1"use strict";(self.webpackChunktwilio_foundation_frontend=self.webpackChunktwilio_foundation_frontend||[]).push([[3261],{23261:function(t,e,r){r.r(e),r.d(e,{accordionExternalMethods:function(){return g},registerSlidersWrapper:function(){return E}});var n,i,a=r(97519),o=r(94598),s=r(68229);!function(t){t.DEFAULT="default",t.INSIDE_CUSTOMER_WINDOW="inside-customer-window"}(n||(n={})),function(t){t.SELF=".cmp-sliders-wrapper",t.MAIN_CONTENT=".cmp-sliders-wrapper__main",t.UNAVAILABLE_CONTENT=".cmp-sliders-wrapper__unavailable",t.EXPAND_BUTTON=".cmp-sliders-wrapper__main__button",t.ACCORDION_CONTENT=".cmp-sliders-wrapper__main__content",t.PARENT=".cmp-whatsapp-calculator",t.PARENT_COUNTRY_SELECTOR=".cmp-whatsapp-country-selector__wrapper__select",t.CALCULATION_TOTAL=".cmp-sliders-wrapper__main__button__price__value",t.META_FEES=".cmp-sliders-wrapper__main__content__fees__meta__paragraph__fee",t.META_FEES_TOTAL=".cmp-sliders-wrapper__main__content__fees__meta__paragraph__total",t.TWILIO_FEES=".cmp-sliders-wrapper__main__content__fees__twilio__paragraph__fee",t.TWILIO_FEES_TOTAL=".cmp-sliders-wrapper__main__content__fees__twilio__paragraph__total",t.TIER_DISCLAIMER_ELEMENT=".cmp-sliders-wrapper__main__content__fees__meta__paragraph__disclaimer[data-type='tier']",t.AUTH_DISCLAIMER_ELEMENT=".cmp-sliders-wrapper__main__content__fees__meta__paragraph__disclaimer[data-type='international-rates']",t.SLIDERS=".cmp-sliders-wrapper__main__content__slider__input-wrapper__input",t.SLIDER_WRAPPER=".cmp-sliders-wrapper__main__content__slider__input-wrapper",t.SLIDER_MESSAGE_COUNT=".cmp-sliders-wrapper__main__content__slider__title__messages",t.SLIDER_MAX_RANGE_TEXT=".cmp-sliders-wrapper__main__content__slider__input-wrapper__range__max",t.SLIDERS_DEFAULT='.cmp-sliders-wrapper__main__content__slider__input-wrapper__input[data-type="default"]',t.SLIDERS_INSIDE_CUSTOMER_WINDOW='.cmp-sliders-wrapper__main__content__slider__input-wrapper__input[data-type="inside-customer-window"]'}(i||(i={}));const c=new Map([["utility-accordion","utilityRates"],["authentication-accordion","authenticationRates"],["marketing-accordion","marketingRates"],["freeform-accordion","serviceRates"]]),l=new Intl.NumberFormat,u=(t,e)=>{const r=c.get(e??""),n=t?.dataset[r??""]??"[]",[i,a,o]=JSON.parse(n);return{messageFee:i??0,limit:a??0,available:o??!1}},_=t=>t?.querySelector(i.PARENT_COUNTRY_SELECTOR)?.selectedOptions.item(0),p=(t,e)=>{t&&(t.textContent=a.default.sanitize(e))},m=(t,e,r)=>{const n=_(e),{accordionType:a,calculationType:s}=t.dataset,{messageFee:c}=u(n,a),l=n?.dataset.fixedTwilioRate??e?.dataset.twilioRate,m={meta:c,twilio:Number(l??.005)},{customerWindowCalculator:d,defaultMessagesCalculator:h}=(t=>({defaultMessagesCalculator:e=>{const r=()=>e*t.twilio,n=()=>e*(t.meta??0);return{getTwilioTotal:r,getMetaTotal:n,getTotal:()=>r()+n()}},customerWindowCalculator:({insideCustomerWindow:e,outsideCustomerWindow:r})=>{const n=()=>(e+r)*t.twilio,i=()=>r*(t.meta??0);return{getTwilioTotal:n,getMetaTotal:i,getTotal:()=>n()+i()}}}))(m),g=(0,o.YW)(s).with("customer-window",()=>{const e=Number(t.querySelector(i.SLIDERS_INSIDE_CUSTOMER_WINDOW)?.value??"0"),r=Number(t.querySelector(i.SLIDERS_DEFAULT)?.value??"0");return d({insideCustomerWindow:e,outsideCustomerWindow:r})}).otherwise(()=>h(Number(t.querySelector(i.SLIDERS_DEFAULT)?.value??"0"))),E=t.querySelector(i.META_FEES_TOTAL),T=t.querySelector(i.TWILIO_FEES_TOTAL),f=t.querySelector(i.CALCULATION_TOTAL);p(E,r.twoDigit.format(g.getMetaTotal())),p(T,r.twoDigit.format(g.getTwilioTotal())),p(f,r.twoDigit.format(g.getTotal())),t.setAttribute("data-total",g.getTotal().toString())},d=(t,e)=>{const r=e.closest("label")?.querySelector(i.SLIDER_MESSAGE_COUNT),a=Number(e.value),o=Number(e.max);p(r,l.format(a)),e.dataset.type===n.DEFAULT&&(a>=o?t?.querySelector(i.TIER_DISCLAIMER_ELEMENT)?.toggleAttribute("hidden",!1):t?.querySelector(i.TIER_DISCLAIMER_ELEMENT)?.toggleAttribute("hidden",!0)),(t=>{const e=Number(t.min),r=Number(t.max),n=Number(t.value),i=Math.round(100*(n-e)/(r-e));t.style.cssText=`--track-position: ${i}%`})(e)},h=()=>
1{document.querySelectorAll(i.SELF).forEach(t=>{const e=t.closest(i.PARENT),r=e?.dataset.currencyFormat??s.O,n=(0,s.A)(r);$(t).on("input",i.SLIDERS,r=>{const i=r.target;d(t,i),m(t,e,n),t.dispatchEvent(new CustomEvent("calculationChange",{bubbles:!0}))}),t.querySelector(i.EXPAND_BUTTON)?.addEventListener("click",e=>{const r=e.currentTarget,n=t.querySelector(i.ACCORDION_CONTENT);if(n){const t="true"===r.getAttribute("aria-expanded");r.setAttribute("aria-expanded",String(!t)),n.toggleAttribute("hidden",t)}})})},g=(t,e)=>({updateRatesInfo:r=>{const n=r.querySelector(i.META_FEES),a=r.querySelector(i.TWILIO_FEES),o=_(t),{accordionType:s,noChargeText:c}=r.dataset,{hasAuthInternationalRates:h,fixedTwilioRate:g}=o?.dataset??{},{messageFee:E,limit:T,available:f}=u(o,s);r.querySelector(i.MAIN_CONTENT)?.toggleAttribute("hidden",!f),r.querySelector(i.UNAVAILABLE_CONTENT)?.toggleAttribute("hidden",f),p(n,E?e.tenDigit.format(E):c??"No charge");const S=Number(g??t.dataset.twilioRate??.005);p(a,e.tenDigit.format(S)),"true"===h?r.querySelector(i.AUTH_DISCLAIMER_ELEMENT)?.toggleAttribute("hidden",!1):r.querySelector(i.AUTH_DISCLAIMER_ELEMENT)?.toggleAttribute("hidden",!0),r.querySelectorAll(i.SLIDERS).forEach(t=>{t.value=f?Math.min(Number(t.value),T).toString():"0",t.max=f?T.toString():"0",d(r,t);const e=t.closest(i.SLIDER_WRAPPER)?.querySelector(i.SLIDER_MAX_RANGE_TEXT);p(e,`${l.format(T)}+`)}),m(r,t,e)},resetAccordion:r=>{r.querySelectorAll(i.SLIDERS).forEach(t=>{t.value="0",d(r,t)}),m(r,t,e)}}),E=()=>{"loading"!==document.readyState?h():window.addEventListener("load",()=>{h()})}},68229:function(t,e,r){r.d(e,{A:function(){return s},O:function(){return n}});const n="${pricing_value}",i=new Intl.NumberFormat("en-us",{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}),a=new Intl.NumberFormat("en-us",{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:10}),o=(t,e)=>({format:r=>t.replace("{pricing_value}",e.format(r))}),s=t=>({twoDigit:o(t,i),tenDigit:o(t,a)})},94598:function(t,e,r){r.d(e,{YW:function(){return I}});const n=Symbol.for("@ts-pattern/matcher"),i=Symbol.for("@ts-pattern/isVariadic"),a="@ts-pattern/anonymous-select-key",o=t=>Boolean(t&&"object"==typeof t),s=t=>t&&!!t[n],c=(t,e,r)=>{if(s(t)){const i=t[n](),{matched:a,selections:o}=i.match(e);return a&&o&&Object.keys(o).forEach(t=>r(t,o[t])),a}if(o(t)){if(!o(e))return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let n=[],a=[],o=[];for(const e of t.keys()){const r=t[e];s(r)&&r[i]?o.push(r):o.length?a.push(r):n.push(r)}if(o.length){if(o.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(e.length<n.length+a.length)return!1;const t=e.slice(0,n.length),i=0===a.length?[]:e.slice(-a.length),s=e.slice(n.length,0===a.length?1/0:-a.length);return n.every((e,n)=>c(e,t[n],r))&&a.every((t,e)=>c(t,i[e],r))&&(0===o.length||c(o[0],s,r))}return t.length===e.length&&t.every((t,n)=>c(t,e[n],r))}return Reflect.ownKeys(t).every(i=>{const a=t[i];return(i in e||s(o=a)&&"optional"===o[n]().matcherType)&&c(a,e[i],r);var o})}return Object.is(e,t)},l=t=>{var e,r,i;return o(t)?s(t)?null!=(e=null==(r=(i=t[n]()).getSelectionKeys)?void 0:r.call(i))?e:[]:Array.isArray(t)?u(t,l):u(Object.values(t),l):[]},u=(t,e)=>t.reduce((t,r)=>t.concat(e(r)),[]);function _(t){return Object.assign(t,{optional:()=>p(t),and:e=>m(t,e),or:e=>d(t,e),select:e=>void 0===e?g(t):g(e,t)})}function p(t){return _({[n]:()=>({match:e=>{let r={};const n=(t,e)=>{r[t]=e};return void 0===e?(l(t).forEach(t=>n(t,void 0)),{matched:!0,selections:r}):{matched:c(t,e,n),selections:r}},getSelectionKeys:()=>l(t),matcherType:"optional"})})}function m(...t){return _({[n]:()=>({match:e=>{let r={};const n=(t,e)=>{r[t]=e};return{matched:t.every(t=>c(t,e,n)),selections:r}},getSelectionKeys:()=>u(t,l),matcherType:"and"})})}function d(...t){return _({[n]:()=>({match:e=>{let r={};const n=(t,e)=>{r[t]=e};return u(t,l).forEach(t=>n(t,void 0)),{matched:t.some(t=>c(t,e,n)),selections:r}},getSelectionKeys:()=>u(t,l),matcherType:"or"})})}function h(t){return{[n]:()=>({match:e=>({matched:Boolean(t(e))})})}}function g(...t){const e="string"==typeof t[0]?t[0]:void 0,r=2===t.length?t[1]:"string"==typeof t[0]?void 0:t[0];return _({[n]:()=>({match:t=>{let n={[null!=e?e:a]:t};return{matched:void 0===r||c(r,t,(t,e)=>{n[t]=e}),selections:n}},getSelectionKeys:()=>[null!=e?e:a].concat(void 0===r?[]:l(r))})})}function E(t){return"number"==typeof t}function T(t){return"string"==typeof t}function f(t){return"bigint"==typeof t}_(h(function(t){return!0}));const S=t=>Object.assign(_(t),{startsWith:e=>{return S(m(t,(r=e,h(t=>T(t)&&t.startsWith(r)))));var r},endsWith:e=>{return S(m(t,(r=e,h(t=>T(t)&&t.endsWith(r)))));var r},minLength:e=>S(m(t,(t=>h(e=>T(e)&&e.length>=t))(e))),length:e=>S(m(t,(t=>h(e=>T(e)&&e.length===t))(e))),maxLength:e=>S(m(t,(t=>h(e=>T(e)&&e.length<=t))(e))),includes:e=>{return S(m(t,(r=e,h(t=>T(t)&&t.includes(r)))));var r},regex:e=>{return S(m(t,(r=e,h(t=>T(t)&&Boolean(t.match(r))))));var r}}),w=(S(h(T)),t=>Object.assign(_(t),{between:(e,r)=>w(m(t,((t,e)=>h(r=>E(r)&&t<=r&&e>=r))(e,r))),lt:e=>w(m(t,(t=>h(e=>E(e)&&e<t))(e))),gt:e=>w(m(t,(t=>h(e=>E(e)&&e>t))(e))),lte:e=>w(m(t,(t=>h(e=>E(e)&&e<=t))(e))),gte:e=>w(m(t,(t=>h(e=>E(e)&&e>=t))(e))),int:()=>w(m(t,h(t=>E(t)&&Number.isInteger(t)))),finite:()=>w(m(t,h(t=>E(t)&&Number.isFinite(t)))),positive:()=>w(m(t,h(t=>E(t)&&t>0))),negative:()=>w(m(t,h(t=>E(t)&&t<0)))})),y=(w(h(E)),t=>Object.assign(_(t),{between:(e,r)=>y(m(t,((t,e)=>h(r=>f(r)&&t<=r&&e>=r))(e,r))),lt:e=>y(m(t,(t=>h(e=>f(e)&&e<t))(e))),gt:e=>y(m(t,(t=>h(e=>f(e)&&e>t))(e))),lte:e=>y(m(t,(t=>h(e=>f(e)&&e<=t))(e))),gte:e=>y(m(t,(t=>h(e=>f(e)&&e>=t))(e))),positive:()=>y(m(t,h(t=>f(t)&&t>0))),negative:()=>y(m(t,h(t=>f(t)&&t<0)))}));y(h(f)),_(h(function(t){return"boolean"==typeof t})),_(h(function(t){return"symbol"==typeof t})),_(h(function(t){return null==t})),_(h(function(t){return null!=t}));
1class A extends Error{constructor(t){let e;try{e=JSON.stringify(t)}catch(r){e=t}super(`Pattern matching error: no pattern matches value ${e}`),this.input=void 0,this.input=t}}const N={matched:!1,value:void 0};function I(t){return new v(t,N)}class v{constructor(t,e){this.input=void 0,this.state=void 0,this.input=t,this.state=e}with(...t){if(this.state.matched)return this;const e=t[t.length-1],r=[t[0]];let n;3===t.length&&"function"==typeof t[1]?n=t[1]:t.length>2&&r.push(...t.slice(1,t.length-1));let i=!1,o={};const s=(t,e)=>{i=!0,o[t]=e},l=!r.some(t=>c(t,this.input,s))||n&&!Boolean(n(this.input))?N:{matched:!0,value:e(i?a in o?o[a]:o:this.input,this.input)};return new v(this.input,l)}when(t,e){if(this.state.matched)return this;const r=Boolean(t(this.input));return new v(this.input,r?{matched:!0,value:e(this.input,this.input)}:N)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(t=L){return this.state.matched?this.state.value:t(this.input)}run(){return this.exhaustive()}returnType(){return this}narrow(){return this}}function L(t){throw new A(t)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.