@vtex/ads-stories 0.4.1 → 0.7.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +44 -88
  3. package/dist/cdn/vtex-ads-stories.js +1313 -74
  4. package/dist/cdn/vtex-ads-stories.js.map +1 -1
  5. package/dist/cjs/index.cjs +3744 -513
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/index.d.cts +46 -15
  8. package/dist/cjs/react.cjs.map +1 -1
  9. package/dist/cjs/react.d.cts +51 -5
  10. package/dist/cjs/story-DAiAN9v-.d.cts +260 -0
  11. package/dist/esm/index.d.ts +46 -15
  12. package/dist/esm/index.js +3348 -217
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/react.d.ts +51 -5
  15. package/dist/esm/story-DAiAN9v-.d.ts +260 -0
  16. package/package.json +18 -4
  17. package/src/cdn.ts +7 -3
  18. package/src/commerce-events.ts +93 -0
  19. package/src/components/card/card.ts +79 -14
  20. package/src/components/carousel/carousel-skeleton.ts +113 -0
  21. package/src/components/carousel/carousel.ts +715 -0
  22. package/src/components/carousel/index.ts +22 -0
  23. package/src/components/events/events-controller.ts +222 -0
  24. package/src/components/events/index.ts +6 -0
  25. package/src/components/icons/assets/caret-left-bold.svg +1 -0
  26. package/src/components/icons/assets/caret-right-bold.svg +1 -0
  27. package/src/components/icons/assets/caret-up-bold.svg +1 -0
  28. package/src/components/icons/assets/minus.svg +1 -0
  29. package/src/components/icons/assets/plus.svg +1 -0
  30. package/src/components/icons/assets/trash.svg +1 -0
  31. package/src/components/icons/assets/warning-circle-fill.svg +1 -0
  32. package/src/components/icons/index.ts +14 -0
  33. package/src/components/media/index.ts +8 -1
  34. package/src/components/media/media.styles.ts +113 -0
  35. package/src/components/media/media.ts +124 -23
  36. package/src/components/media/video-controller.ts +127 -6
  37. package/src/components/player/index.ts +6 -2
  38. package/src/components/player/player.ts +824 -50
  39. package/src/components/product/cta.ts +56 -0
  40. package/src/components/product/index.ts +22 -0
  41. package/src/components/product/price.ts +86 -0
  42. package/src/components/product/product.styles.ts +426 -0
  43. package/src/components/product/product.ts +336 -0
  44. package/src/index.ts +17 -1
  45. package/src/locales/en.ts +39 -0
  46. package/src/locales/es.ts +40 -0
  47. package/src/locales/index.ts +36 -0
  48. package/src/locales/pt.ts +39 -0
  49. package/src/locales/types.ts +44 -0
  50. package/src/react.ts +55 -7
  51. package/src/story/index.ts +5 -1
  52. package/src/story/story.ts +679 -49
  53. package/src/tag-name.ts +1 -0
  54. package/src/types.ts +8 -12
  55. package/src/utils/fetch-story.ts +113 -0
  56. package/src/utils/hydrate-products.ts +112 -0
  57. package/src/utils/media-ready.ts +58 -0
  58. package/src/utils/safe-url.ts +36 -0
  59. package/src/utils/send-event.ts +71 -0
  60. package/src/utils/with-timeout.ts +43 -0
@@ -1,38 +1,717 @@
1
- "use strict";var VtexAdsStories=(()=>{var pe=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var ft=(i,e)=>{for(var t in e)pe(i,t,{get:e[t],enumerable:!0})},mt=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ct(e))!ut.call(i,o)&&o!==t&&pe(i,o,{get:()=>e[o],enumerable:!(s=pt(e,o))||s.enumerable});return i};var yt=i=>mt(pe({},"__esModule",{value:!0}),i);var Dt={};ft(Dt,{TAG_NAME:()=>F,VtexAdsStoryElement:()=>O,defineVtexAdsStories:()=>Y});var Q=globalThis,X=Q.ShadowRoot&&(Q.ShadyCSS===void 0||Q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ce=Symbol(),Me=new WeakMap,R=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==ce)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(X&&e===void 0){let s=t!==void 0&&t.length===1;s&&(e=Me.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&Me.set(t,e))}return e}toString(){return this.cssText}},Te=i=>new R(typeof i=="string"?i:i+"",void 0,ce),x=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((s,o,r)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[r+1],i[0]);return new R(t,i,ce)},Le=(i,e)=>{if(X)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let s=document.createElement("style"),o=Q.litNonce;o!==void 0&&s.setAttribute("nonce",o),s.textContent=t.cssText,i.appendChild(s)}},ue=X?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let s of e.cssRules)t+=s.cssText;return Te(t)})(i):i;var{is:gt,defineProperty:$t,getOwnPropertyDescriptor:vt,getOwnPropertyNames:_t,getOwnPropertySymbols:bt,getPrototypeOf:At}=Object,_=globalThis,Oe=_.trustedTypes,xt=Oe?Oe.emptyScript:"",fe=_.reactiveElementPolyfillSupport,U=(i,e)=>i,me={toAttribute(i,e){switch(e){case Boolean:i=i?xt:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch(s){t=null}}return t}},Re=(i,e)=>!gt(i,e),Pe={attribute:!0,type:String,converter:me,reflect:!1,useDefault:!1,hasChanged:Re},He,Ve;(He=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Ve=_.litPropertyMetadata)!=null||(_.litPropertyMetadata=new WeakMap);var y=class extends HTMLElement{static addInitializer(e){var t;this._$Ei(),((t=this.l)!=null?t:this.l=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Pe){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let s=Symbol(),o=this.getPropertyDescriptor(e,s,t);o!==void 0&&$t(this.prototype,e,o)}}static getPropertyDescriptor(e,t,s){var n;let{get:o,set:r}=(n=vt(this.prototype,e))!=null?n:{get(){return this[t]},set(l){this[t]=l}};return{get:o,set(l){let a=o==null?void 0:o.call(this);r==null||r.call(this,l),this.requestUpdate(e,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){var t;return(t=this.elementProperties.get(e))!=null?t:Pe}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;let e=At(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){let t=this.properties,s=[..._t(t),...bt(t)];for(let o of s)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[s,o]of t)this.elementProperties.set(s,o)}this._$Eh=new Map;for(let[t,s]of this.elementProperties){let o=this._$Eu(t,s);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let s=new Set(e.flat(1/0).reverse());for(let o of s)t.unshift(ue(o))}else e!==void 0&&t.push(ue(e));return t}static _$Eu(e,t){let s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t,s;((t=this._$EO)!=null?t:this._$EO=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&((s=e.hostConnected)==null||s.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){var t;let e=(t=this.shadowRoot)!=null?t:this.attachShadow(this.constructor.shadowRootOptions);return Le(e,this.constructor.elementStyles),e}connectedCallback(){var e,t;(e=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(s=>{var o;return(o=s.hostConnected)==null?void 0:o.call(s)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostDisconnected)==null?void 0:s.call(t)})}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){var r;let s=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,s);if(o!==void 0&&s.reflect===!0){let n=(((r=s.converter)==null?void 0:r.toAttribute)!==void 0?s.converter:me).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(e,t){var r,n,l;let s=this.constructor,o=s._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let a=s.getPropertyOptions(o),d=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:me;this._$Em=o;let p=d.fromAttribute(t,a.type);this[o]=(l=p!=null?p:(n=this._$Ej)==null?void 0:n.get(o))!=null?l:p,this._$Em=null}}requestUpdate(e,t,s,o=!1,r){var n,l;if(e!==void 0){let a=this.constructor;if(o===!1&&(r=this[e]),s!=null||(s=a.getPropertyOptions(e)),!(((n=s.hasChanged)!=null?n:Re)(r,t)||s.useDefault&&s.reflect&&r===((l=this._$Ej)==null?void 0:l.get(e))&&!this.hasAttribute(a._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:o,wrapped:r},n){var l,a,d;s&&!((l=this._$Ej)!=null?l:this._$Ej=new Map).has(e)&&(this._$Ej.set(e,(a=n!=null?n:t)!=null?a:this[e]),r!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),o===!0&&this._$Em!==e&&((d=this._$Eq)!=null?d:this._$Eq=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s,o;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((s=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,l]of this._$Ep)this[n]=l;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[n,l]of r){let{wrapped:a}=l,d=this[n];a!==!0||this._$AL.has(n)||d===void 0||this.C(n,void 0,l,d)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(o=this._$EO)==null||o.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(s=>{var o;return(o=s.hostUpdated)==null?void 0:o.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}},ke;y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[U("elementProperties")]=new Map,y[U("finalized")]=new Map,fe==null||fe({ReactiveElement:y}),((ke=_.reactiveElementVersions)!=null?ke:_.reactiveElementVersions=[]).push("2.1.2");var D=globalThis,Ue=i=>i,ee=D.trustedTypes,Ne=ee?ee.createPolicy("lit-html",{createHTML:i=>i}):void 0,$e="$lit$",g=`lit$${Math.random().toFixed(9).slice(2)}$`,ve="?"+g,wt=`<${ve}>`,C=document,B=()=>C.createComment(""),I=i=>i===null||typeof i!="object"&&typeof i!="function",_e=Array.isArray,Ge=i=>_e(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",ye=`[
2
- \f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,De=/-->/g,Be=/>/g,w=RegExp(`>|${ye}(?:([^\\s"'>=/]+)(${ye}*=${ye}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ie=/'/g,ze=/"/g,qe=/^(?:script|style|textarea|title)$/i,be=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),u=be(1),Gt=be(2),qt=be(3),$=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),je=new WeakMap,E=C.createTreeWalker(C,129);function We(i,e){if(!_e(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ne!==void 0?Ne.createHTML(e):e}var Ke=(i,e)=>{let t=i.length-1,s=[],o,r=e===2?"<svg>":e===3?"<math>":"",n=N;for(let l=0;l<t;l++){let a=i[l],d,p,c=-1,m=0;for(;m<a.length&&(n.lastIndex=m,p=n.exec(a),p!==null);)m=n.lastIndex,n===N?p[1]==="!--"?n=De:p[1]!==void 0?n=Be:p[2]!==void 0?(qe.test(p[2])&&(o=RegExp("</"+p[2],"g")),n=w):p[3]!==void 0&&(n=w):n===w?p[0]===">"?(n=o!=null?o:N,c=-1):p[1]===void 0?c=-2:(c=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?w:p[3]==='"'?ze:Ie):n===ze||n===Ie?n=w:n===De||n===Be?n=N:(n=w,o=void 0);let v=n===w&&i[l+1].startsWith("/>")?" ":"";r+=n===N?a+wt:c>=0?(s.push(d),a.slice(0,c)+$e+a.slice(c)+g+v):a+g+(c===-2?l:v)}return[We(i,r+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]},z=class i{constructor({strings:e,_$litType$:t},s){let o;this.parts=[];let r=0,n=0,l=e.length-1,a=this.parts,[d,p]=Ke(e,t);if(this.el=i.createElement(d,s),E.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(o=E.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let c of o.getAttributeNames())if(c.endsWith($e)){let m=p[n++],v=o.getAttribute(c).split(g),J=/([.?@])?(.*)/.exec(m);a.push({type:1,index:r,name:J[2],strings:v,ctor:J[1]==="."?se:J[1]==="?"?ie:J[1]==="@"?oe:M}),o.removeAttribute(c)}else c.startsWith(g)&&(a.push({type:6,index:r}),o.removeAttribute(c));if(qe.test(o.tagName)){let c=o.textContent.split(g),m=c.length-1;if(m>0){o.textContent=ee?ee.emptyScript:"";for(let v=0;v<m;v++)o.append(c[v],B()),E.nextNode(),a.push({type:2,index:++r});o.append(c[m],B())}}}else if(o.nodeType===8)if(o.data===ve)a.push({type:2,index:r});else{let c=-1;for(;(c=o.data.indexOf(g,c+1))!==-1;)a.push({type:7,index:r}),c+=g.length-1}r++}}static createElement(e,t){let s=C.createElement("template");return s.innerHTML=e,s}};function S(i,e,t=i,s){var n,l,a;if(e===$)return e;let o=s!==void 0?(n=t._$Co)==null?void 0:n[s]:t._$Cl,r=I(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==r&&((l=o==null?void 0:o._$AO)==null||l.call(o,!1),r===void 0?o=void 0:(o=new r(i),o._$AT(i,t,s)),s!==void 0?((a=t._$Co)!=null?a:t._$Co=[])[s]=o:t._$Cl=o),o!==void 0&&(e=S(i,o._$AS(i,e.values),o,s)),e}var te=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var d;let{el:{content:t},parts:s}=this._$AD,o=((d=e==null?void 0:e.creationScope)!=null?d:C).importNode(t,!0);E.currentNode=o;let r=E.nextNode(),n=0,l=0,a=s[0];for(;a!==void 0;){if(n===a.index){let p;a.type===2?p=new P(r,r.nextSibling,this,e):a.type===1?p=new a.ctor(r,a.name,a.strings,this,e):a.type===6&&(p=new re(r,this,e)),this._$AV.push(p),a=s[++l]}n!==(a==null?void 0:a.index)&&(r=E.nextNode(),n++)}return E.currentNode=C,o}p(e){let t=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}},P=class i{get _$AU(){var e,t;return(t=(e=this._$AM)==null?void 0:e._$AU)!=null?t:this._$Cv}constructor(e,t,s,o){var r;this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=o,this._$Cv=(r=o==null?void 0:o.isConnected)!=null?r:!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=S(this,e,t),I(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==$&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ge(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==h&&I(this._$AH)?this._$AA.nextSibling.data=e:this.T(C.createTextNode(e)),this._$AH=e}$(e){var r;let{values:t,_$litType$:s}=e,o=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=z.createElement(We(s.h,s.h[0]),this.options)),s);if(((r=this._$AH)==null?void 0:r._$AD)===o)this._$AH.p(t);else{let n=new te(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=je.get(e.strings);return t===void 0&&je.set(e.strings,t=new z(e)),t}k(e){_e(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,s,o=0;for(let r of e)o===t.length?t.push(s=new i(this.O(B()),this.O(B()),this,this.options)):s=t[o],s._$AI(r),o++;o<t.length&&(this._$AR(s&&s._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){let o=Ue(e).nextSibling;Ue(e).remove(),e=o}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,o,r){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=h}_$AI(e,t=this,s,o){let r=this.strings,n=!1;if(r===void 0)e=S(this,e,t,0),n=!I(e)||e!==this._$AH&&e!==$,n&&(this._$AH=e);else{let l=e,a,d;for(e=r[0],a=0;a<r.length-1;a++)d=S(this,l[s+a],t,a),d===$&&(d=this._$AH[a]),n||(n=!I(d)||d!==this._$AH[a]),d===h?e=h:e!==h&&(e+=(d!=null?d:"")+r[a+1]),this._$AH[a]=d}n&&!o&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e!=null?e:"")}},se=class extends M{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},ie=class extends M{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},oe=class extends M{constructor(e,t,s,o,r){super(e,t,s,o,r),this.type=5}_$AI(e,t=this){var n;if((e=(n=S(this,e,t,0))!=null?n:h)===$)return;let s=this._$AH,o=e===h&&s!==h||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,r=e!==h&&(s===h||o);o&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,s;typeof this._$AH=="function"?this._$AH.call((s=(t=this.options)==null?void 0:t.host)!=null?s:this.element,e):this._$AH.handleEvent(e)}},re=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){S(this,e)}},Fe={M:$e,P:g,A:ve,C:1,L:Ke,R:te,D:Ge,V:S,I:P,H:M,N:ie,U:oe,B:se,F:re},ge=D.litHtmlPolyfillSupport,Ze;ge==null||ge(z,P),((Ze=D.litHtmlVersions)!=null?Ze:D.litHtmlVersions=[]).push("3.3.3");var Ye=(i,e,t)=>{var r,n;let s=(r=t==null?void 0:t.renderBefore)!=null?r:e,o=s._$litPart$;if(o===void 0){let l=(n=t==null?void 0:t.renderBefore)!=null?n:null;s._$litPart$=o=new P(e.insertBefore(B(),l),l,void 0,t!=null?t:{})}return o._$AI(i),o};var T=globalThis,b=class extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,s;let e=super.createRenderRoot();return(s=(t=this.renderOptions).renderBefore)!=null||(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ye(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return $}},Je;b._$litElement$=!0,b.finalized=!0,(Je=T.litElementHydrateSupport)==null||Je.call(T,{LitElement:b});var Ae=T.litElementPolyfillSupport;Ae==null||Ae({LitElement:b});var Qe;((Qe=T.litElementVersions)!=null?Qe:T.litElementVersions=[]).push("4.2.2");var ne={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},j=i=>(...e)=>({_$litDirective$:i,values:e}),H=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Z=class extends H{constructor(e){if(super(e),this.it=h,e.type!==ne.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===h||e==null)return this._t=void 0,this.it=e;if(e===$)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Z.directiveName="unsafeHTML",Z.resultType=1;var Xe=j(Z);var et=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>
4
- `;var tt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"/></svg>
5
- `;var st=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"/></svg>
6
- `;var it=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z"/></svg>
7
- `;var ot=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg>
8
- `;var rt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M245.66,146.34a8,8,0,0,1-11.32,11.32L216,139.31l-18.34,18.35a8,8,0,0,1-11.32-11.32L204.69,128l-18.35-18.34a8,8,0,0,1,11.32-11.32L216,116.69l18.34-18.35a8,8,0,0,1,11.32,11.32L227.31,128ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm97.15-54.15a8,8,0,0,0-10-.16l-65.57,51A4,4,0,0,0,80,79.84v96.32a4,4,0,0,0,1.55,3.15l65.57,51a8,8,0,0,0,9,.56,8.29,8.29,0,0,0,3.91-7.18V32.25A8.27,8.27,0,0,0,157.12,25.85Z"/></svg>
9
- `;var nt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M160,32.25V223.69a8.29,8.29,0,0,1-3.91,7.18,8,8,0,0,1-9-.56l-65.57-51A4,4,0,0,1,80,176.16V79.84a4,4,0,0,1,1.55-3.15l65.57-51a8,8,0,0,1,10,.16A8.27,8.27,0,0,1,160,32.25ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm126.77,20.84a8,8,0,0,0-.72,11.3,24,24,0,0,1,0,31.72,8,8,0,1,0,12,10.58,40,40,0,0,0,0-52.88A8,8,0,0,0,186.74,100.84Zm40.89-26.17a8,8,0,1,0-11.92,10.66,64,64,0,0,1,0,85.34,8,8,0,1,0,11.92,10.66,80,80,0,0,0,0-106.66Z"/></svg>
10
- `;var Pt={close:et,collapse:tt,expand:st,pause:it,play:ot,soundOff:rt,soundOn:nt},Ht=Object.fromEntries(Object.entries(Pt).map(([i,e])=>[i,e.replace("<svg",'<svg class="icon" aria-hidden="true" focusable="false"')]));function A(i){return Xe(Ht[i])}var{I:Ms}=Fe;var at=i=>i.strings===void 0;var G=(i,e)=>{var s;let t=i._$AN;if(t===void 0)return!1;for(let o of t)(s=o._$AO)==null||s.call(o,e,!1),G(o,e);return!0},ae=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while((t==null?void 0:t.size)===0)},lt=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),Rt(e)}};function Vt(i){this._$AN!==void 0?(ae(this),this._$AM=i,lt(this)):this._$AM=i}function kt(i,e=!1,t=0){let s=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(s))for(let r=t;r<s.length;r++)G(s[r],!1),ae(s[r]);else s!=null&&(G(s,!1),ae(s));else G(this,i)}var Rt=i=>{var e,t;i.type==ne.CHILD&&((e=i._$AP)!=null||(i._$AP=kt),(t=i._$AQ)!=null||(i._$AQ=Vt))},le=class extends H{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,s){super._$AT(e,t,s),lt(this),this.isConnected=e._$AU}_$AO(e,t=!0){var s,o;e!==this.isConnected&&(this.isConnected=e,e?(s=this.reconnected)==null||s.call(this):(o=this.disconnected)==null||o.call(this)),t&&(G(this,e),ae(this))}setValue(e){if(at(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var V=()=>new we,we=class{},xe=new WeakMap,k=j(class extends le{render(i){return h}update(i,[e]){var s;let t=e!==this.G;return t&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(s=i.options)==null?void 0:s.host,this.rt(this.ct=i.element)),h}rt(i){var e;if(this.G!==void 0)if(this.isConnected||(i=void 0),typeof this.G=="function"){let t=(e=this.ht)!=null?e:globalThis,s=xe.get(t);s===void 0&&(s=new WeakMap,xe.set(t,s)),s.get(this.G)!==void 0&&this.G.call(this.ht,void 0),s.set(this.G,i),i!==void 0&&this.G.call(this.ht,i)}else this.G.value=i}get lt(){var i,e,t;return typeof this.G=="function"?(e=xe.get((i=this.ht)!=null?i:globalThis))==null?void 0:e.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function he(i){if(!i)return null;try{let{protocol:e}=new URL(i);return e==="https:"||e==="http:"?i:null}catch(e){return null}}function Ut(){var i,e;return(e=(i=globalThis.matchMedia)==null?void 0:i.call(globalThis,"(prefers-reduced-motion: reduce)").matches)!=null?e:!1}function q(i,e){return!e.failed&&he(i.media_url)!==null}function W(i,e){let t=he(i.poster_url),s=he(i.media_url);return u`
11
- ${t?u`<img class="poster" alt="" src=${t} />`:h}
12
- ${s&&!e.failed?u`
1
+ "use strict";var VtexAdsStories=(()=>{var Le=Object.defineProperty;var oo=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.prototype.hasOwnProperty;var no=(o,e)=>{for(var t in e)Le(o,t,{get:e[t],enumerable:!0})},ao=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of io(e))!so.call(o,i)&&i!==t&&Le(o,i,{get:()=>e[i],enumerable:!(r=oo(e,i))||r.enumerable});return o};var lo=o=>ao(Le({},"__esModule",{value:!0}),o);var ji={};no(ji,{TAG_NAME:()=>x,VtexAdsStoryCarouselElement:()=>D,defineVtexAdsStoryCarousel:()=>ye});var ve=globalThis,ge=ve.ShadowRoot&&(ve.ShadyCSS===void 0||ve.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,De=Symbol(),ft=new WeakMap,te=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==De)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ge&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ft.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ft.set(t,e))}return e}toString(){return this.cssText}},mt=o=>new te(typeof o=="string"?o:o+"",void 0,De),g=(o,...e)=>{let t=o.length===1?o[0]:e.reduce((r,i,s)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new te(t,o,De)},yt=(o,e)=>{if(ge)o.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=ve.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,o.appendChild(r)}},Ve=ge?o=>o:o=>o instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return mt(t)})(o):o;var{is:co,defineProperty:po,getOwnPropertyDescriptor:uo,getOwnPropertyNames:ho,getOwnPropertySymbols:fo,getPrototypeOf:mo}=Object,M=globalThis,vt=M.trustedTypes,yo=vt?vt.emptyScript:"",Ne=M.reactiveElementPolyfillSupport,re=(o,e)=>o,He={toAttribute(o,e){switch(e){case Boolean:o=o?yo:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,e){let t=o;switch(e){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o)}catch(r){t=null}}return t}},$t=(o,e)=>!co(o,e),gt={attribute:!0,type:String,converter:He,reflect:!1,useDefault:!1,hasChanged:$t},bt,xt;(bt=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(xt=M.litPropertyMetadata)!=null||(M.litPropertyMetadata=new WeakMap);var E=class extends HTMLElement{static addInitializer(e){var t;this._$Ei(),((t=this.l)!=null?t:this.l=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=gt){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&po(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){var n;let{get:i,set:s}=(n=uo(this.prototype,e))!=null?n:{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){let d=i==null?void 0:i.call(this);s==null||s.call(this,a),this.requestUpdate(e,d,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){var t;return(t=this.elementProperties.get(e))!=null?t:gt}static _$Ei(){if(this.hasOwnProperty(re("elementProperties")))return;let e=mo(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(re("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(re("properties"))){let t=this.properties,r=[...ho(t),...fo(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Ve(i))}else e!==void 0&&t.push(Ve(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t,r;((t=this._$EO)!=null?t:this._$EO=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)==null||r.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){var t;let e=(t=this.shadowRoot)!=null?t:this.attachShadow(this.constructor.shadowRootOptions);return yt(e,this.constructor.elementStyles),e}connectedCallback(){var e,t;(e=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(r=>{var i;return(i=r.hostConnected)==null?void 0:i.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var r;return(r=t.hostDisconnected)==null?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){var s;let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let n=(((s=r.converter)==null?void 0:s.toAttribute)!==void 0?r.converter:He).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){var s,n,a;let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let d=r.getPropertyOptions(i),l=typeof d.converter=="function"?{fromAttribute:d.converter}:((s=d.converter)==null?void 0:s.fromAttribute)!==void 0?d.converter:He;this._$Em=i;let p=l.fromAttribute(t,d.type);this[i]=(a=p!=null?p:(n=this._$Ej)==null?void 0:n.get(i))!=null?a:p,this._$Em=null}}requestUpdate(e,t,r,i=!1,s){var n,a;if(e!==void 0){let d=this.constructor;if(i===!1&&(s=this[e]),r!=null||(r=d.getPropertyOptions(e)),!(((n=r.hasChanged)!=null?n:$t)(s,t)||r.useDefault&&r.reflect&&s===((a=this._$Ej)==null?void 0:a.get(e))&&!this.hasAttribute(d._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},n){var a,d,l;r&&!((a=this._$Ej)!=null?a:this._$Ej=new Map).has(e)&&(this._$Ej.set(e,(d=n!=null?n:t)!=null?d:this[e]),s!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&((l=this._$Eq)!=null?l:this._$Eq=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,a]of this._$Ep)this[n]=a;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[n,a]of s){let{wrapped:d}=a,l=this[n];d!==!0||this._$AL.has(n)||l===void 0||this.C(n,void 0,a,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}},wt;E.elementStyles=[],E.shadowRootOptions={mode:"open"},E[re("elementProperties")]=new Map,E[re("finalized")]=new Map,Ne==null||Ne({ReactiveElement:E}),((wt=M.reactiveElementVersions)!=null?wt:M.reactiveElementVersions=[]).push("2.1.2");var ie=globalThis,St=o=>o,be=ie.trustedTypes,At=be?be.createPolicy("lit-html",{createHTML:o=>o}):void 0,Be="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,qe="?"+T,vo=`<${qe}>`,U=document,se=()=>U.createComment(""),ne=o=>o===null||typeof o!="object"&&typeof o!="function",ze=Array.isArray,Mt=o=>ze(o)||typeof(o==null?void 0:o[Symbol.iterator])=="function",Ue=`[
2
+ \f\r]`,oe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_t=/-->/g,Ct=/>/g,N=RegExp(`>|${Ue}(?:([^\\s"'>=/]+)(${Ue}*=${Ue}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Et=/'/g,Tt=/"/g,Rt=/^(?:script|style|textarea|title)$/i,We=o=>(e,...t)=>({_$litType$:o,strings:e,values:t}),f=We(1),Yi=We(2),Ji=We(3),w=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),Pt=new WeakMap,H=U.createTreeWalker(U,129);function Ot(o,e){if(!ze(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return At!==void 0?At.createHTML(e):e}var It=(o,e)=>{let t=o.length-1,r=[],i,s=e===2?"<svg>":e===3?"<math>":"",n=oe;for(let a=0;a<t;a++){let d=o[a],l,p,c=-1,h=0;for(;h<d.length&&(n.lastIndex=h,p=n.exec(d),p!==null);)h=n.lastIndex,n===oe?p[1]==="!--"?n=_t:p[1]!==void 0?n=Ct:p[2]!==void 0?(Rt.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=N):p[3]!==void 0&&(n=N):n===N?p[0]===">"?(n=i!=null?i:oe,c=-1):p[1]===void 0?c=-2:(c=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?N:p[3]==='"'?Tt:Et):n===Tt||n===Et?n=N:n===_t||n===Ct?n=oe:(n=N,i=void 0);let m=n===N&&o[a+1].startsWith("/>")?" ":"";s+=n===oe?d+vo:c>=0?(r.push(l),d.slice(0,c)+Be+d.slice(c)+T+m):d+T+(c===-2?a:m)}return[Ot(o,s+(o[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},ae=class o{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,n=0,a=e.length-1,d=this.parts,[l,p]=It(e,t);if(this.el=o.createElement(l,r),H.currentNode=this.el.content,t===2||t===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(i=H.nextNode())!==null&&d.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(Be)){let h=p[n++],m=i.getAttribute(c).split(T),y=/([.?@])?(.*)/.exec(h);d.push({type:1,index:s,name:y[2],strings:m,ctor:y[1]==="."?we:y[1]==="?"?$e:y[1]==="@"?Se:B}),i.removeAttribute(c)}else c.startsWith(T)&&(d.push({type:6,index:s}),i.removeAttribute(c));if(Rt.test(i.tagName)){let c=i.textContent.split(T),h=c.length-1;if(h>0){i.textContent=be?be.emptyScript:"";for(let m=0;m<h;m++)i.append(c[m],se()),H.nextNode(),d.push({type:2,index:++s});i.append(c[h],se())}}}else if(i.nodeType===8)if(i.data===qe)d.push({type:2,index:s});else{let c=-1;for(;(c=i.data.indexOf(T,c+1))!==-1;)d.push({type:7,index:s}),c+=T.length-1}s++}}static createElement(e,t){let r=U.createElement("template");return r.innerHTML=e,r}};function F(o,e,t=o,r){var n,a,d;if(e===w)return e;let i=r!==void 0?(n=t._$Co)==null?void 0:n[r]:t._$Cl,s=ne(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,t,r)),r!==void 0?((d=t._$Co)!=null?d:t._$Co=[])[r]=i:t._$Cl=i),i!==void 0&&(e=F(o,i._$AS(o,e.values),i,r)),e}var xe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var l;let{el:{content:t},parts:r}=this._$AD,i=((l=e==null?void 0:e.creationScope)!=null?l:U).importNode(t,!0);H.currentNode=i;let s=H.nextNode(),n=0,a=0,d=r[0];for(;d!==void 0;){if(n===d.index){let p;d.type===2?p=new j(s,s.nextSibling,this,e):d.type===1?p=new d.ctor(s,d.name,d.strings,this,e):d.type===6&&(p=new Ae(s,this,e)),this._$AV.push(p),d=r[++a]}n!==(d==null?void 0:d.index)&&(s=H.nextNode(),n++)}return H.currentNode=U,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},j=class o{get _$AU(){var e,t;return(t=(e=this._$AM)==null?void 0:e._$AU)!=null?t:this._$Cv}constructor(e,t,r,i){var s;this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(s=i==null?void 0:i.isConnected)!=null?s:!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=F(this,e,t),ne(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==w&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==u&&ne(this._$AH)?this._$AA.nextSibling.data=e:this.T(U.createTextNode(e)),this._$AH=e}$(e){var s;let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ae.createElement(Ot(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{let n=new xe(i,this),a=n.u(this.options);n.p(t),this.T(a),this._$AH=n}}_$AC(e){let t=Pt.get(e.strings);return t===void 0&&Pt.set(e.strings,t=new ae(e)),t}k(e){ze(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let s of e)i===t.length?t.push(r=new o(this.O(se()),this.O(se()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){let i=St(e).nextSibling;St(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},B=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(e,t=this,r,i){let s=this.strings,n=!1;if(s===void 0)e=F(this,e,t,0),n=!ne(e)||e!==this._$AH&&e!==w,n&&(this._$AH=e);else{let a=e,d,l;for(e=s[0],d=0;d<s.length-1;d++)l=F(this,a[r+d],t,d),l===w&&(l=this._$AH[d]),n||(n=!ne(l)||l!==this._$AH[d]),l===u?e=u:e!==u&&(e+=(l!=null?l:"")+s[d+1]),this._$AH[d]=l}n&&!i&&this.j(e)}j(e){e===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e!=null?e:"")}},we=class extends B{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===u?void 0:e}},$e=class extends B{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==u)}},Se=class extends B{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){var n;if((e=(n=F(this,e,t,0))!=null?n:u)===w)return;let r=this._$AH,i=e===u&&r!==u||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==u&&(r===u||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)==null?void 0:t.host)!=null?r:this.element,e):this._$AH.handleEvent(e)}},Ae=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){F(this,e)}},Lt={M:Be,P:T,A:qe,C:1,L:It,R:xe,D:Mt,V:F,I:j,H:B,N:$e,U:Se,B:we,F:Ae},Fe=ie.litHtmlPolyfillSupport,kt;Fe==null||Fe(ae,j),((kt=ie.litHtmlVersions)!=null?kt:ie.litHtmlVersions=[]).push("3.3.3");var Dt=(o,e,t)=>{var s,n;let r=(s=t==null?void 0:t.renderBefore)!=null?s:e,i=r._$litPart$;if(i===void 0){let a=(n=t==null?void 0:t.renderBefore)!=null?n:null;r._$litPart$=i=new j(e.insertBefore(se(),a),a,void 0,t!=null?t:{})}return i._$AI(o),i};var q=globalThis,R=class extends E{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,r;let e=super.createRenderRoot();return(r=(t=this.renderOptions).renderBefore)!=null||(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Dt(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return w}},Vt;R._$litElement$=!0,R.finalized=!0,(Vt=q.litElementHydrateSupport)==null||Vt.call(q,{LitElement:R});var je=q.litElementPolyfillSupport;je==null||je({LitElement:R});var Nt;((Nt=q.litElementVersions)!=null?Nt:q.litElementVersions=[]).push("4.2.2");var{I:go}=Lt,Ht=o=>o;var Ft=o=>o.strings===void 0,Ut=()=>document.createComment(""),G=(o,e,t)=>{var s;let r=o._$AA.parentNode,i=e===void 0?o._$AB:e._$AA;if(t===void 0){let n=r.insertBefore(Ut(),i),a=r.insertBefore(Ut(),i);t=new go(n,a,o,o.options)}else{let n=t._$AB.nextSibling,a=t._$AM,d=a!==o;if(d){let l;(s=t._$AQ)==null||s.call(t,o),t._$AM=o,t._$AP!==void 0&&(l=o._$AU)!==a._$AU&&t._$AP(l)}if(n!==i||d){let l=t._$AA;for(;l!==n;){let p=Ht(l).nextSibling;Ht(r).insertBefore(l,i),l=p}}}return t},O=(o,e,t=o)=>(o._$AI(e,t),o),bo={},Bt=(o,e=bo)=>o._$AH=e,qt=o=>o._$AH,_e=o=>{o._$AR(),o._$AA.remove()};var I={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},P=o=>(...e)=>({_$litDirective$:o,values:e}),_=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var de=(o,e)=>{var r;let t=o._$AN;if(t===void 0)return!1;for(let i of t)(r=i._$AO)==null||r.call(i,e,!1),de(i,e);return!0},Ce=o=>{let e,t;do{if((e=o._$AM)===void 0)break;t=e._$AN,t.delete(o),o=e}while((t==null?void 0:t.size)===0)},zt=o=>{for(let e;e=o._$AM;o=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(o))break;t.add(o),$o(e)}};function xo(o){this._$AN!==void 0?(Ce(this),this._$AM=o,zt(this)):this._$AM=o}function wo(o,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)de(r[s],!1),Ce(r[s]);else r!=null&&(de(r,!1),Ce(r));else de(this,o)}var $o=o=>{var e,t;o.type==I.CHILD&&((e=o._$AP)!=null||(o._$AP=wo),(t=o._$AQ)!=null||(o._$AQ=xo))},Ee=class extends _{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),zt(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(de(this,e),Ce(this))}setValue(e){if(Ft(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var k=()=>new Ze,Ze=class{},Ge=new WeakMap,$=P(class extends Ee{render(o){return u}update(o,[e]){var r;let t=e!==this.G;return t&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=o.options)==null?void 0:r.host,this.rt(this.ct=o.element)),u}rt(o){var e;if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=(e=this.ht)!=null?e:globalThis,r=Ge.get(t);r===void 0&&(r=new WeakMap,Ge.set(t,r)),r.get(this.G)!==void 0&&this.G.call(this.ht,void 0),r.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){var o,e,t;return typeof this.G=="function"?(e=Ge.get((o=this.ht)!=null?o:globalThis))==null?void 0:e.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var le=class extends _{constructor(e){if(super(e),this.it=u,e.type!==I.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===u||e==null)return this._t=void 0,this.it=e;if(e===w)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};le.directiveName="unsafeHTML",le.resultType=1;var Wt=P(le);var jt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M168.49,199.51a12,12,0,0,1-17,17l-80-80a12,12,0,0,1,0-17l80-80a12,12,0,0,1,17,17L97,128Z"/></svg>
4
+ `;var Gt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"/></svg>
5
+ `;var Zt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/></svg>
6
+ `;var Qt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"/></svg>';var Kt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z"/></svg>
7
+ `;var Xt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z"/></svg>
8
+ `;var Yt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"/></svg>';var Jt=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z"/></svg>
9
+ `;var er=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"/></svg>
10
+ `;var tr='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/></svg>';var rr=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M245.66,146.34a8,8,0,0,1-11.32,11.32L216,139.31l-18.34,18.35a8,8,0,0,1-11.32-11.32L204.69,128l-18.35-18.34a8,8,0,0,1,11.32-11.32L216,116.69l18.34-18.35a8,8,0,0,1,11.32,11.32L227.31,128ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm97.15-54.15a8,8,0,0,0-10-.16l-65.57,51A4,4,0,0,0,80,79.84v96.32a4,4,0,0,0,1.55,3.15l65.57,51a8,8,0,0,0,9,.56,8.29,8.29,0,0,0,3.91-7.18V32.25A8.27,8.27,0,0,0,157.12,25.85Z"/></svg>
11
+ `;var or=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M160,32.25V223.69a8.29,8.29,0,0,1-3.91,7.18,8,8,0,0,1-9-.56l-65.57-51A4,4,0,0,1,80,176.16V79.84a4,4,0,0,1,1.55-3.15l65.57-51a8,8,0,0,1,10,.16A8.27,8.27,0,0,1,160,32.25ZM60,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H60a4,4,0,0,0,4-4V84A4,4,0,0,0,60,80Zm126.77,20.84a8,8,0,0,0-.72,11.3,24,24,0,0,1,0,31.72,8,8,0,1,0,12,10.58,40,40,0,0,0,0-52.88A8,8,0,0,0,186.74,100.84Zm40.89-26.17a8,8,0,1,0-11.92,10.66,64,64,0,0,1,0,85.34,8,8,0,1,0,11.92,10.66,80,80,0,0,0,0-106.66Z"/></svg>
12
+ `;var ir='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/></svg>';var sr=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"/></svg>
13
+ `;var Vo={caretUp:Qt,close:Zt,collapse:Kt,expand:Xt,minus:Yt,next:Gt,pause:Jt,play:er,plus:tr,previous:jt,soundOff:rr,soundOn:or,trash:ir,warning:sr},No=Object.fromEntries(Object.entries(Vo).map(([o,e])=>[o,e.replace("<svg",'<svg class="icon" aria-hidden="true" focusable="false"')]));function v(o){return Wt(No[o])}var nr={watch:"Watch video",show:"Show video",carousel:"Videos",carouselRole:"carousel",previous:"Previous video",next:"Next video",player:"Video",expand:"Expand video",collapse:"Collapse video",close:"Close video",play:"Play video",pause:"Pause video",soundOn:"Turn sound on",soundOff:"Turn sound off",addToCart:"Add to cart",cartQuantity:"Quantity in cart",decreaseQuantity:"Decrease quantity",removeFromCart:"Remove from cart",increaseQuantity:"Increase quantity",unavailable:"Product unavailable",soldOut:"Sold out",viewProduct:"View product",videoUnavailable:"Video unavailable",videoFailed:"Couldn't load the video",retry:"Try again",videoLoading:"Loading video",product:(o,e,t,r)=>{let i=o;return e&&t?i=`${o}, was ${t}, now ${e}`:e&&(i=`${o}, ${e}`),r?`${i}, ${r}`:i},position:(o,e,t)=>t>1?`${o} ${e+1} of ${t}`:o};var ar={watch:"Ver video",show:"Mostrar video",carousel:"Videos",carouselRole:"carrusel",previous:"Video anterior",next:"Video siguiente",player:"Video",expand:"Ampliar video",collapse:"Reducir video",close:"Cerrar video",play:"Reproducir video",pause:"Pausar video",soundOn:"Activar sonido",soundOff:"Desactivar sonido",addToCart:"Agregar al carrito",cartQuantity:"Cantidad en el carrito",decreaseQuantity:"Disminuir cantidad",removeFromCart:"Quitar del carrito",increaseQuantity:"Aumentar cantidad",unavailable:"Producto no disponible",soldOut:"Agotado",viewProduct:"Ver producto",videoUnavailable:"Video no disponible",videoFailed:"No se pudo cargar el video",retry:"Intentar de nuevo",videoLoading:"Cargando video",product:(o,e,t,r)=>{let i=o;return e&&t?i=`${o}, antes ${t}, ahora ${e}`:e&&(i=`${o}, ${e}`),r?`${i}, ${r}`:i},position:(o,e,t)=>t>1?`${o} ${e+1} de ${t}`:o};var Z={watch:"Assistir v\xEDdeo",show:"Mostrar v\xEDdeo",carousel:"V\xEDdeos",carouselRole:"carrossel",previous:"V\xEDdeo anterior",next:"Pr\xF3ximo v\xEDdeo",player:"V\xEDdeo",expand:"Expandir v\xEDdeo",collapse:"Reduzir v\xEDdeo",close:"Fechar v\xEDdeo",play:"Reproduzir v\xEDdeo",pause:"Pausar v\xEDdeo",soundOn:"Ativar som",soundOff:"Desativar som",addToCart:"Adicionar ao carrinho",cartQuantity:"Quantidade no carrinho",decreaseQuantity:"Diminuir quantidade",removeFromCart:"Remover do carrinho",increaseQuantity:"Aumentar quantidade",unavailable:"Produto indispon\xEDvel",soldOut:"Esgotado",viewProduct:"Ver produto",videoUnavailable:"V\xEDdeo indispon\xEDvel",videoFailed:"N\xE3o foi poss\xEDvel carregar o v\xEDdeo",retry:"Tentar de novo",videoLoading:"Carregando v\xEDdeo",product:(o,e,t,r)=>{let i=o;return e&&t?i=`${o}, de ${t} por ${e}`:e&&(i=`${o}, ${e}`),r?`${i}, ${r}`:i},position:(o,e,t)=>t>1?`${o} ${e+1} de ${t}`:o};var Ho=new Map([["pt",Z],["es",ar],["en",nr]]);function dr(o,e={}){var n,a,d;let t=o.split("-")[0].toLowerCase(),r=(n=Ho.get(t))!=null?n:Z,i=(a=e.addToCart)==null?void 0:a.trim(),s=(d=e.viewProduct)==null?void 0:d.trim();return{...r,...i&&{addToCart:i},...s&&{viewProduct:s}}}function b(o){if(!o)return null;try{let{protocol:e}=new URL(o);return e==="https:"||e==="http:"?o:null}catch(e){return null}}var lr="https://store.invalid";function Uo(o){try{let e=new URL(o,lr);return e.origin!==lr||e.pathname.startsWith("//")?null:`${e.pathname}${e.search}${e.hash}`}catch(e){return null}}function Te(o){return o?o.startsWith("/")?Uo(o):b(o):null}var cr="(prefers-reduced-motion: reduce)";function Q(){var o,e;return(e=(o=globalThis.matchMedia)==null?void 0:o.call(globalThis,cr).matches)!=null?e:!1}function K(o,e){return!e.failed&&!e.retrying&&b(o.media_url)!==null}function Fo(o,e){let t=r=>{r.stopPropagation(),e==null||e()};return f`
14
+ <div class="media-status" ?data-retry=${!!e}>
15
+ <span class="media-status-text">
16
+ ${v("warning")}
17
+ ${e?o.videoFailed:o.videoUnavailable}
18
+ </span>
19
+ ${e?f`
20
+ <button type="button" class="media-retry" @click=${t}>
21
+ ${o.retry}
22
+ </button>
23
+ `:u}
24
+ </div>
25
+ `}function Bo(o){return f`
26
+ <div class="media-status">
27
+ <span class="media-status-text">
28
+ <span class="media-spinner" aria-hidden="true"></span>
29
+ ${o.videoLoading}
30
+ </span>
31
+ </div>
32
+ `}function qo(o,e,t){return o.failed?Fo(e,t):o.retrying?Bo(e):u}function zo(o,{labels:e=Z,onRetry:t,announce:r=!0}){return f`
33
+ <div
34
+ class="media-notice"
35
+ role=${r?"status":u}
36
+ aria-hidden=${r?u:"true"}
37
+ >
38
+ ${qo(o,e,t)}
39
+ </div>
40
+ `}function ce(o,e,t={}){let{withVideo:r=!0,loop:i=!0,onEnded:s,autoplay:n=!0}=t,a=b(o.poster_url),d=r?b(o.media_url):null,l=n?"metadata":"auto";return f`
41
+ ${a?f`<img class="poster" alt="" src=${a} />`:u}
42
+ ${d&&!e.failed?f`
13
43
  <video
14
44
  class="video"
15
45
  muted
16
46
  playsinline
17
- loop
18
- preload="metadata"
47
+ ?loop=${i}
48
+ preload=${l}
19
49
  .muted=${!0}
20
- ?autoplay=${!Ut()}
21
- poster=${t!=null?t:h}
22
- src=${s}
23
- ${k(e.ref)}
50
+ ?autoplay=${n&&!Q()}
51
+ poster=${a!=null?a:u}
52
+ src=${d}
53
+ ${$(e.ref)}
24
54
  @play=${e.sync}
25
55
  @pause=${e.sync}
26
56
  @volumechange=${e.sync}
57
+ @loadeddata=${e.loaded}
27
58
  @error=${e.fail}
59
+ @ended=${s}
28
60
  ></video>
29
- `:h}
30
- `}function de(i){var e;(e=i.play())==null||e.catch(()=>{})}var L=class{constructor(e){this.host=e;this.ref=V();this.paused=!0;this.muted=!0;this.failed=!1;this.sync=()=>{let e=this.ref.value;e&&(this.paused=e.paused,this.muted=e.muted,this.host.requestUpdate())};this.fail=()=>{this.failed=!0,this.host.requestUpdate()}}reset(){this.paused=!0,this.muted=!0,this.failed=!1}play(){let e=this.ref.value;e&&de(e)}pause(){var e;(e=this.ref.value)==null||e.pause()}resume(){let e=this.ref.value;e!=null&&e.autoplay&&de(e)}togglePlayback(){let e=this.ref.value;e&&(e.paused?de(e):e.pause())}toggleMuted(){let e=this.ref.value;e&&(e.muted=!e.muted)}};var Ee=x`
61
+ `:u}
62
+ ${d?zo(e,t):u}
63
+ `}var Qe=g`
64
+ /* The live region the notice shows in, over the cover. Empty until the
65
+ video can't load or is loading again. Clicks go through to the card. */
66
+ .media-notice {
67
+ position: absolute;
68
+ inset: 0;
69
+ pointer-events: none;
70
+ }
71
+
72
+ /* The notice: a dimmed layer with the text in the middle. */
73
+ .media-status {
74
+ position: absolute;
75
+ inset: 0;
76
+ display: flex;
77
+ flex-direction: column;
78
+ gap: 12px;
79
+ align-items: center;
80
+ justify-content: center;
81
+ box-sizing: border-box;
82
+ padding: 16px;
83
+ background: rgba(0, 0, 0, 0.45);
84
+ color: #fff;
85
+ text-align: center;
86
+ pointer-events: none;
87
+ }
88
+
89
+ .media-status > * {
90
+ animation: media-status-in 0.4s ease-out both;
91
+ }
92
+
93
+ .media-status-text {
94
+ display: flex;
95
+ flex-direction: column;
96
+ gap: 8px;
97
+ align-items: center;
98
+ max-width: 100%;
99
+ font-size: 14px;
100
+ font-weight: 600;
101
+ line-height: 1.3;
102
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
103
+ }
104
+
105
+ .media-status-text .icon {
106
+ width: 18px;
107
+ height: 18px;
108
+ }
109
+
110
+ .media-status[data-retry] .media-status-text .icon {
111
+ width: 24px;
112
+ height: 24px;
113
+ }
114
+
115
+ .media-retry {
116
+ min-height: 36px;
117
+ padding: 0 16px;
118
+ border: 0;
119
+ border-radius: var(--_button-radius);
120
+ background: rgba(255, 255, 255, 0.15);
121
+ backdrop-filter: blur(4px);
122
+ box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.42);
123
+ color: #fff;
124
+ font: inherit;
125
+ font-size: 14px;
126
+ font-weight: 600;
127
+ cursor: pointer;
128
+ pointer-events: auto;
129
+ animation-delay: 0.06s;
130
+ }
131
+
132
+ .media-retry:focus-visible {
133
+ outline: 2px solid #fff;
134
+ outline-offset: 2px;
135
+ }
136
+
137
+ @media (hover: hover) and (pointer: fine) {
138
+ .media-retry:hover {
139
+ background: rgba(255, 255, 255, 0.25);
140
+ }
141
+ }
142
+
143
+ /* It spins with reduced motion too: a still ring wouldn't read as
144
+ loading. */
145
+ .media-spinner {
146
+ width: 24px;
147
+ height: 24px;
148
+ box-sizing: border-box;
149
+ border: 2px solid rgba(255, 255, 255, 0.35);
150
+ border-top-color: #fff;
151
+ border-radius: 50%;
152
+ animation: media-spin 0.8s linear infinite;
153
+ }
154
+
155
+ @keyframes media-status-in {
156
+ from {
157
+ opacity: 0;
158
+ transform: translateY(4px);
159
+ }
160
+ }
161
+
162
+ @keyframes media-spin {
163
+ to {
164
+ transform: rotate(360deg);
165
+ }
166
+ }
167
+
168
+ @media (prefers-reduced-motion: reduce) {
169
+ .media-status > :not(.media-spinner) {
170
+ animation: none;
171
+ }
172
+ }
173
+ `;function X(o){var e;(e=o.play())==null||e.catch(()=>{})}var z=class{constructor(e){this.host=e;this.ref=k();this.paused=!0;this.muted=!0;this.status="playable";this.sync=()=>{let e=this.ref.value;e&&(this.paused=e.paused,this.muted=e.muted,this.host.requestUpdate())};this.loaded=()=>{this.settleReady(!0),this.retrying&&(this.status="playable",this.host.requestUpdate())};this.fail=()=>{this.status="failed",this.settleReady(!1),this.host.requestUpdate()};this.waitForReady()}get ready(){return this.readyState}get failed(){return this.status==="failed"}get retrying(){return this.status==="retrying"}get playing(){let e=this.ref.value;return!!e&&e.isConnected&&!e.paused}reset(){this.cancelRetry(),this.paused=!0,this.muted=!0,this.status="playable",this.waitForReady()}clearFailure(){this.retrying&&(this.cancelRetry(),this.waitForReady()),this.status="playable",this.host.requestUpdate()}retry(){return this.retrying?this.ready:this.failed?(this.reset(),this.status="retrying",this.host.requestUpdate(),this.ready):Promise.resolve(!1)}play(){let e=this.ref.value;e&&X(e)}pause(){var e;(e=this.ref.value)==null||e.pause()}resume(){let e=this.ref.value;e!=null&&e.autoplay&&X(e)}togglePlayback(){let e=this.ref.value;e&&(e.paused?X(e):e.pause())}mute(){let e=this.ref.value;e&&(e.muted=!0)}restart({withSound:e=!1}={}){let t=this.ref.value;t&&(t.currentTime=0,e?this.playWithSound():X(t))}playWithSound(){var t;let e=this.ref.value;e&&(e.muted=!1,(t=e.play())==null||t.catch(r=>{!(r instanceof DOMException&&r.name==="NotAllowedError")||this.ref.value!==e||!e.isConnected||(e.muted=!0,X(e))}))}toggleMuted(){let e=this.ref.value;e&&(e.muted=!e.muted)}cancelRetry(){this.retrying&&this.settleReady(!1)}waitForReady(){this.readyState=new Promise(e=>this.settleReady=e)}};var Pe="pt-BR";function pr(o){let e=Number.NaN;return typeof o=="number"?e=o:typeof o=="string"&&o.trim()!==""&&(e=Number(o)),Number.isFinite(e)&&e>0?e:void 0}function Xe(o){let e=pr(o==null?void 0:o.price),t=pr(o==null?void 0:o.promotional_price);return t!==void 0&&(e===void 0||t<e)?e===void 0?{price:t}:{price:t,listPrice:e}:e===void 0?void 0:{price:e}}function Wo(o){try{return Intl.NumberFormat.supportedLocalesOf(o).length>0}catch(e){return!1}}var Ke=Intl;function jo(o){var t;if(!/^[a-z]{3}$/i.test(o))return!1;let e=(t=Ke.supportedValuesOf)==null?void 0:t.call(Ke,"currency");return e?e.includes(o.toUpperCase()):!0}function Ye(o,e){let t=new Intl.NumberFormat(o&&Wo(o)?o:Pe,{style:"currency",currency:e&&jo(e)?e:"BRL"});return r=>t.format(r)}function Je(o,e,t,r){var h,m,y,A,S,W;let i=o.product,s=(h=i==null?void 0:i.product_name)==null?void 0:h.trim();if(!i||!s)return;let n={name:s,imageUrl:(m=b(i.image_url))!=null?m:void 0,url:(y=Te(o.destination_url))!=null?y:void 0,sku:((A=i.product_sku)==null?void 0:A.trim())||void 0,seller:((S=i.seller_id)==null?void 0:S.trim())||void 0};if(r==="loading")return{...n,label:t.product(s),isLoading:!0};let a=(r==null?void 0:r.available)===!1?t.soldOut:void 0,d=V=>a&&(V==null?void 0:V.price)===0?void 0:V,l=(W=d(r==null?void 0:r.price))!=null?W:d(Xe(i.product_metadata)),p=l&&e(l.price),c=(l==null?void 0:l.listPrice)===void 0?void 0:e(l.listPrice);return{...n,price:p,listPrice:c,soldOut:a,label:t.product(s,p,c,a)}}var Go=f`
174
+ <span
175
+ class="product-price product-loading product-price-loading"
176
+ aria-hidden="true"
177
+ ></span>
178
+ `,Zo=f`
179
+ <span
180
+ class="product-loading product-add-to-cart-loading"
181
+ aria-hidden="true"
182
+ ></span>
183
+ `;function Qo({isLoading:o,soldOut:e,price:t,listPrice:r}){return o?Go:t?f`
184
+ <span class="product-price">
185
+ <span>${t}</span>
186
+ ${r?f`<s class="product-list-price">${r}</s>`:u}
187
+ </span>
188
+ `:e?f`<span class="product-price product-sold-out">${e}</span>`:u}function ur(o){return f`
189
+ ${o.imageUrl?f`<img class="product-image" alt="" src=${o.imageUrl} />`:u}
190
+ <span class="product-info">
191
+ <span class="product-name">${o.name}</span>
192
+ ${Qo(o)}
193
+ </span>
194
+ `}function et(o,e){return f`
195
+ <button
196
+ type="button"
197
+ class="card-product"
198
+ aria-label=${o.label}
199
+ @click=${e}
200
+ >
201
+ ${ur(o)}
202
+ </button>
203
+ `}var hr="product-stepper-add",fr="product-add-to-cart";function tt(o,e){var r;let t=e==="stepper"?hr:fr;(r=o.querySelector(`.${t}`))==null||r.focus()}function Ko(o,{labels:e,onAddToCart:t,onRemoveFromCart:r}){let i=o===1;return f`
204
+ <div
205
+ class="product-action product-stepper"
206
+ role="group"
207
+ aria-label=${e.cartQuantity}
208
+ >
209
+ <button
210
+ type="button"
211
+ class="product-stepper-button product-stepper-remove"
212
+ aria-label=${i?e.removeFromCart:e.decreaseQuantity}
213
+ @click=${r}
214
+ >
215
+ ${v(i?"trash":"minus")}
216
+ </button>
217
+ <span class="product-quantity">${o}</span>
218
+ <button
219
+ type="button"
220
+ class="product-stepper-button ${hr}"
221
+ aria-label=${e.increaseQuantity}
222
+ @click=${t}
223
+ >
224
+ ${v("plus")}
225
+ </button>
226
+ </div>
227
+ `}function Xo({isLoading:o,soldOut:e,sku:t},r){let{labels:i,onAddToCart:s,cartQuantity:n=0}=r;return!t||!s?u:o?Zo:e?f`
228
+ <button type="button" class="product-action product-unavailable" disabled>
229
+ ${i.unavailable}
230
+ </button>
231
+ `:n>0?Ko(n,r):f`
232
+ <button
233
+ type="button"
234
+ class="product-action ${fr}"
235
+ @click=${s}
236
+ >
237
+ ${i.addToCart}
238
+ </button>
239
+ `}function Yo({sku:o},{labels:e,cartQuantity:t=0,onAddToCart:r}){return!o||!r?u:f`
240
+ <span class="product-cart-status" role="status">
241
+ ${t>0?`${e.cartQuantity}: ${t}`:""}
242
+ </span>
243
+ `}function rt(o,e){let{open:t}=e;return f`
244
+ <div class="card-product product-expandable" ?data-open=${t}>
245
+ <button
246
+ type="button"
247
+ class="product-summary"
248
+ aria-label=${o.label}
249
+ aria-expanded=${t?"true":"false"}
250
+ aria-controls=${e.panelId}
251
+ @click=${e.onToggle}
252
+ >
253
+ ${ur(o)}
254
+ <span class="product-toggle">${v("caretUp")}</span>
255
+ </button>
256
+ <div id=${e.panelId} class="product-panel" ?inert=${!t}>
257
+ <div class="product-actions">
258
+ ${Yo(o,e)}
259
+ ${Xo(o,e)}
260
+ ${o.url?f`
261
+ <a
262
+ class="product-action product-view"
263
+ href=${o.url}
264
+ target="_blank"
265
+ rel="noopener noreferrer"
266
+ >
267
+ ${e.labels.viewProduct}
268
+ </a>
269
+ `:u}
270
+ </div>
271
+ </div>
272
+ </div>
273
+ `}function ke(o){var r;if(o.product)return;let e=(r=o.call_to_action)==null?void 0:r.trim(),t=Te(o.destination_url);return e&&t?{label:e,url:t}:void 0}function pe(o,e){let t=e?r=>{r.preventDefault(),e()}:void 0;return f`
274
+ <a
275
+ class="card-cta"
276
+ href=${o.url}
277
+ target="_blank"
278
+ rel="noopener noreferrer"
279
+ @click=${t}
280
+ >
281
+ <span class="cta-label">${o.label}</span>
282
+ ${v("next")}
283
+ </a>
284
+ `}var ot=g`
285
+ /* A glass pill at the bottom of the card, above its button: the product or
286
+ the call to action. */
287
+ .card-product,
288
+ .card-cta {
289
+ position: absolute;
290
+ right: 12px;
291
+ bottom: 12px;
292
+ left: 12px;
293
+ z-index: 1;
294
+ display: flex;
295
+ gap: 8px;
296
+ align-items: center;
297
+ box-sizing: border-box;
298
+ padding: var(--_pill-inset);
299
+ border: 0;
300
+ border-radius: var(--_pill-radius);
301
+ background: rgba(255, 255, 255, 0.15);
302
+ backdrop-filter: blur(5px);
303
+ color: #fff;
304
+ font: inherit;
305
+ text-align: left;
306
+ isolation: isolate;
307
+ transition: transform 0.2s ease;
308
+ }
309
+
310
+ /* The glass's tint and inner light, darker on hover. */
311
+ .card-product::before,
312
+ .card-cta::before {
313
+ position: absolute;
314
+ inset: 0;
315
+ z-index: -1;
316
+ border-radius: inherit;
317
+ background: rgba(0, 0, 0, 0.15);
318
+ box-shadow: inset 0 0 3px rgba(255, 255, 255, 0.42);
319
+ content: "";
320
+ transition: background-color 0.2s ease;
321
+ }
322
+
323
+ button.card-product,
324
+ .card-cta {
325
+ cursor: pointer;
326
+ }
327
+
328
+ .card-product:focus-visible,
329
+ .card-cta:focus-visible {
330
+ outline: 2px solid #fff;
331
+ outline-offset: 2px;
332
+ }
333
+
334
+ @media (hover: hover) and (pointer: fine) {
335
+ .card-product:hover,
336
+ .card-cta:hover {
337
+ transform: translateY(-2px);
338
+ }
339
+
340
+ .card-product:hover::before,
341
+ .card-cta:hover::before {
342
+ background: rgba(0, 0, 0, 0.32);
343
+ }
344
+ }
345
+
346
+ /* A Story with a link: the pill is the call to action, its text centered
347
+ with a caret after it. */
348
+ .card-cta {
349
+ justify-content: center;
350
+ gap: 6px;
351
+ height: 48px;
352
+ padding: 0 16px;
353
+ font-size: 14px;
354
+ font-weight: 700;
355
+ line-height: 1;
356
+ text-decoration: none;
357
+ }
358
+
359
+ .cta-label {
360
+ min-width: 0;
361
+ overflow: hidden;
362
+ text-overflow: ellipsis;
363
+ white-space: nowrap;
364
+ }
365
+
366
+ .card-cta .icon {
367
+ flex: none;
368
+ width: 14px;
369
+ height: 14px;
370
+ }
371
+
372
+ /* In the player: the pill is a toggle, with the actions panel below. */
373
+ .product-expandable {
374
+ display: block;
375
+ padding: 0;
376
+ transition:
377
+ background-color 0.3s ease,
378
+ color 0.3s ease,
379
+ box-shadow 0.3s ease,
380
+ transform 0.2s ease;
381
+ }
382
+
383
+ .product-expandable::before {
384
+ transition:
385
+ opacity 0.3s ease,
386
+ background-color 0.2s ease;
387
+ }
388
+
389
+ .product-summary {
390
+ display: flex;
391
+ gap: 8px;
392
+ align-items: center;
393
+ box-sizing: border-box;
394
+ width: 100%;
395
+ padding: var(--_pill-inset);
396
+ border: 0;
397
+ border-radius: inherit;
398
+ background: transparent;
399
+ color: inherit;
400
+ font: inherit;
401
+ text-align: left;
402
+ cursor: pointer;
403
+ transition: padding 0.3s ease;
404
+ }
405
+
406
+ .product-summary:focus-visible {
407
+ outline: 2px solid currentColor;
408
+ outline-offset: 2px;
409
+ }
410
+
411
+ /* The caret points up while closed and down while open. */
412
+ .product-toggle {
413
+ display: grid;
414
+ flex: none;
415
+ margin-right: 4px;
416
+ opacity: 0.7;
417
+ transition:
418
+ transform 0.3s ease,
419
+ opacity 0.2s ease;
420
+ }
421
+
422
+ .product-toggle .icon {
423
+ width: 14px;
424
+ height: 14px;
425
+ }
426
+
427
+ .product-summary:hover .product-toggle {
428
+ opacity: 1;
429
+ }
430
+
431
+ /* Closed: 0 rows tall, so it grows smoothly when it opens. */
432
+ .product-panel {
433
+ display: grid;
434
+ grid-template-rows: 0fr;
435
+ transition: grid-template-rows 0.3s ease;
436
+ }
437
+
438
+ .product-actions {
439
+ display: grid;
440
+ gap: 8px;
441
+ min-height: 0;
442
+ overflow: hidden;
443
+ padding: 0 12px;
444
+ opacity: 0;
445
+ transition:
446
+ padding 0.3s ease,
447
+ opacity 0.2s ease;
448
+ }
449
+
450
+ .product-action {
451
+ display: flex;
452
+ align-items: center;
453
+ justify-content: center;
454
+ box-sizing: border-box;
455
+ height: 48px;
456
+ padding: 0 16px;
457
+ border: 1px solid var(--vtex-ads-story-color-accent, #1b75a8);
458
+ border-radius: var(--_button-radius);
459
+ font: inherit;
460
+ font-size: 14px;
461
+ font-weight: 700;
462
+ text-decoration: none;
463
+ cursor: pointer;
464
+ transition: background-color 0.2s ease;
465
+ }
466
+
467
+ .product-action:focus-visible {
468
+ outline: 2px solid var(--vtex-ads-story-color-accent, #1b75a8);
469
+ outline-offset: 2px;
470
+ }
471
+
472
+ .product-add-to-cart {
473
+ background: var(--vtex-ads-story-color-accent, #1b75a8);
474
+ color: var(--vtex-ads-story-color-accent-contrast, #fff);
475
+ }
476
+
477
+ .product-add-to-cart:hover {
478
+ background: color-mix(
479
+ in srgb,
480
+ var(--vtex-ads-story-color-accent, #1b75a8) 85%,
481
+ #000
482
+ );
483
+ }
484
+
485
+ /* In the cart: the add to cart button's pill, with minus and plus at its
486
+ ends and the quantity between them. */
487
+ .product-stepper {
488
+ justify-content: space-between;
489
+ padding: 0;
490
+ background: var(--vtex-ads-story-color-accent, #1b75a8);
491
+ color: var(--vtex-ads-story-color-accent-contrast, #fff);
492
+ cursor: auto;
493
+ }
494
+
495
+ .product-stepper-button {
496
+ display: grid;
497
+ flex: none;
498
+ place-items: center;
499
+ width: 46px;
500
+ height: 46px;
501
+ padding: 0;
502
+ border: 0;
503
+ border-radius: var(--_button-radius);
504
+ background: transparent;
505
+ color: inherit;
506
+ cursor: pointer;
507
+ transition: background-color 0.2s ease;
508
+ }
509
+
510
+ .product-stepper-button .icon {
511
+ width: 18px;
512
+ height: 18px;
513
+ }
514
+
515
+ .product-stepper-button:hover {
516
+ background: rgba(0, 0, 0, 0.15);
517
+ }
518
+
519
+ .product-stepper-button:focus-visible {
520
+ outline: 2px solid var(--vtex-ads-story-color-accent-contrast, #fff);
521
+ outline-offset: -4px;
522
+ }
523
+
524
+ .product-quantity {
525
+ flex: 1;
526
+ min-width: 0;
527
+ font-size: 16px;
528
+ text-align: center;
529
+ }
530
+
531
+ .product-cart-status {
532
+ position: absolute;
533
+ width: 1px;
534
+ height: 1px;
535
+ margin: -1px;
536
+ overflow: hidden;
537
+ clip-path: inset(50%);
538
+ white-space: nowrap;
539
+ }
540
+
541
+ /* Sold out: add to cart, disabled and grayed. */
542
+ .product-unavailable {
543
+ border-color: transparent;
544
+ background: rgba(0, 0, 0, 0.06);
545
+ color: var(--vtex-ads-story-color-muted, #6b6b6b);
546
+ cursor: not-allowed;
547
+ }
548
+
549
+ .product-view {
550
+ background: var(--vtex-ads-story-color-surface, #fff);
551
+ color: var(--vtex-ads-story-color-accent, #1b75a8);
552
+ }
553
+
554
+ /* A light tint of the accent. */
555
+ .product-view:hover {
556
+ background: color-mix(
557
+ in srgb,
558
+ var(--vtex-ads-story-color-accent, #1b75a8) 8%,
559
+ var(--vtex-ads-story-color-surface, #fff)
560
+ );
561
+ }
562
+
563
+ /* Open: a solid card (white by default), without the glass. */
564
+ .product-expandable[data-open] {
565
+ background: var(--vtex-ads-story-color-surface, #fff);
566
+ color: var(--vtex-ads-story-color-text, #242424);
567
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
568
+ }
569
+
570
+ .product-expandable[data-open]::before {
571
+ opacity: 0;
572
+ }
573
+
574
+ .product-expandable[data-open] .product-price {
575
+ color: inherit;
576
+ }
577
+
578
+ .product-expandable[data-open] .product-list-price {
579
+ color: var(--vtex-ads-story-color-muted, #6b6b6b);
580
+ opacity: 1;
581
+ }
582
+
583
+ .product-expandable[data-open] .product-summary {
584
+ padding: 12px;
585
+ }
586
+
587
+ .product-expandable[data-open] .product-toggle {
588
+ transform: rotate(180deg);
589
+ }
590
+
591
+ .product-expandable[data-open] .product-panel {
592
+ grid-template-rows: 1fr;
593
+ }
594
+
595
+ .product-expandable[data-open] .product-actions {
596
+ padding: 0 12px 12px;
597
+ opacity: 1;
598
+ transition:
599
+ padding 0.3s ease,
600
+ opacity 0.25s ease 0.1s;
601
+ }
602
+
603
+ /* Open, it stays in place on hover. */
604
+ @media (hover: hover) and (pointer: fine) {
605
+ .product-expandable[data-open]:hover {
606
+ transform: none;
607
+ }
608
+ }
609
+
610
+ @media (prefers-reduced-motion: reduce) {
611
+ .card-product,
612
+ .card-product:hover,
613
+ .card-cta,
614
+ .card-cta:hover {
615
+ transform: none;
616
+ transition: none;
617
+ }
618
+
619
+ .card-product::before,
620
+ .card-cta::before,
621
+ .product-summary,
622
+ .product-toggle,
623
+ .product-panel,
624
+ .product-actions,
625
+ .product-expandable[data-open] .product-actions {
626
+ transition: none;
627
+ }
628
+ }
629
+
630
+ /* Its corners follow the pill's, one inset in from them: 8px by default. */
631
+ .product-image {
632
+ flex: none;
633
+ width: 60px;
634
+ height: 60px;
635
+ border-radius: max(0px, var(--_pill-radius) - var(--_pill-inset));
636
+ background: #fff;
637
+ object-fit: contain;
638
+ }
639
+
640
+ .product-info {
641
+ display: grid;
642
+ flex: 1;
643
+ gap: 4px;
644
+ min-width: 0;
645
+ font-size: 12px;
646
+ font-weight: 700;
647
+ line-height: 16px;
648
+ }
649
+
650
+ .product-name {
651
+ display: -webkit-box;
652
+ overflow: hidden;
653
+ -webkit-box-orient: vertical;
654
+ -webkit-line-clamp: 2;
655
+ overflow-wrap: anywhere;
656
+ }
657
+
658
+ .product-price {
659
+ display: flex;
660
+ flex-wrap: wrap;
661
+ gap: 0 6px;
662
+ }
663
+
664
+ .product-list-price {
665
+ font-weight: 400;
666
+ opacity: 0.5;
667
+ }
668
+
669
+ /* In place of the price, for a product that can't be bought. */
670
+ .product-sold-out {
671
+ font-weight: 700;
672
+ opacity: 0.75;
673
+ }
674
+
675
+ /* Placeholders while the product loads, pulsing gently. */
676
+ .product-loading {
677
+ background: currentColor;
678
+ opacity: 0.25;
679
+ animation: product-loading-pulse 1.2s ease-in-out infinite alternate;
680
+ }
681
+
682
+ @keyframes product-loading-pulse {
683
+ to {
684
+ opacity: 0.1;
685
+ }
686
+ }
687
+
688
+ /* The price's: a line its height (the info's line height). */
689
+ .product-price-loading {
690
+ width: 64px;
691
+ height: 16px;
692
+ border-radius: 4px;
693
+ }
694
+
695
+ /* The add to cart button's: its size and shape. */
696
+ .product-add-to-cart-loading {
697
+ display: block;
698
+ height: 48px;
699
+ border-radius: var(--_button-radius);
700
+ }
701
+
702
+ @media (prefers-reduced-motion: reduce) {
703
+ .product-loading {
704
+ animation: none;
705
+ }
706
+ }
707
+ `;var it=g`
708
+ /* 9:16 at the height its container gives it (--card-height, default
709
+ 500px). */
31
710
  .card {
32
711
  position: relative;
33
712
  box-sizing: border-box;
34
- width: calc(500px * 9 / 16);
35
- height: 500px;
713
+ width: calc(var(--card-height, 500px) * 9 / 16);
714
+ height: var(--card-height, 500px);
36
715
  overflow: hidden;
37
716
  border-radius: var(--vtex-ads-story-radius, 20px);
38
717
  background: #000;
@@ -133,29 +812,332 @@
133
812
  transform: translate(-50%, -50%);
134
813
  }
135
814
  }
136
- `;function Nt(i,e){return u`
815
+ `;function Jo(o,e){return f`
137
816
  <button
138
817
  type="button"
139
818
  class="card-sound"
140
- aria-label=${i.muted?e.soundOnLabel:e.soundOffLabel}
141
- @click=${()=>i.toggleMuted()}
819
+ aria-label=${o.muted?e.labels.soundOn:e.labels.soundOff}
820
+ @click=${()=>o.toggleMuted()}
142
821
  >
143
- ${A(i.muted?"soundOff":"soundOn")}
822
+ ${v(o.muted?"soundOff":"soundOn")}
144
823
  </button>
145
- `}function Ce(i,e,t){return u`
146
- <div class="card">
147
- ${W(i,e)}
824
+ `}function st(o,e,t){var i,s;let r=(i=t.withVideo)!=null?i:!0;return f`
825
+ <div
826
+ class="card"
827
+ ${$(t.ref)}
828
+ @click=${{handleEvent:()=>{var n;return(n=t.onPress)==null?void 0:n.call(t)},capture:!0}}
829
+ >
830
+ ${ce(o,e,{withVideo:r,autoplay:t.autoplay,labels:t.labels,announce:!1})}
148
831
  <button
149
832
  type="button"
150
833
  class="card-open"
834
+ ${$(t.openRef)}
151
835
  aria-label=${t.label}
152
836
  @click=${t.onSelect}
153
837
  >
154
- <span class="play" aria-hidden="true">${A("play")}</span>
838
+ ${r&&e.failed?u:f`<span class="play" aria-hidden="true">${v("play")}</span>`}
155
839
  </button>
156
- ${q(i,e)&&!e.paused?Nt(e,t):h}
840
+ ${r&&K(o,e)&&!e.paused?Jo(e,t):u}
841
+ ${t.product?et(t.product,(s=t.onProductSelect)!=null?s:t.onSelect):u}
842
+ ${t.cta?pe(t.cta,t.onCtaSelect):u}
157
843
  </div>
158
- `}var Se=x`
844
+ `}var mr=(o,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(o[i],i);return r},Me=P(class extends _{constructor(o){if(super(o),o.type!==I.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],s=[],n=0;for(let a of o)i[n]=r?r(a,n):n,s[n]=t(a,n),n++;return{values:s,keys:i}}render(o,e,t){return this.dt(o,e,t).values}update(o,[e,t,r]){var A;let i=qt(o),{values:s,keys:n}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=n,s;let a=(A=this.ut)!=null?A:this.ut=[],d=[],l,p,c=0,h=i.length-1,m=0,y=s.length-1;for(;c<=h&&m<=y;)if(i[c]===null)c++;else if(i[h]===null)h--;else if(a[c]===n[m])d[m]=O(i[c],s[m]),c++,m++;else if(a[h]===n[y])d[y]=O(i[h],s[y]),h--,y--;else if(a[c]===n[y])d[y]=O(i[c],s[y]),G(o,d[y+1],i[c]),c++,y--;else if(a[h]===n[m])d[m]=O(i[h],s[m]),G(o,i[c],i[h]),h--,m++;else if(l===void 0&&(l=mr(n,m,y),p=mr(a,c,h)),l.has(a[c]))if(l.has(a[h])){let S=p.get(n[m]),W=S!==void 0?i[S]:null;if(W===null){let V=G(o,i[c]);O(V,s[m]),d[m]=V}else d[m]=O(W,s[m]),G(o,i[c],W),i[S]=null;m++}else _e(i[h]),h--;else _e(i[c]),c++;for(;m<=y;){let S=G(o,d[y+1]);O(S,s[m]),d[m++]=S}for(;c<=h;){let S=i[c++];S!==null&&_e(S)}return this.ut=n,Bt(o,d),w}});var yr="important",ei=" !"+yr,L=P(class extends _{constructor(o){var e;if(super(o),o.type!==I.ATTRIBUTE||o.name!=="style"||((e=o.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((e,t)=>{let r=o[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[e]){let{style:t}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let s=typeof i=="string"&&i.endsWith(ei);r.includes("-")||s?t.setProperty(r,s?i.slice(0,-11):i,s?yr:""):t[r]=i}}return w}});var C=g`500px`,vr=g`24px`,xr=5e3,wr=2e3,$r=12e4,Sr=o=>o===void 0||!Number.isFinite(o)||o<0?xr:o===0?0:Math.min(Math.max(o,wr),$r),Ar=40,nt=g`(max-width: 576px)`,Y=2,ue=Y+3,at=g`
845
+ .carousel {
846
+ position: relative;
847
+ box-sizing: border-box;
848
+ display: grid;
849
+ height: ${C};
850
+ place-items: center;
851
+ --card-height: ${C};
852
+ user-select: none;
853
+ }
854
+
855
+ .carousel[data-layout="solo"] {
856
+ padding: ${vr};
857
+ border-radius: var(--vtex-ads-story-radius, 20px);
858
+ background: var(--vtex-ads-story-color-surface, #fafafa);
859
+ --card-height: calc(${C} - 2 * ${vr});
860
+ }
861
+
862
+ .carousel[data-layout="solo"] .card {
863
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
864
+ }
865
+
866
+ .track {
867
+ position: absolute;
868
+ inset: 0;
869
+ overflow: hidden;
870
+ touch-action: pan-y;
871
+ }
872
+
873
+ /* Each slide starts centered, then moves by its own transform. */
874
+ .slide {
875
+ --ease: cubic-bezier(0.25, 1, 0.5, 1);
876
+ --duration: var(--slide-duration, 0.4s);
877
+ position: absolute;
878
+ top: 0;
879
+ left: 50%;
880
+ width: calc(${C} * 9 / 16);
881
+ height: 100%;
882
+ margin-left: calc(${C} * 9 / -32);
883
+ opacity: 0.5;
884
+ transition:
885
+ transform var(--duration) var(--ease),
886
+ opacity var(--duration) var(--ease),
887
+ visibility 0s;
888
+ }
889
+
890
+ .slide[data-active] {
891
+ opacity: 1;
892
+ }
893
+
894
+ /* Pair: --side is -1 for the first card, 1 for the second. The highlighted
895
+ card sits 47.5% of its width off center, the other (scaled to 0.9)
896
+ 52.5%, so the gap between them stays 8px. */
897
+ .carousel[data-layout="pair"] .slide {
898
+ --side: 1;
899
+ --offset: 52.5%;
900
+ --scale: 0.9;
901
+ transform: translateX(calc(var(--side) * (var(--offset) + 4px)))
902
+ scale(var(--scale));
903
+ }
904
+
905
+ .carousel[data-layout="pair"] .slide[data-index="0"] {
906
+ --side: -1;
907
+ }
908
+
909
+ .carousel[data-layout="pair"] .slide[data-active] {
910
+ --offset: 47.5%;
911
+ --scale: 1;
912
+ }
913
+
914
+ /* Rolling: --place is the slide's distance from the highlighted one, in
915
+ cards, 8px apart. A hidden slide fades out, then stops being visible. */
916
+ .carousel[data-layout="rolling"] .slide {
917
+ transform: translateX(calc(var(--place) * (100% + 8px))) scale(0.9);
918
+ }
919
+
920
+ .carousel[data-layout="rolling"] .slide[data-active] {
921
+ transform: translateX(0) scale(1);
922
+ }
923
+
924
+ .slide[data-hidden] {
925
+ opacity: 0;
926
+ visibility: hidden;
927
+ transition:
928
+ transform var(--duration) var(--ease),
929
+ opacity var(--duration) var(--ease),
930
+ visibility 0s var(--duration);
931
+ }
932
+
933
+ /* Only the highlighted card opens the player, so only it shows play. Its
934
+ sound is the only one to turn on: the others play muted, if at all. */
935
+ .slide:not([data-active]) .play,
936
+ .slide:not([data-active]) .card-sound {
937
+ display: none;
938
+ }
939
+
940
+ .arrow {
941
+ position: absolute;
942
+ top: 50%;
943
+ z-index: 2;
944
+ display: grid;
945
+ width: 32px;
946
+ height: 32px;
947
+ place-items: center;
948
+ padding: 0;
949
+ border: 1px solid rgba(133, 133, 133, 0.3);
950
+ border-radius: 50%;
951
+ background: rgba(0, 0, 0, 0.3);
952
+ backdrop-filter: blur(5px);
953
+ color: #fff;
954
+ cursor: pointer;
955
+ transform: translateY(-50%);
956
+ transition: background-color 0.2s;
957
+ }
958
+
959
+ .arrow:hover {
960
+ background: #262626;
961
+ }
962
+
963
+ .arrow:disabled {
964
+ cursor: default;
965
+ opacity: 0.5;
966
+ }
967
+
968
+ .arrow .icon {
969
+ width: 16px;
970
+ height: 16px;
971
+ }
972
+
973
+ .arrow-previous {
974
+ left: 3px;
975
+ }
976
+
977
+ .arrow-next {
978
+ right: 3px;
979
+ }
980
+
981
+ @media ${nt} {
982
+ .carousel[data-layout="solo"] {
983
+ padding: 0;
984
+ background: none;
985
+ --card-height: ${C};
986
+ }
987
+
988
+ .carousel[data-layout="solo"] .card {
989
+ box-shadow: none;
990
+ }
991
+ }
992
+
993
+ @media (prefers-reduced-motion: reduce) {
994
+ .slide,
995
+ .slide[data-hidden] {
996
+ transition: none;
997
+ }
998
+ }
999
+ `,gr=(o,e)=>(o%e+e)%e;function br(o,e){let t;return r=>{t&&o.delete(t),t=r,r&&o.set(r,e)}}var he=class{constructor(e,t){this.host=e;this.options=t;this.position=0;this.distance=1;this.count=0;this.narrow=!1;this.reducedMotion=!1;this.connected=!1;this.hovered=!1;this.focused=!1;this.timerMs=0;this.cards=new Map;this.focusTargets=new Map;this.onMediaChange=e=>{var r,i;let t=this.layout;this.narrow=e.matches,this.layout!==t&&((i=(r=this.options).onLayoutChange)==null||i.call(r),this.host.requestUpdate())};this.onPointerEnter=()=>{this.hovered=!0,this.syncTimer()};this.onPointerLeave=()=>{this.hovered=!1,this.syncTimer()};this.onFocusIn=e=>{this.focused=e.target.matches(":focus-visible"),this.syncTimer()};this.onFocusOut=e=>{let t=e.currentTarget,r=e.relatedTarget;(!r||!t.contains(r))&&(this.focused=!1),this.syncTimer()};this.onPointerDown=e=>{this.endSwipe(),this.swipe={x:e.clientX,moved:!1},globalThis.addEventListener("pointerup",this.onPointerUp),globalThis.addEventListener("pointercancel",this.onPointerCancel)};this.onPointerUp=e=>{let{swipe:t}=this;if(this.removeSwipeListeners(),!t)return;let r=e.clientX-t.x;Math.abs(r)>Ar&&(t.moved=!0,this.step(r<0?1:-1))};this.onPointerCancel=()=>this.endSwipe();this.onClickCapture={handleEvent:e=>{var t;(t=this.swipe)!=null&&t.moved&&(e.stopPropagation(),e.preventDefault()),this.swipe=void 0},capture:!0};e.addController(this)}get active(){return this.count?gr(this.position,this.count):0}get layout(){return this.count<2?"solo":this.count===2&&!this.narrow?"pair":"rolling"}get activeKey(){return this.layout==="rolling"?this.position:this.active}*visibleCards(){for(let[e,t]of this.cards)t.hidden||(yield[e,t])}focusActive(){for(let[e,t]of this.focusTargets)if(t.active&&e instanceof HTMLElement){e.focus();return}}hostConnected(){var e,t,r,i,s,n,a;this.connected=!0,this.media=(e=globalThis.matchMedia)==null?void 0:e.call(globalThis,nt.toString()),(t=this.media)==null||t.addEventListener("change",this.onMediaChange),this.narrow=(i=(r=this.media)==null?void 0:r.matches)!=null?i:!1,this.reducedMotion=(a=(n=(s=this.options).reducedMotion)==null?void 0:n.call(s))!=null?a:!1,this.syncTimer()}hostDisconnected(){var e;this.connected=!1,(e=this.media)==null||e.removeEventListener("change",this.onMediaChange),this.media=void 0,this.endSwipe(),this.syncTimer()}hostUpdated(){this.syncTimer()}reset(e){this.count=e,this.position=0,this.distance=1,this.hovered=!1,this.focused=!1,this.restartTimer()}step(e,{evenIfLocked:t=!1}={}){var i,s,n,a;if(this.count<2||e===0||(s=(i=this.options).locked)!=null&&s.call(i)&&!t)return;let r=this.activeKey;this.position+=e,this.distance=Math.abs(e),this.host.requestUpdate(),(a=(n=this.options).onStep)==null||a.call(n,r,this.activeKey),this.restartTimer()}get slideDuration(){var e,t;return Sr((t=(e=this.options).slideDuration)==null?void 0:t.call(e))}get shouldAdvance(){var e,t;return this.slideDuration>0&&!this.reducedMotion&&this.connected&&this.count>1&&!this.hovered&&!this.focused&&!((t=(e=this.options).locked)!=null&&t.call(e))}syncTimer(){let e=this.slideDuration;this.timer&&this.timerMs!==e&&this.stopTimer(),this.shouldAdvance&&!this.timer?(this.timerMs=e,this.timer=setInterval(()=>this.step(1),e)):!this.shouldAdvance&&this.timer&&this.stopTimer()}stopTimer(){clearInterval(this.timer),this.timer=void 0,this.timerMs=0}restartTimer(){this.stopTimer(),this.syncTimer()}endSwipe(){this.removeSwipeListeners(),this.swipe=void 0}removeSwipeListeners(){globalThis.removeEventListener("pointerup",this.onPointerUp),globalThis.removeEventListener("pointercancel",this.onPointerCancel)}slide(e){let t={...e,cardRef:s=>r(s),focusRef:s=>i(s)},r=br(this.cards,t),i=br(this.focusTargets,t);return t}pairSlides(){let{active:e}=this;return[0,1].map(t=>this.slide({key:t,index:t,offset:t-e,active:t===e,hidden:!1}))}rollingSlides(){let{count:e}=this,t=e===2||e===4,r=t?e/2:Math.floor((e-1)/2),i=t?e/2:e-1-r,s=[];for(let n=-ue;n<=ue;n+=1)s.push(this.slide({key:this.position+n,index:gr(this.position+n,e),offset:n,active:n===0,hidden:Math.abs(n)>Y||n<-r||n>i}));return s}renderSlides(e,t){let{layout:r}=this,i=r==="pair"?this.pairSlides():this.rollingSlides();return Me(i,s=>`${r}:${s.key}`,s=>{let{index:n}=s;return f`
1000
+ <div
1001
+ class="slide"
1002
+ data-index=${n}
1003
+ ?data-active=${s.active}
1004
+ ?data-hidden=${s.hidden}
1005
+ ?inert=${s.hidden}
1006
+ style=${L({"--place":String(s.offset)})}
1007
+ >
1008
+ ${t(e[n],s)}
1009
+ </div>
1010
+ `})}render(e,t,r){var s,n,a;if(this.layout==="solo")return f`
1011
+ <div class="carousel" data-layout="solo">
1012
+ ${t(e[0],this.slide({key:0,index:0,offset:0,active:!0,hidden:!1}))}
1013
+ </div>
1014
+ `;let i=(a=(n=(s=this.options).locked)==null?void 0:n.call(s))!=null?a:!1;return f`
1015
+ <div
1016
+ class="carousel"
1017
+ data-layout=${this.layout}
1018
+ role="region"
1019
+ aria-roledescription=${r.carouselRole}
1020
+ aria-label=${r.carousel}
1021
+ @pointerenter=${this.onPointerEnter}
1022
+ @pointerleave=${this.onPointerLeave}
1023
+ @focusin=${this.onFocusIn}
1024
+ @focusout=${this.onFocusOut}
1025
+ >
1026
+ <div
1027
+ class="track"
1028
+ style=${L({"--slide-duration":this.distance>1?"0.52s":"0.4s"})}
1029
+ @pointerdown=${this.onPointerDown}
1030
+ @click=${this.onClickCapture}
1031
+ >
1032
+ ${this.renderSlides(e,t)}
1033
+ </div>
1034
+ <button
1035
+ type="button"
1036
+ class="arrow arrow-previous"
1037
+ aria-label=${r.previous}
1038
+ ?disabled=${i}
1039
+ @click=${()=>this.step(-1)}
1040
+ >
1041
+ ${v("previous")}
1042
+ </button>
1043
+ <button
1044
+ type="button"
1045
+ class="arrow arrow-next"
1046
+ aria-label=${r.next}
1047
+ ?disabled=${i}
1048
+ @click=${()=>this.step(1)}
1049
+ >
1050
+ ${v("next")}
1051
+ </button>
1052
+ </div>
1053
+ `}};var dt=g`
1054
+ .root {
1055
+ position: relative;
1056
+ }
1057
+
1058
+ .root[data-requesting] {
1059
+ height: ${C};
1060
+ }
1061
+
1062
+ .root[data-loading] .carousel {
1063
+ visibility: hidden;
1064
+ }
1065
+
1066
+ .skeleton {
1067
+ position: absolute;
1068
+ inset: 0;
1069
+ z-index: 2;
1070
+ box-sizing: border-box;
1071
+ overflow: hidden;
1072
+ pointer-events: none;
1073
+ transition:
1074
+ opacity 0.3s ease,
1075
+ visibility 0s;
1076
+ }
1077
+
1078
+ .skeleton[data-done] {
1079
+ opacity: 0;
1080
+ visibility: hidden;
1081
+ transition:
1082
+ opacity 0.3s ease,
1083
+ visibility 0s 0.3s;
1084
+ }
1085
+
1086
+ .skeleton-slide {
1087
+ position: absolute;
1088
+ top: 0;
1089
+ left: 50%;
1090
+ width: calc(${C} * 9 / 16);
1091
+ height: 100%;
1092
+ margin-left: calc(${C} * 9 / -32);
1093
+ transform: translateX(calc(var(--place) * (100% + 8px))) scale(0.9);
1094
+ }
1095
+
1096
+ .skeleton-slide[data-active] {
1097
+ transform: none;
1098
+ }
1099
+
1100
+ .skeleton-card {
1101
+ width: 100%;
1102
+ height: 100%;
1103
+ border-radius: var(--vtex-ads-story-radius, 20px);
1104
+ background: #ececec;
1105
+ animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
1106
+ }
1107
+
1108
+ .skeleton[data-done] .skeleton-card {
1109
+ animation: none;
1110
+ }
1111
+
1112
+ @keyframes skeleton-pulse {
1113
+ to {
1114
+ background-color: #f6f6f6;
1115
+ }
1116
+ }
1117
+
1118
+ @media (prefers-reduced-motion: reduce) {
1119
+ .skeleton,
1120
+ .skeleton[data-done] {
1121
+ transition: none;
1122
+ }
1123
+
1124
+ .skeleton-card {
1125
+ animation: none;
1126
+ }
1127
+ }
1128
+ `;function lt({done:o}){let e=Array.from({length:Y*2+1},(t,r)=>r-Y);return f`
1129
+ <div class="skeleton" aria-hidden="true" ?data-done=${o}>
1130
+ ${e.map(t=>f`
1131
+ <div
1132
+ class="skeleton-slide"
1133
+ ?data-active=${t===0}
1134
+ style=${L({"--place":String(t)})}
1135
+ >
1136
+ <div class="skeleton-card"></div>
1137
+ </div>
1138
+ `)}
1139
+ </div>
1140
+ `}var x="vtex-ads-story-carousel";var _r="text/plain;charset=utf-8";function Cr(o,{sessionId:e,userId:t}){var s,n;let r=b(o);if(!r||globalThis.window===void 0)return!1;let i=JSON.stringify(t?{session_id:e,user_id:t}:{session_id:e});try{if((n=(s=globalThis.navigator)==null?void 0:s.sendBeacon)==null?void 0:n.call(s,r,new Blob([i],{type:_r})))return!0}catch(a){}return typeof globalThis.fetch!="function"?!1:(globalThis.fetch(r,{method:"POST",headers:{"Content-Type":_r},body:i,keepalive:!0,credentials:"omit"}).catch(a=>{console.error(`[${x}] Event request failed`,{url:r,error:a})}),!0)}var ct=.5,Er=2e3,ti={impression:"impression_url",view:"view_url",click:"click_url"},fe=class{constructor(e,t){this.host=e;this.options=t;this.sent={impression:new Set,view:new Set,click:new Set};this.pendingImpressions=[];this.connected=!1;this.watched=new Map;this.onIntersect=e=>{for(let t of e){let r=this.watched.get(t.target);r&&(r.visible=t.isIntersecting&&t.intersectionRatio>=ct,r.visible?this.startTimer(r):this.stopTimer(r))}};this.onVisibilityChange=()=>{for(let e of this.watched.values())document.hidden?this.stopTimer(e):e.visible&&this.startTimer(e)};e.addController(this)}hostConnected(){var e;this.connected=!0,typeof IntersectionObserver=="function"&&(this.observer=new IntersectionObserver(this.onIntersect,{threshold:ct})),(e=globalThis.document)==null||e.addEventListener("visibilitychange",this.onVisibilityChange),this.host.updateComplete.then(()=>{this.connected&&(this.sendImpressions(),this.syncViewTargets())})}hostDisconnected(){var e,t;this.connected=!1,(e=globalThis.document)==null||e.removeEventListener("visibilitychange",this.onVisibilityChange),(t=this.observer)==null||t.disconnect(),this.observer=void 0;for(let r of this.watched.values())clearTimeout(r.timer);this.watched.clear()}hostUpdated(){this.connected&&(this.sendImpressions(),this.syncViewTargets())}impress(e){this.pendingImpressions=e}sendImpressions(){let e=this.pendingImpressions;if(!(!e.length||!this.options.identity().sessionId)){this.pendingImpressions=[];for(let t of e)this.send("impression",t)}}click(e){this.send("click",e)}key(e,t){return`${e}|${t.ad_id}`}wasSent(e,t){let{sessionId:r}=this.options.identity();return!!r&&this.sent[e].has(this.key(r,t))}send(e,t){let{sessionId:r,userId:i}=this.options.identity();if(!r||this.wasSent(e,t))return;Cr(t[ti[e]],{sessionId:r,userId:i})&&this.sent[e].add(this.key(r,t))}syncViewTargets(){let{observer:e}=this;if(!e)return;let t=new Map;for(let[r,i]of this.options.viewTargets())this.wasSent("view",i)||t.set(r,i);for(let[r,i]of this.watched)t.get(r)!==i.story&&this.unwatch(r,i);for(let[r,i]of t)this.watched.has(r)||(this.watched.set(r,{story:i,visible:!1}),e.observe(r))}startTimer(e){var t;e.timer||(t=globalThis.document)!=null&&t.hidden||(e.timer=setTimeout(()=>{e.timer=void 0,this.send("view",e.story),this.wasSent("view",e.story)&&this.unwatchStory(e.story)},Er))}stopTimer(e){clearTimeout(e.timer),e.timer=void 0}unwatch(e,t){var r;this.stopTimer(t),(r=this.observer)==null||r.unobserve(e),this.watched.delete(e)}unwatchStory(e){for(let[t,r]of this.watched)r.story.ad_id===e.ad_id&&this.unwatch(t,r)}};var Re=72,Pr=48,pt=g`
159
1141
  .player {
160
1142
  position: fixed;
161
1143
  inset: auto 16px 16px auto;
@@ -188,12 +1170,28 @@
188
1170
  background: transparent;
189
1171
  }
190
1172
 
1173
+ /* Focusable only to keep the focus in the player when its video is clicked
1174
+ (see render): no ring around the whole player. */
1175
+ .player:focus {
1176
+ outline: none;
1177
+ }
1178
+
191
1179
  .player-frame {
192
1180
  position: relative;
193
1181
  width: 100%;
194
1182
  height: 100%;
195
1183
  }
196
1184
 
1185
+ /* What moves in the expanded view, off center with two Stories and in the
1186
+ step animation: the video, its dimming and previous and next. Expand and
1187
+ close stay out of it: a transformed box becomes the one their fixed
1188
+ position, at the top right of the screen, is measured from. */
1189
+ .player-stage {
1190
+ position: relative;
1191
+ width: 100%;
1192
+ height: 100%;
1193
+ }
1194
+
197
1195
  .player .card {
198
1196
  width: 100%;
199
1197
  height: 100%;
@@ -240,6 +1238,26 @@
240
1238
  height: 20px;
241
1239
  }
242
1240
 
1241
+ /* The product pill or the call to action. Their wrapper only stops clicks:
1242
+ the pill places itself. The product is larger than on the carousel card
1243
+ (as in the prototype). */
1244
+ .player-destination {
1245
+ display: contents;
1246
+ }
1247
+
1248
+ .player .product-info {
1249
+ font-size: 14px;
1250
+ }
1251
+
1252
+ .player .product-image {
1253
+ width: 72px;
1254
+ height: 72px;
1255
+ }
1256
+
1257
+ .player .product-price {
1258
+ color: rgba(255, 255, 255, 0.7);
1259
+ }
1260
+
243
1261
  /* Above the card: on narrow screens the expanded card can cover them. */
244
1262
  .player-controls {
245
1263
  position: absolute;
@@ -250,6 +1268,12 @@
250
1268
  gap: 8px;
251
1269
  }
252
1270
 
1271
+ /* Previous and next Story, above the card's top left (mini player only). */
1272
+ .player-nav {
1273
+ right: auto;
1274
+ left: 0;
1275
+ }
1276
+
253
1277
  .player-button {
254
1278
  display: grid;
255
1279
  width: 36px;
@@ -303,6 +1327,116 @@
303
1327
  height: 40px;
304
1328
  }
305
1329
 
1330
+ /* Expanded with more than one Story: the other Stories' covers beside the
1331
+ video, smaller and dimmed, as in the prototype. --side is -1 (before)
1332
+ or 1 (after), --beyond how many places past the nearest one. */
1333
+ .player[data-expanded] {
1334
+ --center-height: min(78vh, 720px);
1335
+ --side-height: min(38vh, 320px);
1336
+ --side-width: calc(var(--side-height) * 9 / 16);
1337
+ --center-half: calc(var(--center-height) * 9 / 32);
1338
+ --near-gap: ${Re}px;
1339
+ --far-gap: ${Pr}px;
1340
+ --near: calc(var(--center-half) + var(--near-gap) + var(--side-width) / 2);
1341
+ --pitch: calc(var(--side-width) + var(--far-gap));
1342
+ }
1343
+
1344
+ .player-neighbor {
1345
+ position: absolute;
1346
+ top: 50%;
1347
+ left: 50%;
1348
+ width: var(--side-width);
1349
+ height: var(--side-height);
1350
+ padding: 0;
1351
+ overflow: hidden;
1352
+ border: 0;
1353
+ border-radius: var(--vtex-ads-story-radius, 16px);
1354
+ background: #111;
1355
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
1356
+ cursor: pointer;
1357
+ transform: translate(
1358
+ calc(-50% + var(--side) * var(--near) + var(--beyond) * var(--pitch)),
1359
+ -50%
1360
+ );
1361
+ }
1362
+
1363
+ .player-neighbor img {
1364
+ width: 100%;
1365
+ height: 100%;
1366
+ object-fit: cover;
1367
+ }
1368
+
1369
+ /* Fades out as the video arrives from a dimmed cover (see animateStep). */
1370
+ .player-dim {
1371
+ position: absolute;
1372
+ inset: 0;
1373
+ z-index: 3;
1374
+ border-radius: var(--vtex-ads-story-radius, 20px);
1375
+ background: rgba(0, 0, 0, 0.35);
1376
+ opacity: 0;
1377
+ pointer-events: none;
1378
+ }
1379
+
1380
+ .player-neighbor::after {
1381
+ position: absolute;
1382
+ inset: 0;
1383
+ background: rgba(0, 0, 0, 0.35);
1384
+ content: "";
1385
+ }
1386
+
1387
+ .player-neighbor:hover::after,
1388
+ .player-neighbor:focus-visible::after {
1389
+ background: rgba(0, 0, 0, 0.12);
1390
+ }
1391
+
1392
+ .player-neighbor:focus-visible {
1393
+ outline: 2px solid #fff;
1394
+ outline-offset: 2px;
1395
+ }
1396
+
1397
+ /* Two Stories: the video moves off center toward --pair-dir, and the other
1398
+ Story sits on the other side. */
1399
+ .player[data-pair] .player-stage {
1400
+ transform: translateX(
1401
+ calc(var(--pair-dir) * (var(--near-gap) + var(--side-width)) / 2)
1402
+ );
1403
+ }
1404
+
1405
+ .player[data-pair] .player-neighbor {
1406
+ transform: translate(
1407
+ calc(
1408
+ -50% + var(--pair-dir) * -1 * (var(--center-half) + var(--near-gap) / 2)
1409
+ ),
1410
+ -50%
1411
+ );
1412
+ }
1413
+
1414
+ /* Expanded previous and next: beside the video, centered on its height. */
1415
+ .player[data-expanded] .player-nav {
1416
+ position: static;
1417
+ display: contents;
1418
+ }
1419
+
1420
+ .player[data-expanded] .player-nav .player-button {
1421
+ position: absolute;
1422
+ top: 50%;
1423
+ z-index: 2;
1424
+ transform: translateY(-50%);
1425
+ }
1426
+
1427
+ .player[data-expanded] .player-previous {
1428
+ left: -56px;
1429
+ }
1430
+
1431
+ .player[data-expanded] .player-next {
1432
+ right: -56px;
1433
+ }
1434
+
1435
+ /* With two, the other Story's cover beside the video does that. */
1436
+ .player[data-expanded][data-pair] .player-nav {
1437
+ display: none;
1438
+ }
1439
+
306
1440
  @media (max-width: 576px) {
307
1441
  .player {
308
1442
  right: 12px;
@@ -310,6 +1444,18 @@
310
1444
  height: 391px;
311
1445
  }
312
1446
 
1447
+ .player:not([data-expanded]) .product-image {
1448
+ width: 56px;
1449
+ height: 56px;
1450
+ }
1451
+
1452
+ /* "Adicionar ao carrinho" fits on one line in the narrow mini player. */
1453
+ .player:not([data-expanded]) .product-action {
1454
+ height: 40px;
1455
+ padding: 0 8px;
1456
+ font-size: 12px;
1457
+ }
1458
+
313
1459
  .player[data-expanded] {
314
1460
  background: #000;
315
1461
  }
@@ -332,6 +1478,28 @@
332
1478
  top: 60px;
333
1479
  right: 12px;
334
1480
  }
1481
+
1482
+ /* No room for the other Stories' covers: previous and next go inside
1483
+ the video's edges instead, also with two. */
1484
+ .player-neighbor {
1485
+ display: none;
1486
+ }
1487
+
1488
+ .player[data-pair] .player-stage {
1489
+ transform: none;
1490
+ }
1491
+
1492
+ .player[data-expanded][data-pair] .player-nav {
1493
+ display: contents;
1494
+ }
1495
+
1496
+ .player[data-expanded] .player-previous {
1497
+ left: 12px;
1498
+ }
1499
+
1500
+ .player[data-expanded] .player-next {
1501
+ right: 12px;
1502
+ }
335
1503
  }
336
1504
 
337
1505
  @keyframes player-in {
@@ -346,74 +1514,137 @@
346
1514
  animation: none;
347
1515
  }
348
1516
  }
349
- `;function ht(i){return typeof i.showPopover=="function"}var K=class{constructor(e,t){this.host=e;this.options=t;this.isOpen=!1;this.expanded=!1;this.switched=!1;this.shown=!1;this.dialog=V();this.expandButton=V();this.closeButton=V();this.toggleExpanded=async()=>{var t;let e=this.dialog.value;e&&(this.hide(e),this.expanded=!this.expanded,this.switched=!0,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.show(e),(t=this.expandButton.value)==null||t.focus()))};this.onKeyDown=e=>{e.key==="Escape"&&this.options.onClose()};this.onDialogClick=e=>{this.expanded&&e.target===e.currentTarget&&this.options.onClose()};this.onCancel=e=>{e.preventDefault(),this.options.onClose()};e.addController(this),this.video=new L(e)}hostDisconnected(){this.close()}async open(){var t;if(this.isOpen)return;document.addEventListener("keydown",this.onKeyDown),this.isOpen=!0,this.expanded=!1,this.switched=!1,this.video.reset(),this.host.requestUpdate(),await this.host.updateComplete;let e=this.dialog.value;!this.isOpen||!e||(this.show(e),this.video.play(),(t=this.closeButton.value)==null||t.focus())}close(){if(!this.isOpen)return;document.removeEventListener("keydown",this.onKeyDown);let e=this.dialog.value;e&&this.hide(e),this.isOpen=!1,this.host.requestUpdate()}show(e){this.shown||(this.expanded?e.showModal():ht(e)?e.showPopover():e.show(),this.shown=!0)}hide(e){this.shown&&(!this.expanded&&ht(e)?e.hidePopover():e.close(),this.shown=!1)}renderVideoControls(){let{video:e,options:t}=this,s=r=>{r.stopPropagation(),e.togglePlayback()},o=r=>{r.stopPropagation(),e.toggleMuted()};return u`
1517
+ `;function ut(o,e){if(o<2)return[];if(o===2)return[e===0?1:-1];let t=[],r=new Set([0]);for(let i of[-1,1,-2,2]){let s=(i%o+o)%o;r.has(s)||(r.add(s),t.push(i))}return t}var J={duration:560,easing:"cubic-bezier(0.32, 0.72, 0, 1)"},Oe=(o,e=1)=>`translate(-50%, -50%) translateX(${o}px) scale(${e})`,kr=o=>o.animate([{opacity:0},{opacity:1}],{...J,pseudoElement:"::after"});function ri(o,e,t,{frameWidth:r,sideWidth:i}){let s=d=>{if(d===0)return 0;let l=Math.sign(d),p=r/2+Re+i/2;return l*p+(d-l)*(i+Pr)},n=i/r,a=[o.animate([{transform:`translateX(${s(e)}px) scale(${n})`},{transform:"none"}],J)];for(let{element:d,offset:l,from:p}of t){let c=p===0;a.push(d.animate([{transform:Oe(s(p),c?1/n:1)},{transform:Oe(s(l))}],J)),c&&a.push(kr(d))}return a}function oi(o,e,t,{frameWidth:r,sideWidth:i}){let s=d=>d*(Re+i)/2,n=d=>-d*(r+Re)/2,a=i/r;return[o.animate([{transform:`translateX(${n(-t)}px) scale(${a})`},{transform:`translateX(${s(t)}px)`}],J),e.animate([{transform:Oe(s(-t),1/a)},{transform:Oe(n(t))}],J),kr(e)]}var ii={ArrowLeft:-1,ArrowRight:1},si=o=>!o.defaultPrevented&&!o.altKey&&!o.ctrlKey&&!o.metaKey&&!o.shiftKey;function Tr(o){return typeof o.showPopover=="function"}var me=class{constructor(e,t){this.host=e;this.options=t;this.isOpen=!1;this.expanded=!1;this.productOpen=!1;this.switched=!1;this.shown=!1;this.dialog=k();this.expandButton=k();this.closeButton=k();this.stage=k();this.stageCardRef=k();this.dim=k();this.neighborElements=new Map;this.neighborRefs=new Map;this.navigation=!1;this.pairDirection=0;this.animations=[];this.toggleExpanded=async()=>{var t;let e=this.dialog.value;e&&(this.cancelAnimations(),this.hide(e),this.expanded=!this.expanded,this.switched=!0,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.show(e),(t=this.expandButton.value)==null||t.focus()))};this.onKeyDown=e=>{e.key==="Escape"&&this.options.onClose()};this.onPlayerKeyDown=e=>{var r,i;let t=ii[e.key];!t||!this.navigation||!si(e)||(e.preventDefault(),(i=(r=this.options).onStep)==null||i.call(r,t))};this.onDialogClick=e=>{this.expanded&&e.target===e.currentTarget&&this.options.onClose()};this.onCancel=e=>{e.preventDefault(),this.options.onClose()};this.toggleProduct=()=>{this.productOpen=!this.productOpen,this.host.requestUpdate()};this.retryVideo=()=>{var e;(e=this.dialog.value)==null||e.focus(),this.video.retry().then(t=>{t&&this.video.playWithSound()})};this.onVideoClick=()=>{this.productOpen?this.toggleProduct():this.video.togglePlayback()};e.addController(this),this.video=new z(e)}get isExpanded(){return this.isOpen&&this.expanded}get stageCard(){return this.isOpen?this.stageCardRef.value:void 0}hostDisconnected(){this.close()}async open({productOpen:e=!1}={}){var r;if(this.isOpen)return;document.addEventListener("keydown",this.onKeyDown),this.isOpen=!0,this.expanded=!1,this.productOpen=e,this.switched=!1,this.rendered=void 0,this.beforeStep=void 0,this.video.reset(),this.host.requestUpdate(),await this.host.updateComplete;let t=this.dialog.value;!this.isOpen||!t||(this.show(t),this.video.playWithSound(),(r=this.closeButton.value)==null||r.focus())}close(){if(!this.isOpen)return;document.removeEventListener("keydown",this.onKeyDown),this.cancelAnimations();let e=this.dialog.value;e&&this.hide(e),this.isOpen=!1,this.host.requestUpdate()}async showNext(e=0){if(!this.isOpen)return;let t=!this.video.muted;this.video.clearFailure(),this.productOpen=!1,this.host.requestUpdate(),await this.host.updateComplete,this.isOpen&&(this.video.restart({withSound:t}),this.animateStep(e))}cancelAnimations(){for(let e of this.animations)e.cancel();this.animations=[]}animateStep(e){var l,p;if(!this.expanded||e===0||Q())return;let t=this.stage.value,r=this.dim.value;if(!t||!r||typeof t.animate!="function")return;let{rendered:i,beforeStep:s}=this,n=(c,h)=>{var y;if(!c||!s)return h;if(c===s.story)return 0;let m=s.neighbors.find(A=>A.story===c);return(y=m==null?void 0:m.offset)!=null?y:h},a=[...this.neighborElements].map(([c,h])=>{var m;return{offset:c,element:h,from:n((m=i==null?void 0:i.neighbors.find(y=>y.offset===c))==null?void 0:m.story,c+e)}}),d={frameWidth:t.offsetWidth,sideWidth:(p=(l=a[0])==null?void 0:l.element.offsetWidth)!=null?p:0};!d.frameWidth||!d.sideWidth||(this.cancelAnimations(),this.animations=[r.animate([{opacity:1},{opacity:0}],J),...this.pairDirection?oi(t,a[0].element,this.pairDirection,d):ri(t,n(i==null?void 0:i.story,e),a,d)])}neighborRef(e){let t=this.neighborRefs.get(e);return t||(t=r=>{r?this.neighborElements.set(e,r):this.neighborElements.delete(e)},this.neighborRefs.set(e,t)),t}show(e){this.shown||(this.expanded?e.showModal():Tr(e)?e.showPopover():e.show(),this.shown=!0)}hide(e){this.shown&&(!this.expanded&&Tr(e)?e.hidePopover():e.close(),this.shown=!1)}renderDestination({product:e,cta:t,labels:r,productActions:i}){let s;if(e)s=rt(e,{...i,labels:r,open:this.productOpen,onToggle:this.toggleProduct,panelId:"player-product-panel"});else if(t)s=pe(t);else return u;return f`
1518
+ <div
1519
+ class="player-destination"
1520
+ @click=${n=>n.stopPropagation()}
1521
+ >
1522
+ ${s}
1523
+ </div>
1524
+ `}renderVideoControls(e){let{video:t}=this,r=s=>{s.stopPropagation(),t.togglePlayback()},i=s=>{s.stopPropagation(),t.toggleMuted()};return f`
350
1525
  <button
351
1526
  type="button"
352
1527
  class="play player-toggle"
353
- aria-label=${e.paused?t.playLabel:t.pauseLabel}
354
- @click=${s}
1528
+ aria-label=${t.paused?e.play:e.pause}
1529
+ @click=${r}
355
1530
  >
356
- ${A(e.paused?"play":"pause")}
1531
+ ${v(t.paused?"play":"pause")}
357
1532
  </button>
358
1533
  <button
359
1534
  type="button"
360
1535
  class="player-button player-sound"
361
- aria-label=${e.muted?t.soundOnLabel:t.soundOffLabel}
362
- @click=${o}
1536
+ aria-label=${t.muted?e.soundOn:e.soundOff}
1537
+ @click=${i}
363
1538
  >
364
- ${A(e.muted?"soundOff":"soundOn")}
1539
+ ${v(t.muted?"soundOff":"soundOn")}
365
1540
  </button>
366
- `}render(e){if(!this.isOpen)return h;let{video:t,options:s,expanded:o}=this,r=q(e,t);return u`
1541
+ `}renderNavigation(e){let{options:t}=this,r=i=>()=>{var s;return(s=t.onStep)==null?void 0:s.call(t,i)};return f`
1542
+ <div class="player-controls player-nav">
1543
+ <button
1544
+ type="button"
1545
+ class="player-button player-previous"
1546
+ aria-label=${e.previous}
1547
+ @click=${r(-1)}
1548
+ >
1549
+ ${v("previous")}
1550
+ </button>
1551
+ <button
1552
+ type="button"
1553
+ class="player-button player-next"
1554
+ aria-label=${e.next}
1555
+ @click=${r(1)}
1556
+ >
1557
+ ${v("next")}
1558
+ </button>
1559
+ </div>
1560
+ `}renderNeighbors(e,t){let{options:r}=this;return Me(e,({offset:i})=>e.length===1?"single":i,({offset:i,story:s,label:n})=>{let a=b(s.poster_url),d=Math.sign(i);return f`
1561
+ <button
1562
+ type="button"
1563
+ class="player-neighbor"
1564
+ aria-label=${n!=null?n:t.show}
1565
+ style=${L({"--side":String(d),"--beyond":String(i-d)})}
1566
+ ${$(this.neighborRef(i))}
1567
+ @click=${()=>{var l;return(l=r.onStep)==null?void 0:l.call(r,i)}}
1568
+ >
1569
+ ${a?f`<img alt="" src=${a} />`:u}
1570
+ </button>
1571
+ `})}renderWindowControls(e){let{options:t,expanded:r}=this;return f`
1572
+ <div class="player-controls">
1573
+ <button
1574
+ type="button"
1575
+ class="player-button player-expand"
1576
+ aria-label=${r?e.collapse:e.expand}
1577
+ ${$(this.expandButton)}
1578
+ @click=${this.toggleExpanded}
1579
+ >
1580
+ ${v(r?"collapse":"expand")}
1581
+ </button>
1582
+ <button
1583
+ type="button"
1584
+ class="player-button player-close"
1585
+ aria-label=${e.close}
1586
+ ${$(this.closeButton)}
1587
+ @click=${t.onClose}
1588
+ >
1589
+ ${v("close")}
1590
+ </button>
1591
+ </div>
1592
+ `}renderVideo(e,t,r){let{video:i,options:s}=this;return f`
1593
+ <div class="card" ${$(this.stageCardRef)} @click=${this.onVideoClick}>
1594
+ ${ce(e,i,{loop:!t,onEnded:t?()=>{var n;return(n=s.onStep)==null?void 0:n.call(s,1)}:void 0,labels:r.labels,onRetry:this.retryVideo})}
1595
+ ${K(e,i)?this.renderVideoControls(r.labels):u}
1596
+ ${this.renderDestination(r)}
1597
+ </div>
1598
+ `}track(e,t){let r=this.expanded?t:[];return this.pairDirection=r.length===1?-Math.sign(r[0].offset):0,this.rendered&&e!==this.rendered.story&&(this.beforeStep=this.rendered),this.rendered={story:e,neighbors:r},r}render(e,{navigation:t=!1,neighbors:r=[],onPress:i,...s}){let{labels:n}=s;if(!this.isOpen)return u;let{video:a,expanded:d}=this,l=this.track(e,r),p=this.pairDirection!==0;return this.navigation=t,f`
367
1599
  <dialog
368
1600
  class="player"
369
1601
  popover="manual"
370
- aria-label=${s.label}
371
- ?data-expanded=${o}
1602
+ aria-label=${n.player}
1603
+ ?data-expanded=${d}
1604
+ ?data-pair=${p}
1605
+ style=${L({"--pair-dir":p?String(this.pairDirection):void 0})}
372
1606
  ?data-switched=${this.switched}
373
- ?data-paused=${r&&t.paused}
374
- ${k(this.dialog)}
1607
+ ?data-paused=${K(e,a)&&a.paused}
1608
+ tabindex="-1"
1609
+ ${$(this.dialog)}
375
1610
  @click=${this.onDialogClick}
376
1611
  @cancel=${this.onCancel}
1612
+ @keydown=${this.onPlayerKeyDown}
377
1613
  >
1614
+ ${this.renderNeighbors(l,n)}
378
1615
  <div class="player-frame">
379
- <div class="player-controls">
380
- <button
381
- type="button"
382
- class="player-button player-expand"
383
- aria-label=${o?s.collapseLabel:s.expandLabel}
384
- ${k(this.expandButton)}
385
- @click=${this.toggleExpanded}
386
- >
387
- ${A(o?"collapse":"expand")}
388
- </button>
389
- <button
390
- type="button"
391
- class="player-button player-close"
392
- aria-label=${s.closeLabel}
393
- ${k(this.closeButton)}
394
- @click=${s.onClose}
395
- >
396
- ${A("close")}
397
- </button>
398
- </div>
399
- <div class="card" @click=${()=>t.togglePlayback()}>
400
- ${W(e,t)}
401
- ${r?this.renderVideoControls():h}
1616
+ ${this.renderWindowControls(n)}
1617
+ <div
1618
+ class="player-stage"
1619
+ ${$(this.stage)}
1620
+ @click=${{handleEvent:c=>{let h=this.stageCardRef.value;h!=null&&h.contains(c.target)&&(i==null||i())},capture:!0}}
1621
+ >
1622
+ ${t?this.renderNavigation(n):u}
1623
+ ${this.renderVideo(e,t&&d,s)}
1624
+ <span class="player-dim" aria-hidden="true" ${$(this.dim)}></span>
402
1625
  </div>
403
1626
  </div>
404
1627
  </dialog>
405
- `}};var F="vtex-ads-story",dt={poster_url:"https://dummyimage.com/1080x1920/e31c57/fff",media_url:"https://samplelib.com/mp4/sample-10s-vp9.mp4"},f={watch:"Assistir v\xEDdeo",player:"V\xEDdeo",expand:"Expandir v\xEDdeo",collapse:"Reduzir v\xEDdeo",close:"Fechar v\xEDdeo",play:"Reproduzir v\xEDdeo",pause:"Pausar v\xEDdeo",soundOn:"Ativar som",soundOff:"Desativar som"},O=class extends b{constructor(){super(...arguments);this.cardVideo=new L(this);this.player=new K(this,{label:f.player,expandLabel:f.expand,collapseLabel:f.collapse,closeLabel:f.close,playLabel:f.play,pauseLabel:f.pause,soundOnLabel:f.soundOn,soundOffLabel:f.soundOff,onClose:()=>this.closePlayer()})}connectedCallback(){super.connectedCallback(),this.cardVideo.resume()}openPlayer(){this.player.isOpen||(this.cardVideo.pause(),this.player.open())}closePlayer(){var t;this.player.isOpen&&(this.player.close(),this.cardVideo.resume(),(t=this.renderRoot.querySelector(".root .card-open"))==null||t.focus())}render(){return u`
406
- <div class="root">
407
- ${Ce(dt,this.cardVideo,{label:f.watch,soundOnLabel:f.soundOn,soundOffLabel:f.soundOff,onSelect:()=>this.openPlayer()})}
1628
+ `}};var Mr=(o,e)=>globalThis.fetch(o,e);var ni=()=>{let o=async(s,n,a,d,l)=>{let p=new URL(n,s).toString(),c=d?{"content-type":"application/json"}:void 0;return Mr(p,{body:d?JSON.stringify(d):void 0,method:a,signal:l==null?void 0:l.signal,headers:{accept:"application/json",...c}}).then(h=>{if(!h.ok)throw console.error({description:"HTTP error",response:h}),new Error(`HTTP error! status: ${h.status}`);return h.json()})};return{get:async(s,n,a)=>o(s,n,"GET",void 0,a),post:async(s,n,a,d)=>o(s,n,"POST",a,d),put:async(s,n,a)=>o(s,n,"PUT",a),delete:async(s,n)=>o(s,n,"DELETE")}},ht=ni(),ai="https://newtail-media.newtail.com.br/v1/rma/",di=async(o,e,t)=>ht.post(ai,o,e,{signal:t==null?void 0:t.signal}).then(r=>{if(r.validations&&r.validations.length>0)throw console.error(JSON.stringify({description:"Ads validation error",response:r},null,2)),new Error("Ads validation error");return r}),li=o=>Object.entries(o).filter(([,e])=>Array.isArray(e)).map(([e,t])=>[e,t.filter(r=>"product_sku"in r)]).filter(([e,t])=>t.length>0),ci=o=>Object.entries(o).filter(([,e])=>Array.isArray(e)).map(([e,t])=>[e,t.filter(r=>"type"in r&&r.type==="story")]).filter(([e,t])=>t.length>0),Dr=o=>{var e;return{skuId:o.product_sku,sellerId:(e=o.seller_id)!=null?e:"1",productId:o.product_metadata.productId}},Vr=o=>{var e,t,r;let{product:i}=o;if(!i)return;let s=(e=i.product_metadata)==null?void 0:e.productId;return{skuId:i.product_sku,sellerId:(r=(t=i.seller_id)!=null?t:o.seller_id)!=null?r:"1",productId:typeof s=="string"?s:""}},Rr=o=>{let e={};for(let[t,r]of o)e[t]=r;return e},pi=(o,e)=>{let t={};for(let[r,i]of Object.entries(o))t[r]=i.map(s=>e(s));return t},ui=(o,e)=>e?new Promise((t,r)=>{let i=()=>r(e.reason);if(e.aborted){i();return}e.addEventListener("abort",i,{once:!0}),o.then(t,r).finally(()=>e.removeEventListener("abort",i))}):o,Nr=(o,e)=>({eventUrls:{click:o.click_url,impression:o.impression_url,view:o.view_url},eventParameters:btoa(o.impression_url),sponsoredBySellerId:e}),hi=(o,e,t)=>({product:o,advertisement:Nr(e,t.sellerId)}),fi=(o,e)=>{var t;let r=Vr(o);return{story:o,product:e(r),offer:r,advertisement:Nr(o,(t=r==null?void 0:r.sellerId)!=null?t:o.seller_id)}},Or=(o,e)=>Object.values(o).flatMap(t=>t.map(r=>e(r))).filter(t=>t!==void 0),mi=(o,e)=>t=>t&&o.find(r=>e(r,t)),yi=(o,e)=>{var t;let r={},i=[];for(let[s,n]of Object.entries(o))for(let a of n){let d=Dr(a),l=e(d);l?((t=r[s])!=null||(r[s]=[]),r[s].push(hi(l,a,d))):i.push(a)}return{byPlacement:r,failed:i}},Hr=async({sponsoredProducts:o={},stories:e={}},t,r,i,s)=>{let n=[...Or(o,Dr),...Or(e,Vr)],a=n.length>0?await ui(t(n,i,{signal:s==null?void 0:s.signal}),s==null?void 0:s.signal):[],d=mi(a,r);return{sponsoredProducts:yi(o,d),stories:pi(e,l=>fi(l,d))}},Ur=(o,e)=>o.items.some(t=>t.itemId===e.skuId&&t.sellers.some(r=>r.sellerId===e.sellerId)),Fr=o=>`https://${o}.vtexcommercestable.com.br/api/intelligent-search/`,Br="product_search",vi=async(o,e,t)=>{let r=Fr(o),i=`product:${e.map(encodeURIComponent).join(";")}`,s=`${Br}?q=${i}`;return ht.get(r,s,t)},gi=24,bi=async(o,e,t)=>{let r=Fr(o),i=`sku:${e.map(encodeURIComponent).join(";")}`,s=`${Br}?q=${i}`;return ht.get(r,s,t)},xi=o=>{let e=new Map;for(let{skuId:t,sellerId:r}of o){let i=e.get(t);i?i.push(r):e.set(t,[r])}return e},wi=(o,e)=>o.map(t=>{let r=e.get(t.itemId);if(!r)return null;let i=t.sellers.filter(s=>r.includes(s.sellerId));return i.length===0?null:{...t,sellers:i}}).filter(t=>t!==null),$i=(o,e)=>{let t=xi(e);return o.map(r=>{let i=wi(r.items,t);return i.length===0?null:{...r,items:i}}).filter(r=>r!==null)},Si=(o,e)=>{let t=[];for(let r=0;r<o.length;r+=e)t.push(o.slice(r,r+e));return t},Ir=(o,e,t,r)=>Si(t,gi).map(i=>o(e,i,r)),Ai=o=>[...new Map(o.map(e=>[e.productId,e])).values()],qr=async(o,{accountName:e},t)=>{let r=new Set,i=new Set;for(let{productId:d,skuId:l}of o)d?r.add(d):i.add(l);let s={signal:t==null?void 0:t.signal},n=await Promise.all([...Ir(vi,e,[...r],s),...Ir(bi,e,[...i],s)]),a=Ai(n.flatMap(d=>d.products));return $i(a,o)},zr=(o,{skuId:e,sellerId:t})=>{var r,i;return(i=(r=o.items.find(s=>s.itemId===e))==null?void 0:r.sellers.find(s=>s.sellerId===t))==null?void 0:i.commertialOffer},Lr=o=>typeof o=="number"&&Number.isFinite(o)?o:void 0,Wr=(o,e)=>{let t=zr(o,e),r=Lr(t==null?void 0:t.Price);if(r===void 0)return;let i=Lr(t==null?void 0:t.ListPrice);return i!==void 0&&i>r?{price:r,listPrice:i}:{price:r}},jr=(o,e)=>{var t;let r=(t=zr(o,e))==null?void 0:t.AvailableQuantity;return typeof r=="number"&&!Number.isNaN(r)?r>0:void 0},Ie=({selectedFacets:o,attributeSynonyms:e,attributePrefix:t})=>{if(!(o!=null&&o.length))return;let r=e==null?void 0:e.map(n=>n.toLowerCase()),i=t==null?void 0:t.toLowerCase(),s=o.filter(n=>{let a=n.key.toLowerCase();return(r==null?void 0:r.includes(a))||i&&a.startsWith(i)});if(s.length>0)return s},_i=o=>{var e;return(e=Ie({selectedFacets:o,attributeSynonyms:["categoria","c"],attributePrefix:"category"}))==null?void 0:e.map(t=>t.value).join(" > ")},Ci=o=>{var e;return(e=Ie({selectedFacets:o,attributeSynonyms:["brand","b"]}))==null?void 0:e.map(t=>t.value)[0]},Ei=o=>{var e;return(e=Ie({selectedFacets:o,attributeSynonyms:["productClusterIds","productClusterNames"]}))==null?void 0:e.map(t=>`product_cluster/${t.value}`)},Ti=o=>{var e;return(e=Ie({selectedFacets:o,attributeSynonyms:["sellerName","seller"]}))==null?void 0:e.map(t=>t.value)[0]},Pi=o=>({category:_i(o),brand:Ci(o),tags:Ei(o),seller:Ti(o)}),ki=({term:o,category:e,brand:t,skuId:r})=>o?"search":e?"category":t?"brand_page":r?"product_page":"home",Mi=o=>{var e;let{category:t,brand:r,tags:i,seller:s}=Pi(o.search.selectedFacets),n=(e=o.search.term)!=null?e:!t&&!r?s:void 0,a=ki({term:n,category:t,brand:r,skuId:o.search.skuId});return{brand_name:r,category_name:t,tags:i,context:a,placements:o.placements,channel:o.identity.channel,term:n,session_id:o.identity.sessionId,user_id:o.identity.userId,product_sku:o.search.skuId}},Gr=async(o,e)=>{let t=Mi(o),r=await di(o.identity.publisherId,t,e);return{sponsoredProducts:Rr(li(r)),stories:Rr(ci(r)),banners:void 0,sponsoredBrands:void 0}};var ee=(o,e,t)=>{let r=o!==void 0&&Number.isFinite(o)&&o>0?o:e,i=new AbortController,s=setTimeout(()=>i.abort(new DOMException(`Timed out after ${r} ms`,"TimeoutError")),r),n=()=>i.abort(t==null?void 0:t.reason);return t!=null&&t.aborted?n():t==null||t.addEventListener("abort",n,{once:!0}),{signal:i.signal,clear:()=>{clearTimeout(s),t==null||t.removeEventListener("abort",n)}}};var Ri=5e3,Zr={fetcher:qr,matcher:Ur,price:Wr,available:jr};function Oi(o){let e=i=>typeof i=="number"&&Number.isFinite(i)&&i>=0;if(!e(o==null?void 0:o.price))return;let{price:t,listPrice:r}=o;return e(r)&&r>t?{price:t,listPrice:r}:{price:t}}async function Qr(o,e,t,r,{signal:i,timeout:s}={}){var d,l;let n=new Map,a=ee(s,Ri,i);try{let p=await Hr({stories:{[o]:e}},t.fetcher,(c,h)=>t.matcher(c,h),r,{signal:a.signal});for(let{story:c,product:h,offer:m}of(d=p.stories[o])!=null?d:[])if(!(!h||!m))try{let y=Oi(t.price(h,m)),A=(l=t.available)==null?void 0:l.call(t,h,m);n.set(c.ad_id,{...y&&{price:y},...A!==void 0&&{available:A}})}catch(y){console.error(`[${x}] Product details failed for ad ${c.ad_id}`,y)}}catch(p){a.signal.aborted||console.error(`[${x}] Product request failed`,p)}finally{a.clear()}return n}var Ii=2e3,Li=8,Di=o=>o!==void 0&&Number.isFinite(o)&&o>=1?Math.floor(o):Li;async function Kr({publisherId:o,sessionId:e,placement:t,userId:r,accountName:i,channel:s,quantity:n},{signal:a,timeout:d}={}){var h;if(globalThis.window===void 0||!o||!e||!t)return[];let p=ee(d,Ii,a),c=Di(n);try{let{stories:m}=await Gr({identity:{accountName:i!=null?i:"",publisherId:o,sessionId:e,userId:r,channel:s},search:{},placements:{[t]:{quantity:c,types:["story"]}}},{signal:p.signal});return((h=m[t])!=null?h:[]).slice(0,c)}catch(m){return p.signal.aborted||console.error(`[${x}] Story request failed`,{placement:t,publisherId:o,error:m}),[]}finally{p.clear()}}var Vi=3e3;function Xr(o){if(typeof Image=="undefined")return Promise.resolve(!0);let e=new Image;return e.src=o,e.decode?e.decode().then(()=>!0,()=>!1):Promise.resolve(!0)}function Yr(o,e){if(!o.length)return Promise.resolve();let t=ee(void 0,Vi,e);return new Promise(r=>{let i=()=>{t.clear(),r()};if(t.signal.aborted)return i();t.signal.addEventListener("abort",i,{once:!0});let s=0;for(let n of o)n.then(a=>{(a||++s===o.length)&&i()},()=>{++s===o.length&&i()})})}var Ni="vtex-ads-story:add-to-cart",Hi="vtex-ads-story:remove-from-cart";function Jr(o,{sku:e,seller:t},r){return new CustomEvent(o,{detail:{sku:e,...t&&{seller:t},quantity:r},bubbles:!0,composed:!0})}function eo(o,e=1){return Jr(Ni,o,e)}function to(o,e=1){return Jr(Hi,o,e)}var Ui=["publisherId","sessionId","placement","userId","accountName","channel","quantity","hydration"],Fi=new Set(["site","app"]),Bi=o=>Fi.has(o),qi={fromAttribute:o=>typeof o=="string"&&(o===""||o.toLowerCase()==="true")},zi={fromAttribute:o=>Bi(o)?o:void 0},Wi={fromAttribute:o=>o==="none"?"none":void 0},ro=({sku:o,seller:e})=>JSON.stringify([o,e!=null?e:""]),D=class extends R{constructor(){super();this.cartQuantities=new Map;this.cardVideos=new Map;this.soundPending=!1;this.carousel=new he(this,{onStep:(t,r)=>this.leaveHighlight(t,r),onLayoutChange:()=>{this.cardVideos.clear(),this.player.isOpen&&(this.afterRender=()=>{var t;return(t=this.activeVideo)==null?void 0:t.pause()})},locked:()=>this.player.isOpen||this.mediaLoading,slideDuration:()=>this.slideDuration,reducedMotion:Q});this.player=new me(this,{onStep:t=>this.stepInPlayer(t),onClose:()=>this.closePlayer()});this.events=new fe(this,{identity:()=>({sessionId:this.sessionId,userId:this.userId}),viewTargets:()=>this.viewTargets()});this.renderSlide=(t,{key:r,index:i,offset:s,active:n,hidden:a,cardRef:d,focusRef:l})=>st(t,this.videoFor(r),{label:this.labels.position(n?this.labels.watch:this.labels.show,i,this.stories.length),labels:this.labels,withVideo:n||this.inactiveAutoplay&&!a,autoplay:!this.mediaLoading,product:this.productOf(t),onSelect:n?()=>this.openPlayer():()=>this.carousel.step(s),onProductSelect:n?()=>this.openPlayer({productOpen:!0}):void 0,cta:ke(t),onCtaSelect:n?void 0:()=>this.carousel.step(s),onPress:()=>this.events.click(t),ref:d,openRef:l});this.inactiveAutoplay=!1,this.stories=[],this.requesting=!1,this.mediaLoading=!1}connectedCallback(){var t;super.connectedCallback();for(let r of this.cardVideos.values())r.resume();(t=this.request)!=null&&t.signal.aborted&&this.loadStory()}disconnectedCallback(){var t,r;super.disconnectedCallback(),(t=this.request)==null||t.abort(),(r=this.mediaWait)==null||r.abort()}willUpdate(t){Ui.some(r=>t.has(r))&&this.loadStory()}updated(){let t=this.afterRender;this.afterRender=void 0,t==null||t()}get activeHydration(){if(this.hydration!=="none")return this.hydration?this.hydration:this.accountName?Zr:void 0}async loadStory(){var n,a,d,l,p;(n=this.request)==null||n.abort();let t=new AbortController;if(this.request=t,this.player.close(),this.requesting=!1,this.showStories([]),!this.isConnected){t.abort();return}this.requesting=!!(this.publisherId&&this.sessionId&&this.placement);let r=await Kr(this,{signal:t.signal,timeout:this.timeout});if(t.signal.aborted)return;this.requesting=!1;let i=this.activeHydration;if(!i||!r.some(c=>c.product)){this.request=void 0,this.showStories(r);return}this.showStories(r,"loading");let s=await Qr((a=this.placement)!=null?a:"",r,i,{accountName:(d=this.accountName)!=null?d:"",publisherId:(l=this.publisherId)!=null?l:"",sessionId:(p=this.sessionId)!=null?p:"",userId:this.userId,channel:this.channel},{signal:t.signal,timeout:this.hydrationTimeout});t.signal.aborted||(this.request=void 0,this.products=s)}showStories(t,r){this.products=r,this.cardVideos.clear(),this.soundPending=!1,this.afterRender=void 0,this.carousel.reset(t.length),this.stories=t,this.waitForFirstMedia(t)}async waitForFirstMedia(t){var a,d,l;(a=this.mediaWait)==null||a.abort();let r=new AbortController;this.mediaWait=r;let i=b((d=t[0])==null?void 0:d.poster_url),s=b((l=t[0])==null?void 0:l.media_url),n=[];i&&n.push(Xr(i)),s&&n.push(this.videoFor(this.carousel.activeKey).ready),this.mediaLoading=n.length>0,await Yr(n,r.signal),this.mediaWait===r&&(this.mediaWait=void 0,this.mediaLoading=!1,this.events.impress(t),this.afterRender=()=>{if(this.isConnected)for(let p of this.cardVideos.values())p.resume()},this.requestUpdate())}*viewTargets(){var s;let{stories:t}=this;if(this.mediaLoading)return;if(!this.player.isExpanded)for(let[n,{key:a,index:d}]of this.carousel.visibleCards()){let l=t[d];l&&((s=this.cardVideos.get(a))!=null&&s.playing)&&(yield[n,l])}let r=this.player.stageCard,i=t[this.carousel.active];r&&i&&this.player.video.playing&&(yield[r,i])}videoFor(t){let r=this.cardVideos.get(t);return r||(r=new z(this),this.cardVideos.set(t,r)),r}get activeVideo(){return this.cardVideos.get(this.carousel.activeKey)}leaveHighlight(t,r){let i=this.cardVideos.get(t);this.soundPending||(this.soundPending=i!==void 0&&!i.muted),this.inactiveAutoplay?i==null||i.mute():i==null||i.reset(),this.player.isOpen?(this.soundPending=!1,this.afterRender=()=>this.videoFor(r).pause()):this.soundPending&&(this.afterRender=()=>{this.soundPending=!1,this.videoFor(r).playWithSound()});for(let s of this.cardVideos.keys())Math.abs(s-r)>ue&&this.cardVideos.delete(s)}stepInPlayer(t){this.carousel.step(t,{evenIfLocked:!0}),this.player.showNext(t)}openPlayer({productOpen:t=!1}={}){var r;this.player.isOpen||(this.cartQuantities.clear(),(r=this.activeVideo)==null||r.pause(),this.player.open({productOpen:t}))}closePlayer(){if(this.player.isOpen){this.player.close();for(let t of this.cardVideos.values())t.resume();this.carousel.focusActive()}}get locale(){var t,r;return(r=(t=this.closest('[lang]:not([lang=""])'))==null?void 0:t.lang)!=null?r:Pe}get labels(){var n;let{locale:t,labelAddToCart:r="",labelViewProduct:i=""}=this,s=JSON.stringify([t,r,i]);return((n=this.labelSet)==null?void 0:n.key)!==s&&(this.labelSet={key:s,labels:dr(t,{addToCart:r,viewProduct:i})}),this.labelSet.labels}get formatPrice(){var i,s;let{locale:t}=this,r=`${t}|${(i=this.currency)!=null?i:""}`;return((s=this.formatter)==null?void 0:s.key)!==r&&(this.formatter={key:r,format:Ye(t,this.currency)}),this.formatter.format}productOf(t){var i;let r=this.products==="loading"?"loading":(i=this.products)==null?void 0:i.get(t.ad_id);return Je(t,this.formatPrice,this.labels,r)}render(){let{stories:t}=this,r=this.carousel.active,i=t[r];if(!i&&!this.requesting)return u;let s=this.requesting||this.mediaLoading;return f`
1629
+ <div
1630
+ class="root"
1631
+ ?data-loading=${s}
1632
+ ?data-requesting=${this.requesting}
1633
+ >
1634
+ ${i?this.carousel.render(t,this.renderSlide,this.labels):u}
1635
+ ${lt({done:!s})}
408
1636
  </div>
409
- ${this.player.render(dt)}
410
- `}};O.styles=[x`
1637
+ ${i?this.renderPlayer(i):u}
1638
+ `}renderPlayer(t){let{stories:r}=this,i=this.carousel.active,s=ut(r.length,i).map(a=>{let d=(i+a+r.length)%r.length;return{offset:a,story:r[d],label:this.labels.position(this.labels.show,d,r.length)}}),n=this.productOf(t);return this.player.render(t,{labels:this.labels,navigation:r.length>1,neighbors:s,product:n,cta:ke(t),productActions:this.cartActionsFor(n),onPress:()=>this.events.click(t)})}cartActionsFor(t){let r=t==null?void 0:t.sku;if(!r)return;let i={sku:r,seller:t.seller};return{cartQuantity:this.cartQuantities.get(ro(i)),onAddToCart:()=>this.changeCart(i,1),onRemoveFromCart:()=>this.changeCart(i,-1)}}changeCart(t,r){var l;let i=ro(t),s=(l=this.cartQuantities.get(i))!=null?l:0,n=Math.max(0,s+r);if(n===s)return;n>0?this.cartQuantities.set(i,n):this.cartQuantities.delete(i),this.requestUpdate(),this.dispatchEvent(r>0?eo(t):to(t));let a;if(s===0?a="stepper":n===0&&(a="add"),!a)return;let d=a;this.updateComplete.then(()=>this.shadowRoot&&tt(this.shadowRoot,d))}};D.properties={publisherId:{attribute:"publisher-id"},sessionId:{attribute:"session-id"},placement:{},userId:{attribute:"user-id"},accountName:{attribute:"account-name"},channel:{converter:zi},timeout:{type:Number},quantity:{type:Number},currency:{},labelAddToCart:{attribute:"label-add-to-cart"},labelViewProduct:{attribute:"label-view-product"},hydration:{converter:Wi},hydrationTimeout:{type:Number,attribute:"hydration-timeout"},slideDuration:{type:Number,attribute:"slide-duration"},inactiveAutoplay:{type:Boolean,attribute:"inactive-autoplay",converter:qi},stories:{state:!0},products:{state:!0},requesting:{state:!0},mediaLoading:{state:!0}},D.styles=[g`
411
1639
  :host {
412
1640
  display: block;
413
1641
  font-family: var(--vtex-ads-story-font-family, inherit);
414
1642
  color: var(--vtex-ads-story-color-text, inherit);
1643
+ --_pill-radius: var(--vtex-ads-story-radius, 16px);
1644
+ --_pill-inset: 8px;
1645
+ --_button-radius: var(--vtex-ads-story-radius, 999px);
415
1646
  }
416
- `,Ee,Se];function Y(){typeof customElements!="undefined"&&(customElements.get(F)||customElements.define(F,O))}Y();return yt(Dt);})();
1647
+ `,it,Qe,ot,at,dt,pt];function ye(){typeof customElements!="undefined"&&(customElements.get(x)||customElements.define(x,D))}ye();return lo(ji);})();
417
1648
  /*! Icons from Phosphor Icons (https://phosphoricons.com), MIT License, Copyright (c) 2023 Phosphor Icons */
418
1649
  /*! Bundled license information:
419
1650
 
@@ -428,8 +1659,9 @@
428
1659
  lit-html/lit-html.js:
429
1660
  lit-element/lit-element.js:
430
1661
  lit-html/directive.js:
431
- lit-html/directives/unsafe-html.js:
432
1662
  lit-html/async-directive.js:
1663
+ lit-html/directives/unsafe-html.js:
1664
+ lit-html/directives/repeat.js:
433
1665
  (**
434
1666
  * @license
435
1667
  * Copyright 2017 Google LLC
@@ -450,5 +1682,12 @@ lit-html/directives/ref.js:
450
1682
  * Copyright 2020 Google LLC
451
1683
  * SPDX-License-Identifier: BSD-3-Clause
452
1684
  *)
1685
+
1686
+ lit-html/directives/style-map.js:
1687
+ (**
1688
+ * @license
1689
+ * Copyright 2018 Google LLC
1690
+ * SPDX-License-Identifier: BSD-3-Clause
1691
+ *)
453
1692
  */
454
1693
  //# sourceMappingURL=vtex-ads-stories.js.map