/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","./componentsUtils","./dom","./label","./form","./math","./observers","./interactive","./icon","./progress"],(function(t,e,i,n,a,r,o,s,l,u){"use strict";
/*!
   * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
   * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
   * v1.0.0-beta.82
   */const c=["0","1","2","3","4","5","6","7","8","9"];function d(t){return!(!t||isNaN(Number(t)))}function h(t){return t&&v(t)?f(t,(t=>{let e=!1;const i=t.split("").filter(((t,i)=>t.match(/\./g)&&!e?(e=!0,!0):!(!t.match(/\-/g)||0!==i)||c.includes(t))).reduce(((t,e)=>t+e));return d(i)?Number(i).toString():""})):""}function m(t){const e=/(?!^\.)\.$/;return t.replace(e,"")}function p(t){const e=/(?!^-)-/g;return t.replace(e,"")}function b(t){const e=/^([-0])0+(?=\d)/;return t.replace(e,"$1")}function g(t){return f(t,(t=>{const e=p(m(b(t))),i=/^-\b0\b\.?0*$/;return d(e)?i.test(e)?e:Number(e).toString():t}))}function f(t,e){if(!t)return t;const i=t.toLowerCase().indexOf("e")+1;return t.replace(/[eE]*$/g,"").substring(0,i).concat(t.slice(i).replace(/[eE]/g,"")).split(/[eE]/).map(((t,i)=>e(1===i?t.replace(/\./g,""):t))).join("e").replace(/^e/,"1e")}function v(t){return c.some((e=>t.includes(e)))}
/*!
   * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
   * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
   * v1.0.0-beta.82
   */const x=new RegExp("[.](?=.*[.])","g"),y=new RegExp("[^0-9-.]","g"),w=new RegExp(",","g");function k(t){return new Intl.NumberFormat(t,{minimumFractionDigits:0,maximumFractionDigits:20})}function E(t,e){return f(t,(t=>{const i=t.replace(V(e),"-").replace(I(e),"").replace(z(e),".").replace(x,"").replace(y,"");return d(i)?i:t}))}function I(t){const e=k(t).formatToParts(1234567).find((t=>"group"===t.type)).value;return 0===e.trim().length?" ":e}function z(t){return k(t).formatToParts(1.1).find((t=>"decimal"===t.type)).value}function V(t){return k(t).formatToParts(-9).find((t=>"minusSign"===t.type)).value}function D(t,e,i=!1){return f(t,(t=>{if(t){const n=Number(m(t.replace(w,"")));if(!isNaN(n)){return k(e).formatToParts(n).map((({type:t,value:n})=>{switch(t){case"group":return i?I(e):"";case"decimal":return z(e);case"minusSign":return V(e);default:return n}})).reduce(((t,e)=>t+e))}}return t}))}
/*!
   * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
   * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
   * v1.0.0-beta.82
   */const N={loader:"loader",clearButton:"clear-button",editingEnabled:"editing-enabled",inlineChild:"inline-child",inputIcon:"icon",prefix:"prefix",suffix:"suffix",numberButtonWrapper:"number-button-wrapper",buttonItemHorizontal:"number-button-item--horizontal",wrapper:"element-wrapper",inputWrapper:"wrapper",actionWrapper:"action-wrapper",resizeIconWrapper:"resize-icon-wrapper",numberButtonItem:"number-button-item"},H={tel:"phone",password:"lock",email:"email-address",date:"calendar",time:"clock",search:"search"},O={action:"action"},C={clear:"Clear value"},T="@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:block}:host([scale=s]) input,:host([scale=s]) .prefix,:host([scale=s]) .suffix{height:1.5rem;padding:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=s]) textarea{height:1.5rem;min-height:1.5rem}:host([scale=s]) .number-button-wrapper,:host([scale=s]) .action-wrapper calcite-button,:host([scale=s]) .action-wrapper calcite-button button{height:1.5rem}:host([scale=s]) input[type=file]{height:1.5rem}:host([scale=s]) .clear-button{min-height:1.5rem;min-width:1.5rem}:host([scale=s]) textarea{height:auto;padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=m]) input,:host([scale=m]) .prefix,:host([scale=m]) .suffix{height:2rem;padding:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=m]) textarea{min-height:2rem}:host([scale=m]) .number-button-wrapper,:host([scale=m]) .action-wrapper calcite-button,:host([scale=m]) .action-wrapper calcite-button button{height:2rem}:host([scale=m]) input[type=file]{height:2rem}:host([scale=m]) .clear-button{min-height:2rem;min-width:2rem}:host([scale=m]) textarea{height:auto;padding-top:0.5rem;padding-bottom:0.5rem;padding-left:0.75rem;padding-right:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]) input,:host([scale=l]) .prefix,:host([scale=l]) .suffix{height:2.75rem;padding:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=l]) textarea{min-height:2.75rem}:host([scale=l]) .number-button-wrapper,:host([scale=l]) .action-wrapper calcite-button,:host([scale=l]) .action-wrapper calcite-button button{height:2.75rem}:host([scale=l]) input[type=file]{height:2.75rem}:host([scale=l]) .clear-button{min-height:2.75rem;min-width:2.75rem}:host([scale=l]) textarea{height:auto;padding-top:0.75rem;padding-bottom:0.75rem;padding-left:1rem;padding-right:1rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) textarea{resize:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host textarea,:host input{-webkit-transition:var(--calcite-animation-timing), height 0s;transition:var(--calcite-animation-timing), height 0s;-webkit-appearance:none;position:relative;margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;max-height:100%;width:100%;max-width:100%;-ms-flex:1 1 0%;flex:1 1 0%;border-radius:0px;background-color:var(--calcite-ui-foreground-1);font-family:inherit;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-1)}:host input[type=search]::-webkit-search-decoration{-webkit-appearance:none}:host input,:host textarea{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);color:var(--calcite-ui-text-1)}:host input:-ms-input-placeholder,:host textarea:-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}:host input::-ms-input-placeholder,:host textarea::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}:host input::placeholder,:host input:-ms-input-placeholder,:host input::-ms-input-placeholder,:host textarea::placeholder,:host textarea:-ms-input-placeholder,:host textarea::-ms-input-placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}:host input:focus,:host textarea:focus{border-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-1)}:host input[readonly],:host textarea[readonly]{background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium)}:host input[readonly]:focus,:host textarea[readonly]:focus{color:var(--calcite-ui-text-1)}:host calcite-icon{color:var(--calcite-ui-text-3)}:host textarea,:host input{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out}:host textarea:focus,:host input:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host([status=invalid]) input,:host([status=invalid]) textarea{border-color:var(--calcite-ui-danger)}:host([status=invalid]) input:focus,:host([status=invalid]) textarea:focus{outline:2px solid var(--calcite-ui-danger);outline-offset:-2px}:host([scale=s]) .icon{inset-inline-start:0.5rem}:host([scale=m]) .icon{inset-inline-start:0.75rem}:host([scale=l]) .icon{inset-inline-start:1rem}:host([icon][scale=s]) input{-webkit-padding-start:2rem;padding-inline-start:2rem}:host([icon][scale=m]) input{-webkit-padding-start:2.5rem;padding-inline-start:2.5rem}:host([icon][scale=l]) input{-webkit-padding-start:3rem;padding-inline-start:3rem}.element-wrapper{position:relative;-ms-flex-order:3;order:3;display:-ms-inline-flexbox;display:inline-flex;-ms-flex:1 1 0%;flex:1 1 0%;-ms-flex-align:center;align-items:center}.icon{pointer-events:none;position:absolute;z-index:10;display:block;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}input[type=text]::-ms-clear,input[type=text]::-ms-reveal{display:none;height:0px;width:0px}input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration,input[type=date]::-webkit-clear-button,input[type=time]::-webkit-clear-button{display:none}.clear-button{pointer-events:initial;-ms-flex-order:4;order:4;margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;min-height:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-item-align:stretch;align-self:stretch;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;border-inline-start-width:0px}.clear-button:hover{background-color:var(--calcite-ui-foreground-2);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.clear-button:hover calcite-icon{color:var(--calcite-ui-text-1);-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.clear-button:active{background-color:var(--calcite-ui-foreground-3)}.clear-button:active calcite-icon{color:var(--calcite-ui-text-1)}.clear-button:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.loader{top:1px;left:1px;right:1px;pointer-events:none;position:absolute;display:block}.action-wrapper{-ms-flex-order:7;order:7;display:-ms-flexbox;display:flex}.prefix,.suffix{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;height:auto;min-height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-line-pack:center;align-content:center;-ms-flex-align:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}.prefix{-ms-flex-order:2;order:2;border-inline-end-width:0px}.suffix{-ms-flex-order:5;order:5;border-inline-start-width:0px}:host([alignment=start]) textarea,:host([alignment=start]) input{text-align:start}:host([alignment=end]) textarea,:host([alignment=end]) input{text-align:end}:host input[type=number]{-moz-appearance:textfield}:host input[type=number]::-webkit-inner-spin-button,:host input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield;margin:0px}.number-button-wrapper{pointer-events:none;-ms-flex-order:6;order:6;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}:host([number-button-type=vertical]) .wrapper{-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex}:host([number-button-type=vertical]) input,:host([number-button-type=vertical]) textarea{-ms-flex-order:2;order:2}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down],.number-button-item.number-button-item--horizontal[data-adjustment=up]{-ms-flex-order:1;order:1;max-height:100%;min-height:100%;-ms-flex-item-align:stretch;align-self:stretch}.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon,.number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-inline-end-width:0px}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item.number-button-item--horizontal[data-adjustment=up]{-ms-flex-order:5;order:5}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]{border-top-width:0px}.number-button-item{max-height:50%;min-height:50%;pointer-events:initial;margin:0px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-item-align:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-top:0px;padding-bottom:0px;padding-left:0.5rem;padding-right:0.5rem;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s;border-inline-start-width:0px}.number-button-item calcite-icon{pointer-events:none;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}.number-button-item:focus{background-color:var(--calcite-ui-foreground-2)}.number-button-item:focus calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item:active{background-color:var(--calcite-ui-foreground-3)}.wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}:host input::-webkit-calendar-picker-indicator{display:none}:host input[type=date]::-webkit-input-placeholder{visibility:hidden !important}:host textarea::-webkit-resizer{position:absolute;bottom:0px;-webkit-box-sizing:border-box;box-sizing:border-box;padding-top:0px;padding-bottom:0px;padding-left:0.25rem;padding-right:0.25rem;inset-inline-end:0}.resize-icon-wrapper{bottom:2px;inset-inline-end:2px;pointer-events:none;position:absolute;z-index:10;height:0.75rem;width:0.75rem;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-3)}.resize-icon-wrapper calcite-icon{bottom:0.25rem;inset-inline-end:0.25rem;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.calcite--rtl .resize-icon-wrapper calcite-icon{-webkit-transform:rotate(45deg);transform:rotate(45deg)}:host([type=color]) input{padding:0.25rem}:host([type=file]) input{cursor:pointer;border-width:1px;border-style:dashed;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);text-align:center}:host([type=file][scale=s]) input{padding-top:1px;padding-bottom:1px;padding-left:0.5rem;padding-right:0.5rem}:host([type=file][scale=m]) input{padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}:host([type=file][scale=l]) input{padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem}:host(.no-bottom-border) input{border-bottom-width:0px}:host(.border-top-color-one) input{border-top-color:var(--calcite-ui-border-1)}:host .inline-child{background-color:transparent;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:var(--calcite-animation-timing);transition-duration:var(--calcite-animation-timing);-webkit-transition-timing-function:ease-in-out;transition-timing-function:ease-in-out;-webkit-transition-delay:0s;transition-delay:0s}:host .inline-child .editing-enabled{background-color:inherit}:host .inline-child:not(.editing-enabled){display:-ms-flexbox;display:flex;cursor:pointer;border-color:transparent;-webkit-padding-start:0;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}",F=e.proxyCustomElement(class extends e.H{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteInputFocus=e.createEvent(this,"calciteInputFocus",7),this.calciteInputBlur=e.createEvent(this,"calciteInputBlur",7),this.calciteInputInput=e.createEvent(this,"calciteInputInput",7),this.calciteInputChange=e.createEvent(this,"calciteInputChange",7),this.alignment="start",this.autofocus=!1,this.clearable=!1,this.disabled=!1,this.groupSeparator=!1,this.hidden=!1,this.intlLoading=i.TEXT.loading,this.iconFlipRtl=!1,this.loading=!1,this.locale=document.documentElement.lang||"en",this.localeFormat=!1,this.numberButtonType="vertical",this.readOnly=!1,this.required=!1,this.scale="m",this.status="idle",this.editingEnabled=!1,this.type="text",this.value="",this.childElType="input",this.previousValueOrigin="initial",this.mutationObserver=o.createObserver("mutation",(()=>this.setDisabledAction())),this.userChangedValue=!1,this.keyDownHandler=t=>{this.readOnly||this.disabled||(this.isClearable&&"Escape"===t.key&&(this.clearInputValue(t),t.preventDefault()),"Enter"!==t.key||t.defaultPrevented||a.submitForm(this))},this.clearInputValue=t=>{this.setValue({committing:!0,nativeEvent:t,origin:"user",value:""})},this.emitChangeIfUserModified=()=>{"user"===this.previousValueOrigin&&this.value!==this.previousEmittedValue&&this.calciteInputChange.emit(),this.previousEmittedValue=this.value},this.inputBlurHandler=()=>{this.calciteInputBlur.emit({element:this.childEl,value:this.value}),this.emitChangeIfUserModified()},this.inputFocusHandler=t=>{const e=i.getSlotted(this.el,"action");t.target!==e&&this.setFocus(),this.calciteInputFocus.emit({element:this.childEl,value:this.value})},this.inputInputHandler=t=>{this.disabled||this.readOnly||this.setValue({nativeEvent:t,origin:"user",value:t.target.value})},this.inputKeyDownHandler=t=>{this.disabled||this.readOnly||"Enter"===t.key&&this.emitChangeIfUserModified()},this.inputNumberInputHandler=t=>{if(this.disabled||this.readOnly)return;const e=E(t.target.value,this.locale);"insertFromPaste"===t.inputType?(d(e)||t.preventDefault(),this.setValue({nativeEvent:t,origin:"user",value:h(e)}),this.childNumberEl.value=this.localizedValue):this.setValue({nativeEvent:t,origin:"user",value:e})},this.inputNumberKeyDownHandler=t=>{if("number"!==this.type||this.disabled||this.readOnly)return;if("ArrowUp"===t.key)return t.preventDefault(),void this.nudgeNumberValue("up",t);if("ArrowDown"===t.key)return void this.nudgeNumberValue("down",t);const e=[...c,"ArrowLeft","ArrowRight","Backspace","Delete","Enter","Escape","Tab"];if(t.altKey||t.ctrlKey||t.metaKey)return;const i=t.shiftKey&&"Tab"===t.key;if(e.includes(t.key)&&(!t.shiftKey||i))return void("Enter"===t.key&&this.emitChangeIfUserModified());const n=z(this.locale);if(t.key===n){if(!this.value&&!this.childNumberEl.value)return;if(this.value&&-1===this.childNumberEl.value.indexOf(n))return}if(/[eE]/.test(t.key)){if(!this.value&&!this.childNumberEl.value)return;if(this.value&&!/[eE]/.test(this.childNumberEl.value))return}if("-"===t.key){if(!this.value&&!this.childNumberEl.value)return;if(this.value&&this.childNumberEl.value.split("-").length<=2)return}t.preventDefault()},this.nudgeNumberValue=(t,e)=>{if(e instanceof KeyboardEvent&&e.repeat||"number"!==this.type)return;const i=this.maxString?parseFloat(this.maxString):null,n=this.minString?parseFloat(this.minString):null,a=100;this.incrementOrDecrementNumberValue(t,i,n,e),this.nudgeNumberValueIntervalId&&window.clearInterval(this.nudgeNumberValueIntervalId);let r=!0;this.nudgeNumberValueIntervalId=window.setInterval((()=>{r?r=!1:this.incrementOrDecrementNumberValue(t,i,n,e)}),a)},this.numberButtonMouseUpAndMouseOutHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId)},this.numberButtonMouseDownHandler=t=>{t.preventDefault();const e=t.target.dataset.adjustment;this.nudgeNumberValue(e,t)},this.setChildElRef=t=>{this.childEl=t},this.setChildNumberElRef=t=>{this.childNumberEl=t},this.setInputValue=t=>{("text"!==this.type||this.childEl)&&("number"!==this.type||this.childNumberEl)&&(this[`child${"number"===this.type?"Number":""}El`].value=t)},this.setPreviousEmittedValue=t=>{this.previousEmittedValue="number"===this.type?d(t)?t:"":t},this.setPreviousValue=t=>{this.previousValue="number"===this.type?d(t)?t:"":t},this.setValue=({committing:t=!1,nativeEvent:e,origin:i,previousValue:n,value:a})=>{const r="number"===this.type?D(this.previousValue,this.locale,this.groupSeparator):"",o="number"===this.type?g(a):a,s="number"===this.type&&a&&!o?d(this.previousValue)?this.previousValue:"":o,l="number"===this.type?D(s,this.locale,this.groupSeparator):"";if(this.setPreviousValue(n||this.value),this.previousValueOrigin=i,this.userChangedValue="user"===i&&this.value!==s,this.value=s,"number"===this.type&&(this.localizedValue=l),"direct"===i&&this.setInputValue("number"===this.type?l:s),e){this.calciteInputInput.emit({element:this.childEl,nativeEvent:e,value:this.value}).defaultPrevented?(this.value=this.previousValue,this.localizedValue=r):t&&this.emitChangeIfUserModified()}},this.inputKeyUpHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId)}}disabledWatcher(){this.setDisabledAction()}maxWatcher(){var t;this.maxString=(null===(t=this.max)||void 0===t?void 0:t.toString())||null}minWatcher(){var t;this.minString=(null===(t=this.min)||void 0===t?void 0:t.toString())||null}valueWatcher(t,e){this.userChangedValue||(this.setValue({origin:"direct",previousValue:e,value:null==t||""==t?"":"number"===this.type?d(t)?t:this.previousValue||"":t}),this.warnAboutInvalidNumberValue(t)),this.userChangedValue=!1}updateRequestedIcon(){this.requestedIcon=i.setRequestedIcon(H,this.icon,this.type)}get isClearable(){return!this.isTextarea&&(this.clearable||"search"===this.type)&&this.value.length>0}get isTextarea(){return"textarea"===this.childElType}connectedCallback(){var t;this.scale=i.getElementProp(this.el,"scale",this.scale),this.status=i.getElementProp(this.el,"status",this.status),this.inlineEditableEl=this.el.closest("calcite-inline-editable"),this.inlineEditableEl&&(this.editingEnabled=this.inlineEditableEl.editingEnabled||!1),this.setPreviousEmittedValue(this.value),this.setPreviousValue(this.value),"number"===this.type&&(this.warnAboutInvalidNumberValue(this.value),this.setValue({origin:"connected",value:d(this.value)?this.value:""})),n.connectLabel(this),a.connectForm(this),null===(t=this.mutationObserver)||void 0===t||t.observe(this.el,{childList:!0}),this.setDisabledAction()}disconnectedCallback(){var t;n.disconnectLabel(this),a.disconnectForm(this),null===(t=this.mutationObserver)||void 0===t||t.disconnect()}componentWillLoad(){var t,e;this.childElType="textarea"===this.type?"textarea":"input",this.maxString=null===(t=this.max)||void 0===t?void 0:t.toString(),this.minString=null===(e=this.min)||void 0===e?void 0:e.toString(),this.requestedIcon=i.setRequestedIcon(H,this.icon,this.type)}componentShouldUpdate(t,e,i){return!("number"===this.type&&"value"===i&&t&&!d(t))||(this.setValue({origin:"reset",value:e}),!1)}componentDidRender(){s.updateHostInteraction(this)}async setFocus(){var t,e;"number"===this.type?null===(t=this.childNumberEl)||void 0===t||t.focus():null===(e=this.childEl)||void 0===e||e.focus()}onLabelClick(){this.setFocus()}incrementOrDecrementNumberValue(t,e,i,n){const{value:a}=this,o="any"===this.step?1:Math.abs(this.step||1),s=a&&""!==a?parseFloat(a):0,l=s+o*("up"===t?1:-1),u="number"==typeof i&&!isNaN(i)&&l<i||"number"==typeof e&&!isNaN(e)&&l>e?s:l,c=r.decimalPlaces(s),d=r.decimalPlaces(o);this.setValue({committing:!0,nativeEvent:n,origin:"user",value:u.toFixed(Math.max(c,d))})}onFormReset(){this.setValue({origin:"reset",value:this.defaultValue})}syncHiddenFormInput(t){var e,i,n,a;"number"===this.type?(t.type="number",t.min=null!==(i=null===(e=this.min)||void 0===e?void 0:e.toString(10))&&void 0!==i?i:"",t.max=null!==(a=null===(n=this.max)||void 0===n?void 0:n.toString(10))&&void 0!==a?a:""):"text"===this.type?(t.type="text",null!=this.minLength&&(t.minLength=this.minLength),null!=this.maxLength&&(t.maxLength=this.maxLength)):"password"===this.type&&(t.type="password")}setDisabledAction(){const t=i.getSlotted(this.el,"action");t&&(this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"))}warnAboutInvalidNumberValue(t){"number"===this.type&&t&&!d(t)&&console.warn(`The specified value "${t}" cannot be parsed, or is out of range.`)}render(){const t=i.getElementDir(this.el),r=e.h("div",{class:N.loader},e.h("calcite-progress",{label:this.intlLoading,type:"indeterminate"})),o=e.h("button",{"aria-label":this.intlClear||C.clear,class:N.clearButton,disabled:this.disabled||this.readOnly,onClick:this.clearInputValue,tabIndex:this.disabled?-1:0,type:"button"},e.h("calcite-icon",{icon:"x",scale:"s"})),s=e.h("calcite-icon",{class:N.inputIcon,flipRtl:this.iconFlipRtl,icon:this.requestedIcon,scale:"s"}),l="horizontal"===this.numberButtonType,u=e.h("button",{class:{[N.numberButtonItem]:!0,[N.buttonItemHorizontal]:l},"data-adjustment":"up",disabled:this.disabled||this.readOnly,onMouseDown:this.numberButtonMouseDownHandler,onMouseOut:this.numberButtonMouseUpAndMouseOutHandler,onMouseUp:this.numberButtonMouseUpAndMouseOutHandler,tabIndex:-1,type:"button"},e.h("calcite-icon",{icon:"chevron-up",scale:"s"})),c=e.h("button",{class:{[N.numberButtonItem]:!0,[N.buttonItemHorizontal]:l},"data-adjustment":"down",disabled:this.disabled||this.readOnly,onMouseDown:this.numberButtonMouseDownHandler,onMouseOut:this.numberButtonMouseUpAndMouseOutHandler,onMouseUp:this.numberButtonMouseUpAndMouseOutHandler,tabIndex:-1,type:"button"},e.h("calcite-icon",{icon:"chevron-down",scale:"s"})),d=e.h("div",{class:N.numberButtonWrapper},u,c),h=e.h("div",{class:N.prefix},this.prefixText),m=e.h("div",{class:N.suffix},this.suffixText),p="number"===this.type?e.h("input",{"aria-label":n.getLabelText(this),autofocus:!!this.autofocus||null,defaultValue:this.defaultValue,disabled:!!this.disabled||null,enterKeyHint:this.el.enterKeyHint,inputMode:this.el.inputMode,key:"localized-input",maxLength:this.maxLength,minLength:this.minLength,name:void 0,onBlur:this.inputBlurHandler,onFocus:this.inputFocusHandler,onInput:this.inputNumberInputHandler,onKeyDown:this.inputNumberKeyDownHandler,onKeyUp:this.inputKeyUpHandler,placeholder:this.placeholder||"",readOnly:this.readOnly,ref:this.setChildNumberElRef,type:"text",value:this.localizedValue}):null,b="number"!==this.type?[e.h(this.childElType,{"aria-label":n.getLabelText(this),autofocus:!!this.autofocus||null,class:{[N.editingEnabled]:this.editingEnabled,[N.inlineChild]:!!this.inlineEditableEl},defaultValue:this.defaultValue,disabled:!!this.disabled||null,enterKeyHint:this.el.enterKeyHint,inputMode:this.el.inputMode,max:this.maxString,maxLength:this.maxLength,min:this.minString,minLength:this.minLength,name:this.name,onBlur:this.inputBlurHandler,onFocus:this.inputFocusHandler,onInput:this.inputInputHandler,onKeyDown:this.inputKeyDownHandler,onKeyUp:this.inputKeyUpHandler,placeholder:this.placeholder||"",readOnly:this.readOnly,ref:this.setChildElRef,required:!!this.required||null,step:this.step,tabIndex:this.disabled||this.inlineEditableEl&&!this.editingEnabled?-1:null,type:this.type,value:this.value}),this.isTextarea?e.h("div",{class:N.resizeIconWrapper},e.h("calcite-icon",{icon:"chevron-down",scale:"s"})):null]:null;return e.h(e.Host,{onClick:this.inputFocusHandler,onKeyDown:this.keyDownHandler},e.h("div",{class:{[N.inputWrapper]:!0,[i.CSS_UTILITY.rtl]:"rtl"===t}},"number"!==this.type||"horizontal"!==this.numberButtonType||this.readOnly?null:c,this.prefixText?h:null,e.h("div",{class:N.wrapper},p,b,this.isClearable?o:null,this.requestedIcon?s:null,this.loading?r:null),e.h("div",{class:N.actionWrapper},e.h("slot",{name:O.action})),"number"!==this.type||"vertical"!==this.numberButtonType||this.readOnly?null:d,this.suffixText?m:null,"number"!==this.type||"horizontal"!==this.numberButtonType||this.readOnly?null:u,e.h(a.HiddenFormInputSlot,{component:this})))}get el(){return this}static get watchers(){return{disabled:["disabledWatcher"],max:["maxWatcher"],min:["minWatcher"],value:["valueWatcher"],icon:["updateRequestedIcon"],type:["updateRequestedIcon"]}}static get style(){return T}},[1,"calcite-input",{alignment:[513],autofocus:[4],clearable:[516],disabled:[516],groupSeparator:[4,"group-separator"],hidden:[4],icon:[520],intlClear:[1,"intl-clear"],intlLoading:[1,"intl-loading"],iconFlipRtl:[516,"icon-flip-rtl"],label:[1],loading:[516],locale:[1],localeFormat:[4,"locale-format"],max:[514],min:[514],maxlength:[514],maxLength:[514,"max-length"],minLength:[514,"min-length"],name:[513],numberButtonType:[513,"number-button-type"],placeholder:[1],prefixText:[1,"prefix-text"],readOnly:[4,"read-only"],required:[4],scale:[1537],status:[1537],step:[520],suffixText:[1,"suffix-text"],editingEnabled:[1540,"editing-enabled"],type:[513],value:[1025],localizedValue:[32],setFocus:[64]}]);function S(){if("undefined"==typeof customElements)return;["calcite-input","calcite-icon","calcite-progress"].forEach((t=>{switch(t){case"calcite-input":customElements.get(t)||customElements.define(t,F);break;case"calcite-icon":customElements.get(t)||l.defineCustomElement();break;case"calcite-progress":customElements.get(t)||u.defineCustomElement()}}))}S(),t.Input=F,t.defineCustomElement=S}));
