@tylertech/forge 2.12.4 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +1 -1
  2. package/custom-elements.json +25 -22
  3. package/dist/esm/app-bar/help-button/index.js +1 -1
  4. package/dist/esm/app-bar/index.js +1 -1
  5. package/dist/esm/autocomplete/index.js +1 -1
  6. package/dist/esm/chunks/{chunk.DCLBX6PX.js → chunk.6SGRP4FO.js} +2 -2
  7. package/dist/esm/chunks/{chunk.DCLBX6PX.js.map → chunk.6SGRP4FO.js.map} +0 -0
  8. package/dist/esm/chunks/{chunk.SZL74RTY.js → chunk.6XXKSGW5.js} +2 -2
  9. package/dist/esm/chunks/{chunk.SZL74RTY.js.map → chunk.6XXKSGW5.js.map} +0 -0
  10. package/dist/esm/chunks/{chunk.MOARJZVS.js → chunk.75KFBRF6.js} +2 -2
  11. package/dist/esm/chunks/{chunk.MOARJZVS.js.map → chunk.75KFBRF6.js.map} +0 -0
  12. package/dist/esm/chunks/{chunk.WUPPCCF2.js → chunk.BX7242PC.js} +2 -2
  13. package/dist/esm/chunks/{chunk.WUPPCCF2.js.map → chunk.BX7242PC.js.map} +1 -1
  14. package/dist/esm/chunks/{chunk.DVMUMHVM.js → chunk.DQBSFX46.js} +2 -2
  15. package/dist/esm/chunks/{chunk.DVMUMHVM.js.map → chunk.DQBSFX46.js.map} +0 -0
  16. package/dist/esm/chunks/{chunk.KGW63HJX.js → chunk.F2TKPPK7.js} +2 -2
  17. package/dist/esm/chunks/{chunk.KGW63HJX.js.map → chunk.F2TKPPK7.js.map} +0 -0
  18. package/dist/esm/chunks/{chunk.D3DLVPPE.js → chunk.J2ODMCFS.js} +2 -2
  19. package/dist/esm/chunks/{chunk.D3DLVPPE.js.map → chunk.J2ODMCFS.js.map} +0 -0
  20. package/dist/esm/chunks/{chunk.EMDSXK65.js → chunk.J6CIWTDH.js} +2 -2
  21. package/dist/esm/chunks/{chunk.EMDSXK65.js.map → chunk.J6CIWTDH.js.map} +0 -0
  22. package/dist/esm/chunks/chunk.LMOYZQZJ.js +7 -0
  23. package/dist/esm/chunks/chunk.LMOYZQZJ.js.map +7 -0
  24. package/dist/esm/chunks/{chunk.JAEVBPHT.js → chunk.O2XO3IRX.js} +2 -2
  25. package/dist/esm/chunks/{chunk.JAEVBPHT.js.map → chunk.O2XO3IRX.js.map} +0 -0
  26. package/dist/esm/chunks/{chunk.VW4KKRF5.js → chunk.ON3JVSSR.js} +2 -2
  27. package/dist/esm/chunks/{chunk.VW4KKRF5.js.map → chunk.ON3JVSSR.js.map} +0 -0
  28. package/dist/esm/chunks/{chunk.6ZCECXMM.js → chunk.PZTAIVJW.js} +2 -2
  29. package/dist/esm/chunks/{chunk.6ZCECXMM.js.map → chunk.PZTAIVJW.js.map} +0 -0
  30. package/dist/esm/chunks/{chunk.7ZGIIEIW.js → chunk.QEHJJKFZ.js} +2 -2
  31. package/dist/esm/chunks/{chunk.7ZGIIEIW.js.map → chunk.QEHJJKFZ.js.map} +0 -0
  32. package/dist/esm/chunks/chunk.QOZLQPKE.js +7 -0
  33. package/dist/esm/chunks/chunk.QOZLQPKE.js.map +7 -0
  34. package/dist/esm/chunks/{chunk.G5Q2CUUE.js → chunk.RGWUF3J2.js} +2 -2
  35. package/dist/esm/chunks/{chunk.G5Q2CUUE.js.map → chunk.RGWUF3J2.js.map} +0 -0
  36. package/dist/esm/chunks/{chunk.F3W3XMGT.js → chunk.RST65QIB.js} +2 -2
  37. package/dist/esm/chunks/{chunk.F3W3XMGT.js.map → chunk.RST65QIB.js.map} +0 -0
  38. package/dist/esm/chunks/{chunk.HAOBWYPY.js → chunk.WIUER75G.js} +2 -2
  39. package/dist/esm/chunks/{chunk.HAOBWYPY.js.map → chunk.WIUER75G.js.map} +0 -0
  40. package/dist/esm/date-range-picker/index.js +1 -1
  41. package/dist/esm/index.js +1 -1
  42. package/dist/esm/list/index.js +1 -1
  43. package/dist/esm/list/list/index.js +1 -1
  44. package/dist/esm/list/list-item/index.js +1 -1
  45. package/dist/esm/list-dropdown/index.js +1 -1
  46. package/dist/esm/menu/index.js +1 -1
  47. package/dist/esm/paginator/index.js +1 -1
  48. package/dist/esm/select/core/index.js +1 -1
  49. package/dist/esm/select/index.js +1 -1
  50. package/dist/esm/select/select/index.js +1 -1
  51. package/dist/esm/select/select-dropdown/index.js +1 -1
  52. package/dist/esm/split-view/index.js +1 -1
  53. package/dist/esm/split-view/split-view/index.js +1 -1
  54. package/dist/esm/split-view/split-view-panel/index.js +1 -1
  55. package/dist/esm/time-picker/index.js +1 -1
  56. package/esm/date-range-picker/date-range-picker-foundation.d.ts +1 -0
  57. package/esm/date-range-picker/date-range-picker-foundation.js +15 -3
  58. package/esm/list/list-item/list-item-adapter.d.ts +7 -2
  59. package/esm/list/list-item/list-item-adapter.js +10 -4
  60. package/esm/list/list-item/list-item-foundation.js +8 -2
  61. package/esm/list/list-item/list-item.d.ts +1 -1
  62. package/esm/list/list-item/list-item.js +1 -1
  63. package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
  64. package/package.json +1 -1
  65. package/dist/esm/chunks/chunk.7JTKKFL4.js +0 -7
  66. package/dist/esm/chunks/chunk.7JTKKFL4.js.map +0 -7
  67. package/dist/esm/chunks/chunk.VOMWB7Q6.js +0 -7
  68. package/dist/esm/chunks/chunk.VOMWB7Q6.js.map +0 -7
@@ -3,5 +3,5 @@
3
3
  * Copyright 2022 Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import{a as rt}from"./chunk.E37HEAJ5.js";import{d as at}from"./chunk.NNGE722W.js";import{a as f,b as nt}from"./chunk.IMK2LFWR.js";import{h as st}from"./chunk.KGW63HJX.js";import{c as et}from"./chunk.D3DLVPPE.js";import{e as tt}from"./chunk.7JTKKFL4.js";import{e as it}from"./chunk.3UMBCR4P.js";import{a as E,b as ot}from"./chunk.BOENNFXE.js";import{j as K}from"./chunk.LZMYHIO2.js";import{a as F}from"./chunk.D4SNVKDA.js";import{a as Q,d as Z,l as w}from"./chunk.YAJT3P6V.js";import{a as $}from"./chunk.24D46RLZ.js";import{g as J}from"./chunk.7ZS4N2FT.js";import{j as b,k as X,m as G,n as q,o as Y,p as j}from"./chunk.KYCC3C3M.js";import{a as z}from"./chunk.A23NSEWA.js";import{a as u}from"./chunk.B3IJU6XJ.js";import{a as R,b as B}from"./chunk.BSZ2LBJX.js";import{a as W}from"./chunk.3E5QKMHL.js";import{a as N,e as H,g as V,i as U}from"./chunk.HN4PXH3D.js";import{m as A,s as P,u as x}from"./chunk.R4NDFXVA.js";import{a as S,k as c,l as L,o as y}from"./chunk.G76HB2FK.js";import{a as k,f as p}from"./chunk.MCIQXNKY.js";var h=`${B}time-picker`,lt={TOGGLE:"forge-time-picker-toggle",VALUE:"value",OPEN:"open",ALLOW_SECONDS:"allow-seconds",MASKED:"masked",SHOW_MASK_FORMAT:"show-mask-format",USE_24_HOUR_TIME:"use-24-hour-time",ALLOW_INVALID_TIME:"allow-invalid-time",MIN:"min",MAX:"max",START_TIME:"start-time",STEP:"step",ALLOW_INPUT:"allow-input",SHOW_NOW:"show-now",SHOW_HOUR_OPTIONS:"show-hour-options",DISABLED:"disabled",POPUP_CLASSES:"popup-classes",ALLOW_DROPDOWN:"allow-dropdown"},ft={INPUT:"input, input[forge-time-picker-input]",TOGGLE:`[${lt.TOGGLE}]`},gt={OPEN:`${h}-open`,CLOSE:`${h}-close`,INPUT:`${h}-input`,CHANGE:`${h}-change`},vt={DEFAULT_MINUTE_STEP:60,MAX_DAY_MILLIS:864e5,MAX_DAY_MINUTES:1440},s={elementName:h,attributes:lt,selectors:ft,events:gt,numbers:vt};var g=class extends z{constructor(e){super(e)}initialize(){this._inputElement=this._component.querySelector(s.selectors.INPUT)}initializeMask(e){this._inputMask&&this._inputMask.destroy(),this._inputMask=new J(this._inputElement,e)}destroy(){this._targetElement=void 0,this._toggleElement=void 0,this._inputElement=void 0}destroyMask(){this._inputMask&&(this._inputMask.destroy(),this._inputMask=void 0)}initializeAccessibility(e){this._inputElement.setAttribute("autocomplete","off"),this._inputElement.setAttribute("autocorrect","off"),this._inputElement.setAttribute("autocapitalize","off"),this._inputElement.setAttribute("spellcheck","false"),this._inputElement.setAttribute("role","combobox"),this._inputElement.setAttribute("aria-live","assertive"),this._inputElement.setAttribute("aria-atomic","true"),this._inputElement.setAttribute("aria-haspopup","true"),this._inputElement.setAttribute("aria-expanded","false")}addInputListener(e,i,n){this._inputElement.addEventListener(e,i,{capture:n})}removeInputListener(e,i,n){this._inputElement&&this._inputElement.removeEventListener(e,i,{capture:n})}addToggleListener(e,i){this._toggleElement&&this._toggleElement.addEventListener(e,i)}removeToggleListener(e,i){this._toggleElement&&this._toggleElement.removeEventListener(e,i)}hasInputElement(){return!!this._inputElement}tryCreateToggle(){let e=this._component.querySelector(f.elementName),i=this._component.querySelector(s.selectors.TOGGLE);if(e){let n=e.querySelector(`${E.elementName}[slot=trailing]`);if(n||i){this._toggleElement=n||i;return}let l=document.createElement(E.elementName);l.slot="trailing",l.dense=!0,l.densityLevel=3,l.style.marginRight="4px";let o=document.createElement("button");o.type="button",o.tabIndex=-1,o.setAttribute("aria-label","Toggle time dropdown");let d=document.createElement(Q.elementName);d.name="clock_outline",o.appendChild(d),l.appendChild(o),e.appendChild(l),this._toggleElement=l}else i&&(this._toggleElement=i)}tryFocusInput(){this._inputElement.select()}tryBlurInput(){this._inputElement.blur()}selectInputText(){this._inputElement.select()}isInputDisabled(){return this._inputElement.disabled}isInputFocused(){return P()===this._inputElement}setInputValue(e,i){this._inputElement.value!==e&&(this._inputElement.value=e,this._inputMask&&this._inputMask.update(),i&&(this._emitInputEvent("change"),this._emitInputEvent("input")))}getInputValue(){return this._inputMask?this._inputMask.maskedValue:this._inputElement.value}setDisabled(e){this._inputElement.disabled=e,this._inputElement.setAttribute("aria-disabled",e.toString()),this.setToggleDisabled(e)}attachDropdown(e){this._listDropdown=new st(this._inputElement,e),this._listDropdown.open(),this._inputElement.setAttribute("aria-controls",`list-dropdown-popup-${e.id}`)}detachDropdown(){this._listDropdown&&(this._listDropdown.close(),this._listDropdown.destroy(),this._listDropdown=void 0),this._inputElement.removeAttribute("aria-controls")}propagateKey(e){var i;(i=this._listDropdown)==null||i.handleKey(e)}setActiveDescendant(e){x(this._inputElement,!!e,"aria-activedescendant",e)}getTargetElementWidth(e){return this._getTargetElement(e).getBoundingClientRect().width}_emitInputEvent(e){this._inputElement.dispatchEvent(new Event(e))}emitInputEvent(e,i){U(this._inputElement,e,i)}setInputReadonly(e){this._inputElement.readOnly=e}setToggleDisabled(e){if(this._toggleElement)if(this._toggleElement.setAttribute("aria-disabled",e.toString()),"disabled"in this._toggleElement)this._toggleElement.disabled=e;else{let i=this._toggleElement.querySelector("button");i&&(i.disabled=e)}}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}getActiveOption(){var e;return(e=this._listDropdown)==null?void 0:e.getActiveOption()}_getTargetElement(e){return this._targetElement?this._targetElement:(this._targetElement=e?this._component.querySelector(e)||this._getDefaultTargetElement():this._getDefaultTargetElement(),this._targetElement)}_getDefaultTargetElement(){let e=this._component.querySelector(f.elementName);if(e&&e.shadowRoot){let i=V(e,f.selectors.ROOT);if(i)return i}return this._component}};function C(a,t,e){if(!a||/^\s*$/.test(a))return null;let i=0,n=0,l=0;if(b.test(a)){let o=G(a);i=+o.hours||0,n=+o.minutes||0,l=+o.seconds||0}else if(X.test(a)){let o=q(a);i=+o.hours||0,n=+o.minutes||0,l=+o.seconds||0,i===12&&o.meridiem==="AM"&&(i=0),i<12&&o.meridiem==="PM"&&(i+=12)}else return null;return dt(i)+I(n)+(e?O(l):0)}function m(a,t,e){if(typeof a!="number"||a<0)return null;let i=Math.min(pt(a),23),n=Math.min(ut(a),59),o=a/(1e3*60)<720?"AM":"PM";t||(i=i<=12?i:i-12,i===0&&(i=12));let d=`${String(i).padStart(2,"0")}:${String(n).padStart(2,"0")}`;if(e){let _=Math.min(M(a),59);d+=`:${String(_).padStart(2,"0")}`}return t||(d+=` ${o}`),d}function pt(a){return Math.abs(Math.floor(a/(1e3*60*60)))}function ut(a){return Math.abs(Math.floor(v(a)%60))}function v(a){return a/(1e3*60)}function M(a){return Math.abs(Math.floor(It(a)%60))}function It(a){return a/1e3}function dt(a){return a*60*60*1e3}function I(a){return a*60*1e3}function O(a){return a*1e3}function mt(a){return a-O(M(a))}function D(a){let t=new Date,e=t.getHours(),i=t.getMinutes();return dt(e)+I(i)+(a?O(t.getSeconds()):0)}function Rt(a,t,e=!1){a||(a=new Date);let i=C(t,!0,e);if(!i)return a.setHours(0,0,0),a;let n=pt(i),l=828e5;n>l?n=l:n<0&&(n=0);let o=ut(i),d=e?M(i):0;return a.setHours(n,o,d),a}var T=class{constructor(t){this._adapter=t;this._value=null;this._masked=!0;this._use24HourTime=!1;this._showMaskFormat=!1;this._min=null;this._max=null;this._restrictedTimes=[];this._startTime=null;this._step=s.numbers.DEFAULT_MINUTE_STEP;this._allowInput=!0;this._open=!1;this._allowSeconds=!1;this._allowInvalidTime=!1;this._showNow=!1;this._showHourOptions=!0;this._customOptions=[];this._disabled=!1;this._popupClasses=[];this._allowDropdown=!0;this._isInitialized=!1;this._identifier=S(),this._inputListener=e=>this._onInput(e),this._inputKeydownListener=e=>this._onInputKeydown(e),this._toggleMousedownListener=e=>this._onToggleMousedown(e),this._inputFocusListener=e=>this._onInputFocus(e),this._inputBlurListener=e=>this._onInputBlur(e),this._inputMousedownListener=e=>this._onInputMousedown(e)}initialize(){if(this._adapter.initialize(),!this._adapter.hasInputElement())throw new Error("Unable to locate <input> element to attach to.");if(this._adapter.initializeAccessibility(this._identifier),!this._value){let t=this._adapter.getInputValue();this._setValue(this._convertTimeStringToMillis(t,this._use24HourTime,this._allowSeconds))}this._adapter.addInputListener("focus",this._inputFocusListener),this._adapter.addInputListener("blur",this._inputBlurListener),this._adapter.addInputListener("keydown",this._inputKeydownListener,!0),this._formatInputValue(!1),typeof this._value=="number"&&this._applyValue(this._value,!1),this._applyAllowInput(),this._applyAllowDropdown(),this._applyDisabled(),this._applyMask(),this._isInitialized=!0}disconnect(){this._isInitialized=!1,this._adapter.removeInputListener("input",this._inputListener),this._adapter.removeInputListener("focus",this._inputFocusListener),this._adapter.removeInputListener("blur",this._inputBlurListener),this._adapter.removeToggleListener("mousedown",this._toggleMousedownListener),this._adapter.removeInputListener("keydown",this._inputKeydownListener,!0),this._masked&&this._adapter.destroyMask(),this._closeDropdown(),this._adapter.destroy()}_onInput(t){this._handleInput(this._adapter.getInputValue())}_onInputKeydown(t){if(t.shiftKey)switch(t.code){case"Backspace":case"Delete":t.preventDefault(),this._trySetValue(null)&&this._formatInputValue();return}switch(t.code){case"Tab":this._open&&this._selectActiveOption();break;case"Esc":case"Escape":this._open&&(t.preventDefault(),this._closeDropdown(!0));break;case"Down":case"ArrowDown":this._allowDropdown&&(t.preventDefault(),this._open?this._adapter.propagateKey(t.code):(this._openDropdown(),this._adapter.activateFirstOption()));break;case"Up":case"ArrowUp":this._allowDropdown&&(t.preventDefault(),this._open&&this._adapter.propagateKey(t.code));break;case"Enter":case"Home":case"End":this._open&&(t.code==="Enter"&&t.stopPropagation(),t.preventDefault(),this._adapter.propagateKey(t.code));break;case"KeyN":t.preventDefault();let e=D(this._allowSeconds);if(this._value!==e){let i=m(e,!0,this._allowSeconds);this._emitChangeEvent(i)&&(this._applyValue(e),this._selectInputText())}break}}_selectActiveOption(){let t=this._adapter.getActiveOption();t&&this._onSelect(t.value)}_onToggleMousedown(t){this._disabled||!this.allowDropdown||(t.stopPropagation(),!this._adapter.isInputDisabled()&&(t.preventDefault(),this._open?this._closeDropdown(!0):(F.isMobile?this._adapter.tryBlurInput():this._adapter.tryFocusInput(),this._openDropdown())))}_onInputFocus(t){this._allowInput&&this._adapter.selectInputText()}_onInputBlur(t){this._formatInputValue(),this._open&&!this._adapter.isInputFocused()&&this._closeDropdown(!0)}_onInputMousedown(t){!this._allowInput&&!this._open&&(this._openDropdown(),this._adapter.tryFocusInput(),window.requestAnimationFrame(()=>this._adapter.selectInputText()))}_applyDisabled(){this._adapter.setDisabled(this._disabled)}_applyMask(){if(this._masked&&this._allowInput){let t={showMaskFormat:this._showMaskFormat,use24HourTime:this._use24HourTime,showSeconds:this._allowSeconds,prepareCallback:this._prepareMaskCallback,onChange:y(e=>this._handleInput(e),0,!0)};this._adapter.initializeMask(t)}else this._adapter.destroyMask(),this._formatInputValue()}_applyAllowInput(){this._adapter.setInputReadonly(!this._allowInput),this._allowInput?(this._adapter.removeInputListener("mousedown",this._inputMousedownListener),this._masked||this._adapter.addInputListener("input",this._inputListener)):(this._adapter.addInputListener("mousedown",this._inputMousedownListener),this._adapter.removeInputListener("input",this._inputListener))}_applyAllowDropdown(){this._adapter.setToggleDisabled(!this._allowDropdown),this._allowDropdown?(this._adapter.removeToggleListener("mousedown",this._toggleMousedownListener),this._adapter.tryCreateToggle(),this._adapter.addToggleListener("mousedown",this._toggleMousedownListener)):this._open&&this._closeDropdown(!0)}_applyAllowSeconds(){let t=this._value;if(this._allowSeconds){if(this._isInitialized&&t!==this._value){let e=m(this._value,!0,!0);this._emitChangeEvent(e)}}else{if(typeof this._value!="number")return;if(this._setValue(mt(this._value)),this._isInitialized&&t!==this._value){let e=m(this._value,!0,!1);this._emitChangeEvent(e)}}}_handleInput(t){let e=t;if(!this._allowInput)return;this._open&&this._closeDropdown(!0),t=j(t,this._use24HourTime,this._allowSeconds),typeof this._coercionCallback=="function"&&(t=this._coercionCallback.call(null,e,t,this._allowSeconds)),this._isValidTimeFormat(t)||(t="");let i;!this._masked&&typeof this._parseCallback=="function"?i=this._parseCallback.call(null,t):i=this._convertTimeStringToMillis(t,this._use24HourTime,this._allowSeconds),i=this._validateMillis(i),this._trySetValue(i)}_emitChangeEvent(t,e=!1){return this._adapter.emitHostEvent(s.events.CHANGE,t,!0,!e)}_trySetValue(t){if(t===this._value)return!1;let e=m(t,!0,this._allowSeconds);return this._masked&&this._adapter.emitInputEvent(s.events.INPUT,e),this._value!==t&&this._emitChangeEvent(e)?(this._setValue(t),!0):!1}_setValue(t){this._value=this._normalizeTimeValue(t)}_validateMillis(t){if(typeof t=="number"){let e=typeof this._min=="number"&&t<this._min,i=typeof this._max=="number"&&t>this._max;(e||i)&&(t=null)}return typeof t=="number"&&this._restrictedTimes.length&&this._restrictedTimes.includes(t)&&(t=null),t}_isValidTimeFormat(t){return!this._masked&&typeof this._validationCallback=="function"?this._validationCallback.call(this,t):Y(t)}_isValidInputValue(t){return b.test(t)}_onSelect(t){if(this._closeDropdown(!0),!t.isCustom&&t.metadata==="now"&&(t.time=D(this._allowSeconds)),t.isCustom)if(typeof t.customCallback=="function"){let n=t.customCallback.call(null,t.metadata);if(typeof n!="number")throw new Error("Custom options must provide a time of day value in milliseconds.");t.time=n}else throw new Error("You must implement a `toMilliseconds` callback that returns the time value to use for this custom option.");if(this._value===t.time)return;let e=m(t.time,!0,this._allowSeconds);!this._emitChangeEvent(e)||(this._applyValue(t.time),this._selectInputText())}_selectInputText(){window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{this._adapter.isInputFocused()&&this._adapter.selectInputText()})})}_applyValue(t,e=!0){this._setValue(t);let i=this._formatValue(this._value);this._adapter.getInputValue()!==i&&this._adapter.setInputValue(i,e)}_normalizeTimeValue(t){return t==null?null:t<0?0:t>s.numbers.MAX_DAY_MILLIS?s.numbers.MAX_DAY_MILLIS:t}_openDropdown(){let t=this._generateTimeOptions();if(!this.allowDropdown||!t.length)return;this._formatInputValue(),this._open=!0,this._adapter.setHostAttribute(s.attributes.OPEN);let e=t.filter(o=>!o.divider&&!o.disabled),i=[],n;if(t.length){if(this._value!=null){let o=this._findClosestOptionIndex(this._value,e);o>=0&&(e[o].value.time===this._value?i=[e[o].value]:n=o)}else if(typeof this._startTime=="number"){let o=this._findClosestOptionIndex(this._startTime,e);o>=0&&o<e.length&&(n=o)}}let l={id:`forge-time-picker-${this._identifier}`,selectedValues:i,syncWidth:!0,activeStartIndex:n,popupClasses:this._popupClasses,popupStatic:!0,type:"standard",options:t,selectCallback:o=>this._onSelect(o),closeCallback:()=>this._closeDropdown(!0),activeChangeCallback:o=>this._adapter.setActiveDescendant(o),targetWidthCallback:()=>this._adapter.getTargetElementWidth(this._popupTarget)};this._adapter.attachDropdown(l),this._adapter.emitHostEvent(s.events.OPEN,void 0,!1)}_closeDropdown(t=!1){this._open=!1,this._adapter.removeHostAttribute(s.attributes.OPEN),this._adapter.detachDropdown(),t&&this._adapter.emitHostEvent(s.events.CLOSE,!0,!1)}_findClosestOptionIndex(t,e){let i=e.reduce((n,l)=>Math.abs((l.value.time||0)-t)<Math.abs((n.value.time||0)-t)?l:n);return e.indexOf(i)}_formatInputValue(t=!0){let e=this._adapter.getInputValue();if(this._allowInvalidTime&&!this._masked&&e&&!this._value)return;let i=this._formatValue(this._value);e!==i&&this._adapter.setInputValue(i,t)}_generateTimeOptions(){let t=this._min!=null?Math.max(v(this._min),0):0,e=this._max!=null?Math.min(v(this._max),s.numbers.MAX_DAY_MINUTES):s.numbers.MAX_DAY_MINUTES,i=this._step,n=[],l=[];if(this._showHourOptions){for(let d=t;d<=e&&d!==s.numbers.MAX_DAY_MINUTES;d+=i){let _=I(d),_t=this._restrictedTimes.includes(_),ht=m(_,this._use24HourTime,!1)||"",bt={time:_};n.push({label:ht,value:bt,disabled:_t})}let o=n.findIndex(d=>d.value.time/1e3/60>=720);o>=0&&o<n.length-1&&n.splice(o,0,{label:"",value:null,divider:!0})}if(this._showNow){let o={time:null,metadata:"now"};l.push({label:"Now",value:o})}if(Array.isArray(this._customOptions)&&this._customOptions.length){let o=this._customOptions.map(d=>{let _={time:null,metadata:d.value,isCustom:!0,customCallback:d.toMilliseconds};return{label:d.label,value:_}});l=[...l,...o]}return l.length&&(n.length&&n.splice(0,0,{label:"",value:null,divider:!0}),l.forEach((o,d)=>n.splice(d,0,o))),n}_convertTimeStringToMillis(t,e,i){return(!t||!this._isValidTimeFormat(t))&&(t=""),C(t,e,i)}_formatValue(t){return!this._masked&&typeof this._formatCallback=="function"?this._formatCallback.call(null,t,this._use24HourTime,this._allowSeconds):m(this._value,this._use24HourTime,this._allowSeconds)||""}_warnInvalidFormat(t){console.warn(`The specified value "${t}" does not conform to the required format. The format is "HH:mm", "HH:mm:ss" where HH is 00-23, mm is 00-59, and ss is 00-59.`)}get open(){return this._open}set open(t){this._open!==t&&this._isInitialized&&(this._open=t,this._open?this._openDropdown():this._closeDropdown())}get masked(){return this._masked}set masked(t){this._masked!==t&&(this._masked=t,this._isInitialized&&(this._masked?(this._adapter.removeInputListener("input",this._inputListener),this._applyMask()):(this._adapter.destroyMask(),this._formatInputValue(),this._adapter.addInputListener("input",this._inputListener))))}get showMaskFormat(){return this._showMaskFormat}set showMaskFormat(t){this._showMaskFormat!==t&&(this._showMaskFormat=t,this._isInitialized&&this._applyMask())}get allowSeconds(){return this._allowSeconds}set allowSeconds(t){this._allowSeconds!==t&&(this._allowSeconds=!!t,this._applyAllowSeconds(),this._isInitialized&&(this._applyMask(),this._formatInputValue()),this._adapter.setHostAttribute(s.attributes.ALLOW_SECONDS,`${!!t}`))}get use24HourTime(){return this._use24HourTime}set use24HourTime(t){this._use24HourTime!==t&&(this._use24HourTime=!!t,this._isInitialized&&(this._adapter.destroyMask(),this._formatInputValue(),this._applyMask()),this._adapter.setHostAttribute(s.attributes.USE_24_HOUR_TIME,`${!!t}`))}get allowInvalidTime(){return this._allowInvalidTime}set allowInvalidTime(t){this._allowInvalidTime!==t&&(this._allowInvalidTime=!!t,this._adapter.setHostAttribute(s.attributes.ALLOW_INVALID_TIME,`${!!t}`))}get value(){return m(this._value,!0,this._allowSeconds)}set value(t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}let e=this._validateMillis(this._convertTimeStringToMillis(t,!0,!0));this._setValue(e),this._isInitialized&&this._applyValue(this._value)}get min(){return m(this._min,!0,this._allowSeconds)}set min(t){if(this._min!==t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}this._min=this._convertTimeStringToMillis(t,!0,this._allowSeconds);let e=this._validateMillis(this._value);this._setValue(e),this._isInitialized&&this._applyValue(e)}}get max(){return m(this._max,!0,this._allowSeconds)}set max(t){if(this._max!==t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}this._max=this._convertTimeStringToMillis(t,!0,this._allowSeconds);let e=this._validateMillis(this._value);this._setValue(e),this._isInitialized&&this._applyValue(e)}}get restrictedTimes(){return this._restrictedTimes.map(t=>m(t,!0,this._allowSeconds)).filter(t=>typeof t=="string")}set restrictedTimes(t){Array.isArray(t)||(t=[]),this._restrictedTimes=t.filter(e=>typeof e=="string").map(e=>this._convertTimeStringToMillis(e,!0,!0)).filter(e=>typeof e=="number")}get startTime(){return m(this._startTime,!0,this._allowSeconds)}set startTime(t){if(this._startTime!==t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}this._startTime=this._convertTimeStringToMillis(t,!0,this._allowSeconds)}}get step(){return this._step}set step(t){this._step=t}get allowInput(){return this._allowInput}set allowInput(t){this._allowInput!==t&&(this._allowInput=t,this._isInitialized&&(this._applyAllowInput(),this._applyMask()))}get popupTarget(){return this._popupTarget}set popupTarget(t){this._popupTarget!==t&&(this._popupTarget=t)}get showNow(){return this._showNow}set showNow(t){this._showNow!==t&&(this._showNow=t)}get showHourOptions(){return this._showHourOptions}set showHourOptions(t){this._showHourOptions!==t&&(this._showHourOptions=t)}get customOptions(){return this._customOptions}set customOptions(t){this._customOptions=Array.isArray(t)?t:[]}set validationCallback(t){this._validationCallback=t,this._isInitialized&&this._applyMask()}set parseCallback(t){this._parseCallback=t}set formatCallback(t){this._formatCallback=t}set coercionCallback(t){this._coercionCallback=t}set prepareMaskCallback(t){this._prepareMaskCallback=t,this._isInitialized&&this._applyMask()}get disabled(){return this._disabled}set disabled(t){this._disabled!==t&&(this._disabled=!!t,this._isInitialized&&this._applyDisabled(),this._adapter.toggleHostAttribute(s.attributes.DISABLED,this._disabled))}get popupClasses(){return Array.isArray(this._popupClasses)?[...this._popupClasses]:this._popupClasses}set popupClasses(t){Array.isArray(t)?this._popupClasses=[...t]:this._popupClasses=[t]}get allowDropdown(){return this._allowDropdown}set allowDropdown(t){this._allowDropdown!==t&&(this._allowDropdown=t,this._isInitialized&&this._applyAllowDropdown())}};var Tt="<template><slot></slot></template>",kt=":host{display:block}:host([hidden]){display:none}",r=class extends W{constructor(){super();Z.define([rt,K]),H(this,Tt,kt),this._foundation=new T(new g(this))}static get observedAttributes(){return[s.attributes.VALUE,s.attributes.OPEN,s.attributes.ALLOW_SECONDS,s.attributes.MASKED,s.attributes.SHOW_MASK_FORMAT,s.attributes.USE_24_HOUR_TIME,s.attributes.ALLOW_INVALID_TIME,s.attributes.MIN,s.attributes.MAX,s.attributes.START_TIME,s.attributes.STEP,s.attributes.ALLOW_INPUT,s.attributes.SHOW_NOW,s.attributes.SHOW_HOUR_OPTIONS,s.attributes.DISABLED,s.attributes.POPUP_CLASSES,s.attributes.ALLOW_DROPDOWN]}connectedCallback(){this.querySelector(s.selectors.INPUT)?this._foundation.initialize():A(this,s.selectors.INPUT).then(()=>this._foundation.initialize())}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(e,i,n){switch(e){case s.attributes.VALUE:this.value=n;break;case s.attributes.OPEN:this.open=c(n);break;case s.attributes.ALLOW_SECONDS:this.allowSeconds=c(n);break;case s.attributes.MASKED:this.masked=c(n);break;case s.attributes.SHOW_MASK_FORMAT:this.showMaskFormat=c(n);break;case s.attributes.USE_24_HOUR_TIME:this.use24HourTime=c(n);break;case s.attributes.ALLOW_INVALID_TIME:this.allowInvalidTime=c(n);break;case s.attributes.SHOW_NOW:this.showNow=c(n);break;case s.attributes.SHOW_HOUR_OPTIONS:this.showHourOptions=c(n);break;case s.attributes.MIN:this.min=n;break;case s.attributes.MAX:this.max=n;break;case s.attributes.START_TIME:this.startTime=n;break;case s.attributes.STEP:this.step=L(n);break;case s.attributes.ALLOW_INPUT:this.allowInput=c(n);break;case s.attributes.DISABLED:this.disabled=c(n);break;case s.attributes.POPUP_CLASSES:this.popupClasses=n;break;case s.attributes.ALLOW_DROPDOWN:this.allowDropdown=c(n);break}}};p([u()],r.prototype,"value",2),p([u()],r.prototype,"open",2),p([u()],r.prototype,"allowSeconds",2),p([u()],r.prototype,"masked",2),p([u()],r.prototype,"showMaskFormat",2),p([u()],r.prototype,"use24HourTime",2),p([u()],r.prototype,"allowInvalidTime",2),p([u()],r.prototype,"min",2),p([u()],r.prototype,"max",2),p([u()],r.prototype,"restrictedTimes",2),p([u()],r.prototype,"startTime",2),p([u()],r.prototype,"step",2),p([u()],r.prototype,"allowInput",2),p([u()],r.prototype,"showNow",2),p([u()],r.prototype,"showHourOptions",2),p([u()],r.prototype,"customOptions",2),p([u()],r.prototype,"validationCallback",2),p([u()],r.prototype,"parseCallback",2),p([u()],r.prototype,"formatCallback",2),p([u()],r.prototype,"coercionCallback",2),p([u()],r.prototype,"prepareMaskCallback",2),p([u()],r.prototype,"disabled",2),p([u()],r.prototype,"popupClasses",2),p([u()],r.prototype,"allowDropdown",2),p([u()],r.prototype,"popupTarget",2),r=p([R({name:s.elementName,dependencies:[et,tt,ot,w,it,w,at]})],r);var ct=class extends ${constructor(e){super(e)}_build(){let e=document.createElement(s.elementName);return this._attachTextField(e),e}get inputElement(){return this._textFieldDelegate.inputElement}get textFieldElement(){return this._textFieldDelegate.element}get value(){return this._element.value}set value(e){this._element.value=e}get disabled(){return this._element.disabled}set disabled(e){this._element.disabled=e}get invalid(){return this._textFieldDelegate.invalid||!1}set invalid(e){this._textFieldDelegate.invalid=e}onChange(e){this._element.addEventListener(s.events.CHANGE,i=>{var n;return e((n=i.detail)!=null?n:"")})}onInput(e){this._element.masked?this._element.addEventListener(s.events.INPUT,i=>{var n;return e((n=i.detail)!=null?n:"")}):this._textFieldDelegate.inputElement.addEventListener("input",i=>e(i.target.value))}onFocus(e){this._textFieldDelegate.inputElement.addEventListener("focus",i=>e(i))}onBlur(e){this._textFieldDelegate.inputElement.addEventListener("blur",i=>e(i))}_attachTextField(e){var n,l,o,d;let i={props:k({},(l=(n=this._config.options)==null?void 0:n.textFieldDelegateConfig)==null?void 0:l.props),options:k({},(d=(o=this._config.options)==null?void 0:o.textFieldDelegateConfig)==null?void 0:d.options)};this._textFieldDelegate=new nt(i),e.appendChild(this._textFieldDelegate.element)}};function xe(){N(r)}export{s as a,g as b,C as c,m as d,pt as e,ut as f,v as g,M as h,It as i,dt as j,I as k,O as l,mt as m,D as n,Rt as o,T as p,r as q,ct as r,xe as s};
7
- //# sourceMappingURL=chunk.JAEVBPHT.js.map
6
+ import{a as rt}from"./chunk.E37HEAJ5.js";import{d as at}from"./chunk.NNGE722W.js";import{a as f,b as nt}from"./chunk.IMK2LFWR.js";import{h as st}from"./chunk.F2TKPPK7.js";import{c as et}from"./chunk.J2ODMCFS.js";import{e as tt}from"./chunk.LMOYZQZJ.js";import{e as it}from"./chunk.3UMBCR4P.js";import{a as E,b as ot}from"./chunk.BOENNFXE.js";import{j as K}from"./chunk.LZMYHIO2.js";import{a as F}from"./chunk.D4SNVKDA.js";import{a as Q,d as Z,l as w}from"./chunk.YAJT3P6V.js";import{a as $}from"./chunk.24D46RLZ.js";import{g as J}from"./chunk.7ZS4N2FT.js";import{j as b,k as X,m as G,n as q,o as Y,p as j}from"./chunk.KYCC3C3M.js";import{a as z}from"./chunk.A23NSEWA.js";import{a as u}from"./chunk.B3IJU6XJ.js";import{a as R,b as B}from"./chunk.BSZ2LBJX.js";import{a as W}from"./chunk.3E5QKMHL.js";import{a as N,e as H,g as V,i as U}from"./chunk.HN4PXH3D.js";import{m as A,s as P,u as x}from"./chunk.R4NDFXVA.js";import{a as S,k as c,l as L,o as y}from"./chunk.G76HB2FK.js";import{a as k,f as p}from"./chunk.MCIQXNKY.js";var h=`${B}time-picker`,lt={TOGGLE:"forge-time-picker-toggle",VALUE:"value",OPEN:"open",ALLOW_SECONDS:"allow-seconds",MASKED:"masked",SHOW_MASK_FORMAT:"show-mask-format",USE_24_HOUR_TIME:"use-24-hour-time",ALLOW_INVALID_TIME:"allow-invalid-time",MIN:"min",MAX:"max",START_TIME:"start-time",STEP:"step",ALLOW_INPUT:"allow-input",SHOW_NOW:"show-now",SHOW_HOUR_OPTIONS:"show-hour-options",DISABLED:"disabled",POPUP_CLASSES:"popup-classes",ALLOW_DROPDOWN:"allow-dropdown"},ft={INPUT:"input, input[forge-time-picker-input]",TOGGLE:`[${lt.TOGGLE}]`},gt={OPEN:`${h}-open`,CLOSE:`${h}-close`,INPUT:`${h}-input`,CHANGE:`${h}-change`},vt={DEFAULT_MINUTE_STEP:60,MAX_DAY_MILLIS:864e5,MAX_DAY_MINUTES:1440},s={elementName:h,attributes:lt,selectors:ft,events:gt,numbers:vt};var g=class extends z{constructor(e){super(e)}initialize(){this._inputElement=this._component.querySelector(s.selectors.INPUT)}initializeMask(e){this._inputMask&&this._inputMask.destroy(),this._inputMask=new J(this._inputElement,e)}destroy(){this._targetElement=void 0,this._toggleElement=void 0,this._inputElement=void 0}destroyMask(){this._inputMask&&(this._inputMask.destroy(),this._inputMask=void 0)}initializeAccessibility(e){this._inputElement.setAttribute("autocomplete","off"),this._inputElement.setAttribute("autocorrect","off"),this._inputElement.setAttribute("autocapitalize","off"),this._inputElement.setAttribute("spellcheck","false"),this._inputElement.setAttribute("role","combobox"),this._inputElement.setAttribute("aria-live","assertive"),this._inputElement.setAttribute("aria-atomic","true"),this._inputElement.setAttribute("aria-haspopup","true"),this._inputElement.setAttribute("aria-expanded","false")}addInputListener(e,i,n){this._inputElement.addEventListener(e,i,{capture:n})}removeInputListener(e,i,n){this._inputElement&&this._inputElement.removeEventListener(e,i,{capture:n})}addToggleListener(e,i){this._toggleElement&&this._toggleElement.addEventListener(e,i)}removeToggleListener(e,i){this._toggleElement&&this._toggleElement.removeEventListener(e,i)}hasInputElement(){return!!this._inputElement}tryCreateToggle(){let e=this._component.querySelector(f.elementName),i=this._component.querySelector(s.selectors.TOGGLE);if(e){let n=e.querySelector(`${E.elementName}[slot=trailing]`);if(n||i){this._toggleElement=n||i;return}let l=document.createElement(E.elementName);l.slot="trailing",l.dense=!0,l.densityLevel=3,l.style.marginRight="4px";let o=document.createElement("button");o.type="button",o.tabIndex=-1,o.setAttribute("aria-label","Toggle time dropdown");let d=document.createElement(Q.elementName);d.name="clock_outline",o.appendChild(d),l.appendChild(o),e.appendChild(l),this._toggleElement=l}else i&&(this._toggleElement=i)}tryFocusInput(){this._inputElement.select()}tryBlurInput(){this._inputElement.blur()}selectInputText(){this._inputElement.select()}isInputDisabled(){return this._inputElement.disabled}isInputFocused(){return P()===this._inputElement}setInputValue(e,i){this._inputElement.value!==e&&(this._inputElement.value=e,this._inputMask&&this._inputMask.update(),i&&(this._emitInputEvent("change"),this._emitInputEvent("input")))}getInputValue(){return this._inputMask?this._inputMask.maskedValue:this._inputElement.value}setDisabled(e){this._inputElement.disabled=e,this._inputElement.setAttribute("aria-disabled",e.toString()),this.setToggleDisabled(e)}attachDropdown(e){this._listDropdown=new st(this._inputElement,e),this._listDropdown.open(),this._inputElement.setAttribute("aria-controls",`list-dropdown-popup-${e.id}`)}detachDropdown(){this._listDropdown&&(this._listDropdown.close(),this._listDropdown.destroy(),this._listDropdown=void 0),this._inputElement.removeAttribute("aria-controls")}propagateKey(e){var i;(i=this._listDropdown)==null||i.handleKey(e)}setActiveDescendant(e){x(this._inputElement,!!e,"aria-activedescendant",e)}getTargetElementWidth(e){return this._getTargetElement(e).getBoundingClientRect().width}_emitInputEvent(e){this._inputElement.dispatchEvent(new Event(e))}emitInputEvent(e,i){U(this._inputElement,e,i)}setInputReadonly(e){this._inputElement.readOnly=e}setToggleDisabled(e){if(this._toggleElement)if(this._toggleElement.setAttribute("aria-disabled",e.toString()),"disabled"in this._toggleElement)this._toggleElement.disabled=e;else{let i=this._toggleElement.querySelector("button");i&&(i.disabled=e)}}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}getActiveOption(){var e;return(e=this._listDropdown)==null?void 0:e.getActiveOption()}_getTargetElement(e){return this._targetElement?this._targetElement:(this._targetElement=e?this._component.querySelector(e)||this._getDefaultTargetElement():this._getDefaultTargetElement(),this._targetElement)}_getDefaultTargetElement(){let e=this._component.querySelector(f.elementName);if(e&&e.shadowRoot){let i=V(e,f.selectors.ROOT);if(i)return i}return this._component}};function C(a,t,e){if(!a||/^\s*$/.test(a))return null;let i=0,n=0,l=0;if(b.test(a)){let o=G(a);i=+o.hours||0,n=+o.minutes||0,l=+o.seconds||0}else if(X.test(a)){let o=q(a);i=+o.hours||0,n=+o.minutes||0,l=+o.seconds||0,i===12&&o.meridiem==="AM"&&(i=0),i<12&&o.meridiem==="PM"&&(i+=12)}else return null;return dt(i)+I(n)+(e?O(l):0)}function m(a,t,e){if(typeof a!="number"||a<0)return null;let i=Math.min(pt(a),23),n=Math.min(ut(a),59),o=a/(1e3*60)<720?"AM":"PM";t||(i=i<=12?i:i-12,i===0&&(i=12));let d=`${String(i).padStart(2,"0")}:${String(n).padStart(2,"0")}`;if(e){let _=Math.min(M(a),59);d+=`:${String(_).padStart(2,"0")}`}return t||(d+=` ${o}`),d}function pt(a){return Math.abs(Math.floor(a/(1e3*60*60)))}function ut(a){return Math.abs(Math.floor(v(a)%60))}function v(a){return a/(1e3*60)}function M(a){return Math.abs(Math.floor(It(a)%60))}function It(a){return a/1e3}function dt(a){return a*60*60*1e3}function I(a){return a*60*1e3}function O(a){return a*1e3}function mt(a){return a-O(M(a))}function D(a){let t=new Date,e=t.getHours(),i=t.getMinutes();return dt(e)+I(i)+(a?O(t.getSeconds()):0)}function Rt(a,t,e=!1){a||(a=new Date);let i=C(t,!0,e);if(!i)return a.setHours(0,0,0),a;let n=pt(i),l=828e5;n>l?n=l:n<0&&(n=0);let o=ut(i),d=e?M(i):0;return a.setHours(n,o,d),a}var T=class{constructor(t){this._adapter=t;this._value=null;this._masked=!0;this._use24HourTime=!1;this._showMaskFormat=!1;this._min=null;this._max=null;this._restrictedTimes=[];this._startTime=null;this._step=s.numbers.DEFAULT_MINUTE_STEP;this._allowInput=!0;this._open=!1;this._allowSeconds=!1;this._allowInvalidTime=!1;this._showNow=!1;this._showHourOptions=!0;this._customOptions=[];this._disabled=!1;this._popupClasses=[];this._allowDropdown=!0;this._isInitialized=!1;this._identifier=S(),this._inputListener=e=>this._onInput(e),this._inputKeydownListener=e=>this._onInputKeydown(e),this._toggleMousedownListener=e=>this._onToggleMousedown(e),this._inputFocusListener=e=>this._onInputFocus(e),this._inputBlurListener=e=>this._onInputBlur(e),this._inputMousedownListener=e=>this._onInputMousedown(e)}initialize(){if(this._adapter.initialize(),!this._adapter.hasInputElement())throw new Error("Unable to locate <input> element to attach to.");if(this._adapter.initializeAccessibility(this._identifier),!this._value){let t=this._adapter.getInputValue();this._setValue(this._convertTimeStringToMillis(t,this._use24HourTime,this._allowSeconds))}this._adapter.addInputListener("focus",this._inputFocusListener),this._adapter.addInputListener("blur",this._inputBlurListener),this._adapter.addInputListener("keydown",this._inputKeydownListener,!0),this._formatInputValue(!1),typeof this._value=="number"&&this._applyValue(this._value,!1),this._applyAllowInput(),this._applyAllowDropdown(),this._applyDisabled(),this._applyMask(),this._isInitialized=!0}disconnect(){this._isInitialized=!1,this._adapter.removeInputListener("input",this._inputListener),this._adapter.removeInputListener("focus",this._inputFocusListener),this._adapter.removeInputListener("blur",this._inputBlurListener),this._adapter.removeToggleListener("mousedown",this._toggleMousedownListener),this._adapter.removeInputListener("keydown",this._inputKeydownListener,!0),this._masked&&this._adapter.destroyMask(),this._closeDropdown(),this._adapter.destroy()}_onInput(t){this._handleInput(this._adapter.getInputValue())}_onInputKeydown(t){if(t.shiftKey)switch(t.code){case"Backspace":case"Delete":t.preventDefault(),this._trySetValue(null)&&this._formatInputValue();return}switch(t.code){case"Tab":this._open&&this._selectActiveOption();break;case"Esc":case"Escape":this._open&&(t.preventDefault(),this._closeDropdown(!0));break;case"Down":case"ArrowDown":this._allowDropdown&&(t.preventDefault(),this._open?this._adapter.propagateKey(t.code):(this._openDropdown(),this._adapter.activateFirstOption()));break;case"Up":case"ArrowUp":this._allowDropdown&&(t.preventDefault(),this._open&&this._adapter.propagateKey(t.code));break;case"Enter":case"Home":case"End":this._open&&(t.code==="Enter"&&t.stopPropagation(),t.preventDefault(),this._adapter.propagateKey(t.code));break;case"KeyN":t.preventDefault();let e=D(this._allowSeconds);if(this._value!==e){let i=m(e,!0,this._allowSeconds);this._emitChangeEvent(i)&&(this._applyValue(e),this._selectInputText())}break}}_selectActiveOption(){let t=this._adapter.getActiveOption();t&&this._onSelect(t.value)}_onToggleMousedown(t){this._disabled||!this.allowDropdown||(t.stopPropagation(),!this._adapter.isInputDisabled()&&(t.preventDefault(),this._open?this._closeDropdown(!0):(F.isMobile?this._adapter.tryBlurInput():this._adapter.tryFocusInput(),this._openDropdown())))}_onInputFocus(t){this._allowInput&&this._adapter.selectInputText()}_onInputBlur(t){this._formatInputValue(),this._open&&!this._adapter.isInputFocused()&&this._closeDropdown(!0)}_onInputMousedown(t){!this._allowInput&&!this._open&&(this._openDropdown(),this._adapter.tryFocusInput(),window.requestAnimationFrame(()=>this._adapter.selectInputText()))}_applyDisabled(){this._adapter.setDisabled(this._disabled)}_applyMask(){if(this._masked&&this._allowInput){let t={showMaskFormat:this._showMaskFormat,use24HourTime:this._use24HourTime,showSeconds:this._allowSeconds,prepareCallback:this._prepareMaskCallback,onChange:y(e=>this._handleInput(e),0,!0)};this._adapter.initializeMask(t)}else this._adapter.destroyMask(),this._formatInputValue()}_applyAllowInput(){this._adapter.setInputReadonly(!this._allowInput),this._allowInput?(this._adapter.removeInputListener("mousedown",this._inputMousedownListener),this._masked||this._adapter.addInputListener("input",this._inputListener)):(this._adapter.addInputListener("mousedown",this._inputMousedownListener),this._adapter.removeInputListener("input",this._inputListener))}_applyAllowDropdown(){this._adapter.setToggleDisabled(!this._allowDropdown),this._allowDropdown?(this._adapter.removeToggleListener("mousedown",this._toggleMousedownListener),this._adapter.tryCreateToggle(),this._adapter.addToggleListener("mousedown",this._toggleMousedownListener)):this._open&&this._closeDropdown(!0)}_applyAllowSeconds(){let t=this._value;if(this._allowSeconds){if(this._isInitialized&&t!==this._value){let e=m(this._value,!0,!0);this._emitChangeEvent(e)}}else{if(typeof this._value!="number")return;if(this._setValue(mt(this._value)),this._isInitialized&&t!==this._value){let e=m(this._value,!0,!1);this._emitChangeEvent(e)}}}_handleInput(t){let e=t;if(!this._allowInput)return;this._open&&this._closeDropdown(!0),t=j(t,this._use24HourTime,this._allowSeconds),typeof this._coercionCallback=="function"&&(t=this._coercionCallback.call(null,e,t,this._allowSeconds)),this._isValidTimeFormat(t)||(t="");let i;!this._masked&&typeof this._parseCallback=="function"?i=this._parseCallback.call(null,t):i=this._convertTimeStringToMillis(t,this._use24HourTime,this._allowSeconds),i=this._validateMillis(i),this._trySetValue(i)}_emitChangeEvent(t,e=!1){return this._adapter.emitHostEvent(s.events.CHANGE,t,!0,!e)}_trySetValue(t){if(t===this._value)return!1;let e=m(t,!0,this._allowSeconds);return this._masked&&this._adapter.emitInputEvent(s.events.INPUT,e),this._value!==t&&this._emitChangeEvent(e)?(this._setValue(t),!0):!1}_setValue(t){this._value=this._normalizeTimeValue(t)}_validateMillis(t){if(typeof t=="number"){let e=typeof this._min=="number"&&t<this._min,i=typeof this._max=="number"&&t>this._max;(e||i)&&(t=null)}return typeof t=="number"&&this._restrictedTimes.length&&this._restrictedTimes.includes(t)&&(t=null),t}_isValidTimeFormat(t){return!this._masked&&typeof this._validationCallback=="function"?this._validationCallback.call(this,t):Y(t)}_isValidInputValue(t){return b.test(t)}_onSelect(t){if(this._closeDropdown(!0),!t.isCustom&&t.metadata==="now"&&(t.time=D(this._allowSeconds)),t.isCustom)if(typeof t.customCallback=="function"){let n=t.customCallback.call(null,t.metadata);if(typeof n!="number")throw new Error("Custom options must provide a time of day value in milliseconds.");t.time=n}else throw new Error("You must implement a `toMilliseconds` callback that returns the time value to use for this custom option.");if(this._value===t.time)return;let e=m(t.time,!0,this._allowSeconds);!this._emitChangeEvent(e)||(this._applyValue(t.time),this._selectInputText())}_selectInputText(){window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{this._adapter.isInputFocused()&&this._adapter.selectInputText()})})}_applyValue(t,e=!0){this._setValue(t);let i=this._formatValue(this._value);this._adapter.getInputValue()!==i&&this._adapter.setInputValue(i,e)}_normalizeTimeValue(t){return t==null?null:t<0?0:t>s.numbers.MAX_DAY_MILLIS?s.numbers.MAX_DAY_MILLIS:t}_openDropdown(){let t=this._generateTimeOptions();if(!this.allowDropdown||!t.length)return;this._formatInputValue(),this._open=!0,this._adapter.setHostAttribute(s.attributes.OPEN);let e=t.filter(o=>!o.divider&&!o.disabled),i=[],n;if(t.length){if(this._value!=null){let o=this._findClosestOptionIndex(this._value,e);o>=0&&(e[o].value.time===this._value?i=[e[o].value]:n=o)}else if(typeof this._startTime=="number"){let o=this._findClosestOptionIndex(this._startTime,e);o>=0&&o<e.length&&(n=o)}}let l={id:`forge-time-picker-${this._identifier}`,selectedValues:i,syncWidth:!0,activeStartIndex:n,popupClasses:this._popupClasses,popupStatic:!0,type:"standard",options:t,selectCallback:o=>this._onSelect(o),closeCallback:()=>this._closeDropdown(!0),activeChangeCallback:o=>this._adapter.setActiveDescendant(o),targetWidthCallback:()=>this._adapter.getTargetElementWidth(this._popupTarget)};this._adapter.attachDropdown(l),this._adapter.emitHostEvent(s.events.OPEN,void 0,!1)}_closeDropdown(t=!1){this._open=!1,this._adapter.removeHostAttribute(s.attributes.OPEN),this._adapter.detachDropdown(),t&&this._adapter.emitHostEvent(s.events.CLOSE,!0,!1)}_findClosestOptionIndex(t,e){let i=e.reduce((n,l)=>Math.abs((l.value.time||0)-t)<Math.abs((n.value.time||0)-t)?l:n);return e.indexOf(i)}_formatInputValue(t=!0){let e=this._adapter.getInputValue();if(this._allowInvalidTime&&!this._masked&&e&&!this._value)return;let i=this._formatValue(this._value);e!==i&&this._adapter.setInputValue(i,t)}_generateTimeOptions(){let t=this._min!=null?Math.max(v(this._min),0):0,e=this._max!=null?Math.min(v(this._max),s.numbers.MAX_DAY_MINUTES):s.numbers.MAX_DAY_MINUTES,i=this._step,n=[],l=[];if(this._showHourOptions){for(let d=t;d<=e&&d!==s.numbers.MAX_DAY_MINUTES;d+=i){let _=I(d),_t=this._restrictedTimes.includes(_),ht=m(_,this._use24HourTime,!1)||"",bt={time:_};n.push({label:ht,value:bt,disabled:_t})}let o=n.findIndex(d=>d.value.time/1e3/60>=720);o>=0&&o<n.length-1&&n.splice(o,0,{label:"",value:null,divider:!0})}if(this._showNow){let o={time:null,metadata:"now"};l.push({label:"Now",value:o})}if(Array.isArray(this._customOptions)&&this._customOptions.length){let o=this._customOptions.map(d=>{let _={time:null,metadata:d.value,isCustom:!0,customCallback:d.toMilliseconds};return{label:d.label,value:_}});l=[...l,...o]}return l.length&&(n.length&&n.splice(0,0,{label:"",value:null,divider:!0}),l.forEach((o,d)=>n.splice(d,0,o))),n}_convertTimeStringToMillis(t,e,i){return(!t||!this._isValidTimeFormat(t))&&(t=""),C(t,e,i)}_formatValue(t){return!this._masked&&typeof this._formatCallback=="function"?this._formatCallback.call(null,t,this._use24HourTime,this._allowSeconds):m(this._value,this._use24HourTime,this._allowSeconds)||""}_warnInvalidFormat(t){console.warn(`The specified value "${t}" does not conform to the required format. The format is "HH:mm", "HH:mm:ss" where HH is 00-23, mm is 00-59, and ss is 00-59.`)}get open(){return this._open}set open(t){this._open!==t&&this._isInitialized&&(this._open=t,this._open?this._openDropdown():this._closeDropdown())}get masked(){return this._masked}set masked(t){this._masked!==t&&(this._masked=t,this._isInitialized&&(this._masked?(this._adapter.removeInputListener("input",this._inputListener),this._applyMask()):(this._adapter.destroyMask(),this._formatInputValue(),this._adapter.addInputListener("input",this._inputListener))))}get showMaskFormat(){return this._showMaskFormat}set showMaskFormat(t){this._showMaskFormat!==t&&(this._showMaskFormat=t,this._isInitialized&&this._applyMask())}get allowSeconds(){return this._allowSeconds}set allowSeconds(t){this._allowSeconds!==t&&(this._allowSeconds=!!t,this._applyAllowSeconds(),this._isInitialized&&(this._applyMask(),this._formatInputValue()),this._adapter.setHostAttribute(s.attributes.ALLOW_SECONDS,`${!!t}`))}get use24HourTime(){return this._use24HourTime}set use24HourTime(t){this._use24HourTime!==t&&(this._use24HourTime=!!t,this._isInitialized&&(this._adapter.destroyMask(),this._formatInputValue(),this._applyMask()),this._adapter.setHostAttribute(s.attributes.USE_24_HOUR_TIME,`${!!t}`))}get allowInvalidTime(){return this._allowInvalidTime}set allowInvalidTime(t){this._allowInvalidTime!==t&&(this._allowInvalidTime=!!t,this._adapter.setHostAttribute(s.attributes.ALLOW_INVALID_TIME,`${!!t}`))}get value(){return m(this._value,!0,this._allowSeconds)}set value(t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}let e=this._validateMillis(this._convertTimeStringToMillis(t,!0,!0));this._setValue(e),this._isInitialized&&this._applyValue(this._value)}get min(){return m(this._min,!0,this._allowSeconds)}set min(t){if(this._min!==t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}this._min=this._convertTimeStringToMillis(t,!0,this._allowSeconds);let e=this._validateMillis(this._value);this._setValue(e),this._isInitialized&&this._applyValue(e)}}get max(){return m(this._max,!0,this._allowSeconds)}set max(t){if(this._max!==t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}this._max=this._convertTimeStringToMillis(t,!0,this._allowSeconds);let e=this._validateMillis(this._value);this._setValue(e),this._isInitialized&&this._applyValue(e)}}get restrictedTimes(){return this._restrictedTimes.map(t=>m(t,!0,this._allowSeconds)).filter(t=>typeof t=="string")}set restrictedTimes(t){Array.isArray(t)||(t=[]),this._restrictedTimes=t.filter(e=>typeof e=="string").map(e=>this._convertTimeStringToMillis(e,!0,!0)).filter(e=>typeof e=="number")}get startTime(){return m(this._startTime,!0,this._allowSeconds)}set startTime(t){if(this._startTime!==t){if(t&&!this._isValidInputValue(t)){this._warnInvalidFormat(t);return}this._startTime=this._convertTimeStringToMillis(t,!0,this._allowSeconds)}}get step(){return this._step}set step(t){this._step=t}get allowInput(){return this._allowInput}set allowInput(t){this._allowInput!==t&&(this._allowInput=t,this._isInitialized&&(this._applyAllowInput(),this._applyMask()))}get popupTarget(){return this._popupTarget}set popupTarget(t){this._popupTarget!==t&&(this._popupTarget=t)}get showNow(){return this._showNow}set showNow(t){this._showNow!==t&&(this._showNow=t)}get showHourOptions(){return this._showHourOptions}set showHourOptions(t){this._showHourOptions!==t&&(this._showHourOptions=t)}get customOptions(){return this._customOptions}set customOptions(t){this._customOptions=Array.isArray(t)?t:[]}set validationCallback(t){this._validationCallback=t,this._isInitialized&&this._applyMask()}set parseCallback(t){this._parseCallback=t}set formatCallback(t){this._formatCallback=t}set coercionCallback(t){this._coercionCallback=t}set prepareMaskCallback(t){this._prepareMaskCallback=t,this._isInitialized&&this._applyMask()}get disabled(){return this._disabled}set disabled(t){this._disabled!==t&&(this._disabled=!!t,this._isInitialized&&this._applyDisabled(),this._adapter.toggleHostAttribute(s.attributes.DISABLED,this._disabled))}get popupClasses(){return Array.isArray(this._popupClasses)?[...this._popupClasses]:this._popupClasses}set popupClasses(t){Array.isArray(t)?this._popupClasses=[...t]:this._popupClasses=[t]}get allowDropdown(){return this._allowDropdown}set allowDropdown(t){this._allowDropdown!==t&&(this._allowDropdown=t,this._isInitialized&&this._applyAllowDropdown())}};var Tt="<template><slot></slot></template>",kt=":host{display:block}:host([hidden]){display:none}",r=class extends W{constructor(){super();Z.define([rt,K]),H(this,Tt,kt),this._foundation=new T(new g(this))}static get observedAttributes(){return[s.attributes.VALUE,s.attributes.OPEN,s.attributes.ALLOW_SECONDS,s.attributes.MASKED,s.attributes.SHOW_MASK_FORMAT,s.attributes.USE_24_HOUR_TIME,s.attributes.ALLOW_INVALID_TIME,s.attributes.MIN,s.attributes.MAX,s.attributes.START_TIME,s.attributes.STEP,s.attributes.ALLOW_INPUT,s.attributes.SHOW_NOW,s.attributes.SHOW_HOUR_OPTIONS,s.attributes.DISABLED,s.attributes.POPUP_CLASSES,s.attributes.ALLOW_DROPDOWN]}connectedCallback(){this.querySelector(s.selectors.INPUT)?this._foundation.initialize():A(this,s.selectors.INPUT).then(()=>this._foundation.initialize())}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(e,i,n){switch(e){case s.attributes.VALUE:this.value=n;break;case s.attributes.OPEN:this.open=c(n);break;case s.attributes.ALLOW_SECONDS:this.allowSeconds=c(n);break;case s.attributes.MASKED:this.masked=c(n);break;case s.attributes.SHOW_MASK_FORMAT:this.showMaskFormat=c(n);break;case s.attributes.USE_24_HOUR_TIME:this.use24HourTime=c(n);break;case s.attributes.ALLOW_INVALID_TIME:this.allowInvalidTime=c(n);break;case s.attributes.SHOW_NOW:this.showNow=c(n);break;case s.attributes.SHOW_HOUR_OPTIONS:this.showHourOptions=c(n);break;case s.attributes.MIN:this.min=n;break;case s.attributes.MAX:this.max=n;break;case s.attributes.START_TIME:this.startTime=n;break;case s.attributes.STEP:this.step=L(n);break;case s.attributes.ALLOW_INPUT:this.allowInput=c(n);break;case s.attributes.DISABLED:this.disabled=c(n);break;case s.attributes.POPUP_CLASSES:this.popupClasses=n;break;case s.attributes.ALLOW_DROPDOWN:this.allowDropdown=c(n);break}}};p([u()],r.prototype,"value",2),p([u()],r.prototype,"open",2),p([u()],r.prototype,"allowSeconds",2),p([u()],r.prototype,"masked",2),p([u()],r.prototype,"showMaskFormat",2),p([u()],r.prototype,"use24HourTime",2),p([u()],r.prototype,"allowInvalidTime",2),p([u()],r.prototype,"min",2),p([u()],r.prototype,"max",2),p([u()],r.prototype,"restrictedTimes",2),p([u()],r.prototype,"startTime",2),p([u()],r.prototype,"step",2),p([u()],r.prototype,"allowInput",2),p([u()],r.prototype,"showNow",2),p([u()],r.prototype,"showHourOptions",2),p([u()],r.prototype,"customOptions",2),p([u()],r.prototype,"validationCallback",2),p([u()],r.prototype,"parseCallback",2),p([u()],r.prototype,"formatCallback",2),p([u()],r.prototype,"coercionCallback",2),p([u()],r.prototype,"prepareMaskCallback",2),p([u()],r.prototype,"disabled",2),p([u()],r.prototype,"popupClasses",2),p([u()],r.prototype,"allowDropdown",2),p([u()],r.prototype,"popupTarget",2),r=p([R({name:s.elementName,dependencies:[et,tt,ot,w,it,w,at]})],r);var ct=class extends ${constructor(e){super(e)}_build(){let e=document.createElement(s.elementName);return this._attachTextField(e),e}get inputElement(){return this._textFieldDelegate.inputElement}get textFieldElement(){return this._textFieldDelegate.element}get value(){return this._element.value}set value(e){this._element.value=e}get disabled(){return this._element.disabled}set disabled(e){this._element.disabled=e}get invalid(){return this._textFieldDelegate.invalid||!1}set invalid(e){this._textFieldDelegate.invalid=e}onChange(e){this._element.addEventListener(s.events.CHANGE,i=>{var n;return e((n=i.detail)!=null?n:"")})}onInput(e){this._element.masked?this._element.addEventListener(s.events.INPUT,i=>{var n;return e((n=i.detail)!=null?n:"")}):this._textFieldDelegate.inputElement.addEventListener("input",i=>e(i.target.value))}onFocus(e){this._textFieldDelegate.inputElement.addEventListener("focus",i=>e(i))}onBlur(e){this._textFieldDelegate.inputElement.addEventListener("blur",i=>e(i))}_attachTextField(e){var n,l,o,d;let i={props:k({},(l=(n=this._config.options)==null?void 0:n.textFieldDelegateConfig)==null?void 0:l.props),options:k({},(d=(o=this._config.options)==null?void 0:o.textFieldDelegateConfig)==null?void 0:d.options)};this._textFieldDelegate=new nt(i),e.appendChild(this._textFieldDelegate.element)}};function xe(){N(r)}export{s as a,g as b,C as c,m as d,pt as e,ut as f,v as g,M as h,It as i,dt as j,I as k,O as l,mt as m,D as n,Rt as o,T as p,r as q,ct as r,xe as s};
7
+ //# sourceMappingURL=chunk.O2XO3IRX.js.map
@@ -3,10 +3,10 @@
3
3
  * Copyright 2022 Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import{f as To}from"./chunk.33Q5FK2H.js";import{b as go}from"./chunk.DIYJJHWP.js";import{f as So}from"./chunk.YWKKZLZ2.js";import{d as Bo}from"./chunk.OOBE3XRM.js";import{q as so}from"./chunk.JAEVBPHT.js";import{d as Po}from"./chunk.2SAHWDGJ.js";import{c as ao}from"./chunk.EMDSXK65.js";import{d as co}from"./chunk.TLHI6K2R.js";import{d as lo}from"./chunk.SJSLC6XF.js";import{h as uo}from"./chunk.TR64DV3G.js";import{b as xo}from"./chunk.T7ZJDAXV.js";import{d as io}from"./chunk.444GNOS4.js";import{d as Co}from"./chunk.Q6L7T6OJ.js";import{b as ro}from"./chunk.VMWS5OOZ.js";import{d as fo}from"./chunk.DVMUMHVM.js";import{d as eo}from"./chunk.HAOBWYPY.js";import{d as no}from"./chunk.MOARJZVS.js";import{b as po}from"./chunk.BCUBTR5O.js";import{b as to}from"./chunk.B5ABD4CZ.js";import{d as mo}from"./chunk.EJ4ASQET.js";import{b as U}from"./chunk.5WMEFHVN.js";import{j as _}from"./chunk.5XQVZQ4U.js";import{d as j}from"./chunk.X77WVI2H.js";import{b as G}from"./chunk.SHT6BCLY.js";import{b as H}from"./chunk.6APYGKNX.js";import{d as N}from"./chunk.URBXDOF7.js";import{d as K}from"./chunk.Y7Q6QI5V.js";import{b as Q}from"./chunk.XXA6KNXT.js";import{d as y}from"./chunk.4T5TGQFG.js";import{e as v}from"./chunk.VOMWB7Q6.js";import{d as R}from"./chunk.NNGE722W.js";import{f as V}from"./chunk.LLHA3SQR.js";import{E as L}from"./chunk.JB2N65SR.js";import{b as O}from"./chunk.MGTNCCW3.js";import{i as B}from"./chunk.7ZGIIEIW.js";import{c as l}from"./chunk.HSJQA42U.js";import{b as e}from"./chunk.YHHIPP2F.js";import{d}from"./chunk.YPUWII7L.js";import{c as u}from"./chunk.G77PXLAU.js";import{e as c}from"./chunk.Y6MPWPZU.js";import{d as A}from"./chunk.7O7V3N4A.js";import{d as D}from"./chunk.6QMDYUVT.js";import{b as k}from"./chunk.HUWXZ4ZN.js";import{b as w}from"./chunk.NGIBMR3Q.js";import{f as h}from"./chunk.7NXPOEXV.js";import{d as M}from"./chunk.I2YRKTG7.js";import{d as s}from"./chunk.QJPH24V4.js";import{d as F}from"./chunk.5K5SIZRX.js";import{d as E}from"./chunk.WNOSTPQQ.js";import{d as p}from"./chunk.IFZXG3LI.js";import{d as t}from"./chunk.OG2BI3UW.js";import{d as m}from"./chunk.P6B3UWJ5.js";import{e as z}from"./chunk.CV5E5W6I.js";import{d as Y}from"./chunk.G5Q2CUUE.js";import{d as q}from"./chunk.SZL74RTY.js";import{b as a}from"./chunk.54QFNVMG.js";import{c as C}from"./chunk.D3DLVPPE.js";import{e as i}from"./chunk.7JTKKFL4.js";import{d as I}from"./chunk.K753A3KI.js";import{b as n}from"./chunk.XYBFFTXS.js";import{b as W}from"./chunk.APGFXXJ7.js";import{d as X}from"./chunk.BFNAQQCU.js";import{d as P}from"./chunk.MNBJMPJ6.js";import{d as oo}from"./chunk.PFD2SVJ4.js";import{d as $}from"./chunk.FPV4XEUK.js";import{b as Z}from"./chunk.JNOCXQVB.js";import{d as S}from"./chunk.35U4OX7S.js";import{b}from"./chunk.OAKTW64X.js";import{e as x}from"./chunk.3UMBCR4P.js";import{b as g}from"./chunk.BOENNFXE.js";import{f}from"./chunk.QXLPBYMX.js";import{e as J}from"./chunk.4KBQ5AJJ.js";import{d as T}from"./chunk.OUEF6VQ6.js";import{l as r}from"./chunk.YAJT3P6V.js";import{b as o}from"./chunk.HN4PXH3D.js";var Ao=[p,S,s,P,A,D,M,b,E,F,L,O,h,c,u,d,I,V,y,v,R,e,G,H,N,t,K,Q,io,r,g,U,_,j,n,C,i,q,z,J,W,X,Y,oo,$,m,mo,to,ro,fo,x,Co,w,f,po,no,eo,a,xo,ao,co,lo,k,So,Bo,uo,l,so,Po,Z,T,To,go,B];function Mr(){o(Ao)}export{Mr as a};
6
+ import{f as To}from"./chunk.33Q5FK2H.js";import{b as go}from"./chunk.DIYJJHWP.js";import{f as So}from"./chunk.YWKKZLZ2.js";import{d as Bo}from"./chunk.OOBE3XRM.js";import{q as so}from"./chunk.O2XO3IRX.js";import{d as Po}from"./chunk.2SAHWDGJ.js";import{c as ao}from"./chunk.J6CIWTDH.js";import{d as co}from"./chunk.TLHI6K2R.js";import{d as lo}from"./chunk.SJSLC6XF.js";import{h as uo}from"./chunk.TR64DV3G.js";import{b as xo}from"./chunk.T7ZJDAXV.js";import{d as io}from"./chunk.444GNOS4.js";import{d as Co}from"./chunk.Q6L7T6OJ.js";import{b as ro}from"./chunk.VMWS5OOZ.js";import{d as fo}from"./chunk.DQBSFX46.js";import{d as eo}from"./chunk.WIUER75G.js";import{d as no}from"./chunk.75KFBRF6.js";import{b as po}from"./chunk.BCUBTR5O.js";import{b as to}from"./chunk.B5ABD4CZ.js";import{d as mo}from"./chunk.EJ4ASQET.js";import{b as U}from"./chunk.5WMEFHVN.js";import{j as _}from"./chunk.5XQVZQ4U.js";import{d as j}from"./chunk.X77WVI2H.js";import{b as G}from"./chunk.SHT6BCLY.js";import{b as H}from"./chunk.6APYGKNX.js";import{d as N}from"./chunk.URBXDOF7.js";import{d as K}from"./chunk.Y7Q6QI5V.js";import{b as Q}from"./chunk.XXA6KNXT.js";import{d as y}from"./chunk.4T5TGQFG.js";import{e as v}from"./chunk.QOZLQPKE.js";import{d as R}from"./chunk.NNGE722W.js";import{f as V}from"./chunk.LLHA3SQR.js";import{E as L}from"./chunk.JB2N65SR.js";import{b as O}from"./chunk.MGTNCCW3.js";import{i as B}from"./chunk.QEHJJKFZ.js";import{c as l}from"./chunk.HSJQA42U.js";import{b as e}from"./chunk.YHHIPP2F.js";import{d}from"./chunk.YPUWII7L.js";import{c as u}from"./chunk.G77PXLAU.js";import{e as c}from"./chunk.Y6MPWPZU.js";import{d as A}from"./chunk.7O7V3N4A.js";import{d as D}from"./chunk.6QMDYUVT.js";import{b as k}from"./chunk.HUWXZ4ZN.js";import{b as w}from"./chunk.NGIBMR3Q.js";import{f as h}from"./chunk.7NXPOEXV.js";import{d as M}from"./chunk.I2YRKTG7.js";import{d as s}from"./chunk.QJPH24V4.js";import{d as F}from"./chunk.5K5SIZRX.js";import{d as E}from"./chunk.WNOSTPQQ.js";import{d as p}from"./chunk.IFZXG3LI.js";import{d as t}from"./chunk.OG2BI3UW.js";import{d as m}from"./chunk.P6B3UWJ5.js";import{e as z}from"./chunk.CV5E5W6I.js";import{d as Y}from"./chunk.RGWUF3J2.js";import{d as q}from"./chunk.6XXKSGW5.js";import{b as a}from"./chunk.54QFNVMG.js";import{c as C}from"./chunk.J2ODMCFS.js";import{e as i}from"./chunk.LMOYZQZJ.js";import{d as I}from"./chunk.K753A3KI.js";import{b as n}from"./chunk.XYBFFTXS.js";import{b as W}from"./chunk.APGFXXJ7.js";import{d as X}from"./chunk.BFNAQQCU.js";import{d as P}from"./chunk.MNBJMPJ6.js";import{d as oo}from"./chunk.PFD2SVJ4.js";import{d as $}from"./chunk.FPV4XEUK.js";import{b as Z}from"./chunk.JNOCXQVB.js";import{d as S}from"./chunk.35U4OX7S.js";import{b}from"./chunk.OAKTW64X.js";import{e as x}from"./chunk.3UMBCR4P.js";import{b as g}from"./chunk.BOENNFXE.js";import{f}from"./chunk.QXLPBYMX.js";import{e as J}from"./chunk.4KBQ5AJJ.js";import{d as T}from"./chunk.OUEF6VQ6.js";import{l as r}from"./chunk.YAJT3P6V.js";import{b as o}from"./chunk.HN4PXH3D.js";var Ao=[p,S,s,P,A,D,M,b,E,F,L,O,h,c,u,d,I,V,y,v,R,e,G,H,N,t,K,Q,io,r,g,U,_,j,n,C,i,q,z,J,W,X,Y,oo,$,m,mo,to,ro,fo,x,Co,w,f,po,no,eo,a,xo,ao,co,lo,k,So,Bo,uo,l,so,Po,Z,T,To,go,B];function Mr(){o(Ao)}export{Mr as a};
7
7
  /**
8
8
  * @license
9
9
  * Copyright (c) 2022 Tyler Technologies, Inc.
10
10
  * License: Apache-2.0
11
11
  */
12
- //# sourceMappingURL=chunk.VW4KKRF5.js.map
12
+ //# sourceMappingURL=chunk.ON3JVSSR.js.map
@@ -3,5 +3,5 @@
3
3
  * Copyright 2022 Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import{a as C}from"./chunk.B5ABD4CZ.js";import{b as o}from"./chunk.EJ4ASQET.js";import{a as V}from"./chunk.F3W3XMGT.js";import{h as P,i as N}from"./chunk.KGW63HJX.js";import{a as k}from"./chunk.3UMBCR4P.js";import{x as L}from"./chunk.KYCC3C3M.js";import{a as G}from"./chunk.A23NSEWA.js";import{a as d}from"./chunk.B3IJU6XJ.js";import{i as S}from"./chunk.R4NDFXVA.js";import{a as y,b as c,j as I,k as x,n as B}from"./chunk.G76HB2FK.js";import{a as O,f as a}from"./chunk.MCIQXNKY.js";var U={VALUE:"value",MULTIPLE:"multiple",OBSERVE_SCROLL:"observe-scroll",OBSERVE_SCROLL_THRESHOLD:"observe-scroll-threshold",POPUP_CLASSES:"popup-classes",OPTION_LIMIT:"option-limit",SYNC_POPUP_WIDTH:"sync-popup-width"},W=O({},U),R={CHANGE:"change"},m={attributes:W,events:R};var H=(e=>(e[e.Option=0]="Option",e[e.Group=1]="Group",e))(H||{});function D(l,b){let e=l.some(i=>E(i)),t=l.some(i=>z(i));return e&&b===1||t&&b===0}function E(l){return c(l)&&I(l)&&l.hasOwnProperty("options")&&l.hasOwnProperty("text")}function z(l){return c(l)&&I(l)&&l.hasOwnProperty("label")&&l.hasOwnProperty("value")}var F=class extends N{constructor(e){super();this._adapter=e;this._options=[];this._value=[];this._multiple=!1;this._open=!1;this._selectedValues=[];this._selectedLabels=[];this._selectedIndexes=[];this._filterString="";this._focusListener=t=>this._onFocus(t),this._blurListener=t=>this._onBlur(t),this._clickListener=t=>this._onClick(t),this._keydownListener=t=>this._onKeydown(t),this._optionsChangedListener=t=>this._onOptionsChanged(t),this._activeChangeListener=t=>this._onActiveOptionChanged(t),this._dropdownScrollEndListener=()=>this._onDropdownScrollEnd(),this._dismissListener=()=>this._onDismiss(),this._identifier=y()}_onFocus(e){}initialize(){this._optionListenerDestructor&&this._optionListenerDestructor(),this._optionListenerDestructor=this._adapter.setOptionsListener(this._optionsChangedListener),this._initializeValue()}initializeTarget(){this._adapter.initializeAccessibility(),this._adapter.setMultiple(this._multiple),this._adapter.addClickListener(this._clickListener),this._adapter.addTargetListener("blur",this._blurListener),this._adapter.addTargetListener("focus",this._focusListener),this._adapter.addTargetListener("keydown",this._keydownListener)}disconnect(){this._adapter.removeClickListener(this._clickListener),this._adapter.removeTargetListener("blur",this._blurListener),this._adapter.removeTargetListener("focus",this._focusListener),this._adapter.removeTargetListener("keydown",this._keydownListener),this._open&&this._closeDropdown(),this._optionListenerDestructor&&this._optionListenerDestructor()}appendOptions(e){this._adapter.setOptions(e,!1),this._open&&this._adapter.appendDropdownOptions(e)}selectAll(){this._multiple&&(this.value=this._flatOptions.map(e=>e.value))}deselectAll(){this._multiple&&(this.value=[])}get _flatOptions(){return D(this._options,1)?[].concat.apply([],this._options.map(e=>e.options)):this._options}get _nonDividerOptions(){return this._flatOptions.filter(e=>!e.divider)}_initializeValue(){let e=this._options.length&&this._options||this._adapter.getOptions();c(this._value)&&e.length&&this._applyValue(this._value)}_onClick(e){e.button===0&&(this._open?this._closeDropdown():this._openDropdown())}_onBlur(e){this._adapter.isFocusWithinPopup(e.relatedTarget)||this._open&&this._closeDropdown()}_openDropdown(){if(this._options=this._adapter.getOptions(),!this._flatOptions.length)return;this._open=!0;let e={options:this._options,multiple:this._multiple,selectedValues:[...this._selectedValues],id:this._identifier,optionBuilder:this._optionBuilder,syncWidth:this._syncPopupWidth,observeScroll:this._observeScroll,observeScrollThreshold:this._observeScrollThreshold,scrollEndListener:this._dropdownScrollEndListener,activeChangeCallback:this._activeChangeListener,targetWidthCallback:this._targetWidthCallback,popupClasses:this._popupClasses,optionLimit:this._optionLimit,headerBuilder:this._popupHeaderBuilder,footerBuilder:this._popupFooterBuilder,closeCallback:()=>this._closeDropdown(),selectCallback:t=>{let i=this._flatOptions,n=i.find(r=>r.value===t);if(n){let r=i.indexOf(n);this._onSelect(n,r,!0)}}};this._adapter.open(e),this._adapter.setDismissListener(this._dismissListener)}_closeDropdown(){this._open=!1,this._adapter.close()}async _onSelect(e,t,i=!0){return new Promise(async n=>{if(this._valueChanging)return Promise.resolve(!1);let r=e?e.value:"",u=e?e.label:"",v=[...this._value],f=[...this._selectedValues],g=[...this._selectedLabels],w=[...this._selectedIndexes];if(this._multiple)if(this._selectedValues.includes(r)){let h=this._selectedValues.indexOf(r);this._selectedValues.splice(h,1),this._selectedLabels.splice(h,1),this._selectedIndexes.splice(h,1)}else this._selectedValues.push(r),this._selectedLabels.push(u),this._selectedIndexes.push(t);else c(r)?(this._selectedValues[0]=r,this._selectedLabels[0]=u,this._selectedIndexes[0]=t):(this._selectedValues=[],this._selectedLabels=[],this._selectedIndexes=[]);this._value=[...this._selectedValues];let s=()=>{this._selectedValues=[...f],this._selectedLabels=[...g],this._selectedIndexes=[...w],this._value=[...v]},_=()=>{if(this._multiple){let h=this._selectedIndexes.includes(t);this._adapter.toggleOptionMultiple(t,h)}this._applySelection()},A=this.multiple?[...this._selectedValues]:this._selectedValues[0];if(this._open&&i&&!this._multiple&&this._closeDropdown(),typeof this._beforeValueChange=="function"){this._valueChanging=Promise.resolve(this._beforeValueChange.call(null,A));let h=await this._valueChanging;if(this._valueChanging=void 0,!h)return s(),this._tryUpdateDropdownPosition(),n(!1)}let T=!this._adapter.emitHostEvent(m.events.CHANGE,A,!0,!0);T?s():_(),this._tryUpdateDropdownPosition(),n(!T)})}_selectActiveOption(){let e=this._adapter.getActiveOptionIndex();e>=0&&this._nonDividerOptions[e]&&this._onSelect(this._nonDividerOptions[e],e)}_tryUpdateDropdownPosition(){this._open&&this._adapter.queueDropdownPositionUpdate()}_reset(){this._selectedValues=[],this._selectedLabels=[],this._selectedIndexes=[]}_applyValue(e){this._selectedValues=[],this._selectedLabels=[],this._options=this._adapter.getOptions(),Array.isArray(e)||(e=[e]),this._value=[];for(let t of e){this._value.includes(t)||this._value.push(t);let i=this._flatOptions.find(n=>B(n.value,t));i&&(this._selectedValues.push(i.value),this._selectedLabels.push(i.label))}this._selectedIndexes=this._selectedValues.map(t=>this._flatOptions.findIndex(i=>i.value===t)),this._adapter.patchSelectedValues(this._selectedValues)}_onDismiss(){this._closeDropdown()}_getSelectedText(){if(typeof this._selectedTextBuilder=="function"){let e=this._flatOptions.filter(t=>this._selectedValues.includes(t.value));return this._selectedTextBuilder(e)}return this._multiple?this._selectedLabels.length?`${this._selectedLabels.length} ${this._selectedLabels.length===1?"option":"options"} selected`:"":this._selectedLabels.filter(e=>e&&e.length).join(" ").trim()}_onKeydown(e){let t=e.key==="Escape"||e.keyCode===27,i=e.key==="Enter"||e.keyCode===13,n=e.key==="Space"||e.keyCode===32,r=e.key==="ArrowDown"||e.keyCode===40,u=e.key==="ArrowUp"||e.keyCode===38,v=e.keyCode>=48&&e.keyCode<=90,f=e.key==="Home"||e.keyCode===36,g=e.key==="End"||e.keyCode===35;if(e.key==="Tab"&&this._open&&!this._multiple){this._selectActiveOption();return}if(!v&&this._filterTimeout&&(window.clearTimeout(this._filterTimeout),this._filterString="",this._filterTimeout=void 0),t&&(e.preventDefault(),this._open)){this._closeDropdown();return}if(n)e.preventDefault(),this._open?this._closeDropdown():this._openDropdown();else if(i)this._open&&(e.stopPropagation(),e.preventDefault(),this._options=this._adapter.getOptions(),this._selectActiveOption());else if(u||r){if(e.preventDefault(),this._multiple&&!this._open){this._openDropdown(),this._adapter.activateFirstOption();return}if(this._flatOptions.length===0)return;let s=0;this._open?(s=this._adapter.getActiveOptionIndex(),s===-1&&(s=this._getFirstSelectedOptionIndex())):s=this._getFirstSelectedOptionIndex(),u?s=this._getPreviousHighlightableOptionIndex(s,this._nonDividerOptions):s=this._getNextHighlightableOptionIndex(s,this._nonDividerOptions),this._open?this._adapter.highlightActiveOption(s):this._onSelect(this._nonDividerOptions[s],s)}else if(f)this._open&&(e.preventDefault(),this._adapter.highlightActiveOption(this._nonDividerOptions.findIndex(s=>!s.disabled)));else if(g){if(this._open){e.preventDefault();let s=this._nonDividerOptions;for(let _=s.length-1;_>=0;_--)if(!s[_].disabled){this._adapter.highlightActiveOption(_);break}}}else v&&this._filter(e.key)}_getFirstSelectedOptionIndex(){return this._nonDividerOptions.findIndex(e=>this._selectedValues.includes(e.value))}_getPreviousHighlightableOptionIndex(e,t){let i=e;return i<=0?i=t.length-1:i--,t[i].disabled?this._getPreviousHighlightableOptionIndex(i,t):i}_getNextHighlightableOptionIndex(e,t){let i=e;return i===t.length-1?i=0:i++,t[i].disabled?this._getNextHighlightableOptionIndex(i,t):i}_filter(e){this._filterTimeout&&(window.clearTimeout(this._filterTimeout),this._filterTimeout=void 0),this._filterString+=e,this._filterTimeout=window.setTimeout(()=>{this._filterString="",this._filterTimeout=void 0},300),this._options=this._adapter.getOptions();let t=this._flatOptions.find(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._filterString));if(t){let i=this._flatOptions.indexOf(t);this._open?this._adapter.highlightActiveOption(i):this._multiple||this._onSelect(t,i,!1)}}_onOptionsChanged(e){this._options=e,this._applyValue(this._value)}_onActiveOptionChanged(e){this._adapter.updateActiveDescendant(e)}get value(){return this._multiple?[...this._value]:this._value[0]}set value(e){let t;Array.isArray(e)?t=[...e]:t=e,this._applyValue(t)}get selectedIndex(){return this._multiple?[...this._selectedIndexes]:this._selectedIndexes[0]}set selectedIndex(e){this._options=this._adapter.getOptions();let t;if(Array.isArray(e)?t=[...e]:t=[e],t.sort(),this.multiple)this.value=t.map(i=>this._flatOptions[i]).filter(i=>i).map(i=>i.value);else{let i=this._flatOptions[t[t.length-1]];if(!i)return;this.value=i.value}}get options(){return this._adapter.getOptions()}set options(e){let t;D(e,1)?t=e.map(i=>O({},i)):t=e.map(i=>O({},i)),this._options=t,this._adapter.setOptions(t),this._initializeValue(),this._open&&this._adapter.setDropdownOptions(t)}get multiple(){return this._multiple}set multiple(e){this._multiple!==e&&(this._multiple=e,this._reset(),this._open&&this._closeDropdown(),this._adapter.setMultiple(this._multiple))}get open(){return this._open}set open(e){this._open!==e&&(e?this._openDropdown():this._closeDropdown())}get optionBuilder(){return this._optionBuilder}set optionBuilder(e){this._optionBuilder=e}get selectedTextBuilder(){return this._selectedTextBuilder}set selectedTextBuilder(e){this._selectedTextBuilder=e}get observeScroll(){return this._observeScroll}set observeScroll(e){this._observeScroll=e}get observeScrollThreshold(){return this._observeScrollThreshold}set observeScrollThreshold(e){this._observeScrollThreshold=e}get syncPopupWidth(){return this._syncPopupWidth}set syncPopupWidth(e){this._syncPopupWidth=e}get optionLimit(){return this._optionLimit}set optionLimit(e){this._optionLimit=e}get popupClasses(){return this._popupClasses}set popupClasses(e){this._popupClasses=e}get popupHeaderBuilder(){return this._popupHeaderBuilder}set popupHeaderBuilder(e){this._popupHeaderBuilder=e}get popupFooterBuilder(){return this._popupFooterBuilder}set popupFooterBuilder(e){this._popupFooterBuilder=e}get popupElement(){return this._adapter.popupElement}get beforeValueChange(){return this._beforeValueChange}set beforeValueChange(e){this._beforeValueChange=e}};var p=class extends V{constructor(){super()}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case m.attributes.MULTIPLE:this.multiple=x(i);break;case m.attributes.VALUE:this.value=i;break}}appendOptions(e){this._foundation.appendOptions(e)}selectAll(){this._foundation.selectAll()}deselectAll(){this._foundation.deselectAll()}connectedCallback(){this._foundation.initialize()}disconnectedCallback(){this._foundation.disconnect()}};a([d()],p.prototype,"value",2),a([d()],p.prototype,"selectedIndex",2),a([d()],p.prototype,"options",2),a([d()],p.prototype,"multiple",2),a([d()],p.prototype,"open",2),a([d()],p.prototype,"optionBuilder",2),a([d()],p.prototype,"selectedTextBuilder",2),a([d()],p.prototype,"beforeValueChange",2),a([d({set:!1})],p.prototype,"popupElement",2);var M=class extends G{constructor(e){super(e)}get popupElement(){var e;return(e=this._listDropdown)==null?void 0:e.dropdownElement}getOptions(){let e=Array.from(this._component.querySelectorAll(C.elementName));if(e.length)return e.map(t=>{let i=Array.from(t.querySelectorAll(o.elementName)),n=this._createOptionsFromElements(i);return{text:t.label,options:n}});{let t=Array.from(this._component.querySelectorAll(o.elementName));return this._createOptionsFromElements(t)}}_createOptionsFromElements(e){return e.map(t=>{let i=t.hasAttribute(o.attributes.OPTION_CLASS)?t.getAttribute(o.attributes.OPTION_CLASS):t.optionClass;return typeof i=="string"&&(i=i.split(" ")),{label:t.hasAttribute(o.attributes.LABEL)?t.getAttribute(o.attributes.LABEL):c(t.label)?t.label:t.innerText,value:t.hasAttribute(o.attributes.VALUE)?t.getAttribute(o.attributes.VALUE):t.value,disabled:t.hasAttribute(o.attributes.DISABLED),divider:t.hasAttribute(o.attributes.DIVIDER),optionClass:i,leadingIcon:t.hasAttribute(o.attributes.LEADING_ICON)?t.getAttribute(o.attributes.LEADING_ICON):t.leadingIcon,leadingIconClass:t.hasAttribute(o.attributes.LEADING_ICON_CLASS)?t.getAttribute(o.attributes.LEADING_ICON_CLASS):t.leadingIconClass,leadingIconType:t.hasAttribute(o.attributes.LEADING_ICON_TYPE)?t.getAttribute(o.attributes.LEADING_ICON_TYPE):t.leadingIconType,trailingIcon:t.hasAttribute(o.attributes.TRAILING_ICON)?t.getAttribute(o.attributes.TRAILING_ICON):t.trailingIcon,trailingIconClass:t.hasAttribute(o.attributes.TRAILING_ICON_CLASS)?t.getAttribute(o.attributes.TRAILING_ICON_CLASS):t.trailingIconClass,trailingIconType:t.hasAttribute(o.attributes.TRAILING_ICON_TYPE)?t.getAttribute(o.attributes.TRAILING_ICON_TYPE):t.trailingIconType,leadingBuilder:t.leadingBuilder,trailingBuilder:t.trailingBuilder}})}open(e){this._listDropdown=new P(this._targetElement,e),this._listDropdown.open()}close(){this._listDropdown&&(this._listDropdown.close(),this._listDropdown.destroy(),this._listDropdown=void 0)}setDismissListener(e){if(!this._listDropdown||!this._listDropdown.dropdownElement)return;let t=this._listDropdown.dropdownElement;t.targetElement&&t.targetElement.addEventListener(k.events.BLUR,e)}toggleOptionMultiple(e,t){var i;(i=this._listDropdown)==null||i.toggleOptionMultiple(e,t)}getActiveOptionIndex(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.getActiveOptionIndex())!=null?t:-1}activateSelectedOption(){var e;(e=this._listDropdown)==null||e.activateSelectedOption()}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}highlightActiveOption(e){var t;(t=this._listDropdown)==null||t.activateOption(e)}patchSelectedValues(e){var t;(t=this._listDropdown)==null||t.setSelectedValues(e)}setOptionsListener(e){let t=n=>{n.stopPropagation(),e(this.getOptions())};this._component.addEventListener(o.events.VALUE_CHANGE,t);let i=new MutationObserver(()=>e(this.getOptions()));return i.observe(this._component,{childList:!0,subtree:!0}),()=>{this._component.removeEventListener(o.events.VALUE_CHANGE,t),i.disconnect()}}setOptions(e,t=!0){t&&this._clearOptions();for(let i of e)if(E(i)){let n=this._createOptionGroupElement(i);for(let r of i.options){let u=this._createOptionElement(r);n.appendChild(u)}this._component.appendChild(n)}else{let n=this._createOptionElement(i);this._component.appendChild(n)}}appendDropdownOptions(e){var t;(t=this._listDropdown)==null||t.appendOptions(e)}setDropdownOptions(e){var t;(t=this._listDropdown)==null||t.setOptions(e)}scrollSelectedOptionIntoView(){var e;(e=this._listDropdown)==null||e.scrollSelectedOptionIntoView()}isFocusWithinPopup(e){return!this._listDropdown||!this._listDropdown.dropdownElement?!1:this._listDropdown.dropdownElement.contains(e)}queueDropdownPositionUpdate(){!this.popupElement||window.requestAnimationFrame(()=>{let e=this.popupElement;e==null||e.position()})}_clearOptions(){Array.from(this._component.querySelectorAll(C.elementName)).forEach(i=>S(i)),Array.from(this._component.querySelectorAll(o.elementName)).forEach(i=>S(i))}_createOptionGroupElement(e){var i;let t=document.createElement("forge-option-group");return L(e,t),t.label=(i=e.text)!=null?i:"",t}_createOptionElement(e){let t=document.createElement("forge-option");return L(e,t),t.textContent=e.label,t}};export{m as a,H as b,D as c,E as d,z as e,F as f,p as g,M as h};
7
- //# sourceMappingURL=chunk.6ZCECXMM.js.map
6
+ import{a as C}from"./chunk.B5ABD4CZ.js";import{b as o}from"./chunk.EJ4ASQET.js";import{a as V}from"./chunk.RST65QIB.js";import{h as P,i as N}from"./chunk.F2TKPPK7.js";import{a as k}from"./chunk.3UMBCR4P.js";import{x as L}from"./chunk.KYCC3C3M.js";import{a as G}from"./chunk.A23NSEWA.js";import{a as d}from"./chunk.B3IJU6XJ.js";import{i as S}from"./chunk.R4NDFXVA.js";import{a as y,b as c,j as I,k as x,n as B}from"./chunk.G76HB2FK.js";import{a as O,f as a}from"./chunk.MCIQXNKY.js";var U={VALUE:"value",MULTIPLE:"multiple",OBSERVE_SCROLL:"observe-scroll",OBSERVE_SCROLL_THRESHOLD:"observe-scroll-threshold",POPUP_CLASSES:"popup-classes",OPTION_LIMIT:"option-limit",SYNC_POPUP_WIDTH:"sync-popup-width"},W=O({},U),R={CHANGE:"change"},m={attributes:W,events:R};var H=(e=>(e[e.Option=0]="Option",e[e.Group=1]="Group",e))(H||{});function D(l,b){let e=l.some(i=>E(i)),t=l.some(i=>z(i));return e&&b===1||t&&b===0}function E(l){return c(l)&&I(l)&&l.hasOwnProperty("options")&&l.hasOwnProperty("text")}function z(l){return c(l)&&I(l)&&l.hasOwnProperty("label")&&l.hasOwnProperty("value")}var F=class extends N{constructor(e){super();this._adapter=e;this._options=[];this._value=[];this._multiple=!1;this._open=!1;this._selectedValues=[];this._selectedLabels=[];this._selectedIndexes=[];this._filterString="";this._focusListener=t=>this._onFocus(t),this._blurListener=t=>this._onBlur(t),this._clickListener=t=>this._onClick(t),this._keydownListener=t=>this._onKeydown(t),this._optionsChangedListener=t=>this._onOptionsChanged(t),this._activeChangeListener=t=>this._onActiveOptionChanged(t),this._dropdownScrollEndListener=()=>this._onDropdownScrollEnd(),this._dismissListener=()=>this._onDismiss(),this._identifier=y()}_onFocus(e){}initialize(){this._optionListenerDestructor&&this._optionListenerDestructor(),this._optionListenerDestructor=this._adapter.setOptionsListener(this._optionsChangedListener),this._initializeValue()}initializeTarget(){this._adapter.initializeAccessibility(),this._adapter.setMultiple(this._multiple),this._adapter.addClickListener(this._clickListener),this._adapter.addTargetListener("blur",this._blurListener),this._adapter.addTargetListener("focus",this._focusListener),this._adapter.addTargetListener("keydown",this._keydownListener)}disconnect(){this._adapter.removeClickListener(this._clickListener),this._adapter.removeTargetListener("blur",this._blurListener),this._adapter.removeTargetListener("focus",this._focusListener),this._adapter.removeTargetListener("keydown",this._keydownListener),this._open&&this._closeDropdown(),this._optionListenerDestructor&&this._optionListenerDestructor()}appendOptions(e){this._adapter.setOptions(e,!1),this._open&&this._adapter.appendDropdownOptions(e)}selectAll(){this._multiple&&(this.value=this._flatOptions.map(e=>e.value))}deselectAll(){this._multiple&&(this.value=[])}get _flatOptions(){return D(this._options,1)?[].concat.apply([],this._options.map(e=>e.options)):this._options}get _nonDividerOptions(){return this._flatOptions.filter(e=>!e.divider)}_initializeValue(){let e=this._options.length&&this._options||this._adapter.getOptions();c(this._value)&&e.length&&this._applyValue(this._value)}_onClick(e){e.button===0&&(this._open?this._closeDropdown():this._openDropdown())}_onBlur(e){this._adapter.isFocusWithinPopup(e.relatedTarget)||this._open&&this._closeDropdown()}_openDropdown(){if(this._options=this._adapter.getOptions(),!this._flatOptions.length)return;this._open=!0;let e={options:this._options,multiple:this._multiple,selectedValues:[...this._selectedValues],id:this._identifier,optionBuilder:this._optionBuilder,syncWidth:this._syncPopupWidth,observeScroll:this._observeScroll,observeScrollThreshold:this._observeScrollThreshold,scrollEndListener:this._dropdownScrollEndListener,activeChangeCallback:this._activeChangeListener,targetWidthCallback:this._targetWidthCallback,popupClasses:this._popupClasses,optionLimit:this._optionLimit,headerBuilder:this._popupHeaderBuilder,footerBuilder:this._popupFooterBuilder,closeCallback:()=>this._closeDropdown(),selectCallback:t=>{let i=this._flatOptions,n=i.find(r=>r.value===t);if(n){let r=i.indexOf(n);this._onSelect(n,r,!0)}}};this._adapter.open(e),this._adapter.setDismissListener(this._dismissListener)}_closeDropdown(){this._open=!1,this._adapter.close()}async _onSelect(e,t,i=!0){return new Promise(async n=>{if(this._valueChanging)return Promise.resolve(!1);let r=e?e.value:"",u=e?e.label:"",v=[...this._value],f=[...this._selectedValues],g=[...this._selectedLabels],w=[...this._selectedIndexes];if(this._multiple)if(this._selectedValues.includes(r)){let h=this._selectedValues.indexOf(r);this._selectedValues.splice(h,1),this._selectedLabels.splice(h,1),this._selectedIndexes.splice(h,1)}else this._selectedValues.push(r),this._selectedLabels.push(u),this._selectedIndexes.push(t);else c(r)?(this._selectedValues[0]=r,this._selectedLabels[0]=u,this._selectedIndexes[0]=t):(this._selectedValues=[],this._selectedLabels=[],this._selectedIndexes=[]);this._value=[...this._selectedValues];let s=()=>{this._selectedValues=[...f],this._selectedLabels=[...g],this._selectedIndexes=[...w],this._value=[...v]},_=()=>{if(this._multiple){let h=this._selectedIndexes.includes(t);this._adapter.toggleOptionMultiple(t,h)}this._applySelection()},A=this.multiple?[...this._selectedValues]:this._selectedValues[0];if(this._open&&i&&!this._multiple&&this._closeDropdown(),typeof this._beforeValueChange=="function"){this._valueChanging=Promise.resolve(this._beforeValueChange.call(null,A));let h=await this._valueChanging;if(this._valueChanging=void 0,!h)return s(),this._tryUpdateDropdownPosition(),n(!1)}let T=!this._adapter.emitHostEvent(m.events.CHANGE,A,!0,!0);T?s():_(),this._tryUpdateDropdownPosition(),n(!T)})}_selectActiveOption(){let e=this._adapter.getActiveOptionIndex();e>=0&&this._nonDividerOptions[e]&&this._onSelect(this._nonDividerOptions[e],e)}_tryUpdateDropdownPosition(){this._open&&this._adapter.queueDropdownPositionUpdate()}_reset(){this._selectedValues=[],this._selectedLabels=[],this._selectedIndexes=[]}_applyValue(e){this._selectedValues=[],this._selectedLabels=[],this._options=this._adapter.getOptions(),Array.isArray(e)||(e=[e]),this._value=[];for(let t of e){this._value.includes(t)||this._value.push(t);let i=this._flatOptions.find(n=>B(n.value,t));i&&(this._selectedValues.push(i.value),this._selectedLabels.push(i.label))}this._selectedIndexes=this._selectedValues.map(t=>this._flatOptions.findIndex(i=>i.value===t)),this._adapter.patchSelectedValues(this._selectedValues)}_onDismiss(){this._closeDropdown()}_getSelectedText(){if(typeof this._selectedTextBuilder=="function"){let e=this._flatOptions.filter(t=>this._selectedValues.includes(t.value));return this._selectedTextBuilder(e)}return this._multiple?this._selectedLabels.length?`${this._selectedLabels.length} ${this._selectedLabels.length===1?"option":"options"} selected`:"":this._selectedLabels.filter(e=>e&&e.length).join(" ").trim()}_onKeydown(e){let t=e.key==="Escape"||e.keyCode===27,i=e.key==="Enter"||e.keyCode===13,n=e.key==="Space"||e.keyCode===32,r=e.key==="ArrowDown"||e.keyCode===40,u=e.key==="ArrowUp"||e.keyCode===38,v=e.keyCode>=48&&e.keyCode<=90,f=e.key==="Home"||e.keyCode===36,g=e.key==="End"||e.keyCode===35;if(e.key==="Tab"&&this._open&&!this._multiple){this._selectActiveOption();return}if(!v&&this._filterTimeout&&(window.clearTimeout(this._filterTimeout),this._filterString="",this._filterTimeout=void 0),t&&(e.preventDefault(),this._open)){this._closeDropdown();return}if(n)e.preventDefault(),this._open?this._closeDropdown():this._openDropdown();else if(i)this._open&&(e.stopPropagation(),e.preventDefault(),this._options=this._adapter.getOptions(),this._selectActiveOption());else if(u||r){if(e.preventDefault(),this._multiple&&!this._open){this._openDropdown(),this._adapter.activateFirstOption();return}if(this._flatOptions.length===0)return;let s=0;this._open?(s=this._adapter.getActiveOptionIndex(),s===-1&&(s=this._getFirstSelectedOptionIndex())):s=this._getFirstSelectedOptionIndex(),u?s=this._getPreviousHighlightableOptionIndex(s,this._nonDividerOptions):s=this._getNextHighlightableOptionIndex(s,this._nonDividerOptions),this._open?this._adapter.highlightActiveOption(s):this._onSelect(this._nonDividerOptions[s],s)}else if(f)this._open&&(e.preventDefault(),this._adapter.highlightActiveOption(this._nonDividerOptions.findIndex(s=>!s.disabled)));else if(g){if(this._open){e.preventDefault();let s=this._nonDividerOptions;for(let _=s.length-1;_>=0;_--)if(!s[_].disabled){this._adapter.highlightActiveOption(_);break}}}else v&&this._filter(e.key)}_getFirstSelectedOptionIndex(){return this._nonDividerOptions.findIndex(e=>this._selectedValues.includes(e.value))}_getPreviousHighlightableOptionIndex(e,t){let i=e;return i<=0?i=t.length-1:i--,t[i].disabled?this._getPreviousHighlightableOptionIndex(i,t):i}_getNextHighlightableOptionIndex(e,t){let i=e;return i===t.length-1?i=0:i++,t[i].disabled?this._getNextHighlightableOptionIndex(i,t):i}_filter(e){this._filterTimeout&&(window.clearTimeout(this._filterTimeout),this._filterTimeout=void 0),this._filterString+=e,this._filterTimeout=window.setTimeout(()=>{this._filterString="",this._filterTimeout=void 0},300),this._options=this._adapter.getOptions();let t=this._flatOptions.find(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._filterString));if(t){let i=this._flatOptions.indexOf(t);this._open?this._adapter.highlightActiveOption(i):this._multiple||this._onSelect(t,i,!1)}}_onOptionsChanged(e){this._options=e,this._applyValue(this._value)}_onActiveOptionChanged(e){this._adapter.updateActiveDescendant(e)}get value(){return this._multiple?[...this._value]:this._value[0]}set value(e){let t;Array.isArray(e)?t=[...e]:t=e,this._applyValue(t)}get selectedIndex(){return this._multiple?[...this._selectedIndexes]:this._selectedIndexes[0]}set selectedIndex(e){this._options=this._adapter.getOptions();let t;if(Array.isArray(e)?t=[...e]:t=[e],t.sort(),this.multiple)this.value=t.map(i=>this._flatOptions[i]).filter(i=>i).map(i=>i.value);else{let i=this._flatOptions[t[t.length-1]];if(!i)return;this.value=i.value}}get options(){return this._adapter.getOptions()}set options(e){let t;D(e,1)?t=e.map(i=>O({},i)):t=e.map(i=>O({},i)),this._options=t,this._adapter.setOptions(t),this._initializeValue(),this._open&&this._adapter.setDropdownOptions(t)}get multiple(){return this._multiple}set multiple(e){this._multiple!==e&&(this._multiple=e,this._reset(),this._open&&this._closeDropdown(),this._adapter.setMultiple(this._multiple))}get open(){return this._open}set open(e){this._open!==e&&(e?this._openDropdown():this._closeDropdown())}get optionBuilder(){return this._optionBuilder}set optionBuilder(e){this._optionBuilder=e}get selectedTextBuilder(){return this._selectedTextBuilder}set selectedTextBuilder(e){this._selectedTextBuilder=e}get observeScroll(){return this._observeScroll}set observeScroll(e){this._observeScroll=e}get observeScrollThreshold(){return this._observeScrollThreshold}set observeScrollThreshold(e){this._observeScrollThreshold=e}get syncPopupWidth(){return this._syncPopupWidth}set syncPopupWidth(e){this._syncPopupWidth=e}get optionLimit(){return this._optionLimit}set optionLimit(e){this._optionLimit=e}get popupClasses(){return this._popupClasses}set popupClasses(e){this._popupClasses=e}get popupHeaderBuilder(){return this._popupHeaderBuilder}set popupHeaderBuilder(e){this._popupHeaderBuilder=e}get popupFooterBuilder(){return this._popupFooterBuilder}set popupFooterBuilder(e){this._popupFooterBuilder=e}get popupElement(){return this._adapter.popupElement}get beforeValueChange(){return this._beforeValueChange}set beforeValueChange(e){this._beforeValueChange=e}};var p=class extends V{constructor(){super()}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case m.attributes.MULTIPLE:this.multiple=x(i);break;case m.attributes.VALUE:this.value=i;break}}appendOptions(e){this._foundation.appendOptions(e)}selectAll(){this._foundation.selectAll()}deselectAll(){this._foundation.deselectAll()}connectedCallback(){this._foundation.initialize()}disconnectedCallback(){this._foundation.disconnect()}};a([d()],p.prototype,"value",2),a([d()],p.prototype,"selectedIndex",2),a([d()],p.prototype,"options",2),a([d()],p.prototype,"multiple",2),a([d()],p.prototype,"open",2),a([d()],p.prototype,"optionBuilder",2),a([d()],p.prototype,"selectedTextBuilder",2),a([d()],p.prototype,"beforeValueChange",2),a([d({set:!1})],p.prototype,"popupElement",2);var M=class extends G{constructor(e){super(e)}get popupElement(){var e;return(e=this._listDropdown)==null?void 0:e.dropdownElement}getOptions(){let e=Array.from(this._component.querySelectorAll(C.elementName));if(e.length)return e.map(t=>{let i=Array.from(t.querySelectorAll(o.elementName)),n=this._createOptionsFromElements(i);return{text:t.label,options:n}});{let t=Array.from(this._component.querySelectorAll(o.elementName));return this._createOptionsFromElements(t)}}_createOptionsFromElements(e){return e.map(t=>{let i=t.hasAttribute(o.attributes.OPTION_CLASS)?t.getAttribute(o.attributes.OPTION_CLASS):t.optionClass;return typeof i=="string"&&(i=i.split(" ")),{label:t.hasAttribute(o.attributes.LABEL)?t.getAttribute(o.attributes.LABEL):c(t.label)?t.label:t.innerText,value:t.hasAttribute(o.attributes.VALUE)?t.getAttribute(o.attributes.VALUE):t.value,disabled:t.hasAttribute(o.attributes.DISABLED),divider:t.hasAttribute(o.attributes.DIVIDER),optionClass:i,leadingIcon:t.hasAttribute(o.attributes.LEADING_ICON)?t.getAttribute(o.attributes.LEADING_ICON):t.leadingIcon,leadingIconClass:t.hasAttribute(o.attributes.LEADING_ICON_CLASS)?t.getAttribute(o.attributes.LEADING_ICON_CLASS):t.leadingIconClass,leadingIconType:t.hasAttribute(o.attributes.LEADING_ICON_TYPE)?t.getAttribute(o.attributes.LEADING_ICON_TYPE):t.leadingIconType,trailingIcon:t.hasAttribute(o.attributes.TRAILING_ICON)?t.getAttribute(o.attributes.TRAILING_ICON):t.trailingIcon,trailingIconClass:t.hasAttribute(o.attributes.TRAILING_ICON_CLASS)?t.getAttribute(o.attributes.TRAILING_ICON_CLASS):t.trailingIconClass,trailingIconType:t.hasAttribute(o.attributes.TRAILING_ICON_TYPE)?t.getAttribute(o.attributes.TRAILING_ICON_TYPE):t.trailingIconType,leadingBuilder:t.leadingBuilder,trailingBuilder:t.trailingBuilder}})}open(e){this._listDropdown=new P(this._targetElement,e),this._listDropdown.open()}close(){this._listDropdown&&(this._listDropdown.close(),this._listDropdown.destroy(),this._listDropdown=void 0)}setDismissListener(e){if(!this._listDropdown||!this._listDropdown.dropdownElement)return;let t=this._listDropdown.dropdownElement;t.targetElement&&t.targetElement.addEventListener(k.events.BLUR,e)}toggleOptionMultiple(e,t){var i;(i=this._listDropdown)==null||i.toggleOptionMultiple(e,t)}getActiveOptionIndex(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.getActiveOptionIndex())!=null?t:-1}activateSelectedOption(){var e;(e=this._listDropdown)==null||e.activateSelectedOption()}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}highlightActiveOption(e){var t;(t=this._listDropdown)==null||t.activateOption(e)}patchSelectedValues(e){var t;(t=this._listDropdown)==null||t.setSelectedValues(e)}setOptionsListener(e){let t=n=>{n.stopPropagation(),e(this.getOptions())};this._component.addEventListener(o.events.VALUE_CHANGE,t);let i=new MutationObserver(()=>e(this.getOptions()));return i.observe(this._component,{childList:!0,subtree:!0}),()=>{this._component.removeEventListener(o.events.VALUE_CHANGE,t),i.disconnect()}}setOptions(e,t=!0){t&&this._clearOptions();for(let i of e)if(E(i)){let n=this._createOptionGroupElement(i);for(let r of i.options){let u=this._createOptionElement(r);n.appendChild(u)}this._component.appendChild(n)}else{let n=this._createOptionElement(i);this._component.appendChild(n)}}appendDropdownOptions(e){var t;(t=this._listDropdown)==null||t.appendOptions(e)}setDropdownOptions(e){var t;(t=this._listDropdown)==null||t.setOptions(e)}scrollSelectedOptionIntoView(){var e;(e=this._listDropdown)==null||e.scrollSelectedOptionIntoView()}isFocusWithinPopup(e){return!this._listDropdown||!this._listDropdown.dropdownElement?!1:this._listDropdown.dropdownElement.contains(e)}queueDropdownPositionUpdate(){!this.popupElement||window.requestAnimationFrame(()=>{let e=this.popupElement;e==null||e.position()})}_clearOptions(){Array.from(this._component.querySelectorAll(C.elementName)).forEach(i=>S(i)),Array.from(this._component.querySelectorAll(o.elementName)).forEach(i=>S(i))}_createOptionGroupElement(e){var i;let t=document.createElement("forge-option-group");return L(e,t),t.label=(i=e.text)!=null?i:"",t}_createOptionElement(e){let t=document.createElement("forge-option");return L(e,t),t.textContent=e.label,t}};export{m as a,H as b,D as c,E as d,z as e,F as f,p as g,M as h};
7
+ //# sourceMappingURL=chunk.PZTAIVJW.js.map
@@ -3,5 +3,5 @@
3
3
  * Copyright 2022 Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import{c as re}from"./chunk.HSJQA42U.js";import{a as se,b as le}from"./chunk.IMK2LFWR.js";import{b as X}from"./chunk.YHHIPP2F.js";import{a as x}from"./chunk.YPUWII7L.js";import{a as ne}from"./chunk.Y6FFG7XO.js";import{a as te}from"./chunk.F3W3XMGT.js";import{h as pe,i as ae}from"./chunk.KGW63HJX.js";import{b as oe}from"./chunk.54QFNVMG.js";import{c as ee}from"./chunk.D3DLVPPE.js";import{e as Z}from"./chunk.7JTKKFL4.js";import{b as Q}from"./chunk.XYBFFTXS.js";import{a as y,e as ie}from"./chunk.3UMBCR4P.js";import{g as V,h as q}from"./chunk.LZMYHIO2.js";import{a as C}from"./chunk.D4SNVKDA.js";import{d as Y,l as J,m as j}from"./chunk.YAJT3P6V.js";import{a as z}from"./chunk.24D46RLZ.js";import{q as $}from"./chunk.KYCC3C3M.js";import{a as G}from"./chunk.A23NSEWA.js";import{a}from"./chunk.B3IJU6XJ.js";import{a as R,b as K,c as W}from"./chunk.BSZ2LBJX.js";import{a as U,e as H,g as A}from"./chunk.HN4PXH3D.js";import{m as M,r as N,s as k,u as L}from"./chunk.R4NDFXVA.js";import{a as S,b as h,c as F,j as D,k as g,l as P,n as T,o as B}from"./chunk.G76HB2FK.js";import{a as w,f as p}from"./chunk.MCIQXNKY.js";var O=`${K}autocomplete`,me={MODE:"mode",MULTIPLE:"multiple",DEBOUNCE:"debounce",FILTER_ON_FOCUS:"filter-on-focus",ALLOW_UNMATCHED:"allow-unmatched",POPUP_TARGET:"popup-target",POPUP_CLASSES:"popup-classes",OPTION_LIMIT:"option-limit",OBSERVE_SCROLL:"observe-scroll",OBSERVE_SCROLL_THRESHOLD:"observe-scroll-threshold",SYNC_POPUP_WIDTH:"sync-popup-width",OPEN:"open",MATCH_KEY:"match-key",DROPDOWN_ICON_OPEN:"data-forge-dropdown-icon-open"},fe={INPUT:ne.selectors.INPUT,DROPDOWN_ICON:"[data-forge-dropdown-icon],[data-forge-dropdown-icon],[forge-dropdown-icon],.forge-dropdown-icon",CLEAR_BUTTON:"[data-forge-autocomplete-clear],[forge-autocomplete-clear]"},ve={DEFAULT_DEBOUNCE_TIME:500,NUM_SKELETON_ITEMS:3},ge={CHANGE:`${O}-change`,SELECT:`${O}-select`,SCROLLED_BOTTOM:`${O}-scrolled-bottom`},o={elementName:O,attributes:me,selectors:fe,numbers:ve,events:ge},ue=(e=>(e.Default="default",e.Stateless="stateless",e))(ue||{});var I=class extends G{constructor(e){super(e);this.setInputElement()}setInputElement(){let e=N(this._component,o.selectors.INPUT,!1);return e.length&&(this._inputElement=e[0]),this._inputElement}setInputAttribute(e,t){this._inputElement.setAttribute(e,t)}addInputListener(e,t){this._inputElement.addEventListener(e,t)}removeInputListener(e,t){this._inputElement.removeEventListener(e,t)}intializeInputAccessibility(e){this._inputElement.setAttribute("autocomplete","off"),this._inputElement.setAttribute("role","combobox"),this._inputElement.setAttribute("aria-live","polite"),this._inputElement.setAttribute("aria-atomic","true"),this._inputElement.setAttribute("aria-haspopup","true"),this._inputElement.setAttribute("aria-expanded","false"),this._inputElement.setAttribute("aria-autocomplete","list")}isWrappingChipField(){return!!this._component.querySelector(x.elementName)}show(e,t){this._targetElement=this._getTargetElement(t),this._targetElement&&(this._listDropdown=new pe(this._targetElement,e),this._listDropdown.open(),this._inputElement.setAttribute("aria-expanded","true"),this._inputElement.setAttribute("aria-controls",`list-dropdown-popup-${e.id}`),this._tryToggleDropdownIconRotation(!0))}hide(e){if(!this._listDropdown)return;let{targetElement:t}=this._listDropdown.dropdownElement;t.removeEventListener(y.events.BLUR,e),this.setBusyVisibility(!1),this._tryToggleDropdownIconRotation(!1),this._inputElement.removeAttribute("aria-activedescendant"),this._inputElement.removeAttribute("aria-controls"),this._inputElement.setAttribute("aria-expanded","false"),this._listDropdown.close(),this._listDropdown=void 0}setBusyVisibility(e){var t;(t=this._listDropdown)==null||t.setBusyVisibility(e)}toggleOptionMultiple(e,t){var i;(i=this._listDropdown)==null||i.toggleOptionMultiple(e,t)}setDismissListener(e){if(!this._listDropdown||!this._listDropdown.dropdownElement)return;let t=this._listDropdown.dropdownElement;t.targetElement&&t.targetElement.addEventListener(y.events.BLUR,e)}focus(){window.requestAnimationFrame(()=>this._inputElement.focus())}setOptions(e){var t;(t=this._listDropdown)==null||t.setOptions(e)}appendOptions(e){var t;(t=this._listDropdown)==null||t.appendOptions(e)}setSelectedText(e){this._inputElement.value=e}getInputValue(){return this._inputElement.value}selectInputValue(){window.requestAnimationFrame(()=>this._inputElement.select())}isFocusWithinPopup(e){return!this._listDropdown||!this._listDropdown.dropdownElement?!1:this._listDropdown.dropdownElement.contains(e)}hasFocus(){let e=k();return e===this._inputElement||this.isFocusWithinPopup(e)}hasInputElement(){return!!this._inputElement}setDropdownIconListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.addEventListener(e,t)})}removeDropdownIconListener(e,t){let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.removeEventListener(e,t)}setClearButtonListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.addEventListener(e,t)})}removeClearButtonListener(e,t){let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.removeEventListener(e,t)}propagateKey(e){var t;(t=this._listDropdown)==null||t.handleKey(e)}updateActiveDescendant(e){!this._targetElement||L(this._inputElement,!!e,"aria-activedescendant",e)}getTargetElementWidth(e){return this._targetElement||(this._targetElement=this._getTargetElement(e)),this._targetElement.getBoundingClientRect().width}getPopupElement(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.dropdownElement)!=null?t:null}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}activateSelectedOption(){var e;(e=this._listDropdown)==null||e.activateSelectedOption()}activateOptionByIndex(e){var t;(t=this._listDropdown)==null||t.activateOption(e)}getActiveOptionIndex(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.getActiveOptionIndex())!=null?t:null}clearActiveOption(){var e;(e=this._listDropdown)==null||e.clearActiveOption()}setSelectedOptions(e){if(this._listDropdown){let t=e.map(i=>i.value);this._listDropdown.setSelectedValues(t)}}queueDropdownPositionUpdate(){!this.getPopupElement()||window.requestAnimationFrame(()=>{let e=this.getPopupElement();e==null||e.position()})}_getTargetElement(e){return e?this._component.querySelector(e)||this._getDefaultTargetElement():this._getDefaultTargetElement()}_getDefaultTargetElement(){let e=this._component.querySelector("forge-text-field");if(e&&e.shadowRoot){let i=A(e,se.selectors.ROOT);if(i)return i}let t=this._component.querySelector("forge-chip-field");if(t&&t.shadowRoot){let i=A(t,x.selectors.ROOT);if(i)return i}return this._component.querySelector("input")||this._component}_tryToggleDropdownIconRotation(e){let t=this._component.querySelector(o.selectors.DROPDOWN_ICON);t&&L(t,e,o.attributes.DROPDOWN_ICON_OPEN)}};var de=(e=>(e[e.Option=0]="Option",e[e.Group=1]="Group",e))(de||{});function b(u,d){let e=u.some(i=>h(i)&&D(i)&&i.hasOwnProperty("options")&&(i.hasOwnProperty("text")||i.hasOwnProperty("builder"))),t=u.some(i=>h(i)&&D(i)&&i.hasOwnProperty("label")&&i.hasOwnProperty("value"));return e&&d===1||t&&d===0}function ce(u,d){return u.find(e=>e.value===d)}function v(u,d,e=null){return e?!(e in u.value)||!(e in d)?!1:T(u.value[e],d[e]):T(u.value,d)}var E=class extends ae{constructor(e){super();this._adapter=e;this._isInitialized=!1;this._isDropdownOpen=!1;this._mode="default";this._multiple=!1;this._debounce=o.numbers.DEFAULT_DEBOUNCE_TIME;this._allowUnmatched=!1;this._filterOnFocus=!0;this._options=[];this._filterText="";this._selectedOptions=[];this._values=[];this._pendingFilterPromises=[];this._matchKey=null;this._clickListener=t=>this._onClick(t),this._focusListener=()=>this._onFocus(),this._blurListener=t=>this._onBlur(t),this._keydownListener=t=>this._onKeydown(t),this._dropdownIconClickListener=t=>this._onDropdownIconClick(t),this._dropdownScrollEndListener=()=>this._onDropdownScrollEnd(),this._dropdownIconMouseDownListener=t=>this._onDropdownIconMouseDown(t),this._clearButtonListener=t=>this._onClear(t),this._dismissListener=()=>this._onDismiss(),this._activeChangeListener=t=>this._adapter.updateActiveDescendant(t),this._targetWidthCallback=()=>this._adapter.getTargetElementWidth(this._popupTarget),this._identifier=S()}async initialize(){if(!this._adapter.hasInputElement()&&!this._adapter.setInputElement())throw new Error("An input element is required as a child of the autocomplete component.");if(this._setInputListener(),this._setFilterCallback(),this._attachListeners(),this._initializeAccessibility(),this._values.length){if(!this._selectedOptions.length){try{await this._executeFilter()}catch(e){console.error(e)}this._updateSelectedOptions(this._values)}this._adapter.setSelectedText(this._getSelectedText())}this._isInitialized=!0}disconnect(){this._isInitialized&&(this._detachListeners(),this._isInitialized=!1),this._isDropdownOpen&&this._closeDropdown()}_attachListeners(){this._adapter.addInputListener("click",this._clickListener),this._adapter.addInputListener("focus",this._focusListener),this._adapter.addInputListener("blur",this._blurListener),this._adapter.addInputListener("input",this._inputListener),this._adapter.addInputListener("keydown",this._keydownListener),this._adapter.setDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.setDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.setClearButtonListener("click",this._clearButtonListener)}_detachListeners(){this._adapter.removeInputListener("click",this._clickListener),this._adapter.removeInputListener("focus",this._focusListener),this._adapter.removeInputListener("blur",this._blurListener),this._adapter.removeInputListener("input",this._inputListener),this._adapter.removeInputListener("keydown",this._keydownListener),this._adapter.removeDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.removeDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.removeClearButtonListener("click",this._clearButtonListener)}_setInputListener(){this._inputListener=e=>this._onInput(e)}_setFilterCallback(){this._filterFn=h(this._debounce)&&this._debounce>0?B(this._debounceFilter,this._debounce,!1):this._debounceFilter}_initializeAccessibility(){this._adapter.intializeInputAccessibility(this._identifier)}get _flatOptions(){return b(this._options,1)?this._options.reduce((e,t)=>e.concat(t.options),[]):this._options}_onClick(e){!this._isDropdownOpen&&this._filterOnFocus&&this._showDropdown()}_onDropdownIconMouseDown(e){e.preventDefault()}_onDropdownIconClick(e){this._isDropdownOpen?this._closeDropdown():(this._adapter.focus(),window.requestAnimationFrame(()=>this._showDropdown()))}_onClear(e){this._clearValue(),this._adapter.setSelectedText(this._getSelectedText())}_onDropdownScrollEnd(){this._adapter.emitHostEvent(o.events.SCROLLED_BOTTOM)}_onFocus(){!this._isDropdownOpen&&this._adapter.getInputValue()&&!C.isMobile&&this._adapter.selectInputValue()}_onBlur(e){this._adapter.isFocusWithinPopup(e.relatedTarget)||this._applyBlur()}_applyBlur(){this._isDropdownOpen&&this._closeDropdown(),this._mode!=="stateless"&&(this._selectedOptions.length?this._adapter.setSelectedText(this._getSelectedText()):this._allowUnmatched||(this._filterText="",this._adapter.setSelectedText("")))}_onInput(e){this._selectedOptions.length&&!this._multiple&&(!this._adapter.getInputValue()||this._allowUnmatched)&&!this._adapter.isWrappingChipField()&&(this._selectedOptions=[],this._values=[],this._emitChangeEvent()),this._filterText=this._adapter.getInputValue(),this._filterFn()}async _debounceFilter(){if(!this._adapter.hasFocus()){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}let e=this._filterText,t=this._executeFilter();this._pendingFilterPromises.push(t),this._isDropdownOpen?this._adapter.setBusyVisibility(!0):this._showDropdown({filter:!1});try{await t}catch(i){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}if(e===this._filterText)this._pendingFilterPromises=[],this._onFilterComplete();else{let i=this._pendingFilterPromises.indexOf(t);i!==-1&&this._pendingFilterPromises.splice(i,1)}}_onKeydown(e){switch(e.key){case"Tab":this._isDropdownOpen&&!this._multiple&&this._selectActiveOption(!1);break;case"Esc":case"Escape":this._isDropdownOpen&&(e.preventDefault(),this._closeDropdown());break;case"Down":case"ArrowDown":e.preventDefault(),this._isDropdownOpen?this._adapter.propagateKey(e.key):this._showDropdown({activateFirst:!0,activateSelected:!0});break;case"Up":case"ArrowUp":e.preventDefault(),this._isDropdownOpen&&this._adapter.propagateKey(e.key);break;case"Enter":case"Home":case"End":this._isDropdownOpen&&(e.key==="Enter"&&e.stopPropagation(),e.preventDefault(),this._adapter.propagateKey(e.key));break;case"Backspace":case"Delete":let t=e.target,i=this._adapter.getInputValue(),n=t.value.substring(t.selectionStart,t.selectionEnd)===t.value,l=i.length===1&&t.selectionEnd===1,c=i.length===1&&t.selectionEnd===0,_=!i||n||l||c;!this._adapter.isWrappingChipField()&&_&&!this._multiple&&this._values.length&&this._clearValue();break}}_executeFilter(e=!0,t=!1){if(!this._filter||typeof this._filter!="function")throw new Error('A filter callback must be provided. Did you set the "filter" property?');let i=this._filter,n=e?this._filterText:"",l=t?this._getValue():null;return new Promise((c,_)=>Promise.resolve(i(n,l)).then(s=>{this._options=s,c(this._options)}).catch(s=>_(`An unexpected error occurred while filtering: ${s}`)))}_onFilterComplete(){if(!this._adapter.hasFocus()){this._isDropdownOpen&&this._closeDropdown();return}if(this._options.length){let e=this._allowUnmatched&&!this._selectedOptions.length;this._dropdownReady({userTriggered:e}),this._filterText&&this._adapter.activateFirstOption()}else this._closeDropdown()}_clearValue(){this._selectedOptions=[],this._values=[],this._isDropdownOpen&&(this._adapter.setSelectedOptions([]),this._adapter.clearActiveOption()),this._emitChangeEvent()}async _showDropdown({filter:e=!0,userTriggered:t=!0,activateFirst:i=!1,activateSelected:n=!1}={}){let l=this._allowUnmatched&&!this._selectedOptions.length;this._isDropdownOpen=!0;let c;if(this._optionBuilder){let s=this._optionBuilder;c=(m,f)=>s(m,this._filterText,f)}let _={options:this._options,multiple:this._multiple,selectedValues:[...this._values],id:`forge-autocomplete-${this._identifier}`,asyncStyle:"skeleton",optionLimit:this._optionLimit,popupClasses:this._popupClasses,headerBuilder:this._popupHeaderBuilder,footerBuilder:this._popupFooterBuilder,transform:s=>{if(this._filterText){let m=$(s,this._filterText);if(m)return m}return s},allowBusy:!0,optionBuilder:c,syncWidth:this._syncPopupWidth,observeScroll:this._observeScroll,observeScrollThreshold:this._observeScrollThreshold,scrollEndListener:this._dropdownScrollEndListener,activeChangeCallback:this._activeChangeListener,targetWidthCallback:this._targetWidthCallback,selectCallback:s=>this._onSelect(s),closeCallback:()=>this._closeDropdown()};if(this._adapter.show(_,this._popupTarget),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen),e){this._options.length&&this._adapter.setBusyVisibility(!0);try{await this._executeFilter(l)}catch(s){console.error(s)}this._updateSelectedOptions(this._values)}this._pendingFilterPromises.length||this._dropdownReady({userTriggered:t,activateFirst:i,activateSelected:n})}_dropdownReady({userTriggered:e=!0,activateFirst:t=!1,activateSelected:i=!1}={}){if(!this._isDropdownOpen||!this._options.length||e&&!this._adapter.hasFocus()){this._closeDropdown();return}this._sortSelectedOptions(),this._adapter.setBusyVisibility(!1),this._adapter.setOptions(this._options),this._adapter.setSelectedOptions(this._selectedOptions),this._adapter.setDismissListener(this._dismissListener),i&&this._selectedOptions.length?this._adapter.activateSelectedOption():t&&this._adapter.activateFirstOption()}_closeDropdown(){this._multiple&&(this._filterText=""),this._isDropdownOpen=!1,this._adapter.hide(this._dismissListener),this._sortSelectedOptions(),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen)}_sortSelectedOptions(){if(this._multiple&&this._selectedOptions.length&&b(this._options,0)){let e=[],t=[];this._options.forEach(i=>{this._selectedOptions.find(n=>v(n,i.value,this._matchKey))?e.push(i):t.push(i)}),this._options=[...e,...t]}}async _onSelect(e,t=!0){if(this._valueChanging)return;if(this._mode==="stateless"){let n={value:e};this._adapter.emitHostEvent(o.events.SELECT,n,!0,!0)&&(this._filterText="",this._closeDropdown());return}let i=()=>{let n=this._flatOptions,l=n.find(s=>v(s,e,this._matchKey)),c=l?l.value:"",_=l?l.label:"";if(this._multiple){let s=n.findIndex(f=>v(f,e,this._matchKey));if(s>=0){let f=this._selectedOptions.some(_e=>v(_e,e,this._matchKey));this._adapter.toggleOptionMultiple(s,f)}let m=ce(this._selectedOptions,c);if(m){let f=this._selectedOptions.indexOf(m);this._selectedOptions.splice(f,1)}else this._selectedOptions.push(l)}else h(c)?(this._selectedOptions[0]=l,this._filterText=_):(this._selectedOptions=[],this._filterText="");if(this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions),this._values=this._selectedOptions.map(s=>s.value),this._adapter.setSelectedText(this._getSelectedText()),!C.isMobile&&t&&this._adapter.selectInputValue(),this._multiple){let s=n.findIndex(f=>v(f,e,this._matchKey)),m=this._values.includes(e);this._adapter.toggleOptionMultiple(s,m)}this._emitChangeEvent(),this._tryUpdateDropdownPosition()};this._isDropdownOpen&&!this._multiple&&this._closeDropdown(),typeof this._beforeValueChange=="function"?(this._valueChanging=Promise.resolve(this._beforeValueChange.call(null,e,this._matchKey)),await this._valueChanging?i():this._tryUpdateDropdownPosition(),this._valueChanging=void 0):i()}_selectActiveOption(e=!0){let t=this._adapter.getActiveOptionIndex();if(typeof t=="number"&&t>=0){let i=this._flatOptions[t];i&&this._onSelect(i.value,e)}}_emitChangeEvent(){this._adapter.emitHostEvent(o.events.CHANGE,this._getValue(),!0)}_tryUpdateDropdownPosition(){this._isDropdownOpen&&this._adapter.queueDropdownPositionUpdate()}_getValue(){return this._values?this._values.length?this._multiple?[...this._values]:this._values[0]:this._multiple?[]:null:null}_getSelectedText(){return this._adapter.isWrappingChipField()?"":this._selectedTextBuilder?this._selectedTextBuilder(this._selectedOptions):this._multiple?this._values.length?`${this._values.length} ${this._values.length===1?"option":"options"} selected`:"":this._selectedOptions.filter(e=>e&&e.label).map(e=>e.label).join(" ").trim()}_onDismiss(){this._closeDropdown()}async _applyValue(e){let t=[];this._selectedOptions=[],Array.isArray(e)?t=e:t=h(e)?[e]:[],!this._multiple&&t.length>1&&(t=[t[0]]),b(t,0)?(this._values=t.map(n=>n.value),this._selectedOptions=t):this._values=t;let i=this._flatOptions;if(t.length&&i.length&&this._updateSelectedOptions(t),this._values.length&&!this._selectedOptions.length&&!!this._filter&&this._isInitialized){try{await this._executeFilter(!1,!0)}catch(n){console.error(n)}this._updateSelectedOptions(this._values)}this._multiple?this._filterText="":this._filterText=this._selectedOptions.length?this._selectedOptions[0].label:"",this._isInitialized&&this._adapter.setSelectedText(this._getSelectedText()),this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions)}_updateSelectedOptions(e){let t=[...this._flatOptions,...this._selectedOptions];if(this._selectedOptions.length&&(this._selectedOptions=[]),b(e,0))for(let i of e){let n=t.find(l=>v(l,i.value,this._matchKey));n?this._selectedOptions.push(n):this._selectedOptions.push(i)}else for(let i of e){let n=t.find(l=>v(l,i,this._matchKey));n?this._selectedOptions.push(n):this._allowUnmatched&&this._selectedOptions.push({label:i,value:i})}}get mode(){return this._mode}set mode(e){this._mode!==e&&(this._mode=e,this._mode==="stateless"&&(this._selectedOptions=[],this._isDropdownOpen&&this._closeDropdown()),this._adapter.setHostAttribute(o.attributes.MODE,this._mode))}get multiple(){return this._multiple}set multiple(e){this._multiple!==e&&(this._multiple=e,this._adapter.setHostAttribute(o.attributes.MULTIPLE,h(this._multiple)?this._multiple.toString():""))}get value(){return this._getValue()}set value(e){let t=[];e==null?t=[]:Array.isArray(e)?t=JSON.parse(JSON.stringify(e)):F(e)?t=[e]:t=[JSON.parse(JSON.stringify(e))],(t.length!==this._values.length||t.some(n=>!this._values.includes(n)))&&this._applyValue(e)}get filterOnFocus(){return this._filterOnFocus}set filterOnFocus(e){this._filterOnFocus!==e&&(this._filterOnFocus=e,this._adapter.setHostAttribute(o.attributes.FILTER_ON_FOCUS,h(this._filterOnFocus)?this._filterOnFocus.toString():""))}get allowUnmatched(){return this._allowUnmatched}set allowUnmatched(e){this._allowUnmatched!==e&&(this._allowUnmatched=e,h(this._allowUnmatched)&&this._adapter.setHostAttribute(o.attributes.ALLOW_UNMATCHED,this._allowUnmatched.toString()))}get matchKey(){return this._matchKey}set matchKey(e){this._matchKey!==e&&(this._matchKey=e)}get popupTarget(){return this._popupTarget}set popupTarget(e){this._popupTarget!==e&&(this._popupTarget=e)}get popupClasses(){return Array.isArray(this._popupClasses)?[...this._popupClasses]:[this._popupClasses]}set popupClasses(e){this._popupClasses!==e&&(this._popupClasses=Array.isArray(e)?[...e]:[e])}set popupHeaderBuilder(e){this._popupHeaderBuilder=e}set popupFooterBuilder(e){this._popupFooterBuilder=e}get syncPopupWidth(){return this._syncPopupWidth}set syncPopupWidth(e){this._syncPopupWidth!==e&&(this._syncPopupWidth=e)}get optionLimit(){return this._optionLimit}set optionLimit(e){this._optionLimit!==e&&(this._optionLimit=e)}get debounce(){return this._debounce}set debounce(e){this._debounce!==e&&(this._debounce=e,this._isInitialized&&this._setFilterCallback(),this._adapter.setHostAttribute(o.attributes.DEBOUNCE,h(this._debounce)?this._debounce.toString():""))}get optionBuilder(){return this._optionBuilder}set optionBuilder(e){this._optionBuilder=e}get filter(){return this._filter}set filter(e){this._filter!==e&&(this._filter=e,this._isInitialized&&this._values.length&&!this._flatOptions.length&&!!this._filter&&this._executeFilter().then(()=>{this._updateSelectedOptions(this._values),this._adapter.setSelectedText(this._getSelectedText())}))}get selectedTextBuilder(){return this._selectedTextBuilder}set selectedTextBuilder(e){this._selectedTextBuilder=e,this._selectedOptions.length&&this._adapter.setSelectedText(this._getSelectedText())}get observeScroll(){return this._observeScroll}set observeScroll(e){this._observeScroll=e}get observeScrollThreshold(){return this._observeScrollThreshold}set observeScrollThreshold(e){this._observeScrollThreshold=e}appendOptions(e){!this._isDropdownOpen||(this._options=[...this._options,...e],this._adapter.appendOptions(e))}get isInitialized(){return this._isInitialized}get open(){return this._isDropdownOpen}set open(e){this._isDropdownOpen!==e&&(e?this._showDropdown({userTriggered:!1}):this._closeDropdown())}get beforeValueChange(){return this._beforeValueChange}set beforeValueChange(e){e!==this._beforeValueChange&&(this._beforeValueChange=e)}get popupElement(){return this._adapter.getPopupElement()}};var be="<template><slot></slot></template>",Oe=":host{display:block}:host([hidden]){display:none}",r=class extends te{constructor(){super();Y.define([q,V]),H(this,be,Oe),this._foundation=new E(new I(this))}static get observedAttributes(){return[o.attributes.MODE,o.attributes.MULTIPLE,o.attributes.DEBOUNCE,o.attributes.FILTER_ON_FOCUS,o.attributes.ALLOW_UNMATCHED,o.attributes.POPUP_TARGET,o.attributes.POPUP_CLASSES,o.attributes.OBSERVE_SCROLL,o.attributes.OBSERVE_SCROLL_THRESHOLD,o.attributes.OPTION_LIMIT,o.attributes.SYNC_POPUP_WIDTH,o.attributes.OPEN,o.attributes.MATCH_KEY]}connectedCallback(){this.querySelector(o.selectors.INPUT)?this._foundation.initialize():M(this,o.selectors.INPUT).then(()=>this._foundation.initialize())}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case o.attributes.MODE:this.mode=i;break;case o.attributes.MULTIPLE:this.multiple=g(i);break;case o.attributes.DEBOUNCE:this.debounce=P(i);break;case o.attributes.FILTER_ON_FOCUS:this.filterOnFocus=g(i);break;case o.attributes.ALLOW_UNMATCHED:this.allowUnmatched=g(i);break;case o.attributes.POPUP_TARGET:this.popupTarget=i;break;case o.attributes.OPEN:this.open=g(i);break;case o.attributes.MATCH_KEY:this.matchKey=i;break}}appendOptions(e){this._foundation.appendOptions(e)}openDropdown(){this.open=!0}closeDropdown(){this.open=!1}};p([a()],r.prototype,"mode",2),p([a()],r.prototype,"multiple",2),p([a()],r.prototype,"value",2),p([a()],r.prototype,"debounce",2),p([a()],r.prototype,"filterOnFocus",2),p([a()],r.prototype,"allowUnmatched",2),p([a()],r.prototype,"popupTarget",2),p([a()],r.prototype,"optionBuilder",2),p([a()],r.prototype,"filter",2),p([a()],r.prototype,"selectedTextBuilder",2),p([a()],r.prototype,"open",2),p([a()],r.prototype,"matchKey",2),p([a({set:!1})],r.prototype,"isInitialized",2),p([a({set:!1})],r.prototype,"popupElement",2),p([a()],r.prototype,"beforeValueChange",2),r=p([R({name:o.elementName,dependencies:[re,ie,ee,Z,X,oe,Q,J]})],r);var he=class extends z{constructor(e){super(e)}_build(){let e=document.createElement(o.elementName);return this._attachTextField(e),e}get textFieldDelegate(){return this._textFieldDelegate}get value(){return this._element.value}set value(e){this._element.value=e}get disabled(){return this._textFieldDelegate.inputElement.disabled}set disabled(e){this._textFieldDelegate.inputElement.disabled=e}get invalid(){return this._textFieldDelegate.invalid||!1}set invalid(e){this._textFieldDelegate.invalid=e}onChange(e){this._element.addEventListener(o.events.CHANGE,t=>e(t.detail))}onFocus(e){this._textFieldDelegate.inputElement.addEventListener("focus",t=>e(t))}onBlur(e){this._textFieldDelegate.inputElement.addEventListener("blur",t=>e(t))}_attachTextField(e){var i,n,l,c,_,s;let t={props:w({},(n=(i=this._config.options)==null?void 0:i.textFieldDelegateConfig)==null?void 0:n.props),options:w({},(c=(l=this._config.options)==null?void 0:l.textFieldDelegateConfig)==null?void 0:c.options)};t.options||(t.options={}),((_=this._config.options)==null?void 0:_.useDropdownIcon)!==!1&&!((s=t.options)!=null&&s.trailingElement)&&(t.options.trailingElement=this._createDropdownIconElement()),this._textFieldDelegate=new le(t),e.appendChild(this._textFieldDelegate.element)}_createDropdownIconElement(){let e={props:{slot:"trailing",name:"arrow_drop_down"},options:{attributes:{"forge-dropdown-icon":""}}};return new j(e).element}};function Nt(){U(r)}export{o as a,ue as b,I as c,de as d,b as e,ce as f,v as g,E as h,r as i,he as j,Nt as k};
7
- //# sourceMappingURL=chunk.7ZGIIEIW.js.map
6
+ import{c as re}from"./chunk.HSJQA42U.js";import{a as se,b as le}from"./chunk.IMK2LFWR.js";import{b as X}from"./chunk.YHHIPP2F.js";import{a as x}from"./chunk.YPUWII7L.js";import{a as ne}from"./chunk.Y6FFG7XO.js";import{a as te}from"./chunk.RST65QIB.js";import{h as pe,i as ae}from"./chunk.F2TKPPK7.js";import{b as oe}from"./chunk.54QFNVMG.js";import{c as ee}from"./chunk.J2ODMCFS.js";import{e as Z}from"./chunk.LMOYZQZJ.js";import{b as Q}from"./chunk.XYBFFTXS.js";import{a as y,e as ie}from"./chunk.3UMBCR4P.js";import{g as V,h as q}from"./chunk.LZMYHIO2.js";import{a as C}from"./chunk.D4SNVKDA.js";import{d as Y,l as J,m as j}from"./chunk.YAJT3P6V.js";import{a as z}from"./chunk.24D46RLZ.js";import{q as $}from"./chunk.KYCC3C3M.js";import{a as G}from"./chunk.A23NSEWA.js";import{a}from"./chunk.B3IJU6XJ.js";import{a as R,b as K,c as W}from"./chunk.BSZ2LBJX.js";import{a as U,e as H,g as A}from"./chunk.HN4PXH3D.js";import{m as M,r as N,s as k,u as L}from"./chunk.R4NDFXVA.js";import{a as S,b as h,c as F,j as D,k as g,l as P,n as T,o as B}from"./chunk.G76HB2FK.js";import{a as w,f as p}from"./chunk.MCIQXNKY.js";var O=`${K}autocomplete`,me={MODE:"mode",MULTIPLE:"multiple",DEBOUNCE:"debounce",FILTER_ON_FOCUS:"filter-on-focus",ALLOW_UNMATCHED:"allow-unmatched",POPUP_TARGET:"popup-target",POPUP_CLASSES:"popup-classes",OPTION_LIMIT:"option-limit",OBSERVE_SCROLL:"observe-scroll",OBSERVE_SCROLL_THRESHOLD:"observe-scroll-threshold",SYNC_POPUP_WIDTH:"sync-popup-width",OPEN:"open",MATCH_KEY:"match-key",DROPDOWN_ICON_OPEN:"data-forge-dropdown-icon-open"},fe={INPUT:ne.selectors.INPUT,DROPDOWN_ICON:"[data-forge-dropdown-icon],[data-forge-dropdown-icon],[forge-dropdown-icon],.forge-dropdown-icon",CLEAR_BUTTON:"[data-forge-autocomplete-clear],[forge-autocomplete-clear]"},ve={DEFAULT_DEBOUNCE_TIME:500,NUM_SKELETON_ITEMS:3},ge={CHANGE:`${O}-change`,SELECT:`${O}-select`,SCROLLED_BOTTOM:`${O}-scrolled-bottom`},o={elementName:O,attributes:me,selectors:fe,numbers:ve,events:ge},ue=(e=>(e.Default="default",e.Stateless="stateless",e))(ue||{});var I=class extends G{constructor(e){super(e);this.setInputElement()}setInputElement(){let e=N(this._component,o.selectors.INPUT,!1);return e.length&&(this._inputElement=e[0]),this._inputElement}setInputAttribute(e,t){this._inputElement.setAttribute(e,t)}addInputListener(e,t){this._inputElement.addEventListener(e,t)}removeInputListener(e,t){this._inputElement.removeEventListener(e,t)}intializeInputAccessibility(e){this._inputElement.setAttribute("autocomplete","off"),this._inputElement.setAttribute("role","combobox"),this._inputElement.setAttribute("aria-live","polite"),this._inputElement.setAttribute("aria-atomic","true"),this._inputElement.setAttribute("aria-haspopup","true"),this._inputElement.setAttribute("aria-expanded","false"),this._inputElement.setAttribute("aria-autocomplete","list")}isWrappingChipField(){return!!this._component.querySelector(x.elementName)}show(e,t){this._targetElement=this._getTargetElement(t),this._targetElement&&(this._listDropdown=new pe(this._targetElement,e),this._listDropdown.open(),this._inputElement.setAttribute("aria-expanded","true"),this._inputElement.setAttribute("aria-controls",`list-dropdown-popup-${e.id}`),this._tryToggleDropdownIconRotation(!0))}hide(e){if(!this._listDropdown)return;let{targetElement:t}=this._listDropdown.dropdownElement;t.removeEventListener(y.events.BLUR,e),this.setBusyVisibility(!1),this._tryToggleDropdownIconRotation(!1),this._inputElement.removeAttribute("aria-activedescendant"),this._inputElement.removeAttribute("aria-controls"),this._inputElement.setAttribute("aria-expanded","false"),this._listDropdown.close(),this._listDropdown=void 0}setBusyVisibility(e){var t;(t=this._listDropdown)==null||t.setBusyVisibility(e)}toggleOptionMultiple(e,t){var i;(i=this._listDropdown)==null||i.toggleOptionMultiple(e,t)}setDismissListener(e){if(!this._listDropdown||!this._listDropdown.dropdownElement)return;let t=this._listDropdown.dropdownElement;t.targetElement&&t.targetElement.addEventListener(y.events.BLUR,e)}focus(){window.requestAnimationFrame(()=>this._inputElement.focus())}setOptions(e){var t;(t=this._listDropdown)==null||t.setOptions(e)}appendOptions(e){var t;(t=this._listDropdown)==null||t.appendOptions(e)}setSelectedText(e){this._inputElement.value=e}getInputValue(){return this._inputElement.value}selectInputValue(){window.requestAnimationFrame(()=>this._inputElement.select())}isFocusWithinPopup(e){return!this._listDropdown||!this._listDropdown.dropdownElement?!1:this._listDropdown.dropdownElement.contains(e)}hasFocus(){let e=k();return e===this._inputElement||this.isFocusWithinPopup(e)}hasInputElement(){return!!this._inputElement}setDropdownIconListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.addEventListener(e,t)})}removeDropdownIconListener(e,t){let i=this._component.querySelector(o.selectors.DROPDOWN_ICON);i&&i.removeEventListener(e,t)}setClearButtonListener(e,t){window.requestAnimationFrame(()=>{let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.addEventListener(e,t)})}removeClearButtonListener(e,t){let i=this._component.querySelector(o.selectors.CLEAR_BUTTON);i&&i.removeEventListener(e,t)}propagateKey(e){var t;(t=this._listDropdown)==null||t.handleKey(e)}updateActiveDescendant(e){!this._targetElement||L(this._inputElement,!!e,"aria-activedescendant",e)}getTargetElementWidth(e){return this._targetElement||(this._targetElement=this._getTargetElement(e)),this._targetElement.getBoundingClientRect().width}getPopupElement(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.dropdownElement)!=null?t:null}activateFirstOption(){var e;(e=this._listDropdown)==null||e.activateFirstOption()}activateSelectedOption(){var e;(e=this._listDropdown)==null||e.activateSelectedOption()}activateOptionByIndex(e){var t;(t=this._listDropdown)==null||t.activateOption(e)}getActiveOptionIndex(){var e,t;return(t=(e=this._listDropdown)==null?void 0:e.getActiveOptionIndex())!=null?t:null}clearActiveOption(){var e;(e=this._listDropdown)==null||e.clearActiveOption()}setSelectedOptions(e){if(this._listDropdown){let t=e.map(i=>i.value);this._listDropdown.setSelectedValues(t)}}queueDropdownPositionUpdate(){!this.getPopupElement()||window.requestAnimationFrame(()=>{let e=this.getPopupElement();e==null||e.position()})}_getTargetElement(e){return e?this._component.querySelector(e)||this._getDefaultTargetElement():this._getDefaultTargetElement()}_getDefaultTargetElement(){let e=this._component.querySelector("forge-text-field");if(e&&e.shadowRoot){let i=A(e,se.selectors.ROOT);if(i)return i}let t=this._component.querySelector("forge-chip-field");if(t&&t.shadowRoot){let i=A(t,x.selectors.ROOT);if(i)return i}return this._component.querySelector("input")||this._component}_tryToggleDropdownIconRotation(e){let t=this._component.querySelector(o.selectors.DROPDOWN_ICON);t&&L(t,e,o.attributes.DROPDOWN_ICON_OPEN)}};var de=(e=>(e[e.Option=0]="Option",e[e.Group=1]="Group",e))(de||{});function b(u,d){let e=u.some(i=>h(i)&&D(i)&&i.hasOwnProperty("options")&&(i.hasOwnProperty("text")||i.hasOwnProperty("builder"))),t=u.some(i=>h(i)&&D(i)&&i.hasOwnProperty("label")&&i.hasOwnProperty("value"));return e&&d===1||t&&d===0}function ce(u,d){return u.find(e=>e.value===d)}function v(u,d,e=null){return e?!(e in u.value)||!(e in d)?!1:T(u.value[e],d[e]):T(u.value,d)}var E=class extends ae{constructor(e){super();this._adapter=e;this._isInitialized=!1;this._isDropdownOpen=!1;this._mode="default";this._multiple=!1;this._debounce=o.numbers.DEFAULT_DEBOUNCE_TIME;this._allowUnmatched=!1;this._filterOnFocus=!0;this._options=[];this._filterText="";this._selectedOptions=[];this._values=[];this._pendingFilterPromises=[];this._matchKey=null;this._clickListener=t=>this._onClick(t),this._focusListener=()=>this._onFocus(),this._blurListener=t=>this._onBlur(t),this._keydownListener=t=>this._onKeydown(t),this._dropdownIconClickListener=t=>this._onDropdownIconClick(t),this._dropdownScrollEndListener=()=>this._onDropdownScrollEnd(),this._dropdownIconMouseDownListener=t=>this._onDropdownIconMouseDown(t),this._clearButtonListener=t=>this._onClear(t),this._dismissListener=()=>this._onDismiss(),this._activeChangeListener=t=>this._adapter.updateActiveDescendant(t),this._targetWidthCallback=()=>this._adapter.getTargetElementWidth(this._popupTarget),this._identifier=S()}async initialize(){if(!this._adapter.hasInputElement()&&!this._adapter.setInputElement())throw new Error("An input element is required as a child of the autocomplete component.");if(this._setInputListener(),this._setFilterCallback(),this._attachListeners(),this._initializeAccessibility(),this._values.length){if(!this._selectedOptions.length){try{await this._executeFilter()}catch(e){console.error(e)}this._updateSelectedOptions(this._values)}this._adapter.setSelectedText(this._getSelectedText())}this._isInitialized=!0}disconnect(){this._isInitialized&&(this._detachListeners(),this._isInitialized=!1),this._isDropdownOpen&&this._closeDropdown()}_attachListeners(){this._adapter.addInputListener("click",this._clickListener),this._adapter.addInputListener("focus",this._focusListener),this._adapter.addInputListener("blur",this._blurListener),this._adapter.addInputListener("input",this._inputListener),this._adapter.addInputListener("keydown",this._keydownListener),this._adapter.setDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.setDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.setClearButtonListener("click",this._clearButtonListener)}_detachListeners(){this._adapter.removeInputListener("click",this._clickListener),this._adapter.removeInputListener("focus",this._focusListener),this._adapter.removeInputListener("blur",this._blurListener),this._adapter.removeInputListener("input",this._inputListener),this._adapter.removeInputListener("keydown",this._keydownListener),this._adapter.removeDropdownIconListener("click",this._dropdownIconClickListener),this._adapter.removeDropdownIconListener("mousedown",this._dropdownIconMouseDownListener),this._adapter.removeClearButtonListener("click",this._clearButtonListener)}_setInputListener(){this._inputListener=e=>this._onInput(e)}_setFilterCallback(){this._filterFn=h(this._debounce)&&this._debounce>0?B(this._debounceFilter,this._debounce,!1):this._debounceFilter}_initializeAccessibility(){this._adapter.intializeInputAccessibility(this._identifier)}get _flatOptions(){return b(this._options,1)?this._options.reduce((e,t)=>e.concat(t.options),[]):this._options}_onClick(e){!this._isDropdownOpen&&this._filterOnFocus&&this._showDropdown()}_onDropdownIconMouseDown(e){e.preventDefault()}_onDropdownIconClick(e){this._isDropdownOpen?this._closeDropdown():(this._adapter.focus(),window.requestAnimationFrame(()=>this._showDropdown()))}_onClear(e){this._clearValue(),this._adapter.setSelectedText(this._getSelectedText())}_onDropdownScrollEnd(){this._adapter.emitHostEvent(o.events.SCROLLED_BOTTOM)}_onFocus(){!this._isDropdownOpen&&this._adapter.getInputValue()&&!C.isMobile&&this._adapter.selectInputValue()}_onBlur(e){this._adapter.isFocusWithinPopup(e.relatedTarget)||this._applyBlur()}_applyBlur(){this._isDropdownOpen&&this._closeDropdown(),this._mode!=="stateless"&&(this._selectedOptions.length?this._adapter.setSelectedText(this._getSelectedText()):this._allowUnmatched||(this._filterText="",this._adapter.setSelectedText("")))}_onInput(e){this._selectedOptions.length&&!this._multiple&&(!this._adapter.getInputValue()||this._allowUnmatched)&&!this._adapter.isWrappingChipField()&&(this._selectedOptions=[],this._values=[],this._emitChangeEvent()),this._filterText=this._adapter.getInputValue(),this._filterFn()}async _debounceFilter(){if(!this._adapter.hasFocus()){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}let e=this._filterText,t=this._executeFilter();this._pendingFilterPromises.push(t),this._isDropdownOpen?this._adapter.setBusyVisibility(!0):this._showDropdown({filter:!1});try{await t}catch(i){this._pendingFilterPromises=[],this._isDropdownOpen&&this._closeDropdown();return}if(e===this._filterText)this._pendingFilterPromises=[],this._onFilterComplete();else{let i=this._pendingFilterPromises.indexOf(t);i!==-1&&this._pendingFilterPromises.splice(i,1)}}_onKeydown(e){switch(e.key){case"Tab":this._isDropdownOpen&&!this._multiple&&this._selectActiveOption(!1);break;case"Esc":case"Escape":this._isDropdownOpen&&(e.preventDefault(),this._closeDropdown());break;case"Down":case"ArrowDown":e.preventDefault(),this._isDropdownOpen?this._adapter.propagateKey(e.key):this._showDropdown({activateFirst:!0,activateSelected:!0});break;case"Up":case"ArrowUp":e.preventDefault(),this._isDropdownOpen&&this._adapter.propagateKey(e.key);break;case"Enter":case"Home":case"End":this._isDropdownOpen&&(e.key==="Enter"&&e.stopPropagation(),e.preventDefault(),this._adapter.propagateKey(e.key));break;case"Backspace":case"Delete":let t=e.target,i=this._adapter.getInputValue(),n=t.value.substring(t.selectionStart,t.selectionEnd)===t.value,l=i.length===1&&t.selectionEnd===1,c=i.length===1&&t.selectionEnd===0,_=!i||n||l||c;!this._adapter.isWrappingChipField()&&_&&!this._multiple&&this._values.length&&this._clearValue();break}}_executeFilter(e=!0,t=!1){if(!this._filter||typeof this._filter!="function")throw new Error('A filter callback must be provided. Did you set the "filter" property?');let i=this._filter,n=e?this._filterText:"",l=t?this._getValue():null;return new Promise((c,_)=>Promise.resolve(i(n,l)).then(s=>{this._options=s,c(this._options)}).catch(s=>_(`An unexpected error occurred while filtering: ${s}`)))}_onFilterComplete(){if(!this._adapter.hasFocus()){this._isDropdownOpen&&this._closeDropdown();return}if(this._options.length){let e=this._allowUnmatched&&!this._selectedOptions.length;this._dropdownReady({userTriggered:e}),this._filterText&&this._adapter.activateFirstOption()}else this._closeDropdown()}_clearValue(){this._selectedOptions=[],this._values=[],this._isDropdownOpen&&(this._adapter.setSelectedOptions([]),this._adapter.clearActiveOption()),this._emitChangeEvent()}async _showDropdown({filter:e=!0,userTriggered:t=!0,activateFirst:i=!1,activateSelected:n=!1}={}){let l=this._allowUnmatched&&!this._selectedOptions.length;this._isDropdownOpen=!0;let c;if(this._optionBuilder){let s=this._optionBuilder;c=(m,f)=>s(m,this._filterText,f)}let _={options:this._options,multiple:this._multiple,selectedValues:[...this._values],id:`forge-autocomplete-${this._identifier}`,asyncStyle:"skeleton",optionLimit:this._optionLimit,popupClasses:this._popupClasses,headerBuilder:this._popupHeaderBuilder,footerBuilder:this._popupFooterBuilder,transform:s=>{if(this._filterText){let m=$(s,this._filterText);if(m)return m}return s},allowBusy:!0,optionBuilder:c,syncWidth:this._syncPopupWidth,observeScroll:this._observeScroll,observeScrollThreshold:this._observeScrollThreshold,scrollEndListener:this._dropdownScrollEndListener,activeChangeCallback:this._activeChangeListener,targetWidthCallback:this._targetWidthCallback,selectCallback:s=>this._onSelect(s),closeCallback:()=>this._closeDropdown()};if(this._adapter.show(_,this._popupTarget),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen),e){this._options.length&&this._adapter.setBusyVisibility(!0);try{await this._executeFilter(l)}catch(s){console.error(s)}this._updateSelectedOptions(this._values)}this._pendingFilterPromises.length||this._dropdownReady({userTriggered:t,activateFirst:i,activateSelected:n})}_dropdownReady({userTriggered:e=!0,activateFirst:t=!1,activateSelected:i=!1}={}){if(!this._isDropdownOpen||!this._options.length||e&&!this._adapter.hasFocus()){this._closeDropdown();return}this._sortSelectedOptions(),this._adapter.setBusyVisibility(!1),this._adapter.setOptions(this._options),this._adapter.setSelectedOptions(this._selectedOptions),this._adapter.setDismissListener(this._dismissListener),i&&this._selectedOptions.length?this._adapter.activateSelectedOption():t&&this._adapter.activateFirstOption()}_closeDropdown(){this._multiple&&(this._filterText=""),this._isDropdownOpen=!1,this._adapter.hide(this._dismissListener),this._sortSelectedOptions(),this._adapter.toggleHostAttribute(o.attributes.OPEN,this._isDropdownOpen)}_sortSelectedOptions(){if(this._multiple&&this._selectedOptions.length&&b(this._options,0)){let e=[],t=[];this._options.forEach(i=>{this._selectedOptions.find(n=>v(n,i.value,this._matchKey))?e.push(i):t.push(i)}),this._options=[...e,...t]}}async _onSelect(e,t=!0){if(this._valueChanging)return;if(this._mode==="stateless"){let n={value:e};this._adapter.emitHostEvent(o.events.SELECT,n,!0,!0)&&(this._filterText="",this._closeDropdown());return}let i=()=>{let n=this._flatOptions,l=n.find(s=>v(s,e,this._matchKey)),c=l?l.value:"",_=l?l.label:"";if(this._multiple){let s=n.findIndex(f=>v(f,e,this._matchKey));if(s>=0){let f=this._selectedOptions.some(_e=>v(_e,e,this._matchKey));this._adapter.toggleOptionMultiple(s,f)}let m=ce(this._selectedOptions,c);if(m){let f=this._selectedOptions.indexOf(m);this._selectedOptions.splice(f,1)}else this._selectedOptions.push(l)}else h(c)?(this._selectedOptions[0]=l,this._filterText=_):(this._selectedOptions=[],this._filterText="");if(this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions),this._values=this._selectedOptions.map(s=>s.value),this._adapter.setSelectedText(this._getSelectedText()),!C.isMobile&&t&&this._adapter.selectInputValue(),this._multiple){let s=n.findIndex(f=>v(f,e,this._matchKey)),m=this._values.includes(e);this._adapter.toggleOptionMultiple(s,m)}this._emitChangeEvent(),this._tryUpdateDropdownPosition()};this._isDropdownOpen&&!this._multiple&&this._closeDropdown(),typeof this._beforeValueChange=="function"?(this._valueChanging=Promise.resolve(this._beforeValueChange.call(null,e,this._matchKey)),await this._valueChanging?i():this._tryUpdateDropdownPosition(),this._valueChanging=void 0):i()}_selectActiveOption(e=!0){let t=this._adapter.getActiveOptionIndex();if(typeof t=="number"&&t>=0){let i=this._flatOptions[t];i&&this._onSelect(i.value,e)}}_emitChangeEvent(){this._adapter.emitHostEvent(o.events.CHANGE,this._getValue(),!0)}_tryUpdateDropdownPosition(){this._isDropdownOpen&&this._adapter.queueDropdownPositionUpdate()}_getValue(){return this._values?this._values.length?this._multiple?[...this._values]:this._values[0]:this._multiple?[]:null:null}_getSelectedText(){return this._adapter.isWrappingChipField()?"":this._selectedTextBuilder?this._selectedTextBuilder(this._selectedOptions):this._multiple?this._values.length?`${this._values.length} ${this._values.length===1?"option":"options"} selected`:"":this._selectedOptions.filter(e=>e&&e.label).map(e=>e.label).join(" ").trim()}_onDismiss(){this._closeDropdown()}async _applyValue(e){let t=[];this._selectedOptions=[],Array.isArray(e)?t=e:t=h(e)?[e]:[],!this._multiple&&t.length>1&&(t=[t[0]]),b(t,0)?(this._values=t.map(n=>n.value),this._selectedOptions=t):this._values=t;let i=this._flatOptions;if(t.length&&i.length&&this._updateSelectedOptions(t),this._values.length&&!this._selectedOptions.length&&!!this._filter&&this._isInitialized){try{await this._executeFilter(!1,!0)}catch(n){console.error(n)}this._updateSelectedOptions(this._values)}this._multiple?this._filterText="":this._filterText=this._selectedOptions.length?this._selectedOptions[0].label:"",this._isInitialized&&this._adapter.setSelectedText(this._getSelectedText()),this._isDropdownOpen&&this._adapter.setSelectedOptions(this._selectedOptions)}_updateSelectedOptions(e){let t=[...this._flatOptions,...this._selectedOptions];if(this._selectedOptions.length&&(this._selectedOptions=[]),b(e,0))for(let i of e){let n=t.find(l=>v(l,i.value,this._matchKey));n?this._selectedOptions.push(n):this._selectedOptions.push(i)}else for(let i of e){let n=t.find(l=>v(l,i,this._matchKey));n?this._selectedOptions.push(n):this._allowUnmatched&&this._selectedOptions.push({label:i,value:i})}}get mode(){return this._mode}set mode(e){this._mode!==e&&(this._mode=e,this._mode==="stateless"&&(this._selectedOptions=[],this._isDropdownOpen&&this._closeDropdown()),this._adapter.setHostAttribute(o.attributes.MODE,this._mode))}get multiple(){return this._multiple}set multiple(e){this._multiple!==e&&(this._multiple=e,this._adapter.setHostAttribute(o.attributes.MULTIPLE,h(this._multiple)?this._multiple.toString():""))}get value(){return this._getValue()}set value(e){let t=[];e==null?t=[]:Array.isArray(e)?t=JSON.parse(JSON.stringify(e)):F(e)?t=[e]:t=[JSON.parse(JSON.stringify(e))],(t.length!==this._values.length||t.some(n=>!this._values.includes(n)))&&this._applyValue(e)}get filterOnFocus(){return this._filterOnFocus}set filterOnFocus(e){this._filterOnFocus!==e&&(this._filterOnFocus=e,this._adapter.setHostAttribute(o.attributes.FILTER_ON_FOCUS,h(this._filterOnFocus)?this._filterOnFocus.toString():""))}get allowUnmatched(){return this._allowUnmatched}set allowUnmatched(e){this._allowUnmatched!==e&&(this._allowUnmatched=e,h(this._allowUnmatched)&&this._adapter.setHostAttribute(o.attributes.ALLOW_UNMATCHED,this._allowUnmatched.toString()))}get matchKey(){return this._matchKey}set matchKey(e){this._matchKey!==e&&(this._matchKey=e)}get popupTarget(){return this._popupTarget}set popupTarget(e){this._popupTarget!==e&&(this._popupTarget=e)}get popupClasses(){return Array.isArray(this._popupClasses)?[...this._popupClasses]:[this._popupClasses]}set popupClasses(e){this._popupClasses!==e&&(this._popupClasses=Array.isArray(e)?[...e]:[e])}set popupHeaderBuilder(e){this._popupHeaderBuilder=e}set popupFooterBuilder(e){this._popupFooterBuilder=e}get syncPopupWidth(){return this._syncPopupWidth}set syncPopupWidth(e){this._syncPopupWidth!==e&&(this._syncPopupWidth=e)}get optionLimit(){return this._optionLimit}set optionLimit(e){this._optionLimit!==e&&(this._optionLimit=e)}get debounce(){return this._debounce}set debounce(e){this._debounce!==e&&(this._debounce=e,this._isInitialized&&this._setFilterCallback(),this._adapter.setHostAttribute(o.attributes.DEBOUNCE,h(this._debounce)?this._debounce.toString():""))}get optionBuilder(){return this._optionBuilder}set optionBuilder(e){this._optionBuilder=e}get filter(){return this._filter}set filter(e){this._filter!==e&&(this._filter=e,this._isInitialized&&this._values.length&&!this._flatOptions.length&&!!this._filter&&this._executeFilter().then(()=>{this._updateSelectedOptions(this._values),this._adapter.setSelectedText(this._getSelectedText())}))}get selectedTextBuilder(){return this._selectedTextBuilder}set selectedTextBuilder(e){this._selectedTextBuilder=e,this._selectedOptions.length&&this._adapter.setSelectedText(this._getSelectedText())}get observeScroll(){return this._observeScroll}set observeScroll(e){this._observeScroll=e}get observeScrollThreshold(){return this._observeScrollThreshold}set observeScrollThreshold(e){this._observeScrollThreshold=e}appendOptions(e){!this._isDropdownOpen||(this._options=[...this._options,...e],this._adapter.appendOptions(e))}get isInitialized(){return this._isInitialized}get open(){return this._isDropdownOpen}set open(e){this._isDropdownOpen!==e&&(e?this._showDropdown({userTriggered:!1}):this._closeDropdown())}get beforeValueChange(){return this._beforeValueChange}set beforeValueChange(e){e!==this._beforeValueChange&&(this._beforeValueChange=e)}get popupElement(){return this._adapter.getPopupElement()}};var be="<template><slot></slot></template>",Oe=":host{display:block}:host([hidden]){display:none}",r=class extends te{constructor(){super();Y.define([q,V]),H(this,be,Oe),this._foundation=new E(new I(this))}static get observedAttributes(){return[o.attributes.MODE,o.attributes.MULTIPLE,o.attributes.DEBOUNCE,o.attributes.FILTER_ON_FOCUS,o.attributes.ALLOW_UNMATCHED,o.attributes.POPUP_TARGET,o.attributes.POPUP_CLASSES,o.attributes.OBSERVE_SCROLL,o.attributes.OBSERVE_SCROLL_THRESHOLD,o.attributes.OPTION_LIMIT,o.attributes.SYNC_POPUP_WIDTH,o.attributes.OPEN,o.attributes.MATCH_KEY]}connectedCallback(){this.querySelector(o.selectors.INPUT)?this._foundation.initialize():M(this,o.selectors.INPUT).then(()=>this._foundation.initialize())}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(e,t,i){switch(super.attributeChangedCallback(e,t,i),e){case o.attributes.MODE:this.mode=i;break;case o.attributes.MULTIPLE:this.multiple=g(i);break;case o.attributes.DEBOUNCE:this.debounce=P(i);break;case o.attributes.FILTER_ON_FOCUS:this.filterOnFocus=g(i);break;case o.attributes.ALLOW_UNMATCHED:this.allowUnmatched=g(i);break;case o.attributes.POPUP_TARGET:this.popupTarget=i;break;case o.attributes.OPEN:this.open=g(i);break;case o.attributes.MATCH_KEY:this.matchKey=i;break}}appendOptions(e){this._foundation.appendOptions(e)}openDropdown(){this.open=!0}closeDropdown(){this.open=!1}};p([a()],r.prototype,"mode",2),p([a()],r.prototype,"multiple",2),p([a()],r.prototype,"value",2),p([a()],r.prototype,"debounce",2),p([a()],r.prototype,"filterOnFocus",2),p([a()],r.prototype,"allowUnmatched",2),p([a()],r.prototype,"popupTarget",2),p([a()],r.prototype,"optionBuilder",2),p([a()],r.prototype,"filter",2),p([a()],r.prototype,"selectedTextBuilder",2),p([a()],r.prototype,"open",2),p([a()],r.prototype,"matchKey",2),p([a({set:!1})],r.prototype,"isInitialized",2),p([a({set:!1})],r.prototype,"popupElement",2),p([a()],r.prototype,"beforeValueChange",2),r=p([R({name:o.elementName,dependencies:[re,ie,ee,Z,X,oe,Q,J]})],r);var he=class extends z{constructor(e){super(e)}_build(){let e=document.createElement(o.elementName);return this._attachTextField(e),e}get textFieldDelegate(){return this._textFieldDelegate}get value(){return this._element.value}set value(e){this._element.value=e}get disabled(){return this._textFieldDelegate.inputElement.disabled}set disabled(e){this._textFieldDelegate.inputElement.disabled=e}get invalid(){return this._textFieldDelegate.invalid||!1}set invalid(e){this._textFieldDelegate.invalid=e}onChange(e){this._element.addEventListener(o.events.CHANGE,t=>e(t.detail))}onFocus(e){this._textFieldDelegate.inputElement.addEventListener("focus",t=>e(t))}onBlur(e){this._textFieldDelegate.inputElement.addEventListener("blur",t=>e(t))}_attachTextField(e){var i,n,l,c,_,s;let t={props:w({},(n=(i=this._config.options)==null?void 0:i.textFieldDelegateConfig)==null?void 0:n.props),options:w({},(c=(l=this._config.options)==null?void 0:l.textFieldDelegateConfig)==null?void 0:c.options)};t.options||(t.options={}),((_=this._config.options)==null?void 0:_.useDropdownIcon)!==!1&&!((s=t.options)!=null&&s.trailingElement)&&(t.options.trailingElement=this._createDropdownIconElement()),this._textFieldDelegate=new le(t),e.appendChild(this._textFieldDelegate.element)}_createDropdownIconElement(){let e={props:{slot:"trailing",name:"arrow_drop_down"},options:{attributes:{"forge-dropdown-icon":""}}};return new j(e).element}};function Nt(){U(r)}export{o as a,ue as b,I as c,de as d,b as e,ce as f,v as g,E as h,r as i,he as j,Nt as k};
7
+ //# sourceMappingURL=chunk.QEHJJKFZ.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import{a as z,b as B,c as H,d as K,e as U}from"./chunk.RKKJB3EE.js";import{E as S}from"./chunk.JB2N65SR.js";import{F as O}from"./chunk.J3NHIF6W.js";import{a}from"./chunk.E43TT4RI.js";import{a as m}from"./chunk.IMK2LFWR.js";import{e as D}from"./chunk.AWCBH5KW.js";import{e as w}from"./chunk.3UMBCR4P.js";import{b as N}from"./chunk.BOENNFXE.js";import{l as M}from"./chunk.LZMYHIO2.js";import{a as V}from"./chunk.D4SNVKDA.js";import{d as R,l as x}from"./chunk.YAJT3P6V.js";import{a as F}from"./chunk.24D46RLZ.js";import{b}from"./chunk.7ZS4N2FT.js";import{e as l}from"./chunk.KYCC3C3M.js";import{a as C}from"./chunk.B3IJU6XJ.js";import{a as A,b as L}from"./chunk.BSZ2LBJX.js";import{a as y,e as P,i as E}from"./chunk.HN4PXH3D.js";import{s as v}from"./chunk.R4NDFXVA.js";import{f as g,g as k}from"./chunk.G76HB2FK.js";import{f as h}from"./chunk.MCIQXNKY.js";var d=`${L}date-range-picker`,u=class{constructor(r){r&&(this.from=r.from,this.to=r.to)}copy(){return new u(this)}},q={FROM:"from",TO:"to",END_VALUE:"end-value"},G={INPUT:"input"},W={CHANGE:`${d}-change`,OPEN:`${d}-open`,CLOSE:`${d}-close`,INPUT:`${d}-input`},i={elementName:d,selectors:G,events:W,observedAttributes:q};var _=class extends K{constructor(t){super(t);this._dropdownIdentifier=`forge-date-range-picker-${this._identifier}`}_initializeInput(){if(this._fromInputElement=this._component.querySelectorAll(i.selectors.INPUT)[0],this._toInputElement=this._component.querySelectorAll(i.selectors.INPUT)[1],!this._fromInputElement||!this._fromInputElement)throw new Error(`The ${i.elementName} requires two inputs`)}_initializeCalendarDropdown(){let t=this._getDefaultTargetElement();this._calendarDropdown=new O(t,this._dropdownIdentifier)}initializeMask(t){this._fromInputMask&&this._fromInputMask.destroy(),this._fromInputMask=new b(this._fromInputElement,t)}initializeToMask(t){this._toInputMask&&this._toInputMask.destroy(),this._toInputMask=new b(this._toInputElement,t)}destroy(){super.destroy(),this._destroyToValueChangeListener()}destroyMask(){this._fromInputMask&&(this._fromInputMask.destroy(),this._fromInputMask=void 0),this._toInputMask&&(this._toInputMask.destroy(),this._toInputMask=void 0)}_destroyToValueChangeListener(){typeof this._toValueChangeListener=="function"&&this._toValueChangeListener()}initializeAccessibility(){this._applyToInputs(t=>t.setAttribute("autocomplete","off")),this._applyToInputs(t=>t.setAttribute("autocorrect","off")),this._applyToInputs(t=>t.setAttribute("autocapitalize","off")),this._applyToInputs(t=>t.setAttribute("spellcheck","false")),this._applyToInputs(t=>t.setAttribute("role","combobox")),this._applyToInputs(t=>t.setAttribute("aria-live","assertive")),this._applyToInputs(t=>t.setAttribute("aria-atomic","true")),this._applyToInputs(t=>t.setAttribute("aria-haspopup","true")),this._applyToInputs(t=>t.setAttribute("aria-expanded","false")),this._applyToInputs(t=>t.setAttribute("aria-owns",this._dropdownIdentifier))}addInputListener(t,e,n){var o;(o=this._fromInputElement)==null||o.addEventListener(t,e,{capture:n})}addToInputListener(t,e,n){var o;(o=this._toInputElement)==null||o.addEventListener(t,e,{capture:n})}removeInputListener(t,e){var n;(n=this._fromInputElement)==null||n.removeEventListener(t,e)}removeToInputListener(t,e){var n;(n=this._toInputElement)==null||n.removeEventListener(t,e)}setInputValueChangedListener(t,e){this._valueChangeListeners.length&&this.destroyValueChangeListener();let n=D(t,this._fromInputElement,"value",e);this._valueChangeListeners.push(n)}setToInputValueChangedListener(t,e){this._destroyToValueChangeListener(),this._toValueChangeListener=D(t,this._toInputElement,"value",e)}hasInputElement(){return!!this._fromInputElement&&!!this._toInputElement}attachCalendar(t,e){super.attachCalendar(t,e),this._fromInputElement.setAttribute("aria-expanded","true")}detachCalendar(){super.detachCalendar(),this._fromInputElement&&(this._fromInputElement.setAttribute("aria-expanded","false"),this._fromInputElement.removeAttribute("aria-activedescendant"))}setActiveDescendant(t){this._fromInputElement.setAttribute("aria-activedescendant",t)}setInputValue(t,e){this._fromInputElement.value!==t&&(this._fromInputElement.value=t,this._fromInputMask&&this._fromInputMask.updateMask(),e&&(this._fromInputElement.dispatchEvent(new Event("change")),this._fromInputElement.dispatchEvent(new Event("input"))))}setToInputValue(t,e){this._toInputElement.value!==t&&(this._toInputElement.value=t,this._toInputMask&&this._toInputMask.updateMask(),e&&(this._toInputElement.dispatchEvent(new Event("change")),this._toInputElement.dispatchEvent(new Event("input"))))}isInputDisabled(){return this._fromInputElement.disabled}isInputFocused(){return this._toInputElement===v()||this._fromInputElement===v()}getInputValue(){return this._fromInputElement.value}getToInputValue(){return this._toInputElement.value}setDisabled(t){this._fromInputElement.disabled=t,this._toInputElement.disabled=t,this._toInputElement.setAttribute("aria-disabled",t.toString()),this._fromInputElement.setAttribute("aria-disabled",t.toString()),this._toggleElement&&(this._toggleElement.setAttribute("aria-disabled",t.toString()),this._toggleElement.hasOwnProperty("disabled")&&(this._toggleElement.disabled=t))}emitInputEvent(t,e){E(this._fromInputElement,t,e)}emitToInputEvent(t,e){E(this._toInputElement,t,e)}_createToggleElement(){return H("date_range")}tryFocusInput(){this._fromInputElement.focus()}tryBlurInput(){this._fromInputElement.blur()}selectInputText(){this._fromInputElement.select()}selectToInputText(){this._toInputElement.select()}_applyToInputs(t){[this._fromInputElement,this._toInputElement].forEach(t)}};var c=class extends U{constructor(t){super(t);this._mode="range";this._from=null;this._to=null;this._toInputListener=e=>this._onToInput(e),this._toInputValueChangedListener=e=>this._onToInputValueChanged(e),this._toInputKeydownListener=e=>this._onInputKeydown(e),this._toInputFocusListener=e=>this._onToInputFocus(),this._toInputBlurListener=e=>this._onToInputBlur(e)}_initializeState(){this._from||(this._from=this._coerceDateValue(this._adapter.getInputValue())),this._to||(this._to=this._coerceDateValue(this._adapter.getToInputValue()))}_initializeListeners(){super._initializeListeners(),this._adapter.addToInputListener("keydown",this._toInputKeydownListener),this._adapter.addToInputListener("focus",this._toInputFocusListener),this._adapter.addToInputListener("blur",this._toInputBlurListener)}_initializeValueChangedListeners(){super._initializeValueChangedListeners(),this._adapter.setToInputValueChangedListener(this,this._toInputValueChangedListener)}_setInputChangeListeners(){super._setInputChangeListeners(),this._adapter.addToInputListener("input",this._toInputListener)}_removeInputChangeListeners(){super._removeInputChangeListeners(),this._adapter.removeToInputListener("input",this._toInputListener)}_openCalendar(t){this._formatToInputValue(),super._openCalendar(t);let e=this._getCurrentValue();e!=null&&e.to?this._adapter.goToCalendarDate(new Date(e.to)):e!=null&&e.from&&this._adapter.goToCalendarDate(new Date(e.from))}_emitChangeEvent(t,e){let n=this._getTypedValue(t&&t.from||null),o=this._getTypedValue(t&&t.to||null),p=new u({from:n,to:o});return this._adapter.emitHostEvent(i.events.CHANGE,p,!0,!e)?(this._setValue(this._coerceDateValue(t&&t.from||null)),this._setToValue(this._coerceDateValue(t&&t.to||null)),!0):!1}_emitOpenEvent(){this._adapter.emitHostEvent(i.events.OPEN,void 0,!1)}_emitCloseEvent(){this._adapter.emitHostEvent(i.events.CLOSE,void 0,!1)}_onToday(){let t=new Date,e=this._open?new a({from:this._from||t,to:this._to||void 0}):new a({from:t});!this._isDateRangeAcceptable(e)||(this.value=e,this._onDateSelected({date:t,range:e,selected:!0,type:"date"}),this._adapter.setCalendarActiveDate(t))}_onClear(){this._onDateSelected({date:null,range:new a,selected:!1,type:"date"}),this._closeCalendar(!0)}_getCurrentValue(){return this._value}_formatToInputValue(){let t=this._adapter.getToInputValue();if(t){let e=this._parseDateString(t);if(k(e)&&this._isDateValueAcceptable(e)){let n=this._formatDate(e);n&&this._adapter.setToInputValue(n,this._notifyInputValueChanges)}else this._allowInvalidDate||this._adapter.setToInputValue("",this._notifyInputValueChanges)}}_setFormattedInputValue(t){let e=this._formatDate(this._from);!e&&!this._allowInvalidDate&&(e=""),this._adapter.setInputValue(e,t?!1:this._notifyInputValueChanges)}_setFormattedToInputValue(t){let e=this._formatDate(this._to);!e&&!this._allowInvalidDate&&(e=""),this._adapter.setToInputValue(e,t?!1:this._notifyInputValueChanges)}_isDateRangeAcceptable(t){if(!(t!=null&&t.to))return!0;let e=()=>this._isDateValueAcceptable(t.from),n=()=>this._isDateValueAcceptable(t.to),o=()=>(t==null?void 0:t.from)&&(t==null?void 0:t.to)?t.from.getTime()<=t.to.getTime():!0;return e()&&n()&&o()}_setValue(t){this._isDateValueAcceptable(t)&&(this._from=t||null,this._value?this._value.from=this._from:this._value={from:this._from,to:this._to})}_setToValue(t){this._isDateValueAcceptable(t)&&(this._to=t||null,this._value?this._value.to=this._to:this._value={from:this._from,to:this._to})}_onDateSelected(t){let e=t.range;if(t.rangeSelectionState==="to"&&this._closeCalendar(!0),!this._emitChangeEvent(e!=null?e:null))return;let n=this._formatDate(e&&e.from||null),o=this._formatDate(e&&e.to||null);this._adapter.setInputValue(n,this._notifyInputValueChanges),this._adapter.setToInputValue(o,this._notifyInputValueChanges),this._formatInputValue(),this._formatToInputValue(),this._from=e&&e.from||null,this._to=e&&e.to||null,V.isMobile||(o?this._adapter.selectToInputText():this._adapter.selectInputText())}_applyMin(){this._from&&!this._isDateValueAcceptable(this._from)&&(this._emitChangeEvent(new a({to:this._to||void 0}),!0),this._setFormattedInputValue()),this._to&&!this._isDateValueAcceptable(this._to)&&(this._emitChangeEvent(new a({from:this._from||void 0}),!0),this._setFormattedToInputValue()),super._applyMin()}_applyMax(){this._from&&!this._isDateValueAcceptable(this._from)&&(this._emitChangeEvent(new a({to:this._to||void 0}),!0),this._setFormattedInputValue()),this._to&&!this._isDateValueAcceptable(this._to)&&(this._emitChangeEvent(new a({from:this._from||void 0}),!0),this._setFormattedToInputValue()),super._applyMax()}_initializeMask(){if(super._initializeMask(),this._masked){let t={showMaskFormat:this._showMaskFormat,pattern:this._maskFormat,onChange:e=>this._handleToInput(e)};this._prepareMaskCallback&&(t.prepareCallback=(e,n,o,p)=>this._prepareMaskCallback.call(null,e,n,o,p)),this._adapter.initializeToMask(t)}}_applyDisabledDates(){this._from&&!this._isDateValueAcceptable(this._from)&&(this._emitChangeEvent(new a({to:this._to||void 0}),!0),this._setFormattedInputValue()),this._to&&!this._isDateValueAcceptable(this._to)&&(this._emitChangeEvent(new a({from:this._from||void 0}),!0),this._setFormattedToInputValue())}_applyDisabledDaysOfWeek(){this._from&&!this._isDateValueAcceptable(this._from)&&(this._emitChangeEvent(null,!0),this._setFormattedInputValue()),this._to&&!this._isDateValueAcceptable(this._to)&&(this._emitChangeEvent(null,!0),this._setFormattedToInputValue())}_onToInput(t){this._handleInput(this._adapter.getInputValue())}_handleInput(t){let e=this._getSanitizedDateString(t),n=this._coerceDateValue(e);this._masked&&this._adapter.emitInputEvent(i.events.INPUT,e),!l(n,this._from)&&this._isDateValueAcceptable(n)&&this._emitChangeEvent(new a({from:n||void 0,to:this._to||void 0}))}_handleToInput(t){let e=this._getSanitizedDateString(t),n=this._coerceDateValue(e);this._masked&&this._adapter.emitToInputEvent(i.events.INPUT,e),!l(n,this._to)&&this._isDateValueAcceptable(n)&&this._emitChangeEvent(new a({from:this._from||void 0,to:n||void 0}))}_onToInputFocus(){this._adapter.selectToInputText()}_onToInputBlur(t){this._formatToInputValue(),this._open&&this._closeCalendar(!0)}_onInputValueChanged(t){if(this._masked)return;let e=this._getSanitizedDateString(t),n=this._coerceDateValue(e);l(n,this._from)||(this.from=n,this._emitChangeEvent(new a({from:n||void 0,to:this._to||void 0})))}_onToInputValueChanged(t){if(this._masked)return;let e=this._getSanitizedDateString(t),n=this._coerceDateValue(e);l(n,this._to)||(this.to=n,this._emitChangeEvent(new a({from:this._from||void 0,to:n||void 0})))}get value(){return{from:this.from,to:this.to}}set value(t){!t||(t.from===void 0&&(t.from=null),t.to===void 0&&(t.to=null),this.from=t.from,this.to=t.to,this._value={from:this.from,to:this.to})}get from(){let t=this._getTypedValue(this._from);return t?g(t)?new Date(t.getTime()):t:null}set from(t){this._from!==t&&(this._setValue(this._coerceDateValue(t)),this._isInitialized&&(this._setFormattedInputValue(),this._open&&this._adapter.setCalendarValue(new a({from:this._coerceDateValue(t)||void 0,to:this._coerceDateValue(this._to)||void 0}))))}get to(){let t=this._getTypedValue(this._to);return t?g(t)?new Date(t.getTime()):t:null}set to(t){this._to!==t&&(this._setToValue(this._coerceDateValue(t)),this._isInitialized&&(this._setFormattedToInputValue(),this._open&&this._adapter.setCalendarValue(new a({to:this._coerceDateValue(t)||void 0,from:this._coerceDateValue(this._from)||void 0}))))}};var X="<template><slot></slot></template>",j=":host{display:block}:host([hidden]){display:none}",s=class extends B{constructor(){super();R.define(M),P(this,X,j),this._foundation=new c(new _(this))}static get observedAttributes(){return[...Object.values(z.observedAttributes),i.observedAttributes.FROM,i.observedAttributes.TO]}attributeChangedCallback(t,e,n){switch(t){case i.observedAttributes.FROM:this.from=n;return;case i.observedAttributes.TO:this.to=n;return}super.attributeChangedCallback(t,e,n)}};h([C()],s.prototype,"from",2),h([C()],s.prototype,"to",2),s=h([A({name:i.elementName,dependencies:[w,S,N,x]})],s);var $=class extends F{constructor(t){super(t)}_build(){let t=document.createElement(i.elementName);return this._attachTextField(t),t}get fromInput(){return this._textField.querySelector(`input[${m.attributes.MULTI_INPUT}-0]`)}get toInput(){return this._textField.querySelector(`input[${m.attributes.MULTI_INPUT}-1]`)}get textField(){return this._textField}get value(){return this._element.value}set value(t){this._element.value=t}get disabled(){return this._element.disabled}set disabled(t){this._element.disabled=t}get invalid(){return this._textField.invalid||!1}set invalid(t){this._textField.invalid=t}onChange(t){this._element.addEventListener(i.events.CHANGE,e=>t(e.detail))}onFocus(t){this._element.addEventListener("focusin",e=>{!this._element.contains(e.relatedTarget)&&t(e)})}onBlur(t){this._element.addEventListener("focusout",e=>{!this._element.contains(e.relatedTarget)&&t(e)})}_attachTextField(t){var n,o,p,I,T;this._textField=document.createElement(m.elementName),(n=this._config.options)!=null&&n.required&&(this._textField.required=!0),(o=this._config.options)!=null&&o.density&&(this._textField.density=this._config.options.density),this._fromInput=document.createElement("input"),this._fromInput.type="text",this._fromInput.placeholder=((p=this._config.options)==null?void 0:p.fromPlaceholder)||"From",this._textField.appendChild(this._fromInput),this._toInput=document.createElement("input"),this._toInput.type="text",this._toInput.placeholder=((I=this._config.options)==null?void 0:I.toPlaceholder)||"To",this._textField.appendChild(this._toInput);let e=document.createElement("label");e.textContent=((T=this._config.options)==null?void 0:T.label)||"Choose date range",this._textField.appendChild(e),t.appendChild(this._textField)}};function $t(){y(s)}export{u as a,i as b,_ as c,c as d,s as e,$ as f,$t as g};
7
+ //# sourceMappingURL=chunk.QOZLQPKE.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/date-range-picker/date-range-picker-constants.ts", "../../src/date-range-picker/date-range-picker-adapter.ts", "../../src/date-range-picker/date-range-picker-foundation.ts", "../../src/date-range-picker/date-range-picker.ts", "../../src/date-range-picker/date-range-picker-component-delegate.ts", "../../src/date-range-picker/index.ts"],
4
+ "sourcesContent": ["import { COMPONENT_NAME_PREFIX } from '../constants';\n\nconst elementName: keyof HTMLElementTagNameMap = `${COMPONENT_NAME_PREFIX}date-range-picker`;\n\nexport class DatePickerRange implements IDatePickerRange {\n public from?: Date | string | null;\n public to?: Date | string | null;\n constructor(range?: IDatePickerRange) {\n if (range) {\n this.from = range.from;\n this.to = range.to;\n }\n }\n\n public copy(): DatePickerRange {\n return new DatePickerRange(this);\n }\n}\n\nexport interface IDatePickerRange {\n from?: Date | string | null;\n to?: Date | string | null;\n}\n\nconst observedAttributes = {\n FROM: 'from',\n TO: 'to',\n END_VALUE: 'end-value'\n};\n\nconst selectors = {\n INPUT: 'input'\n};\n\nconst events = {\n CHANGE: `${elementName}-change`,\n OPEN: `${elementName}-open`,\n CLOSE: `${elementName}-close`,\n INPUT: `${elementName}-input`\n};\n\nexport const DATE_RANGE_PICKER_CONSTANTS = {\n elementName,\n selectors,\n events,\n observedAttributes\n};\n\n\nexport interface IDateRangePickerChangeEventData extends DatePickerRange {}\n", "import { emitEvent, listenOwnProperty, getActiveElement } from '@tylertech/forge-core';\nimport { CalendarDropdown, ICalendarDropdownPopupConfig } from '../calendar/calendar-dropdown';\nimport { DateInputMask, IDateInputMaskOptions } from '../core';\nimport { BaseDatePickerAdapter, IBaseDatePickerAdapter } from '../date-picker/base/base-date-picker-adapter';\nimport { IDatePickerCalendarDropdownConfig } from '../date-picker/base/base-date-picker-constants';\nimport { createToggleElement } from '../date-picker/base/base-date-picker-utils';\nimport { DateRangePickerComponent, IDateRangePickerComponent } from './date-range-picker';\nimport { DATE_RANGE_PICKER_CONSTANTS } from './date-range-picker-constants';\n\nexport interface IDateRangePickerAdapter extends IBaseDatePickerAdapter {\n initializeToMask(toOptions: IDateInputMaskOptions): void;\n addToInputListener(type: string, listener: (event: Event) => void): void;\n removeToInputListener(type: string, listener: (event: Event) => void): void;\n setToInputValueChangedListener(context: any, listener: (value: any) => void): void;\n getToInputValue(): string;\n setToInputValue(value: string, emitEvents: boolean): void;\n emitInputEvent(type: string, data?: any): void;\n emitToInputEvent(type: string, data?: any): void;\n tryFocusInput(): void;\n tryBlurInput(): void;\n selectToInputText(): void;\n}\n\nexport class DateRangePickerAdapter extends BaseDatePickerAdapter<IDateRangePickerComponent> implements IDateRangePickerAdapter {\n private _fromInputElement: HTMLInputElement;\n private _toInputElement: HTMLInputElement;\n private _toInputMask: DateInputMask | undefined;\n private _fromInputMask: DateInputMask | undefined;\n private _dropdownIdentifier: string;\n private _toValueChangeListener: (() => void) | undefined;\n\n constructor(component: DateRangePickerComponent) {\n super(component);\n this._dropdownIdentifier = `forge-date-range-picker-${this._identifier}`;\n }\n\n protected _initializeInput(): void {\n this._fromInputElement = this._component.querySelectorAll(DATE_RANGE_PICKER_CONSTANTS.selectors.INPUT)[0] as HTMLInputElement;\n this._toInputElement = this._component.querySelectorAll(DATE_RANGE_PICKER_CONSTANTS.selectors.INPUT)[1] as HTMLInputElement;\n\n if (!this._fromInputElement || !this._fromInputElement) {\n throw new Error(`The ${DATE_RANGE_PICKER_CONSTANTS.elementName} requires two inputs`);\n }\n }\n\n protected _initializeCalendarDropdown(): void {\n const targetElement = this._getDefaultTargetElement();\n this._calendarDropdown = new CalendarDropdown(targetElement, this._dropdownIdentifier);\n }\n\n public initializeMask(fromOptions: IDateInputMaskOptions): void {\n if (this._fromInputMask) {\n this._fromInputMask.destroy();\n }\n this._fromInputMask = new DateInputMask(this._fromInputElement, fromOptions);\n }\n\n public initializeToMask(toOptions: IDateInputMaskOptions): void {\n if (this._toInputMask) {\n this._toInputMask.destroy();\n }\n this._toInputMask = new DateInputMask(this._toInputElement, toOptions);\n }\n\n public destroy(): void {\n super.destroy();\n this._destroyToValueChangeListener();\n }\n\n public destroyMask(): void {\n if (this._fromInputMask) {\n this._fromInputMask.destroy();\n this._fromInputMask = undefined;\n }\n if (this._toInputMask) {\n this._toInputMask.destroy();\n this._toInputMask = undefined;\n }\n }\n\n private _destroyToValueChangeListener(): void {\n if (typeof this._toValueChangeListener === 'function') {\n this._toValueChangeListener();\n }\n }\n\n public initializeAccessibility(): void {\n this._applyToInputs(input => input.setAttribute('autocomplete', 'off'));\n this._applyToInputs(input => input.setAttribute('autocorrect', 'off'));\n this._applyToInputs(input => input.setAttribute('autocapitalize', 'off'));\n this._applyToInputs(input => input.setAttribute('spellcheck', 'false'));\n this._applyToInputs(input => input.setAttribute('role', 'combobox'));\n this._applyToInputs(input => input.setAttribute('aria-live', 'assertive'));\n this._applyToInputs(input => input.setAttribute('aria-atomic', 'true'));\n this._applyToInputs(input => input.setAttribute('aria-haspopup', 'true'));\n this._applyToInputs(input => input.setAttribute('aria-expanded', 'false'));\n this._applyToInputs(input => input.setAttribute('aria-owns', this._dropdownIdentifier));\n }\n\n public addInputListener(type: string, listener: (event: Event) => void, capture?: boolean): void {\n this._fromInputElement?.addEventListener(type, listener, { capture });\n }\n\n public addToInputListener(type: string, listener: (event: Event) => void, capture?: boolean): void {\n this._toInputElement?.addEventListener(type, listener, { capture });\n }\n\n public removeInputListener(type: string, listener: (event: Event) => void): void {\n this._fromInputElement?.removeEventListener(type, listener);\n }\n \n public removeToInputListener(type: string, listener: (event: Event) => void): void {\n this._toInputElement?.removeEventListener(type, listener);\n }\n\n public setInputValueChangedListener(context: any, listener: (value: any) => void): void {\n if (this._valueChangeListeners.length) {\n this.destroyValueChangeListener();\n }\n const destroyListenerCb = listenOwnProperty(context, this._fromInputElement, 'value', listener);\n this._valueChangeListeners.push(destroyListenerCb);\n }\n\n public setToInputValueChangedListener(context: any, listener: (value: any) => void): void {\n this._destroyToValueChangeListener();\n this._toValueChangeListener = listenOwnProperty(context, this._toInputElement, 'value', listener);\n }\n\n public hasInputElement(): boolean {\n return !!this._fromInputElement && !!this._toInputElement;\n }\n\n public override attachCalendar(calendarConfig: IDatePickerCalendarDropdownConfig<Date | null>, dropdownConfig?: ICalendarDropdownPopupConfig): void {\n super.attachCalendar(calendarConfig, dropdownConfig);\n this._fromInputElement.setAttribute('aria-expanded', 'true');\n }\n\n public override detachCalendar(): void {\n super.detachCalendar();\n if (this._fromInputElement) {\n this._fromInputElement.setAttribute('aria-expanded', 'false');\n this._fromInputElement.removeAttribute('aria-activedescendant');\n }\n }\n\n public setActiveDescendant(id: string): void {\n this._fromInputElement.setAttribute('aria-activedescendant', id);\n }\n\n public setInputValue(value: string, emitEvents: boolean): void {\n if (this._fromInputElement.value === value) {\n return;\n }\n\n this._fromInputElement.value = value;\n \n if (this._fromInputMask) {\n this._fromInputMask.updateMask();\n }\n\n if (emitEvents) {\n this._fromInputElement.dispatchEvent(new Event('change'));\n this._fromInputElement.dispatchEvent(new Event('input'));;\n }\n }\n\n public setToInputValue(value: string, emitEvents: boolean): void {\n if (this._toInputElement.value === value) {\n return;\n }\n\n this._toInputElement.value = value;\n \n if (this._toInputMask) {\n this._toInputMask.updateMask();\n }\n \n if (emitEvents) {\n this._toInputElement.dispatchEvent(new Event('change'));\n this._toInputElement.dispatchEvent(new Event('input'));\n }\n }\n\n public isInputDisabled(): boolean {\n return this._fromInputElement.disabled;\n }\n\n public isInputFocused(): boolean {\n return this._toInputElement === getActiveElement() || this._fromInputElement === getActiveElement();\n }\n\n public getInputValue(): string {\n return this._fromInputElement.value;\n }\n\n public getToInputValue(): string {\n return this._toInputElement.value;\n }\n\n public setDisabled(isDisabled: boolean): void {\n this._fromInputElement.disabled = isDisabled;\n this._toInputElement.disabled = isDisabled;\n\n this._toInputElement.setAttribute('aria-disabled', isDisabled.toString());\n this._fromInputElement.setAttribute('aria-disabled', isDisabled.toString());\n\n if (this._toggleElement) {\n this._toggleElement.setAttribute('aria-disabled', isDisabled.toString());\n if (this._toggleElement.hasOwnProperty('disabled')) {\n (this._toggleElement as HTMLButtonElement).disabled = isDisabled;\n }\n }\n }\n\n public emitInputEvent(type: string, data?: any): void {\n emitEvent(this._fromInputElement, type, data);\n }\n\n public emitToInputEvent(type: string, data?: any): void {\n emitEvent(this._toInputElement, type, data);\n }\n\n protected override _createToggleElement(): HTMLElement {\n return createToggleElement('date_range');\n }\n\n public tryFocusInput(): void {\n this._fromInputElement.focus();\n }\n\n public tryBlurInput(): void {\n this._fromInputElement.blur();\n }\n\n public selectInputText(): void {\n this._fromInputElement.select();\n }\n\n public selectToInputText(): void {\n this._toInputElement.select();\n }\n\n private _applyToInputs(action: (input: HTMLInputElement) => void): void {\n [this._fromInputElement, this._toInputElement].forEach(action);\n }\n}\n", "import { isDate, isValidDate, Platform } from '@tylertech/forge-core';\nimport { CalendarMode, DateRange, ICalendarDateSelectEventData } from '../calendar';\nimport { isSameDate } from '../core/utils/date-utils';\nimport { IDateInputMaskOptions } from '../core/mask/date-input-mask';\nimport { BaseDatePickerFoundation, IBaseDatePickerFoundation } from '../date-picker/base/base-date-picker-foundation';\nimport { IDateRangePickerAdapter } from './date-range-picker-adapter';\nimport { DatePickerRange, DATE_RANGE_PICKER_CONSTANTS, IDatePickerRange, IDateRangePickerChangeEventData } from './date-range-picker-constants';\n\nexport interface IDateRangePickerFoundation extends IBaseDatePickerFoundation<IDatePickerRange> {\n from: Date | string | null | undefined;\n to: Date | string | null | undefined;\n}\n\nexport class DateRangePickerFoundation extends BaseDatePickerFoundation<IDateRangePickerAdapter, IDatePickerRange> implements IDateRangePickerFoundation {\n protected _mode: CalendarMode = 'range';\n private _from?: Date | null = null;\n private _to?: Date | null = null;\n private _toInputListener: (evt: Event) => void;\n private _toInputKeydownListener: (evt: KeyboardEvent) => void;\n private _toInputFocusListener: (evt: Event) => void;\n private _toInputBlurListener: (evt: Event) => void;\n private _toInputValueChangedListener: (value: string) => void;\n\n constructor(adapter: IDateRangePickerAdapter) {\n super(adapter);\n this._toInputListener = evt => this._onToInput(evt);\n this._toInputValueChangedListener = value => this._onToInputValueChanged(value);\n this._toInputKeydownListener = evt => this._onInputKeydown(evt);\n this._toInputFocusListener = evt => this._onToInputFocus();\n this._toInputBlurListener = evt => this._onToInputBlur(evt);\n }\n\n protected _initializeState(): void {\n if (!this._from) {\n this._from = this._coerceDateValue(this._adapter.getInputValue());\n }\n if (!this._to) {\n this._to = this._coerceDateValue(this._adapter.getToInputValue());\n }\n }\n\n protected override _initializeListeners(): void {\n super._initializeListeners();\n this._adapter.addToInputListener('keydown', this._toInputKeydownListener);\n this._adapter.addToInputListener('focus', this._toInputFocusListener);\n this._adapter.addToInputListener('blur', this._toInputBlurListener);\n }\n\n protected override _initializeValueChangedListeners(): void {\n super._initializeValueChangedListeners();\n this._adapter.setToInputValueChangedListener(this, this._toInputValueChangedListener);\n }\n\n protected override _setInputChangeListeners(): void {\n super._setInputChangeListeners();\n this._adapter.addToInputListener('input', this._toInputListener);\n }\n\n protected override _removeInputChangeListeners(): void {\n super._removeInputChangeListeners();\n this._adapter.removeToInputListener('input', this._toInputListener);\n }\n\n protected override _openCalendar(emitOpenEvent?: boolean): void {\n this._formatToInputValue();\n super._openCalendar(emitOpenEvent);\n\n const currentValue = this._getCurrentValue();\n if (!!currentValue?.to) {\n this._adapter.goToCalendarDate(new Date(currentValue.to));\n } else if (!!currentValue?.from) {\n this._adapter.goToCalendarDate(new Date(currentValue.from));\n }\n }\n\n protected _emitChangeEvent(value: DateRange | null | undefined, force?: boolean): boolean {\n const typedStartValue = this._getTypedValue((value && value.from) || null);\n const typedEndValue = this._getTypedValue((value && value.to) || null);\n const detail: IDateRangePickerChangeEventData = new DatePickerRange({ from: typedStartValue, to: typedEndValue });\n const wasCancelled = !this._adapter.emitHostEvent(DATE_RANGE_PICKER_CONSTANTS.events.CHANGE, detail, true, !force);\n if (!wasCancelled) {\n this._setValue(this._coerceDateValue((value && value.from) || null));\n this._setToValue(this._coerceDateValue((value && value.to) || null));\n return true;\n }\n return false;\n }\n\n protected _emitOpenEvent(): void {\n this._adapter.emitHostEvent(DATE_RANGE_PICKER_CONSTANTS.events.OPEN, undefined, false);\n }\n\n protected _emitCloseEvent(): void {\n this._adapter.emitHostEvent(DATE_RANGE_PICKER_CONSTANTS.events.CLOSE, undefined, false);\n }\n \n protected _onToday(): void {\n const today = new Date();\n const range = this._open ? new DateRange({ from: this._from || today, to: this._to || undefined }) : new DateRange({ from: today });\n if (!this._isDateRangeAcceptable(range)) {\n return;\n }\n this.value = range;\n this._onDateSelected({ date: today, range, selected: true, type: 'date' });\n this._adapter.setCalendarActiveDate(today);\n }\n\n protected _onClear(): void {\n this._onDateSelected({ date: null, range: new DateRange(), selected: false, type: 'date' });\n this._closeCalendar(true);\n }\n\n protected _getCurrentValue(): IDatePickerRange | null | undefined {\n return this._value;\n }\n\n private _formatToInputValue(): void {\n const inputValue = this._adapter.getToInputValue();\n if (inputValue) {\n const parsedDate = this._parseDateString(inputValue);\n if (isValidDate(parsedDate) && this._isDateValueAcceptable(parsedDate)) {\n const formattedDate = this._formatDate(parsedDate);\n if (formattedDate) {\n this._adapter.setToInputValue(formattedDate, this._notifyInputValueChanges);\n }\n } else {\n if (!this._allowInvalidDate) {\n this._adapter.setToInputValue('', this._notifyInputValueChanges);\n }\n }\n }\n }\n\n protected _setFormattedInputValue(suppressValueChanges?: boolean): void {\n let formattedDate = this._formatDate(this._from);\n if (!formattedDate && !this._allowInvalidDate) {\n formattedDate = '';\n }\n this._adapter.setInputValue(formattedDate, suppressValueChanges ? false : this._notifyInputValueChanges);\n }\n\n private _setFormattedToInputValue(suppressValueChanges?: boolean): void {\n let formattedDate = this._formatDate(this._to);\n if (!formattedDate && !this._allowInvalidDate) {\n formattedDate = '';\n }\n this._adapter.setToInputValue(formattedDate, suppressValueChanges ? false : this._notifyInputValueChanges);\n }\n\n protected _isDateRangeAcceptable(value?: DateRange | null | undefined): boolean {\n if (!value?.to) {\n return true;\n }\n\n const passesMinDate = (): boolean => this._isDateValueAcceptable(value.from);\n const passesMaxDate = (): boolean => this._isDateValueAcceptable(value.to);\n const passesDateRange = (): boolean => value?.from && value?.to ? value.from.getTime() <= value.to.getTime() : true;\n\n return passesMinDate() && passesMaxDate() && passesDateRange();\n }\n\n protected _setValue(value: Date | null | undefined): void {\n if (this._isDateValueAcceptable(value)) {\n this._from = value || null;\n if (!this._value) {\n this._value = { from: this._from, to: this._to };\n } else {\n this._value.from = this._from;\n }\n }\n }\n\n private _setToValue(value: Date | null | undefined): void {\n if (this._isDateValueAcceptable(value)) {\n this._to = value || null;\n if (!this._value) {\n this._value = { from: this._from, to: this._to };\n } else {\n this._value.to = this._to;\n }\n }\n }\n\n protected _onDateSelected(event: ICalendarDateSelectEventData): void {\n const value = event.range;\n\n if (event.rangeSelectionState === 'to') {\n this._closeCalendar(true);\n }\n\n if (!this._emitChangeEvent(value ?? null)) {\n return;\n }\n\n const formattedFromValue = this._formatDate((value && value.from) || null);\n const formattedToValue = this._formatDate((value && value.to) || null);\n this._adapter.setInputValue(formattedFromValue, this._notifyInputValueChanges);\n this._adapter.setToInputValue(formattedToValue, this._notifyInputValueChanges);\n this._formatInputValue();\n this._formatToInputValue();\n\n this._from = (value && value.from) || null;\n this._to = (value && value.to) || null;\n\n if (!Platform.isMobile) {\n if (formattedToValue) {\n this._adapter.selectToInputText();\n } else {\n this._adapter.selectInputText();\n }\n }\n }\n\n protected override _applyMin(): void {\n if (this._from && !this._isDateValueAcceptable(this._from)) {\n this._emitChangeEvent(new DateRange({ to: this._to || undefined }), true);\n this._setFormattedInputValue();\n }\n if (this._to && !this._isDateValueAcceptable(this._to)) {\n this._emitChangeEvent(new DateRange({ from: this._from || undefined }), true);\n this._setFormattedToInputValue();\n }\n super._applyMin();\n }\n\n protected override _applyMax(): void {\n if (this._from && !this._isDateValueAcceptable(this._from)) {\n this._emitChangeEvent(new DateRange({ to: this._to || undefined }), true);\n this._setFormattedInputValue();\n }\n if (this._to && !this._isDateValueAcceptable(this._to)) {\n this._emitChangeEvent(new DateRange({ from: this._from || undefined }), true);\n this._setFormattedToInputValue();\n }\n super._applyMax();\n }\n\n protected override _initializeMask(): void {\n super._initializeMask();\n\n // We also need to initialize our mask for the \"to\" input\n if (this._masked) {\n const options: IDateInputMaskOptions = {\n showMaskFormat: this._showMaskFormat,\n pattern: this._maskFormat,\n onChange: (value: string) => this._handleToInput(value)\n };\n\n if (this._prepareMaskCallback) {\n options.prepareCallback = (value, masked, flags, maskInstance) => {\n return this._prepareMaskCallback.call(null, value, masked, flags, maskInstance);\n };\n }\n\n this._adapter.initializeToMask(options);\n }\n }\n\n protected _applyDisabledDates(): void {\n if (this._from && !this._isDateValueAcceptable(this._from)) {\n this._emitChangeEvent(new DateRange({ to: this._to || undefined }), true);\n this._setFormattedInputValue();\n }\n if (this._to && !this._isDateValueAcceptable(this._to)) {\n this._emitChangeEvent(new DateRange({ from: this._from || undefined }), true);\n this._setFormattedToInputValue();\n }\n }\n\n protected _applyDisabledDaysOfWeek(): void {\n if (this._from && !this._isDateValueAcceptable(this._from)) {\n this._emitChangeEvent(null, true);\n this._setFormattedInputValue();\n }\n if (this._to && !this._isDateValueAcceptable(this._to)) {\n this._emitChangeEvent(null, true);\n this._setFormattedToInputValue();\n }\n }\n\n private _onToInput(evt: Event): void {\n this._handleInput(this._adapter.getInputValue());\n }\n\n protected _handleInput(value: string): void {\n const sanitizedValue = this._getSanitizedDateString(value);\n const date = this._coerceDateValue(sanitizedValue);\n if (this._masked) {\n this._adapter.emitInputEvent(DATE_RANGE_PICKER_CONSTANTS.events.INPUT, sanitizedValue);\n }\n if (!isSameDate(date, this._from) && this._isDateValueAcceptable(date)) {\n this._emitChangeEvent(new DateRange({ from: date || undefined, to: this._to || undefined }));\n }\n }\n\n private _handleToInput(value: string): void {\n const sanitizedValue = this._getSanitizedDateString(value);\n const date = this._coerceDateValue(sanitizedValue);\n if (this._masked) {\n this._adapter.emitToInputEvent(DATE_RANGE_PICKER_CONSTANTS.events.INPUT, sanitizedValue);\n }\n if (!isSameDate(date, this._to) && this._isDateValueAcceptable(date)) {\n this._emitChangeEvent(new DateRange({ from: this._from || undefined, to: date || undefined }));\n }\n }\n\n private _onToInputFocus(): void {\n this._adapter.selectToInputText();\n }\n\n private _onToInputBlur(evt: Event): void {\n this._formatToInputValue();\n if (this._open) {\n this._closeCalendar(true);\n }\n }\n\n protected _onInputValueChanged(value: string): void {\n if (this._masked) {\n return;\n }\n const sanitizedValue = this._getSanitizedDateString(value);\n const date = this._coerceDateValue(sanitizedValue);\n if (!isSameDate(date, this._from)) {\n this.from = date;\n this._emitChangeEvent(new DateRange({ from: date || undefined, to: this._to || undefined }));\n }\n }\n\n private _onToInputValueChanged(value: string): void {\n if (this._masked) {\n return;\n }\n const sanitizedValue = this._getSanitizedDateString(value);\n const date = this._coerceDateValue(sanitizedValue);\n if (!isSameDate(date, this._to)) {\n this.to = date;\n this._emitChangeEvent(new DateRange({ from: this._from || undefined, to: date || undefined }));\n }\n }\n\n public get value(): IDatePickerRange {\n return { from: this.from, to: this.to };\n }\n public set value(value: IDatePickerRange) {\n if (!value) {\n return;\n }\n\n if (value.from === undefined) {\n value.from = null;\n }\n\n if (value.to === undefined) {\n value.to = null;\n }\n\n this.from = value.from;\n this.to = value.to;\n\n this._value = { from: this.from, to: this.to };\n }\n\n public get from(): Date | string | null | undefined {\n const date = this._getTypedValue(this._from);\n\n if (!date) {\n return null;\n }\n\n if (isDate(date)) {\n return new Date(date.getTime());\n }\n\n return date;\n }\n public set from(value: Date | string | null | undefined) {\n if (this._from !== value) {\n this._setValue(this._coerceDateValue(value));\n if (this._isInitialized) {\n this._setFormattedInputValue();\n if (this._open) {\n this._adapter.setCalendarValue(new DateRange({ from: this._coerceDateValue(value) || undefined, to: this._coerceDateValue(this._to) || undefined }));\n }\n }\n }\n }\n\n public get to(): Date | string | null | undefined {\n const date = this._getTypedValue(this._to);\n\n if (!date) {\n return null;\n }\n\n if (isDate(date)) {\n return new Date(date.getTime());\n }\n\n return date;\n }\n public set to(value: Date | string | null | undefined) {\n if (this._to !== value) {\n this._setToValue(this._coerceDateValue(value));\n if (this._isInitialized) {\n this._setFormattedToInputValue();\n if (this._open) {\n this._adapter.setCalendarValue(new DateRange({ to: this._coerceDateValue(value) || undefined, from: this._coerceDateValue(this._from) || undefined }));\n }\n }\n }\n }\n}\n", "import { attachShadowTemplate, CustomElement, FoundationProperty } from '@tylertech/forge-core';\nimport { tylIconDateRange } from '@tylertech/tyler-icons/standard';\nimport { CalendarComponent } from '../calendar';\nimport { BaseDatePickerComponent, IBaseDatePickerComponent } from '../date-picker/base/base-date-picker';\nimport { BASE_DATE_PICKER_CONSTANTS } from '../date-picker/base/base-date-picker-constants';\nimport { IconComponent, IconRegistry } from '../icon';\nimport { IconButtonComponent } from '../icon-button';\nimport { PopupComponent } from '../popup';\nimport { DateRangePickerAdapter } from './date-range-picker-adapter';\nimport { DATE_RANGE_PICKER_CONSTANTS, IDatePickerRange, IDateRangePickerChangeEventData } from './date-range-picker-constants';\nimport { DateRangePickerFoundation } from './date-range-picker-foundation';\n\nconst template = '<template><slot></slot></template>';\nconst styles = ':host{display:block}:host([hidden]){display:none}';\n\nexport interface IDateRangePickerComponent extends IBaseDatePickerComponent<IDatePickerRange> {\n from: Date | string | null | undefined;\n to: Date | string | null | undefined;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'forge-date-range-picker': IDateRangePickerComponent;\n }\n\n interface HTMLElementEventMap {\n 'forge-date-range-picker-change': CustomEvent<IDateRangePickerChangeEventData>;\n 'forge-date-range-picker-open': CustomEvent<void>;\n 'forge-date-range-picker-close': CustomEvent<void>;\n 'forge-date-range-picker-input': CustomEvent<string>;\n }\n}\n\n/**\n * The custom element class behind the `<forge-date-range-picker>` element.\n * \n * @tag forge-date-range-picker\n */\n@CustomElement({\n name: DATE_RANGE_PICKER_CONSTANTS.elementName,\n dependencies: [\n PopupComponent,\n CalendarComponent,\n IconButtonComponent,\n IconComponent\n ]\n})\nexport class DateRangePickerComponent extends BaseDatePickerComponent<IDatePickerRange, IDatePickerRange, DateRangePickerFoundation> implements IDateRangePickerComponent {\n public static get observedAttributes(): string[] {\n return [\n ...Object.values(BASE_DATE_PICKER_CONSTANTS.observedAttributes),\n DATE_RANGE_PICKER_CONSTANTS.observedAttributes.FROM,\n DATE_RANGE_PICKER_CONSTANTS.observedAttributes.TO\n ];\n }\n\n constructor() {\n super();\n IconRegistry.define(tylIconDateRange);\n attachShadowTemplate(this, template, styles);\n this._foundation = new DateRangePickerFoundation(new DateRangePickerAdapter(this));\n }\n\n public attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n switch (name) {\n case DATE_RANGE_PICKER_CONSTANTS.observedAttributes.FROM:\n this.from = newValue;\n return;\n case DATE_RANGE_PICKER_CONSTANTS.observedAttributes.TO:\n this.to = newValue;\n return;\n }\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n /** Gets/sets the \"from\" date range value. */\n @FoundationProperty()\n public from: Date | string | null | undefined;\n\n /** Gets/sets the \"to\" date range value. */\n @FoundationProperty()\n public to: Date | string | null | undefined;\n}\n", "import { FormFieldComponentDelegate, IFormFieldComponentDelegateOptions, IBaseComponentDelegateConfig } from '../core/delegates';\nimport { FieldDensityType } from '../field/field-constants';\nimport { ITextFieldComponent, TEXT_FIELD_CONSTANTS } from '../text-field';\nimport { IDateRangePickerComponent } from './date-range-picker';\nimport { DATE_RANGE_PICKER_CONSTANTS, IDateRangePickerChangeEventData } from './date-range-picker-constants';\n\nexport type DateRangePickerComponentDelegateProps = Partial<IDateRangePickerComponent>;\nexport interface IDateRangePickerComponentDelegateOptions extends IFormFieldComponentDelegateOptions {\n useDropdownIcon?: boolean;\n fromPlaceholder?: string;\n toPlaceholder?: string;\n label?: string;\n required?: boolean;\n density?: FieldDensityType;\n}\nexport interface IDateRangePickerComponentDelegateConfig extends IBaseComponentDelegateConfig<IDateRangePickerComponent, IDateRangePickerComponentDelegateOptions> {}\n\nexport class DateRangeComponentDelegate extends FormFieldComponentDelegate<IDateRangePickerComponent, IDateRangePickerComponentDelegateOptions> {\n private _textField: ITextFieldComponent;\n private _fromInput: HTMLInputElement;\n private _toInput: HTMLInputElement;\n\n constructor(config?: IDateRangePickerComponentDelegateConfig) {\n super(config);\n }\n\n protected _build(): IDateRangePickerComponent {\n const dateRangePicker = document.createElement(DATE_RANGE_PICKER_CONSTANTS.elementName) as IDateRangePickerComponent;\n this._attachTextField(dateRangePicker);\n return dateRangePicker;\n }\n\n public get fromInput(): HTMLInputElement {\n return this._textField.querySelector(`input[${TEXT_FIELD_CONSTANTS.attributes.MULTI_INPUT}-0]`) as HTMLInputElement;\n }\n\n public get toInput(): HTMLInputElement {\n return this._textField.querySelector(`input[${TEXT_FIELD_CONSTANTS.attributes.MULTI_INPUT}-1]`) as HTMLInputElement;\n }\n\n public get textField(): ITextFieldComponent {\n return this._textField;\n }\n\n public get value(): any {\n return this._element.value;\n }\n public set value(value: any) {\n this._element.value = value;\n }\n\n public get disabled(): boolean {\n return this._element.disabled;\n }\n public set disabled(value: boolean) {\n this._element.disabled = value;\n }\n\n public get invalid(): boolean {\n return this._textField.invalid || false;\n }\n public set invalid(value: boolean) {\n this._textField.invalid = value;\n }\n\n public onChange(listener: (value: IDateRangePickerChangeEventData) => void): void {\n this._element.addEventListener(DATE_RANGE_PICKER_CONSTANTS.events.CHANGE, (evt: CustomEvent<IDateRangePickerChangeEventData>) => listener(evt.detail));\n }\n\n public onFocus(listener: (evt: FocusEvent) => void): void {\n this._element.addEventListener('focusin', (evt: FocusEvent) => {\n const isFocusWithin = !this._element.contains(evt.relatedTarget as Node);\n if (isFocusWithin) {\n listener(evt);\n }\n });\n }\n\n public onBlur(listener: (evt: FocusEvent) => void): void {\n this._element.addEventListener('focusout', (evt: FocusEvent) => {\n const isFocusOutside = !this._element.contains(evt.relatedTarget as Node);\n if (isFocusOutside) {\n listener(evt);\n }\n });\n }\n\n private _attachTextField(dateRangePicker: IDateRangePickerComponent): void {\n this._textField = document.createElement(TEXT_FIELD_CONSTANTS.elementName);\n\n if (this._config.options?.required) {\n this._textField.required = true;\n }\n if (this._config.options?.density) {\n this._textField.density = this._config.options.density;\n }\n\n this._fromInput = document.createElement('input');\n this._fromInput.type = 'text';\n this._fromInput.placeholder = this._config.options?.fromPlaceholder || 'From';\n this._textField.appendChild(this._fromInput);\n\n this._toInput = document.createElement('input');\n this._toInput.type = 'text';\n this._toInput.placeholder = this._config.options?.toPlaceholder || 'To';\n this._textField.appendChild(this._toInput);\n\n const label = document.createElement('label');\n label.textContent = this._config.options?.label || 'Choose date range';\n this._textField.appendChild(label);\n\n dateRangePicker.appendChild(this._textField);\n }\n}\n", "import { defineCustomElement } from '@tylertech/forge-core';\nimport { DateRangePickerComponent } from './date-range-picker';\n\nexport * from './date-range-picker';\nexport * from './date-range-picker-adapter';\nexport * from './date-range-picker-constants';\nexport * from './date-range-picker-foundation';\nexport * from './date-range-picker-component-delegate';\n\nexport function defineDateRangePickerComponent(): void {\n defineCustomElement(DateRangePickerComponent);\n}\n"],
5
+ "mappings": "q1BAEA,GAAM,GAA2C,GAAG,qBAEvC,EAAN,KAAkD,CAGvD,YAAY,EAA0B,CACpC,AAAI,GACF,MAAK,KAAO,EAAM,KAClB,KAAK,GAAK,EAAM,GAEpB,CAEA,AAAO,MAAwB,CAC7B,MAAO,IAAI,GAAgB,IAAI,CACjC,CACF,EAOM,EAAqB,CACzB,KAAM,OACN,GAAI,KACJ,UAAW,WACb,EAEM,EAAY,CAChB,MAAO,OACT,EAEM,EAAS,CACb,OAAQ,GAAG,WACX,KAAM,GAAG,SACT,MAAO,GAAG,UACV,MAAO,GAAG,SACZ,EAEa,EAA8B,CACzC,cACA,YACA,SACA,oBACF,ECvBO,GAAM,GAAN,aAAqC,EAAoF,CAQ9H,YAAY,EAAqC,CAC/C,MAAM,CAAS,EACf,KAAK,oBAAsB,2BAA2B,KAAK,aAC7D,CAEA,AAAU,kBAAyB,CAIjC,GAHA,KAAK,kBAAoB,KAAK,WAAW,iBAAiB,EAA4B,UAAU,KAAK,EAAE,GACvG,KAAK,gBAAkB,KAAK,WAAW,iBAAiB,EAA4B,UAAU,KAAK,EAAE,GAEjG,CAAC,KAAK,mBAAqB,CAAC,KAAK,kBACnC,KAAM,IAAI,OAAM,OAAO,EAA4B,iCAAiC,CAExF,CAEA,AAAU,6BAAoC,CAC5C,GAAM,GAAgB,KAAK,yBAAyB,EACpD,KAAK,kBAAoB,GAAI,GAAiB,EAAe,KAAK,mBAAmB,CACvF,CAEA,AAAO,eAAe,EAA0C,CAC9D,AAAI,KAAK,gBACP,KAAK,eAAe,QAAQ,EAE9B,KAAK,eAAiB,GAAI,GAAc,KAAK,kBAAmB,CAAW,CAC7E,CAEA,AAAO,iBAAiB,EAAwC,CAC9D,AAAI,KAAK,cACP,KAAK,aAAa,QAAQ,EAE5B,KAAK,aAAe,GAAI,GAAc,KAAK,gBAAiB,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