!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js"),require("lit/directives/if-defined.js"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit/directives/repeat.js"),require("country-codes-list"),require("country-flags-svg"));else if("function"==typeof define&&define.amd)define(["lit","lit/decorators.js","lit/directives/class-map.js","lit/directives/style-map.js","lit/directives/if-defined.js","@momentum-ui/icons/data/momentumUiIconsNames.json","@momentum-ui/utils/lib/getColorValue","mobx","lit/directives/repeat.js","country-codes-list","country-flags-svg"],t);else{var o="object"==typeof exports?t(require("lit"),require("lit/decorators.js"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js"),require("lit/directives/if-defined.js"),require("@momentum-ui/icons/data/momentumUiIconsNames.json"),require("@momentum-ui/utils/lib/getColorValue"),require("mobx"),require("lit/directives/repeat.js"),require("country-codes-list"),require("country-flags-svg")):t(e.lit,e["lit/decorators.js"],e["lit/directives/class-map.js"],e["lit/directives/style-map.js"],e["lit/directives/if-defined.js"],e["@momentum-ui/icons/data/momentumUiIconsNames.json"],e["@momentum-ui/utils/lib/getColorValue"],e.mobx,e["lit/directives/repeat.js"],e["country-codes-list"],e["country-flags-svg"]);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(self,(e,t,o,r,i,s,n,l,a,d,c)=>(()=>{"use strict";var u,p={6709(e,t,o){o.r(t),o.d(t,{CountryCodePicker:()=>r}),o(2273);var r,i=o(9609),s=o(4084),n=o(3060),l=o(5875),a=o(7161),d=o(429),c=o(5125),u=o(8175),p=o(8373),m=function(e,t,o,r){var i,s=arguments.length,n=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,o,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(n=(s<3?i(n):s>3?i(t,o,n):i(t,o))||n);return s>3&&n&&Object.defineProperty(t,o,n),n};!function(e){let t=class extends a.LitElement{constructor(){super(...arguments),this.codePlaceholder="+1",this.countryCallingCode="",this.showFlags=!1,this.pill=!1,this.disabled=!1,this.ariaLabel="",this.clearAriaLabel="Clear Country Code",this.id="",this.newMomentum=!1,this.isDropdownArrow=!0,this.countryCode="US",this.codeList=[]}connectedCallback(){super.connectedCallback(),this.codeList=(0,n.customArray)({name:"{countryNameEn}",value:"{countryCallingCode}",code:"{countryCode}"}),""===this.id&&(this.id=`md-country-code-picker-${Math.random().toString(36).substring(2,6)}`)}getCountryFlag(e){return a.html`
        <span class="flag-svg-wrapper">
          <img src="${(0,l.findFlagUrlByIso2Code)(e)}" />
        </span>
      `}countryCodeOptionTemplate(e,t){return a.html`
        <div
          part="option"
          class="md-country-code-picker__option"
          display-value="+${e.value}"
          slot=${t}
          aria-label="+${e.value}, ${e.name}, ${e.code}"
        >
          ${this.showFlags?this.getCountryFlag(e.code):a.nothing}
          <span>${e.name}</span>
          <span>+${e.value}</span>
        </div>
      `}handleCountryChange(e){var t,o;e.detail.value&&(null===(t=e.detail.value)||void 0===t?void 0:t.id)?(this.countryCallingCode=e.detail.value.id,this.countryCode=null===(o=e.detail.value.id.split(",")[2])||void 0===o?void 0:o.trim()):(this.countryCode="US",this.countryCallingCode=""),this.dispatchEvent(new CustomEvent("country-code-changed",{bubbles:!0,composed:!0,detail:{srcEvent:e}}))}get flagClassMap(){return{"new-momentum":this.newMomentum}}get containerClassMap(){return{"md-country-code-picker__container":!0,"show-flags":this.showFlags}}getFormatedCountryCallingCode(){var e;return{id:this.countryCallingCode,value:null===(e=this.countryCallingCode.split(",")[0])||void 0===e?void 0:e.trim()}}static get styles(){return[s.A,p.A]}get sortedCodeList(){return[...this.codeList].sort((e,t)=>e.name.localeCompare(t.name))}render(){return a.html`
        <div class="${(0,c.classMap)(this.containerClassMap)}">
          ${this.showFlags?a.html`
                <span class="flag-box ${(0,c.classMap)(this.flagClassMap)}">${this.getCountryFlag(this.countryCode)}</span>
              `:a.nothing}
          <md-combobox
            part="combobox"
            exportparts="group: combobox-group, combobox-options: options-container"
            ?disabled=${this.disabled}
            shape="${this.pill?"pill":"none"}"
            ariaLabel=${this.ariaLabel}
            placeholder="${this.codePlaceholder}"
            .value="${this.countryCallingCode?[this.getFormatedCountryCallingCode()]:[]}"
            @change-selected=${e=>this.handleCountryChange(e)}
            with-custom-content
            ?newMomentum=${this.newMomentum}
            ?is-dropdown-arrow=${this.isDropdownArrow}
            .clearAriaLabel="${this.clearAriaLabel}"
          >
            ${(0,u.repeat)(this.sortedCodeList,e=>e.name,(e,t)=>this.countryCodeOptionTemplate(e,t))}
          </md-combobox>
        </div>
      `}};m([(0,d.property)({type:String,reflect:!0})],t.prototype,"codePlaceholder",void 0),m([(0,d.property)({type:String,attribute:"country-calling-code"})],t.prototype,"countryCallingCode",void 0),m([(0,d.property)({type:Boolean,attribute:"show-flags"})],t.prototype,"showFlags",void 0),m([(0,d.property)({type:Boolean})],t.prototype,"pill",void 0),m([(0,d.property)({type:Boolean})],t.prototype,"disabled",void 0),m([(0,d.property)({type:String})],t.prototype,"ariaLabel",void 0),m([(0,d.property)({type:String})],t.prototype,"clearAriaLabel",void 0),m([(0,d.property)({type:String})],t.prototype,"id",void 0),m([(0,d.property)({type:Boolean})],t.prototype,"newMomentum",void 0),m([(0,d.property)({type:Boolean})],t.prototype,"isDropdownArrow",void 0),m([(0,d.state)()],t.prototype,"countryCode",void 0),m([(0,d.state)()],t.prototype,"codeList",void 0),m([(0,d.query)("md-combobox")],t.prototype,"combobox",void 0),t=m([(0,i.w)("md-country-code-picker")],t),e.ELEMENT=t}(r||(r={}))},2022(e){e.exports=s},554(e){e.exports=n},3060(e){e.exports=d},5875(e){e.exports=c},7161(t){t.exports=e},429(e){e.exports=t},5125(e){e.exports=o},291(e){e.exports=i},8175(e){e.exports=a},318(e){e.exports=r},5314(e){e.exports=l}},m={};function y(e){var t=m[e];if(void 0!==t)return t.exports;var o=m[e]={exports:{}};return p[e].call(o.exports,o,o.exports,y),o.exports}y.m=p,u=[],y.O=(e,t,o,r)=>{if(!t){var i=1/0;for(a=0;a<u.length;a++){for(var[t,o,r]=u[a],s=!0,n=0;n<t.length;n++)(!1&r||i>=r)&&Object.keys(y.O).every(e=>y.O[e](t[n]))?t.splice(n--,1):(s=!1,r<i&&(i=r));if(s){u.splice(a--,1);var l=o();void 0!==l&&(e=l)}}return e}r=r||0;for(var a=u.length;a>0&&u[a-1][2]>r;a--)u[a]=u[a-1];u[a]=[t,o,r]},y.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return y.d(t,{a:t}),t},y.d=(e,t)=>{for(var o in t)y.o(t,o)&&!y.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),y.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={6753:0};y.O.j=t=>0===e[t];var t=(t,o)=>{var r,i,[s,n,l]=o,a=0;if(s.some(t=>0!==e[t])){for(r in n)y.o(n,r)&&(y.m[r]=n[r]);if(l)var d=l(y)}for(t&&t(o);a<s.length;a++)i=s[a],y.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return y.O(d)},o=self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var h=y.O(void 0,[7103,9609,4084,3305,4739,7154,9773,5983,9488,1821,2364,9938,4781,5201,5584,8227,7704,2797,7906,4047,4431,8138,2273,8373],()=>y(6709));return y.O(h)})());