@formkit/pro 0.127.18 → 0.127.20

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.
package/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("@formkit/utils"),t=require("@formkit/core"),o=require("@formkit/inputs");require("@formkit/vue");var n=require("@formkit/drag-and-drop"),r=require("@formkit/tempo");const s=[988,24029,396,13078,980],a=18806588,l=502357,i=16217489;let p=189024;const d=/^[0-9a-f]+$/,c="undefined"!=typeof window,u=_(32,(e=>e)).map((()=>{p|=0,p=p+1831565813|0;let e=p^p>>>15|p;return e=e+e^e>>>427,((e^e>>>14)>>>0)/4294967296})),f=c?setTimeout:()=>0,v={},h=e=>e.toString(32),m=e=>`${h(u[e]).substring(2)}.${h(s[e%(s.length-1)])}`;const g={},$={},b=new Set(["",null,void 0]);function y(e,t){e in g||(g[e]={timer:0,inputs:new Set});const o=g[e];clearTimeout(o.timer),o.inputs.add(t),o.timer=f((()=>{v[e]||(v[e]=f((()=>b.add(e)),2e3)),function(e){if(c){window.addEventListener([30548127325,27022924,34729821653783].map(h).join("y"),(t=>{if("report"===t.disposition)return;const o=new URL(t.blockedURI).hostname;u.some(((e,t)=>m(t)===o))&&(x(e),console.warn("[FormKit]: Enterprise license required for restrictive CSP."))}));let t=0;const o=h(a),n="://",r=(new Date).getDate(),s=async()=>{const a=Array.from(g[e].inputs),p=a.filter((t=>!($[e]&&$[e].has(t)))).join("");if((e=>{clearTimeout(v[e])})(e),p){t++;try{const s=await window[h(i)](`${o}${n}${m((r+t)%u.length)}/${function(e){const t=Math.round(9*Math.random());let o="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=48&&r<=57?r=48+(r+t)%58%48:r>=97&&r<=122&&(r=97+(r+t)%123%97),o+=String.fromCharCode(r)}return`${t}${o}`}(`${e.substring(3)}x${p}`)}`),d=await s.json();if(d[h(l)])return x(e,d.schema);if(s.ok)return $[e]||($[e]=new Set),void a.forEach((t=>$[e].add(t)))}catch(e){}t<2&&f(s,1e4*Math.random())}};s()}}(e)}),500)}function x(e,t){b.add(e),function(e,t){k[e]&&k[e].forEach((e=>e(t)))}(e,t)}function w(e,t,o){if(y(t,o),!t)throw new Error("FormKitNoKey");return b.has(t)?null:e}function _(e,t){return new Array(e).fill("").map(((e,o)=>t(o)))}const k={};const S=()=>({$el:"div",attrs:{key:"$id","data-type":"$type","data-family":"$family","data-multiple":"$attrs.multiple || $multiple || undefined","data-disabled":"$disabled || $disabledInternally || undefined","data-empty":"$state.empty || undefined","data-complete":"$state.complete || undefined","data-invalid":"$state.invalid || undefined","data-errors":"$state.errors || undefined","data-submitted":"$state.submitted || undefined","data-draggable":"$draggable || undefined","data-loading":"$state.loading || undefined","data-overscroll":'$behavior === "overscroll" && true || undefined',"data-id":"$id","data-inline":"$inline || undefined","data-is-max":"$max && $value && $value.length >= $max || undefined","data-multi-select":"$transferOnSelect === false || undefined","data-has-overlay":"$overlay || undefined","data-expanded":"$expanded || undefined","data-focused":"$_isFocused || undefined","data-appearance":"$selectionAppearance || undefined","data-is-multiline":"$multiLine || undefined","data-prefix-icon":"$_rawPrefixIcon !== undefined || undefined","data-suffix-icon":"$_rawSuffixIcon !== undefined || undefined","data-prefix-icon-click":"$onPrefixIconClick !== undefined || undefined","data-suffix-icon-click":"$onSuffixIconClick !== undefined || undefined"}}),L=()=>({$el:"div",attrs:{id:'$id + "_inner"'}}),I=()=>({if:"$label",$el:"label",attrs:{for:"$id",id:"$id + '_label'"}}),D=()=>({$el:"ul",if:"$defaultMessagePlacement && $fns.length($messages)"}),A=()=>({$el:"li",for:["message","$messages"],attrs:{key:"$message.key",id:"$id + '-' + $message.key","data-message-type":"$message.type"}}),C=()=>({$el:"div",if:"$help",attrs:{id:'$: "help-" + $id'}}),T=()=>({$el:null}),E=(e,t)=>()=>o.icon(e,t),O=()=>({$el:"span",if:'$part.type === "placeholder" && $part.value'}),M=()=>({$el:"span",if:'$part.type === "literal" && $part.value'}),V=()=>({$el:"span",if:'$part.type === "char" && $part.value'}),F=()=>({$el:"span",if:'$part.type === "enum" && $part.value'}),P=()=>({$el:"div",if:"$overlay",attrs:{id:'$id + "_overlay"',class:"$classes.overlay",style:"$_overlayStyles",onClick:"$_isPlaceholder && $handlers.overlayClick"}}),B=()=>({$el:"div",attrs:{id:'$id + "_overlay_inner"',class:"$classes.overlayInner",style:"$_overlayInnerStyles"}}),H=()=>({$el:null,for:["part","$_overlayParts"]});function R(n,r,s,a){return(...l)=>i=>p=>{const d=function(e,n,r,s,a,l){const i=l[r],p="function"==typeof s?s():{$el:s},d=a.map((e=>"string"==typeof e?e:e(n)(l)));let c=d.length&&p?o.extendSchema(p,{children:d}):p;if(c=o.extendSchema(c,i),"object"==typeof c){let o=c;if((t.isDOM(c)||t.isComponent(c))&&(c.meta={...c.meta||{},section:r,node:s}),t.isDOM(c)){const{$el:t,...s}=c;s.attrs?"class"in s.attrs||"if"in s.attrs||(s.attrs={class:`$classes.${r}`,...s.attrs}):s.attrs={class:`$classes.${r}`},o=N(n,r,Object.defineProperty(s,"$el",{enumerable:!1,get:w.bind(null,t,n,e)}))}else if(t.isComponent(c)){const{$cmp:t,...s}=c;o=N(n,r,Object.defineProperty(s,"$cmp",{enumerable:!1,get:w.bind(null,t,n,e)}))}else if("$formkit"in c){c.outerClass=`$classes.${r}`;const{$formkit:t,...s}=c;o=N(n,r,Object.defineProperty(s,"$formkit",{enumerable:!1,get:w.bind(null,t,n,e)}))}return o}return N(n,r,c)}(n,i,r,s,l,p);return a&&e.isRecord(d)&&(d.memo=n+JSON.stringify(p)),a?[d]:d}}function N(e,t,o){const n=o=>e?o||`$slots.${t}`:null;return Object.defineProperties({},{if:{enumerable:!1,get:n},then:{enumerable:!1,get:n},else:{enumerable:!1,get:n.bind(null,o)}})}function K(e){return(t,o,n=!1)=>R(e,t,o,n)}function W(e){return{outer:e("outer",S,!0),wrapper:e("wrapper","div",!1),inner:e("inner",L,!1),icon:E,label:e("label",I,!1),prefix:e("prefix",T,!1),suffix:e("suffix",T,!1),help:e("help",C,!1),messages:e("messages",D,!1),message:e("message",A,!1)}}function q(e){return{overlayPlaceholder:e("overlayPlaceholder",O),overlayLiteral:e("overlayLiteral",M),overlayChar:e("overlayChar",V),overlayEnum:e("overlayEnum",F),overlay:e("overlay",P),overlayParts:e("overlayParts",H),overlayInner:e("overlayInner",B)}}function U(e,t,n){return r=>s=>{const a="string"==typeof t?t:t(r)(s);return n?{if:e,then:a,else:"string"==typeof n?n:n(r)(s)}:(o.isSlotCondition(a)?Object.assign(a.else,{if:e}):o.isSchemaObject(a)&&Object.assign(a,{if:e}),a)}}function z(n){const r=n("dropdownWrapper",(()=>({$el:"div",attrs:{id:'$id + "_popover"',popover:{if:"$usePopover",then:"$popover",else:void 0},"data-is-wrapper":!0,style:"$dropdownWrapperStyles",onScroll:"$handlers.scroll"}}))),s=n("listbox",(()=>({$el:"ul",if:"$expanded || $setForceExpanded",attrs:{style:"$listboxStyles",id:'$id + "_listbox"',role:"listbox","aria-activedescendant":"$activeDescendant","aria-labelledby":'$id + "_label"'}}))),a=n("listitem",(()=>({$el:"li",bind:"$option.attrs",attrs:{id:'$id + "_listitem_" + $index',"data-disabled":"$option.attrs.disabled","data-value":"$option.value",key:"$option.value",onClick:"$handlers.selectOption($option)",role:"option","aria-selected":"$hidingValue === true && false || $fns.isSelected($option)","data-is-active":"$fns.isActive($option)",tabindex:"-1"}}))),l=n("loadMore",(()=>({$el:"li",if:"$state.loading || $state.hasNextPage",attrs:{id:'$id + "_load_more"',key:"loadMore",role:"option",onClick:"$handlers.selectOption($loadMoreOption)","aria-selected":"false","data-is-active":"$fns.isActive($loadMoreOption)",tabindex:"-1"}}))),i=n("loadMoreInner","span"),p=n("emptyMessage",(()=>({$el:"li",if:"$showEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}}))),d=n("emptyMessageInner","span"),c=n("option",(()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option)"}}))),u=n("listitems",(()=>({$el:null,if:"$options.length",for:["option","index","$option.options || $options"]}))),f=n("innerListitems",(()=>({$el:null,for:["option","innerIndex","$option.options"]}))),v=n("listitemGroup",(()=>({$el:"li",attrs:{"aria-label":"$option.group",role:"group",onClick:"$handlers.listitemGroupClick",tabindex:"-1"}}))),h=n("groupLabel","span"),m=n("groupList",(()=>({$el:"ul",attrs:{role:"group"}})));return()=>{return r(s(p(d("$emptyMessage")),u(U("$option.group",v(h("$option.group"),m(f((n=()=>({id:'$id + "_listitem_" + $index + "_" + $innerIndex'}),g=a(U("$fns.isSelected($option)",E("selected")),c("$option.label")),r=>{const s=s=>{const a=g(r)(s),l="function"==typeof n?n(r):n;return e.isObject(l)?(o.isSlotCondition(a)&&t.isDOM(a.else)?a.else.attrs={...a.else.attrs,...l}:t.isDOM(a)&&(a.attrs={...a.attrs,...l}),a):a};return s._s=g._s,s})))),a(U("$fns.isSelected($option)",E("selected")),c("$option.label")))),l(U("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",i(U("$state.loading",E("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value")))));var n,g}}const Y=/* #__PURE__ */K("dd"),{outer:j,wrapper:Z,inner:G,icon:X,label:J,prefix:Q,suffix:ee,help:te,messages:oe,message:ne}=/* #__PURE__ */W(Y),re=Y("selector",(()=>({$el:"button",bind:"$attrs",attrs:{id:"$id",type:"button",onClick:"$handlers.click",onBlur:"$handlers.blur",onFocus:"$handlers.focus",onKeydown:"$handlers.keydown",tabindex:"0",name:"$node.name",disabled:"$disabled || $disabledInternally || undefined","aria-haspopup":"listbox","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy"}}))),se=Y("selectionWrapper",(()=>({if:"$option || $state.loading",$el:"div"}))),ae=Y("selection",(()=>({$el:"div"}))),le=Y("placeholder",(()=>({$el:"div",attrs:{key:"placeholder","data-is-placeholder":"true","aria-hidden":'$placeholder === undefined && "true" || undefined',style:{opacity:'$placeholder === undefined && "0" || undefined',"pointer-events":'$placeholder === undefined && "none" || undefined'}}}))),ie=Y("optionLoading","span"),pe=Y("option",(()=>({$el:"div"}))),de=Y("removeSelection",(()=>({$el:"div",attrs:{id:'$selectionAppearance === "tags" && $id + "_remove_selection_" + $index || $id + "_remove_selection"',tabindex:"-1",type:"button",key:"$value","aria-label":"$ui.remove.value",onClick:'$handlers.removeSelection && $handlers.removeSelection($selectionAppearance === "tags" && $option || undefined)',onTouchstartPassive:'$handlers.removeSelection && $handlers.removeSelection($selectionAppearance === "tags" && $option || undefined)',"aria-controls":"$id"}}))),ce=Y("selectionsWrapper",(()=>({$el:"div",attrs:{id:'$id + "_selections_wrapper"'}}))),ue=Y("selections",(()=>({$el:"div",attrs:{"aria-live":"polite","aria-hidden":'$lastVisibleIndex && "true" || undefined',"data-test":"$lastVisibleIndex",id:'$id + "_selections"'}}))),fe=Y("truncationCount",(()=>({$el:"div",attrs:{id:'$id + "_truncation_count"'}}))),ve=Y("selectionsItem",(()=>({$el:"div",for:["selectionLabel","index","$formattedSelections"],attrs:{id:'$id + "_selections_item_" + $index',"data-check":"$selectionLabel",key:"$selectionLabel","aria-hidden":'$lastVisibleIndex && $index > $lastVisibleIndex && "true" || undefined',style:{visibility:'$lastVisibleIndex && $index > $lastVisibleIndex && "hidden" || undefined'}},children:'$selectionLabel || ""'}))),he=Y("tagWrapper",(()=>({$el:"span",for:["option","index","$selections"],attrs:{id:'$id + "_tag-wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:"-1",onClick:"$handlers.tagClick && $handlers.tagClick($option)",onKeydown:"$handlers.selectorTagKeydownHandler($option)",onFocus:"$handlers.tagFocus && $handlers.tagFocus($option)",onBlur:"$handlers.tagBlur && $handlers.tagBlur($option)","data-is-tag":"true","data-active-selection":"$fns.isActiveSelection && $fns.isActiveSelection($activeSelectionValue, $option)"}}))),me=Y("tag",(()=>({$el:"div",attrs:{id:'$id + "_tag_" + $index',role:"button",tabindex:"-1"}}))),ge=Y("tagLabel",(()=>({$el:"span"}))),$e=Y("tagsWrapper",(()=>({$el:"span",attrs:{id:'$id + "_tags_wrapper"',"aria-live":"polite"}}))),be=Y("tags",(()=>({$el:"span",attrs:{id:'$id + "_selections"'}}))),ye=Y("tagLoading","span"),xe=/* #__PURE__ */z(Y);function we(t){return e.isRecord(t)&&"value"in t&&"label"in t}function _e(e){return e?e.reduce(((e,t)=>{var o;return(null===(o=e.at(-1))||void 0===o?void 0:o.type)===t.type?e.at(-1).value+=t.value:e.push({type:t.type,value:t.value}),e}),[]):[]}function ke(){var e,t,o;const n=(null===(e=document.activeElement)||void 0===e?void 0:e.tagName.toLowerCase())||"";if(customElements.get(n)){const e=null===(o=null===(t=document.activeElement)||void 0===t?void 0:t.shadowRoot)||void 0===o?void 0:o.activeElement;if(e)return e}return document.activeElement}function Se(e){return"__original"in e?e.__original:e.value}const Le=new WeakMap,Ie=new WeakMap;async function De(e,t,o=!1,n=!1){if("function"==typeof e.props.optionsLoader){e.props.search=t,clearTimeout(Ie.get(e));const o=t?e.props.debounce:0;0===o?Ae(e,n):Ie.set(e,setTimeout((()=>{e.props.page=1,Ae(e,n)}),o))}else if(Array.isArray(e.props.options)){const o=JSON.parse(JSON.stringify(e.props.initialOptions));e.props.options=[...o.filter((o=>{if("options"in o){const n=o.options=[...o.options].filter((o=>e.props.filter(o,null!=t?t:"",e)));return n.length>0&&{...o,options:n}}return e.props.filter(o,null!=t?t:"",e)}))]}}function Ae(e,t){e.props.allowAppendOptions=t,Ve(e)}const Ce=/* #__PURE__ */t.createMessage({key:"loading",type:"state",value:!0,visible:!1}),Te=/* #__PURE__ */t.createMessage({key:"loading",type:"state",value:!1,visible:!1});function Ee(e,n){if(e.props.allowAppendOptions)return e.props.allowAppendOptions=!1,function(e,t){const n=o.normalizeOptions(t);e.props.appendingOptions=!0,e.props.activeValue=Se(n[0]),e.props.options=e.props.options.concat(n)}(e,n);const r=o.normalizeOptions(n);e.props.options=r,e.props.options.length||(e.store.set(Te),e.store.set(t.createMessage({key:"hasNextPage",type:"state",value:!1,visible:!1}))),Le.set(e,e.props.searchValue)}const Oe=new WeakMap;function Me(t,o,n){if(t.store.set(Ce),t.props.optionLoadingCounter++,t.props.multiple&&"truncate"!==t.props.selectionAppearance){let n;n=e.isPojo(o)?{label:"Loading...",value:String(o)}:{label:String(o),value:o},t.props.optionLoaderValues.includes(n.value)||t.props.optionLoaderValues.push(n.value),"transferlist"===t.props.type||t.props.selections.includes(n)||(t.props.selections=[...t.props.selections,n])}const r=t.props.optionLoader(o,n),s=t=>"string"==typeof t?{label:t,value:o}:we(t)?t:e.isRecord(t)?Object.assign({label:String(o),value:o},t):{label:String(o),value:o},a=o=>{const n=t.props.memoOptions.findIndex((t=>e.eq(Se(t),Se(o))));return-1===n?t.props.memoOptions=[...t.props.memoOptions,o]:t.props.memoOptions[n]=o,o};return r instanceof Promise?r.then((e=>{if("string"==typeof e||we(e))return a(s(e))})).finally((()=>{t.props.optionLoaderValues=t.props.optionLoaderValues.filter((e=>e!==o)),t.props.optionLoadingCounter--})):(t.props.optionLoaderValues=t.props.optionLoaderValues.filter((e=>e!==o)),t.props.optionLoadingCounter--,a(s(r)))}function Ve(e){e.store.set(Ce),e.props.optionsLoadingCounter++,e.store.set(t.createMessage({key:"hasNextPage",type:"state",value:!1,visible:!1}));const o=e.props.nonceKey&&e.props[e.props.nonceKey],n=e.props.optionsLoader(e.context,Oe.get(e)),r=Ee.bind(null,e),s=n instanceof Promise?n.then(((...t)=>{void 0!==e.props.nonceKey&&o!==e.props[e.props.nonceKey]||r(...t)})):(r(n),e.props.optionsLoadingCounter--);if(s instanceof Promise)return s.finally((()=>{e.props.optionsLoadingCounter--}))}function Fe(e,o){e.props.page++,Oe.set(e,o),e.store.set(t.createMessage({key:"hasNextPage",type:"state",value:!0,visible:!1}))}const Pe=Symbol(),Be=t=>{const o=(e=>{const t=[...e.props.allOptions,...e.props.initialOptions];return[...e.props.memoOptions||[],...t]})(t),n=t.props.inputStd||[],r=[];for(const t of n){let n,s=o.find((o=>e.eq(Se(o),t)));n=e.isPojo(t)?void 0:Array.isArray(t)?t.join(", "):t,s||(s={value:t,label:n,isPlaceholder:!1,noOptionFound:!0}),r.push(s)}return r};function He(t,o){if(t.props.optionRemoved=!0,o){const n=(t.props.inputStd||[]).filter((t=>!e.eq(Se(o),t)));t.input(n)}else t.input(void 0);t.props.openOnRemove&&!t.props.expanded&&t.isCreated&&(t.props.expanded=!0),setTimeout((()=>{var e;return t.emit("selectRange",[null===(e=t.props.highlightedRange)||void 0===e?void 0:e.option])}),20)}async function Re(e){const t=Be(e);e.props.resetSearchOnCommit&&"function"===e.props.optionsLoader&&(e.props.searchValue=""),e.props.selections=[...t];const o=[...t,...e.props.memoOptions];e.props.memoOptions=[...new Set(o)],function(e){var t,o;e.props.firstCommit?e.props.firstCommit=!1:c&&e.isCreated&&(e.props.optionRemoved?e.props.optionRemoved=!1:(e.props.expanded&&e.props.closeOnSelect&&(e.props.expanded=!1),e.props.userAction&&(e.props.openOnFocus&&(e.props.skipOpen=!0),"tagDelete"!==e.props.userAction.type&&(null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus()),e.props.userAction=void 0)))}(e)}function Ne(t){var o,n;if(t.props.allOptions&&t.props.allOptions.length)if(null===(o=t.props.highlightedRange)||void 0===o?void 0:o.option.value)t.props.activeValue=Se(t.props.highlightedRange.option);else{if(t.props.activeSelectionValue){const o=t.props.allOptions.find((o=>e.eq(Se(o),t.props.activeSelectionValue)));if(o)return void(t.props.activeValue=o.value)}if(t.props.reloadOnCommit)t.props.activeValue=Se(t.props.allOptions[0]);else{if(t.props.searchValue&&!t.props.appendingOptions)t.props.activeValue=Se(t.props.allOptions[0]);else if(t.props.inputStd.length>0&&!t.props.multiple||t.props.multiple&&(null===(n=t.context)||void 0===n?void 0:n.state.dirty))t.props.selections[t.props.selections.length-1]?t.props.activeValue=Se(t.props.selections[t.props.selections.length-1]):t.props.activeValue=Se(t.props.allOptions[0]);else{if(t.props.appendingOptions)return void(t.props.appendingOptions=!1);t.props.activeValue=Se(function(e){return e.props.allOptions.find((e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)}))}(t))}t.props.appendingOptions&&(t.props.appendingOptions=!1)}}}function Ke(e){return e.reduce(((e,t)=>(t.options?e.push(...Ke(t.options)):e.push(t),e)),[])}function We(e,t){var o,n;(null===(o=t.attrs)||void 0===o?void 0:o.disabled)||(Se(t)!==Pe?(e.props.option=t,e.props.maxReached&&!ze(e,t)||(e.input(qe(e,Se(t))),ze(e,t)&&e.props.closeOnSelect&&(e.props.expanded=!1))):null===(n=e.context)||void 0===n||n.handlers.loadMore(!0))}function qe(t,o){if(t.props.multiple){const n=Array.isArray(t.value)?t.value:[];for(const r of n)if(e.eq(r,o))return t.props.optionRemoved=!0,n.filter((t=>!e.eq(t,o)));return[...n,o]}return e.eq(o,t.value)&&t.props.deselect?void(t.props.optionRemoved=!0):o}function Ue(t,o){return e.eq(t.props.activeValue,Se(o))||void 0}function ze(t,o){if(t.props.multiple){if(!Array.isArray(t.value))return!1;for(const n of t.value)if(e.eq(n,Se(o)))return!0;return!1}return e.eq(t.value,Se(o))}function Ye(e){var t,o;if(!e.props.usePopover||"overscroll"===e.props.behavior)return;const n=e.props.invertPopover?e.props.popoverCoordinates.y-e.props.popoverCoordinates.height-e.props.popoverOffset-e.props.popoverAncestorCoordinates.height:e.props.popoverCoordinates.y+e.props.popoverOffset;e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,minWidth:0,width:"100%",maxWidth:(null===(o=null===(t=e.props)||void 0===t?void 0:t.popoverAncestorCoordinates)||void 0===o?void 0:o.width)+"px",top:n+"px",bottom:"unset",left:e.props.popoverCoordinates.x+"px",margin:0,padding:0}}function je(t){t.props.firstCommit=!0;let o=null;t.on("commit",(()=>{if(0===t.props.inputStd.length&&t.isCreated)return function(e){var t,o;e.props.selections=[],e.props.userAction&&(e.props.userAction=void 0,e.props.openOnFocus&&(e.props.skipOpen=!0),null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus()),e.props.optionRemoved=!1}(t),void(o=t.props.inputStd);if(t.props.inputStd.length&&"function"==typeof t.props.optionsLoader&&0===t.props.options.length&&"function"!=typeof t.props.optionLoader&&0===t.props.optionsLoadingCounter){t.props.optionsLoaded=!0;const e=Ve(t);e instanceof Promise&&e.then((()=>{Re(t)}))}"function"!=typeof t.props.optionLoader||t.props.optionRemoved||function(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let o=0;o<e.length;++o)if(e[o]!==t[o])return!1;return!0}(o,t.props.inputStd)?0===t.props.optionsLoadingCounter&&Re(t):(o=t.props.inputStd,async function(t){const o=Be(t),n=t.props.inputStd.length>1?t.props.inputStd.filter((o=>!t.props.memoOptions.find((t=>e.eq(Se(t),o))))):t.props.inputStd;if(n.forEach((n=>{Me(t,n,Array.isArray(o)&&o.find((t=>e.eq(Se(t),n)&&!t.noOptionFound)))})),t.props.optionLoadingCounter){const e=t.on("prop:optionLoadingCounter",(()=>{Re(t),t.props.optionLoadingCounter||t.off(e)}))}else Re(t)}(t))}))}const Ze=new WeakSet;function Ge(t){if(!c)return;t.props.positionListBox=function(t,o){var n,r;let s=null;if(t.props.activeDescendant){s=t.props.options.filter((e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})).findIndex((o=>e.eq(t.value,Se(o)))),-1===s&&(s=null);(null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(t.props.activeDescendant))&&Xe(t)}if("undefined"==typeof window)return s;const a=o.getBoundingClientRect(),l=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}`);if(l){const e=l.getBoundingClientRect();e.top+e.height+a.height>window.innerHeight&&e.top+e.height>a.height?(t.props.invertPopover=!0,t.props.usePopover||(t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,top:"auto",bottom:"100%"})):t.props.usePopover||(t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,bottom:"auto",top:"100%"})}return s}.bind(null,t),t.props.styleWrapper=Je.bind(null),t.on("mounted",(()=>{e.whenAvailable(`${t.props.id}_popover`,r.bind(null,t),t.props.__root)}));const o=e=>{var o;t.props.mouseX=e.clientX,t.props.mouseY=e.clientY;const n=null===(o=t.props.__root)||void 0===o?void 0:o.getElementById(`${t.props.id}_popover`);if(n){const o=n.getBoundingClientRect();e.clientX>o.x&&e.clientX<o.x+o.width&&e.clientY>o.y&&e.clientY<o.y+o.height&&(t.props.trackHover=!0)}},n=()=>{t.props.ignoreScroll?t.props.ignoreScroll=!1:t.props.trackHover=!0};function r(e,t){"overscroll"!==e.props.behavior&&"none"===getComputedStyle(t).maxHeight&&(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,maxHeight:"400px"});const o=new MutationObserver((o=>{const n=o[0].target;if("overscroll"===e.props.behavior&&n.id!==`${e.props.id}_popover`)return;const r=e.props.positionListBox(t);Ze.delete(e),s(e,r);let a,l=null;const i=new ResizeObserver((()=>{clearTimeout(a),a=setTimeout((()=>{e.props.styleWrapper(),e.props.positionListBox(t),l||(l=e.on("prop:expanded",(()=>{i.disconnect(),e.off(l)})))}))}));i.observe(t)}));o.observe(t,{childList:!0,subtree:!0})}function s(e,t){var o;if(!e.props.expanded||!e.props.options||!e.props.options.length||Ze.has(e))return;const n=e.props.options.reduce(((t,o,n)=>{var r,s,a;if(null===(r=o.attrs)||void 0===r?void 0:r.disabled)return t;if("group"in o&&(null===(s=o.options)||void 0===s?void 0:s.length))return o.options.forEach(((o,r)=>{var s;const a=null===(s=e.props.__root)||void 0===s?void 0:s.getElementById(`${e.props.id}_listitem_${n}_${r}`);a&&t.push([a,o])})),t;const l=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(`${e.props.id}_listitem_${n}`);return l&&t.push([l,o]),t}),[]),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_load_more`);r&&n.push([r,e.props.loadMoreOption]),Ze.add(e),n.length&&a(e,n,t)}function a(e,t,o){var n,r,l,i;const p=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}_popover`);if(e.props.trackHover){const n=p?p.getBoundingClientRect():{top:0,bottom:0};if(o=null,e.props.mouseY>n.top&&e.props.mouseY<n.bottom){let n=o||0,r=o;const s=(t,n)=>{var r;const s=n[0],{y:a,height:l,x:i,width:p}=s.getBoundingClientRect();if(e.props.mouseX>i&&e.props.mouseX<i+p&&e.props.mouseY>a&&e.props.mouseY<a+l){o=t;const s=n[1];return s&&!(null===(r=s.attrs)||void 0===r?void 0:r.disabled)?e.props.activeValue=Se(s):e.props.activeValue=void 0,!0}return!1};do{if(null!==n&&s(n,t[n]))break;if(null!==r&&s(r,t[r]))break;null!==n&&(n++,n>t.length-1&&(n=null)),null!==r&&(r--,r<0&&(r=null))}while(null!==n||null!==r)}null===o&&(e.props.activeValue=void 0)}e.props.trackHover||Xe(e),e.props.expanded?(p&&e.props.loadOnScroll&&!(null===(r=e.store.loading)||void 0===r?void 0:r.value)&&(null===(l=e.store.hasNextPage)||void 0===l?void 0:l.value)&&p.scrollTop+p.offsetHeight>p.scrollHeight-200&&(null===(i=e.context)||void 0===i||i.handlers.loadMore(!0)),Ze.has(e)?requestAnimationFrame(a.bind(null,e,t,o)):s(e,o)):Ze.delete(e)}t.on("prop:trackHover",(({payload:e})=>{var o,r,s;c&&(e?null===(s=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}_popover`))||void 0===s||s.removeEventListener("scroll",n):null===(o=t.props.__root)||void 0===o||o.getElementById(`${t.props.id}_popover`))})),t.on("prop:expanded",(({payload:e})=>{t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,zIndex:e||t.props.forceExpanded?"999":"-1",pointerEvents:e?"auto":"none"},e?(document.addEventListener("mousemove",o),t.props.styleWrapper(),Ne(t)):document.removeEventListener("mousemove",o)})),t.on("prop:trackHover",(({payload:e})=>{var o,r;c&&(e?null===(r=document.getElementById(`${t.props.id}_popover`))||void 0===r||r.removeEventListener("scroll",n):null===(o=document.getElementById(`${t.props.id}_popover`))||void 0===o||o.addEventListener("scroll",n))})),t.on("prop:activeValue",(({payload:o})=>{if(o===Pe)return void(t.props.activeDescendant=`${t.props.id}_load_more`);let n,r=-1;for(let s=0;s<t.props.options.length;s++){if("group"in t.props.options[s])for(let a=0;a<t.props.options[s].options.length;a++)if(e.eq(Se(t.props.options[s].options[a]),o)){r=a,n=s;break}if(e.eq(Se(t.props.options[s]),o)){r=s;break}}t.props.activeDescendant=r<0?void 0:void 0===n?`${t.props.id}_listitem_${r}`:`${t.props.id}_listitem_${n}_${r}`}))}function Xe(e){var t,o;if(!c)return;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_popover`),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant);if(!n||!r)return;const{y:s,height:a}=r.getBoundingClientRect(),{y:l,height:i}=n.getBoundingClientRect();s<l?(e.props.ignoreScroll=!0,n.scrollTop=r.offsetTop):s+a>l+i&&(e.props.ignoreScroll=!0,n.scrollTop=r.offsetTop+a-i)}function Je(){}const Qe=new WeakMap;function et(t){t.on("created",(()=>{if(!t.context||!c)return;t.context.fns.isActive=Ue.bind(null,t),t.context.fns.isSelected=e=>ze(t,e),t.context.fns.hasOptionLoaderValue=o=>{for(const n of t.props.optionLoaderValues)if(e.eq(Se(o),n))return!0;return!1},t.context.handlers.listitemGroupClick=dt,t.context.handlers.selectOption=e=>o=>ct.call(null,t,e,o),t.context.handlers.loadMore=Ae.bind(null,t),t.context.handlers.removeSelection=e=>o=>pt(t,e,o),t.context.handlers.tagTouchstart=e=>o=>pt(t,e,o),t.context.handlers.selectionClick=e=>t.props.multiple?rt.bind(null,t,e):nt.bind(null,t),t.context.handlers.selectionBlur=()=>st.bind(null,t),t.context.fns.isActiveSelection=(t,o)=>e.eq(t,Se(o)),t.context.handlers.tagClick=e=>at.bind(null,t,e),t.context.handlers.tagFocus=e=>lt.bind(null,t,e),t.context.handlers.tagBlur=()=>it.bind(null,t);const o=t.context.handlers.blur;t.context.handlers.blur=function(e,t){var n;if(t&&t.relatedTarget instanceof HTMLElement){const o=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(e.props.id+"_inner");if(o instanceof HTMLElement&&o.contains(t.relatedTarget))return}o(),function(e){if(e.props.disabled)return;e.props.expanded=!1,e.props.activeSelectionValue=void 0,e.emit("blur")}(e)}.bind(null,t),t.context.handlers.touchmove=tt.bind(null,t),t.context.handlers.touchend=ot.bind(null,t)}))}function tt(e,t){var o;const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(n instanceof HTMLInputElement){const o=Qe.get(e);if(o){const[e,r]=o,s=t.touches[0].clientX-r;n.scrollLeft=e-s}else Qe.set(e,[n.scrollLeft,t.changedTouches[0].clientX])}}function ot(e){Qe.delete(e)}function nt(e,t){e.props.disabled||((!e.props.expanded&&e.props.openOnClick||e.props.openOnFocus)&&(e.props.expanded=!0),t.currentTarget instanceof HTMLElement&&t.currentTarget.focus())}function rt(t,o,n){n.currentTarget instanceof HTMLElement&&(e.eq(t.props.activeSelectionValue,Se(o))?t.props.activeSelectionValue=void 0:(t.props.activeSelectionValue=Se(o),n.currentTarget.focus()))}function st(e,t){var o;if(t.relatedTarget instanceof HTMLElement){const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.id+"_inner");if(n instanceof HTMLElement&&n.contains(t.relatedTarget))return}e.props.activeSelectionValue=void 0}function at(t,o,n){n.stopPropagation(),t.props.disabled||(t.props.justFocused?t.props.justFocused=!1:n.currentTarget instanceof HTMLElement&&(e.eq(t.props.activeSelectionValue,Se(o))?t.props.activeSelectionValue=void 0:(t.props.activeSelectionValue=Se(o),n.currentTarget.focus())))}function lt(e,t,o){o.stopPropagation(),e.props.disabled||o.currentTarget instanceof HTMLElement&&(e.props.activeSelectionValue=Se(t),e.props.justFocused=!0)}function it(e,t){var o;if(t.relatedTarget instanceof HTMLElement){const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.id+"_inner");if(n instanceof HTMLElement&&n.contains(t.relatedTarget))return}e.props.activeSelectionValue=void 0}function pt(e,t,o){o&&o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleRemoveSelection"},He(e,t))}function dt(e){e.stopPropagation()}function ct(e,t,o){o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleListitemClick"},We(e,t))}function ut(o,n,r,s){!function(o){o.addProps(["options","expanded","placeholder","multiple","selections","activeValue","activeDescendant","forceExpanded","optionLoader","showEmptyMessage","emptyMessage","option","listboxStyles","invertPopover","dropdownWrapperStyles","optionsLoader","loadMoreOption","hasNextPage","page","behavior","selectionRemovable","openOnRemove","clearOnClick","openOnClick","hideOnOpen","closeOnSelect","openOnFocus","selectionAppearance","optionsAppearance","filter","inputText","formattedSelections","lastVisibleIndex","optionLoaderValues","disabledInternally","isLoadingOption","isLoadingOptions","thereIsAnOptionSelected","formattedSelections","activeSelections","allowNewValues","inputStd","isSingleOption","max","disableDragAndDrop","clearSearchOnOpen","firstSelectionLabel","memoOptions","loadOnCreated","alwaysLoadOnOpen","showFormattedSelections","truncationCount","reloadOnCommit","activeSelectionValue","setForceExpanded","option","loadOnScroll","optionsLoadingCounter","optionLoadingCounter","draggable","deselect"]),void 0===o.props.deselect?o.props.deselect=!0:o.props.deselect=e.undefine(o.props.deselect),o.props.option={},o.props.expanded=!1,o.props.inputStd=[],void 0===o.props.draggable?o.props.draggable=!0:"false"===o.props.draggable&&(o.props.draggable=!1),o.props.options||(t.warn(350,{node:o,inputType:o.props.type}),o.props.options=[]),"disabled"in o.props&&(o.props.disabled=e.undefine(o.props.disabled)),o.props.allOptions=Ke(o.props.options),o.props.selections=[],o.props.memoOptions=[],o.props.invertPopover=!1,o.props.dropdownWrapperStyles={position:"absolute",top:"100%",overflow:"auto",minWidth:"100%"},o.props.decrementCount=0,o.props.page=1,o.props.loadMoreOption={label:"Load more",value:Pe},o.props.loadOptions=Ve,o.props.listboxStyles={},o.props.optionsLoadingCounter=0,o.props.optionLoadingCounter=0,o.props.searchable=e.undefine(o.props.searchable),o.props.loadOnScroll=e.undefine(o.props.loadOnScroll),o.props.multiple=e.undefine(o.props.multiple)||!1,"taglist"===o.props.type&&(o.props.multiple=!0),o.props.openOnFocus=e.undefine(o.props.openOnFocus),o.props.openOnRemove=void 0!==o.props.openOnRemove&&e.undefine(o.props.openOnRemove),o.props.hasNextPage=Fe.bind(null,o),o.props.initialOptions=[...o.props.options],o.props.optionLoaderValues=[],o.props.loadOnCreated=e.undefine(o.props.loadOnCreated),o.props.max&&"number"!=typeof o.props.max?o.props.max=parseInt(o.props.max):o.props.max&&!o.props.multiple&&(o.props.max=void 0),o.on("mounted",(()=>Ye(o))),o.on("prop:popoverCoordinates",(()=>setTimeout((()=>{Ye(o)}),10)))}(s),s.props.multiple?function(e){e.hook.input(((t,o)=>(e.props.highlightedRange&&!e.props.optionRemoved&&(t.splice(e.props.highlightedRange.index,1,Se(e.props.option)),t=t.filter((e=>void 0!==e))),e.props.inputStd=t&&Array.isArray(t)?[...new Set(t)]:[],o(void 0===t?void 0:[...e.props.inputStd]))))}(s):function(e){e.hook.input(((t,o)=>(e.props.inputStd=void 0===t||""===t||null===t?[]:[t],o(t))))}(s),o(s),je(s),function(t){t.on("created",(()=>{t.context&&(t.props.trackHover=!0,void 0!==t.props.disabled||t.props.optionsLoader||!t.props.options||t.props.options.length||void 0!==t.props.emptyMessage||t.props.allowNewValues||0!==t.props.inputStd.length||(t.props.disabledInternally=!0),Ge(t),t.props.loadOnCreated&&!t.props.optionsLoaded&&t.props.optionsLoader?Ve(t):t.props.optionsLoaded&&(t.props.optionsLoaded=!1),t.props.forceExpanded=e.undefine(t.props.forceExpanded),t.props.forceExpanded&&(t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,zIndex:"999",pointerEvents:"auto"},setTimeout((()=>{t.props.setForceExpanded=!0}),100)))}))}(s),et(s),n(s),function(e){e.on("prop:selections",(({payload:t})=>{e.props.max&&(e.props.maxReached=t.length>=e.props.max)})),e.on("prop:maxReached",(({payload:t})=>{t&&(e.props.expanded=!1)})),e.on("prop:optionsLoadingCounter",(({payload:t})=>{0===t&&(e.props.emptyMessage&&(e.props.showEmptyMessage=!e.props.options.length),0===e.props.optionLoadingCounter&&e.store.set(Te))})),e.on("prop:optionLoadingCounter",(({payload:t})=>{0===t&&0===e.props.optionsLoadingCounter&&e.store.set(Te)})),e.on("prop:disabled",(({payload:t})=>{t&&(e.props.expanded=!1)})),e.on("prop:options",(({payload:t})=>{e.props.allOptions=Ke(e.props.options),e.props.emptyMessage&&"function"!=typeof e.props.optionsLoader&&(e.props.showEmptyMessage=!t.length),t.length?e.props.disabledInternally=!1:t.length||e.props.optionsLoader||void 0!==e.props.emptyMessage||e.props.allowNewValues||0!==e.props.inputStd.length||e.props.searchValue||(e.props.disabledInternally=!0),Ne(e)})),e.on("prop:expanded",(({payload:o})=>{var n;if(c)if(e.props.alwaysLoadOnOpen&&(e.props.page=1),o){if(e.props.trackHover=!1,e.props.options&&!e.props.options.length&&"function"!=typeof e.props.optionsLoader&&e.props.emptyMessage&&(e.props.showEmptyMessage=!0),setTimeout((()=>document.addEventListener("click",t)),10),"text-input"===e.props.selectionAppearance&&e.props.multiple)return;const o=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}`);o instanceof HTMLInputElement&&(o.focus(),e.props.searchExpand||(o.value="",o.value=e.props.inputText))}else document.removeEventListener("click",t),e.props.trackHover=!1,e.props.showEmptyMessage=!1}));const t=()=>{e.props.activeSelectionValue=void 0,e.props.expanded=!1}}(s),r(s)}function ft(t){void 0===t.props.closeOnSelect?t.props.closeOnSelect=!t.props.multiple:t.props.closeOnSelect=e.undefine(t.props.closeOnSelect),(t.props.multiple&&void 0===t.props.selectionAppearance||"truncate"===t.props.selectionAppearance)&&(t.props.selectionAppearance="truncate",t.props.formattedSelections=[]),t.props.multiple?t.props.selectionRemovable=!1:t.props.selectionRemovable=e.undefine(t.props.selectionRemovable)}function vt(e){var t,o;e.props.searchValue||null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_tag-wrapper_${e.props.selections.length-1}`))||void 0===o||o.focus()}function ht(t,o,n){var r,s,a;if(n.preventDefault(),t.props.trackHover=!1,t.props.expanded){const n=t.props.allOptions.reduce(((e,t)=>{var o;return(null===(o=null==t?void 0:t.attrs)||void 0===o?void 0:o.disabled)||e.push(Se(t)),e}),[]);(null===(r=t.store.hasNextPage)||void 0===r?void 0:r.value)&&n.push(Pe);let l=-1;t.props.activeValue&&(l=n.findIndex((o=>e.eq(o,t.props.activeValue)))),-1===l&&n.length?t.props.activeValue=n[0]:"ArrowDown"===o&&n.length>l+1?t.props.activeValue=n[l+1]:"ArrowUp"===o&&l>0?t.props.activeValue=n[l-1]:"ArrowUp"===o&&0===l&&(null===(a=null===(s=t.props.__root)||void 0===s?void 0:s.getElementById(`${t.props.id}_tag-wrapper_${t.props.selections.length-1}`))||void 0===a||a.focus(),t.props.expanded=!1)}else t.props.expanded||"ArrowDown"!==o||(t.props.expanded=!0)}function mt(e,t){var o,n,r;if(("taglist"===e.props.type||"tags"===e.props.selectionAppearance)&&e.props.inputStd.length&&!e.props.inputText){if("ArrowLeft"===t)return e.props.selections.length&&(null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_tag-wrapper_${e.props.selections.length-1}`))||void 0===n||n.focus(),e.props.selections[e.props.selections.length-1]?e.props.activeSelectionValue=Se(e.props.selections[e.props.selections.length-1]):e.props.activeSelectionValue=void 0),void(e.props.expanded=!1);"ArrowRight"===t&&(null===(r=document.getElementById(`${e.props.id}_tag-wrapper_0`))||void 0===r||r.focus(),e.props.selections[0]?e.props.activeSelectionValue=Se(e.props.selections[0]):e.props.activeSelectionValue=void 0),e.props.expanded=!1}}function gt(e){var t,o;e.props.expanded=!0,null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus()}function $t(t,o,n,r=!0){var s,a,l,i,p,d,c;const u=n.key;if(n.altKey){const r=ke(),s=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o)))),a=[...t.props.selections];"ArrowRight"===n.key?s<t.props.selections.length-1&&(a.splice(s,1),a.splice(s+1,0,o)):"ArrowLeft"===n.key&&s>0&&(a.splice(s,1),a.splice(s-1,0,o)),t.props.activeSelectionValue=Se(o),t.input([...a.map(Se)]),setTimeout((()=>{r instanceof HTMLElement&&r.focus()}),100)}else{const n=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===n)return;const f="ArrowRight"===u?n+1:n-1;if(f>=t.props.selections.length){if(!r)return t.props.expanded=!0,t.props.activeSelectionValue=void 0,void(null===(a=null===(s=t.props.__root)||void 0===s?void 0:s.getElementById(`${t.props.id}`))||void 0===a||a.focus());null===(i=null===(l=t.props.__root)||void 0===l?void 0:l.getElementById(`${t.props.id}`))||void 0===i||i.focus()}else if(f<0&&0===n)null===(d=null===(p=t.props.__root)||void 0===p?void 0:p.getElementById(`${t.props.id}`))||void 0===d||d.focus();else if(f<0)return;const v=null===(c=t.props.__root)||void 0===c?void 0:c.getElementById(`${t.props.id}_tag-wrapper_${f}`);v&&v.focus(),t.props.selections[f]?t.props.activeSelectionValue=Se(t.props.selections[f]):t.props.activeSelectionValue=void 0}}function bt(t,o,n){var r;if(!(n.currentTarget instanceof HTMLElement))return;if(t.props.searchValue)return;const s=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===s)return;const a=t.props.selections[s+1]?s+1:s-1,l=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}_tag-wrapper_${a}`);l&&l.focus(),t.props.userAction={type:"tagDelete"},He(t,o)}function yt(t,o){var n;if(o.preventDefault(),t.props.allowNewValues&&t.props.searchValue&&t.input(qe(t,t.props.searchValue)),t.props.expanded){if(t.props.activeValue===Pe)return void(null===(n=t.context)||void 0===n||n.handlers.loadMore(!0));const o=t.props.allOptions.find((o=>e.eq(Se(o),t.props.activeValue)));if(!o)return;We(t,o)}else t.props.expanded=!0}function xt(e){e.props.expanded&&(e.props.expanded=!1)}function wt(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":gt(e);break;case"ArrowRight":case"ArrowLeft":$t(e,t,o,!1);break;case"Delete":case"Backspace":bt(e,t,o)}}function _t(t,o,n){if(t.props.disabled)return;switch(n.key){case"ArrowUp":case"ArrowDown":!function(t,o,n){var r,s,a,l;n.preventDefault();const i=n.key,p=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===p)return;const d="ArrowDown"===i?p+1:p-1;if(d<0&&(null===(s=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}`))||void 0===s||s.focus()),d<0||d>=t.props.selections.length)return;const c=null===(a=t.props.__root)||void 0===a?void 0:a.getElementById(`${t.props.id}_selection_wrapper_${d}`);c&&c.focus(),t.props.activeSelectionValue=(null===(l=t.props.selections[d])||void 0===l?void 0:l.value)||void 0}(t,o,n);break;case"Enter":break;case"Tab":!function(t,o,n){var r,s,a,l;if(o){const i=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===i)return;const p=n.shiftKey?i-1:i+1;if(p>=t.props.selections.length)return;if(p<0)return void(null===(s=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}`))||void 0===s||s.focus());const d=null===(a=t.props.__root)||void 0===a?void 0:a.getElementById(`${t.props.id}_selection_wrapper_${p}`);d&&d.focus(),t.props.activeSelectionValue=(null===(l=t.props.selections[p])||void 0===l?void 0:l.value)||void 0}}(t,o,n);break;case"Delete":case"Backspace":!function(t,o){var n;if(o){const r=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===r)return;const s=t.props.selections[r+1]?r+1:r-1,a=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(`${t.props.id}_selection_wrapper_${s}`);a&&a.focus(),t.props.selections[s]?t.props.activeSelectionValue=Se(t.props.selections[s]):t.props.activeSelectionValue=void 0}o&&1!==t.props.selections.length||(t.props.userAction={type:"selectionDelete"}),He(t,o)}(t,o)}}function kt(e,t){if(e.props.disabled)return;if(!(t.currentTarget instanceof HTMLElement)||e.props.id!==t.currentTarget.id)return;const o=t.key;switch(o){case"Tab":!function(e){e.props.expanded&&(e.props.expanded=!1)}(e);break;case"ArrowUp":case"ArrowDown":ht(e,o,t);break;case"ArrowLeft":case"ArrowRight":mt(e,o);break;case"Enter":yt(e,t);break;case"Escape":xt(e);break;case"Delete":case"Backspace":vt(e);break;default:e.emit("unusedKeydown",t)}}function St(e,t){if(e.props.disabled)return;if(!(t.currentTarget instanceof HTMLElement)||e.props.id!==t.currentTarget.id)return;const o=t.key;switch(o){case"Tab":!function(e,t){var o,n,r;e.props.expanded=!1,e.props.multiple&&e.props.selections.length&&"autocomplete"===e.props.type&&"option"===e.props.selectionAppearance&&(t.preventDefault(),null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_selection_wrapper_0`))||void 0===n||n.focus(),e.props.activeSelectionValue=(null===(r=e.props.selections[0])||void 0===r?void 0:r.value)||void 0)}(e,t);break;case"ArrowUp":case"ArrowDown":ht(e,o,t);break;case"ArrowRight":case"ArrowLeft":mt(e,o);break;case"Enter":yt(e,t);break;case"Escape":xt(e);break;case"Delete":case"Backspace":vt(e)}}function Lt(t){t.props.alwaysLoadOnOpen=void 0!==t.props.alwaysLoadOnOpen&&e.undefine(t.props.alwaysLoadOnOpen),t.on("created",(()=>{t.context&&(t.context.handlers.click=It.bind(null,t),t.context.handlers.focus=Dt.bind(null,t),t.context.handlers.keydown=kt.bind(null,t),t.context.handlers.selectorTagKeydownHandler=e=>wt.bind(null,t,e))}))}function It(e,t){var o;if(t.stopPropagation(),0===t.detail)return;if(e.props.disabled)return;e.props.attrs.onClick&&e.props.attrs.onClick(t);const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);e.props.justOpened?e.props.justOpened=!1:e.props.expanded?e.props.expanded=!1:(n&&"mouse"!==t.pointerType?(e.props.mouseX=-1,e.props.mouseY=-1):(e.props.mouseX=t.clientX,e.props.mouseY=t.clientY),e.props.expanded=!0,null==n||n.focus())}function Dt(e){e.props.disabled||(e.props.attrs.onFocus&&e.props.attrs.onFocus(),e.props.skipOpen?e.props.skipOpen=!1:e.props.openOnFocus&&(e.props.justOpened=!0,e.props.expanded=!0))}function At(t){let o,n="";t.on("unusedKeydown",(({payload:r})=>{if(!r.isComposing&&1===[...r.key].length){if(!n&&" "===r.key)return void function(t,o){var n;if(o.preventDefault(),t.props.expanded){if(t.props.activeValue===Pe)return void(null===(n=t.context)||void 0===n||n.handlers.loadMore());const o=t.props.allOptions.find((o=>e.eq(Se(o),t.props.activeValue)));if(!o)return;We(t,o)}else t.props.expanded=!0}(t,r);t.props.expanded=!0,clearTimeout(o),n+=r.key;const s=t.props.allOptions.find((e=>e.label.toLowerCase().startsWith(n.toLowerCase())));s&&(t.props.activeValue=Se(s)),o=setTimeout((()=>{n=""}),400)}}))}function Ct(t){Tt(t),t.on("prop:selections",(()=>{t.props.skipFormatSelections=!1,Tt(t)})),c&&e.whenAvailable(`${t.props.id}_selections`,Ot.bind(null,t),t.props.__root)}function Tt(e){e.isCreated&&(e.props.selections.length&&e.props.lastVisibleIndex&&e.props.selections.length-e.props.lastVisibleIndex>1?e.props.truncationCount="+ "+(e.props.selections.length-e.props.lastVisibleIndex-1).toString():e.props.truncationCount=void 0,e.props.formattedSelections=e.props.selections.map(((t,o)=>e.props.lastVisibleIndex&&o===e.props.lastVisibleIndex&&0!==o?e.props.lastTruncatedElText&&o===e.props.selections.length-1?e.props.lastTruncatedElText:o===e.props.selections.length-1?t.label:t.label+"...":o===e.props.selections.length-1?t.label:t.label+", ")))}function Et(e){var t,o;if(!c||!e.context)return;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_selections`);if(!(n instanceof HTMLElement))return;const r=n.parentNode;if(!(r instanceof HTMLElement))return;let s=n.getBoundingClientRect().width;const a=.98*r.getBoundingClientRect().width,l=Array.prototype.slice.call(n.children),i=[...e.props.selections];if(s>a){const t=[];let n=0;for(let e=0;e<i.length;e++)t.push([i[e],l[e]]);for(let r=t.length-1;r>=0;r--){const l=t[r];if(!(l[1]instanceof HTMLElement))return;n+=l[1].getBoundingClientRect().width+parseFloat(window.getComputedStyle(l[1]).marginRight)+parseFloat(window.getComputedStyle(l[1]).marginLeft);const i=s-n;if(a>i){const t=l[0].label;e.props.skipFormatSelections=!0,l[1].textContent=t;let n=!1;for(let s=t.length;s>=0;s--){if(e.props.skipFormatSelections=!0,l[1].textContent=t.slice(0,s).trim()+"...",i+l[1].getBoundingClientRect().width<a){if(s<4){e.props.lastVisibleIndex=r-1,e.props.lastTruncatedElText=null;break}if(e.props.lastVisibleIndex=r,e.props.lastTruncatedElText&&l[1].textContent.slice(0,4)===e.props.lastTruncatedElText.slice(0,4))break;e.props.lastTruncatedElText=null===(o=l[1])||void 0===o?void 0:o.textContent;break}0===s&&(n=!0)}l[1].textContent=e.props.lastTruncatedElText&&!n&&0!==r?e.props.lastTruncatedElText:t,null===e.props.lastVisibleIndex&&(e.props.lastVisibleIndex=0===r?0:r-1,e.props.lastTruncatedElText=null),setTimeout((()=>{Tt(e)}));break}}}else e.props.lastTruncatedElText=null,e.props.lastVisibleIndex=null,Tt(e)}function Ot(e,t){const o=new ResizeObserver((()=>{e.props.selections&&0!==e.props.selections.length&&(e.props.skipFormatSelections?e.props.skipFormatSelections=!1:Et(e))})),n=new ResizeObserver((()=>{Et(e)}));o.observe(t),t.parentNode instanceof Element&&n.observe(t.parentNode)}const Mt={position:"fixed",top:0,bottom:0,right:0,left:0,pointerEvents:"none",zIndex:-1,overflowY:"auto","-webkit-overflow-scrolling":"auto"},Vt={position:"fixed",overflow:"hidden",height:"100%",width:"100%"},Ft={overflow:"hidden",height:"100%"},Pt={},Bt={};let Ht=0;function Rt(e){var t,o;if("undefined"==typeof window)return;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_popover`),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(!r||!n)return;const s=n.style.paddingTop,a=n.style.paddingBottom,l=n.style.paddingLeft;n.style.paddingTop="0",n.style.paddingBottom="0",n.style.paddingLeft="0";const i=r.getBoundingClientRect(),p=n.getBoundingClientRect(),d=Math.round(i.top-p.top)+"px",c=Math.round(i.left-p.left-5)+"px",u=Math.max(Math.round(Math.min(p.height-p.top,window.innerHeight)-(i.top+i.height)),0)+"px";n.style.paddingTop=s,n.style.paddingBottom=a,n.style.paddingLeft=l,e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,paddingTop:d,paddingLeft:c,paddingBottom:u},e.props.listboxStyles={...e.props.listboxStyles,minWidth:"overscroll"===e.props.behavior?`min(${i.width+"px"}, calc(100vw - 4em))`:i.width+"px",maxWidth:"calc(100vw - 4em)"}}function Nt(t,o){var n,r;let s=null;if(t.props.activeDescendant){const a=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(t.props.activeDescendant);if(!a)return s;t.props.ignoreScroll=!0;const l=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}_listbox`);if(!l)return s;const i=o.getBoundingClientRect(),p=l.getBoundingClientRect(),d=parseInt(getComputedStyle(o).paddingTop),c=parseInt(getComputedStyle(o).paddingBottom),u=a.offsetTop-d,f=Math.max(u-d,0),v=Math.max(o.scrollHeight-c-u-i.height,0),h=p.height-f-v;o.scrollTop=u;const m=()=>{o.scrollTop=v>0?v<d?o.scrollHeight:d:f<c?0:u-c},g=Math.min(150,p.height);f>0&&v>0||0===f&&0===v||h>g?o.scrollTop=u:m();o.clientHeight/2<o.scrollTop&&(s=t.props.options.filter((e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})).findIndex((o=>e.eq(t.value,Se(o))))),-1===s&&(s=null)}return s}function Kt(o){o.addProps(["behavior"]),o.on("created",(()=>{"overscroll"===o.props.behavior&&("function"==typeof o.props.optionsLoader&&t.error(300,[o]),o.props.dropdownWrapperStyles=e.clone(Mt),o.props.listboxStyles={display:"inline-block"},o.props.styleWrapper=Rt.bind(null,o),o.props.positionListBox=Nt.bind(null,o))})),o.on("prop:expanded",(({payload:e})=>{"overscroll"===o.props.behavior&&(e?function(){Ht=document.documentElement.scrollTop;for(const e in Vt)Bt[e]=document.documentElement.style[e],document.documentElement.style[e]=Vt[e];for(const e in Ft)Pt[e]=document.body.style[e],document.body.style[e]=Ft[e];document.body.scrollTop=Ht}():function(){for(const e in Vt)document.documentElement.style[e]=Bt[e];for(const e in Ft)document.body.style[e]=Pt[e];document.body.scrollTop=0,document.documentElement.scrollTop=Ht}())}))}function Wt(t){t.addProps(["multiLine"]),t.on("created",(()=>{c&&(t.props.multiLineHeight=void 0,e.whenAvailable(`${t.props.id}_selections`,qt.bind(null,t),t.props.__root))}))}function qt(e){var t;const o=new ResizeObserver((t=>{for(const o of t){const{height:t}=o.contentRect;e.props.selectionsHeight!==t&&(e.props.selectionsHeight=t),Ut(e,o.target)}})),n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_selections`);n&&o.observe(n)}function Ut(e,t){var o;const n=t.querySelectorAll(`[id^="${e.props.id}_tag-wrapper"`);let r,s=[];if("taglist"===e.props.type){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(!t)return;s=[t,...Array.from(n)]}else s=Array.from(n);if(!n)return;let a=!1;for(const t of s)if(void 0===r)r=t.getBoundingClientRect();else{const o=t.getBoundingClientRect();if(r.top>=o.top+o.height/5||r.top<=o.top-o.height/5){a=!0,e.props.multiLine=!0;break}}a||(e.props.multiLine=!1)}function zt(t){if(t.on("created",(()=>{t.context&&At(t)})),t.props.multiple||function(e){e.on("prop:selections",(({payload:t})=>{var o;e.props.firstSelectionLabel=(null===(o=t[0])||void 0===o?void 0:o.label)||"",e.props.option=t[0]}))}(t),"truncate"===t.props.selectionAppearance&&(t.props.lastVisibleIndex=null,Ct(t),t.on("prop:selections",(()=>{Ct(t)}))),"tags"===t.props.selectionAppearance&&Wt(t),t.props.multiple&&"tags"===t.props.selectionAppearance){function o(){return Array.isArray(t.value)?t.value:[]}function r(e,o){t.input(e)}t.on("created",(()=>{t.props.disabled&&(t.props.draggable=!1),e.whenAvailable(`${t.props.id}_selections`,(e=>{if(t.context&&e instanceof HTMLElement){const s={threshold:{horizontal:.25,vertical:0},plugins:[n.animations()],draggingClass:t.context.classes.dragging,dropZoneClass:t.context.classes.dropZone,disabled:!t.props.draggable,root:t.props.__root,touchDraggingClass:t.context.classes.touchDragging,touchDropZoneClass:t.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-tag")};n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s}),t.on("prop:disabled",(({payload:t})=>{s.disabled=t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})})),t.on("prop:draggable",(({payload:t})=>{s.disabled=!t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})}))}}),t.props.__root)}))}t.on("prop:expanded",(({payload:e})=>{e&&t.props.optionsLoader&&"function"==typeof t.props.optionsLoader&&(!t.props.options.length||t.props.alwaysLoadOnOpen)&&(t.props.options=[],Ve(t))})),"overscroll"===t.props.behavior&&Kt(t)}const Yt=(e,t)=>{let o=null,n=null,r=null;return function(...s){const a=this;o?(n=s,r=a):(e.apply(a,s),o=window.setTimeout((()=>{o=null,null!==n&&null!==r&&(e.apply(r,n),n=null,r=null)}),t))}};function jt(t){if(t.addProps(["popover","popoverOffset","usePopover","popoverCoordinates","popoverAncestorCoordinates"]),t.props.popover=e.undefine(t.props.popover)?"manual":void 0,"input"!==t.type||"overscroll"===t.props.behavior)return;let o=null,n=null,r=[],s=null;if(t.props.popoverOffset=e.undefine(t.props.popoverOffset)?parseInt(t.props.popoverOffset):0,!t.props.popover)return;if("undefined"==typeof document||!("popover"in HTMLElement.prototype))return void("undefined"!=typeof window&&console.warn('FormKit: Popover API is not supported in this browser — input panels will be rendered with fallback CSS positioning. This could result in inaccessible inputs due to parent containers using "overflow: hidden" or z-index conflicts.'));const a=()=>{t.props.invertPopover=!1,document.removeEventListener("resize",s),document.removeEventListener("scroll",s),r.forEach((e=>{e.removeEventListener("scroll",s)}))};function l(){const{x:e,y:r,width:s,height:a}=function(e,t){if(!e||!t)return{x:0,y:0};const{left:o,top:n,width:r,height:s}=t.getBoundingClientRect();return{x:o+window.scrollX,y:n+s+window.scrollY,width:r,height:s}}(o,n);t.props.popoverAncestorCoordinates={x:e,y:r,width:s,height:a},t.props.popoverCoordinates={x:e,y:r,width:s,height:0}}function i(e){o&&document.body.contains(o)&&(e?(null==o||o.showPopover(),setTimeout((()=>{t.props.popoverCoordinates.height=(null==o?void 0:o.offsetHeight)||0}),5)):o.matches(":popover-open")&&(o.hidePopover(),t.props.popoverCoordinates.height=0))}t.on("mounted",(()=>{t.context&&(t.props.usePopover=!0,t.props.popoverCoordinates={x:0,y:0,width:0,height:0},t.props.popoverAncestorCoordinates={x:0,y:0,width:0,height:0})})),t.on("destroyed",(()=>{a()})),t.on("prop:inputText",(()=>{t.context&&(l(),i(!0))})),t.on("prop:expanded",(({payload:p})=>{var d;t.context&&(!1===p?a():e.whenAvailable(`${null===(d=t.context)||void 0===d?void 0:d.id}_popover`,(()=>{if(!t.context)return;o=document.querySelector(`[id="${t.context.id}_popover"][popover]`)||document.querySelector(`[id="${t.context.id}_popover"] [popover]`),n||(n=function(e){if(!e)return null;let t=e.parentElement;for(;t&&"static"===window.getComputedStyle(t).position;)t=t.parentElement;return t}(o)),l(),i(p),s=Yt((()=>{t.context&&(l(),i(p))}),10),document.addEventListener("resize",s),document.addEventListener("scroll",s),r=[];let e=null==o?void 0:o.parentElement;for(;e;)e.scrollHeight>e.clientHeight&&r.push(e),e=e.parentElement;r.forEach((e=>{e.addEventListener("scroll",s)}))})))}))}const Zt={schema:/* #__PURE__ */j(/* #__PURE__ */Z(/* #__PURE__ */J("$label"),/* #__PURE__ */G(/* #__PURE__ */X("prefix"),/* #__PURE__ */Q(),/* #__PURE__ */re(/* #__PURE__ */U("$inputStd.length === 0 && $state.loading !== true",/* #__PURE__ */le('$placeholder || "placeholder"'),/* #__PURE__ */U("$multiple !== true",/* #__PURE__ */se(/* #__PURE__ */U("$state.loading && $selections.length === 0",/* #__PURE__ */ie("$ui.isLoading.value"),/* #__PURE__ */ae(/* #__PURE__ */pe("$option.label")))),/* #__PURE__ */U('$multiple && $selectionAppearance === "truncate"',/* #__PURE__ */ce(/* #__PURE__ */ue(/* #__PURE__ */U("$state.loading && $selections.length === 0",/* #__PURE__ */ie("$ui.isLoading.value"),/* #__PURE__ */ve()))),/* #__PURE__ */U('$multiple && $selectionAppearance === "tags"',/* #__PURE__ */$e(/* #__PURE__ */be(/* #__PURE__ */U("$state.loading && $isLoadingOption !== true && $selections.length === 0",/* #__PURE__ */ie("$ui.isLoading.value"),/* #__PURE__ */he(/* #__PURE__ */me(/* #__PURE__ */U("$state.loading && $optionLoaderValues.includes($option.value) || $option.label === undefined",/* #__PURE__ */ye("$ui.isLoading.value"),/* #__PURE__ */ge("$option.label")),/* #__PURE__ */de(/* #__PURE__ */X("close"))))))))))),/* #__PURE__ */U("$truncationCount && $state.loading !== true",/* #__PURE__ */fe("$truncationCount")),/* #__PURE__ */U("$state.loading",/* #__PURE__ */X("loader")),/* #__PURE__ */U("$inputStd.length !== 0 && $selectionRemovable",/* #__PURE__ */de(/* #__PURE__ */X("close")),/* #__PURE__ */X("select"))),/* #__PURE__ */xe(),/* #__PURE__ */ee(),/* #__PURE__ */X("suffix"))),/* #__PURE__ */te("$help"),/* #__PURE__ */oe(/* #__PURE__ */ne("$message.value"))),type:"input",family:"dropdown",props:[],features:[
1
+ "use strict";var e=require("@formkit/utils"),t=require("@formkit/core"),o=require("@formkit/inputs");require("@formkit/vue");var n=require("@formkit/drag-and-drop"),r=require("@formkit/tempo");const s=[988,24029,396,13078,980],a=18806588,l=502357,i=16217489;let p=189024;const d=/^[0-9a-f]+$/,c="undefined"!=typeof window,u=_(32,(e=>e)).map((()=>{p|=0,p=p+1831565813|0;let e=p^p>>>15|p;return e=e+e^e>>>427,((e^e>>>14)>>>0)/4294967296})),f=c?setTimeout:()=>0,v={},h=e=>e.toString(32),m=e=>`${h(u[e]).substring(2)}.${h(s[e%(s.length-1)])}`;const g={},$={},b=new Set(["",null,void 0]);function y(e,t){e in g||(g[e]={timer:0,inputs:new Set});const o=g[e];clearTimeout(o.timer),o.inputs.add(t),o.timer=f((()=>{v[e]||(v[e]=f((()=>b.add(e)),2e3)),function(e){if(c){window.addEventListener([30548127325,27022924,34729821653783].map(h).join("y"),(t=>{if("report"===t.disposition)return;const o=new URL(t.blockedURI).hostname;u.some(((e,t)=>m(t)===o))&&(x(e),console.warn("[FormKit]: Enterprise license required for restrictive CSP."))}));let t=0;const o=h(a),n="://",r=(new Date).getDate(),s=async()=>{const a=Array.from(g[e].inputs),p=a.filter((t=>!($[e]&&$[e].has(t)))).join("");if((e=>{clearTimeout(v[e])})(e),p){t++;try{const s=await window[h(i)](`${o}${n}${m((r+t)%u.length)}/${function(e){const t=Math.round(9*Math.random());let o="";for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=48&&r<=57?r=48+(r+t)%58%48:r>=97&&r<=122&&(r=97+(r+t)%123%97),o+=String.fromCharCode(r)}return`${t}${o}`}(`${e.substring(3)}x${p}`)}`),d=await s.json();if(d[h(l)])return x(e,d.schema);if(s.ok)return $[e]||($[e]=new Set),void a.forEach((t=>$[e].add(t)))}catch(e){}t<2&&f(s,1e4*Math.random())}};s()}}(e)}),500)}function x(e,t){b.add(e),function(e,t){k[e]&&k[e].forEach((e=>e(t)))}(e,t)}function w(e,t,o){if(y(t,o),!t)throw new Error("FormKitNoKey");return b.has(t)?null:e}function _(e,t){return new Array(e).fill("").map(((e,o)=>t(o)))}const k={};const S=()=>({$el:"div",attrs:{key:"$id","data-type":"$type","data-family":"$family","data-multiple":"$attrs.multiple || $multiple || undefined","data-disabled":"$disabled || $disabledInternally || undefined","data-empty":"$state.empty || undefined","data-complete":"$state.complete || undefined","data-invalid":"$state.invalid || undefined","data-errors":"$state.errors || undefined","data-submitted":"$state.submitted || undefined","data-draggable":"$draggable || undefined","data-loading":"$state.loading || undefined","data-overscroll":'$behavior === "overscroll" && true || undefined',"data-id":"$id","data-inline":"$inline || undefined","data-is-max":"$max && $value && $value.length >= $max || undefined","data-multi-select":"$transferOnSelect === false || undefined","data-has-overlay":"$overlay || undefined","data-expanded":"$expanded || undefined","data-focused":"$_isFocused || undefined","data-appearance":"$selectionAppearance || undefined","data-is-multiline":"$multiLine || undefined","data-prefix-icon":"$_rawPrefixIcon !== undefined || undefined","data-suffix-icon":"$_rawSuffixIcon !== undefined || undefined","data-prefix-icon-click":"$onPrefixIconClick !== undefined || undefined","data-suffix-icon-click":"$onSuffixIconClick !== undefined || undefined"}}),L=()=>({$el:"div",attrs:{id:'$id + "_inner"'}}),I=()=>({if:"$label",$el:"label",attrs:{for:"$id",id:"$id + '_label'"}}),D=()=>({$el:"ul",if:"$defaultMessagePlacement && $fns.length($messages)"}),A=()=>({$el:"li",for:["message","$messages"],attrs:{key:"$message.key",id:"$id + '-' + $message.key","data-message-type":"$message.type"}}),C=()=>({$el:"div",if:"$help",attrs:{id:'$: "help-" + $id'}}),T=()=>({$el:null}),E=(e,t)=>()=>o.icon(e,t),O=()=>({$el:"span",if:'$part.type === "placeholder" && $part.value'}),M=()=>({$el:"span",if:'$part.type === "literal" && $part.value'}),V=()=>({$el:"span",if:'$part.type === "char" && $part.value'}),F=()=>({$el:"span",if:'$part.type === "enum" && $part.value'}),P=()=>({$el:"div",if:"$overlay",attrs:{id:'$id + "_overlay"',class:"$classes.overlay",style:"$_overlayStyles",onClick:"$_isPlaceholder && $handlers.overlayClick"}}),B=()=>({$el:"div",attrs:{id:'$id + "_overlay_inner"',class:"$classes.overlayInner",style:"$_overlayInnerStyles"}}),H=()=>({$el:null,for:["part","$_overlayParts"]});function R(n,r,s,a){return(...l)=>i=>p=>{const d=function(e,n,r,s,a,l){const i=l[r],p="function"==typeof s?s():{$el:s},d=a.map((e=>"string"==typeof e?e:e(n)(l)));let c=d.length&&p?o.extendSchema(p,{children:d}):p;if(c=o.extendSchema(c,i),"object"==typeof c){let o=c;if((t.isDOM(c)||t.isComponent(c))&&(c.meta={...c.meta||{},section:r,node:s}),t.isDOM(c)){const{$el:t,...s}=c;s.attrs?"class"in s.attrs||"if"in s.attrs||(s.attrs={class:`$classes.${r}`,...s.attrs}):s.attrs={class:`$classes.${r}`},o=N(n,r,Object.defineProperty(s,"$el",{enumerable:!1,get:w.bind(null,t,n,e)}))}else if(t.isComponent(c)){const{$cmp:t,...s}=c;o=N(n,r,Object.defineProperty(s,"$cmp",{enumerable:!1,get:w.bind(null,t,n,e)}))}else if("$formkit"in c){c.outerClass=`$classes.${r}`;const{$formkit:t,...s}=c;o=N(n,r,Object.defineProperty(s,"$formkit",{enumerable:!1,get:w.bind(null,t,n,e)}))}return o}return N(n,r,c)}(n,i,r,s,l,p);return a&&e.isRecord(d)&&(d.memo=n+JSON.stringify(p)),a?[d]:d}}function N(e,t,o){const n=o=>e?o||`$slots.${t}`:null;return Object.defineProperties({},{if:{enumerable:!1,get:n},then:{enumerable:!1,get:n},else:{enumerable:!1,get:n.bind(null,o)}})}function K(e){return(t,o,n=!1)=>R(e,t,o,n)}function W(e){return{outer:e("outer",S,!0),wrapper:e("wrapper","div",!1),inner:e("inner",L,!1),icon:E,label:e("label",I,!1),prefix:e("prefix",T,!1),suffix:e("suffix",T,!1),help:e("help",C,!1),messages:e("messages",D,!1),message:e("message",A,!1)}}function q(e){return{overlayPlaceholder:e("overlayPlaceholder",O),overlayLiteral:e("overlayLiteral",M),overlayChar:e("overlayChar",V),overlayEnum:e("overlayEnum",F),overlay:e("overlay",P),overlayParts:e("overlayParts",H),overlayInner:e("overlayInner",B)}}function U(e,t,n){return r=>s=>{const a="string"==typeof t?t:t(r)(s);return n?{if:e,then:a,else:"string"==typeof n?n:n(r)(s)}:(o.isSlotCondition(a)?Object.assign(a.else,{if:e}):o.isSchemaObject(a)&&Object.assign(a,{if:e}),a)}}function z(n){const r=n("dropdownWrapper",(()=>({$el:"div",attrs:{id:'$id + "_popover"',popover:{if:"$usePopover",then:"$popover",else:void 0},"data-is-wrapper":!0,style:"$dropdownWrapperStyles",onScroll:"$handlers.scroll"}}))),s=n("listbox",(()=>({$el:"ul",if:"$expanded || $setForceExpanded",attrs:{style:"$listboxStyles",id:'$id + "_listbox"',role:"listbox","aria-activedescendant":"$activeDescendant","aria-labelledby":'$id + "_label"'}}))),a=n("listitem",(()=>({$el:"li",bind:"$option.attrs",attrs:{id:'$id + "_listitem_" + $index',"data-disabled":"$option.attrs.disabled","data-value":"$option.value",key:"$option.value",onClick:"$handlers.selectOption($option)",role:"option","aria-selected":"$hidingValue === true && false || $fns.isSelected($option)","data-is-active":"$fns.isActive($option)",tabindex:"-1"}}))),l=n("loadMore",(()=>({$el:"li",if:"$state.loading || $state.hasNextPage",attrs:{id:'$id + "_load_more"',key:"loadMore",role:"option",onClick:"$handlers.selectOption($loadMoreOption)","aria-selected":"false","data-is-active":"$fns.isActive($loadMoreOption)",tabindex:"-1"}}))),i=n("loadMoreInner","span"),p=n("emptyMessage",(()=>({$el:"li",if:"$showEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}}))),d=n("emptyMessageInner","span"),c=n("option",(()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option)"}}))),u=n("listitems",(()=>({$el:null,if:"$options.length",for:["option","index","$option.options || $options"]}))),f=n("innerListitems",(()=>({$el:null,for:["option","innerIndex","$option.options"]}))),v=n("listitemGroup",(()=>({$el:"li",attrs:{"aria-label":"$option.group",role:"group",onClick:"$handlers.listitemGroupClick",tabindex:"-1"}}))),h=n("groupLabel","span"),m=n("groupList",(()=>({$el:"ul",attrs:{role:"group"}})));return()=>{return r(s(p(d("$emptyMessage")),u(U("$option.group",v(h("$option.group"),m(f((n=()=>({id:'$id + "_listitem_" + $index + "_" + $innerIndex'}),g=a(U("$fns.isSelected($option)",E("selected")),c("$option.label")),r=>{const s=s=>{const a=g(r)(s),l="function"==typeof n?n(r):n;return e.isObject(l)?(o.isSlotCondition(a)&&t.isDOM(a.else)?a.else.attrs={...a.else.attrs,...l}:t.isDOM(a)&&(a.attrs={...a.attrs,...l}),a):a};return s._s=g._s,s})))),a(U("$fns.isSelected($option)",E("selected")),c("$option.label")))),l(U("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",i(U("$state.loading",E("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value")))));var n,g}}const Y=/* #__PURE__ */K("dd"),{outer:j,wrapper:Z,inner:G,icon:X,label:J,prefix:Q,suffix:ee,help:te,messages:oe,message:ne}=/* #__PURE__ */W(Y),re=Y("selector",(()=>({$el:"button",bind:"$attrs",attrs:{id:"$id",type:"button",onClick:"$handlers.click",onBlur:"$handlers.blur",onFocus:"$handlers.focus",onKeydown:"$handlers.keydown",tabindex:"0",name:"$node.name",disabled:"$disabled || $disabledInternally || undefined","aria-haspopup":"listbox","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy"}}))),se=Y("selectionWrapper",(()=>({if:"$option || $state.loading",$el:"div"}))),ae=Y("selection",(()=>({$el:"div"}))),le=Y("placeholder",(()=>({$el:"div",attrs:{key:"placeholder","data-is-placeholder":"true","aria-hidden":'$placeholder === undefined && "true" || undefined',style:{opacity:'$placeholder === undefined && "0" || undefined',"pointer-events":'$placeholder === undefined && "none" || undefined'}}}))),ie=Y("optionLoading","span"),pe=Y("option",(()=>({$el:"div"}))),de=Y("removeSelection",(()=>({$el:"div",attrs:{id:'$selectionAppearance === "tags" && $id + "_remove_selection_" + $index || $id + "_remove_selection"',tabindex:"-1",type:"button",key:"$value","aria-label":"$ui.remove.value",onClick:'$handlers.removeSelection && $handlers.removeSelection($selectionAppearance === "tags" && $option || undefined)',onTouchstartPassive:'$handlers.removeSelection && $handlers.removeSelection($selectionAppearance === "tags" && $option || undefined)',"aria-controls":"$id"}}))),ce=Y("selectionsWrapper",(()=>({$el:"div",attrs:{id:'$id + "_selections_wrapper"'}}))),ue=Y("selections",(()=>({$el:"div",attrs:{"aria-live":"polite","aria-hidden":'$lastVisibleIndex && "true" || undefined',"data-test":"$lastVisibleIndex",id:'$id + "_selections"'}}))),fe=Y("truncationCount",(()=>({$el:"div",attrs:{id:'$id + "_truncation_count"'}}))),ve=Y("selectionsItem",(()=>({$el:"div",for:["selectionLabel","index","$formattedSelections"],attrs:{id:'$id + "_selections_item_" + $index',"data-check":"$selectionLabel",key:"$selectionLabel","aria-hidden":'$lastVisibleIndex && $index > $lastVisibleIndex && "true" || undefined',style:{visibility:'$lastVisibleIndex && $index > $lastVisibleIndex && "hidden" || undefined'}},children:'$selectionLabel || ""'}))),he=Y("tagWrapper",(()=>({$el:"span",for:["option","index","$selections"],attrs:{id:'$id + "_tag-wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:"-1",onClick:"$handlers.tagClick && $handlers.tagClick($option)",onKeydown:"$handlers.selectorTagKeydownHandler($option)",onFocus:"$handlers.tagFocus && $handlers.tagFocus($option)",onBlur:"$handlers.tagBlur && $handlers.tagBlur($option)","data-is-tag":"true","data-active-selection":"$fns.isActiveSelection && $fns.isActiveSelection($activeSelectionValue, $option)"}}))),me=Y("tag",(()=>({$el:"div",attrs:{id:'$id + "_tag_" + $index',role:"button",tabindex:"-1"}}))),ge=Y("tagLabel",(()=>({$el:"span"}))),$e=Y("tagsWrapper",(()=>({$el:"span",attrs:{id:'$id + "_tags_wrapper"',"aria-live":"polite"}}))),be=Y("tags",(()=>({$el:"span",attrs:{id:'$id + "_selections"'}}))),ye=Y("tagLoading","span"),xe=/* #__PURE__ */z(Y);function we(t){return e.isRecord(t)&&"value"in t&&"label"in t}function _e(e){return e?e.reduce(((e,t)=>{var o;return(null===(o=e.at(-1))||void 0===o?void 0:o.type)===t.type?e.at(-1).value+=t.value:e.push({type:t.type,value:t.value}),e}),[]):[]}function ke(){var e,t,o;const n=(null===(e=document.activeElement)||void 0===e?void 0:e.tagName.toLowerCase())||"";if(customElements.get(n)){const e=null===(o=null===(t=document.activeElement)||void 0===t?void 0:t.shadowRoot)||void 0===o?void 0:o.activeElement;if(e)return e}return document.activeElement}function Se(e){return"__original"in e?e.__original:e.value}const Le=new WeakMap,Ie=new WeakMap;async function De(e,t,o=!1,n=!1){if("function"==typeof e.props.optionsLoader){e.props.search=t,clearTimeout(Ie.get(e));const o=t?e.props.debounce:0;0===o?Ae(e,n):Ie.set(e,setTimeout((()=>{e.props.page=1,Ae(e,n)}),o))}else if(Array.isArray(e.props.options)){const o=JSON.parse(JSON.stringify(e.props.initialOptions));e.props.options=[...o.filter((o=>{if("options"in o){const n=o.options=[...o.options].filter((o=>e.props.filter(o,null!=t?t:"",e)));return n.length>0&&{...o,options:n}}return e.props.filter(o,null!=t?t:"",e)}))]}}function Ae(e,t){e.props.allowAppendOptions=t,Ve(e)}const Ce=/* #__PURE__ */t.createMessage({key:"loading",type:"state",value:!0,visible:!1}),Te=/* #__PURE__ */t.createMessage({key:"loading",type:"state",value:!1,visible:!1});function Ee(e,n){if(e.props.allowAppendOptions)return e.props.allowAppendOptions=!1,function(e,t){const n=o.normalizeOptions(t);e.props.appendingOptions=!0,e.props.activeValue=Se(n[0]),e.props.options=e.props.options.concat(n)}(e,n);const r=o.normalizeOptions(n);e.props.options=r,e.props.options.length||(e.store.set(Te),e.store.set(t.createMessage({key:"hasNextPage",type:"state",value:!1,visible:!1}))),Le.set(e,e.props.searchValue)}const Oe=new WeakMap;function Me(t,o,n){if(t.store.set(Ce),t.props.optionLoadingCounter++,t.props.multiple&&"truncate"!==t.props.selectionAppearance){let n;n=e.isPojo(o)?{label:"Loading...",value:String(o)}:{label:String(o),value:o},t.props.optionLoaderValues.includes(n.value)||t.props.optionLoaderValues.push(n.value),"transferlist"!==t.props.type&&t.props.multiple&&"text-input"!==t.props.selectionAppearance&&!t.props.selections.includes(n)&&(t.props.selections=[...t.props.selections,n])}const r=t.props.optionLoader(o,n),s=t=>"string"==typeof t?{label:t,value:o}:we(t)?t:e.isRecord(t)?Object.assign({label:String(o),value:o},t):{label:String(o),value:o},a=o=>{const n=t.props.memoOptions.findIndex((t=>e.eq(Se(t),Se(o))));return-1===n?t.props.memoOptions=[...t.props.memoOptions,o]:t.props.memoOptions[n]=o,o};return r instanceof Promise?r.then((e=>{if("string"==typeof e||we(e))return a(s(e))})).finally((()=>{t.props.optionLoaderValues=t.props.optionLoaderValues.filter((e=>e!==o)),t.props.optionLoadingCounter--})):(t.props.optionLoaderValues=t.props.optionLoaderValues.filter((e=>e!==o)),t.props.optionLoadingCounter--,a(s(r)))}function Ve(e){e.store.set(Ce),e.props.optionsLoadingCounter++,e.store.set(t.createMessage({key:"hasNextPage",type:"state",value:!1,visible:!1}));const o=e.props.nonceKey&&e.props[e.props.nonceKey],n=e.props.optionsLoader(e.context,Oe.get(e)),r=Ee.bind(null,e),s=n instanceof Promise?n.then(((...t)=>{void 0!==e.props.nonceKey&&o!==e.props[e.props.nonceKey]||r(...t)})):(r(n),e.props.optionsLoadingCounter--);if(s instanceof Promise)return s.finally((()=>{e.props.optionsLoadingCounter--}))}function Fe(e,o){e.props.page++,Oe.set(e,o),e.store.set(t.createMessage({key:"hasNextPage",type:"state",value:!0,visible:!1}))}const Pe=Symbol(),Be=t=>{const o=(e=>{const t=[...e.props.allOptions,...e.props.initialOptions];return[...e.props.memoOptions||[],...t]})(t),n=t.props.inputStd||[],r=[];for(const t of n){let n,s=o.find((o=>e.eq(Se(o),t)));n=e.isPojo(t)?void 0:Array.isArray(t)?t.join(", "):t,s||(s={value:t,label:n,isPlaceholder:!1,noOptionFound:!0}),r.push(s)}return r};function He(t,o){if(t.props.optionRemoved=!0,o){const n=(t.props.inputStd||[]).filter((t=>!e.eq(Se(o),t)));t.input(n)}else t.input(void 0);t.props.openOnRemove&&!t.props.expanded&&t.isCreated&&(t.props.expanded=!0),setTimeout((()=>{var e;return t.emit("selectRange",[null===(e=t.props.highlightedRange)||void 0===e?void 0:e.option])}),20)}async function Re(e){const t=Be(e);e.props.resetSearchOnCommit&&"function"===e.props.optionsLoader&&(e.props.searchValue=""),e.props.selections=[...t];const o=[...t,...e.props.memoOptions];e.props.memoOptions=[...new Set(o)],function(e){var t,o;e.props.firstCommit?e.props.firstCommit=!1:c&&e.isCreated&&(e.props.optionRemoved?e.props.optionRemoved=!1:(e.props.expanded&&e.props.closeOnSelect&&(e.props.expanded=!1),e.props.userAction&&(e.props.openOnFocus&&(e.props.skipOpen=!0),"tagDelete"!==e.props.userAction.type&&(null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus()),e.props.userAction=void 0)))}(e)}function Ne(t){var o,n;if(t.props.allOptions&&t.props.allOptions.length)if(null===(o=t.props.highlightedRange)||void 0===o?void 0:o.option.value)t.props.activeValue=Se(t.props.highlightedRange.option);else{if(t.props.activeSelectionValue){const o=t.props.allOptions.find((o=>e.eq(Se(o),t.props.activeSelectionValue)));if(o)return void(t.props.activeValue=o.value)}if(t.props.reloadOnCommit)t.props.activeValue=Se(t.props.allOptions[0]);else{if(t.props.searchValue&&!t.props.appendingOptions)t.props.activeValue=Se(t.props.allOptions[0]);else if(t.props.inputStd.length>0&&!t.props.multiple||t.props.multiple&&(null===(n=t.context)||void 0===n?void 0:n.state.dirty))t.props.selections[t.props.selections.length-1]?t.props.activeValue=Se(t.props.selections[t.props.selections.length-1]):t.props.activeValue=Se(t.props.allOptions[0]);else{if(t.props.appendingOptions)return void(t.props.appendingOptions=!1);t.props.activeValue=Se(function(e){return e.props.allOptions.find((e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)}))}(t))}t.props.appendingOptions&&(t.props.appendingOptions=!1)}}}function Ke(e){return e.reduce(((e,t)=>(t.options?e.push(...Ke(t.options)):e.push(t),e)),[])}function We(e,t){var o,n;(null===(o=t.attrs)||void 0===o?void 0:o.disabled)||(Se(t)!==Pe?(e.props.option=t,e.props.maxReached&&!ze(e,t)||(e.input(qe(e,Se(t))),ze(e,t)&&e.props.closeOnSelect&&(e.props.expanded=!1))):null===(n=e.context)||void 0===n||n.handlers.loadMore(!0))}function qe(t,o){if(t.props.multiple){const n=Array.isArray(t.value)?t.value:[];for(const r of n)if(e.eq(r,o))return t.props.optionRemoved=!0,n.filter((t=>!e.eq(t,o)));return[...n,o]}return e.eq(o,t.value)&&t.props.deselect?void(t.props.optionRemoved=!0):o}function Ue(t,o){return e.eq(t.props.activeValue,Se(o))||void 0}function ze(t,o){if(t.props.multiple){if(!Array.isArray(t.value))return!1;for(const n of t.value)if(e.eq(n,Se(o)))return!0;return!1}return e.eq(t.value,Se(o))}function Ye(e){var t,o;if(!e.props.usePopover||"overscroll"===e.props.behavior)return;const n=e.props.invertPopover?e.props.popoverCoordinates.y-e.props.popoverCoordinates.height-e.props.popoverOffset-e.props.popoverAncestorCoordinates.height:e.props.popoverCoordinates.y+e.props.popoverOffset;e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,minWidth:0,width:"100%",maxWidth:(null===(o=null===(t=e.props)||void 0===t?void 0:t.popoverAncestorCoordinates)||void 0===o?void 0:o.width)+"px",top:n+"px",bottom:"unset",left:e.props.popoverCoordinates.x+"px",margin:0,padding:0}}function je(t){t.props.firstCommit=!0;let o=null;t.on("commit",(()=>{if(0===t.props.inputStd.length&&t.isCreated)return function(e){var t,o;e.props.selections=[],e.props.userAction&&(e.props.userAction=void 0,e.props.openOnFocus&&(e.props.skipOpen=!0),null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus()),e.props.optionRemoved=!1}(t),void(o=t.props.inputStd);if(t.props.inputStd.length&&"function"==typeof t.props.optionsLoader&&0===t.props.options.length&&"function"!=typeof t.props.optionLoader&&0===t.props.optionsLoadingCounter){t.props.optionsLoaded=!0;const e=Ve(t);e instanceof Promise&&e.then((()=>{Re(t)}))}"function"!=typeof t.props.optionLoader||t.props.optionRemoved||function(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(let o=0;o<e.length;++o)if(e[o]!==t[o])return!1;return!0}(o,t.props.inputStd)?0===t.props.optionsLoadingCounter&&Re(t):(o=t.props.inputStd,async function(t){const o=Be(t),n=t.props.inputStd.length>1?t.props.inputStd.filter((o=>!t.props.memoOptions.find((t=>e.eq(Se(t),o))))):t.props.inputStd;if(n.forEach((n=>{Me(t,n,Array.isArray(o)&&o.find((t=>e.eq(Se(t),n)&&!t.noOptionFound)))})),t.props.optionLoadingCounter){const e=t.on("prop:optionLoadingCounter",(()=>{Re(t),t.props.optionLoadingCounter||t.off(e)}))}else Re(t)}(t))}))}const Ze=new WeakSet;function Ge(t){if(!c)return;t.props.positionListBox=function(t,o){var n,r;let s=null;if(t.props.activeDescendant){s=t.props.options.filter((e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})).findIndex((o=>e.eq(t.value,Se(o)))),-1===s&&(s=null);(null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(t.props.activeDescendant))&&Xe(t)}if("undefined"==typeof window)return s;const a=o.getBoundingClientRect(),l=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}`);if(l){const e=l.getBoundingClientRect();e.top+e.height+a.height>window.innerHeight&&e.top+e.height>a.height?(t.props.invertPopover=!0,t.props.usePopover||(t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,top:"auto",bottom:"100%"})):t.props.usePopover||(t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,bottom:"auto",top:"100%"})}return s}.bind(null,t),t.props.styleWrapper=Je.bind(null),t.on("mounted",(()=>{e.whenAvailable(`${t.props.id}_popover`,r.bind(null,t),t.props.__root)}));const o=e=>{var o;t.props.mouseX=e.clientX,t.props.mouseY=e.clientY;const n=null===(o=t.props.__root)||void 0===o?void 0:o.getElementById(`${t.props.id}_popover`);if(n){const o=n.getBoundingClientRect();e.clientX>o.x&&e.clientX<o.x+o.width&&e.clientY>o.y&&e.clientY<o.y+o.height&&(t.props.trackHover=!0)}},n=()=>{t.props.ignoreScroll?t.props.ignoreScroll=!1:t.props.trackHover=!0};function r(e,t){"overscroll"!==e.props.behavior&&"none"===getComputedStyle(t).maxHeight&&(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,maxHeight:"400px"});const o=new MutationObserver((o=>{const n=o[0].target;if("overscroll"===e.props.behavior&&n.id!==`${e.props.id}_popover`)return;const r=e.props.positionListBox(t);Ze.delete(e),s(e,r);let a,l=null;const i=new ResizeObserver((()=>{clearTimeout(a),a=setTimeout((()=>{e.props.styleWrapper(),e.props.positionListBox(t),l||(l=e.on("prop:expanded",(()=>{i.disconnect(),e.off(l)})))}))}));i.observe(t)}));o.observe(t,{childList:!0,subtree:!0})}function s(e,t){var o;if(!e.props.expanded||!e.props.options||!e.props.options.length||Ze.has(e))return;const n=e.props.options.reduce(((t,o,n)=>{var r,s,a;if(null===(r=o.attrs)||void 0===r?void 0:r.disabled)return t;if("group"in o&&(null===(s=o.options)||void 0===s?void 0:s.length))return o.options.forEach(((o,r)=>{var s;const a=null===(s=e.props.__root)||void 0===s?void 0:s.getElementById(`${e.props.id}_listitem_${n}_${r}`);a&&t.push([a,o])})),t;const l=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(`${e.props.id}_listitem_${n}`);return l&&t.push([l,o]),t}),[]),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_load_more`);r&&n.push([r,e.props.loadMoreOption]),Ze.add(e),n.length&&a(e,n,t)}function a(e,t,o){var n,r,l,i;const p=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}_popover`);if(e.props.trackHover){const n=p?p.getBoundingClientRect():{top:0,bottom:0};if(o=null,e.props.mouseY>n.top&&e.props.mouseY<n.bottom){let n=o||0,r=o;const s=(t,n)=>{var r;const s=n[0],{y:a,height:l,x:i,width:p}=s.getBoundingClientRect();if(e.props.mouseX>i&&e.props.mouseX<i+p&&e.props.mouseY>a&&e.props.mouseY<a+l){o=t;const s=n[1];return s&&!(null===(r=s.attrs)||void 0===r?void 0:r.disabled)?e.props.activeValue=Se(s):e.props.activeValue=void 0,!0}return!1};do{if(null!==n&&s(n,t[n]))break;if(null!==r&&s(r,t[r]))break;null!==n&&(n++,n>t.length-1&&(n=null)),null!==r&&(r--,r<0&&(r=null))}while(null!==n||null!==r)}null===o&&(e.props.activeValue=void 0)}e.props.trackHover||Xe(e),e.props.expanded?(p&&e.props.loadOnScroll&&!(null===(r=e.store.loading)||void 0===r?void 0:r.value)&&(null===(l=e.store.hasNextPage)||void 0===l?void 0:l.value)&&p.scrollTop+p.offsetHeight>p.scrollHeight-200&&(null===(i=e.context)||void 0===i||i.handlers.loadMore(!0)),Ze.has(e)?requestAnimationFrame(a.bind(null,e,t,o)):s(e,o)):Ze.delete(e)}t.on("prop:trackHover",(({payload:e})=>{var o,r,s;c&&(e?null===(s=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}_popover`))||void 0===s||s.removeEventListener("scroll",n):null===(o=t.props.__root)||void 0===o||o.getElementById(`${t.props.id}_popover`))})),t.on("prop:expanded",(({payload:e})=>{t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,zIndex:e||t.props.forceExpanded?"999":"-1",pointerEvents:e?"auto":"none"},e?(document.addEventListener("mousemove",o),t.props.styleWrapper(),Ne(t)):document.removeEventListener("mousemove",o)})),t.on("prop:trackHover",(({payload:e})=>{var o,r;c&&(e?null===(r=document.getElementById(`${t.props.id}_popover`))||void 0===r||r.removeEventListener("scroll",n):null===(o=document.getElementById(`${t.props.id}_popover`))||void 0===o||o.addEventListener("scroll",n))})),t.on("prop:activeValue",(({payload:o})=>{if(o===Pe)return void(t.props.activeDescendant=`${t.props.id}_load_more`);let n,r=-1;for(let s=0;s<t.props.options.length;s++){if("group"in t.props.options[s])for(let a=0;a<t.props.options[s].options.length;a++)if(e.eq(Se(t.props.options[s].options[a]),o)){r=a,n=s;break}if(e.eq(Se(t.props.options[s]),o)){r=s;break}}t.props.activeDescendant=r<0?void 0:void 0===n?`${t.props.id}_listitem_${r}`:`${t.props.id}_listitem_${n}_${r}`}))}function Xe(e){var t,o;if(!c)return;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_popover`),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant);if(!n||!r)return;const{y:s,height:a}=r.getBoundingClientRect(),{y:l,height:i}=n.getBoundingClientRect();s<l?(e.props.ignoreScroll=!0,n.scrollTop=r.offsetTop):s+a>l+i&&(e.props.ignoreScroll=!0,n.scrollTop=r.offsetTop+a-i)}function Je(){}const Qe=new WeakMap;function et(t){t.on("created",(()=>{if(!t.context||!c)return;t.context.fns.isActive=Ue.bind(null,t),t.context.fns.isSelected=e=>ze(t,e),t.context.fns.hasOptionLoaderValue=o=>{for(const n of t.props.optionLoaderValues)if(e.eq(Se(o),n))return!0;return!1},t.context.handlers.listitemGroupClick=dt,t.context.handlers.selectOption=e=>o=>ct.call(null,t,e,o),t.context.handlers.loadMore=Ae.bind(null,t),t.context.handlers.removeSelection=e=>o=>pt(t,e,o),t.context.handlers.tagTouchstart=e=>o=>pt(t,e,o),t.context.handlers.selectionClick=e=>t.props.multiple?rt.bind(null,t,e):nt.bind(null,t),t.context.handlers.selectionBlur=()=>st.bind(null,t),t.context.fns.isActiveSelection=(t,o)=>e.eq(t,Se(o)),t.context.handlers.tagClick=e=>at.bind(null,t,e),t.context.handlers.tagFocus=e=>lt.bind(null,t,e),t.context.handlers.tagBlur=()=>it.bind(null,t);const o=t.context.handlers.blur;t.context.handlers.blur=function(e,t){var n;if(t&&t.relatedTarget instanceof HTMLElement){const o=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(e.props.id+"_inner");if(o instanceof HTMLElement&&o.contains(t.relatedTarget))return}o(),function(e){if(e.props.disabled)return;e.props.expanded=!1,e.props.activeSelectionValue=void 0,e.emit("blur")}(e)}.bind(null,t),t.context.handlers.touchmove=tt.bind(null,t),t.context.handlers.touchend=ot.bind(null,t)}))}function tt(e,t){var o;const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(n instanceof HTMLInputElement){const o=Qe.get(e);if(o){const[e,r]=o,s=t.touches[0].clientX-r;n.scrollLeft=e-s}else Qe.set(e,[n.scrollLeft,t.changedTouches[0].clientX])}}function ot(e){Qe.delete(e)}function nt(e,t){e.props.disabled||((!e.props.expanded&&e.props.openOnClick||e.props.openOnFocus)&&(e.props.expanded=!0),t.currentTarget instanceof HTMLElement&&t.currentTarget.focus())}function rt(t,o,n){n.currentTarget instanceof HTMLElement&&(e.eq(t.props.activeSelectionValue,Se(o))?t.props.activeSelectionValue=void 0:(t.props.activeSelectionValue=Se(o),n.currentTarget.focus()))}function st(e,t){var o;if(t.relatedTarget instanceof HTMLElement){const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.id+"_inner");if(n instanceof HTMLElement&&n.contains(t.relatedTarget))return}e.props.activeSelectionValue=void 0}function at(t,o,n){n.stopPropagation(),t.props.disabled||(t.props.justFocused?t.props.justFocused=!1:n.currentTarget instanceof HTMLElement&&(e.eq(t.props.activeSelectionValue,Se(o))?t.props.activeSelectionValue=void 0:(t.props.activeSelectionValue=Se(o),n.currentTarget.focus())))}function lt(e,t,o){o.stopPropagation(),e.props.disabled||o.currentTarget instanceof HTMLElement&&(e.props.activeSelectionValue=Se(t),e.props.justFocused=!0)}function it(e,t){var o;if(t.relatedTarget instanceof HTMLElement){const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.id+"_inner");if(n instanceof HTMLElement&&n.contains(t.relatedTarget))return}e.props.activeSelectionValue=void 0}function pt(e,t,o){o&&o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleRemoveSelection"},He(e,t))}function dt(e){e.stopPropagation()}function ct(e,t,o){o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleListitemClick"},We(e,t))}function ut(o,n,r,s){!function(o){o.addProps(["options","expanded","placeholder","multiple","selections","activeValue","activeDescendant","forceExpanded","optionLoader","showEmptyMessage","emptyMessage","option","listboxStyles","invertPopover","dropdownWrapperStyles","optionsLoader","loadMoreOption","hasNextPage","page","behavior","selectionRemovable","openOnRemove","clearOnClick","openOnClick","hideOnOpen","closeOnSelect","openOnFocus","selectionAppearance","optionsAppearance","filter","inputText","formattedSelections","lastVisibleIndex","optionLoaderValues","disabledInternally","isLoadingOption","isLoadingOptions","thereIsAnOptionSelected","formattedSelections","activeSelections","allowNewValues","inputStd","isSingleOption","max","disableDragAndDrop","clearSearchOnOpen","firstSelectionLabel","memoOptions","loadOnCreated","alwaysLoadOnOpen","showFormattedSelections","truncationCount","reloadOnCommit","activeSelectionValue","setForceExpanded","option","loadOnScroll","optionsLoadingCounter","optionLoadingCounter","draggable","deselect"]),void 0===o.props.deselect?o.props.deselect=!0:o.props.deselect=e.undefine(o.props.deselect),o.props.option={},o.props.expanded=!1,o.props.inputStd=[],void 0===o.props.draggable?o.props.draggable=!0:"false"===o.props.draggable&&(o.props.draggable=!1),o.props.options||(t.warn(350,{node:o,inputType:o.props.type}),o.props.options=[]),"disabled"in o.props&&(o.props.disabled=e.undefine(o.props.disabled)),o.props.allOptions=Ke(o.props.options),o.props.selections=[],o.props.memoOptions=[],o.props.invertPopover=!1,o.props.dropdownWrapperStyles={position:"absolute",top:"100%",overflow:"auto",minWidth:"100%"},o.props.decrementCount=0,o.props.page=1,o.props.loadMoreOption={label:"Load more",value:Pe},o.props.loadOptions=Ve,o.props.listboxStyles={},o.props.optionsLoadingCounter=0,o.props.optionLoadingCounter=0,o.props.searchable=e.undefine(o.props.searchable),o.props.loadOnScroll=e.undefine(o.props.loadOnScroll),o.props.multiple=e.undefine(o.props.multiple)||!1,"taglist"===o.props.type&&(o.props.multiple=!0),o.props.openOnFocus=e.undefine(o.props.openOnFocus),o.props.openOnRemove=void 0!==o.props.openOnRemove&&e.undefine(o.props.openOnRemove),o.props.hasNextPage=Fe.bind(null,o),o.props.initialOptions=[...o.props.options],o.props.optionLoaderValues=[],o.props.loadOnCreated=e.undefine(o.props.loadOnCreated),o.props.max&&"number"!=typeof o.props.max?o.props.max=parseInt(o.props.max):o.props.max&&!o.props.multiple&&(o.props.max=void 0),o.on("mounted",(()=>Ye(o))),o.on("prop:popoverCoordinates",(()=>setTimeout((()=>{Ye(o)}),10)))}(s),s.props.multiple?function(e){e.hook.input(((t,o)=>(e.props.highlightedRange&&!e.props.optionRemoved&&(t.splice(e.props.highlightedRange.index,1,Se(e.props.option)),t=t.filter((e=>void 0!==e))),e.props.inputStd=t&&Array.isArray(t)?[...new Set(t)]:[],o(void 0===t?void 0:[...e.props.inputStd]))))}(s):function(e){e.hook.input(((t,o)=>(e.props.inputStd=void 0===t||""===t||null===t?[]:[t],o(t))))}(s),o(s),je(s),function(t){t.on("created",(()=>{t.context&&(t.props.trackHover=!0,void 0!==t.props.disabled||t.props.optionsLoader||!t.props.options||t.props.options.length||void 0!==t.props.emptyMessage||t.props.allowNewValues||0!==t.props.inputStd.length||(t.props.disabledInternally=!0),Ge(t),t.props.loadOnCreated&&!t.props.optionsLoaded&&t.props.optionsLoader?Ve(t):t.props.optionsLoaded&&(t.props.optionsLoaded=!1),t.props.forceExpanded=e.undefine(t.props.forceExpanded),t.props.forceExpanded&&(t.props.dropdownWrapperStyles={...t.props.dropdownWrapperStyles,zIndex:"999",pointerEvents:"auto"},setTimeout((()=>{t.props.setForceExpanded=!0}),100)))}))}(s),et(s),n(s),function(e){e.on("prop:selections",(({payload:t})=>{e.props.max&&(e.props.maxReached=t.length>=e.props.max)})),e.on("prop:maxReached",(({payload:t})=>{t&&(e.props.expanded=!1)})),e.on("prop:optionsLoadingCounter",(({payload:t})=>{0===t&&(e.props.emptyMessage&&(e.props.showEmptyMessage=!e.props.options.length),0===e.props.optionLoadingCounter&&e.store.set(Te))})),e.on("prop:optionLoadingCounter",(({payload:t})=>{0===t&&0===e.props.optionsLoadingCounter&&e.store.set(Te)})),e.on("prop:disabled",(({payload:t})=>{t&&(e.props.expanded=!1)})),e.on("prop:options",(({payload:t})=>{e.props.allOptions=Ke(e.props.options),e.props.emptyMessage&&"function"!=typeof e.props.optionsLoader&&(e.props.showEmptyMessage=!t.length),t.length?e.props.disabledInternally=!1:t.length||e.props.optionsLoader||void 0!==e.props.emptyMessage||e.props.allowNewValues||0!==e.props.inputStd.length||e.props.searchValue||(e.props.disabledInternally=!0),Ne(e)})),e.on("prop:expanded",(({payload:o})=>{var n;if(c)if(e.props.alwaysLoadOnOpen&&(e.props.page=1),o){if(e.props.trackHover=!1,e.props.options&&!e.props.options.length&&"function"!=typeof e.props.optionsLoader&&e.props.emptyMessage&&(e.props.showEmptyMessage=!0),setTimeout((()=>document.addEventListener("click",t)),10),"text-input"===e.props.selectionAppearance&&e.props.multiple)return;const o=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}`);o instanceof HTMLInputElement&&(o.focus(),e.props.searchExpand||(o.value="",o.value=e.props.inputText))}else document.removeEventListener("click",t),e.props.trackHover=!1,e.props.showEmptyMessage=!1}));const t=()=>{e.props.activeSelectionValue=void 0,e.props.expanded=!1}}(s),r(s)}function ft(t){void 0===t.props.closeOnSelect?t.props.closeOnSelect=!t.props.multiple:t.props.closeOnSelect=e.undefine(t.props.closeOnSelect),(t.props.multiple&&void 0===t.props.selectionAppearance||"truncate"===t.props.selectionAppearance)&&(t.props.selectionAppearance="truncate",t.props.formattedSelections=[]),t.props.multiple?t.props.selectionRemovable=!1:t.props.selectionRemovable=e.undefine(t.props.selectionRemovable)}function vt(e){var t,o;e.props.searchValue||null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_tag-wrapper_${e.props.selections.length-1}`))||void 0===o||o.focus()}function ht(t,o,n){var r,s,a;if(n.preventDefault(),t.props.trackHover=!1,t.props.expanded){const n=t.props.allOptions.reduce(((e,t)=>{var o;return(null===(o=null==t?void 0:t.attrs)||void 0===o?void 0:o.disabled)||e.push(Se(t)),e}),[]);(null===(r=t.store.hasNextPage)||void 0===r?void 0:r.value)&&n.push(Pe);let l=-1;t.props.activeValue&&(l=n.findIndex((o=>e.eq(o,t.props.activeValue)))),-1===l&&n.length?t.props.activeValue=n[0]:"ArrowDown"===o&&n.length>l+1?t.props.activeValue=n[l+1]:"ArrowUp"===o&&l>0?t.props.activeValue=n[l-1]:"ArrowUp"===o&&0===l&&(null===(a=null===(s=t.props.__root)||void 0===s?void 0:s.getElementById(`${t.props.id}_tag-wrapper_${t.props.selections.length-1}`))||void 0===a||a.focus(),t.props.expanded=!1)}else t.props.expanded||"ArrowDown"!==o||(t.props.expanded=!0)}function mt(e,t){var o,n,r;if(("taglist"===e.props.type||"tags"===e.props.selectionAppearance)&&e.props.inputStd.length&&!e.props.inputText){if("ArrowLeft"===t)return e.props.selections.length&&(null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_tag-wrapper_${e.props.selections.length-1}`))||void 0===n||n.focus(),e.props.selections[e.props.selections.length-1]?e.props.activeSelectionValue=Se(e.props.selections[e.props.selections.length-1]):e.props.activeSelectionValue=void 0),void(e.props.expanded=!1);"ArrowRight"===t&&(null===(r=document.getElementById(`${e.props.id}_tag-wrapper_0`))||void 0===r||r.focus(),e.props.selections[0]?e.props.activeSelectionValue=Se(e.props.selections[0]):e.props.activeSelectionValue=void 0),e.props.expanded=!1}}function gt(e){var t,o;e.props.expanded=!0,null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus()}function $t(t,o,n,r=!0){var s,a,l,i,p,d,c;const u=n.key;if(n.altKey){const r=ke(),s=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o)))),a=[...t.props.selections];"ArrowRight"===n.key?s<t.props.selections.length-1&&(a.splice(s,1),a.splice(s+1,0,o)):"ArrowLeft"===n.key&&s>0&&(a.splice(s,1),a.splice(s-1,0,o)),t.props.activeSelectionValue=Se(o),t.input([...a.map(Se)]),setTimeout((()=>{r instanceof HTMLElement&&r.focus()}),100)}else{const n=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===n)return;const f="ArrowRight"===u?n+1:n-1;if(f>=t.props.selections.length){if(!r)return t.props.expanded=!0,t.props.activeSelectionValue=void 0,void(null===(a=null===(s=t.props.__root)||void 0===s?void 0:s.getElementById(`${t.props.id}`))||void 0===a||a.focus());null===(i=null===(l=t.props.__root)||void 0===l?void 0:l.getElementById(`${t.props.id}`))||void 0===i||i.focus()}else if(f<0&&0===n)null===(d=null===(p=t.props.__root)||void 0===p?void 0:p.getElementById(`${t.props.id}`))||void 0===d||d.focus();else if(f<0)return;const v=null===(c=t.props.__root)||void 0===c?void 0:c.getElementById(`${t.props.id}_tag-wrapper_${f}`);v&&v.focus(),t.props.selections[f]?t.props.activeSelectionValue=Se(t.props.selections[f]):t.props.activeSelectionValue=void 0}}function bt(t,o,n){var r;if(!(n.currentTarget instanceof HTMLElement))return;if(t.props.searchValue)return;const s=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===s)return;const a=t.props.selections[s+1]?s+1:s-1,l=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}_tag-wrapper_${a}`);l&&l.focus(),t.props.userAction={type:"tagDelete"},He(t,o)}function yt(t,o){var n;if(o.preventDefault(),t.props.allowNewValues&&t.props.searchValue&&t.input(qe(t,t.props.searchValue)),t.props.expanded){if(t.props.activeValue===Pe)return void(null===(n=t.context)||void 0===n||n.handlers.loadMore(!0));const o=t.props.allOptions.find((o=>e.eq(Se(o),t.props.activeValue)));if(!o)return;We(t,o)}else t.props.expanded=!0}function xt(e){e.props.expanded&&(e.props.expanded=!1)}function wt(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":gt(e);break;case"ArrowRight":case"ArrowLeft":$t(e,t,o,!1);break;case"Delete":case"Backspace":bt(e,t,o)}}function _t(t,o,n){if(t.props.disabled)return;switch(n.key){case"ArrowUp":case"ArrowDown":!function(t,o,n){var r,s,a,l;n.preventDefault();const i=n.key,p=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===p)return;const d="ArrowDown"===i?p+1:p-1;if(d<0&&(null===(s=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}`))||void 0===s||s.focus()),d<0||d>=t.props.selections.length)return;const c=null===(a=t.props.__root)||void 0===a?void 0:a.getElementById(`${t.props.id}_selection_wrapper_${d}`);c&&c.focus(),t.props.activeSelectionValue=(null===(l=t.props.selections[d])||void 0===l?void 0:l.value)||void 0}(t,o,n);break;case"Enter":break;case"Tab":!function(t,o,n){var r,s,a,l;if(o){const i=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===i)return;const p=n.shiftKey?i-1:i+1;if(p>=t.props.selections.length)return;if(p<0)return void(null===(s=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}`))||void 0===s||s.focus());const d=null===(a=t.props.__root)||void 0===a?void 0:a.getElementById(`${t.props.id}_selection_wrapper_${p}`);d&&d.focus(),t.props.activeSelectionValue=(null===(l=t.props.selections[p])||void 0===l?void 0:l.value)||void 0}}(t,o,n);break;case"Delete":case"Backspace":!function(t,o){var n;if(o){const r=t.props.selections.findIndex((t=>e.eq(Se(t),Se(o))));if(-1===r)return;const s=t.props.selections[r+1]?r+1:r-1,a=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(`${t.props.id}_selection_wrapper_${s}`);a&&a.focus(),t.props.selections[s]?t.props.activeSelectionValue=Se(t.props.selections[s]):t.props.activeSelectionValue=void 0}o&&1!==t.props.selections.length||(t.props.userAction={type:"selectionDelete"}),He(t,o)}(t,o)}}function kt(e,t){if(e.props.disabled)return;if(!(t.currentTarget instanceof HTMLElement)||e.props.id!==t.currentTarget.id)return;const o=t.key;switch(o){case"Tab":!function(e){e.props.expanded&&(e.props.expanded=!1)}(e);break;case"ArrowUp":case"ArrowDown":ht(e,o,t);break;case"ArrowLeft":case"ArrowRight":mt(e,o);break;case"Enter":yt(e,t);break;case"Escape":xt(e);break;case"Delete":case"Backspace":vt(e);break;default:e.emit("unusedKeydown",t)}}function St(e,t){if(e.props.disabled)return;if(!(t.currentTarget instanceof HTMLElement)||e.props.id!==t.currentTarget.id)return;const o=t.key;switch(o){case"Tab":!function(e,t){var o,n,r;e.props.expanded=!1,e.props.multiple&&e.props.selections.length&&"autocomplete"===e.props.type&&"option"===e.props.selectionAppearance&&(t.preventDefault(),null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_selection_wrapper_0`))||void 0===n||n.focus(),e.props.activeSelectionValue=(null===(r=e.props.selections[0])||void 0===r?void 0:r.value)||void 0)}(e,t);break;case"ArrowUp":case"ArrowDown":ht(e,o,t);break;case"ArrowRight":case"ArrowLeft":mt(e,o);break;case"Enter":yt(e,t);break;case"Escape":xt(e);break;case"Delete":case"Backspace":vt(e)}}function Lt(t){t.props.alwaysLoadOnOpen=void 0!==t.props.alwaysLoadOnOpen&&e.undefine(t.props.alwaysLoadOnOpen),t.on("created",(()=>{t.context&&(t.context.handlers.click=It.bind(null,t),t.context.handlers.focus=Dt.bind(null,t),t.context.handlers.keydown=kt.bind(null,t),t.context.handlers.selectorTagKeydownHandler=e=>wt.bind(null,t,e))}))}function It(e,t){var o;if(t.stopPropagation(),0===t.detail)return;if(e.props.disabled)return;e.props.attrs.onClick&&e.props.attrs.onClick(t);const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);e.props.justOpened?e.props.justOpened=!1:e.props.expanded?e.props.expanded=!1:(n&&"mouse"!==t.pointerType?(e.props.mouseX=-1,e.props.mouseY=-1):(e.props.mouseX=t.clientX,e.props.mouseY=t.clientY),e.props.expanded=!0,null==n||n.focus())}function Dt(e){e.props.disabled||(e.props.attrs.onFocus&&e.props.attrs.onFocus(),e.props.skipOpen?e.props.skipOpen=!1:e.props.openOnFocus&&(e.props.justOpened=!0,e.props.expanded=!0))}function At(t){let o,n="";t.on("unusedKeydown",(({payload:r})=>{if(!r.isComposing&&1===[...r.key].length){if(!n&&" "===r.key)return void function(t,o){var n;if(o.preventDefault(),t.props.expanded){if(t.props.activeValue===Pe)return void(null===(n=t.context)||void 0===n||n.handlers.loadMore());const o=t.props.allOptions.find((o=>e.eq(Se(o),t.props.activeValue)));if(!o)return;We(t,o)}else t.props.expanded=!0}(t,r);t.props.expanded=!0,clearTimeout(o),n+=r.key;const s=t.props.allOptions.find((e=>e.label.toLowerCase().startsWith(n.toLowerCase())));s&&(t.props.activeValue=Se(s)),o=setTimeout((()=>{n=""}),400)}}))}function Ct(t){Tt(t),t.on("prop:selections",(()=>{t.props.skipFormatSelections=!1,Tt(t)})),c&&e.whenAvailable(`${t.props.id}_selections`,Ot.bind(null,t),t.props.__root)}function Tt(e){e.isCreated&&(e.props.selections.length&&e.props.lastVisibleIndex&&e.props.selections.length-e.props.lastVisibleIndex>1?e.props.truncationCount="+ "+(e.props.selections.length-e.props.lastVisibleIndex-1).toString():e.props.truncationCount=void 0,e.props.formattedSelections=e.props.selections.map(((t,o)=>e.props.lastVisibleIndex&&o===e.props.lastVisibleIndex&&0!==o?e.props.lastTruncatedElText&&o===e.props.selections.length-1?e.props.lastTruncatedElText:o===e.props.selections.length-1?t.label:t.label+"...":o===e.props.selections.length-1?t.label:t.label+", ")))}function Et(e){var t,o;if(!c||!e.context)return;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_selections`);if(!(n instanceof HTMLElement))return;const r=n.parentNode;if(!(r instanceof HTMLElement))return;let s=n.getBoundingClientRect().width;const a=.98*r.getBoundingClientRect().width,l=Array.prototype.slice.call(n.children),i=[...e.props.selections];if(s>a){const t=[];let n=0;for(let e=0;e<i.length;e++)t.push([i[e],l[e]]);for(let r=t.length-1;r>=0;r--){const l=t[r];if(!(l[1]instanceof HTMLElement))return;n+=l[1].getBoundingClientRect().width+parseFloat(window.getComputedStyle(l[1]).marginRight)+parseFloat(window.getComputedStyle(l[1]).marginLeft);const i=s-n;if(a>i){const t=l[0].label;e.props.skipFormatSelections=!0,l[1].textContent=t;let n=!1;for(let s=t.length;s>=0;s--){if(e.props.skipFormatSelections=!0,l[1].textContent=t.slice(0,s).trim()+"...",i+l[1].getBoundingClientRect().width<a){if(s<4){e.props.lastVisibleIndex=r-1,e.props.lastTruncatedElText=null;break}if(e.props.lastVisibleIndex=r,e.props.lastTruncatedElText&&l[1].textContent.slice(0,4)===e.props.lastTruncatedElText.slice(0,4))break;e.props.lastTruncatedElText=null===(o=l[1])||void 0===o?void 0:o.textContent;break}0===s&&(n=!0)}l[1].textContent=e.props.lastTruncatedElText&&!n&&0!==r?e.props.lastTruncatedElText:t,null===e.props.lastVisibleIndex&&(e.props.lastVisibleIndex=0===r?0:r-1,e.props.lastTruncatedElText=null),setTimeout((()=>{Tt(e)}));break}}}else e.props.lastTruncatedElText=null,e.props.lastVisibleIndex=null,Tt(e)}function Ot(e,t){const o=new ResizeObserver((()=>{e.props.selections&&0!==e.props.selections.length&&(e.props.skipFormatSelections?e.props.skipFormatSelections=!1:Et(e))})),n=new ResizeObserver((()=>{Et(e)}));o.observe(t),t.parentNode instanceof Element&&n.observe(t.parentNode)}const Mt={position:"fixed",top:0,bottom:0,right:0,left:0,pointerEvents:"none",zIndex:-1,overflowY:"auto","-webkit-overflow-scrolling":"auto"},Vt={position:"fixed",overflow:"hidden",height:"100%",width:"100%"},Ft={overflow:"hidden",height:"100%"},Pt={},Bt={};let Ht=0;function Rt(e){var t,o;if("undefined"==typeof window)return;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_popover`),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(!r||!n)return;const s=n.style.paddingTop,a=n.style.paddingBottom,l=n.style.paddingLeft;n.style.paddingTop="0",n.style.paddingBottom="0",n.style.paddingLeft="0";const i=r.getBoundingClientRect(),p=n.getBoundingClientRect(),d=Math.round(i.top-p.top)+"px",c=Math.round(i.left-p.left-5)+"px",u=Math.max(Math.round(Math.min(p.height-p.top,window.innerHeight)-(i.top+i.height)),0)+"px";n.style.paddingTop=s,n.style.paddingBottom=a,n.style.paddingLeft=l,e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,paddingTop:d,paddingLeft:c,paddingBottom:u},e.props.listboxStyles={...e.props.listboxStyles,minWidth:"overscroll"===e.props.behavior?`min(${i.width+"px"}, calc(100vw - 4em))`:i.width+"px",maxWidth:"calc(100vw - 4em)"}}function Nt(t,o){var n,r;let s=null;if(t.props.activeDescendant){const a=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(t.props.activeDescendant);if(!a)return s;t.props.ignoreScroll=!0;const l=null===(r=t.props.__root)||void 0===r?void 0:r.getElementById(`${t.props.id}_listbox`);if(!l)return s;const i=o.getBoundingClientRect(),p=l.getBoundingClientRect(),d=parseInt(getComputedStyle(o).paddingTop),c=parseInt(getComputedStyle(o).paddingBottom),u=a.offsetTop-d,f=Math.max(u-d,0),v=Math.max(o.scrollHeight-c-u-i.height,0),h=p.height-f-v;o.scrollTop=u;const m=()=>{o.scrollTop=v>0?v<d?o.scrollHeight:d:f<c?0:u-c},g=Math.min(150,p.height);f>0&&v>0||0===f&&0===v||h>g?o.scrollTop=u:m();o.clientHeight/2<o.scrollTop&&(s=t.props.options.filter((e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})).findIndex((o=>e.eq(t.value,Se(o))))),-1===s&&(s=null)}return s}function Kt(o){o.addProps(["behavior"]),o.on("created",(()=>{"overscroll"===o.props.behavior&&("function"==typeof o.props.optionsLoader&&t.error(300,[o]),o.props.dropdownWrapperStyles=e.clone(Mt),o.props.listboxStyles={display:"inline-block"},o.props.styleWrapper=Rt.bind(null,o),o.props.positionListBox=Nt.bind(null,o))})),o.on("prop:expanded",(({payload:e})=>{"overscroll"===o.props.behavior&&(e?function(){Ht=document.documentElement.scrollTop;for(const e in Vt)Bt[e]=document.documentElement.style[e],document.documentElement.style[e]=Vt[e];for(const e in Ft)Pt[e]=document.body.style[e],document.body.style[e]=Ft[e];document.body.scrollTop=Ht}():function(){for(const e in Vt)document.documentElement.style[e]=Bt[e];for(const e in Ft)document.body.style[e]=Pt[e];document.body.scrollTop=0,document.documentElement.scrollTop=Ht}())}))}function Wt(t){t.addProps(["multiLine"]),t.on("created",(()=>{c&&(t.props.multiLineHeight=void 0,e.whenAvailable(`${t.props.id}_selections`,qt.bind(null,t),t.props.__root))}))}function qt(e){var t;const o=new ResizeObserver((t=>{for(const o of t){const{height:t}=o.contentRect;e.props.selectionsHeight!==t&&(e.props.selectionsHeight=t),Ut(e,o.target)}})),n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_selections`);n&&o.observe(n)}function Ut(e,t){var o;const n=t.querySelectorAll(`[id^="${e.props.id}_tag-wrapper"`);let r,s=[];if("taglist"===e.props.type){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(!t)return;s=[t,...Array.from(n)]}else s=Array.from(n);if(!n)return;let a=!1;for(const t of s)if(void 0===r)r=t.getBoundingClientRect();else{const o=t.getBoundingClientRect();if(r.top>=o.top+o.height/5||r.top<=o.top-o.height/5){a=!0,e.props.multiLine=!0;break}}a||(e.props.multiLine=!1)}function zt(t){if(t.on("created",(()=>{t.context&&At(t)})),t.props.multiple||function(e){e.on("prop:selections",(({payload:t})=>{var o;e.props.firstSelectionLabel=(null===(o=t[0])||void 0===o?void 0:o.label)||"",e.props.option=t[0]}))}(t),"truncate"===t.props.selectionAppearance&&(t.props.lastVisibleIndex=null,Ct(t),t.on("prop:selections",(()=>{Ct(t)}))),"tags"===t.props.selectionAppearance&&Wt(t),t.props.multiple&&"tags"===t.props.selectionAppearance){function o(){return Array.isArray(t.value)?t.value:[]}function r(e,o){t.input(e)}t.on("created",(()=>{t.props.disabled&&(t.props.draggable=!1),e.whenAvailable(`${t.props.id}_selections`,(e=>{if(t.context&&e instanceof HTMLElement){const s={threshold:{horizontal:.25,vertical:0},plugins:[n.animations()],draggingClass:t.context.classes.dragging,dropZoneClass:t.context.classes.dropZone,disabled:!t.props.draggable,root:t.props.__root,touchDraggingClass:t.context.classes.touchDragging,touchDropZoneClass:t.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-tag")};n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s}),t.on("prop:disabled",(({payload:t})=>{s.disabled=t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})})),t.on("prop:draggable",(({payload:t})=>{s.disabled=!t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})}))}}),t.props.__root)}))}t.on("prop:expanded",(({payload:e})=>{e&&t.props.optionsLoader&&"function"==typeof t.props.optionsLoader&&(!t.props.options.length||t.props.alwaysLoadOnOpen)&&(t.props.options=[],Ve(t))})),"overscroll"===t.props.behavior&&Kt(t)}const Yt=(e,t)=>{let o=null,n=null,r=null;return function(...s){const a=this;o?(n=s,r=a):(e.apply(a,s),o=window.setTimeout((()=>{o=null,null!==n&&null!==r&&(e.apply(r,n),n=null,r=null)}),t))}};function jt(t){if(t.addProps(["popover","popoverOffset","usePopover","popoverCoordinates","popoverAncestorCoordinates"]),t.props.popover=e.undefine(t.props.popover)?"manual":void 0,"input"!==t.type||"overscroll"===t.props.behavior)return;let o=null,n=null,r=[],s=null;if(t.props.popoverOffset=e.undefine(t.props.popoverOffset)?parseInt(t.props.popoverOffset):0,!t.props.popover)return;if("undefined"==typeof document||!("popover"in HTMLElement.prototype))return void("undefined"!=typeof window&&console.warn('FormKit: Popover API is not supported in this browser — input panels will be rendered with fallback CSS positioning. This could result in inaccessible inputs due to parent containers using "overflow: hidden" or z-index conflicts.'));const a=()=>{t.props.invertPopover=!1,document.removeEventListener("resize",s),document.removeEventListener("scroll",s),r.forEach((e=>{e.removeEventListener("scroll",s)}))};function l(){const{x:e,y:r,width:s,height:a}=function(e,t){if(!e||!t)return{x:0,y:0};const{left:o,top:n,width:r,height:s}=t.getBoundingClientRect();return{x:o+window.scrollX,y:n+s+window.scrollY,width:r,height:s}}(o,n);t.props.popoverAncestorCoordinates={x:e,y:r,width:s,height:a},t.props.popoverCoordinates={x:e,y:r,width:s,height:0}}function i(e){o&&document.body.contains(o)&&(e?(null==o||o.showPopover(),setTimeout((()=>{t.props.popoverCoordinates.height=(null==o?void 0:o.offsetHeight)||0}),5)):o.matches(":popover-open")&&(o.hidePopover(),t.props.popoverCoordinates.height=0))}t.on("mounted",(()=>{t.context&&(t.props.usePopover=!0,t.props.popoverCoordinates={x:0,y:0,width:0,height:0},t.props.popoverAncestorCoordinates={x:0,y:0,width:0,height:0})})),t.on("destroyed",(()=>{a()})),t.on("prop:inputText",(()=>{t.context&&(l(),i(!0))})),t.on("prop:expanded",(({payload:p})=>{var d;t.context&&(!1===p?a():e.whenAvailable(`${null===(d=t.context)||void 0===d?void 0:d.id}_popover`,(()=>{if(!t.context)return;o=document.querySelector(`[id="${t.context.id}_popover"][popover]`)||document.querySelector(`[id="${t.context.id}_popover"] [popover]`),n||(n=function(e){if(!e)return null;let t=e.parentElement;for(;t&&"static"===window.getComputedStyle(t).position;)t=t.parentElement;return t}(o)),l(),i(p),s=Yt((()=>{t.context&&(l(),i(p))}),10),document.addEventListener("resize",s),document.addEventListener("scroll",s),r=[];let e=null==o?void 0:o.parentElement;for(;e;)e.scrollHeight>e.clientHeight&&r.push(e),e=e.parentElement;r.forEach((e=>{e.addEventListener("scroll",s)}))})))}))}const Zt={schema:/* #__PURE__ */j(/* #__PURE__ */Z(/* #__PURE__ */J("$label"),/* #__PURE__ */G(/* #__PURE__ */X("prefix"),/* #__PURE__ */Q(),/* #__PURE__ */re(/* #__PURE__ */U("$inputStd.length === 0 && $state.loading !== true",/* #__PURE__ */le('$placeholder || "placeholder"'),/* #__PURE__ */U("$multiple !== true",/* #__PURE__ */se(/* #__PURE__ */U("$state.loading && $selections.length === 0",/* #__PURE__ */ie("$ui.isLoading.value"),/* #__PURE__ */ae(/* #__PURE__ */pe("$option.label")))),/* #__PURE__ */U('$multiple && $selectionAppearance === "truncate"',/* #__PURE__ */ce(/* #__PURE__ */ue(/* #__PURE__ */U("$state.loading && $selections.length === 0",/* #__PURE__ */ie("$ui.isLoading.value"),/* #__PURE__ */ve()))),/* #__PURE__ */U('$multiple && $selectionAppearance === "tags"',/* #__PURE__ */$e(/* #__PURE__ */be(/* #__PURE__ */U("$state.loading && $isLoadingOption !== true && $selections.length === 0",/* #__PURE__ */ie("$ui.isLoading.value"),/* #__PURE__ */he(/* #__PURE__ */me(/* #__PURE__ */U("$state.loading && $fns.hasOptionLoaderValue($option) || $option.label === undefined",/* #__PURE__ */ye("$ui.isLoading.value"),/* #__PURE__ */ge("$option.label")),/* #__PURE__ */de(/* #__PURE__ */X("close"))))))))))),/* #__PURE__ */U("$truncationCount && $state.loading !== true",/* #__PURE__ */fe("$truncationCount")),/* #__PURE__ */U("$state.loading",/* #__PURE__ */X("loader")),/* #__PURE__ */U("$inputStd.length !== 0 && $selectionRemovable",/* #__PURE__ */de(/* #__PURE__ */X("close")),/* #__PURE__ */X("select"))),/* #__PURE__ */xe(),/* #__PURE__ */ee(),/* #__PURE__ */X("suffix"))),/* #__PURE__ */te("$help"),/* #__PURE__ */oe(/* #__PURE__ */ne("$message.value"))),type:"input",family:"dropdown",props:[],features:[
2
2
  /* #__PURE__ */o.defaultIcon("select","select"),
3
3
  /* #__PURE__ */o.defaultIcon("close","close"),
4
4
  /* #__PURE__ */o.defaultIcon("selected","check"),
@@ -16,7 +16,7 @@
16
16
  /* #__PURE__ */o.defaultIcon("remove","trash"),
17
17
  /* #__PURE__ */o.defaultIcon("add","add"),
18
18
  /* #__PURE__ */o.defaultIcon("moveUp","arrowUp"),
19
- /* #__PURE__ */o.defaultIcon("moveDown","arrowDown")]},Zo=new WeakMap;function Go(e,t){const o={onItems:[],offItems:[]},n=t||Number(e.value||0);for(let t=0;t<e.props.max;t++)if(t<n&&t+1>=n){const r=e.props.rightToLeft?100-100*(n-t):100*(n-t);o.onItems.push(r+"%"),o.offItems.push(100-r+"%")}else t<n?(o.offItems.push("0%"),o.onItems.push("100%")):t>=n&&(o.offItems.push("100%"),o.onItems.push("0%"));e.props.itemsToPercentages=o}function Xo(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function Jo(e,t){const{x:o,y:n}=ln(t);let r=document.elementFromPoint(o,n);const s=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));let a=!0;for(;r&&a;){if(s.includes(r)){a=!1;break}r=r.parentNode}if(!a){const t=s.indexOf(r);if(1===e.props.step)return void e.input(t+1,!1)}}function Qo(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?pn(e,t,o):e.input(t+1,!1))}function en(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,Go(e);const o=Zo.get(e);o&&(o.abort(),Zo.delete(e))}function tn(e,t,o){if(e.props.hoverHighlight||e.props.disabled)return;o.preventDefault(),e.props.hoverHighlight=!0,e.props.dragStarted=!0;const n=new AbortController;document.addEventListener("mouseup",(t=>en(e,t)),{signal:n.signal}),Zo.set(e,n),1===e.props.step?e.input(t+1,!1):pn(e,t,o)}function on(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=e.value?dn(e.value+1*e.props.step,e.props.step):e.props.min+1*e.props.step,n=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(e.value?`#${e.props.id}_inner input[value="${t}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,n&&n instanceof HTMLInputElement&&n.focus(),e.props.preventFocus=!1,e.input(Number(t))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=e.value?dn(e.value-1*e.props.step,e.props.step):e.props.max,o=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${t}"]`);e.props.preventFocus=!0,o&&o instanceof HTMLInputElement&&o.focus(),e.props.preventFocus=!0,e.input(Number(t)),e.props.preventFocus=!1}}function nn(e,t){if(!e.props.preventFocus)if(e.props.preventFocus=!0,setTimeout((()=>{e.props.preventFocus=!1}),50),t.relatedTarget instanceof HTMLElement&&t.relatedTarget.id===e.props.id+"_items_wrapper")e.props.arrow>0?setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+"_0_0"))||void 0===o||o.focus()})):e.props.arrow<0&&setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+`_${e.props.max-1}_${e.props.stepsPerValue-1}`))||void 0===o||o.focus()}));else if(t.target instanceof HTMLInputElement){if(Number(t.target.value)===e.props.step&&e.value===e.props.max||Number(t.target.value)===e.props.max&&e.value===e.props.step){const t=document.getElementById(e.props.id+"_items_wrapper");return null==t||t.focus(),void e.input(0)}e.input(Number(t.target.value))}}function rn(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(Go(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):pn(e,t,o,!!e.props.dragStarted)))}function sn(e){Go(e)}function an(e,t,o){if(!e.props.disabled&&"touchstart"!==o.type&&(o.preventDefault(),(0!==o.clientX||0!==o.clientY)&&o.currentTarget instanceof HTMLElement))return 1===e.props.step?e.props.deselect&&Number(e.value)===t+1?void e.input(0):void e.input(t+1):void pn(e,t,o)}function ln(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function pn(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r,y:s}=ln(o),a=o.currentTarget.getBoundingClientRect();let l=dn((r-a.x)/a.width+t,e.props.step);l=l>e.props.min?l:e.props.min,l=l<e.props.max?l:e.props.max,!e.props.deselect||l!==Number(e.value)||e.props.dragStarted?n?e.input(l,!1):Go(e,l):e.input(0)}function dn(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const cn=/* #__PURE__ */K("rt"),{outer:un,wrapper:fn,inner:vn,label:hn,prefix:mn,suffix:gn,help:$n,messages:bn,message:yn,icon:xn}=/* #__PURE__ */W(cn),wn=cn("itemsWrapper",(()=>({$el:"span",attrs:{style:{"flex-direction":'$rightToLeft && "row-reverse" || undefined'},tabindex:"$value !== undefined && $value !== 0 && '-1' || '0'",id:"$id + _items_wrapper",onKeydown:"$handlers.handleWrapperKeydown","data-disabled":"$disabled",onBlur:"$handlers.handleWrapperBlur",onMouseleave:"$hoverHighlight && $handlers.handleMouseleave"}}))),_n=cn("ratingItem",(()=>({for:["item","index","$max"],$el:"span",attrs:{id:'$id + "_item_" + $index',onClick:"$handlers.handleItemClick($item)",draggable:"$hoverHighlight !== true && && $disabled !== true && true",onMousemove:"$handlers.handleMousemove($item)",onDragstart:"$handlers.handleDragstart($item)",onDragend:"$handlers.handleDragend",onTouchstartPassive:"$handlers.handleTouchstart($item)",onTouchmovePassive:"$handlers.handleTouchmove"}}))),kn=cn("template",(()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null}))),Sn=cn("itemLabel",(()=>({$el:"label",attrs:{id:'$id + "_label_" + $index + "_" + $stepIndex',for:'$id + "_" + $index + "_" + $stepIndex',"data-checked":'$value === $fns.getValue($item, $increment) && "true" || "false"',style:{width:'$fns.showLabel($fns.getValue($item, $increment), $stepIndex, $item) && "100%" || "0%"'}}}))),Ln=cn("itemLabelInner",(()=>({$el:"span",children:"$fns.getValue($item, $increment)"}))),In=cn("input",(()=>({$el:"input",attrs:{type:"radio",value:"$fns.getValue($item, $increment)",id:'$id + "_" + $index + "_" + $stepIndex',onFocus:"$handlers.handleFocus",tabindex:'$value === $fns.getValue($item, $increment) && "0" || "-1"',disabled:"$disabled",name:"$id","data-value":"$fns.getValue($item, $increment)",checked:"$value === $fns.getValue($item, $increment) && true",onKeydown:"$handlers.handleKeydown($fns.getValue($item, $increment))"}}))),Dn=cn("onItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}}))),An=cn("offItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item, false)",display:"flex","flex-direction":"row-reverse",position:"absolute",zIndex:"$offItemStyles && 100",overflow:"hidden",top:"0",right:"0"}}}))),Cn=cn("onItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$onColor"}}}))),Tn=cn("offItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$offColor"}}}))),En=()=>U("$slots.onItem",(()=>()=>"$slots.onItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),On=()=>U("$slots.offItem",(()=>()=>"$slots.offItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),Mn={schema:/* #__PURE__ */un(/* #__PURE__ */fn(/* #__PURE__ */hn("$label"),/* #__PURE__ */vn(/* #__PURE__ */xn("prefix"),/* #__PURE__ */mn(),/* #__PURE__ */wn(/* #__PURE__ */_n(/* #__PURE__ */kn(/* #__PURE__ */Sn(/* #__PURE__ */Dn(/* #__PURE__ */Cn(/* #__PURE__ */En())),/* #__PURE__ */An(/* #__PURE__ */Tn(/* #__PURE__ */On())),/* #__PURE__ */Ln()),/* #__PURE__ */In()))),/* #__PURE__ */gn(),/* #__PURE__ */xn("suffix"))),/* #__PURE__ */$n("$help"),/* #__PURE__ */bn(/* #__PURE__ */yn("$message.value"))),type:"input",props:[],features:[function(t){function o(e){setTimeout((()=>{const t=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));for(let e=0;e<t.length;e++){const o=t[e].querySelectorAll(".formkit-onItemWrapper"),n=t[e].querySelectorAll(".formkit-offItemWrapper");for(let n=0;n<o.length;n++)o[n].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`;for(let o=0;o<n.length;o++)n[o].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`}}))}t.addProps(["max","step","stepsPerValue","itemsToPercentages","rightToLeft","onItemStyles","offItemStyles","hoverHighlight","deselect","disabled","wrapperWidth","onColor","offColor"]),!1!==t.props.hoverHighlight&&"false"!==t.props.hoverHighlight&&(t.props.hoverHighlight=!0),t.props.deselect=e.undefine(t.props.deselect),t.props.max=Number(t.props.max)||5,t.props.min=Number(t.props.min)||0,t.props.step=Number(t.props.step)||1,t.props.numberOfSteps=t.props.max/t.props.step,t.props.lastIndex=1/t.props.step-1,t.props.itemsToPercentages={},"disabled"in t.props&&(t.props.disabled=e.undefine(t.props.disabled)),t.props.rightToLeft?(t.props.onItemStyles=void 0,t.props.offItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%",zIndex:100}):t.props.onItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%"},t.props.stepsPerValue=1/t.props.step,t.hook.input(((e,o)=>{if(null===e||""===e||isNaN(e))return o(e);const n=Number(e),r=Number(t.props.min),s=Number(t.props.max);return n>s?o(s):t.props.min&&n<=r?o(r):o(n)})),t.on("commit",(({payload:e})=>{const o=Number(e||0);Go(t,o)})),t.on("created",(()=>{t.context&&(e.whenAvailable(`${t.props.id}_items_wrapper`,(()=>{o(t),function(e){var t;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_items_wrapper`);if(!n)return;new ResizeObserver((()=>{o(e)})).observe(n)}(t),setTimeout((()=>o(t)),100)}),t.props.__root),t.context.fns.getPercentage=(e,t,o=!0)=>(o?e.onItems:e.offItems)[t],t.context.fns.getValue=(e,o)=>e+Number((o*t.props.step+t.props.step).toFixed(1)),t.context.fns.showLabel=(e,o)=>{const n=Number(t.value||0);return 0===n&&0===o||n&&e===n||e>n&&0===o||n>e&&o===t.props.lastIndex},t.context.handlers.handleFocus=e=>nn.call(null,t,e),t.context.handlers.handleWrapperKeydown=e=>on.call(null,t,e),t.context.handlers.handleWrapperBlur=e=>Xo.call(null,t,e),t.context.handlers.handleItemClick=e=>o=>an.call(null,t,e,o),t.context.handlers.handleMousemove=e=>o=>rn.call(null,t,e,o),t.context.handlers.handleMouseleave=()=>sn.call(null,t),t.context.handlers.handleDragstart=e=>o=>tn.call(null,t,e,o),t.context.handlers.handleMouseup=e=>en.call(null,t,e),t.context.handlers.handleTouchstart=e=>o=>Qo.call(null,t,e,o),t.context.handlers.handleTouchmove=e=>Jo.call(null,t,e),t.context.handlers.handleKeydown=e=>o=>function(e,t,o){const n=Number(e.value);e.props.deselect&&" "===o.key&&n===t?e.input(0):" "===o.key&&e.input(t)}(t,e,o))}))},/* #__PURE__ */o.defaultIcon("rating","star")]},Vn=/* #__PURE__ */K("ac"),{outer:Fn,wrapper:Pn,inner:Bn,icon:Hn,label:Rn,prefix:Nn,suffix:Kn,help:Wn,messages:qn,message:Un}=/* #__PURE__ */W(Vn),zn=Vn("input",(()=>({$el:"input",bind:"$attrs",attrs:{id:"$id",type:"text",onClick:"$handlers.click",onBlur:"$handlers.blur",onKeydown:"$handlers.keydown",onInput:"$handlers.input",onFocus:"$handlers.focus",value:"$inputText || undefined",name:"$node.name",placeholder:"$state.loading && $ui.isLoading.value || $placeholder || undefined",tabindex:'$disabled && "-1" || 0',role:"combobox",autocomplete:'$attrs.autocomplete || "off"',autocapitalize:"none",readonly:"$attrs.readonly || $state.loading || $multiple && $max && $value && $value.length >= $max && $hasHighlightedRange !== true || undefined","data-selection-appearance":"$selectionAppearance",disabled:"$disabled || $disabledInternally || undefined",onTouchmovePassive:"$handlers.touchmove",onTouchstartPassive:"$handlers.touchmove",onTouchend:"$handlers.touchend","aria-autocomplete":"list","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy","aria-activedescendant":"$expanded && $activeDescendant || undefined","aria-required":"$state.required || undefined"}}))),Yn=Vn("listboxButton",(()=>({$el:"div",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',role:"button","aria-label":"$expanded && $ui.close.value || $ui.open.value",onClick:"$handlers.toggleListbox",onKeydown:"$handlers.toggleListboxKeydown",tabindex:'$disabled && "-1" || 0',"aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-disabled":"$disabled || $state.loading || undefined","data-disabled":"$disabled || $disabledInternally || undefined"}}))),jn=Vn("selectionWrapper",(()=>({for:["option","index","$selections"],$el:"div",attrs:{id:'$id + "_selection_wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:'$disabled && "-1" || 0',onKeydown:"$handlers.selectionKeydown && $handlers.selectionKeydown($multiple && $option || undefined)",onClick:"$handlers.selectionClick && $handlers.selectionClick($multiple && $option || undefined)",onFocus:"$handlers.selectionFocus && $handlers.selectionFocus($multiple && $option || undefined)",onBlur:"$handlers.selectionBlur && $handlers.selectionBlur($multiple && $option || undefined)","data-is-selection":"true","data-active-selection":"$fns.isActiveSelection && $fns.isActiveSelection($activeSelectionValue, $option)"}}))),Zn=Vn("selection",(()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}}))),Gn=Vn("selections",(()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}}))),Xn=Vn("removeSelection",(()=>({$el:"button",attrs:{id:'$selectionAppearance === "option" && $multiple && $id + "_remove_selection_" + $index || $id + "_remove_selection"',tabindex:"0",title:"$ui.remove.value",type:"button","aria-label":"$ui.remove.value",onClick:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)",onTouchend:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)","aria-controls":"$id"}}))),Jn=Vn("optionLoading","span"),Qn=Vn("option",(()=>({$el:"div",if:"$value !== undefined"}))),er=/* #__PURE__ */z(Vn);function tr(t){"option"!==t.props.selectionAppearance||t.props.multiple||!1===t.props.selectionRemovable||"false"===t.props.selectionRemovable||(t.props.selectionRemovable=!0),t.props.multiple||(t.props.clearSearchOnOpen=e.undefine(t.props.clearSearchOnOpen)),t.props.selectionRemovable=e.undefine(t.props.selectionRemovable),t.props.openOnClick=e.undefine(t.props.openOnClick),"option"!==t.props.selectionAppearance||t.props.multiple||(t.props.isSingleOption=!0),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),void 0===t.props.selectionAppearance&&(t.props.selectionAppearance="text-input"),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),t.props.closeOnSelect?t.props.resetSearchOnCommit=!1:void 0===t.props.resetSearchOnCommit&&(t.props.resetSearchOnCommit=t.props.multiple),t.props.allowNewValues=e.undefine(t.props.allowNewValues)}function or(t){t.addProps(["inputText","selectionAppearance","searchValue","openOnClick","filteredOptions","search","debounce","showInput","visibilityStyles","selectionStyles","multiple","filter","hasHighlightedRange","clearOnClick","debounce"]),void 0===t.props.debounce?t.props.debounce=200:t.props.debounce=parseInt(t.props.debounce),t.props.nonceKey="searchValue",t.props.searchValue="",t.props.inputText="",t.props.filterOptions=De.bind(null,t),t.props.reloadOnCommit=e.undefine(t.props.reloadOnCommit),void 0===t.props.alwaysLoadOnOpen?t.props.alwaysLoadOnOpen=!0:t.props.alwaysLoadOnOpen=e.undefine(t.props.alwaysLoadOnOpen),"function"!=typeof t.props.filter&&(t.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase())),t.on("created",(()=>{t.context&&c&&(t.context.handlers.focus=sr.bind(null,t),t.context.handlers.input=nr.bind(null,t),t.context.handlers.focus=sr.bind(null,t),t.context.handlers.click=rr.bind(null,t),t.context.handlers.toggleListbox=ar.bind(null,t),t.context.handlers.toggleListboxKeydown=lr.bind(null,t),t.context.handlers.keydown=St.bind(null,t),t.context.handlers.selectionKeydown=e=>o=>_t(t,e,o),t.context.handlers.searchInputTagKeydown=e=>o=>function(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":gt(e);break;case"ArrowRight":case"ArrowLeft":$t(e,t,o);break;case"Delete":case"Backspace":bt(e,t,o)}}(t,e,o),t.on("prop:options",(({payload:e})=>{if((0===t.props.initialOptions.length&&"function"!=typeof t.props.optionsLoader||!t.props.searchValue&&e.length)&&(t.props.initialOptions=[...e]),t.props.selections&&t.props.selections.length&&e.length)for(let o=0;o<t.props.selections.length;o++){const n=t.props.selections[o],r=e.find((e=>Se(e)===n.value));r&&(t.props.selections[o]=r)}})))})),t.on("prop:expanded",(({payload:e})=>{e||Le.delete(t)}))}function nr(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&De(e,e.props.searchValue,!0)}function rr(e,t){t.stopPropagation(),e.props.disabled||e.props.disabledInternally||(e.props.attrs.onClick&&e.props.attrs.onClick(t),(!e.props.expanded&&e.props.openOnClick||e.props.openOnFocus)&&(e.props.expanded=!0))}function sr(e){e.props.disabled||e.props.disabledInternally||(e.props.attrs.onFocus&&e.props.attrs.onFocus(),e.props.activeSelectionValue=void 0,e.props.skipOpen?e.props.skipOpen=!1:e.props.openOnFocus&&(e.props.expanded=!0))}function ar(e){var t,o,n;e.props.disabled||e.props.disabledInternally||(null===(t=e.context)||void 0===t?void 0:t.state.loading)||(e.props.expanded=!e.props.expanded,e.props.openOnFocus||null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`))||void 0===n||n.focus())}function lr(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),ar(e))}const ir=new WeakMap,pr="undefined"!=typeof window,dr=new WeakMap;let cr=!1;function ur(t){t.props.searchValue=null,t.on("commit",(()=>{t.props.searchValue=null,t.props.highlightedRange||fr(t)})),t.on("created",(()=>{if(!t.context||!pr)return;t.on("handleSearchInput",(({payload:e})=>{""===e?(t.props.searchValue=null,t.input([])):e&&0===t.props.inputStd.length?t.props.searchValue=e:e&&t.props.inputStd.length>0&&(t.props.searchValue=function(e){var t;const o=hr(e);if(e.props.highlightedRange){const[t,n]=vr(e,o);return e.props.inputText.slice(t,n)}return e.props.inputText.slice((null===(t=o[o.length-1])||void 0===t?void 0:t.end)+2)}(t)),!t.props.expanded&&e?t.props.expanded=!0:!e&&t.props.expanded&&(t.props.expanded=!1)})),function(t){e.whenAvailable(`${t.props.id}`,(e=>{e instanceof HTMLInputElement&&dr.set(e,t)}),t.props.__root),pr&&!cr&&(cr=!0,document.addEventListener("selectionchange",(()=>{const e=ke();if(e instanceof HTMLInputElement&&dr.has(e)){const t=dr.get(e);t&&function(e){clearTimeout(ir.get(e)),ir.set(e,setTimeout((()=>{var t,o,n,r;const s=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(s instanceof HTMLInputElement){const t=hr(e),a=t.findIndex((e=>null!==s.selectionStart?s.selectionStart>=e.start&&s.selectionStart<=e.end:null!==s.selectionEnd&&(s.selectionEnd>=e.start&&s.selectionEnd<=e.end))),l=null===(o=t[t.length-1])||void 0===o?void 0:o.end;if(0===s.selectionStart&&s.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))return;if("string"==typeof e.props.searchValue&&e.props.highlightedRange){if(t.length){const o=e.props.highlightedRange,[n,r]=vr(e,t);if(null!==s.selectionEnd&&(s.selectionEnd<n||s.selectionEnd>r)){const t=o.end-o.start-(r-n),a=s.selectionEnd;e.props.inputText=e.props.option.label,e.props.highlightedRange=void 0,e.props.searchValue=null,s.value=e.props.inputText,s.selectionStart=s.selectionEnd=a+(a>n?t:0)}}}else if(a>=0&&null!==s.selectionStart&&(l!==(null===(r=e.props.inputText)||void 0===r?void 0:r.length)||s.selectionStart<l)){const o=t[a],n=e.props.inputText.substr(0,l),r=o.start+(o.index>0?1:0),i=o.end+(t.length-1>o.index?-1:0);n!==e.props.inputText&&(e.props.inputText=n,s.value=n),e.props.highlightedRange=o,s.selectionStart=r,s.selectionEnd=i}else e.props.highlightedRange=void 0,fr(e);if(null!==s.selectionStart&&s.selectionStart>=l&&", "!==e.props.inputText.substring(l,l+2)){let t=e.props.inputText.substring(0,l);t=e.props.multiple&&e.props.max&&Array.isArray(e.props.inputStd)&&e.props.inputStd.length>=e.props.max?t:`${t},`,e.props.inputText=`${t} ${e.props.inputText.substring(l).replace(/^[,\s]{1,2}/,"")}`}}}),5))}(t)}})))}(t);const n=t.context.handlers.keydown;t.context.handlers.keydown=e=>{n(e),function(e,t){var n,r,s,a;if(["ArrowRight","ArrowLeft"].includes(t.key)&&t.target instanceof HTMLInputElement&&null!==t.target.selectionEnd&&null!==t.target.selectionStart){if(0===t.target.selectionStart&&t.target.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))"ArrowLeft"===t.key?o(0):o(-1);else if(!e.props.searchValue){e.props.searchValue=null;const o=hr(e),n=null===(r=o[o.length-1])||void 0===r?void 0:r.end;t.target.selectionStart<n&&(t.target.selectionStart=Math.max(0,"ArrowLeft"===t.key?t.target.selectionStart-2:t.target.selectionEnd+2))}}else if(["Delete","Backspace"].includes(t.key))e.props.highlightedRange&&!e.props.searchValue?(He(e,e.props.highlightedRange.option),0===e.props.inputStd.length&&(e.props.highlightedRange=void 0)):t.target instanceof HTMLInputElement&&(e.props.searchValue=null,o(-1,!0)&&t.preventDefault());else if(t.target instanceof HTMLInputElement&&0===t.target.selectionStart&&t.target.selectionEnd===(null===(s=e.props.inputText)||void 0===s?void 0:s.length)&&(null===(a=e.props.inputText)||void 0===a?void 0:a.length)&&0===e.props.selections.length)t.preventDefault();else if("Tab"===t.key)return;"ArrowLeft"===t.key&&o(-1,!0)&&t.preventDefault()}(t,e)};const r=t.context.handlers.focus;t.context.handlers.focus=e=>{r(t,e);const o=new Event("selectionchange");document.dispatchEvent(o)},t.on("blur",(()=>{t.props.selections.length?(t.props.inputText=t.props.selections.map((e=>e.label)).join(", "),t.props.searchValue=null):t.props.selections.length||(t.props.inputText="",t.props.searchValue="")}))})),t.on("prop:expanded",(({payload:e})=>{e||t.props.inputStd.length?e&&(t.props.options.length&&!t.props.alwaysLoadOnOpen||(t.props.options=[],De(t,t.props.searchValue))):(t.props.searchValue="",t.props.inputText="")})),t.on("prop:selections",(()=>{var e;const o=[...t.props.selections].map((e=>e.label)).join(", ");let n="";if(pr&&t.isCreated){const o=null===(e=t.props.__root)||void 0===e?void 0:e.getElementById(`${t.props.id}`);if(ke()===o&&Array.isArray(t._value)&&t._value.length){if(t.props.max&&t._value.length>=Number(t.props.max))return;n=", "}}t.props.inputText=`${o}${n}`,t.props.reloadOnCommit&&(t.props.searchValue="",De(t,t.props.searchValue))}));const o=(e,o=!1)=>{var n,r;const s=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(`${t.props.id}`);if(!(s instanceof HTMLInputElement))return!1;const a=hr(t),l=e>=0?e:a.length-1;if(void 0===a[l])return!1;const i=null===(r=a[l])||void 0===r?void 0:r.end;return null!==s.selectionStart&&(!o||s.selectionStart>=i&&s.selectionStart<=i+2)&&(s.selectionStart=a[l].start+(l>0?1:0),s.selectionEnd=a[l].end+(l<a.length-1?-1:0),!0)};let n;t.on("selectRange",(({payload:e})=>o(...e))),t.on("prop:highlightedRange",(({payload:e})=>{t.props.hasHighlightedRange=!!e,e&&t.props.expanded&&n!==e.option&&(n=e.option,Ne(t))}))}function fr(e){var t;if(!pr)return;const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);o&&o.scrollTo({left:o.scrollWidth,behavior:"smooth"})}function vr(e,t){var o;const n=e.props.highlightedRange,r=n.index,s=n.start+(r?1:0),a=t.length-1>r?t[t.length-1].end-t[r+1].start:0;return[s,(null===(o=e.props.inputText)||void 0===o?void 0:o.length)-a+(t.length-1>n.index?-1:0)]}function hr(e){const t=Be(e);return Array.isArray(t)&&t.length?t.reduce(((e,o,n)=>{var r;const s=(null===(r=e[n-1])||void 0===r?void 0:r.end)||0;let a=0;return t.length-1!==n&&a++,0!==n&&a++,e.push({option:o,index:n,start:s,end:s+o.label.length+a}),e}),[]):[]}function mr(e){!function(e){e.on("prop:expanded",(({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0))):(e.props.searchValue="",e.props.inputText="")}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{t&&!e.props.expanded?(e.props.searchExpand=!0,e.props.expanded=!0):!t&&e.props.expanded&&(e.props.expanded=!1),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(()=>{e.isCreated&&(e.props.inputText="",e.props.searchValue="",e.props.optionRemoved||e.props.reloadOnCommit&&De(e,e.props.searchValue,!0))}))}(e)}function gr(e){!function(e){function t(e){0===e.props.inputStd.length?(e.props.inputText="",e.props.searchValue=""):(e.props.inputText=e.props.selections[0].label,e.props.searchValue=e.props.selections[0].label)}function o(e){e.props.clearSearchOnOpen&&!e.props.searchExpand&&(e.props.inputText="",e.props.searchValue=""),e.props.searchValue=e.props.inputText,e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0)),e.props.searchExpand&&(e.props.searchExpand=!1)}e.on("prop:expanded",(({payload:n})=>{n?o(e):t(e)}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{""===t?(0===e.props.inputStd.length&&(e.props.expanded=!1),e.input(void 0)):t&&!e.props.expanded&&(e.props.searchExpand=!0,e.props.expanded=!0),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(({payload:t})=>{e.props.inputText=t.length?t[0].label:"",e.props.searchValue=t.length?t[0].label:"",e.isCreated&&e.props.expanded&&0===t.length&&De(e,e.props.searchValue,!0)}))}(e)}function $r(t){if(t.props.multiple)if(t.props.multiple&&"option"===t.props.selectionAppearance){function o(){return Array.isArray(t.value)?t.value:[]}function r(e){t.input(e)}mr(t),t.on("created",(()=>{t.props.disabled&&(t.props.draggable=!1),e.whenAvailable(`${t.props.id}_selections`,(e=>{if(e instanceof HTMLElement&&t.context){const s={draggingClass:t.context.classes.dragging,dropZoneClass:t.context.classes.dropZone,root:t.props.__root,disabled:!t.props.draggable,plugins:[n.animations()],touchDraggingClass:t.context.classes.touchDragging,touchDropZoneClass:t.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-selection")};n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s}),t.on("prop:disabled",(({payload:t})=>{s.disabled=t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})})),t.on("prop:draggable",(({payload:t})=>{s.disabled=!t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})}))}}),t.props.__root)}))}else t.props.multiple&&"text-input"===t.props.selectionAppearance&&ur(t);else gr(t)}const br={schema:/* #__PURE__ */Fn(/* #__PURE__ */Pn(/* #__PURE__ */Rn("$label"),/* #__PURE__ */Bn(/* #__PURE__ */Hn("prefix"),/* #__PURE__ */Nn(),/* #__PURE__ */zn(),/* #__PURE__ */U("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */U("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U("$selectionRemovable && $isSingleOption",/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */U("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")),/* #__PURE__ */U('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */Yn(/* #__PURE__ */Hn("select")))),/* #__PURE__ */U("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */Yn(/* #__PURE__ */Hn("select"))),/* #__PURE__ */er(),/* #__PURE__ */Kn(),/* #__PURE__ */Hn("suffix")),/* #__PURE__ */U("$multiple && $selectionAppearance === option",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading && $isLoadingOption",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */Wn("$help"),/* #__PURE__ */qn(/* #__PURE__ */Un("$message.value"))),type:"input",family:"dropdown",props:[],features:[
19
+ /* #__PURE__ */o.defaultIcon("moveDown","arrowDown")]},Zo=new WeakMap;function Go(e,t){const o={onItems:[],offItems:[]},n=t||Number(e.value||0);for(let t=0;t<e.props.max;t++)if(t<n&&t+1>=n){const r=e.props.rightToLeft?100-100*(n-t):100*(n-t);o.onItems.push(r+"%"),o.offItems.push(100-r+"%")}else t<n?(o.offItems.push("0%"),o.onItems.push("100%")):t>=n&&(o.offItems.push("100%"),o.onItems.push("0%"));e.props.itemsToPercentages=o}function Xo(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function Jo(e,t){const{x:o,y:n}=ln(t);let r=document.elementFromPoint(o,n);const s=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));let a=!0;for(;r&&a;){if(s.includes(r)){a=!1;break}r=r.parentNode}if(!a){const t=s.indexOf(r);if(1===e.props.step)return void e.input(t+1,!1)}}function Qo(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?pn(e,t,o):e.input(t+1,!1))}function en(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,Go(e);const o=Zo.get(e);o&&(o.abort(),Zo.delete(e))}function tn(e,t,o){if(e.props.hoverHighlight||e.props.disabled)return;o.preventDefault(),e.props.hoverHighlight=!0,e.props.dragStarted=!0;const n=new AbortController;document.addEventListener("mouseup",(t=>en(e,t)),{signal:n.signal}),Zo.set(e,n),1===e.props.step?e.input(t+1,!1):pn(e,t,o)}function on(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=e.value?dn(e.value+1*e.props.step,e.props.step):e.props.min+1*e.props.step,n=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(e.value?`#${e.props.id}_inner input[value="${t}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,n&&n instanceof HTMLInputElement&&n.focus(),e.props.preventFocus=!1,e.input(Number(t))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=e.value?dn(e.value-1*e.props.step,e.props.step):e.props.max,o=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${t}"]`);e.props.preventFocus=!0,o&&o instanceof HTMLInputElement&&o.focus(),e.props.preventFocus=!0,e.input(Number(t)),e.props.preventFocus=!1}}function nn(e,t){if(!e.props.preventFocus)if(e.props.preventFocus=!0,setTimeout((()=>{e.props.preventFocus=!1}),50),t.relatedTarget instanceof HTMLElement&&t.relatedTarget.id===e.props.id+"_items_wrapper")e.props.arrow>0?setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+"_0_0"))||void 0===o||o.focus()})):e.props.arrow<0&&setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+`_${e.props.max-1}_${e.props.stepsPerValue-1}`))||void 0===o||o.focus()}));else if(t.target instanceof HTMLInputElement){if(Number(t.target.value)===e.props.step&&e.value===e.props.max||Number(t.target.value)===e.props.max&&e.value===e.props.step){const t=document.getElementById(e.props.id+"_items_wrapper");return null==t||t.focus(),void e.input(0)}e.input(Number(t.target.value))}}function rn(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(Go(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):pn(e,t,o,!!e.props.dragStarted)))}function sn(e){Go(e)}function an(e,t,o){if(!e.props.disabled&&"touchstart"!==o.type&&(o.preventDefault(),(0!==o.clientX||0!==o.clientY)&&o.currentTarget instanceof HTMLElement))return 1===e.props.step?e.props.deselect&&Number(e.value)===t+1?void e.input(0):void e.input(t+1):void pn(e,t,o)}function ln(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function pn(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r,y:s}=ln(o),a=o.currentTarget.getBoundingClientRect();let l=dn((r-a.x)/a.width+t,e.props.step);l=l>e.props.min?l:e.props.min,l=l<e.props.max?l:e.props.max,!e.props.deselect||l!==Number(e.value)||e.props.dragStarted?n?e.input(l,!1):Go(e,l):e.input(0)}function dn(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const cn=/* #__PURE__ */K("rt"),{outer:un,wrapper:fn,inner:vn,label:hn,prefix:mn,suffix:gn,help:$n,messages:bn,message:yn,icon:xn}=/* #__PURE__ */W(cn),wn=cn("itemsWrapper",(()=>({$el:"span",attrs:{style:{"flex-direction":'$rightToLeft && "row-reverse" || undefined'},tabindex:"$value !== undefined && $value !== 0 && '-1' || '0'",id:"$id + _items_wrapper",onKeydown:"$handlers.handleWrapperKeydown","data-disabled":"$disabled",onBlur:"$handlers.handleWrapperBlur",onMouseleave:"$hoverHighlight && $handlers.handleMouseleave"}}))),_n=cn("ratingItem",(()=>({for:["item","index","$max"],$el:"span",attrs:{id:'$id + "_item_" + $index',onClick:"$handlers.handleItemClick($item)",draggable:"$hoverHighlight !== true && && $disabled !== true && true",onMousemove:"$handlers.handleMousemove($item)",onDragstart:"$handlers.handleDragstart($item)",onDragend:"$handlers.handleDragend",onTouchstartPassive:"$handlers.handleTouchstart($item)",onTouchmovePassive:"$handlers.handleTouchmove"}}))),kn=cn("template",(()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null}))),Sn=cn("itemLabel",(()=>({$el:"label",attrs:{id:'$id + "_label_" + $index + "_" + $stepIndex',for:'$id + "_" + $index + "_" + $stepIndex',"data-checked":'$value === $fns.getValue($item, $increment) && "true" || "false"',style:{width:'$fns.showLabel($fns.getValue($item, $increment), $stepIndex, $item) && "100%" || "0%"'}}}))),Ln=cn("itemLabelInner",(()=>({$el:"span",children:"$fns.getValue($item, $increment)"}))),In=cn("input",(()=>({$el:"input",attrs:{type:"radio",value:"$fns.getValue($item, $increment)",id:'$id + "_" + $index + "_" + $stepIndex',onFocus:"$handlers.handleFocus",tabindex:'$value === $fns.getValue($item, $increment) && "0" || "-1"',disabled:"$disabled",name:"$id","data-value":"$fns.getValue($item, $increment)",checked:"$value === $fns.getValue($item, $increment) && true",onKeydown:"$handlers.handleKeydown($fns.getValue($item, $increment))"}}))),Dn=cn("onItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}}))),An=cn("offItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item, false)",display:"flex","flex-direction":"row-reverse",position:"absolute",zIndex:"$offItemStyles && 100",overflow:"hidden",top:"0",right:"0"}}}))),Cn=cn("onItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$onColor"}}}))),Tn=cn("offItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$offColor"}}}))),En=()=>U("$slots.onItem",(()=>()=>"$slots.onItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),On=()=>U("$slots.offItem",(()=>()=>"$slots.offItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),Mn={schema:/* #__PURE__ */un(/* #__PURE__ */fn(/* #__PURE__ */hn("$label"),/* #__PURE__ */vn(/* #__PURE__ */xn("prefix"),/* #__PURE__ */mn(),/* #__PURE__ */wn(/* #__PURE__ */_n(/* #__PURE__ */kn(/* #__PURE__ */Sn(/* #__PURE__ */Dn(/* #__PURE__ */Cn(/* #__PURE__ */En())),/* #__PURE__ */An(/* #__PURE__ */Tn(/* #__PURE__ */On())),/* #__PURE__ */Ln()),/* #__PURE__ */In()))),/* #__PURE__ */gn(),/* #__PURE__ */xn("suffix"))),/* #__PURE__ */$n("$help"),/* #__PURE__ */bn(/* #__PURE__ */yn("$message.value"))),type:"input",props:[],features:[function(t){function o(e){setTimeout((()=>{const t=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));for(let e=0;e<t.length;e++){const o=t[e].querySelectorAll(".formkit-onItemWrapper"),n=t[e].querySelectorAll(".formkit-offItemWrapper");for(let n=0;n<o.length;n++)o[n].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`;for(let o=0;o<n.length;o++)n[o].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`}}))}t.addProps(["max","step","stepsPerValue","itemsToPercentages","rightToLeft","onItemStyles","offItemStyles","hoverHighlight","deselect","disabled","wrapperWidth","onColor","offColor"]),!1!==t.props.hoverHighlight&&"false"!==t.props.hoverHighlight&&(t.props.hoverHighlight=!0),t.props.deselect=e.undefine(t.props.deselect),t.props.max=Number(t.props.max)||5,t.props.min=Number(t.props.min)||0,t.props.step=Number(t.props.step)||1,t.props.numberOfSteps=t.props.max/t.props.step,t.props.lastIndex=1/t.props.step-1,t.props.itemsToPercentages={},"disabled"in t.props&&(t.props.disabled=e.undefine(t.props.disabled)),t.props.rightToLeft?(t.props.onItemStyles=void 0,t.props.offItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%",zIndex:100}):t.props.onItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%"},t.props.stepsPerValue=1/t.props.step,t.hook.input(((e,o)=>{if(null===e||""===e||isNaN(e))return o(e);const n=Number(e),r=Number(t.props.min),s=Number(t.props.max);return n>s?o(s):t.props.min&&n<=r?o(r):o(n)})),t.on("commit",(({payload:e})=>{const o=Number(e||0);Go(t,o)})),t.on("created",(()=>{t.context&&(e.whenAvailable(`${t.props.id}_items_wrapper`,(()=>{o(t),function(e){var t;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_items_wrapper`);if(!n)return;new ResizeObserver((()=>{o(e)})).observe(n)}(t),setTimeout((()=>o(t)),100)}),t.props.__root),t.context.fns.getPercentage=(e,t,o=!0)=>(o?e.onItems:e.offItems)[t],t.context.fns.getValue=(e,o)=>e+Number((o*t.props.step+t.props.step).toFixed(1)),t.context.fns.showLabel=(e,o)=>{const n=Number(t.value||0);return 0===n&&0===o||n&&e===n||e>n&&0===o||n>e&&o===t.props.lastIndex},t.context.handlers.handleFocus=e=>nn.call(null,t,e),t.context.handlers.handleWrapperKeydown=e=>on.call(null,t,e),t.context.handlers.handleWrapperBlur=e=>Xo.call(null,t,e),t.context.handlers.handleItemClick=e=>o=>an.call(null,t,e,o),t.context.handlers.handleMousemove=e=>o=>rn.call(null,t,e,o),t.context.handlers.handleMouseleave=()=>sn.call(null,t),t.context.handlers.handleDragstart=e=>o=>tn.call(null,t,e,o),t.context.handlers.handleMouseup=e=>en.call(null,t,e),t.context.handlers.handleTouchstart=e=>o=>Qo.call(null,t,e,o),t.context.handlers.handleTouchmove=e=>Jo.call(null,t,e),t.context.handlers.handleKeydown=e=>o=>function(e,t,o){const n=Number(e.value);e.props.deselect&&" "===o.key&&n===t?e.input(0):" "===o.key&&e.input(t)}(t,e,o))}))},/* #__PURE__ */o.defaultIcon("rating","star")]},Vn=/* #__PURE__ */K("ac"),{outer:Fn,wrapper:Pn,inner:Bn,icon:Hn,label:Rn,prefix:Nn,suffix:Kn,help:Wn,messages:qn,message:Un}=/* #__PURE__ */W(Vn),zn=Vn("input",(()=>({$el:"input",bind:"$attrs",attrs:{id:"$id",type:"text",onClick:"$handlers.click",onBlur:"$handlers.blur",onKeydown:"$handlers.keydown",onInput:"$handlers.input",onFocus:"$handlers.focus",value:"$state.loading !== true && $inputText || undefined",name:"$node.name",placeholder:"$state.loading && $ui.isLoading.value || $placeholder || undefined",tabindex:'$disabled && "-1" || 0',role:"combobox",autocomplete:'$attrs.autocomplete || "off"',autocapitalize:"none",readonly:"$attrs.readonly || $state.loading || $multiple && $max && $value && $value.length >= $max && $hasHighlightedRange !== true || undefined","data-selection-appearance":"$selectionAppearance",disabled:"$disabled || $disabledInternally || undefined",onTouchmovePassive:"$handlers.touchmove",onTouchstartPassive:"$handlers.touchmove",onTouchend:"$handlers.touchend","aria-autocomplete":"list","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy","aria-activedescendant":"$expanded && $activeDescendant || undefined","aria-required":"$state.required || undefined"}}))),Yn=Vn("listboxButton",(()=>({$el:"div",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',role:"button","aria-label":"$expanded && $ui.close.value || $ui.open.value",onClick:"$handlers.toggleListbox",onKeydown:"$handlers.toggleListboxKeydown",tabindex:'$disabled && "-1" || 0',"aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-disabled":"$disabled || $state.loading || undefined","data-disabled":"$disabled || $disabledInternally || undefined"}}))),jn=Vn("selectionWrapper",(()=>({for:["option","index","$selections"],$el:"div",attrs:{id:'$id + "_selection_wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:'$disabled && "-1" || 0',onKeydown:"$handlers.selectionKeydown && $handlers.selectionKeydown($multiple && $option || undefined)",onClick:"$handlers.selectionClick && $handlers.selectionClick($multiple && $option || undefined)",onFocus:"$handlers.selectionFocus && $handlers.selectionFocus($multiple && $option || undefined)",onBlur:"$handlers.selectionBlur && $handlers.selectionBlur($multiple && $option || undefined)","data-is-selection":"true","data-active-selection":"$fns.isActiveSelection && $fns.isActiveSelection($activeSelectionValue, $option)"}}))),Zn=Vn("selection",(()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}}))),Gn=Vn("selections",(()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}}))),Xn=Vn("removeSelection",(()=>({$el:"button",attrs:{id:'$selectionAppearance === "option" && $multiple && $id + "_remove_selection_" + $index || $id + "_remove_selection"',tabindex:"0",title:"$ui.remove.value",type:"button","aria-label":"$ui.remove.value",onClick:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)",onTouchend:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)","aria-controls":"$id"}}))),Jn=Vn("optionLoading","span"),Qn=Vn("option",(()=>({$el:"div",if:"$value !== undefined"}))),er=/* #__PURE__ */z(Vn);function tr(t){"option"!==t.props.selectionAppearance||t.props.multiple||!1===t.props.selectionRemovable||"false"===t.props.selectionRemovable||(t.props.selectionRemovable=!0),t.props.multiple||(t.props.clearSearchOnOpen=e.undefine(t.props.clearSearchOnOpen)),t.props.selectionRemovable=e.undefine(t.props.selectionRemovable),t.props.openOnClick=e.undefine(t.props.openOnClick),"option"!==t.props.selectionAppearance||t.props.multiple||(t.props.isSingleOption=!0),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),void 0===t.props.selectionAppearance&&(t.props.selectionAppearance="text-input"),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),t.props.closeOnSelect?t.props.resetSearchOnCommit=!1:void 0===t.props.resetSearchOnCommit&&(t.props.resetSearchOnCommit=t.props.multiple),t.props.allowNewValues=e.undefine(t.props.allowNewValues)}function or(t){t.addProps(["inputText","selectionAppearance","searchValue","openOnClick","filteredOptions","search","debounce","showInput","visibilityStyles","selectionStyles","multiple","filter","hasHighlightedRange","clearOnClick","debounce"]),void 0===t.props.debounce?t.props.debounce=200:t.props.debounce=parseInt(t.props.debounce),t.props.nonceKey="searchValue",t.props.searchValue="",t.props.inputText="",t.props.filterOptions=De.bind(null,t),t.props.reloadOnCommit=e.undefine(t.props.reloadOnCommit),void 0===t.props.alwaysLoadOnOpen?t.props.alwaysLoadOnOpen=!0:t.props.alwaysLoadOnOpen=e.undefine(t.props.alwaysLoadOnOpen),"function"!=typeof t.props.filter&&(t.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase())),t.on("created",(()=>{t.context&&c&&(t.context.handlers.focus=sr.bind(null,t),t.context.handlers.input=nr.bind(null,t),t.context.handlers.focus=sr.bind(null,t),t.context.handlers.click=rr.bind(null,t),t.context.handlers.toggleListbox=ar.bind(null,t),t.context.handlers.toggleListboxKeydown=lr.bind(null,t),t.context.handlers.keydown=St.bind(null,t),t.context.handlers.selectionKeydown=e=>o=>_t(t,e,o),t.context.handlers.searchInputTagKeydown=e=>o=>function(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":gt(e);break;case"ArrowRight":case"ArrowLeft":$t(e,t,o);break;case"Delete":case"Backspace":bt(e,t,o)}}(t,e,o),t.on("prop:options",(({payload:e})=>{if((0===t.props.initialOptions.length&&"function"!=typeof t.props.optionsLoader||!t.props.searchValue&&e.length)&&(t.props.initialOptions=[...e]),t.props.selections&&t.props.selections.length&&e.length)for(let o=0;o<t.props.selections.length;o++){const n=t.props.selections[o],r=e.find((e=>Se(e)===n.value));r&&(t.props.selections[o]=r)}})))})),t.on("prop:expanded",(({payload:e})=>{e||Le.delete(t)}))}function nr(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&De(e,e.props.searchValue,!0)}function rr(e,t){t.stopPropagation(),e.props.disabled||e.props.disabledInternally||(e.props.attrs.onClick&&e.props.attrs.onClick(t),(!e.props.expanded&&e.props.openOnClick||e.props.openOnFocus)&&(e.props.expanded=!0))}function sr(e){e.props.disabled||e.props.disabledInternally||(e.props.attrs.onFocus&&e.props.attrs.onFocus(),e.props.activeSelectionValue=void 0,e.props.skipOpen?e.props.skipOpen=!1:e.props.openOnFocus&&(e.props.expanded=!0))}function ar(e){var t,o,n;e.props.disabled||e.props.disabledInternally||(null===(t=e.context)||void 0===t?void 0:t.state.loading)||(e.props.expanded=!e.props.expanded,e.props.openOnFocus||null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`))||void 0===n||n.focus())}function lr(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),ar(e))}const ir=new WeakMap,pr="undefined"!=typeof window,dr=new WeakMap;let cr=!1;function ur(t){t.props.searchValue=null,t.on("commit",(()=>{t.props.searchValue=null,t.props.highlightedRange||fr(t)})),t.on("created",(()=>{if(!t.context||!pr)return;t.on("handleSearchInput",(({payload:e})=>{""===e?(t.props.searchValue=null,t.input([])):e&&0===t.props.inputStd.length?t.props.searchValue=e:e&&t.props.inputStd.length>0&&(t.props.searchValue=function(e){var t;const o=hr(e);if(e.props.highlightedRange){const[t,n]=vr(e,o);return e.props.inputText.slice(t,n)}return e.props.inputText.slice((null===(t=o[o.length-1])||void 0===t?void 0:t.end)+2)}(t)),!t.props.expanded&&e?t.props.expanded=!0:!e&&t.props.expanded&&(t.props.expanded=!1)})),function(t){e.whenAvailable(`${t.props.id}`,(e=>{e instanceof HTMLInputElement&&dr.set(e,t)}),t.props.__root),pr&&!cr&&(cr=!0,document.addEventListener("selectionchange",(()=>{const e=ke();if(e instanceof HTMLInputElement&&dr.has(e)){const t=dr.get(e);t&&function(e){clearTimeout(ir.get(e)),ir.set(e,setTimeout((()=>{var t,o,n,r;const s=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(s instanceof HTMLInputElement){const t=hr(e),a=t.findIndex((e=>null!==s.selectionStart?s.selectionStart>=e.start&&s.selectionStart<=e.end:null!==s.selectionEnd&&(s.selectionEnd>=e.start&&s.selectionEnd<=e.end))),l=null===(o=t[t.length-1])||void 0===o?void 0:o.end;if(0===s.selectionStart&&s.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))return;if("string"==typeof e.props.searchValue&&e.props.highlightedRange){if(t.length){const o=e.props.highlightedRange,[n,r]=vr(e,t);if(null!==s.selectionEnd&&(s.selectionEnd<n||s.selectionEnd>r)){const t=o.end-o.start-(r-n),a=s.selectionEnd;e.props.inputText=e.props.option.label,e.props.highlightedRange=void 0,e.props.searchValue=null,s.value=e.props.inputText,s.selectionStart=s.selectionEnd=a+(a>n?t:0)}}}else if(a>=0&&null!==s.selectionStart&&(l!==(null===(r=e.props.inputText)||void 0===r?void 0:r.length)||s.selectionStart<l)){const o=t[a],n=e.props.inputText.substr(0,l),r=o.start+(o.index>0?1:0),i=o.end+(t.length-1>o.index?-1:0);n!==e.props.inputText&&(e.props.inputText=n,s.value=n),e.props.highlightedRange=o,s.selectionStart=r,s.selectionEnd=i}else e.props.highlightedRange=void 0,fr(e);if(null!==s.selectionStart&&s.selectionStart>=l&&", "!==e.props.inputText.substring(l,l+2)){let t=e.props.inputText.substring(0,l);t=e.props.multiple&&e.props.max&&Array.isArray(e.props.inputStd)&&e.props.inputStd.length>=e.props.max?t:`${t},`,e.props.inputText=`${t} ${e.props.inputText.substring(l).replace(/^[,\s]{1,2}/,"")}`}}}),5))}(t)}})))}(t);const n=t.context.handlers.keydown;t.context.handlers.keydown=e=>{n(e),function(e,t){var n,r,s,a;if(["ArrowRight","ArrowLeft"].includes(t.key)&&t.target instanceof HTMLInputElement&&null!==t.target.selectionEnd&&null!==t.target.selectionStart){if(0===t.target.selectionStart&&t.target.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))"ArrowLeft"===t.key?o(0):o(-1);else if(!e.props.searchValue){e.props.searchValue=null;const o=hr(e),n=null===(r=o[o.length-1])||void 0===r?void 0:r.end;t.target.selectionStart<n&&(t.target.selectionStart=Math.max(0,"ArrowLeft"===t.key?t.target.selectionStart-2:t.target.selectionEnd+2))}}else if(["Delete","Backspace"].includes(t.key))e.props.highlightedRange&&!e.props.searchValue?(He(e,e.props.highlightedRange.option),0===e.props.inputStd.length&&(e.props.highlightedRange=void 0)):t.target instanceof HTMLInputElement&&(e.props.searchValue=null,o(-1,!0)&&t.preventDefault());else if(t.target instanceof HTMLInputElement&&0===t.target.selectionStart&&t.target.selectionEnd===(null===(s=e.props.inputText)||void 0===s?void 0:s.length)&&(null===(a=e.props.inputText)||void 0===a?void 0:a.length)&&0===e.props.selections.length)t.preventDefault();else if("Tab"===t.key)return;"ArrowLeft"===t.key&&o(-1,!0)&&t.preventDefault()}(t,e)};const r=t.context.handlers.focus;t.context.handlers.focus=e=>{r(t,e);const o=new Event("selectionchange");document.dispatchEvent(o)},t.on("blur",(()=>{t.props.selections.length?(t.props.inputText=t.props.selections.map((e=>e.label)).join(", "),t.props.searchValue=null):t.props.selections.length||(t.props.inputText="",t.props.searchValue="")}))})),t.on("prop:expanded",(({payload:e})=>{e||t.props.inputStd.length?e&&(t.props.options.length&&!t.props.alwaysLoadOnOpen||(t.props.options=[],De(t,t.props.searchValue))):(t.props.searchValue="",t.props.inputText="")})),t.on("prop:selections",(()=>{var e;const o=[...t.props.selections].map((e=>e.label)).join(", ");let n="";if(pr&&t.isCreated){const o=null===(e=t.props.__root)||void 0===e?void 0:e.getElementById(`${t.props.id}`);if(ke()===o&&Array.isArray(t._value)&&t._value.length){if(t.props.max&&t._value.length>=Number(t.props.max))return;n=", "}}t.props.inputText=`${o}${n}`,t.props.reloadOnCommit&&(t.props.searchValue="",De(t,t.props.searchValue))}));const o=(e,o=!1)=>{var n,r;const s=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(`${t.props.id}`);if(!(s instanceof HTMLInputElement))return!1;const a=hr(t),l=e>=0?e:a.length-1;if(void 0===a[l])return!1;const i=null===(r=a[l])||void 0===r?void 0:r.end;return null!==s.selectionStart&&(!o||s.selectionStart>=i&&s.selectionStart<=i+2)&&(s.selectionStart=a[l].start+(l>0?1:0),s.selectionEnd=a[l].end+(l<a.length-1?-1:0),!0)};let n;t.on("selectRange",(({payload:e})=>o(...e))),t.on("prop:highlightedRange",(({payload:e})=>{t.props.hasHighlightedRange=!!e,e&&t.props.expanded&&n!==e.option&&(n=e.option,Ne(t))}))}function fr(e){var t;if(!pr)return;const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);o&&o.scrollTo({left:o.scrollWidth,behavior:"smooth"})}function vr(e,t){var o;const n=e.props.highlightedRange,r=n.index,s=n.start+(r?1:0),a=t.length-1>r?t[t.length-1].end-t[r+1].start:0;return[s,(null===(o=e.props.inputText)||void 0===o?void 0:o.length)-a+(t.length-1>n.index?-1:0)]}function hr(e){const t=Be(e);return Array.isArray(t)&&t.length?t.reduce(((e,o,n)=>{var r;const s=(null===(r=e[n-1])||void 0===r?void 0:r.end)||0;let a=0;return t.length-1!==n&&a++,0!==n&&a++,e.push({option:o,index:n,start:s,end:s+o.label.length+a}),e}),[]):[]}function mr(e){!function(e){e.on("prop:expanded",(({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0))):(e.props.searchValue="",e.props.inputText="")}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{t&&!e.props.expanded?(e.props.searchExpand=!0,e.props.expanded=!0):!t&&e.props.expanded&&(e.props.expanded=!1),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(()=>{e.isCreated&&(e.props.inputText="",e.props.searchValue="",e.props.optionRemoved||e.props.reloadOnCommit&&De(e,e.props.searchValue,!0))}))}(e)}function gr(e){!function(e){function t(e){0===e.props.inputStd.length?(e.props.inputText="",e.props.searchValue=""):(e.props.inputText=e.props.selections[0].label,e.props.searchValue=e.props.selections[0].label)}function o(e){e.props.clearSearchOnOpen&&!e.props.searchExpand&&(e.props.inputText="",e.props.searchValue=""),e.props.searchValue=e.props.inputText,e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0)),e.props.searchExpand&&(e.props.searchExpand=!1)}e.on("prop:expanded",(({payload:n})=>{n?o(e):t(e)}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{""===t?(0===e.props.inputStd.length&&(e.props.expanded=!1),e.input(void 0)):t&&!e.props.expanded&&(e.props.searchExpand=!0,e.props.expanded=!0),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(({payload:t})=>{e.props.inputText=t.length?t[0].label:"",e.props.searchValue=t.length?t[0].label:"",e.isCreated&&e.props.expanded&&0===t.length&&De(e,e.props.searchValue,!0)}))}(e)}function $r(t){if(t.props.multiple)if(t.props.multiple&&"option"===t.props.selectionAppearance){function o(){return Array.isArray(t.value)?t.value:[]}function r(e){t.input(e)}mr(t),t.on("created",(()=>{t.props.disabled&&(t.props.draggable=!1),e.whenAvailable(`${t.props.id}_selections`,(e=>{if(e instanceof HTMLElement&&t.context){const s={draggingClass:t.context.classes.dragging,dropZoneClass:t.context.classes.dropZone,root:t.props.__root,disabled:!t.props.draggable,plugins:[n.animations()],touchDraggingClass:t.context.classes.touchDragging,touchDropZoneClass:t.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-selection")};n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s}),t.on("prop:disabled",(({payload:t})=>{s.disabled=t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})})),t.on("prop:draggable",(({payload:t})=>{s.disabled=!t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})}))}}),t.props.__root)}))}else t.props.multiple&&"text-input"===t.props.selectionAppearance&&ur(t);else gr(t)}const br={schema:/* #__PURE__ */Fn(/* #__PURE__ */Pn(/* #__PURE__ */Rn("$label"),/* #__PURE__ */Bn(/* #__PURE__ */Hn("prefix"),/* #__PURE__ */Nn(),/* #__PURE__ */zn(),/* #__PURE__ */U("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */U("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U("$selectionRemovable && $isSingleOption",/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */U("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")),/* #__PURE__ */U('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */Yn(/* #__PURE__ */Hn("select")))),/* #__PURE__ */U("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */Yn(/* #__PURE__ */Hn("select"))),/* #__PURE__ */er(),/* #__PURE__ */Kn(),/* #__PURE__ */Hn("suffix")),/* #__PURE__ */U("$multiple && $selectionAppearance === option",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading && $fns.hasOptionLoaderValue($option)",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */Wn("$help"),/* #__PURE__ */qn(/* #__PURE__ */Un("$message.value"))),type:"input",family:"dropdown",props:[],features:[
20
20
  /* #__PURE__ */o.defaultIcon("select","select"),
21
21
  /* #__PURE__ */o.defaultIcon("close","close"),
22
22
  /* #__PURE__ */o.defaultIcon("selected","check"),
@@ -26,7 +26,7 @@
26
26
  /* #__PURE__ */o.localize("remove"),
27
27
  /* #__PURE__ */o.localize("open"),
28
28
  /* #__PURE__ */o.localize("close"),o.options,
29
- /* #__PURE__ */ut.bind(null,tr,or,$r),jt]},yr=/* #__PURE__ */K("dp"),{outer:xr,wrapper:wr,inner:_r,icon:kr,label:Sr,prefix:Lr,suffix:Ir,help:Dr,messages:Ar,message:Cr}=/* #__PURE__ */W(yr),Tr=yr("input",(()=>({$el:"input",bind:"$attrs",attrs:{name:"$node.name",id:"$id",onKeydown:"$handlers.inputKeydown",value:"$inputText",onInput:"$handlers.dateInput",onClick:"$pickerOnly && $handlers.open",onBlur:"$handlers._blur",onFocus:"$handlers.focus",readonly:"$pickerOnly || $expanded",disabled:"$disabled"}}))),Er=yr("panelWrapper",(()=>({$el:"div",if:"$expanded",attrs:{id:'$id + "_popover"',role:"dialog",onBlur:"$handlers._blurOut()",tabindex:"-1",popover:"$popover","aria-modal":"true","aria-label":"Choose date","data-panel":"$panel",style:{if:"$usePopover",then:{margin:0,top:'$popoverCoordinates.y + "px"',left:'$popoverCoordinates.x + "px"',width:'$popoverCoordinates.width + "px"'}}}}))),Or=yr("next",(()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _next_button",type:"button",onClick:"$handlers.next"}}))),Mr=yr("nextLabel","span"),Vr=yr("prev",(()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _prev_button",type:"button",onClick:"$handlers.prev"}}))),Fr=yr("prevLabel","span"),Pr=yr("calendar",(()=>({if:'$panel === "day"',$el:"table",for:["month","$calendar"],attrs:{key:'$fns.format($month.monthDay, "YYYY-MM")'}}))),Br=yr("calendarWeeks",(()=>({$el:"tbody"}))),Hr=yr("calendarHeader",(()=>({$el:"thead"}))),Rr=yr("weekDays",(()=>({$el:"tr"}))),Nr=yr("weekDay",(()=>({$el:"th",for:["day","$month.weeks.0"],attrs:{"aria-label":'$fns.format($day, "dddd")'}}))),Kr=yr("week",(()=>({$el:"tr",for:["week","weekIndex","$month.weeks"]}))),Wr=yr("dayCell",(()=>({$el:"td",for:["day","dayIndex","$week"],attrs:{key:"$day",onClick:"$handlers.setDate($day)",onKeydown:"$handlers.keyDown",onMouseenter:"$handlers.mouseEnter($day)",onMouseleave:"$handlers.mouseLeave",onBlur:"$handlers._blurOut(day)",tabindex:'$fns.sameDay($day) && "0" || "-1"',"data-is-extra":"$fns.notInMonth($month.monthDay, $day)","data-disabled":"$fns.isDisabled($day)","aria-selected":"$selectedWeek === $weekIndex && $selectedDay === $dayIndex","aria-label":'$fns.format($day, "long")'}}))),qr=yr("day","div"),Ur=yr("openButton",(()=>({$el:"div",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',type:"div",role:"button",onClick:"$handlers.open",onKeydown:"$handlers.openKeydown",tabIndex:'$pickerOnly && "-1" || "0"',"data-disabled":"$disabled","aria-disabled":"$disabled","aria-label":'$value && ($ui.changeDate.value + ", " + $inputText) || $ui.chooseDate.value',"aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined'}}))),zr=yr("years",(()=>({if:'$panel === "year"',$el:"ul",attrs:{id:'$id + "_years"'}}))),Yr=yr("year",(()=>({for:["year","yearIndex","$years"],$el:"li",attrs:{key:'$: "year" + $fns.format($year, "YYYY")',onClick:"$handlers.setDate($year)",onKeydown:"$handlers.keyDown",onMouseenter:"$handlers.mouseEnter($year)",onMouseleave:"$handlers.mouseLeave",onBlur:"$handlers._blurOut(year)",tabindex:'$fns.sameYear($year) && "0" || "-1"',"aria-selected":"$selectedYear === $yearIndex","data-disabled":"$fns.isDisabledYear($year)","aria-label":"$fns.format($year, $yearFormat)"}}))),jr=yr("months",(()=>({if:'$panel === "month"',$el:"ul"}))),Zr=yr("month",(()=>({$el:"li",for:["month","index","$months"],attrs:{key:"$month",onClick:"$handlers.setDate($month)",onKeydown:"$handlers.keyDown",onMouseenter:"$handlers.mouseEnter($month)",onMouseleave:"$handlers.mouseLeave",onBlur:"$handlers._blurOut(month)",tabindex:'$fns.sameMonth($month) && "0" || "-1"',"aria-selected":"$selectedMonth === $index","data-disabled":"$fns.isDisabledMonth($month)"}}))),Gr=yr("panelHeader",(()=>({$el:"header",attrs:{"aria-live":"polite"}}))),Xr=yr("yearsHeader",(()=>({$el:"div",if:'$panel === "year"'}))),Jr=yr("monthsHeader",(()=>({$el:"div",if:'$panel === "month"'}))),Qr=yr("daysHeader",(()=>({$el:"div",if:'$panel === "day"'}))),es=yr("timeHeader",(()=>({$el:"div",if:'$panel === "time"'}))),ts=yr("yearButton",(()=>({$el:"button",attrs:{type:"button",id:"$id + _year_button",onClick:"$handlers.jumpTo(year)"},children:"$fns.format($renderedDate, $yearFormat)"}))),os=yr("monthButton",(()=>({$el:"button",attrs:{type:"button",id:"$id + _month_button",onClick:"$handlers.jumpTo(month)"},children:"$fns.format($renderedDate, $monthButtonFormat)"}))),ns=yr("dayButton",(()=>({$el:"button",attrs:{type:"button",id:"$id + _day_button",onClick:"$handlers.jumpTo(day)",tabindex:"2"},children:"$fns.format($renderedDate, $dayButtonFormat)"}))),rs=yr("removeSelection",(()=>({$el:"button",if:"$clearable && $_value",attrs:{id:'$id + "_remove_selection"',type:"button",onClick:"$handlers.clear","aria-controls":"$id"}}))),ss=yr("time",(()=>({$el:"div",if:'$panel === "time"'}))),as=yr("timeInput",(()=>({$el:"input",attrs:{type:"time",value:"$localTime",onInput:"$handlers.localTime",onKeydown:"$handlers.keyDown",spellcheck:"false",onBlur:"$handlers._blurOut(time)"}}))),ls=yr("panelClose",(()=>({$el:"button",if:"$showPanelClose && ($inline === undefined || $inline === false)",attrs:{type:"button",class:"$classes.panelClose",onClick:"$handlers.closePanel",tabindex:-1,"aria-label":"$ui.close.value"}}))),{overlayPlaceholder:is,overlayLiteral:ps,overlayChar:ds,overlayEnum:cs,overlay:us,overlayParts:fs,overlayInner:vs}=/* #__PURE__ */q(yr),hs=yr("panel","div"),ms=/* #__PURE__ */new WeakMap,gs=/* #__PURE__ */new WeakMap,$s=new WeakSet,bs=/* #__PURE__ */new WeakMap,ys=/* #__PURE__ */new WeakMap,xs=new WeakSet,ws=/* #__PURE__ */new WeakMap,_s=/[\uD800-\uDBFF]/,ks=/* #__PURE__ */new WeakMap,Ss=/* #__PURE__ */new WeakMap,Ls=/* #__PURE__ */new WeakMap,Is=/* #__PURE__ */new WeakMap,Ds=/* #__PURE__ */new WeakMap,As=new WeakSet,Cs=/* #__PURE__ */new WeakMap,Ts=/* #__PURE__ */new WeakMap,Es=/* #__PURE__ */new WeakMap,Os=/* #__PURE__ */new WeakMap;let Ms=!1;const Vs=()=>{Ms=!0,setTimeout((()=>{Ms=!1}),500)},Fs={"#":{type:"char",pattern:/\d/,token:"#",placeholder:"_",selectDirection:"right"},a:{type:"char",pattern:/[a-zA-Z]/,token:"a",placeholder:"_",selectDirection:"left"},h:{type:"char",pattern:/[0-9a-fA-F]/,token:"h",placeholder:"_",selectDirection:"left"},"*":{type:"char",pattern:/./,token:"*",placeholder:"_",selectDirection:"left"}},Ps=/* #__PURE__ */new WeakMap,Bs="undefined"!=typeof window;let Hs=!1,Rs=!1;function Ns(){Bs&&!Rs&&(Rs=!0,document.addEventListener("selectionchange",(()=>{const e=ke();if(!(e instanceof HTMLInputElement))return;if(Os.has(e))return function(e){const t=Os.get(e);if(t){const[o,n]=t,[r,s]=Sa(e),a=s.indexOf(o);if(-1===a)return void Os.delete(e);const l=r[a],i=[l[0]+n[0],l[1],"none"];Qs(ea(e),i)||aa(e,i)}}(e);if("select"!==ws.get(e))return;const t=ea(e);if(!Qs(t,Ps.get(e))){if(Ps.set(e,t),$s.has(e))return $s.delete(e);e.dispatchEvent(new CustomEvent("selection",{detail:ea(e)}))}})))}function Ks(e,t,o){var n;if(Ns(),ms.has(e))return;ms.set(e,[]),t.reverse&&As.add(e),t.prefix&&Cs.set(e,t.prefix),t.suffix&&Ts.set(e,t.suffix),Ys(e,t.pattern,t.partOverrides,t.explicitParts);const r=ys.get(e),s=null==r?void 0:r.some((e=>Gs(e))),a=null==r?void 0:r.some((e=>function(e){return!!e&&("group"===e.type&&Array.isArray(e.parts))}(e)));if(s&&a)throw new Error("Cannot use enums and groups in the same mask.");const l=s?"select":null!==(n=t.mode)&&void 0!==n?n:"shift";if(a&&"select"===l)throw new Error("Cannot use groups in select mode.");(t.placeholder||"select"===l)&&xs.add(e),ws.set(e,l),t.onChange&&Is.set(e,t.onChange);let i=!1;e.addEventListener("beforeinput",(o=>{if(Hs)return;if("insertLineBreak"===o.inputType)return;if(o.inputType.startsWith("history"))return function(e,t){e.addEventListener("input",(o=>{var n;o.preventDefault(),o.stopImmediatePropagation();const r=ms.get(e);if(null==r?void 0:r.length){const o=(null!==(n=gs.get(e))&&void 0!==n?n:r.length-1)+(t.endsWith("Undo")?-1:1),s=r[o];if(!s)return;la(e,s),e.setSelectionRange(...s.selectionAfter),gs.set(e,o),Is.has(e)&&Is.get(e)(s,e)}}),{once:!0})}(e,o.inputType);o.preventDefault(),i=!0;const n=(r=o.inputType).startsWith("insert")?"insert":!!r.startsWith("delete")&&("deleteContentForward"===r?"deleteContentForward":"deleteContentBackward");var r;const s=ea(e),a=e.value;n&&ta(e,{type:n,selectionBefore:s,data:o.data,valueBefore:a,suffix:t.suffix,prefix:t.prefix})})),e.addEventListener("input",(t=>{i=!1,"data"in t||!i&&o&&(o.input(e.value,!1),o.props._maskValue=e.value)})),"select"===l&&e.addEventListener("keydown",(t=>{switch(t.key){case"ArrowRight":return t.preventDefault(),Ca(e);case"ArrowLeft":return t.preventDefault(),Ca(e,-1);case"ArrowUp":return void(Ta(e,1)&&t.preventDefault());case"ArrowDown":return void(Ta(e,-1)&&t.preventDefault());case"Tab":return Ms?void t.preventDefault():void(Ca(e,t.shiftKey?-1:1)&&t.preventDefault())}})),e.addEventListener("focus",(()=>function(e){var t;const o=xs.has(e),n=ws.get(e);if(o){let o=null,r=null,s=!1;const a="shift"===n?0:1,l=e.value;ga(e,{type:"insert",data:l,selectionBefore:[0,0,"none"],valueBefore:l},"shift"===n?"":l,((e,t)=>(null===o&&"char"===t.type&&(o=e.pos-a),(Zs(t)||Gs(t))&&e.value.endsWith(t.placeholder)?(r=e.pos-a,!1):("char"===t.type&&(s=!0),!0))));const i=null!==(t=null!=r?r:s?l.length:o)&&void 0!==t?t:null;if(null!==i){let t=[i,i,"none"];if("select"===ws.get(e)){const[o]=Sa(e),n=Oa(e,t);void 0!==n&&n in o&&(t=o[n])}return function(e,t,o=50){ks.set(e,na(e,t));const n=async()=>{if(!Bs||ke()!==e)return;"select"===ws.get(e)&&(await new Promise((e=>setTimeout(e,10))),function(e){let t=ea(e);if(t[0]===t[1]&&0===t[0]||e.value.length===t[1]&&0===t[0])return;t=ra(e,t);const[o]=Sa(e),n=Oa(e,t),r=t[0];void 0!==n&&o.some((e=>r>=e[0]&&r<e[1]))&&ks.set(e,na(e,o[n]))}(e));const t=ks.get(e);t&&e.setSelectionRange(...t)};n(),document.addEventListener("selectionchange",n),setTimeout((()=>{document.removeEventListener("selectionchange",n),ks.delete(e)}),o)}(e,t)}}}(e))),e.addEventListener("selection",(t=>function(e,t){if(ks.get(e))return;Ba(e),t=ra(e,t);const[o]=Sa(e),n=Oa(e,t),r=void 0!==n&&na(e,o[n]);r&&!Qs(t,r)&&aa(e,r,!0)}(e,t.detail))),ta(e,{type:"insert",selectionBefore:[0,0,"forward"],data:e.value,valueBefore:"",suffix:t.suffix,prefix:t.prefix})}function Ws(e){var t,o;if(Os.has(e))return;const n=null!==(t=ms.get(e))&&void 0!==t?t:[],r=n[null!==(o=gs.get(e))&&void 0!==o?o:n.length-1];if(r){const t=r.selectionAfter,[o,n]=Sa(e,r.valueAfter),s=Oa(e,t,[o,n]);if(void 0!==s&&s in o){const r=n[s],a=o[s],l=[t[0]-a[0],t[1]-a[0],"none"];Os.set(e,[r,l])}}}function qs(e){Os.delete(e)}function Us(e,t,o){const n="string"==typeof e||!ms.has(e),r="string"==typeof e?zs(e):e;if(n)t.prefix&&Cs.set(r,t.prefix),t.suffix&&Ts.set(r,t.suffix),r.value=oa(r,r.value),Ks(r,t,o);else{const e=Ma(r),o=r.value;r.value="",ta(r,{type:"insert",selectionBefore:[0,e?e.valueAfter.length:0,"none"],valueBefore:e?e.valueAfter:"",data:o,suffix:t.suffix,prefix:t.prefix})}return r.value}function zs(e){return{value:e,selectionStart:0,selectionEnd:0,scrollWidth:0,clientWidth:0,addEventListener:()=>{},dispatchEvent:()=>{},setSelectionRange:()=>{}}}function Ys(e,t,o,n,r){r=e&&As.has(e)||r;const s=(null!=n?n:function(e){const t=Object.values(Fs);if(!e)return t;const o={...e},n=[];for(const r of t)if(!Js(r))if("token"in r&&r.token in e){const t={...r,...e[r.token]};js(t)&&n.push(t),delete o[r.token]}else n.push(r);const r=Object.values(o);for(const e of r)js(e)?n.push(e):console.warn(`Invalid ${e.type} token`,e);return n}(o)).sort(((e,t)=>{const o="token"in e?e.token.length:-1,n="token"in t?t.token.length:-1;return o===n?0:o>n?-1:1}));let a=[];[t,a]=function(e,t,o,n){let r,s=0,a="",l="",i="";const p=[];for(;a=ia(e);)a===t&&r!==n?(s++,s>1&&(i+=a)):a===o&&s&&r!==n?(s--,0===s?(l+=`{$${p.length}}`,p.push(i),i=""):i+=a):s?i+=a:r!==n||a!==t&&a!==o?l+=a:l=`${l.substring(0,l.length-1)}${a}`,r=a,e=e.substring(a.length);return[l,p]}(t,"{","}","\\");const l=a.length;t=s.reduce(((e,t,o)=>"token"in t?e.replaceAll(`\\${t.token}`,"{“!”}").replaceAll(t.token,`{$${l+o}}`).replaceAll("{“!”}",t.token):e),t);const i=function(e,t,o){return e.reduce(((e,n)=>{const[r,s]=function(e){const[t,...o]=e.split("|"),n=o.reduce(((e,t)=>{const[o,n=!0]=t.split(":");return Object.assign(e,{[o]:n})}),{});return[t,n]}(n);let a=Ys(null,r,void 0,t,o);a=a.map((e=>{const t={...e};if("char"===t.type&&s.placeholder)t.placeholder=s.placeholder;else if("enum"===t.type)throw new Error("Groups cannot contain enums.");return t}));const l={type:"group",parts:a,...s};return e.push(l),e}),[])}(a,s,r).concat(s),p=/\{\$\d+\}/g,d=t.match(p),c=t.split(p).reduce(((e,t,o)=>{if(t&&(t=t.replaceAll("\\",""),e.push({type:"literal",value:r?[...t].reverse().join(""):t})),d&&d[o]){const t=d[o],n=Number(t.substring(2,t.length-1));!isNaN(n)&&i[n]&&e.push(i[n])}return e}),[]);return r&&c.reverse(),e&&ys.set(e,c),c}function js(e){return!!e&&(Js(e)||Zs(e)||Gs(e))}function Zs(e){return!!e&&("char"===e.type&&e.pattern instanceof RegExp&&Xs(e))}function Gs(e){return!!e&&("enum"===e.type&&Array.isArray(e.values)&&Xs(e))}function Xs(e){return!!e&&("placeholder"in e&&"token"in e)}function Js(e){return!!e&&("literal"===e.type&&"string"==typeof e.value)}function Qs(e,t){return e===t||void 0!==e&&void 0!==t&&(e[0]===t[0]&&e[1]===t[1])}function ea(e){var t,o;return[null!==(t=e.selectionStart)&&void 0!==t?t:e.value.length,null!==(o=e.selectionEnd)&&void 0!==o?o:e.value.length,"none"]}function ta(e,t){var o;As.has(e)&&Pa(t);let n=!1;switch(Ds.set(e,"playing"),t.type){case"insert":n=function(e,t){let o=sa(t);const n=t.selectionBefore,r=function(e,t){var o,n,r;if("select"===ws.get(e)){const[s,a]=Sa(e),l=s.findIndex((e=>Qs(e,t.selectionBefore))),i=null!==(o=a[l])&&void 0!==o?o:null;if(Zs(i)){const e=t.selectionBefore,o=e[1]-e[0],s=t.valueBefore.substring(e[0],e[1]),a="left"===i.selectDirection,l=ha(s,i),p=a?0:function(e,t,o){if(!e)return 0;let n="";for(;e.length;){const o=ia(e);e=e.substring(o.length),t.pattern.test(o)&&(n+=o)}return Math.min(Math.max(n.length,1),o)}(t.data,i,o);if(l.length>=o)return a||(t.insertPos=e[1]-p),(null!==(n=i.selectFill)&&void 0!==n?n:i.placeholder).repeat(o);const d=(null!==(r=i.selectFill)&&void 0!==r?r:i.placeholder).repeat(o-l.length-(a?0:p));return t.insertPos=a?e[0]+l.length:e[1]-p,"left"===i.selectDirection?`${l}${d}`:`${d}${l}${i.placeholder}`}if(Gs(i)){const e=t.selectionBefore;return t.valueBefore.substring(e[0],e[1])}}return""}(e,t);o=`${o.substring(0,n[0])}${r}${o.substring(n[1])}`;const s=ga(e,t,o);return bs.set(e,s.endPos),{...t,valueAfter:s.value,selectionAfter:ma(e,s),unmasked:s.unmasked,complete:s.complete,meta:s.meta}}(e,t);break;case"deleteContentBackward":case"deleteContentForward":n=function(e,t){const o=sa(t),n=t.selectionBefore,r=As.has(e);let s=n[0],a=n[1];s===a&&("deleteContentBackward"!==t.type||r?a+=pa(o,s):s-=pa(o,s,"backward"));const l=ws.get(e);let i="";if("select"===l){const[o,n]=Sa(e),r=Oa(e,[s,a,"none"]);if(void 0!==r){const l=n[r],p=o[r];Zs(l)?i=l.placeholder.repeat(a-s):Gs(l)&&([i,s]=Qs(p,ea(e))?[l.placeholder,s]:function(e,t,o,n){const r=n.valueBefore,s=pa(r,n.selectionBefore[0],"backward"),a=Math.max(o[0],n.selectionBefore[0]-s),l=r.substring(o[0],a),i=Ia(t.values,l);let p=null==i?void 0:i.substring(l.length);i&&!p&&Da(t.values,i)&&(p=i);return[null!=p?p:t.placeholder,p?a:o[0]]}(0,l,p,t))}}const p=`${o.substring(0,s)}${i}${o.substring(a)}`,d=ga(e,t,p);return{...t,valueAfter:d.value,selectionAfter:wa(e,d,t,s),unmasked:d.unmasked,complete:d.complete,meta:d.meta}}(e,t)}if(As.has(e)&&n&&Pa(n),n&&function(e,t){t.prefix&&(t.valueAfter=t.prefix+t.valueAfter,t.selectionAfter=na(e,t.selectionAfter));t.suffix&&(t.valueAfter+=t.suffix)}(e,n),n&&function(e){return e.valueBefore!==e.valueAfter||e.selectionBefore[0]!==e.selectionAfter[0]||e.selectionBefore[1]!==e.selectionAfter[1]}(n)){Is.has(e)&&Es.set(e,(()=>{Es.delete(e),n&&Is.get(e)(n,e)})),Ds.set(e,"beforeCallback");let t=null!==(o=ms.get(e))&&void 0!==o?o:[];const r=gs.get(e);r&&(t=t.slice(0,r),gs.delete(e)),t.push(n),ms.set(e,t),Bs&&ke()===e&&"function"==typeof document.execCommand&&!Hs?(aa(e,[0,e.value.length,"forward"],!0),Hs=!0,document.execCommand("insertText",void 0,n.valueAfter),Hs=!1):la(e,n),Bs&&ke()===e&&aa(e,n.selectionAfter);const s=Es.get(e);s&&s(),Ba(e)}Ds.set(e,"complete")}function oa(e,t){var o,n;const r=null!==(o=Cs.get(e))&&void 0!==o?o:"",s=null!==(n=Ts.get(e))&&void 0!==n?n:"";return r&&t.startsWith(r)&&(t=t.substring(r.length)),s&&t.endsWith(s)&&(t=t.substring(0,t.length-s.length)),t}function na(e,t){const o=Cs.get(e),n=[...t];return o&&(n[0]+=o.length,n[1]+=o.length),n}function ra(e,t){const o=Cs.get(e),n=[...t];return o&&(n[0]-=o.length,n[1]-=o.length),n}function sa(e){let t=e.valueBefore;const o=e.selectionBefore;if(e.suffix&&t.endsWith(e.suffix)&&(t=t.substring(0,t.length-e.suffix.length),e.valueBefore=t,o[0]>=t.length&&(o[0]=t.length),o[1]>=t.length&&(o[1]=t.length)),e.prefix&&t.startsWith(e.prefix)){const n=e.prefix.length;t=t.substring(n),e.valueBefore=t,o[0]=Math.max(o[0]-n,0),o[1]=Math.max(o[1]-n,0)}return t}function aa(e,t,o=!1){o&&($s.add(e),setTimeout((()=>$s.delete(e)),5)),ks.get(e)&&ks.set(e,t),e.setSelectionRange(...t)}function la(e,t,o="After"){if(e.value=t[`value${o}`],Bs){const o=new InputEvent("input",{inputType:"insert"===t.type?"insertText":t.type,data:t.data});e.dispatchEvent(o)}}function ia(e){if(null==e)return"";const t=_s.test(e.charAt(0))&&_s.test(e.charAt(1))?2:1;return e.substring(0,t)}function pa(e,t,o="forward"){if("backward"===o)return 0===t?0:1===t?1:_s.test(e.charAt(t))&&_s.test(e.charAt(t-1))?2:1;const n=e.length-t;return 0===n?0:1===n?1:ia(e.substring(t)).length}function da(e,t){const o=ia(e.data),n=o.length;if(e.value+=o,e.pos+=n,"string"==typeof e.data&&(e.data=e.data.substring(n),e.data.length||(e.endPos=e.pos)),t)return t.substring(n)}function ca(e){const t=ia(e.buffer),o=t.length;e.value+=t,e.pos+=o,e.buffer=e.buffer.substring(o)}function ua(e,t){const o=ia(t),n=o.length;return e.value+=o,e.pos+=n,t.substring(n)}function fa(e,t){for(;t.buffer;){const o=ia(t.buffer);if(e.pattern.test(o)||t.placeholder&&e.placeholder===o)return void("replace"!==t.mode&&"select"!==t.mode||(t.buffer=t.buffer.substring(o.length)));t.buffer=t.buffer.substring(o.length)}}function va(e,t){const o=e.values.concat([e.placeholder]).map((e=>e.toLowerCase())).sort(((e,t)=>e.length>t.length?-1:1));for(;t.buffer;){const e=t.buffer.toLowerCase(),n=o.find((t=>e.startsWith(t)));if(n){const e=t.buffer.substring(0,n.length);return t.buffer=t.buffer.substring(n.length),e}t.buffer=t.buffer.substring(pa(t.buffer,0))}return null}function ha(e,t){let o=e.replaceAll(t.placeholder,"");const n="left"===t.selectDirection;if(t.selectFill){const e=new RegExp(`${n?"":"^"}${r=t.selectFill,r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}+${n?"$":""}`);o=o.replace(e,"")}var r;return o}function ma(e,t){let o=[t.endPos,t.endPos,"forward"];if("select"!==t.mode)return o;const n=ea(e);o=[n[0],t.endPos,"none"];const[r,s]=Sa(e,t.value),a=Oa(e,o,[r,s]);if(void 0===a)return o;if(!(a in r)||!(a in s))return o;const l=r[a],i=s[a],p=t.value.slice(l[0],l[1]);if(Zs(i)&&ha(p,i).length===p.length&&a<r.length-1)return Vs(),r[a+1];if(Gs(i)&&t.insertPos>=l[0]&&t.insertPos<=l[1]){if(t.cycle)return l;const o=function(e,t,o){if(null===e.originalData)return 0;const n=e.insertPos>=t?e.value.substring(t,e.insertPos):"",r=`${n}${e.originalData}`,s=Ia(o.values,r);if(s)return ka(r,s).length-n.length;return 0}(t,l[0],i);if(t.insertPos+o===l[1])return Da(i.values,p)?[l[1],l[1],"forward"]:(Vs(),r[a+1]?r[a+1]:r[a]);const s=[t.insertPos+o,l[1],"none"];return Qs(s,n)||($s.add(e),setTimeout((()=>$s.delete(e)),5)),s}return l}function ga(e,t,o,n){var r,s;const a=null!==(r=ys.get(e))&&void 0!==r?r:[],l={pos:0,insertPos:null!==(s=t.insertPos)&&void 0!==s?s:t.selectionBefore[0],range:t.selectionBefore,chars:0,placeholder:xs.has(e),buffer:o,data:t.data,originalData:t.data,value:"",mode:ws.get(e)||"replace",endPos:t.selectionBefore[0],rangeParts:Sa(e),unmasked:"",complete:!0,cycle:t.cycle,meta:[]};return $a(a,l,void 0,n),l}function $a(e,t,o,n){var r,s;const a={...t};(null==o?void 0:o.placeholder)&&(t.placeholder=!0);const l=(null==o?void 0:o.repeat)&&"literal"===(null===(r=o.nextPart)||void 0===r?void 0:r.type)?o.nextPart.value:null;let i=0;const p=e.reduce(((e,t)=>e+("char"===t.type?1:0)),0),d=t.chars;for(const o of e){const r=e[i+1];switch(o.type){case"literal":ya(o,t,e.at(-1)===o);break;case"char":xa(o,t,l);break;case"enum":ba(o,t);break;case"group":const a={repeat:null!==(s=o.repeat)&&void 0!==s&&s,nextPart:r,repeats:0,placeholder:!!o.placeholder};$a(o.parts,t,a,n)}if(n){if(!1===n(t,o))break}const a=Js(r)&&i+2===e.length&&d!==t.chars;if(!(t.buffer||t.data||t.placeholder||a))break;i++}if(t.chars<p&&(t.complete=!1),o){const r=t.chars-d,s=r===p,i=!(!t.data||l&&t.data.startsWith(l)&&t.insertPos<=t.pos),c=!(t.buffer&&l&&t.buffer.startsWith(l)&&t.insertPos>=t.pos+l.length)&&(t.buffer||i);if(o.repeat&&c&&s)return o.repeats++,$a(e,t,o,n);if(!s){t.complete=!1;const o=e.reverse().find((e=>"literal"===e.type));e.reverse(),Js(o)&&t.value.endsWith(o.value)&&(t.value=t.value.substring(0,t.value.length-o.value.length),t.pos=t.value.length)}p>1&&r<p&&0!==r&&t.insertPos<=t.pos?t.data="":o.repeat&&!s&&o.repeats&&Object.assign(t,a)}t.placeholder=a.placeholder}function ba(e,t){const[o,n]=t.rangeParts,r=o[n.indexOf(e)];if(r&&(t.insertPos<=t.pos||t.insertPos>=r[0]&&t.insertPos<=r[1])&&t.data){const o=t.buffer.substring(0,t.insertPos-t.pos),n=`${o}${t.data}`,r=Ia(e.values.concat([e.placeholder]),n);if(r){const s=ka(n,r);return t.data=t.data.substring(s.length),t.value+=r,r!==e.placeholder?t.unmasked+=r:t.complete=!1,t.meta.push({type:r!==e.placeholder?"enum":"placeholder",value:r}),o?t.buffer=t.buffer.substring(o.length):va(e,t),t.endPos=t.pos+s.length,void(t.pos=t.value.length)}t.data=""}if(t.buffer){const o=va(e,t);if(o)return t.value+=o,o!==e.placeholder?t.unmasked+=o:t.complete=!1,t.meta.push({type:o!==e.placeholder?"enum":"placeholder",value:o}),void(t.pos=t.value.length)}t.complete=!1,t.value+=e.placeholder,t.meta.push({type:"placeholder",value:e.placeholder}),t.pos=t.value.length}function ya(e,t,o){let n=e.value;if(""===t.data&&!t.buffer&&!t.placeholder&&!o)return;let r=!1;for(;n;){const e=t.insertPos<=t.pos?ia(t.data):"",s=ia(n);if(e===s)n=da(t,n),t.meta.push({type:"literal",value:s}),r=!0;else if(!r||t.data||null===t.data||t.placeholder||o)n=ua(t,n),t.meta.push({type:"literal",value:s});else if(r&&!t.data)break;t.buffer.startsWith(s)&&(t.buffer=t.buffer.substring(s.length))}null===t.data&&!t.buffer&&t.insertPos<=t.pos&&!t.placeholder&&(t.value=t.value.substring(0,t.value.length-e.value.length),t.pos=t.endPos=t.value.length)}function xa(e,t,o){var n;let r=!0;if(t.insertPos<=t.pos)for(;null===(n=t.data)||void 0===n?void 0:n.length;){const n=ia(t.data);if(e.pattern.test(n))return da(t),t.meta.push({type:"char",value:n}),t.chars++,t.unmasked+=n,void fa(e,t);if("string"==typeof t.data){if(o&&t.data.startsWith(o)){r=!1;break}t.data=t.data.substring(n.length)}}for(;r&&t.buffer;){const n=ia(t.buffer);if(e.pattern.test(n))return t.chars++,t.unmasked+=n,ca(t),void t.meta.push({type:"char",value:n});if(t.placeholder&&n===e.placeholder)return ca(t),void t.meta.push({type:"placeholder",value:n});if("string"==typeof t.buffer){if(o&&t.buffer.startsWith(o)){t.buffer=t.buffer.substring(o.length);break}t.buffer=t.buffer.substring(n.length)}}t.placeholder?(t.value+=e.placeholder,t.meta.push({type:"placeholder",value:e.placeholder})):t.endPos=t.pos}function wa(e,t,o,n){const r=[n,n,"none"];if("select"===t.mode){const s=Sa(e),a=Oa(e,r,s),[l,i]=Sa(e,t.value),p=void 0!==a&&_a(o.valueBefore,s[0][a],s[1][a]);if(void 0!==a&&a in l){if(p){const e=l.slice(a).every(((e,o)=>_a(t.value,e,i[a+o])));return e&&l[a-1]?l[a-1]:l[a]}return[n,l[a][1],"none"]}}return r}function _a(e,t,o){if(Js(o))return!1;if(Zs(o)){let n=t[0];for(;n<t[1];){const t=ia(e.substring(n));if(t!==o.placeholder)return!1;n+=t.length}}return!Gs(o)||e.substring(t[0],t[1])===o.placeholder}function ka(e,t){let o="";do{const n=ia(e).toLowerCase(),r=ia(t).toLowerCase();if(n!==r)break;o+=n,e=e.substring(n.length),t=t.substring(r.length)}while(e.length&&t.length);return o}function Sa(e,t){const o=ys.get(e);if(!o)return[[],[]];if(Ss.has(e))return Ss.get(e);const n=null!=t?t:oa(e,e.value),r=[],s=[];let a=null,l=null,i=0,p=!0;for(const e of o)if(Js(e))a=e,null!==l&&(r.push([l,i,"none"]),l=null),i+=e.value.length;else{if(Zs(a)&&Zs(e)&&e.token===a.token)i++;else if(Zs(e))null===l?(l=i,s.push(e)):(r.push([l,i,"none"]),l=i,s.push(e)),i++;else if(Gs(e)){l&&r.push([l,i,"none"]),Aa(e)||(p=!1);const t=La(n,e,i);l=null,r.push([i,i+t,"none"]),s.push(e),i+=t}a=e}null!==l&&r.push([l,i,"none"]);const d=[[...r],[...s]];return p&&!t&&Ss.set(e,d),d}function La(e,t,o){if(Aa(t))return t.values[0].length;const n=e.slice(o),r=Ia(t.values.concat([t.placeholder]),n);return r?r.length:0}function Ia(e,t,o=null,n){var r;if(0===t.length)return o;if(!n){const o=e.find((e=>e.toLowerCase()===t.toLowerCase()));if(o)return o}const s=ia(t.toLowerCase()),a=`${null!=n?n:""}${s}`,l=e.filter((e=>e.toLowerCase().startsWith(a))),i=l.find((e=>e.toLowerCase()===a));return i&&(o=i),0===l.length?o:1===l.length?l[0]:(l.length>1&&(o=l[0]),null!==(r=Ia(l,t.substring(s.length),o,a))&&void 0!==r?r:l[0])}function Da(e,t){return t=t.toLowerCase(),e.some((e=>(e=e.toLowerCase()).startsWith(t.toLocaleLowerCase())&&e!==t))}function Aa(e){if(!Ls.has(e)&&Array.isArray(e.values)&&e.values.length>0){const t=e.values[0].length;if(e.placeholder.length!==t)return!1;Ls.set(e,e.values.every((e=>e.length===t)))}return Ls.get(e)}function Ca(e,t=1){const[o]=Sa(e),n=Oa(e,ra(e,ea(e)));return void 0!==n&&void 0!==o[n+t]&&(e.setSelectionRange(...na(e,o[n+t])),!0)}function Ta(e,t=1){const[o,n]=Sa(e),r=Oa(e,ea(e));if(void 0!==r&&r in n){const s=n[r];if(Gs(s)){const n=o[r],a=e.value.slice(n[0],n[1]);let l=null,i=s.values.indexOf(a);const p=s.values.length-1;if(-1!==i){const e=i+t;i=e<0?p:e>p?0:e,l=s.values[i]}else a===s.placeholder&&(l=t>0?s.values[0]:s.values[p]);if(null!==l){const t={selectionBefore:n,insertPos:n[0],type:"insert",data:l,valueBefore:e.value,cycle:!0};return setTimeout((()=>ta(e,t)),0),!0}}}return!1}function Ea(e,t){if(!e.length)return-1;if(1===e.length)return e[0];const o=e.length/2,n=Number.isInteger(o)?o:Math.floor(o),r=Math.abs(t-e[n-1])<Math.abs(t-e[n])?[0,n]:[n];return Ea(e.slice(...r),t)}function Oa(e,t,o){const[n]=null!=o?o:Sa(e),r=n.findIndex((e=>e[0]!==e[1]&&(!!Qs(e,t)||t[1]>e[0]&&t[1]<e[1])));if(-1!==r)return r;const[s,a]=n.reduce(((e,t,o)=>(e[0].add(t[0]),e[0].add(t[1]),e[1][t[0]]=o,e[1][t[1]]=o,e)),[new Set,{}]),l=Ea([...s],0===t[0]&&t[1]===e.value.length?0:t[1]);return l in a?a[l]:void 0}function Ma(e){var t,o;const n=null!==(t=ms.get(e))&&void 0!==t?t:[];return n[null!==(o=gs.get(e))&&void 0!==o?o:n.length-1]}function Va(e,t=!1){const o=Ma(e);return o&&(o.complete||t)?As.has(e)?[...o.unmasked].reverse().join(""):o.unmasked:t?"":null}function Fa(e){var t;const o=Ma(e);return null!==(t=null==o?void 0:o.meta)&&void 0!==t?t:null}function Pa(e){const t=e=>[...e].reverse().join(""),o=(e,t)=>[t-e[1],t-e[0],e[2]];e.data&&(e.data=t(e.data)),e.valueBefore=t(e.valueBefore),"valueAfter"in e&&(e.valueAfter=t(e.valueAfter)),"selectionAfter"in e&&(e.selectionAfter=o(e.selectionBefore,e.valueAfter.length)),e.selectionBefore=o(e.selectionBefore,e.valueBefore.length)}function Ba(e){if(e.scrollWidth>e.clientWidth&&null!==e.selectionStart&&null!==e.selectionEnd){const t=e.selectionStart/e.value.length,o=e.selectionEnd/e.value.length;e.scrollLeft=o>.9?e.scrollWidth:t*e.scrollWidth-20,e.dispatchEvent(new CustomEvent("input-scroll",{bubbles:!1,detail:e.scrollLeft}))}}const Ha="undefined"!=typeof window,Ra=new WeakSet,Na=new WeakSet,Ka=new WeakSet,Wa=new WeakMap,qa=new WeakMap,Ua=new WeakSet,za=new WeakSet;function Ya(e){e.props.selectedMonth=e.props.selectedYear=e.props.selectedDay=e.props.selectedWeek=void 0}function ja(e){var t,o,n;e.props.selectedMonth=e.props.months.findIndex((t=>Xa(t,e.props.activeDate))),e.props.selectedYear=e.props.years.findIndex((t=>Ga(t,e.props.activeDate)));for(let s=0;s<(null===(t=e.props.calendar[0])||void 0===t?void 0:t.weeks.length);s++)for(let t=0;t<(null===(o=e.props.calendar[0])||void 0===o?void 0:o.weeks[s].length);t++){const o=null===(n=e.props.calendar[0])||void 0===n?void 0:n.weeks[s][t];if(r.sameDay(o,e.props.activeDate)){e.props.selectedWeek=s,e.props.selectedDay=t;break}}}function Za(e){return"timeZoneName"!==e.partName}function Ga(e,t){return t instanceof Date&&e.getFullYear()===t.getFullYear()}function Xa(e,t){return t instanceof Date&&e.getMonth()===t.getMonth()}function Ja(e){e.props.skipBuildCalendar||Ya(e),e.props.selectedIndex=e.props.calendar=_(e.props.showMonths,(e=>e)).map((t=>function(e,t){const o=[],n=r.date(t);n.setDate(1);let s=r.weekStart(n,e.props.weekStart);s.setHours(n.getHours(),n.getMinutes(),n.getSeconds());const a=r.weekEnd(r.monthEnd(t),e.props.weekStart);let l=[];do{l.push(s),7===l.length&&(o.push(l),l=[]),s=r.addDay(s)}while(s.getTime()<=a.getTime());return{monthDay:n,weeks:o}}(e,r.addMonth(e.props.renderedDate,t)))),e.props.years=function(e){const t=Number(r.format(e.props.renderedDate,"YYYY")),o=t-t%10;return e.props.decade=`${o} - ${o+9}`,_(10,(n=>r.addYear(e.props.renderedDate,o+n-t)))}(e),e.props.months=function(e){const t=r.date(e.props.renderedDate);return t.setMonth(0),_(12,(e=>r.addMonth(t,e)))}(e),e.props.skipBuildCalendar?e.props.skipBuildCalendar=!1:e.value&&ja(e)}function Qa(e,t){var o;t.target&&t.target instanceof Element&&(t.target.closest(`#${e.props.id}_popover`)||!(null===(o=e.props.__root)||void 0===o?void 0:o.contains(t.target)))||(e.props.expanded=!1)}function el(e,t){if(!t)return e.props.inputText="",new Date;const o=t instanceof Date?t:r.parse(t,e.props.valueFormat,e.props.valueLocale);return e.props.inputText=e.props.formatDate(o,e.props.format,e.props.locale,!1,Za),o}function tl(t){return Array.isArray(t.props.sequence)?e.clone(t.props.sequence):["day"]}function ol(e,t,o=!0){var n,s;if(e._value===t)return;if(null==t)return e.input(t,o);e.props.offset=e.props.timezone?r.offset(t,e.props.timezone):"+0000";const a=r.applyOffset(t,null!==(n=(s=e.props).offset)&&void 0!==n?n:s.offset="+0000");e.input(r.format(a,e.props.valueFormat,e.props.valueLocale,!1),o)}function nl(e,t){var o;const n=["prev_button","month_button","day_button","year_button","next_button"].find((t=>{var o;return null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_${t}`)})),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_${n}`);r instanceof HTMLElement&&(t.preventDefault(),r.focus())}function rl(e,t){var o;let n="";if(!(t instanceof HTMLInputElement)||e.props.pickerOnly)return;Wa.set(e,t),null===(o=e.props.__root)||void 0===o||o.addEventListener("click",(t=>{e.props.expanded&&t.target instanceof HTMLElement&&t.target.closest(`#${e.props.id}_popover`)?za.add(e):za.delete(e)})),e.on("prop:inputText",(({payload:e})=>{e!==t.value&&("beforeCallback"===Ds.get(t)&&(n=t.value),Ws(t),t.selectionStart=0,t.selectionEnd=t.value.length,function(e,t){var o,n;if(!ms.has(e))return;const r=null!==(o=Cs.get(e))&&void 0!==o?o:"",s=null!==(n=Ts.get(e))&&void 0!==n?n:"";ta(e,{type:"insert",selectionBefore:ea(e),data:t,valueBefore:e.value,suffix:s,prefix:r})}(t,e),t.value=e,setTimeout((()=>qs(t)),10))}));const[s,a]=function(e){const t=e.props.locale,o=["full","long","medium","short"].includes(e.props.format)||"object"==typeof e.props.format,n=r.parts(e.props.format,t),s=r.formatStr(e.props.format,t,!0,Za);return[s,n.reduce(((n,s)=>{if("literal"===s.partName)return n;let a=r.range(s.token,t,o);if("YYYY"===s.token&&e.props.minDate&&e.props.maxDate){const t=e.props.minDate.getFullYear();a=_(e.props.maxDate.getFullYear()-t+1,(e=>String(t+e)))}const l={type:"enum",token:s.token,values:a,placeholder:"A"===s.token?"A/P":s.token,selectDirection:"left"};return n.push(l),s.token.startsWith("D")&&qa.set(e,a),n}),[])]}(e);Ks(t,{pattern:s,explicitParts:a,onChange:({valueAfter:o})=>{if(sl(e),Ra.has(e))return Ra.delete(e);n&&n===o?n="":(Ws(t),e.props.inputText=o,setTimeout((()=>qs(t)),10))}},e)}function sl(e){var t,o;if(e.props.overlay){const n=Wa.get(e);!n||!(null===(t=e.props.attrs)||void 0===t?void 0:t.placeholder)||e._value||Va(n,!0)||e.props._isFocused||e.props.activeDate&&e.props.expanded?n&&(e.props._isPlaceholder=!1,e.props._overlayParts=_e(Fa(n))):(e.props._isPlaceholder=!0,e.props._overlayParts=[{type:"placeholder",value:null===(o=e.props.attrs)||void 0===o?void 0:o.placeholder}])}}function al(e,t){return!t||(!(!e.props.minDate||!r.isBefore(t,e.props.minDate))||(!(!e.props.maxDate||!r.isAfter(t,e.props.maxDate))||void 0))}function ll(e){return"function"==typeof e.props.validationLabel?e.props.validationLabel(e):e.props.validationLabel||e.props.label||e.props.name||String(e.name)}const il="undefined"!=typeof window,pl=new WeakMap;function dl(e,t){var o,n;if(t instanceof HTMLInputElement&&!pl.get(e)&&il){const r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_overlay`),s=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}_overlay_inner`);if(r&&t&&s){pl.set(e,r);const o=getComputedStyle(t).color;t.style.color="transparent",t.style.caretColor=o;const n=new ResizeObserver((()=>{var o;const n=getComputedStyle(t),r=t.getBoundingClientRect(),s=null===(o=t.parentElement)||void 0===o?void 0:o.getBoundingClientRect();e.props._overlayStyles={...e.props._overlayStyles,width:n.width,height:n.height,boxSizing:n.boxSizing,padding:n.padding,margin:n.margin,fontSize:n.fontSize,lineHeight:n.lineHeight,top:r.top-((null==s?void 0:s.top)||r.top)+"px",left:r.left-((null==s?void 0:s.left)||r.left)+"px"}}));n.observe(t);const a=e=>{s.scrollLeft=e.detail};t.addEventListener("input-scroll",a),e.on("destroyed",(()=>{t.removeEventListener("input-scroll",a),n.disconnect()}))}}}function cl(t){t.addProps(["_overlayStyles","_overlayParts","_overlayInnerStyles","_isPlaceholder"]),t.props._overlayStyles={position:"absolute",top:"0",left:"0",pointerEvents:t.props._isPlaceholder?"auto":"none"},t.props._overlayInnerStyles={overflow:"hidden",whiteSpace:"nowrap",paddingRight:"20px"},t.on("created",(()=>{t.props.overlay=e.undefine(t.props.overlay),t.props.pickerOnly=e.undefine(t.props.pickerOnly),t.props.overlay=t.props.pickerOnly?void 0:t.props.overlay,t.props.overlay&&e.whenAvailable(`${t.props.id}`,dl.bind(null,t),t.props.__root)})),t.on("prop:_isPlaceholder",(()=>{t.props._overlayStyles={...t.props._overlayStyles,pointerEvents:t.props._isPlaceholder?"auto":"none"}}))}const ul={schema:/* #__PURE__ */xr(/* #__PURE__ */wr(/* #__PURE__ */Sr("$label"),/* #__PURE__ */_r(/* #__PURE__ */kr("prefix"),/* #__PURE__ */Lr(),/* #__PURE__ */us(/* #__PURE__ */vs(/* #__PURE__ */fs(/* #__PURE__ */is("$part.value"),/* #__PURE__ */ps("$part.value"),/* #__PURE__ */ds("$part.value"),/* #__PURE__ */cs("$part.value")))),/* #__PURE__ */Tr(),/* #__PURE__ */Er(/* #__PURE__ */Gr(/* #__PURE__ */Vr(/* #__PURE__ */Fr("$ui.prev.value"),/* #__PURE__ */kr("prev")),/* #__PURE__ */Xr("$decade"),/* #__PURE__ */Jr(/* #__PURE__ */ts()),/* #__PURE__ */Qr(/* #__PURE__ */os(),/* #__PURE__ */ts()),/* #__PURE__ */es(/* #__PURE__ */os(),/* #__PURE__ */ns(),/* #__PURE__ */ts()),/* #__PURE__ */Or(/* #__PURE__ */Mr("$ui.next.value"),/* #__PURE__ */kr("next")),/* #__PURE__ */ls(/* #__PURE__ */kr("close"))),/* #__PURE__ */hs(/* #__PURE__ */zr(/* #__PURE__ */Yr("$fns.format($year, $yearFormat)")),/* #__PURE__ */jr(/* #__PURE__ */Zr("$fns.format($month, $monthFormat)")),/* #__PURE__ */Pr(/* #__PURE__ */Hr(/* #__PURE__ */Rr(/* #__PURE__ */Nr("$fns.format($day, $weekdayFormat)"))),/* #__PURE__ */Br(/* #__PURE__ */Kr(/* #__PURE__ */Wr(/* #__PURE__ */qr("$fns.format($day, $dateFormat)"))))),/* #__PURE__ */ss(/* #__PURE__ */as()))),/* #__PURE__ */rs(/* #__PURE__ */kr("clear")),/* #__PURE__ */Ur(/* #__PURE__ */kr("calendar")),/* #__PURE__ */Ir(),/* #__PURE__ */kr("suffix"))),/* #__PURE__ */Dr("$help"),/* #__PURE__ */Ar(/* #__PURE__ */Cr("$message.value"))),type:"input",family:"text",props:["dateFormat","dayButtonFormat","format","monthButtonFormat","monthFormat","overlay","pickerOnly","showMonths","showPagination","weekStart","weekdayFormat","yearFormat","years"],features:[cl,function(o){var n,s,a,l,i,p,d,c,u,f,v,h,m,g,$,b,y,x,w,k,S,L;o.addProps(["_isDisabled","_isFocused","activeDate","calendar","clearable","disabled","decade","disabledDays","expanded","inputText","localTime","maxDate","maxScan","minDate","months","offset","paginatedPanels","panel","pickerOnly","renderedDate","sequence","timezone","valueFormat","valueLocale","showPanelClose","selectedDay","selectedWeek","selectedMonth","selectedYear"]),o.hook.prop(((e,t)=>("expanded"===e.prop&&o.props.disabled&&(e.value=!1),"weekStart"===e.prop&&(e.value=Number(e.value||0)),"showMonths"===e.prop&&(e.value=Number(e.value||1)),"maxScan"===e.prop&&(e.value=Number(e.value||7)),"timezone"===e.prop&&("string"==typeof o._value||o._value instanceof Date)&&(o.props.offset=r.offset(o._value,e.value)),t(e)))),o.props._isFocused=!1,o.props._isPlaceholder=!1,null!==(n=(h=o.props).valueFormat)&&void 0!==n||(h.valueFormat="ISO8601"),null!==(s=(m=o.props).weekdayFormat)&&void 0!==s||(m.weekdayFormat="d"),null!==(a=(g=o.props).monthFormat)&&void 0!==a||(g.monthFormat="MMM"),null!==(l=($=o.props).monthButtonFormat)&&void 0!==l||($.monthButtonFormat="MMMM"),null!==(i=(b=o.props).dayButtonFormat)&&void 0!==i||(b.dayButtonFormat="D"),null!==(p=(y=o.props).dateFormat)&&void 0!==p||(y.dateFormat="D"),null!==(d=(x=o.props).yearFormat)&&void 0!==d||(x.yearFormat="YYYY"),null!==(c=(w=o.props).paginatedPanels)&&void 0!==c||(w.paginatedPanels=["day","year"]),null!==(u=(k=o.props).valueLocale)&&void 0!==u||(k.valueLocale=o.props.locale),null!==(f=(S=o.props).format)&&void 0!==f||(S.format="long"),o.props.panels=tl(o),o.props.pickerOnly=e.undefine(o.props.pickerOnly),"disabled"in o.props&&(o.props.disabled=e.undefine(o.props.disabled)),"clearable"in o.props&&(o.props.clearable=e.undefine(o.props.clearable)),null!==(v=(L=o.props).maxScan)&&void 0!==v||(L.maxScan=7),o.props._isDisabled="function"==typeof o.props.disabledDays?o.props.disabledDays.bind(null,o):al.bind(null,o),o.props.calendar=[],o.props.inputText="",o.props.showMonths=o.props.showMonths||1,"function"==typeof o.props.format?(o.props.formatDate=o.props.format,o.props.format=null):o.props.formatDate=r.format,Ja(o),o.on("mounted",(()=>{e.whenAvailable(`${o.props.id}`,rl.bind(null,o),o.props.__root)})),o.on("created",(()=>{if(function(e){const t=e._value;let o=new Date;if(t instanceof Date)o=r.date(t);else if("string"==typeof t)try{const n=r.parse(t,e.props.valueFormat,e.props.valueLocale);o=r.date(n)}catch{console.warn(`Date (${t}) does not match format (${r.formatStr(e.props.valueFormat,e.props.valueLocale)})`),o=void 0}else t||(o=void 0);if(e.props.offset=e.props.timezone?r.offset(o||new Date,e.props.timezone):"+0000",e.props.minDate){const t="string"==typeof e.props.minDate?r.parse(e.props.minDate):e.props.minDate;e.props.minDate=r.removeOffset(t,e.props.offset)}if(e.props.maxDate){const t="string"==typeof e.props.maxDate?r.parse(e.props.maxDate):e.props.maxDate;e.props.maxDate=r.removeOffset(t,e.props.offset)}o=o&&r.removeOffset(o,e.props.offset),o&&ol(e,o,!1);let n=o||new Date;e.props.minDate&&n<e.props.minDate?n=e.props.minDate:e.props.maxDate&&n>e.props.maxDate&&(n=e.props.maxDate),e.props.renderedDate=n,e.props.activeDate=n,e.props.localTime=o&&r.format(o,"HH:mm")||"12:00"}(o),o.context){const e={};let t;o.context.fns.format=(t,n)=>{if(e[n]&&e[n][t.toString()])return e[n][t.toString()];const s=r.format(t,n,o.props.locale||"en",!1,Za);return e[n]?e[n][t.toString()]=s:e[n]={[t.toString()]:s},s},o.context.fns.isDisabled=o.props._isDisabled,o.context.fns.isDisabledMonth=e=>!r.nearestDay(e,(e=>!o.props._isDisabled(e)),"month"),o.context.fns.isDisabledYear=e=>!r.nearestDay(e,(e=>!o.props._isDisabled(e)),"year"),o.context.handlers._blur=e=>{var t,n;o.props._isFocused=!1,"function"==typeof(null===(t=o.context)||void 0===t?void 0:t.handlers.blur)&&(null===(n=o.context)||void 0===n||n.handlers.blur(e))},o.context.handlers.closePanel=()=>{o.props.expanded=!1},o.context.handlers._blurOut=e=>t=>{var n;t.preventDefault(),o.props.keydown?o.props.keydown=!1:e&&e!==o.props.panel||o.props.pickerOnly&&t.relatedTarget instanceof Element&&(t.relatedTarget===document.getElementById(`${o.props.id}_inner`)||t.relatedTarget.closest(`#${o.props.id}_inner`))||t.relatedTarget&&t.relatedTarget instanceof Element&&(t.relatedTarget.closest(`#${o.props.id}_popover`)||!(null===(n=o.props.__root)||void 0===n?void 0:n.contains(t.relatedTarget))||t.relatedTarget.id===`${o.props.id}_popover`)||(o.props.expanded=!1)},o.context.handlers.overlayClick=()=>{const e=Wa.get(o);e&&(e.focus(),o.props._isPlaceholder=!1)},o.context.handlers.focus=()=>{o.props.pickerOnly||(o.props._isFocused=!0,o.props.pickerOnly&&!Na.has(o)&&(Ka.add(o),o.props.expanded=!0,setTimeout((()=>Ka.delete(o)),200)))},o.context.handlers.clear=()=>{var e,t;ol(o,void 0,!0),el(o,void 0);const n=null===(t=null===(e=o.props)||void 0===e?void 0:e.__root)||void 0===t?void 0:t.getElementById(`${o.props.id}`);n instanceof HTMLInputElement&&(n.focus(),setTimeout((()=>{n.setSelectionRange(0,0)}),50))},o.context.handlers.dateInput=e=>{var t;if(Ua.has(o))return Ua.delete(o);if(e.target instanceof HTMLInputElement&&!o.props.expanded)try{let n=r.parse({date:e.target.value,format:o.props.format,locale:o.props.locale,partFilter:Za});if(function(e){return r.parts(e.props.format,e.props.locale).some((e=>"weekday"===e.partName))}(o)&&o.props.activeDate instanceof Date&&o.props.activeDate.getTime()===n.getTime()&&!Os.get(e.target)&&r.format(n,o.props.format,o.props.locale,!1,Za)!==e.target.value){const s=r.range("dddd",o.props.locale),a=r.parts(o.props.format,o.props.locale),l=null===(t=r.parseParts(e.target.value,a).find((e=>"dddd"===e.token)))||void 0===t?void 0:t.value,i=r.format(n,"dddd",o.props.locale);if(l&&s.includes(l)&&i!==l){let e=s.indexOf(l)-s.indexOf(i);e=e<-1?7+e:e,n=r.addDay(n,e),Ra.add(o)}}ol(o,n)}catch(e){ol(o,void 0)}},o.context.handlers.open=()=>{o.props.expanded=!0},o.context.handlers.next=()=>{switch(o.props.panel){case"year":return void(o.props.renderedDate=r.addYear(o.props.renderedDate,10));case"day":return void(o.props.renderedDate=r.addMonth(o.props.renderedDate,1))}},o.context.handlers.prev=()=>{switch(o.props.panel){case"year":return void(o.props.renderedDate=r.addYear(o.props.renderedDate,-10));case"day":return void(o.props.renderedDate=r.addMonth(o.props.renderedDate,-1))}},o.context.handlers.setDate=e=>()=>{"month"!==o.props.panel&&"year"!==o.props.panel||!o.props.activeDate||(e=o.props.activeDate),o.emit("dateSelected",e)},o.context.handlers.localTime=e=>{const t=e.target;if(!t.value)return;const[n,r]=t.value.split(":");o.props.localTime=t.value,o.props.activeDate.setHours(n,r),el(o,o.props.activeDate)},o.context.handlers.keyDown=e=>{switch(o.props.keydown=!0,o.props.panel){case"day":return o.emit("calendarKeydown",e);case"year":return o.emit("yearKeydown",e);case"month":return o.emit("monthKeydown",e);case"time":return o.emit("timeKeydown",e);default:return}},o.context.handlers.inputKeydown=e=>{o.emit("keydown",e)},o.context.handlers.openKeydown=e=>{"Enter"!==e.key&&"Space"!==e.key||(o.props.expanded=!0)},o.context.handlers.mouseEnter=e=>n=>{if(clearTimeout(t),n.target instanceof HTMLElement&&"-1"===n.target.getAttribute("tabindex")&&"true"!==n.target.getAttribute("data-is-extra"))if("month"===o.props.panel||"year"===o.props.panel){const t=r.nearestDay(e,(()=>!0),o.props.panel);t&&(o.props.activeDate=t)}else o.props.activeDate=e},o.context.handlers.mouseLeave=()=>{clearTimeout(t),t=setTimeout((()=>{}),100)},o.context.handlers.jumpTo=e=>()=>{o.props.panels.unshift(o.props.panel),o.props.panel=e},o.context.fns.sameDay=e=>function(e,t){return t instanceof Date&&r.sameDay(e,t)}(e,o.props.activeDate),o.context.fns.sameMonth=e=>Xa(e,o.props.activeDate),o.context.fns.sameYear=e=>Ga(e,o.props.activeDate),o.context.fns.notInMonth=(e,t)=>{const o=r.dayStart(t).getTime();return o<r.monthStart(e).getTime()||o>r.monthEnd(e).getTime()||void 0}}}));const I=Qa.bind(null,o);o.on("prop:panel",(({payload:e})=>{o.props.showPagination=o.props.paginatedPanels.includes(e)})),o.on("dateSelected",(({payload:e})=>{var t,n;Array.isArray(o.props.panels)&&o.props.panels.length?o.props.panel=o.props.panels.shift():(o.props.expanded=!1,null===(n=null===(t=o.props.__root)||void 0===t?void 0:t.getElementById(`${o.props.id}`))||void 0===n||n.focus()),e&&o.props._isDisabled(e)||ol(o,e)})),o.on("input",(({payload:e})=>{if(void 0===e&&!o.props._isFocused)return void el(o,void 0);const t=new Date,n=e?el(o,r.removeOffset("string"==typeof e?r.parse(e,o.props.valueFormat,o.props.valueLocale):e,o.props.offset)):t;o.props.activeDate=!e&&o.props.activeDate?o.props.activeDate:n,o.props.renderedDate=!e&&o.props.renderedDate?o.props.renderedDate:n,o.props.localTime=r.format(n,"HH:mm"),function(e){const t=qa.get(e);if(e._value&&t){const o=r.monthDays(e.props.activeDate);if(t.length>o)t.splice(o,t.length-o);else if(t.length<o)for(let e=t.length+1;e<=o;e++)t.push(String(e))}}(o)})),o.on("prop:renderedDate",Ja.bind(null,o)),o.on("prop:expanded",(({payload:t})=>{if(t){if(za.delete(o),o.props.panels=tl(o),o.props.panel=o.props.panels.shift(),window.innerWidth<=430&&!window.matchMedia("(hover: hover)").matches?o.props.showPanelClose=!0:o.props.showPanelClose=!1,"day"===o.props.panel){const e=o.props.activeDate;o.props.activeDate=r.nearestDay(o.props.activeDate,(e=>!o.props._isDisabled(e)),"month")||e}Ja(o),e.whenAvailable(`${o.props.id}_popover`,(e=>{const t=e.querySelector('[tabindex="0"]');t&&setTimeout((()=>{t.focus(),function(e,t){const o=new MutationObserver((e=>{for(const t of e)"attributes"===t.type&&t.target instanceof HTMLElement&&"0"===t.target.getAttribute("tabindex")?t.target.focus():t.addedNodes.length&&t.addedNodes.forEach((e=>{var t;if(e instanceof HTMLElement&&"0"===e.getAttribute("tabindex"))e.focus();else if(e instanceof HTMLElement&&e.querySelector('[tabindex="0"]')){const t=e.querySelector('[tabindex="0"]');t instanceof HTMLElement&&t.focus()}else e instanceof HTMLElement&&e.querySelector('input[type="time"]')&&(null===(t=e.querySelector('input[type="time"]'))||void 0===t||t.focus())}))}));o.observe(t,{attributes:!0,attributeFilter:["tabindex"],childList:!0,subtree:!0});const n=e.on("prop:expanded",(({payload:t})=>{t||(e.off(n),o.disconnect())}))}(o,e)}),0)}),o.props.__root),Ha&&setTimeout((()=>{document.addEventListener("click",I)}),10)}else{if("time"===o.props.panel)o.emit("dateSelected",o.props.activeDate);else if(o._value){Ua.add(o);const e="string"==typeof o._value?r.parse(o._value,o.props.valueFormat,o.props.valueLocale):o._value;el(o,r.removeOffset(e,o.props.offset))}else el(o,void 0);Ha&&(Na.add(o),document.removeEventListener("click",I),setTimeout((()=>Na.delete(o)),50))}})),o.on("prop:activeDate",(({payload:e})=>{if(Array.isArray(o.props.calendar)&&o.props.calendar.length)if("day"===o.props.panel){const t=o.props.calendar,n=r.monthStart(o.props.renderedDate),s=r.monthEnd(r.addMonth(o.props.renderedDate,t.length-1));e.getTime()<n.getTime()?o.props.renderedDate=r.addMonth(o.props.renderedDate,-1):e.getTime()>s.getTime()&&(o.props.renderedDate=r.addMonth(o.props.renderedDate))}else if("year"===o.props.panel){const t=o.props.years,n=t[0].getFullYear(),s=t[t.length-1].getFullYear(),a=o.props.activeDate.getFullYear();a>s?o.props.renderedDate=r.addYear(o.props.renderedDate,10):a<n?o.props.renderedDate=r.addYear(o.props.renderedDate,-10):(o.props.skipBuildCalendar=!0,o.props.renderedDate=e)}o.props.expanded&&el(o,o.props.activeDate)})),o.on("keydown",(({payload:e})=>{switch(e.key){case"ArrowDown":case"ArrowUp":case" ":e.preventDefault(),o.props.pickerOnly&&(o.props.expanded=!0);break;case"Enter":case"Return":o.props.expanded||(o.props.expanded=!0);break;case"Escape":o.props.expanded=!1}})),o.on("calendarKeydown",(({payload:e})=>{e.preventDefault();let t=null,n=0;switch(e.key){case"ArrowRight":n=1;break;case"ArrowLeft":n=-1;break;case"ArrowDown":n=7;break;case"ArrowUp":n=-7;break;case"Return":case"Enter":o.emit("dateSelected",o.props.activeDate);break;case"Tab":e.shiftKey||nl(o,e);break;case"Escape":o.props.expanded=!1}if(n&&(e.preventDefault(),t=r.addDay(o.props.activeDate,n)),t&&!o.props._isDisabled(t))o.props.activeDate=t;else if(t&&o.props._isDisabled(t)){const e=n>0?1:-1;_(Number(o.props.maxScan),(t=>e*t)).some((e=>{const n=r.addDay(t,e);return!o.props._isDisabled(n)&&(o.props.activeDate=n,!0)}))}})),o.on("yearKeydown",(({payload:e})=>{let t=0;switch(e.key){case"ArrowDown":t=5;break;case"ArrowRight":t=1;break;case"ArrowUp":t=-5;break;case"ArrowLeft":t=-1;break;case"Tab":e.shiftKey||nl(o,e);break;case"Return":case"Enter":o.emit("dateSelected",o.props.activeDate);break;case"Escape":o.props.expanded=!1}const n=o.props.activeDate.getFullYear()+t-o.props.renderedDate.getFullYear();o.props.activeDate=r.addYear(o.props.renderedDate,n)})),o.on("monthKeydown",(({payload:e})=>{let t=0;switch(e.key){case"ArrowDown":t=3;break;case"ArrowRight":t=1;break;case"ArrowLeft":t=-1;break;case"ArrowUp":t=-3;break;case"Tab":e.shiftKey||nl(o,e);break;case"Return":case"Enter":o.emit("dateSelected",o.props.activeDate);break;case"Escape":o.props.expanded=!1}t&&e.preventDefault();let n=(o.props.activeDate.getMonth()+t)%12;n=n<0?12+n:n;const s=n-o.props.renderedDate.getMonth();let a=r.addMonth(o.props.renderedDate,s);if(o.props._isDisabled(a)){const e=r.nearestDay(a,(e=>!o.props._isDisabled(e)),"month");e&&(a=e)}o.props.activeDate=a})),o.on("timeKeydown",(({payload:e})=>{switch(e.key){case"Return":case"Enter":e.preventDefault(),o.emit("dateSelected",o.props.activeDate)}})),o.on("prop:_isFocused",(()=>{Wa.get(o)&&sl(o)})),o.on("commit",(({payload:e})=>{if(e?ja(o):Ya(o),o.props.activeDate&&o.props._isDisabled(o.props.activeDate)){const e=t.createMessage({blocking:!0,key:"rule_invalidDate",meta:{messageKey:"invalidDate",removeImmediately:!1,localize:!0,i18nArgs:[{node:o,name:ll(o),args:[]}]},type:"validation",value:"The selected date is invalid."});o.store.set(e)}else o.store.remove("rule_invalidDate")}))},jt,
29
+ /* #__PURE__ */ut.bind(null,tr,or,$r),jt]},yr=/* #__PURE__ */K("dp"),{outer:xr,wrapper:wr,inner:_r,icon:kr,label:Sr,prefix:Lr,suffix:Ir,help:Dr,messages:Ar,message:Cr}=/* #__PURE__ */W(yr),Tr=yr("input",(()=>({$el:"input",bind:"$attrs",attrs:{name:"$node.name",id:"$id",onKeydown:"$handlers.inputKeydown",value:"$inputText",onInput:"$handlers.dateInput",onClick:"$pickerOnly && $handlers.open",onBlur:"$handlers._blur",onFocus:"$handlers.focus",readonly:"$pickerOnly || $expanded",disabled:"$disabled"}}))),Er=yr("panelWrapper",(()=>({$el:"div",if:"$expanded",attrs:{id:'$id + "_popover"',role:"dialog",onBlur:"$handlers._blurOut()",tabindex:"-1",popover:"$popover","aria-modal":"true","aria-label":"Choose date","data-panel":"$panel",style:{if:"$usePopover",then:{margin:0,top:'$popoverCoordinates.y + "px"',left:'$popoverCoordinates.x + "px"',width:'$popoverCoordinates.width + "px"'}}}}))),Or=yr("next",(()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _next_button",type:"button",onClick:"$handlers.next"}}))),Mr=yr("nextLabel","span"),Vr=yr("prev",(()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _prev_button",type:"button",onClick:"$handlers.prev"}}))),Fr=yr("prevLabel","span"),Pr=yr("calendar",(()=>({if:'$panel === "day"',$el:"table",for:["month","$calendar"],attrs:{key:'$fns.format($month.monthDay, "YYYY-MM")'}}))),Br=yr("calendarWeeks",(()=>({$el:"tbody"}))),Hr=yr("calendarHeader",(()=>({$el:"thead"}))),Rr=yr("weekDays",(()=>({$el:"tr"}))),Nr=yr("weekDay",(()=>({$el:"th",for:["day","$month.weeks.0"],attrs:{"aria-label":'$fns.format($day, "dddd")'}}))),Kr=yr("week",(()=>({$el:"tr",for:["week","weekIndex","$month.weeks"]}))),Wr=yr("dayCell",(()=>({$el:"td",for:["day","dayIndex","$week"],attrs:{key:"$day",onClick:"$handlers.setDate($day)",onKeydown:"$handlers.keyDown",onMouseenter:"$handlers.mouseEnter($day)",onMouseleave:"$handlers.mouseLeave",onBlur:"$handlers._blurOut(day)",tabindex:'$fns.sameDay($day) && "0" || "-1"',"data-is-extra":"$fns.notInMonth($month.monthDay, $day)","data-disabled":"$fns.isDisabled($day)","aria-selected":"$selectedWeek === $weekIndex && $selectedDay === $dayIndex","aria-label":'$fns.format($day, "long")'}}))),qr=yr("day","div"),Ur=yr("openButton",(()=>({$el:"div",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',type:"div",role:"button",onClick:"$handlers.open",onKeydown:"$handlers.openKeydown",tabIndex:'$pickerOnly && "-1" || "0"',"data-disabled":"$disabled","aria-disabled":"$disabled","aria-label":'$value && ($ui.changeDate.value + ", " + $inputText) || $ui.chooseDate.value',"aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined'}}))),zr=yr("years",(()=>({if:'$panel === "year"',$el:"ul",attrs:{id:'$id + "_years"'}}))),Yr=yr("year",(()=>({for:["year","yearIndex","$years"],$el:"li",attrs:{key:'$: "year" + $fns.format($year, "YYYY")',onClick:"$handlers.setDate($year)",onKeydown:"$handlers.keyDown",onMouseenter:"$handlers.mouseEnter($year)",onMouseleave:"$handlers.mouseLeave",onBlur:"$handlers._blurOut(year)",tabindex:'$fns.sameYear($year) && "0" || "-1"',"aria-selected":"$selectedYear === $yearIndex","data-disabled":"$fns.isDisabledYear($year)","aria-label":"$fns.format($year, $yearFormat)"}}))),jr=yr("months",(()=>({if:'$panel === "month"',$el:"ul"}))),Zr=yr("month",(()=>({$el:"li",for:["month","index","$months"],attrs:{key:"$month",onClick:"$handlers.setDate($month)",onKeydown:"$handlers.keyDown",onMouseenter:"$handlers.mouseEnter($month)",onMouseleave:"$handlers.mouseLeave",onBlur:"$handlers._blurOut(month)",tabindex:'$fns.sameMonth($month) && "0" || "-1"',"aria-selected":"$selectedMonth === $index","data-disabled":"$fns.isDisabledMonth($month)"}}))),Gr=yr("panelHeader",(()=>({$el:"header",attrs:{"aria-live":"polite"}}))),Xr=yr("yearsHeader",(()=>({$el:"div",if:'$panel === "year"'}))),Jr=yr("monthsHeader",(()=>({$el:"div",if:'$panel === "month"'}))),Qr=yr("daysHeader",(()=>({$el:"div",if:'$panel === "day"'}))),es=yr("timeHeader",(()=>({$el:"div",if:'$panel === "time"'}))),ts=yr("yearButton",(()=>({$el:"button",attrs:{type:"button",id:"$id + _year_button",onClick:"$handlers.jumpTo(year)"},children:"$fns.format($renderedDate, $yearFormat)"}))),os=yr("monthButton",(()=>({$el:"button",attrs:{type:"button",id:"$id + _month_button",onClick:"$handlers.jumpTo(month)"},children:"$fns.format($renderedDate, $monthButtonFormat)"}))),ns=yr("dayButton",(()=>({$el:"button",attrs:{type:"button",id:"$id + _day_button",onClick:"$handlers.jumpTo(day)",tabindex:"2"},children:"$fns.format($renderedDate, $dayButtonFormat)"}))),rs=yr("removeSelection",(()=>({$el:"button",if:"$clearable && $_value",attrs:{id:'$id + "_remove_selection"',type:"button",onClick:"$handlers.clear","aria-controls":"$id"}}))),ss=yr("time",(()=>({$el:"div",if:'$panel === "time"'}))),as=yr("timeInput",(()=>({$el:"input",attrs:{type:"time",value:"$localTime",onInput:"$handlers.localTime",onKeydown:"$handlers.keyDown",spellcheck:"false",onBlur:"$handlers._blurOut(time)"}}))),ls=yr("panelClose",(()=>({$el:"button",if:"$showPanelClose && ($inline === undefined || $inline === false)",attrs:{type:"button",class:"$classes.panelClose",onClick:"$handlers.closePanel",tabindex:-1,"aria-label":"$ui.close.value"}}))),{overlayPlaceholder:is,overlayLiteral:ps,overlayChar:ds,overlayEnum:cs,overlay:us,overlayParts:fs,overlayInner:vs}=/* #__PURE__ */q(yr),hs=yr("panel","div"),ms=/* #__PURE__ */new WeakMap,gs=/* #__PURE__ */new WeakMap,$s=new WeakSet,bs=/* #__PURE__ */new WeakMap,ys=/* #__PURE__ */new WeakMap,xs=new WeakSet,ws=/* #__PURE__ */new WeakMap,_s=/[\uD800-\uDBFF]/,ks=/* #__PURE__ */new WeakMap,Ss=/* #__PURE__ */new WeakMap,Ls=/* #__PURE__ */new WeakMap,Is=/* #__PURE__ */new WeakMap,Ds=/* #__PURE__ */new WeakMap,As=new WeakSet,Cs=/* #__PURE__ */new WeakMap,Ts=/* #__PURE__ */new WeakMap,Es=/* #__PURE__ */new WeakMap,Os=/* #__PURE__ */new WeakMap;let Ms=!1;const Vs=()=>{Ms=!0,setTimeout((()=>{Ms=!1}),500)},Fs={"#":{type:"char",pattern:/\d/,token:"#",placeholder:"_",selectDirection:"right"},a:{type:"char",pattern:/[a-zA-Z]/,token:"a",placeholder:"_",selectDirection:"left"},h:{type:"char",pattern:/[0-9a-fA-F]/,token:"h",placeholder:"_",selectDirection:"left"},"*":{type:"char",pattern:/./,token:"*",placeholder:"_",selectDirection:"left"}},Ps=/* #__PURE__ */new WeakMap,Bs="undefined"!=typeof window;let Hs=!1,Rs=!1;function Ns(){Bs&&!Rs&&(Rs=!0,document.addEventListener("selectionchange",(()=>{const e=ke();if(!(e instanceof HTMLInputElement))return;if(Os.has(e))return function(e){const t=Os.get(e);if(t){const[o,n]=t,[r,s]=Sa(e),a=s.indexOf(o);if(-1===a)return void Os.delete(e);const l=r[a],i=[l[0]+n[0],l[1],"none"];Qs(ea(e),i)||aa(e,i)}}(e);if("select"!==ws.get(e))return;const t=ea(e);if(!Qs(t,Ps.get(e))){if(Ps.set(e,t),$s.has(e))return $s.delete(e);e.dispatchEvent(new CustomEvent("selection",{detail:ea(e)}))}})))}function Ks(e,t,o){var n;if(Ns(),ms.has(e))return;ms.set(e,[]),t.reverse&&As.add(e),t.prefix&&Cs.set(e,t.prefix),t.suffix&&Ts.set(e,t.suffix),Ys(e,t.pattern,t.partOverrides,t.explicitParts);const r=ys.get(e),s=null==r?void 0:r.some((e=>Gs(e))),a=null==r?void 0:r.some((e=>function(e){return!!e&&("group"===e.type&&Array.isArray(e.parts))}(e)));if(s&&a)throw new Error("Cannot use enums and groups in the same mask.");const l=s?"select":null!==(n=t.mode)&&void 0!==n?n:"shift";if(a&&"select"===l)throw new Error("Cannot use groups in select mode.");(t.placeholder||"select"===l)&&xs.add(e),ws.set(e,l),t.onChange&&Is.set(e,t.onChange);let i=!1;e.addEventListener("beforeinput",(o=>{if(Hs)return;if("insertLineBreak"===o.inputType)return;if(o.inputType.startsWith("history"))return function(e,t){e.addEventListener("input",(o=>{var n;o.preventDefault(),o.stopImmediatePropagation();const r=ms.get(e);if(null==r?void 0:r.length){const o=(null!==(n=gs.get(e))&&void 0!==n?n:r.length-1)+(t.endsWith("Undo")?-1:1),s=r[o];if(!s)return;la(e,s),e.setSelectionRange(...s.selectionAfter),gs.set(e,o),Is.has(e)&&Is.get(e)(s,e)}}),{once:!0})}(e,o.inputType);o.preventDefault(),i=!0;const n=(r=o.inputType).startsWith("insert")?"insert":!!r.startsWith("delete")&&("deleteContentForward"===r?"deleteContentForward":"deleteContentBackward");var r;const s=ea(e),a=e.value;n&&ta(e,{type:n,selectionBefore:s,data:o.data,valueBefore:a,suffix:t.suffix,prefix:t.prefix})})),e.addEventListener("input",(t=>{i=!1,"data"in t||!i&&o&&(o.input(e.value,!1),o.props._maskValue=e.value)})),"select"===l&&e.addEventListener("keydown",(t=>{switch(t.key){case"ArrowRight":return t.preventDefault(),Ca(e);case"ArrowLeft":return t.preventDefault(),Ca(e,-1);case"ArrowUp":return void(Ta(e,1)&&t.preventDefault());case"ArrowDown":return void(Ta(e,-1)&&t.preventDefault());case"Tab":return Ms?void t.preventDefault():void(Ca(e,t.shiftKey?-1:1)&&t.preventDefault())}})),e.addEventListener("focus",(()=>function(e){var t;const o=xs.has(e),n=ws.get(e);if(o){let o=null,r=null,s=!1;const a="shift"===n?0:1,l=e.value;ga(e,{type:"insert",data:l,selectionBefore:[0,0,"none"],valueBefore:l},"shift"===n?"":l,((e,t)=>(null===o&&"char"===t.type&&(o=e.pos-a),(Zs(t)||Gs(t))&&e.value.endsWith(t.placeholder)?(r=e.pos-a,!1):("char"===t.type&&(s=!0),!0))));const i=null!==(t=null!=r?r:s?l.length:o)&&void 0!==t?t:null;if(null!==i){let t=[i,i,"none"];if("select"===ws.get(e)){const[o]=Sa(e),n=Oa(e,t);void 0!==n&&n in o&&(t=o[n])}return function(e,t,o=50){ks.set(e,na(e,t));const n=async()=>{if(!Bs||ke()!==e)return;"select"===ws.get(e)&&(await new Promise((e=>setTimeout(e,10))),function(e){let t=ea(e);if(t[0]===t[1]&&0===t[0]||e.value.length===t[1]&&0===t[0])return;t=ra(e,t);const[o]=Sa(e),n=Oa(e,t),r=t[0];void 0!==n&&o.some((e=>r>=e[0]&&r<e[1]))&&ks.set(e,na(e,o[n]))}(e));const t=ks.get(e);t&&e.setSelectionRange(...t)};n(),document.addEventListener("selectionchange",n),setTimeout((()=>{document.removeEventListener("selectionchange",n),ks.delete(e)}),o)}(e,t)}}}(e))),e.addEventListener("selection",(t=>function(e,t){if(ks.get(e))return;Ba(e),t=ra(e,t);const[o]=Sa(e),n=Oa(e,t),r=void 0!==n&&na(e,o[n]);r&&!Qs(t,r)&&aa(e,r,!0)}(e,t.detail))),ta(e,{type:"insert",selectionBefore:[0,0,"forward"],data:e.value,valueBefore:"",suffix:t.suffix,prefix:t.prefix})}function Ws(e){var t,o;if(Os.has(e))return;const n=null!==(t=ms.get(e))&&void 0!==t?t:[],r=n[null!==(o=gs.get(e))&&void 0!==o?o:n.length-1];if(r){const t=r.selectionAfter,[o,n]=Sa(e,r.valueAfter),s=Oa(e,t,[o,n]);if(void 0!==s&&s in o){const r=n[s],a=o[s],l=[t[0]-a[0],t[1]-a[0],"none"];Os.set(e,[r,l])}}}function qs(e){Os.delete(e)}function Us(e,t,o){const n="string"==typeof e||!ms.has(e),r="string"==typeof e?zs(e):e;if(n)t.prefix&&Cs.set(r,t.prefix),t.suffix&&Ts.set(r,t.suffix),r.value=oa(r,r.value),Ks(r,t,o);else{const e=Ma(r),o=r.value;r.value="",ta(r,{type:"insert",selectionBefore:[0,e?e.valueAfter.length:0,"none"],valueBefore:e?e.valueAfter:"",data:o,suffix:t.suffix,prefix:t.prefix})}return r.value}function zs(e){return{value:e,selectionStart:0,selectionEnd:0,scrollWidth:0,clientWidth:0,addEventListener:()=>{},dispatchEvent:()=>{},setSelectionRange:()=>{}}}function Ys(e,t,o,n,r){r=e&&As.has(e)||r;const s=(null!=n?n:function(e){const t=Object.values(Fs);if(!e)return t;const o={...e},n=[];for(const r of t)if(!Js(r))if("token"in r&&r.token in e){const t={...r,...e[r.token]};js(t)&&n.push(t),delete o[r.token]}else n.push(r);const r=Object.values(o);for(const e of r)js(e)?n.push(e):console.warn(`Invalid ${e.type} token`,e);return n}(o)).sort(((e,t)=>{const o="token"in e?e.token.length:-1,n="token"in t?t.token.length:-1;return o===n?0:o>n?-1:1}));let a=[];[t,a]=function(e,t,o,n){let r,s=0,a="",l="",i="";const p=[];for(;a=ia(e);)a===t&&r!==n?(s++,s>1&&(i+=a)):a===o&&s&&r!==n?(s--,0===s?(l+=`{$${p.length}}`,p.push(i),i=""):i+=a):s?i+=a:r!==n||a!==t&&a!==o?l+=a:l=`${l.substring(0,l.length-1)}${a}`,r=a,e=e.substring(a.length);return[l,p]}(t,"{","}","\\");const l=a.length;t=s.reduce(((e,t,o)=>"token"in t?e.replaceAll(`\\${t.token}`,"{“!”}").replaceAll(t.token,`{$${l+o}}`).replaceAll("{“!”}",t.token):e),t);const i=function(e,t,o){return e.reduce(((e,n)=>{const[r,s]=function(e){const[t,...o]=e.split("|"),n=o.reduce(((e,t)=>{const[o,n=!0]=t.split(":");return Object.assign(e,{[o]:n})}),{});return[t,n]}(n);let a=Ys(null,r,void 0,t,o);a=a.map((e=>{const t={...e};if("char"===t.type&&s.placeholder)t.placeholder=s.placeholder;else if("enum"===t.type)throw new Error("Groups cannot contain enums.");return t}));const l={type:"group",parts:a,...s};return e.push(l),e}),[])}(a,s,r).concat(s),p=/\{\$\d+\}/g,d=t.match(p),c=t.split(p).reduce(((e,t,o)=>{if(t&&(t=t.replaceAll("\\",""),e.push({type:"literal",value:r?[...t].reverse().join(""):t})),d&&d[o]){const t=d[o],n=Number(t.substring(2,t.length-1));!isNaN(n)&&i[n]&&e.push(i[n])}return e}),[]);return r&&c.reverse(),e&&ys.set(e,c),c}function js(e){return!!e&&(Js(e)||Zs(e)||Gs(e))}function Zs(e){return!!e&&("char"===e.type&&e.pattern instanceof RegExp&&Xs(e))}function Gs(e){return!!e&&("enum"===e.type&&Array.isArray(e.values)&&Xs(e))}function Xs(e){return!!e&&("placeholder"in e&&"token"in e)}function Js(e){return!!e&&("literal"===e.type&&"string"==typeof e.value)}function Qs(e,t){return e===t||void 0!==e&&void 0!==t&&(e[0]===t[0]&&e[1]===t[1])}function ea(e){var t,o;return[null!==(t=e.selectionStart)&&void 0!==t?t:e.value.length,null!==(o=e.selectionEnd)&&void 0!==o?o:e.value.length,"none"]}function ta(e,t){var o;As.has(e)&&Pa(t);let n=!1;switch(Ds.set(e,"playing"),t.type){case"insert":n=function(e,t){let o=sa(t);const n=t.selectionBefore,r=function(e,t){var o,n,r;if("select"===ws.get(e)){const[s,a]=Sa(e),l=s.findIndex((e=>Qs(e,t.selectionBefore))),i=null!==(o=a[l])&&void 0!==o?o:null;if(Zs(i)){const e=t.selectionBefore,o=e[1]-e[0],s=t.valueBefore.substring(e[0],e[1]),a="left"===i.selectDirection,l=ha(s,i),p=a?0:function(e,t,o){if(!e)return 0;let n="";for(;e.length;){const o=ia(e);e=e.substring(o.length),t.pattern.test(o)&&(n+=o)}return Math.min(Math.max(n.length,1),o)}(t.data,i,o);if(l.length>=o)return a||(t.insertPos=e[1]-p),(null!==(n=i.selectFill)&&void 0!==n?n:i.placeholder).repeat(o);const d=(null!==(r=i.selectFill)&&void 0!==r?r:i.placeholder).repeat(o-l.length-(a?0:p));return t.insertPos=a?e[0]+l.length:e[1]-p,"left"===i.selectDirection?`${l}${d}`:`${d}${l}${i.placeholder}`}if(Gs(i)){const e=t.selectionBefore;return t.valueBefore.substring(e[0],e[1])}}return""}(e,t);o=`${o.substring(0,n[0])}${r}${o.substring(n[1])}`;const s=ga(e,t,o);return bs.set(e,s.endPos),{...t,valueAfter:s.value,selectionAfter:ma(e,s),unmasked:s.unmasked,complete:s.complete,meta:s.meta}}(e,t);break;case"deleteContentBackward":case"deleteContentForward":n=function(e,t){const o=sa(t),n=t.selectionBefore,r=As.has(e);let s=n[0],a=n[1];s===a&&("deleteContentBackward"!==t.type||r?a+=pa(o,s):s-=pa(o,s,"backward"));const l=ws.get(e);let i="";if("select"===l){const[o,n]=Sa(e),r=Oa(e,[s,a,"none"]);if(void 0!==r){const l=n[r],p=o[r];Zs(l)?i=l.placeholder.repeat(a-s):Gs(l)&&([i,s]=Qs(p,ea(e))?[l.placeholder,s]:function(e,t,o,n){const r=n.valueBefore,s=pa(r,n.selectionBefore[0],"backward"),a=Math.max(o[0],n.selectionBefore[0]-s),l=r.substring(o[0],a),i=Ia(t.values,l);let p=null==i?void 0:i.substring(l.length);i&&!p&&Da(t.values,i)&&(p=i);return[null!=p?p:t.placeholder,p?a:o[0]]}(0,l,p,t))}}const p=`${o.substring(0,s)}${i}${o.substring(a)}`,d=ga(e,t,p);return{...t,valueAfter:d.value,selectionAfter:wa(e,d,t,s),unmasked:d.unmasked,complete:d.complete,meta:d.meta}}(e,t)}if(As.has(e)&&n&&Pa(n),n&&function(e,t){t.prefix&&(t.valueAfter=t.prefix+t.valueAfter,t.selectionAfter=na(e,t.selectionAfter));t.suffix&&(t.valueAfter+=t.suffix)}(e,n),n&&function(e){return e.valueBefore!==e.valueAfter||e.selectionBefore[0]!==e.selectionAfter[0]||e.selectionBefore[1]!==e.selectionAfter[1]}(n)){Is.has(e)&&Es.set(e,(()=>{Es.delete(e),n&&Is.get(e)(n,e)})),Ds.set(e,"beforeCallback");let t=null!==(o=ms.get(e))&&void 0!==o?o:[];const r=gs.get(e);r&&(t=t.slice(0,r),gs.delete(e)),t.push(n),ms.set(e,t),Bs&&ke()===e&&"function"==typeof document.execCommand&&!Hs?(aa(e,[0,e.value.length,"forward"],!0),Hs=!0,document.execCommand("insertText",void 0,n.valueAfter),Hs=!1):la(e,n),Bs&&ke()===e&&aa(e,n.selectionAfter);const s=Es.get(e);s&&s(),Ba(e)}Ds.set(e,"complete")}function oa(e,t){var o,n;const r=null!==(o=Cs.get(e))&&void 0!==o?o:"",s=null!==(n=Ts.get(e))&&void 0!==n?n:"";return r&&t.startsWith(r)&&(t=t.substring(r.length)),s&&t.endsWith(s)&&(t=t.substring(0,t.length-s.length)),t}function na(e,t){const o=Cs.get(e),n=[...t];return o&&(n[0]+=o.length,n[1]+=o.length),n}function ra(e,t){const o=Cs.get(e),n=[...t];return o&&(n[0]-=o.length,n[1]-=o.length),n}function sa(e){let t=e.valueBefore;const o=e.selectionBefore;if(e.suffix&&t.endsWith(e.suffix)&&(t=t.substring(0,t.length-e.suffix.length),e.valueBefore=t,o[0]>=t.length&&(o[0]=t.length),o[1]>=t.length&&(o[1]=t.length)),e.prefix&&t.startsWith(e.prefix)){const n=e.prefix.length;t=t.substring(n),e.valueBefore=t,o[0]=Math.max(o[0]-n,0),o[1]=Math.max(o[1]-n,0)}return t}function aa(e,t,o=!1){o&&($s.add(e),setTimeout((()=>$s.delete(e)),5)),ks.get(e)&&ks.set(e,t),e.setSelectionRange(...t)}function la(e,t,o="After"){if(e.value=t[`value${o}`],Bs){const o=new InputEvent("input",{inputType:"insert"===t.type?"insertText":t.type,data:t.data});e.dispatchEvent(o)}}function ia(e){if(null==e)return"";const t=_s.test(e.charAt(0))&&_s.test(e.charAt(1))?2:1;return e.substring(0,t)}function pa(e,t,o="forward"){if("backward"===o)return 0===t?0:1===t?1:_s.test(e.charAt(t))&&_s.test(e.charAt(t-1))?2:1;const n=e.length-t;return 0===n?0:1===n?1:ia(e.substring(t)).length}function da(e,t){const o=ia(e.data),n=o.length;if(e.value+=o,e.pos+=n,"string"==typeof e.data&&(e.data=e.data.substring(n),e.data.length||(e.endPos=e.pos)),t)return t.substring(n)}function ca(e){const t=ia(e.buffer),o=t.length;e.value+=t,e.pos+=o,e.buffer=e.buffer.substring(o)}function ua(e,t){const o=ia(t),n=o.length;return e.value+=o,e.pos+=n,t.substring(n)}function fa(e,t){for(;t.buffer;){const o=ia(t.buffer);if(e.pattern.test(o)||t.placeholder&&e.placeholder===o)return void("replace"!==t.mode&&"select"!==t.mode||(t.buffer=t.buffer.substring(o.length)));t.buffer=t.buffer.substring(o.length)}}function va(e,t){const o=e.values.concat([e.placeholder]).map((e=>e.toLowerCase())).sort(((e,t)=>e.length>t.length?-1:1));for(;t.buffer;){const e=t.buffer.toLowerCase(),n=o.find((t=>e.startsWith(t)));if(n){const e=t.buffer.substring(0,n.length);return t.buffer=t.buffer.substring(n.length),e}t.buffer=t.buffer.substring(pa(t.buffer,0))}return null}function ha(e,t){let o=e.replaceAll(t.placeholder,"");const n="left"===t.selectDirection;if(t.selectFill){const e=new RegExp(`${n?"":"^"}${r=t.selectFill,r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}+${n?"$":""}`);o=o.replace(e,"")}var r;return o}function ma(e,t){let o=[t.endPos,t.endPos,"forward"];if("select"!==t.mode)return o;const n=ea(e);o=[n[0],t.endPos,"none"];const[r,s]=Sa(e,t.value),a=Oa(e,o,[r,s]);if(void 0===a)return o;if(!(a in r)||!(a in s))return o;const l=r[a],i=s[a],p=t.value.slice(l[0],l[1]);if(Zs(i)&&ha(p,i).length===p.length&&a<r.length-1)return Vs(),r[a+1];if(Gs(i)&&t.insertPos>=l[0]&&t.insertPos<=l[1]){if(t.cycle)return l;const o=function(e,t,o){if(null===e.originalData)return 0;const n=e.insertPos>=t?e.value.substring(t,e.insertPos):"",r=`${n}${e.originalData}`,s=Ia(o.values,r);if(s)return ka(r,s).length-n.length;return 0}(t,l[0],i);if(t.insertPos+o===l[1])return Da(i.values,p)?[l[1],l[1],"forward"]:(Vs(),r[a+1]?r[a+1]:r[a]);const s=[t.insertPos+o,l[1],"none"];return Qs(s,n)||($s.add(e),setTimeout((()=>$s.delete(e)),5)),s}return l}function ga(e,t,o,n){var r,s;const a=null!==(r=ys.get(e))&&void 0!==r?r:[],l={pos:0,insertPos:null!==(s=t.insertPos)&&void 0!==s?s:t.selectionBefore[0],range:t.selectionBefore,chars:0,placeholder:xs.has(e),buffer:o,data:t.data,originalData:t.data,value:"",mode:ws.get(e)||"replace",endPos:t.selectionBefore[0],rangeParts:Sa(e),unmasked:"",complete:!0,cycle:t.cycle,meta:[]};return $a(a,l,void 0,n),l}function $a(e,t,o,n){var r,s;const a={...t};(null==o?void 0:o.placeholder)&&(t.placeholder=!0);const l=(null==o?void 0:o.repeat)&&"literal"===(null===(r=o.nextPart)||void 0===r?void 0:r.type)?o.nextPart.value:null;let i=0;const p=e.reduce(((e,t)=>e+("char"===t.type?1:0)),0),d=t.chars;for(const o of e){const r=e[i+1];switch(o.type){case"literal":ya(o,t,e.at(-1)===o);break;case"char":xa(o,t,l);break;case"enum":ba(o,t);break;case"group":const a={repeat:null!==(s=o.repeat)&&void 0!==s&&s,nextPart:r,repeats:0,placeholder:!!o.placeholder};$a(o.parts,t,a,n)}if(n){if(!1===n(t,o))break}const a=Js(r)&&i+2===e.length&&d!==t.chars;if(!(t.buffer||t.data||t.placeholder||a))break;i++}if(t.chars<p&&(t.complete=!1),o){const r=t.chars-d,s=r===p,i=!(!t.data||l&&t.data.startsWith(l)&&t.insertPos<=t.pos),c=!(t.buffer&&l&&t.buffer.startsWith(l)&&t.insertPos>=t.pos+l.length)&&(t.buffer||i);if(o.repeat&&c&&s)return o.repeats++,$a(e,t,o,n);if(!s){t.complete=!1;const o=e.reverse().find((e=>"literal"===e.type));e.reverse(),Js(o)&&t.value.endsWith(o.value)&&(t.value=t.value.substring(0,t.value.length-o.value.length),t.pos=t.value.length)}p>1&&r<p&&0!==r&&t.insertPos<=t.pos?t.data="":o.repeat&&!s&&o.repeats&&Object.assign(t,a)}t.placeholder=a.placeholder}function ba(e,t){const[o,n]=t.rangeParts,r=o[n.indexOf(e)];if(r&&(t.insertPos<=t.pos||t.insertPos>=r[0]&&t.insertPos<=r[1])&&t.data){const o=t.buffer.substring(0,t.insertPos-t.pos),n=`${o}${t.data}`,r=Ia(e.values.concat([e.placeholder]),n);if(r){const s=ka(n,r);return t.data=t.data.substring(s.length),t.value+=r,r!==e.placeholder?t.unmasked+=r:t.complete=!1,t.meta.push({type:r!==e.placeholder?"enum":"placeholder",value:r}),o?t.buffer=t.buffer.substring(o.length):va(e,t),t.endPos=t.pos+s.length,void(t.pos=t.value.length)}t.data=""}if(t.buffer){const o=va(e,t);if(o)return t.value+=o,o!==e.placeholder?t.unmasked+=o:t.complete=!1,t.meta.push({type:o!==e.placeholder?"enum":"placeholder",value:o}),void(t.pos=t.value.length)}t.complete=!1,t.value+=e.placeholder,t.meta.push({type:"placeholder",value:e.placeholder}),t.pos=t.value.length}function ya(e,t,o){let n=e.value;if(""===t.data&&!t.buffer&&!t.placeholder&&!o)return;let r=!1;for(;n;){const e=t.insertPos<=t.pos?ia(t.data):"",s=ia(n);if(e===s)n=da(t,n),t.meta.push({type:"literal",value:s}),r=!0;else if(!r||t.data||null===t.data||t.placeholder||o)n=ua(t,n),t.meta.push({type:"literal",value:s});else if(r&&!t.data)break;t.buffer.startsWith(s)&&(t.buffer=t.buffer.substring(s.length))}null===t.data&&!t.buffer&&t.insertPos<=t.pos&&!t.placeholder&&(t.value=t.value.substring(0,t.value.length-e.value.length),t.pos=t.endPos=t.value.length)}function xa(e,t,o){var n;let r=!0;if(t.insertPos<=t.pos)for(;null===(n=t.data)||void 0===n?void 0:n.length;){const n=ia(t.data);if(e.pattern.test(n))return da(t),t.meta.push({type:"char",value:n}),t.chars++,t.unmasked+=n,void fa(e,t);if("string"==typeof t.data){if(o&&t.data.startsWith(o)){r=!1;break}t.data=t.data.substring(n.length)}}for(;r&&t.buffer;){const n=ia(t.buffer);if(e.pattern.test(n))return t.chars++,t.unmasked+=n,ca(t),void t.meta.push({type:"char",value:n});if(t.placeholder&&n===e.placeholder)return ca(t),void t.meta.push({type:"placeholder",value:n});if("string"==typeof t.buffer){if(o&&t.buffer.startsWith(o)){t.buffer=t.buffer.substring(o.length);break}t.buffer=t.buffer.substring(n.length)}}t.placeholder?(t.value+=e.placeholder,t.meta.push({type:"placeholder",value:e.placeholder})):t.endPos=t.pos}function wa(e,t,o,n){const r=[n,n,"none"];if("select"===t.mode){const s=Sa(e),a=Oa(e,r,s),[l,i]=Sa(e,t.value),p=void 0!==a&&_a(o.valueBefore,s[0][a],s[1][a]);if(void 0!==a&&a in l){if(p){const e=l.slice(a).every(((e,o)=>_a(t.value,e,i[a+o])));return e&&l[a-1]?l[a-1]:l[a]}return[n,l[a][1],"none"]}}return r}function _a(e,t,o){if(Js(o))return!1;if(Zs(o)){let n=t[0];for(;n<t[1];){const t=ia(e.substring(n));if(t!==o.placeholder)return!1;n+=t.length}}return!Gs(o)||e.substring(t[0],t[1])===o.placeholder}function ka(e,t){let o="";do{const n=ia(e).toLowerCase(),r=ia(t).toLowerCase();if(n!==r)break;o+=n,e=e.substring(n.length),t=t.substring(r.length)}while(e.length&&t.length);return o}function Sa(e,t){const o=ys.get(e);if(!o)return[[],[]];if(Ss.has(e))return Ss.get(e);const n=null!=t?t:oa(e,e.value),r=[],s=[];let a=null,l=null,i=0,p=!0;for(const e of o)if(Js(e))a=e,null!==l&&(r.push([l,i,"none"]),l=null),i+=e.value.length;else{if(Zs(a)&&Zs(e)&&e.token===a.token)i++;else if(Zs(e))null===l?(l=i,s.push(e)):(r.push([l,i,"none"]),l=i,s.push(e)),i++;else if(Gs(e)){l&&r.push([l,i,"none"]),Aa(e)||(p=!1);const t=La(n,e,i);l=null,r.push([i,i+t,"none"]),s.push(e),i+=t}a=e}null!==l&&r.push([l,i,"none"]);const d=[[...r],[...s]];return p&&!t&&Ss.set(e,d),d}function La(e,t,o){if(Aa(t))return t.values[0].length;const n=e.slice(o),r=Ia(t.values.concat([t.placeholder]),n);return r?r.length:0}function Ia(e,t,o=null,n){var r;if(0===t.length)return o;if(!n){const o=e.find((e=>e.toLowerCase()===t.toLowerCase()));if(o)return o}const s=ia(t.toLowerCase()),a=`${null!=n?n:""}${s}`,l=e.filter((e=>e.toLowerCase().startsWith(a))),i=l.find((e=>e.toLowerCase()===a));return i&&(o=i),0===l.length?o:1===l.length?l[0]:(l.length>1&&(o=l[0]),null!==(r=Ia(l,t.substring(s.length),o,a))&&void 0!==r?r:l[0])}function Da(e,t){return t=t.toLowerCase(),e.some((e=>(e=e.toLowerCase()).startsWith(t.toLocaleLowerCase())&&e!==t))}function Aa(e){if(!Ls.has(e)&&Array.isArray(e.values)&&e.values.length>0){const t=e.values[0].length;if(e.placeholder.length!==t)return!1;Ls.set(e,e.values.every((e=>e.length===t)))}return Ls.get(e)}function Ca(e,t=1){const[o]=Sa(e),n=Oa(e,ra(e,ea(e)));return void 0!==n&&void 0!==o[n+t]&&(e.setSelectionRange(...na(e,o[n+t])),!0)}function Ta(e,t=1){const[o,n]=Sa(e),r=Oa(e,ea(e));if(void 0!==r&&r in n){const s=n[r];if(Gs(s)){const n=o[r],a=e.value.slice(n[0],n[1]);let l=null,i=s.values.indexOf(a);const p=s.values.length-1;if(-1!==i){const e=i+t;i=e<0?p:e>p?0:e,l=s.values[i]}else a===s.placeholder&&(l=t>0?s.values[0]:s.values[p]);if(null!==l){const t={selectionBefore:n,insertPos:n[0],type:"insert",data:l,valueBefore:e.value,cycle:!0};return setTimeout((()=>ta(e,t)),0),!0}}}return!1}function Ea(e,t){if(!e.length)return-1;if(1===e.length)return e[0];const o=e.length/2,n=Number.isInteger(o)?o:Math.floor(o),r=Math.abs(t-e[n-1])<Math.abs(t-e[n])?[0,n]:[n];return Ea(e.slice(...r),t)}function Oa(e,t,o){const[n]=null!=o?o:Sa(e),r=n.findIndex((e=>e[0]!==e[1]&&(!!Qs(e,t)||t[1]>e[0]&&t[1]<e[1])));if(-1!==r)return r;const[s,a]=n.reduce(((e,t,o)=>(e[0].add(t[0]),e[0].add(t[1]),e[1][t[0]]=o,e[1][t[1]]=o,e)),[new Set,{}]),l=Ea([...s],0===t[0]&&t[1]===e.value.length?0:t[1]);return l in a?a[l]:void 0}function Ma(e){var t,o;const n=null!==(t=ms.get(e))&&void 0!==t?t:[];return n[null!==(o=gs.get(e))&&void 0!==o?o:n.length-1]}function Va(e,t=!1){const o=Ma(e);return o&&(o.complete||t)?As.has(e)?[...o.unmasked].reverse().join(""):o.unmasked:t?"":null}function Fa(e){var t;const o=Ma(e);return null!==(t=null==o?void 0:o.meta)&&void 0!==t?t:null}function Pa(e){const t=e=>[...e].reverse().join(""),o=(e,t)=>[t-e[1],t-e[0],e[2]];e.data&&(e.data=t(e.data)),e.valueBefore=t(e.valueBefore),"valueAfter"in e&&(e.valueAfter=t(e.valueAfter)),"selectionAfter"in e&&(e.selectionAfter=o(e.selectionBefore,e.valueAfter.length)),e.selectionBefore=o(e.selectionBefore,e.valueBefore.length)}function Ba(e){if(e.scrollWidth>e.clientWidth&&null!==e.selectionStart&&null!==e.selectionEnd){const t=e.selectionStart/e.value.length,o=e.selectionEnd/e.value.length;e.scrollLeft=o>.9?e.scrollWidth:t*e.scrollWidth-20,e.dispatchEvent(new CustomEvent("input-scroll",{bubbles:!1,detail:e.scrollLeft}))}}const Ha="undefined"!=typeof window,Ra=new WeakSet,Na=new WeakSet,Ka=new WeakSet,Wa=new WeakMap,qa=new WeakMap,Ua=new WeakSet,za=new WeakSet;function Ya(e){e.props.selectedMonth=e.props.selectedYear=e.props.selectedDay=e.props.selectedWeek=void 0}function ja(e){var t,o,n;e.props.selectedMonth=e.props.months.findIndex((t=>Xa(t,e.props.activeDate))),e.props.selectedYear=e.props.years.findIndex((t=>Ga(t,e.props.activeDate)));for(let s=0;s<(null===(t=e.props.calendar[0])||void 0===t?void 0:t.weeks.length);s++)for(let t=0;t<(null===(o=e.props.calendar[0])||void 0===o?void 0:o.weeks[s].length);t++){const o=null===(n=e.props.calendar[0])||void 0===n?void 0:n.weeks[s][t];if(r.sameDay(o,e.props.activeDate)){e.props.selectedWeek=s,e.props.selectedDay=t;break}}}function Za(e){return"timeZoneName"!==e.partName}function Ga(e,t){return t instanceof Date&&e.getFullYear()===t.getFullYear()}function Xa(e,t){return t instanceof Date&&e.getMonth()===t.getMonth()}function Ja(e){e.props.skipBuildCalendar||Ya(e),e.props.selectedIndex=e.props.calendar=_(e.props.showMonths,(e=>e)).map((t=>function(e,t){const o=[],n=r.date(t);n.setDate(1);let s=r.weekStart(n,e.props.weekStart);s.setHours(n.getHours(),n.getMinutes(),n.getSeconds());const a=r.weekEnd(r.monthEnd(t),e.props.weekStart);let l=[];do{l.push(s),7===l.length&&(o.push(l),l=[]),s=r.addDay(s)}while(s.getTime()<=a.getTime());return{monthDay:n,weeks:o}}(e,r.addMonth(e.props.renderedDate,t)))),e.props.years=function(e){const t=Number(r.format(e.props.renderedDate,"YYYY")),o=t-t%10;return e.props.decade=`${o} - ${o+9}`,_(10,(n=>r.addYear(e.props.renderedDate,o+n-t)))}(e),e.props.months=function(e){const t=r.date(e.props.renderedDate);return t.setMonth(0),_(12,(e=>r.addMonth(t,e)))}(e),e.props.skipBuildCalendar?e.props.skipBuildCalendar=!1:e.value&&ja(e)}function Qa(e,t){var o;t.target&&t.target instanceof Element&&(t.target.closest(`#${e.props.id}_popover`)||!(null===(o=e.props.__root)||void 0===o?void 0:o.contains(t.target)))||(e.props.expanded=!1)}function el(e,t){if(!t)return e.props.inputText="",new Date;const o=t instanceof Date?t:r.parse(t,e.props.valueFormat,e.props.valueLocale);return e.props.inputText=e.props.formatDate(o,e.props.format,e.props.locale,!1,Za),o}function tl(t){return Array.isArray(t.props.sequence)?e.clone(t.props.sequence):["day"]}function ol(e,t,o=!0){var n,s;if(e._value===t)return;if(null==t)return e.input(t,o);e.props.offset=e.props.timezone?r.offset(t,e.props.timezone):"+0000";const a=r.applyOffset(t,null!==(n=(s=e.props).offset)&&void 0!==n?n:s.offset="+0000");e.input(r.format(a,e.props.valueFormat,e.props.valueLocale,!1),o)}function nl(e,t){var o;const n=["prev_button","month_button","day_button","year_button","next_button"].find((t=>{var o;return null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_${t}`)})),r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_${n}`);r instanceof HTMLElement&&(t.preventDefault(),r.focus())}function rl(e,t){var o;let n="";if(!(t instanceof HTMLInputElement)||e.props.pickerOnly)return;Wa.set(e,t),null===(o=e.props.__root)||void 0===o||o.addEventListener("click",(t=>{e.props.expanded&&t.target instanceof HTMLElement&&t.target.closest(`#${e.props.id}_popover`)?za.add(e):za.delete(e)})),e.on("prop:inputText",(({payload:e})=>{e!==t.value&&("beforeCallback"===Ds.get(t)&&(n=t.value),Ws(t),t.selectionStart=0,t.selectionEnd=t.value.length,function(e,t){var o,n;if(!ms.has(e))return;const r=null!==(o=Cs.get(e))&&void 0!==o?o:"",s=null!==(n=Ts.get(e))&&void 0!==n?n:"";ta(e,{type:"insert",selectionBefore:ea(e),data:t,valueBefore:e.value,suffix:s,prefix:r})}(t,e),t.value=e,setTimeout((()=>qs(t)),10))}));const[s,a]=function(e){const t=e.props.locale,o=["full","long","medium","short"].includes(e.props.format)||"object"==typeof e.props.format,n=r.parts(e.props.format,t),s=r.formatStr(e.props.format,t,!0,Za);return[s,n.reduce(((n,s)=>{if("literal"===s.partName)return n;let a=r.range(s.token,t,o);if("YYYY"===s.token&&e.props.minDate&&e.props.maxDate){const t=e.props.minDate.getFullYear();a=_(e.props.maxDate.getFullYear()-t+1,(e=>String(t+e)))}const l={type:"enum",token:s.token,values:a,placeholder:"A"===s.token?"A/P":s.token,selectDirection:"left"};return n.push(l),s.token.startsWith("D")&&qa.set(e,a),n}),[])]}(e);Ks(t,{pattern:s,explicitParts:a,onChange:({valueAfter:o})=>{if(sl(e),Ra.has(e))return Ra.delete(e);n&&n===o?n="":(Ws(t),e.props.inputText=o,setTimeout((()=>qs(t)),10))}},e)}function sl(e){var t,o;if(e.props.overlay){const n=Wa.get(e);!n||!(null===(t=e.props.attrs)||void 0===t?void 0:t.placeholder)||e._value||Va(n,!0)||e.props._isFocused||e.props.activeDate&&e.props.expanded?n&&(e.props._isPlaceholder=!1,e.props._overlayParts=_e(Fa(n))):(e.props._isPlaceholder=!0,e.props._overlayParts=[{type:"placeholder",value:null===(o=e.props.attrs)||void 0===o?void 0:o.placeholder}])}}function al(e,t){return!t||(!(!e.props.minDate||!r.isBefore(t,e.props.minDate))||(!(!e.props.maxDate||!r.isAfter(t,e.props.maxDate))||void 0))}function ll(e){return"function"==typeof e.props.validationLabel?e.props.validationLabel(e):e.props.validationLabel||e.props.label||e.props.name||String(e.name)}const il="undefined"!=typeof window,pl=new WeakMap;function dl(e,t){var o,n;if(t instanceof HTMLInputElement&&!pl.get(e)&&il){const r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_overlay`),s=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}_overlay_inner`);if(r&&t&&s){pl.set(e,r);const o=getComputedStyle(t).color;t.style.color="transparent",t.style.caretColor=o;const n=new ResizeObserver((()=>{var o;const n=getComputedStyle(t),r=t.getBoundingClientRect(),s=null===(o=t.parentElement)||void 0===o?void 0:o.getBoundingClientRect();e.props._overlayStyles={...e.props._overlayStyles,width:n.width,height:n.height,boxSizing:n.boxSizing,padding:n.padding,margin:n.margin,fontSize:n.fontSize,lineHeight:n.lineHeight,top:r.top-((null==s?void 0:s.top)||r.top)+"px",left:r.left-((null==s?void 0:s.left)||r.left)+"px"}}));n.observe(t);const a=e=>{s.scrollLeft=e.detail};t.addEventListener("input-scroll",a),e.on("destroyed",(()=>{t.removeEventListener("input-scroll",a),n.disconnect()}))}}}function cl(t){t.addProps(["_overlayStyles","_overlayParts","_overlayInnerStyles","_isPlaceholder"]),t.props._overlayStyles={position:"absolute",top:"0",left:"0",pointerEvents:t.props._isPlaceholder?"auto":"none"},t.props._overlayInnerStyles={overflow:"hidden",whiteSpace:"nowrap",paddingRight:"20px"},t.on("created",(()=>{t.props.overlay=e.undefine(t.props.overlay),t.props.pickerOnly=e.undefine(t.props.pickerOnly),t.props.overlay=t.props.pickerOnly?void 0:t.props.overlay,t.props.overlay&&e.whenAvailable(`${t.props.id}`,dl.bind(null,t),t.props.__root)})),t.on("prop:_isPlaceholder",(()=>{t.props._overlayStyles={...t.props._overlayStyles,pointerEvents:t.props._isPlaceholder?"auto":"none"}}))}const ul={schema:/* #__PURE__ */xr(/* #__PURE__ */wr(/* #__PURE__ */Sr("$label"),/* #__PURE__ */_r(/* #__PURE__ */kr("prefix"),/* #__PURE__ */Lr(),/* #__PURE__ */us(/* #__PURE__ */vs(/* #__PURE__ */fs(/* #__PURE__ */is("$part.value"),/* #__PURE__ */ps("$part.value"),/* #__PURE__ */ds("$part.value"),/* #__PURE__ */cs("$part.value")))),/* #__PURE__ */Tr(),/* #__PURE__ */Er(/* #__PURE__ */Gr(/* #__PURE__ */Vr(/* #__PURE__ */Fr("$ui.prev.value"),/* #__PURE__ */kr("prev")),/* #__PURE__ */Xr("$decade"),/* #__PURE__ */Jr(/* #__PURE__ */ts()),/* #__PURE__ */Qr(/* #__PURE__ */os(),/* #__PURE__ */ts()),/* #__PURE__ */es(/* #__PURE__ */os(),/* #__PURE__ */ns(),/* #__PURE__ */ts()),/* #__PURE__ */Or(/* #__PURE__ */Mr("$ui.next.value"),/* #__PURE__ */kr("next")),/* #__PURE__ */ls(/* #__PURE__ */kr("close"))),/* #__PURE__ */hs(/* #__PURE__ */zr(/* #__PURE__ */Yr("$fns.format($year, $yearFormat)")),/* #__PURE__ */jr(/* #__PURE__ */Zr("$fns.format($month, $monthFormat)")),/* #__PURE__ */Pr(/* #__PURE__ */Hr(/* #__PURE__ */Rr(/* #__PURE__ */Nr("$fns.format($day, $weekdayFormat)"))),/* #__PURE__ */Br(/* #__PURE__ */Kr(/* #__PURE__ */Wr(/* #__PURE__ */qr("$fns.format($day, $dateFormat)"))))),/* #__PURE__ */ss(/* #__PURE__ */as()))),/* #__PURE__ */rs(/* #__PURE__ */kr("clear")),/* #__PURE__ */Ur(/* #__PURE__ */kr("calendar")),/* #__PURE__ */Ir(),/* #__PURE__ */kr("suffix"))),/* #__PURE__ */Dr("$help"),/* #__PURE__ */Ar(/* #__PURE__ */Cr("$message.value"))),type:"input",family:"text",props:["dateFormat","dayButtonFormat","format","monthButtonFormat","monthFormat","overlay","pickerOnly","showMonths","showPagination","weekStart","weekdayFormat","yearFormat","years"],features:[cl,function(o){var n,s,a,l,i,p,d,c,u,f,v,h,m,g,$,b,y,x,w,k,S,L;o.addProps(["_isDisabled","_isFocused","activeDate","calendar","clearable","disabled","decade","disabledDays","expanded","inputText","localTime","maxDate","maxScan","minDate","months","offset","paginatedPanels","panel","pickerOnly","renderedDate","sequence","timezone","valueFormat","valueLocale","showPanelClose","selectedDay","selectedWeek","selectedMonth","selectedYear"]),o.hook.prop(((e,t)=>("expanded"===e.prop&&o.props.disabled&&(e.value=!1),"weekStart"===e.prop&&(e.value=Number(e.value||0)),"showMonths"===e.prop&&(e.value=Number(e.value||1)),"maxScan"===e.prop&&(e.value=Number(e.value||7)),"timezone"===e.prop&&("string"==typeof o._value||o._value instanceof Date)&&(o.props.offset=r.offset(o._value,e.value)),t(e)))),o.props._isFocused=!1,o.props._isPlaceholder=!1,null!==(n=(h=o.props).valueFormat)&&void 0!==n||(h.valueFormat="ISO8601"),null!==(s=(m=o.props).weekdayFormat)&&void 0!==s||(m.weekdayFormat="d"),null!==(a=(g=o.props).monthFormat)&&void 0!==a||(g.monthFormat="MMM"),null!==(l=($=o.props).monthButtonFormat)&&void 0!==l||($.monthButtonFormat="MMMM"),null!==(i=(b=o.props).dayButtonFormat)&&void 0!==i||(b.dayButtonFormat="D"),null!==(p=(y=o.props).dateFormat)&&void 0!==p||(y.dateFormat="D"),null!==(d=(x=o.props).yearFormat)&&void 0!==d||(x.yearFormat="YYYY"),null!==(c=(w=o.props).paginatedPanels)&&void 0!==c||(w.paginatedPanels=["day","year"]),null!==(u=(k=o.props).valueLocale)&&void 0!==u||(k.valueLocale=o.props.locale),null!==(f=(S=o.props).format)&&void 0!==f||(S.format="long"),o.props.panels=tl(o),o.props.pickerOnly=e.undefine(o.props.pickerOnly),"disabled"in o.props&&(o.props.disabled=e.undefine(o.props.disabled)),"clearable"in o.props&&(o.props.clearable=e.undefine(o.props.clearable)),null!==(v=(L=o.props).maxScan)&&void 0!==v||(L.maxScan=7),o.props._isDisabled="function"==typeof o.props.disabledDays?o.props.disabledDays.bind(null,o):al.bind(null,o),o.props.calendar=[],o.props.inputText="",o.props.showMonths=o.props.showMonths||1,"function"==typeof o.props.format?(o.props.formatDate=o.props.format,o.props.format=null):o.props.formatDate=r.format,Ja(o),o.on("mounted",(()=>{e.whenAvailable(`${o.props.id}`,rl.bind(null,o),o.props.__root)})),o.on("created",(()=>{if(function(e){const t=e._value;let o=new Date;if(t instanceof Date)o=r.date(t);else if("string"==typeof t)try{const n=r.parse(t,e.props.valueFormat,e.props.valueLocale);o=r.date(n)}catch{console.warn(`Date (${t}) does not match format (${r.formatStr(e.props.valueFormat,e.props.valueLocale)})`),o=void 0}else t||(o=void 0);if(e.props.offset=e.props.timezone?r.offset(o||new Date,e.props.timezone):"+0000",e.props.minDate){const t="string"==typeof e.props.minDate?r.parse(e.props.minDate):e.props.minDate;e.props.minDate=r.removeOffset(t,e.props.offset)}if(e.props.maxDate){const t="string"==typeof e.props.maxDate?r.parse(e.props.maxDate):e.props.maxDate;e.props.maxDate=r.removeOffset(t,e.props.offset)}o=o&&r.removeOffset(o,e.props.offset),o&&ol(e,o,!1);let n=o||new Date;e.props.minDate&&n<e.props.minDate?n=e.props.minDate:e.props.maxDate&&n>e.props.maxDate&&(n=e.props.maxDate),e.props.renderedDate=n,e.props.activeDate=n,e.props.localTime=o&&r.format(o,"HH:mm")||"12:00"}(o),o.context){const e={};let t;o.context.fns.format=(t,n)=>{if(e[n]&&e[n][t.toString()])return e[n][t.toString()];const s=r.format(t,n,o.props.locale||"en",!1,Za);return e[n]?e[n][t.toString()]=s:e[n]={[t.toString()]:s},s},o.context.fns.isDisabled=o.props._isDisabled,o.context.fns.isDisabledMonth=e=>!r.nearestDay(e,(e=>!o.props._isDisabled(e)),"month"),o.context.fns.isDisabledYear=e=>!r.nearestDay(e,(e=>!o.props._isDisabled(e)),"year"),o.context.handlers._blur=e=>{var t,n;o.props._isFocused=!1,"function"==typeof(null===(t=o.context)||void 0===t?void 0:t.handlers.blur)&&(null===(n=o.context)||void 0===n||n.handlers.blur(e))},o.context.handlers.closePanel=()=>{o.props.expanded=!1},o.context.handlers._blurOut=e=>t=>{var n;t.preventDefault(),o.props.keydown?o.props.keydown=!1:e&&e!==o.props.panel||o.props.pickerOnly&&t.relatedTarget instanceof Element&&(t.relatedTarget===document.getElementById(`${o.props.id}_inner`)||t.relatedTarget.closest(`#${o.props.id}_inner`))||t.relatedTarget&&t.relatedTarget instanceof Element&&(t.relatedTarget.closest(`#${o.props.id}_popover`)||!(null===(n=o.props.__root)||void 0===n?void 0:n.contains(t.relatedTarget))||t.relatedTarget.id===`${o.props.id}_popover`)||(o.props.expanded=!1)},o.context.handlers.overlayClick=()=>{const e=Wa.get(o);e&&(e.focus(),o.props._isPlaceholder=!1)},o.context.handlers.focus=()=>{o.props.pickerOnly||(o.props._isFocused=!0,o.props.pickerOnly&&!Na.has(o)&&(Ka.add(o),o.props.expanded=!0,setTimeout((()=>Ka.delete(o)),200)))},o.context.handlers.clear=()=>{var e,t;ol(o,void 0,!0),el(o,void 0);const n=null===(t=null===(e=o.props)||void 0===e?void 0:e.__root)||void 0===t?void 0:t.getElementById(`${o.props.id}`);n instanceof HTMLInputElement&&(n.focus(),setTimeout((()=>{n.setSelectionRange(0,0)}),50))},o.context.handlers.dateInput=e=>{var t;if(Ua.has(o))return Ua.delete(o);if(e.target instanceof HTMLInputElement&&!o.props.expanded)try{let n=r.parse({date:e.target.value,format:o.props.format,locale:o.props.locale,partFilter:Za});if(function(e){return r.parts(e.props.format,e.props.locale).some((e=>"weekday"===e.partName))}(o)&&o.props.activeDate instanceof Date&&o.props.activeDate.getTime()===n.getTime()&&!Os.get(e.target)&&r.format(n,o.props.format,o.props.locale,!1,Za)!==e.target.value){const s=r.range("dddd",o.props.locale),a=r.parts(o.props.format,o.props.locale),l=null===(t=r.parseParts(e.target.value,a).find((e=>"dddd"===e.token)))||void 0===t?void 0:t.value,i=r.format(n,"dddd",o.props.locale);if(l&&s.includes(l)&&i!==l){let e=s.indexOf(l)-s.indexOf(i);e=e<-1?7+e:e,n=r.addDay(n,e),Ra.add(o)}}ol(o,n)}catch(e){ol(o,void 0)}},o.context.handlers.open=()=>{o.props.expanded=!0},o.context.handlers.next=()=>{switch(o.props.panel){case"year":return void(o.props.renderedDate=r.addYear(o.props.renderedDate,10));case"day":return void(o.props.renderedDate=r.addMonth(o.props.renderedDate,1))}},o.context.handlers.prev=()=>{switch(o.props.panel){case"year":return void(o.props.renderedDate=r.addYear(o.props.renderedDate,-10));case"day":return void(o.props.renderedDate=r.addMonth(o.props.renderedDate,-1))}},o.context.handlers.setDate=e=>()=>{"month"!==o.props.panel&&"year"!==o.props.panel||!o.props.activeDate||(e=o.props.activeDate),o.emit("dateSelected",e)},o.context.handlers.localTime=e=>{const t=e.target;if(!t.value)return;const[n,r]=t.value.split(":");o.props.localTime=t.value,o.props.activeDate.setHours(n,r),el(o,o.props.activeDate)},o.context.handlers.keyDown=e=>{switch(o.props.keydown=!0,o.props.panel){case"day":return o.emit("calendarKeydown",e);case"year":return o.emit("yearKeydown",e);case"month":return o.emit("monthKeydown",e);case"time":return o.emit("timeKeydown",e);default:return}},o.context.handlers.inputKeydown=e=>{o.emit("keydown",e)},o.context.handlers.openKeydown=e=>{"Enter"!==e.key&&"Space"!==e.key||(o.props.expanded=!0)},o.context.handlers.mouseEnter=e=>n=>{if(clearTimeout(t),n.target instanceof HTMLElement&&"-1"===n.target.getAttribute("tabindex")&&"true"!==n.target.getAttribute("data-is-extra"))if("month"===o.props.panel||"year"===o.props.panel){const t=r.nearestDay(e,(()=>!0),o.props.panel);t&&(o.props.activeDate=t)}else o.props.activeDate=e},o.context.handlers.mouseLeave=()=>{clearTimeout(t),t=setTimeout((()=>{}),100)},o.context.handlers.jumpTo=e=>()=>{o.props.panels.unshift(o.props.panel),o.props.panel=e},o.context.fns.sameDay=e=>function(e,t){return t instanceof Date&&r.sameDay(e,t)}(e,o.props.activeDate),o.context.fns.sameMonth=e=>Xa(e,o.props.activeDate),o.context.fns.sameYear=e=>Ga(e,o.props.activeDate),o.context.fns.notInMonth=(e,t)=>{const o=r.dayStart(t).getTime();return o<r.monthStart(e).getTime()||o>r.monthEnd(e).getTime()||void 0}}}));const I=Qa.bind(null,o);o.on("prop:panel",(({payload:e})=>{o.props.showPagination=o.props.paginatedPanels.includes(e)})),o.on("dateSelected",(({payload:e})=>{var t,n;Array.isArray(o.props.panels)&&o.props.panels.length?o.props.panel=o.props.panels.shift():(o.props.expanded=!1,null===(n=null===(t=o.props.__root)||void 0===t?void 0:t.getElementById(`${o.props.id}`))||void 0===n||n.focus()),e&&o.props._isDisabled(e)||ol(o,e)})),o.on("input",(({payload:e})=>{if(void 0===e&&!o.props._isFocused)return void el(o,void 0);const t=new Date,n=e?el(o,r.removeOffset("string"==typeof e?r.parse(e,o.props.valueFormat,o.props.valueLocale):e,o.props.offset)):t;o.props.activeDate=!e&&o.props.activeDate?o.props.activeDate:n,o.props.renderedDate=!e&&o.props.renderedDate?o.props.renderedDate:n,o.props.localTime=r.format(n,"HH:mm"),function(e){const t=qa.get(e);if(e._value&&t){const o=r.monthDays(e.props.activeDate);if(t.length>o)t.splice(o,t.length-o);else if(t.length<o)for(let e=t.length+1;e<=o;e++)t.push(String(e))}}(o)})),o.on("prop:renderedDate",Ja.bind(null,o)),o.on("prop:expanded",(({payload:t})=>{if(t){if(za.delete(o),o.props.panels=tl(o),o.props.panel=o.props.panels.shift(),window.innerWidth<=430&&!window.matchMedia("(hover: hover)").matches?o.props.showPanelClose=!0:o.props.showPanelClose=!1,"day"===o.props.panel){const e=o.props.activeDate;o.props.activeDate=r.nearestDay(o.props.activeDate,(e=>!o.props._isDisabled(e)),"month")||e}Ja(o),e.whenAvailable(`${o.props.id}_popover`,(e=>{const t=e.querySelector('[tabindex="0"]');t&&setTimeout((()=>{t.focus(),function(e,t){const o=new MutationObserver((e=>{for(const t of e)"attributes"===t.type&&t.target instanceof HTMLElement&&"0"===t.target.getAttribute("tabindex")?t.target.focus():t.addedNodes.length&&t.addedNodes.forEach((e=>{var t;if(e instanceof HTMLElement&&"0"===e.getAttribute("tabindex"))e.focus();else if(e instanceof HTMLElement&&e.querySelector('[tabindex="0"]')){const t=e.querySelector('[tabindex="0"]');t instanceof HTMLElement&&t.focus()}else e instanceof HTMLElement&&e.querySelector('input[type="time"]')&&(null===(t=e.querySelector('input[type="time"]'))||void 0===t||t.focus())}))}));o.observe(t,{attributes:!0,attributeFilter:["tabindex"],childList:!0,subtree:!0});const n=e.on("prop:expanded",(({payload:t})=>{t||(e.off(n),o.disconnect())}))}(o,e)}),0)}),o.props.__root),Ha&&setTimeout((()=>{document.addEventListener("click",I)}),10)}else{if(o.props.activeDate=o.props.renderedDate,"time"===o.props.panel)o.emit("dateSelected",o.props.activeDate);else if(o._value){Ua.add(o);const e="string"==typeof o._value?r.parse(o._value,o.props.valueFormat,o.props.valueLocale):o._value;el(o,r.removeOffset(e,o.props.offset))}else el(o,void 0);Ha&&(Na.add(o),document.removeEventListener("click",I),setTimeout((()=>Na.delete(o)),50))}})),o.on("prop:activeDate",(({payload:e})=>{if(Array.isArray(o.props.calendar)&&o.props.calendar.length)if("day"===o.props.panel){const t=o.props.calendar,n=r.monthStart(o.props.renderedDate),s=r.monthEnd(r.addMonth(o.props.renderedDate,t.length-1));e.getTime()<n.getTime()?o.props.renderedDate=r.addMonth(o.props.renderedDate,-1):e.getTime()>s.getTime()&&(o.props.renderedDate=r.addMonth(o.props.renderedDate))}else if("year"===o.props.panel){const t=o.props.years,n=t[0].getFullYear(),s=t[t.length-1].getFullYear(),a=o.props.activeDate.getFullYear();a>s?o.props.renderedDate=r.addYear(o.props.renderedDate,10):a<n?o.props.renderedDate=r.addYear(o.props.renderedDate,-10):(o.props.skipBuildCalendar=!0,o.props.renderedDate=e)}o.props.expanded&&el(o,o.props.activeDate)})),o.on("keydown",(({payload:e})=>{switch(e.key){case"ArrowDown":case"ArrowUp":case" ":e.preventDefault(),o.props.pickerOnly&&(o.props.expanded=!0);break;case"Enter":case"Return":o.props.expanded||(o.props.expanded=!0);break;case"Escape":o.props.expanded=!1}})),o.on("calendarKeydown",(({payload:e})=>{e.preventDefault();let t=null,n=0;switch(e.key){case"ArrowRight":n=1;break;case"ArrowLeft":n=-1;break;case"ArrowDown":n=7;break;case"ArrowUp":n=-7;break;case"Return":case"Enter":o.emit("dateSelected",o.props.activeDate);break;case"Tab":e.shiftKey||nl(o,e);break;case"Escape":o.props.expanded=!1}if(n&&(e.preventDefault(),t=r.addDay(o.props.activeDate,n)),t&&!o.props._isDisabled(t))o.props.activeDate=t;else if(t&&o.props._isDisabled(t)){const e=n>0?1:-1;_(Number(o.props.maxScan),(t=>e*t)).some((e=>{const n=r.addDay(t,e);return!o.props._isDisabled(n)&&(o.props.activeDate=n,!0)}))}})),o.on("yearKeydown",(({payload:e})=>{let t=0;switch(e.key){case"ArrowDown":t=5;break;case"ArrowRight":t=1;break;case"ArrowUp":t=-5;break;case"ArrowLeft":t=-1;break;case"Tab":e.shiftKey||nl(o,e);break;case"Return":case"Enter":o.emit("dateSelected",o.props.activeDate);break;case"Escape":o.props.expanded=!1}const n=o.props.activeDate.getFullYear()+t-o.props.renderedDate.getFullYear();o.props.activeDate=r.addYear(o.props.renderedDate,n)})),o.on("monthKeydown",(({payload:e})=>{let t=0;switch(e.key){case"ArrowDown":t=3;break;case"ArrowRight":t=1;break;case"ArrowLeft":t=-1;break;case"ArrowUp":t=-3;break;case"Tab":e.shiftKey||nl(o,e);break;case"Return":case"Enter":o.emit("dateSelected",o.props.activeDate);break;case"Escape":o.props.expanded=!1}t&&e.preventDefault();let n=(o.props.activeDate.getMonth()+t)%12;n=n<0?12+n:n;const s=n-o.props.renderedDate.getMonth();let a=r.addMonth(o.props.renderedDate,s);if(o.props._isDisabled(a)){const e=r.nearestDay(a,(e=>!o.props._isDisabled(e)),"month");e&&(a=e)}o.props.activeDate=a})),o.on("timeKeydown",(({payload:e})=>{switch(e.key){case"Return":case"Enter":e.preventDefault(),o.emit("dateSelected",o.props.activeDate)}})),o.on("prop:_isFocused",(()=>{Wa.get(o)&&sl(o)})),o.on("commit",(({payload:e})=>{if(e?ja(o):Ya(o),o.props.activeDate&&o.props._isDisabled(o.props.activeDate)){const e=t.createMessage({blocking:!0,key:"rule_invalidDate",meta:{messageKey:"invalidDate",removeImmediately:!1,localize:!0,i18nArgs:[{node:o,name:ll(o),args:[]}]},type:"validation",value:"The selected date is invalid."});o.store.set(e)}else o.store.remove("rule_invalidDate")}))},jt,
30
30
  /* #__PURE__ */o.localize("next"),
31
31
  /* #__PURE__ */o.localize("prev"),
32
32
  /* #__PURE__ */o.localize("changeDate"),