vviinn-widgets 2.158.2 → 2.159.0

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.
@@ -14,7 +14,7 @@ function fromString(s) {
14
14
  return s === "VPR" ? { _tag: "VPR" } : { _tag: "VCS" };
15
15
  }
16
16
 
17
- const version = "2.158.2";
17
+ const version = "2.159.0";
18
18
 
19
19
  exports.campaignTypeNames = campaignTypeNames;
20
20
  exports.fold = fold;
@@ -7,7 +7,7 @@ const search_store = require('./search.store-5c334453.js');
7
7
  const customizedSlots = require('./customized-slots-a9416ea3.js');
8
8
  const index$1 = require('./index-601ae273.js');
9
9
  const Rectangle = require('./Rectangle-baf86229.js');
10
- const _package = require('./package-fc8274cf.js');
10
+ const _package = require('./package-442ca80c.js');
11
11
  const resources = require('./resources-9a669f8f.js');
12
12
  const index$2 = require('./index-bbed84c5.js');
13
13
  const constants = require('./constants-21309688.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1a40d6c9.js');
6
6
  const search_store = require('./search.store-5c334453.js');
7
- const _package = require('./package-fc8274cf.js');
7
+ const _package = require('./package-442ca80c.js');
8
8
  const index$1 = require('./index-601ae273.js');
9
9
  const Rectangle = require('./Rectangle-baf86229.js');
10
10
  const customizedSlots = require('./customized-slots-a9416ea3.js');
@@ -7,7 +7,7 @@ const search_store = require('./search.store-5c334453.js');
7
7
  const Rectangle = require('./Rectangle-baf86229.js');
8
8
  const WarningIcon = require('./WarningIcon-db443b71.js');
9
9
  const customizedSlots = require('./customized-slots-a9416ea3.js');
10
- const _package = require('./package-fc8274cf.js');
10
+ const _package = require('./package-442ca80c.js');
11
11
  const index$1 = require('./index-bbed84c5.js');
12
12
 
13
13
  const SecondaryActionIcon = () => (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" },
@@ -12,6 +12,6 @@ function fromString(s) {
12
12
  return s === "VPR" ? { _tag: "VPR" } : { _tag: "VCS" };
13
13
  }
14
14
 
15
- const version = "2.158.2";
15
+ const version = "2.159.0";
16
16
 
17
17
  export { fold as a, campaignTypeNames as c, fromString as f, version as v };
@@ -3,7 +3,7 @@ import { l as toFile, _ as _function, n as makeUploadFileRequest, E as Either, o
3
3
  import { s as slotChangeListener, p as productCardSlotNames, v as vprIconSlotName, S as SlotSkeleton } from './customized-slots-0f854530.js';
4
4
  import { P as PlusIcon, R as RESULTS_CALCULATED_COLUMNS_CSS_VAR, e as createWidgetEvent, j as createFilterEvent, v as v4, c as createAddToBasketEvent, d as createAddToWishlistEvent, f as createResultEventByType, h as createProductEventByType, g as getCustomLabels, k as createImageSearchEvent } from './index-3c9c6402.js';
5
5
  import { f as fromImage, i as instance } from './Rectangle-abec127b.js';
6
- import { c as campaignTypeNames, v as version } from './package-d93b3a3a.js';
6
+ import { c as campaignTypeNames, v as version } from './package-7b73d407.js';
7
7
  import { r as resources } from './resources-4651fe88.js';
8
8
  import { a as productCardParts, m as modalParts, f as filtersParts, b as extendedFiltersParts, s as searchBarParts, c as searchWidgetFilterParts, d as searchWidgetButtonParts } from './index-47360621.js';
9
9
  import { R as RESULTS_WIDGET_IMAGE_RESOLUTION_WIDTH, f as findSlotElements, g as getSlotNames, S as SEARCH_WIDGET_IMAGE_RESOLUTION_WIDTH, D as DEFAULT_EXAMPLE_IMAGE } from './constants-7fd90481.js';
@@ -1,6 +1,6 @@
1
1
  import { h, r as registerInstance, c as createEvent, F as Fragment, H as Host, g as getElement } from './index-057b9128.js';
2
2
  import { h as has, t as tuple, a as addIfNotEmpty, _ as _function, b as _Array, g as globalState, s as searchState, c as componentsState, O as Option, S as Semigroup, E as Either, p as pipe, d as chainW, m as makeRequest, f as fromEither, e as getApiPath, i as createInitPostRequest, A as Apply, u as updateGlobalState, j as trackEvent, T as TaskEither } from './search.store-273df781.js';
3
- import { c as campaignTypeNames, f as fromString, a as fold, v as version } from './package-d93b3a3a.js';
3
+ import { c as campaignTypeNames, f as fromString, a as fold, v as version } from './package-7b73d407.js';
4
4
  import { C as CAROUSEL_IMAGE_WIDTH_CSS_VAR, S as SET_MODE_IMAGE_WIDTH_CSS_VAR, a as CAROUSEL_CONTENT_WIDTH_CSS_VAR, R as RESULTS_CALCULATED_COLUMNS_CSS_VAR, D as DEFAULT_COLUMNS_NUMBER, b as CONTENT_GROUP_CSS_CLASS, g as getCustomLabels, P as PlusIcon, v as v4, c as createAddToBasketEvent, d as createAddToWishlistEvent, e as createWidgetEvent, f as createResultEventByType, h as createProductEventByType, i as getRecommendationsBody } from './index-3c9c6402.js';
5
5
  import { i as instance, a as isClickedInRectBound } from './Rectangle-abec127b.js';
6
6
  import { s as slotChangeListener, S as SlotSkeleton } from './customized-slots-0f854530.js';
@@ -3,7 +3,7 @@ import { _ as _function, O as Option, D as detectedObjectEq, s as searchState, a
3
3
  import { s as scaleWithSized, c as center, i as instance } from './Rectangle-abec127b.js';
4
4
  import { W as WarningIcon } from './WarningIcon-7896b328.js';
5
5
  import { s as slotChangeListener } from './customized-slots-0f854530.js';
6
- import { c as campaignTypeNames, v as version } from './package-d93b3a3a.js';
6
+ import { c as campaignTypeNames, v as version } from './package-7b73d407.js';
7
7
  import { m as modalParts } from './index-47360621.js';
8
8
 
9
9
  const SecondaryActionIcon = () => (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" },
@@ -1,4 +1,4 @@
1
- import{h as t,r as i,c as e,H as o,g as r,F as s}from"./p-cb343b7a.js";import{l as n,_ as a,n as h,E as c,o as l,q as d,v as p,w as u,u as f,c as v,x as g,y as b,j as m,r as x,a as w,g as y,z as k,B as C,C as M,O as j,s as S,k as z}from"./p-9d271438.js";import{s as I,p as O,v as T,S as W}from"./p-9503cb7c.js";import{P as B,R as P,e as R,j as E,v as V,c as N,d as _,f as A,h as H,g as D,k as L}from"./p-6bce92ff.js";import{f as F,i as U}from"./p-cc05dbfb.js";import{c as X,v as $}from"./p-3b067958.js";import{r as Y}from"./p-64d85117.js";import{a as Z,m as q,f as Q,b as K,s as G,c as J,d as tt}from"./p-f3488b9e.js";import{R as it,f as et,g as ot,S as rt,D as st}from"./p-0f1b98bc.js";import{W as nt}from"./p-d66d9ba6.js";const at=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},t("path",{d:"M12 17.5C13.25 17.5 14.3125 17.0625 15.1875 16.1875C16.0625 15.3125 16.5 14.25 16.5 13C16.5 11.75 16.0625 10.6875 15.1875 9.8125C14.3125 8.9375 13.25 8.5 12 8.5C10.75 8.5 9.6875 8.9375 8.8125 9.8125C7.9375 10.6875 7.5 11.75 7.5 13C7.5 14.25 7.9375 15.3125 8.8125 16.1875C9.6875 17.0625 10.75 17.5 12 17.5ZM12 15.5C11.3 15.5 10.7083 15.2583 10.225 14.775C9.74167 14.2917 9.5 13.7 9.5 13C9.5 12.3 9.74167 11.7083 10.225 11.225C10.7083 10.7417 11.3 10.5 12 10.5C12.7 10.5 13.2917 10.7417 13.775 11.225C14.2583 11.7083 14.5 12.3 14.5 13C14.5 13.7 14.2583 14.2917 13.775 14.775C13.2917 15.2583 12.7 15.5 12 15.5ZM4 21C3.45 21 2.97917 20.8042 2.5875 20.4125C2.19583 20.0208 2 19.55 2 19V7C2 6.45 2.19583 5.97917 2.5875 5.5875C2.97917 5.19583 3.45 5 4 5H7.15L8.4 3.65C8.58333 3.45 8.80417 3.29167 9.0625 3.175C9.32083 3.05833 9.59167 3 9.875 3H14.125C14.4083 3 14.6792 3.05833 14.9375 3.175C15.1958 3.29167 15.4167 3.45 15.6 3.65L16.85 5H20C20.55 5 21.0208 5.19583 21.4125 5.5875C21.8042 5.97917 22 6.45 22 7V19C22 19.55 21.8042 20.0208 21.4125 20.4125C21.0208 20.8042 20.55 21 20 21H4Z",fill:"currentColor"})),ht=()=>t("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M8.00001 17.3333C7.62223 17.3333 7.30556 17.2056 7.05001 16.95C6.79445 16.6944 6.66667 16.3778 6.66667 16C6.66667 15.6222 6.79445 15.3056 7.05001 15.05C7.30556 14.7944 7.62223 14.6667 8.00001 14.6667H24C24.3778 14.6667 24.6944 14.7944 24.95 15.05C25.2056 15.3056 25.3333 15.6222 25.3333 16C25.3333 16.3778 25.2056 16.6944 24.95 16.95C24.6944 17.2056 24.3778 17.3333 24 17.3333H8.00001Z",fill:"currentColor"})),ct=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 80 80",fill:"none"},t("circle",{cx:"40",cy:"40",r:"36",fill:"white"}),t("circle",{cx:"40",cy:"40",r:"39",fill:"white","fill-opacity":"0.16",stroke:"white","stroke-width":"2"}),t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M48 29.3333H50.6667C53.6133 29.3333 56 31.72 56 34.6667V45.3333H53.3333V34.6667C53.3333 33.2 52.1333 32 50.6667 32H46.5733L45.7867 30.8133L43.9067 28H36.0933L34.2133 30.8133L33.4267 32H29.3333C27.8667 32 26.6667 33.2 26.6667 34.6667V48C26.6667 49.4667 27.8667 50.6667 29.3333 50.6667H36V53.3333H29.3333C26.3867 53.3333 24 50.9467 24 48V34.6667C24 31.72 26.3867 29.3333 29.3333 29.3333H32L34.6667 25.3333H45.3333L48 29.3333ZM40 34.6667C43.68 34.6667 46.6667 37.6533 46.6667 41.3333L46.6533 41.3467C46.6533 42.6933 46.24 43.96 45.5467 45.0133L51.6 51.0667L49.72 52.9467L43.6667 46.8933C42.6133 47.5867 41.36 48 40 48C36.32 48 33.3333 45.0133 33.3333 41.3333C33.3333 37.6533 36.32 34.6667 40 34.6667ZM36 41.3333C36 43.5333 37.8 45.3333 40 45.3333C42.2 45.3333 44 43.5333 44 41.3333C44 39.1333 42.2 37.3333 40 37.3333C37.8 37.3333 36 39.1333 36 41.3333Z",fill:"#161616"})),lt=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},t("path",{d:"M4.5 21C4.1 21 3.75 20.85 3.45 20.55C3.15 20.25 3 19.9 3 19.5V4.5C3 4.1 3.15 3.75 3.45 3.45C3.75 3.15 4.1 3 4.5 3H19.5C19.9 3 20.25 3.15 20.55 3.45C20.85 3.75 21 4.1 21 4.5V19.5C21 19.9 20.85 20.25 20.55 20.55C20.25 20.85 19.9 21 19.5 21H4.5ZM6.65 17.075H17.375C17.525 17.075 17.6333 17.0083 17.7 16.875C17.7667 16.7417 17.7583 16.6083 17.675 16.475L14.75 12.575C14.6667 12.475 14.5667 12.425 14.45 12.425C14.3333 12.425 14.2333 12.475 14.15 12.575L11.15 16.45L9.125 13.675C9.04167 13.575 8.94167 13.525 8.825 13.525C8.70833 13.525 8.60833 13.575 8.525 13.675L6.375 16.475C6.275 16.6083 6.25833 16.7417 6.325 16.875C6.39167 17.0083 6.5 17.075 6.65 17.075Z",fill:"currentColor"})),dt=({className:i})=>t("svg",{width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:i},t("path",{d:"M31 3H15C8.37258 3 3 8.37258 3 15V31",stroke:"white","stroke-width":"6","stroke-linecap":"square"})),pt=class{constructor(t){i(this,t),this.vviinnImageUploadStarted=e(this,"vviinnImageUploadStarted",7),this.vviinnNoResult=e(this,"vviinnNoResult",7),this.vviinnImageUploadFinished=e(this,"vviinnImageUploadFinished",7),this.vviinnCameraEnabled=e(this,"vviinnCameraEnabled",7),this.videoTrack=null,this.initializeZoom=async()=>{var t;if(!this.videoTrack)return;const i=(null===(t=this.videoTrack)||void 0===t?void 0:t.getCapabilities)?this.videoTrack.getCapabilities():{};"zoom"in i&&(this.zoomCapabilities=i.zoom,await this.videoTrack.applyConstraints({advanced:[{zoom:this.zoomCapabilities.min}]}))},this.onZoom=async t=>{var i;if(!this.videoTrack||!this.zoomCapabilities)return;const{max:e,min:o}=this.zoomCapabilities,r=null!==(i=this.videoTrack.getSettings().zoom)&&void 0!==i?i:o,s=Math.round((e-o)/5*10)/10;let n;n="in"===t?r+s:r-s,n="in"===t&&r<1?1:n,n<o&&(n=o),n>e&&(n=e),await this.videoTrack.applyConstraints({advanced:[{zoom:n}]})},this.exampleImageSource=void 0,this.width=0,this.height=0,this.basicEventData=void 0,this.srcObject=void 0,this.cameraButtonClicked=!1,this.useComponentsStore=!1,this.selected=!1,this.videoInitialized=!1,this.zoomCapabilities=null}componentWillLoad(){I(this,this.el)}componentDidLoad(){this.videoElement=this.el.shadowRoot.getElementById("camera-preview")}createPlaceholderImageCanvas(){const t=this.el.shadowRoot.getElementById("captured-image-placeholder"),i=this.videoElement,{videoWidth:e,videoHeight:o}=i,r=document.createElement("canvas");r.width=e,r.height=o,r.getContext("2d").drawImage(i,0,0,r.width,r.height);const s=r.toDataURL("image/jpeg");t.src=s}async selectImage(){if(!this.srcObject)return;let t;this.vviinnImageUploadStarted.emit(this.basicEventData);const i=this.el.shadowRoot.getElementById("photo-frame"),e=this.videoElement,o=i.getBoundingClientRect(),r=e.getBoundingClientRect(),{videoWidth:s,videoHeight:l}=e,d=document.createElement("canvas");this.selected=!0,this.videoElement.pause(),this.createPlaceholderImageCanvas();const p=s/r.width,u=l/r.height,f=Math.min(o.width*p,o.height*u);d.width=f,d.height=f;const v=(o.left-r.left+(o.width-f/p)/2)*p,g=(o.top-r.top+(o.height-f/u)/2)*u;d.getContext("2d").drawImage(e,v,g,f,f,0,0,d.width,d.height);const b=d.toDataURL("image/jpeg");t=await n(b),a.pipe(await h(this.useComponentsStore?"components":"widget")(t),c.match((()=>{this.vviinnNoResult.emit(this.basicEventData)}),(t=>this.vviinnImageUploadFinished.emit({searchId:t.requestId,isTriggeredByVpsWidget:!this.useComponentsStore})))),this.selected=!1,this.videoInitialized=!1,this.vviinnCameraEnabled.emit(!1)}handleKeyPress({key:t}){"Enter"!==t&&" "!==t||this.selectImage()}handleSrcObjectChange(){this.srcObject?(this.videoElement.srcObject=this.srcObject,this.videoTrack=this.srcObject.getVideoTracks()[0],this.initializeZoom(),this.videoElement.onloadedmetadata=()=>{this.vviinnCameraEnabled.emit(!0),this.videoInitialized=!0}):this.videoInitialized=!1}render(){return t(o,{onKeyUp:t=>this.handleKeyPress(t),class:{"video-expanded":this.cameraButtonClicked}},t("video",{id:"camera-preview",class:{hidden:!this.videoInitialized||this.selected},autoplay:!0,playsinline:!0,muted:!0}),t("img",{src:this.exampleImageSource,width:this.width,height:this.height,tabindex:1,class:{hidden:this.videoInitialized||this.selected}}),t("img",{id:"captured-image-placeholder",class:{hidden:!this.selected}}),t("div",{class:{container:!0,hidden:!this.videoInitialized}},t("div",{class:"photo-frame-container"},t("div",{id:"photo-frame"},t(dt,{className:"photo-frame-corner top-left"}),t(dt,{className:"photo-frame-corner top-right"}),t(dt,{className:"photo-frame-corner bottom-left"}),t(dt,{className:"photo-frame-corner bottom-right"})),t("div",{class:{"zoom-buttons":!0,hidden:!this.zoomCapabilities}},t("button",{onClick:()=>this.onZoom("out")},t(ht,null)),t("button",{onClick:()=>this.onZoom("in")},t(B,null)))),t("div",{class:"photo-button-container"},t("button",{class:"photo-button",onClick:()=>this.selectImage()},t(ct,null)))))}get el(){return r(this)}static get watchers(){return{srcObject:["handleSrcObjectChange"]}}};pt.style=":host{display:block;width:100%;height:100%;min-height:0;position:relative;overflow:hidden;flex-grow:1;transition:min-height 1s}:host(.video-expanded){min-height:100%;transition:min-height 0.8s}img{width:100%;height:100%;min-height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center}#camera-preview{width:100%;min-height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center;position:relative}#captured-image-placeholder{height:auto}.container{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;flex-direction:column;gap:12px;padding:68px 0 48px;justify-content:space-around;align-content:center;box-sizing:border-box}.photo-frame-container{width:100%;height:100%;display:flex;flex-direction:column;gap:12px}#photo-frame{position:relative;aspect-ratio:1/1;border-radius:16px;box-shadow:0 0 0 100vmax rgba(0, 0, 0, 0.32);width:100%;height:auto;max-width:80%;margin:0 auto}@media (max-width: 960px){.photo-frame-container{width:auto;height:auto}}@media (max-width: 380px){#photo-frame{max-width:70%}}.photo-frame-corner{position:absolute;--delta:-3px}.photo-frame-corner.top-left{top:var(--delta);left:var(--delta)}.photo-frame-corner.top-right{top:var(--delta);right:var(--delta);transform:rotate(90deg)}.photo-frame-corner.bottom-left{bottom:var(--delta);left:var(--delta);transform:rotate(-90deg)}.photo-frame-corner.bottom-right{bottom:var(--delta);right:var(--delta);transform:rotate(180deg)}.photo-button-container{display:flex;width:100%;align-items:center;justify-self:flex-end}.photo-button{cursor:pointer;border:none;position:relative;z-index:1;padding:0;color:#6f6f6f;background-color:transparent;-webkit-tap-highlight-color:transparent;line-height:0;margin:0 auto}.zoom-buttons{display:flex;position:relative;justify-content:center;gap:12px}.zoom-buttons button{color:white;display:flex;width:48px;height:48px;justify-content:center;align-items:center;border-radius:var(--border-radius-100, 8px);background-color:rgba(0, 0, 0, 0.48);border:none;cursor:pointer}.hidden{display:none}";var ut=l((function(t){
1
+ import{h as t,r as i,c as e,H as o,g as r,F as s}from"./p-cb343b7a.js";import{l as n,_ as a,n as h,E as c,o as l,q as d,v as p,w as u,u as f,c as v,x as g,y as b,j as m,r as x,a as w,g as y,z as k,B as C,C as M,O as j,s as S,k as z}from"./p-9d271438.js";import{s as I,p as O,v as T,S as W}from"./p-9503cb7c.js";import{P as B,R as P,e as R,j as E,v as V,c as N,d as _,f as A,h as H,g as D,k as L}from"./p-6bce92ff.js";import{f as F,i as U}from"./p-cc05dbfb.js";import{c as X,v as $}from"./p-2de34328.js";import{r as Y}from"./p-64d85117.js";import{a as Z,m as q,f as Q,b as K,s as G,c as J,d as tt}from"./p-f3488b9e.js";import{R as it,f as et,g as ot,S as rt,D as st}from"./p-0f1b98bc.js";import{W as nt}from"./p-d66d9ba6.js";const at=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},t("path",{d:"M12 17.5C13.25 17.5 14.3125 17.0625 15.1875 16.1875C16.0625 15.3125 16.5 14.25 16.5 13C16.5 11.75 16.0625 10.6875 15.1875 9.8125C14.3125 8.9375 13.25 8.5 12 8.5C10.75 8.5 9.6875 8.9375 8.8125 9.8125C7.9375 10.6875 7.5 11.75 7.5 13C7.5 14.25 7.9375 15.3125 8.8125 16.1875C9.6875 17.0625 10.75 17.5 12 17.5ZM12 15.5C11.3 15.5 10.7083 15.2583 10.225 14.775C9.74167 14.2917 9.5 13.7 9.5 13C9.5 12.3 9.74167 11.7083 10.225 11.225C10.7083 10.7417 11.3 10.5 12 10.5C12.7 10.5 13.2917 10.7417 13.775 11.225C14.2583 11.7083 14.5 12.3 14.5 13C14.5 13.7 14.2583 14.2917 13.775 14.775C13.2917 15.2583 12.7 15.5 12 15.5ZM4 21C3.45 21 2.97917 20.8042 2.5875 20.4125C2.19583 20.0208 2 19.55 2 19V7C2 6.45 2.19583 5.97917 2.5875 5.5875C2.97917 5.19583 3.45 5 4 5H7.15L8.4 3.65C8.58333 3.45 8.80417 3.29167 9.0625 3.175C9.32083 3.05833 9.59167 3 9.875 3H14.125C14.4083 3 14.6792 3.05833 14.9375 3.175C15.1958 3.29167 15.4167 3.45 15.6 3.65L16.85 5H20C20.55 5 21.0208 5.19583 21.4125 5.5875C21.8042 5.97917 22 6.45 22 7V19C22 19.55 21.8042 20.0208 21.4125 20.4125C21.0208 20.8042 20.55 21 20 21H4Z",fill:"currentColor"})),ht=()=>t("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M8.00001 17.3333C7.62223 17.3333 7.30556 17.2056 7.05001 16.95C6.79445 16.6944 6.66667 16.3778 6.66667 16C6.66667 15.6222 6.79445 15.3056 7.05001 15.05C7.30556 14.7944 7.62223 14.6667 8.00001 14.6667H24C24.3778 14.6667 24.6944 14.7944 24.95 15.05C25.2056 15.3056 25.3333 15.6222 25.3333 16C25.3333 16.3778 25.2056 16.6944 24.95 16.95C24.6944 17.2056 24.3778 17.3333 24 17.3333H8.00001Z",fill:"currentColor"})),ct=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 80 80",fill:"none"},t("circle",{cx:"40",cy:"40",r:"36",fill:"white"}),t("circle",{cx:"40",cy:"40",r:"39",fill:"white","fill-opacity":"0.16",stroke:"white","stroke-width":"2"}),t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M48 29.3333H50.6667C53.6133 29.3333 56 31.72 56 34.6667V45.3333H53.3333V34.6667C53.3333 33.2 52.1333 32 50.6667 32H46.5733L45.7867 30.8133L43.9067 28H36.0933L34.2133 30.8133L33.4267 32H29.3333C27.8667 32 26.6667 33.2 26.6667 34.6667V48C26.6667 49.4667 27.8667 50.6667 29.3333 50.6667H36V53.3333H29.3333C26.3867 53.3333 24 50.9467 24 48V34.6667C24 31.72 26.3867 29.3333 29.3333 29.3333H32L34.6667 25.3333H45.3333L48 29.3333ZM40 34.6667C43.68 34.6667 46.6667 37.6533 46.6667 41.3333L46.6533 41.3467C46.6533 42.6933 46.24 43.96 45.5467 45.0133L51.6 51.0667L49.72 52.9467L43.6667 46.8933C42.6133 47.5867 41.36 48 40 48C36.32 48 33.3333 45.0133 33.3333 41.3333C33.3333 37.6533 36.32 34.6667 40 34.6667ZM36 41.3333C36 43.5333 37.8 45.3333 40 45.3333C42.2 45.3333 44 43.5333 44 41.3333C44 39.1333 42.2 37.3333 40 37.3333C37.8 37.3333 36 39.1333 36 41.3333Z",fill:"#161616"})),lt=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},t("path",{d:"M4.5 21C4.1 21 3.75 20.85 3.45 20.55C3.15 20.25 3 19.9 3 19.5V4.5C3 4.1 3.15 3.75 3.45 3.45C3.75 3.15 4.1 3 4.5 3H19.5C19.9 3 20.25 3.15 20.55 3.45C20.85 3.75 21 4.1 21 4.5V19.5C21 19.9 20.85 20.25 20.55 20.55C20.25 20.85 19.9 21 19.5 21H4.5ZM6.65 17.075H17.375C17.525 17.075 17.6333 17.0083 17.7 16.875C17.7667 16.7417 17.7583 16.6083 17.675 16.475L14.75 12.575C14.6667 12.475 14.5667 12.425 14.45 12.425C14.3333 12.425 14.2333 12.475 14.15 12.575L11.15 16.45L9.125 13.675C9.04167 13.575 8.94167 13.525 8.825 13.525C8.70833 13.525 8.60833 13.575 8.525 13.675L6.375 16.475C6.275 16.6083 6.25833 16.7417 6.325 16.875C6.39167 17.0083 6.5 17.075 6.65 17.075Z",fill:"currentColor"})),dt=({className:i})=>t("svg",{width:"34",height:"34",viewBox:"0 0 34 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:i},t("path",{d:"M31 3H15C8.37258 3 3 8.37258 3 15V31",stroke:"white","stroke-width":"6","stroke-linecap":"square"})),pt=class{constructor(t){i(this,t),this.vviinnImageUploadStarted=e(this,"vviinnImageUploadStarted",7),this.vviinnNoResult=e(this,"vviinnNoResult",7),this.vviinnImageUploadFinished=e(this,"vviinnImageUploadFinished",7),this.vviinnCameraEnabled=e(this,"vviinnCameraEnabled",7),this.videoTrack=null,this.initializeZoom=async()=>{var t;if(!this.videoTrack)return;const i=(null===(t=this.videoTrack)||void 0===t?void 0:t.getCapabilities)?this.videoTrack.getCapabilities():{};"zoom"in i&&(this.zoomCapabilities=i.zoom,await this.videoTrack.applyConstraints({advanced:[{zoom:this.zoomCapabilities.min}]}))},this.onZoom=async t=>{var i;if(!this.videoTrack||!this.zoomCapabilities)return;const{max:e,min:o}=this.zoomCapabilities,r=null!==(i=this.videoTrack.getSettings().zoom)&&void 0!==i?i:o,s=Math.round((e-o)/5*10)/10;let n;n="in"===t?r+s:r-s,n="in"===t&&r<1?1:n,n<o&&(n=o),n>e&&(n=e),await this.videoTrack.applyConstraints({advanced:[{zoom:n}]})},this.exampleImageSource=void 0,this.width=0,this.height=0,this.basicEventData=void 0,this.srcObject=void 0,this.cameraButtonClicked=!1,this.useComponentsStore=!1,this.selected=!1,this.videoInitialized=!1,this.zoomCapabilities=null}componentWillLoad(){I(this,this.el)}componentDidLoad(){this.videoElement=this.el.shadowRoot.getElementById("camera-preview")}createPlaceholderImageCanvas(){const t=this.el.shadowRoot.getElementById("captured-image-placeholder"),i=this.videoElement,{videoWidth:e,videoHeight:o}=i,r=document.createElement("canvas");r.width=e,r.height=o,r.getContext("2d").drawImage(i,0,0,r.width,r.height);const s=r.toDataURL("image/jpeg");t.src=s}async selectImage(){if(!this.srcObject)return;let t;this.vviinnImageUploadStarted.emit(this.basicEventData);const i=this.el.shadowRoot.getElementById("photo-frame"),e=this.videoElement,o=i.getBoundingClientRect(),r=e.getBoundingClientRect(),{videoWidth:s,videoHeight:l}=e,d=document.createElement("canvas");this.selected=!0,this.videoElement.pause(),this.createPlaceholderImageCanvas();const p=s/r.width,u=l/r.height,f=Math.min(o.width*p,o.height*u);d.width=f,d.height=f;const v=(o.left-r.left+(o.width-f/p)/2)*p,g=(o.top-r.top+(o.height-f/u)/2)*u;d.getContext("2d").drawImage(e,v,g,f,f,0,0,d.width,d.height);const b=d.toDataURL("image/jpeg");t=await n(b),a.pipe(await h(this.useComponentsStore?"components":"widget")(t),c.match((()=>{this.vviinnNoResult.emit(this.basicEventData)}),(t=>this.vviinnImageUploadFinished.emit({searchId:t.requestId,isTriggeredByVpsWidget:!this.useComponentsStore})))),this.selected=!1,this.videoInitialized=!1,this.vviinnCameraEnabled.emit(!1)}handleKeyPress({key:t}){"Enter"!==t&&" "!==t||this.selectImage()}handleSrcObjectChange(){this.srcObject?(this.videoElement.srcObject=this.srcObject,this.videoTrack=this.srcObject.getVideoTracks()[0],this.initializeZoom(),this.videoElement.onloadedmetadata=()=>{this.vviinnCameraEnabled.emit(!0),this.videoInitialized=!0}):this.videoInitialized=!1}render(){return t(o,{onKeyUp:t=>this.handleKeyPress(t),class:{"video-expanded":this.cameraButtonClicked}},t("video",{id:"camera-preview",class:{hidden:!this.videoInitialized||this.selected},autoplay:!0,playsinline:!0,muted:!0}),t("img",{src:this.exampleImageSource,width:this.width,height:this.height,tabindex:1,class:{hidden:this.videoInitialized||this.selected}}),t("img",{id:"captured-image-placeholder",class:{hidden:!this.selected}}),t("div",{class:{container:!0,hidden:!this.videoInitialized}},t("div",{class:"photo-frame-container"},t("div",{id:"photo-frame"},t(dt,{className:"photo-frame-corner top-left"}),t(dt,{className:"photo-frame-corner top-right"}),t(dt,{className:"photo-frame-corner bottom-left"}),t(dt,{className:"photo-frame-corner bottom-right"})),t("div",{class:{"zoom-buttons":!0,hidden:!this.zoomCapabilities}},t("button",{onClick:()=>this.onZoom("out")},t(ht,null)),t("button",{onClick:()=>this.onZoom("in")},t(B,null)))),t("div",{class:"photo-button-container"},t("button",{class:"photo-button",onClick:()=>this.selectImage()},t(ct,null)))))}get el(){return r(this)}static get watchers(){return{srcObject:["handleSrcObjectChange"]}}};pt.style=":host{display:block;width:100%;height:100%;min-height:0;position:relative;overflow:hidden;flex-grow:1;transition:min-height 1s}:host(.video-expanded){min-height:100%;transition:min-height 0.8s}img{width:100%;height:100%;min-height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center}#camera-preview{width:100%;min-height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center;position:relative}#captured-image-placeholder{height:auto}.container{position:absolute;width:100%;height:100%;left:0;top:0;display:flex;flex-direction:column;gap:12px;padding:68px 0 48px;justify-content:space-around;align-content:center;box-sizing:border-box}.photo-frame-container{width:100%;height:100%;display:flex;flex-direction:column;gap:12px}#photo-frame{position:relative;aspect-ratio:1/1;border-radius:16px;box-shadow:0 0 0 100vmax rgba(0, 0, 0, 0.32);width:100%;height:auto;max-width:80%;margin:0 auto}@media (max-width: 960px){.photo-frame-container{width:auto;height:auto}}@media (max-width: 380px){#photo-frame{max-width:70%}}.photo-frame-corner{position:absolute;--delta:-3px}.photo-frame-corner.top-left{top:var(--delta);left:var(--delta)}.photo-frame-corner.top-right{top:var(--delta);right:var(--delta);transform:rotate(90deg)}.photo-frame-corner.bottom-left{bottom:var(--delta);left:var(--delta);transform:rotate(-90deg)}.photo-frame-corner.bottom-right{bottom:var(--delta);right:var(--delta);transform:rotate(180deg)}.photo-button-container{display:flex;width:100%;align-items:center;justify-self:flex-end}.photo-button{cursor:pointer;border:none;position:relative;z-index:1;padding:0;color:#6f6f6f;background-color:transparent;-webkit-tap-highlight-color:transparent;line-height:0;margin:0 auto}.zoom-buttons{display:flex;position:relative;justify-content:center;gap:12px}.zoom-buttons button{color:white;display:flex;width:48px;height:48px;justify-content:center;align-items:center;border-radius:var(--border-radius-100, 8px);background-color:rgba(0, 0, 0, 0.48);border:none;cursor:pointer}.hidden{display:none}";var ut=l((function(t){
2
2
  /*!
3
3
  * Cropper.js v1.6.2
4
4
  * https://fengyuanchen.github.io/cropperjs
@@ -1 +1 @@
1
- const t={VPR:"Similar Products",VPS:"Visual Search",VCS:"Cross-Selling",TPS:"Text Product Search"};function a(t,a){return r=>(t=>"VPR"===t._tag)(r)?t():a()}function r(t){return"VPR"===t?{_tag:"VPR"}:{_tag:"VCS"}}const s="2.158.2";export{a,t as c,r as f,s as v}
1
+ const t={VPR:"Similar Products",VPS:"Visual Search",VCS:"Cross-Selling",TPS:"Text Product Search"};function a(t,a){return r=>(t=>"VPR"===t._tag)(r)?t():a()}function r(t){return"VPR"===t?{_tag:"VPR"}:{_tag:"VCS"}}const s="2.159.0";export{a,t as c,r as f,s as v}