/*
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","./debounce","./popper","./guid","./utils2","./label","./form","./observers","./interactive","./dom","./conditionalSlot","./icon"],(function(e,t,i,a,n,o,s,r,c,l,h,p,m){"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
   */var d=Array.isArray;function u(e){return e}var b="[object AsyncFunction]",f="[object Function]",g="[object GeneratorFunction]",v="[object Proxy]";function x(e){if(!i.isObject(e))return!1;var t=i.baseGetTag(e);return t==f||t==g||t==b||t==v}var y=9007199254740991,I=/^(?:0|[1-9]\d*)$/;function w(e,t){var i=typeof e;return!!(t=null==t?y:t)&&("number"==i||"symbol"!=i&&I.test(e))&&e>-1&&e%1==0&&e<t}var C=9007199254740991;function k(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=C}function E(e){return null!=e&&k(e.length)&&!x(e)}var D=Object.prototype;function A(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||D)}function H(e,t){for(var i=-1,a=Array(e);++i<e;)a[i]=t(i);return a}var S="[object Arguments]";function j(e){return i.isObjectLike(e)&&i.baseGetTag(e)==S}var F=Object.prototype,L=F.hasOwnProperty,P=F.propertyIsEnumerable,T=j(function(){return arguments}())?j:function(e){return i.isObjectLike(e)&&L.call(e,"callee")&&!P.call(e,"callee")};function O(){return!1}var M="object"==typeof e&&e&&!e.nodeType&&e,V=M&&"object"==typeof module&&module&&!module.nodeType&&module,z=V&&V.exports===M?i.root.Buffer:void 0,$=(z?z.isBuffer:void 0)||O,_="[object Arguments]",B="[object Array]",R="[object Boolean]",N="[object Date]",G="[object Error]",q="[object Function]",U="[object Map]",X="[object Number]",W="[object Object]",Y="[object RegExp]",K="[object Set]",J="[object String]",Q="[object WeakMap]",Z="[object ArrayBuffer]",ee="[object DataView]",te="[object Float64Array]",ie="[object Int8Array]",ae="[object Int16Array]",ne="[object Int32Array]",oe="[object Uint8Array]",se="[object Uint8ClampedArray]",re="[object Uint16Array]",ce="[object Uint32Array]",le={};function he(e){return i.isObjectLike(e)&&k(e.length)&&!!le[i.baseGetTag(e)]}function pe(e){return function(t){return e(t)}}le["[object Float32Array]"]=le[te]=le[ie]=le[ae]=le[ne]=le[oe]=le[se]=le[re]=le[ce]=!0,le[_]=le[B]=le[Z]=le[R]=le[ee]=le[N]=le[G]=le[q]=le[U]=le[X]=le[W]=le[Y]=le[K]=le[J]=le[Q]=!1;var me="object"==typeof e&&e&&!e.nodeType&&e,de=me&&"object"==typeof module&&module&&!module.nodeType&&module,ue=de&&de.exports===me&&i.freeGlobal.process,be=function(){try{var e=de&&de.require&&de.require("util").types;return e||ue&&ue.binding&&ue.binding("util")}catch(t){}}(),fe=be&&be.isTypedArray,ge=fe?pe(fe):he,ve=Object.prototype.hasOwnProperty;function xe(e,t){var i=d(e),a=!i&&T(e),n=!i&&!a&&$(e),o=!i&&!a&&!n&&ge(e),s=i||a||n||o,r=s?H(e.length,String):[],c=r.length;for(var l in e)!t&&!ve.call(e,l)||s&&("length"==l||n&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||w(l,c))||r.push(l);return r}function ye(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}var Ie=Object.prototype.hasOwnProperty;function we(e){if(!i.isObject(e))return ye(e);var t=A(e),a=[];for(var n in e)("constructor"!=n||!t&&Ie.call(e,n))&&a.push(n);return a}function Ce(e){return E(e)?xe(e,!0):we(e)}function ke(e){return function(t,i,a){for(var n=-1,o=Object(t),s=a(t),r=s.length;r--;){var c=s[e?r:++n];if(!1===i(o[c],c,o))break}return t}}var Ee=ke();function De(e){return"function"==typeof e?e:u}function Ae(e,t){return null==e?e:Ee(e,De(t),Ce)}
/*!
   * 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 He={title:"title",close:"close",imageContainer:"image-container",chipIcon:"chip-icon",closeIcon:"close-icon"},Se={close:"Close"},je={image:"image"},Fe={close:"x"},Le="@-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([scale=s]){height:1.5rem;font-size:var(--calcite-font-size--2);--calcite-chip-spacing-unit-l:0.5rem;--calcite-chip-spacing-unit-s:0.25rem}:host([scale=s]) .image-container{height:1.25rem;width:1.25rem}:host([scale=m]){height:2rem;font-size:var(--calcite-font-size--1);--calcite-chip-spacing-unit-l:0.75rem;--calcite-chip-spacing-unit-s:6px}:host([scale=m]) .image-container{height:1.5rem;width:1.5rem;-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}:host([scale=l]){height:2.75rem;font-size:var(--calcite-font-size-0);--calcite-chip-spacing-unit-l:1rem;--calcite-chip-spacing-unit-s:0.5rem}:host([scale=l]) .image-container{height:2rem;width:2rem;padding-left:0.25rem}:host{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-inline-flexbox;display:inline-flex;cursor:default;-ms-flex-align:center;align-items:center;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container{display:-ms-inline-flexbox;display:inline-flex;height:100%;max-width:100%;-ms-flex-align:center;align-items:center}.title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host span{padding:0 var(--calcite-chip-spacing-unit-l)}:host([dismissible]) span{padding-inline:var(--calcite-chip-spacing-unit-l) var(--calcite-chip-spacing-unit-s)}:host([icon]:not([dismissible])) span{padding:0 var(--calcite-chip-spacing-unit-l)}:host button{margin:0px;display:-ms-inline-flexbox;display:inline-flex;max-height:100%;min-height:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-item-align:stretch;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-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;-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;-webkit-appearance:none;border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0;padding:0 var(--calcite-chip-spacing-unit-s);color:inherit;--calcite-chip-transparent-hover:var(--calcite-button-transparent-hover);--calcite-chip-transparent-press:var(--calcite-button-transparent-press)}:host button:hover{background-color:var(--calcite-chip-transparent-hover)}:host button:focus{background-color:var(--calcite-chip-transparent-hover);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host button:active{background-color:var(--calcite-chip-transparent-press)}.image-container{display:-ms-inline-flexbox;display:inline-flex;overflow:hidden;border-radius:50%}:host slot[name=image]::slotted(*){display:-ms-flexbox;display:flex;height:100%;width:100%;overflow:hidden;border-radius:50%}.chip-icon{position:relative;margin-top:0px;margin-bottom:0px;display:-ms-inline-flexbox;display:inline-flex;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:0;margin-inline-end:0;-webkit-margin-start:var(--calcite-chip-spacing-unit-l);margin-inline-start:var(--calcite-chip-spacing-unit-l);border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0}:host([color=blue][appearance=solid]){border-color:transparent;background-color:var(--calcite-ui-info);color:var(--calcite-ui-text-inverse)}:host([color=red][appearance=solid]){border-color:transparent;background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}:host([color=yellow][appearance=solid]){border-color:transparent;background-color:var(--calcite-ui-warning);color:#151515}:host([color=green][appearance=solid]){border-color:transparent;background-color:var(--calcite-ui-success);color:#151515}:host([color=grey][appearance=solid]){border-color:transparent;background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}:host([color=grey][appearance=solid]) button,:host([color=grey][appearance=solid]) .close-icon{color:var(--calcite-ui-text-3)}:host([color=grey][appearance=solid]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([color=blue][appearance=clear]){border-color:var(--calcite-ui-info)}:host([color=blue][appearance=clear]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-info))}:host([color=red][appearance=clear]){border-color:var(--calcite-ui-danger)}:host([color=red][appearance=clear]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-danger))}:host([color=yellow][appearance=clear]){border-color:var(--calcite-ui-warning)}:host([color=yellow][appearance=clear]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-warning))}:host([color=green][appearance=clear]){border-color:var(--calcite-ui-success)}:host([color=green][appearance=clear]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-success))}:host([color=grey][appearance=clear]){border-color:var(--calcite-ui-border-1)}:host([color=grey][appearance=clear]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}",Pe=t.proxyCustomElement(class extends t.H{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteChipDismiss=t.createEvent(this,"calciteChipDismiss",7),this.appearance="solid",this.color="grey",this.dismissible=!1,this.dismissLabel=Se.close,this.iconFlipRtl=!1,this.scale="m",this.closeClickHandler=e=>{e.preventDefault(),this.calciteChipDismiss.emit(this.el)},this.guid=n.guid()}connectedCallback(){p.connectConditionalSlotComponent(this)}disconnectedCallback(){p.disconnectConditionalSlotComponent(this)}async setFocus(){var e;null===(e=this.closeButton)||void 0===e||e.focus()}renderChipImage(){const{el:e}=this;return h.getSlotted(e,je.image)?t.h("div",{class:He.imageContainer,key:"image"},t.h("slot",{name:je.image})):null}render(){const e=t.h("calcite-icon",{class:He.chipIcon,flipRtl:this.iconFlipRtl,icon:this.icon,scale:"s"}),i=t.h("button",{"aria-describedby":this.guid,"aria-label":this.dismissLabel,class:He.close,onClick:this.closeClickHandler,ref:e=>this.closeButton=e},t.h("calcite-icon",{class:He.closeIcon,icon:Fe.close,scale:"s"}));return t.h("div",{class:"container"},this.renderChipImage(),this.icon?e:null,t.h("span",{class:He.title,id:this.guid},t.h("slot",null)),this.dismissible?i:null)}get el(){return this}static get style(){return Le}},[1,"calcite-chip",{appearance:[513],color:[513],dismissible:[516],dismissLabel:[1,"dismiss-label"],icon:[513],iconFlipRtl:[516,"icon-flip-rtl"],scale:[513],value:[8],setFocus:[64]}]);function Te(){if("undefined"==typeof customElements)return;["calcite-chip","calcite-icon"].forEach((e=>{switch(e){case"calcite-chip":customElements.get(e)||customElements.define(e,Pe);break;case"calcite-icon":customElements.get(e)||m.defineCustomElement()}}))}
/*!
   * 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
   */
function Oe(e,t){for(var i=-1,a=null==e?0:e.length,n=Array(a);++i<a;)n[i]=t(e[i],i,e);return n}Te();var Me=1/0,Ve=i.Symbol?i.Symbol.prototype:void 0,ze=Ve?Ve.toString:void 0;function $e(e){if("string"==typeof e)return e;if(d(e))return Oe(e,$e)+"";if(i.isSymbol(e))return ze?ze.call(e):"";var t=e+"";return"0"==t&&1/e==-Me?"-0":t}function _e(e){return null==e?"":$e(e)}var Be=/[\\^$.*+?()[\]{}|]/g,Re=RegExp(Be.source);function Ne(e){return(e=_e(e))&&Re.test(e)?e.replace(Be,"\\$&"):e}const Ge=(e,t)=>{const i=Ne(t),a=new RegExp(i,"i");0===e.length&&console.warn("No data was passed to the filter function.\n    The data argument should be an array of objects");const n=(e,t)=>{var i;if(null===(i=e)||void 0===i?void 0:i.constant)return!0;let a=!1;return Ae(e,(e=>{"function"!=typeof e&&null!=e&&(Array.isArray(e)||"object"==typeof e&&null!==e?n(e,t)&&(a=!0):t.test(e)&&(a=!0))})),a};return e.filter((e=>n(e,a)))},qe="@-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{position:relative;display:block}: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]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}.wrapper{display:-ms-flexbox;display:flex;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-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;-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);padding:calc(var(--calcite-combobox-item-spacing-unit-s) / 4) var(--calcite-combobox-item-spacing-unit-l)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.wrapper--single{padding:0 var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.grid-input{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}.input{-ms-flex-positive:1;flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;height:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-width:120px;margin-bottom:var(--calcite-combobox-item-spacing-unit-s)}.input:focus{outline:2px solid transparent;outline-offset:2px}.input--transparent{opacity:0}.input--single{margin-bottom:0px;margin-top:0px;padding:0px}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;width:0px;min-width:0px;opacity:0}.input--icon{padding:0 var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1}.input-wrap--single{-ms-flex:1 1 0%;flex:1 1 0%;overflow:hidden}.label{pointer-events:none;display:-ms-flexbox;display:flex;max-width:100%;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);height:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--spaced{padding-top:0px;padding-bottom:0px;padding-left:var(--calcite-combobox-item-spacing-unit-l);padding-right:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:-ms-flexbox;display:flex;width:1rem;cursor:pointer;-ms-flex-align:center;align-items:center}.icon-end{-ms-flex:none;flex:none}.popper-container{width:100%;display:block;position:absolute;z-index:900;-webkit-transform:scale(0);transform:scale(0);visibility:hidden;pointer-events:none}.popper-container .calcite-popper-anim{position:relative;z-index:1;-webkit-transition:var(--calcite-popper-transition);transition:var(--calcite-popper-transition);visibility:hidden;-webkit-transition-property:visibility, opacity, -webkit-transform;transition-property:visibility, opacity, -webkit-transform;transition-property:transform, visibility, opacity;transition-property:transform, visibility, opacity, -webkit-transform;opacity:0;-webkit-box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);border-radius:0.25rem}.popper-container[data-popper-placement^=bottom] .calcite-popper-anim{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.popper-container[data-popper-placement^=top] .calcite-popper-anim{-webkit-transform:translateY(5px);transform:translateY(5px)}.popper-container[data-popper-placement^=left] .calcite-popper-anim{-webkit-transform:translateX(5px);transform:translateX(5px)}.popper-container[data-popper-placement^=right] .calcite-popper-anim{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.popper-container[data-popper-placement] .calcite-popper-anim--active{opacity:1;visibility:visible;-webkit-transform:translate(0);transform:translate(0)}.popper-container--active{pointer-events:initial;visibility:visible}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-height:100vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);width:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{height:0px;overflow:hidden}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-width:100%}.chip--active{background-color:var(--calcite-ui-foreground-3)}.item{display:block}::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}",Ue=e=>e.tagName===o.ComboboxItemGroup,Xe="combobox-item-",We="combobox-chip-",Ye="combobox-label-",Ke="combobox-listbox-",Je="combobox-input-",Qe=t.proxyCustomElement(class extends t.H{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteLookupChange=t.createEvent(this,"calciteLookupChange",7),this.calciteComboboxChange=t.createEvent(this,"calciteComboboxChange",7),this.calciteComboboxFilterChange=t.createEvent(this,"calciteComboboxFilterChange",7),this.calciteComboboxChipDismiss=t.createEvent(this,"calciteComboboxChipDismiss",7),this.calciteComboboxOpen=t.createEvent(this,"calciteComboboxOpen",7),this.calciteComboboxClose=t.createEvent(this,"calciteComboboxClose",7),this.active=!1,this.disabled=!1,this.maxItems=0,this.overlayPositioning="absolute",this.required=!1,this.selectionMode="multi",this.scale="m",this.value=null,this.intlRemoveTag=o.TEXT.removeTag,this.internalValueChangeFlag=!1,this.items=[],this.groupItems=[],this.selectedItems=[],this.visibleItems=[],this.activeItemIndex=-1,this.activeChipIndex=-1,this.activeDescendant="",this.text="",this.textInput=null,this.mutationObserver=c.createObserver("mutation",(()=>this.updateItems())),this.resizeObserver=c.createObserver("resize",(()=>this.setMaxScrollerHeight())),this.guid=n.guid(),this.inputHeight=0,this.ignoreSelectedEventsFlag=!1,this.activeTransitionProp="opacity",this.setFilteredPlacements=()=>{const{el:e,flipPlacements:t}=this;this.filteredFlipPlacements=t?a.filterComputedPlacements(t,e):null},this.getValue=()=>{const e=this.selectedItems.map((e=>{var t;return null===(t=null==e?void 0:e.value)||void 0===t?void 0:t.toString()}));return(null==e?void 0:e.length)?e.length>1?e:e[0]:""},this.onLabelClick=()=>{this.setFocus()},this.keydownHandler=e=>{const{key:t}=e;switch(t){case"Tab":this.activeChipIndex=-1,this.activeItemIndex=-1,this.allowCustomValues&&this.text?(this.addCustomChip(this.text,!0),e.preventDefault()):this.active&&(this.active=!1,e.preventDefault());break;case"ArrowLeft":this.previousChip();break;case"ArrowRight":this.nextChip();break;case"ArrowUp":this.shiftActiveItemIndex(-1),this.comboboxInViewport()||this.el.scrollIntoView();break;case"ArrowDown":this.active||(e.preventDefault(),this.active=!0),this.shiftActiveItemIndex(1),this.comboboxInViewport()||this.el.scrollIntoView();break;case" ":this.textInput.value||(e.preventDefault(),this.active=!0,this.shiftActiveItemIndex(1));break;case"Home":this.active&&e.preventDefault(),this.updateActiveItemIndex(0),this.scrollToActiveItem(),this.comboboxInViewport()||this.el.scrollIntoView();break;case"End":this.active&&e.preventDefault(),this.updateActiveItemIndex(this.visibleItems.length-1),this.scrollToActiveItem(),this.comboboxInViewport()||this.el.scrollIntoView();break;case"Escape":this.active=!1;break;case"Enter":this.activeItemIndex>-1?this.toggleSelection(this.visibleItems[this.activeItemIndex]):this.activeChipIndex>-1?this.removeActiveChip():this.allowCustomValues&&this.text?this.addCustomChip(this.text,!0):e.defaultPrevented||r.submitForm(this);break;case"Delete":case"Backspace":this.activeChipIndex>-1?this.removeActiveChip():!this.text&&this.isMulti()&&this.removeLastChip()}},this.toggleCloseEnd=()=>{this.active=!1,this.el.removeEventListener("calciteComboboxClose",this.toggleCloseEnd)},this.toggleOpenEnd=()=>{this.active=!0,this.el.removeEventListener("calciteComboboxOpen",this.toggleOpenEnd)},this.transitionEnd=e=>{e.propertyName===this.activeTransitionProp&&(this.active?this.calciteComboboxOpen.emit():this.calciteComboboxClose.emit())},this.setMaxScrollerHeight=()=>{const{active:e,listContainerEl:t}=this;if(!t||!e)return;this.reposition();const i=this.getMaxScrollerHeight();t.style.maxHeight=i>0?`${i}px`:"",this.reposition()},this.calciteChipDismissHandler=(e,t)=>{this.active=!1;const i=this.items.find((e=>e===t));i&&this.toggleSelection(i,!1),this.calciteComboboxChipDismiss.emit(e.detail)},this.clickHandler=e=>{e.composedPath().some((e=>"CALCITE-CHIP"===e.tagName))||(this.active=!this.active,this.updateActiveItemIndex(0),this.setFocus())},this.setInactiveIfNotContained=e=>{const t=e.composedPath();!this.active||t.includes(this.el)||t.includes(this.referenceEl)||(this.allowCustomValues&&this.text.trim().length&&this.addCustomChip(this.text),"single"===this.selectionMode&&(this.textInput&&(this.textInput.value=""),this.text="",this.filterItems(""),this.updateActiveItemIndex(-1)),this.active=!1)},this.setMenuEl=e=>{this.menuEl=e},this.setListContainerEl=e=>{this.resizeObserver.observe(e),this.listContainerEl=e},this.setReferenceEl=e=>{this.referenceEl=e},this.inputHandler=e=>{const t=e.target.value;this.text=t,this.filterItems(t),t&&(this.activeChipIndex=-1)},this.filterItems=(()=>{const e=(e,t)=>e&&t.some((({label:t,value:i})=>Ue(e)?i===e.label:i===e.textLabel||i===e.value||t===e.textLabel||t===e.value));return i.debounce((t=>{const i=Ge(this.data,t);this.getCombinedItems().forEach((t=>{const a=!e(t,i);t.hidden=a;const[n,o]=t.ancestors;(e(n,i)||e(o,i))&&(t.hidden=!1),a||t.ancestors.forEach((e=>e.hidden=!1))})),this.visibleItems=this.getVisibleItems(),this.calciteComboboxFilterChange.emit({visibleItems:[...this.visibleItems],text:t})}),100)})(),this.internalCalciteLookupChangeEvent=()=>{this.calciteLookupChange.emit(this.selectedItems)},this.emitCalciteLookupChange=i.debounce(this.internalCalciteLookupChangeEvent,0),this.internalComboboxChangeEvent=()=>{const{selectedItems:e}=this;this.calciteComboboxChange.emit({selectedItems:e})},this.emitComboboxChange=i.debounce(this.internalComboboxChangeEvent,0),this.updateItems=()=>{this.items=this.getItems(),this.groupItems=this.getGroupItems(),this.data=this.getData(),this.selectedItems=this.getSelectedItems(),this.visibleItems=this.getVisibleItems(),this.needsIcon=this.getNeedsIcon(),this.allowCustomValues||this.setMaxScrollerHeight()},this.scrollToActiveItem=()=>{const e=this.visibleItems[this.activeItemIndex],t=this.calculateSingleItemHeight(e),{offsetHeight:i,scrollTop:a}=this.listContainerEl;i+a<e.offsetTop+t?this.listContainerEl.scrollTop=e.offsetTop-i+t:e.offsetTop<a&&(this.listContainerEl.scrollTop=e.offsetTop)},this.comboboxFocusHandler=()=>{var e;null===(e=this.textInput)||void 0===e||e.focus()},this.comboboxBlurHandler=e=>{this.setInactiveIfNotContained(e)}}activeHandler(){this.disabled?this.active=!1:this.reposition()}handleDisabledChange(e){e||(this.active=!1)}maxItemsHandler(){this.setMaxScrollerHeight()}valueHandler(e){if(!this.internalValueChangeFlag){const t=this.getItems();Array.isArray(e)?t.forEach((t=>t.selected=e.includes(t.value))):e?t.forEach((t=>t.selected=e===t.value)):t.forEach((e=>e.selected=!1)),this.updateItems()}}flipPlacementsHandler(){this.setFilteredPlacements()}documentClickHandler(e){this.setInactiveIfNotContained(e)}calciteComboboxItemChangeHandler(e){if(this.ignoreSelectedEventsFlag)return;const t=e.target,i=this.visibleItems.indexOf(t);this.updateActiveItemIndex(i),this.toggleSelection(t,t.selected)}async reposition(){const{popper:e,menuEl:t}=this,i=this.getModifiers();e?await a.updatePopper({el:t,modifiers:i,placement:a.defaultMenuPlacement,popper:e}):this.createPopper()}async setFocus(){var e;null===(e=this.textInput)||void 0===e||e.focus(),this.activeChipIndex=-1,this.activeItemIndex=-1}connectedCallback(){var e;this.internalValueChangeFlag=!0,this.value=this.getValue(),this.internalValueChangeFlag=!1,null===(e=this.mutationObserver)||void 0===e||e.observe(this.el,{childList:!0,subtree:!0}),this.createPopper(),s.connectLabel(this),r.connectForm(this),this.setFilteredPlacements()}componentWillLoad(){this.updateItems()}componentDidLoad(){r.afterConnectDefaultValueSet(this,this.getValue())}componentDidRender(){this.el.offsetHeight!==this.inputHeight&&(this.reposition(),this.inputHeight=this.el.offsetHeight),l.updateHostInteraction(this)}disconnectedCallback(){var e,t;null===(e=this.mutationObserver)||void 0===e||e.disconnect(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.destroyPopper(),s.disconnectLabel(this),r.disconnectForm(this)}selectedItemsHandler(){this.internalValueChangeFlag=!0,this.value=this.getValue(),this.internalValueChangeFlag=!1}textHandler(){this.updateActiveItemIndex(-1)}comboboxInViewport(){const e=this.el.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.right<=(window.innerWidth||document.documentElement.clientWidth)&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)}getModifiers(){const e={name:"flip",enabled:!0};e.options={fallbackPlacements:this.filteredFlipPlacements||a.popperMenuComputedPlacements};return[e,{name:"eventListeners",enabled:this.active}]}createPopper(){this.destroyPopper();const{menuEl:e,referenceEl:t,overlayPositioning:i}=this,n=this.getModifiers();this.popper=a.createPopper({el:e,modifiers:n,overlayPositioning:i,placement:a.defaultMenuPlacement,referenceEl:t})}destroyPopper(){const{popper:e}=this;e&&e.destroy(),this.popper=null}getMaxScrollerHeight(){const e=this.getCombinedItems().filter((e=>!e.hidden)),{maxItems:t}=this;let i=0,a=0;return e.length>t&&e.forEach((e=>{if(i<t&&t>0){const t=this.calculateSingleItemHeight(e);t>0&&(a+=t,i++)}})),a}calculateSingleItemHeight(e){let t=e.offsetHeight;return Array.from(e.querySelectorAll(o.ComboboxChildSelector)).map((e=>null==e?void 0:e.offsetHeight)).forEach((e=>{t-=e})),t}getCombinedItems(){return[...this.groupItems,...this.items]}toggleSelection(e,t=!e.selected){e&&(this.isMulti()?(e.selected=t,this.updateAncestors(e),this.selectedItems=this.getSelectedItems(),this.emitCalciteLookupChange(),this.emitComboboxChange(),this.resetText(),this.filterItems("")):(this.ignoreSelectedEventsFlag=!0,this.items.forEach((i=>i.selected=i===e&&t)),this.ignoreSelectedEventsFlag=!1,this.selectedItems=this.getSelectedItems(),this.emitComboboxChange(),this.textInput&&(this.textInput.value=e.textLabel),this.active=!1,this.updateActiveItemIndex(-1),this.resetText(),this.filterItems("")))}updateAncestors(e){if("ancestors"!==this.selectionMode)return;const t=o.getItemAncestors(e),i=o.getItemChildren(e);e.selected?t.forEach((e=>{e.selected=!0})):(i.forEach((e=>e.selected=!1)),[...t].forEach((e=>{o.hasActiveChildren(e)||(e.selected=!1)})))}getVisibleItems(){return this.items.filter((e=>!e.hidden))}getSelectedItems(){if(!this.isMulti()){const e=this.items.find((({selected:e})=>e));return e?[e]:[]}return this.items.filter((e=>e.selected&&("ancestors"!==this.selectionMode||!o.hasActiveChildren(e)))).sort(((e,t)=>{const i=this.selectedItems.indexOf(e),a=this.selectedItems.indexOf(t);return i>-1&&a>-1?i-a:a-i}))}getData(){return this.items.map((e=>({constant:e.constant,value:e.value,label:e.textLabel})))}getNeedsIcon(){return"single"===this.selectionMode&&this.items.some((e=>e.icon))}resetText(){this.textInput&&(this.textInput.value=""),this.text=""}getItems(){return Array.from(this.el.querySelectorAll(o.ComboboxItem)).filter((e=>!e.disabled))}getGroupItems(){return Array.from(this.el.querySelectorAll(o.ComboboxItemGroup))}addCustomChip(e,t){const i=this.items.find((t=>t.textLabel===e));if(i)this.toggleSelection(i,!0);else{this.isMulti()||this.toggleSelection(this.selectedItems[this.selectedItems.length-1],!1);const i=document.createElement(o.ComboboxItem);i.value=e,i.textLabel=e,i.selected=!0,this.el.appendChild(i),this.resetText(),t&&this.setFocus(),this.updateItems(),this.filterItems(""),this.emitCalciteLookupChange(),this.emitComboboxChange()}}removeActiveChip(){this.toggleSelection(this.selectedItems[this.activeChipIndex],!1),this.setFocus()}removeLastChip(){this.toggleSelection(this.selectedItems[this.selectedItems.length-1],!1),this.setFocus()}previousChip(){if(this.text)return;const e=this.selectedItems.length-1,t=this.activeChipIndex;this.activeChipIndex=-1===t?e:Math.max(t-1,0),this.updateActiveItemIndex(-1),this.focusChip()}nextChip(){if(this.text||-1===this.activeChipIndex)return;const e=this.selectedItems.length-1,t=this.activeChipIndex+1;t>e?(this.activeChipIndex=-1,this.setFocus()):(this.activeChipIndex=t,this.focusChip()),this.updateActiveItemIndex(-1)}focusChip(){var e;const t=null===(e=this.selectedItems[this.activeChipIndex])||void 0===e?void 0:e.guid,i=t?this.referenceEl.querySelector(`#${We}${t}`):null;null==i||i.setFocus()}shiftActiveItemIndex(e){const{length:t}=this.visibleItems,i=(this.activeItemIndex+t+e)%t;this.updateActiveItemIndex(i),this.scrollToActiveItem()}updateActiveItemIndex(e){var t;this.activeItemIndex=e;let i=null;this.visibleItems.forEach(((t,a)=>{a===e?(t.active=!0,i=t.guid):t.active=!1})),this.activeDescendant=i,this.activeItemIndex>-1&&(this.activeChipIndex=-1,null===(t=this.textInput)||void 0===t||t.focus())}isMulti(){return"single"!==this.selectionMode}renderChips(){const{activeChipIndex:e,scale:i,selectionMode:a,intlRemoveTag:n}=this;return this.selectedItems.map(((s,r)=>{const c={chip:!0,"chip--active":e===r},l=[...[...o.getItemAncestors(s)].reverse(),s].map((e=>e.textLabel)),h="ancestors"!==a?s.textLabel:l.join(" / ");return t.h("calcite-chip",{class:c,dismissLabel:n,dismissible:!0,icon:s.icon,id:s.guid?`${We}${s.guid}`:null,key:s.textLabel,onCalciteChipDismiss:e=>this.calciteChipDismissHandler(e,s),scale:i,title:h,value:s.value},h)}))}renderInput(){const{guid:e,active:i,disabled:a,placeholder:n,selectionMode:o,needsIcon:r,selectedItems:c}=this,l="single"===o,h=c[0],p=!i&&l&&!!h;return t.h("span",{class:{"input-wrap":!0,"input-wrap--single":l}},p&&t.h("span",{class:{label:!0,"label--spaced":r},key:"label"},h.textLabel),t.h("input",{"aria-activedescendant":this.activeDescendant,"aria-autocomplete":"list","aria-controls":`${Ke}${e}`,"aria-label":s.getLabelText(this),class:{input:!0,"input--single":!0,"input--transparent":this.activeChipIndex>-1,"input--hidden":p,"input--icon":l&&r},disabled:a,id:`${Je}${e}`,key:"input",onBlur:this.comboboxBlurHandler,onFocus:this.comboboxFocusHandler,onInput:this.inputHandler,placeholder:n,ref:e=>this.textInput=e,type:"text"}))}renderListBoxOptions(){return this.visibleItems.map((e=>t.h("li",{"aria-selected":h.toAriaBoolean(e.selected),id:e.guid?`${Xe}${e.guid}`:null,role:"option",tabindex:"-1"},e.textLabel)))}renderPopperContainer(){const{active:e,setMenuEl:i,setListContainerEl:n}=this,o={"list-container":!0,[a.CSS.animation]:!0,[a.CSS.animationActive]:e};return t.h("div",{"aria-hidden":"true",class:{"popper-container":!0,"popper-container--active":e},ref:i},t.h("div",{class:o,onTransitionEnd:this.transitionEnd,ref:n},t.h("ul",{class:{list:!0,"list--hide":!e}},t.h("slot",null))))}renderIconStart(){const{selectionMode:e,needsIcon:i,selectedItems:a}=this,n=a[0];return"single"===e&&i&&t.h("span",{class:"icon-start"},(null==n?void 0:n.icon)&&t.h("calcite-icon",{class:"selected-icon",icon:n.icon,scale:"s"}))}renderIconEnd(){const{active:e}=this;return t.h("span",{class:"icon-end"},t.h("calcite-icon",{icon:e?"chevron-up":"chevron-down",scale:"s"}))}render(){const{active:e,guid:i,label:a}=this,n="single"===this.selectionMode;return t.h(t.Host,{onKeyDown:this.keydownHandler},t.h("div",{"aria-autocomplete":"list","aria-expanded":h.toAriaBoolean(e),"aria-haspopup":"listbox","aria-labelledby":`${Ye}${i}`,"aria-owns":`${Ke}${i}`,class:{wrapper:!0,"wrapper--single":n||!this.selectedItems.length,"wrapper--active":e},onClick:this.clickHandler,ref:this.setReferenceEl,role:"combobox"},t.h("div",{class:"grid-input"},this.renderIconStart(),!n&&this.renderChips(),t.h("label",{class:"screen-readers-only",htmlFor:`${Je}${i}`,id:`${Ye}${i}`},a),this.renderInput()),this.renderIconEnd()),t.h("ul",{"aria-labelledby":`${Ye}${i}`,"aria-multiselectable":"true",class:"screen-readers-only",id:`${Ke}${i}`,role:"listbox",tabIndex:-1},this.renderListBoxOptions()),this.renderPopperContainer(),t.h(r.HiddenFormInputSlot,{component:this}))}get el(){return this}static get watchers(){return{active:["activeHandler"],disabled:["handleDisabledChange"],maxItems:["maxItemsHandler"],value:["valueHandler"],flipPlacements:["flipPlacementsHandler"],selectedItems:["selectedItemsHandler"],text:["textHandler"]}}static get style(){return qe}},[1,"calcite-combobox",{active:[1540],disabled:[516],label:[1],placeholder:[1],maxItems:[2,"max-items"],name:[513],allowCustomValues:[4,"allow-custom-values"],overlayPositioning:[1,"overlay-positioning"],required:[4],selectionMode:[513,"selection-mode"],scale:[513],value:[1025],intlRemoveTag:[1,"intl-remove-tag"],flipPlacements:[16],items:[32],groupItems:[32],selectedItems:[32],visibleItems:[32],needsIcon:[32],activeItemIndex:[32],activeChipIndex:[32],activeDescendant:[32],text:[32],reposition:[64],setFocus:[64]},[[4,"click","documentClickHandler"],[0,"calciteComboboxItemChange","calciteComboboxItemChangeHandler"]]]);function Ze(){if("undefined"==typeof customElements)return;["calcite-combobox","calcite-chip","calcite-icon"].forEach((e=>{switch(e){case"calcite-combobox":customElements.get(e)||customElements.define(e,Qe);break;case"calcite-chip":customElements.get(e)||Te();break;case"calcite-icon":customElements.get(e)||m.defineCustomElement()}}))}Ze();const et=Qe,tt=Ze;e.CalciteCombobox=et,e.defineCustomElement=tt,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
