From cdc25269cce4e4bbc98337498a1812ac878361d5 Mon Sep 17 00:00:00 2001 From: Denis Vlassenko Date: Tue, 5 Dec 2023 17:12:19 +0100 Subject: [PATCH] MWPW-140041: Update merch block for release 3 (#1600) MWPW-140041: Update merch block for release 3 --- libs/blocks/commerce/commerce.js | 2 +- libs/blocks/merch-card/legacy-merch-card.css | 6 ++-- libs/blocks/merch/merch.css | 2 +- libs/blocks/merch/merch.js | 32 +++++++++++++++--- libs/deps/commerce.js | 6 ++-- libs/deps/merch-card.js | 2 +- test/blocks/merch/merch.test.js | 34 +++++++++++++------- test/blocks/merch/mocks/body.html | 5 +++ 8 files changed, 64 insertions(+), 25 deletions(-) diff --git a/libs/blocks/commerce/commerce.js b/libs/blocks/commerce/commerce.js index 12f233211b..3890f542b4 100644 --- a/libs/blocks/commerce/commerce.js +++ b/libs/blocks/commerce/commerce.js @@ -97,7 +97,7 @@ export async function handleOfferSearch(event, el) { const osi = searchParams.get('osi'); if (osi != null) { const service = await initService(); - const [promise] = await service.resolveOfferSelectors({ offerSelectorIds: [osi] }); + const [promise] = await service.resolveOfferSelectors({ wcsOsi: [osi] }); const [offer] = await promise; await decorateOfferDetails(el, offer, searchParams); } else { diff --git a/libs/blocks/merch-card/legacy-merch-card.css b/libs/blocks/merch-card/legacy-merch-card.css index 5b06912d3a..53271e27ea 100644 --- a/libs/blocks/merch-card/legacy-merch-card.css +++ b/libs/blocks/merch-card/legacy-merch-card.css @@ -154,9 +154,9 @@ font-size: var(--type-heading-xs-size); } -.merch-card .consonant-SegmentBlade-description span.placeholder-resolved[data-template="priceStrikethrough"], -.merch-card .consonant-SpecialOffers-description span.placeholder-resolved[data-template="priceStrikethrough"], -.merch-card .consonant-PlansCard-description span.placeholder-resolved[data-template="priceStrikethrough"] { +.merch-card .consonant-SegmentBlade-description span.placeholder-resolved[data-template="strikethrough"], +.merch-card .consonant-SpecialOffers-description span.placeholder-resolved[data-template="strikethrough"], +.merch-card .consonant-PlansCard-description span.placeholder-resolved[data-template="strikethrough"] { font-size: var(--type-body-xs-size); } diff --git a/libs/blocks/merch/merch.css b/libs/blocks/merch/merch.css index f2806fefeb..01c7c66256 100644 --- a/libs/blocks/merch/merch.css +++ b/libs/blocks/merch/merch.css @@ -7,7 +7,7 @@ span[data-wcs-osi] { display: inline-block; } -span.placeholder-resolved[data-template="priceStrikethrough"], span.price.price-strikethrough { +span.placeholder-resolved[data-template="strikethrough"], span.price.price-strikethrough { text-decoration: line-through; } diff --git a/libs/blocks/merch/merch.js b/libs/blocks/merch/merch.js index 94d73a0ccd..1f21cf4609 100644 --- a/libs/blocks/merch/merch.js +++ b/libs/blocks/merch/merch.js @@ -2,6 +2,11 @@ import { getConfig, loadScript } from '../../utils/utils.js'; export const priceLiteralsURL = 'https://milo.adobe.com/libs/commerce/price-literals.json'; +export const PRICE_TEMPLATE_DISCOUNT = 'discount'; +export const PRICE_TEMPLATE_OPTICAL = 'optical'; +export const PRICE_TEMPLATE_REGULAR = 'price'; +export const PRICE_TEMPLATE_STRIKETHROUGH = 'strikethrough'; + export function polyfills() { /* c8 ignore start */ if (!polyfills.promise) { @@ -24,6 +29,9 @@ export function polyfills() { /* c8 ignore stop */ } +/** + * Activates commerce service and returns a promise resolving to its ready-to-use instance. + */ export async function initService() { await polyfills(); const commerce = await import('../../deps/commerce.js'); @@ -38,7 +46,7 @@ export async function getCommerceContext(el, params) { if (!wcsOsi) return null; const perpetual = params.get('perp') === 'true' || undefined; const promotionCode = ( - params.get('promo') ?? el.closest('[data-promotion-code]')?.dataset.promotionCode + params.get('promo') ?? params.get('promotionCode') ?? el.closest('[data-promotion-code]')?.dataset.promotionCode ) || undefined; return { promotionCode, perpetual, wcsOsi }; } @@ -79,8 +87,24 @@ export async function getPriceContext(el, params) { const displayRecurrence = params.get('term'); const displayTax = params.get('tax'); const forceTaxExclusive = params.get('exclusive'); - const type = params.get('type'); - const template = type === 'price' ? undefined : type; + let template = PRICE_TEMPLATE_REGULAR; + // This mapping also supports legacy OST links + switch (params.get('type')) { + case PRICE_TEMPLATE_DISCOUNT: + case 'priceDiscount': + template = PRICE_TEMPLATE_DISCOUNT; + break; + case PRICE_TEMPLATE_OPTICAL: + case 'priceOptical': + template = PRICE_TEMPLATE_OPTICAL; + break; + case PRICE_TEMPLATE_STRIKETHROUGH: + case 'priceStrikethrough': + template = PRICE_TEMPLATE_STRIKETHROUGH; + break; + default: + break; + } return { ...context, displayOldPrice, @@ -120,7 +144,7 @@ export default async function init(el) { const isCta = searchParams.get('type') === 'checkoutUrl'; const merch = await (isCta ? buildCta : buildPrice)(el, searchParams); const service = await initService(); - const log = service.log.module('merch'); + const log = service.Log.module('merch'); if (merch) { log.debug('Rendering:', { options: { ...merch.dataset }, merch, el }); el.replaceWith(merch); diff --git a/libs/deps/commerce.js b/libs/deps/commerce.js index b3737e5c2a..01c8d5660c 100644 --- a/libs/deps/commerce.js +++ b/libs/deps/commerce.js @@ -1,5 +1,5 @@ -// Fri, 03 Nov 2023 14:14:19 GMT -var pe;(function(e){e.ServerError="ServerError",e.ClientError="ClientError",e.UnexpectedError="UnexpectedError"})(pe||(pe={}));var rr=(e,t,r)=>({type:(i=>i>=500?pe.ServerError:i<400?pe.UnexpectedError:pe.ClientError)(e),message:t,originatingRequest:r,status:e});var An=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},Ce;(function(e){e.AUTHORIZATION="Authorization",e.X_API_KEY="X-Api-Key"})(Ce||(Ce={}));var nt=class{constructor(t){this.fetchOptions=t}commonHeaders(){let t={};return this.fetchOptions.apiKey&&(t[Ce.X_API_KEY]=this.fetchOptions.apiKey),this.fetchOptions.accessToken&&(t[Ce.AUTHORIZATION]=`Bearer ${this.fetchOptions.accessToken}`),t}transformData(t,r){return r?t.map(n=>r(n)):t.map(n=>this.identifyTransform(n))}transformDatum(t,r){return r?r(t):this.identifyTransform(t)}identifyTransform(t){return t}failOnBadStatusOrParseBody(t,r){return An(this,void 0,void 0,function*(){if(t.ok)return t.json().then(i=>({headers:t.headers,status:t.status,statusText:t.statusText,data:i}));let n=yield t.text();return Promise.reject(rr(t.status,n,r))})}buildUrl(t,r,n,i,o){var s;let a=(s=this.fetchOptions.baseUrl)!==null&&s!==void 0?s:i(this.fetchOptions.env),c=o(r,n);return this.generateUrl(a,t,c)}generateUrl(t,r,n){let i=new URL(r,t);return n&&(i.search=this.convertToSearchParams(n).toString()),i.toString()}convertToSearchParams(t){return new URLSearchParams(t)}setParams(t,r,n){n!=null&&typeof n=="boolean"?t[r]=String(n):n&&(t[r]=n)}},it=nt;var k;(function(e){e.STAGE="STAGE",e.PRODUCTION="PRODUCTION",e.LOCAL="LOCAL"})(k||(k={}));var me;(function(e){e.STAGE="STAGE",e.PRODUCTION="PROD",e.LOCAL="LOCAL"})(me||(me={}));var Z;(function(e){e.DRAFT="DRAFT",e.PUBLISHED="PUBLISHED"})(Z||(Z={}));var J;(function(e){e.V2="UCv2",e.V3="UCv3"})(J||(J={}));var z;(function(e){e.CHECKOUT="checkout",e.CHECKOUT_EMAIL="checkout/email",e.SEGMENTATION="segmentation",e.BUNDLE="bundle",e.COMMITMENT="commitment",e.RECOMMENDATION="recommendation",e.EMAIL="email",e.PAYMENT="payment",e.CHANGE_PLAN_TEAM_PLANS="change-plan/team-upgrade/plans",e.CHANGE_PLAN_TEAM_PAYMENT="change-plan/team-upgrade/payment"})(z||(z={}));var ot=function(e){var t;return(t=wn.get(e))!==null&&t!==void 0?t:e},wn=new Map([["countrySpecific","cs"],["quantity","q"],["authCode","code"],["checkoutPromoCode","apc"],["rurl","rUrl"],["curl","cUrl"],["ctxrturl","ctxRtUrl"],["country","co"],["language","lang"],["clientId","cli"],["context","ctx"],["productArrangementCode","pa"],["offerType","ot"],["marketSegment","ms"]]);var nr=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ir=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function he(e,t,r){var n,i;try{for(var o=nr(Object.entries(e)),s=o.next();!s.done;s=o.next()){var a=ir(s.value,2),c=a[0],l=a[1];l!=null&&r.has(c)&&t.set(ot(c),l)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}function Ne(e){switch(e){case k.PRODUCTION:return"https://commerce.adobe.com";default:return"https://commerce-stg.adobe.com"}}function Ie(e,t){var r,n;for(var i in e){var o=e[i];try{for(var s=(r=void 0,nr(Object.entries(o))),a=s.next();!a.done;a=s.next()){var c=ir(a.value,2),l=c[0],u=c[1];if(u!=null){var p=ot(l);t.set("items["+i+"]["+p+"]",u)}}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}}var _n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function or(e){Nn(e);var t=e.env,r=e.items,n=e.workflowStep,i=_n(e,["env","items","workflowStep"]),o=new URL(Ne(t));return o.pathname=n+"/",Ie(r,o.searchParams),he(i,o.searchParams,On),o.toString()}var On=new Set(["clientId","country","language","context","cUrl","mv","nglwfdata","otac","promoid","rUrl","sdid","spint","trackingid","authCode","campaignid","appctxid"]),Cn=["env","workflowStep","clientId","country","items"];function Nn(e){var t,r;try{for(var n=Ln(Cn),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!0}var In=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Un="/store/";function st(e){Dn(e);var t=e.env,r=e.items,n=e.workflowStep,i=e.marketSegment,o=e.offerType,s=e.productArrangementCode,a=In(e,["env","items","workflowStep","marketSegment","offerType","productArrangementCode"]),c={marketSegment:i,offerType:o,productArrangementCode:s},l=new URL(Ne(t));return l.pathname=""+Un+n,n!==z.SEGMENTATION?Ie(r,l.searchParams):he(c,l.searchParams,sr),he(a,l.searchParams,sr),l.toString()}var sr=new Set(["clientId","country","language","context","landscape","ctxRtUrl","jit","productArrangementCode","marketSegment","offerType","checkoutPromoCode","svar","usid","rUrl","otac","nglwfdata","appctxid","promoid","sdid","trackingid","mv","ai","sc","csm","th","thm","lo","gsp","so.su","so.ca","so.va","so.tr","context.guid","af","rf"]),Mn=["env","workflowStep","clientId","country"];function Dn(e){var t,r;try{for(var n=Rn(Mn),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(e.workflowStep!==z.SEGMENTATION&&!e.items)throw new Error('Argument "checkoutData" is not valid, missing: items');return!0}function at(e,t){switch(e){case J.V2:return or(t);case J.V3:return st(t);default:return console.warn("Unsupported CheckoutType, will use UCv3 as default. Given type: "+e),st(t)}}var ct;(function(e){e.BASE="BASE",e.TRIAL="TRIAL",e.PROMOTION="PROMOTION"})(ct||(ct={}));var C;(function(e){e.MONTH="MONTH",e.YEAR="YEAR",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS",e.PERPETUAL="PERPETUAL"})(C||(C={}));var _;(function(e){e.ANNUAL="ANNUAL",e.MONTHLY="MONTHLY",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS"})(_||(_={}));var ut;(function(e){e.INDIVIDUAL="INDIVIDUAL",e.TEAM="TEAM",e.ENTERPRISE="ENTERPRISE"})(ut||(ut={}));var lt;(function(e){e.COM="COM",e.EDU="EDU",e.GOV="GOV"})(lt||(lt={}));var ft;(function(e){e.DIRECT="DIRECT",e.INDIRECT="INDIRECT"})(ft||(ft={}));var pt;(function(e){e.ENTERPRISE_PRODUCT="ENTERPRISE_PRODUCT",e.ETLA="ETLA",e.RETAIL="RETAIL",e.VIP="VIP",e.VIPMP="VIPMP",e.FREE="FREE"})(pt||(pt={}));var kn=Z.PUBLISHED,ar=e=>{switch(e){case k.PRODUCTION:return"https://wcs.adobe.io";case k.STAGE:return"https://wcs-stage.adobe.io";case k.LOCAL:return"http://localhost:3002";default:return"https://wcs-stage.adobe.io"}},cr=(e,t)=>{var r;return e.api_key=t.apiKey,e.landscape=(r=t.landscape)!==null&&r!==void 0?r:kn,e};var Gn=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},mt=class extends it{constructor(t){super(t),this.apiPaths={getWebCommerceArtifact:"web_commerce_artifact"},this.getWebCommerceArtifact=(r,n,i,o)=>Gn(this,void 0,void 0,function*(){let s=this.buildUrl(this.apiPaths.getWebCommerceArtifact,n,r,a=>ar(a),(a,c)=>this.evaluateGetWebCommerceArtifactParams(a,c));return this.fetchOptions.fetch(s,{signal:o,headers:Object.assign({},this.commonHeaders()),mode:"cors"}).then(a=>this.failOnBadStatusOrParseBody(a,`GET ${s}`)).then(a=>{let l=a.data;return{data:this.transformDatum(l,i)}})})}evaluateGetWebCommerceArtifactParams(t,r){let n={};return this.setParams(n,"offer_selector_ids",r.offerSelectorIds.join(",")),this.setParams(n,"country",r.country),this.setParams(n,"language",r.language),this.setParams(n,"currency",r.currency),this.setParams(n,"locale",r.locale),this.setParams(n,"promotion_code",r.promotionCode),cr(n,t)}},ur=mt;var Re=e=>new ur(e).getWebCommerceArtifact;var lr="tacocat.js";var oe=(e,t)=>String(e??"").toLowerCase()==String(t??"").toLowerCase(),fr=e=>`${e??""}`.replace(/[&<>'"]/g,t=>({"&":"&","<":"<",">":">","'":"'",'"':"""})[t]??t)??"";function L(e,t={},{metadata:r=!0,search:n=!0,storage:i=!0}={}){let o;if(n&&o==null){let s=new URLSearchParams(window.location.search),a=de(n)?n:e;o=s.get(a)}if(i&&o==null){let s=de(i)?i:e;o=window.sessionStorage.getItem(s)??window.localStorage.getItem(s)}if(r&&o==null){let s=Fn(de(r)?r:e);o=document.documentElement.querySelector(`meta[name="${s}"]`)?.content}return o??t[e]}var ht=()=>{};var pr=e=>typeof e=="boolean",Ue=e=>typeof e=="function",dt=e=>typeof e=="number",mr=e=>e!=null&&typeof e=="object";var de=e=>typeof e=="string";function I(e,t=r=>r==null||r===""){return e!=null&&Object.entries(e).forEach(([r,n])=>{t(n)&&delete e[r]}),e}function b(e,t){if(pr(e))return e;let r=String(e);return r==="1"||r==="true"?!0:r==="0"||r==="false"?!1:t}function B(e,t,r){let n=Object.values(t);return n.find(i=>oe(i,e))??r??n[0]}function Fn(e=""){return String(e).replace(/(\p{Lowercase_Letter})(\p{Uppercase_Letter})/gu,(t,r,n)=>`${r}-${n}`).replace(/\W+/gu,"-").toLowerCase()}function se(e,t=1){return dt(e)||(e=Number.parseInt(e,10)),!Number.isNaN(e)&&e>0&&Number.isFinite(e)?e:t}var Vn=Date.now(),gt=()=>`(+${Date.now()-Vn}ms)`,Me=new Set,Wn=b(L("tacocat.debug",{},{metadata:!1}),typeof process<"u"&&process.env?.DEBUG);function hr(e){let t=`[${lr}/${e}]`,r=(s,a,...c)=>s?!0:(i(a,...c),!1),n=Wn?(s,...a)=>{console.debug(`${t} ${s}`,...a,gt())}:()=>{},i=(s,...a)=>{let c=`${t} ${s}`;Me.forEach(([l])=>l(c,...a))};return{assert:r,debug:n,error:i,warn:(s,...a)=>{let c=`${t} ${s}`;Me.forEach(([,l])=>l(c,...a))}}}function jn(e,t){let r=[e,t];return Me.add(r),()=>{Me.delete(r)}}jn((e,...t)=>{console.error(e,...t,gt())},(e,...t)=>{console.warn(e,...t,gt())});var Hn="no promo",dr="promo-tag",Xn="yellow",Bn="neutral",$n=(e,t,r)=>{let n=o=>o||Hn,i=r?` (was "${n(t)}")`:"";return`${n(e)}${i}`},zn="cancel-context",xt=(e,t)=>{let r=e===zn,n=!r&&e?.length>0,i=(n||r)&&(t&&t!=e||!t&&!r),o=i&&n||!i&&!!t,s=o?e||t:void 0;return{effectivePromoCode:s,overridenPromoCode:e,className:o?dr:`${dr} no-promo`,text:$n(s,t,i),variant:o?Xn:Bn,isOverriden:i}};var Et=function(e,t){return Et=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Et(e,t)};function ge(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Et(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var x=function(){return x=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0}),r=[],n=0,i=t;n1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(Zn,function(a,c,l,u,p,f){if(c)t.minimumIntegerDigits=l.length;else{if(u&&p)throw new Error("We currently do not support maximum integer digits");if(f)throw new Error("We currently do not support exact integer digits")}return""});continue}if(Ar.test(i.stem)){t.minimumIntegerDigits=i.stem.length;continue}if(vr.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(vr,function(a,c,l,u,p,f){return l==="*"?t.minimumFractionDigits=c.length:u&&u[0]==="#"?t.maximumFractionDigits=u.length:p&&f?(t.minimumFractionDigits=p.length,t.maximumFractionDigits=p.length+f.length):(t.minimumFractionDigits=c.length,t.maximumFractionDigits=c.length),""}),i.options.length&&(t=x(x({},t),br(i.options[0])));continue}if(Sr.test(i.stem)){t=x(x({},t),br(i.stem));continue}var o=wr(i.stem);o&&(t=x(x({},t),o));var s=Jn(i.stem);s&&(t=x(x({},t),s))}return t}var bt,Qn=new RegExp("^"+vt.source+"*"),Kn=new RegExp(vt.source+"*$");function g(e,t){return{start:e,end:t}}var ei=!!String.prototype.startsWith,ti=!!String.fromCodePoint,ri=!!Object.fromEntries,ni=!!String.prototype.codePointAt,ii=!!String.prototype.trimStart,oi=!!String.prototype.trimEnd,si=!!Number.isSafeInteger,ai=si?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},Pt=!0;try{Lr=Ir("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),Pt=((bt=Lr.exec("a"))===null||bt===void 0?void 0:bt[0])==="a"}catch{Pt=!1}var Lr,Or=ei?function(t,r,n){return t.startsWith(r,n)}:function(t,r,n){return t.slice(n,n+r.length)===r},St=ti?String.fromCodePoint:function(){for(var t=[],r=0;ro;){if(s=t[o++],s>1114111)throw RangeError(s+" is not a valid code point");n+=s<65536?String.fromCharCode(s):String.fromCharCode(((s-=65536)>>10)+55296,s%1024+56320)}return n},Cr=ri?Object.fromEntries:function(t){for(var r={},n=0,i=t;n=n)){var i=t.charCodeAt(r),o;return i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?i:(i-55296<<10)+(o-56320)+65536}},ci=ii?function(t){return t.trimStart()}:function(t){return t.replace(Qn,"")},ui=oi?function(t){return t.trimEnd()}:function(t){return t.replace(Kn,"")};function Ir(e,t){return new RegExp(e,t)}var At;Pt?(Tt=Ir("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),At=function(t,r){var n;Tt.lastIndex=r;var i=Tt.exec(t);return(n=i[1])!==null&&n!==void 0?n:""}):At=function(t,r){for(var n=[];;){var i=Nr(t,r);if(i===void 0||Ur(i)||pi(i))break;n.push(i),r+=i>=65536?2:1}return St.apply(void 0,n)};var Tt,Rr=function(){function e(t,r){r===void 0&&(r={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!r.ignoreTag,this.requiresOtherClause=!!r.requiresOtherClause,this.shouldParseSkeletons=!!r.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,r,n){for(var i=[];!this.isEOF();){var o=this.char();if(o===123){var s=this.parseArgument(t,n);if(s.err)return s;i.push(s.val)}else{if(o===125&&t>0)break;if(o===35&&(r==="plural"||r==="selectordinal")){var a=this.clonePosition();this.bump(),i.push({type:T.pound,location:g(a,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(d.UNMATCHED_CLOSING_TAG,g(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&wt(this.peek()||0)){var s=this.parseTag(t,r);if(s.err)return s;i.push(s.val)}else{var s=this.parseLiteral(t,r);if(s.err)return s;i.push(s.val)}}}return{val:i,err:null}},e.prototype.parseTag=function(t,r){var n=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:T.literal,value:"<"+i+"/>",location:g(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(t+1,r,!0);if(o.err)return o;var s=o.val,a=this.clonePosition();if(this.bumpIf("")?{val:{type:T.tag,value:i,children:s,location:g(n,this.clonePosition())},err:null}:this.error(d.INVALID_TAG,g(a,this.clonePosition())))}else return this.error(d.UNCLOSED_TAG,g(n,this.clonePosition()))}else return this.error(d.INVALID_TAG,g(n,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&fi(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,r){for(var n=this.clonePosition(),i="";;){var o=this.tryParseQuote(r);if(o){i+=o;continue}var s=this.tryParseUnquoted(t,r);if(s){i+=s;continue}var a=this.tryParseLeftAngleBracket();if(a){i+=a;continue}break}var c=g(n,this.clonePosition());return{val:{type:T.literal,value:i,location:c},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!li(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var r=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(n===39)if(this.peek()===39)r.push(39),this.bump();else{this.bump();break}else r.push(n);this.bump()}return St.apply(void 0,r)},e.prototype.tryParseUnquoted=function(t,r){if(this.isEOF())return null;var n=this.char();return n===60||n===123||n===35&&(r==="plural"||r==="selectordinal")||n===125&&t>0?null:(this.bump(),St(n))},e.prototype.parseArgument=function(t,r){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,g(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(d.EMPTY_ARGUMENT,g(n,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(d.MALFORMED_ARGUMENT,g(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,g(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:T.argument,value:i,location:g(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,g(n,this.clonePosition())):this.parseArgumentOptions(t,r,i,n);default:return this.error(d.MALFORMED_ARGUMENT,g(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),r=this.offset(),n=At(this.message,r),i=r+n.length;this.bumpTo(i);var o=this.clonePosition(),s=g(t,o);return{value:n,location:s}},e.prototype.parseArgumentOptions=function(t,r,n,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,c=this.clonePosition();switch(a){case"":return this.error(d.EXPECT_ARGUMENT_TYPE,g(s,c));case"number":case"date":case"time":{this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var u=this.clonePosition(),p=this.parseSimpleArgStyleIfPossible();if(p.err)return p;var f=ui(p.val);if(f.length===0)return this.error(d.EXPECT_ARGUMENT_STYLE,g(this.clonePosition(),this.clonePosition()));var m=g(u,this.clonePosition());l={style:f,styleLocation:m}}var h=this.tryParseArgumentClose(i);if(h.err)return h;var y=g(i,this.clonePosition());if(l&&Or(l?.style,"::",0)){var E=ci(l.style.slice(2));if(a==="number"){var p=this.parseNumberSkeletonFromString(E,l.styleLocation);return p.err?p:{val:{type:T.number,value:n,location:y,style:p.val},err:null}}else{if(E.length===0)return this.error(d.EXPECT_DATE_TIME_SKELETON,y);var f={type:Q.dateTime,pattern:E,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?Er(E):{}},v=a==="date"?T.date:T.time;return{val:{type:v,value:n,location:y,style:f},err:null}}}return{val:{type:a==="number"?T.number:a==="date"?T.date:T.time,value:n,location:y,style:(o=l?.style)!==null&&o!==void 0?o:null},err:null}}case"plural":case"selectordinal":case"select":{var w=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(d.EXPECT_SELECT_ARGUMENT_OPTIONS,g(w,x({},w)));this.bumpSpace();var P=this.parseIdentifierIfPossible(),S=0;if(a!=="select"&&P.value==="offset"){if(!this.bumpIf(":"))return this.error(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,g(this.clonePosition(),this.clonePosition()));this.bumpSpace();var p=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,d.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(p.err)return p;this.bumpSpace(),P=this.parseIdentifierIfPossible(),S=p.val}var A=this.tryParsePluralOrSelectOptions(t,a,r,P);if(A.err)return A;var h=this.tryParseArgumentClose(i);if(h.err)return h;var G=g(i,this.clonePosition());return a==="select"?{val:{type:T.select,value:n,options:Cr(A.val),location:G},err:null}:{val:{type:T.plural,value:n,options:Cr(A.val),offset:S,pluralType:a==="plural"?"cardinal":"ordinal",location:G},err:null}}default:return this.error(d.INVALID_ARGUMENT_TYPE,g(s,c))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,g(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,r=this.clonePosition();!this.isEOF();){var n=this.char();switch(n){case 39:{this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(d.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,g(i,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(r.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(r.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,r){var n=[];try{n=Pr(t)}catch{return this.error(d.INVALID_NUMBER_SKELETON,r)}return{val:{type:Q.number,tokens:n,location:r,parsedOptions:this.shouldParseSkeletons?_r(n):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,r,n,i){for(var o,s=!1,a=[],c=new Set,l=i.value,u=i.location;;){if(l.length===0){var p=this.clonePosition();if(r!=="select"&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_SELECTOR,d.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;u=g(p,this.clonePosition()),l=this.message.slice(p.offset,this.offset())}else break}if(c.has(l))return this.error(r==="select"?d.DUPLICATE_SELECT_ARGUMENT_SELECTOR:d.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,u);l==="other"&&(s=!0),this.bumpSpace();var m=this.clonePosition();if(!this.bumpIf("{"))return this.error(r==="select"?d.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:d.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,g(this.clonePosition(),this.clonePosition()));var h=this.parseMessage(t+1,r,n);if(h.err)return h;var y=this.tryParseArgumentClose(m);if(y.err)return y;a.push([l,{value:h.val,location:g(m,this.clonePosition())}]),c.add(l),this.bumpSpace(),o=this.parseIdentifierIfPossible(),l=o.value,u=o.location}return a.length===0?this.error(r==="select"?d.EXPECT_SELECT_ARGUMENT_SELECTOR:d.EXPECT_PLURAL_ARGUMENT_SELECTOR,g(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!s?this.error(d.MISSING_OTHER_CLAUSE,g(this.clonePosition(),this.clonePosition())):{val:a,err:null}},e.prototype.tryParseDecimalInteger=function(t,r){var n=1,i=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var o=!1,s=0;!this.isEOF();){var a=this.char();if(a>=48&&a<=57)o=!0,s=s*10+(a-48),this.bump();else break}var c=g(i,this.clonePosition());return o?(s*=n,ai(s)?{val:s,err:null}:this.error(r,c)):this.error(t,c)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var r=Nr(this.message,t);if(r===void 0)throw Error("Offset "+t+" is at invalid UTF-16 code unit boundary");return r},e.prototype.error=function(t,r){return{val:null,err:{kind:t,message:this.message,location:r}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(Or(this.message,t,this.offset())){for(var r=0;r=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset "+t+" must be greater than or equal to the current offset "+this.offset());for(t=Math.min(t,this.message.length);;){var r=this.offset();if(r===t)break;if(r>t)throw Error("targetOffset "+t+" is at invalid UTF-16 code unit boundary");if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&Ur(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),r=this.offset(),n=this.message.charCodeAt(r+(t>=65536?2:1));return n??null},e}();function wt(e){return e>=97&&e<=122||e>=65&&e<=90}function li(e){return wt(e)||e===47}function fi(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Ur(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function pi(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function _t(e){e.forEach(function(t){if(delete t.location,Ve(t)||We(t))for(var r in t.options)delete t.options[r].location,_t(t.options[r].value);else ke(t)&&He(t.style)||(Ge(t)||Fe(t))&&xe(t.style)?delete t.style.location:je(t)&&_t(t.children)})}function Mr(e,t){t===void 0&&(t={}),t=x({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new Rr(e,t).parse();if(r.err){var n=SyntaxError(d[r.err.kind]);throw n.location=r.err.location,n.originalMessage=r.err.message,n}return t?.captureLocation||_t(r.val),r.val}function Ee(e,t){var r=t&&t.cache?t.cache:Ei,n=t&&t.serializer?t.serializer:xi,i=t&&t.strategy?t.strategy:hi;return i(e,{cache:r,serializer:n})}function mi(e){return e==null||typeof e=="number"||typeof e=="boolean"}function Dr(e,t,r,n){var i=mi(n)?n:r(n),o=t.get(i);return typeof o>"u"&&(o=e.call(this,n),t.set(i,o)),o}function kr(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return typeof o>"u"&&(o=e.apply(this,n),t.set(i,o)),o}function Lt(e,t,r,n,i){return r.bind(t,e,n,i)}function hi(e,t){var r=e.length===1?Dr:kr;return Lt(e,this,r,t.cache.create(),t.serializer)}function di(e,t){return Lt(e,this,kr,t.cache.create(),t.serializer)}function gi(e,t){return Lt(e,this,Dr,t.cache.create(),t.serializer)}var xi=function(){return JSON.stringify(arguments)};function Ot(){this.cache=Object.create(null)}Ot.prototype.get=function(e){return this.cache[e]};Ot.prototype.set=function(e,t){this.cache[e]=t};var Ei={create:function(){return new Ot}},Xe={variadic:di,monadic:gi};var K;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(K||(K={}));var ye=function(e){ge(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.code=n,o.originalMessage=i,o}return t.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},t}(Error);var Ct=function(e){ge(t,e);function t(r,n,i,o){return e.call(this,'Invalid values for "'+r+'": "'+n+'". Options are "'+Object.keys(i).join('", "')+'"',K.INVALID_VALUE,o)||this}return t}(ye);var Gr=function(e){ge(t,e);function t(r,n,i){return e.call(this,'Value for "'+r+'" must be of type '+n,K.INVALID_VALUE,i)||this}return t}(ye);var Fr=function(e){ge(t,e);function t(r,n){return e.call(this,'The intl string context variable "'+r+'" was not provided to the string "'+n+'"',K.MISSING_VALUE,n)||this}return t}(ye);var N;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(N||(N={}));function yi(e){return e.length<2?e:e.reduce(function(t,r){var n=t[t.length-1];return!n||n.type!==N.literal||r.type!==N.literal?t.push(r):n.value+=r.value,t},[])}function vi(e){return typeof e=="function"}function ve(e,t,r,n,i,o,s){if(e.length===1&&yt(e[0]))return[{type:N.literal,value:e[0].value}];for(var a=[],c=0,l=e;ct in e?Pr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var zn=(e,t)=>{for(var r in t)Pr(e,r,{get:t[r],enumerable:!0})};var me=(e,t,r)=>(Yn(e,typeof t!="symbol"?t+"":t,r),r);var _e;(function(e){e.ServerError="ServerError",e.ClientError="ClientError",e.UnexpectedError="UnexpectedError"})(_e||(_e={}));var Ar=(e,t,r)=>({type:(i=>i>=500?_e.ServerError:i<400?_e.UnexpectedError:_e.ClientError)(e),message:t,originatingRequest:r,status:e});var Zn=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},Ge;(function(e){e.AUTHORIZATION="Authorization",e.X_API_KEY="X-Api-Key"})(Ge||(Ge={}));var Tt=class{constructor(t){this.fetchOptions=t}commonHeaders(){let t={};return this.fetchOptions.apiKey&&(t[Ge.X_API_KEY]=this.fetchOptions.apiKey),this.fetchOptions.accessToken&&(t[Ge.AUTHORIZATION]=`Bearer ${this.fetchOptions.accessToken}`),t}transformData(t,r){return r?t.map(n=>r(n)):t.map(n=>this.identifyTransform(n))}transformDatum(t,r){return r?r(t):this.identifyTransform(t)}identifyTransform(t){return t}failOnBadStatusOrParseBody(t,r){return Zn(this,void 0,void 0,function*(){if(t.ok)return t.json().then(i=>({headers:t.headers,status:t.status,statusText:t.statusText,data:i}));let n=yield t.text();return Promise.reject(Ar(t.status,n,r))})}buildUrl(t,r,n,i,o){var s;let a=(s=this.fetchOptions.baseUrl)!==null&&s!==void 0?s:i(this.fetchOptions.env),c=o(r,n);return this.generateUrl(a,t,c)}generateUrl(t,r,n){let i=new URL(r,t);return n&&(i.search=this.convertToSearchParams(n).toString()),i.toString()}convertToSearchParams(t){return new URLSearchParams(t)}setParams(t,r,n){n!=null&&typeof n=="boolean"?t[r]=String(n):n&&(t[r]=n)}},St=Tt;var F;(function(e){e.STAGE="STAGE",e.PRODUCTION="PRODUCTION",e.LOCAL="LOCAL"})(F||(F={}));var we;(function(e){e.STAGE="STAGE",e.PRODUCTION="PROD",e.LOCAL="LOCAL"})(we||(we={}));var re;(function(e){e.DRAFT="DRAFT",e.PUBLISHED="PUBLISHED"})(re||(re={}));var ne;(function(e){e.V2="UCv2",e.V3="UCv3"})(ne||(ne={}));var ee;(function(e){e.CHECKOUT="checkout",e.CHECKOUT_EMAIL="checkout/email",e.SEGMENTATION="segmentation",e.BUNDLE="bundle",e.COMMITMENT="commitment",e.RECOMMENDATION="recommendation",e.EMAIL="email",e.PAYMENT="payment",e.CHANGE_PLAN_TEAM_PLANS="change-plan/team-upgrade/plans",e.CHANGE_PLAN_TEAM_PAYMENT="change-plan/team-upgrade/payment"})(ee||(ee={}));var Pt=function(e){var t;return(t=Qn.get(e))!==null&&t!==void 0?t:e},Qn=new Map([["countrySpecific","cs"],["quantity","q"],["authCode","code"],["checkoutPromoCode","apc"],["rurl","rUrl"],["curl","cUrl"],["ctxrturl","ctxRtUrl"],["country","co"],["language","lang"],["clientId","cli"],["context","ctx"],["productArrangementCode","pa"],["offerType","ot"],["marketSegment","ms"]]);var _r=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},wr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function Oe(e,t,r){var n,i;try{for(var o=_r(Object.entries(e)),s=o.next();!s.done;s=o.next()){var a=wr(s.value,2),c=a[0],l=a[1];l!=null&&r.has(c)&&t.set(Pt(c),l)}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}function Fe(e){switch(e){case F.PRODUCTION:return"https://commerce.adobe.com";default:return"https://commerce-stg.adobe.com"}}function Ve(e,t){var r,n;for(var i in e){var o=e[i];try{for(var s=(r=void 0,_r(Object.entries(o))),a=s.next();!a.done;a=s.next()){var c=wr(a.value,2),l=c[0],u=c[1];if(u!=null){var p=Pt(l);t.set("items["+i+"]["+p+"]",u)}}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}}var Jn=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Or(e){ri(e);var t=e.env,r=e.items,n=e.workflowStep,i=Jn(e,["env","items","workflowStep"]),o=new URL(Fe(t));return o.pathname=n+"/",Ve(r,o.searchParams),Oe(i,o.searchParams,ei),o.toString()}var ei=new Set(["clientId","country","language","context","cUrl","mv","nglwfdata","otac","promoid","rUrl","sdid","spint","trackingid","authCode","campaignid","appctxid"]),ti=["env","workflowStep","clientId","country","items"];function ri(e){var t,r;try{for(var n=Kn(ti),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!0}var ni=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},oi="/store/";function At(e){ai(e);var t=e.env,r=e.items,n=e.workflowStep,i=e.marketSegment,o=e.offerType,s=e.productArrangementCode,a=ni(e,["env","items","workflowStep","marketSegment","offerType","productArrangementCode"]),c={marketSegment:i,offerType:o,productArrangementCode:s},l=new URL(Fe(t));return l.pathname=""+oi+n,n!==ee.SEGMENTATION?Ve(r,l.searchParams):Oe(c,l.searchParams,Lr),Oe(a,l.searchParams,Lr),l.toString()}var Lr=new Set(["clientId","country","language","context","landscape","ctxRtUrl","jit","productArrangementCode","marketSegment","offerType","checkoutPromoCode","svar","usid","rUrl","otac","nglwfdata","appctxid","promoid","sdid","trackingid","mv","ai","sc","csm","th","thm","lo","gsp","so.su","so.ca","so.va","so.tr","context.guid","af","rf"]),si=["env","workflowStep","clientId","country"];function ai(e){var t,r;try{for(var n=ii(si),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e[o])throw new Error('Argument "checkoutData" is not valid, missing: '+o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}if(e.workflowStep!==ee.SEGMENTATION&&!e.items)throw new Error('Argument "checkoutData" is not valid, missing: items');return!0}function _t(e,t){switch(e){case ne.V2:return Or(t);case ne.V3:return At(t);default:return console.warn("Unsupported CheckoutType, will use UCv3 as default. Given type: "+e),At(t)}}var wt;(function(e){e.BASE="BASE",e.TRIAL="TRIAL",e.PROMOTION="PROMOTION"})(wt||(wt={}));var N;(function(e){e.MONTH="MONTH",e.YEAR="YEAR",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS",e.PERPETUAL="PERPETUAL"})(N||(N={}));var L;(function(e){e.ANNUAL="ANNUAL",e.MONTHLY="MONTHLY",e.TWO_YEARS="TWO_YEARS",e.THREE_YEARS="THREE_YEARS"})(L||(L={}));var Ot;(function(e){e.INDIVIDUAL="INDIVIDUAL",e.TEAM="TEAM",e.ENTERPRISE="ENTERPRISE"})(Ot||(Ot={}));var Lt;(function(e){e.COM="COM",e.EDU="EDU",e.GOV="GOV"})(Lt||(Lt={}));var Ct;(function(e){e.DIRECT="DIRECT",e.INDIRECT="INDIRECT"})(Ct||(Ct={}));var Nt;(function(e){e.ENTERPRISE_PRODUCT="ENTERPRISE_PRODUCT",e.ETLA="ETLA",e.RETAIL="RETAIL",e.VIP="VIP",e.VIPMP="VIPMP",e.FREE="FREE"})(Nt||(Nt={}));var ci=re.PUBLISHED,Cr=e=>{switch(e){case F.PRODUCTION:return"https://wcs.adobe.io";case F.STAGE:return"https://wcs-stage.adobe.io";case F.LOCAL:return"http://localhost:3002";default:return"https://wcs-stage.adobe.io"}},Nr=(e,t)=>{var r;return e.api_key=t.apiKey,e.landscape=(r=t.landscape)!==null&&r!==void 0?r:ci,e};var ui=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(p){s(p)}}function c(u){try{l(n.throw(u))}catch(p){s(p)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},It=class extends St{constructor(t){super(t),this.apiPaths={getWebCommerceArtifact:"web_commerce_artifact"},this.getWebCommerceArtifact=(r,n,i,o)=>ui(this,void 0,void 0,function*(){let s=this.buildUrl(this.apiPaths.getWebCommerceArtifact,n,r,a=>Cr(a),(a,c)=>this.evaluateGetWebCommerceArtifactParams(a,c));return this.fetchOptions.fetch(s,{signal:o,headers:Object.assign({},this.commonHeaders()),mode:"cors"}).then(a=>this.failOnBadStatusOrParseBody(a,`GET ${s}`)).then(a=>{let l=a.data;return{data:this.transformDatum(l,i)}})})}evaluateGetWebCommerceArtifactParams(t,r){let n={};return this.setParams(n,"offer_selector_ids",r.offerSelectorIds.join(",")),this.setParams(n,"country",r.country),this.setParams(n,"language",r.language),this.setParams(n,"currency",r.currency),this.setParams(n,"locale",r.locale),this.setParams(n,"promotion_code",r.promotionCode),Nr(n,t)}},Ir=It;var We=e=>new Ir(e).getWebCommerceArtifact;var Rr="tacocat.js";var de=(e,t)=>String(e??"").toLowerCase()==String(t??"").toLowerCase(),Ur=e=>`${e??""}`.replace(/[&<>'"]/g,t=>({"&":"&","<":"<",">":">","'":"'",'"':"""})[t]??t)??"";function O(e,t={},{metadata:r=!0,search:n=!0,storage:i=!0}={}){let o;if(n&&o==null){let s=new URLSearchParams(window.location.search),a=he(n)?n:e;o=s.get(a)}if(i&&o==null){let s=he(i)?i:e;o=window.sessionStorage.getItem(s)??window.localStorage.getItem(s)}if(r&&o==null){let s=kr(he(r)?r:e);o=document.documentElement.querySelector(`meta[name="${s}"]`)?.content}return o??t[e]}var Ee=()=>{};var Mr=e=>typeof e=="boolean",ie=e=>typeof e=="function",je=e=>typeof e=="number",Dr=e=>e!=null&&typeof e=="object";var he=e=>typeof e=="string",Rt=e=>he(e)&&e,ge=e=>je(e)&&Number.isFinite(e)&&e>0;function xe(e,t=r=>r==null||r===""){return e!=null&&Object.entries(e).forEach(([r,n])=>{t(n)&&delete e[r]}),e}function T(e,t){if(Mr(e))return e;let r=String(e);return r==="1"||r==="true"?!0:r==="0"||r==="false"?!1:t}function Q(e,t,r){let n=Object.values(t);return n.find(i=>de(i,e))??r??n[0]}function kr(e=""){return String(e).replace(/(\p{Lowercase_Letter})(\p{Uppercase_Letter})/gu,(t,r,n)=>`${r}-${n}`).replace(/\W+/gu,"-").toLowerCase()}function ye(e,t=1){return je(e)||(e=Number.parseInt(e,10)),!Number.isNaN(e)&&e>0&&Number.isFinite(e)?e:t}var li=Date.now(),Ut=()=>`(+${Date.now()-li}ms)`,He=new Set,fi=T(O("tacocat.debug",{},{metadata:!1}),typeof process<"u"&&process.env?.DEBUG);function Gr(e){let t=`[${Rr}/${e}]`,r=(s,a,...c)=>s?!0:(i(a,...c),!1),n=fi?(s,...a)=>{console.debug(`${t} ${s}`,...a,Ut())}:()=>{},i=(s,...a)=>{let c=`${t} ${s}`;He.forEach(([l])=>l(c,...a))};return{assert:r,debug:n,error:i,warn:(s,...a)=>{let c=`${t} ${s}`;He.forEach(([,l])=>l(c,...a))}}}function pi(e,t){let r=[e,t];return He.add(r),()=>{He.delete(r)}}pi((e,...t)=>{console.error(e,...t,Ut())},(e,...t)=>{console.warn(e,...t,Ut())});var mi="no promo",Fr="promo-tag",hi="yellow",di="neutral",Ei=(e,t,r)=>{let n=o=>o||mi,i=r?` (was "${n(t)}")`:"";return`${n(e)}${i}`},gi="cancel-context",Le=(e,t)=>{let r=e===gi,n=!r&&e?.length>0,i=(n||r)&&(t&&t!=e||!t&&!r),o=i&&n||!i&&!!t,s=o?e||t:void 0;return{effectivePromoCode:s,overridenPromoCode:e,className:o?Fr:`${Fr} no-promo`,text:Ei(s,t,i),variant:o?hi:di,isOverriden:i}};var Mt=function(e,t){return Mt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Mt(e,t)};function Ce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Mt(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var g=function(){return g=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0}),r=[],n=0,i=t;n1)throw new RangeError("integer-width stems only accept a single optional option");i.options[0].replace(vi,function(a,c,l,u,p,f){if(c)t.minimumIntegerDigits=l.length;else{if(u&&p)throw new Error("We currently do not support maximum integer digits");if(f)throw new Error("We currently do not support exact integer digits")}return""});continue}if(zr.test(i.stem)){t.minimumIntegerDigits=i.stem.length;continue}if(Xr.test(i.stem)){if(i.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");i.stem.replace(Xr,function(a,c,l,u,p,f){return l==="*"?t.minimumFractionDigits=c.length:u&&u[0]==="#"?t.maximumFractionDigits=u.length:p&&f?(t.minimumFractionDigits=p.length,t.maximumFractionDigits=p.length+f.length):(t.minimumFractionDigits=c.length,t.maximumFractionDigits=c.length),""}),i.options.length&&(t=g(g({},t),Br(i.options[0])));continue}if(Yr.test(i.stem)){t=g(g({},t),Br(i.stem));continue}var o=Zr(i.stem);o&&(t=g(g({},t),o));var s=bi(i.stem);s&&(t=g(g({},t),s))}return t}var Gt,Ti=new RegExp("^"+kt.source+"*"),Si=new RegExp(kt.source+"*$");function E(e,t){return{start:e,end:t}}var Pi=!!String.prototype.startsWith,Ai=!!String.fromCodePoint,_i=!!Object.fromEntries,wi=!!String.prototype.codePointAt,Oi=!!String.prototype.trimStart,Li=!!String.prototype.trimEnd,Ci=!!Number.isSafeInteger,Ni=Ci?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},Vt=!0;try{Jr=rn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),Vt=((Gt=Jr.exec("a"))===null||Gt===void 0?void 0:Gt[0])==="a"}catch{Vt=!1}var Jr,Kr=Pi?function(t,r,n){return t.startsWith(r,n)}:function(t,r,n){return t.slice(n,n+r.length)===r},Wt=Ai?String.fromCodePoint:function(){for(var t=[],r=0;ro;){if(s=t[o++],s>1114111)throw RangeError(s+" is not a valid code point");n+=s<65536?String.fromCharCode(s):String.fromCharCode(((s-=65536)>>10)+55296,s%1024+56320)}return n},en=_i?Object.fromEntries:function(t){for(var r={},n=0,i=t;n=n)){var i=t.charCodeAt(r),o;return i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?i:(i-55296<<10)+(o-56320)+65536}},Ii=Oi?function(t){return t.trimStart()}:function(t){return t.replace(Ti,"")},Ri=Li?function(t){return t.trimEnd()}:function(t){return t.replace(Si,"")};function rn(e,t){return new RegExp(e,t)}var jt;Vt?(Ft=rn("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu"),jt=function(t,r){var n;Ft.lastIndex=r;var i=Ft.exec(t);return(n=i[1])!==null&&n!==void 0?n:""}):jt=function(t,r){for(var n=[];;){var i=tn(t,r);if(i===void 0||on(i)||Di(i))break;n.push(i),r+=i>=65536?2:1}return Wt.apply(void 0,n)};var Ft,nn=function(){function e(t,r){r===void 0&&(r={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!r.ignoreTag,this.requiresOtherClause=!!r.requiresOtherClause,this.shouldParseSkeletons=!!r.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,r,n){for(var i=[];!this.isEOF();){var o=this.char();if(o===123){var s=this.parseArgument(t,n);if(s.err)return s;i.push(s.val)}else{if(o===125&&t>0)break;if(o===35&&(r==="plural"||r==="selectordinal")){var a=this.clonePosition();this.bump(),i.push({type:S.pound,location:E(a,this.clonePosition())})}else if(o===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(d.UNMATCHED_CLOSING_TAG,E(this.clonePosition(),this.clonePosition()))}else if(o===60&&!this.ignoreTag&&Ht(this.peek()||0)){var s=this.parseTag(t,r);if(s.err)return s;i.push(s.val)}else{var s=this.parseLiteral(t,r);if(s.err)return s;i.push(s.val)}}}return{val:i,err:null}},e.prototype.parseTag=function(t,r){var n=this.clonePosition();this.bump();var i=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:S.literal,value:"<"+i+"/>",location:E(n,this.clonePosition())},err:null};if(this.bumpIf(">")){var o=this.parseMessage(t+1,r,!0);if(o.err)return o;var s=o.val,a=this.clonePosition();if(this.bumpIf("")?{val:{type:S.tag,value:i,children:s,location:E(n,this.clonePosition())},err:null}:this.error(d.INVALID_TAG,E(a,this.clonePosition())))}else return this.error(d.UNCLOSED_TAG,E(n,this.clonePosition()))}else return this.error(d.INVALID_TAG,E(n,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&Mi(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,r){for(var n=this.clonePosition(),i="";;){var o=this.tryParseQuote(r);if(o){i+=o;continue}var s=this.tryParseUnquoted(t,r);if(s){i+=s;continue}var a=this.tryParseLeftAngleBracket();if(a){i+=a;continue}break}var c=E(n,this.clonePosition());return{val:{type:S.literal,value:i,location:c},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!Ui(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var r=[this.char()];for(this.bump();!this.isEOF();){var n=this.char();if(n===39)if(this.peek()===39)r.push(39),this.bump();else{this.bump();break}else r.push(n);this.bump()}return Wt.apply(void 0,r)},e.prototype.tryParseUnquoted=function(t,r){if(this.isEOF())return null;var n=this.char();return n===60||n===123||n===35&&(r==="plural"||r==="selectordinal")||n===125&&t>0?null:(this.bump(),Wt(n))},e.prototype.parseArgument=function(t,r){var n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(d.EMPTY_ARGUMENT,E(n,this.clonePosition()));var i=this.parseIdentifierIfPossible().value;if(!i)return this.error(d.MALFORMED_ARGUMENT,E(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:S.argument,value:i,location:E(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(n,this.clonePosition())):this.parseArgumentOptions(t,r,i,n);default:return this.error(d.MALFORMED_ARGUMENT,E(n,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),r=this.offset(),n=jt(this.message,r),i=r+n.length;this.bumpTo(i);var o=this.clonePosition(),s=E(t,o);return{value:n,location:s}},e.prototype.parseArgumentOptions=function(t,r,n,i){var o,s=this.clonePosition(),a=this.parseIdentifierIfPossible().value,c=this.clonePosition();switch(a){case"":return this.error(d.EXPECT_ARGUMENT_TYPE,E(s,c));case"number":case"date":case"time":{this.bumpSpace();var l=null;if(this.bumpIf(",")){this.bumpSpace();var u=this.clonePosition(),p=this.parseSimpleArgStyleIfPossible();if(p.err)return p;var f=Ri(p.val);if(f.length===0)return this.error(d.EXPECT_ARGUMENT_STYLE,E(this.clonePosition(),this.clonePosition()));var m=E(u,this.clonePosition());l={style:f,styleLocation:m}}var h=this.tryParseArgumentClose(i);if(h.err)return h;var v=E(i,this.clonePosition());if(l&&Kr(l?.style,"::",0)){var x=Ii(l.style.slice(2));if(a==="number"){var p=this.parseNumberSkeletonFromString(x,l.styleLocation);return p.err?p:{val:{type:S.number,value:n,location:v,style:p.val},err:null}}else{if(x.length===0)return this.error(d.EXPECT_DATE_TIME_SKELETON,v);var f={type:oe.dateTime,pattern:x,location:l.styleLocation,parsedOptions:this.shouldParseSkeletons?jr(x):{}},w=a==="date"?S.date:S.time;return{val:{type:w,value:n,location:v,style:f},err:null}}}return{val:{type:a==="number"?S.number:a==="date"?S.date:S.time,value:n,location:v,style:(o=l?.style)!==null&&o!==void 0?o:null},err:null}}case"plural":case"selectordinal":case"select":{var A=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(d.EXPECT_SELECT_ARGUMENT_OPTIONS,E(A,g({},A)));this.bumpSpace();var y=this.parseIdentifierIfPossible(),_=0;if(a!=="select"&&y.value==="offset"){if(!this.bumpIf(":"))return this.error(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,E(this.clonePosition(),this.clonePosition()));this.bumpSpace();var p=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,d.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(p.err)return p;this.bumpSpace(),y=this.parseIdentifierIfPossible(),_=p.val}var P=this.tryParsePluralOrSelectOptions(t,a,r,y);if(P.err)return P;var h=this.tryParseArgumentClose(i);if(h.err)return h;var U=E(i,this.clonePosition());return a==="select"?{val:{type:S.select,value:n,options:en(P.val),location:U},err:null}:{val:{type:S.plural,value:n,options:en(P.val),offset:_,pluralType:a==="plural"?"cardinal":"ordinal",location:U},err:null}}default:return this.error(d.INVALID_ARGUMENT_TYPE,E(s,c))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(d.EXPECT_ARGUMENT_CLOSING_BRACE,E(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,r=this.clonePosition();!this.isEOF();){var n=this.char();switch(n){case 39:{this.bump();var i=this.clonePosition();if(!this.bumpUntil("'"))return this.error(d.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,E(i,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(r.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(r.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,r){var n=[];try{n=qr(t)}catch{return this.error(d.INVALID_NUMBER_SKELETON,r)}return{val:{type:oe.number,tokens:n,location:r,parsedOptions:this.shouldParseSkeletons?Qr(n):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,r,n,i){for(var o,s=!1,a=[],c=new Set,l=i.value,u=i.location;;){if(l.length===0){var p=this.clonePosition();if(r!=="select"&&this.bumpIf("=")){var f=this.tryParseDecimalInteger(d.EXPECT_PLURAL_ARGUMENT_SELECTOR,d.INVALID_PLURAL_ARGUMENT_SELECTOR);if(f.err)return f;u=E(p,this.clonePosition()),l=this.message.slice(p.offset,this.offset())}else break}if(c.has(l))return this.error(r==="select"?d.DUPLICATE_SELECT_ARGUMENT_SELECTOR:d.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,u);l==="other"&&(s=!0),this.bumpSpace();var m=this.clonePosition();if(!this.bumpIf("{"))return this.error(r==="select"?d.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:d.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,E(this.clonePosition(),this.clonePosition()));var h=this.parseMessage(t+1,r,n);if(h.err)return h;var v=this.tryParseArgumentClose(m);if(v.err)return v;a.push([l,{value:h.val,location:E(m,this.clonePosition())}]),c.add(l),this.bumpSpace(),o=this.parseIdentifierIfPossible(),l=o.value,u=o.location}return a.length===0?this.error(r==="select"?d.EXPECT_SELECT_ARGUMENT_SELECTOR:d.EXPECT_PLURAL_ARGUMENT_SELECTOR,E(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!s?this.error(d.MISSING_OTHER_CLAUSE,E(this.clonePosition(),this.clonePosition())):{val:a,err:null}},e.prototype.tryParseDecimalInteger=function(t,r){var n=1,i=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(n=-1);for(var o=!1,s=0;!this.isEOF();){var a=this.char();if(a>=48&&a<=57)o=!0,s=s*10+(a-48),this.bump();else break}var c=E(i,this.clonePosition());return o?(s*=n,Ni(s)?{val:s,err:null}:this.error(r,c)):this.error(t,c)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var r=tn(this.message,t);if(r===void 0)throw Error("Offset "+t+" is at invalid UTF-16 code unit boundary");return r},e.prototype.error=function(t,r){return{val:null,err:{kind:t,message:this.message,location:r}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(Kr(this.message,t,this.offset())){for(var r=0;r=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset "+t+" must be greater than or equal to the current offset "+this.offset());for(t=Math.min(t,this.message.length);;){var r=this.offset();if(r===t)break;if(r>t)throw Error("targetOffset "+t+" is at invalid UTF-16 code unit boundary");if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&on(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),r=this.offset(),n=this.message.charCodeAt(r+(t>=65536?2:1));return n??null},e}();function Ht(e){return e>=97&&e<=122||e>=65&&e<=90}function Ui(e){return Ht(e)||e===47}function Mi(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function on(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function Di(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function Xt(e){e.forEach(function(t){if(delete t.location,Ye(t)||ze(t))for(var r in t.options)delete t.options[r].location,Xt(t.options[r].value);else Be(t)&&Qe(t.style)||($e(t)||qe(t))&&Ne(t.style)?delete t.style.location:Ze(t)&&Xt(t.children)})}function sn(e,t){t===void 0&&(t={}),t=g({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new nn(e,t).parse();if(r.err){var n=SyntaxError(d[r.err.kind]);throw n.location=r.err.location,n.originalMessage=r.err.message,n}return t?.captureLocation||Xt(r.val),r.val}function Ie(e,t){var r=t&&t.cache?t.cache:ji,n=t&&t.serializer?t.serializer:Wi,i=t&&t.strategy?t.strategy:Gi;return i(e,{cache:r,serializer:n})}function ki(e){return e==null||typeof e=="number"||typeof e=="boolean"}function an(e,t,r,n){var i=ki(n)?n:r(n),o=t.get(i);return typeof o>"u"&&(o=e.call(this,n),t.set(i,o)),o}function cn(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return typeof o>"u"&&(o=e.apply(this,n),t.set(i,o)),o}function Bt(e,t,r,n,i){return r.bind(t,e,n,i)}function Gi(e,t){var r=e.length===1?an:cn;return Bt(e,this,r,t.cache.create(),t.serializer)}function Fi(e,t){return Bt(e,this,cn,t.cache.create(),t.serializer)}function Vi(e,t){return Bt(e,this,an,t.cache.create(),t.serializer)}var Wi=function(){return JSON.stringify(arguments)};function $t(){this.cache=Object.create(null)}$t.prototype.get=function(e){return this.cache[e]};$t.prototype.set=function(e,t){this.cache[e]=t};var ji={create:function(){return new $t}},Je={variadic:Fi,monadic:Vi};var se;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(se||(se={}));var Re=function(e){Ce(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.code=n,o.originalMessage=i,o}return t.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},t}(Error);var qt=function(e){Ce(t,e);function t(r,n,i,o){return e.call(this,'Invalid values for "'+r+'": "'+n+'". Options are "'+Object.keys(i).join('", "')+'"',se.INVALID_VALUE,o)||this}return t}(Re);var un=function(e){Ce(t,e);function t(r,n,i){return e.call(this,'Value for "'+r+'" must be of type '+n,se.INVALID_VALUE,i)||this}return t}(Re);var ln=function(e){Ce(t,e);function t(r,n){return e.call(this,'The intl string context variable "'+r+'" was not provided to the string "'+n+'"',se.MISSING_VALUE,n)||this}return t}(Re);var I;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(I||(I={}));function Hi(e){return e.length<2?e:e.reduce(function(t,r){var n=t[t.length-1];return!n||n.type!==I.literal||r.type!==I.literal?t.push(r):n.value+=r.value,t},[])}function Xi(e){return typeof e=="function"}function Ue(e,t,r,n,i,o,s){if(e.length===1&&Dt(e[0]))return[{type:I.literal,value:e[0].value}];for(var a=[],c=0,l=e;c0?e.substring(0,n):"";let i=jr(e.split("").reverse().join("")),o=r-i,s=e.substring(o,o+1),a=o+(s==="."||s===","?1:0);t.suffix=i>0?e.substring(a,r):"",t.mask=e.substring(n,a),t.maskHasNegativeSign=t.mask.charAt(0)==="-",t.maskHasPositiveSign=t.mask.charAt(0)==="+";let c=t.mask.match(Ai);return t.decimal=c&&c[c.length-1]||".",t.separator=c&&c[1]&&c[0]||",",c=t.mask.split(t.decimal),t.integer=c[0],t.fraction=c[1],t}function _i(e,t,r){let n=!1,i={value:e};e<0&&(n=!0,i.value=-i.value),i.sign=n?"-":"",i.value=Number(i.value).toFixed(t.fraction&&t.fraction.length),i.value=Number(i.value).toString();let o=t.fraction&&t.fraction.lastIndexOf("0"),[s="0",a=""]=i.value.split(".");return(!a||a&&a.length<=o)&&(a=o<0?"":(+("0."+a)).toFixed(o+1).replace("0.","")),i.integer=s,i.fraction=a,Li(i,t),(i.result==="0"||i.result==="")&&(n=!1,i.sign=""),!n&&t.maskHasPositiveSign?i.sign="+":n&&t.maskHasPositiveSign?i.sign="-":n&&(i.sign=r&&r.enforceMaskSign&&!t.maskHasNegativeSign?"":"-"),i}function Li(e,t){e.result="";let r=t.integer.split(t.separator),n=r.join(""),i=n&&n.indexOf("0");if(i>-1)for(;e.integer.lengthMath.round(e*20)/20},It=(e,t)=>({accept:e,round:t}),Ri=[It(({divisor:e,price:t})=>t%e==0,({divisor:e,price:t})=>t/e),It(({usePrecision:e})=>e,({divisor:e,price:t})=>Math.ceil(Math.floor(t*1e4/e)/100)/100),It(()=>!0,({divisor:e,price:t})=>Math.ceil(Math.floor(t*100/e)/100))],qr={[C.YEAR]:{[_.MONTHLY]:Be.MONTH,[_.ANNUAL]:Be.YEAR},[C.MONTH]:{[_.MONTHLY]:Be.MONTH}},Ui=(e,t)=>e.indexOf(`'${t}'`)===0,Mi=(e,t=!0)=>{let r=e.replace(/'.*?'/,"").trim(),n=Zr(r);return!!n?t||(r=r.replace(/[,\.]0+/,n)):r=r.replace(/\s?(#.*0)(?!\s)?/,"$&"+ki(e)),r},Di=e=>{let t=Gi(e),r=Ui(e,t),n=e.replace(/'.*?'/,""),i=$r.test(n)||zr.test(n);return{currencySymbol:t,isCurrencyFirst:r,hasCurrencySpace:i}},Yr=e=>e.replace($r,Br).replace(zr,Br),ki=e=>e.match(/#(.?)#/)?.[1]===Xr?Ci:Xr,Gi=e=>e.match(/'(.*?)'/)?.[1]??"",Zr=e=>e.match(/0(.?)0/)?.[1]??"";function Jr({formatString:e,price:t,usePrecision:r,isIndianPrice:n=!1},i,o=s=>s){let{currencySymbol:s,isCurrencyFirst:a,hasCurrencySpace:c}=Di(e),l=r?Zr(e):"",u=Mi(e,r),p=r?2:0,f=o(t,{currencySymbol:s}),m=n?f.toLocaleString("hi-IN",{minimumFractionDigits:p,maximumFractionDigits:p}):Hr(u,f),h=r?m.lastIndexOf(l):m.length,y=m.substring(0,h),E=m.substring(h+1);return{accessiblePrice:e.replace(/'.*?'/,"SYMBOL").replace(/#.*0/,m).replace(/SYMBOL/,s),currencySymbol:s,decimals:E,decimalsDelimiter:l,hasCurrencySpace:c,integer:y,isCurrencyFirst:a,recurrenceTerm:i}}var Qr=e=>{let{commitment:t,term:r,usePrecision:n}=e,i=Ni[r]??1;return Jr(e,i>1?Be.MONTH:qr[t]?.[r],(o,{currencySymbol:s})=>{let a={divisor:i,price:o,usePrecision:n},{round:c}=Ri.find(({accept:u})=>u(a));if(!c)throw new Error(`Missing rounding rule for: ${JSON.stringify(a)}`);return(Ii[s]??(u=>u))(c(a))})},Kr=({commitment:e,term:t,...r})=>Jr(r,qr[e]?.[t]);var Fi={recurrenceLabel:"{recurrenceTerm, select, MONTH {/mo} YEAR {/yr} other {}}",recurrenceAriaLabel:"{recurrenceTerm, select, MONTH {per month} YEAR {per year} other {}}",perUnitLabel:"{perUnit, select, LICENSE {per license} other {}}",perUnitAriaLabel:"{perUnit, select, LICENSE {per license} other {}}",freeLabel:"Free",freeAriaLabel:"Free",taxExclusiveLabel:"{taxTerm, select, GST {excl. GST} VAT {excl. VAT} TAX {excl. tax} IVA {excl. IVA} SST {excl. SST} KDV {excl. KDV} other {}}",taxInclusiveLabel:"{taxTerm, select, GST {incl. GST} VAT {incl. VAT} TAX {incl. tax} IVA {incl. IVA} SST {incl. SST} KDV {incl. KDV} other {}}",alternativePriceAriaLabel:"Alternatively at {alternativePrice}",strikethroughAriaLabel:"Regularly at {strikethroughPrice}"},Vi=hr("ConsonantTemplates/price"),Wi=/<.+?>/g,D={container:"price",containerOptical:"price-optical",containerStrikethrough:"price-strikethrough",disabled:"disabled",currencySpace:"price-currency-space",currencySymbol:"price-currency-symbol",decimals:"price-decimals",decimalsDelimiter:"price-decimals-delimiter",integer:"price-integer",recurrence:"price-recurrence",taxInclusivity:"price-tax-inclusivity",unitType:"price-unit-type"},ee={perUnitLabel:"perUnitLabel",perUnitAriaLabel:"perUnitAriaLabel",recurrenceLabel:"recurrenceLabel",recurrenceAriaLabel:"recurrenceAriaLabel",taxExclusiveLabel:"taxExclusiveLabel",taxInclusiveLabel:"taxInclusiveLabel",strikethroughAriaLabel:"strikethroughAriaLabel"},ji="TAX_EXCLUSIVE",Hi=e=>mr(e)?Object.entries(e).filter(([,t])=>de(t)||dt(t)||t===!0).reduce((t,[r,n])=>t+` ${r}${n===!0?"":'="'+fr(n)+'"'}`,""):"",F=(e,t,r,n=!1)=>`${n?Yr(t):t??""}`;function Xi(e,{accessibleLabel:t,currencySymbol:r,decimals:n,decimalsDelimiter:i,hasCurrencySpace:o,integer:s,isCurrencyFirst:a,recurrenceLabel:c,perUnitLabel:l,taxInclusivityLabel:u},p={}){let f=F(D.currencySymbol,r),m=F(D.currencySpace,o?" ":""),h="";return a&&(h+=f+m),h+=F(D.integer,s),h+=F(D.decimalsDelimiter,i),h+=F(D.decimals,n),a||(h+=m+f),h+=F(D.recurrence,c,null,!0),h+=F(D.unitType,l,null,!0),h+=F(D.taxInclusivity,u,!0),F(e,h,{...p,"aria-label":t})}var ae=({displayOptical:e=!1,displayStrikethrough:t=!1}={})=>({country:r,displayFormatted:n=!0,displayRecurrence:i=!0,displayPerUnit:o=!1,displayTax:s=!1,language:a,literals:c={}}={},{commitment:l,formatString:u,price:p,priceWithoutDiscount:f,taxDisplay:m,taxTerm:h,term:y,usePrecision:E}={},v={})=>{Object.entries({country:r,formatString:u,language:a,price:p}).forEach(([X,tt])=>{if(tt==null)throw new Error(`Argument "${X}" is missing`)});let w={...Fi,...c},P=`${a.toLowerCase()}-${r.toUpperCase()}`;function S(X,tt){let rt=w[X];if(rt==null)return"";try{return new Wr(rt.replace(Wi,""),P).format(tt)}catch{return Vi.error("Failed to format literal:",rt),""}}let A=t&&f?f:p,{accessiblePrice:G,recurrenceTerm:H,...Y}=(e?Qr:Kr)({commitment:l,formatString:u,term:y,price:e?p:A,usePrecision:E,isIndianPrice:r==="IN"}),$=G,M="";if(b(i)&&H){let X=S(ee.recurrenceAriaLabel,{recurrenceTerm:H});X&&($+=" "+X),M=S(ee.recurrenceLabel,{recurrenceTerm:H})}let Le="";if(b(o)){Le=S(ee.perUnitLabel,{perUnit:"LICENSE"});let X=S(ee.perUnitAriaLabel,{perUnit:"LICENSE"});X&&($+=" "+X)}let ne="";b(s)&&h&&(ne=S(m===ji?ee.taxExclusiveLabel:ee.taxInclusiveLabel,{taxTerm:h}),ne&&($+=" "+ne)),t&&($=S(ee.strikethroughAriaLabel,{strikethroughPrice:$}));let Oe=D.container;if(e&&(Oe+=" "+D.containerOptical),t&&(Oe+=" "+D.containerStrikethrough),b(n))return Xi(Oe,{...Y,accessibleLabel:$,recurrenceLabel:M,perUnitLabel:Le,taxInclusivityLabel:ne},v);let{currencySymbol:er,decimals:vn,decimalsDelimiter:bn,hasCurrencySpace:tr,integer:Tn,isCurrencyFirst:Pn}=Y,ie=[Tn,bn,vn];Pn?(ie.unshift(tr?"\xA0":""),ie.unshift(er)):(ie.push(tr?"\xA0":""),ie.push(er)),ie.push(M,Le,ne);let Sn=ie.join("");return F(Oe,Sn,v)},en=()=>(e,t,r)=>{let i=(e.displayOldPrice===void 0||b(e.displayOldPrice))&&t.priceWithoutDiscount&&t.priceWithoutDiscount!=t.price;return`${ae()(e,t,r)}${i?" "+ae({displayStrikethrough:!0})(e,t,r):""}`};var Rt=ae(),Ut=en(),Mt=ae({displayOptical:!0}),Dt=ae({displayStrikethrough:!0});var kt="ABM",Gt="PUF",Ft="M2M",Vt="PERPETUAL",Bi="TAX_INCLUSIVE_DETAILS",$i="TAX_EXCLUSIVE",tn={ABM:kt,PUF:Gt,M2M:Ft,PERPETUAL:Vt},Zs={[kt]:{commitment:C.YEAR,term:_.MONTHLY},[Gt]:{commitment:C.YEAR,term:_.ANNUAL},[Ft]:{commitment:C.MONTH,term:_.MONTHLY},[Vt]:{commitment:C.PERPETUAL,term:void 0}},rn="Value is not an offer",Wt=e=>{if(typeof e!="object")return rn;let{commitment:t,term:r}=e,n=zi(t,r);return{...e,planType:n}};var zi=(e,t)=>{if(e===void 0)return rn;if(e===""&&t==="")return"";let r="";return e===C.YEAR?t===_.MONTHLY?r=kt:t===_.ANNUAL&&(r=Gt):e===C.MONTH?t===_.MONTHLY&&(r=Ft):e===C.PERPETUAL&&(r=Vt),r};function jt(e){let{priceDetails:t}=e,{price:r,priceWithoutDiscount:n,priceWithoutTax:i,priceWithoutDiscountAndTax:o,taxDisplay:s}=t;if(s!==Bi)return e;let a={...e,priceDetails:{...t,price:i??r,priceWithoutDiscount:o??n,taxDisplay:$i}};return a.offerType==="TRIAL"&&a.priceDetails.price===0&&(a.priceDetails.price=a.priceDetails.priceWithoutDiscount),a}var{freeze:q}=Object,V=q({...J}),W=q({...z}),j=q({...k}),Ht=q({...C}),be=q({...me}),$e=q({...Z}),Xt=q({...tn}),Bt=q({..._});var ce={delimiter:"\xB6",ignoredProperties:["analytics","literals"],serializableTypes:["Array","Object"],sampleRate:100,tags:"consumer=milo/commerce"},nn=new Set,qi=e=>e instanceof Error||typeof e.originatingRequest=="string";function on(e){if(e==null)return;let t=typeof e;if(t==="function"){let{name:r}=e;return r?`${t} ${r}`:t}if(t==="object"){if(e instanceof Error)return e.message;if(typeof e.originatingRequest=="string"){let{message:n,originatingRequest:i,status:o}=e;return[n,o,i].filter(s=>s).join(" ")}let r=e[Symbol.toStringTag]??Object.getPrototypeOf(e).constructor.name;if(!ce.serializableTypes.includes(r))return r}return e}function Yi(e,t){if(!ce.ignoredProperties.includes(e))return on(t)}var $t={append(e){let{delimiter:t,sampleRate:r,tags:n}=ce,{message:i,params:o}=e,s=[],a=i,c=[];o.forEach(p=>{p!=null&&(qi(p)?s:c).push(p)}),s.length&&(a+=" ",a+=s.map(on).join(" "));let{pathname:l,search:u}=window.location;a+=`${t}page=`,a+=l+u,c.length&&(a+=`${t}facts=`,a+=JSON.stringify(c,Yi)),nn.has(a)||(nn.add(a),window.lana.log(a,{sampleRate:r,tags:n}))}};var O=Object.freeze({checkoutClientId:"adobe_com",checkoutWorkflow:V.V3,checkoutWorkflowStep:W.EMAIL,country:"US",displayPerUnit:!1,displayRecurrence:!0,displayTax:!1,env:j.PRODUCTION,forceTaxExclusive:!1,language:"en",promotionCode:"",quantity:1,wcsApiKey:"wcms-commerce-ims-ro-user-milo",wcsBufferDelay:1,wcsEnv:be.PRODUCTION,wcsLandscape:$e.PUBLISHED,wcsBufferLimit:1});function ze(e){if(!e)return 1;let t=(Array.isArray(e)?e:String(e).split(",")).map(se);return t.length===0?1:t.length===1?t[0]:t}var Zi={africa:"en-ZA",mena_en:"en-DZ",il_he:"iw-IL",mena_ar:"ar-DZ",id_id:"in-ID",no:"nb-NO"},ue=Object.freeze({LOCAL:"local",PROD:"prod",STAGE:"stage"}),Ji=["ar","bg","cs","da","de","en","es","et","fi","fr","he","hu","it","ja","ko","lt","lv","nb","nl","pl","pt","ro","ru","sk","sl","sv","tr","uk","zh_CN","zh_TW"];function sn({locale:e={ietf:"en-US"}}={}){let t=Zi[e.prefix??""]??e.ietf,[r=O.language,n=O.country]=t.split("-",2);return n=n.toUpperCase(),r=(Ji.some(i=>oe(i,r))?r:O.language).toLowerCase(),{country:n,language:r,locale:`${r}_${n}`}}function zt({commerce:e={},locale:t=void 0}={}){let n=B(L("commerce.env",e,{metadata:!1}),ue,ue.PROD)===ue.PROD?j.PRODUCTION:j.STAGE,i=L("checkoutClientId",e)??O.checkoutClientId,o=B(L("checkoutWorkflow",e),V,O.checkoutWorkflow),s=W.CHECKOUT;o===V.V3&&(s=B(L("checkoutWorkflowStep",e),W,O.checkoutWorkflowStep));let a=b(L("displayPerUnit",e),O.displayPerUnit),c=b(L("displayRecurrence",e),O.displayRecurrence),l=b(L("displayTax",e),O.displayTax),u=b(L("forceTaxExclusive",e),O.forceTaxExclusive),p=L("promotionCode",e)??O.promotionCode,f=ze(L("quantity",e)),m=L("wcsApiKey",e)??O.wcsApiKey,h=B(L("wcsLandscape",e),$e,O.wcsLandscape),y=se(L("wcsBufferDelay",e),O.wcsBufferDelay),E=se(L("wcsBufferLimit",e),O.wcsBufferLimit),v;try{v=new URL(e.priceLiteralsURL)}catch{}return{...sn({locale:t}),checkoutClientId:i,checkoutWorkflow:o,checkoutWorkflowStep:s,displayPerUnit:a,displayRecurrence:c,displayTax:l,env:n,forceTaxExclusive:u,priceLiteralsURL:v,promotionCode:p,quantity:f,wcsApiKey:m,wcsBufferDelay:y,wcsBufferLimit:E,wcsEnv:n===j.STAGE?be.STAGE:be.PRODUCTION,wcsLandscape:h}}var cn="debug",Qi="error",Ki="info",eo="warn",to=Date.now(),qt=new Set,Yt=new Set,an=new Map,Te=Object.freeze({DEBUG:cn,ERROR:Qi,INFO:Ki,WARN:eo}),un={append({level:e,message:t,params:r,timestamp:n,source:i}){console[e](`[${i}]`,t,...r,`(+${n}ms)`)}},ln={filter:({level:e})=>e!==cn},ro={filter:()=>!1},no=(e,t,r,n,i)=>({level:e,message:t,namespace:r,params:n,source:i,timestamp:Date.now()-to});function io(e){[...Yt].every(t=>t(e))&&qt.forEach(t=>t(e))}function fn(e){let t=(an.get(e)??0)+1;an.set(e,t);let r=`${e} #${t}`,n=o=>(s,...a)=>io(no(o,s,e,a,r)),i=Object.seal({id:r,namespace:e,module(o){return fn(`${i.namespace}/${o}`)},debug:n(Te.DEBUG),error:n(Te.ERROR),info:n(Te.INFO),warn:n(Te.WARN)});return i}function qe(...e){e.forEach(t=>{let{append:r,filter:n}=t;Ue(n)?Yt.add(n):Ue(r)&&qt.add(r)})}function oo(e={}){let{name:t}=e,r=b(L("commerce.debug",{search:!0,storage:!0}),t===ue.LOCAL);qe(r?un:ln),t===ue.PROD&&qe($t)}function so(){qt.clear(),Yt.clear()}var R={...fn("milo"),Level:Te,Plugins:{consoleAppender:un,debugFilter:ln,quietFilter:ro,lanaAppender:$t},init:oo,reset:so,use:qe};var Pe={FAILED:"placeholder-failed",PENDING:"placeholder-pending",RESOLVED:"placeholder-resolved"},le={BAD_REQUEST:"Bad WCS request",OFFER_NOT_FOUND:"Commerce offer not found"},Se={ERROR:"commerce:error",READY:"commerce:ready"};var fe={price:new Set},pn;function U(){return pn??null}function Zt(e){return pn=e,e}function te(e){return xt(e.promotionCode??U()?.settings.promotionCode).effectivePromoCode}var{FAILED:Ye,PENDING:Ze,RESOLVED:Je}=Pe,Qe=e=>setTimeout(e,0),re=new WeakMap,Jt={attributeChangedCallback(e,t,r){this.log?.debug(`Changed attribute "${e}":`,r),this.update()},connectedCallback(){this.log?.debug("Connected:",this.parentElement),this.listenerDisposer=()=>this.update(),document.addEventListener(Se.READY,this.listenerDisposer),this.update()},disconnectedCallback(){document.removeEventListener(Se.READY,this.listenerDisposer)},init(){this.log?.debug("Initialised"),re.set(this,{promises:[],state:void 0,version:0})},onceSettled(){let{error:e,promises:t,state:r}=re.get(this);return Je===r?Promise.resolve(this):Ye===r?Promise.reject(e):new Promise((n,i)=>{t.push({resolve:n,reject:i})})},toggle(){let e=re.get(this);[Ye,Ze,Je].forEach(t=>{this.classList.toggle(t,t===e.state)})},toggleResolved(e){let t=re.get(this);return e!==t.version?!1:(t.state=Je,this.toggle(),this.log?.debug("Resolved:",{dataset:{...this.dataset},node:this,settings:U().settings}),Qe(()=>{let{promises:r}=t;t.promises=[],r.forEach(({resolve:n})=>n(this)),this.dispatchEvent(new CustomEvent(Je,{bubbles:!0}))}),!0)},toggleFailed(e,t){let r=re.get(this);return e!==r.version?!1:(r.error=t,r.state=Ye,this.toggle(),this.log?.error("Failed:",{dataset:{...this.dataset},node:this,settings:U()?.settings},t),Qe(()=>{let{promises:n}=r;r.promises=[],n.forEach(({reject:i})=>i(t)),this.dispatchEvent(new CustomEvent(Ye,{bubbles:!0}))}),!0)},togglePending(){let e=re.get(this);return e.version++,Ze!==e.state&&(this.log?.debug("Pending"),e.state=Ze,this.toggle(),Qe(()=>{this.dispatchEvent(new CustomEvent(Ze,{bubbles:!0}))})),e.version},update(){if(!this.isConnected)return;this.togglePending();let e=re.get(this);e.timer||(e.timer=Qe(()=>{delete e.timer,this.render()}))}};Jt.onceResolved=Jt.onceSettled;function Ae(e,t,r){return customElements.get(t)||(Object.assign(r.prototype,Jt),customElements.define(t,r,{extends:e})),r}var Ke=class extends HTMLAnchorElement{static get observedAttributes(){return["data-checkout-workflow","data-checkout-workflow-step","data-ims-country","data-perpetual","data-promotion-code","data-quantity","data-template","data-wcs-osi"]}constructor(){super(),this.log=R.module("checkoutLink"),this.placeholder.init()}get placeholder(){return this}async render(t={}){if(!this.isConnected)return!1;let r=U();if(!r)return!1;this.dataset.imsCountry||r.imsCountry.then(c=>{c&&(this.dataset.imsCountry=c)},ht);let n=this.placeholder.togglePending();this.href="";let{dataset:i}=this,o=i.wcsOsi.split(","),s=b(i.perpetual,t.perpetual),a=te({...i,...t});try{let c=await Promise.all(U().resolveOfferSelectors({perpetual:s,offerSelectorIds:o,promotionCode:a})).then(l=>l.flat());return this.renderOffers(c,t,n)}catch(c){return this.placeholder.toggleFailed(n,c)}}renderOffers(t,r={},n=void 0){return this.href="",this.isConnected?(n??(n=this.placeholder.togglePending()),t.length?this.placeholder.toggleResolved(n)?(this.href=U().buildCheckoutURL(t,{...this.dataset,...r}),!0):!1:(this.placeholder.toggleFailed(n),!1)):!1}},we={custom:"checkout-link",extends:"a"};Ae(we.extends,we.custom,Ke);function Qt(e={},t=""){let r=document.createElement(we.extends,{is:we.custom});r.setAttribute("is",we.custom);let{checkoutMarketSegment:n,checkoutWorkflow:i,checkoutWorkflowStep:o,perpetual:s,promotionCode:a,quantity:c,wcsOsi:l}=U().collectCheckoutOptions(e);return Object.assign(r.dataset,I({checkoutMarketSegment:n,checkoutWorkflow:i,checkoutWorkflowStep:o,perpetual:s,promotionCode:a,quantity:c,wcsOsi:l})),t&&(r.innerHTML=t),r}var et=class extends HTMLSpanElement{static get observedAttributes(){return["data-display-per-unit","data-display-recurrence","data-display-tax","data-perpetual","data-promotion-code","data-tax-exclusive","data-template","data-wcs-osi"]}constructor(){super(),this.log=R.module("inlinePrice"),this.placeholder.init()}get placeholder(){return this}async render(t={}){if(this.innerHTML="",!this.isConnected)return!1;let r=U();if(r==null)return!1;let n=this.placeholder.togglePending(),{forceTaxExclusive:i,perpetual:o,promotionCode:s}=r.collectPriceOptions({...this.dataset,...t});try{let[a]=r.resolveOfferSelectors({forceTaxExclusive:i,offerSelectorIds:[this.dataset.wcsOsi],perpetual:o,promotionCode:s}),c=await a;this.renderOffers(c,t,n)}catch(a){this.innerHTML="",this.placeholder.toggleFailed(n,a)}}renderOffers(t,r={},n=void 0){if(this.innerHTML="",!this.isConnected)return;if(n??(n=this.placeholder.togglePending()),!t.length)return this.placeholder.toggleFailed(n),!1;if(!this.placeholder.toggleResolved(n))return;let i={...I(this.dataset),...I(r)};fe.price.forEach(o=>o(this.placeholder,i)),this.innerHTML=U().buildPriceHTML(t,i)}},_e={custom:"inline-price",extends:"span"};Ae(_e.extends,_e.custom,et);function Kt(e){let t=document.createElement(_e.extends,{is:_e.custom});t.setAttribute("is",_e.custom);let{displayOldPrice:r,displayPerUnit:n,displayRecurrence:i,displayTax:o,forceTaxExclusive:s,perpetual:a,promotionCode:c,quantity:l,template:u,wcsOsi:p}=U().collectPriceOptions(e);return Object.assign(t.dataset,I({displayOldPrice:r,displayPerUnit:n,displayRecurrence:i,displayTax:o,forceTaxExclusive:s,perpetual:a,promotionCode:c,quantity:l,template:u,wcsOsi:p})),t}function mn(e){let t=R.module("checkout");function r(i={}){let{checkoutClientId:o,checkoutWorkflow:s,checkoutWorkflowStep:a,country:c,quantity:l}=e,{checkoutMarketSegment:u,checkoutWorkflow:p=s,checkoutWorkflowStep:f=a,imsCountry:m=c,quantity:h=l,...y}=I(i),E=te(y),v=B(p,V,ce.checkoutWorkflow),w=W.CHECKOUT;return v===V.V3&&(w=B(f,W,ce.checkoutWorkflowStep)),I({...y,checkoutClientId:o,checkoutMarketSegment:u,country:m,quantity:ze(h),checkoutWorkflow:v,checkoutWorkflowStep:w,promotionCode:E})}function n(i,o){let{env:s,language:a}=e,{checkoutClientId:c,checkoutMarketSegment:l,checkoutWorkflow:u,checkoutWorkflowStep:p,country:f,promotionCode:m,quantity:h,...y}=r(o),E=window.frameElement?"if":"fp",v={checkoutPromoCode:m,clientId:c,context:E,country:f,env:s,items:[],language:a,marketSegment:l,workflowStep:p,...y},w=Array.isArray(h)?h:[h];if(i.length===1){let{offerId:S,offerType:A,productArrangementCode:G}=i[0],{marketSegments:[H]}=i[0];Object.assign(v,{marketSegment:H,offerType:A,productArrangementCode:G});let Y=w[0];v.items.push(Y===1?{id:S}:{id:S,quantity:Y})}else v.items.push(...i.map(({offerId:S},A)=>({id:S,quantity:w[A]??1})));let P=at(u,v);return t.debug(`Url: ${P}`,{options:o}),P}return{CheckoutWorkflow:V,CheckoutWorkflowStep:W,buildCheckoutURL:n,collectCheckoutOptions:r,createCheckoutLink:Qt}}function ao({interval:e=200,maxAttempts:t=25}={}){let r=R.module("ims");return new Promise(n=>{r.debug("Getting user country");let i=0;function o(){window.adobeIMS?window.adobeIMS.isSignedInUser()?window.adobeIMS.getProfile().then(({countryCode:s})=>{r.debug("Got user country:",s),n(s)},s=>{r.error("Unable to get user country:",s),n()}):(r.debug("User is not signed in"),n()):++i>t?(r.debug("Timeout"),n()):setTimeout(o,e)}o()})}function hn(){return{imsCountry:ao()}}async function dn(e){if(!e.priceLiteralsURL)throw new Error("Price literals URL was not provided");let t=await window.fetch(e.priceLiteralsURL),{data:r}=await t.json();if(Array.isArray(r)){let n=o=>r.find(s=>oe(s.lang,o)),i=n(e.language)??n(O.language);if(i)return i}return{}}function gn(e,t){function r(i={}){let{perpetual:o,displayOldPrice:s,displayPerUnit:a,displayRecurrence:c,displayTax:l,forceTaxExclusive:u,template:p,...f}=I(i);return I({...f,displayOldPrice:b(s),displayPerUnit:b(a),displayRecurrence:b(c),displayTax:b(l),forceTaxExclusive:b(u),perpetual:b(o),promotionCode:te(i),template:p})}function n(i,o){let{template:s}=o,a;te(o)?a=Ut:s==="strikethrough"?a=Dt:s==="optical"?a=Mt:a=Rt;let{country:c,language:l}=e,u={...r({...e,...I(o)}),country:c,language:l,literals:Object.assign({},t,I(o.literals??{}))},[p]=i;return a(u,{...p,...p.priceDetails})}return{buildPriceHTML:n,collectPriceOptions:r,createInlinePrice:Kt}}var co={[j.PRODUCTION]:"https://wcs.adobe.com",[j.STAGE]:"https://wcs.stage.adobe.com"};function uo(e,{country:t,forceTaxExclusive:r,perpetual:n,multiple:i}){let o;if(i||e.length===1)o=e;else{let s=t==="GB"||n?"EN":"MULT",[a,c]=e;o=[a.language===s?a:c]}return r&&(o=o.map(jt)),o}function xn(e){let t=R.module("wcs"),{env:r,wcsApiKey:n}=e,i={apiKey:n,baseUrl:co[r],fetch:window.fetch.bind(window)},o=Re(i),s=new Map,a=new Map,c;async function l(f,m,h=!0){let y=le.OFFER_NOT_FOUND;try{t.debug("Fetching:",f),f.offerSelectorIds=f.offerSelectorIds.sort();let{data:E}=await o(f,{apiKey:n,environment:e.wcsEnv,landscape:r===j.STAGE?"ALL":e.wcsLandscape},({resolvedOffers:w})=>({offers:w.map(Wt)}));t.debug("Fetched:",f,E);let{offers:v}=E??{};m.forEach(({resolve:w},P)=>{let S=v.filter(({offerSelectorIds:A})=>A.includes(P)).flat();S.length&&(m.delete(P),w(S))})}catch(E){E.status===404&&f.offerSelectorIds.length>1?(t.debug("Multi-osi 404, fallback to fetch-by-one strategy"),await Promise.allSettled(f.offerSelectorIds.map(v=>l({...f,offerSelectorIds:[v]},m,!1)))):(t.error("Failed:",f,E),y=le.BAD_REQUEST)}h&&m.size&&(t.debug("Missing:",{offerSelectorIds:[...m.keys()]}),m.forEach(E=>{E.reject(new Error(y))}))}function u(){clearTimeout(c);let f=[...a.values()];a.clear(),f.forEach(({options:m,promises:h})=>l(m,h))}function p({forceTaxExclusive:f=e.forceTaxExclusive,multiple:m=!1,offerSelectorIds:h=[],perpetual:y=!1,promotionCode:E=""}){let{country:v,locale:w}=e,P;v!=="GB"&&(P=y?"EN":"MULT");let S=[v,P,E].filter(A=>A).join("-").toLowerCase();return h.map(A=>{let G=`${A}-${S}`;if(!s.has(G)){let H=new Promise((Y,$)=>{let M=a.get(S);M||(M={options:{country:v,language:P,locale:w,offerSelectorIds:[]},promises:new Map},a.set(S,M)),E&&(M.options.promotionCode=E),M.options.offerSelectorIds.push(A),M.promises.set(A,{resolve:Y,reject:$}),M.options.offerSelectorIds.length>=e.wcsBufferLimit?u():(t.debug("Queued:",M.options),c||(c=setTimeout(u,e.wcsBufferDelay)))});s.set(G,H)}return s.get(G).then(H=>uo(H,{country:v,forceTaxExclusive:f,multiple:m,perpetual:y}))})}return{WcsCommitment:Ht,WcsPlanType:Xt,WcsTerm:Bt,resolveOfferSelectors:p}}var En=null;async function lo(e){let t=e?.()??{};R.init(t.env);let r=R.module("commerce");r.debug("Initialising:",t);let n={price:{}},i=Object.freeze(zt(t));try{n.price=await dn(i),r.debug("Price literals loaded:",n.price)}catch(s){r.warn("Price literals were not fetched:",s)}let o=Object.freeze({...mn(i),...hn(),...gn(i,n.price),...xn(i),ClassName:Pe,ErrorMessage:le,literals:n,log:r,providers:{price(s){return fe.price.add(s),()=>fe.price.delete(s)}},settings:i});return r.debug("Initialised:",o),Zt(o),document.dispatchEvent(new CustomEvent(Se.READY)),o}function yn(){Zt(null),En=null,fe.price.clear(),R.reset()}function fo(e,t=!1){return t&&yn(),En??(En=lo(e))}export{V as CheckoutWorkflow,W as CheckoutWorkflowStep,Pe as ClassName,O as Defaults,le as ErrorMessage,Ke as HTMLCheckoutAnchorElement,et as HTMLPriceSpanElement,R as Log,Ht as WcsCommitment,Xt as WcsPlanType,Bt as WcsTerm,Qt as createCheckoutLink,Kt as createInlinePrice,sn as getLocaleSettings,zt as getSettings,fo as init,Ae as makeHTMLPlaceholder,yn as reset}; +`,se.MISSING_INTL_API,s);var _=r.getPluralRules(t,{type:u.pluralType}).select(f-(u.offset||0));y=u.options[_]||u.options.other}if(!y)throw new qt(u.value,f,Object.keys(u.options),s);a.push.apply(a,Ue(y.value,t,r,n,i,f-(u.offset||0)));continue}}return Hi(a)}function Bi(e,t){return t?g(g(g({},e||{}),t||{}),Object.keys(e).reduce(function(r,n){return r[n]=g(g({},e[n]),t[n]||{}),r},{})):e}function $i(e,t){return t?Object.keys(e).reduce(function(r,n){return r[n]=Bi(e[n],t[n]),r},g({},e)):e}function Yt(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,r){e[t]=r}}}}}function qi(e){return e===void 0&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:Ie(function(){for(var t,r=[],n=0;n0?e.substring(0,n):"";let i=mn(e.split("").reverse().join("")),o=r-i,s=e.substring(o,o+1),a=o+(s==="."||s===","?1:0);t.suffix=i>0?e.substring(a,r):"",t.mask=e.substring(n,a),t.maskHasNegativeSign=t.mask.charAt(0)==="-",t.maskHasPositiveSign=t.mask.charAt(0)==="+";let c=t.mask.match(zi);return t.decimal=c&&c[c.length-1]||".",t.separator=c&&c[1]&&c[0]||",",c=t.mask.split(t.decimal),t.integer=c[0],t.fraction=c[1],t}function Qi(e,t,r){let n=!1,i={value:e};e<0&&(n=!0,i.value=-i.value),i.sign=n?"-":"",i.value=Number(i.value).toFixed(t.fraction&&t.fraction.length),i.value=Number(i.value).toString();let o=t.fraction&&t.fraction.lastIndexOf("0"),[s="0",a=""]=i.value.split(".");return(!a||a&&a.length<=o)&&(a=o<0?"":(+("0."+a)).toFixed(o+1).replace("0.","")),i.integer=s,i.fraction=a,Ji(i,t),(i.result==="0"||i.result==="")&&(n=!1,i.sign=""),!n&&t.maskHasPositiveSign?i.sign="+":n&&t.maskHasPositiveSign?i.sign="-":n&&(i.sign=r&&r.enforceMaskSign&&!t.maskHasNegativeSign?"":"-"),i}function Ji(e,t){e.result="";let r=t.integer.split(t.separator),n=r.join(""),i=n&&n.indexOf("0");if(i>-1)for(;e.integer.lengthMath.round(e*20)/20},zt=(e,t)=>({accept:e,round:t}),no=[zt(({divisor:e,price:t})=>t%e==0,({divisor:e,price:t})=>t/e),zt(({usePrecision:e})=>e,({divisor:e,price:t})=>Math.ceil(Math.floor(t*1e4/e)/100)/100),zt(()=>!0,({divisor:e,price:t})=>Math.ceil(Math.floor(t*100/e)/100))],yn={[N.YEAR]:{[L.MONTHLY]:Ke.MONTH,[L.ANNUAL]:Ke.YEAR},[N.MONTH]:{[L.MONTHLY]:Ke.MONTH}},io=(e,t)=>e.indexOf(`'${t}'`)===0,oo=(e,t=!0)=>{let r=e.replace(/'.*?'/,"").trim(),n=bn(r);return!!n?t||(r=r.replace(/[,\.]0+/,n)):r=r.replace(/\s?(#.*0)(?!\s)?/,"$&"+ao(e)),r},so=e=>{let t=co(e),r=io(e,t),n=e.replace(/'.*?'/,""),i=gn.test(n)||xn.test(n);return{currencySymbol:t,isCurrencyFirst:r,hasCurrencySpace:i}},vn=e=>e.replace(gn,En).replace(xn,En),ao=e=>e.match(/#(.?)#/)?.[1]===dn?eo:dn,co=e=>e.match(/'(.*?)'/)?.[1]??"",bn=e=>e.match(/0(.?)0/)?.[1]??"";function Tn({formatString:e,price:t,usePrecision:r,isIndianPrice:n=!1},i,o=s=>s){let{currencySymbol:s,isCurrencyFirst:a,hasCurrencySpace:c}=so(e),l=r?bn(e):"",u=oo(e,r),p=r?2:0,f=o(t,{currencySymbol:s}),m=n?f.toLocaleString("hi-IN",{minimumFractionDigits:p,maximumFractionDigits:p}):hn(u,f),h=r?m.lastIndexOf(l):m.length,v=m.substring(0,h),x=m.substring(h+1);return{accessiblePrice:e.replace(/'.*?'/,"SYMBOL").replace(/#.*0/,m).replace(/SYMBOL/,s),currencySymbol:s,decimals:x,decimalsDelimiter:l,hasCurrencySpace:c,integer:v,isCurrencyFirst:a,recurrenceTerm:i}}var Sn=e=>{let{commitment:t,term:r,usePrecision:n}=e,i=to[r]??1;return Tn(e,i>1?Ke.MONTH:yn[t]?.[r],(o,{currencySymbol:s})=>{let a={divisor:i,price:o,usePrecision:n},{round:c}=no.find(({accept:u})=>u(a));if(!c)throw new Error(`Missing rounding rule for: ${JSON.stringify(a)}`);return(ro[s]??(u=>u))(c(a))})},Pn=({commitment:e,term:t,...r})=>Tn(r,yn[e]?.[t]);var uo={recurrenceLabel:"{recurrenceTerm, select, MONTH {/mo} YEAR {/yr} other {}}",recurrenceAriaLabel:"{recurrenceTerm, select, MONTH {per month} YEAR {per year} other {}}",perUnitLabel:"{perUnit, select, LICENSE {per license} other {}}",perUnitAriaLabel:"{perUnit, select, LICENSE {per license} other {}}",freeLabel:"Free",freeAriaLabel:"Free",taxExclusiveLabel:"{taxTerm, select, GST {excl. GST} VAT {excl. VAT} TAX {excl. tax} IVA {excl. IVA} SST {excl. SST} KDV {excl. KDV} other {}}",taxInclusiveLabel:"{taxTerm, select, GST {incl. GST} VAT {incl. VAT} TAX {incl. tax} IVA {incl. IVA} SST {incl. SST} KDV {incl. KDV} other {}}",alternativePriceAriaLabel:"Alternatively at {alternativePrice}",strikethroughAriaLabel:"Regularly at {strikethroughPrice}"},lo=Gr("ConsonantTemplates/price"),fo=/<.+?>/g,D={container:"price",containerOptical:"price-optical",containerStrikethrough:"price-strikethrough",disabled:"disabled",currencySpace:"price-currency-space",currencySymbol:"price-currency-symbol",decimals:"price-decimals",decimalsDelimiter:"price-decimals-delimiter",integer:"price-integer",recurrence:"price-recurrence",taxInclusivity:"price-tax-inclusivity",unitType:"price-unit-type"},ae={perUnitLabel:"perUnitLabel",perUnitAriaLabel:"perUnitAriaLabel",recurrenceLabel:"recurrenceLabel",recurrenceAriaLabel:"recurrenceAriaLabel",taxExclusiveLabel:"taxExclusiveLabel",taxInclusiveLabel:"taxInclusiveLabel",strikethroughAriaLabel:"strikethroughAriaLabel"},po="TAX_EXCLUSIVE",mo=e=>Dr(e)?Object.entries(e).filter(([,t])=>he(t)||je(t)||t===!0).reduce((t,[r,n])=>t+` ${r}${n===!0?"":'="'+Ur(n)+'"'}`,""):"",W=(e,t,r,n=!1)=>`${n?vn(t):t??""}`;function ho(e,{accessibleLabel:t,currencySymbol:r,decimals:n,decimalsDelimiter:i,hasCurrencySpace:o,integer:s,isCurrencyFirst:a,recurrenceLabel:c,perUnitLabel:l,taxInclusivityLabel:u},p={}){let f=W(D.currencySymbol,r),m=W(D.currencySpace,o?" ":""),h="";return a&&(h+=f+m),h+=W(D.integer,s),h+=W(D.decimalsDelimiter,i),h+=W(D.decimals,n),a||(h+=m+f),h+=W(D.recurrence,c,null,!0),h+=W(D.unitType,l,null,!0),h+=W(D.taxInclusivity,u,!0),W(e,h,{...p,"aria-label":t})}var ve=({displayOptical:e=!1,displayStrikethrough:t=!1}={})=>({country:r,displayFormatted:n=!0,displayRecurrence:i=!0,displayPerUnit:o=!1,displayTax:s=!1,language:a,literals:c={}}={},{commitment:l,formatString:u,price:p,priceWithoutDiscount:f,taxDisplay:m,taxTerm:h,term:v,usePrecision:x}={},w={})=>{Object.entries({country:r,formatString:u,language:a,price:p}).forEach(([Z,vt])=>{if(vt==null)throw new Error(`Argument "${Z}" is missing`)});let A={...uo,...c},y=`${a.toLowerCase()}-${r.toUpperCase()}`;function _(Z,vt){let bt=A[Z];if(bt==null)return"";try{return new pn(bt.replace(fo,""),y).format(vt)}catch{return lo.error("Failed to format literal:",bt),""}}let P=t&&f?f:p,{accessiblePrice:U,recurrenceTerm:k,...C}=(e?Sn:Pn)({commitment:l,formatString:u,term:v,price:e?p:P,usePrecision:x,isIndianPrice:r==="IN"}),G=U,J="";if(T(i)&&k){let Z=_(ae.recurrenceAriaLabel,{recurrenceTerm:k});Z&&(G+=" "+Z),J=_(ae.recurrenceLabel,{recurrenceTerm:k})}let K="";if(T(o)){K=_(ae.perUnitLabel,{perUnit:"LICENSE"});let Z=_(ae.perUnitAriaLabel,{perUnit:"LICENSE"});Z&&(G+=" "+Z)}let V="";T(s)&&h&&(V=_(m===po?ae.taxExclusiveLabel:ae.taxInclusiveLabel,{taxTerm:h}),V&&(G+=" "+V)),t&&(G=_(ae.strikethroughAriaLabel,{strikethroughPrice:G}));let z=D.container;if(e&&(z+=" "+D.containerOptical),t&&(z+=" "+D.containerStrikethrough),T(n))return ho(z,{...C,accessibleLabel:G,recurrenceLabel:J,perUnitLabel:K,taxInclusivityLabel:V},w);let{currencySymbol:fe,decimals:ke,decimalsDelimiter:yt,hasCurrencySpace:Sr,integer:Bn,isCurrencyFirst:$n}=C,pe=[Bn,yt,ke];$n?(pe.unshift(Sr?"\xA0":""),pe.unshift(fe)):(pe.push(Sr?"\xA0":""),pe.push(fe)),pe.push(J,K,V);let qn=pe.join("");return W(z,qn,w)},An=()=>(e,t,r)=>{let i=(e.displayOldPrice===void 0||T(e.displayOldPrice))&&t.priceWithoutDiscount&&t.priceWithoutDiscount!=t.price;return`${ve()(e,t,r)}${i?" "+ve({displayStrikethrough:!0})(e,t,r):""}`};var Zt=ve(),Qt=An(),Jt=ve({displayOptical:!0}),Kt=ve({displayStrikethrough:!0});var Eo=(e,t)=>{if(!(!ge(e)||!ge(t)))return Math.floor((t-e)/t*100)},_n=()=>(e,t,r)=>{let{price:n,priceWithoutDiscount:i}=t,o=Eo(n,i);return o===void 0?'':`${o}%`};var er=_n();var tr="ABM",rr="PUF",nr="M2M",ir="PERPETUAL",go="TAX_INCLUSIVE_DETAILS",xo="TAX_EXCLUSIVE",wn={ABM:tr,PUF:rr,M2M:nr,PERPETUAL:ir},Na={[tr]:{commitment:N.YEAR,term:L.MONTHLY},[rr]:{commitment:N.YEAR,term:L.ANNUAL},[nr]:{commitment:N.MONTH,term:L.MONTHLY},[ir]:{commitment:N.PERPETUAL,term:void 0}},On="Value is not an offer",or=e=>{if(typeof e!="object")return On;let{commitment:t,term:r}=e,n=yo(t,r);return{...e,planType:n}};var yo=(e,t)=>{if(e===void 0)return On;if(e===""&&t==="")return"";let r="";return e===N.YEAR?t===L.MONTHLY?r=tr:t===L.ANNUAL&&(r=rr):e===N.MONTH?t===L.MONTHLY&&(r=nr):e===N.PERPETUAL&&(r=ir),r};function sr(e){let{priceDetails:t}=e,{price:r,priceWithoutDiscount:n,priceWithoutTax:i,priceWithoutDiscountAndTax:o,taxDisplay:s}=t;if(s!==go)return e;let a={...e,priceDetails:{...t,price:i??r,priceWithoutDiscount:o??n,taxDisplay:xo}};return a.offerType==="TRIAL"&&a.priceDetails.price===0&&(a.priceDetails.price=a.priceDetails.priceWithoutDiscount),a}var{freeze:te}=Object,j=te({...ne}),H=te({...ee}),X=te({...F}),ar=te({...N}),be=te({...we}),Me=te({...re}),cr=te({...wn}),ur=te({...L});var hr={};zn(hr,{CLASS_NAME_FAILED:()=>et,CLASS_NAME_PENDING:()=>tt,CLASS_NAME_RESOLVED:()=>rt,ERROR_MESSAGE_BAD_REQUEST:()=>lr,ERROR_MESSAGE_MISSING_LITERALS_URL:()=>pr,ERROR_MESSAGE_OFFER_NOT_FOUND:()=>fr,EVENT_TYPE_ERROR:()=>vo,EVENT_TYPE_FAILED:()=>nt,EVENT_TYPE_PENDING:()=>it,EVENT_TYPE_READY:()=>ce,EVENT_TYPE_RESOLVED:()=>ot,LOG_NAMESPACE:()=>mr,STATE_FAILED:()=>B,STATE_PENDING:()=>$,STATE_RESOLVED:()=>q,TAG_NAME_COMMERCE_SERVICE:()=>ue});var et="placeholder-failed",tt="placeholder-pending",rt="placeholder-resolved",lr="Bad WCS request",fr="Commerce offer not found",pr="Literals URL not provided",vo="wcms:commerce:error",nt="wcms:placeholder:failed",it="wcms:placeholder:pending",ce="wcms:commerce:ready",ot="wcms:placeholder:resolved",mr="wcms/commerce",B="failed",$="pending",q="resolved",ue="wcms-commerce";var dr={delimiter:"\xB6",ignoredProperties:["analytics","literals"],serializableTypes:["Array","Object"],sampleRate:100,tags:"consumer=milo/commerce"},Ln=new Set,bo=e=>e instanceof Error||typeof e.originatingRequest=="string";function Cn(e){if(e==null)return;let t=typeof e;if(t==="function"){let{name:r}=e;return r?`${t} ${r}`:t}if(t==="object"){if(e instanceof Error)return e.message;if(typeof e.originatingRequest=="string"){let{message:n,originatingRequest:i,status:o}=e;return[n,o,i].filter(s=>s).join(" ")}let r=e[Symbol.toStringTag]??Object.getPrototypeOf(e).constructor.name;if(!dr.serializableTypes.includes(r))return r}return e}function To(e,t){if(!dr.ignoredProperties.includes(e))return Cn(t)}var Er={append(e){let{delimiter:t,sampleRate:r,tags:n}=dr,{message:i,params:o}=e,s=[],a=i,c=[];o.forEach(p=>{p!=null&&(bo(p)?s:c).push(p)}),s.length&&(a+=" ",a+=s.map(Cn).join(" "));let{pathname:l,search:u}=window.location;a+=`${t}page=`,a+=l+u,c.length&&(a+=`${t}facts=`,a+=JSON.stringify(c,To)),Ln.has(a)||(Ln.add(a),window.lana.log(a,{sampleRate:r,tags:n}))}};var b=Object.freeze({checkoutClientId:"adobe_com",checkoutWorkflow:j.V3,checkoutWorkflowStep:H.EMAIL,country:"US",displayOldPrice:!0,displayPerUnit:!1,displayRecurrence:!0,displayTax:!1,env:X.PRODUCTION,forceTaxExclusive:!1,language:"en",promotionCode:"",quantity:1,wcsApiKey:"wcms-commerce-ims-ro-user-milo",wcsBufferDelay:1,wcsEnv:be.PRODUCTION,wcsLandscape:Me.PUBLISHED,wcsBufferLimit:1});function Nn(e,{country:t,forceTaxExclusive:r,perpetual:n}){let i;if(e.length<2)i=e;else{let o=t==="GB"||n?"EN":"MULT",[s,a]=e;i=[s.language===o?s:a]}return r&&(i=i.map(sr)),i}var le=e=>setTimeout(e,0);function Te(e,t=1){if(e==null)return[t];let r=(Array.isArray(e)?e:String(e).split(",")).map(ye).filter(ge);return r.length||(r=[t]),r}function st(e){return e==null?[]:(Array.isArray(e)?e:String(e).split(",")).filter(Rt)}var So="en-US",Po={africa:"en-ZA",mena_en:"en-DZ",il_he:"iw-IL",mena_ar:"ar-DZ",id_id:"in-ID",no:"nb-NO"},Se=Object.freeze({LOCAL:"local",PROD:"prod",STAGE:"stage"}),Ao=["ar","bg","cs","da","de","en","es","et","fi","fr","he","hu","it","ja","ko","lt","lv","nb","nl","pl","pt","ro","ru","sk","sl","sv","tr","uk","zh_CN","zh_TW"];function In({locale:e={}}={}){let t=Po[e.prefix??""]??e.ietf??So,[r=b.language,n=b.country]=t.split("-",2);return n=n.toUpperCase(),r=(Ao.some(i=>de(i,r))?r:b.language).toLowerCase(),{country:n,language:r,locale:`${r}_${n}`}}function gr({commerce:e={},locale:t=void 0}={}){let n=Q(O("commerce.env",e,{metadata:!1}),Se,Se.PROD)===Se.PROD?X.PRODUCTION:X.STAGE,i=O("checkoutClientId",e)??b.checkoutClientId,o=Q(O("checkoutWorkflow",e),j,b.checkoutWorkflow),s=H.CHECKOUT;o===j.V3&&(s=Q(O("checkoutWorkflowStep",e),H,b.checkoutWorkflowStep));let a=T(O("displayOldPrice",e),b.displayOldPrice),c=T(O("displayPerUnit",e),b.displayPerUnit),l=T(O("displayRecurrence",e),b.displayRecurrence),u=T(O("displayTax",e),b.displayTax),p=T(O("forceTaxExclusive",e),b.forceTaxExclusive),f=O("promotionCode",e)??b.promotionCode,m=Te(O("quantity",e)),h=O("wcsApiKey",e)??b.wcsApiKey,v=Q(O("wcsLandscape",e),Me,b.wcsLandscape),x=ye(O("wcsBufferDelay",e),b.wcsBufferDelay),w=ye(O("wcsBufferLimit",e),b.wcsBufferLimit);return{...In({locale:t}),displayOldPrice:a,checkoutClientId:i,checkoutWorkflow:o,checkoutWorkflowStep:s,displayPerUnit:c,displayRecurrence:l,displayTax:u,env:n,forceTaxExclusive:p,priceLiteralsURL:e.priceLiteralsURL,promotionCode:f,quantity:m,wcsApiKey:h,wcsBufferDelay:x,wcsBufferLimit:w,wcsEnv:n===X.STAGE?be.STAGE:be.PRODUCTION,wcsLandscape:v}}var Un="debug",_o="error",wo="info",Oo="warn",Lo=Date.now(),xr=new Set,yr=new Set,Rn=new Map,De=Object.freeze({DEBUG:Un,ERROR:_o,INFO:wo,WARN:Oo}),Mn={append({level:e,message:t,params:r,timestamp:n,source:i}){console[e](`${n}ms [${i}] %c${t}`,"font-weight: bold;",...r)}},Dn={filter:({level:e})=>e!==Un},Co={filter:()=>!1};function No(e,t,r,n,i){return{level:e,message:t,namespace:r,get params(){if(n.length===1){let[o]=n;ie(o)&&(n=o(),Array.isArray(n)||(n=[n]))}return n},source:i,timestamp:Date.now()-Lo}}function Io(e){[...yr].every(t=>t(e))&&xr.forEach(t=>t(e))}function kn(e){let t=(Rn.get(e)??0)+1;Rn.set(e,t);let r=`${e} #${t}`,n=o=>(s,...a)=>Io(No(o,s,e,a,r)),i=Object.seal({id:r,namespace:e,module(o){return kn(`${i.namespace}/${o}`)},debug:n(De.DEBUG),error:n(De.ERROR),info:n(De.INFO),warn:n(De.WARN)});return i}function at(...e){e.forEach(t=>{let{append:r,filter:n}=t;ie(n)?yr.add(n):ie(r)&&xr.add(r)})}function Ro(e={}){let{name:t}=e,r=T(O("commerce.debug",{search:!0,storage:!0}),t===Se.LOCAL);return at(r?Mn:Dn),t===Se.PROD&&at(Er),R}function Uo(){xr.clear(),yr.clear()}var R={...kn(mr),Level:De,Plugins:{consoleAppender:Mn,debugFilter:Dn,quietFilter:Co,lanaAppender:Er},init:Ro,reset:Uo,use:at};var Mo={CLASS_NAME_FAILED:et,CLASS_NAME_PENDING:tt,CLASS_NAME_RESOLVED:rt,EVENT_TYPE_FAILED:nt,EVENT_TYPE_PENDING:it,EVENT_TYPE_RESOLVED:ot,STATE_FAILED:B,STATE_PENDING:$,STATE_RESOLVED:q},Do={[B]:et,[$]:tt,[q]:rt},ko={[B]:nt,[$]:it,[q]:ot},lt=new WeakMap;function M(e){if(!lt.has(e)){let t=R.module(e.constructor.is);lt.set(e,{changes:new Map,connected:!1,dispose:Ee,error:void 0,log:t,options:void 0,promises:[],state:$,timer:null,value:void 0,version:0})}return lt.get(e)}function ct(e){let t=M(e),{error:r,promises:n,state:i}=t;(i===q||i===B)&&(t.promises=[],i===q?n.forEach(({resolve:o})=>o(e)):i===B&&n.forEach(({reject:o})=>o(r))),e.dispatchEvent(new CustomEvent(ko[i],{bubbles:!0}))}function ut(e){let t=lt.get(e);[B,$,q].forEach(r=>{e.classList.toggle(Do[r],r===t.state)})}var Go={get error(){return M(this).error},get log(){return M(this).log},get options(){return M(this).options},get state(){return M(this).state},get value(){return M(this).value},attributeChangedCallback(e,t,r){M(this).changes.set(e,r),this.requestUpdate()},connectedCallback(){let e=M(this),t=()=>this.requestUpdate(!0);document.addEventListener(ce,t),e.dispose=()=>{document.removeEventListener(ce,t)},t()},disconnectedCallback(){let e=M(this);e.connected&&(e.connected=!1,e.log.debug("Disconnected:",{element:this})),e.dispose(),e.dispose=Ee},onceSettled(){let{error:e,promises:t,state:r}=M(this);return q===r?Promise.resolve(this):B===r?Promise.reject(e):new Promise((n,i)=>{t.push({resolve:n,reject:i})})},toggleResolved(e,t,r){let n=M(this);return e!==n.version?!1:(r!==void 0&&(n.options=r),n.state=q,n.value=t,ut(this),this.log.debug("Resolved:",{element:this,value:t}),le(()=>ct(this)),!0)},toggleFailed(e,t,r){let n=M(this);return e!==n.version?!1:(r!==void 0&&(n.options=r),n.error=t,n.state=B,ut(this),n.log.error("Failed:",{element:this,error:t}),le(()=>ct(this)),!0)},togglePending(e){let t=M(this);return t.version++,e&&(t.options=e),t.state=$,ut(this),le(()=>ct(this)),t.version},requestUpdate(e=!1){if(!this.isConnected)return;let t=M(this);if(t.timer)return;let{error:r,options:n,state:i,value:o,version:s}=t;t.state=$,t.timer=le(async()=>{t.timer=null;let a=null;if(t.changes.size&&(a=Object.fromEntries(t.changes.entries()),t.changes.clear()),t.connected?t.log.debug("Updated:",{element:this,changes:a}):(t.connected=!0,t.log.debug("Connected:",{element:this,changes:a})),a||e)try{await this.render?.()===!1&&t.state===$&&t.version===s&&(t.state=i,t.error=r,t.value=o,ut(this),ct(this))}catch(c){this.toggleFailed(t.version,c,n)}})}};function Gn(e={}){return Object.entries(e).forEach(([t,r])=>{(r==null||r===""||r?.length===0)&&delete e[t]}),e}function ft(e,t={}){let{tag:r,is:n}=e,i=document.createElement(r,{is:n});return i.setAttribute("is",n),Object.assign(i.dataset,Gn(t)),i}function pt(e){let{tag:t,is:r,prototype:n}=e,i=window.customElements.get(r);return i||(Object.defineProperties(n,Object.getOwnPropertyDescriptors(Go)),i=Object.defineProperties(e,Object.getOwnPropertyDescriptors(Mo)),window.customElements.define(r,i,{extends:t})),i}function mt(e,t=document.body){return Array.from(t?.querySelectorAll(`${e.tag}[is="${e.is}"]`)??[])}function ht(e,t={}){return e instanceof HTMLElement?(Object.assign(e.dataset,Gn(t)),e):null}function Fn({providers:e,settings:t}){let r=R.module("checkout");function n(a,c){let{checkoutClientId:l,checkoutWorkflow:u,checkoutWorkflowStep:p,country:f,language:m,promotionCode:h,quantity:v}=t,{checkoutMarketSegment:x,checkoutWorkflow:w=u,checkoutWorkflowStep:A=p,imsCountry:y,country:_=y??f,language:P=m,quantity:U=v,perpetual:k,promotionCode:C=h,wcsOsi:G,...J}=Object.assign({},c?.dataset??{},a??{}),K=Q(w,j,b.checkoutWorkflow),V=H.CHECKOUT;K===j.V3&&(V=Q(A,H,b.checkoutWorkflowStep));let z=xe({...J,checkoutClientId:l,checkoutMarketSegment:x,country:_,quantity:Te(U,b.quantity),checkoutWorkflow:K,checkoutWorkflowStep:V,language:P,perpetual:T(k),promotionCode:Le(C).effectivePromoCode,wcsOsi:st(G)});if(c)for(let fe of e.checkout)fe(c,z);return z}function i(a,c){if(!Array.isArray(a)||!a.length||!c)return"";let{env:l}=t,{checkoutClientId:u,checkoutMarketSegment:p,checkoutWorkflow:f,checkoutWorkflowStep:m,country:h,promotionCode:v,quantity:x,...w}=n(c),A=window.frameElement?"if":"fp",y={checkoutPromoCode:v,clientId:u,context:A,country:h,env:l,items:[],marketSegment:p,workflowStep:m,...w};if(a.length===1){let{offerId:P,offerType:U,productArrangementCode:k}=a[0],{marketSegments:[C]}=a[0];Object.assign(y,{marketSegment:C,offerType:U,productArrangementCode:k}),y.items.push(x[0]===1?{id:P}:{id:P,quantity:x[0]})}else y.items.push(...a.map(({offerId:P},U)=>({id:P,quantity:x[U]??b.quantity})));return _t(f,y)}let{createCheckoutLink:o,getCheckoutLinks:s}=dt;return{CheckoutLink:dt,CheckoutWorkflow:j,CheckoutWorkflowStep:H,buildCheckoutURL:i,collectCheckoutOptions:n,createCheckoutLink:o,getCheckoutLinks:s}}function Fo({interval:e=200,maxAttempts:t=25}={}){let r=R.module("ims");return new Promise(n=>{r.debug("Getting user country");let i=0;function o(){window.adobeIMS?window.adobeIMS.isSignedInUser()?window.adobeIMS.getProfile().then(({countryCode:s})=>{r.debug("Got user country:",s),n(s)},s=>{r.error("Unable to get user country:",s),n()}):(r.debug("User is not signed in"),n()):++i>t?(r.debug("Timeout"),n()):setTimeout(o,e)}o()})}function Vn({}){return{imsCountry:Fo()}}async function Wn(e){if(!e.priceLiteralsURL)throw new Error(pr);let t=await window.fetch(e.priceLiteralsURL),{data:r}=await t.json();if(Array.isArray(r)){let n=o=>r.find(s=>de(s.lang,o)),i=n(e.language)??n(b.language);if(i)return Object.freeze(i)}return{}}var Pe=class Pe extends HTMLSpanElement{static get observedAttributes(){return["data-display-old-price","data-display-per-unit","data-display-recurrence","data-display-tax","data-perpetual","data-promotion-code","data-tax-exclusive","data-template","data-wcs-osi"]}static createInlinePrice(t){let r=Y();if(!r)return null;let{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}=r.collectPriceOptions(t);return ft(Pe,{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f})}static getInlinePrices(t){return mt(Pe,t)}get isInlinePrice(){return!0}get placeholder(){return this}async render(t={}){if(!this.isConnected)return!1;let r=Y();if(!r)return!1;let n=r.collectPriceOptions(t,this.placeholder);if(!n.wcsOsi.length)return!1;let i=this.placeholder.togglePending(n);this.innerHTML="";let[o]=r.resolveOfferSelectors(n);return this.renderOffers(Nn(await o,n),n,i)}renderOffers(t,r={},n=void 0){if(!this.isConnected)return;let i=Y();if(!i)return!1;let o=i.collectPriceOptions({...this.dataset,...r});if(n??(n=this.placeholder.togglePending(o)),t.length){if(this.placeholder.toggleResolved(n,t,o))return this.innerHTML=i.buildPriceHTML(t,o),!0}else{let s=new Error(`Not provided: ${o?.wcsOsi??"-"}`);if(this.placeholder.toggleFailed(n,s,o))return this.innerHTML="",!0}return!1}updateOptions(t){let r=Y();if(!r)return!1;let{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}=r.collectPriceOptions(t);return ht(this,{displayOldPrice:n,displayPerUnit:i,displayRecurrence:o,displayTax:s,forceTaxExclusive:a,perpetual:c,promotionCode:l,quantity:u,template:p,wcsOsi:f}),!0}};me(Pe,"is","inline-price"),me(Pe,"tag","span");var vr=Pe,Et=pt(vr);function jn({literals:e,providers:t,settings:r}){function n(a,c){let{country:l,displayOldPrice:u,displayPerUnit:p,displayRecurrence:f,displayTax:m,forceTaxExclusive:h,language:v,promotionCode:x,quantity:w}=r,{displayOldPrice:A=u,displayPerUnit:y=p,displayRecurrence:_=f,displayTax:P=m,forceTaxExclusive:U=h,country:k=l,language:C=v,perpetual:G,promotionCode:J=x,quantity:K=w,template:V,wcsOsi:z,...fe}=Object.assign({},c?.dataset??{},a??{}),ke=xe({...fe,country:k,displayOldPrice:T(A),displayPerUnit:T(y),displayRecurrence:T(_),displayTax:T(P),forceTaxExclusive:T(U),language:C,perpetual:T(G),promotionCode:Le(J).effectivePromoCode,quantity:Te(K,b.quantity),template:V,wcsOsi:st(z)});if(c)for(let yt of t.price)yt(c,ke);return ke}function i(a,c){if(!Array.isArray(a)||!a.length||!c)return"";let{template:l}=c,u;switch(l){case"discount":u=er;break;case"strikethrough":u=Kt;break;case"optical":u=Jt;break;default:u=c.promotionCode?Qt:Zt}let p=n(c);p.literals=Object.assign({},e.price,xe(c.literals??{}));let[f]=a;return f={...f,...f.priceDetails},u(p,f)}let{createInlinePrice:o,getInlinePrices:s}=Et;return{InlinePrice:Et,buildPriceHTML:i,collectPriceOptions:n,createInlinePrice:o,getInlinePrices:s}}var Vo={[X.PRODUCTION]:"https://wcs.adobe.com",[X.STAGE]:"https://wcs.stage.adobe.com"};function Hn({settings:e}){let t=R.module("wcs"),{env:r,wcsApiKey:n}=e,i={apiKey:n,baseUrl:Vo[r],fetch:window.fetch.bind(window)},o=We(i),s=new Map,a=new Map,c;async function l(f,m,h=!0){let v=fr;try{t.debug("Fetching:",f),f.offerSelectorIds=f.offerSelectorIds.sort();let{data:x}=await o(f,{apiKey:n,environment:e.wcsEnv,landscape:r===X.STAGE?"ALL":e.wcsLandscape},({resolvedOffers:A})=>({offers:A.map(or)}));t.debug("Fetched:",f,x);let{offers:w}=x??{};m.forEach(({resolve:A},y)=>{let _=w.filter(({offerSelectorIds:P})=>P.includes(y)).flat();_.length&&(m.delete(y),A(_))})}catch(x){x.status===404&&f.offerSelectorIds.length>1?(t.debug("Multi-osi 404, fallback to fetch-by-one strategy"),await Promise.allSettled(f.offerSelectorIds.map(w=>l({...f,offerSelectorIds:[w]},m,!1)))):(t.error("Failed:",f,x),v=lr)}h&&m.size&&(t.debug("Missing:",{offerSelectorIds:[...m.keys()]}),m.forEach(x=>{x.reject(new Error(v))}))}function u(){clearTimeout(c);let f=[...a.values()];a.clear(),f.forEach(({options:m,promises:h})=>l(m,h))}function p({country:f,language:m,perpetual:h=!1,promotionCode:v="",wcsOsi:x=[]}){let w=`${m}_${f}`;f!=="GB"&&(m=h?"EN":"MULT");let A=[f,m,v].filter(y=>y).join("-").toLowerCase();return x.map(y=>{let _=`${y}-${A}`;if(!s.has(_)){let P=new Promise((U,k)=>{let C=a.get(A);C||(C={options:{country:f,language:m,locale:w,offerSelectorIds:[]},promises:new Map},a.set(A,C)),v&&(C.options.promotionCode=v),C.options.offerSelectorIds.push(y),C.promises.set(y,{resolve:U,reject:k}),C.options.offerSelectorIds.length>=e.wcsBufferLimit?u():(t.debug("Queued:",C.options),c||(c=setTimeout(u,e.wcsBufferDelay)))});s.set(_,P)}return s.get(_)})}return{WcsCommitment:ar,WcsPlanType:cr,WcsTerm:ur,resolveOfferSelectors:p}}var gt,xt=null,br=class extends HTMLElement{get isWcmsCommerce(){return!0}};window.customElements.define(ue,br);async function Wo(e){let t=R.init(e.env).module("service");t.debug("Activating:",e);let r={price:{}},n=Object.freeze(gr(e));try{r.price=await Wn(n)}catch(a){t.warn("Price literals were not fetched:",a)}let i={checkout:new Set,price:new Set},o=document.createElement(ue),s={literals:r,providers:i,settings:n};return gt=Object.defineProperties(o,Object.getOwnPropertyDescriptors({...Fn(s),...Vn(s),...jn(s),...Hn(s),...hr,Log:R,get defaults(){return b},get literals(){return r},get log(){return R},get providers(){return{checkout(a){return i.checkout.add(a),()=>i.checkout.delete(a)},price(a){return i.price.add(a),()=>i.price.delete(a)}}},get settings(){return n}})),t.debug("Activated:",{literals:r,settings:n,element:o}),document.head.append(o),le(()=>{let a=new CustomEvent(ce,{bubbles:!0,cancelable:!1,detail:gt});gt.dispatchEvent(a)}),gt}function Xn(){document.head.querySelector(ue)?.remove(),xt=null,R.reset()}function jo(e,t=!1){return ie(e)?(t&&Xn(),xt??(xt=Wo(e()))):xt||new Promise(r=>{let n=i=>{r(i.detail)};document.head.addEventListener(ce,n,{once:!0})})}function Y(){return document.head.querySelector(ue)}var Ae=class Ae extends HTMLAnchorElement{static get observedAttributes(){return["data-checkout-workflow","data-checkout-workflow-step","data-ims-country","data-perpetual","data-promotion-code","data-quantity","data-template","data-wcs-osi"]}static createCheckoutLink(t={},r=""){let n=Y();if(!n)return null;let{checkoutMarketSegment:i,checkoutWorkflow:o,checkoutWorkflowStep:s,perpetual:a,promotionCode:c,quantity:l,wcsOsi:u}=n.collectCheckoutOptions(t),p=ft(Ae,{checkoutMarketSegment:i,checkoutWorkflow:o,checkoutWorkflowStep:s,perpetual:a,promotionCode:c,quantity:l,wcsOsi:u});return r&&(p.innerHTML=r),p}static getCheckoutLinks(t){return mt(Ae,t)}get isCheckoutLink(){return!0}get placeholder(){return this}async render(t={}){if(!this.isConnected)return!1;let r=Y();if(!r)return!1;this.dataset.imsCountry||r.imsCountry.then(s=>{s&&(this.dataset.imsCountry=s)},Ee);let n=r.collectCheckoutOptions(t,this.placeholder);if(!n.wcsOsi.length)return!1;let i=this.placeholder.togglePending(n);this.href="";let o=r.resolveOfferSelectors(n);return this.renderOffers((await Promise.all(o)).flat(),n,i)}renderOffers(t,r={},n=void 0){if(!this.isConnected)return!1;let i=Y();if(!i)return!1;let o=i.collectCheckoutOptions(r,this.placeholder);if(n??(n=this.placeholder.togglePending(o)),t.length){if(this.placeholder.toggleResolved(n,t,o))return this.href=i.buildCheckoutURL(t,o),!0}else{let s=new Error(`Not provided: ${o?.wcsOsi??"-"}`);if(this.placeholder.toggleFailed(n,s,o))return this.href="",!0}return!1}updateOptions(t={}){let r=Y();if(!r)return!1;let{checkoutMarketSegment:n,checkoutWorkflow:i,checkoutWorkflowStep:o,perpetual:s,promotionCode:a,quantity:c,wcsOsi:l}=r.collectCheckoutOptions(t);return ht(this,{checkoutMarketSegment:n,checkoutWorkflow:i,checkoutWorkflowStep:o,perpetual:s,promotionCode:a,quantity:c,wcsOsi:l}),!0}};me(Ae,"is","checkout-link"),me(Ae,"tag","a");var Tr=Ae,dt=pt(Tr);export{dt as CheckoutLink,j as CheckoutWorkflow,H as CheckoutWorkflowStep,b as Defaults,Et as InlinePrice,R as Log,ue as TAG_NAME_COMMERCE_SERVICE,ar as WcsCommitment,be as WcsEnv,Me as WcsLandscape,cr as WcsPlanType,ur as WcsTerm,In as getLocaleSettings,gr as getSettings,jo as init,Xn as reset}; //# sourceMappingURL=commerce.js.map diff --git a/libs/deps/merch-card.js b/libs/deps/merch-card.js index 21ed0207c1..7014c1648c 100644 --- a/libs/deps/merch-card.js +++ b/libs/deps/merch-card.js @@ -526,7 +526,7 @@ merch-card.has-divider hr { margin-bottom: var(--spacing-xxs); } -merch-card[variant="special-offers"] span[is="inline-price"][data-template="priceStrikethrough"] { +merch-card[variant="special-offers"] span[is="inline-price"][data-template="strikethrough"] { font-size: var(--consonant-merch-card-body-xs-font-size); } diff --git a/test/blocks/merch/merch.test.js b/test/blocks/merch/merch.test.js index 78616d1347..b7a0f48906 100644 --- a/test/blocks/merch/merch.test.js +++ b/test/blocks/merch/merch.test.js @@ -2,6 +2,9 @@ import { readFile } from '@web/test-runner-commands'; import { expect } from '@esm-bundle/chai'; import merch, { + PRICE_TEMPLATE_DISCOUNT, + PRICE_TEMPLATE_OPTICAL, + PRICE_TEMPLATE_STRIKETHROUGH, buildCta, getCheckoutContext, priceLiteralsURL, @@ -30,9 +33,6 @@ const validatePriceSpan = async (selector, expectedAttributes) => { )); const { nodeName, dataset } = await el.onceSettled(); expect(nodeName).to.equal('SPAN'); - if (!expectedAttributes.template) { - expect(dataset.template).to.be.undefined; - } Object.keys(expectedAttributes).forEach((key) => { const value = expectedAttributes[key]; expect(dataset[key], ` ${key} should equal ${value}`).to.equal(value); @@ -69,7 +69,7 @@ describe('Merch Block', () => { expect(await merch(el)).to.be.null; }); - describe('Prices', () => { + describe('prices', () => { it('renders merch link to price without term (new)', async () => { await validatePriceSpan('.merch.price.hide-term', { displayRecurrence: 'false' }); }); @@ -91,11 +91,15 @@ describe('Merch Block', () => { }); it('renders merch link to strikethrough price with term, seat and tax', async () => { - await validatePriceSpan('.merch.price.strikethrough', { template: 'strikethrough' }); + await validatePriceSpan('.merch.price.strikethrough', { template: PRICE_TEMPLATE_STRIKETHROUGH }); }); it('renders merch link to optical price with term, seat and tax', async () => { - await validatePriceSpan('.merch.price.optical', { template: 'optical' }); + await validatePriceSpan('.merch.price.optical', { template: PRICE_TEMPLATE_OPTICAL }); + }); + + it('renders merch link to discount price', async () => { + await validatePriceSpan('.merch.price.discount', { template: PRICE_TEMPLATE_DISCOUNT }); }); it('renders merch link to tax exclusive price with tax exclusive attribute', async () => { @@ -103,13 +107,16 @@ describe('Merch Block', () => { }); }); - describe('Promo Prices', () => { + describe('promo prices', () => { it('renders merch link to promo price with discount', async () => { await validatePriceSpan('.merch.price.oldprice', { promotionCode: undefined }); }); it('renders merch link to promo price without discount', async () => { - await validatePriceSpan('.merch.strikethrough.oldprice', { template: 'strikethrough', promotionCode: undefined }); + await validatePriceSpan('.merch.strikethrough.oldprice', { + template: PRICE_TEMPLATE_STRIKETHROUGH, + promotionCode: undefined, + }); }); it('renders merch link to promo price with discount', async () => { @@ -121,13 +128,16 @@ describe('Merch Block', () => { }); }); - describe('Promo Prices in a fragment', () => { + describe('promo prices in a fragment', () => { it('renders merch link to promo price with discount', async () => { await validatePriceSpan('.fragment .merch.price.oldprice', { promotionCode: undefined }); }); it('renders merch link to promo price without discount', async () => { - await validatePriceSpan('.fragment .merch.strikethrough.oldprice', { template: 'strikethrough', promotionCode: undefined }); + await validatePriceSpan('.fragment .merch.strikethrough.oldprice', { + template: PRICE_TEMPLATE_STRIKETHROUGH, + promotionCode: undefined, + }); }); it('renders merch link to promo price with discount', async () => { @@ -279,7 +289,7 @@ describe('Merch Block', () => { }); }); - describe('Function "getCheckoutContext"', () => { + describe('function "getCheckoutContext"', () => { it('returns null if context params do not have osi', async () => { const el = document.createElement('a'); const params = new URLSearchParams(); @@ -287,7 +297,7 @@ describe('Merch Block', () => { }); }); - describe('Function "buildCta"', () => { + describe('function "buildCta"', () => { it('returns null if context params do not have osi', async () => { const el = document.createElement('a'); const params = new URLSearchParams(); diff --git a/test/blocks/merch/mocks/body.html b/test/blocks/merch/mocks/body.html index 02229bb355..ea03fb9fc8 100644 --- a/test/blocks/merch/mocks/body.html +++ b/test/blocks/merch/mocks/body.html @@ -39,6 +39,11 @@

Optical price

href="/tools/ost?osi=08&type=optical&seat=true&tax=true">Price - 632B3ADD940A7FBB7864AA5AD19B8D28 - All Apps

+

Discount price

+

Display term, seat and tax texts: Price - 632B3ADD940A7FBB7864AA5AD19B8D28 - All Apps +

+

Promo prices

Price without discount: Price - 632B3ADD940A7FBB7864AA5AD19B8D28 - All Apps -