ui.shipaid.com 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.es.js CHANGED
@@ -1707,6 +1707,7 @@ const logger = {
1707
1707
  };
1708
1708
  const POLL_INTERVAL_DEFAULT = 2500;
1709
1709
  const LOCAL_STORAGE_KEY = "shipaid-protection";
1710
+ const LOCAL_STORAGE_POLL_KEY = "polling-shipaid-protection";
1710
1711
  const PRODUCT_HANDLE = "shipaid-protection";
1711
1712
  const PREVIEW_FLAG = "shipaid-test";
1712
1713
  const StoreQuery = `query StoreByDomain ($store: String!) {
@@ -1715,6 +1716,7 @@ const StoreQuery = `query StoreByDomain ($store: String!) {
1715
1716
  planActive
1716
1717
  store
1717
1718
  widgetAutoOptIn
1719
+ widgetPollProtection
1718
1720
  widgetShowCart
1719
1721
  excludedProductSkus
1720
1722
  protectionSettings
@@ -1749,6 +1751,7 @@ let ShipAidWidget = class extends s$1 {
1749
1751
  this._shouldShowWidget = true;
1750
1752
  this._hasProtectionInCart = false;
1751
1753
  this.hasLoadedStrings = false;
1754
+ this.intervalId = 0;
1752
1755
  this._state = {
1753
1756
  loading: false,
1754
1757
  success: null,
@@ -1983,6 +1986,39 @@ let ShipAidWidget = class extends s$1 {
1983
1986
  );
1984
1987
  }
1985
1988
  }
1989
+ /** Try adding ShipAid shipping protection during polling if applicable */
1990
+ async attemptAddProtection() {
1991
+ var _a, _b, _c, _d, _e, _f;
1992
+ if (!((_a = this._store) == null ? void 0 : _a.widgetAutoOptIn))
1993
+ return;
1994
+ if (!((_b = this._cart) == null ? void 0 : _b.items) || !((_c = this._cart) == null ? void 0 : _c.item_count))
1995
+ return;
1996
+ const protectionCartItemIndex = (_d = this._cart.items) == null ? void 0 : _d.findIndex((item) => {
1997
+ var _a2, _b2;
1998
+ return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some(
1999
+ (variant) => variant.id === item.variant_id
2000
+ );
2001
+ });
2002
+ const protectionCartItem = (_e = this._cart) == null ? void 0 : _e.items[protectionCartItemIndex];
2003
+ this._hasProtectionInCart = !!protectionCartItem;
2004
+ if (this._cart.item_count === 1 && !!protectionCartItem)
2005
+ return;
2006
+ const hasSessionPayload = !!sessionStorage.getItem(LOCAL_STORAGE_KEY);
2007
+ if (hasSessionPayload)
2008
+ return;
2009
+ sessionStorage.setItem(
2010
+ LOCAL_STORAGE_KEY,
2011
+ JSON.stringify({ loaded: true })
2012
+ );
2013
+ if (
2014
+ // If we first check that no protection items are in the cart
2015
+ !this._hasProtectionInCart && // Then check we have some items in the cart
2016
+ ((_f = this._cart) == null ? void 0 : _f.item_count) && // And that we are actually showing the widget
2017
+ this._store.widgetShowCart
2018
+ ) {
2019
+ await this.addProtection();
2020
+ }
2021
+ }
1986
2022
  /** Templates */
1987
2023
  learnMorePopupTemplate() {
1988
2024
  return y`
@@ -2066,7 +2102,7 @@ let ShipAidWidget = class extends s$1 {
2066
2102
  }
2067
2103
  render() {
2068
2104
  useOnce(this, async () => {
2069
- var _a, _b;
2105
+ var _a, _b, _c;
2070
2106
  const linkEl = document.createElement("link");
2071
2107
  linkEl.setAttribute(
2072
2108
  "href",
@@ -2114,7 +2150,7 @@ let ShipAidWidget = class extends s$1 {
2114
2150
  this._shouldShowWidget = true;
2115
2151
  this._dispatchEvent(Events.LOADED, this._store);
2116
2152
  setTimeout(async () => {
2117
- var _a2, _b2, _c;
2153
+ var _a2, _b2, _c2;
2118
2154
  if (!((_a2 = this._store) == null ? void 0 : _a2.widgetAutoOptIn))
2119
2155
  return;
2120
2156
  if (!((_b2 = this._cart) == null ? void 0 : _b2.item_count))
@@ -2129,7 +2165,7 @@ let ShipAidWidget = class extends s$1 {
2129
2165
  if (
2130
2166
  // If we first check that no protection items are in the cart
2131
2167
  !this._hasProtectionInCart && // Then check we have some items in the cart
2132
- ((_c = this._cart) == null ? void 0 : _c.item_count) && // And that we are actually showing the widget
2168
+ ((_c2 = this._cart) == null ? void 0 : _c2.item_count) && // And that we are actually showing the widget
2133
2169
  this._store.widgetShowCart
2134
2170
  ) {
2135
2171
  await this.addProtection();
@@ -2147,6 +2183,12 @@ let ShipAidWidget = class extends s$1 {
2147
2183
  }
2148
2184
  await this.updateCart();
2149
2185
  }, this.pollingInterval);
2186
+ if (((_c = this._store) == null ? void 0 : _c.widgetPollProtection) && !this.intervalId) {
2187
+ this.intervalId = setInterval(async () => {
2188
+ await this.attemptAddProtection();
2189
+ }, 500);
2190
+ localStorage.setItem(`${LOCAL_STORAGE_POLL_KEY}_${this.intervalId}`, `${this.intervalId}`);
2191
+ }
2150
2192
  });
2151
2193
  useEffect(
2152
2194
  this,
@@ -2172,6 +2214,7 @@ let ShipAidWidget = class extends s$1 {
2172
2214
  "/cart/change.js",
2173
2215
  removePayload
2174
2216
  );
2217
+ sessionStorage.removeItem(LOCAL_STORAGE_KEY);
2175
2218
  return await this._handleRefresh(cart2);
2176
2219
  }
2177
2220
  const protectionFee = await this.calculateProtectionTotal(this._cart);
@@ -2289,6 +2332,9 @@ __decorateClass([
2289
2332
  __decorateClass([
2290
2333
  t$3()
2291
2334
  ], ShipAidWidget.prototype, "hasLoadedStrings", 2);
2335
+ __decorateClass([
2336
+ t$3()
2337
+ ], ShipAidWidget.prototype, "intervalId", 2);
2292
2338
  __decorateClass([
2293
2339
  t$3()
2294
2340
  ], ShipAidWidget.prototype, "_state", 2);
@@ -24,7 +24,7 @@ var ShipAidWidget=function(t){"use strict";const e={calculateProtectionTotal:fun
24
24
  * Copyright 2019 Google LLC
25
25
  * SPDX-License-Identifier: BSD-3-Clause
26
26
  */
27
- const a=window,d=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,p=Symbol(),l=new WeakMap;let c=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==p)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(d&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}};const h=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new c(i,t,p)},u=d?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,p))(e)})(t):t
27
+ const a=window,d=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),p=new WeakMap;let c=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==l)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(d&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=p.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&p.set(e,t))}return t}toString(){return this.cssText}};const h=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new c(i,t,l)},u=d?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,l))(e)})(t):t
28
28
  /**
29
29
  * @license
30
30
  * Copyright 2017 Google LLC
@@ -35,12 +35,12 @@ const a=window,d=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"
35
35
  * Copyright 2017 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
37
  */
38
- var C;$.finalized=!0,$.elementProperties=new Map,$.elementStyles=[],$.shadowRootOptions={mode:"open"},null==_||_({ReactiveElement:$}),(null!==(f=v.reactiveElementVersions)&&void 0!==f?f:v.reactiveElementVersions=[]).push("1.6.1");const A=window,S=A.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E=`lit$${(Math.random()+"").slice(9)}$`,L="?"+E,P=`<${L}>`,z=document,M=(t="")=>z.createComment(t),k=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,N=/>/g,R=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),j=/'/g,q=/"/g,I=/^(?:script|style|textarea|title)$/i,W=(F=1,(t,...e)=>({_$litType$:F,strings:t,values:e})),H=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),V=new WeakMap,B=z.createTreeWalker(z,129,null,!1);var F;class Z{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[d,p]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=O;for(let d=0;d<i;d++){const e=t[d];let i,a,p=-1,l=0;for(;l<e.length&&(n.lastIndex=l,a=n.exec(e),null!==a);)l=n.lastIndex,n===O?"!--"===a[1]?n=U:void 0!==a[1]?n=N:void 0!==a[2]?(I.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=R):void 0!==a[3]&&(n=R):n===R?">"===a[0]?(n=null!=r?r:O,p=-1):void 0===a[1]?p=-2:(p=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?R:'"'===a[3]?q:j):n===q||n===j?n=R:n===U||n===N?n=O:(n=R,r=void 0);const c=n===R&&t[d+1].startsWith("/>")?" ":"";s+=n===O?e+P:p>=0?(o.push(i),e.slice(0,p)+"$lit$"+e.slice(p)+E+c):e+E+(-2===p?(o.push(void 0),d):c)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==x?x.createHTML(a):a,o]})(t,e);if(this.el=Z.createElement(d,i),B.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=B.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(E)){const i=p[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(E),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?Q:"?"===e[1]?tt:"@"===e[1]?et:K})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(I.test(o.tagName)){const t=o.textContent.split(E),e=t.length-1;if(e>0){o.textContent=S?S.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],M()),B.nextNode(),a.push({type:2,index:++r});o.append(t[e],M())}}}else if(8===o.nodeType)if(o.data===L)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(E,t+1));)a.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=z.createElement("template");return i.innerHTML=t,i}}function Y(t,e,i=t,o){var r,s,n,a;if(e===H)return e;let d=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const p=k(e)?void 0:e._$litDirective$;return(null==d?void 0:d.constructor)!==p&&(null===(s=null==d?void 0:d._$AO)||void 0===s||s.call(d,!1),void 0===p?d=void 0:(d=new p(t),d._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Co)&&void 0!==n?n:a._$Co=[])[o]=d:i._$Cl=d),void 0!==d&&(e=Y(t,d._$AS(t,e.values),d,o)),e}class G{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:z).importNode(i,!0);B.currentNode=r;let s=B.nextNode(),n=0,a=0,d=o[0];for(;void 0!==d;){if(n===d.index){let e;2===d.type?e=new J(s,s.nextSibling,this,t):1===d.type?e=new d.ctor(s,d.name,d.strings,this,t):6===d.type&&(e=new it(s,this,t)),this.u.push(e),d=o[++a]}n!==(null==d?void 0:d.index)&&(s=B.nextNode(),n++)}return r}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class J{constructor(t,e,i,o){var r;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cm=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),k(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==H&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==D&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Z.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.p(i);else{const t=new G(r,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new Z(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new J(this.O(M()),this.O(M()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class K{constructor(t,e,i,o,r){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=D}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Y(this,t,e,0),s=!k(t)||t!==this._$AH&&t!==H,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Y(this,o[i+n],e,n),a===H&&(a=this._$AH[n]),s||(s=!k(a)||a!==this._$AH[n]),a===D?t=D:t!==D&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}const X=S?S.emptyScript:"";class tt extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==D?this.element.setAttribute(this.name,X):this.element.removeAttribute(this.name)}}class et extends K{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Y(this,t,e,0))&&void 0!==i?i:D)===H)return;const o=this._$AH,r=t===D&&o!==D||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==D&&(o===D||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const ot=A.litHtmlPolyfillSupport;null==ot||ot(Z,J),(null!==(C=A.litHtmlVersions)&&void 0!==C?C:A.litHtmlVersions=[]).push("2.6.1");const rt=(t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new J(e.insertBefore(M(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n};
38
+ var C;$.finalized=!0,$.elementProperties=new Map,$.elementStyles=[],$.shadowRootOptions={mode:"open"},null==_||_({ReactiveElement:$}),(null!==(f=v.reactiveElementVersions)&&void 0!==f?f:v.reactiveElementVersions=[]).push("1.6.1");const A=window,S=A.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E=`lit$${(Math.random()+"").slice(9)}$`,P="?"+E,L=`<${P}>`,z=document,M=(t="")=>z.createComment(t),k=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,N=/>/g,I=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),R=/'/g,j=/"/g,q=/^(?:script|style|textarea|title)$/i,W=(F=1,(t,...e)=>({_$litType$:F,strings:t,values:e})),H=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),V=new WeakMap,B=z.createTreeWalker(z,129,null,!1);var F;class Z{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[d,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=O;for(let d=0;d<i;d++){const e=t[d];let i,a,l=-1,p=0;for(;p<e.length&&(n.lastIndex=p,a=n.exec(e),null!==a);)p=n.lastIndex,n===O?"!--"===a[1]?n=U:void 0!==a[1]?n=N:void 0!==a[2]?(q.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=I):void 0!==a[3]&&(n=I):n===I?">"===a[0]?(n=null!=r?r:O,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?I:'"'===a[3]?j:R):n===j||n===R?n=I:n===U||n===N?n=O:(n=I,r=void 0);const c=n===I&&t[d+1].startsWith("/>")?" ":"";s+=n===O?e+L:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+E+c):e+E+(-2===l?(o.push(void 0),d):c)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==x?x.createHTML(a):a,o]})(t,e);if(this.el=Z.createElement(d,i),B.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=B.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(E)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(E),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?Q:"?"===e[1]?tt:"@"===e[1]?et:K})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(q.test(o.tagName)){const t=o.textContent.split(E),e=t.length-1;if(e>0){o.textContent=S?S.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],M()),B.nextNode(),a.push({type:2,index:++r});o.append(t[e],M())}}}else if(8===o.nodeType)if(o.data===P)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(E,t+1));)a.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=z.createElement("template");return i.innerHTML=t,i}}function Y(t,e,i=t,o){var r,s,n,a;if(e===H)return e;let d=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const l=k(e)?void 0:e._$litDirective$;return(null==d?void 0:d.constructor)!==l&&(null===(s=null==d?void 0:d._$AO)||void 0===s||s.call(d,!1),void 0===l?d=void 0:(d=new l(t),d._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Co)&&void 0!==n?n:a._$Co=[])[o]=d:i._$Cl=d),void 0!==d&&(e=Y(t,d._$AS(t,e.values),d,o)),e}class G{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:z).importNode(i,!0);B.currentNode=r;let s=B.nextNode(),n=0,a=0,d=o[0];for(;void 0!==d;){if(n===d.index){let e;2===d.type?e=new J(s,s.nextSibling,this,t):1===d.type?e=new d.ctor(s,d.name,d.strings,this,t):6===d.type&&(e=new it(s,this,t)),this.u.push(e),d=o[++a]}n!==(null==d?void 0:d.index)&&(s=B.nextNode(),n++)}return r}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class J{constructor(t,e,i,o){var r;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cm=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),k(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==H&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==D&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Z.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.p(i);else{const t=new G(r,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new Z(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new J(this.O(M()),this.O(M()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class K{constructor(t,e,i,o,r){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=D}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Y(this,t,e,0),s=!k(t)||t!==this._$AH&&t!==H,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Y(this,o[i+n],e,n),a===H&&(a=this._$AH[n]),s||(s=!k(a)||a!==this._$AH[n]),a===D?t=D:t!==D&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}const X=S?S.emptyScript:"";class tt extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==D?this.element.setAttribute(this.name,X):this.element.removeAttribute(this.name)}}class et extends K{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Y(this,t,e,0))&&void 0!==i?i:D)===H)return;const o=this._$AH,r=t===D&&o!==D||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==D&&(o===D||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const ot=A.litHtmlPolyfillSupport;null==ot||ot(Z,J),(null!==(C=A.litHtmlVersions)&&void 0!==C?C:A.litHtmlVersions=[]).push("2.6.1");const rt=(t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new J(e.insertBefore(M(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n};
39
39
  /**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
- */var st,nt;let at=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return H}};at.finalized=!0,at._$litElement$=!0,null===(st=globalThis.litElementHydrateSupport)||void 0===st||st.call(globalThis,{LitElement:at});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:at}),(null!==(nt=globalThis.litElementVersions)&&void 0!==nt?nt:globalThis.litElementVersions=[]).push("3.2.0");const pt="langChanged";function lt(t,e,i){return Object.entries(ht(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[  ]*${e}[  ]*}}`,"gm"),String(ht(i)))),t)}function ct(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function ht(t){return"function"==typeof t?t():t}let ut={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:ct,interpolate:lt,translationCache:{}};function ft(t,e,i=ut){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(pt,{detail:o}))}
43
+ */var st,nt;let at=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return H}};at.finalized=!0,at._$litElement$=!0,null===(st=globalThis.litElementHydrateSupport)||void 0===st||st.call(globalThis,{LitElement:at});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:at}),(null!==(nt=globalThis.litElementVersions)&&void 0!==nt?nt:globalThis.litElementVersions=[]).push("3.2.0");const lt="langChanged";function pt(t,e,i){return Object.entries(ht(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[  ]*${e}[  ]*}}`,"gm"),String(ht(i)))),t)}function ct(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function ht(t){return"function"==typeof t?t():t}let ut={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:ct,interpolate:pt,translationCache:{}};function ft(t,e,i=ut){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(lt,{detail:o}))}
44
44
  /**
45
45
  * @license
46
46
  * Copyright 2017 Google LLC
@@ -56,12 +56,12 @@ const vt=2;class mt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i)
56
56
  * @license
57
57
  * Copyright 2017 Google LLC
58
58
  * SPDX-License-Identifier: BSD-3-Clause
59
- */function bt(t){void 0!==this._$AN?(_t(this),this._$AM=t,yt(this)):this._$AM=t}function wt(t,e=!1,i=0){const o=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(o))for(let s=i;s<o.length;s++)gt(o[s],!1),_t(o[s]);else null!=o&&(gt(o,!1),_t(o));else gt(this,t)}const $t=t=>{var e,i,o,r;t.type==vt&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=wt),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=bt))};class Ct extends mt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),yt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,o;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(o=this.disconnected)||void 0===o||o.call(this)),e&&(gt(this,t),_t(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class At extends Ct{constructor(){super(...arguments),this.langChangedSubscription=null,this.getValue=()=>""}renderValue(t){return this.getValue=t,this.subscribe(),this.getValue()}langChanged(t){this.setValue(this.getValue(t))}subscribe(){null==this.langChangedSubscription&&(this.langChangedSubscription=function(t,e){const i=e=>t(e.detail);return window.addEventListener(pt,i,e),()=>window.removeEventListener(pt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const St=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends At{render(t,e,i){return this.renderValue((()=>function(t,e,i=ut){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?ht(e):null)?i.interpolate(o,e,i):o}(t,e,i)))}});
59
+ */function bt(t){void 0!==this._$AN?(_t(this),this._$AM=t,yt(this)):this._$AM=t}function wt(t,e=!1,i=0){const o=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(o))for(let s=i;s<o.length;s++)gt(o[s],!1),_t(o[s]);else null!=o&&(gt(o,!1),_t(o));else gt(this,t)}const $t=t=>{var e,i,o,r;t.type==vt&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=wt),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=bt))};class Ct extends mt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),yt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,o;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(o=this.disconnected)||void 0===o||o.call(this)),e&&(gt(this,t),_t(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class At extends Ct{constructor(){super(...arguments),this.langChangedSubscription=null,this.getValue=()=>""}renderValue(t){return this.getValue=t,this.subscribe(),this.getValue()}langChanged(t){this.setValue(this.getValue(t))}subscribe(){null==this.langChangedSubscription&&(this.langChangedSubscription=function(t,e){const i=e=>t(e.detail);return window.addEventListener(lt,i,e),()=>window.removeEventListener(lt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const St=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends At{render(t,e,i){return this.renderValue((()=>function(t,e,i=ut){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?ht(e):null)?i.interpolate(o,e,i):o}(t,e,i)))}});
60
60
  /**
61
61
  * @license
62
62
  * Copyright 2017 Google LLC
63
63
  * SPDX-License-Identifier: BSD-3-Clause
64
- */class xt extends mt{constructor(t){if(super(t),this.it=D,t.type!==vt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this._t=void 0,this.it=t;if(t===H)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}xt.directiveName="unsafeHTML",xt.resultType=1;const Et="__registered_effects";function Lt(t){const e=t;if(e[Et])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[Et]={index:0,count:0,effects:[]},i.updated=t=>(e[Et].index=0,o(t)),e}function Pt(t,e,i){const o=function(t,e){const i=Lt(t),{index:o,count:r}=i[Et];return o===r?(i[Et].index++,i[Et].count++,i[Et].effects.push(e),e):(i[Et].index++,i[Et].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
64
+ */class xt extends mt{constructor(t){if(super(t),this.it=D,t.type!==vt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this._t=void 0,this.it=t;if(t===H)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}xt.directiveName="unsafeHTML",xt.resultType=1;const Et="__registered_effects";function Pt(t){const e=t;if(e[Et])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[Et]={index:0,count:0,effects:[]},i.updated=t=>(e[Et].index=0,o(t)),e}function Lt(t,e,i){const o=function(t,e){const i=Pt(t),{index:o,count:r}=i[Et];return o===r?(i[Et].index++,i[Et].count++,i[Et].effects.push(e),e):(i[Et].index++,i[Et].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
65
65
  /**
66
66
  * @license
67
67
  * Copyright 2021 Google LLC
@@ -433,7 +433,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
433
433
  />
434
434
  </g>
435
435
  </svg>
436
- `,Rt=W`
436
+ `,It=W`
437
437
  <svg
438
438
  version="1.0"
439
439
  viewBox="0 0 500.000000 500.000000"
@@ -458,7 +458,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
458
458
  />
459
459
  </g>
460
460
  </svg>
461
- `,jt=W`
461
+ `,Rt=W`
462
462
  <svg
463
463
  xmlns="http://www.w3.org/2000/svg"
464
464
  version="1.0"
@@ -484,7 +484,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
484
484
  />
485
485
  </g>
486
486
  </svg>
487
- `;var qt=Object.defineProperty,It=Object.getOwnPropertyDescriptor,Wt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?It(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&qt(e,i,s),s};let Ht=class extends at{constructor(){super(...arguments),this.active=!1}handleClosePopup(){const t=new Event("close");this.dispatchEvent(t)}render(){return W`
487
+ `;var jt=Object.defineProperty,qt=Object.getOwnPropertyDescriptor,Wt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?qt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&jt(e,i,s),s};let Ht=class extends at{constructor(){super(...arguments),this.active=!1}handleClosePopup(){const t=new Event("close");this.dispatchEvent(t)}render(){return W`
488
488
  <div class=${`shipaid-popup ${this.active&&"active"}`}>
489
489
  <div class="blocker" @click=${this.handleClosePopup}></div>
490
490
  <button
@@ -505,11 +505,11 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
505
505
  <p>${St("learn-more-popup.disclaimer.subtitle-monitor")}</p>
506
506
  </div>
507
507
  <div class="popup-disclaimer-subtitle">
508
- <div class="popup-icon-b">${jt}</div>
508
+ <div class="popup-icon-b">${Rt}</div>
509
509
  <p>${St("learn-more-popup.disclaimer.subtitle-notify")}</p>
510
510
  </div>
511
511
  <div class="popup-disclaimer-subtitle">
512
- <div class="popup-icon-bell">${Rt}</div>
512
+ <div class="popup-icon-bell">${It}</div>
513
513
  <p>
514
514
  ${St("learn-more-popup.disclaimer.subtitle-resolution")}
515
515
  </p>
@@ -697,7 +697,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
697
697
  .shipaid-prompt .prompt-footer .prompt-footer-badge svg {
698
698
  height: 9px;
699
699
  }
700
- `;var Kt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(Kt||{}),Qt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,te=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?Xt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&Qt(e,i,s),s};const ee=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},ie=t=>console.warn(`[ShipAid] ${t}`),oe=t=>console.error(`[ShipAid] ${t}`),re="shipaid-protection",se=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>Gt)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>ue)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>be)).then((t=>t.default))});var ne;ne={loader:async t=>{if("en"===t)return Yt;const e=Reflect.get(se,`./lang/${t}.json`);return e?await e():Yt}},ut=Object.assign(Object.assign({},ut),ne),t.ShipAidWidget=class extends at{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.lang="en",this.currency=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ee(t),post:(t,e)=>ee(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(ie("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(e=this._store)?void 0:e.currency)||(null==(o=null==(i=window.Shopify)?void 0:i.currency)?void 0:o.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(Kt.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(n){throw console.error(n),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw oe(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw oe(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._setState("success")}catch(i){oe(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._cart=e,this._setState("success")}catch(t){oe(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}learnMorePopupTemplate(){return W`
700
+ `;var Kt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(Kt||{}),Qt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,te=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?Xt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&Qt(e,i,s),s};const ee=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},ie=t=>console.warn(`[ShipAid] ${t}`),oe=t=>console.error(`[ShipAid] ${t}`),re="shipaid-protection",se=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>Gt)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>ue)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>be)).then((t=>t.default))});var ne;ne={loader:async t=>{if("en"===t)return Yt;const e=Reflect.get(se,`./lang/${t}.json`);return e?await e():Yt}},ut=Object.assign(Object.assign({},ut),ne),t.ShipAidWidget=class extends at{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.lang="en",this.currency=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this.intervalId=0,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ee(t),post:(t,e)=>ee(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(ie("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(e=this._store)?void 0:e.currency)||(null==(o=null==(i=window.Shopify)?void 0:i.currency)?void 0:o.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(Kt.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetPollProtection\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(n){throw console.error(n),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw oe(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw oe(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._setState("success")}catch(i){oe(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._cart=e,this._setState("success")}catch(t){oe(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async attemptAddProtection(){var t,e,i,o,r,s;if(!(null==(t=this._store)?void 0:t.widgetAutoOptIn))return;if(!(null==(e=this._cart)?void 0:e.items)||!(null==(i=this._cart)?void 0:i.item_count))return;const n=null==(o=this._cart.items)?void 0:o.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),a=null==(r=this._cart)?void 0:r.items[n];if(this._hasProtectionInCart=!!a,1===this._cart.item_count&&a)return;!!sessionStorage.getItem(re)||(sessionStorage.setItem(re,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(s=this._cart)?void 0:s.item_count)&&this._store.widgetShowCart&&await this.addProtection())}learnMorePopupTemplate(){return W`
701
701
  <shipaid-popup-learn-more
702
702
  ?active=${"learn-more"===this._popup}
703
703
  @close=${()=>{this._popup=null}}
@@ -748,10 +748,10 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
748
748
  </a>
749
749
  </div>
750
750
  </div>
751
- `}async connectedCallback(){super.connectedCallback(),await async function(t,e=ut){const i=await e.loader(t,e);e.translationCache={},ft(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return Pt(this,(async()=>{var t,e;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(o){return oe(o.message),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(Kt.LOADED,this._store),setTimeout((async()=>{var t,e,i;(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&(null==(e=this._cart)?void 0:e.item_count)&&(sessionStorage.getItem(re)||(sessionStorage.setItem(re,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(i=this._cart)?void 0:i.item_count)&&this._store.widgetShowCart&&await this.addProtection()))}),500),void(this.disablePolling||setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval))):(ie("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),Pt(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,!(null==n?void 0:n.id))return this._shouldShowWidget=!1,void oe("No matching protection variant found.");if(!r)return;if(n.id===r.variant_id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a={updates:{[r.variant_id]:0,[n.id]:1}},d=await this._fetch.post("/cart/update.js",a);await this._handleRefresh(d)}),[this._store,this._cart]),rt(this.learnMorePopupTemplate(),document.body),W`
751
+ `}async connectedCallback(){super.connectedCallback(),await async function(t,e=ut){const i=await e.loader(t,e);e.translationCache={},ft(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return Lt(this,(async()=>{var t,e,i;const o=document.createElement("link");o.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),o.setAttribute("rel","stylesheet"),document.head.appendChild(o);try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(r){return oe(r.message),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(Kt.LOADED,this._store),setTimeout((async()=>{var t,e,i;(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&(null==(e=this._cart)?void 0:e.item_count)&&(sessionStorage.getItem(re)||(sessionStorage.setItem(re,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(i=this._cart)?void 0:i.item_count)&&this._store.widgetShowCart&&await this.addProtection()))}),500),void(this.disablePolling||(setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval),(null==(i=this._store)?void 0:i.widgetPollProtection)&&!this.intervalId&&(this.intervalId=setInterval((async()=>{await this.attemptAddProtection()}),500),localStorage.setItem(`polling-shipaid-protection_${this.intervalId}`,`${this.intervalId}`))))):(ie("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),Lt(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return sessionStorage.removeItem(re),await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,!(null==n?void 0:n.id))return this._shouldShowWidget=!1,void oe("No matching protection variant found.");if(!r)return;if(n.id===r.variant_id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a={updates:{[r.variant_id]:0,[n.id]:1}},d=await this._fetch.post("/cart/update.js",a);await this._handleRefresh(d)}),[this._store,this._cart]),rt(this.learnMorePopupTemplate(),document.body),W`
752
752
  <div class="shipaid">
753
753
  ${zt(this._hasFinishedSetup,(()=>{var t;return zt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>this.promptTemplate()),(()=>D))}),(()=>W`<p>
754
754
  <slot name="loading" default>${St("loading")}</slot>
755
755
  </p>`))}
756
756
  </div>
757
- `}},t.ShipAidWidget.styles=Jt,te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),te([r({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),te([s()],t.ShipAidWidget.prototype,"_storeDomain",2),te([s()],t.ShipAidWidget.prototype,"_store",2),te([s()],t.ShipAidWidget.prototype,"_cart",2),te([s()],t.ShipAidWidget.prototype,"_protectionProduct",2),te([s()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),te([s()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),te([s()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),te([s()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),te([s()],t.ShipAidWidget.prototype,"_protectionCartItem",2),te([s()],t.ShipAidWidget.prototype,"_protectionVariant",2),te([s()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),te([s()],t.ShipAidWidget.prototype,"_state",2),te([s()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=te([i("shipaid-widget")],t.ShipAidWidget);const ae="Caricamento del widget ShipAid...",de="Garanzia di consegna",pe="in caso di Perdita, Danno o Furto",le={button:"Offerto da"},ce={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},he={loading:ae,title:de,description:pe,footer:le,actions:ce,"learn-more-popup":{close:"Vicina",title:"Garanzia di consegna",subtitle:"Consentiamo ai tuoi marchi preferiti di offrire una garanzia di consegna perché ogni ordine è prezioso!",disclaimer:{"subtitle-enable":"Consentiamo ai tuoi marchi preferiti di fornire una garanzia di consegna perché sappiamo che ogni ordine è prezioso e le cose accadono!","subtitle-monitor":"Monitoriamo continuamente il tuo pacco e ti offriamo un comodo portale per monitorare lo stato di avanzamento del tuo ordine in qualsiasi momento!","subtitle-notify":"Riceverai una notifica durante l'intero processo di spedizione, assicurandoti di rimanere aggiornato in ogni fase del processo.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Acquistando questa garanzia di consegna, accetti i nostri Termini di servizio e l'Informativa sulla privacy. Non sei obbligato ad acquistare questa garanzia. Questa garanzia NON è un'assicurazione e non fornisce un indennizzo contro perdite, danni o responsabilità derivanti da un evento contingente o sconosciuto, ma piuttosto, attraverso ShipAid i marchi forniscono una garanzia di consegna in base alla quale se il prodotto ordinato non viene consegnato in condizioni soddisfacenti, il marchio da cui hai ordinato il prodotto può sostituire il prodotto gratuitamente. ShipAid non fornisce alcun prodotto o servizio direttamente ai consumatori, ma fornisce invece un servizio che consente ai marchi di facilitare la sostituzione del prodotto ai propri clienti. L'acquisto di questa garanzia non significa che verrai automaticamente rimborsato per qualsiasi prodotto o costo di spedizione perché il processo di risoluzione e la decisione per il risarcimento sono rigorosamente decisi dal marchio da cui stai acquistando. Il marchio richiederà la prova del danno o del prodotto non consegnato."},links:{terms:"Termini di servizio",privacy:"Politica sulla riservatezza"}}},ue=Object.freeze(Object.defineProperty({__proto__:null,actions:ce,default:he,description:pe,footer:le,loading:ae,title:de},Symbol.toStringTag,{value:"Module"})),fe="Carregando o widget ShipAid...",ve="Garantia de entrega",me="em caso de Perda, Danos ou Roubo",ge={button:"Distribuído por"},_e={add:"Adicionar",remove:"Remover",loading:"Carregando..."},ye={loading:fe,title:ve,description:me,footer:ge,actions:_e,"learn-more-popup":{close:"Fechar",title:"Garantia de entrega",subtitle:"Capacitamos suas marcas favoritas para oferecer uma garantia de entrega porque cada pedido é precioso!",disclaimer:{"subtitle-enable":"Permitimos que suas marcas favoritas forneçam uma garantia de entrega porque sabemos que cada pedido é precioso e as coisas acontecem!","subtitle-monitor":"Monitoramos continuamente o seu pacote e oferecemos um portal conveniente para você acompanhar o andamento do seu pedido a qualquer momento!","subtitle-notify":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Ao adquirir esta garantia de entrega, você concorda com nossos Termos de Serviço e Política de Privacidade. Esta garantia não é obrigatória, NÃO é um seguro e não fornece indenização contra perdas, danos ou responsabilidade decorrentes de um contingente ou desconhecido. Caso o produto não seja entregue em condições satisfatórias, a marca da qual você comprou pode substituí-lo gratuitamente. A ShipAid não fornece nenhum produto ou serviço diretamente aos consumidores, mas sim presta um serviço que permite às marcas facilitar a substituição do produto aos seus clientes. Adquirir esta garantia não significa que você será automaticamente reembolsado por qualquer produto ou custos de envio porque o processo de resolução e decisão de compensação é estritamente decidido pela marca que você está comprando. A marca exigirá prova de danos ou produto não entregue."},links:{terms:"Termos de serviço",privacy:"Política de Privacidade"}}},be=Object.freeze(Object.defineProperty({__proto__:null,actions:_e,default:ye,description:me,footer:ge,loading:fe,title:ve},Symbol.toStringTag,{value:"Module"}));return Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
757
+ `}},t.ShipAidWidget.styles=Jt,te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),te([r({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),te([s()],t.ShipAidWidget.prototype,"_storeDomain",2),te([s()],t.ShipAidWidget.prototype,"_store",2),te([s()],t.ShipAidWidget.prototype,"_cart",2),te([s()],t.ShipAidWidget.prototype,"_protectionProduct",2),te([s()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),te([s()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),te([s()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),te([s()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),te([s()],t.ShipAidWidget.prototype,"_protectionCartItem",2),te([s()],t.ShipAidWidget.prototype,"_protectionVariant",2),te([s()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),te([s()],t.ShipAidWidget.prototype,"intervalId",2),te([s()],t.ShipAidWidget.prototype,"_state",2),te([s()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=te([i("shipaid-widget")],t.ShipAidWidget);const ae="Caricamento del widget ShipAid...",de="Garanzia di consegna",le="in caso di Perdita, Danno o Furto",pe={button:"Offerto da"},ce={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},he={loading:ae,title:de,description:le,footer:pe,actions:ce,"learn-more-popup":{close:"Vicina",title:"Garanzia di consegna",subtitle:"Consentiamo ai tuoi marchi preferiti di offrire una garanzia di consegna perché ogni ordine è prezioso!",disclaimer:{"subtitle-enable":"Consentiamo ai tuoi marchi preferiti di fornire una garanzia di consegna perché sappiamo che ogni ordine è prezioso e le cose accadono!","subtitle-monitor":"Monitoriamo continuamente il tuo pacco e ti offriamo un comodo portale per monitorare lo stato di avanzamento del tuo ordine in qualsiasi momento!","subtitle-notify":"Riceverai una notifica durante l'intero processo di spedizione, assicurandoti di rimanere aggiornato in ogni fase del processo.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Acquistando questa garanzia di consegna, accetti i nostri Termini di servizio e l'Informativa sulla privacy. Non sei obbligato ad acquistare questa garanzia. Questa garanzia NON è un'assicurazione e non fornisce un indennizzo contro perdite, danni o responsabilità derivanti da un evento contingente o sconosciuto, ma piuttosto, attraverso ShipAid i marchi forniscono una garanzia di consegna in base alla quale se il prodotto ordinato non viene consegnato in condizioni soddisfacenti, il marchio da cui hai ordinato il prodotto può sostituire il prodotto gratuitamente. ShipAid non fornisce alcun prodotto o servizio direttamente ai consumatori, ma fornisce invece un servizio che consente ai marchi di facilitare la sostituzione del prodotto ai propri clienti. L'acquisto di questa garanzia non significa che verrai automaticamente rimborsato per qualsiasi prodotto o costo di spedizione perché il processo di risoluzione e la decisione per il risarcimento sono rigorosamente decisi dal marchio da cui stai acquistando. Il marchio richiederà la prova del danno o del prodotto non consegnato."},links:{terms:"Termini di servizio",privacy:"Politica sulla riservatezza"}}},ue=Object.freeze(Object.defineProperty({__proto__:null,actions:ce,default:he,description:le,footer:pe,loading:ae,title:de},Symbol.toStringTag,{value:"Module"})),fe="Carregando o widget ShipAid...",ve="Garantia de entrega",me="em caso de Perda, Danos ou Roubo",ge={button:"Distribuído por"},_e={add:"Adicionar",remove:"Remover",loading:"Carregando..."},ye={loading:fe,title:ve,description:me,footer:ge,actions:_e,"learn-more-popup":{close:"Fechar",title:"Garantia de entrega",subtitle:"Capacitamos suas marcas favoritas para oferecer uma garantia de entrega porque cada pedido é precioso!",disclaimer:{"subtitle-enable":"Permitimos que suas marcas favoritas forneçam uma garantia de entrega porque sabemos que cada pedido é precioso e as coisas acontecem!","subtitle-monitor":"Monitoramos continuamente o seu pacote e oferecemos um portal conveniente para você acompanhar o andamento do seu pedido a qualquer momento!","subtitle-notify":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Ao adquirir esta garantia de entrega, você concorda com nossos Termos de Serviço e Política de Privacidade. Esta garantia não é obrigatória, NÃO é um seguro e não fornece indenização contra perdas, danos ou responsabilidade decorrentes de um contingente ou desconhecido. Caso o produto não seja entregue em condições satisfatórias, a marca da qual você comprou pode substituí-lo gratuitamente. A ShipAid não fornece nenhum produto ou serviço diretamente aos consumidores, mas sim presta um serviço que permite às marcas facilitar a substituição do produto aos seus clientes. Adquirir esta garantia não significa que você será automaticamente reembolsado por qualquer produto ou custos de envio porque o processo de resolução e decisão de compensação é estritamente decidido pela marca que você está comprando. A marca exigirá prova de danos ou produto não entregue."},links:{terms:"Termos de serviço",privacy:"Política de Privacidade"}}},be=Object.freeze(Object.defineProperty({__proto__:null,actions:_e,default:ye,description:me,footer:ge,loading:fe,title:ve},Symbol.toStringTag,{value:"Module"}));return Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
@@ -24,44 +24,44 @@
24
24
  * Copyright 2019 Google LLC
25
25
  * SPDX-License-Identifier: BSD-3-Clause
26
26
  */
27
- const a=window,d=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,p=Symbol(),l=new WeakMap;let c=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==p)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(d&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}};const h=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new c(i,t,p)},u=d?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,p))(e)})(t):t
27
+ const a=window,d=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),p=new WeakMap;let c=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==l)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(d&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=p.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&p.set(e,t))}return t}toString(){return this.cssText}};const h=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new c(i,t,l)},u=d?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new c("string"==typeof t?t:t+"",void 0,l))(e)})(t):t
28
28
  /**
29
29
  * @license
30
30
  * Copyright 2017 Google LLC
31
31
  * SPDX-License-Identifier: BSD-3-Clause
32
- */;var f;const m=window,g=m.trustedTypes,v=g?g.emptyScript:"",_=m.reactiveElementPolyfillSupport,y={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(o){i=null}}return i}},b=(t,e)=>e!==t&&(e==e||t==t),w={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:b};let $=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Ep(i,e);void 0!==o&&(this._$Ev.set(o,i),t.push(o))})),t}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||w}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{d?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=a.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=w){var o;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(o=i.converter)||void 0===o?void 0:o.toAttribute)?i.converter:y).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const o=this.constructor,r=o._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=o.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:y;this._$El=r,this[r]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||b)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(o){throw e=!1,this._$Ek(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};
32
+ */;var f;const v=window,m=v.trustedTypes,g=m?m.emptyScript:"",_=v.reactiveElementPolyfillSupport,y={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(o){i=null}}return i}},b=(t,e)=>e!==t&&(e==e||t==t),w={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:b};let $=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const o=this._$Ep(i,e);void 0!==o&&(this._$Ev.set(o,i),t.push(o))})),t}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const r=this[t];this[e]=o,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||w}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{d?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),o=a.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=w){var o;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(o=i.converter)||void 0===o?void 0:o.toAttribute)?i.converter:y).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const o=this.constructor,r=o._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=o.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:y;this._$El=r,this[r]=s.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||b)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(o){throw e=!1,this._$Ek(),o}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};
33
33
  /**
34
34
  * @license
35
35
  * Copyright 2017 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
37
  */
38
- var C;$.finalized=!0,$.elementProperties=new Map,$.elementStyles=[],$.shadowRootOptions={mode:"open"},null==_||_({ReactiveElement:$}),(null!==(f=m.reactiveElementVersions)&&void 0!==f?f:m.reactiveElementVersions=[]).push("1.6.1");const A=window,S=A.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E=`lit$${(Math.random()+"").slice(9)}$`,L="?"+E,P=`<${L}>`,z=document,M=(t="")=>z.createComment(t),k=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,N=/>/g,R=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),j=/'/g,q=/"/g,I=/^(?:script|style|textarea|title)$/i,W=(F=1,(t,...e)=>({_$litType$:F,strings:t,values:e})),H=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),V=new WeakMap,B=z.createTreeWalker(z,129,null,!1);var F;class Z{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[d,p]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=O;for(let d=0;d<i;d++){const e=t[d];let i,a,p=-1,l=0;for(;l<e.length&&(n.lastIndex=l,a=n.exec(e),null!==a);)l=n.lastIndex,n===O?"!--"===a[1]?n=U:void 0!==a[1]?n=N:void 0!==a[2]?(I.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=R):void 0!==a[3]&&(n=R):n===R?">"===a[0]?(n=null!=r?r:O,p=-1):void 0===a[1]?p=-2:(p=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?R:'"'===a[3]?q:j):n===q||n===j?n=R:n===U||n===N?n=O:(n=R,r=void 0);const c=n===R&&t[d+1].startsWith("/>")?" ":"";s+=n===O?e+P:p>=0?(o.push(i),e.slice(0,p)+"$lit$"+e.slice(p)+E+c):e+E+(-2===p?(o.push(void 0),d):c)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==x?x.createHTML(a):a,o]})(t,e);if(this.el=Z.createElement(d,i),B.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=B.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(E)){const i=p[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(E),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?Q:"?"===e[1]?tt:"@"===e[1]?et:K})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(I.test(o.tagName)){const t=o.textContent.split(E),e=t.length-1;if(e>0){o.textContent=S?S.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],M()),B.nextNode(),a.push({type:2,index:++r});o.append(t[e],M())}}}else if(8===o.nodeType)if(o.data===L)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(E,t+1));)a.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=z.createElement("template");return i.innerHTML=t,i}}function Y(t,e,i=t,o){var r,s,n,a;if(e===H)return e;let d=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const p=k(e)?void 0:e._$litDirective$;return(null==d?void 0:d.constructor)!==p&&(null===(s=null==d?void 0:d._$AO)||void 0===s||s.call(d,!1),void 0===p?d=void 0:(d=new p(t),d._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Co)&&void 0!==n?n:a._$Co=[])[o]=d:i._$Cl=d),void 0!==d&&(e=Y(t,d._$AS(t,e.values),d,o)),e}class G{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:z).importNode(i,!0);B.currentNode=r;let s=B.nextNode(),n=0,a=0,d=o[0];for(;void 0!==d;){if(n===d.index){let e;2===d.type?e=new J(s,s.nextSibling,this,t):1===d.type?e=new d.ctor(s,d.name,d.strings,this,t):6===d.type&&(e=new it(s,this,t)),this.u.push(e),d=o[++a]}n!==(null==d?void 0:d.index)&&(s=B.nextNode(),n++)}return r}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class J{constructor(t,e,i,o){var r;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cm=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),k(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==H&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==D&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Z.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.p(i);else{const t=new G(r,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new Z(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new J(this.O(M()),this.O(M()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class K{constructor(t,e,i,o,r){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=D}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Y(this,t,e,0),s=!k(t)||t!==this._$AH&&t!==H,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Y(this,o[i+n],e,n),a===H&&(a=this._$AH[n]),s||(s=!k(a)||a!==this._$AH[n]),a===D?t=D:t!==D&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}const X=S?S.emptyScript:"";class tt extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==D?this.element.setAttribute(this.name,X):this.element.removeAttribute(this.name)}}class et extends K{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Y(this,t,e,0))&&void 0!==i?i:D)===H)return;const o=this._$AH,r=t===D&&o!==D||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==D&&(o===D||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const ot=A.litHtmlPolyfillSupport;null==ot||ot(Z,J),(null!==(C=A.litHtmlVersions)&&void 0!==C?C:A.litHtmlVersions=[]).push("2.6.1");const rt=(t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new J(e.insertBefore(M(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n};
38
+ var C;$.finalized=!0,$.elementProperties=new Map,$.elementStyles=[],$.shadowRootOptions={mode:"open"},null==_||_({ReactiveElement:$}),(null!==(f=v.reactiveElementVersions)&&void 0!==f?f:v.reactiveElementVersions=[]).push("1.6.1");const A=window,S=A.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E=`lit$${(Math.random()+"").slice(9)}$`,P="?"+E,L=`<${P}>`,z=document,M=(t="")=>z.createComment(t),k=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,N=/>/g,I=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),R=/'/g,j=/"/g,q=/^(?:script|style|textarea|title)$/i,W=(F=1,(t,...e)=>({_$litType$:F,strings:t,values:e})),H=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),V=new WeakMap,B=z.createTreeWalker(z,129,null,!1);var F;class Z{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[d,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=O;for(let d=0;d<i;d++){const e=t[d];let i,a,l=-1,p=0;for(;p<e.length&&(n.lastIndex=p,a=n.exec(e),null!==a);)p=n.lastIndex,n===O?"!--"===a[1]?n=U:void 0!==a[1]?n=N:void 0!==a[2]?(q.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=I):void 0!==a[3]&&(n=I):n===I?">"===a[0]?(n=null!=r?r:O,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?I:'"'===a[3]?j:R):n===j||n===R?n=I:n===U||n===N?n=O:(n=I,r=void 0);const c=n===I&&t[d+1].startsWith("/>")?" ":"";s+=n===O?e+L:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+E+c):e+E+(-2===l?(o.push(void 0),d):c)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==x?x.createHTML(a):a,o]})(t,e);if(this.el=Z.createElement(d,i),B.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=B.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(E)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(E),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?Q:"?"===e[1]?tt:"@"===e[1]?et:K})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(q.test(o.tagName)){const t=o.textContent.split(E),e=t.length-1;if(e>0){o.textContent=S?S.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],M()),B.nextNode(),a.push({type:2,index:++r});o.append(t[e],M())}}}else if(8===o.nodeType)if(o.data===P)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(E,t+1));)a.push({type:7,index:r}),t+=E.length-1}r++}}static createElement(t,e){const i=z.createElement("template");return i.innerHTML=t,i}}function Y(t,e,i=t,o){var r,s,n,a;if(e===H)return e;let d=void 0!==o?null===(r=i._$Co)||void 0===r?void 0:r[o]:i._$Cl;const l=k(e)?void 0:e._$litDirective$;return(null==d?void 0:d.constructor)!==l&&(null===(s=null==d?void 0:d._$AO)||void 0===s||s.call(d,!1),void 0===l?d=void 0:(d=new l(t),d._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Co)&&void 0!==n?n:a._$Co=[])[o]=d:i._$Cl=d),void 0!==d&&(e=Y(t,d._$AS(t,e.values),d,o)),e}class G{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:z).importNode(i,!0);B.currentNode=r;let s=B.nextNode(),n=0,a=0,d=o[0];for(;void 0!==d;){if(n===d.index){let e;2===d.type?e=new J(s,s.nextSibling,this,t):1===d.type?e=new d.ctor(s,d.name,d.strings,this,t):6===d.type&&(e=new it(s,this,t)),this.u.push(e),d=o[++a]}n!==(null==d?void 0:d.index)&&(s=B.nextNode(),n++)}return r}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class J{constructor(t,e,i,o){var r;this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cm=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),k(t)?t===D||null==t||""===t?(this._$AH!==D&&this._$AR(),this._$AH=D):t!==this._$AH&&t!==H&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==D&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=Z.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.p(i);else{const t=new G(r,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new Z(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new J(this.O(M()),this.O(M()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class K{constructor(t,e,i,o,r){this.type=1,this._$AH=D,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=D}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Y(this,t,e,0),s=!k(t)||t!==this._$AH&&t!==H,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Y(this,o[i+n],e,n),a===H&&(a=this._$AH[n]),s||(s=!k(a)||a!==this._$AH[n]),a===D?t=D:t!==D&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(t)}j(t){t===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===D?void 0:t}}const X=S?S.emptyScript:"";class tt extends K{constructor(){super(...arguments),this.type=4}j(t){t&&t!==D?this.element.setAttribute(this.name,X):this.element.removeAttribute(this.name)}}class et extends K{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Y(this,t,e,0))&&void 0!==i?i:D)===H)return;const o=this._$AH,r=t===D&&o!==D||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==D&&(o===D||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const ot=A.litHtmlPolyfillSupport;null==ot||ot(Z,J),(null!==(C=A.litHtmlVersions)&&void 0!==C?C:A.litHtmlVersions=[]).push("2.6.1");const rt=(t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new J(e.insertBefore(M(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n};
39
39
  /**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
- */var st,nt;let at=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return H}};at.finalized=!0,at._$litElement$=!0,null===(st=globalThis.litElementHydrateSupport)||void 0===st||st.call(globalThis,{LitElement:at});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:at}),(null!==(nt=globalThis.litElementVersions)&&void 0!==nt?nt:globalThis.litElementVersions=[]).push("3.2.0");const pt="langChanged";function lt(t,e,i){return Object.entries(ht(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[  ]*${e}[  ]*}}`,"gm"),String(ht(i)))),t)}function ct(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function ht(t){return"function"==typeof t?t():t}let ut={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:ct,interpolate:lt,translationCache:{}};function ft(t,e,i=ut){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(pt,{detail:o}))}
43
+ */var st,nt;let at=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return H}};at.finalized=!0,at._$litElement$=!0,null===(st=globalThis.litElementHydrateSupport)||void 0===st||st.call(globalThis,{LitElement:at});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:at}),(null!==(nt=globalThis.litElementVersions)&&void 0!==nt?nt:globalThis.litElementVersions=[]).push("3.2.0");const lt="langChanged";function pt(t,e,i){return Object.entries(ht(e||{})).reduce(((t,[e,i])=>t.replace(new RegExp(`{{[  ]*${e}[  ]*}}`,"gm"),String(ht(i)))),t)}function ct(t,e){const i=t.split(".");let o=e.strings;for(;null!=o&&i.length>0;)o=o[i.shift()];return null!=o?o.toString():null}function ht(t){return"function"==typeof t?t():t}let ut={loader:()=>Promise.resolve({}),empty:t=>`[${t}]`,lookup:ct,interpolate:pt,translationCache:{}};function ft(t,e,i=ut){var o;o={previousStrings:i.strings,previousLang:i.lang,lang:i.lang=t,strings:i.strings=e},window.dispatchEvent(new CustomEvent(lt,{detail:o}))}
44
44
  /**
45
45
  * @license
46
46
  * Copyright 2017 Google LLC
47
47
  * SPDX-License-Identifier: BSD-3-Clause
48
48
  */
49
- const mt=2;class gt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
49
+ const vt=2;class mt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
50
50
  /**
51
51
  * @license
52
52
  * Copyright 2020 Google LLC
53
53
  * SPDX-License-Identifier: BSD-3-Clause
54
- */const vt=(t,e)=>{var i,o;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(o=(i=s)._$AO)||void 0===o||o.call(i,e,!1),vt(s,e);return!0},_t=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},yt=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),$t(e)}};
54
+ */const gt=(t,e)=>{var i,o;const r=t._$AN;if(void 0===r)return!1;for(const s of r)null===(o=(i=s)._$AO)||void 0===o||o.call(i,e,!1),gt(s,e);return!0},_t=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},yt=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),$t(e)}};
55
55
  /**
56
56
  * @license
57
57
  * Copyright 2017 Google LLC
58
58
  * SPDX-License-Identifier: BSD-3-Clause
59
- */function bt(t){void 0!==this._$AN?(_t(this),this._$AM=t,yt(this)):this._$AM=t}function wt(t,e=!1,i=0){const o=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(o))for(let s=i;s<o.length;s++)vt(o[s],!1),_t(o[s]);else null!=o&&(vt(o,!1),_t(o));else vt(this,t)}const $t=t=>{var e,i,o,r;t.type==mt&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=wt),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=bt))};class Ct extends gt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),yt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,o;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(o=this.disconnected)||void 0===o||o.call(this)),e&&(vt(this,t),_t(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class At extends Ct{constructor(){super(...arguments),this.langChangedSubscription=null,this.getValue=()=>""}renderValue(t){return this.getValue=t,this.subscribe(),this.getValue()}langChanged(t){this.setValue(this.getValue(t))}subscribe(){null==this.langChangedSubscription&&(this.langChangedSubscription=function(t,e){const i=e=>t(e.detail);return window.addEventListener(pt,i,e),()=>window.removeEventListener(pt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const St=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends At{render(t,e,i){return this.renderValue((()=>function(t,e,i=ut){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?ht(e):null)?i.interpolate(o,e,i):o}(t,e,i)))}});
59
+ */function bt(t){void 0!==this._$AN?(_t(this),this._$AM=t,yt(this)):this._$AM=t}function wt(t,e=!1,i=0){const o=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(o))for(let s=i;s<o.length;s++)gt(o[s],!1),_t(o[s]);else null!=o&&(gt(o,!1),_t(o));else gt(this,t)}const $t=t=>{var e,i,o,r;t.type==vt&&(null!==(e=(o=t)._$AP)&&void 0!==e||(o._$AP=wt),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=bt))};class Ct extends mt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),yt(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,o;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(o=this.disconnected)||void 0===o||o.call(this)),e&&(gt(this,t),_t(this))}setValue(t){if(void 0===this._$Ct.strings)this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class At extends Ct{constructor(){super(...arguments),this.langChangedSubscription=null,this.getValue=()=>""}renderValue(t){return this.getValue=t,this.subscribe(),this.getValue()}langChanged(t){this.setValue(this.getValue(t))}subscribe(){null==this.langChangedSubscription&&(this.langChangedSubscription=function(t,e){const i=e=>t(e.detail);return window.addEventListener(lt,i,e),()=>window.removeEventListener(lt,i)}(this.langChanged.bind(this)))}unsubscribe(){null!=this.langChangedSubscription&&this.langChangedSubscription()}disconnected(){this.unsubscribe()}reconnected(){this.subscribe()}}const St=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends At{render(t,e,i){return this.renderValue((()=>function(t,e,i=ut){let o=i.translationCache[t]||(i.translationCache[t]=i.lookup(t,i)||i.empty(t,i));return null!=(e=null!=e?ht(e):null)?i.interpolate(o,e,i):o}(t,e,i)))}});
60
60
  /**
61
61
  * @license
62
62
  * Copyright 2017 Google LLC
63
63
  * SPDX-License-Identifier: BSD-3-Clause
64
- */class xt extends gt{constructor(t){if(super(t),this.it=D,t.type!==mt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this._t=void 0,this.it=t;if(t===H)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}xt.directiveName="unsafeHTML",xt.resultType=1;const Et="__registered_effects";function Lt(t){const e=t;if(e[Et])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[Et]={index:0,count:0,effects:[]},i.updated=t=>(e[Et].index=0,o(t)),e}function Pt(t,e,i){const o=function(t,e){const i=Lt(t),{index:o,count:r}=i[Et];return o===r?(i[Et].index++,i[Et].count++,i[Et].effects.push(e),e):(i[Et].index++,i[Et].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
64
+ */class xt extends mt{constructor(t){if(super(t),this.it=D,t.type!==vt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this._t=void 0,this.it=t;if(t===H)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}xt.directiveName="unsafeHTML",xt.resultType=1;const Et="__registered_effects";function Pt(t){const e=t;if(e[Et])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[Et]={index:0,count:0,effects:[]},i.updated=t=>(e[Et].index=0,o(t)),e}function Lt(t,e,i){const o=function(t,e){const i=Pt(t),{index:o,count:r}=i[Et];return o===r?(i[Et].index++,i[Et].count++,i[Et].effects.push(e),e):(i[Et].index++,i[Et].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
65
65
  /**
66
66
  * @license
67
67
  * Copyright 2021 Google LLC
@@ -433,7 +433,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
433
433
  />
434
434
  </g>
435
435
  </svg>
436
- `,Rt=W`
436
+ `,It=W`
437
437
  <svg
438
438
  version="1.0"
439
439
  viewBox="0 0 500.000000 500.000000"
@@ -458,7 +458,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
458
458
  />
459
459
  </g>
460
460
  </svg>
461
- `,jt=W`
461
+ `,Rt=W`
462
462
  <svg
463
463
  xmlns="http://www.w3.org/2000/svg"
464
464
  version="1.0"
@@ -484,7 +484,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
484
484
  />
485
485
  </g>
486
486
  </svg>
487
- `;var qt=Object.defineProperty,It=Object.getOwnPropertyDescriptor,Wt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?It(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&qt(e,i,s),s};let Ht=class extends at{constructor(){super(...arguments),this.active=!1}handleClosePopup(){const t=new Event("close");this.dispatchEvent(t)}render(){return W`
487
+ `;var jt=Object.defineProperty,qt=Object.getOwnPropertyDescriptor,Wt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?qt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&jt(e,i,s),s};let Ht=class extends at{constructor(){super(...arguments),this.active=!1}handleClosePopup(){const t=new Event("close");this.dispatchEvent(t)}render(){return W`
488
488
  <div class=${`shipaid-popup ${this.active&&"active"}`}>
489
489
  <div class="blocker" @click=${this.handleClosePopup}></div>
490
490
  <button
@@ -505,11 +505,11 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
505
505
  <p>${St("learn-more-popup.disclaimer.subtitle-monitor")}</p>
506
506
  </div>
507
507
  <div class="popup-disclaimer-subtitle">
508
- <div class="popup-icon-b">${jt}</div>
508
+ <div class="popup-icon-b">${Rt}</div>
509
509
  <p>${St("learn-more-popup.disclaimer.subtitle-notify")}</p>
510
510
  </div>
511
511
  <div class="popup-disclaimer-subtitle">
512
- <div class="popup-icon-bell">${Rt}</div>
512
+ <div class="popup-icon-bell">${It}</div>
513
513
  <p>
514
514
  ${St("learn-more-popup.disclaimer.subtitle-resolution")}
515
515
  </p>
@@ -697,7 +697,7 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
697
697
  .shipaid-prompt .prompt-footer .prompt-footer-badge svg {
698
698
  height: 9px;
699
699
  }
700
- `;var Kt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(Kt||{}),Qt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,te=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?Xt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&Qt(e,i,s),s};const ee=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},ie=t=>console.warn(`[ShipAid] ${t}`),oe=t=>console.error(`[ShipAid] ${t}`),re="shipaid-protection",se=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>Gt)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>ue)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>be)).then((t=>t.default))});var ne;ne={loader:async t=>{if("en"===t)return Yt;const e=Reflect.get(se,`./lang/${t}.json`);return e?await e():Yt}},ut=Object.assign(Object.assign({},ut),ne),t.ShipAidWidget=class extends at{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.lang="en",this.currency=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ee(t),post:(t,e)=>ee(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(ie("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(e=this._store)?void 0:e.currency)||(null==(o=null==(i=window.Shopify)?void 0:i.currency)?void 0:o.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(Kt.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(n){throw console.error(n),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw oe(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw oe(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._setState("success")}catch(i){oe(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._cart=e,this._setState("success")}catch(t){oe(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}learnMorePopupTemplate(){return W`
700
+ `;var Kt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(Kt||{}),Qt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,te=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?Xt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&Qt(e,i,s),s};const ee=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},ie=t=>console.warn(`[ShipAid] ${t}`),oe=t=>console.error(`[ShipAid] ${t}`),re="shipaid-protection",se=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>Gt)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>ue)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>be)).then((t=>t.default))});var ne;ne={loader:async t=>{if("en"===t)return Yt;const e=Reflect.get(se,`./lang/${t}.json`);return e?await e():Yt}},ut=Object.assign(Object.assign({},ut),ne),t.ShipAidWidget=class extends at{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.lang="en",this.currency=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this.intervalId=0,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ee(t),post:(t,e)=>ee(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(ie("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(e=this._store)?void 0:e.currency)||(null==(o=null==(i=window.Shopify)?void 0:i.currency)?void 0:o.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(Kt.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetPollProtection\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(n){throw console.error(n),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw oe(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw oe(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._setState("success")}catch(i){oe(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._cart=e,this._setState("success")}catch(t){oe(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async attemptAddProtection(){var t,e,i,o,r,s;if(!(null==(t=this._store)?void 0:t.widgetAutoOptIn))return;if(!(null==(e=this._cart)?void 0:e.items)||!(null==(i=this._cart)?void 0:i.item_count))return;const n=null==(o=this._cart.items)?void 0:o.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),a=null==(r=this._cart)?void 0:r.items[n];if(this._hasProtectionInCart=!!a,1===this._cart.item_count&&a)return;!!sessionStorage.getItem(re)||(sessionStorage.setItem(re,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(s=this._cart)?void 0:s.item_count)&&this._store.widgetShowCart&&await this.addProtection())}learnMorePopupTemplate(){return W`
701
701
  <shipaid-popup-learn-more
702
702
  ?active=${"learn-more"===this._popup}
703
703
  @close=${()=>{this._popup=null}}
@@ -748,10 +748,10 @@ function zt(t,e,i){return t?e():null==i?void 0:i()}const Mt=h`
748
748
  </a>
749
749
  </div>
750
750
  </div>
751
- `}async connectedCallback(){super.connectedCallback(),await async function(t,e=ut){const i=await e.loader(t,e);e.translationCache={},ft(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return Pt(this,(async()=>{var t,e;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(o){return oe(o.message),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(Kt.LOADED,this._store),setTimeout((async()=>{var t,e,i;(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&(null==(e=this._cart)?void 0:e.item_count)&&(sessionStorage.getItem(re)||(sessionStorage.setItem(re,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(i=this._cart)?void 0:i.item_count)&&this._store.widgetShowCart&&await this.addProtection()))}),500),void(this.disablePolling||setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval))):(ie("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),Pt(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,!(null==n?void 0:n.id))return this._shouldShowWidget=!1,void oe("No matching protection variant found.");if(!r)return;if(n.id===r.variant_id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a={updates:{[r.variant_id]:0,[n.id]:1}},d=await this._fetch.post("/cart/update.js",a);await this._handleRefresh(d)}),[this._store,this._cart]),rt(this.learnMorePopupTemplate(),document.body),W`
751
+ `}async connectedCallback(){super.connectedCallback(),await async function(t,e=ut){const i=await e.loader(t,e);e.translationCache={},ft(t,i,e)}(this.lang),this.hasLoadedStrings=!0}render(){return Lt(this,(async()=>{var t,e,i;const o=document.createElement("link");o.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),o.setAttribute("rel","stylesheet"),document.head.appendChild(o);try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(r){return oe(r.message),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(Kt.LOADED,this._store),setTimeout((async()=>{var t,e,i;(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&(null==(e=this._cart)?void 0:e.item_count)&&(sessionStorage.getItem(re)||(sessionStorage.setItem(re,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(i=this._cart)?void 0:i.item_count)&&this._store.widgetShowCart&&await this.addProtection()))}),500),void(this.disablePolling||(setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval),(null==(i=this._store)?void 0:i.widgetPollProtection)&&!this.intervalId&&(this.intervalId=setInterval((async()=>{await this.attemptAddProtection()}),500),localStorage.setItem(`polling-shipaid-protection_${this.intervalId}`,`${this.intervalId}`))))):(ie("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(ie("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),Lt(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return sessionStorage.removeItem(re),await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,!(null==n?void 0:n.id))return this._shouldShowWidget=!1,void oe("No matching protection variant found.");if(!r)return;if(n.id===r.variant_id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a={updates:{[r.variant_id]:0,[n.id]:1}},d=await this._fetch.post("/cart/update.js",a);await this._handleRefresh(d)}),[this._store,this._cart]),rt(this.learnMorePopupTemplate(),document.body),W`
752
752
  <div class="shipaid">
753
753
  ${zt(this._hasFinishedSetup,(()=>{var t;return zt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>this.promptTemplate()),(()=>D))}),(()=>W`<p>
754
754
  <slot name="loading" default>${St("loading")}</slot>
755
755
  </p>`))}
756
756
  </div>
757
- `}},t.ShipAidWidget.styles=Jt,te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),te([r({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),te([s()],t.ShipAidWidget.prototype,"_storeDomain",2),te([s()],t.ShipAidWidget.prototype,"_store",2),te([s()],t.ShipAidWidget.prototype,"_cart",2),te([s()],t.ShipAidWidget.prototype,"_protectionProduct",2),te([s()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),te([s()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),te([s()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),te([s()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),te([s()],t.ShipAidWidget.prototype,"_protectionCartItem",2),te([s()],t.ShipAidWidget.prototype,"_protectionVariant",2),te([s()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),te([s()],t.ShipAidWidget.prototype,"_state",2),te([s()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=te([i("shipaid-widget")],t.ShipAidWidget);const ae="Caricamento del widget ShipAid...",de="Garanzia di consegna",pe="in caso di Perdita, Danno o Furto",le={button:"Offerto da"},ce={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},he={loading:ae,title:de,description:pe,footer:le,actions:ce,"learn-more-popup":{close:"Vicina",title:"Garanzia di consegna",subtitle:"Consentiamo ai tuoi marchi preferiti di offrire una garanzia di consegna perché ogni ordine è prezioso!",disclaimer:{"subtitle-enable":"Consentiamo ai tuoi marchi preferiti di fornire una garanzia di consegna perché sappiamo che ogni ordine è prezioso e le cose accadono!","subtitle-monitor":"Monitoriamo continuamente il tuo pacco e ti offriamo un comodo portale per monitorare lo stato di avanzamento del tuo ordine in qualsiasi momento!","subtitle-notify":"Riceverai una notifica durante l'intero processo di spedizione, assicurandoti di rimanere aggiornato in ogni fase del processo.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Acquistando questa garanzia di consegna, accetti i nostri Termini di servizio e l'Informativa sulla privacy. Non sei obbligato ad acquistare questa garanzia. Questa garanzia NON è un'assicurazione e non fornisce un indennizzo contro perdite, danni o responsabilità derivanti da un evento contingente o sconosciuto, ma piuttosto, attraverso ShipAid i marchi forniscono una garanzia di consegna in base alla quale se il prodotto ordinato non viene consegnato in condizioni soddisfacenti, il marchio da cui hai ordinato il prodotto può sostituire il prodotto gratuitamente. ShipAid non fornisce alcun prodotto o servizio direttamente ai consumatori, ma fornisce invece un servizio che consente ai marchi di facilitare la sostituzione del prodotto ai propri clienti. L'acquisto di questa garanzia non significa che verrai automaticamente rimborsato per qualsiasi prodotto o costo di spedizione perché il processo di risoluzione e la decisione per il risarcimento sono rigorosamente decisi dal marchio da cui stai acquistando. Il marchio richiederà la prova del danno o del prodotto non consegnato."},links:{terms:"Termini di servizio",privacy:"Politica sulla riservatezza"}}},ue=Object.freeze(Object.defineProperty({__proto__:null,actions:ce,default:he,description:pe,footer:le,loading:ae,title:de},Symbol.toStringTag,{value:"Module"})),fe="Carregando o widget ShipAid...",me="Garantia de entrega",ge="em caso de Perda, Danos ou Roubo",ve={button:"Distribuído por"},_e={add:"Adicionar",remove:"Remover",loading:"Carregando..."},ye={loading:fe,title:me,description:ge,footer:ve,actions:_e,"learn-more-popup":{close:"Fechar",title:"Garantia de entrega",subtitle:"Capacitamos suas marcas favoritas para oferecer uma garantia de entrega porque cada pedido é precioso!",disclaimer:{"subtitle-enable":"Permitimos que suas marcas favoritas forneçam uma garantia de entrega porque sabemos que cada pedido é precioso e as coisas acontecem!","subtitle-monitor":"Monitoramos continuamente o seu pacote e oferecemos um portal conveniente para você acompanhar o andamento do seu pedido a qualquer momento!","subtitle-notify":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Ao adquirir esta garantia de entrega, você concorda com nossos Termos de Serviço e Política de Privacidade. Esta garantia não é obrigatória, NÃO é um seguro e não fornece indenização contra perdas, danos ou responsabilidade decorrentes de um contingente ou desconhecido. Caso o produto não seja entregue em condições satisfatórias, a marca da qual você comprou pode substituí-lo gratuitamente. A ShipAid não fornece nenhum produto ou serviço diretamente aos consumidores, mas sim presta um serviço que permite às marcas facilitar a substituição do produto aos seus clientes. Adquirir esta garantia não significa que você será automaticamente reembolsado por qualquer produto ou custos de envio porque o processo de resolução e decisão de compensação é estritamente decidido pela marca que você está comprando. A marca exigirá prova de danos ou produto não entregue."},links:{terms:"Termos de serviço",privacy:"Política de Privacidade"}}},be=Object.freeze(Object.defineProperty({__proto__:null,actions:_e,default:ye,description:ge,footer:ve,loading:fe,title:me},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
757
+ `}},t.ShipAidWidget.styles=Jt,te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableActions",2),te([r({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),te([r({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"lang",2),te([r({type:String,attribute:!0})],t.ShipAidWidget.prototype,"currency",2),te([s()],t.ShipAidWidget.prototype,"_storeDomain",2),te([s()],t.ShipAidWidget.prototype,"_store",2),te([s()],t.ShipAidWidget.prototype,"_cart",2),te([s()],t.ShipAidWidget.prototype,"_protectionProduct",2),te([s()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),te([s()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),te([s()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),te([s()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),te([s()],t.ShipAidWidget.prototype,"_protectionCartItem",2),te([s()],t.ShipAidWidget.prototype,"_protectionVariant",2),te([s()],t.ShipAidWidget.prototype,"hasLoadedStrings",2),te([s()],t.ShipAidWidget.prototype,"intervalId",2),te([s()],t.ShipAidWidget.prototype,"_state",2),te([s()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=te([i("shipaid-widget")],t.ShipAidWidget);const ae="Caricamento del widget ShipAid...",de="Garanzia di consegna",le="in caso di Perdita, Danno o Furto",pe={button:"Offerto da"},ce={add:"Aggiungere",remove:"Rimuovere",loading:"Caricamento ..."},he={loading:ae,title:de,description:le,footer:pe,actions:ce,"learn-more-popup":{close:"Vicina",title:"Garanzia di consegna",subtitle:"Consentiamo ai tuoi marchi preferiti di offrire una garanzia di consegna perché ogni ordine è prezioso!",disclaimer:{"subtitle-enable":"Consentiamo ai tuoi marchi preferiti di fornire una garanzia di consegna perché sappiamo che ogni ordine è prezioso e le cose accadono!","subtitle-monitor":"Monitoriamo continuamente il tuo pacco e ti offriamo un comodo portale per monitorare lo stato di avanzamento del tuo ordine in qualsiasi momento!","subtitle-notify":"Riceverai una notifica durante l'intero processo di spedizione, assicurandoti di rimanere aggiornato in ogni fase del processo.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Acquistando questa garanzia di consegna, accetti i nostri Termini di servizio e l'Informativa sulla privacy. Non sei obbligato ad acquistare questa garanzia. Questa garanzia NON è un'assicurazione e non fornisce un indennizzo contro perdite, danni o responsabilità derivanti da un evento contingente o sconosciuto, ma piuttosto, attraverso ShipAid i marchi forniscono una garanzia di consegna in base alla quale se il prodotto ordinato non viene consegnato in condizioni soddisfacenti, il marchio da cui hai ordinato il prodotto può sostituire il prodotto gratuitamente. ShipAid non fornisce alcun prodotto o servizio direttamente ai consumatori, ma fornisce invece un servizio che consente ai marchi di facilitare la sostituzione del prodotto ai propri clienti. L'acquisto di questa garanzia non significa che verrai automaticamente rimborsato per qualsiasi prodotto o costo di spedizione perché il processo di risoluzione e la decisione per il risarcimento sono rigorosamente decisi dal marchio da cui stai acquistando. Il marchio richiederà la prova del danno o del prodotto non consegnato."},links:{terms:"Termini di servizio",privacy:"Politica sulla riservatezza"}}},ue=Object.freeze(Object.defineProperty({__proto__:null,actions:ce,default:he,description:le,footer:pe,loading:ae,title:de},Symbol.toStringTag,{value:"Module"})),fe="Carregando o widget ShipAid...",ve="Garantia de entrega",me="em caso de Perda, Danos ou Roubo",ge={button:"Distribuído por"},_e={add:"Adicionar",remove:"Remover",loading:"Carregando..."},ye={loading:fe,title:ve,description:me,footer:ge,actions:_e,"learn-more-popup":{close:"Fechar",title:"Garantia de entrega",subtitle:"Capacitamos suas marcas favoritas para oferecer uma garantia de entrega porque cada pedido é precioso!",disclaimer:{"subtitle-enable":"Permitimos que suas marcas favoritas forneçam uma garantia de entrega porque sabemos que cada pedido é precioso e as coisas acontecem!","subtitle-monitor":"Monitoramos continuamente o seu pacote e oferecemos um portal conveniente para você acompanhar o andamento do seu pedido a qualquer momento!","subtitle-notify":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.","subtitle-resolution":"Você será notificado durante todo o processo de envio, garantindo que você fique atualizado a cada passo do caminho.",text:"Ao adquirir esta garantia de entrega, você concorda com nossos Termos de Serviço e Política de Privacidade. Esta garantia não é obrigatória, NÃO é um seguro e não fornece indenização contra perdas, danos ou responsabilidade decorrentes de um contingente ou desconhecido. Caso o produto não seja entregue em condições satisfatórias, a marca da qual você comprou pode substituí-lo gratuitamente. A ShipAid não fornece nenhum produto ou serviço diretamente aos consumidores, mas sim presta um serviço que permite às marcas facilitar a substituição do produto aos seus clientes. Adquirir esta garantia não significa que você será automaticamente reembolsado por qualquer produto ou custos de envio porque o processo de resolução e decisão de compensação é estritamente decidido pela marca que você está comprando. A marca exigirá prova de danos ou produto não entregue."},links:{terms:"Termos de serviço",privacy:"Política de Privacidade"}}},be=Object.freeze(Object.defineProperty({__proto__:null,actions:_e,default:ye,description:me,footer:ge,loading:fe,title:ve},Symbol.toStringTag,{value:"Module"}));Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
@@ -42,6 +42,7 @@ export interface ShipAidStore {
42
42
  store: string;
43
43
  currency: string;
44
44
  widgetAutoOptIn?: boolean;
45
+ widgetPollProtection?: boolean;
45
46
  widgetShowCart?: boolean;
46
47
  excludedProductSkus?: string[];
47
48
  planActive: boolean;
@@ -0,0 +1,3 @@
1
+ export declare const CheckmarkIcon: import('lit').TemplateResult<1>
2
+ export declare const ShipAidLogo: import('lit').TemplateResult<1>
3
+ export declare const ShipAidLogoText: import('lit').TemplateResult<1>
@@ -0,0 +1,2 @@
1
+ declare const styles: import('lit').CSSResult
2
+ export default styles
@@ -0,0 +1,2 @@
1
+ declare const _default: import('lit').CSSResult
2
+ export default _default
@@ -0,0 +1,8 @@
1
+ import { LitElement } from 'lit'
2
+ declare class LearnMorePopup extends LitElement {
3
+ static styles: import('lit').CSSResult
4
+ active: boolean
5
+ handleClosePopup(): void
6
+ render(): import('lit').TemplateResult<1>
7
+ }
8
+ export default LearnMorePopup
@@ -0,0 +1,97 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import './components/learn-more-popup';
3
+ import type { ShopifyCart } from '../types/shopify';
4
+ /**
5
+ * ShipAid Widget.
6
+ *
7
+ * @description When the <shipaid-widget> element is added to page, it will render this element,
8
+ * allowing a customer to add ShipAid protection to cart (and remove).
9
+ *
10
+ */
11
+ export declare class ShipAidWidget extends LitElement {
12
+ static styles: import("lit").CSSResult;
13
+ disablePolling: boolean;
14
+ disableActions: boolean;
15
+ pollingInterval: number;
16
+ disableRefresh: boolean;
17
+ lang: string;
18
+ currency: undefined;
19
+ /** API Proxy pathname */
20
+ private _apiEndpoint;
21
+ /** The current store domain */
22
+ private _storeDomain;
23
+ /** The current store data object from the ShipAid API */
24
+ private _store;
25
+ /** The current cart data object from the Shopify API */
26
+ private _cart;
27
+ /** The current protection product data object from the Shopify API */
28
+ private _protectionProduct;
29
+ /** When the cart was last updated */
30
+ private _cartLastUpdated;
31
+ /** Whether we have finished the initial setup */
32
+ private _hasFinishedSetup;
33
+ /** Can be used to hide all widget content */
34
+ private _shouldShowWidget;
35
+ /** Whether the ShipAid protection product is currently added to the cart */
36
+ private _hasProtectionInCart;
37
+ /** The protection item from the Shopify cart */
38
+ private _protectionCartItem;
39
+ /** The protection variant that will be used */
40
+ private _protectionVariant;
41
+ hasLoadedStrings: boolean;
42
+ protected shouldUpdate(props: PropertyValues): boolean;
43
+ /**
44
+ * Internal state
45
+ */
46
+ private _state;
47
+ /**
48
+ * Internal popup state
49
+ */
50
+ private _popup;
51
+ /** Getter to check if we should refresh the page or not */
52
+ get shouldRefreshOnUpdate(): boolean;
53
+ /** Getter to check whether to show the widget or not */
54
+ get planActive(): boolean;
55
+ private _currencyFormat;
56
+ /** Emit events */
57
+ private _dispatchEvent;
58
+ /** Handle cart or page refreshes */
59
+ private _handleRefresh;
60
+ /** Given the current order, it calculates the protection total according to the store protection settings. */
61
+ calculateProtectionTotal(cart?: ShopifyCart): Promise<number>;
62
+ /**
63
+ * Given the current order, it finds the relevant protection product variant, and adds it to cart.
64
+ * This should be run whenever the cart updates, or it is manually triggered.
65
+ */
66
+ private _findProtectionVariant;
67
+ /** Update State */
68
+ private _setState;
69
+ /** Updates the current protection status, calling the relevant add/remove function. */
70
+ private _updateProtection;
71
+ /** General fetch function, which handles error responses, and returns JSON responses. */
72
+ private _fetch;
73
+ /** Fetches store info from the ShipAid public API. */
74
+ private _fetchShipAidData;
75
+ /** Fetch current cart from the Shopify ajax API */
76
+ private _fetchCart;
77
+ /** Fetch current product from the Shopify ajax API */
78
+ private _fetchProduct;
79
+ /** Whether the cart currently contains Shipping protection from ShipAid. */
80
+ hasProtection(): boolean;
81
+ /** Update the internal cart, which will trigger any protection fee updates */
82
+ updateCart(cart?: ShopifyCart): Promise<void>;
83
+ /** Add ShipAid shipping protection. */
84
+ addProtection(): Promise<void>;
85
+ /** Remove ShipAid shipping protection. */
86
+ removeProtection(): Promise<void>;
87
+ /** Templates */
88
+ learnMorePopupTemplate(): import("lit").TemplateResult<1>;
89
+ promptTemplate(): import("lit").TemplateResult<1>;
90
+ connectedCallback(): Promise<void>;
91
+ protected render(): import("lit").TemplateResult<1>;
92
+ }
93
+ declare global {
94
+ interface HTMLElementTagNameMap {
95
+ 'shipaid-widget': ShipAidWidget;
96
+ }
97
+ }
@@ -0,0 +1,57 @@
1
+ export interface ProtectionSettingsProductVariant {
2
+ id?: string;
3
+ sku?: string;
4
+ price?: string;
5
+ title?: string;
6
+ selectedOptions?: {
7
+ name?: string;
8
+ value?: string;
9
+ }[];
10
+ }
11
+ export interface ProtectionSettingsProduct {
12
+ id?: string;
13
+ title?: string;
14
+ options?: {
15
+ name: string;
16
+ value: string;
17
+ }[];
18
+ variants?: {
19
+ edges?: {
20
+ node?: ProtectionSettingsProductVariant;
21
+ }[];
22
+ };
23
+ }
24
+ export interface ProtectionSettings {
25
+ product?: ProtectionSettingsProduct;
26
+ }
27
+ export interface ProtectionSettingsPercentage {
28
+ protectionType: 'PERCENTAGE';
29
+ percentage: number;
30
+ minimumFee: number;
31
+ }
32
+ export interface ProtectionSettingsFixed {
33
+ protectionType: 'FIXED';
34
+ defaultFee?: number;
35
+ rules?: {
36
+ fee?: number;
37
+ rangeLower?: number;
38
+ rangeUpper?: number;
39
+ }[];
40
+ }
41
+ export interface ShipAidStore {
42
+ store: string;
43
+ currency: string;
44
+ widgetAutoOptIn?: boolean;
45
+ widgetShowCart?: boolean;
46
+ excludedProductSkus?: string[];
47
+ planActive: boolean;
48
+ protectionSettings: ProtectionSettingsFixed | ProtectionSettingsPercentage;
49
+ }
50
+ export interface ShipAidStoreQuery {
51
+ data: null | {
52
+ store: ShipAidStore;
53
+ };
54
+ errors?: {
55
+ message: string;
56
+ }[];
57
+ }
@@ -0,0 +1,151 @@
1
+ declare global {
2
+ interface Window {
3
+ Shopify?: {
4
+ shop?: string;
5
+ locale?: string;
6
+ designMode?: boolean;
7
+ currency?: {
8
+ active?: string;
9
+ };
10
+ Checkout?: Record<string, string> & {
11
+ apiHost?: string;
12
+ };
13
+ };
14
+ }
15
+ }
16
+ export interface ShopifyCart {
17
+ token: string;
18
+ note?: null;
19
+ original_total_price: number;
20
+ total_price: number;
21
+ total_discount: number;
22
+ total_weight: number;
23
+ item_count: number;
24
+ items?: ShopifyCartItem[];
25
+ requires_shipping: boolean;
26
+ currency: string;
27
+ items_subtotal_price: number;
28
+ cart_level_discount_applications?: (null)[] | null;
29
+ sections?: Record<string, string>;
30
+ }
31
+ export interface ShopifyCartItem {
32
+ id: number;
33
+ index: number;
34
+ position: number;
35
+ properties?: null;
36
+ quantity: number;
37
+ variant_id: number;
38
+ key: string;
39
+ title: string;
40
+ price: number;
41
+ original_price: number;
42
+ discounted_price: number;
43
+ line_price: number;
44
+ original_line_price: number;
45
+ total_discount: number;
46
+ discounts?: (null)[] | null;
47
+ sku: string;
48
+ grams: number;
49
+ vendor: string;
50
+ taxable: boolean;
51
+ product_id: number;
52
+ product_has_only_default_variant: boolean;
53
+ gift_card: boolean;
54
+ final_price: number;
55
+ final_line_price: number;
56
+ url: string;
57
+ featured_image: FeaturedImage;
58
+ image: string;
59
+ handle: string;
60
+ requires_shipping: boolean;
61
+ product_type: string;
62
+ product_title: string;
63
+ product_description: string;
64
+ variant_title?: null;
65
+ variant_options?: (string)[] | null;
66
+ options_with_values?: (OptionsWithValuesEntity)[] | null;
67
+ line_level_discount_allocations?: (null)[] | null;
68
+ line_level_total_discount: number;
69
+ sections?: Record<string, string>;
70
+ }
71
+ export interface FeaturedImage {
72
+ aspect_ratio: number;
73
+ alt: string;
74
+ height: number;
75
+ url: string;
76
+ width: number;
77
+ }
78
+ export interface OptionsWithValuesEntity {
79
+ name: string;
80
+ value: string;
81
+ }
82
+ export interface ShopifyCartAddPayload {
83
+ id: number | string;
84
+ quantity?: number;
85
+ }
86
+ export interface ShopifyCartUpdatePayload {
87
+ updates: Record<string | number, number>;
88
+ }
89
+ export interface ShopifyProductResponse {
90
+ product: ShopifyProduct;
91
+ }
92
+ export interface ShopifyProduct {
93
+ id: number;
94
+ title: string;
95
+ body_html: string;
96
+ vendor: string;
97
+ product_type: string;
98
+ created_at: string;
99
+ handle: string;
100
+ updated_at: string;
101
+ published_at: string;
102
+ template_suffix: string;
103
+ published_scope: string;
104
+ tags: string;
105
+ variants?: ShopifyProductVariant[];
106
+ options?: (OptionsEntity)[] | null;
107
+ images?: (ImagesEntityOrImage)[] | null;
108
+ image: ImagesEntityOrImage;
109
+ }
110
+ export interface ShopifyProductVariant {
111
+ id: number;
112
+ product_id: number;
113
+ title: string;
114
+ price: string;
115
+ sku: string;
116
+ position: number;
117
+ compare_at_price: string;
118
+ fulfillment_service: string;
119
+ inventory_management?: null;
120
+ option1: string;
121
+ option2?: null;
122
+ option3?: null;
123
+ created_at: string;
124
+ updated_at: string;
125
+ taxable: boolean;
126
+ barcode?: null;
127
+ grams: number;
128
+ image_id?: null;
129
+ weight: number;
130
+ weight_unit: string;
131
+ requires_shipping: boolean;
132
+ }
133
+ export interface OptionsEntity {
134
+ id: number;
135
+ product_id: number;
136
+ name: string;
137
+ position: number;
138
+ values?: (string)[] | null;
139
+ }
140
+ export interface ImagesEntityOrImage {
141
+ id: number;
142
+ product_id: number;
143
+ position: number;
144
+ created_at: string;
145
+ updated_at: string;
146
+ alt?: null;
147
+ width: number;
148
+ height: number;
149
+ src: string;
150
+ variant_ids?: (null)[] | null;
151
+ }
@@ -0,0 +1,13 @@
1
+ export declare enum Events {
2
+ LOADED = 'shipaid-loaded',
3
+ STATUS_UPDATE = 'shipaid-protection-status'
4
+ }
5
+ export interface State {
6
+ loading: boolean;
7
+ success: boolean | null;
8
+ error: boolean | string | null;
9
+ }
10
+ export interface FetchHelper {
11
+ get: <Data>(url: string) => Promise<Data>;
12
+ post: <Data>(url: string, body: unknown) => Promise<Data>;
13
+ }
@@ -39,6 +39,7 @@ export declare class ShipAidWidget extends LitElement {
39
39
  /** The protection variant that will be used */
40
40
  private _protectionVariant;
41
41
  hasLoadedStrings: boolean;
42
+ intervalId: number;
42
43
  protected shouldUpdate(props: PropertyValues): boolean;
43
44
  /**
44
45
  * Internal state
@@ -84,6 +85,8 @@ export declare class ShipAidWidget extends LitElement {
84
85
  addProtection(): Promise<void>;
85
86
  /** Remove ShipAid shipping protection. */
86
87
  removeProtection(): Promise<void>;
88
+ /** Try adding ShipAid shipping protection during polling if applicable */
89
+ attemptAddProtection(): Promise<void>;
87
90
  /** Templates */
88
91
  learnMorePopupTemplate(): import("lit").TemplateResult<1>;
89
92
  promptTemplate(): import("lit").TemplateResult<1>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui.shipaid.com",
3
3
  "private": false,
4
- "version": "0.3.5",
4
+ "version": "0.3.6",
5
5
  "type": "module",
6
6
  "main": "dist/widget.umd.js",
7
7
  "unpkg": "dist/widget.iife.js",