!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("jQuery")):"function"==typeof define&&define.amd?define(["jQuery"],e):"object"==typeof exports?exports.DBoxCurrency=e(require("jQuery")):n.DBoxCurrency=e(n.jQuery)}(self,(n=>(()=>{"use strict";var e={938:(n,e,t)=>{t.d(e,{Z:()=>s});var r=t(81),o=t.n(r),a=t(645),i=t.n(a)()(o());i.push([n.id,"",""]),i.locals={containerClass:"dbox-currency-container"};const s=i},639:(n,e,t)=>{t.d(e,{Z:()=>s});var r=t(81),o=t.n(r),a=t(645),i=t.n(a)()(o());i.push([n.id,".dbox-currency-container {\n  display: flex;\n  padding-right: .5rem !important;\n  padding-left: .5rem !important;\n}\n\n.dbox-currency-container * {\n  font-family: Roboto;\n}\n\n.dbox-currency-container .mx-1 {\n  margin-right: .25rem !important;\n  margin-left: .25rem !important;\n}\n\n.dbox-currency-container .mb-0 {\n  margin-bottom: 0 !important;\n}\n\n.dbox-currency-container .field-label {\n  color: #4b5c72 !important;\n  font-size: 0.85714286rem;\n  font-weight: normal;\n  margin-bottom: 0.28571429rem;\n}\n\n.dbox-currency-container dbx-dropdown::part(main_container) {\n  width: 6.42857143rem;\n}\n\n.dbox-currency-container input.amount {\n  font-size: 1rem;\n  padding: 0.5rem 0.85714286rem;\n  border-radius: 0.28571429rem !important;\n  border: 0.07142857rem solid #bcc6d6 !important;\n  color: #212223 !important;\n  -webkit-text-fill-color: inherit;\n  box-shadow: none;\n  caret-color: var(--primary-color);\n  background: #fff;\n  transition: all .5s ease;\n  height: auto;\n}\n\n.dbox-currency-container input.amount:focus {\n  border: 0.07142857rem solid var(--primary-color) !important;\n  box-shadow: 0 0.07142857rem 0.07142857rem rgba(0,0,0,.075) inset,0 0 0.57142857rem rgba(102,175,233,.6) !important;\n}\n\n.dbox-currency-container .formatted-amount,\n.dbox-currency-container .message {\n  color: #4b5c72;\n  font-size: 0.71428571rem;\n}",""]);const s=i},645:n=>{n.exports=function(n){var e=[];return e.toString=function(){return this.map((function(e){var t="",r=void 0!==e[5];return e[4]&&(t+="@supports (".concat(e[4],") {")),e[2]&&(t+="@media ".concat(e[2]," {")),r&&(t+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),t+=n(e),r&&(t+="}"),e[2]&&(t+="}"),e[4]&&(t+="}"),t})).join("")},e.i=function(n,t,r,o,a){"string"==typeof n&&(n=[[null,n,void 0]]);var i={};if(r)for(var s=0;s<this.length;s++){var u=this[s][0];null!=u&&(i[u]=!0)}for(var c=0;c<n.length;c++){var l=[].concat(n[c]);r&&i[l[0]]||(void 0!==a&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=a),t&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=t):l[2]=t),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},81:n=>{n.exports=function(n){return n[1]}},379:n=>{var e=[];function t(n){for(var t=-1,r=0;r<e.length;r++)if(e[r].identifier===n){t=r;break}return t}function r(n,r){for(var a={},i=[],s=0;s<n.length;s++){var u=n[s],c=r.base?u[0]+r.base:u[0],l=a[c]||0,p="".concat(c," ").concat(l);a[c]=l+1;var d=t(p),f={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var m=o(f,r);r.byIndex=s,e.splice(s,0,{identifier:p,updater:m,references:1})}i.push(p)}return i}function o(n,e){var t=e.domAPI(e);t.update(n);return function(e){if(e){if(e.css===n.css&&e.media===n.media&&e.sourceMap===n.sourceMap&&e.supports===n.supports&&e.layer===n.layer)return;t.update(n=e)}else t.remove()}}n.exports=function(n,o){var a=r(n=n||[],o=o||{});return function(n){n=n||[];for(var i=0;i<a.length;i++){var s=t(a[i]);e[s].references--}for(var u=r(n,o),c=0;c<a.length;c++){var l=t(a[c]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}a=u}}},569:n=>{var e={};n.exports=function(n,t){var r=function(n){if(void 0===e[n]){var t=document.querySelector(n);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(n){t=null}e[n]=t}return e[n]}(n);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}},216:n=>{n.exports=function(n){var e=document.createElement("style");return n.setAttributes(e,n.attributes),n.insert(e,n.options),e}},565:(n,e,t)=>{n.exports=function(n){var e=t.nc;e&&n.setAttribute("nonce",e)}},795:n=>{n.exports=function(n){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=n.insertStyleElement(n);return{update:function(t){!function(n,e,t){var r="";t.supports&&(r+="@supports (".concat(t.supports,") {")),t.media&&(r+="@media ".concat(t.media," {"));var o=void 0!==t.layer;o&&(r+="@layer".concat(t.layer.length>0?" ".concat(t.layer):""," {")),r+=t.css,o&&(r+="}"),t.media&&(r+="}"),t.supports&&(r+="}");var a=t.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleTagTransform(r,n,e.options)}(e,n,t)},remove:function(){!function(n){if(null===n.parentNode)return!1;n.parentNode.removeChild(n)}(e)}}}},589:n=>{n.exports=function(n,e){if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}},145:e=>{e.exports=n}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={id:n,exports:{}};return e[n](a,a.exports,r),a.exports}r.n=n=>{var e=n&&n.__esModule?()=>n.default:()=>n;return r.d(e,{a:e}),e},r.d=(n,e)=>{for(var t in e)r.o(e,t)&&!r.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},r.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.nc=void 0;var o={};return(()=>{r.r(o),r.d(o,{default:()=>M});var n=r(145),e=r.n(n),t=r(379),a=r.n(t),i=r(795),s=r.n(i),u=r(569),c=r.n(u),l=r(565),p=r.n(l),d=r(216),f=r.n(d),m=r(589),y=r.n(m),h=r(639),b={};b.styleTagTransform=y(),b.setAttributes=p(),b.insert=c().bind(null,"head"),b.domAPI=s(),b.insertStyleElement=f();a()(h.Z,b);h.Z&&h.Z.locals&&h.Z.locals;var v=r(938),S={};S.styleTagTransform=y(),S.setAttributes=p(),S.insert=c().bind(null,"head"),S.domAPI=s(),S.insertStyleElement=f();a()(v.Z,S);const N=v.Z&&v.Z.locals?v.Z.locals:void 0;function g(n,e){var t={RUPEE:"en-IN",DOLLAR:"en-US",AED:"en-AE",EURO:"en-BE",POUNDS:"en-GB",PHP:"en-PH",SGD:"en-SG",THB:"th-TH",IDR:"in-ID",HKD:"en-HK",AUD:"en-AU",CAD:"en-CA",BDT:"en-IN",VND:"en-VN",CNY:"bo-CN",TWD:"en-IN",JPY:"ja-JP",MYR:"ms-MY",KRW:"ko-KR",KHR:"en-IN",EGP:"en-EG",LKR:"en-IN",MMK:"en-MM",COP:"es-CO",NGN:"en-NG",TRY:"en-US",UZS:"en-US",XOF:"en-US",BRL:"en-IN",JOD:"en-IN",AFN:"en-IN",ALL:"en-IN",ARS:"en-IN",AZN:"en-IN",BBD:"en-IN",BYN:"en-IN",BZD:"en-IN",BMD:"en-IN",BOB:"en-IN",BAM:"en-IN",BWP:"en-IN",BND:"en-IN",CLP:"en-IN",CRC:"en-IN",CZK:"en-IN",DKK:"en-IN",DOP:"en-IN",GHS:"en-IN",GTQ:"en-IN",HNL:"en-IN",HUF:"en-IN",ISK:"en-IN",IRR:"en-IN",ILS:"en-IN",JMD:"en-IN",LAK:"en-IN",LRD:"en-IN",MKD:"en-IN",MUR:"en-IN",MXN:"en-US",MNT:"en-IN",MZN:"en-IN",NAD:"en-IN",NPR:"en-IN",ANG:"en-IN",NZD:"en-IN",NIO:"en-IN",NOK:"en-IN",OMR:"en-IN",PYG:"en-IN",PEN:"en-IN",PLN:"en-IN",QAR:"en-IN",RON:"en-IN",RUB:"en-IN",SAR:"en-IN",RSD:"en-IN",SCR:"en-IN",SOS:"en-IN",ZAR:"en-IN",SEK:"en-IN",CHF:"en-IN",SYP:"en-IN",TTD:"en-IN",TVD:"en-IN",UAH:"en-IN",UYU:"en-IN",VEF:"en-IN",YER:"en-IN",ZWL:"en-IN",KES:"en-IN",DZD:"en-US",AOA:"en-US",AMD:"en-US",AWG:"en-US",BSD:"en-US",BHD:"en-US",BTN:"en-US",BTC:"en-US",BGN:"en-US",BIF:"en-US",CVE:"en-US",KYD:"en-US",XAF:"en-US",XPF:"en-US",KMF:"en-US",CDF:"en-US",CUP:"en-US",DJF:"en-US",XCD:"en-US",ERN:"en-US",ETB:"en-US",FKP:"en-US",FJD:"en-US",GMD:"en-US",GEL:"en-US",GIP:"en-US",GGP:"en-US",GNF:"en-US",GYD:"en-US",HTG:"en-US",IQD:"en-US",JEP:"en-US",KZT:"en-US",KWD:"en-US",KGS:"en-US",LBP:"en-US",LSL:"en-US",LYD:"en-US",MOP:"en-US",MGA:"en-US",MWK:"en-US",MVR:"en-US",IMP:"en-US",MRU:"en-US",MDL:"en-US",MAD:"en-US",KPW:"en-US",PKR:"en-US",PAB:"en-US",PGK:"en-US",RWF:"en-US",SHP:"en-US",WST:"en-US",STN:"en-US",SLL:"en-US",SBD:"en-US",SDG:"en-US",SRD:"en-US",SZL:"en-US",TJS:"en-US",TZS:"en-US",TOP:"en-US",TND:"en-US",TMT:"en-US",UGX:"en-US",VUV:"en-US",VED:"en-US",VES:"en-US",ZMW:"en-US"}[n];return new Intl.NumberFormat(t).format(e)}const I={getOptions:function(n){return Object.keys(n).map((function(e){return{label:n[e],value:e}}))}};function U(n){return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},U(n)}function D(n){return function(n){if(Array.isArray(n))return C(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||function(n,e){if(!n)return;if("string"==typeof n)return C(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(n);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return C(n,e)}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function w(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,r)}return t}function O(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?w(Object(t),!0).forEach((function(e){P(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function A(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,x(r.key),r)}}function P(n,e,t){return(e=x(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function x(n){var e=function(n,e){if("object"!==U(n)||null===n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var r=t.call(n,e||"default");if("object"!==U(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(n)}(n,"string");return"symbol"===U(e)?e:String(e)}var E=function(){function n(t,r,o){var a=this;!function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),P(this,"onChangeCurrency",(function(n){n.preventDefault();try{var e=a.getValue(),t=e.currency,r=e.amount;a.updateAmountDisplay(t.value,t.label,r),a.options.callbacks.onChangeCurrency&&a.options.callbacks.onChangeCurrency(t,r)}catch(n){console.error("Error getting value:",n)}})),P(this,"onChangeAmount",(function(n){n.preventDefault();try{var e=a.getValue(),t=e.currency,r=e.amount;a.hiddenField.val(r),a.updateAmountDisplay(t.value,t.label,r),a.options.callbacks.onChangeAmount&&a.options.callbacks.onChangeAmount(t,r)}catch(n){console.error("Error getting value:",n)}})),this.validateParams(t,o),o=this.processOptions(o),this.container=e()("#"+r),this.id=t,this.options=o,this.render(),this.skipOnChangeCurrency=!1}var t,r,o;return t=n,r=[{key:"render",value:function(){var n=e()('<div class="'.concat(N.containerClass,'"></div>')),t=this.renderCurrencyContainer(),r=this.renderAmountContainer();n.append(t,r),this.container.append(n),this.bindEvents()}},{key:"renderCurrencyContainer",value:function(){var n,t=this,r=e()("<div class='currency'></div>").addClass("mx-1"),o=e()("<label></label>").addClass("field-label").text(this.options.currencyLabel),a=e()("<dbx-dropdown class='currency' name='".concat(this.options.currencyDropdownName,"'></dbx-dropdown>")).get(0);return a.singleSelectOutFormat="string",a.isSearchEnabled=!0,a.options=I.getOptions(this.options.currencies),this.options.defaultCurrency&&(n=a.options.find((function(n){return n.value===t.options.defaultCurrency}))),a.valueFormat="object",a.value=n||a.options[0],a.isClearable=!1,this.currencyDropdown=a,r.append(o,a),this.options.dropdownDisabled&&this.enableDisableCurrencyDropdown(!0),r}},{key:"renderAmountContainer",value:function(){var n=e()("<div></div>").addClass("mx-1"),t=e()("<div></div>").addClass("mb-0"),r=e()("<input>").attr("type","text").addClass("amount form-control inline-block vertical-align-middle");this.amountInput=r;var o=e()("<input>").attr("type","hidden").attr("id","hidden-field-"+this.id).attr("name",this.options.amountInputName);this.hiddenField=o;var a=e()("<label></label").addClass("field-label").text(this.options.amountLabel),i=e()("<span></span>").attr("id","formatted-amount-"+this.id).addClass("formatted-amount").hide();this.amountDisplay=i,this.options.defaultAmount&&this.options.defaultCurrency&&(o.val(this.options.defaultAmount),r.val(this.options.defaultAmount),this.updateAmountDisplay(this.options.defaultCurrency,this.options.currencies[this.options.defaultCurrency],this.options.defaultAmount));var s=e()("<span></span>").addClass("message");return this.messageSpan=s,this.options.message?s.text(this.options.message):s.hide(),t.append(a,r,i,s,o),n.append(t)}},{key:"bindEvents",value:function(){var n=this;this.container.on("change",".amount",(function(e){return n.onChangeAmount(e)})),this.currencyDropdown.addEventListener("commonValueChange",(function(e){n.skipOnChangeCurrency||n.onChangeCurrency(e)}))}},{key:"processOptions",value:function(n){for(var e in(n=O(O({},{callbacks:{},inlineFormatting:!1,dropdownDisabled:!1}),n)).callbacks){var t=n.callbacks[e];t&&("string"==typeof t&&"function"==typeof window[t]?n.callbacks[e]=window[t]:"function"!=typeof t&&delete n.callbacks[e])}return n}},{key:"validateParams",value:function(n,e){if(!n)throw new Error("id is required and must be a non-empty string.");if(!e)throw new Error("Options is required.");if(!e.currencies||0===Object.keys(e.currencies).length)throw new Error("Options must include 'currencies' ");if(!e.currencyDropdownName)throw new Error("Options must include a 'currencyDropdownName' string.");if(!e.amountInputName)throw new Error("Options must include an 'amountInputName' string.");if(!e.amountLabel)throw new Error("Options must include an 'amountLabel' string.");if(!e.currencyLabel)throw new Error("Options must include an 'currencyLabel' string.")}},{key:"getValue",value:function(){var n=this.currencyDropdown.value,e=n.value,t=n.label,r=this.container.find(".amount").val();return{currency:{value:e,label:t},amount:r,formattedAmount:g(e,r)}}},{key:"updateAmountDisplay",value:function(n,e,t){var r=g(n,t);t?(this.options.inlineFormatting?(this.amountInput.val(r),this.amountDisplay.empty()):this.amountDisplay.text(e+" "+r),this.amountDisplay.show()):this.amountDisplay.hide()}},{key:"setAmount",value:function(n){this.amountInput.val(n),this.hiddenField.val(n);try{var e=this.getValue().currency;this.updateAmountDisplay(e.value,e.label,n)}catch(n){console.error("Error getting value:",n)}}},{key:"setAmountReadonly",value:function(n){this.amountInput.prop("readonly",n)}},{key:"isAmountReadOnly",value:function(){return this.amountInput.prop("readonly")}},{key:"setMessage",value:function(n){n?(this.messageSpan.text(n),this.messageSpan.show()):this.messageSpan.hide()}},{key:"hideShowMessage",value:function(n){n?this.messageSpan.hide():this.messageSpan.show()}},{key:"appendCurrencies",value:function(n,e){this.skipOnChangeCurrency=!0,this.currencyDropdown.options=[].concat(D(e?[]:this.currencyDropdown.options),D(I.getOptions(n))),this.skipOnChangeCurrency=!1,this.currencyDropdown.value=this.currencyDropdown.options[0]}},{key:"enableDisableCurrencyDropdown",value:function(n){this.currencyDropdown.setDisabled(n)}}],r&&A(t.prototype,r),o&&A(t,o),Object.defineProperty(t,"prototype",{writable:!1}),n}();const M=E})(),o})()));