vviinn-widgets 2.4.2 → 2.4.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 (93) hide show
  1. package/dist/cjs/Handler-d1a8a86a.js +329 -0
  2. package/dist/cjs/{app-globals-d999d944.js → app-globals-474864e0.js} +1 -1
  3. package/dist/cjs/cropper-handler.cjs.entry.js +27 -0
  4. package/dist/cjs/{customized-slots-90e8e849.js → customized-slots-0aa6c3d6.js} +1 -1
  5. package/dist/cjs/{cropper-handler_27.cjs.entry.js → highlight-box_22.cjs.entry.js} +85 -469
  6. package/dist/cjs/{index-c0d08aca.js → imageSearch.store-076370bf.js} +10575 -14822
  7. package/dist/cjs/index-34d20028.js +3222 -0
  8. package/dist/cjs/{index-e8cf5dc5.js → index-61403ab1.js} +1 -1
  9. package/dist/cjs/{index-53400160.js → index-a87f1a44.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +3 -3
  11. package/dist/cjs/{vviinn-carousel_2.cjs.entry.js → vviinn-carousel_3.cjs.entry.js} +212 -25
  12. package/dist/cjs/vviinn-error.cjs.entry.js +19 -0
  13. package/dist/cjs/vviinn-preloader.cjs.entry.js +26 -0
  14. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +2 -2
  15. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +2 -2
  16. package/dist/cjs/vviinn-vps-button.cjs.entry.js +3 -3
  17. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +162 -0
  18. package/dist/cjs/vviinn-widgets.cjs.js +3 -3
  19. package/dist/collection/components/image-search/search-filters/search-filters.js +1 -1
  20. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +3 -0
  21. package/dist/collection/openApi/index.js +1 -1
  22. package/dist/esm/Handler-639a4cb3.js +308 -0
  23. package/dist/esm/{app-globals-f91c6f94.js → app-globals-3888cd41.js} +1 -1
  24. package/dist/esm/cropper-handler.entry.js +23 -0
  25. package/dist/esm/{customized-slots-7be7f3b8.js → customized-slots-863113e2.js} +1 -1
  26. package/dist/esm/{cropper-handler_27.entry.js → highlight-box_22.entry.js} +21 -400
  27. package/dist/esm/{index-840ec915.js → imageSearch.store-b516d12e.js} +10749 -14986
  28. package/dist/esm/index-2f8fb0fe.js +3213 -0
  29. package/dist/esm/{index-00c7b7c2.js → index-36978848.js} +2 -2
  30. package/dist/esm/{index-d7147986.js → index-56c062df.js} +1 -1
  31. package/dist/esm/loader.js +3 -3
  32. package/dist/esm/{vviinn-carousel_2.entry.js → vviinn-carousel_3.entry.js} +190 -4
  33. package/dist/esm/vviinn-error.entry.js +15 -0
  34. package/dist/esm/vviinn-preloader.entry.js +22 -0
  35. package/dist/esm/vviinn-recommendations-sidebar.entry.js +2 -2
  36. package/dist/esm/vviinn-vpr-button.entry.js +2 -2
  37. package/dist/esm/vviinn-vps-button.entry.js +3 -3
  38. package/dist/esm/vviinn-vps-widget.entry.js +158 -0
  39. package/dist/esm/vviinn-widgets.js +3 -3
  40. package/dist/types/components/image-search/search-filters/search-filters.d.ts +1 -1
  41. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +1 -1
  42. package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +2 -1
  43. package/dist/types/components.d.ts +1 -1
  44. package/dist/types/openApi/index.d.ts +2 -2
  45. package/dist/types/tracking/event.d.ts +1 -1
  46. package/dist/types/tracking/index.d.ts +8 -8
  47. package/dist/types/tracking/models.d.ts +1 -1
  48. package/dist/vviinn-widgets/{p-2d4cb17f.entry.js → p-0a9cee09.entry.js} +1 -1
  49. package/dist/vviinn-widgets/p-28678772.js +1 -0
  50. package/dist/vviinn-widgets/{p-07d8ba79.entry.js → p-2e6ecda7.entry.js} +1 -1
  51. package/dist/vviinn-widgets/{p-dc2da207.js → p-47183c9a.js} +1 -1
  52. package/dist/vviinn-widgets/p-535611cd.entry.js +1 -0
  53. package/dist/vviinn-widgets/p-606ff863.js +1 -0
  54. package/dist/vviinn-widgets/p-9cc6f0dd.entry.js +1 -0
  55. package/{www/build/p-ce96f232.js → dist/vviinn-widgets/p-ac0a2989.js} +1 -1
  56. package/dist/vviinn-widgets/p-ad29e9c5.entry.js +1 -0
  57. package/{www/build/p-a66512b2.js → dist/vviinn-widgets/p-b4caf042.js} +1 -1
  58. package/dist/vviinn-widgets/p-b547a6d0.entry.js +1 -0
  59. package/dist/vviinn-widgets/{p-7d5af04d.js → p-c853cba8.js} +1 -1
  60. package/dist/vviinn-widgets/p-d2097302.entry.js +1 -0
  61. package/dist/vviinn-widgets/p-d8d49616.entry.js +1 -0
  62. package/dist/vviinn-widgets/p-f582db5c.js +1 -0
  63. package/dist/vviinn-widgets/{p-9c7297c8.entry.js → p-f9410382.entry.js} +1 -1
  64. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  65. package/package.json +3 -3
  66. package/www/build/{p-2d4cb17f.entry.js → p-0a9cee09.entry.js} +1 -1
  67. package/www/build/p-28678772.js +1 -0
  68. package/www/build/{p-07d8ba79.entry.js → p-2e6ecda7.entry.js} +1 -1
  69. package/www/build/{p-dc2da207.js → p-47183c9a.js} +1 -1
  70. package/www/build/p-535611cd.entry.js +1 -0
  71. package/www/build/p-606ff863.js +1 -0
  72. package/www/build/p-7c313f33.js +125 -0
  73. package/www/build/p-9cc6f0dd.entry.js +1 -0
  74. package/{dist/vviinn-widgets/p-ce96f232.js → www/build/p-ac0a2989.js} +1 -1
  75. package/www/build/p-ad29e9c5.entry.js +1 -0
  76. package/{dist/vviinn-widgets/p-a66512b2.js → www/build/p-b4caf042.js} +1 -1
  77. package/www/build/p-b547a6d0.entry.js +1 -0
  78. package/www/build/{p-7d5af04d.js → p-c853cba8.js} +1 -1
  79. package/www/build/p-d2097302.entry.js +1 -0
  80. package/www/build/p-d8d49616.entry.js +1 -0
  81. package/www/build/p-e0153ae2.css +6 -0
  82. package/www/build/p-f582db5c.js +1 -0
  83. package/www/build/{p-9c7297c8.entry.js → p-f9410382.entry.js} +1 -1
  84. package/www/build/vviinn-widgets.esm.js +1 -1
  85. package/www/index.html +1 -1
  86. package/dist/vviinn-widgets/p-196479f9.js +0 -1
  87. package/dist/vviinn-widgets/p-ae524f97.entry.js +0 -1
  88. package/dist/vviinn-widgets/p-fce4183d.entry.js +0 -1
  89. package/www/build/p-196479f9.js +0 -1
  90. package/www/build/p-32bb0615.js +0 -1
  91. package/www/build/p-a67898be.css +0 -1
  92. package/www/build/p-ae524f97.entry.js +0 -1
  93. package/www/build/p-fce4183d.entry.js +0 -1
@@ -2,44 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-e8cf5dc5.js');
6
- const index$1 = require('./index-c0d08aca.js');
7
- const index$2 = require('./index-53400160.js');
8
- const customizedSlots = require('./customized-slots-90e8e849.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));
5
+ const index = require('./index-61403ab1.js');
6
+ const imageSearch_store = require('./imageSearch.store-076370bf.js');
7
+ const Handler = require('./Handler-d1a8a86a.js');
8
+ const index$1 = require('./index-a87f1a44.js');
9
+ const customizedSlots = require('./customized-slots-0aa6c3d6.js');
43
10
 
44
11
  // -------------------------------------------------------------------------------------
45
12
  // -------------------------------------------------------------------------------------
@@ -61,6 +28,21 @@ var Ord = {
61
28
  compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
62
29
  };
63
30
 
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
+
64
46
  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)}}";
65
47
 
66
48
  let HighlightBox = class {
@@ -68,10 +50,10 @@ let HighlightBox = class {
68
50
  index.registerInstance(this, hostRef);
69
51
  }
70
52
  getInsetValue() {
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(() => ""));
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(() => ""));
72
54
  }
73
55
  renderImage() {
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(() => ""));
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(() => ""));
75
57
  }
76
58
  render() {
77
59
  return index.h(index.Host, null, this.renderImage());
@@ -101,19 +83,19 @@ let ImageCropper = class {
101
83
  handleHandlerMove(event) {
102
84
  event.preventDefault();
103
85
  event.stopPropagation();
104
- const destination = index$1.fromMouseEvent(event);
105
- const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
86
+ const destination = Handler.fromMouseEvent(event);
87
+ const distance = Handler.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
106
88
  const transformedHandler = {
107
89
  position: distance,
108
90
  direction: this.handlerMoveDirection,
109
91
  };
110
- index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((area) => {
111
- const newSearchArea = index$1.transform(area, transformedHandler);
92
+ imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((area) => {
93
+ const newSearchArea = imageSearch_store.transform(area, transformedHandler);
112
94
  if (this.outOfBounds(newSearchArea))
113
95
  return;
114
- index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
96
+ imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(newSearchArea);
115
97
  this.mouseStartPoint = destination;
116
- index$1.imageSearchState.detectedObject = undefined;
98
+ imageSearch_store.imageSearchState.detectedObject = undefined;
117
99
  }));
118
100
  }
119
101
  outOfBounds(area) {
@@ -127,23 +109,23 @@ let ImageCropper = class {
127
109
  handleCropperMove(ev) {
128
110
  ev.preventDefault();
129
111
  ev.stopPropagation();
130
- const destination = index$1.fromMouseEvent(ev);
131
- const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
132
- index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((searchArea) => {
133
- const newSearchArea = index$1.move(searchArea, distance);
112
+ const destination = Handler.fromMouseEvent(ev);
113
+ const distance = Handler.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
114
+ imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((searchArea) => {
115
+ const newSearchArea = imageSearch_store.move(searchArea, distance);
134
116
  if (newSearchArea.x < 0 ||
135
117
  newSearchArea.y < 0 ||
136
118
  this.bounds.height - (newSearchArea.y + newSearchArea.height) < 0 ||
137
119
  this.bounds.width - (newSearchArea.x + newSearchArea.width) < 0)
138
120
  return;
139
- index$1.imageSearchState.detectedObject = undefined;
140
- index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
121
+ imageSearch_store.imageSearchState.detectedObject = undefined;
122
+ imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(newSearchArea);
141
123
  this.mouseStartPoint = destination;
142
124
  }));
143
125
  }
144
126
  handlePointerDown(event) {
145
127
  event.stopPropagation();
146
- this.mouseStartPoint = index$1.fromMouseEvent(event);
128
+ this.mouseStartPoint = Handler.fromMouseEvent(event);
147
129
  // should be htmlelement or handler
148
130
  const target = findTarget(event);
149
131
  if (target.localName === "cropper-handler") {
@@ -163,18 +145,18 @@ let ImageCropper = class {
163
145
  this.el.removeEventListener("pointermove", this.pointerMoveListener);
164
146
  document.removeEventListener("pointerup", this.pointerReleaseListener);
165
147
  this.mouseStartPoint = undefined;
166
- index$1.makeRectangularSearchRequest();
148
+ imageSearch_store.makeRectangularSearchRequest();
167
149
  this.cropperChanged.emit();
168
150
  }
169
151
  getStyleMap() {
170
- return index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((rectangle) => {
152
+ return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((rectangle) => {
171
153
  return {
172
154
  width: `${rectangle.width}px`,
173
155
  height: `${rectangle.height}px`,
174
156
  transform: `translate3d(${rectangle.x}px, ${rectangle.y}px, 0)`,
175
157
  cursor: this.handleMove ? "move" : "default",
176
158
  };
177
- }), index$1.Option.getOrElse(() => {
159
+ }), imageSearch_store.Option.getOrElse(() => {
178
160
  return {};
179
161
  }));
180
162
  }
@@ -183,7 +165,7 @@ let ImageCropper = class {
183
165
  "crop-area": true,
184
166
  active: this.handleMove,
185
167
  disabled: this.disabled,
186
- }, 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) }))))));
168
+ }, 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) }))))));
187
169
  }
188
170
  get el() { return index.getElement(this); }
189
171
  };
@@ -209,12 +191,12 @@ let SearchFilters = class {
209
191
  }
210
192
  selectFilter(filter) {
211
193
  this.selectedCategoryId = getFilterId(filter);
212
- index$1.imageSearchState.activeIonLink = filter;
194
+ imageSearch_store.imageSearchState.activeIonLink = filter;
213
195
  this.filterSelected.emit("select");
214
196
  }
215
197
  clearSelectedFilter() {
216
198
  this.selectedCategoryId = null;
217
- index$1.imageSearchState.activeIonLink = undefined;
199
+ imageSearch_store.imageSearchState.activeIonLink = undefined;
218
200
  this.findSelectedFilter().blur();
219
201
  this.filterSelected.emit("deselect");
220
202
  }
@@ -241,7 +223,7 @@ let SearchFilters = class {
241
223
  }, style: { "animation-delay": `${n * 10}ms` }, onPointerUp: (ev) => {
242
224
  ev.stopPropagation();
243
225
  this.handleFilterSelection(f);
244
- }, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$2.CheckIcon, null) : null, f.name))), index.h("div", { class: {
226
+ }, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$1.CheckIcon, null) : null, f.name))), index.h("div", { class: {
245
227
  filter: true,
246
228
  "show-more": true,
247
229
  hidden: this.filter.filters.length <= FILTERS_COUNT,
@@ -265,31 +247,31 @@ let VviinnDetectedObject = class {
265
247
  this.position = ["0", "0"];
266
248
  }
267
249
  getObjectPosition() {
268
- return index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
269
- const objectRectangle = index$1.fromAlt(index$1.foldValueObject(this.detectedObject).rectangle);
270
- const { x, y } = index$1._function.pipe(objectRectangle, index$1.scaleWithSized(bounds), index$1.center);
250
+ return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageBounds, imageSearch_store.Option.map((bounds) => {
251
+ const objectRectangle = imageSearch_store.fromAlt(imageSearch_store.foldValueObject(this.detectedObject).rectangle);
252
+ const { x, y } = imageSearch_store._function.pipe(objectRectangle, imageSearch_store.scaleWithSized(bounds), imageSearch_store.center);
271
253
  return [`${x}px`, `${y}px`];
272
- }), index$1.Option.getOrElse(() => ["0", "0"]));
254
+ }), imageSearch_store.Option.getOrElse(() => ["0", "0"]));
273
255
  }
274
256
  selectDetectedObject() {
275
- index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
276
- const rectangle = index$1.foldValueObject(this.detectedObject).rectangle;
277
- const transformedRect = index$1.fromAlt(rectangle);
278
- const scaledRect = index$1.scaleWithSized(bounds)(transformedRect);
279
- index$1.imageSearchState.detectedObject = this.detectedObject;
280
- index$1.imageSearchState.searchArea = index$1.Option.some(scaledRect);
257
+ imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageBounds, imageSearch_store.Option.map((bounds) => {
258
+ const rectangle = imageSearch_store.foldValueObject(this.detectedObject).rectangle;
259
+ const transformedRect = imageSearch_store.fromAlt(rectangle);
260
+ const scaledRect = imageSearch_store.scaleWithSized(bounds)(transformedRect);
261
+ imageSearch_store.imageSearchState.detectedObject = this.detectedObject;
262
+ imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(scaledRect);
281
263
  }));
282
- index$1.makeRectangularSearchRequest();
264
+ imageSearch_store.makeRectangularSearchRequest();
283
265
  this.detectedObjectClicked.emit();
284
266
  }
285
267
  isActive() {
286
268
  if (!this.detectedObject)
287
269
  return false;
288
- if (!index$1.imageSearchState.detectedObject)
270
+ if (!imageSearch_store.imageSearchState.detectedObject)
289
271
  return false;
290
- const thisObject = index$1.foldValueObject(this.detectedObject);
291
- const savedObject = index$1.foldValueObject(index$1.imageSearchState.detectedObject);
292
- return index$1.detectedObjectEq.equals(thisObject, savedObject);
272
+ const thisObject = imageSearch_store.foldValueObject(this.detectedObject);
273
+ const savedObject = imageSearch_store.foldValueObject(imageSearch_store.imageSearchState.detectedObject);
274
+ return imageSearch_store.detectedObjectEq.equals(thisObject, savedObject);
293
275
  }
294
276
  render() {
295
277
  return (index.h(index.Host, { class: {
@@ -315,18 +297,6 @@ let VviinnEmptyResults = class {
315
297
  };
316
298
  VviinnEmptyResults.style = vviinnEmptyResultsCss;
317
299
 
318
- 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}";
319
-
320
- let VviinnError = class {
321
- constructor(hostRef) {
322
- index.registerInstance(this, hostRef);
323
- }
324
- render() {
325
- 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" })));
326
- }
327
- };
328
- VviinnError.style = vviinnErrorCss;
329
-
330
300
  const vviinnExampleImageCss = ":host{display:block;margin-bottom:8px;position:relative}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;pointer-events:none;position:absolute;right:12px;z-index:4}vviinn-preloader{--preloader-size:12px}@media (max-width: 640px){.image-preloader{display:block}}";
331
301
 
332
302
  let VviinnExampleImage = class {
@@ -341,14 +311,14 @@ let VviinnExampleImage = class {
341
311
  }
342
312
  async selectImage(_event) {
343
313
  this.selected = true;
344
- const file = await index$1.toFile(this.src);
345
- const processResult = await index$1.processSelectedFile(file);
346
- index$1._function.pipe(processResult, index$1.Either.match(() => this.exampleImageError.emit(), () => this.exampleImageSelected.emit()));
314
+ const file = await imageSearch_store.toFile(this.src);
315
+ const processResult = await imageSearch_store.processSelectedFile(file);
316
+ imageSearch_store._function.pipe(processResult, imageSearch_store.Either.match(() => this.exampleImageError.emit(), () => this.exampleImageSelected.emit()));
347
317
  this.selected = false;
348
318
  }
349
319
  showPreloader() {
350
- return ((index$1.imageSearchState.objectDetectionInProgress ||
351
- index$1.imageSearchState.loading) &&
320
+ return ((imageSearch_store.imageSearchState.objectDetectionInProgress ||
321
+ imageSearch_store.imageSearchState.loading) &&
352
322
  this.selected);
353
323
  }
354
324
  render() {
@@ -391,12 +361,12 @@ let VviinnImageSelector = class {
391
361
  }
392
362
  async handleInputChange(event) {
393
363
  const input = event.target;
394
- const processingResult = await index$1.processSelectedFile(input.files[0]);
395
- index$1._function.pipe(processingResult, index$1.match(() => this.imageSelectedError.emit(), () => this.imageSelected.emit()));
364
+ const processingResult = await imageSearch_store.processSelectedFile(input.files[0]);
365
+ imageSearch_store._function.pipe(processingResult, imageSearch_store.match(() => this.imageSelectedError.emit(), () => this.imageSelected.emit()));
396
366
  input.value = null;
397
367
  }
398
368
  isLoading() {
399
- return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
369
+ return (imageSearch_store.imageSearchState.loading || imageSearch_store.imageSearchState.objectDetectionInProgress);
400
370
  }
401
371
  render() {
402
372
  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) })));
@@ -407,8 +377,8 @@ VviinnImageSelector.style = vviinnImageSelectorCss;
407
377
  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}";
408
378
 
409
379
  const getImageSizes = (i) => {
410
- const dimensions = index$1.dimensionsFromImage(i);
411
- const resize = index$1.scaleByLargestSide(288);
380
+ const dimensions = imageSearch_store.dimensionsFromImage(i);
381
+ const resize = imageSearch_store.scaleByLargestSide(288);
412
382
  const newDimensions = resize(dimensions);
413
383
  const sizes = newDimensions.map(d => d.size);
414
384
  return [sizes[0], sizes[1]];
@@ -419,34 +389,34 @@ let VviinnImageView = class {
419
389
  }
420
390
  handleInitialImageLoad(ev) {
421
391
  const target = ev.target;
422
- const imageBounds = index$1.fromImage(target);
392
+ const imageBounds = imageSearch_store.fromImage(target);
423
393
  const padding = 12;
424
- const { x, y } = index$1.move(imageBounds, { x: padding, y: padding });
394
+ const { x, y } = imageSearch_store.move(imageBounds, { x: padding, y: padding });
425
395
  const searchArea = {
426
396
  x,
427
397
  y,
428
398
  width: imageBounds.width - padding * 2,
429
399
  height: imageBounds.height - padding * 2,
430
400
  };
431
- index$1.imageSearchState.imageBounds = index$1.Option.some(imageBounds);
432
- index$1.imageSearchState.searchArea = index$1.Option.some(searchArea);
401
+ imageSearch_store.imageSearchState.imageBounds = imageSearch_store.Option.some(imageBounds);
402
+ imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(searchArea);
433
403
  }
434
404
  renderDetectedObject(object) {
435
405
  return index.h("vviinn-detected-object", { detectedObject: object });
436
406
  }
437
407
  renderImage() {
438
- return index$1._function.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.image), index$1.Option.map(([url, refImage]) => {
408
+ return imageSearch_store._function.pipe(imageSearch_store.sequenceToOption(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.imageSearchState.image), imageSearch_store.Option.map(([url, refImage]) => {
439
409
  const [width, height] = getImageSizes(refImage);
440
410
  const image = (index.h("img", { decoding: "async", width: width, height: height, src: url, onLoad: (el) => this.handleInitialImageLoad(el), draggable: false }));
441
411
  return image;
442
- }), index$1.Option.getOrElse(() => null));
412
+ }), imageSearch_store.Option.getOrElse(() => null));
443
413
  }
444
414
  renderCropper() {
445
- return index$1._function.pipe(index$1.imageSearchState.imageUrl, index$1.Option.map(() => index.h("image-cropper", null)), index$1.Option.getOrElse(() => null));
415
+ return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.Option.map(() => index.h("image-cropper", null)), imageSearch_store.Option.getOrElse(() => null));
446
416
  }
447
417
  render() {
448
- return (index.h(index.Host, null, index$1.imageSearchState.loading ||
449
- 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))));
418
+ return (index.h(index.Host, null, imageSearch_store.imageSearchState.loading ||
419
+ 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))));
450
420
  }
451
421
  };
452
422
  VviinnImageView.style = vviinnImageViewCss;
@@ -504,7 +474,7 @@ let VviinnOnboardingCard1 = class {
504
474
  customizedSlots.slotChangeListener(this, this.el);
505
475
  }
506
476
  render() {
507
- 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.")))));
477
+ 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.")))));
508
478
  }
509
479
  get el() { return index.getElement(this); }
510
480
  };
@@ -520,7 +490,7 @@ let VviinnOnboardingCard2 = class {
520
490
  customizedSlots.slotChangeListener(this, this.el);
521
491
  }
522
492
  render() {
523
- 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.")))));
493
+ 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.")))));
524
494
  }
525
495
  get el() { return index.getElement(this); }
526
496
  };
@@ -536,7 +506,7 @@ let VviinnOnboardingCard3 = class {
536
506
  customizedSlots.slotChangeListener(this, this.el);
537
507
  }
538
508
  render() {
539
- 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.")))));
509
+ 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.")))));
540
510
  }
541
511
  get el() { return index.getElement(this); }
542
512
  };
@@ -569,23 +539,6 @@ let VviinnOverlayedModal = class {
569
539
  };
570
540
  VviinnOverlayedModal.style = vviinnOverlayedModalCss;
571
541
 
572
- 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)}}";
573
-
574
- let VviinnPreloader = class {
575
- constructor(hostRef) {
576
- index.registerInstance(this, hostRef);
577
- }
578
- isActive() {
579
- return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
580
- }
581
- render() {
582
- return (index.h(index.Host, { class: {
583
- active: this.isActive(),
584
- } }));
585
- }
586
- };
587
- VviinnPreloader.style = vviinnPreloaderCss;
588
-
589
542
  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}";
590
543
 
591
544
  let VviinnPrivacyBadge = class {
@@ -602,190 +555,6 @@ let VviinnPrivacyBadge = class {
602
555
  };
603
556
  VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
604
557
 
605
- class GtagAnalytics {
606
- sendImpression(product) {
607
- var _a, _b, _c;
608
- gtag('event', 'view_item_list', {
609
- items: [
610
- {
611
- id: product.productId,
612
- name: product.title,
613
- brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
614
- category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
615
- list_name: 'VI VPR View',
616
- price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
617
- }
618
- ]
619
- });
620
- return undefined;
621
- }
622
- sendClick(product) {
623
- var _a, _b, _c;
624
- gtag('event', 'select_content', {
625
- content_type: 'product',
626
- items: [
627
- {
628
- id: product.productId,
629
- name: product.title,
630
- brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
631
- category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
632
- list_name: 'VI VPR View',
633
- price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
634
- }
635
- ]
636
- });
637
- return undefined;
638
- }
639
- }
640
-
641
- class GAnalytics {
642
- constructor() {
643
- ga('require', 'ec');
644
- }
645
- convertProduct(product) {
646
- var _a, _b, _c;
647
- return {
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: 'VI VPR View',
653
- price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
654
- };
655
- }
656
- sendImpression(product) {
657
- ga('ec:addImpression', this.convertProduct(product));
658
- return undefined;
659
- }
660
- sendClick(product) {
661
- var _a, _b, _c;
662
- ga('ec:addProduct', {
663
- id: product.productId,
664
- name: product.title,
665
- brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
666
- category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
667
- price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
668
- });
669
- ga('ec:setAction', 'click', { list: 'VI VPR View' });
670
- return undefined;
671
- }
672
- }
673
-
674
- const getGtagAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.gtag), index$1.Option.map(() => new GtagAnalytics()));
675
- const getCommonAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.ga), index$1.Option.map(() => new GAnalytics()));
676
- const analyticsMonoid = index$1.Option.getMonoid(index$1.Semigroup.first());
677
- const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
678
-
679
- const FIT_EXPR = /fit\/\d+\//;
680
- const containsFit = (url) => {
681
- return index$1._function.pipe(url.match(FIT_EXPR), index$1.Either.fromNullable(url), index$1.Either.map(() => url));
682
- };
683
- const processWidth = (url, size) => {
684
- return index$1._function.pipe(containsFit(url), index$1.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), index$1.Either.getOrElse(() => url));
685
- };
686
- const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
687
- const FormattedPrice = (props) => {
688
- var _a;
689
- const locale = props.locale;
690
- const formattedPrice = new Intl.NumberFormat(locale, {
691
- minimumFractionDigits: 2,
692
- }).format(props.price);
693
- const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
694
- return (index.h("span", { class: "price-amount", part: "price-amount" }, fullPrice));
695
- };
696
- const Price = (props) => {
697
- const priceEl = (index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale }));
698
- return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
699
- index.h("span", { class: "price-sale", part: "price-sale" },
700
- index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale })),
701
- index.h("span", { class: "price-outdated", part: "price-outdated" }, priceEl),
702
- ]) : (index.h("span", { class: "price-regular", part: "price-regular" }, priceEl))));
703
- };
704
- const Image = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
705
- 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 })));
706
- const ResponsiveImage = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
707
- index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
708
-
709
- 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}";
710
-
711
- let VviinnProductCard = class {
712
- constructor(hostRef) {
713
- index.registerInstance(this, hostRef);
714
- this.recommendationLoad = index.createEvent(this, "recommendationLoad", 7);
715
- this.recommendationView = index.createEvent(this, "recommendationView", 7);
716
- this.recommendationClick = index.createEvent(this, "recommendationClick", 7);
717
- this.productImageLoaded = index.createEvent(this, "productImageLoaded", 7);
718
- this.currency = undefined;
719
- this.imageRatio = 1;
720
- this.imageWidth = 200;
721
- this.locale = undefined;
722
- this.pricePrefix = undefined;
723
- this.responsive = false;
724
- this.dimmedBackground = false;
725
- /** @internal */
726
- this.index = 0;
727
- this.imageLoaded = false;
728
- this.productData = null;
729
- this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
730
- }
731
- connectedCallback() {
732
- this.productData = {
733
- product: this.productId,
734
- rank: this.index
735
- };
736
- }
737
- intersectionCallback(data) {
738
- if (data.some((entry) => entry.isIntersecting)) {
739
- index$1._function.pipe(getAnalyticsModule, index$1.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
740
- this.recommendationView.emit(this.productData);
741
- this.intersectionObserver.disconnect();
742
- }
743
- }
744
- componentDidLoad() {
745
- this.recommendationLoad.emit(this.productData);
746
- this.intersectionObserver.observe(this.el);
747
- const links = this.el.shadowRoot.querySelectorAll("a");
748
- links.forEach((link) => link.addEventListener("mousedown", (event) => {
749
- this.recommendationClick.emit(this.productData);
750
- if (window.ga) {
751
- event.preventDefault();
752
- }
753
- index$1._function.pipe(getAnalyticsModule, index$1.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
754
- if (window.ga) {
755
- ga("send", "event", "UX", "click", "Results", {
756
- hitCallback: function () {
757
- document.location.href = this.deeplink;
758
- },
759
- });
760
- }
761
- }));
762
- }
763
- getProduct() {
764
- return index$1.imageSearchState.results.find((r) => r.productId === this.productId);
765
- }
766
- renderImage() {
767
- const props = {
768
- width: this.imageWidth,
769
- height: this.imageWidth * this.imageRatio,
770
- src: this.image,
771
- title: this.productTitle,
772
- lazy: false,
773
- };
774
- return this.responsive
775
- ? ResponsiveImage(props, () => this.kek())
776
- : Image(props, () => this.kek());
777
- }
778
- kek() {
779
- this.productImageLoaded.emit(this.productId);
780
- }
781
- render() {
782
- var _a, _b, _c;
783
- return (index.h(index.Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, 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 })));
784
- }
785
- get el() { return index.getElement(this); }
786
- };
787
- VviinnProductCard.style = vviinnProductCardCss;
788
-
789
558
  const vviinnServerErrorCss = ":host{display:block}";
790
559
 
791
560
  let VviinnServerError = class {
@@ -819,7 +588,7 @@ const getStyleMap = (data) => {
819
588
  };
820
589
  };
821
590
  const Arrow = ({ kind, tabindex, disabled, onClick, onKeyDown, }) => (index.h("div", { class: getStyleMap({ kind, disabled }), onClick: onClick, tabindex: tabindex, onKeyDown: onKeyDown },
822
- index.h(index$2.ArrowIcon, null)));
591
+ index.h(index$1.ArrowIcon, null)));
823
592
 
824
593
  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;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}";
825
594
 
@@ -828,7 +597,7 @@ let VviinnSlider = class {
828
597
  index.registerInstance(this, hostRef);
829
598
  this.elementsCount = 0;
830
599
  this.internalPosition = 0;
831
- this.swipeStartPosition = index$1.Option.none;
600
+ this.swipeStartPosition = imageSearch_store.Option.none;
832
601
  this.showBullets = true;
833
602
  this.position = 0;
834
603
  this.showArrows = false;
@@ -858,7 +627,7 @@ let VviinnSlider = class {
858
627
  this.setActiveCssClassToSlide(index);
859
628
  }
860
629
  renderBullets() {
861
- return this.showBullets ? (index.h("div", { class: "controls" }, index$1.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
630
+ return this.showBullets ? (index.h("div", { class: "controls" }, imageSearch_store.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
862
631
  bullet: true,
863
632
  active: i == this.internalPosition % this.elementsCount,
864
633
  }, onClick: () => this.goToSlide(i) }))))) : null;
@@ -895,13 +664,13 @@ let VviinnSlider = class {
895
664
  handleTouchStart(event) {
896
665
  if (!this.showBullets)
897
666
  return;
898
- this.swipeStartPosition = index$1._function.pipe(event.touches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
667
+ this.swipeStartPosition = imageSearch_store._function.pipe(event.touches[0], imageSearch_store.Option.fromNullable, imageSearch_store.Option.map((t) => t.clientX));
899
668
  }
900
669
  handleTouchEnd(event) {
901
670
  if (!this.showBullets)
902
671
  return;
903
- const swipeEndPosition = index$1._function.pipe(event.changedTouches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
904
- 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) => {
672
+ const swipeEndPosition = imageSearch_store._function.pipe(event.changedTouches[0], imageSearch_store.Option.fromNullable, imageSearch_store.Option.map((t) => t.clientX));
673
+ 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) => {
905
674
  switch (swipeDirection) {
906
675
  case 1:
907
676
  return this.nextSlide();
@@ -941,154 +710,6 @@ let VviinnTeaser = class {
941
710
  };
942
711
  VviinnTeaser.style = vviinnTeaserCss;
943
712
 
944
- 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}";
945
-
946
- let VviinnVpsWidget = class {
947
- constructor(hostRef) {
948
- index.registerInstance(this, hostRef);
949
- /** @internal */
950
- this.apiPath = "https://api.vviinn.com";
951
- /** When true modal window with widget will be shown */
952
- this.active = false;
953
- /** Currency sign will shown after price */
954
- this.currencySign = "€";
955
- /** Locale for currency formatting */
956
- this.locale = "de-DE";
957
- this.slidePosition = 0;
958
- this.width = 0;
959
- this.wrongImageFormat = false;
960
- this.imageSource = null;
961
- }
962
- activeWatcher(value) {
963
- if (value) {
964
- this.overflow = document.body.style.overflow;
965
- document.body.style.overflow = "hidden";
966
- }
967
- else {
968
- document.body.style.overflow = this.overflow;
969
- }
970
- }
971
- trackRecommendationView({ detail }) {
972
- const recommendationViewEvent = index$1.createProductViewVpsEvent(Object.assign({ session_id: this.uiSessionId }, detail));
973
- this.trackingApi.trackEvent(recommendationViewEvent);
974
- }
975
- trackRecommendationClick({ detail }) {
976
- const recommendationClickEvent = index$1.createProductViewVpsEvent(Object.assign({ sessionId: this.uiSessionId }, detail));
977
- this.trackingApi.trackEvent(recommendationClickEvent);
978
- }
979
- trachSearchAreaChanges() {
980
- const searchEvent = index$1.createSearchEvent({
981
- session_id: this.uiSessionId,
982
- source: this.imageSource,
983
- search_area: "manual-selection",
984
- });
985
- this.trackingApi.trackEvent(searchEvent);
986
- }
987
- trackDetectedObject() {
988
- const searchEvent = index$1.createSearchEvent({
989
- session_id: this.uiSessionId,
990
- source: this.imageSource,
991
- search_area: "attention-point",
992
- });
993
- this.trackingApi.trackEvent(searchEvent);
994
- }
995
- trackFilter({ detail }) {
996
- const searchEvent = index$1.createFilterEvent({
997
- session_id: this.uiSessionId,
998
- source: this.imageSource,
999
- kind: "category",
1000
- action: detail,
1001
- });
1002
- this.trackingApi.trackEvent(searchEvent);
1003
- }
1004
- componentWillLoad() {
1005
- customizedSlots.slotChangeListener(this, this.el);
1006
- }
1007
- connectedCallback() {
1008
- index$1.state.apiPath = this.apiPath;
1009
- index$1.state.currencySign = this.currencySign;
1010
- index$1.state.locale = this.locale;
1011
- index$1.imageSearchState.token = this.token;
1012
- this.uiSessionId = index$1.v4();
1013
- this.trackingApi = index$1.createTrackingApi(this.apiPath, this.token);
1014
- const widgetOpenEvent = index$1.createWidgetVpsEvent({
1015
- action: "open",
1016
- session_id: this.uiSessionId,
1017
- });
1018
- this.trackingApi.trackEvent(widgetOpenEvent);
1019
- }
1020
- handleImageSelection(source) {
1021
- this.imageSource = source;
1022
- this.slidePosition = 1;
1023
- const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
1024
- const overlay = root.shadowRoot.querySelector("vviinn-overlay");
1025
- const modal = overlay.querySelector("vviinn-modal");
1026
- const modalBody = modal.shadowRoot.querySelector(".body");
1027
- modalBody.scrollTop = 0;
1028
- this.trackInitialSearch();
1029
- }
1030
- trackInitialSearch() {
1031
- const searchEvent = index$1.createSearchEvent({
1032
- session_id: this.uiSessionId,
1033
- source: this.imageSource,
1034
- search_area: "full",
1035
- });
1036
- this.trackingApi.trackEvent(searchEvent);
1037
- }
1038
- resetState() {
1039
- this.resetScroll("onboarding-block");
1040
- this.slidePosition = 0;
1041
- index$1.imageSearchState.image = index$1.Option.none;
1042
- index$1.imageSearchState.imageUrl = index$1.Option.none;
1043
- index$1.imageSearchState.imageBounds = index$1.Option.none;
1044
- index$1.imageSearchState.searchArea = index$1.Option.none;
1045
- index$1.imageSearchState.results = [];
1046
- index$1.imageSearchState.filters = [];
1047
- index$1.imageSearchState.detectedObjects = [];
1048
- index$1.imageSearchState.activeIonLink = undefined;
1049
- index$1.imageSearchState.rectangleSearchForm = undefined;
1050
- this.resetScroll("results-block");
1051
- }
1052
- haveErrors() {
1053
- return this.wrongImageFormat || index$1.imageSearchState.serverError;
1054
- }
1055
- resetScroll(elementId, behavior = "auto") {
1056
- const element = this.el.shadowRoot.getElementById(elementId);
1057
- element.scroll({ top: 0, left: 0, behavior });
1058
- }
1059
- handleModalClose() {
1060
- this.active = false;
1061
- this.resetState();
1062
- const elementsToReset = ["onboarding-block", "results-block"];
1063
- elementsToReset.forEach((name) => this.resetScroll(name));
1064
- const widgetOpenEvent = index$1.createWidgetVpsEvent({
1065
- action: "close",
1066
- session_id: this.uiSessionId,
1067
- });
1068
- this.trackingApi.trackEvent(widgetOpenEvent);
1069
- }
1070
- render() {
1071
- return (index.h(index.Host, 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" }, index.h("vviinn-slider", { showBullets: false, position: this.slidePosition }, index.h("vviinn-slide", { class: { "start-page": true } }, index.h("div", { class: {
1072
- error: this.haveErrors(),
1073
- "start-page_block": true,
1074
- } }, 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", { 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: {
1075
- "nothing-found": true,
1076
- hidden: index$1.imageSearchState.results.length > 0,
1077
- } }, index.h("vviinn-empty-results", null), index.h("vviinn-onboarding", null)), index.h("div", { class: {
1078
- hidden: index$1.imageSearchState.results.length <= 0,
1079
- products: true,
1080
- } }, index$1.imageSearchState.results.map((p, i) => {
1081
- var _a;
1082
- 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 }));
1083
- }))))))));
1084
- }
1085
- get el() { return index.getElement(this); }
1086
- static get watchers() { return {
1087
- "active": ["activeWatcher"]
1088
- }; }
1089
- };
1090
- VviinnVpsWidget.style = vviinnVpsWidgetCss;
1091
-
1092
713
  const vviinnWrongFormatCss = ":host{display:block}";
1093
714
 
1094
715
  let VviinnWrongFormat = class {
@@ -1102,13 +723,11 @@ let VviinnWrongFormat = class {
1102
723
  };
1103
724
  VviinnWrongFormat.style = vviinnWrongFormatCss;
1104
725
 
1105
- exports.cropper_handler = CropperHandler;
1106
726
  exports.highlight_box = HighlightBox;
1107
727
  exports.image_cropper = ImageCropper;
1108
728
  exports.search_filters = SearchFilters;
1109
729
  exports.vviinn_detected_object = VviinnDetectedObject;
1110
730
  exports.vviinn_empty_results = VviinnEmptyResults;
1111
- exports.vviinn_error = VviinnError;
1112
731
  exports.vviinn_example_image = VviinnExampleImage;
1113
732
  exports.vviinn_example_images = VviinnExampleImages;
1114
733
  exports.vviinn_image_selector = VviinnImageSelector;
@@ -1120,12 +739,9 @@ exports.vviinn_onboarding_card_2 = VviinnOnboardingCard2;
1120
739
  exports.vviinn_onboarding_card_3 = VviinnOnboardingCard3;
1121
740
  exports.vviinn_overlay = VviinnOverlay;
1122
741
  exports.vviinn_overlayed_modal = VviinnOverlayedModal;
1123
- exports.vviinn_preloader = VviinnPreloader;
1124
742
  exports.vviinn_privacy_badge = VviinnPrivacyBadge;
1125
- exports.vviinn_product_card = VviinnProductCard;
1126
743
  exports.vviinn_server_error = VviinnServerError;
1127
744
  exports.vviinn_slide = VviinnSlide;
1128
745
  exports.vviinn_slider = VviinnSlider;
1129
746
  exports.vviinn_teaser = VviinnTeaser;
1130
- exports.vviinn_vps_widget = VviinnVpsWidget;
1131
747
  exports.vviinn_wrong_format = VviinnWrongFormat;