@formkit/pro 0.129.1 → 0.129.2-next.6173fc1
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/autocomplete/index.mjs +1 -1
- package/datepicker/index.mjs +1 -1
- package/dropdown/index.mjs +1 -1
- package/genesis.css +1 -1
- package/index.cjs +10 -10
- package/index.d.ts +4 -0
- package/index.mjs +10 -10
- package/package.json +1 -1
- package/taglist/index.mjs +1 -1
- package/togglebuttons/index.mjs +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailable as s,clone as a}from"@formkit/utils";import{isDOM as l,isComponent as i,createMessage as p,warn as d,error as c}from"@formkit/core";import{icon as u,isSlotCondition as f,isSchemaObject as v,extendSchema as h,normalizeOptions as m,defaultIcon as g,localize as $,options as b,disablesChildren as y}from"@formkit/inputs";import"@formkit/vue";import{animations as x,dragAndDrop as w,handleEnd as _,dragstartClasses as k}from"@formkit/drag-and-drop";import{offset as S,format as L,nearestDay as I,parse as A,range as C,parts as D,parseParts as T,addDay as E,addMonth as O,addYear as M,dayStart as V,monthStart as F,monthEnd as P,removeOffset as B,sameDay as H,date as R,formatStr as N,applyOffset as K,monthDays as W,isBefore as U,isAfter as Y,weekStart as j,weekEnd as q}from"@formkit/tempo";const z=[988,24029,396,13078,980],G=18806588,Z=502357,X=16217489;let J=189024;const Q=/^[0-9a-f]+$/,ee="undefined"!=typeof window,te=ue(32,e=>e).map(()=>{J|=0,J=J+1831565813|0;let e=J^J>>>15|J;return e=e+e^e>>>427|e^e,((e^e>>>14)>>>0)/4294967296}),oe=ee?setTimeout:()=>0,ne={},re=e=>e.toString(32),se=e=>`${re(te[e]).substring(2)}.${re(z[e%(z.length-1)])}`;const ae={},le={},ie=new Set(["",null,void 0]);function pe(e,t){e in ae||(ae[e]={timer:0,inputs:new Set});const o=ae[e];clearTimeout(o.timer),o.inputs.add(t),o.timer=oe(()=>{ne[e]||(ne[e]=oe(()=>ie.add(e),2e3)),function(e){if(ee){window.addEventListener([30548127325,27022924,34729821653783].map(re).join("y"),t=>{if("report"===t.disposition)return;const o=new URL(t.blockedURI).hostname;te.some((e,t)=>se(t)===o)&&(de(e),console.warn("[FormKit]: Enterprise license required for restrictive CSP."))});let t=0;const o=re(G),n="://",r=(new Date).getDate(),s=async()=>{const a=Array.from(ae[e].inputs),l=a.filter(t=>!(le[e]&&le[e].has(t))).join("");if((e=>{clearTimeout(ne[e])})(e),l){t++;try{const s=await window[re(X)](`${o}${n}${se((r+t)%te.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${l}`)}`),i=await s.json();if(i[re(Z)])return de(e,i.schema);if(s.ok)return le[e]||(le[e]=new Set),void a.forEach(t=>le[e].add(t))}catch(e){}t<2&&oe(s,1e4*Math.random())}};s()}}(e)},500)}function de(e,t){ie.add(e),function(e,t){fe[e]&&fe[e].forEach(e=>e(t))}(e,t)}function ce(e,t,o){if(pe(t,o),!t)throw new Error("FormKitNoKey");return ie.has(t)?null:e}function ue(e,t){return new Array(e).fill("").map((e,o)=>t(o))}const fe={};const ve=()=>({$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"}}),he=()=>({$el:"div",attrs:{id:'$id + "_inner"'}}),me=()=>({if:"$label",$el:"label",attrs:{for:"$id",id:"$id + '_label'"}}),ge=()=>({$el:"ul",if:"$defaultMessagePlacement && $fns.length($messages)"}),$e=()=>({$el:"li",for:["message","$messages"],attrs:{key:"$message.key",id:"$id + '-' + $message.key","data-message-type":"$message.type"}}),be=()=>({$el:"div",if:"$help",attrs:{id:'$: "help-" + $id'}}),ye=()=>({$el:null}),xe=(e,t)=>()=>u(e,t),we=()=>({$el:"span",if:'$part.type === "placeholder" && $part.value'}),_e=()=>({$el:"span",if:'$part.type === "literal" && $part.value'}),ke=()=>({$el:"span",if:'$part.type === "char" && $part.value'}),Se=()=>({$el:"span",if:'$part.type === "enum" && $part.value'}),Le=()=>({$el:"div",if:"$overlay",attrs:{id:'$id + "_overlay"',class:"$classes.overlay",style:"$_overlayStyles",onClick:"$_isPlaceholder && $handlers.overlayClick"}}),Ie=()=>({$el:"div",attrs:{id:'$id + "_overlay_inner"',class:"$classes.overlayInner",style:"$_overlayInnerStyles"}}),Ae=()=>({$el:null,for:["part","$_overlayParts"]});function Ce(t,o,n,r){return(...s)=>a=>p=>{const d=function(e,t,o,n,r,s){const a=s[o],p="function"==typeof n?n():{$el:n},d=r.map(e=>"string"==typeof e?e:e(t)(s));let c=d.length&&p?h(p,{children:d}):p;if(c=h(c,a),"object"==typeof c){let r=c;if((l(c)||i(c))&&(c.meta={...c.meta||{},section:o,node:n}),l(c)){const{$el:n,...s}=c;s.attrs?"class"in s.attrs||"if"in s.attrs||(s.attrs={class:`$classes.${o}`,...s.attrs}):s.attrs={class:`$classes.${o}`},r=De(t,o,Object.defineProperty(s,"$el",{enumerable:!1,get:ce.bind(null,n,t,e)}))}else if(i(c)){const{$cmp:n,...s}=c;r=De(t,o,Object.defineProperty(s,"$cmp",{enumerable:!1,get:ce.bind(null,n,t,e)}))}else if("$formkit"in c){c.outerClass=`$classes.${o}`;const{$formkit:n,...s}=c;r=De(t,o,Object.defineProperty(s,"$formkit",{enumerable:!1,get:ce.bind(null,n,t,e)}))}return r}return De(t,o,c)}(t,a,o,n,s,p);return r&&e(d)&&(d.memo=t+JSON.stringify(p)),r?[d]:d}}function De(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 Te(e){return(t,o,n=!1)=>Ce(e,t,o,n)}function Ee(e){return{outer:e("outer",ve,!0),wrapper:e("wrapper","div",!1),inner:e("inner",he,!1),icon:xe,label:e("label",me,!1),prefix:e("prefix",ye,!1),suffix:e("suffix",ye,!1),help:e("help",be,!1),messages:e("messages",ge,!1),message:e("message",$e,!1)}}function Oe(e){return{overlayPlaceholder:e("overlayPlaceholder",we),overlayLiteral:e("overlayLiteral",_e),overlayChar:e("overlayChar",ke),overlayEnum:e("overlayEnum",Se),overlay:e("overlay",Le),overlayParts:e("overlayParts",Ae),overlayInner:e("overlayInner",Ie)}}function Me(e,t,o){return n=>r=>{const s="string"==typeof t?t:t(n)(r);return o?{if:e,then:s,else:"string"==typeof o?o:o(n)(r)}:(f(s)?Object.assign(s.else,{if:e}):v(s)&&Object.assign(s,{if:e}),s)}}function Ve(e){const o=e("dropdownWrapper",()=>({$el:"div",attrs:{id:'$id + "_popover"',popover:{if:"$usePopover",then:"$popover",else:void 0},"data-is-wrapper":!0,style:"$dropdownWrapperStyles",onScroll:"$handlers.scroll"}})),n=e("listbox",()=>({$el:"ul",if:"$expanded || $setForceExpanded",attrs:{style:"$listboxStyles",id:'$id + "_listbox"',role:"listbox","aria-activedescendant":"$activeDescendant","aria-labelledby":'$id + "_label"'}})),r=e("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"}})),s=e("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"}})),a=e("loadMoreInner","span"),i=e("emptyMessage",()=>({$el:"li",if:"$showEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}})),p=e("emptyMessageInner","span"),d=e("option",()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option)"}})),c=e("listitems",()=>({$el:null,if:"$options.length",for:["option","index","$option.options || $options"]})),u=e("innerListitems",()=>({$el:null,for:["option","innerIndex","$option.options"]})),v=e("listitemGroup",()=>({$el:"li",attrs:{"aria-label":"$option.group",role:"group",onClick:"$handlers.listitemGroupClick",tabindex:"-1"}})),h=e("groupLabel","span"),m=e("groupList",()=>({$el:"ul",attrs:{role:"group"}}));return()=>{return o(n(i(p("$emptyMessage")),c(Me("$option.group",v(h("$option.group"),m(u((e=()=>({id:'$id + "_listitem_" + $index + "_" + $innerIndex'}),g=r(Me("$fns.isSelected($option)",xe("selected")),d("$option.label")),o=>{const n=n=>{const r=g(o)(n),s="function"==typeof e?e(o):e;return t(s)?(f(r)&&l(r.else)?r.else.attrs={...r.else.attrs,...s}:l(r)&&(r.attrs={...r.attrs,...s}),r):r};return n._s=g._s,n})))),r(Me("$fns.isSelected($option)",xe("selected")),d("$option.label")))),s(Me("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",a(Me("$state.loading",xe("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value")))));var e,g}}const Fe=/* #__PURE__ */Te("dd"),{outer:Pe,wrapper:Be,inner:He,icon:Re,label:Ne,prefix:Ke,suffix:We,help:Ue,messages:Ye,message:je}=/* #__PURE__ */Ee(Fe),qe=Fe("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"}})),ze=Fe("selectionWrapper",()=>({if:"$option || $state.loading",$el:"div"})),Ge=Fe("selection",()=>({$el:"div"})),Ze=Fe("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'}}})),Xe=Fe("optionLoading","span"),Je=Fe("option",()=>({$el:"div"})),Qe=Fe("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"}})),et=Fe("selectionsWrapper",()=>({$el:"div",attrs:{id:'$id + "_selections_wrapper"'}})),tt=Fe("selections",()=>({$el:"div",attrs:{"aria-live":"polite","aria-hidden":'$lastVisibleIndex && "true" || undefined',"data-test":"$lastVisibleIndex",id:'$id + "_selections"'}})),ot=Fe("truncationCount",()=>({$el:"div",attrs:{id:'$id + "_truncation_count"'}})),nt=Fe("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 || ""'})),rt=Fe("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)"}})),st=Fe("tag",()=>({$el:"div",attrs:{id:'$id + "_tag_" + $index',role:"button",tabindex:"-1"}})),at=Fe("tagLabel",()=>({$el:"span"})),lt=Fe("tagsWrapper",()=>({$el:"span",attrs:{id:'$id + "_tags_wrapper"',"aria-live":"polite"}})),it=Fe("tags",()=>({$el:"span",attrs:{id:'$id + "_selections"'}})),pt=Fe("tagLoading","span"),dt=/* #__PURE__ */Ve(Fe);function ct(t){return e(t)&&"value"in t&&"label"in t}function ut(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 ft(){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 vt(e){return"__original"in e?e.__original:e.value}const ht=new WeakMap,mt={mutationObservers:0,resizeObservers:0,documentListeners:new Map,windowListeners:new Map,timeouts:0,intervals:0};function gt(e,t){ht.has(e)||(ht.set(e,new Set),e.on("destroyed",()=>{const t=ht.get(e);t&&(t.forEach(e=>{try{e()}catch(e){}}),t.clear(),ht.delete(e))}));const o=ht.get(e);return o.add(t),()=>{o.delete(t)}}function $t(e,t){const o=new MutationObserver(t);return mt.mutationObservers++,gt(e,()=>{o.disconnect(),mt.mutationObservers--}),o}function bt(e,t){const o=new ResizeObserver(t);return mt.resizeObservers++,gt(e,()=>{o.disconnect(),mt.resizeObservers--}),o}function yt(e,t,o,n){let r=null;const s=()=>{r&&r()};return gt(e,s),{add:()=>{if(!r){document.addEventListener(t,o,n);const e=mt.documentListeners.get(t)||0;mt.documentListeners.set(t,e+1),r=()=>{document.removeEventListener(t,o,n);const e=mt.documentListeners.get(t)||1;e<=1?mt.documentListeners.delete(t):mt.documentListeners.set(t,e-1),r=null}}},remove:s}}const xt=new WeakMap,wt=new WeakMap,_t=new WeakSet;async function kt(e,t,o=!1,n=!1){if("function"==typeof e.props.optionsLoader){e.props.search=t,clearTimeout(wt.get(e));const o=t?e.props.debounce:0;0===o?St(e,n):(!function(e){_t.has(e)||(_t.add(e),gt(e,()=>{const t=wt.get(e);t&&(clearTimeout(t),wt.delete(e))}))}(e),wt.set(e,setTimeout(()=>{e.props.page=1,St(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 St(e,t){e.props.allowAppendOptions=t,Tt(e)}const Lt=/* #__PURE__ */p({key:"loading",type:"state",value:!0,visible:!1}),It=/* #__PURE__ */p({key:"loading",type:"state",value:!1,visible:!1});function At(e,t){if(e.props.allowAppendOptions)return e.props.allowAppendOptions=!1,function(e,t){const o=m(t);e.props.appendingOptions=!0,e.props.activeValue=vt(o[0]),e.props.options=e.props.options.concat(o)}(e,t);const o=m(t);e.props.options=o,e.props.options.length||(e.store.set(It),e.store.set(p({key:"hasNextPage",type:"state",value:!1,visible:!1}))),xt.set(e,e.props.searchValue)}const Ct=new WeakMap;function Dt(t,r,s){if(t.store.set(Lt),t.props.optionLoadingCounter++,t.props.multiple&&"truncate"!==t.props.selectionAppearance){let e;e=o(r)?{label:"Loading...",value:String(r)}:{label:String(r),value:r},t.props.optionLoaderValues.includes(e.value)||t.props.optionLoaderValues.push(e.value),"transferlist"!==t.props.type&&t.props.multiple&&"text-input"!==t.props.selectionAppearance&&!t.props.selections.includes(e)&&(t.props.selections=[...t.props.selections,e])}const a=t.props.optionLoader(r,s),l=t=>"string"==typeof t?{label:t,value:r}:ct(t)?t:e(t)?Object.assign({label:String(r),value:r},t):{label:String(r),value:r},i=e=>{const o=t.props.memoOptions.findIndex(t=>n(vt(t),vt(e)));return-1===o?t.props.memoOptions=[...t.props.memoOptions,e]:t.props.memoOptions[o]=e,e};return a instanceof Promise?a.then(e=>{if("string"==typeof e||ct(e))return i(l(e))}).finally(()=>{t.props.optionLoaderValues=t.props.optionLoaderValues.filter(e=>e!==r),t.props.optionLoadingCounter--}):(t.props.optionLoaderValues=t.props.optionLoaderValues.filter(e=>e!==r),t.props.optionLoadingCounter--,i(l(a)))}function Tt(e){e.store.set(Lt),e.props.optionsLoadingCounter++,e.store.set(p({key:"hasNextPage",type:"state",value:!1,visible:!1}));const t=e.props.nonceKey&&e.props[e.props.nonceKey],o=e.props.optionsLoader(e.context,Ct.get(e)),n=At.bind(null,e),r=o instanceof Promise?o.then((...o)=>{void 0!==e.props.nonceKey&&t!==e.props[e.props.nonceKey]||n(...o)}):(n(o),e.props.optionsLoadingCounter--);if(r instanceof Promise)return r.finally(()=>{e.props.optionsLoadingCounter--})}function Et(e,t){e.props.page++,Ct.set(e,t),e.store.set(p({key:"hasNextPage",type:"state",value:!0,visible:!1}))}const Ot=Symbol(),Mt=e=>{const t=(e=>{const t=[...e.props.allOptions,...e.props.initialOptions];return[...e.props.memoOptions||[],...t]})(e),r=e.props.inputStd||[],s=[];for(const e of r){let r,a=t.find(t=>n(vt(t),e));r=o(e)?void 0:Array.isArray(e)?e.join(", "):e,a||(a={value:e,label:r,isPlaceholder:!1,noOptionFound:!0}),s.push(a)}return s};function Vt(e,t){if(e.props.optionRemoved=!0,t){const o=(e.props.inputStd||[]).filter(e=>!n(vt(t),e));e.input(o)}else e.input(void 0);e.props.openOnRemove&&!e.props.expanded&&e.isCreated&&(e.props.expanded=!0),setTimeout(()=>{var t;return e.emit("selectRange",[null===(t=e.props.highlightedRange)||void 0===t?void 0:t.option])},20)}async function Ft(e){const t=Mt(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:ee&&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 Pt(e){var t,o;if(e.props.allOptions&&e.props.allOptions.length)if(null===(t=e.props.highlightedRange)||void 0===t?void 0:t.option.value)e.props.activeValue=vt(e.props.highlightedRange.option);else{if(e.props.activeSelectionValue){const t=e.props.allOptions.find(t=>n(vt(t),e.props.activeSelectionValue));if(t)return void(e.props.activeValue=t.value)}if(e.props.reloadOnCommit)e.props.activeValue=vt(e.props.allOptions[0]);else{if(e.props.searchValue&&!e.props.appendingOptions)e.props.activeValue=vt(e.props.allOptions[0]);else if(e.props.inputStd.length>0&&!e.props.multiple||e.props.multiple&&(null===(o=e.context)||void 0===o?void 0:o.state.dirty))e.props.selections[e.props.selections.length-1]?e.props.activeValue=vt(e.props.selections[e.props.selections.length-1]):e.props.activeValue=vt(e.props.allOptions[0]);else{if(e.props.appendingOptions)return void(e.props.appendingOptions=!1);e.props.activeValue=vt(function(e){return e.props.allOptions.find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})}(e))}e.props.appendingOptions&&(e.props.appendingOptions=!1)}}}function Bt(e){return e.reduce((e,t)=>("options"in t&&Array.isArray(t.options)?e.push(...Bt(t.options)):e.push(t),e),[])}function Ht(e,t){var o,n;(null===(o=t.attrs)||void 0===o?void 0:o.disabled)||(vt(t)!==Ot?(e.props.option=t,e.props.maxReached&&!Kt(e,t)||(e.input(Rt(e,vt(t))),Kt(e,t)&&e.props.closeOnSelect&&(e.props.expanded=!1))):null===(n=e.context)||void 0===n||n.handlers.loadMore(!0))}function Rt(e,t){if(e.props.multiple){const o=Array.isArray(e.value)?e.value:[];for(const r of o)if(n(r,t))return e.props.optionRemoved=!0,o.filter(e=>!n(e,t));return[...o,t]}return n(t,e.value)&&e.props.deselect?void(e.props.optionRemoved=!0):t}function Nt(e,t){return n(e.props.activeValue,vt(t))||void 0}function Kt(e,t){if(e.props.multiple){if(!Array.isArray(e.value))return!1;for(const o of e.value)if(n(o,vt(t)))return!0;return!1}return n(e.value,vt(t))}function Wt(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 Ut(e){e.props.firstCommit=!0;let t=null;e.on("commit",()=>{if(0===e.props.inputStd.length&&e.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}(e),void(t=e.props.inputStd);if(e.props.inputStd.length&&"function"==typeof e.props.optionsLoader&&0===e.props.options.length&&"function"!=typeof e.props.optionLoader&&0===e.props.optionsLoadingCounter){e.props.optionsLoaded=!0;const t=Tt(e);t instanceof Promise&&t.then(()=>{Ft(e)})}"function"!=typeof e.props.optionLoader||e.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}(t,e.props.inputStd)?0===e.props.optionsLoadingCounter&&Ft(e):(t=e.props.inputStd,async function(e){const t=Mt(e),o=e.props.inputStd.length>1?e.props.inputStd.filter(t=>!e.props.memoOptions.find(e=>n(vt(e),t))):e.props.inputStd;if(o.forEach(o=>{Dt(e,o,Array.isArray(t)&&t.find(e=>n(vt(e),o)&&!e.noOptionFound))}),e.props.optionLoadingCounter){const t=e.on("prop:optionLoadingCounter",()=>{Ft(e),e.props.optionLoadingCounter||e.off(t)})}else Ft(e)}(e))})}const Yt=new WeakSet;function jt(e){if(!ee)return;e.props.positionListBox=function(e,t){var o,r;let s=null;if(e.props.activeDescendant){s=e.props.options.filter(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)}).findIndex(t=>n(e.value,vt(t))),-1===s&&(s=null);(null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant))&&qt(e)}if("undefined"==typeof window)return s;const a=t.getBoundingClientRect(),l=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}`);if(l){const t=l.getBoundingClientRect();t.top+t.height+a.height>window.innerHeight&&t.top+t.height>a.height?(e.props.invertPopover=!0,e.props.usePopover||(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,top:"auto",bottom:"100%"})):e.props.usePopover||(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,bottom:"auto",top:"100%"})}return s}.bind(null,e),e.props.styleWrapper=zt.bind(null),e.on("mounted",()=>{s(`${e.props.id}_popover`,r.bind(null,e),e.props.__root)});const t=yt(e,"mousemove",t=>{var o;e.props.mouseX=t.clientX,e.props.mouseY=t.clientY;const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_popover`);if(n){const o=n.getBoundingClientRect();t.clientX>o.x&&t.clientX<o.x+o.width&&t.clientY>o.y&&t.clientY<o.y+o.height&&(e.props.trackHover=!0)}}),o=()=>{e.props.ignoreScroll?e.props.ignoreScroll=!1:e.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=bt(e,()=>{e.props.styleWrapper(),e.props.positionListBox(t)}),n=$t(e,n=>{const r=n[0].target;if("overscroll"!==e.props.behavior||r.id===`${e.props.id}_popover`){const n=e.props.positionListBox(t);Yt.delete(e),a(e,n),o.observe(t)}});n.observe(t,{childList:!0,subtree:!0})}function a(e,t){var o;if(!e.props.expanded||!e.props.options||!e.props.options.length||Yt.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]),Yt.add(e),n.length&&l(e,n,t)}function l(e,t,o){var n,r,s,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=vt(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||qt(e),e.props.expanded?(p&&e.props.loadOnScroll&&!(null===(r=e.store.loading)||void 0===r?void 0:r.value)&&(null===(s=e.store.hasNextPage)||void 0===s?void 0:s.value)&&p.scrollTop+p.offsetHeight>p.scrollHeight-200&&(null===(i=e.context)||void 0===i||i.handlers.loadMore(!0)),Yt.has(e)?requestAnimationFrame(l.bind(null,e,t,o)):a(e,o)):Yt.delete(e)}e.on("prop:trackHover",({payload:t})=>{var n,r,s;ee&&(t?null===(s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_popover`))||void 0===s||s.removeEventListener("scroll",o):null===(n=e.props.__root)||void 0===n||n.getElementById(`${e.props.id}_popover`))}),e.on("prop:expanded",({payload:o})=>{e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,zIndex:o||e.props.forceExpanded?"999":"-1",pointerEvents:o?"auto":"none"},o?(t.add(),e.props.styleWrapper(),Pt(e)):t.remove()}),e.on("prop:trackHover",({payload:t})=>{var n,r;ee&&(t?null===(r=document.getElementById(`${e.props.id}_popover`))||void 0===r||r.removeEventListener("scroll",o):null===(n=document.getElementById(`${e.props.id}_popover`))||void 0===n||n.addEventListener("scroll",o))}),e.on("prop:activeValue",({payload:t})=>{if(t===Ot)return void(e.props.activeDescendant=`${e.props.id}_load_more`);let o,r=-1;for(let s=0;s<e.props.options.length;s++){if("group"in e.props.options[s])for(let a=0;a<e.props.options[s].options.length;a++)if(n(vt(e.props.options[s].options[a]),t)){r=a,o=s;break}if(n(vt(e.props.options[s]),t)){r=s;break}}e.props.activeDescendant=r<0?void 0:void 0===o?`${e.props.id}_listitem_${r}`:`${e.props.id}_listitem_${o}_${r}`})}function qt(e){var t,o;if(!ee)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 zt(){}const Gt=new WeakMap;function Zt(e){e.on("created",()=>{if(!e.context||!ee)return;e.context.fns.isActive=Nt.bind(null,e),e.context.fns.isSelected=t=>Kt(e,t),e.context.fns.hasOptionLoaderValue=t=>{for(const o of e.props.optionLoaderValues)if(n(vt(t),o))return!0;return!1},e.context.handlers.listitemGroupClick=ao,e.context.handlers.selectOption=t=>o=>lo.call(null,e,t,o),e.context.handlers.loadMore=St.bind(null,e),e.context.handlers.removeSelection=t=>o=>so(e,t,o),e.context.handlers.tagTouchstart=t=>o=>so(e,t,o),e.context.handlers.selectionClick=t=>e.props.multiple?eo.bind(null,e,t):Qt.bind(null,e),e.context.handlers.selectionBlur=()=>to.bind(null,e),e.context.fns.isActiveSelection=(e,t)=>n(e,vt(t)),e.context.handlers.tagClick=t=>oo.bind(null,e,t),e.context.handlers.tagFocus=t=>no.bind(null,e,t),e.context.handlers.tagBlur=()=>ro.bind(null,e);const t=e.context.handlers.blur;e.context.handlers.blur=function(e,o){var n;if(o&&o.relatedTarget instanceof HTMLElement){const t=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(e.props.id+"_inner");if(t instanceof HTMLElement&&t.contains(o.relatedTarget))return}t(),function(e){if(e.props.disabled)return;e.props.expanded=!1,e.props.activeSelectionValue=void 0,e.emit("blur")}(e)}.bind(null,e),e.context.handlers.touchmove=Xt.bind(null,e),e.context.handlers.touchend=Jt.bind(null,e)})}function Xt(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=Gt.get(e);if(o){const[e,r]=o,s=t.touches[0].clientX-r;n.scrollLeft=e-s}else Gt.set(e,[n.scrollLeft,t.changedTouches[0].clientX])}}function Jt(e){Gt.delete(e)}function Qt(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 eo(e,t,o){o.currentTarget instanceof HTMLElement&&(n(e.props.activeSelectionValue,vt(t))?e.props.activeSelectionValue=void 0:(e.props.activeSelectionValue=vt(t),o.currentTarget.focus()))}function to(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 oo(e,t,o){o.stopPropagation(),e.props.disabled||(e.props.justFocused?e.props.justFocused=!1:o.currentTarget instanceof HTMLElement&&(n(e.props.activeSelectionValue,vt(t))?e.props.activeSelectionValue=void 0:(e.props.activeSelectionValue=vt(t),o.currentTarget.focus())))}function no(e,t,o){o.stopPropagation(),e.props.disabled||o.currentTarget instanceof HTMLElement&&(e.props.activeSelectionValue=vt(t),e.props.justFocused=!0)}function ro(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 so(e,t,o){o&&o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleRemoveSelection"},Vt(e,t))}function ao(e){e.stopPropagation()}function lo(e,t,o){o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleListitemClick"},Ht(e,t))}function io(e,t,o,n){!function(e){e.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===e.props.deselect?e.props.deselect=!0:e.props.deselect=r(e.props.deselect),e.props.option={},e.props.expanded=!1,e.props.inputStd=[],void 0===e.props.draggable?e.props.draggable=!0:"false"===e.props.draggable&&(e.props.draggable=!1),e.props.options||(d(350,{node:e,inputType:e.props.type}),e.props.options=[]),"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.props.allOptions=Bt(e.props.options),e.props.selections=[],e.props.memoOptions=[],e.props.invertPopover=!1,e.props.dropdownWrapperStyles={position:"absolute",top:"100%",overflow:"auto",minWidth:"100%"},e.props.decrementCount=0,e.props.page=1,e.props.loadMoreOption={label:"Load more",value:Ot},e.props.loadOptions=Tt,e.props.listboxStyles={},e.props.optionsLoadingCounter=0,e.props.optionLoadingCounter=0,e.props.searchable=r(e.props.searchable),e.props.loadOnScroll=r(e.props.loadOnScroll),e.props.multiple=r(e.props.multiple)||!1,"taglist"===e.props.type&&(e.props.multiple=!0),e.props.openOnFocus=r(e.props.openOnFocus),e.props.openOnRemove=void 0!==e.props.openOnRemove&&r(e.props.openOnRemove),e.props.hasNextPage=Et.bind(null,e),e.props.initialOptions=[...e.props.options],e.props.optionLoaderValues=[],e.props.loadOnCreated=r(e.props.loadOnCreated),e.props.max&&"number"!=typeof e.props.max?e.props.max=parseInt(e.props.max):e.props.max&&!e.props.multiple&&(e.props.max=void 0),e.on("mounted",()=>Wt(e)),e.on("prop:popoverCoordinates",()=>setTimeout(()=>{Wt(e)},10))}(n),n.props.multiple?function(e){e.hook.input((t,o)=>(e.props.highlightedRange&&!e.props.optionRemoved&&(t.splice(e.props.highlightedRange.index,1,vt(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])))}(n):function(e){e.hook.input((t,o)=>(e.props.inputStd=void 0===t||""===t||null===t?[]:[t],o(t)))}(n),e(n),Ut(n),function(e){e.on("created",()=>{e.context&&(e.props.trackHover=!0,void 0!==e.props.disabled||e.props.optionsLoader||!e.props.options||e.props.options.length||void 0!==e.props.emptyMessage||e.props.allowNewValues||0!==e.props.inputStd.length||(e.props.disabledInternally=!0),jt(e),e.props.loadOnCreated&&!e.props.optionsLoaded&&e.props.optionsLoader?Tt(e):e.props.optionsLoaded&&(e.props.optionsLoaded=!1),e.props.forceExpanded=r(e.props.forceExpanded),e.props.forceExpanded&&(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,zIndex:"999",pointerEvents:"auto"},setTimeout(()=>{e.props.setForceExpanded=!0},100)))})}(n),Zt(n),t(n),function(e){const t=yt(e,"click",()=>{e.props.activeSelectionValue=void 0,e.props.expanded=!1});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(It))}),e.on("prop:optionLoadingCounter",({payload:t})=>{0===t&&0===e.props.optionsLoadingCounter&&e.store.set(It)}),e.on("prop:disabled",({payload:t})=>{t&&(e.props.expanded=!1)}),e.on("prop:options",({payload:t})=>{e.props.allOptions=Bt(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),Pt(e)}),e.on("prop:expanded",({payload:o})=>{var n;if(ee)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(()=>t.add(),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 t.remove(),e.props.trackHover=!1,e.props.showEmptyMessage=!1})}(n),o(n)}function po(e){void 0===e.props.closeOnSelect?e.props.closeOnSelect=!e.props.multiple:e.props.closeOnSelect=r(e.props.closeOnSelect),(e.props.multiple&&void 0===e.props.selectionAppearance||"truncate"===e.props.selectionAppearance)&&(e.props.selectionAppearance="truncate",e.props.formattedSelections=[]),e.props.multiple?e.props.selectionRemovable=!1:e.props.selectionRemovable=r(e.props.selectionRemovable)}function co(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 uo(e,t,o){var r,s,a;if(o.preventDefault(),e.props.trackHover=!1,e.props.expanded){const o=e.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(vt(t)),e},[]);(null===(r=e.store.hasNextPage)||void 0===r?void 0:r.value)&&o.push(Ot);let l=-1;e.props.activeValue&&(l=o.findIndex(t=>n(t,e.props.activeValue))),-1===l&&o.length?e.props.activeValue=o[0]:"ArrowDown"===t&&o.length>l+1?e.props.activeValue=o[l+1]:"ArrowUp"===t&&l>0?e.props.activeValue=o[l-1]:"ArrowUp"===t&&0===l&&(null===(a=null===(s=e.props.__root)||void 0===s?void 0:s.getElementById(`${e.props.id}_tag-wrapper_${e.props.selections.length-1}`))||void 0===a||a.focus(),e.props.expanded=!1)}else e.props.expanded||"ArrowDown"!==t||(e.props.expanded=!0)}function fo(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=vt(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=vt(e.props.selections[0]):e.props.activeSelectionValue=void 0),e.props.expanded=!1}}function vo(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 ho(e,t,o,r=!0){var s,a,l,i,p,d,c;const u=o.key;if(o.altKey){const r=ft(),s=e.props.selections.findIndex(e=>n(vt(e),vt(t))),a=[...e.props.selections];"ArrowRight"===o.key?s<e.props.selections.length-1&&(a.splice(s,1),a.splice(s+1,0,t)):"ArrowLeft"===o.key&&s>0&&(a.splice(s,1),a.splice(s-1,0,t)),e.props.activeSelectionValue=vt(t),e.input([...a.map(vt)]),setTimeout(()=>{r instanceof HTMLElement&&r.focus()},100)}else{const o=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===o)return;const f="ArrowRight"===u?o+1:o-1;if(f>=e.props.selections.length){if(!r)return e.props.expanded=!0,e.props.activeSelectionValue=void 0,void(null===(a=null===(s=e.props.__root)||void 0===s?void 0:s.getElementById(`${e.props.id}`))||void 0===a||a.focus());null===(i=null===(l=e.props.__root)||void 0===l?void 0:l.getElementById(`${e.props.id}`))||void 0===i||i.focus()}else if(f<0&&0===o)null===(d=null===(p=e.props.__root)||void 0===p?void 0:p.getElementById(`${e.props.id}`))||void 0===d||d.focus();else if(f<0)return;const v=null===(c=e.props.__root)||void 0===c?void 0:c.getElementById(`${e.props.id}_tag-wrapper_${f}`);v&&v.focus(),e.props.selections[f]?e.props.activeSelectionValue=vt(e.props.selections[f]):e.props.activeSelectionValue=void 0}}function mo(e,t,o){var r;if(!(o.currentTarget instanceof HTMLElement))return;if(e.props.searchValue)return;const s=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===s)return;const a=e.props.selections[s+1]?s+1:s-1,l=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_tag-wrapper_${a}`);l&&l.focus(),e.props.userAction={type:"tagDelete"},Vt(e,t)}function go(e,t){var o;if(t.preventDefault(),e.props.allowNewValues&&e.props.searchValue&&e.input(Rt(e,e.props.searchValue)),e.props.expanded){if(e.props.activeValue===Ot)return void(null===(o=e.context)||void 0===o||o.handlers.loadMore(!0));const t=e.props.allOptions.find(t=>n(vt(t),e.props.activeValue));if(!t)return;Ht(e,t)}else e.props.expanded=!0}function $o(e){e.props.expanded&&(e.props.expanded=!1)}function bo(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":vo(e);break;case"ArrowRight":case"ArrowLeft":ho(e,t,o,!1);break;case"Delete":case"Backspace":mo(e,t,o)}}function yo(e,t,o){if(e.props.disabled)return;switch(o.key){case"ArrowUp":case"ArrowDown":!function(e,t,o){var r,s,a,l;o.preventDefault();const i=o.key,p=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===p)return;const d="ArrowDown"===i?p+1:p-1;if(d<0&&(null===(s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}`))||void 0===s||s.focus()),d<0||d>=e.props.selections.length)return;const c=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(`${e.props.id}_selection_wrapper_${d}`);c&&c.focus(),e.props.activeSelectionValue=(null===(l=e.props.selections[d])||void 0===l?void 0:l.value)||void 0}(e,t,o);break;case"Enter":break;case"Tab":!function(e,t,o){var r,s,a,l;if(t){const i=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===i)return;const p=o.shiftKey?i-1:i+1;if(p>=e.props.selections.length)return;if(p<0)return void(null===(s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}`))||void 0===s||s.focus());const d=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(`${e.props.id}_selection_wrapper_${p}`);d&&d.focus(),e.props.activeSelectionValue=(null===(l=e.props.selections[p])||void 0===l?void 0:l.value)||void 0}}(e,t,o);break;case"Delete":case"Backspace":!function(e,t){var o;if(t){const r=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===r)return;const s=e.props.selections[r+1]?r+1:r-1,a=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_selection_wrapper_${s}`);a&&a.focus(),e.props.selections[s]?e.props.activeSelectionValue=vt(e.props.selections[s]):e.props.activeSelectionValue=void 0}t&&1!==e.props.selections.length||(e.props.userAction={type:"selectionDelete"}),Vt(e,t)}(e,t)}}function xo(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":uo(e,o,t);break;case"ArrowLeft":case"ArrowRight":fo(e,o);break;case"Enter":go(e,t);break;case"Escape":$o(e);break;case"Delete":case"Backspace":co(e);break;default:e.emit("unusedKeydown",t)}}function wo(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":uo(e,o,t);break;case"ArrowRight":case"ArrowLeft":fo(e,o);break;case"Enter":go(e,t);break;case"Escape":$o(e);break;case"Delete":case"Backspace":co(e)}}function _o(e){e.props.alwaysLoadOnOpen=void 0!==e.props.alwaysLoadOnOpen&&r(e.props.alwaysLoadOnOpen),e.on("created",()=>{e.context&&(e.context.handlers.click=ko.bind(null,e),e.context.handlers.focus=So.bind(null,e),e.context.handlers.keydown=xo.bind(null,e),e.context.handlers.selectorTagKeydownHandler=t=>bo.bind(null,e,t))})}function ko(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 So(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 Lo(e){let t,o="";e.on("unusedKeydown",({payload:r})=>{if(!r.isComposing&&1===[...r.key].length){if(!o&&" "===r.key)return void function(e,t){var o;if(t.preventDefault(),e.props.expanded){if(e.props.activeValue===Ot)return void(null===(o=e.context)||void 0===o||o.handlers.loadMore());const t=e.props.allOptions.find(t=>n(vt(t),e.props.activeValue));if(!t)return;Ht(e,t)}else e.props.expanded=!0}(e,r);e.props.expanded=!0,clearTimeout(t),o+=r.key;const s=e.props.allOptions.find(e=>e.label.toLowerCase().startsWith(o.toLowerCase()));s&&(e.props.activeValue=vt(s)),t=setTimeout(()=>{o=""},400)}})}function Io(e){Ao(e),e.on("prop:selections",()=>{e.props.skipFormatSelections=!1,Ao(e)}),ee&&s(`${e.props.id}_selections`,Do.bind(null,e),e.props.__root)}function Ao(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 Co(e){var t,o;if(!ee||!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(()=>{Ao(e)});break}}}else e.props.lastTruncatedElText=null,e.props.lastVisibleIndex=null,Ao(e)}function Do(e,t){const o=new ResizeObserver(()=>{e.props.selections&&0!==e.props.selections.length&&(e.props.skipFormatSelections?e.props.skipFormatSelections=!1:Co(e))}),n=new ResizeObserver(()=>{Co(e)});o.observe(t),t.parentNode instanceof Element&&n.observe(t.parentNode)}const To={position:"fixed",top:0,bottom:0,right:0,left:0,pointerEvents:"none",zIndex:-1,overflowY:"auto","-webkit-overflow-scrolling":"auto"},Eo={position:"fixed",overflow:"hidden",height:"100%",width:"100%"},Oo={overflow:"hidden",height:"100%"},Mo={},Vo={};let Fo=0;function Po(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 Bo(e,t){var o,r;let s=null;if(e.props.activeDescendant){const a=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant);if(!a)return s;e.props.ignoreScroll=!0;const l=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_listbox`);if(!l)return s;const i=t.getBoundingClientRect(),p=l.getBoundingClientRect(),d=parseInt(getComputedStyle(t).paddingTop),c=parseInt(getComputedStyle(t).paddingBottom),u=a.offsetTop-d,f=Math.max(u-d,0),v=Math.max(t.scrollHeight-c-u-i.height,0),h=p.height-f-v;t.scrollTop=u;const m=()=>{t.scrollTop=v>0?v<d?t.scrollHeight:d:f<c?0:u-c},g=Math.min(150,p.height);f>0&&v>0||0===f&&0===v||h>g?t.scrollTop=u:m();t.clientHeight/2<t.scrollTop&&(s=e.props.options.filter(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)}).findIndex(t=>n(e.value,vt(t)))),-1===s&&(s=null)}return s}function Ho(e){e.addProps(["behavior"]),e.on("created",()=>{"overscroll"===e.props.behavior&&("function"==typeof e.props.optionsLoader&&c(300,[e]),e.props.dropdownWrapperStyles=a(To),e.props.listboxStyles={display:"inline-block"},e.props.styleWrapper=Po.bind(null,e),e.props.positionListBox=Bo.bind(null,e))}),e.on("prop:expanded",({payload:t})=>{"overscroll"===e.props.behavior&&(t?function(){Fo=document.documentElement.scrollTop;for(const e in Eo)Vo[e]=document.documentElement.style[e],document.documentElement.style[e]=Eo[e];for(const e in Oo)Mo[e]=document.body.style[e],document.body.style[e]=Oo[e];document.body.scrollTop=Fo}():function(){for(const e in Eo)document.documentElement.style[e]=Vo[e];for(const e in Oo)document.body.style[e]=Mo[e];document.body.scrollTop=0,document.documentElement.scrollTop=Fo}())})}function Ro(e){e.addProps(["multiLine"]),e.on("created",()=>{ee&&(e.props.multiLineHeight=void 0,s(`${e.props.id}_selections`,No.bind(null,e),e.props.__root))})}function No(e){var t;const o=bt(e,t=>{for(const o of t){const{height:t}=o.contentRect;e.props.selectionsHeight!==t&&(e.props.selectionsHeight=t),Ko(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 Ko(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 Wo(e){if(e.on("created",()=>{e.context&&Lo(e)}),e.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]})}(e),"truncate"===e.props.selectionAppearance&&(e.props.lastVisibleIndex=null,Io(e),e.on("prop:selections",()=>{Io(e)})),"tags"===e.props.selectionAppearance&&Ro(e),e.props.multiple&&"tags"===e.props.selectionAppearance){function t(){return Array.isArray(e.value)?e.value:[]}function o(t,o){e.input(t)}e.on("created",()=>{e.props.disabled&&(e.props.draggable=!1),s(`${e.props.id}_selections`,n=>{if(e.context&&n instanceof HTMLElement){const r={threshold:{horizontal:.25,vertical:0},plugins:[x()],draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,disabled:!e.props.draggable,root:e.props.__root,synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-tag")};w({parent:n,getValues:t,setValues:o,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:n,getValues:t,setValues:o,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:n,getValues:t,setValues:o,config:r})})}},e.props.__root)})}e.on("prop:expanded",({payload:t})=>{t&&e.props.optionsLoader&&"function"==typeof e.props.optionsLoader&&(!e.props.options.length||e.props.alwaysLoadOnOpen)&&(e.props.options=[],Tt(e))}),"overscroll"===e.props.behavior&&Ho(e)}const Uo=(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 Yo(e){if(e.addProps(["popover","popoverOffset","usePopover","popoverCoordinates","popoverAncestorCoordinates"]),e.props.popover=r(e.props.popover)?"manual":void 0,"input"!==e.type||"overscroll"===e.props.behavior)return;let t=null,o=null,n=[],a=null;if(e.props.popoverOffset=r(e.props.popoverOffset)?parseInt(e.props.popoverOffset):0,!e.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 l=()=>{e.props.invertPopover=!1,document.removeEventListener("resize",a),document.removeEventListener("scroll",a),n.forEach(e=>{e.removeEventListener("scroll",a)})};function i(){const{x:n,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}}(t,o);e.props.popoverAncestorCoordinates={x:n,y:r,width:s,height:a},e.props.popoverCoordinates={x:n,y:r,width:s,height:0}}function p(o){t&&document.body.contains(t)&&(o?(null==t||t.showPopover(),setTimeout(()=>{e.props.popoverCoordinates.height=(null==t?void 0:t.offsetHeight)||0},5)):t.matches(":popover-open")&&(t.hidePopover(),e.props.popoverCoordinates.height=0))}e.on("mounted",()=>{e.context&&(e.props.usePopover=!0,e.props.popoverCoordinates={x:0,y:0,width:0,height:0},e.props.popoverAncestorCoordinates={x:0,y:0,width:0,height:0})}),e.on("destroyed",()=>{l()}),e.on("prop:inputText",()=>{e.context&&(i(),p(!0))}),e.on("prop:expanded",({payload:r})=>{var d;e.context&&(!1===r?l():s(`${null===(d=e.context)||void 0===d?void 0:d.id}_popover`,()=>{if(!e.context)return;t=document.querySelector(`[id="${e.context.id}_popover"][popover]`)||document.querySelector(`[id="${e.context.id}_popover"] [popover]`),o||(o=function(e){if(!e)return null;let t=e.parentElement;for(;t&&"static"===window.getComputedStyle(t).position;)t=t.parentElement;return t}(t)),i(),p(r),a=Uo(()=>{e.context&&(i(),p(r))},10),document.addEventListener("resize",a),document.addEventListener("scroll",a),n=[];let s=null==t?void 0:t.parentElement;for(;s;)s.scrollHeight>s.clientHeight&&n.push(s),s=s.parentElement;n.forEach(e=>{e.addEventListener("scroll",a)})}))})}const jo={schema:/* #__PURE__ */Pe(/* #__PURE__ */Be(/* #__PURE__ */Ne("$label"),/* #__PURE__ */He(/* #__PURE__ */Re("prefix"),/* #__PURE__ */Ke(),/* #__PURE__ */qe(/* #__PURE__ */Me("$inputStd.length === 0 && $state.loading !== true",/* #__PURE__ */Ze('$placeholder || "placeholder"'),/* #__PURE__ */Me("$multiple !== true",/* #__PURE__ */ze(/* #__PURE__ */Me("$state.loading && $selections.length === 0",/* #__PURE__ */Xe("$ui.isLoading.value"),/* #__PURE__ */Ge(/* #__PURE__ */Je("$option.label")))),/* #__PURE__ */Me('$multiple && $selectionAppearance === "truncate"',/* #__PURE__ */et(/* #__PURE__ */tt(/* #__PURE__ */Me("$state.loading && $selections.length === 0",/* #__PURE__ */Xe("$ui.isLoading.value"),/* #__PURE__ */nt()))),/* #__PURE__ */Me('$multiple && $selectionAppearance === "tags"',/* #__PURE__ */lt(/* #__PURE__ */it(/* #__PURE__ */Me("$state.loading && $isLoadingOption !== true && $selections.length === 0",/* #__PURE__ */Xe("$ui.isLoading.value"),/* #__PURE__ */rt(/* #__PURE__ */st(/* #__PURE__ */Me("$state.loading && $fns.hasOptionLoaderValue($option) || $option.label === undefined",/* #__PURE__ */pt("$ui.isLoading.value"),/* #__PURE__ */at("$option.label")),/* #__PURE__ */Qe(/* #__PURE__ */Re("close"))))))))))),/* #__PURE__ */Me("$truncationCount && $state.loading !== true",/* #__PURE__ */ot("$truncationCount")),/* #__PURE__ */Me("$state.loading",/* #__PURE__ */Re("loader")),/* #__PURE__ */Me("$inputStd.length !== 0 && $selectionRemovable",/* #__PURE__ */Qe(/* #__PURE__ */Re("close")),/* #__PURE__ */Re("select"))),/* #__PURE__ */dt(),/* #__PURE__ */We(),/* #__PURE__ */Re("suffix"))),/* #__PURE__ */Ue("$help"),/* #__PURE__ */Ye(/* #__PURE__ */je("$message.value"))),type:"input",family:"dropdown",props:[],features:[
|
|
1
|
+
import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailable as s,clone as a}from"@formkit/utils";import{isDOM as l,isComponent as i,createMessage as p,warn as d,error as c}from"@formkit/core";import{icon as u,isSlotCondition as f,isSchemaObject as v,extendSchema as h,normalizeOptions as m,defaultIcon as g,localize as $,options as b,disablesChildren as y}from"@formkit/inputs";import"@formkit/vue";import{animations as x,dragAndDrop as w,handleEnd as k,dragstartClasses as _}from"@formkit/drag-and-drop";import{offset as S,format as L,nearestDay as I,parse as A,range as C,parts as D,parseParts as T,addDay as O,addMonth as E,addYear as M,dayStart as V,monthStart as F,monthEnd as P,removeOffset as B,sameDay as H,date as N,formatStr as R,applyOffset as K,monthDays as W,isBefore as U,isAfter as Y,weekStart as j,weekEnd as q}from"@formkit/tempo";const z=[988,24029,396,13078,980],G=18806588,Z=502357,X=16217489;let J=189024;const Q=/^[0-9a-f]+$/,ee="undefined"!=typeof window,te=ue(32,e=>e).map(()=>{J|=0,J=J+1831565813|0;let e=J^J>>>15|J;return e=e+e^e>>>427|e^e,((e^e>>>14)>>>0)/4294967296}),oe=ee?setTimeout:()=>0,ne={},re=e=>e.toString(32),se=e=>`${re(te[e]).substring(2)}.${re(z[e%(z.length-1)])}`;const ae={},le={},ie=new Set(["",null,void 0]);function pe(e,t){e in ae||(ae[e]={timer:0,inputs:new Set});const o=ae[e];clearTimeout(o.timer),o.inputs.add(t),o.timer=oe(()=>{ne[e]||(ne[e]=oe(()=>ie.add(e),2e3)),function(e){if(ee){window.addEventListener([30548127325,27022924,34729821653783].map(re).join("y"),t=>{if("report"===t.disposition)return;const o=new URL(t.blockedURI).hostname;te.some((e,t)=>se(t)===o)&&(de(e),console.warn("[FormKit]: Enterprise license required for restrictive CSP."))});let t=0;const o=re(G),n="://",r=(new Date).getDate(),s=async()=>{const a=Array.from(ae[e].inputs),l=a.filter(t=>!(le[e]&&le[e].has(t))).join("");if((e=>{clearTimeout(ne[e])})(e),l){t++;try{const s=await window[re(X)](`${o}${n}${se((r+t)%te.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${l}`)}`),i=await s.json();if(i[re(Z)])return de(e,i.schema);if(s.ok)return le[e]||(le[e]=new Set),void a.forEach(t=>le[e].add(t))}catch(e){}t<2&&oe(s,1e4*Math.random())}};s()}}(e)},500)}function de(e,t){ie.add(e),function(e,t){fe[e]&&fe[e].forEach(e=>e(t))}(e,t)}function ce(e,t,o){if(pe(t,o),!t)throw new Error("FormKitNoKey");return ie.has(t)?null:e}function ue(e,t){return new Array(e).fill("").map((e,o)=>t(o))}const fe={};const ve=()=>({$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-options-appearance":"$optionsAppearance || 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"}}),he=()=>({$el:"div",attrs:{id:'$id + "_inner"'}}),me=()=>({if:"$label",$el:"label",attrs:{for:"$id",id:"$id + '_label'"}}),ge=()=>({$el:"ul",if:"$defaultMessagePlacement && $fns.length($messages)"}),$e=()=>({$el:"li",for:["message","$messages"],attrs:{key:"$message.key",id:"$id + '-' + $message.key","data-message-type":"$message.type"}}),be=()=>({$el:"div",if:"$help",attrs:{id:'$: "help-" + $id'}}),ye=()=>({$el:null}),xe=(e,t)=>()=>u(e,t),we=()=>({$el:"span",if:'$part.type === "placeholder" && $part.value'}),ke=()=>({$el:"span",if:'$part.type === "literal" && $part.value'}),_e=()=>({$el:"span",if:'$part.type === "char" && $part.value'}),Se=()=>({$el:"span",if:'$part.type === "enum" && $part.value'}),Le=()=>({$el:"div",if:"$overlay",attrs:{id:'$id + "_overlay"',class:"$classes.overlay",style:"$_overlayStyles",onClick:"$_isPlaceholder && $handlers.overlayClick"}}),Ie=()=>({$el:"div",attrs:{id:'$id + "_overlay_inner"',class:"$classes.overlayInner",style:"$_overlayInnerStyles"}}),Ae=()=>({$el:null,for:["part","$_overlayParts"]});function Ce(t,o,n,r){return(...s)=>a=>p=>{const d=function(e,t,o,n,r,s){const a=s[o],p="function"==typeof n?n():{$el:n},d=r.map(e=>"string"==typeof e?e:e(t)(s));let c=d.length&&p?h(p,{children:d}):p;if(c=h(c,a),"object"==typeof c){let r=c;if((l(c)||i(c))&&(c.meta={...c.meta||{},section:o,node:n}),l(c)){const{$el:n,...s}=c;s.attrs?"class"in s.attrs||"if"in s.attrs||(s.attrs={class:`$classes.${o}`,...s.attrs}):s.attrs={class:`$classes.${o}`},r=De(t,o,Object.defineProperty(s,"$el",{enumerable:!1,get:ce.bind(null,n,t,e)}))}else if(i(c)){const{$cmp:n,...s}=c;r=De(t,o,Object.defineProperty(s,"$cmp",{enumerable:!1,get:ce.bind(null,n,t,e)}))}else if("$formkit"in c){c.outerClass=`$classes.${o}`;const{$formkit:n,...s}=c;r=De(t,o,Object.defineProperty(s,"$formkit",{enumerable:!1,get:ce.bind(null,n,t,e)}))}return r}return De(t,o,c)}(t,a,o,n,s,p);return r&&e(d)&&(d.memo=t+JSON.stringify(p)),r?[d]:d}}function De(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 Te(e){return(t,o,n=!1)=>Ce(e,t,o,n)}function Oe(e){return{outer:e("outer",ve,!0),wrapper:e("wrapper","div",!1),inner:e("inner",he,!1),icon:xe,label:e("label",me,!1),prefix:e("prefix",ye,!1),suffix:e("suffix",ye,!1),help:e("help",be,!1),messages:e("messages",ge,!1),message:e("message",$e,!1)}}function Ee(e){return{overlayPlaceholder:e("overlayPlaceholder",we),overlayLiteral:e("overlayLiteral",ke),overlayChar:e("overlayChar",_e),overlayEnum:e("overlayEnum",Se),overlay:e("overlay",Le),overlayParts:e("overlayParts",Ae),overlayInner:e("overlayInner",Ie)}}function Me(e,t,o){return n=>r=>{const s="string"==typeof t?t:t(n)(r);return o?{if:e,then:s,else:"string"==typeof o?o:o(n)(r)}:(f(s)?Object.assign(s.else,{if:e}):v(s)&&Object.assign(s,{if:e}),s)}}function Ve(e){const o=e("dropdownWrapper",()=>({$el:"div",attrs:{id:'$id + "_popover"',popover:{if:"$usePopover",then:"$popover",else:void 0},"data-is-wrapper":!0,style:"$dropdownWrapperStyles",onMousedown:"$handlers.dropdownWrapperMousedown",onScroll:"$handlers.scroll"}})),n=e("listbox",()=>({$el:"ul",if:"$expanded || $setForceExpanded",attrs:{style:"$listboxStyles",id:'$id + "_listbox"',"data-options-appearance":"$optionsAppearance || undefined",role:"listbox","aria-activedescendant":"$activeDescendant","aria-labelledby":'$id + "_label"'}})),r=e("listitem",()=>({$el:"li",bind:"$fns.optionAttrs($option)",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"}})),s=e("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"}})),a=e("loadMoreInner","span"),i=e("emptyMessage",()=>({$el:"li",if:"$showEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}})),p=e("emptyMessageInner","span"),d=e("option",()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option)"}})),c=e("listitemCheckbox",()=>({$el:"input",attrs:{type:"checkbox",checked:"$fns.isSelected($option)",tabindex:"-1","aria-hidden":"true",readonly:!0}})),u=e("listitems",()=>({$el:null,if:"$options.length",for:["option","index","$option.options || $options"]})),v=e("innerListitems",()=>({$el:null,for:["option","innerIndex","$option.options"]})),h=e("listitemGroup",()=>({$el:"li",attrs:{"aria-label":"$option.group",role:"group",onClick:"$handlers.listitemGroupClick",tabindex:"-1"}})),m=e("groupLabel","span"),g=e("groupList",()=>({$el:"ul",attrs:{role:"group"}}));return()=>{return o(n(i(p("$emptyMessage")),u(Me("$option.group",h(m("$option.group"),g(v((e=()=>({id:'$id + "_listitem_" + $index + "_" + $innerIndex'}),$=r(Me('$optionsAppearance === "checkbox"',c()),Me('$optionsAppearance !== "checkbox" && $fns.isSelected($option)',xe("selected")),d("$option.label")),o=>{const n=n=>{const r=$(o)(n),s="function"==typeof e?e(o):e;return t(s)?(f(r)&&l(r.else)?r.else.attrs={...r.else.attrs,...s}:l(r)&&(r.attrs={...r.attrs,...s}),r):r};return n._s=$._s,n})))),r(Me('$optionsAppearance === "checkbox"',c()),Me('$optionsAppearance !== "checkbox" && $fns.isSelected($option)',xe("selected")),d("$option.label")))),s(Me("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",a(Me("$state.loading",xe("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value")))));var e,$}}const Fe=/* #__PURE__ */Te("dd"),{outer:Pe,wrapper:Be,inner:He,icon:Ne,label:Re,prefix:Ke,suffix:We,help:Ue,messages:Ye,message:je}=/* #__PURE__ */Oe(Fe),qe=Fe("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"}})),ze=Fe("selectionWrapper",()=>({if:"$option || $state.loading",$el:"div"})),Ge=Fe("selection",()=>({$el:"div"})),Ze=Fe("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'}}})),Xe=Fe("optionLoading","span"),Je=Fe("option",()=>({$el:"div"})),Qe=Fe("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"}})),et=Fe("selectionsWrapper",()=>({$el:"div",attrs:{id:'$id + "_selections_wrapper"'}})),tt=Fe("selections",()=>({$el:"div",attrs:{"aria-live":"polite","aria-hidden":'$lastVisibleIndex === 0 && "true" || $lastVisibleIndex && "true" || undefined',"data-test":'$lastVisibleIndex === 0 && "0" || $lastVisibleIndex || undefined',id:'$id + "_selections"'}})),ot=Fe("truncationCount",()=>({$el:"div",attrs:{id:'$id + "_truncation_count"'}})),nt=Fe("selectionsItem",()=>({$el:"div",for:["selectionLabel","index","$formattedSelections"],attrs:{id:'$id + "_selections_item_" + $index',"data-check":"$selectionLabel",key:"$selectionLabel","aria-hidden":'$lastVisibleIndex === 0 && $index > $lastVisibleIndex && "true" || $lastVisibleIndex && $index > $lastVisibleIndex && "true" || undefined',style:{visibility:'$lastVisibleIndex === 0 && $index > $lastVisibleIndex && "hidden" || $lastVisibleIndex && $index > $lastVisibleIndex && "hidden" || undefined'}},children:'$selectionLabel || ""'})),rt=Fe("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)"}})),st=Fe("tag",()=>({$el:"div",attrs:{id:'$id + "_tag_" + $index',role:"button",tabindex:"-1"}})),at=Fe("tagLabel",()=>({$el:"span"})),lt=Fe("tagsWrapper",()=>({$el:"span",attrs:{id:'$id + "_tags_wrapper"',"aria-live":"polite"}})),it=Fe("tags",()=>({$el:"span",attrs:{id:'$id + "_selections"'}})),pt=Fe("tagLoading","span"),dt=/* #__PURE__ */Ve(Fe);function ct(t){return e(t)&&"value"in t&&"label"in t}function ut(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 ft(){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 vt(e){return"__original"in e?e.__original:e.value}const ht=new WeakMap,mt={mutationObservers:0,resizeObservers:0,documentListeners:new Map,windowListeners:new Map,timeouts:0,intervals:0};function gt(e,t){ht.has(e)||(ht.set(e,new Set),e.on("destroyed",()=>{const t=ht.get(e);t&&(t.forEach(e=>{try{e()}catch(e){}}),t.clear(),ht.delete(e))}));const o=ht.get(e);return o.add(t),()=>{o.delete(t)}}function $t(e,t){const o=new MutationObserver(t);return mt.mutationObservers++,gt(e,()=>{o.disconnect(),mt.mutationObservers--}),o}function bt(e,t){const o=new ResizeObserver(t);return mt.resizeObservers++,gt(e,()=>{o.disconnect(),mt.resizeObservers--}),o}function yt(e,t,o,n){let r=null;const s=()=>{r&&r()};return gt(e,s),{add:()=>{if(!r){document.addEventListener(t,o,n);const e=mt.documentListeners.get(t)||0;mt.documentListeners.set(t,e+1),r=()=>{document.removeEventListener(t,o,n);const e=mt.documentListeners.get(t)||1;e<=1?mt.documentListeners.delete(t):mt.documentListeners.set(t,e-1),r=null}}},remove:s}}const xt=new WeakMap,wt=new WeakMap,kt=100,_t=new WeakSet;async function St(e,t,o=!1,n=!1){if("function"==typeof e.props.optionsLoader){e.props.search=t,clearTimeout(wt.get(e));const o=t?e.props.debounce:0;0===o?Lt(e,n):(!function(e){_t.has(e)||(_t.add(e),gt(e,()=>{const t=wt.get(e);t&&(clearTimeout(t),wt.delete(e))}))}(e),wt.set(e,setTimeout(()=>{e.props.page=1,Lt(e,n)},o)))}else if(Array.isArray(e.props.options)){const o=function(e,t){const o=e.props.initialOptions;return t?o.reduce((o,n)=>{if("options"in n){const r=n.options.filter(o=>e.props.filter(o,t,e));r.length&&o.push({...n,options:r})}else e.props.filter(n,t,e)&&o.push(n);return o},[]):[...o]}(e,null!=t?t:"");!function(e,t,o){const n=It(t),r="autocomplete"===e.props.type&&n>1e3,s=o?It(e.props.options)+kt:kt,a=r?function(e,t){const o=[];let n=t;for(const t of e){if(n<=0)break;if("options"in t){const e=t.options.slice(0,n);e.length&&(o.push({...t,options:e}),n-=e.length)}else o.push(t),n--}return o}(t,s):t;e.props.appendingOptions=o,e.props.filteringOptions=!0,e.props.options=a,e.props.filteringOptions=!1,function(e,t){e.store.set(p({key:"hasNextPage",type:"state",value:t,visible:!1}))}(e,r&&It(a)<n)}(e,o,n)}}function Lt(e,t){"function"==typeof e.props.optionsLoader?(e.props.allowAppendOptions=t,Vt(e)):St(e,e.props.searchValue,!1,t)}function It(e){return e.reduce((e,t)=>e+("options"in t?t.options.length:1),0)}const At=/* #__PURE__ */p({key:"loading",type:"state",value:!0,visible:!1}),Ct=/* #__PURE__ */p({key:"loading",type:"state",value:!1,visible:!1});function Dt(e,t,o=e.props.allowAppendOptions){if(o)return e.props.allowAppendOptions=!1,function(e,t){const o=Tt(t);if(!o.length)return void Ot(e);e.props.appendingOptions=!0,e.props.activeValue=vt(o[0]),e.props.options=e.props.options.concat(o)}(e,t);const n=Tt(t);e.props.options=n,e.props.options.length||Ot(e),xt.set(e,e.props.searchValue)}function Tt(t){return null==t||e(t)&&0===Object.keys(t).length?[]:m(t)}function Ot(e){e.store.set(Ct),e.store.set(p({key:"hasNextPage",type:"state",value:!1,visible:!1}))}const Et=new WeakMap;function Mt(t,r,s){if(t.store.set(At),t.props.optionLoadingCounter++,t.props.multiple&&"truncate"!==t.props.selectionAppearance){let e;e=o(r)?{label:"Loading...",value:String(r)}:{label:String(r),value:r},t.props.optionLoaderValues.includes(e.value)||t.props.optionLoaderValues.push(e.value),"transferlist"!==t.props.type&&t.props.multiple&&"text-input"!==t.props.selectionAppearance&&!t.props.selections.includes(e)&&(t.props.selections=[...t.props.selections,e])}const a=t.props.optionLoader(r,s),l=t=>"string"==typeof t?{label:t,value:r}:ct(t)?t:e(t)?Object.assign({label:String(r),value:r},t):{label:String(r),value:r},i=e=>{const o=t.props.memoOptions.findIndex(t=>n(vt(t),vt(e)));return-1===o?t.props.memoOptions=[...t.props.memoOptions,e]:t.props.memoOptions[o]=e,e};return a instanceof Promise?a.then(e=>{if("string"==typeof e||ct(e))return i(l(e))}).finally(()=>{t.props.optionLoaderValues=t.props.optionLoaderValues.filter(e=>e!==r),t.props.optionLoadingCounter--}):(t.props.optionLoaderValues=t.props.optionLoaderValues.filter(e=>e!==r),t.props.optionLoadingCounter--,i(l(a)))}function Vt(e){e.store.set(At),e.props.optionsLoadingCounter++,e.store.set(p({key:"hasNextPage",type:"state",value:!1,visible:!1}));const t=e.props.nonceKey&&e.props[e.props.nonceKey],o=e.props.allowAppendOptions;e.props.allowAppendOptions=!1;const n=e.props.optionsLoader(e.context,Et.get(e)),r=t=>Dt(e,t,o),s=n instanceof Promise?n.then((...o)=>{void 0!==e.props.nonceKey&&t!==e.props[e.props.nonceKey]||r(...o)}):(r(n),e.props.optionsLoadingCounter--);if(s instanceof Promise)return s.finally(()=>{e.props.optionsLoadingCounter--})}function Ft(e,t){e.props.page++,Et.set(e,t),e.store.set(p({key:"hasNextPage",type:"state",value:!0,visible:!1}))}const Pt=Symbol(),Bt=e=>{const t=(e=>{const t=[...e.props.allOptions,...e.props.initialOptions];return[...e.props.memoOptions||[],...t]})(e),r=e.props.inputStd||[],s=[];for(const e of r){let r,a=t.find(t=>n(vt(t),e));r=o(e)?void 0:Array.isArray(e)?e.join(", "):e,a||(a={value:e,label:r,isPlaceholder:!1,noOptionFound:!0}),s.push(a)}return s};function Ht(e,t){if(e.props.optionRemoved=!0,t){const o=(e.props.inputStd||[]).filter(e=>!n(vt(t),e));e.input(o)}else e.input(void 0);e.props.openOnRemove&&!e.props.expanded&&e.isCreated&&(e.props.expanded=!0),setTimeout(()=>{var t;return e.emit("selectRange",[null===(t=e.props.highlightedRange)||void 0===t?void 0:t.option])},20)}async function Nt(e){const t=Bt(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,n,r;if(e.props.firstCommit)e.props.firstCommit=!1;else if(ee&&e.isCreated){if(e.props.optionRemoved)return e.props.optionRemoved=!1,void(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.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===(r=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}`))||void 0===r||r.focus()),e.props.userAction=void 0)}}(e)}function Rt(e){var t,o;if(e.props.allOptions&&e.props.allOptions.length)if(null===(t=e.props.highlightedRange)||void 0===t?void 0:t.option.value)e.props.activeValue=vt(e.props.highlightedRange.option);else{if(e.props.activeSelectionValue){const t=e.props.allOptions.find(t=>n(vt(t),e.props.activeSelectionValue));if(t)return void(e.props.activeValue=t.value)}if(e.props.reloadOnCommit)e.props.activeValue=vt(e.props.allOptions[0]);else{if(e.props.searchValue&&!e.props.appendingOptions)e.props.activeValue=vt(e.props.allOptions[0]);else if(e.props.inputStd.length>0&&!e.props.multiple||e.props.multiple&&(null===(o=e.context)||void 0===o?void 0:o.state.dirty))e.props.selections[e.props.selections.length-1]?e.props.activeValue=vt(e.props.selections[e.props.selections.length-1]):e.props.activeValue=vt(e.props.allOptions[0]);else{if(e.props.appendingOptions)return void(e.props.appendingOptions=!1);e.props.activeValue=vt(function(e){return e.props.allOptions.find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})}(e))}e.props.appendingOptions&&(e.props.appendingOptions=!1)}}}function Kt(e){return e.reduce((e,t)=>("options"in t&&Array.isArray(t.options)?e.push(...Kt(t.options)):e.push(t),e),[])}function Wt(e,t){var o,n;(null===(o=t.attrs)||void 0===o?void 0:o.disabled)||(vt(t)!==Pt?(e.props.option=t,e.props.maxReached&&!jt(e,t)||(e.input(Ut(e,vt(t))),jt(e,t)&&e.props.closeOnSelect&&(e.props.expanded=!1))):null===(n=e.context)||void 0===n||n.handlers.loadMore(!0))}function Ut(e,t){if(e.props.multiple){const o=Array.isArray(e.value)?e.value:[];for(const r of o)if(n(r,t))return e.props.optionRemoved=!0,o.filter(e=>!n(e,t));return[...o,t]}return n(t,e.value)&&e.props.deselect?void(e.props.optionRemoved=!0):t}function Yt(e,t){return n(e.props.activeValue,vt(t))||void 0}function jt(e,t){if(e.props.multiple){if(!Array.isArray(e.value))return!1;for(const o of e.value)if(n(o,vt(t)))return!0;return!1}return n(e.value,vt(t))}function qt(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 zt(e){e.props.firstCommit=!0;let t=null;e.on("commit",()=>{if(0===e.props.inputStd.length&&e.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}(e),void(t=e.props.inputStd);if(e.props.inputStd.length&&"function"==typeof e.props.optionsLoader&&0===e.props.options.length&&"function"!=typeof e.props.optionLoader&&0===e.props.optionsLoadingCounter){e.props.optionsLoaded=!0;const t=Vt(e);t instanceof Promise&&t.then(()=>{Nt(e)})}"function"!=typeof e.props.optionLoader||e.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}(t,e.props.inputStd)?0===e.props.optionsLoadingCounter&&Nt(e):(t=e.props.inputStd,async function(e){const t=Bt(e),o=e.props.inputStd.length>1?e.props.inputStd.filter(t=>!e.props.memoOptions.find(e=>n(vt(e),t))):e.props.inputStd;if(o.forEach(o=>{Mt(e,o,Array.isArray(t)&&t.find(e=>n(vt(e),o)&&!e.noOptionFound))}),e.props.optionLoadingCounter){const t=e.on("prop:optionLoadingCounter",()=>{Nt(e),e.props.optionLoadingCounter||e.off(t)})}else Nt(e)}(e))})}const Gt=new WeakSet;function Zt(e){if(!ee)return;e.props.positionListBox=function(e,t){var o,r;let s=null;if(e.props.activeDescendant){s=e.props.options.filter(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)}).findIndex(t=>n(e.value,vt(t))),-1===s&&(s=null);(null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant))&&Xt(e)}if("undefined"==typeof window)return s;const a=t.getBoundingClientRect(),l=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}`);if(l){const t=l.getBoundingClientRect();t.top+t.height+a.height>window.innerHeight&&t.top+t.height>a.height?(e.props.invertPopover=!0,e.props.usePopover||(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,top:"auto",bottom:"100%"})):e.props.usePopover||(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,bottom:"auto",top:"100%"})}return s}.bind(null,e),e.props.styleWrapper=Jt.bind(null),e.on("mounted",()=>{s(`${e.props.id}_popover`,r.bind(null,e),e.props.__root)});const t=yt(e,"mousemove",t=>{var o;e.props.mouseX=t.clientX,e.props.mouseY=t.clientY;const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_popover`);if(n){const o=n.getBoundingClientRect();t.clientX>o.x&&t.clientX<o.x+o.width&&t.clientY>o.y&&t.clientY<o.y+o.height&&(e.props.trackHover=!0)}}),o=()=>{e.props.ignoreScroll?e.props.ignoreScroll=!1:e.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=bt(e,()=>{e.props.styleWrapper(),e.props.positionListBox(t)}),n=$t(e,n=>{const r=n[0].target;if("overscroll"!==e.props.behavior||r.id===`${e.props.id}_popover`){const n=e.props.positionListBox(t);Gt.delete(e),a(e,n),o.observe(t)}});n.observe(t,{childList:!0,subtree:!0})}function a(e,t){var o;if(!e.props.expanded||!e.props.options||!e.props.options.length||Gt.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]),Gt.add(e),n.length&&l(e,n,t)}function l(e,t,o){var n,r,s,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=vt(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||Xt(e),e.props.expanded?(p&&e.props.loadOnScroll&&!(null===(r=e.store.loading)||void 0===r?void 0:r.value)&&(null===(s=e.store.hasNextPage)||void 0===s?void 0:s.value)&&p.scrollTop+p.offsetHeight>p.scrollHeight-200&&(null===(i=e.context)||void 0===i||i.handlers.loadMore(!0)),Gt.has(e)?requestAnimationFrame(l.bind(null,e,t,o)):a(e,o)):Gt.delete(e)}e.on("prop:trackHover",({payload:t})=>{var n,r,s;ee&&(t?null===(s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_popover`))||void 0===s||s.removeEventListener("scroll",o):null===(n=e.props.__root)||void 0===n||n.getElementById(`${e.props.id}_popover`))}),e.on("prop:expanded",({payload:o})=>{e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,zIndex:o||e.props.forceExpanded?"999":"-1",pointerEvents:o?"auto":"none"},o?(t.add(),e.props.styleWrapper(),Rt(e)):t.remove()}),e.on("prop:trackHover",({payload:t})=>{var n,r;ee&&(t?null===(r=document.getElementById(`${e.props.id}_popover`))||void 0===r||r.removeEventListener("scroll",o):null===(n=document.getElementById(`${e.props.id}_popover`))||void 0===n||n.addEventListener("scroll",o))}),e.on("prop:activeValue",({payload:t})=>{if(t===Pt)return void(e.props.activeDescendant=`${e.props.id}_load_more`);let o,r=-1;for(let s=0;s<e.props.options.length;s++){if("group"in e.props.options[s])for(let a=0;a<e.props.options[s].options.length;a++)if(n(vt(e.props.options[s].options[a]),t)){r=a,o=s;break}if(n(vt(e.props.options[s]),t)){r=s;break}}e.props.activeDescendant=r<0?void 0:void 0===o?`${e.props.id}_listitem_${r}`:`${e.props.id}_listitem_${o}_${r}`})}function Xt(e){var t,o;if(!ee)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 Jt(){}const Qt=new WeakMap;function eo(e){e.on("created",()=>{if(!e.context||!ee)return;e.context.fns.isActive=Yt.bind(null,e),e.context.fns.isSelected=t=>jt(e,t),e.context.fns.hasOptionLoaderValue=t=>{for(const o of e.props.optionLoaderValues)if(n(vt(t),o))return!0;return!1},e.context.fns.optionAttrs=e=>e.attrs||{},e.context.handlers.listitemGroupClick=uo,e.context.handlers.dropdownWrapperMousedown=to.bind(null,e),e.context.handlers.selectOption=t=>o=>fo.call(null,e,t,o),e.context.handlers.loadMore=Lt.bind(null,e),e.context.handlers.removeSelection=t=>o=>co(e,t,o),e.context.handlers.tagTouchstart=t=>o=>co(e,t,o),e.context.handlers.selectionClick=t=>e.props.multiple?so.bind(null,e,t):ro.bind(null,e),e.context.handlers.selectionBlur=()=>ao.bind(null,e),e.context.fns.isActiveSelection=(e,t)=>n(e,vt(t)),e.context.handlers.tagClick=t=>lo.bind(null,e,t),e.context.handlers.tagFocus=t=>io.bind(null,e,t),e.context.handlers.tagBlur=()=>po.bind(null,e);const t=e.context.handlers.blur;e.context.handlers.blur=function(e,o){var n;if(e.props.ignoreDropdownBlur)return void(e.props.ignoreDropdownBlur=!1);if(o&&o.relatedTarget instanceof HTMLElement){const t=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(e.props.id+"_inner");if(t instanceof HTMLElement&&t.contains(o.relatedTarget))return}t(),function(e){if(e.props.disabled)return;e.props.expanded=!1,e.props.activeSelectionValue=void 0,e.emit("blur")}(e)}.bind(null,e),e.context.handlers.touchmove=oo.bind(null,e),e.context.handlers.touchend=no.bind(null,e)})}function to(e,t){e.props.disabled||t.currentTarget instanceof HTMLElement&&(e.props.ignoreDropdownBlur=!0,setTimeout(()=>{e.props.ignoreDropdownBlur=!1},0))}function oo(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=Qt.get(e);if(o){const[e,r]=o,s=t.touches[0].clientX-r;n.scrollLeft=e-s}else Qt.set(e,[n.scrollLeft,t.changedTouches[0].clientX])}}function no(e){Qt.delete(e)}function ro(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 so(e,t,o){o.currentTarget instanceof HTMLElement&&(n(e.props.activeSelectionValue,vt(t))?e.props.activeSelectionValue=void 0:(e.props.activeSelectionValue=vt(t),o.currentTarget.focus()))}function ao(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 lo(e,t,o){o.stopPropagation(),e.props.disabled||(e.props.justFocused?e.props.justFocused=!1:o.currentTarget instanceof HTMLElement&&(n(e.props.activeSelectionValue,vt(t))?e.props.activeSelectionValue=void 0:(e.props.activeSelectionValue=vt(t),o.currentTarget.focus())))}function io(e,t,o){o.stopPropagation(),e.props.disabled||o.currentTarget instanceof HTMLElement&&(e.props.activeSelectionValue=vt(t),e.props.justFocused=!0)}function po(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 co(e,t,o){o&&o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleRemoveSelection"},Ht(e,t))}function uo(e){e.stopPropagation()}function fo(e,t,o){o.stopPropagation(),e.props.disabled||(e.props.userAction={type:"handleListitemClick"},Wt(e,t))}function vo(e){let t=!1;const o=yt(e,"click",()=>{e.props.activeSelectionValue=void 0,e.props.expanded=!1});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(Ct))}),e.on("prop:optionLoadingCounter",({payload:t})=>{0===t&&0===e.props.optionsLoadingCounter&&e.store.set(Ct)}),e.on("prop:disabled",({payload:t})=>{t&&(e.props.expanded=!1)}),e.on("prop:options",({payload:t})=>{e.props.allOptions=Kt(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),Rt(e)}),e.on("prop:expanded",({payload:n})=>{var r,s;if(ee)if(e.props.alwaysLoadOnOpen&&(e.props.page=1),n){if(t=!0,e.props.trackHover=!1,e.props.options&&!e.props.options.length&&"function"!=typeof e.props.optionsLoader&&e.props.emptyMessage&&(e.props.showEmptyMessage=!0),setTimeout(()=>o.add(),10),"text-input"===e.props.selectionAppearance&&e.props.multiple)return;const n=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}`);n instanceof HTMLInputElement&&(n.focus(),e.props.searchExpand||(n.value="",n.value=e.props.inputText))}else o.remove(),e.props.trackHover=!1,e.props.showEmptyMessage=!1,t&&!(null===(s=e.store.blurred)||void 0===s?void 0:s.value)&&(!function(e){let t=e;for(;t;)t.store.set(p({key:"blurred",visible:!1,value:!0})),t=t.parent}(e),e.emit("blur")),t=!1})}function ho(e,t,o,n){!function(e){e.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===e.props.deselect?e.props.deselect=!0:e.props.deselect=r(e.props.deselect),e.props.option={},e.props.expanded=!1,e.props.inputStd=[],void 0===e.props.draggable?e.props.draggable=!0:"false"===e.props.draggable&&(e.props.draggable=!1),e.props.options||(d(350,{node:e,inputType:e.props.type}),e.props.options=[]),"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.props.allOptions=Kt(e.props.options),e.props.selections=[],e.props.memoOptions=[],e.props.invertPopover=!1,e.props.dropdownWrapperStyles={position:"absolute",top:"100%",overflow:"auto",minWidth:"100%"},e.props.decrementCount=0,e.props.page=1,e.props.loadMoreOption={label:"Load more",value:Pt},e.props.loadOptions=Vt,e.props.listboxStyles={},e.props.optionsLoadingCounter=0,e.props.optionLoadingCounter=0,e.props.searchable=r(e.props.searchable),e.props.loadOnScroll=r(e.props.loadOnScroll),e.props.multiple=r(e.props.multiple)||!1,"taglist"===e.props.type&&(e.props.multiple=!0),e.props.openOnFocus=r(e.props.openOnFocus),e.props.openOnRemove=void 0!==e.props.openOnRemove&&r(e.props.openOnRemove),e.props.hasNextPage=Ft.bind(null,e),e.props.initialOptions=[...e.props.options],e.props.optionLoaderValues=[],e.props.loadOnCreated=r(e.props.loadOnCreated),e.props.max&&"number"!=typeof e.props.max?e.props.max=parseInt(e.props.max):e.props.max&&!e.props.multiple&&(e.props.max=void 0),e.props.multiple||(e.props.optionsAppearance=void 0),e.on("mounted",()=>qt(e)),e.on("prop:popoverCoordinates",()=>setTimeout(()=>{qt(e)},10)),e.on("prop:invertPopover",()=>setTimeout(()=>{qt(e)},10))}(n),n.props.multiple?function(e){e.hook.input((t,o)=>(e.props.highlightedRange&&!e.props.optionRemoved&&(t.splice(e.props.highlightedRange.index,1,vt(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])))}(n):function(e){e.hook.input((t,o)=>(e.props.inputStd=void 0===t||""===t||null===t?[]:[t],o(t)))}(n),e(n),zt(n),function(e){e.on("created",()=>{e.context&&(e.props.trackHover=!0,void 0!==e.props.disabled||e.props.optionsLoader||!e.props.options||e.props.options.length||void 0!==e.props.emptyMessage||e.props.allowNewValues||0!==e.props.inputStd.length||(e.props.disabledInternally=!0),Zt(e),e.props.loadOnCreated&&!e.props.optionsLoaded&&e.props.optionsLoader?Vt(e):e.props.optionsLoaded&&(e.props.optionsLoaded=!1),e.props.forceExpanded=r(e.props.forceExpanded),e.props.forceExpanded&&(e.props.dropdownWrapperStyles={...e.props.dropdownWrapperStyles,zIndex:"999",pointerEvents:"auto"},setTimeout(()=>{e.props.setForceExpanded=!0},100)))})}(n),eo(n),t(n),vo(n),o(n)}function mo(e){void 0===e.props.closeOnSelect?e.props.closeOnSelect=!e.props.multiple:e.props.closeOnSelect=r(e.props.closeOnSelect),(e.props.multiple&&void 0===e.props.selectionAppearance||"truncate"===e.props.selectionAppearance)&&(e.props.selectionAppearance="truncate",e.props.formattedSelections=[]),e.props.multiple?e.props.selectionRemovable=!1:e.props.selectionRemovable=r(e.props.selectionRemovable)}function go(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 $o(e,t,o){var r,s,a;if(o.preventDefault(),e.props.trackHover=!1,e.props.expanded){const o=e.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(vt(t)),e},[]);(null===(r=e.store.hasNextPage)||void 0===r?void 0:r.value)&&o.push(Pt);let l=-1;e.props.activeValue&&(l=o.findIndex(t=>n(t,e.props.activeValue))),-1===l&&o.length?e.props.activeValue=o[0]:"ArrowDown"===t&&o.length>l+1?e.props.activeValue=o[l+1]:"ArrowUp"===t&&l>0?e.props.activeValue=o[l-1]:"ArrowUp"===t&&0===l&&(null===(a=null===(s=e.props.__root)||void 0===s?void 0:s.getElementById(`${e.props.id}_tag-wrapper_${e.props.selections.length-1}`))||void 0===a||a.focus(),e.props.expanded=!1)}else e.props.expanded||"ArrowDown"!==t||(e.props.expanded=!0)}function bo(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=vt(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=vt(e.props.selections[0]):e.props.activeSelectionValue=void 0),e.props.expanded=!1}}function yo(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 xo(e,t,o,r=!0){var s,a,l,i,p,d,c;const u=o.key;if(o.altKey){const r=ft(),s=e.props.selections.findIndex(e=>n(vt(e),vt(t))),a=[...e.props.selections];"ArrowRight"===o.key?s<e.props.selections.length-1&&(a.splice(s,1),a.splice(s+1,0,t)):"ArrowLeft"===o.key&&s>0&&(a.splice(s,1),a.splice(s-1,0,t)),e.props.activeSelectionValue=vt(t),e.input([...a.map(vt)]),setTimeout(()=>{r instanceof HTMLElement&&r.focus()},100)}else{const o=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===o)return;const f="ArrowRight"===u?o+1:o-1;if(f>=e.props.selections.length){if(!r)return e.props.expanded=!0,e.props.activeSelectionValue=void 0,void(null===(a=null===(s=e.props.__root)||void 0===s?void 0:s.getElementById(`${e.props.id}`))||void 0===a||a.focus());null===(i=null===(l=e.props.__root)||void 0===l?void 0:l.getElementById(`${e.props.id}`))||void 0===i||i.focus()}else if(f<0&&0===o)null===(d=null===(p=e.props.__root)||void 0===p?void 0:p.getElementById(`${e.props.id}`))||void 0===d||d.focus();else if(f<0)return;const v=null===(c=e.props.__root)||void 0===c?void 0:c.getElementById(`${e.props.id}_tag-wrapper_${f}`);v&&v.focus(),e.props.selections[f]?e.props.activeSelectionValue=vt(e.props.selections[f]):e.props.activeSelectionValue=void 0}}function wo(e,t,o){var r;if(!(o.currentTarget instanceof HTMLElement))return;if(e.props.searchValue)return;const s=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===s)return;const a=e.props.selections[s+1]?s+1:s-1,l=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_tag-wrapper_${a}`);l&&l.focus(),e.props.userAction={type:"tagDelete"},Ht(e,t)}function ko(e,t){var o;if(t.isComposing||229===t.keyCode)return;t.preventDefault();const r=e.props.allOptions.find(t=>n(vt(t),e.props.activeValue));if(!e.props.allowNewValues||!e.props.searchValue||r&&function(e,t){const o=e.toLowerCase();if("string"==typeof t.label&&t.label.toLowerCase()===o)return!0;const n=vt(t);return"string"==typeof n&&n.toLowerCase()===o}(e.props.searchValue,r))if(e.props.expanded){if(e.props.activeValue===Pt)return void(null===(o=e.context)||void 0===o||o.handlers.loadMore(!0));if(!r)return;Wt(e,r)}else e.props.expanded=!0;else e.input(Ut(e,e.props.searchValue))}function _o(e){e.props.expanded&&(e.props.expanded=!1)}function So(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":yo(e);break;case"ArrowRight":case"ArrowLeft":xo(e,t,o,!1);break;case"Delete":case"Backspace":wo(e,t,o)}}function Lo(e,t,o){if(e.props.disabled)return;switch(o.key){case"ArrowUp":case"ArrowDown":!function(e,t,o){var r,s,a,l;o.preventDefault();const i=o.key,p=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===p)return;const d="ArrowDown"===i?p+1:p-1;if(d<0&&(null===(s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}`))||void 0===s||s.focus()),d<0||d>=e.props.selections.length)return;const c=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(`${e.props.id}_selection_wrapper_${d}`);c&&c.focus(),e.props.activeSelectionValue=(null===(l=e.props.selections[d])||void 0===l?void 0:l.value)||void 0}(e,t,o);break;case"Enter":break;case"Tab":!function(e,t,o){var r,s,a,l;if(t){const i=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===i)return;const p=o.shiftKey?i-1:i+1;if(p>=e.props.selections.length)return;if(p<0)return void(null===(s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}`))||void 0===s||s.focus());const d=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(`${e.props.id}_selection_wrapper_${p}`);d&&d.focus(),e.props.activeSelectionValue=(null===(l=e.props.selections[p])||void 0===l?void 0:l.value)||void 0}}(e,t,o);break;case"Delete":case"Backspace":!function(e,t){var o;if(t){const r=e.props.selections.findIndex(e=>n(vt(e),vt(t)));if(-1===r)return;const s=e.props.selections[r+1]?r+1:r-1,a=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_selection_wrapper_${s}`);a&&a.focus(),e.props.selections[s]?e.props.activeSelectionValue=vt(e.props.selections[s]):e.props.activeSelectionValue=void 0}t&&1!==e.props.selections.length||(e.props.userAction={type:"selectionDelete"}),Ht(e,t)}(e,t)}}function Io(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":$o(e,o,t);break;case"ArrowLeft":case"ArrowRight":bo(e,o);break;case"Enter":ko(e,t);break;case"Escape":_o(e);break;case"Delete":case"Backspace":go(e);break;default:e.emit("unusedKeydown",t)}}function Ao(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":$o(e,o,t);break;case"ArrowRight":case"ArrowLeft":bo(e,o);break;case"Enter":ko(e,t);break;case"Escape":_o(e);break;case"Delete":case"Backspace":go(e)}}function Co(e){e.props.alwaysLoadOnOpen=void 0!==e.props.alwaysLoadOnOpen&&r(e.props.alwaysLoadOnOpen),e.on("created",()=>{e.context&&(e.context.handlers.click=Do.bind(null,e),e.context.handlers.focus=To.bind(null,e),e.context.handlers.keydown=Io.bind(null,e),e.context.handlers.selectorTagKeydownHandler=t=>So.bind(null,e,t))})}function Do(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 To(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 Oo(e){let t,o="";e.on("unusedKeydown",({payload:r})=>{if(!r.isComposing&&1===[...r.key].length){if(!o&&" "===r.key)return void function(e,t){var o;if(t.preventDefault(),e.props.expanded){if(e.props.activeValue===Pt)return void(null===(o=e.context)||void 0===o||o.handlers.loadMore());const t=e.props.allOptions.find(t=>n(vt(t),e.props.activeValue));if(!t)return;Wt(e,t)}else e.props.expanded=!0}(e,r);e.props.expanded=!0,clearTimeout(t),o+=r.key;const s=e.props.allOptions.find(e=>e.label.toLowerCase().startsWith(o.toLowerCase()));s&&(e.props.activeValue=vt(s)),t=setTimeout(()=>{o=""},400)}})}function Eo(e){Mo(e),e.on("prop:selections",()=>{e.props.skipFormatSelections=!1,Vo(e),Mo(e),Bo(e)}),ee&&s(`${e.props.id}_selections`,Po.bind(null,e),e.props.__root)}function Mo(e){if(!e.isCreated)return;const t=function(e){return"number"==typeof e.props.lastVisibleIndex?e.props.lastVisibleIndex:void 0}(e),o=e.props.selections.length&&void 0!==t&&e.props.selections.length-t>1?"+ "+(e.props.selections.length-t-1).toString():void 0;e.props.truncationCount!==o&&(e.props.truncationCount=o);const n=e.props.selections.map((o,n)=>void 0!==t&&n===t?e.props.lastTruncatedElText?e.props.lastTruncatedElText:0===n?n===e.props.selections.length-1?o.label:o.label+", ":n===e.props.selections.length-1?o.label:o.label+"...":n===e.props.selections.length-1?o.label:o.label+", ");var r,s;r=e.props.formattedSelections,s=n,Array.isArray(r)&&r.length===s.length&&r.every((e,t)=>e===s[t])||(e.props.formattedSelections=n)}function Vo(e){e.props.lastTruncatedElText=null,e.props.lastVisibleIndex=null,e.props.truncationCount=void 0}function Fo(e){var t,o;if(!e.context)return;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_selections`);if(!Ho(n))return;const r=n.parentNode;if(!Ho(r))return;let s=n.getBoundingClientRect().width;const a=r.getBoundingClientRect().width;if(0===s||0===a)return Vo(e),void Mo(e);const l=.98*a,i=Array.prototype.slice.call(n.children),p=[...e.props.selections];if(s>l){const t=[];let n=0;for(let e=0;e<p.length;e++)t.push([p[e],i[e]]);for(let r=t.length-1;r>=0;r--){const a=t[r];if(!Ho(a[1]))return;n+=a[1].getBoundingClientRect().width+parseFloat(window.getComputedStyle(a[1]).marginRight)+parseFloat(window.getComputedStyle(a[1]).marginLeft);const i=s-n;if(l>i){const t=a[0].label;e.props.skipFormatSelections=!0,a[1].textContent=t;let n=!1;for(let s=t.length;s>=0;s--){if(e.props.skipFormatSelections=!0,a[1].textContent=t.slice(0,s).trim()+"...",i+a[1].getBoundingClientRect().width<l){if(s<4){e.props.lastVisibleIndex=r-1,e.props.lastTruncatedElText=null;break}if(e.props.lastVisibleIndex=r,e.props.lastTruncatedElText&&a[1].textContent.slice(0,4)===e.props.lastTruncatedElText.slice(0,4))break;e.props.lastTruncatedElText=null===(o=a[1])||void 0===o?void 0:o.textContent;break}0===s&&(n=!0)}a[1].textContent=e.props.lastTruncatedElText&&!n?e.props.lastTruncatedElText:t,null===e.props.lastVisibleIndex&&(e.props.lastVisibleIndex=0===r?0:r-1,e.props.lastTruncatedElText=null),setTimeout(()=>{Mo(e)});break}}}else Vo(e),Mo(e)}function Po(e,t){const o=new ResizeObserver(()=>{e.props.selections&&0!==e.props.selections.length&&(e.props.skipFormatSelections?e.props.skipFormatSelections=!1:Fo(e))}),n=new ResizeObserver(()=>{Fo(e)});o.observe(t),t.parentNode instanceof Element&&(n.observe(t.parentNode),Bo(e))}function Bo(e){ee&&("function"==typeof requestAnimationFrame?requestAnimationFrame(()=>{requestAnimationFrame(()=>Fo(e))}):setTimeout(()=>Fo(e)))}function Ho(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}const No={position:"fixed",top:0,bottom:0,right:0,left:0,pointerEvents:"none",zIndex:-1,overflowY:"auto","-webkit-overflow-scrolling":"auto"},Ro={position:"fixed",overflow:"hidden",height:"100%",width:"100%"},Ko={overflow:"hidden",height:"100%"},Wo={},Uo={};let Yo=0;function jo(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 qo(e,t){var o,r;let s=null;if(e.props.activeDescendant){const a=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant);if(!a)return s;e.props.ignoreScroll=!0;const l=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_listbox`);if(!l)return s;const i=t.getBoundingClientRect(),p=l.getBoundingClientRect(),d=parseInt(getComputedStyle(t).paddingTop),c=parseInt(getComputedStyle(t).paddingBottom),u=a.offsetTop-d,f=Math.max(u-d,0),v=Math.max(t.scrollHeight-c-u-i.height,0),h=p.height-f-v;t.scrollTop=u;const m=()=>{t.scrollTop=v>0?v<d?t.scrollHeight:d:f<c?0:u-c},g=Math.min(150,p.height);f>0&&v>0||0===f&&0===v||h>g?t.scrollTop=u:m();t.clientHeight/2<t.scrollTop&&(s=e.props.options.filter(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)}).findIndex(t=>n(e.value,vt(t)))),-1===s&&(s=null)}return s}function zo(e){e.addProps(["behavior"]),e.on("created",()=>{"overscroll"===e.props.behavior&&("function"==typeof e.props.optionsLoader&&c(300,[e]),e.props.dropdownWrapperStyles=a(No),e.props.listboxStyles={display:"inline-block"},e.props.styleWrapper=jo.bind(null,e),e.props.positionListBox=qo.bind(null,e))}),e.on("prop:expanded",({payload:t})=>{"overscroll"===e.props.behavior&&(t?function(){Yo=document.documentElement.scrollTop;for(const e in Ro)Uo[e]=document.documentElement.style[e],document.documentElement.style[e]=Ro[e];for(const e in Ko)Wo[e]=document.body.style[e],document.body.style[e]=Ko[e];document.body.scrollTop=Yo}():function(){for(const e in Ro)document.documentElement.style[e]=Uo[e];for(const e in Ko)document.body.style[e]=Wo[e];document.body.scrollTop=0,document.documentElement.scrollTop=Yo}())})}function Go(e){e.addProps(["multiLine"]),e.on("created",()=>{ee&&(e.props.multiLineHeight=void 0,s(`${e.props.id}_selections`,Zo.bind(null,e),e.props.__root))})}function Zo(e){var t;const o=bt(e,t=>{for(const o of t){const{height:t}=o.contentRect;e.props.selectionsHeight!==t&&(e.props.selectionsHeight=t),Xo(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 Xo(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 Jo(e){if(e.on("created",()=>{e.context&&Oo(e)}),e.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]})}(e),"truncate"===e.props.selectionAppearance&&(e.props.lastVisibleIndex=null,Eo(e)),"tags"===e.props.selectionAppearance&&Go(e),e.props.multiple&&"tags"===e.props.selectionAppearance){function t(){return Array.isArray(e.value)?e.value:[]}function o(t,o){e.input(t)}e.on("created",()=>{e.props.disabled&&(e.props.draggable=!1),s(`${e.props.id}_selections`,n=>{if(e.context&&n instanceof HTMLElement){const r={threshold:{horizontal:.25,vertical:0},plugins:[x()],draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,disabled:!e.props.draggable,root:e.props.__root,synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-tag")};w({parent:n,getValues:t,setValues:o,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:n,getValues:t,setValues:o,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:n,getValues:t,setValues:o,config:r})})}},e.props.__root)})}e.on("prop:expanded",({payload:t})=>{t&&e.props.optionsLoader&&"function"==typeof e.props.optionsLoader&&(!e.props.options.length||e.props.alwaysLoadOnOpen)&&(e.props.options=[],Vt(e))}),"overscroll"===e.props.behavior&&zo(e)}const Qo=(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 en(e){if(e.addProps(["popover","popoverOffset","usePopover","invertPopover","popoverCoordinates","popoverAncestorCoordinates"]),e.props.popover=r(e.props.popover)?"manual":void 0,"input"!==e.type||"overscroll"===e.props.behavior)return;let t=null,o=null,n=[],a=null;if(e.props.popoverOffset=r(e.props.popoverOffset)?parseInt(e.props.popoverOffset):0,!e.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 l=()=>{e.props.invertPopover=!1,document.removeEventListener("resize",a),document.removeEventListener("scroll",a),n.forEach(e=>{e.removeEventListener("scroll",a)})};function i(){var n,r;const s=null!==(r=null===(n=e.props.popoverCoordinates)||void 0===n?void 0:n.height)&&void 0!==r?r:0,{x:a,y:l,width:i,height:p}=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}}(t,o);e.props.popoverAncestorCoordinates={x:a,y:l,width:i,height:p},e.props.popoverCoordinates={x:a,y:l,width:i,height:s},d(s)}function p(t){e.props.popoverCoordinates={...e.props.popoverCoordinates,height:t},d(t)}function d(t){if(!o||!t)return void(e.props.invertPopover=!1);const n=o.getBoundingClientRect(),r=Number.isFinite(e.props.popoverOffset)?e.props.popoverOffset:0,s=n.bottom+r+t>window.innerHeight,a=n.top-r-t>=0;e.props.invertPopover=s&&a}function c(e){t&&document.body.contains(t)&&(e?(null==t||t.showPopover(),setTimeout(()=>{p((null==t?void 0:t.offsetHeight)||0)},5)):t.matches(":popover-open")&&(t.hidePopover(),p(0)))}e.on("mounted",()=>{e.context&&(e.props.usePopover=!0,e.props.invertPopover=!1,e.props.popoverCoordinates={x:0,y:0,width:0,height:0},e.props.popoverAncestorCoordinates={x:0,y:0,width:0,height:0})}),e.on("destroyed",()=>{l()}),e.on("prop:inputText",()=>{e.context&&(i(),c(!0))}),e.on("prop:expanded",({payload:r})=>{var p;e.context&&(!1===r?l():s(`${null===(p=e.context)||void 0===p?void 0:p.id}_popover`,()=>{if(!e.context)return;t=document.querySelector(`[id="${e.context.id}_popover"][popover]`)||document.querySelector(`[id="${e.context.id}_popover"] [popover]`),o||(o=function(e){if(!e)return null;let t=e.parentElement;for(;t&&"static"===window.getComputedStyle(t).position;)t=t.parentElement;return t}(t)),i(),c(r),a=Qo(()=>{e.context&&(i(),c(r))},10),document.addEventListener("resize",a),document.addEventListener("scroll",a),n=[];let s=null==t?void 0:t.parentElement;for(;s;)s.scrollHeight>s.clientHeight&&n.push(s),s=s.parentElement;n.forEach(e=>{e.addEventListener("scroll",a)})}))})}const tn={schema:/* #__PURE__ */Pe(/* #__PURE__ */Be(/* #__PURE__ */Re("$label"),/* #__PURE__ */He(/* #__PURE__ */Ne("prefix"),/* #__PURE__ */Ke(),/* #__PURE__ */qe(/* #__PURE__ */Me("$inputStd.length === 0 && $state.loading !== true",/* #__PURE__ */Ze('$placeholder || "placeholder"'),/* #__PURE__ */Me("$multiple !== true",/* #__PURE__ */ze(/* #__PURE__ */Me("$state.loading && $selections.length === 0",/* #__PURE__ */Xe("$ui.isLoading.value"),/* #__PURE__ */Ge(/* #__PURE__ */Je("$option.label")))),/* #__PURE__ */Me('$multiple && $selectionAppearance === "truncate"',/* #__PURE__ */et(/* #__PURE__ */tt(/* #__PURE__ */Me("$state.loading && $selections.length === 0",/* #__PURE__ */Xe("$ui.isLoading.value"),/* #__PURE__ */nt()))),/* #__PURE__ */Me('$multiple && $selectionAppearance === "tags"',/* #__PURE__ */lt(/* #__PURE__ */it(/* #__PURE__ */Me("$state.loading && $isLoadingOption !== true && $selections.length === 0",/* #__PURE__ */Xe("$ui.isLoading.value"),/* #__PURE__ */rt(/* #__PURE__ */st(/* #__PURE__ */Me("$state.loading && $fns.hasOptionLoaderValue($option) || $option.label === undefined",/* #__PURE__ */pt("$ui.isLoading.value"),/* #__PURE__ */at("$option.label")),/* #__PURE__ */Qe(/* #__PURE__ */Ne("close"))))))))))),/* #__PURE__ */Me("$truncationCount && $state.loading !== true",/* #__PURE__ */ot("$truncationCount")),/* #__PURE__ */Me("$state.loading",/* #__PURE__ */Ne("loader")),/* #__PURE__ */Me("$inputStd.length !== 0 && $selectionRemovable",/* #__PURE__ */Qe(/* #__PURE__ */Ne("close")),/* #__PURE__ */Ne("select"))),/* #__PURE__ */dt(),/* #__PURE__ */We(),/* #__PURE__ */Ne("suffix"))),/* #__PURE__ */Ue("$help"),/* #__PURE__ */Ye(/* #__PURE__ */je("$message.value"))),type:"input",family:"dropdown",props:[],features:[
|
|
2
2
|
/* #__PURE__ */g("select","select"),
|
|
3
3
|
/* #__PURE__ */g("close","close"),
|
|
4
4
|
/* #__PURE__ */g("selected","check"),
|
|
@@ -6,8 +6,8 @@ import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailab
|
|
|
6
6
|
/* #__PURE__ */$("isLoading"),
|
|
7
7
|
/* #__PURE__ */$("loadMore"),
|
|
8
8
|
/* #__PURE__ */$("remove"),b,
|
|
9
|
-
/* #__PURE__ */
|
|
10
|
-
/* #__PURE__ */
|
|
9
|
+
/* #__PURE__ */ho.bind(null,mo,Co,Jo),en]},on=/* #__PURE__ */Te("tg"),{outer:nn,wrapper:rn,label:sn,prefix:an,suffix:ln,help:pn,messages:dn,message:cn,icon:un}=/* #__PURE__ */Oe(on),fn=on("input",()=>({$el:"input",bind:"$attrs",attrs:{type:"checkbox",id:"$id",value:"$value",name:"$node.name",checked:"$checked",onInput:"$handlers.toggles",onBlur:"$handlers.blur",disabled:"$disabled"}})),vn=on("label",()=>({if:"($label && $onValueLabel === undefined && $offValueLabel === undefined) || ($valueLabelDisplay === inner) && $altLabelPosition !== true",$el:"label",attrs:{for:"$id"},children:"$label"})),hn=on("altLabel",()=>({$el:"label",if:"($label && ($onValueLabel || $offValueLabel) && $valueLabelDisplay !== hidden && $valueLabelDisplay !== inner) || $altLabelPosition === true",attrs:{for:"$id","data-label-alt":"true",style:{color:{if:"$checked",then:"$valueLabelColorOn",else:"$valueLabelColorOff"}}},children:"$label"})),mn=on("innerLabel",()=>({$el:"div",if:"$valueLabelDisplay === inner && ($checked && $onValueLabel || $offValueLabel)",attrs:{style:{color:{if:"$checked",then:"$valueLabelColorOn",else:"$valueLabelColorOff"}}},children:{if:"$checked",then:"$onValueLabel",else:"$offValueLabel"}})),gn=on("valueLabel",()=>({$el:"label",if:"$valueLabelDisplay !== hidden && $valueLabelDisplay !== inner && (($checked === true && $onValueLabel) || ($checked === false && $offValueLabel))",attrs:{for:"$id"},children:{if:"$checked && $onValueLabel",then:"$onValueLabel",else:{if:"$offValueLabel",then:"$offValueLabel"}}})),$n=on("inner",()=>({$el:"label",attrs:{for:"$id",id:"$id + '_label'"}})),bn=on("track",()=>({$el:"div",attrs:{style:{backgroundColor:{if:"$checked",then:"$trackColorOn",else:"$trackColorOff"}}}})),yn=on("thumb",()=>({$el:"div",attrs:{style:{color:{if:"$checked",then:"$iconColorOn",else:"$iconColorOff"},backgroundColor:{if:"$checked",then:"$thumbColorOn",else:"$thumbColorOff"}}}})),xn=()=>yn(Me("$slots.default","$slots.default",un("thumb")));const wn={schema:/* #__PURE__ */nn(/* #__PURE__ */rn(/* #__PURE__ */hn(),/* #__PURE__ */$n(/* #__PURE__ */an(),/* #__PURE__ */fn(),/* #__PURE__ */bn(/* #__PURE__ */mn(),/* #__PURE__ */xn()),/* #__PURE__ */ln()),/* #__PURE__ */gn(),/* #__PURE__ */vn()),/* #__PURE__ */pn("$help"),/* #__PURE__ */dn(/* #__PURE__ */cn("$message.value"))),type:"input",props:["checked","thumbColorOff","thumbColorOn","iconColorOff","iconColorOn","valueLabelColorOff","valueLabelColorOn","offValue","offValueLabel","onValue","onValueLabel","thumbIcon","trackColorOff","trackColorOn","valueLabelDisplay","altLabelPosition"],features:[function(e){function t(e,t){t.target instanceof HTMLInputElement&&(e.props.checked=t.target.checked,e.input(t.target.checked?e.props.onValue:e.props.offValue))}e.on("created",()=>{"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.props.altLabelPosition=r(e.props.altLabelPosition),void 0===e.props.offValue&&(e.props.offValue=!1),void 0===e.props.onValue&&(e.props.onValue=!0),e.props.checked=n(e.value,e.props.onValue),e.context&&(e.context.handlers.toggles=t.bind(null,e))}),e.on("commit",({payload:t})=>{e.props.checked=n(t,e.props.onValue)})}]},kn=/* #__PURE__ */Te("rp"),{outer:_n,inner:Sn,prefix:Ln,suffix:In,help:An,messages:Cn,message:Dn,icon:Tn}=
|
|
10
|
+
/* #__PURE__ */Oe(kn),On=kn("empty",()=>({$el:"div"})),En=kn("insertControl",()=>({$el:"button",attrs:{disabled:"$value.length >= $max",onClick:"$fns.createInsert($index)",type:"button"}})),Mn=kn("addButton",()=>({$formkit:"button",bind:"$addAttrs",if:"$addButton",disabled:"$value.length >= $max",onClick:"$fns.createAppend()",type:"button"})),Vn=kn("removeControl",()=>({$el:"button",attrs:{disabled:"$value.length <= $min",onClick:"$fns.createRemover($index)",type:"button"}})),Fn=kn("items",()=>({$el:"ul",meta:{autoAnimate:!0},attrs:{role:"list",id:'$id + "_items"'}})),Pn=kn("item",()=>({$el:"li",for:["item","index","$items"],attrs:{role:"listitem",key:"$item","data-index":"$index"}})),Bn=kn("downControl",()=>({$el:"button",attrs:{disabled:"$index >= $value.length - 1",onClick:"$fns.createShift($index, 1)",type:"button"}})),Hn=kn("upControl",()=>({$el:"button",attrs:{disabled:"$index <= 0",onClick:"$fns.createShift($index, -1)",type:"button"}})),Nn=kn("content","div"),Rn=kn("fieldset",()=>({$el:"fieldset",attrs:{id:"$id"}})),Kn=kn("legend",()=>({$el:"legend",if:"$label"})),Wn=kn("group",()=>({$formkit:"group",index:"$index"})),Un=kn("controls",()=>({$el:"ul",if:"$removeControl || $insertControl || $upControl || $downControl"})),Yn=kn("remove",()=>({$el:"li",if:"$removeControl"})),jn=kn("insert",()=>({$el:"li",if:"$insertControl"})),qn=kn("up",()=>({$el:"li",if:"$upControl"})),zn=kn("down",()=>({$el:"li",if:"$downControl"})),Gn=kn("controlLabel","span"),Zn=kn("dragHandleWrapper",()=>({if:"$draggable",$el:"div"})),Xn=kn("dragHandle",()=>({$el:"div",attrs:{id:'$id + "_drag_handle"'}}));function Jn(e){var t,o,n,s,a,l,i,p,d,c,u,f,v,h;if(null!==(t=(p=e.props).removeControl)&&void 0!==t||(p.removeControl=!0),null!==(o=(d=e.props).upControl)&&void 0!==o||(d.upControl=!0),null!==(n=(c=e.props).downControl)&&void 0!==n||(c.downControl=!0),null!==(s=(u=e.props).insertControl)&&void 0!==s||(u.insertControl=!1),null!==(a=(f=e.props).addButton)&&void 0!==a||(f.addButton=!0),null!==(l=(v=e.props).addLabel)&&void 0!==l||(v.addLabel=!1),null!==(i=(h=e.props).addAttrs)&&void 0!==i||(h.addAttrs={}),e.props.draggable=r(e.props.draggable),e.props.min=void 0!==e.props.min?Number(e.props.min):1,e.props.max=void 0!==e.props.max?Number(e.props.max):1/0,e.props.min>e.props.max)throw Error("Repeater: min must be less than max");if(Array.isArray(e.value))if(e.value.length<e.props.min){const t=ue(e.props.min-e.value.length,()=>({}));e.input(e.value.concat(t),!1)}else e.value.length>e.props.max&&e.input(e.value.slice(0,e.props.max),!1);else e.input(ue(e.props.min,()=>({})),!1);e.context&&function(e,t){t.createShift=(t,o)=>()=>{const n=e._value;n.splice(t+o,0,n.splice(t,1)[0]),e.input(n,!1)},t.createInsert=t=>()=>{const o=e._value;o.splice(t+1,0,{}),e.input(o,!1)},t.createAppend=()=>()=>{const t=e._value;t.push({}),e.input(t,!1)},t.createRemover=t=>()=>{const o=e._value;o.splice(t,1),e.input(o,!1)}}(e,e.context.fns)}function Qn(e,t){var o;if(!t.context)return;const n=null===(o=t.props.__root)||void 0===o?void 0:o.getElementById(`${t.props.id}_inner`),r=null==n?void 0:n.hasAttribute("data-auto-animate"),s={group:t.props.id,dragHandle:`#${t.props.id}_drag_handle`,draggingClass:t.context.classes.dragging,dropZoneClass:t.context.classes.dropZone,root:t.props.__root,disabled:!t.props.draggable,plugins:r?[]:[x({duration:100})],synthDraggingClass:t.context.classes.touchDragging,synthDropZoneClass:t.context.classes.touchDropZone,draggable:e=>"LI"===e.tagName};function a(){return Array.isArray(t.value)?t.value:[]}function l(e){t.input(e)}w({parent:e,getValues:a,setValues:l,config:s}),t.on("prop:disabled",({payload:t})=>{s.disabled=t,w({parent:e,getValues:a,setValues:l,config:s})}),t.on("prop:draggable",({payload:t})=>{s.disabled=!t,w({parent:e,getValues:a,setValues:l,config:s})})}const er={schema:/* #__PURE__ */_n(/* #__PURE__ */Rn(/* #__PURE__ */Kn("$label"),/* #__PURE__ */An("$help"),/* #__PURE__ */Sn(/* #__PURE__ */Ln(),/* #__PURE__ */Me("$value.length === 0",/* #__PURE__ */Me("$slots.empty",/* #__PURE__ */On()),/* #__PURE__ */Fn(/* #__PURE__ */Pn(/* #__PURE__ */Zn(/* #__PURE__ */Xn(/* #__PURE__ */Tn("dragHandle"))),/* #__PURE__ */Nn(/* #__PURE__ */Wn("$slots.default")),/* #__PURE__ */Un(/* #__PURE__ */qn(/* #__PURE__ */Hn(/* #__PURE__ */Gn("$ui.moveUp.value"),/* #__PURE__ */Tn("moveUp"))),/* #__PURE__ */Yn(/* #__PURE__ */Vn(/* #__PURE__ */Gn("$ui.remove.value"),/* #__PURE__ */Tn("remove"))),/* #__PURE__ */jn(/* #__PURE__ */En(/* #__PURE__ */Gn("$ui.add.value"),/* #__PURE__ */Tn("add"))),/* #__PURE__ */zn(/* #__PURE__ */Bn(/* #__PURE__ */Gn("$ui.moveDown.value"),/* #__PURE__ */Tn("moveDown"))))),/* #__PURE__ */In()))),/* #__PURE__ */Mn('$addLabel || ($ui.add.value + " " + ($label || ""))')),/* #__PURE__ */Cn(/* #__PURE__ */Dn("$message.value"))),type:"list",props:["min","max","total","upControl","downControl","removeControl","insertControl","addLabel","addButton","addAttrs","draggable"],features:[function(e){e._c.sync=!0,e.on("created",Jn.bind(null,e)),e.on("mounted",()=>{const t=()=>s(`${e.props.id}_items`,t=>{if(t instanceof HTMLElement){function o(t){for(const o of t)for(const t of Array.from(o.addedNodes))if(t instanceof HTMLElement&&t.id===`${e.props.id}_items`)return void Qn(t,e)}Qn(t,e);$t(e,o).observe(t.parentNode,{childList:!0})}},e.props.__root);"function"!=typeof requestAnimationFrame?setTimeout(t,0):requestAnimationFrame(t)})},y,
|
|
11
11
|
/* #__PURE__ */$("remove"),
|
|
12
12
|
/* #__PURE__ */$("add"),
|
|
13
13
|
/* #__PURE__ */$("moveUp"),
|
|
@@ -16,7 +16,7 @@ import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailab
|
|
|
16
16
|
/* #__PURE__ */g("remove","trash"),
|
|
17
17
|
/* #__PURE__ */g("add","add"),
|
|
18
18
|
/* #__PURE__ */g("moveUp","arrowUp"),
|
|
19
|
-
/* #__PURE__ */g("moveDown","arrowDown")]},jn=new WeakMap;function qn(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 zn(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function Gn(e,t){const{x:o,y:n}=rr(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 Zn(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?sr(e,t,o):e.input(t+1,!1))}function Xn(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,qn(e);const o=jn.get(e);o&&(o.abort(),jn.delete(e))}function Jn(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=>Xn(e,t),{signal:n.signal}),jn.set(e,n),1===e.props.step?e.input(t+1,!1):sr(e,t,o)}function Qn(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=Number(e.value||0),n=t?ar(t+1*e.props.step,e.props.step):e.props.min+1*e.props.step,r=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(t?`#${e.props.id}_inner input[value="${n}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,r&&r instanceof HTMLInputElement&&r.focus(),e.props.preventFocus=!1,e.input(Number(n))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=Number(e.value||0),o=t?ar(t-1*e.props.step,e.props.step):e.props.max,r=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${o}"]`);e.props.preventFocus=!0,r&&r instanceof HTMLInputElement&&r.focus(),e.props.preventFocus=!0,e.input(Number(o)),e.props.preventFocus=!1}}function er(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 tr(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(qn(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):sr(e,t,o,!!e.props.dragStarted)))}function or(e){qn(e)}function nr(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 sr(e,t,o)}function rr(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function sr(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r}=rr(o),s=o.currentTarget.getBoundingClientRect();let a=ar((r-s.x)/s.width+t,e.props.step);a=a>e.props.min?a:e.props.min,a=a<e.props.max?a:e.props.max,!e.props.deselect||a!==Number(e.value)||e.props.dragStarted?n?e.input(a,!1):qn(e,a):e.input(0)}function ar(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const lr=/* #__PURE__ */Te("rt"),{outer:ir,wrapper:pr,inner:dr,label:cr,prefix:ur,suffix:fr,help:vr,messages:hr,message:mr,icon:gr}=/* #__PURE__ */Ee(lr),$r=lr("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"}})),br=lr("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"}})),yr=lr("template",()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null})),xr=lr("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%"'}}})),wr=lr("itemLabelInner",()=>({$el:"span",children:"$fns.getValue($item, $increment)"})),_r=lr("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))"}})),kr=lr("onItemRow",()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}})),Sr=lr("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"}}})),Lr=lr("onItemWrapper",()=>({$el:"div",attrs:{style:{color:"$onColor"}}})),Ir=lr("offItemWrapper",()=>({$el:"div",attrs:{style:{color:"$offColor"}}})),Ar=()=>Me("$slots.onItem",()=>()=>"$slots.onItem",Me("$slots.default",()=>()=>"$slots.default",gr("rating"))),Cr=()=>Me("$slots.offItem",()=>()=>"$slots.offItem",Me("$slots.default",()=>()=>"$slots.default",gr("rating"))),Dr={schema:/* #__PURE__ */ir(/* #__PURE__ */pr(/* #__PURE__ */cr("$label"),/* #__PURE__ */dr(/* #__PURE__ */gr("prefix"),/* #__PURE__ */ur(),/* #__PURE__ */$r(/* #__PURE__ */br(/* #__PURE__ */yr(/* #__PURE__ */xr(/* #__PURE__ */kr(/* #__PURE__ */Lr(/* #__PURE__ */Ar())),/* #__PURE__ */Sr(/* #__PURE__ */Ir(/* #__PURE__ */Cr())),/* #__PURE__ */wr()),/* #__PURE__ */_r()))),/* #__PURE__ */fr(),/* #__PURE__ */gr("suffix"))),/* #__PURE__ */vr("$help"),/* #__PURE__ */hr(/* #__PURE__ */mr("$message.value"))),type:"input",props:[],features:[function(e){function t(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`}})}e.addProps(["max","step","stepsPerValue","itemsToPercentages","rightToLeft","onItemStyles","offItemStyles","hoverHighlight","deselect","disabled","wrapperWidth","onColor","offColor"]),!1!==e.props.hoverHighlight&&"false"!==e.props.hoverHighlight&&(e.props.hoverHighlight=!0),e.props.deselect=r(e.props.deselect),e.props.max=Number(e.props.max)||5,e.props.min=Number(e.props.min)||0,e.props.step=Number(e.props.step)||1,e.props.numberOfSteps=e.props.max/e.props.step,e.props.lastIndex=1/e.props.step-1,e.props.itemsToPercentages={},"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.props.rightToLeft?(e.props.onItemStyles=void 0,e.props.offItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%",zIndex:100}):e.props.onItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%"},e.props.stepsPerValue=1/e.props.step,e.hook.input((t,o)=>{if(null===t||""===t||isNaN(t))return o(t);const n=Number(t),r=Number(e.props.min),s=Number(e.props.max);return n>s?o(s):e.props.min&&n<=r?o(r):o(n)}),e.on("commit",({payload:t})=>{const o=Number(t||0);qn(e,o)}),e.on("created",()=>{e.context&&(s(`${e.props.id}_items_wrapper`,()=>{t(e),function(e){var o;const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_items_wrapper`);if(!n)return;new ResizeObserver(()=>{t(e)}).observe(n)}(e),setTimeout(()=>t(e),100)},e.props.__root),e.context.fns.getPercentage=(e,t,o=!0)=>(o?e.onItems:e.offItems)[t],e.context.fns.getValue=(t,o)=>t+Number((o*e.props.step+e.props.step).toFixed(1)),e.context.fns.showLabel=(t,o)=>{const n=Number(e.value||0);return 0===n&&0===o||n&&t===n||t>n&&0===o||n>t&&o===e.props.lastIndex},e.context.handlers.handleFocus=t=>er.call(null,e,t),e.context.handlers.handleWrapperKeydown=t=>Qn.call(null,e,t),e.context.handlers.handleWrapperBlur=t=>zn.call(null,e,t),e.context.handlers.handleItemClick=t=>o=>nr.call(null,e,t,o),e.context.handlers.handleMousemove=t=>o=>tr.call(null,e,t,o),e.context.handlers.handleMouseleave=()=>or.call(null,e),e.context.handlers.handleDragstart=t=>o=>Jn.call(null,e,t,o),e.context.handlers.handleMouseup=t=>Xn.call(null,e,t),e.context.handlers.handleTouchstart=t=>o=>Zn.call(null,e,t,o),e.context.handlers.handleTouchmove=t=>Gn.call(null,e,t),e.context.handlers.handleKeydown=t=>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)}(e,t,o))})},/* #__PURE__ */g("rating","star")]},Tr=/* #__PURE__ */Te("ac"),{outer:Er,wrapper:Or,inner:Mr,icon:Vr,label:Fr,prefix:Pr,suffix:Br,help:Hr,messages:Rr,message:Nr}=/* #__PURE__ */Ee(Tr),Kr=Tr("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"}})),Wr=Tr("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"}})),Ur=Tr("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)"}})),Yr=Tr("selection",()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}})),jr=Tr("selections",()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}})),qr=Tr("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"}})),zr=Tr("optionLoading","span"),Gr=Tr("option",()=>({$el:"div",if:"$value !== undefined"})),Zr=/* #__PURE__ */Ve(Tr);function Xr(e){"option"!==e.props.selectionAppearance||e.props.multiple||!1===e.props.selectionRemovable||"false"===e.props.selectionRemovable||(e.props.selectionRemovable=!0),e.props.multiple||(e.props.clearSearchOnOpen=r(e.props.clearSearchOnOpen)),e.props.selectionRemovable=r(e.props.selectionRemovable),e.props.openOnClick=r(e.props.openOnClick),"option"!==e.props.selectionAppearance||e.props.multiple||(e.props.isSingleOption=!0),void 0===e.props.closeOnSelect&&(e.props.closeOnSelect=!0),void 0===e.props.selectionAppearance&&(e.props.selectionAppearance="text-input"),void 0===e.props.closeOnSelect&&(e.props.closeOnSelect=!0),e.props.closeOnSelect?e.props.resetSearchOnCommit=!1:void 0===e.props.resetSearchOnCommit&&(e.props.resetSearchOnCommit=e.props.multiple),e.props.allowNewValues=r(e.props.allowNewValues)}function Jr(e){e.addProps(["inputText","selectionAppearance","searchValue","openOnClick","filteredOptions","search","debounce","showInput","visibilityStyles","selectionStyles","multiple","filter","hasHighlightedRange","clearOnClick","debounce"]),void 0===e.props.debounce?e.props.debounce=200:e.props.debounce=parseInt(e.props.debounce),e.props.nonceKey="searchValue",e.props.searchValue="",e.props.inputText="",e.props.filterOptions=kt.bind(null,e),e.props.reloadOnCommit=r(e.props.reloadOnCommit),void 0===e.props.alwaysLoadOnOpen?e.props.alwaysLoadOnOpen=!0:e.props.alwaysLoadOnOpen=r(e.props.alwaysLoadOnOpen),"function"!=typeof e.props.filter&&(e.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase())),e.on("created",()=>{e.context&&ee&&(e.context.handlers.focus=ts.bind(null,e),e.context.handlers.input=Qr.bind(null,e),e.context.handlers.focus=ts.bind(null,e),e.context.handlers.click=es.bind(null,e),e.context.handlers.toggleListbox=os.bind(null,e),e.context.handlers.toggleListboxKeydown=ns.bind(null,e),e.context.handlers.keydown=wo.bind(null,e),e.context.handlers.selectionKeydown=t=>o=>yo(e,t,o),e.context.handlers.searchInputTagKeydown=t=>o=>function(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":vo(e);break;case"ArrowRight":case"ArrowLeft":ho(e,t,o);break;case"Delete":case"Backspace":mo(e,t,o)}}(e,t,o),e.on("prop:options",({payload:t})=>{if((0===e.props.initialOptions.length&&"function"!=typeof e.props.optionsLoader||!e.props.searchValue&&t.length)&&(e.props.initialOptions=[...t]),e.props.selections&&e.props.selections.length&&t.length)for(let o=0;o<e.props.selections.length;o++){const n=e.props.selections[o],r=t.find(e=>vt(e)===n.value);r&&(e.props.selections[o]=r)}}))}),e.on("prop:expanded",({payload:t})=>{t||xt.delete(e)})}function Qr(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&kt(e,e.props.searchValue,!0)}function es(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 ts(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 os(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 ns(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),os(e))}const rs=new WeakMap,ss="undefined"!=typeof window,as=new WeakMap;let ls=!1;function is(e){e.props.searchValue=null,e.on("commit",()=>{e.props.searchValue=null,e.props.highlightedRange||ps(e)}),e.on("created",()=>{if(!e.context||!ss)return;e.on("handleSearchInput",({payload:t})=>{""===t?(e.props.searchValue=null,e.input([])):t&&0===e.props.inputStd.length?e.props.searchValue=t:t&&e.props.inputStd.length>0&&(e.props.searchValue=function(e){var t;const o=cs(e);if(e.props.highlightedRange){const[t,n]=ds(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)}(e)),!e.props.expanded&&t?e.props.expanded=!0:!t&&e.props.expanded&&(e.props.expanded=!1)}),function(e){s(`${e.props.id}`,t=>{t instanceof HTMLInputElement&&as.set(t,e)},e.props.__root),ss&&!ls&&(ls=!0,document.addEventListener("selectionchange",()=>{const e=ft();if(e instanceof HTMLInputElement&&as.has(e)){const t=as.get(e);t&&function(e){clearTimeout(rs.get(e)),rs.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=cs(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]=ds(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,ps(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)}}))}(e);const o=e.context.handlers.keydown;e.context.handlers.keydown=n=>{o(n),function(e,o){var n,r,s,a;if(["ArrowRight","ArrowLeft"].includes(o.key)&&o.target instanceof HTMLInputElement&&null!==o.target.selectionEnd&&null!==o.target.selectionStart){if(0===o.target.selectionStart&&o.target.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))"ArrowLeft"===o.key?t(0):t(-1);else if(!e.props.searchValue){e.props.searchValue=null;const t=cs(e),n=null===(r=t[t.length-1])||void 0===r?void 0:r.end;o.target.selectionStart<n&&(o.target.selectionStart=Math.max(0,"ArrowLeft"===o.key?o.target.selectionStart-2:o.target.selectionEnd+2))}}else if(["Delete","Backspace"].includes(o.key))e.props.highlightedRange&&!e.props.searchValue?(Vt(e,e.props.highlightedRange.option),0===e.props.inputStd.length&&(e.props.highlightedRange=void 0)):o.target instanceof HTMLInputElement&&(e.props.searchValue=null,t(-1,!0)&&o.preventDefault());else if(o.target instanceof HTMLInputElement&&0===o.target.selectionStart&&o.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)o.preventDefault();else if("Tab"===o.key)return;"ArrowLeft"===o.key&&t(-1,!0)&&o.preventDefault()}(e,n)};const n=e.context.handlers.focus;e.context.handlers.focus=t=>{n(e,t);const o=new Event("selectionchange");document.dispatchEvent(o)},e.on("blur",()=>{e.props.selections.length?(e.props.inputText=e.props.selections.map(e=>e.label).join(", "),e.props.searchValue=null):e.props.selections.length||(e.props.inputText="",e.props.searchValue="")})}),e.on("prop:expanded",({payload:t})=>{t||e.props.inputStd.length?t&&(e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],kt(e,e.props.searchValue))):(e.props.searchValue="",e.props.inputText="")}),e.on("prop:selections",()=>{var t;const o=[...e.props.selections].map(e=>e.label).join(", ");let n="";if(ss&&e.isCreated){const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(ft()===o&&Array.isArray(e._value)&&e._value.length){if(e.props.max&&e._value.length>=Number(e.props.max))return;n=", "}}e.props.inputText=`${o}${n}`,e.props.reloadOnCommit&&(e.props.searchValue="",kt(e,e.props.searchValue))});const t=(t,o=!1)=>{var n,r;const s=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}`);if(!(s instanceof HTMLInputElement))return!1;const a=cs(e),l=t>=0?t: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 o;e.on("selectRange",({payload:e})=>t(...e)),e.on("prop:highlightedRange",({payload:t})=>{e.props.hasHighlightedRange=!!t,t&&e.props.expanded&&o!==t.option&&(o=t.option,Pt(e))})}function ps(e){var t;if(!ss)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 ds(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 cs(e){const t=Mt(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 us(e){!function(e){e.on("prop:expanded",({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],kt(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&&kt(e,e.props.searchValue,!0))})}(e)}function fs(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=[],kt(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&&kt(e,e.props.searchValue,!0)})}(e)}function vs(e){if(e.props.multiple)if(e.props.multiple&&"option"===e.props.selectionAppearance){function t(){return Array.isArray(e.value)?e.value:[]}function o(t){e.input(t)}us(e),e.on("created",()=>{e.props.disabled&&(e.props.draggable=!1),s(`${e.props.id}_selections`,n=>{if(n instanceof HTMLElement&&e.context){const r={draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,root:e.props.__root,disabled:!e.props.draggable,plugins:[x()],synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-selection")};w({parent:n,getValues:t,setValues:o,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:n,getValues:t,setValues:o,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:n,getValues:t,setValues:o,config:r})})}},e.props.__root)})}else e.props.multiple&&"text-input"===e.props.selectionAppearance&&is(e);else fs(e)}const hs={schema:/* #__PURE__ */Er(/* #__PURE__ */Or(/* #__PURE__ */Fr("$label"),/* #__PURE__ */Mr(/* #__PURE__ */Vr("prefix"),/* #__PURE__ */Pr(),/* #__PURE__ */Kr(),/* #__PURE__ */Me("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */jr(/* #__PURE__ */Ur(/* #__PURE__ */Yr(/* #__PURE__ */Gr(/* #__PURE__ */Me("$state.loading",/* #__PURE__ */zr("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Me("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */Vr("loader")),/* #__PURE__ */Me("$selectionRemovable && $isSingleOption",/* #__PURE__ */qr(/* #__PURE__ */Vr("close")))))),/* #__PURE__ */Me("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */Vr("loader")),/* #__PURE__ */Me('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */qr(/* #__PURE__ */Vr("close")),/* #__PURE__ */Me('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */Wr(/* #__PURE__ */Vr("select")))),/* #__PURE__ */Me("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */Wr(/* #__PURE__ */Vr("select"))),/* #__PURE__ */Zr(),/* #__PURE__ */Br(),/* #__PURE__ */Vr("suffix")),/* #__PURE__ */Me("$multiple && $selectionAppearance === option",/* #__PURE__ */jr(/* #__PURE__ */Ur(/* #__PURE__ */Yr(/* #__PURE__ */Gr(/* #__PURE__ */Me("$state.loading && $fns.hasOptionLoaderValue($option)",/* #__PURE__ */zr("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */qr(/* #__PURE__ */Vr("close")))))),/* #__PURE__ */Hr("$help"),/* #__PURE__ */Rr(/* #__PURE__ */Nr("$message.value"))),type:"input",family:"dropdown",props:[],features:[
|
|
19
|
+
/* #__PURE__ */g("moveDown","arrowDown")]},tr=new WeakMap;function or(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 nr(e){e.props.max=Number(e.props.max)||5,e.props.min=Number(e.props.min)||0,e.props.step=Number(e.props.step)||1,e.props.numberOfSteps=e.props.max/e.props.step,e.props.lastIndex=1/e.props.step-1,e.props.stepsPerValue=1/e.props.step}function rr(e,t){const o=Number(t),n=Number(e.props.min),r=Number(e.props.max);return o>r?r:o<=n?n:o}function sr(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function ar(e,t){const{x:o,y:n}=hr(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 lr(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?mr(e,t,o):e.input(t+1,!1))}function ir(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,or(e);const o=tr.get(e);o&&(o.abort(),tr.delete(e))}function pr(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=>ir(e,t),{signal:n.signal}),tr.set(e,n),1===e.props.step?e.input(t+1,!1):mr(e,t,o)}function dr(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=Number(e.value||0),n=t?gr(t+1*e.props.step,e.props.step):e.props.min+1*e.props.step,r=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(t?`#${e.props.id}_inner input[value="${n}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,r&&r instanceof HTMLInputElement&&r.focus(),e.props.preventFocus=!1,e.input(Number(n))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=Number(e.value||0),o=t?gr(t-1*e.props.step,e.props.step):e.props.max,r=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${o}"]`);e.props.preventFocus=!0,r&&r instanceof HTMLInputElement&&r.focus(),e.props.preventFocus=!0,e.input(Number(o)),e.props.preventFocus=!1}}function cr(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 ur(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(or(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):mr(e,t,o,!!e.props.dragStarted)))}function fr(e){or(e)}function vr(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 mr(e,t,o)}function hr(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function mr(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r}=hr(o),s=o.currentTarget.getBoundingClientRect();let a=gr((r-s.x)/s.width+t,e.props.step);a=a>e.props.min?a:e.props.min,a=a<e.props.max?a:e.props.max,!e.props.deselect||a!==Number(e.value)||e.props.dragStarted?n?e.input(a,!1):or(e,a):e.input(0)}function gr(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const $r=/* #__PURE__ */Te("rt"),{outer:br,wrapper:yr,inner:xr,label:wr,prefix:kr,suffix:_r,help:Sr,messages:Lr,message:Ir,icon:Ar}=/* #__PURE__ */Oe($r),Cr=$r("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"}})),Dr=$r("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"}})),Tr=$r("template",()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null})),Or=$r("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%"'}}})),Er=$r("itemLabelInner",()=>({$el:"span",children:"$fns.getValue($item, $increment)"})),Mr=$r("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))"}})),Vr=$r("onItemRow",()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}})),Fr=$r("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"}}})),Pr=$r("onItemWrapper",()=>({$el:"div",attrs:{style:{color:"$onColor"}}})),Br=$r("offItemWrapper",()=>({$el:"div",attrs:{style:{color:"$offColor"}}})),Hr=()=>Me("$slots.onItem",()=>()=>"$slots.onItem",Me("$slots.default",()=>()=>"$slots.default",Ar("rating"))),Nr=()=>Me("$slots.offItem",()=>()=>"$slots.offItem",Me("$slots.default",()=>()=>"$slots.default",Ar("rating"))),Rr={schema:/* #__PURE__ */br(/* #__PURE__ */yr(/* #__PURE__ */wr("$label"),/* #__PURE__ */xr(/* #__PURE__ */Ar("prefix"),/* #__PURE__ */kr(),/* #__PURE__ */Cr(/* #__PURE__ */Dr(/* #__PURE__ */Tr(/* #__PURE__ */Or(/* #__PURE__ */Vr(/* #__PURE__ */Pr(/* #__PURE__ */Hr())),/* #__PURE__ */Fr(/* #__PURE__ */Br(/* #__PURE__ */Nr())),/* #__PURE__ */Er()),/* #__PURE__ */Mr()))),/* #__PURE__ */_r(),/* #__PURE__ */Ar("suffix"))),/* #__PURE__ */Sr("$help"),/* #__PURE__ */Lr(/* #__PURE__ */Ir("$message.value"))),type:"input",props:[],features:[function(e){function t(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`}})}e.addProps(["min","max","step","stepsPerValue","itemsToPercentages","rightToLeft","onItemStyles","offItemStyles","hoverHighlight","deselect","disabled","wrapperWidth","onColor","offColor"]),!1!==e.props.hoverHighlight&&"false"!==e.props.hoverHighlight&&(e.props.hoverHighlight=!0),e.props.deselect=r(e.props.deselect),nr(e),e.props.itemsToPercentages={},"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.props.rightToLeft?(e.props.onItemStyles=void 0,e.props.offItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%",zIndex:100}):e.props.onItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%"},e.hook.input((t,o)=>null===t||""===t||isNaN(t)?o(t):o(rr(e,t))),e.on("commit",({payload:t})=>{const o=Number(t||0);or(e,o)}),["min","max","step"].forEach(o=>{e.on(`prop:${o}`,()=>{if(nr(e),null!==e.value&&""!==e.value&&!isNaN(Number(e.value))){const t=rr(e,e.value);t!==Number(e.value)&&e.input(t)}or(e),t(e)})}),e.on("created",()=>{e.context&&(s(`${e.props.id}_items_wrapper`,()=>{t(e),function(e){var o;const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_items_wrapper`);if(!n)return;if("undefined"==typeof ResizeObserver)return;new ResizeObserver(()=>{t(e)}).observe(n)}(e),setTimeout(()=>t(e),100)},e.props.__root),e.context.fns.getPercentage=(e,t,o=!0)=>(o?e.onItems:e.offItems)[t],e.context.fns.getValue=(t,o)=>t+Number((o*e.props.step+e.props.step).toFixed(1)),e.context.fns.showLabel=(t,o)=>{const n=Number(e.value||0);return 0===n&&0===o||n&&t===n||t>n&&0===o||n>t&&o===e.props.lastIndex},e.context.handlers.handleFocus=t=>cr.call(null,e,t),e.context.handlers.handleWrapperKeydown=t=>dr.call(null,e,t),e.context.handlers.handleWrapperBlur=t=>sr.call(null,e,t),e.context.handlers.handleItemClick=t=>o=>vr.call(null,e,t,o),e.context.handlers.handleMousemove=t=>o=>ur.call(null,e,t,o),e.context.handlers.handleMouseleave=()=>fr.call(null,e),e.context.handlers.handleDragstart=t=>o=>pr.call(null,e,t,o),e.context.handlers.handleMouseup=t=>ir.call(null,e,t),e.context.handlers.handleTouchstart=t=>o=>lr.call(null,e,t,o),e.context.handlers.handleTouchmove=t=>ar.call(null,e,t),e.context.handlers.handleKeydown=t=>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)}(e,t,o))})},/* #__PURE__ */g("rating","star")]},Kr=/* #__PURE__ */Te("ac"),{outer:Wr,wrapper:Ur,inner:Yr,icon:jr,label:qr,prefix:zr,suffix:Gr,help:Zr,messages:Xr,message:Jr}=/* #__PURE__ */Oe(Kr),Qr=Kr("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" || $disabledInternally && "-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-labelledby":'$label && $id + "_label" || undefined',"aria-describedby":"$describedBy","aria-activedescendant":"$expanded && $activeDescendant || undefined","aria-required":"$state.required || undefined"}})),es=Kr("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" || $disabledInternally && "-1" || 0',"aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-disabled":"$disabled || $disabledInternally || $state.loading || undefined","data-disabled":"$disabled || $disabledInternally || undefined"}})),ts=Kr("selectionWrapper",()=>({for:["option","index","$selections"],$el:"div",attrs:{id:'$id + "_selection_wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:'$disabled && "-1" || $disabledInternally && "-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)"}})),os=Kr("selection",()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}})),ns=Kr("selections",()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}})),rs=Kr("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"}})),ss=Kr("optionLoading","span"),as=Kr("option",()=>({$el:"div",if:"$value !== undefined"})),ls=/* #__PURE__ */Ve(Kr);function is(e){"option"!==e.props.selectionAppearance||e.props.multiple||!1===e.props.selectionRemovable||"false"===e.props.selectionRemovable||(e.props.selectionRemovable=!0),e.props.multiple||(e.props.clearSearchOnOpen=r(e.props.clearSearchOnOpen)),e.props.selectionRemovable=r(e.props.selectionRemovable),e.props.openOnClick=r(e.props.openOnClick),"option"!==e.props.selectionAppearance||e.props.multiple||(e.props.isSingleOption=!0),void 0===e.props.closeOnSelect&&(e.props.closeOnSelect=!0),void 0===e.props.selectionAppearance&&(e.props.selectionAppearance="text-input"),void 0===e.props.closeOnSelect&&(e.props.closeOnSelect=!0),e.props.closeOnSelect?e.props.resetSearchOnCommit=!1:void 0===e.props.resetSearchOnCommit&&(e.props.resetSearchOnCommit=e.props.multiple),e.props.allowNewValues=r(e.props.allowNewValues)}function ps(e){e.addProps(["inputText","selectionAppearance","searchValue","openOnClick","filteredOptions","search","debounce","showInput","visibilityStyles","selectionStyles","multiple","filter","hasHighlightedRange","clearOnClick","debounce","filteringOptions"]),void 0===e.props.debounce?e.props.debounce=200:e.props.debounce=parseInt(e.props.debounce),e.props.nonceKey="searchValue",e.props.searchValue="",e.props.inputText="",e.props.filterOptions=St.bind(null,e),e.props.reloadOnCommit=r(e.props.reloadOnCommit),void 0===e.props.alwaysLoadOnOpen?e.props.alwaysLoadOnOpen=!0:e.props.alwaysLoadOnOpen=r(e.props.alwaysLoadOnOpen),"function"!=typeof e.props.filter&&(e.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase())),e.on("created",()=>{e.context&&ee&&(e.context.handlers.focus=fs.bind(null,e),e.context.handlers.input=ds.bind(null,e),e.context.handlers.focus=fs.bind(null,e),e.context.handlers.click=cs.bind(null,e),e.context.handlers.toggleListbox=vs.bind(null,e),e.context.handlers.toggleListboxKeydown=hs.bind(null,e),e.context.handlers.focusInput=us.bind(null,e),e.context.handlers.keydown=Ao.bind(null,e),e.context.handlers.selectionKeydown=t=>o=>Lo(e,t,o),e.context.handlers.searchInputTagKeydown=t=>o=>function(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":yo(e);break;case"ArrowRight":case"ArrowLeft":xo(e,t,o);break;case"Delete":case"Backspace":wo(e,t,o)}}(e,t,o),e.on("prop:options",({payload:t})=>{!e.props.filteringOptions&&(0===e.props.initialOptions.length&&"function"!=typeof e.props.optionsLoader||!e.props.searchValue&&t.length)&&(e.props.initialOptions=[...t]),e.props.selections&&e.props.selections.length&&t.length&&function(e,t){var o;const n=ms(e.props.selections,t);n!==e.props.selections&&(e.props.selections=n);if(null===(o=e.props.memoOptions)||void 0===o?void 0:o.length){const o=ms(e.props.memoOptions,t);o!==e.props.memoOptions&&(e.props.memoOptions=o)}}(e,Kt(t))}))}),e.on("prop:expanded",({payload:t})=>{t||xt.delete(e)})}function ds(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&St(e,e.props.searchValue,!0)}function cs(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 us(e){var t,o;e.props.disabled||e.props.disabledInternally||(null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus(),(!e.props.expanded&&e.props.openOnClick||e.props.openOnFocus)&&(e.props.expanded=!0))}function fs(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 vs(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 hs(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),vs(e))}function ms(e,t){let o=!1;const r=e.map(e=>{const r=t.find(t=>n(vt(t),vt(e)));return r&&r!==e?(o=!0,r):e});return o?r:e}const gs=new WeakMap,$s="undefined"!=typeof window,bs=new WeakMap;let ys=!1;function xs(e){e.props.searchValue=null,e.on("commit",()=>{e.props.searchValue=null,e.props.highlightedRange||ws(e)}),e.on("created",()=>{if(!e.context||!$s)return;e.on("handleSearchInput",({payload:t})=>{""===t?(e.props.searchValue=null,e.input([])):t&&0===e.props.inputStd.length?e.props.searchValue=t:t&&e.props.inputStd.length>0&&(e.props.searchValue=function(e){var t;const o=_s(e);if(e.props.highlightedRange){const[t,n]=ks(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)}(e)),!e.props.expanded&&t?e.props.expanded=!0:!t&&e.props.expanded&&(e.props.expanded=!1)}),function(e){s(`${e.props.id}`,t=>{t instanceof HTMLInputElement&&bs.set(t,e)},e.props.__root),$s&&!ys&&(ys=!0,document.addEventListener("selectionchange",()=>{const e=ft();if(e instanceof HTMLInputElement&&bs.has(e)){const t=bs.get(e);t&&function(e){clearTimeout(gs.get(e)),gs.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=_s(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]=ks(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,ws(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)}}))}(e);const o=e.context.handlers.keydown;e.context.handlers.keydown=n=>{o(n),function(e,o){var n,r,s,a;if(["ArrowRight","ArrowLeft"].includes(o.key)&&o.target instanceof HTMLInputElement&&null!==o.target.selectionEnd&&null!==o.target.selectionStart){if(0===o.target.selectionStart&&o.target.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))"ArrowLeft"===o.key?t(0):t(-1);else if(!e.props.searchValue){e.props.searchValue=null;const t=_s(e),n=null===(r=t[t.length-1])||void 0===r?void 0:r.end;o.target.selectionStart<n&&(o.target.selectionStart=Math.max(0,"ArrowLeft"===o.key?o.target.selectionStart-2:o.target.selectionEnd+2))}}else if(["Delete","Backspace"].includes(o.key))e.props.highlightedRange&&!e.props.searchValue?(Ht(e,e.props.highlightedRange.option),0===e.props.inputStd.length&&(e.props.highlightedRange=void 0)):o.target instanceof HTMLInputElement&&(e.props.searchValue=null,t(-1,!0)&&o.preventDefault());else if(o.target instanceof HTMLInputElement&&0===o.target.selectionStart&&o.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)o.preventDefault();else if("Tab"===o.key)return;"ArrowLeft"===o.key&&t(-1,!0)&&o.preventDefault()}(e,n)};const n=e.context.handlers.focus;e.context.handlers.focus=t=>{n(e,t);const o=new Event("selectionchange");document.dispatchEvent(o)},e.on("blur",()=>{e.props.selections.length?(e.props.inputText=e.props.selections.map(e=>e.label).join(", "),e.props.searchValue=null):e.props.selections.length||(e.props.inputText="",e.props.searchValue="")})}),e.on("prop:expanded",({payload:t})=>{t||e.props.inputStd.length?t&&(e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],St(e,e.props.searchValue))):(e.props.searchValue="",e.props.inputText="")}),e.on("prop:selections",()=>{var t;const o=[...e.props.selections].map(e=>e.label).join(", ");let n="";if($s&&e.isCreated){const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(ft()===o&&Array.isArray(e._value)&&e._value.length){if(e.props.max&&e._value.length>=Number(e.props.max))return;n=", "}}e.props.inputText=`${o}${n}`,e.props.reloadOnCommit&&(e.props.searchValue="",St(e,e.props.searchValue))});const t=(t,o=!1)=>{var n,r;const s=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}`);if(!(s instanceof HTMLInputElement))return!1;const a=_s(e),l=t>=0?t: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 o;e.on("selectRange",({payload:e})=>t(...e)),e.on("prop:highlightedRange",({payload:t})=>{e.props.hasHighlightedRange=!!t,t&&e.props.expanded&&o!==t.option&&(o=t.option,Rt(e))})}function ws(e){var t;if(!$s)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 ks(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 _s(e){const t=Bt(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 Ss(e){!function(e){e.on("prop:expanded",({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],St(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&&St(e,e.props.searchValue,!0))})}(e)}function Ls(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=[],St(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&&St(e,e.props.searchValue,!0)})}(e)}function Is(e){if(e.props.multiple)if(e.props.multiple&&"option"===e.props.selectionAppearance){function t(){return Array.isArray(e.value)?e.value:[]}function o(t){e.input(t)}Ss(e),e.on("created",()=>{e.props.disabled&&(e.props.draggable=!1),s(`${e.props.id}_selections`,n=>{if(n instanceof HTMLElement&&e.context){const r={draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,root:e.props.__root,disabled:!e.props.draggable,plugins:[x()],synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-selection")};w({parent:n,getValues:t,setValues:o,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:n,getValues:t,setValues:o,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:n,getValues:t,setValues:o,config:r})})}},e.props.__root)})}else e.props.multiple&&"text-input"===e.props.selectionAppearance&&xs(e);else Ls(e)}const As={schema:/* #__PURE__ */Wr(/* #__PURE__ */Ur(/* #__PURE__ */qr("$label"),/* #__PURE__ */Yr(/* #__PURE__ */jr("prefix"),/* #__PURE__ */zr(),/* #__PURE__ */Qr(),/* #__PURE__ */Me("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */ns(/* #__PURE__ */ts(/* #__PURE__ */os(/* #__PURE__ */as(/* #__PURE__ */Me("$state.loading",/* #__PURE__ */ss("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Me("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */jr("loader")),/* #__PURE__ */Me("$selectionRemovable && $isSingleOption",/* #__PURE__ */rs(/* #__PURE__ */jr("close")))))),/* #__PURE__ */Me("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */jr("loader")),/* #__PURE__ */Me('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */rs(/* #__PURE__ */jr("close")),/* #__PURE__ */Me('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */es(/* #__PURE__ */jr("select")))),/* #__PURE__ */Me("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */es(/* #__PURE__ */jr("select"))),/* #__PURE__ */ls(),/* #__PURE__ */Gr(),/* #__PURE__ */jr("suffix")),/* #__PURE__ */Me("$multiple && $selectionAppearance === option",/* #__PURE__ */ns(/* #__PURE__ */ts(/* #__PURE__ */os(/* #__PURE__ */as(/* #__PURE__ */Me("$state.loading && $fns.hasOptionLoaderValue($option)",/* #__PURE__ */ss("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */rs(/* #__PURE__ */jr("close")))))),/* #__PURE__ */Zr("$help"),/* #__PURE__ */Xr(/* #__PURE__ */Jr("$message.value"))),type:"input",family:"dropdown",props:[],features:[
|
|
20
20
|
/* #__PURE__ */g("select","select"),
|
|
21
21
|
/* #__PURE__ */g("close","close"),
|
|
22
22
|
/* #__PURE__ */g("selected","check"),
|
|
@@ -26,7 +26,7 @@ import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailab
|
|
|
26
26
|
/* #__PURE__ */$("remove"),
|
|
27
27
|
/* #__PURE__ */$("open"),
|
|
28
28
|
/* #__PURE__ */$("close"),b,
|
|
29
|
-
/* #__PURE__ */io.bind(null,Xr,Jr,vs),Yo]},ms=/* #__PURE__ */Te("dp"),{outer:gs,wrapper:$s,inner:bs,icon:ys,label:xs,prefix:ws,suffix:_s,help:ks,messages:Ss,message:Ls}=/* #__PURE__ */Ee(ms),Is=ms("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"}})),As=ms("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"'}}}})),Cs=ms("next",()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _next_button",type:"button",onClick:"$handlers.next"}})),Ds=ms("nextLabel","span"),Ts=ms("prev",()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _prev_button",type:"button",onClick:"$handlers.prev"}})),Es=ms("prevLabel","span"),Os=ms("calendar",()=>({if:'$panel === "day"',$el:"table",for:["month","$calendar"],attrs:{key:'$fns.format($month.monthDay, "YYYY-MM")'}})),Ms=ms("calendarWeeks",()=>({$el:"tbody"})),Vs=ms("calendarHeader",()=>({$el:"thead"})),Fs=ms("weekDays",()=>({$el:"tr"})),Ps=ms("weekDay",()=>({$el:"th",for:["day","$month.weeks.0"],attrs:{"aria-label":'$fns.format($day, "dddd")'}})),Bs=ms("week",()=>({$el:"tr",for:["week","weekIndex","$month.weeks"]})),Hs=ms("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")'}})),Rs=ms("day","div"),Ns=ms("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'}})),Ks=ms("years",()=>({if:'$panel === "year"',$el:"ul",attrs:{id:'$id + "_years"'}})),Ws=ms("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)"}})),Us=ms("months",()=>({if:'$panel === "month"',$el:"ul"})),Ys=ms("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)"}})),js=ms("panelHeader",()=>({$el:"header",attrs:{"aria-live":"polite"}})),qs=ms("yearsHeader",()=>({$el:"div",if:'$panel === "year"'})),zs=ms("monthsHeader",()=>({$el:"div",if:'$panel === "month"'})),Gs=ms("daysHeader",()=>({$el:"div",if:'$panel === "day"'})),Zs=ms("timeHeader",()=>({$el:"div",if:'$panel === "time"'})),Xs=ms("yearButton",()=>({$el:"button",attrs:{type:"button",id:"$id + _year_button",onClick:"$handlers.jumpTo(year)"},children:"$fns.format($renderedDate, $yearFormat)"})),Js=ms("monthButton",()=>({$el:"button",attrs:{type:"button",id:"$id + _month_button",onClick:"$handlers.jumpTo(month)"},children:"$fns.format($renderedDate, $monthButtonFormat)"})),Qs=ms("dayButton",()=>({$el:"button",attrs:{type:"button",id:"$id + _day_button",onClick:"$handlers.jumpTo(day)",tabindex:"2"},children:"$fns.format($renderedDate, $dayButtonFormat)"})),ea=ms("removeSelection",()=>({$el:"button",if:"$clearable && $_value",attrs:{id:'$id + "_remove_selection"',type:"button",onClick:"$handlers.clear","aria-controls":"$id"}})),ta=ms("time",()=>({$el:"div",if:'$panel === "time"'})),oa=ms("timeInput",()=>({$el:"input",attrs:{type:"time",value:"$localTime",onInput:"$handlers.localTime",onKeydown:"$handlers.keyDown",spellcheck:"false",onBlur:"$handlers._blurOut(time)"}})),na=ms("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:ra,overlayLiteral:sa,overlayChar:aa,overlayEnum:la,overlay:ia,overlayParts:pa,overlayInner:da}=/* #__PURE__ */Oe(ms),ca=ms("panel","div"),ua=/* #__PURE__ */new WeakMap,fa=/* #__PURE__ */new WeakMap,va=new WeakSet,ha=/* #__PURE__ */new WeakMap,ma=/* #__PURE__ */new WeakMap,ga=new WeakSet,$a=/* #__PURE__ */new WeakMap,ba=/[\uD800-\uDBFF]/,ya=/* #__PURE__ */new WeakMap,xa=/* #__PURE__ */new WeakMap,wa=/* #__PURE__ */new WeakMap,_a=/* #__PURE__ */new WeakMap,ka=/* #__PURE__ */new WeakMap,Sa=new WeakSet,La=/* #__PURE__ */new WeakMap,Ia=/* #__PURE__ */new WeakMap,Aa=/* #__PURE__ */new WeakMap,Ca=/* #__PURE__ */new WeakMap;let Da=!1;const Ta=()=>{Da=!0,setTimeout(()=>{Da=!1},500)},Ea={"#":{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"}},Oa=/* #__PURE__ */new WeakMap,Ma="undefined"!=typeof window;let Va=!1,Fa=!1;function Pa(){Ma&&!Fa&&(Fa=!0,document.addEventListener("selectionchange",()=>{const e=ft();if(!(e instanceof HTMLInputElement))return;if(Ca.has(e))return function(e){const t=Ca.get(e);if(t){const[o,n]=t,[r,s]=xl(e),a=s.indexOf(o);if(-1===a)return void Ca.delete(e);const l=r[a],i=[l[0]+n[0],l[1],"none"];Ga(Za(e),i)||ol(e,i)}}(e);if("select"!==$a.get(e))return;const t=Za(e);if(!Ga(t,Oa.get(e))){if(Oa.set(e,t),va.has(e))return va.delete(e);e.dispatchEvent(new CustomEvent("selection",{detail:Za(e)}))}}))}function Ba(e,t,o){var n;if(Pa(),ua.has(e))return;ua.set(e,[]),t.reverse&&Sa.add(e),t.prefix&&La.set(e,t.prefix),t.suffix&&Ia.set(e,t.suffix),Wa(e,t.pattern,t.partOverrides,t.explicitParts);const r=ma.get(e),s=null==r?void 0:r.some(e=>ja(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)&&ga.add(e),$a.set(e,l),t.onChange&&_a.set(e,t.onChange);let i=!1;e.addEventListener("beforeinput",o=>{if(Va)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=ua.get(e);if(null==r?void 0:r.length){const o=(null!==(n=fa.get(e))&&void 0!==n?n:r.length-1)+(t.endsWith("Undo")?-1:1),s=r[o];if(!s)return;nl(e,s),e.setSelectionRange(...s.selectionAfter),fa.set(e,o),_a.has(e)&&_a.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=Za(e),a=e.value;n&&Xa(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(),Ll(e);case"ArrowLeft":return t.preventDefault(),Ll(e,-1);case"ArrowUp":return void(Il(e,1)&&t.preventDefault());case"ArrowDown":return void(Il(e,-1)&&t.preventDefault());case"Tab":return Da?void t.preventDefault():void(Ll(e,t.shiftKey?-1:1)&&t.preventDefault())}}),e.addEventListener("focus",()=>function(e){var t;const o=ga.has(e),n=$a.get(e);if(o){let o=null,r=null,s=!1;const a="shift"===n?0:1,l=e.value;fl(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),(Ya(t)||ja(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"===$a.get(e)){const[o]=xl(e),n=Cl(e,t);void 0!==n&&n in o&&(t=o[n])}return function(e,t,o=50){ya.set(e,Qa(e,t));const n=()=>{document.removeEventListener("selectionchange",r),ya.delete(e)},r=async()=>{if(!Ma||ft()!==e)return;const t=$a.get(e);"select"===t&&(await new Promise(e=>setTimeout(e,10)),function(e){let t=Za(e);if(t[0]===t[1]&&0===t[0]||e.value.length===t[1]&&0===t[0])return;t=el(e,t);const[o]=xl(e),n=Cl(e,t),r=t[0];void 0!==n&&o.some(e=>r>=e[0]&&r<e[1])&&ya.set(e,Qa(e,o[n]))}(e));const o=ya.get(e);if(!o)return;const r=Za(e),s=r[0]===r[1]&&0===r[0]||0===r[0]&&r[1]===e.value.length;"select"===t||Ga(r,o)||s?e.setSelectionRange(...o):n()};r(),document.addEventListener("selectionchange",r),setTimeout(()=>{n()},o)}(e,t)}}}(e)),e.addEventListener("selection",t=>function(e,t){if(ya.get(e))return;Ml(e),t=el(e,t);const[o]=xl(e),n=Cl(e,t),r=void 0!==n&&Qa(e,o[n]);r&&!Ga(t,r)&&ol(e,r,!0)}(e,t.detail)),Xa(e,{type:"insert",selectionBefore:[0,0,"forward"],data:e.value,valueBefore:"",suffix:t.suffix,prefix:t.prefix})}function Ha(e){var t,o;if(Ca.has(e))return;const n=null!==(t=ua.get(e))&&void 0!==t?t:[],r=n[null!==(o=fa.get(e))&&void 0!==o?o:n.length-1];if(r){const t=r.selectionAfter,[o,n]=xl(e,r.valueAfter),s=Cl(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"];Ca.set(e,[r,l])}}}function Ra(e){Ca.delete(e)}function Na(e,t,o){const n="string"==typeof e||!ua.has(e),r="string"==typeof e?Ka(e):e;if(n)t.prefix&&La.set(r,t.prefix),t.suffix&&Ia.set(r,t.suffix),r.value=Ja(r,r.value),Ba(r,t,o);else{const e=Dl(r),o=r.value;r.value="",Xa(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 Ka(e){return{value:e,selectionStart:0,selectionEnd:0,scrollWidth:0,clientWidth:0,addEventListener:()=>{},dispatchEvent:()=>{},setSelectionRange:()=>{}}}function Wa(e,t,o,n,r){r=e&&Sa.has(e)||r;const s=(null!=n?n:function(e){const t=Object.values(Ea);if(!e)return t;const o={...e},n=[];for(const r of t)if(!za(r)){if("token"in r&&r.token in e){const t={...r,...e[r.token]};Ua(t)&&n.push(t),delete o[r.token];continue}n.push(r)}const r=Object.values(o);for(const e of r)Ua(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=rl(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=Wa(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&&ma.set(e,c),c}function Ua(e){return!!e&&(za(e)||Ya(e)||ja(e))}function Ya(e){return!!e&&("char"===e.type&&e.pattern instanceof RegExp&&qa(e))}function ja(e){return!!e&&("enum"===e.type&&Array.isArray(e.values)&&qa(e))}function qa(e){return!!e&&("placeholder"in e&&"token"in e)}function za(e){return!!e&&("literal"===e.type&&"string"==typeof e.value)}function Ga(e,t){return e===t||void 0!==e&&void 0!==t&&(e[0]===t[0]&&e[1]===t[1])}function Za(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 Xa(e,t){var o;Sa.has(e)&&Ol(t);let n=!1;switch(ka.set(e,"playing"),t.type){case"insert":n=function(e,t){let o=tl(t);const n=t.selectionBefore,r=function(e,t){var o,n,r;if("select"===$a.get(e)){const[s,a]=xl(e),l=s.findIndex(e=>Ga(e,t.selectionBefore)),i=null!==(o=a[l])&&void 0!==o?o:null;if(Ya(i)){const e=t.selectionBefore,o=e[1]-e[0],s=t.valueBefore.substring(e[0],e[1]),a="left"===i.selectDirection,l=cl(s,i),p=a?0:function(e,t,o){if(!e)return 0;let n="";for(;e.length;){const o=rl(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(ja(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=fl(e,t,o);return ha.set(e,s.endPos),{...t,valueAfter:s.value,selectionAfter:ul(e,s),unmasked:s.unmasked,complete:s.complete,meta:s.meta}}(e,t);break;case"deleteContentBackward":case"deleteContentForward":n=function(e,t){const o=tl(t),n=t.selectionBefore,r=Sa.has(e);let s=n[0],a=n[1];s===a&&("deleteContentBackward"!==t.type||r?a+=sl(o,s):s-=sl(o,s,"backward"));const l=$a.get(e);let i="";if("select"===l){const[o,n]=xl(e),r=Cl(e,[s,a,"none"]);if(void 0!==r){const l=n[r],p=o[r];Ya(l)?i=l.placeholder.repeat(a-s):ja(l)&&([i,s]=Ga(p,Za(e))?[l.placeholder,s]:function(e,t,o,n){const r=n.valueBefore,s=sl(r,n.selectionBefore[0],"backward"),a=Math.max(o[0],n.selectionBefore[0]-s),l=r.substring(o[0],a),i=_l(t.values,l);let p=null==i?void 0:i.substring(l.length);i&&!p&&kl(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=fl(e,t,p);return{...t,valueAfter:d.value,selectionAfter:$l(e,d,t,s),unmasked:d.unmasked,complete:d.complete,meta:d.meta}}(e,t)}if(Sa.has(e)&&n&&Ol(n),n&&function(e,t){t.prefix&&(t.valueAfter=t.prefix+t.valueAfter,t.selectionAfter=Qa(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)){_a.has(e)&&Aa.set(e,()=>{Aa.delete(e),n&&_a.get(e)(n,e)}),ka.set(e,"beforeCallback");let t=null!==(o=ua.get(e))&&void 0!==o?o:[];const r=fa.get(e);r&&(t=t.slice(0,r),fa.delete(e)),t.push(n),ua.set(e,t),Ma&&ft()===e&&"function"==typeof document.execCommand&&!Va?(ol(e,[0,e.value.length,"forward"],!0),Va=!0,document.execCommand("insertText",void 0,n.valueAfter),Va=!1):nl(e,n),Ma&&ft()===e&&ol(e,n.selectionAfter);const s=Aa.get(e);s&&s(),Ml(e)}ka.set(e,"complete")}function Ja(e,t){var o,n;const r=null!==(o=La.get(e))&&void 0!==o?o:"",s=null!==(n=Ia.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 Qa(e,t){const o=La.get(e),n=[...t];return o&&(n[0]+=o.length,n[1]+=o.length),n}function el(e,t){const o=La.get(e),n=[...t];return o&&(n[0]-=o.length,n[1]-=o.length),n}function tl(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 ol(e,t,o=!1){o&&(va.add(e),setTimeout(()=>va.delete(e),5)),ya.get(e)&&ya.set(e,t),e.setSelectionRange(...t)}function nl(e,t,o="After"){if(e.value=t[`value${o}`],Ma){const o=new InputEvent("input",{inputType:"insert"===t.type?"insertText":t.type,data:t.data});e.dispatchEvent(o)}}function rl(e){if(null==e)return"";const t=ba.test(e.charAt(0))&&ba.test(e.charAt(1))?2:1;return e.substring(0,t)}function sl(e,t,o="forward"){if("backward"===o)return 0===t?0:1===t?1:ba.test(e.charAt(t))&&ba.test(e.charAt(t-1))?2:1;const n=e.length-t;return 0===n?0:1===n?1:rl(e.substring(t)).length}function al(e,t){const o=rl(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 ll(e){const t=rl(e.buffer),o=t.length;e.value+=t,e.pos+=o,e.buffer=e.buffer.substring(o)}function il(e,t){const o=rl(t),n=o.length;return e.value+=o,e.pos+=n,t.substring(n)}function pl(e,t){for(;t.buffer;){const o=rl(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 dl(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(sl(t.buffer,0))}return null}function cl(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 ul(e,t){let o=[t.endPos,t.endPos,"forward"];if("select"!==t.mode)return o;const n=Za(e);o=[n[0],t.endPos,"none"];const[r,s]=xl(e,t.value),a=Cl(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(Ya(i)&&cl(p,i).length===p.length&&a<r.length-1)return Ta(),r[a+1];if(ja(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=_l(o.values,r);if(s)return yl(r,s).length-n.length;return 0}(t,l[0],i);if(t.insertPos+o===l[1])return kl(i.values,p)?[l[1],l[1],"forward"]:(Ta(),r[a+1]?r[a+1]:r[a]);const s=[t.insertPos+o,l[1],"none"];return Ga(s,n)||(va.add(e),setTimeout(()=>va.delete(e),5)),s}return l}function fl(e,t,o,n){var r,s;const a=null!==(r=ma.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:ga.has(e),buffer:o,data:t.data,originalData:t.data,value:"",mode:$a.get(e)||"replace",endPos:t.selectionBefore[0],rangeParts:xl(e),unmasked:"",complete:!0,cycle:t.cycle,meta:[]};return vl(a,l,void 0,n),l}function vl(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":ml(o,t,e.at(-1)===o);break;case"char":gl(o,t,l);break;case"enum":hl(o,t);break;case"group":const a={repeat:null!==(s=o.repeat)&&void 0!==s&&s,nextPart:r,repeats:0,placeholder:!!o.placeholder};vl(o.parts,t,a,n)}if(n){if(!1===n(t,o))break}const a=za(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++,vl(e,t,o,n);if(!s){t.complete=!1;const o=e.reverse().find(e=>"literal"===e.type);e.reverse(),za(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 hl(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=_l(e.values.concat([e.placeholder]),n);if(r){const s=yl(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):dl(e,t),t.endPos=t.pos+s.length,void(t.pos=t.value.length)}t.data=""}if(t.buffer){const o=dl(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 ml(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?rl(t.data):"",s=rl(n);if(e===s)n=al(t,n),t.meta.push({type:"literal",value:s}),r=!0;else if(!r||t.data||null===t.data||t.placeholder||o)n=il(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 gl(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=rl(t.data);if(e.pattern.test(n))return al(t),t.meta.push({type:"char",value:n}),t.chars++,t.unmasked+=n,void pl(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=rl(t.buffer);if(e.pattern.test(n))return t.chars++,t.unmasked+=n,ll(t),void t.meta.push({type:"char",value:n});if(t.placeholder&&n===e.placeholder)return ll(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 $l(e,t,o,n){const r=[n,n,"none"];if("select"===t.mode){const s=xl(e),a=Cl(e,r,s),[l,i]=xl(e,t.value),p=void 0!==a&&bl(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)=>bl(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 bl(e,t,o){if(za(o))return!1;if(Ya(o)){let n=t[0];for(;n<t[1];){const t=rl(e.substring(n));if(t!==o.placeholder)return!1;n+=t.length}}return!ja(o)||e.substring(t[0],t[1])===o.placeholder}function yl(e,t){let o="";do{const n=rl(e).toLowerCase(),r=rl(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 xl(e,t){const o=ma.get(e);if(!o)return[[],[]];if(xa.has(e))return xa.get(e);const n=null!=t?t:Ja(e,e.value),r=[],s=[];let a=null,l=null,i=0,p=!0;for(const e of o)if(za(e))a=e,null!==l&&(r.push([l,i,"none"]),l=null),i+=e.value.length;else{if(Ya(a)&&Ya(e)&&e.token===a.token)i++;else if(Ya(e))null===l?(l=i,s.push(e)):(r.push([l,i,"none"]),l=i,s.push(e)),i++;else if(ja(e)){l&&r.push([l,i,"none"]),Sl(e)||(p=!1);const t=wl(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&&xa.set(e,d),d}function wl(e,t,o){if(Sl(t))return t.values[0].length;const n=e.slice(o),r=_l(t.values.concat([t.placeholder]),n);return r?r.length:0}function _l(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=rl(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=_l(l,t.substring(s.length),o,a))&&void 0!==r?r:l[0])}function kl(e,t){return t=t.toLowerCase(),e.some(e=>(e=e.toLowerCase()).startsWith(t.toLocaleLowerCase())&&e!==t)}function Sl(e){if(!wa.has(e)&&Array.isArray(e.values)&&e.values.length>0){const t=e.values[0].length;if(e.placeholder.length!==t)return!1;wa.set(e,e.values.every(e=>e.length===t))}return wa.get(e)}function Ll(e,t=1){const[o]=xl(e),n=Cl(e,el(e,Za(e)));return void 0!==n&&void 0!==o[n+t]&&(e.setSelectionRange(...Qa(e,o[n+t])),!0)}function Il(e,t=1){const[o,n]=xl(e),r=Cl(e,Za(e));if(void 0!==r&&r in n){const s=n[r];if(ja(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(()=>Xa(e,t),0),!0}}}return!1}function Al(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 Al(e.slice(...r),t)}function Cl(e,t,o){const[n]=null!=o?o:xl(e),r=n.findIndex(e=>e[0]!==e[1]&&(!!Ga(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=Al([...s],0===t[0]&&t[1]===e.value.length?0:t[1]);return l in a?a[l]:void 0}function Dl(e){var t,o;const n=null!==(t=ua.get(e))&&void 0!==t?t:[];return n[null!==(o=fa.get(e))&&void 0!==o?o:n.length-1]}function Tl(e,t=!1){const o=Dl(e);return o&&(o.complete||t)?Sa.has(e)?[...o.unmasked].reverse().join(""):o.unmasked:t?"":null}function El(e){var t;const o=Dl(e);return null!==(t=null==o?void 0:o.meta)&&void 0!==t?t:null}function Ol(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 Ml(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 Vl="undefined"!=typeof window,Fl=new WeakSet,Pl=new WeakSet,Bl=new WeakSet,Hl=new WeakMap,Rl=new WeakMap,Nl=new WeakSet,Kl=new WeakSet;function Wl(e){e.props.selectedMonth=e.props.selectedYear=e.props.selectedDay=e.props.selectedWeek=void 0}function Ul(e){var t,o,n;e.props.selectedMonth=e.props.months.findIndex(t=>ql(t,e.props.activeDate)),e.props.selectedYear=e.props.years.findIndex(t=>jl(t,e.props.activeDate));for(let r=0;r<(null===(t=e.props.calendar[0])||void 0===t?void 0:t.weeks.length);r++)for(let t=0;t<(null===(o=e.props.calendar[0])||void 0===o?void 0:o.weeks[r].length);t++){const o=null===(n=e.props.calendar[0])||void 0===n?void 0:n.weeks[r][t];if(H(o,e.props.activeDate)){e.props.selectedWeek=r,e.props.selectedDay=t;break}}}function Yl(e){return"timeZoneName"!==e.partName}function jl(e,t){return t instanceof Date&&e.getFullYear()===t.getFullYear()}function ql(e,t){return t instanceof Date&&e.getMonth()===t.getMonth()}function zl(e){e.props.skipBuildCalendar||Wl(e),e.props.selectedIndex=e.props.calendar=ue(e.props.showMonths,e=>e).map(t=>function(e,t){const o=[],n=R(t);n.setDate(1);let r=j(n,e.props.weekStart);r.setHours(n.getHours(),n.getMinutes(),n.getSeconds());const s=q(P(t),e.props.weekStart);let a=[];do{a.push(r),7===a.length&&(o.push(a),a=[]),r=E(r)}while(r.getTime()<=s.getTime());return{monthDay:n,weeks:o}}(e,O(e.props.renderedDate,t))),e.props.years=function(e){const t=Number(L(e.props.renderedDate,"YYYY")),o=t-t%10;return e.props.decade=`${o} - ${o+9}`,ue(10,n=>M(e.props.renderedDate,o+n-t))}(e),e.props.months=function(e){const t=R(e.props.renderedDate);return t.setMonth(0),ue(12,e=>O(t,e))}(e),e.props.skipBuildCalendar?e.props.skipBuildCalendar=!1:e.value&&Ul(e)}function Gl(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 Zl(e,t){if(!t)return e.props.inputText="",new Date;const o=t instanceof Date?t:A(t,e.props.valueFormat,e.props.valueLocale);return e.props.inputText=e.props.formatDate(o,e.props.format,e.props.locale,!1,Yl),o}function Xl(e){return Array.isArray(e.props.sequence)?a(e.props.sequence):["day"]}function Jl(e,t,o=!0){var n,r;if(e._value===t)return;if(null==t)return e.input(t,o);e.props.offset=e.props.timezone?S(t,e.props.timezone):"+0000";const s=K(t,null!==(n=(r=e.props).offset)&&void 0!==n?n:r.offset="+0000");e.input(L(s,e.props.valueFormat,e.props.valueLocale,!1),o)}function Ql(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 ei(e,t){let o="";if(!(t instanceof HTMLInputElement)||e.props.pickerOnly)return;Hl.set(e,t);const n=t=>{e.props.expanded&&t.target instanceof HTMLElement&&t.target.closest(`#${e.props.id}_popover`)?Kl.add(e):Kl.delete(e)},r=e.props.__root;r&&(r.addEventListener("click",n),gt(e,()=>r.removeEventListener("click",n))),e.on("prop:inputText",({payload:e})=>{e!==t.value&&("beforeCallback"===ka.get(t)&&(o=t.value),Ha(t),t.selectionStart=0,t.selectionEnd=t.value.length,function(e,t){var o,n;if(!ua.has(e))return;const r=null!==(o=La.get(e))&&void 0!==o?o:"",s=null!==(n=Ia.get(e))&&void 0!==n?n:"";Xa(e,{type:"insert",selectionBefore:Za(e),data:t,valueBefore:e.value,suffix:s,prefix:r})}(t,e),t.value=e,setTimeout(()=>Ra(t),10))});const[s,a]=oi(e);Ba(t,{pattern:s,explicitParts:a,onChange:({valueAfter:n})=>{if(ti(e),Fl.has(e))return Fl.delete(e);o&&o===n?o="":(Ha(t),e.props.inputText=n,setTimeout(()=>Ra(t),10))}},e)}function ti(e){var t,o;if(e.props.overlay){const n=Hl.get(e);!n||!(null===(t=e.props.attrs)||void 0===t?void 0:t.placeholder)||e._value||Tl(n,!0)||e.props._isFocused||e.props.activeDate&&e.props.expanded?n&&(e.props._isPlaceholder=!1,e.props._overlayParts=ut(El(n))):(e.props._isPlaceholder=!0,e.props._overlayParts=[{type:"placeholder",value:null===(o=e.props.attrs)||void 0===o?void 0:o.placeholder}])}}function oi(e){const t=e.props.locale,o=["full","long","medium","short"].includes(e.props.format)||"object"==typeof e.props.format,n=D(e.props.format,t);return[N(e.props.format,t,!0,Yl),n.reduce((n,r)=>{if("literal"===r.partName)return n;let s=C(r.token,t,o);if("YYYY"===r.token&&e.props.minDate&&e.props.maxDate){const t=e.props.minDate.getFullYear();s=ue(e.props.maxDate.getFullYear()-t+1,e=>String(t+e))}const a={type:"enum",token:r.token,values:s,placeholder:"A"===r.token?"A/P":r.token,selectDirection:"left"};return n.push(a),r.token.startsWith("D")&&Rl.set(e,s),n},[])]}function ni(e,t){const o=Rl.get(e),n=t||e.props.activeDate;if((e._value||t)&&o&&n){const e=W(n);if(o.length>e)o.splice(e,o.length-e);else if(o.length<e)for(let t=o.length+1;t<=e;t++)o.push(String(t))}}function ri(e,t){return!t||(!(!e.props.minDate||!U(t,e.props.minDate))||(!(!e.props.maxDate||!Y(t,e.props.maxDate))||void 0))}function si(e){return"function"==typeof e.props.validationLabel?e.props.validationLabel(e):e.props.validationLabel||e.props.label||e.props.name||String(e.name)}const ai="undefined"!=typeof window,li=new WeakMap;function ii(e,t){var o,n;if(t instanceof HTMLInputElement&&!li.get(e)&&ai){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){li.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 pi(e){e.addProps(["_overlayStyles","_overlayParts","_overlayInnerStyles","_isPlaceholder"]),e.props._overlayParts=[],e.props._overlayStyles={position:"absolute",top:"0",left:"0",pointerEvents:e.props._isPlaceholder?"auto":"none"},e.props._overlayInnerStyles={overflow:"hidden",whiteSpace:"nowrap",paddingRight:"20px"},e.on("created",()=>{e.props.overlay=r(e.props.overlay),e.props.pickerOnly=r(e.props.pickerOnly),e.props.overlay=e.props.pickerOnly?void 0:e.props.overlay,e.props.overlay&&s(`${e.props.id}`,ii.bind(null,e),e.props.__root)}),e.on("prop:_isPlaceholder",()=>{e.props._overlayStyles={...e.props._overlayStyles,pointerEvents:e.props._isPlaceholder?"auto":"none"}})}const di={schema:/* #__PURE__ */gs(/* #__PURE__ */$s(/* #__PURE__ */xs("$label"),/* #__PURE__ */bs(/* #__PURE__ */ys("prefix"),/* #__PURE__ */ws(),/* #__PURE__ */ia(/* #__PURE__ */da(/* #__PURE__ */pa(/* #__PURE__ */ra("$part.value"),/* #__PURE__ */sa("$part.value"),/* #__PURE__ */aa("$part.value"),/* #__PURE__ */la("$part.value")))),/* #__PURE__ */Is(),/* #__PURE__ */As(/* #__PURE__ */js(/* #__PURE__ */Ts(/* #__PURE__ */Es("$ui.prev.value"),/* #__PURE__ */ys("prev")),/* #__PURE__ */qs("$decade"),/* #__PURE__ */zs(/* #__PURE__ */Xs()),/* #__PURE__ */Gs(/* #__PURE__ */Js(),/* #__PURE__ */Xs()),/* #__PURE__ */Zs(/* #__PURE__ */Js(),/* #__PURE__ */Qs(),/* #__PURE__ */Xs()),/* #__PURE__ */Cs(/* #__PURE__ */Ds("$ui.next.value"),/* #__PURE__ */ys("next")),/* #__PURE__ */na(/* #__PURE__ */ys("close"))),/* #__PURE__ */ca(/* #__PURE__ */Ks(/* #__PURE__ */Ws("$fns.format($year, $yearFormat)")),/* #__PURE__ */Us(/* #__PURE__ */Ys("$fns.format($month, $monthFormat)")),/* #__PURE__ */Os(/* #__PURE__ */Vs(/* #__PURE__ */Fs(/* #__PURE__ */Ps("$fns.format($day, $weekdayFormat)"))),/* #__PURE__ */Ms(/* #__PURE__ */Bs(/* #__PURE__ */Hs(/* #__PURE__ */Rs("$fns.format($day, $dateFormat)"))))),/* #__PURE__ */ta(/* #__PURE__ */oa()))),/* #__PURE__ */ea(/* #__PURE__ */ys("clear")),/* #__PURE__ */Ns(/* #__PURE__ */ys("calendar")),/* #__PURE__ */_s(),/* #__PURE__ */ys("suffix"))),/* #__PURE__ */ks("$help"),/* #__PURE__ */Ss(/* #__PURE__ */Ls("$message.value"))),type:"input",family:"text",props:["dateFormat","dayButtonFormat","format","monthButtonFormat","monthFormat","overlay","pickerOnly","showMonths","showPagination","weekStart","weekdayFormat","yearFormat","years"],features:[pi,function(e){var t,o,n,a,l,i,d,c,u,f,v,h,m,g,$,b,y,x,w,_,k,K;e.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"]),e.hook.prop((t,o)=>("expanded"===t.prop&&e.props.disabled&&(t.value=!1),"weekStart"===t.prop&&(t.value=Number(t.value||0)),"showMonths"===t.prop&&(t.value=Number(t.value||1)),"maxScan"===t.prop&&(t.value=Number(t.value||7)),"timezone"===t.prop&&("string"==typeof e._value||e._value instanceof Date)&&(e.props.offset=S(e._value,t.value)),o(t))),e.props._isFocused=!1,e.props._isPlaceholder=!1,null!==(t=(h=e.props).valueFormat)&&void 0!==t||(h.valueFormat="ISO8601"),null!==(o=(m=e.props).weekdayFormat)&&void 0!==o||(m.weekdayFormat="d"),null!==(n=(g=e.props).monthFormat)&&void 0!==n||(g.monthFormat="MMM"),null!==(a=($=e.props).monthButtonFormat)&&void 0!==a||($.monthButtonFormat="MMMM"),null!==(l=(b=e.props).dayButtonFormat)&&void 0!==l||(b.dayButtonFormat="D"),null!==(i=(y=e.props).dateFormat)&&void 0!==i||(y.dateFormat="D"),null!==(d=(x=e.props).yearFormat)&&void 0!==d||(x.yearFormat="YYYY"),null!==(c=(w=e.props).paginatedPanels)&&void 0!==c||(w.paginatedPanels=["day","year"]),null!==(u=(_=e.props).valueLocale)&&void 0!==u||(_.valueLocale=e.props.locale),null!==(f=(k=e.props).format)&&void 0!==f||(k.format="long"),e.props.panels=Xl(e),e.props.pickerOnly=r(e.props.pickerOnly),"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),"clearable"in e.props&&(e.props.clearable=r(e.props.clearable)),null!==(v=(K=e.props).maxScan)&&void 0!==v||(K.maxScan=7),e.props._isDisabled="function"==typeof e.props.disabledDays?e.props.disabledDays.bind(null,e):ri.bind(null,e),e.props.calendar=[],e.props.inputText="",e.props.showMonths=e.props.showMonths||1,"function"==typeof e.props.format?(e.props.formatDate=e.props.format,e.props.format=null):e.props.formatDate=L,zl(e),e.on("mounted",()=>{s(`${e.props.id}`,ei.bind(null,e),e.props.__root)}),e.on("created",()=>{if(function(e){const t=e._value;let o=new Date;if(t instanceof Date)o=R(t);else if("string"==typeof t)try{const n=A(t,e.props.valueFormat,e.props.valueLocale);o=R(n)}catch{console.warn(`Date (${t}) does not match format (${N(e.props.valueFormat,e.props.valueLocale)})`),o=void 0}else t||(o=void 0);if(e.props.offset=e.props.timezone?S(o||new Date,e.props.timezone):"+0000",e.props.minDate){const t="string"==typeof e.props.minDate?A(e.props.minDate):e.props.minDate;e.props.minDate=B(t,e.props.offset)}if(e.props.maxDate){const t="string"==typeof e.props.maxDate?A(e.props.maxDate):e.props.maxDate;e.props.maxDate=B(t,e.props.offset)}o=o&&B(o,e.props.offset),o&&Jl(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&&L(o,"HH:mm")||"12:00"}(e),e.context){const t={};let o;e.context.fns.format=(o,n)=>{if(t[n]&&t[n][o.toString()])return t[n][o.toString()];const r=L(o,n,e.props.locale||"en",!1,Yl);return t[n]?t[n][o.toString()]=r:t[n]={[o.toString()]:r},r},e.context.fns.isDisabled=e.props._isDisabled,e.context.fns.isDisabledMonth=t=>!I(t,t=>!e.props._isDisabled(t),"month"),e.context.fns.isDisabledYear=t=>!I(t,t=>!e.props._isDisabled(t),"year"),e.context.handlers._blur=t=>{var o,n;e.props._isFocused=!1,"function"==typeof(null===(o=e.context)||void 0===o?void 0:o.handlers.blur)&&(null===(n=e.context)||void 0===n||n.handlers.blur(t))},e.context.handlers.closePanel=()=>{e.props.expanded=!1},e.context.handlers._blurOut=t=>o=>{var n;o.preventDefault(),e.props.keydown?e.props.keydown=!1:t&&t!==e.props.panel||e.props.pickerOnly&&o.relatedTarget instanceof Element&&(o.relatedTarget===document.getElementById(`${e.props.id}_inner`)||o.relatedTarget.closest(`#${e.props.id}_inner`))||o.relatedTarget&&o.relatedTarget instanceof Element&&(o.relatedTarget.closest(`#${e.props.id}_popover`)||!(null===(n=e.props.__root)||void 0===n?void 0:n.contains(o.relatedTarget))||o.relatedTarget.id===`${e.props.id}_popover`)||(e.props.expanded=!1)},e.context.handlers.overlayClick=()=>{const t=Hl.get(e);t&&(t.focus(),e.props._isPlaceholder=!1)},e.context.handlers.focus=()=>{e.props.pickerOnly||(e.props._isFocused=!0,e.props.pickerOnly&&!Pl.has(e)&&(Bl.add(e),e.props.expanded=!0,setTimeout(()=>Bl.delete(e),200)))},e.context.handlers.clear=()=>{var t,o;Jl(e,void 0,!0),Zl(e,void 0);const n=null===(o=null===(t=e.props)||void 0===t?void 0:t.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);n instanceof HTMLInputElement&&(n.focus(),setTimeout(()=>{n.setSelectionRange(0,0)},50))},e.context.handlers.dateInput=t=>{var o;if(Nl.has(e))return Nl.delete(e);if(t.target instanceof HTMLInputElement&&!e.props.expanded)try{let n=A({date:t.target.value,format:e.props.format,locale:e.props.locale,partFilter:Yl});if(function(e){return D(e.props.format,e.props.locale).some(e=>"weekday"===e.partName)}(e)&&e.props.activeDate instanceof Date&&e.props.activeDate.getTime()===n.getTime()&&!Ca.get(t.target)&&L(n,e.props.format,e.props.locale,!1,Yl)!==t.target.value){const r=C("dddd",e.props.locale),s=D(e.props.format,e.props.locale),a=null===(o=T(t.target.value,s).find(e=>"dddd"===e.token))||void 0===o?void 0:o.value,l=L(n,"dddd",e.props.locale);if(a&&r.includes(a)&&l!==a){let t=r.indexOf(a)-r.indexOf(l);t=t<-1?7+t:t,n=E(n,t),Fl.add(e)}}Jl(e,n)}catch(t){Jl(e,void 0)}},e.context.handlers.open=()=>{e.props.expanded=!0},e.context.handlers.next=()=>{switch(e.props.panel){case"year":return void(e.props.renderedDate=M(e.props.renderedDate,10));case"day":return void(e.props.renderedDate=O(e.props.renderedDate,1))}},e.context.handlers.prev=()=>{switch(e.props.panel){case"year":return void(e.props.renderedDate=M(e.props.renderedDate,-10));case"day":return void(e.props.renderedDate=O(e.props.renderedDate,-1))}},e.context.handlers.setDate=t=>()=>{"month"!==e.props.panel&&"year"!==e.props.panel||!e.props.activeDate||(t=e.props.activeDate),e.emit("dateSelected",t)},e.context.handlers.localTime=t=>{const o=t.target;if(!o.value)return;const[n,r]=o.value.split(":");e.props.localTime=o.value,e.props.activeDate.setHours(n,r),Zl(e,e.props.activeDate)},e.context.handlers.keyDown=t=>{switch(e.props.keydown=!0,e.props.panel){case"day":return e.emit("calendarKeydown",t);case"year":return e.emit("yearKeydown",t);case"month":return e.emit("monthKeydown",t);case"time":return e.emit("timeKeydown",t);default:return}},e.context.handlers.inputKeydown=t=>{e.emit("keydown",t)},e.context.handlers.openKeydown=t=>{"Enter"!==t.key&&"Space"!==t.key||(e.props.expanded=!0)},e.context.handlers.mouseEnter=t=>n=>{if(clearTimeout(o),n.target instanceof HTMLElement&&"-1"===n.target.getAttribute("tabindex")&&"true"!==n.target.getAttribute("data-is-extra"))if("month"===e.props.panel||"year"===e.props.panel){const o=I(t,()=>!0,e.props.panel);o&&(e.props.activeDate=o)}else e.props.activeDate=t},e.context.handlers.mouseLeave=()=>{clearTimeout(o),o=setTimeout(()=>{},100)},e.context.handlers.jumpTo=t=>()=>{e.props.panels.unshift(e.props.panel),e.props.panel=t},e.context.fns.sameDay=t=>function(e,t){return t instanceof Date&&H(e,t)}(t,e.props.activeDate),e.context.fns.sameMonth=t=>ql(t,e.props.activeDate),e.context.fns.sameYear=t=>jl(t,e.props.activeDate),e.context.fns.notInMonth=(e,t)=>{const o=V(t).getTime();return o<F(e).getTime()||o>P(e).getTime()||void 0}}});const W=Gl.bind(null,e);gt(e,()=>{document.removeEventListener("click",W)}),e.on("prop:panel",({payload:t})=>{e.props.showPagination=e.props.paginatedPanels.includes(t)}),e.on("dateSelected",({payload:t})=>{var o,n;Array.isArray(e.props.panels)&&e.props.panels.length?e.props.panel=e.props.panels.shift():(e.props.expanded=!1,null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`))||void 0===n||n.focus()),t&&e.props._isDisabled(t)||Jl(e,t)}),e.on("input",({payload:t})=>{if(void 0===t&&!e.props._isFocused)return void Zl(e,void 0);const o=new Date,n=t&&B("string"==typeof t?A(t,e.props.valueFormat,e.props.valueLocale):t,e.props.offset);n&&ni(e,n);const r=n?Zl(e,n):o;e.props.activeDate=!t&&e.props.activeDate?e.props.activeDate:r,e.props.renderedDate=!t&&e.props.renderedDate?e.props.renderedDate:r,e.props.localTime=L(r,"HH:mm"),ni(e)}),e.on("prop:renderedDate",zl.bind(null,e)),e.on("prop:expanded",({payload:t})=>{if(t){if(Kl.delete(e),e.props.panels=Xl(e),e.props.panel=e.props.panels.shift(),window.innerWidth<=430&&!window.matchMedia("(hover: hover)").matches?e.props.showPanelClose=!0:e.props.showPanelClose=!1,"day"===e.props.panel){const t=e.props.activeDate;e.props.activeDate=I(e.props.activeDate,t=>!e.props._isDisabled(t),"month")||t}zl(e),s(`${e.props.id}_popover`,t=>{const o=t.querySelector('[tabindex="0"]');o&&setTimeout(()=>{o.focus(),function(e,t){const o=$t(e,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())})}(e,t)},0)},e.props.__root),Vl&&setTimeout(()=>{document.addEventListener("click",W)},10)}else{if(e.props.activeDate=e.props.renderedDate,"time"===e.props.panel)e.emit("dateSelected",e.props.activeDate);else if(e._value){Nl.add(e);const t="string"==typeof e._value?A(e._value,e.props.valueFormat,e.props.valueLocale):e._value;Zl(e,B(t,e.props.offset))}else Zl(e,void 0);Vl&&(Pl.add(e),document.removeEventListener("click",W),setTimeout(()=>Pl.delete(e),50))}}),e.on("prop:activeDate",({payload:t})=>{if(Array.isArray(e.props.calendar)&&e.props.calendar.length)if("day"===e.props.panel){const o=e.props.calendar,n=F(e.props.renderedDate),r=P(O(e.props.renderedDate,o.length-1));t.getTime()<n.getTime()?e.props.renderedDate=O(e.props.renderedDate,-1):t.getTime()>r.getTime()&&(e.props.renderedDate=O(e.props.renderedDate))}else if("year"===e.props.panel){const o=e.props.years,n=o[0].getFullYear(),r=o[o.length-1].getFullYear(),s=e.props.activeDate.getFullYear();s>r?e.props.renderedDate=M(e.props.renderedDate,10):s<n?e.props.renderedDate=M(e.props.renderedDate,-10):(e.props.skipBuildCalendar=!0,e.props.renderedDate=t)}e.props.expanded&&Zl(e,e.props.activeDate)}),e.on("keydown",({payload:t})=>{switch(t.key){case"ArrowDown":case"ArrowUp":case" ":t.preventDefault(),e.props.pickerOnly&&(e.props.expanded=!0);break;case"Enter":case"Return":e.props.expanded||(e.props.expanded=!0);break;case"Escape":e.props.expanded=!1}}),e.on("calendarKeydown",({payload:t})=>{t.preventDefault();let o=null,n=0;switch(t.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":e.emit("dateSelected",e.props.activeDate);break;case"Tab":t.shiftKey||Ql(e,t);break;case"Escape":e.props.expanded=!1}if(n&&(t.preventDefault(),o=E(e.props.activeDate,n)),o&&!e.props._isDisabled(o))e.props.activeDate=o;else if(o&&e.props._isDisabled(o)){const t=n>0?1:-1;ue(Number(e.props.maxScan),e=>t*e).some(t=>{const n=E(o,t);return!e.props._isDisabled(n)&&(e.props.activeDate=n,!0)})}}),e.on("yearKeydown",({payload:t})=>{let o=0;switch(t.key){case"ArrowDown":o=5;break;case"ArrowRight":o=1;break;case"ArrowUp":o=-5;break;case"ArrowLeft":o=-1;break;case"Tab":t.shiftKey||Ql(e,t);break;case"Return":case"Enter":e.emit("dateSelected",e.props.activeDate);break;case"Escape":e.props.expanded=!1}const n=e.props.activeDate.getFullYear()+o-e.props.renderedDate.getFullYear();e.props.activeDate=M(e.props.renderedDate,n)}),e.on("monthKeydown",({payload:t})=>{let o=0;switch(t.key){case"ArrowDown":o=3;break;case"ArrowRight":o=1;break;case"ArrowLeft":o=-1;break;case"ArrowUp":o=-3;break;case"Tab":t.shiftKey||Ql(e,t);break;case"Return":case"Enter":e.emit("dateSelected",e.props.activeDate);break;case"Escape":e.props.expanded=!1}o&&t.preventDefault();let n=(e.props.activeDate.getMonth()+o)%12;n=n<0?12+n:n;const r=n-e.props.renderedDate.getMonth();let s=O(e.props.renderedDate,r);if(e.props._isDisabled(s)){const t=I(s,t=>!e.props._isDisabled(t),"month");t&&(s=t)}e.props.activeDate=s}),e.on("timeKeydown",({payload:t})=>{switch(t.key){case"Return":case"Enter":t.preventDefault(),e.emit("dateSelected",e.props.activeDate)}}),e.on("prop:_isFocused",()=>{Hl.get(e)&&ti(e)}),e.on("commit",({payload:t})=>{if(t?Ul(e):Wl(e),e.props.activeDate&&e.props._isDisabled(e.props.activeDate)){const t=p({blocking:!0,key:"rule_invalidDate",meta:{messageKey:"invalidDate",removeImmediately:!1,localize:!0,i18nArgs:[{node:e,name:si(e),args:[]}]},type:"validation",value:"The selected date is invalid."});e.store.set(t)}else e.store.remove("rule_invalidDate")})},Yo,
|
|
29
|
+
/* #__PURE__ */ho.bind(null,is,ps,Is),en]},Cs=/* #__PURE__ */Te("dp"),{outer:Ds,wrapper:Ts,inner:Os,icon:Es,label:Ms,prefix:Vs,suffix:Fs,help:Ps,messages:Bs,message:Hs}=/* #__PURE__ */Oe(Cs),Ns=Cs("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"}})),Rs=Cs("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","data-side":'$invertPopover && "top" || "bottom"',style:{if:"$usePopover",then:{margin:0,top:'$invertPopover && ($popoverCoordinates.y - $popoverCoordinates.height - $popoverOffset - $popoverAncestorCoordinates.height) + "px" || ($popoverCoordinates.y + $popoverOffset) + "px"',left:'$popoverCoordinates.x + "px"',width:'$popoverCoordinates.width + "px"'}}}})),Ks=Cs("next",()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _next_button",type:"button",onClick:"$handlers.next"}})),Ws=Cs("nextLabel","span"),Us=Cs("prev",()=>({$el:"button",if:"$showPagination",attrs:{id:"$id + _prev_button",type:"button",onClick:"$handlers.prev"}})),Ys=Cs("prevLabel","span"),js=Cs("calendar",()=>({if:'$panel === "day"',$el:"table",for:["month","$calendar"],attrs:{key:'$fns.format($month.monthDay, "YYYY-MM")',role:"grid"}})),qs=Cs("calendarWeeks",()=>({$el:"tbody",attrs:{role:"rowgroup"}})),zs=Cs("calendarHeader",()=>({$el:"thead",attrs:{role:"rowgroup"}})),Gs=Cs("weekDays",()=>({$el:"tr",attrs:{role:"row"}})),Zs=Cs("weekDay",()=>({$el:"th",for:["day","$month.weeks.0"],attrs:{role:"columnheader","aria-label":'$fns.format($day, "dddd")'}})),Xs=Cs("week",()=>({$el:"tr",for:["week","weekIndex","$month.weeks"],attrs:{role:"row"}})),Js=Cs("dayCell",()=>({$el:"td",for:["day","dayIndex","$week"],attrs:{key:"$day",role:"gridcell",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-disabled":"$fns.isDisabled($day)","aria-selected":"$selectedWeek === $weekIndex && $selectedDay === $dayIndex","aria-label":'$fns.format($day, "long")'}})),Qs=Cs("day","div"),ea=Cs("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":"dialog","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_popover" || undefined'}})),ta=Cs("years",()=>({if:'$panel === "year"',$el:"ul",attrs:{id:'$id + "_years"'}})),oa=Cs("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)"}})),na=Cs("months",()=>({if:'$panel === "month"',$el:"ul"})),ra=Cs("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)"}})),sa=Cs("panelHeader",()=>({$el:"header",attrs:{"aria-live":"polite"}})),aa=Cs("yearsHeader",()=>({$el:"div",if:'$panel === "year"'})),la=Cs("monthsHeader",()=>({$el:"div",if:'$panel === "month"'})),ia=Cs("daysHeader",()=>({$el:"div",if:'$panel === "day"'})),pa=Cs("timeHeader",()=>({$el:"div",if:'$panel === "time"'})),da=Cs("yearButton",()=>({$el:"button",attrs:{type:"button",id:"$id + _year_button",onClick:"$handlers.jumpTo(year)"},children:"$fns.format($renderedDate, $yearFormat)"})),ca=Cs("monthButton",()=>({$el:"button",attrs:{type:"button",id:"$id + _month_button",onClick:"$handlers.jumpTo(month)"},children:"$fns.format($renderedDate, $monthButtonFormat)"})),ua=Cs("dayButton",()=>({$el:"button",attrs:{type:"button",id:"$id + _day_button",onClick:"$handlers.jumpTo(day)",tabindex:"2"},children:"$fns.format($renderedDate, $dayButtonFormat)"})),fa=Cs("removeSelection",()=>({$el:"button",if:"$clearable && $_value",attrs:{id:'$id + "_remove_selection"',type:"button",onClick:"$handlers.clear","aria-controls":"$id"}})),va=Cs("time",()=>({$el:"div",if:'$panel === "time"'})),ha=Cs("timeInput",()=>({$el:"input",attrs:{type:"time",value:"$localTime",onInput:"$handlers.localTime",onKeydown:"$handlers.keyDown",spellcheck:"false",onBlur:"$handlers._blurOut(time)"}})),ma=Cs("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:ga,overlayLiteral:$a,overlayChar:ba,overlayEnum:ya,overlay:xa,overlayParts:wa,overlayInner:ka}=/* #__PURE__ */Ee(Cs),_a=Cs("panel","div"),Sa=/* #__PURE__ */new WeakMap,La=/* #__PURE__ */new WeakMap,Ia=new WeakSet,Aa=/* #__PURE__ */new WeakMap,Ca=/* #__PURE__ */new WeakMap,Da=new WeakSet,Ta=/* #__PURE__ */new WeakMap,Oa=/[\uD800-\uDBFF]/,Ea=/* #__PURE__ */new WeakMap,Ma=/* #__PURE__ */new WeakMap,Va=/* #__PURE__ */new WeakMap,Fa=/* #__PURE__ */new WeakMap,Pa=/* #__PURE__ */new WeakMap,Ba=new WeakSet,Ha=/* #__PURE__ */new WeakMap,Na=/* #__PURE__ */new WeakMap,Ra=/* #__PURE__ */new WeakMap,Ka=/* #__PURE__ */new WeakMap;let Wa=!1;const Ua=()=>{Wa=!0,setTimeout(()=>{Wa=!1},500)},Ya={"#":{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"}},ja=/* #__PURE__ */new WeakMap,qa=/* #__PURE__ */new WeakMap,za="undefined"!=typeof window;let Ga=!1,Za=!1;function Xa(){za&&!Za&&(Za=!0,document.addEventListener("selectionchange",()=>{const e=ft();if(!(e instanceof HTMLInputElement))return;if(Ka.has(e))return function(e){const t=Ka.get(e);if(t){const[o,n]=t,[r,s]=Pl(e),a=s.indexOf(o);if(-1===a)return void Ka.delete(e);const l=r[a],i=[l[0]+n[0],l[1],"none"];cl(ul(e),i)||$l(e,i)}}(e);if("select"!==Ta.get(e))return;const t=ul(e);if(!cl(t,ja.get(e))){if(ja.set(e,t),Ia.has(e))return Ia.delete(e);e.dispatchEvent(new CustomEvent("selection",{detail:ul(e)}))}}))}function Ja(e,t,o){const n=qa.get(e);if(!n)return!1;qa.delete(e);const r=function(e,t,o){if(o)return o;const[n,r]=t.selection,s=t.value.substring(0,n),a=t.value.substring(r);let l=e.value;return l.startsWith(s)&&(l=l.substring(s.length)),a&&l.endsWith(a)&&(l=l.substring(0,l.length-a.length)),l}(e,n,t);return e.value=n.value,e.setSelectionRange(...n.selection),fl(e,{type:"insert",selectionBefore:n.selection,data:r,valueBefore:n.value,suffix:o.suffix,prefix:o.prefix}),!0}function Qa(e,t,o){var n;if(Xa(),Sa.has(e))return;Sa.set(e,[]),nl(e,t),sl(e,t.pattern,t.partOverrides,t.explicitParts);const r=Ca.get(e),s=null==r?void 0:r.some(e=>il(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)&&Da.add(e),Ta.set(e,l),t.onChange&&Fa.set(e,t.onChange);let i=!1;e.addEventListener("beforeinput",o=>{if(Ga)return;if("insertLineBreak"===o.inputType)return;if(qa.has(e)||o.isComposing||"insertCompositionText"===o.inputType)return void(i=!0);if(o.inputType.startsWith("history"))return function(e,t){e.addEventListener("input",o=>{var n;o.preventDefault(),o.stopImmediatePropagation();const r=Sa.get(e);if(null==r?void 0:r.length){const o=(null!==(n=La.get(e))&&void 0!==n?n:r.length-1)+(t.endsWith("Undo")?-1:1),s=r[o];if(!s)return;bl(e,s),e.setSelectionRange(...s.selectionAfter),La.set(e,o),Fa.has(e)&&Fa.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=ul(e),a=e.value;n&&fl(e,{type:n,selectionBefore:s,data:o.data,valueBefore:a,suffix:t.suffix,prefix:t.prefix})}),e.addEventListener("compositionstart",()=>{qa.set(e,{value:e.value,selection:ul(e)})}),e.addEventListener("compositionend",o=>{Ja(e,o.data,t),i=!1}),e.addEventListener("input",n=>{const r=n;if(qa.has(e)){if(r.isComposing||"insertCompositionText"===r.inputType)return;return Ja(e,r.data,t),void(i=!1)}if(r.isComposing||"insertCompositionText"===r.inputType)return;const s=i;i=!1,"data"in n||!s&&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(),Kl(e);case"ArrowLeft":return t.preventDefault(),Kl(e,-1);case"ArrowUp":return void(Wl(e,1)&&t.preventDefault());case"ArrowDown":return void(Wl(e,-1)&&t.preventDefault());case"Tab":return Wa?void t.preventDefault():void(Kl(e,t.shiftKey?-1:1)&&t.preventDefault())}}),e.addEventListener("focus",()=>function(e){var t;const o=Da.has(e),n=Ta.get(e);if(o){let o=null,r=null,s=!1;const a="shift"===n?0:1,l=e.value;Cl(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),(ll(t)||il(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"===Ta.get(e)){const[o]=Pl(e),n=Yl(e,t);void 0!==n&&n in o&&(t=o[n])}return function(e,t,o=50){Ea.set(e,hl(e,t));const n=()=>{document.removeEventListener("selectionchange",r),Ea.delete(e)},r=async()=>{if(!za||ft()!==e)return;const t=Ta.get(e);"select"===t&&(await new Promise(e=>setTimeout(e,10)),function(e){let t=ul(e);if(t[0]===t[1]&&0===t[0]||e.value.length===t[1]&&0===t[0])return;t=ml(e,t);const[o]=Pl(e),n=Yl(e,t),r=t[0];void 0!==n&&o.some(e=>r>=e[0]&&r<e[1])&&Ea.set(e,hl(e,o[n]))}(e));const o=Ea.get(e);if(!o)return;const r=ul(e),s=r[0]===r[1]&&0===r[0]||0===r[0]&&r[1]===e.value.length;"select"===t||cl(r,o)||s?e.setSelectionRange(...o):n()};r(),document.addEventListener("selectionchange",r),setTimeout(()=>{n()},o)}(e,t)}}}(e)),e.addEventListener("selection",t=>function(e,t){if(Ea.get(e))return;Xl(e),t=ml(e,t);const[o]=Pl(e),n=Yl(e,t),r=void 0!==n&&hl(e,o[n]);r&&!cl(t,r)&&$l(e,r,!0)}(e,t.detail)),fl(e,{type:"insert",selectionBefore:[0,0,"forward"],data:e.value,valueBefore:"",suffix:t.suffix,prefix:t.prefix})}function el(e){var t,o;if(Ka.has(e))return;const n=null!==(t=Sa.get(e))&&void 0!==t?t:[],r=n[null!==(o=La.get(e))&&void 0!==o?o:n.length-1];if(r){const t=r.selectionAfter,[o,n]=Pl(e,r.valueAfter),s=Yl(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"];Ka.set(e,[r,l])}}}function tl(e){Ka.delete(e)}function ol(e,t,o){const n="string"==typeof e||!Sa.has(e),r="string"==typeof e?rl(e):e;if(nl(r,t),n)r.value=vl(r,r.value),Qa(r,t,o);else{const e=jl(r),o=r.value;r.value="",fl(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 nl(e,t){t.reverse?Ba.add(e):Ba.delete(e),t.prefix?Ha.set(e,t.prefix):Ha.delete(e),t.suffix?Na.set(e,t.suffix):Na.delete(e)}function rl(e){return{value:e,selectionStart:0,selectionEnd:0,scrollWidth:0,clientWidth:0,addEventListener:()=>{},dispatchEvent:()=>{},setSelectionRange:()=>{}}}function sl(e,t,o,n,r){r=e&&Ba.has(e)||r;const s=(null!=n?n:function(e){const t=Object.values(Ya);if(!e)return t;const o={...e},n=[];for(const r of t)if(!dl(r)){if("token"in r&&r.token in e){const t={...r,...e[r.token]};al(t)&&n.push(t),delete o[r.token];continue}n.push(r)}const r=Object.values(o);for(const e of r)al(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=yl(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=sl(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&&Ca.set(e,c),c}function al(e){return!!e&&(dl(e)||ll(e)||il(e))}function ll(e){return!!e&&("char"===e.type&&e.pattern instanceof RegExp&&pl(e))}function il(e){return!!e&&("enum"===e.type&&Array.isArray(e.values)&&pl(e))}function pl(e){return!!e&&("placeholder"in e&&"token"in e)}function dl(e){return!!e&&("literal"===e.type&&"string"==typeof e.value)}function cl(e,t){return e===t||void 0!==e&&void 0!==t&&(e[0]===t[0]&&e[1]===t[1])}function ul(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 fl(e,t){var o;Ba.has(e)&&(gl(t),Zl(t));let n=!1;switch(Pa.set(e,"playing"),t.type){case"insert":n=function(e,t){let o=gl(t);const n=t.selectionBefore,r=function(e,t){var o,n,r;if("select"===Ta.get(e)){const[s,a]=Pl(e),l=[...t.selectionBefore],i=function(e,t){const[o]=t,n=o.findIndex(t=>cl(t,e.selectionBefore));if(-1!==n)return n;const[r,s]=e.selectionBefore,a=o.findIndex(e=>r===s?r>=e[0]&&r<=e[1]:r>=e[0]&&s<=e[1]);return-1===a?void 0:a}(t,[s,a]),p=void 0===i?void 0:s[i],d=void 0===i?null:null!==(o=a[i])&&void 0!==o?o:null;if(!p)return"";if(ll(d)){t.selectionBefore=p;const e=p[1]-p[0],o=t.valueBefore.substring(p[0],p[1]),s="left"===d.selectDirection,a=Il(o,d);""===t.valueBefore&&"string"==typeof t.data&&t.data.includes(d.placeholder)&&(t.data=Il(t.data,d));const l=s?0:function(e,t,o){if(!e)return 0;let n="";for(;e.length;){const o=yl(e);e=e.substring(o.length),t.pattern.test(o)&&(n+=o)}return Math.min(Math.max(n.length,1),o)}(t.data,d,e),i=s?0:Math.max(1,l);if(a.length>=e)return s||(t.insertPos=p[1]-l),(null!==(n=d.selectFill)&&void 0!==n?n:d.placeholder).repeat(e);const c=Math.max(0,e-a.length-i),u=(null!==(r=d.selectFill)&&void 0!==r?r:d.placeholder).repeat(c);return t.insertPos=s?p[0]+a.length:p[1]-l,"left"===d.selectDirection?`${a}${u}`:`${u}${a}${d.placeholder}`}if(il(d)){const e=t.valueBefore.substring(p[0],l[0]);return l[0]>p[0]&&(l[0]<p[1]||Nl(d.values,e))&&(t.insertPos=l[0]),t.selectionBefore=p,t.valueBefore.substring(p[0],p[1])}}return""}(e,t);o=`${o.substring(0,n[0])}${r}${o.substring(n[1])}`;const s=Cl(e,t,o);return Aa.set(e,s.endPos),{...t,valueAfter:s.value,selectionAfter:Al(e,s),unmasked:s.unmasked,complete:s.complete,meta:s.meta}}(e,t);break;case"deleteContentBackward":case"deleteContentForward":n=function(e,t){const o=gl(t),n=t.selectionBefore,r=Ba.has(e);let s=n[0],a=n[1];s===a&&("deleteContentBackward"!==t.type||r?a+=xl(o,s):s-=xl(o,s,"backward"));const l=Ta.get(e);let i="";if("select"===l){const[o,n]=Pl(e),r=Yl(e,[s,a,"none"]);if(void 0!==r){const l=n[r],p=o[r];ll(l)?i=l.placeholder.repeat(a-s):il(l)&&([i,s]=cl(p,ul(e))?[l.placeholder,s]:function(e,t,o,n){const r=n.valueBefore,s=xl(r,n.selectionBefore[0],"backward"),a=Math.max(o[0],n.selectionBefore[0]-s),l=r.substring(o[0],a),i=Hl(t.values,l);let p=null==i?void 0:i.substring(l.length);i&&!p&&Nl(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=Cl(e,t,p);return{...t,valueAfter:d.value,selectionAfter:Ml(e,d,t,s),unmasked:d.unmasked,complete:d.complete,meta:d.meta}}(e,t)}if(Ba.has(e)&&n&&Zl(n),n&&function(e,t){t.prefix&&(t.valueAfter=t.prefix+t.valueAfter,t.selectionAfter=hl(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)){Fa.has(e)&&Ra.set(e,()=>{Ra.delete(e),n&&Fa.get(e)(n,e)}),Pa.set(e,"beforeCallback");let t=null!==(o=Sa.get(e))&&void 0!==o?o:[];const r=La.get(e);r&&(t=t.slice(0,r),La.delete(e)),t.push(n),Sa.set(e,t),za&&ft()===e&&"function"==typeof document.execCommand&&!Ga?($l(e,[0,e.value.length,"forward"],!0),Ga=!0,document.execCommand("insertText",void 0,n.valueAfter),Ga=!1):bl(e,n),za&&ft()===e&&$l(e,n.selectionAfter);const s=Ra.get(e);s&&s(),Xl(e)}Pa.set(e,"complete")}function vl(e,t){var o,n;const r=null!==(o=Ha.get(e))&&void 0!==o?o:"",s=null!==(n=Na.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 hl(e,t){const o=Ha.get(e),n=[...t];return o&&(n[0]+=o.length,n[1]+=o.length),n}function ml(e,t){const o=Ha.get(e),n=[...t];return o&&(n[0]-=o.length,n[1]-=o.length),n}function gl(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 $l(e,t,o=!1){o&&(Ia.add(e),setTimeout(()=>Ia.delete(e),5)),Ea.get(e)&&Ea.set(e,t),e.setSelectionRange(...t)}function bl(e,t,o="After"){if(e.value=t[`value${o}`],za){const o=new InputEvent("input",{inputType:"insert"===t.type?"insertText":t.type,data:t.data});e.dispatchEvent(o)}}function yl(e){if(null==e)return"";const t=Oa.test(e.charAt(0))&&Oa.test(e.charAt(1))?2:1;return e.substring(0,t)}function xl(e,t,o="forward"){if("backward"===o)return 0===t?0:1===t?1:Oa.test(e.charAt(t))&&Oa.test(e.charAt(t-1))?2:1;const n=e.length-t;return 0===n?0:1===n?1:yl(e.substring(t)).length}function wl(e,t){const o=yl(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 kl(e){const t=yl(e.buffer),o=t.length;e.value+=t,e.pos+=o,e.buffer=e.buffer.substring(o)}function _l(e,t){const o=yl(t),n=o.length;return e.value+=o,e.pos+=n,t.substring(n)}function Sl(e,t){for(;t.buffer;){const o=yl(t.buffer);if(e.pattern.test(o)||t.placeholder&&zl(e,o))return void("replace"!==t.mode&&"select"!==t.mode||(t.buffer=t.buffer.substring(o.length)));t.buffer=t.buffer.substring(o.length)}}function Ll(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(xl(t.buffer,0))}return null}function Il(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 Al(e,t){let o=[t.endPos,t.endPos,"forward"];if("select"!==t.mode)return o;const n=ul(e);o=[n[0],t.endPos,"none"];const[r,s]=Pl(e,t.value),a=Yl(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(ll(i)&&Il(p,i).length===p.length&&a<r.length-1)return Ua(),r[a+1];if(il(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=Hl(o.values,r);if(s)return Fl(r,s).length-n.length;return 0}(t,l[0],i);if(t.insertPos+o===l[1])return Nl(i.values,p)?[l[1],l[1],"forward"]:(Ua(),r[a+1]?r[a+1]:r[a]);const s=[t.insertPos+o,l[1],"none"];return cl(s,n)||(Ia.add(e),setTimeout(()=>Ia.delete(e),5)),s}return l}function Cl(e,t,o,n){var r,s;const a=null!==(r=Ca.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:Da.has(e),buffer:o,data:t.data,originalData:t.data,value:"",mode:Ta.get(e)||"replace",endPos:t.selectionBefore[0],rangeParts:Pl(e),unmasked:"",complete:!0,cycle:t.cycle,meta:[]};return Dl(a,l,void 0,n),l}function Dl(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":Ol(o,t,e.at(-1)===o);break;case"char":El(o,t,l);break;case"enum":Tl(o,t);break;case"group":const a={repeat:null!==(s=o.repeat)&&void 0!==s&&s,nextPart:r,repeats:0,placeholder:!!o.placeholder};Dl(o.parts,t,a,n)}if(n){if(!1===n(t,o))break}const a=dl(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++,Dl(e,t,o,n);if(!s){t.complete=!1;const o=e.reverse().find(e=>"literal"===e.type);e.reverse(),dl(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 Tl(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=function(e,t){if(!Rl(e)||0===t.length)return null;const o=t.toLowerCase(),n=e.values.some(e=>e.toLowerCase()===o);if(n||t.length>=e.values[0].length)return null;const r=e.values.filter(e=>e.toLowerCase().startsWith(o));return r.length>1?`${t}${e.placeholder.slice(t.length)}`:null}(e,n);if(r){const s=Fl(n,r),a=s.length-o.length;return t.data=t.data.substring(a),t.value+=r,t.unmasked+=n,t.complete=!1,t.meta.push({type:"placeholder",value:r}),t.buffer=t.buffer.substring(e.values[0].length),t.endPos=t.pos+s.length,void(t.pos=t.value.length)}const s=Hl(e.values.concat([e.placeholder]),n);if(s){const r=Fl(n,s);return t.data=t.data.substring(r.length),t.value+=s,s!==e.placeholder?t.unmasked+=s:t.complete=!1,t.meta.push({type:s!==e.placeholder?"enum":"placeholder",value:s}),o?t.buffer=t.buffer.substring(o.length):Ll(e,t),t.endPos=t.pos+r.length,void(t.pos=t.value.length)}t.data=""}if(t.buffer){const o=Ll(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 Ol(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?yl(t.data):"",s=yl(n);if(e===s)n=wl(t,n),t.meta.push({type:"literal",value:s}),r=!0;else if(!r||t.data||null===t.data||t.placeholder||o)n=_l(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 El(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=yl(t.data);if(e.pattern.test(n))return wl(t),t.meta.push({type:"char",value:n}),t.chars++,t.unmasked+=n,void Sl(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=yl(t.buffer);if(t.placeholder&&zl(e,n))return kl(t),void t.meta.push({type:"placeholder",value:n});if(e.pattern.test(n))return t.chars++,t.unmasked+=n,kl(t),void t.meta.push({type:"char",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 Ml(e,t,o,n){const r=[n,n,"none"];if("select"===t.mode){const s=Pl(e),a=Yl(e,r,s),[l,i]=Pl(e,t.value),p=void 0!==a&&Vl(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)=>Vl(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 Vl(e,t,o){if(dl(o))return!1;if(ll(o)){let n=t[0];for(;n<t[1];){const t=yl(e.substring(n));if(!zl(o,t))return!1;n+=t.length}}return!il(o)||e.substring(t[0],t[1])===o.placeholder}function Fl(e,t){let o="";do{const n=yl(e).toLowerCase(),r=yl(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 Pl(e,t){const o=Ca.get(e);if(!o)return[[],[]];if(Ma.has(e))return Ma.get(e);const n=null!=t?t:vl(e,e.value),r=[],s=[];let a=null,l=null,i=0,p=!0;for(const e of o)if(dl(e))a=e,null!==l&&(r.push([l,i,"none"]),l=null),i+=e.value.length;else{if(ll(a)&&ll(e)&&e.token===a.token)i++;else if(ll(e))null===l?(l=i,s.push(e)):(r.push([l,i,"none"]),l=i,s.push(e)),i++;else if(il(e)){l&&r.push([l,i,"none"]),Rl(e)||(p=!1);const t=Bl(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&&Ma.set(e,d),d}function Bl(e,t,o){if(Rl(t))return t.values[0].length;const n=e.slice(o),r=Hl(t.values.concat([t.placeholder]),n);return r?r.length:0}function Hl(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=yl(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=Hl(l,t.substring(s.length),o,a))&&void 0!==r?r:l[0])}function Nl(e,t){return t=t.toLowerCase(),e.some(e=>(e=e.toLowerCase()).startsWith(t.toLocaleLowerCase())&&e!==t)}function Rl(e){if(!Va.has(e)&&Array.isArray(e.values)&&e.values.length>0){const t=e.values[0].length;if(e.placeholder.length!==t)return!1;Va.set(e,e.values.every(e=>e.length===t))}return Va.get(e)}function Kl(e,t=1){const[o]=Pl(e),n=Yl(e,ml(e,ul(e)));return void 0!==n&&void 0!==o[n+t]&&(e.setSelectionRange(...hl(e,o[n+t])),!0)}function Wl(e,t=1){const[o,n]=Pl(e),r=Yl(e,ul(e));if(void 0!==r&&r in n){const s=n[r];if(il(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(()=>fl(e,t),0),!0}}}return!1}function Ul(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 Ul(e.slice(...r),t)}function Yl(e,t,o){const[n]=null!=o?o:Pl(e),r=n.findIndex(e=>e[0]!==e[1]&&(!!cl(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=Ul([...s],0===t[0]&&t[1]===e.value.length?0:t[1]);return l in a?a[l]:void 0}function jl(e){var t,o;const n=null!==(t=Sa.get(e))&&void 0!==t?t:[];return n[null!==(o=La.get(e))&&void 0!==o?o:n.length-1]}function ql(e,t=!1){const o=jl(e);return o&&(o.complete||t)?Ba.has(e)?[...o.unmasked].reverse().join(""):o.unmasked:t?"":null}function zl(e,t){return t===e.placeholder||t===e.selectFill}function Gl(e){var t;const o=jl(e);return null!==(t=null==o?void 0:o.meta)&&void 0!==t?t:null}function Zl(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 Xl(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}))}}function Jl(e,t){var o,n;if(!Sa.has(e))return;const r=null!==(o=Ha.get(e))&&void 0!==o?o:"",s=null!==(n=Na.get(e))&&void 0!==n?n:"";fl(e,{type:"insert",selectionBefore:ul(e),data:t,valueBefore:e.value,suffix:s,prefix:r})}const Ql="undefined"!=typeof window,ei=new WeakSet,ti=new WeakSet,oi=new WeakSet,ni=new WeakMap,ri=new WeakMap,si=new WeakSet,ai=new WeakSet,li=new Map,ii="datepicker_invalidDate";function pi(e){e.props.selectedMonth=e.props.selectedYear=e.props.selectedDay=e.props.selectedWeek=void 0}function di(e){var t,o,n;e.props.selectedMonth=e.props.months.findIndex(t=>fi(t,e.props.activeDate)),e.props.selectedYear=e.props.years.findIndex(t=>ui(t,e.props.activeDate));for(let r=0;r<(null===(t=e.props.calendar[0])||void 0===t?void 0:t.weeks.length);r++)for(let t=0;t<(null===(o=e.props.calendar[0])||void 0===o?void 0:o.weeks[r].length);t++){const o=null===(n=e.props.calendar[0])||void 0===n?void 0:n.weeks[r][t];if(H(o,e.props.activeDate)){e.props.selectedWeek=r,e.props.selectedDay=t;break}}}function ci(e){return"timeZoneName"!==e.partName}function ui(e,t){return t instanceof Date&&e.getFullYear()===t.getFullYear()}function fi(e,t){return t instanceof Date&&e.getMonth()===t.getMonth()}function vi(e){e.props.skipBuildCalendar||pi(e),e.props.selectedIndex=e.props.calendar=ue(e.props.showMonths,e=>e).map(t=>function(e,t){const o=[],n=N(t);n.setDate(1);let r=j(n,e.props.weekStart);r.setHours(n.getHours(),n.getMinutes(),n.getSeconds());const s=q(P(t),e.props.weekStart);let a=[];do{a.push(r),7===a.length&&(o.push(a),a=[]),r=O(r)}while(r.getTime()<=s.getTime());return{monthDay:n,weeks:o}}(e,E(e.props.renderedDate,t))),e.props.years=function(e){const t=Number(L(e.props.renderedDate,"YYYY")),o=t-t%10;return e.props.decade=`${o} - ${o+9}`,ue(10,n=>M(e.props.renderedDate,o+n-t))}(e),e.props.months=function(e){const t=N(e.props.renderedDate);return t.setMonth(0),ue(12,e=>E(t,e))}(e),e.props.skipBuildCalendar?e.props.skipBuildCalendar=!1:e.value&&di(e)}function hi(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 mi(e){var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`))||void 0===o||o.focus()}function gi(e,t){if(!t)return e.props.inputText="",new Date;const o=t instanceof Date?t:yi(e,t);return e.props.inputText=e.props.formatDate(o,e.props.format,e.props.locale,!1,ci),o}function $i(e){return Array.isArray(e.props.sequence)?a(e.props.sequence):["day"]}function bi(e,t,o=!0){var n,r;if(e._value===t)return;if(null==t)return e.input(t,o);e.props.offset=e.props.timezone?S(t,e.props.timezone):"+0000";const s=K(t,null!==(n=(r=e.props).offset)&&void 0!==n?n:r.offset="+0000");e.input(function(e,t){return L(t,e.props.valueFormat,e.props.valueLocale,!1)}(e,s),o)}function yi(e,t){const o=A(t,e.props.valueFormat,e.props.valueLocale);return function(e,t){if("ISO8601"===e.props.valueFormat||"buddhist"!==function(e){if(!e)return;if(li.has(e))return li.get(e);let t;try{t=new Intl.DateTimeFormat(e).resolvedOptions().calendar}catch{t=void 0}return li.set(e,t),t}(e.props.valueLocale))return!1;const o=function(e,t,o){if(!o)return;try{const n=D(t,o).filter(ci),r=T(e,n).find(e=>"year"===e.partName),s=Number(null==r?void 0:r.value);return Number.isFinite(s)?s:void 0}catch{return}}(t,e.props.valueFormat,e.props.valueLocale);return"number"==typeof o&&o>=2400}(e,t)?M(o,-543):o}function xi(e){return"string"==typeof e?e.replace(/_/g,"-"):e}function wi(e){if(void 0!==e._value&&null!==e._value&&""!==e._value&&e.props.activeDate&&e.props._isDisabled(e.props.activeDate)){const t=p({blocking:!0,key:ii,meta:{messageKey:"invalidDate",removeImmediately:!1,localize:!0,i18nArgs:[{node:e,name:Ci(e),args:[]}]},type:"validation",value:"The selected date is invalid."});e.store.set(t)}else e.store.remove(ii)}function ki(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 _i(e,t){let o="";if(!(t instanceof HTMLInputElement)||e.props.pickerOnly)return;ni.set(e,t);const n=t=>{e.props.expanded&&t.target instanceof HTMLElement&&t.target.closest(`#${e.props.id}_popover`)?ai.add(e):ai.delete(e)},r=e.props.__root;r&&(r.addEventListener("click",n),gt(e,()=>r.removeEventListener("click",n))),e.on("prop:inputText",({payload:e})=>{e!==t.value&&("beforeCallback"===Pa.get(t)&&(o=t.value),el(t),t.selectionStart=0,t.selectionEnd=t.value.length,Jl(t,e),t.value=e,setTimeout(()=>tl(t),10))});const[s,a]=Li(e);si.add(e),Qa(t,{pattern:s,explicitParts:a,onChange:({valueAfter:n})=>{if(Si(e),ei.has(e))return ei.delete(e);o&&o===n?o="":(el(t),e.props.inputText=n,setTimeout(()=>tl(t),10))}},e),queueMicrotask(()=>si.delete(e))}function Si(e){var t,o;if(e.props.overlay){const n=ni.get(e);!n||!(null===(t=e.props.attrs)||void 0===t?void 0:t.placeholder)||e._value||ql(n,!0)||e.props._isFocused||e.props.activeDate&&e.props.expanded?n&&(e.props._isPlaceholder=!1,e.props._overlayParts=ut(Gl(n))):(e.props._isPlaceholder=!0,e.props._overlayParts=[{type:"placeholder",value:null===(o=e.props.attrs)||void 0===o?void 0:o.placeholder}])}}function Li(e){const t=e.props.locale,o=["full","long","medium","short"].includes(e.props.format)||"object"==typeof e.props.format,n=D(e.props.format,t);return[R(e.props.format,t,!0,ci),n.reduce((n,r)=>{if("literal"===r.partName)return n;let s=C(r.token,t,o);if("YYYY"===r.token&&e.props.minDate&&e.props.maxDate){const t=e.props.minDate.getFullYear();s=ue(e.props.maxDate.getFullYear()-t+1,e=>String(t+e));const o=function(e){const t=e._value;try{if(t instanceof Date)return t.getFullYear();if("string"==typeof t)return A(t,e.props.valueFormat,e.props.valueLocale).getFullYear()}catch{return}return}(e);o&&!s.includes(String(o))&&(s.push(String(o)),s.sort((e,t)=>Number(e)-Number(t)))}const a={type:"enum",token:r.token,values:s,placeholder:"A"===r.token?"A/P":r.token,selectDirection:"left"};return n.push(a),r.token.startsWith("D")&&ri.set(e,s),n},[])]}function Ii(e,t){const o=ri.get(e),n=t||e.props.activeDate;if((e._value||t)&&o&&n){const e=W(n);if(o.length>e)o.splice(e,o.length-e);else if(o.length<e)for(let t=o.length+1;t<=e;t++)o.push(String(t))}}function Ai(e,t){return!t||(!(!e.props.minDate||!U(t,e.props.minDate))||(!(!e.props.maxDate||!Y(t,e.props.maxDate))||void 0))}function Ci(e){return"function"==typeof e.props.validationLabel?e.props.validationLabel(e):e.props.validationLabel||e.props.label||e.props.name||String(e.name)}const Di="undefined"!=typeof window,Ti=new WeakMap;function Oi(e,t){var o,n;if(t instanceof HTMLInputElement&&!Ti.get(e)&&Di){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){Ti.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 Ei(e){e.addProps(["_overlayStyles","_overlayParts","_overlayInnerStyles","_isPlaceholder"]),e.props._overlayParts=[],e.props._overlayStyles={position:"absolute",top:"0",left:"0",pointerEvents:e.props._isPlaceholder?"auto":"none"},e.props._overlayInnerStyles={overflow:"hidden",whiteSpace:"nowrap",paddingRight:"20px"},e.on("created",()=>{e.props.overlay=r(e.props.overlay),e.props.pickerOnly=r(e.props.pickerOnly),e.props.overlay=e.props.pickerOnly?void 0:e.props.overlay,e.props.overlay&&s(`${e.props.id}`,Oi.bind(null,e),e.props.__root)}),e.on("prop:_isPlaceholder",()=>{e.props._overlayStyles={...e.props._overlayStyles,pointerEvents:e.props._isPlaceholder?"auto":"none"}})}const Mi={schema:/* #__PURE__ */Ds(/* #__PURE__ */Ts(/* #__PURE__ */Ms("$label"),/* #__PURE__ */Os(/* #__PURE__ */Es("prefix"),/* #__PURE__ */Vs(),/* #__PURE__ */xa(/* #__PURE__ */ka(/* #__PURE__ */wa(/* #__PURE__ */ga("$part.value"),/* #__PURE__ */$a("$part.value"),/* #__PURE__ */ba("$part.value"),/* #__PURE__ */ya("$part.value")))),/* #__PURE__ */Ns(),/* #__PURE__ */Rs(/* #__PURE__ */sa(/* #__PURE__ */Us(/* #__PURE__ */Ys("$ui.prev.value"),/* #__PURE__ */Es("prev")),/* #__PURE__ */aa("$decade"),/* #__PURE__ */la(/* #__PURE__ */da()),/* #__PURE__ */ia(/* #__PURE__ */ca(),/* #__PURE__ */da()),/* #__PURE__ */pa(/* #__PURE__ */ca(),/* #__PURE__ */ua(),/* #__PURE__ */da()),/* #__PURE__ */Ks(/* #__PURE__ */Ws("$ui.next.value"),/* #__PURE__ */Es("next")),/* #__PURE__ */ma(/* #__PURE__ */Es("close"))),/* #__PURE__ */_a(/* #__PURE__ */ta(/* #__PURE__ */oa("$fns.format($year, $yearFormat)")),/* #__PURE__ */na(/* #__PURE__ */ra("$fns.format($month, $monthFormat)")),/* #__PURE__ */js(/* #__PURE__ */zs(/* #__PURE__ */Gs(/* #__PURE__ */Zs("$fns.format($day, $weekdayFormat)"))),/* #__PURE__ */qs(/* #__PURE__ */Xs(/* #__PURE__ */Js(/* #__PURE__ */Qs("$fns.format($day, $dateFormat)"))))),/* #__PURE__ */va(/* #__PURE__ */ha()))),/* #__PURE__ */fa(/* #__PURE__ */Es("clear")),/* #__PURE__ */ea(/* #__PURE__ */Es("calendar")),/* #__PURE__ */Fs(),/* #__PURE__ */Es("suffix"))),/* #__PURE__ */Ps("$help"),/* #__PURE__ */Bs(/* #__PURE__ */Hs("$message.value"))),type:"input",family:"text",props:["dateFormat","dayButtonFormat","format","monthButtonFormat","monthFormat","overlay","pickerOnly","showMonths","showPagination","weekStart","weekdayFormat","yearFormat","years"],features:[Ei,function(e){var t,o,n,a,l,i,p,d,c,u,f,v,h,m,g,$,b,y,x,w,k;e.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"]),e.hook.prop((t,o)=>("expanded"===t.prop&&e.props.disabled&&(t.value=!1),"weekStart"===t.prop&&(t.value=Number(t.value||0)),"showMonths"===t.prop&&(t.value=Number(t.value||1)),"maxScan"===t.prop&&(t.value=Number(t.value||7)),"timezone"===t.prop&&("string"==typeof e._value||e._value instanceof Date)&&(e.props.offset=S(e._value,t.value)),o(t))),e.props._isFocused=!1,e.props._isPlaceholder=!1,null!==(t=(v=e.props).valueFormat)&&void 0!==t||(v.valueFormat="ISO8601"),null!==(o=(h=e.props).weekdayFormat)&&void 0!==o||(h.weekdayFormat="d"),null!==(n=(m=e.props).monthFormat)&&void 0!==n||(m.monthFormat="MMM"),null!==(a=(g=e.props).monthButtonFormat)&&void 0!==a||(g.monthButtonFormat="MMMM"),null!==(l=($=e.props).dayButtonFormat)&&void 0!==l||($.dayButtonFormat="D"),null!==(i=(b=e.props).dateFormat)&&void 0!==i||(b.dateFormat="D"),null!==(p=(y=e.props).yearFormat)&&void 0!==p||(y.yearFormat="YYYY"),null!==(d=(x=e.props).paginatedPanels)&&void 0!==d||(x.paginatedPanels=["day","year"]),e.props.locale=xi(e.props.locale),e.props.valueLocale=xi(null!==(c=e.props.valueLocale)&&void 0!==c?c:e.props.locale),null!==(u=(w=e.props).format)&&void 0!==u||(w.format="long"),e.props.panels=$i(e),e.props.pickerOnly=r(e.props.pickerOnly),"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),"clearable"in e.props&&(e.props.clearable=r(e.props.clearable)),null!==(f=(k=e.props).maxScan)&&void 0!==f||(k.maxScan=7),e.props._isDisabled="function"==typeof e.props.disabledDays?e.props.disabledDays.bind(null,e):Ai.bind(null,e),e.props.calendar=[],e.props.inputText="",e.props.showMonths=e.props.showMonths||1,"function"==typeof e.props.format?(e.props.formatDate=e.props.format,e.props.format=null):e.props.formatDate=L,vi(e),e.on("mounted",()=>{s(`${e.props.id}`,_i.bind(null,e),e.props.__root)}),e.on("created",()=>{if(function(e){const t=e._value;let o=new Date;if(t instanceof Date)o=N(t);else if("string"==typeof t)try{const n=yi(e,t);o=N(n)}catch{console.warn(`Date (${t}) does not match format (${R(e.props.valueFormat,e.props.valueLocale)})`),o=void 0}else t||(o=void 0);if(e.props.offset=e.props.timezone?S(o||new Date,e.props.timezone):"+0000",e.props.minDate){const t="string"==typeof e.props.minDate?A(e.props.minDate):e.props.minDate;e.props.minDate=B(t,e.props.offset)}if(e.props.maxDate){const t="string"==typeof e.props.maxDate?A(e.props.maxDate):e.props.maxDate;e.props.maxDate=B(t,e.props.offset)}o=o&&B(o,e.props.offset),o&&bi(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&&L(o,"HH:mm")||"12:00"}(e),e.context){const t={};let o;e.context.fns.format=(o,n)=>{if(t[n]&&t[n][o.toString()])return t[n][o.toString()];const r=L(o,n,e.props.locale||"en",!1,ci);return t[n]?t[n][o.toString()]=r:t[n]={[o.toString()]:r},r},e.context.fns.isDisabled=e.props._isDisabled,e.context.fns.isDisabledMonth=t=>!I(t,t=>!e.props._isDisabled(t),"month"),e.context.fns.isDisabledYear=t=>!I(t,t=>!e.props._isDisabled(t),"year"),e.context.handlers._blur=t=>{var o,n;e.props._isFocused=!1,"function"==typeof(null===(o=e.context)||void 0===o?void 0:o.handlers.blur)&&(null===(n=e.context)||void 0===n||n.handlers.blur(t))},e.context.handlers.closePanel=()=>{e.props.expanded=!1,mi(e)},e.context.handlers._blurOut=t=>o=>{var n;o.preventDefault(),e.props.keydown?e.props.keydown=!1:t&&t!==e.props.panel||e.props.pickerOnly&&o.relatedTarget instanceof Element&&(o.relatedTarget===document.getElementById(`${e.props.id}_inner`)||o.relatedTarget.closest(`#${e.props.id}_inner`))||o.relatedTarget&&o.relatedTarget instanceof Element&&(o.relatedTarget.closest(`#${e.props.id}_popover`)||!(null===(n=e.props.__root)||void 0===n?void 0:n.contains(o.relatedTarget))||o.relatedTarget.id===`${e.props.id}_popover`)||(e.props.expanded=!1,mi(e))},e.context.handlers.overlayClick=()=>{const t=ni.get(e);t&&(t.focus(),e.props._isPlaceholder=!1)},e.context.handlers.focus=()=>{e.props.pickerOnly||(e.props._isFocused=!0,e.props.pickerOnly&&!ti.has(e)&&(oi.add(e),e.props.expanded=!0,setTimeout(()=>oi.delete(e),200)))},e.context.handlers.clear=()=>{var t,o;bi(e,void 0,!0),gi(e,void 0),function(e){const t=ni.get(e);t&&(el(t),t.selectionStart=0,t.selectionEnd=t.value.length,Jl(t,""),setTimeout(()=>tl(t),10))}(e);const n=null===(o=null===(t=e.props)||void 0===t?void 0:t.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);n instanceof HTMLInputElement&&(n.focus(),setTimeout(()=>{n.setSelectionRange(0,0)},50))},e.context.handlers.dateInput=t=>{var o;if(si.has(e))return si.delete(e);if(t.target instanceof HTMLInputElement&&!e.props.expanded)try{let n=A({date:t.target.value,format:e.props.format,locale:e.props.locale,partFilter:ci});if(function(e){return D(e.props.format,e.props.locale).some(e=>"weekday"===e.partName)}(e)&&e.props.activeDate instanceof Date&&e.props.activeDate.getTime()===n.getTime()&&!Ka.get(t.target)&&L(n,e.props.format,e.props.locale,!1,ci)!==t.target.value){const r=C("dddd",e.props.locale),s=D(e.props.format,e.props.locale),a=null===(o=T(t.target.value,s).find(e=>"dddd"===e.token))||void 0===o?void 0:o.value,l=L(n,"dddd",e.props.locale);if(a&&r.includes(a)&&l!==a){let t=r.indexOf(a)-r.indexOf(l);t=t<-1?7+t:t,n=O(n,t),ei.add(e)}}bi(e,n)}catch(t){bi(e,void 0)}},e.context.handlers.open=()=>{e.props.expanded=!0},e.context.handlers.next=()=>{switch(e.props.panel){case"year":return void(e.props.renderedDate=M(e.props.renderedDate,10));case"day":return void(e.props.renderedDate=E(e.props.renderedDate,1))}},e.context.handlers.prev=()=>{switch(e.props.panel){case"year":return void(e.props.renderedDate=M(e.props.renderedDate,-10));case"day":return void(e.props.renderedDate=E(e.props.renderedDate,-1))}},e.context.handlers.setDate=t=>()=>{"month"!==e.props.panel&&"year"!==e.props.panel||!e.props.activeDate||(t=e.props.activeDate),e.emit("dateSelected",t)},e.context.handlers.localTime=t=>{const o=t.target;if(!o.value)return;const[n,r]=o.value.split(":");e.props.localTime=o.value,e.props.activeDate.setHours(n,r),gi(e,e.props.activeDate)},e.context.handlers.keyDown=t=>{switch(e.props.keydown=!0,e.props.panel){case"day":return e.emit("calendarKeydown",t);case"year":return e.emit("yearKeydown",t);case"month":return e.emit("monthKeydown",t);case"time":return e.emit("timeKeydown",t);default:return}},e.context.handlers.inputKeydown=t=>{e.emit("keydown",t)},e.context.handlers.openKeydown=t=>{"Enter"!==t.key&&" "!==t.key&&"Space"!==t.key&&"Spacebar"!==t.key||(t.preventDefault(),e.props.expanded=!0)},e.context.handlers.mouseEnter=t=>n=>{if(clearTimeout(o),n.target instanceof HTMLElement&&"-1"===n.target.getAttribute("tabindex")&&"true"!==n.target.getAttribute("data-is-extra"))if("month"===e.props.panel||"year"===e.props.panel){const o=I(t,()=>!0,e.props.panel);o&&(e.props.activeDate=o)}else e.props.activeDate=t},e.context.handlers.mouseLeave=()=>{clearTimeout(o),o=setTimeout(()=>{},100)},e.context.handlers.jumpTo=t=>()=>{e.props.panels.unshift(e.props.panel),e.props.panel=t},e.context.fns.sameDay=t=>function(e,t){return t instanceof Date&&H(e,t)}(t,e.props.activeDate),e.context.fns.sameMonth=t=>fi(t,e.props.activeDate),e.context.fns.sameYear=t=>ui(t,e.props.activeDate),e.context.fns.notInMonth=(e,t)=>{const o=V(t).getTime();return o<F(e).getTime()||o>P(e).getTime()||void 0}}});const _=hi.bind(null,e);gt(e,()=>{document.removeEventListener("click",_)}),e.on("prop:panel",({payload:t})=>{e.props.showPagination=e.props.paginatedPanels.includes(t)}),e.on("dateSelected",({payload:t})=>{Array.isArray(e.props.panels)&&e.props.panels.length?e.props.panel=e.props.panels.shift():(e.props.expanded=!1,mi(e)),t&&e.props._isDisabled(t)||bi(e,t)}),e.on("input",({payload:t})=>{if(void 0===t&&!e.props._isFocused)return void gi(e,void 0);const o=new Date,n=t&&("string"==typeof t?yi(e,t):t);n&&e.props.timezone&&(e.props.offset=S(n,e.props.timezone));const r=n&&B(n,e.props.offset);r&&Ii(e,r);const s=r?gi(e,r):o;e.props.activeDate=!t&&e.props.activeDate?e.props.activeDate:s,e.props.renderedDate=!t&&e.props.renderedDate?e.props.renderedDate:s,e.props.localTime=L(s,"HH:mm"),Ii(e)}),e.on("prop:renderedDate",vi.bind(null,e)),e.on("prop:validation",()=>{setTimeout(()=>wi(e))}),e.on("prop:expanded",({payload:t})=>{if(t){if(ai.delete(e),e.props.panels=$i(e),e.props.panel=e.props.panels.shift(),window.innerWidth<=430&&!window.matchMedia("(hover: hover)").matches?e.props.showPanelClose=!0:e.props.showPanelClose=!1,"day"===e.props.panel){const t=e.props.activeDate;e.props.activeDate=I(e.props.activeDate,t=>!e.props._isDisabled(t),"month")||t}vi(e),s(`${e.props.id}_popover`,t=>{const o=t.querySelector('[tabindex="0"]');o&&setTimeout(()=>{o.focus(),function(e,t){const o=$t(e,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())})}(e,t)},0)},e.props.__root),Ql&&setTimeout(()=>{document.addEventListener("click",_)},10)}else{if(e.props.activeDate=e.props.renderedDate,"time"===e.props.panel)e.emit("dateSelected",e.props.activeDate);else if(e._value){si.add(e);const t="string"==typeof e._value?yi(e,e._value):e._value;gi(e,B(t,e.props.offset))}else gi(e,void 0);Ql&&(ti.add(e),document.removeEventListener("click",_),setTimeout(()=>ti.delete(e),50))}}),e.on("prop:activeDate",({payload:t})=>{if(Array.isArray(e.props.calendar)&&e.props.calendar.length)if("day"===e.props.panel){const o=e.props.calendar,n=F(e.props.renderedDate),r=P(E(e.props.renderedDate,o.length-1));t.getTime()<n.getTime()?e.props.renderedDate=E(e.props.renderedDate,-1):t.getTime()>r.getTime()&&(e.props.renderedDate=E(e.props.renderedDate))}else if("year"===e.props.panel){const o=e.props.years,n=o[0].getFullYear(),r=o[o.length-1].getFullYear(),s=e.props.activeDate.getFullYear();s>r?e.props.renderedDate=M(e.props.renderedDate,10):s<n?e.props.renderedDate=M(e.props.renderedDate,-10):(e.props.skipBuildCalendar=!0,e.props.renderedDate=t)}e.props.expanded&&gi(e,e.props.activeDate)}),e.on("keydown",({payload:t})=>{switch(t.key){case"ArrowDown":case"ArrowUp":case" ":t.preventDefault(),e.props.pickerOnly&&(e.props.expanded=!0);break;case"Enter":case"Return":e.props.pickerOnly&&!e.props.expanded&&(t.preventDefault(),e.props.expanded=!0);break;case"Escape":e.props.expanded=!1,mi(e)}}),e.on("calendarKeydown",({payload:t})=>{t.preventDefault();let o=null,n=0;switch(t.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":case" ":case"Space":case"Spacebar":e.emit("dateSelected",e.props.activeDate);break;case"Tab":t.shiftKey||ki(e,t);break;case"Escape":e.props.expanded=!1,mi(e)}if(n&&(t.preventDefault(),o=O(e.props.activeDate,n)),o&&!e.props._isDisabled(o))e.props.activeDate=o;else if(o&&e.props._isDisabled(o)){const t=n>0?1:-1;ue(Number(e.props.maxScan),e=>t*e).some(t=>{const n=O(o,t);return!e.props._isDisabled(n)&&(e.props.activeDate=n,!0)})}}),e.on("yearKeydown",({payload:t})=>{let o=0;switch(t.key){case"ArrowDown":o=5;break;case"ArrowRight":o=1;break;case"ArrowUp":o=-5;break;case"ArrowLeft":o=-1;break;case"Tab":t.shiftKey||ki(e,t);break;case"Return":case"Enter":case" ":case"Space":case"Spacebar":e.emit("dateSelected",e.props.activeDate);break;case"Escape":e.props.expanded=!1,mi(e)}const n=e.props.activeDate.getFullYear()+o-e.props.renderedDate.getFullYear();e.props.activeDate=M(e.props.renderedDate,n)}),e.on("monthKeydown",({payload:t})=>{let o=0;switch(t.key){case"ArrowDown":o=3;break;case"ArrowRight":o=1;break;case"ArrowLeft":o=-1;break;case"ArrowUp":o=-3;break;case"Tab":t.shiftKey||ki(e,t);break;case"Return":case"Enter":case" ":case"Space":case"Spacebar":e.emit("dateSelected",e.props.activeDate);break;case"Escape":e.props.expanded=!1,mi(e)}o&&t.preventDefault();let n=(e.props.activeDate.getMonth()+o)%12;n=n<0?12+n:n;const r=n-e.props.renderedDate.getMonth();let s=E(e.props.renderedDate,r);if(e.props._isDisabled(s)){const t=I(s,t=>!e.props._isDisabled(t),"month");t&&(s=t)}e.props.activeDate=s}),e.on("timeKeydown",({payload:t})=>{switch(t.key){case"Return":case"Enter":t.preventDefault(),e.emit("dateSelected",e.props.activeDate)}}),e.on("prop:_isFocused",()=>{ni.get(e)&&Si(e)}),e.on("commit",({payload:t})=>{t?di(e):pi(e),e.props.activeDate&&e.props._isDisabled(e.props.activeDate)?wi(e):e.store.remove(ii)})},en,
|
|
30
30
|
/* #__PURE__ */$("next"),
|
|
31
31
|
/* #__PURE__ */$("prev"),
|
|
32
32
|
/* #__PURE__ */$("changeDate"),
|
|
@@ -35,8 +35,8 @@ import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailab
|
|
|
35
35
|
/* #__PURE__ */g("next","right"),
|
|
36
36
|
/* #__PURE__ */g("clear","close"),
|
|
37
37
|
/* #__PURE__ */g("prev","left"),
|
|
38
|
-
/* #__PURE__ */g("calendar","date")]},
|
|
39
|
-
/* #__PURE__ */
|
|
38
|
+
/* #__PURE__ */g("calendar","date")]},Vi=/* #__PURE__ */Te("tl"),{outer:Fi,wrapper:Pi,inner:Bi,icon:Hi,label:Ni,prefix:Ri,suffix:Ki,help:Wi,messages:Ui,message:Yi}=/* #__PURE__ */Oe(Vi),ji=Vi("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",name:"$node.name",tabindex:"0",placeholder:"$state.loading && $inputStd.length === 0 && $ui.isLoading.value || $placeholder || undefined",role:"combobox",autocomplete:"off",autocapitalize:"none",readonly:"$attrs.readonly || $isLoadingOption || undefined || $multiple && $max && $value && $value.length >= $max",disabled:"$disabled || $disabledInternally || undefined","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"}})),qi=Vi("listboxButton",()=>({$el:"button",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',type:"button",onClick:"$handlers.toggleListbox",tabindex:"-1","aria-label":"$expanded && $ui.close.value || $ui.open.value",disabled:"$disabled || undefined","aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined'}})),zi=Vi("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)",onFocus:"$handlers.tagFocus && $handlers.tagFocus($option)",onBlur:"$handlers.tagBlur && $handlers.tagBlur($option)",onKeydown:"$handlers.searchInputTagKeydown && $handlers.searchInputTagKeydown($option)","data-is-tag":"true","data-active-selection":"$fns.isActiveSelection && $fns.isActiveSelection($activeSelectionValue, $option)"}})),Gi=Vi("tag",()=>({$el:"div",attrs:{id:'$id + "_tag_" + $index',role:"button"}})),Zi=Vi("removeSelection",()=>({$el:"button",if:"$selections.length > 0",attrs:{id:'$id + "_remove_selection_" + $index',tabindex:"-1","aria-label":"$ui.remove.value",type:"button",onClick:"$handlers.removeSelection && $handlers.removeSelection($option)",onTouchstartPassive:"$handlers.removeSelection && $handlers.removeSelection($option)","aria-controls":"$id"}})),Xi=Vi("tagLabel",()=>({$el:"span"})),Ji=Vi("tags",()=>({$el:"div",attrs:{id:'$id + "_selections"',onClick:"$handlers.focusInput","aria-live":"polite"}})),Qi=Vi("tagLoading","span"),ep=/* #__PURE__ */Ve(Vi);function tp(e){e.props.multiple=!0,e.props.openOnClick=r(e.props.openOnClick),void 0===e.props.closeOnSelect&&(e.props.closeOnSelect=!0),e.props.closeOnSelect?e.props.resetSearchOnCommit=!1:void 0===e.props.resetSearchOnCommit&&(e.props.resetSearchOnCommit=e.props.multiple),e.props.allowNewValues=r(e.props.allowNewValues)}function op(e){Ss(e),Go(e),e.on("created",()=>{function t(){return Array.isArray(e.value)?e.value:[]}function o(t){e.input(t)}e.props.disabled&&(e.props.draggable=!1),s(`${e.props.id}_selections`,n=>{if(n instanceof HTMLElement){if(!e.context)return;const r={draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,disabled:!e.props.draggable,threshold:{horizontal:.25,vertical:0},plugins:[x()],root:e.props.__root,synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-tag"),handleEnd(t){e.props.activeSelectionValue=void 0,k(t)},dragstartClasses(t,o,n,r){e.props.activeSelectionValue=void 0,_(t,o,n,r)}};w({parent:n,getValues:t,setValues:o,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:n,getValues:t,setValues:o,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:n,getValues:t,setValues:o,config:r})})}},e.props.__root)})}const np={schema:/* #__PURE__ */Fi(/* #__PURE__ */Pi(/* #__PURE__ */Ni("$label"),/* #__PURE__ */Bi(/* #__PURE__ */Hi("prefix"),/* #__PURE__ */Ri(),/* #__PURE__ */Ji(/* #__PURE__ */zi(/* #__PURE__ */Gi(/* #__PURE__ */Me("$state.loading && $fns.hasOptionLoaderValue && $fns.hasOptionLoaderValue($option) || $option.label === undefined",/* #__PURE__ */Qi("$ui.isLoading.value"),/* #__PURE__ */Xi("$option.label")),/* #__PURE__ */Zi(/* #__PURE__ */Hi("close")))),/* #__PURE__ */ji()),/* #__PURE__ */Me("$state.loading",/* #__PURE__ */Hi("loader")),/* #__PURE__ */qi(/* #__PURE__ */Hi("select")),/* #__PURE__ */ep(),/* #__PURE__ */Ki(),/* #__PURE__ */Hi("suffix"))),/* #__PURE__ */Wi("$help"),/* #__PURE__ */Ui(/* #__PURE__ */Yi("$message.value"))),type:"input",family:"dropdown",props:[],features:[b,
|
|
39
|
+
/* #__PURE__ */ho.bind(null,tp,ps,op),
|
|
40
40
|
/* #__PURE__ */g("select","select"),
|
|
41
41
|
/* #__PURE__ */g("close","close"),
|
|
42
42
|
/* #__PURE__ */g("selected","check"),
|
|
@@ -45,7 +45,7 @@ import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailab
|
|
|
45
45
|
/* #__PURE__ */$("loadMore"),
|
|
46
46
|
/* #__PURE__ */$("remove"),
|
|
47
47
|
/* #__PURE__ */$("open"),
|
|
48
|
-
/* #__PURE__ */$("close"),Yo]},Mi=/* #__PURE__ */Te("mk"),{outer:Vi,wrapper:Fi,inner:Pi,label:Bi,prefix:Hi,suffix:Ri,help:Ni,messages:Ki,message:Wi,icon:Ui}=/* #__PURE__ */Ee(Mi),{overlayPlaceholder:Yi,overlayLiteral:ji,overlayChar:qi,overlayEnum:zi,overlay:Gi,overlayParts:Zi,overlayInner:Xi}=/* #__PURE__ */Oe(Mi),Ji=Mi("input",()=>({$el:"input",bind:"$attrs",attrs:{type:"text",disabled:"$disabled",name:"$node.name",onBlur:"$handlers.blur",onInput:"$handlers.DOMInput",value:"$_maskValue",placeholder:"$placeholder",id:"$id","aria-describedby":"$describedBy"}})),Qi=new WeakMap,ep=new WeakMap,tp=new WeakMap;function op(e,t){if(!(t instanceof HTMLInputElement))throw new Error(`Masks can only be applied to an HTMLInputElement (id: ${t.id}).`);ep.set(e,t),Ba(t,{...Qi.get(e),onChange:({valueAfter:t,meta:o})=>{e.props._maskValue=t,e.input({maskValue:t}),e.props._overlayParts=ut(o)}},e)}const np={schema:/* #__PURE__ */Vi(/* #__PURE__ */Fi(/* #__PURE__ */Bi("$label"),/* #__PURE__ */Pi(/* #__PURE__ */Ui("prefix"),/* #__PURE__ */Hi(),/* #__PURE__ */Gi(/* #__PURE__ */Xi(/* #__PURE__ */Zi(/* #__PURE__ */Yi("$part.value"),/* #__PURE__ */ji("$part.value"),/* #__PURE__ */qi("$part.value"),/* #__PURE__ */zi("$part.value")))),/* #__PURE__ */Ji(),/* #__PURE__ */Ri(),/* #__PURE__ */Ui("suffix"))),/* #__PURE__ */Ni("$help"),/* #__PURE__ */Ki(/* #__PURE__ */Wi("$message.value"))),type:"input",props:["allowIncomplete","mask","mode","tokens","showMask","unmaskValue","prefix","suffix","reverse","overlay"],family:"text",features:[pi,function(e){e.addProps(["_maskValue","_overlayParts"]),e.on("created",()=>{var t,o,n,a,l;const i=Ka("string"==typeof e._value?e._value:"");ep.set(e,i),tp.set(e,i),e.props.allowIncomplete=r(e.props.allowIncomplete),e.props.overlay=r(e.props.overlay);const p=!(void 0!==e.props.showMask&&!r(e.props.showMask));e.props.unmaskValue=r(e.props.unmaskValue),e.hook.prop((e,t)=>("unmaskValue"===e.prop&&(e.value=r(e)),t(e)));const d={placeholder:p,pattern:null!==(t=e.props.mask)&&void 0!==t?t:"",mode:null!==(o=e.props.mode)&&void 0!==o?o:"shift",partOverrides:null!==(n=e.props.tokens)&&void 0!==n?n:{},prefix:null!==(a=e.props.prefix)&&void 0!==a?a:void 0,suffix:null!==(l=e.props.suffix)&&void 0!==l?l:void 0,reverse:r(e.props.reverse)};Qi.set(e,d),e.hook.input((t,o)=>{const n=function(e,t){const o=ep.get(e),n="object"==typeof t&&"maskValue"in t;t="string"==typeof t?t:n?t.maskValue:"";const r=tp.get(e);r.value=Ja(r,t);const s=Na(r,Qi.get(e),e),a=Tl(r,e.props.allowIncomplete);if(t===o.value)return e.props.unmaskValue?null!=a?a:"":null===a?"":"string"==typeof t?t:"";if(""===t&&""!==o.value&&!e.props.allowIncomplete)return o.value=s,e.props._maskValue=s,e.props._overlayParts=ut(El(r)||[]),t;n||s===e.props._maskValue||(o.value=s,e.props._maskValue=s,e.props._overlayParts=ut(El(r)||[]));return null===a?"":e.props.unmaskValue?a:s}(e,t);return o(n)}),e.props._maskValue=Na(i,d,e),e.input(e.props._maskValue,!1),e.context&&(e.context.handlers.DOMInput=t=>{e.emit("dom-input-event",t)}),s(`${e.props.id}`,op.bind(null,e),e.props.__root)})}]},rp=/* #__PURE__ */Te("tf"),{outer:sp,wrapper:ap,inner:lp,icon:ip,prefix:pp,suffix:dp,help:cp,messages:up,message:fp}=/* #__PURE__ */Ee(rp),vp=rp("fieldset",()=>({$el:"fieldset",attrs:{id:'$id + "_fieldset"',role:"presentation","aria-describedby":{if:"$help",then:'$: "help-" + $id',else:void 0}}})),hp=rp("legend",()=>({if:"$label",$el:"legend"})),mp=rp("source",()=>({$el:"div",attrs:{id:'$id + "_source"',class:'$classes.transferlist + " " + $classes.source'}})),gp=rp("sourceHeader",()=>({$el:"div",attrs:{id:'$id + "_source_header"',role:"presentation",class:'$classes.transferlistHeader + " " + $classes.sourceHeader'}})),$p=rp("sourceHeaderLabel",()=>({if:"$sourceLabel",$el:"label",attrs:{id:'$id + "_source_header_label"',for:'$id + "_source_search_input"',class:'$classes.transferlistHeaderLabel + " " + $classes.sourceHeaderLabel'},children:"$sourceLabel || $label"})),bp=rp("sourceHeaderItemCount",()=>({$el:"span",attrs:{id:'$id + "_source_header_item_count"',role:"presentation","aria-label":'$sourceOptions.length " items"',class:'$classes.transferlistHeaderItemCount + " " + $classes.sourceHeaderItemCount'}})),yp=rp("targetHeaderLabel",()=>({if:"$targetLabel",$el:"label",attrs:{id:'$id + "_target_header_label"',for:'$id + "_target_search_input"',class:'$classes.transferlistHeaderLabel + " " + $classes.targetHeaderLabel'},children:"$targetLabel || $label"})),xp=rp("targetHeaderItemCount",()=>({$el:"span",attrs:{id:'$id + "_target_header_item_count"',role:"presentation","aria-label":'$targetOptions.length + " items"',class:'$classes.transferlistHeaderItemCount + " " + $classes.targetHeaderItemCount'},children:"$targetOptions.length"})),wp=rp("sourceControls",()=>({$el:"div",if:"$searchable",attrs:{id:'$id + "_source_controls"',class:'$classes.transferlistControls + " " + $classes.sourceControls'}})),_p=rp("sourceSearch",()=>({if:"$searchable",$el:"div",attrs:{id:'$id + "_source_search"',class:'$classes.transferlistSearch + " " + $classes.sourceSearch'}})),kp=rp("sourceSearchInput",()=>({$el:"input",attrs:{id:'$id + "_source_search_input"',type:"text",placeholder:"$placeholder",onInput:"$handlers.onSearch",value:"$inputText",onKeydown:"$handlers.sourceSearchKeydown",disabled:"$disabled","aria-label":"Search",role:"searchbox",autocomplete:"off",class:'$classes.transferlistSearchInput + " " + $classes.sourceSearchInput',onFocus:"$handlers.sourceSearchFocus",onBlur:"$handlers.sourceSearchBlur"}})),Sp=rp("targetSearch",()=>({if:"$targetSearchable",$el:"div",attrs:{id:'$id + "_target_search"',class:'$classes.transferlistSearch + " " + $classes.targetSearch'}})),Lp=rp("targetSearchInput",()=>({$el:"input",attrs:{id:'$id + "_target_search_input"',type:"text",placeholder:"$placeholder",onInput:"$handlers.onTargetSearch",value:"$targetInputText",onKeydown:"$handlers.targetSearchKeydown",disabled:"$disabled","aria-label":"Search",role:"searchbox",autocomplete:"off",class:'$classes.transferlistSearchInput + " " + $classes.targetSearchInput',onFocus:"$handlers.targetSearchFocus",onBlur:"$handlers.targetSearchBlur"}})),Ip=rp("targetControls",()=>({$el:"div",if:"$targetSearchable",attrs:{id:'$id + "_target_controls"',class:'$classes.transferlistControls + " " + $classes.targetControls'}})),Ap=rp("sourceSearchClear",()=>({$el:"button",if:'$inputText !== ""',attrs:{id:'$id + "_source_search_clear"',type:"button",onClick:"$handlers.clearSearch","aria-label":"Clear Source Search",class:'$classes.transferlistSearchClear + " " + $classes.sourceSearchClear'}})),Cp=rp("targetSearchClear",()=>({$el:"button",if:'$targetInputText !== ""',attrs:{id:'$id + "_target_search_clear"',type:"button",onClick:"$handlers.clearTargetSearch","aria-label":"Clear Target Search",class:'$classes.transferlistSearchClear + " " + $classes.targetSearchClear'}})),Dp=rp("sourceListItems",()=>({$el:"ul",attrs:{id:'$id + "_source_list_items"',"aria-activedescendant":"$activeDescendant",onMouseenter:"$handlers.onMouseenter(true)",onMouseout:"$handlers.onMouseleave(true)",role:"listbox","aria-multiselectable":"true","aria-roledescription":"List of options to choose from.",class:'$classes.transferlistListItems + " " + $classes.sourceListItems',onKeydown:"$handlers.sourceListKeydown",tabindex:"$searchable || $sourceOptions.length === 0 && -1 || 0",onFocus:"$handlers.sourceListFocused",onBlur:"$handlers.sourceListBlurred","aria-label":"Source list"}})),Tp=rp("sourceListItem",()=>({for:["option","index","$sourceOptions"],$el:"li",attrs:{id:'$id + "_source_list_item_" + $index',"data-value":"$option.value","aria-selected":"$transferOnSelect === false && $fns.isSelected($option, $selectedSourceItems)","data-is-active":"$fns.isActive($option, $activeValue)","data-disabled":"$option.attrs.disabled",role:"option",onClick:"$handlers.listitemClick($option, true)",onTouchstartPassive:"$handlers.listitemTouchstart($option, true)",onTouchmovePassive:"$handlers.listitemTouchmove($option, true)",onTouchend:"$handlers.listitemTouchend($option, true)",key:"$option.value",class:'$classes.transferlistListItem + " " + $classes.sourceListItem'}})),Ep=rp("sourceOption",()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option, $selectedSourceItems)",class:'$classes.transferlistOption + " " + $classes.sourceOption'}})),Op=rp("sourceLoadMore",()=>({$el:"li",if:"$state.loading || $state.hasNextPage",attrs:{id:'$id + "_source_load_more"',key:"loadMore",onClick:"$handlers.listitemClick($loadMoreOption)","aria-selected":"false","data-is-active":"$fns.isActive($loadMoreOption)",tabindex:"-1"}})),Mp=rp("loadMoreInner","span"),Vp=rp("target",()=>({$el:"div",attrs:{id:'$id + "_target"',class:'$classes.transferlist + " " + $classes.target'}})),Fp=rp("targetHeader",()=>({$el:"div",attrs:{id:'$id + "_target_header"',role:"presentation",class:'$classes.transferlistHeader + " " + $classes.targetHeader'}})),Pp=rp("targetListItems",()=>({$el:"ul",attrs:{id:"$id","aria-activedescendant":"$activeDescendant",onMouseenter:"$handlers.onMouseenter(false)",onMouseout:"$handlers.onMouseleave(false)",role:"listbox",class:'$classes.transferlistListItems + " " + $classes.targetListItems',tabindex:"$targetOptions.length === 0 && -1 || 0",onKeydown:"$handlers.targetListKeydown",onFocus:"$handlers.targetListFocused",onBlur:"$handlers.targetListBlurred","aria-label":"Target list"}})),Bp=rp("targetListItem",()=>({for:["option","index","$targetOptions"],$el:"li",attrs:{id:'$id + "_target_list_item_" + $index',"data-disabled":"$option.attrs.disabled","data-value":"$option.value","aria-selected":"$transferOnSelect === false && $fns.isSelected($option, $selectedTargetItems)","data-is-active":"$fns.isActive($option, $activeValue)",role:"option",onClick:"$handlers.listitemClick($option, false)",onTouchstartPassive:"$handlers.listitemTouchstart($option, false)",onTouchmovePassive:"$handlers.listitemTouchmove($option, false)",onTouchend:"$handlers.listitemTouchend($option, false)",key:"$option.value",class:'$classes.transferlistListItem + " " + $classes.targetListItem'}})),Hp=rp("targetOption",()=>({$el:"div",attrs:{id:'$id + "_target_list_item_" + $index + "_option"',"data-checked":"$fns.isSelected($option, $selectedTargetItems)",class:'$classes.transferlistOption + " " + $classes.targetOption'}})),Rp=rp("transferControls",()=>({$el:"div",attrs:{id:'$id + "_transfer_controls"'}})),Np=rp("transferButtonForward",()=>({if:"$transferOnSelect !== true",$el:"button",attrs:{id:'$id + "_transfer_button_forward"',type:"button",disabled:"$selectedSourceItems.length === 0 || $disabled || ($max && $value && $value.length >= $max)",onClick:"$handlers.transferForward","aria-label":"$ui.addSelectedValues.value",title:"$ui.addSelectedValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonForward'}})),Kp=rp("transferButtonForwardAll",()=>({$el:"button",attrs:{id:'$id + "_transfer_button_forward_all"',type:"button",disabled:"$sourceOptions.length === 0 || $disabled || ($max && $value && $value.length >= $max)",onClick:"$handlers.transferForwardAll","aria-label":"$ui.addAllValues.value",title:"$ui.addAllValues.value",onFocus:"$handlers.transferForwardAllFocused",class:'$classes.transferlistButton + " " + $classes.transferButtonForwardAll'}})),Wp=rp("transferButtonBackward",()=>({if:"$transferOnSelect !== true",$el:"button",attrs:{id:'$id + "_transfer_button_backward"',onClick:"$handlers.transferBackward",type:"button",disabled:"$selectedTargetItems.length === 0 || $targetOptions.length === 0 || $disabled","aria-label":"$ui.removeSelectedValues.value",title:"$ui.removeSelectedValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonBackward'}})),Up=rp("transferButtonBackwardAll",()=>({$el:"button",attrs:{id:'$id + "_transfer_button_backward_all"',onClick:"$handlers.transferBackwardAll",type:"button",disabled:"$targetOptions.length === 0 || $disabled","aria-label":"$ui.removeAllValues.value",title:"$ui.removeAllValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonBackwardAll'}})),Yp=rp("controlLabel","span"),jp=rp("sourceEmptyMessage",()=>({$el:"li",if:"$showSourceEmptyMessage && $sourceEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_source_empty_message"',key:"$sourceEmptyMessage",role:"presentation"}})),qp=rp("targetEmptyMessage",()=>({$el:"li",if:"$showTargetEmptyMessage && $targetEmptyMessage",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}})),zp=rp("emptyMessageInner","span"),Gp=Symbol(),Zp=new WeakSet,Xp=new WeakSet;function Jp(e,t,o,n){if(!(e.props.disabled||(e.props.isSourceOption=o,e.props.isSourceOption&&Array.isArray(e.value)&&e.value.length>=e.props.max)))if(o){if(e.props.selectedSourceItems.includes(t))return e.props.selectedSourceItems=e.props.selectedSourceItems.filter(e=>e!==t),e.props.activeValue=void 0,void(e.props.activeDescendant=void 0);e.props.selectedTargetItems=[],e.props.selectedSourceItems=[...e.props.selectedSourceItems,t]}else{if(e.props.selectedTargetItems.includes(t))return void(e.props.selectedTargetItems=e.props.selectedTargetItems.filter(e=>e!==t));e.props.selectedSourceItems=[],e.props.selectedTargetItems=[...e.props.selectedTargetItems,t]}}function Qp(e,t){if(e.props.sourceListOrigin=!0,e.props.maxReached)return;if(t){const o=Array.isArray(e.value)?[...e.value,t]:[t];return void e.input(o)}const o=e.props.selectedSourceItems.map(e=>vt(e));Array.isArray(e.value)?e.input([...e.value,...o]):e.input(o),e.props.selectedSourceItems=[]}function ed(e,t){if(e.props.sourceListOrigin=!1,t){const o=Array.isArray(e.value)?e.value.filter(e=>!n(e,t)):[];return void e.input(o)}const o=e.props.selectedTargetItems.map(e=>vt(e));if(Array.isArray(e.value)){const t=e.value.filter(e=>!o.includes(e));e.input(t)}e.props.selectedTargetItems=[]}function td(e){var t,o;if(e.props.activeValue===Gp){const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_source_load_more`);return void(o&&o.scrollIntoView({block:"nearest",inline:"start"}))}const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant);n&&n.scrollIntoView({block:"nearest",inline:"start"})}function od(e){var t;if(Array.isArray(e.value)){const t=[];let o=[...e.props.options];e.value.forEach(r=>{const s=e.props.memoOptions.find(e=>n(vt(e),r));if(s&&!s.noOptionFound){t.push(s);const a=e.props.options.findIndex(e=>n(vt(e),r));-1!==a&&(o=o.filter(e=>!n(vt(e),r)))}else{const e=o.find(e=>n(vt(e),r));e?(t.push(e),o=o.filter(e=>!n(vt(e),r))):t.push({label:String(r),value:r,noOptionFound:!0})}}),e.props.targetOptions=e.props.targetInputText?t.filter(t=>e.props.filter(t,e.props.targetInputText,e)):t,e.props.sourceOptions=o}else e.props.sourceOptions=[...e.props.options],e.props.targetOptions=[];if(e.props.skipSetActiveValue)return void(e.props.skipSetActiveValue=!1);(null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+"_source_list_items"))&&nd(e)}function nd(e){var t,o,n,r,s,a,l,i,p;if(e.props.isDragging)return;if(e.props.targetSearchActive){if((null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.activeElement)||void 0===o?void 0:o.id)===`${e.props.id}_target_search_input`){const t=e.props.targetOptions.find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)});return t?void(e.props.activeValue=vt(t)):void(e.props.activeValue=void 0)}return}if(e.props.sourceSearchActive){if((null===(r=null===(n=e.props.__root)||void 0===n?void 0:n.activeElement)||void 0===r?void 0:r.id)===`${e.props.id}_source_search_input`){const t=e.props.sourceOptions.find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)});return t?void(e.props.activeValue=vt(t)):void(e.props.activeValue=void 0)}e.props.sourceSearchActive=!1}if(!1===e.props.transferOnSelect)return void(e.props.activeValue=void 0);const d=e.props.sourceListOrigin?e.props.sourceOptions:e.props.targetOptions;let c=!1;for(let t=e.props.activeIndex;t<=d.length;t++)if(!(null===(s=d.attrs)||void 0===s?void 0:s.disabled)&&d[t]){c=!0,e.props.activeValue=vt(d[t]);break}if(!c&&d.length)for(let t=e.props.activeIndex;t>=0;t--)if(!(null===(a=d.attrs)||void 0===a?void 0:a.disabled)&&d[t])return c=!0,void(e.props.activeValue=vt(d[t]));if(!c){let t;t=e.props.sourceListOrigin?null===(p=e.props.__root)||void 0===p?void 0:p.getElementById(`${e.props.id}`):e.props.searchable?null===(l=e.props.__root)||void 0===l?void 0:l.getElementById(`${e.props.id}_source_search_input`):null===(i=e.props.__root)||void 0===i?void 0:i.getElementById(`${e.props.id}_source_list_items`),t&&t.focus()}}function rd(e,t){return(t?e.props.sourceOptions:e.props.targetOptions).find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})}function sd(e){Array.isArray(e.value)&&e.value.forEach(async t=>{Dt(e,t,function(e,t){const o=[...e.props.options,...e.props.memoOptions];return o.find(e=>n(vt(e),t))}(e,t))})}function ad(e){e.context&&(e.context.handlers.loadMore=St.bind(null,e),e.context.fns.getSourceItemCount=t=>!1===e.props.transferOnSelect&&t.length?t.length+"/"+e.props.sourceOptions.length:e.props.sourceOptions.length,e.context.fns.getTargetItemCount=t=>!1===e.props.transferOnSelect&&t.length?t.length+"/"+e.props.targetOptions.length:e.props.targetOptions.length,e.context.fns.isActive=(t,o)=>{if(!e.props.isDragging&&!e.props.touchStarted)return n(o,vt(t))||void 0},e.context.fns.isSelected=(e,t)=>!!t&&(!!Array.isArray(t)&&t.includes(e)),e.context.fns.optionLoading=t=>e.props.optionLoaderValues.includes(vt(t)),e.context.handlers.clearSearch=()=>{!function(e){var t;e.props.sourceSearchActive=!1,e.props.inputText="",kt(e,"",!0);const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_source_search_input`);if(!o)return;o.focus()}(e)},e.context.handlers.clearTargetSearch=()=>{!function(e){var t;e.props.targetSearchActive=!1,e.props.targetInputText="";const o=[...new Set([...e.props.options,...e.props.memoOptions])],n=[];for(const t of e.value){const e=o.find(e=>vt(e)===t);e&&n.push(e)}e.props.targetOptions=n;const r=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_target_search_input`);if(!r)return;r.focus()}(e)},e.context.handlers.sourceSearchBlur=t=>{setTimeout(()=>{var o;if(t.relatedTarget&&t.relatedTarget instanceof HTMLElement&&(t.relatedTarget.id===`${e.props.id}_source_list_items`||t.relatedTarget.id===`${e.props.id}`)){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_source_search_input`);if(!t)return;t.focus()}else e.props.activeValue=void 0})},e.context.handlers.targetSearchBlur=t=>{setTimeout(()=>{var o;if(t.relatedTarget&&t.relatedTarget instanceof HTMLElement&&(t.relatedTarget.id===`${e.props.id}_source_list_items`||t.relatedTarget.id===`${e.props.id}`)){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_target_search_input`);if(!t)return;t.focus()}else e.props.activeValue=void 0})},e.context.handlers.listitemClick=(t,o)=>n=>{ld(e,t,o)},e.context.handlers.transferForward=Qp.bind(null,e,void 0),e.context.handlers.transferForwardAll=()=>{let t;if(e.props.maxReached)return;const o=e.props.sourceOptions.map(e=>vt(e));t=Array.isArray(e.value)?[...e.value,...o]:[...o],e.input(t),e.props.selectedSourceItems=[]},e.context.handlers.transferBackward=ed.bind(null,e,void 0),e.context.handlers.transferBackwardAll=()=>{Array.isArray(e.value)&&(e.input([]),e.props.selectedTargetItems=[])},e.context.handlers.onSearch=t=>{!function(e,t){e.props.sourceSearchActive=!0;const o=t.target;e.props.inputText=o.value,kt(e,o.value,!0)}(e,t)},e.context.handlers.onTargetSearch=t=>{!function(e,t){e.props.targetSearchActive=!0;const o=t.target;e.props.targetInputText=o.value;const n=[...new Set([...e.props.memoOptions,...e.props.options])],r=[];for(const t of e.value){const e=n.find(e=>vt(e)===t);e&&r.push(e)}const s=[...new Map([...e.props.targetOptions,...r].map(e=>[JSON.stringify(e),e])).values()];e.props.targetOptions=s.filter(t=>e.props.filter(t,o.value,e)),0===e.props.targetOptions.length?e.props.showTargetEmptyMessage=!0:e.props.showTargetEmptyMessage=!1;nd(e)}(e,t)},e.context.handlers.onMouseenter=t=>o=>{"touchstart"!==o.type&&(t?e.props.mouseOnSource=!0:e.props.mouseOnTarget=!0)},e.context.handlers.onMouseleave=t=>o=>{var n;if("touchend"===o.type)return;const r=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(t?`${e.props.id}_source_list_items`:`${e.props.id}`);r&&(r.contains(o.relatedTarget)||(e.props.trackHover=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,e.props.activeIndex=void 0,t?e.props.mouseOnSource=!1:e.props.mouseOnTarget=!1))},e.context.handlers.listitemClick=(t,o)=>n=>{n instanceof MouseEvent&&e.props.touchStarted||ld(e,t,o)},e.context.handlers.listitemTouchstart=()=>()=>{!function(e){e.props.touchStarted=!0}(e)},e.context.handlers.listitemTouchend=(t,o)=>n=>{!function(e,t,o){if(e.props.touchMoved)return e.props.touchMoved=!1,void(e.props.touchStarted=!1);const n=vt(t);e.props.activeIndex=e.props.sourceOptions.findIndex(e=>vt(e)===n),e.props.transferOnSelect?o?Qp(e,n):ed(e,n):Jp(e,t,o)}(e,t,o)},e.context.handlers.listitemTouchmove=()=>t=>{!function(e){e.props.touchMoved=!0}(e)},e.context.handlers.sourceSearchFocus=t=>{id(e,!0)},e.context.handlers.targetSearchFocus=t=>{id(e,!1)},e.context.handlers.sourceListFocused=t=>{id(e,!0)},e.context.handlers.targetListFocused=()=>{id(e,!1)},e.context.handlers.sourceListBlurred=t=>{e.props.activeValue=void 0},e.context.handlers.targetListBlurred=t=>{e.props.activeValue=void 0},e.context.handlers.sourceListKeydown=t=>{pd(e,t,!0)},e.context.handlers.targetListKeydown=t=>{pd(e,t,!1)},e.context.handlers.sourceSearchKeydown=t=>{pd(e,t,!0)},e.context.handlers.targetSearchKeydown=t=>{pd(e,t,!1)})}function ld(e,t,o,r){var s;if(vt(t)===Gp)return void(null===(s=e.context)||void 0===s||s.handlers.loadMore(!0));const a=vt(t);e.props.activeIndex=e.props.sourceOptions.findIndex(e=>n(vt(e),a)),e.props.transferOnSelect?o?Qp(e,a):ed(e,a):Jp(e,t,o)}function id(e,t){const o=rd(e,t);o&&(e.props.sourceListOrigin=t,e.props.activeValue=vt(o))}function pd(e,t,o){if("ArrowDown"===t.key||"ArrowUp"===t.key)!function(e,t,o){var n,r,s;e.preventDefault();const a=o?t.props.sourceOptions:t.props.targetOptions,l=a.reduce((e,t)=>{var o;return(null===(o=null==t?void 0:t.attrs)||void 0===o?void 0:o.disabled)||e.push(vt(t)),e},[]);(null===(n=t.store.hasNextPage)||void 0===n?void 0:n.value)&&l.push(Gp);const i=l.indexOf(t.props.activeValue);if("ArrowUp"===e.key&&0!==i)for(let e=i-1;e>=0;e--){t.props.sourceListOrigin=o,t.props.activeValue=l[i-1];break}else if("ArrowDown"===e.key&&i!==l.length-1)for(let e=i+1;e<l.length;e++)if(!(null===(s=null===(r=a[e])||void 0===r?void 0:r.attrs)||void 0===s?void 0:s.disabled)){t.props.sourceListOrigin=o,t.props.activeValue=l[e];break}td(t)}(t,e,o);else if("ArrowRight"===t.key||"ArrowLeft"===t.key){if("ArrowLeft"===t.key&&o)return;if("ArrowRight"===t.key&&!o)return;!function(e,t,o){if(t.props.searchable)return;e.preventDefault(),function(e,t){var o,n,r;if(rd(e,!t))if(t){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);t&&t.focus()}else if(e.props.searchable){const t=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}_source_search_input`);t&&t.focus()}else{const t=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_source_list_items`);t&&t.focus()}}(t,o)}(t,e,o)}else"Enter"===t.key&&function(e,t,o){var n;if(e.preventDefault(),!t.props.activeValue)return;if(t.props.activeValue===Gp)return void(null===(n=t.context)||void 0===n||n.handlers.loadMore(!0));const r=o?t.props.sourceOptions:t.props.targetOptions,s=r.findIndex(e=>vt(e)===t.props.activeValue);t.props.activeIndex=s;const a=r[s];if(!a)return;t.props.transferOnSelect?o?Qp(t,vt(a)):ed(t,vt(a)):Jp(t,a,o)}(t,e,o)}function dd(e){e.on("created",()=>{if("function"==typeof e.props.optionsLoader&&(e.props.skipSetActiveValue=!0,Tt(e)),ad(e),e.props.disabled&&(e.props.draggable=!1),ee){s(e.props.id+"_source_list_items",t=>{t instanceof HTMLElement&&function(e,t){if(!e.context)return;function o(){return e.props.sourceOptions.map(e=>vt(e))}function n(){return[]}const r={longPress:!0,draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,group:e.props.id,root:e.props.__root||document,disabled:!e.props.draggable||e.props.maxReached,synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,longPressClass:e.context.classes.longTouch,multiDrag:!0,draggedNodes:({parent:t,node:o})=>cd(t,o,e.props.selectedSourceItems),dragstartClasses(t,o,n,r){e.props.isDragging=!0,e.props.trackHover=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,r&&(e.props.selectedSourceItems=[]),k(t,o,n,r)},handleEnd(t){_(t),e.props.isDragging=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,e.props.selectedTargetItems=[],e.props.selectedSourceItems=[]},draggable:e=>"option"===e.getAttribute("role")};w({parent:t,getValues:o,setValues:n,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:t,getValues:o,setValues:n,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:t,getValues:o,setValues:n,config:r})}),e.on("prop:maxReached",({payload:e})=>{r.disabled=e,w({parent:t,getValues:o,setValues:n,config:r})})}(e,t)},e.props.__root),s(`${e.props.id}`,t=>{t instanceof HTMLElement&&function(e,t){if(!e.context)return;function o(){return e.props.targetOptions.map(e=>vt(e))}function n(t,o){e.props.sourceListOrigin=!0,e.input(t)}const r={longPress:!0,root:e.props.__root,group:e.props.id,disabled:!e.props.draggable,draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,longPressClass:e.context.classes.longTouch,multiDrag:!0,draggedNodes:({parent:t,node:o})=>cd(t,o,e.props.selectedTargetItems),dragstartClasses(t,o,n,r){e.props.isDragging=!0,e.props.trackHover=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,k(t,o,n,r)},handleEnd(t){_(t),e.props.selectedTargetItems=[],e.props.selectedSourceItems=[],e.props.activeValue=void 0,e.props.trackHover=!0,e.props.isDragging=!1},draggable:e=>"option"===e.getAttribute("role")};w({parent:t,getValues:o,setValues:n,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:t,getValues:o,setValues:n,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:t,getValues:o,setValues:n,config:r})})}(e,t)},e.props.__root);const t=t=>{var o;if(e.props.isDragging)return;e.props.mouseX=t.clientX,e.props.mouseY=t.clientY;const n=e.props.mouseOnSource?`${e.props.id}_source_list_items`:`${e.props.id}`,r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(n);if(r){const o=r.getBoundingClientRect();t.clientX>o.x&&t.clientX<o.x+o.width&&t.clientY>o.y&&t.clientY<o.y+o.height&&(e.props.trackHover=!0)}};document.addEventListener("mousemove",t)}})}function cd(e,t,o=[]){const n=Array.isArray(o)?o.map(e=>vt(e)):[],r=t.data.value,s=(n.includes(r)?n:[r,...n]).reduce((t,o)=>{const n=e.data.enabledNodes.find(e=>e.data.value===o);return n&&!t.includes(n)&&t.push(n),t},[]);return s.length?s:[t]}function ud(e,t){var o;let n=null,r="",s=[];if(e.props.mouseOnSource){if(n=Zp.has(e),r=`${e.props.id}_source_list_item`,s=[...e.props.sourceOptions],!s||!s.length||n)return s=[],r="",void(n=null)}else if(e.props.mouseOnTarget&&(n=Xp.has(e),r=`${e.props.id}_target_list_item`,s=[...e.props.targetOptions],!s||!s.length||n))return s=[],r="",void(n=null);const a=s.reduce((t,o,n)=>{var s,a;if(null===(s=o.attrs)||void 0===s?void 0:s.disabled)return t;const l=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(r+`_${n}`);return l&&t.push([l,o]),t},[]),l=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_load_more`);l&&a.push([l,e.props.loadMoreOption]),e.props.mouseOnSource&&Zp.add(e),e.props.mouseOnTarget&&Xp.add(e),a.length&&fd(e,a,null,t)}function fd(e,t,o,n){const r=n?n.getBoundingClientRect():{top:0,bottom:0};if(o=null,e.props.trackHover){if(e.props.mouseY>r.top&&e.props.mouseY<r.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 e.props.activeValue=s&&!(null===(r=s.attrs)||void 0===r?void 0:r.disabled)?vt(s):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)}}else td(e);e.props.mouseOnSource||e.props.mouseOnTarget?e.props.mouseOnSource&&Zp.has(e)||e.props.mouseOnTarget&&Xp.has(e)?requestAnimationFrame(fd.bind(null,e,t,o,n)):ud(e,n):(Zp.delete(e),Xp.delete(e))}const vd={schema:/* #__PURE__ */sp(/* #__PURE__ */vp(/* #__PURE__ */hp("$label"),/* #__PURE__ */cp("$help"),/* #__PURE__ */ap(/* #__PURE__ */mp(/* #__PURE__ */gp(/* #__PURE__ */$p(),/* #__PURE__ */bp(/* #__PURE__ */Me("$optionsLoadingCounter > 0",/* #__PURE__ */ip("loader"),"$fns.getSourceItemCount($selectedSourceItems)"))),/* #__PURE__ */wp(/* #__PURE__ */_p(/* #__PURE__ */kp(),/* #__PURE__ */Ap(/* #__PURE__ */ip("close")))),/* #__PURE__ */Dp(/* #__PURE__ */jp(/* #__PURE__ */zp("$sourceEmptyMessage")),/* #__PURE__ */Tp(/* #__PURE__ */Me("$transferOnSelect !== true && $fns.isSelected($option, $selectedSourceItems)",/* #__PURE__ */ip("selected")),/* #__PURE__ */Ep("$option.label")),/* #__PURE__ */Op(/* #__PURE__ */Me("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",/* #__PURE__ */Mp(/* #__PURE__ */Me("$state.loading",/* #__PURE__ */ip("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value"))))),/* #__PURE__ */Rp(/* #__PURE__ */Kp(/* #__PURE__ */Yp("$ui.addAllValues.value"),/* #__PURE__ */ip("fastForward")),/* #__PURE__ */Np(/* #__PURE__ */Yp("$ui.addSelectedValues.value"),/* #__PURE__ */ip("moveRight")),/* #__PURE__ */Wp(/* #__PURE__ */Yp("$ui.removeSelectedValues.value"),/* #__PURE__ */ip("moveLeft")),/* #__PURE__ */Up(/* #__PURE__ */Yp("$ui.removeAllValues.value"),/* #__PURE__ */ip("rewind"))),/* #__PURE__ */Vp(/* #__PURE__ */Fp(/* #__PURE__ */yp(),/* #__PURE__ */xp("$fns.getTargetItemCount($selectedTargetItems)")),/* #__PURE__ */Ip(/* #__PURE__ */Sp(/* #__PURE__ */Lp(),/* #__PURE__ */Cp(/* #__PURE__ */ip("close")))),/* #__PURE__ */Pp(/* #__PURE__ */qp(/* #__PURE__ */Me("$state.loading !== true",/* #__PURE__ */zp("$targetEmptyMessage"))),/* #__PURE__ */Bp(/* #__PURE__ */Me("$transferOnSelect !== true && $fns.isSelected($option, $selectedTargetItems)",/* #__PURE__ */ip("selected")),/* #__PURE__ */Hp(/* #__PURE__ */Me("$fns.optionLoading($option, $optionLoaderValues)","$ui.isLoading.value","$option.label")))))),/* #__PURE__ */up(/* #__PURE__ */fp("$message.value")))),type:"input",props:[],features:[
|
|
48
|
+
/* #__PURE__ */$("close"),en]},rp=/* #__PURE__ */Te("mk"),{outer:sp,wrapper:ap,inner:lp,label:ip,prefix:pp,suffix:dp,help:cp,messages:up,message:fp,icon:vp}=/* #__PURE__ */Oe(rp),{overlayPlaceholder:hp,overlayLiteral:mp,overlayChar:gp,overlayEnum:$p,overlay:bp,overlayParts:yp,overlayInner:xp}=/* #__PURE__ */Ee(rp),wp=rp("input",()=>({$el:"input",bind:"$attrs",attrs:{type:"text",disabled:"$disabled",name:"$node.name",onBlur:"$handlers.blur",onInput:"$handlers.DOMInput",value:"$_maskValue",placeholder:"$placeholder",id:"$id","aria-describedby":"$describedBy"}})),kp=new WeakMap,_p=new WeakMap,Sp=new WeakMap;function Lp(e,t){if(!(t instanceof HTMLInputElement))throw new Error(`Masks can only be applied to an HTMLInputElement (id: ${t.id}).`);_p.set(e,t),Qa(t,{...kp.get(e),onChange:({valueAfter:t,meta:o})=>{e.props._maskValue=t,e.input({maskValue:t}),e.props._overlayParts=ut(o)}},e)}const Ip={schema:/* #__PURE__ */sp(/* #__PURE__ */ap(/* #__PURE__ */ip("$label"),/* #__PURE__ */lp(/* #__PURE__ */vp("prefix"),/* #__PURE__ */pp(),/* #__PURE__ */bp(/* #__PURE__ */xp(/* #__PURE__ */yp(/* #__PURE__ */hp("$part.value"),/* #__PURE__ */mp("$part.value"),/* #__PURE__ */gp("$part.value"),/* #__PURE__ */$p("$part.value")))),/* #__PURE__ */wp(),/* #__PURE__ */dp(),/* #__PURE__ */vp("suffix"))),/* #__PURE__ */cp("$help"),/* #__PURE__ */up(/* #__PURE__ */fp("$message.value"))),type:"input",props:["allowIncomplete","mask","mode","tokens","showMask","unmaskValue","prefix","suffix","reverse","overlay"],family:"text",features:[Ei,function(e){e.addProps(["_maskValue","_overlayParts"]),e.on("created",()=>{var t,o,n,a,l;const i="string"==typeof e._value?e._value:"",p=rl(i);_p.set(e,p),Sp.set(e,p),e.props.allowIncomplete=r(e.props.allowIncomplete),e.props.overlay=r(e.props.overlay);const d=!(void 0!==e.props.showMask&&!r(e.props.showMask));e.props.unmaskValue=r(e.props.unmaskValue),e.hook.prop((e,t)=>("unmaskValue"===e.prop&&(e.value=r(e)),t(e)));const c={placeholder:d,pattern:null!==(t=e.props.mask)&&void 0!==t?t:"",mode:null!==(o=e.props.mode)&&void 0!==o?o:"shift",partOverrides:null!==(n=e.props.tokens)&&void 0!==n?n:{},prefix:null!==(a=e.props.prefix)&&void 0!==a?a:void 0,suffix:null!==(l=e.props.suffix)&&void 0!==l?l:void 0,reverse:r(e.props.reverse)};kp.set(e,c);const u=(t,o)=>{const n=kp.get(e),r=Sp.get(e),s=_p.get(e);if(!n||!r||!s)return;r.value=vl(r,"string"==typeof e.props._maskValue?e.props._maskValue:""),n[t]="string"==typeof o?o:void 0,nl(r,n),nl(s,n);const a=ol(r,n,e),l=ql(r,e.props.allowIncomplete);s.value=a,e.props._maskValue=a,e.props._overlayParts=ut(Gl(r)||[]),e.input(e.props.unmaskValue?null!=l?l:"":null===l?"":a,!1)};e.on("prop:prefix",({payload:e})=>u("prefix",e)),e.on("prop:suffix",({payload:e})=>u("suffix",e));let f=!1;e.hook.input((t,o)=>{if(f)return o(t);const n=function(e,t){const o=_p.get(e),n=function(e){return null!==e&&"object"==typeof e&&"maskValue"in e&&"string"==typeof e.maskValue}(t),r="string"==typeof t?t:n?t.maskValue:"",s=Sp.get(e);s.value=vl(s,r);const a=ol(s,kp.get(e),e),l=ql(s,e.props.allowIncomplete);if(r===o.value)return e.props.unmaskValue?null!=l?l:"":null===l?"":r;if(""===r&&""!==o.value&&!e.props.allowIncomplete)return o.value=a,e.props._maskValue=a,e.props._overlayParts=ut(Gl(s)||[]),r;n||a===e.props._maskValue||(o.value=a,e.props._maskValue=a,e.props._overlayParts=ut(Gl(s)||[]));return null===l?"":e.props.unmaskValue?l:a}(e,t);return o(n)}),e.props._maskValue=ol(p,c,e);const v=ql(p,e.props.allowIncomplete),h=null===v?i:e.props.unmaskValue?v:e.props._maskValue;try{f=!0,e.input(h,!1)}finally{f=!1}e.context&&(e.context.handlers.DOMInput=t=>{e.emit("dom-input-event",t)}),s(`${e.props.id}`,Lp.bind(null,e),e.props.__root)})}]},Ap=/* #__PURE__ */Te("tf"),{outer:Cp,wrapper:Dp,inner:Tp,icon:Op,prefix:Ep,suffix:Mp,help:Vp,messages:Fp,message:Pp}=/* #__PURE__ */Oe(Ap),Bp=Ap("fieldset",()=>({$el:"fieldset",attrs:{id:'$id + "_fieldset"',role:"presentation","aria-describedby":{if:"$help",then:'$: "help-" + $id',else:void 0}}})),Hp=Ap("legend",()=>({if:"$label",$el:"legend"})),Np=Ap("source",()=>({$el:"div",attrs:{id:'$id + "_source"',class:'$classes.transferlist + " " + $classes.source'}})),Rp=Ap("sourceHeader",()=>({$el:"div",attrs:{id:'$id + "_source_header"',role:"presentation",class:'$classes.transferlistHeader + " " + $classes.sourceHeader'}})),Kp=Ap("sourceHeaderLabel",()=>({if:"$sourceLabel",$el:"label",attrs:{id:'$id + "_source_header_label"',for:'$id + "_source_search_input"',class:'$classes.transferlistHeaderLabel + " " + $classes.sourceHeaderLabel'},children:"$sourceLabel || $label"})),Wp=Ap("sourceHeaderItemCount",()=>({$el:"span",attrs:{id:'$id + "_source_header_item_count"',role:"presentation","aria-label":'$sourceOptions.length " items"',class:'$classes.transferlistHeaderItemCount + " " + $classes.sourceHeaderItemCount'}})),Up=Ap("targetHeaderLabel",()=>({if:"$targetLabel",$el:"label",attrs:{id:'$id + "_target_header_label"',for:'$id + "_target_search_input"',class:'$classes.transferlistHeaderLabel + " " + $classes.targetHeaderLabel'},children:"$targetLabel || $label"})),Yp=Ap("targetHeaderItemCount",()=>({$el:"span",attrs:{id:'$id + "_target_header_item_count"',role:"presentation","aria-label":'$targetOptions.length + " items"',class:'$classes.transferlistHeaderItemCount + " " + $classes.targetHeaderItemCount'},children:"$targetOptions.length"})),jp=Ap("sourceControls",()=>({$el:"div",if:"$searchable",attrs:{id:'$id + "_source_controls"',class:'$classes.transferlistControls + " " + $classes.sourceControls'}})),qp=Ap("sourceSearch",()=>({if:"$searchable",$el:"div",attrs:{id:'$id + "_source_search"',class:'$classes.transferlistSearch + " " + $classes.sourceSearch'}})),zp=Ap("sourceSearchInput",()=>({$el:"input",attrs:{id:'$id + "_source_search_input"',type:"text",placeholder:"$placeholder",onInput:"$handlers.onSearch",value:"$inputText",onKeydown:"$handlers.sourceSearchKeydown",disabled:"$disabled","aria-label":"Search",role:"searchbox",autocomplete:"off",class:'$classes.transferlistSearchInput + " " + $classes.sourceSearchInput',onFocus:"$handlers.sourceSearchFocus",onBlur:"$handlers.sourceSearchBlur"}})),Gp=Ap("targetSearch",()=>({if:"$targetSearchable",$el:"div",attrs:{id:'$id + "_target_search"',class:'$classes.transferlistSearch + " " + $classes.targetSearch'}})),Zp=Ap("targetSearchInput",()=>({$el:"input",attrs:{id:'$id + "_target_search_input"',type:"text",placeholder:"$placeholder",onInput:"$handlers.onTargetSearch",value:"$targetInputText",onKeydown:"$handlers.targetSearchKeydown",disabled:"$disabled","aria-label":"Search",role:"searchbox",autocomplete:"off",class:'$classes.transferlistSearchInput + " " + $classes.targetSearchInput',onFocus:"$handlers.targetSearchFocus",onBlur:"$handlers.targetSearchBlur"}})),Xp=Ap("targetControls",()=>({$el:"div",if:"$targetSearchable",attrs:{id:'$id + "_target_controls"',class:'$classes.transferlistControls + " " + $classes.targetControls'}})),Jp=Ap("sourceSearchClear",()=>({$el:"button",if:'$inputText !== ""',attrs:{id:'$id + "_source_search_clear"',type:"button",onClick:"$handlers.clearSearch","aria-label":"Clear Source Search",class:'$classes.transferlistSearchClear + " " + $classes.sourceSearchClear'}})),Qp=Ap("targetSearchClear",()=>({$el:"button",if:'$targetInputText !== ""',attrs:{id:'$id + "_target_search_clear"',type:"button",onClick:"$handlers.clearTargetSearch","aria-label":"Clear Target Search",class:'$classes.transferlistSearchClear + " " + $classes.targetSearchClear'}})),ed=Ap("sourceListItems",()=>({$el:"ul",attrs:{id:'$id + "_source_list_items"',"aria-activedescendant":"$activeDescendant",onMouseenter:"$handlers.onMouseenter(true)",onMouseout:"$handlers.onMouseleave(true)",role:"listbox","aria-multiselectable":"true","aria-roledescription":"List of options to choose from.",class:'$classes.transferlistListItems + " " + $classes.sourceListItems',onKeydown:"$handlers.sourceListKeydown",tabindex:"$searchable || $sourceOptions.length === 0 && -1 || 0",onFocus:"$handlers.sourceListFocused",onBlur:"$handlers.sourceListBlurred","aria-label":"Source list"}})),td=Ap("sourceListItem",()=>({for:["option","index","$sourceOptions"],$el:"li",attrs:{id:'$id + "_source_list_item_" + $index',"data-value":"$option.value","aria-selected":"$transferOnSelect === false && $fns.isSelected($option, $selectedSourceItems)","data-is-active":"$fns.isActive($option, $activeValue)","data-disabled":"$option.attrs.disabled",role:"option",onClick:"$handlers.listitemClick($option, true)",onTouchstartPassive:"$handlers.listitemTouchstart($option, true)",onTouchmovePassive:"$handlers.listitemTouchmove($option, true)",onTouchend:"$handlers.listitemTouchend($option, true)",key:"$option.value",class:'$classes.transferlistListItem + " " + $classes.sourceListItem'}})),od=Ap("sourceOption",()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option, $selectedSourceItems)",class:'$classes.transferlistOption + " " + $classes.sourceOption'}})),nd=Ap("sourceLoadMore",()=>({$el:"li",if:"$state.loading || $state.hasNextPage",attrs:{id:'$id + "_source_load_more"',key:"loadMore",onClick:"$handlers.listitemClick($loadMoreOption)","aria-selected":"false","data-is-active":"$fns.isActive($loadMoreOption)",tabindex:"-1"}})),rd=Ap("loadMoreInner","span"),sd=Ap("target",()=>({$el:"div",attrs:{id:'$id + "_target"',class:'$classes.transferlist + " " + $classes.target'}})),ad=Ap("targetHeader",()=>({$el:"div",attrs:{id:'$id + "_target_header"',role:"presentation",class:'$classes.transferlistHeader + " " + $classes.targetHeader'}})),ld=Ap("targetListItems",()=>({$el:"ul",attrs:{id:"$id","aria-activedescendant":"$activeDescendant",onMouseenter:"$handlers.onMouseenter(false)",onMouseout:"$handlers.onMouseleave(false)",role:"listbox",class:'$classes.transferlistListItems + " " + $classes.targetListItems',tabindex:"$targetOptions.length === 0 && -1 || 0",onKeydown:"$handlers.targetListKeydown",onFocus:"$handlers.targetListFocused",onBlur:"$handlers.targetListBlurred","aria-label":"Target list"}})),id=Ap("targetListItem",()=>({for:["option","index","$targetOptions"],$el:"li",attrs:{id:'$id + "_target_list_item_" + $index',"data-disabled":"$option.attrs.disabled","data-value":"$option.value","aria-selected":"$transferOnSelect === false && $fns.isSelected($option, $selectedTargetItems)","data-is-active":"$fns.isActive($option, $activeValue)",role:"option",onClick:"$handlers.listitemClick($option, false)",onTouchstartPassive:"$handlers.listitemTouchstart($option, false)",onTouchmovePassive:"$handlers.listitemTouchmove($option, false)",onTouchend:"$handlers.listitemTouchend($option, false)",key:"$option.value",class:'$classes.transferlistListItem + " " + $classes.targetListItem'}})),pd=Ap("targetOption",()=>({$el:"div",attrs:{id:'$id + "_target_list_item_" + $index + "_option"',"data-checked":"$fns.isSelected($option, $selectedTargetItems)",class:'$classes.transferlistOption + " " + $classes.targetOption'}})),dd=Ap("transferControls",()=>({$el:"div",attrs:{id:'$id + "_transfer_controls"'}})),cd=Ap("transferButtonForward",()=>({if:"$transferOnSelect !== true",$el:"button",attrs:{id:'$id + "_transfer_button_forward"',type:"button",disabled:"$selectedSourceItems.length === 0 || $disabled || ($max && $value && $value.length >= $max)",onClick:"$handlers.transferForward","aria-label":"$ui.addSelectedValues.value",title:"$ui.addSelectedValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonForward'}})),ud=Ap("transferButtonForwardAll",()=>({$el:"button",attrs:{id:'$id + "_transfer_button_forward_all"',type:"button",disabled:"$sourceOptions.length === 0 || $disabled || ($max && $value && $value.length >= $max)",onClick:"$handlers.transferForwardAll","aria-label":"$ui.addAllValues.value",title:"$ui.addAllValues.value",onFocus:"$handlers.transferForwardAllFocused",class:'$classes.transferlistButton + " " + $classes.transferButtonForwardAll'}})),fd=Ap("transferButtonBackward",()=>({if:"$transferOnSelect !== true",$el:"button",attrs:{id:'$id + "_transfer_button_backward"',onClick:"$handlers.transferBackward",type:"button",disabled:"$selectedTargetItems.length === 0 || $targetOptions.length === 0 || $disabled","aria-label":"$ui.removeSelectedValues.value",title:"$ui.removeSelectedValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonBackward'}})),vd=Ap("transferButtonBackwardAll",()=>({$el:"button",attrs:{id:'$id + "_transfer_button_backward_all"',onClick:"$handlers.transferBackwardAll",type:"button",disabled:"$targetOptions.length === 0 || $disabled","aria-label":"$ui.removeAllValues.value",title:"$ui.removeAllValues.value",class:'$classes.transferlistButton + " " + $classes.transferButtonBackwardAll'}})),hd=Ap("controlLabel","span"),md=Ap("sourceEmptyMessage",()=>({$el:"li",if:"$showSourceEmptyMessage && $sourceEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_source_empty_message"',key:"$sourceEmptyMessage",role:"presentation"}})),gd=Ap("targetEmptyMessage",()=>({$el:"li",if:"$showTargetEmptyMessage && $targetEmptyMessage",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}})),$d=Ap("emptyMessageInner","span"),bd=Symbol(),yd=new WeakSet,xd=new WeakSet;function wd(e,t,o,n){if(!(e.props.disabled||(e.props.isSourceOption=o,e.props.isSourceOption&&Array.isArray(e.value)&&e.value.length>=e.props.max)))if(o){if(e.props.selectedSourceItems.includes(t))return e.props.selectedSourceItems=e.props.selectedSourceItems.filter(e=>e!==t),e.props.activeValue=void 0,void(e.props.activeDescendant=void 0);e.props.selectedTargetItems=[],e.props.selectedSourceItems=[...e.props.selectedSourceItems,t]}else{if(e.props.selectedTargetItems.includes(t))return void(e.props.selectedTargetItems=e.props.selectedTargetItems.filter(e=>e!==t));e.props.selectedSourceItems=[],e.props.selectedTargetItems=[...e.props.selectedTargetItems,t]}}function kd(e,t){if(e.props.disabled)return;if(e.props.sourceListOrigin=!0,e.props.maxReached)return;if(t){const o=Array.isArray(e.value)?[...e.value,t]:[t];return void e.input(o)}const o=e.props.selectedSourceItems.map(e=>vt(e));Array.isArray(e.value)?e.input([...e.value,...o]):e.input(o),e.props.selectedSourceItems=[]}function _d(e,t){if(e.props.disabled)return;if(e.props.sourceListOrigin=!1,t){const o=Array.isArray(e.value)?e.value.filter(e=>!n(e,t)):[];return void e.input(o)}const o=e.props.selectedTargetItems.map(e=>vt(e));if(Array.isArray(e.value)){const t=e.value.filter(e=>!o.includes(e));e.input(t)}e.props.selectedTargetItems=[]}function Sd(e){var t,o;if(e.props.activeValue===bd){const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_source_load_more`);return void(o&&o.scrollIntoView({block:"nearest",inline:"start"}))}const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.activeDescendant);n&&n.scrollIntoView({block:"nearest",inline:"start"})}function Ld(e){var t;if(Array.isArray(e.value)){const t=[];let o=[...e.props.options];e.value.forEach(r=>{const s=e.props.memoOptions.find(e=>n(vt(e),r));if(s&&!s.noOptionFound){t.push(s);const a=e.props.options.findIndex(e=>n(vt(e),r));-1!==a&&(o=o.filter(e=>!n(vt(e),r)))}else{const e=o.find(e=>n(vt(e),r));e?(t.push(e),o=o.filter(e=>!n(vt(e),r))):t.push({label:String(r),value:r,noOptionFound:!0})}}),e.props.targetOptions=e.props.targetInputText?t.filter(t=>e.props.filter(t,e.props.targetInputText,e)):t,e.props.sourceOptions=o}else e.props.sourceOptions=[...e.props.options],e.props.targetOptions=[];if(e.props.skipSetActiveValue)return void(e.props.skipSetActiveValue=!1);(null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+"_source_list_items"))&&Id(e)}function Id(e){var t,o,n,r,s,a,l,i,p;if(e.props.isDragging)return;if(e.props.targetSearchActive){if((null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.activeElement)||void 0===o?void 0:o.id)===`${e.props.id}_target_search_input`){const t=e.props.targetOptions.find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)});return t?void(e.props.activeValue=vt(t)):void(e.props.activeValue=void 0)}return}if(e.props.sourceSearchActive){if((null===(r=null===(n=e.props.__root)||void 0===n?void 0:n.activeElement)||void 0===r?void 0:r.id)===`${e.props.id}_source_search_input`){const t=e.props.sourceOptions.find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)});return t?void(e.props.activeValue=vt(t)):void(e.props.activeValue=void 0)}e.props.sourceSearchActive=!1}if(!1===e.props.transferOnSelect)return void(e.props.activeValue=void 0);const d=e.props.sourceListOrigin?e.props.sourceOptions:e.props.targetOptions;let c=!1;for(let t=e.props.activeIndex;t<=d.length;t++)if(!(null===(s=d.attrs)||void 0===s?void 0:s.disabled)&&d[t]){c=!0,e.props.activeValue=vt(d[t]);break}if(!c&&d.length)for(let t=e.props.activeIndex;t>=0;t--)if(!(null===(a=d.attrs)||void 0===a?void 0:a.disabled)&&d[t])return c=!0,void(e.props.activeValue=vt(d[t]));if(!c){let t;t=e.props.sourceListOrigin?null===(p=e.props.__root)||void 0===p?void 0:p.getElementById(`${e.props.id}`):e.props.searchable?null===(l=e.props.__root)||void 0===l?void 0:l.getElementById(`${e.props.id}_source_search_input`):null===(i=e.props.__root)||void 0===i?void 0:i.getElementById(`${e.props.id}_source_list_items`),t&&t.focus()}}function Ad(e,t){return(t?e.props.sourceOptions:e.props.targetOptions).find(e=>{var t;return!(null===(t=e.attrs)||void 0===t?void 0:t.disabled)})}function Cd(e){Array.isArray(e.value)&&e.value.forEach(async t=>{Mt(e,t,function(e,t){const o=[...e.props.options,...e.props.memoOptions];return o.find(e=>n(vt(e),t))}(e,t))})}function Dd(e){e.context&&(e.context.handlers.loadMore=Lt.bind(null,e),e.context.fns.getSourceItemCount=t=>!1===e.props.transferOnSelect&&t.length?t.length+"/"+e.props.sourceOptions.length:e.props.sourceOptions.length,e.context.fns.getTargetItemCount=t=>!1===e.props.transferOnSelect&&t.length?t.length+"/"+e.props.targetOptions.length:e.props.targetOptions.length,e.context.fns.isActive=(t,o)=>{if(!e.props.isDragging&&!e.props.touchStarted)return n(o,vt(t))||void 0},e.context.fns.isSelected=(e,t)=>!!t&&(!!Array.isArray(t)&&t.includes(e)),e.context.fns.optionLoading=t=>e.props.optionLoaderValues.includes(vt(t)),e.context.handlers.clearSearch=()=>{!function(e){var t;e.props.sourceSearchActive=!1,e.props.inputText="",St(e,"",!0);const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_source_search_input`);if(!o)return;o.focus()}(e)},e.context.handlers.clearTargetSearch=()=>{!function(e){var t;e.props.targetSearchActive=!1,e.props.targetInputText="";const o=[...new Set([...e.props.options,...e.props.memoOptions])],n=[];for(const t of e.value){const e=o.find(e=>vt(e)===t);e&&n.push(e)}e.props.targetOptions=n;const r=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_target_search_input`);if(!r)return;r.focus()}(e)},e.context.handlers.sourceSearchBlur=t=>{setTimeout(()=>{var o;if(t.relatedTarget&&t.relatedTarget instanceof HTMLElement&&(t.relatedTarget.id===`${e.props.id}_source_list_items`||t.relatedTarget.id===`${e.props.id}`)){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_source_search_input`);if(!t)return;t.focus()}else e.props.activeValue=void 0})},e.context.handlers.targetSearchBlur=t=>{setTimeout(()=>{var o;if(t.relatedTarget&&t.relatedTarget instanceof HTMLElement&&(t.relatedTarget.id===`${e.props.id}_source_list_items`||t.relatedTarget.id===`${e.props.id}`)){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_target_search_input`);if(!t)return;t.focus()}else e.props.activeValue=void 0})},e.context.handlers.listitemClick=(t,o)=>n=>{Td(e,t,o)},e.context.handlers.transferForward=kd.bind(null,e,void 0),e.context.handlers.transferForwardAll=()=>{let t;if(e.props.disabled)return;if(e.props.maxReached)return;const o=e.props.sourceOptions.map(e=>vt(e)),n=Array.isArray(e.value)?e.value:[],r=e.props.max?Math.max(e.props.max-n.length,0):o.length,s=o.slice(0,r);t=Array.isArray(e.value)?[...e.value,...s]:[...s],e.input(t),e.props.selectedSourceItems=[]},e.context.handlers.transferBackward=_d.bind(null,e,void 0),e.context.handlers.transferBackwardAll=()=>{e.props.disabled||Array.isArray(e.value)&&(e.input([]),e.props.selectedTargetItems=[])},e.context.handlers.onSearch=t=>{!function(e,t){e.props.sourceSearchActive=!0;const o=t.target;e.props.inputText=o.value,St(e,o.value,!0)}(e,t)},e.context.handlers.onTargetSearch=t=>{!function(e,t){e.props.targetSearchActive=!0;const o=t.target;e.props.targetInputText=o.value;const n=[...new Set([...e.props.memoOptions,...e.props.options])],r=[];for(const t of e.value){const e=n.find(e=>vt(e)===t);e&&r.push(e)}const s=[...new Map([...e.props.targetOptions,...r].map(e=>[JSON.stringify(e),e])).values()];e.props.targetOptions=s.filter(t=>e.props.filter(t,o.value,e)),0===e.props.targetOptions.length?e.props.showTargetEmptyMessage=!0:e.props.showTargetEmptyMessage=!1;Id(e)}(e,t)},e.context.handlers.onMouseenter=t=>o=>{"touchstart"!==o.type&&(t?e.props.mouseOnSource=!0:e.props.mouseOnTarget=!0)},e.context.handlers.onMouseleave=t=>o=>{var n;if("touchend"===o.type)return;const r=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(t?`${e.props.id}_source_list_items`:`${e.props.id}`);r&&(r.contains(o.relatedTarget)||(e.props.trackHover=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,e.props.activeIndex=void 0,t?e.props.mouseOnSource=!1:e.props.mouseOnTarget=!1))},e.context.handlers.listitemClick=(t,o)=>n=>{n instanceof MouseEvent&&e.props.touchStarted||Td(e,t,o)},e.context.handlers.listitemTouchstart=()=>()=>{!function(e){e.props.touchStarted=!0}(e)},e.context.handlers.listitemTouchend=(t,o)=>n=>{!function(e,t,o){if(e.props.touchMoved)return e.props.touchMoved=!1,void(e.props.touchStarted=!1);const n=vt(t);e.props.activeIndex=e.props.sourceOptions.findIndex(e=>vt(e)===n),e.props.transferOnSelect?o?kd(e,n):_d(e,n):wd(e,t,o)}(e,t,o)},e.context.handlers.listitemTouchmove=()=>t=>{!function(e){e.props.touchMoved=!0}(e)},e.context.handlers.sourceSearchFocus=t=>{Od(e,!0)},e.context.handlers.targetSearchFocus=t=>{Od(e,!1)},e.context.handlers.sourceListFocused=t=>{Od(e,!0)},e.context.handlers.targetListFocused=()=>{Od(e,!1)},e.context.handlers.sourceListBlurred=t=>{e.props.activeValue=void 0},e.context.handlers.targetListBlurred=t=>{e.props.activeValue=void 0},e.context.handlers.sourceListKeydown=t=>{Ed(e,t,!0)},e.context.handlers.targetListKeydown=t=>{Ed(e,t,!1)},e.context.handlers.sourceSearchKeydown=t=>{Ed(e,t,!0)},e.context.handlers.targetSearchKeydown=t=>{Ed(e,t,!1)})}function Td(e,t,o,r){var s;if(vt(t)===bd)return void(null===(s=e.context)||void 0===s||s.handlers.loadMore(!0));const a=vt(t);e.props.activeIndex=e.props.sourceOptions.findIndex(e=>n(vt(e),a)),e.props.transferOnSelect?o?kd(e,a):_d(e,a):wd(e,t,o)}function Od(e,t){const o=Ad(e,t);o&&(e.props.sourceListOrigin=t,e.props.activeValue=vt(o))}function Ed(e,t,o){if("ArrowDown"===t.key||"ArrowUp"===t.key)!function(e,t,o){var n,r,s;e.preventDefault();const a=o?t.props.sourceOptions:t.props.targetOptions,l=a.reduce((e,t)=>{var o;return(null===(o=null==t?void 0:t.attrs)||void 0===o?void 0:o.disabled)||e.push(vt(t)),e},[]);(null===(n=t.store.hasNextPage)||void 0===n?void 0:n.value)&&l.push(bd);const i=l.indexOf(t.props.activeValue);if("ArrowUp"===e.key&&0!==i)for(let e=i-1;e>=0;e--){t.props.sourceListOrigin=o,t.props.activeValue=l[i-1];break}else if("ArrowDown"===e.key&&i!==l.length-1)for(let e=i+1;e<l.length;e++)if(!(null===(s=null===(r=a[e])||void 0===r?void 0:r.attrs)||void 0===s?void 0:s.disabled)){t.props.sourceListOrigin=o,t.props.activeValue=l[e];break}Sd(t)}(t,e,o);else if("ArrowRight"===t.key||"ArrowLeft"===t.key){if("ArrowLeft"===t.key&&o)return;if("ArrowRight"===t.key&&!o)return;!function(e,t,o){if(t.props.searchable)return;e.preventDefault(),function(e,t){var o,n,r;if(Ad(e,!t))if(t){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);t&&t.focus()}else if(e.props.searchable){const t=null===(n=e.props.__root)||void 0===n?void 0:n.getElementById(`${e.props.id}_source_search_input`);t&&t.focus()}else{const t=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(`${e.props.id}_source_list_items`);t&&t.focus()}}(t,o)}(t,e,o)}else"Enter"===t.key&&function(e,t,o){var n;if(e.preventDefault(),!t.props.activeValue)return;if(t.props.activeValue===bd)return void(null===(n=t.context)||void 0===n||n.handlers.loadMore(!0));const r=o?t.props.sourceOptions:t.props.targetOptions,s=r.findIndex(e=>vt(e)===t.props.activeValue);t.props.activeIndex=s;const a=r[s];if(!a)return;t.props.transferOnSelect?o?kd(t,vt(a)):_d(t,vt(a)):wd(t,a,o)}(t,e,o)}function Md(e){e.on("created",()=>{if("function"==typeof e.props.optionsLoader&&(e.props.skipSetActiveValue=!0,Vt(e)),Dd(e),e.props.disabled&&(e.props.draggable=!1),ee){s(e.props.id+"_source_list_items",t=>{t instanceof HTMLElement&&function(e,t){if(!e.context)return;function o(){return e.props.sourceOptions.map(e=>vt(e))}function n(){return[]}const r={longPress:!0,draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,group:e.props.id,root:e.props.__root||document,disabled:!e.props.draggable||e.props.maxReached,synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,longPressClass:e.context.classes.longTouch,multiDrag:!0,draggedNodes:({parent:t,node:o})=>Vd(t,o,e.props.selectedSourceItems),dragstartClasses(t,o,n,r){e.props.isDragging=!0,e.props.trackHover=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,r&&(e.props.selectedSourceItems=[]),_(t,o,n,r)},handleEnd(t){k(t),e.props.isDragging=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,e.props.selectedTargetItems=[],e.props.selectedSourceItems=[]},draggable:e=>"option"===e.getAttribute("role")};w({parent:t,getValues:o,setValues:n,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:t,getValues:o,setValues:n,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:t,getValues:o,setValues:n,config:r})}),e.on("prop:maxReached",({payload:e})=>{r.disabled=e,w({parent:t,getValues:o,setValues:n,config:r})})}(e,t)},e.props.__root),s(`${e.props.id}`,t=>{t instanceof HTMLElement&&function(e,t){if(!e.context)return;function o(){return e.props.targetOptions.map(e=>vt(e))}function n(t,o){e.props.sourceListOrigin=!0,e.input(t)}const r={longPress:!0,root:e.props.__root,group:e.props.id,disabled:!e.props.draggable,draggingClass:e.context.classes.dragging,dropZoneClass:e.context.classes.dropZone,synthDraggingClass:e.context.classes.touchDragging,synthDropZoneClass:e.context.classes.touchDropZone,longPressClass:e.context.classes.longTouch,multiDrag:!0,draggedNodes:({parent:t,node:o})=>Vd(t,o,e.props.selectedTargetItems),dragstartClasses(t,o,n,r){e.props.isDragging=!0,e.props.trackHover=!1,e.props.activeValue=void 0,e.props.activeDescendant=void 0,_(t,o,n,r)},handleEnd(t){k(t),e.props.selectedTargetItems=[],e.props.selectedSourceItems=[],e.props.activeValue=void 0,e.props.trackHover=!0,e.props.isDragging=!1},draggable:e=>"option"===e.getAttribute("role")};w({parent:t,getValues:o,setValues:n,config:r}),e.on("prop:disabled",({payload:e})=>{r.disabled=e,w({parent:t,getValues:o,setValues:n,config:r})}),e.on("prop:draggable",({payload:e})=>{r.disabled=!e,w({parent:t,getValues:o,setValues:n,config:r})})}(e,t)},e.props.__root);const t=t=>{var o;if(e.props.isDragging)return;e.props.mouseX=t.clientX,e.props.mouseY=t.clientY;const n=e.props.mouseOnSource?`${e.props.id}_source_list_items`:`${e.props.id}`,r=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(n);if(r){const o=r.getBoundingClientRect();t.clientX>o.x&&t.clientX<o.x+o.width&&t.clientY>o.y&&t.clientY<o.y+o.height&&(e.props.trackHover=!0)}};document.addEventListener("mousemove",t)}})}function Vd(e,t,o=[]){const n=Array.isArray(o)?o.map(e=>vt(e)):[],r=t.data.value,s=(n.includes(r)?n:[r,...n]).reduce((t,o)=>{const n=e.data.enabledNodes.find(e=>e.data.value===o);return n&&!t.includes(n)&&t.push(n),t},[]);return s.length?s:[t]}function Fd(e,t){var o;let n=null,r="",s=[];if(e.props.mouseOnSource){if(n=yd.has(e),r=`${e.props.id}_source_list_item`,s=[...e.props.sourceOptions],!s||!s.length||n)return s=[],r="",void(n=null)}else if(e.props.mouseOnTarget&&(n=xd.has(e),r=`${e.props.id}_target_list_item`,s=[...e.props.targetOptions],!s||!s.length||n))return s=[],r="",void(n=null);const a=s.reduce((t,o,n)=>{var s,a;if(null===(s=o.attrs)||void 0===s?void 0:s.disabled)return t;const l=null===(a=e.props.__root)||void 0===a?void 0:a.getElementById(r+`_${n}`);return l&&t.push([l,o]),t},[]),l=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}_load_more`);l&&a.push([l,e.props.loadMoreOption]),e.props.mouseOnSource&&yd.add(e),e.props.mouseOnTarget&&xd.add(e),a.length&&Pd(e,a,null,t)}function Pd(e,t,o,n){const r=n?n.getBoundingClientRect():{top:0,bottom:0};if(o=null,e.props.trackHover){if(e.props.mouseY>r.top&&e.props.mouseY<r.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 e.props.activeValue=s&&!(null===(r=s.attrs)||void 0===r?void 0:r.disabled)?vt(s):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)}}else Sd(e);e.props.mouseOnSource||e.props.mouseOnTarget?e.props.mouseOnSource&&yd.has(e)||e.props.mouseOnTarget&&xd.has(e)?requestAnimationFrame(Pd.bind(null,e,t,o,n)):Fd(e,n):(yd.delete(e),xd.delete(e))}const Bd={schema:/* #__PURE__ */Cp(/* #__PURE__ */Bp(/* #__PURE__ */Hp("$label"),/* #__PURE__ */Vp("$help"),/* #__PURE__ */Dp(/* #__PURE__ */Np(/* #__PURE__ */Rp(/* #__PURE__ */Kp(),/* #__PURE__ */Wp(/* #__PURE__ */Me("$optionsLoadingCounter > 0",/* #__PURE__ */Op("loader"),"$fns.getSourceItemCount($selectedSourceItems)"))),/* #__PURE__ */jp(/* #__PURE__ */qp(/* #__PURE__ */zp(),/* #__PURE__ */Jp(/* #__PURE__ */Op("close")))),/* #__PURE__ */ed(/* #__PURE__ */md(/* #__PURE__ */$d("$sourceEmptyMessage")),/* #__PURE__ */td(/* #__PURE__ */Me("$transferOnSelect !== true && $fns.isSelected($option, $selectedSourceItems)",/* #__PURE__ */Op("selected")),/* #__PURE__ */od("$option.label")),/* #__PURE__ */nd(/* #__PURE__ */Me("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",/* #__PURE__ */rd(/* #__PURE__ */Me("$state.loading",/* #__PURE__ */Op("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value"))))),/* #__PURE__ */dd(/* #__PURE__ */ud(/* #__PURE__ */hd("$ui.addAllValues.value"),/* #__PURE__ */Op("fastForward")),/* #__PURE__ */cd(/* #__PURE__ */hd("$ui.addSelectedValues.value"),/* #__PURE__ */Op("moveRight")),/* #__PURE__ */fd(/* #__PURE__ */hd("$ui.removeSelectedValues.value"),/* #__PURE__ */Op("moveLeft")),/* #__PURE__ */vd(/* #__PURE__ */hd("$ui.removeAllValues.value"),/* #__PURE__ */Op("rewind"))),/* #__PURE__ */sd(/* #__PURE__ */ad(/* #__PURE__ */Up(),/* #__PURE__ */Yp("$fns.getTargetItemCount($selectedTargetItems)")),/* #__PURE__ */Xp(/* #__PURE__ */Gp(/* #__PURE__ */Zp(),/* #__PURE__ */Qp(/* #__PURE__ */Op("close")))),/* #__PURE__ */ld(/* #__PURE__ */gd(/* #__PURE__ */Me("$state.loading !== true",/* #__PURE__ */$d("$targetEmptyMessage"))),/* #__PURE__ */id(/* #__PURE__ */Me("$transferOnSelect !== true && $fns.isSelected($option, $selectedTargetItems)",/* #__PURE__ */Op("selected")),/* #__PURE__ */pd(/* #__PURE__ */Me("$fns.optionLoading($option, $optionLoaderValues)","$ui.isLoading.value","$option.label")))))),/* #__PURE__ */Fp(/* #__PURE__ */Pp("$message.value")))),type:"input",props:[],features:[
|
|
49
49
|
/* #__PURE__ */g("moveRight","right"),
|
|
50
50
|
/* #__PURE__ */g("moveLeft","left"),
|
|
51
51
|
/* #__PURE__ */g("fastForward","fastForward"),
|
|
@@ -58,8 +58,8 @@ import{isRecord as e,isObject as t,isPojo as o,eq as n,undefine as r,whenAvailab
|
|
|
58
58
|
/* #__PURE__ */$("addAllValues"),
|
|
59
59
|
/* #__PURE__ */$("addSelectedValues"),
|
|
60
60
|
/* #__PURE__ */$("removeSelectedValues"),
|
|
61
|
-
/* #__PURE__ */$("removeAllValues"),b,function(e){!function(e){e.addProps(["search","options","selectedItems","activeValue","activeIndex","activeDescendant","targetOptions","sourceOptions","optionLoader","isLoadingOptions","filterOptions","inputText","hasNextPage","page","targetLoading","searchable","sourceLabel","targetLabel","transferOnSelect","disabled","placeholder","filter","showSourceEmptyMessage","showTargetEmptyMessage","sourceEmptyMessage","targetEmptyMessage","clearOnSelect","max","maxReached","debounce","sourceListActive","optionLoaderValues","optionLoadingCounter","optionsLoadingCounter","memoOptions","optionsLoaded","selectedSourceItems","selectedTargetItems","draggable","loadMore","loadMoreOption","targetSearchable","targetInputText"]),e.props.loadMoreOption={label:"Load more",value:Gp},void 0===e.props.draggable?e.props.draggable=!0:"false"===e.props.draggable&&(e.props.draggable=!1),e.props.optionsLoaderValues=[],e.props.selectedSourceItems=[],e.props.selectedTargetItems=[],e.props.optionsLoaded=void 0,e.props.memoOptions=[],e.props.multiple=!0,e.props.debounce=e.props.debounce?parseInt(e.props.debounce):200,e.props.optionLoaderValues=[],e.props.optionsLoadingCounter=0,e.props.optionLoadingCounter=0,e.props.page=1,e.props.hasNextPage=Et.bind(null,e),e.props.options?e.props.options=[...e.props.options]:e.props.options=[],e.props.sourceOptions=[],e.props.targetOptions=[],"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.props.searchable=r(e.props.searchable),e.props.searchable&&(e.props.inputText=""),e.props.targetSearchable=r(e.props.targetSearchable),e.props.targetSearchable&&(e.props.targetInputText=""),e.props.clearOnSelect=r(e.props.clearOnSelect),void 0===e.props.transferOnSelect?e.props.transferOnSelect=!0:"false"===e.props.transferOnSelect&&(e.props.transferOnSelect=!1),e.props.targetOptions.length&&(e.props.targetOptionValues=e.props.targetOptions.map(e=>vt(e))),e.props.initialOptions=[...e.props.options],e.props.max&&(e.props.max=parseInt(e.props.max)),e.props.sourceListOrigin=void 0,"function"!=typeof e.props.filter&&(e.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase()))}(e),function(e){e.on("commit",async({payload:t})=>{e.props.activeValue=void 0,e.props.max&&(e.props.maxReached=t.length>=e.props.max),e.props.clearOnSelect&&e.props.inputText&&(e.props.reFilter=!0,e.props.inputText=""),e.props.memoOptions=[...new Set([...e.props.targetOptions,...e.props.memoOptions])],e.props.searchable&&e.props.reFilter&&!e.props.initialLoad?(kt(e,e.props.inputText),e.props.reFilter=!1):e.props.initialLoad||(e.isCreated||(e.props.skipSetActiveValue=!0),od(e)),"function"==typeof e.props.optionLoader?sd(e):e.props.initialLoad||(e.props.memoOptions=[...new Set([...e.props.targetOptions,...e.props.memoOptions])])})}(e),dd(e),function(e){e.on("prop:options",()=>{e.props.appendingOptions&&(e.props.skipSetActiveValue=!0,e.props.appendingOptions=!1),od(e)}),e.on("prop:memoOptions",()=>{e.props.skipSetActiveValue=!0,od(e)}),e.on("prop:sourceOptions",()=>{0===e.props.sourceOptions.length?e.props.showSourceEmptyMessage=!0:e.props.showSourceEmptyMessage=!1,Zp.delete(e)}),e.on("prop:targetOptions",()=>{0===e.props.targetOptions.length?e.props.showTargetEmptyMessage=!0:e.props.showTargetEmptyMessage=!1}),e.on("prop:activeValue",({payload:t})=>{if(e.props.isDragging)return void(e.props.activeDescendant=void 0);if(t===Gp)return void(e.props.activeDescendant=`${e.props.id}_load_more`);const o=(e.props.sourceListOrigin?e.props.sourceOptions:e.props.targetOptions).findIndex(e=>n(vt(e),t));o>=0&&e.props.sourceListOrigin?e.props.activeDescendant=`${e.props.id}_source_list_item_${o}`:e.props.activeDescendant=o>=0?`${e.props.id}_target_list_item_${o}`:void 0}),e.on("prop:mouseOnSource",({payload:t})=>{var o;if(t&&!0!==e.props.disabled&&!e.props.isDragging){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.id+"_source_list_items");if(!t)return;e.props.mouseOnTarget=!1,e.props.sourceListOrigin=!0,Zp.delete(e),ud(e,t)}}),e.on("prop:mouseOnTarget",({payload:t})=>{var o;if(t&&!0!==e.props.disabled&&!e.props.isDragging){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(!t)return;e.props.mouseOnSource=!1,e.props.sourceListOrigin=!1,Xp.delete(e),ud(e,t)}}),e.on("prop:optionsLoadingCounter",({payload:t})=>{0===t&&0===e.props.optionLoadingCounter&&e.store.set(It)}),e.on("prop:optionLoadingCounter",({payload:t})=>{0===t&&0===e.props.optionsLoadingCounter&&(e.store.set(It),e.props.skipSetActiveValue=!0,od(e))})}(e)}]};const hd=/* #__PURE__ */Te("sl"),{outer:md,wrapper:gd,inner:$d,icon:bd,prefix:yd,suffix:xd,help:wd,messages:_d,message:kd}=/* #__PURE__ */Ee(hd),Sd=hd("label",()=>({if:"$label",$el:"label",attrs:{id:"$id + '_label'"}})),Ld=hd("chart",()=>({$el:"div",if:"$chart"})),Id=hd("chartBar",()=>({$el:"div",for:["bar","index","$chart"],attrs:{"data-active":{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:"$bar.at >= $_value.0 && $bar.at <= $_value.1",else:"$bar.at >= $_value.1 && $bar.at <= $_value.0"},else:"$bar.at <= $_value"},style:{left:'$bar.at / ($max - $min) * 100 + "%"',width:'$: "calc(" + (100 / $chart.length) + "% - 2px)"',height:{if:"$largestBar",then:'$bar.value / $largestBar * 100 + "%"'}}}})),Ad=hd("sliderInner",()=>({$el:"div",attrs:{"data-has-mark-labels":"$markLabels && $marks.length > 0"}})),Cd=hd("track",()=>({$el:"div",attrs:{id:"$: 'track-' + $id",onClick:"$handlers.clickTrack"}})),Dd=hd("trackWrapper",()=>({$el:"div"})),Td=hd("trackInner",()=>({$el:"div"})),Ed=hd("fill",()=>({$el:"div",attrs:{style:"$fillStyles"}})),Od=hd("linkedValues",()=>({$el:"div"})),Md=hd("maxValue",()=>({$formkit:"number",bind:"$computedMaxInputAttrs",ignore:!0,number:!0,value:{if:"$isMulti",then:"$_value.1",else:"$_value"},tabindex:{if:"$disabled",then:-1},onNode:"$handlers.maxNode",onBlur:"$handlers.inputBlur"})),Vd=hd("minValue",()=>({$formkit:"number",if:"$isMulti",bind:"$computedMinInputAttrs",ignore:!0,number:!0,value:{if:"$isMulti",then:"$_value.0",else:"$_value"},tabindex:{if:"$disabled",then:-1},onNode:"$handlers.minNode",onBlur:"$handlers.inputBlur"})),Fd=hd("marks",()=>({$el:"div",if:"$marks"})),Pd=hd("mark",()=>({$el:"span",for:["step","index","$marks"],attrs:{"data-active":{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:"$step.at >= $_value.0 && $step.at <= $_value.1",else:"$step.at >= $_value.1 && $step.at <= $_value.0"},else:"$step.at <= $_value"},class:{if:"$step.class",then:'$: $classes.mark + " " + $step.class',else:"$classes.mark"},style:{left:'$: $fns.calculateMarkPosition($step.at) + "%"'}}})),Bd=hd("markLabel",()=>({$el:"span",if:"$markLabels",children:{if:"$step.label !== undefined",then:"$step.label",else:""},attrs:{class:'$: $classes.markLabel + " " + $step.labelClass'}})),Hd=hd("handles",()=>({$el:"ul"})),Rd=hd("handleMax",()=>({$el:"li",attrs:{"data-active":"$dragging","data-is-target":'$lastHandleInteraction === "max"',"data-handle":"max","data-show-tooltip":"$tooltip",class:"$: 'formkit-handle ' + $classes.handle + ' ' + $classes.handleMax",onFocus:"$handlers.focus",onClick:"$handlers.clickHandle",onMousedown:"$handlers.startDrag",onTouchstartPassive:"$handlers.startDrag",style:"$maxHandleStyles",tabindex:{if:"$disabled",then:-1,else:0},onBlur:"$handlers.blur",onKeydown:"$handlers.keydown"}})),Nd=hd("handleMin",()=>({$el:"li",if:"$isMulti",attrs:{"data-active":"$dragging","data-is-target":'$lastHandleInteraction === "min"',"data-handle":"min","data-show-tooltip":"$tooltip",class:"$: $classes.handle + ' ' + $classes.handleMin",onFocus:"$handlers.focus",onClick:"$handlers.clickHandle",onMousedown:"$handlers.startDrag",onTouchstartPassive:"$handlers.startDrag",style:"$minHandleStyles",tabindex:{if:"$disabled",then:-1,else:0},onBlur:"$handlers.blur",onKeydown:"$handlers.keydown"}})),Kd=hd("handleMinInner",()=>({$el:"div",attrs:{class:'$: $classes.handleInner + " " + $classes.handleMinInner'}})),Wd=hd("handleMaxInner",()=>({$el:"div",attrs:{class:'$: $classes.handleInner + " " + $classes.handleMaxInner'}})),Ud=hd("tooltipMax",()=>({$el:"div",if:'$tooltip === true || $tooltip === "auto"',children:{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:'$tooltipFormat($_value.1, "max")',else:'$tooltipFormat($_value.0, "max")'},else:'$tooltipFormat($_value, "max")'},attrs:{class:"$classes.tooltip + ' ' + $classes.tooltipMax"}})),Yd=hd("tooltipMin",()=>({$el:"div",if:'$isMulti && ($tooltip === true || $tooltip === "auto")',children:{if:"$_value.0 < $_value.1",then:'$tooltipFormat($_value.0, "min")',else:'$tooltipFormat($_value.1, "min")'},attrs:{class:"$classes.tooltip + ' ' + $classes.tooltipMin"}})),jd={schema:/* #__PURE__ */md(/* #__PURE__ */gd(/* #__PURE__ */Sd("$label"),/* #__PURE__ */wd("$help"),/* #__PURE__ */Ad(/* #__PURE__ */bd("prefix"),/* #__PURE__ */yd(),/* #__PURE__ */Cd(/* #__PURE__ */Ld(/* #__PURE__ */Id()),/* #__PURE__ */Dd(/* #__PURE__ */Td(/* #__PURE__ */Ed(),/* #__PURE__ */Fd(/* #__PURE__ */Pd(/* #__PURE__ */Bd())),/* #__PURE__ */Hd(/* #__PURE__ */Nd(/* #__PURE__ */Yd(),/* #__PURE__ */Kd()),/* #__PURE__ */Rd(/* #__PURE__ */Ud(),/* #__PURE__ */Wd()))))),/* #__PURE__ */xd(),/* #__PURE__ */bd("suffix"),/* #__PURE__ */Me("$showInput && $isMulti === false",/* #__PURE__ */Md())),/* #__PURE__ */Me("$showInput && $isMulti",/* #__PURE__ */Od(/* #__PURE__ */Vd(),/* #__PURE__ */Md())),/* #__PURE__ */_d(/* #__PURE__ */kd("$message.value")))),type:"input",family:"",props:["min","max","step","showInput","tooltip","tooltipFormat","inputAttrs","maxInputAttrs","minInputAttrs","marks","markLabels","snapToMarks","chart","scalingFunction","intervals"],features:[function(e){let t,o,a;e.addProps(["isMulti","maxHandleStyles","minHandleStyles","fillStyles","decimals","dragging","lastHandleInteraction","largestBar","computedMaxInputAttrs","computedMinInputAttrs"]);const l={linear:{forward:e=>e,reverse:e=>e},log:{forward:(t,o=e.props.min,n=e.props.max)=>n*Math.pow(t/n,1.5),reverse:(t,o=e.props.min,n=e.props.max)=>n*Math.pow(t/n,1/1.5)}};let i=!1;function p(){const e=document.activeElement;if(e instanceof HTMLInputElement){const t=e.value;e.value="",e.value=t}}function d(e){if(!e)return;const t={disabled:e.props.disabled,min:"number"==typeof e.props.min?e.props.min:0,max:"number"==typeof e.props.max?e.props.max:void 0,step:e.props.step||1};e.props.minInputAttrs=Object.assign(e.props.minInputAttrs||{},t),e.props.maxInputAttrs=Object.assign(e.props.maxInputAttrs||{},t),e.props.inputAttrs=e.props.inputAttrs&&"object"==typeof e.props.inputAttrs?Object.assign(e.props.inputAttrs,t):t,e.props.computedMaxInputAttrs=e.props.maxInputAttrs&&"object"==typeof e.props.maxInputAttrs?Object.assign({},e.props.inputAttrs,e.props.maxInputAttrs):e.props.inputAttrs,e.props.computedMinInputAttrs=e.props.minInputAttrs&&"object"==typeof e.props.minInputAttrs?Object.assign({},e.props.inputAttrs,e.props.minInputAttrs):e.props.inputAttrs}function c(t){const{min:o,max:n,intervals:r}=e.props;if(t=Math.min(Math.max(t,0),100),!r||0===r.length){x();const r=o+t/100*(n-o);return e.props.scalingFunction.reverse(r,o,n)}const s=f(r,o,n);for(let e=0;e<s.length;e++){const{value:o,step:n,left:r,width:a,stepsInInterval:l}=s[e];if(t>=r&&t<=r+a){const e=o+(t-r)/a*l*n,s=e%n;return $(s<n/2?e-s:e+(n-s))}}return t>100?n:t<0?o:void 0}function u(t,o=e.props.min,n=e.props.max){const r=e.props.intervals;if(!r||0===r.length){x();return(e.props.scalingFunction.forward(t,o,n)-o)/(n-o)*100}const s=f(r,o,n);for(let e=0;e<s.length;e++){const{value:o,step:r,left:a,width:l,stepsInInterval:i}=s[e],p=e<s.length-1?s[e+1].value:n;if(t>=o&&t<=p){return 100*((a+(t-o)/r/i*l)/100)}}return 100}function f(t,o=e.props.min,n=e.props.max){(t=[...t]).sort((e,t)=>e.value-t.value),t[0].value!==o&&t.unshift({value:o,step:e.props.step});let r=0;for(let e=0;e<t.length;e++){const o=t[e].value,s=((e<t.length-1?t[e+1].value:n)-o)/t[e].step;r+=s}let s=0;return t.map((e,o)=>{const a=e.value,l=((o<t.length-1?t[o+1].value:n)-a)/e.step,i=s/r*100;return s+=l,{value:e.value,step:e.step,left:i,width:l/r*100,stepsInInterval:l,totalSteps:r}})}function v(){const t=parseFloat(`${e.props.min}`),o=parseFloat(`${e.props.max}`);let n,r=0;if(Array.isArray(e._value)){const t=[...e._value].sort(h);r=parseFloat(`${t[0]}`),n=parseFloat(`${t[1]}`)}else n=parseFloat(`${e._value}`);e.props.maxHandleStyles={left:`${u(n,t,o)}%`},e.props.isMulti&&Array.isArray(e._value)?(e.props.minHandleStyles={left:`${u(r,t,o)}%`},e.props.fillStyles={left:`${u(r,t,o)}%`,width:u(n,t,o)-u(r,t,o)+"%"}):e.props.fillStyles={left:"0%",width:`${u(n,t,o)}%`}}function h(e,t){return parseFloat(`${e}`)-parseFloat(`${t}`)}function m(o,n=!0){if(e.props.disabled)return;let r;if(void 0===o){if(e.props.isMulti)e.input([b(e.props.min),b(e.props.max)]);else{const t=e.props.min+(e.props.max-e.props.min)/2;e.input(b(t))}return void v()}if(e.props.isMulti&&Array.isArray(e._value)&&!Array.isArray(o)){const n="min"===e.props.lastHandleInteraction?0:1,s=[...e._value];s[n]=o;const[a,l]=s;if(a>=l){const o=null==t?void 0:t.querySelector(`[data-handle="${"min"===e.props.lastHandleInteraction?"max":"min"}"]`);null==o||o.focus()}r=b([...s].sort(h))}else Array.isArray(o)?r=b(o):(r=b(o),r=isNaN(r)?e.props.min:r);e.props.snapToMarks&&(r=y(r));const s=b(g(r));n&&e.input(s),v()}function g(t){return e.props.isMulti&&Array.isArray(t)?[g(t[0]),g(t[1])]:(t=isNaN(t)?e.props.min:t,Math.min(Math.max(parseFloat(`${t}`),e.props.min),e.props.max))}function $(t){return parseFloat(t.toFixed(e.props.decimals))}function b(t){if(e.props.snapToMarks)return t;if(!e.props.intervals)return Array.isArray(t)?t.map(t=>$(Math.round(t/e.props.step)*e.props.step)):$(Math.round(t/e.props.step)*e.props.step);const o=f(e.props.intervals);if(Array.isArray(t))return t.map(t=>{const n=o.find((n,r)=>{var s;return t>=n.value&&t<((null===(s=o[r+1])||void 0===s?void 0:s.value)||e.props.max)});if(!n)return t;return $(n.value+Math.round((t-n.value)/n.step)*n.step)});{const n=o.find((n,r)=>{var s;return t>=n.value&&t<((null===(s=o[r+1])||void 0===s?void 0:s.value)||e.props.max)});if(!n)return t;return $(n.value+Math.round((t-n.value)/n.step)*n.step)}}function y(t){if(Array.isArray(t))return t[0]=y(t[0]),t[1]=y(t[1]),t;{const o=e.props.marks,n=o.reduce((e,o)=>Math.abs(o.at-t)<Math.abs(e.at-t)?o:e,o[0]);return n.at}}function x(){if(i)return;r(e.props.scalingFunction)?"string"==typeof e.props.scalingFunction?e.props.scalingFunction=l[e.props.scalingFunction]||l.linear:"object"==typeof e.props.scalingFunction&&(e.props.scalingFunction={...l.linear,...e.props.scalingFunction}):e.props.scalingFunction=l.linear,i=!0}e.props.maxHandleStyles={left:"0%"},e.props.fillStyles={left:"0%",width:"0%"},e.props.isMulti=!1,e.props.step=1,e.props.min=0,e.props.max=100,e.props.tooltipFormat="function"==typeof e.props.tooltipFormat?e.props.tooltipFormat:(e,t)=>{if(t)return e},e.props.largestBar=0,"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.on("created",()=>{var l;x(),e.props.isMulti=Array.isArray(e.value),e.props.step=parseFloat(`${e.props.step}`),e.props.decimals=(null===(l=e.props.step.toString().split(".")[1])||void 0===l?void 0:l.length)||0,e.props.min=e.props.min?parseFloat(`${e.props.min}`):0,e.props.max=e.props.max?parseFloat(`${e.props.max}`):100;const i=r(e.props.tooltip);e.props.tooltip=void 0===e.props.tooltip?"auto":i;const $=r(e.props.marks);if(e.props.marks=!!$&&(Array.isArray(e.props.marks)?e.props.marks:function(){const{min:t,max:o,step:n}=e.props,r=[];for(let e=t;e<=o;e+=n)r.push({at:e,label:e});return r}()),e.props.markLabels=r(e.props.markLabels),e.props.snapToMarks=r(e.props.snapToMarks),e.props.showInput=r(e.props.showInput),e.props.largestBar=e.props.chart?e.props.chart.reduce((e,t)=>t.value>e?t.value:e,0):e.props.largestBar,d(e),s(`track-${e.props.id}`,()=>{var o;t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`track-${e.props.id}`),m(e.value,!1),v()},e.props.__root),e.context){let r=0,s="";const l=e.context.handlers.blur;e.context.handlers.blur=t=>{l(t),e.emit("blur")},e.context.handlers.clickTrack=o=>{if(!t)return;e.props.dragging=!1;const{left:n,width:r}=t.getBoundingClientRect(),s=(o.clientX-n)/r;if(e.props.isMulti&&Array.isArray(e.value)){const[t,o]=e.value,n=Math.abs(t-s*e.props.max)<Math.abs(o-s*e.props.max)?"min":"max",r="min"===n?0:1;e.props.lastHandleInteraction=n,e.value[r]=c(100*s),m(e._value)}else m(c(100*s))},e.context.handlers.focus=o=>{if(!t)return;const n=o.target.dataset.handle;n&&(e.props.lastHandleInteraction=n)},e.context.handlers.clickHandle=t=>{t.stopPropagation(),e.props.attrs.onClick&&e.props.attrs.onClick(t),e.props.dragging=!1,m(e._value)},e.context.handlers.startDrag=o=>{if(!t)return;e.props.dragging=!0;const n="touchstart"===o.type,r=n?"touchmove":"mousemove",s=n?"touchend":"mouseup";e.props.lastHandleInteraction=o.target.dataset.handle||e.props.lastHandleInteraction,document.addEventListener(r,_,{passive:!1}),document.addEventListener(s,()=>{e.context&&(e.props.dragging=!1,document.removeEventListener(r,_),n&&o.target instanceof HTMLElement&&o.target.blur())})},e.context.handlers.keydown=t=>{if(["1","2","3","4","5","6","7","8","9","0",".","-"].includes(t.key)){t.preventDefault(),clearTimeout(r),s+=t.key;const e="-"===s?-1:1;r=window.setTimeout(()=>{"-"!==s?(m(parseFloat(s)*e),s=""):s=""},350)}if(["ArrowLeft","ArrowDown","ArrowRight","ArrowUp","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const o="min"===e.props.lastHandleInteraction?0:1,n=Array.isArray(e._value)?e._value[o]:e._value,r=function(t,o){if(!e.props.intervals)return e.props.step;const n=f(e.props.intervals);if(t>=e.props.max)return n[n.length-1].step;let r=n.find((o,r)=>{var s;return t>=o.value&&t<((null===(s=n[r+1])||void 0===s?void 0:s.value)||e.props.max)});if(!r)return e.props.step;if(-1===o){t-r.step<r.value&&(r=n[n.indexOf(r)-1]||r)}return r.step}(n,["ArrowLeft","ArrowDown","PageDown"].includes(t.key)?-1:1);if(e.props.marks&&e.props.snapToMarks){const o=y(n),r=e.props.marks.find(e=>e.at===o),s=e.props.marks.indexOf(r),a=["ArrowLeft","ArrowDown"].includes(t.key)?-1:1,l=Math.min(Math.max(0,s+a),e.props.marks.length-1);return void m(e.props.marks[l].at)}if(t.metaKey)return void("ArrowLeft"===t.key||"ArrowDown"===t.key?m(e.props.min):m(e.props.max));if("Home"===t.key)return void m(e.props.min);if("End"===t.key)return void m(e.props.max);if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)){m(n+(t.shiftKey?10*r:r)*(["ArrowLeft","ArrowDown"].includes(t.key)?-1:1))}"PageUp"===t.key?m(n+10*r):"PageDown"===t.key&&m(n-10*r)}},e.context.handlers.maxNode=t=>{a=t,t.hook.commit((o,r)=>{if(n(t.value,o))return r(o);if(`${t.value}`.includes(".")&&!`${o}`.includes(".")&&p(),e.props.isMulti&&Array.isArray(e._value)){m([e._value[0],o])}else m(o);return r(g(o))})},e.context.handlers.minNode=t=>{o=t,t.hook.commit((o,r)=>{if(n(t.value,o))return r(o);if(`${t.value}`.includes(".")&&!`${o}`.includes(".")&&p(),e.props.isMulti&&Array.isArray(e._value)){m([o,e._value[1]])}else m(o);return r(g(o))})},e.context.handlers.inputBlur=()=>{if(e.props.isMulti&&Array.isArray(e._value)){m([...e._value].sort(h))}},e.context.fns.calculateMarkPosition=t=>u(t,e.props.min,e.props.max)}let w;function _(o){var n;if(!t||!e.props.dragging)return;o.preventDefault();const r=o.clientX||(null===(n=o.touches)||void 0===n?void 0:n.length)&&o.touches[0].clientX,{left:s,width:a}=t.getBoundingClientRect(),l=b(c((r-s)/a*100));w!==l&&(w=l,m(l))}m(e.value)}),e.on("input",({payload:t})=>{Array.isArray(e.value)&&Array.isArray(t)?e.value[0]===t[0]&&e.value[1]===t[1]||m(t,!1):e.value!==t&&m(t,!1),function(){if(e.props.isMulti&&Array.isArray(e._value)){const[t,n]=[...e._value];o&&o.input($(t)),a&&a.input($(n))}else a&&a.input(e._value)}()}),e.on("prop:max",()=>{e.props.max=e.props.max?parseFloat(`${e.props.max}`):100,m(e.value),d(e)}),e.on("prop:min",()=>{e.props.min=e.props.min?parseFloat(`${e.props.min}`):0,m(e.value),d(e)})}]},qd=/* #__PURE__ */Te("cp"),{outer:zd,wrapper:Gd,inner:Zd,label:Xd,prefix:Jd,suffix:Qd,help:ec,messages:tc,message:oc,icon:nc}=/* #__PURE__ */Ee(qd),rc=qd("swatchPreview",()=>({$el:"div",attrs:{id:"$id",class:"$classes.swatchPreview",tabindex:{if:"$disabled",then:-1,else:0},onClick:"$handlers.inputPreviewClick",onFocusout:"$handlers.inputPreviewFocusout",onKeydown:"$handlers.inputPreviewKeydown",role:"button","aria-valuetext":'$: "Current color: " + $value'}})),sc=qd("valueString",()=>({$el:"span",attrs:{class:"$classes.valueString"},children:{if:'$format === "hex"',then:"$hex",else:{if:'$format === "rgba"',then:"$rgbaString",else:{if:'$format === "hsla"',then:"$hslaString",else:""}}}})),ac=qd("panel",()=>({$el:"div",attrs:{id:'$: $id + "_popover"',class:"$classes.panel",onKeydown:"$handlers.panelKeydown","aria-role":{if:"$layout === popover",then:"dialog"},"aria-modal":{if:"$layout === popover",then:"true"},"aria-label":"$label",popover:"$popover",style:{if:"$usePopover",then:{margin:0,top:'$popoverCoordinates.y + "px"',left:'$popoverCoordinates.x + "px"'},else:{position:{if:"$inline === undefined || $inline === false",then:"absolute"}}}}})),lc=qd("panelClose",()=>({$el:"button",attrs:{type:"button",class:"$classes.panelClose",onClick:"$handlers.closePanel",tabindex:{if:"$showPanelClose",then:-1,else:0},onKeydown:"$handlers.panelCloseKeydown","aria-label":"$ui.close.value"}})),ic=qd("controlGroup",()=>({$el:"div",attrs:{class:"$classes.controlGroup","data-eye-dropper":"$hasNativeEyeDropper && $eyeDropper",role:"group"}})),pc=qd("LS",()=>({$el:"div",attrs:{class:"$classes.LS"}})),dc=qd("canvasLS",()=>({$el:"canvas",attrs:{id:'$: "canvas-ls-" + $id',class:'$classes.canvas + " " + $classes.canvasLS',width:256,height:256,"aria-hidden":"true"}})),cc=qd("controlLS",()=>({$el:"div",attrs:{tabindex:{if:"$disabled",then:-1,else:0},class:'$classes.control + " " + $classes.controlLS',onKeydown:"$handlers.lsKeydown",style:{left:'$controlLSPosition.x + "%"',top:'$controlLSPosition.y + "%"',backgroundColor:'$: "hsl(" + $hsla.h + "deg, " + ($hsla.s / 255) * 100 + "%, " + ($hsla.l / 255) * 100 + "%)"'},role:"slider","aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":'$: "Lightness: " + $hslaPercent.l + "%, Saturation: " + $hslaPercent.s + "%"'}})),uc=qd("hue",()=>({$el:"div",attrs:{class:"$classes.hue"}})),fc=qd("canvasHue",()=>({$el:"canvas",attrs:{id:'$: "canvas-hue-" + $id',class:'$classes.canvas + " " + $classes.canvasHue',width:256,height:10,"aria-hidden":"true"}})),vc=qd("controlHue",()=>({$el:"div",attrs:{tabindex:{if:"$disabled",then:-1,else:0},onKeydown:"$handlers.hueControlKeydown",class:'$classes.control + " " + $classes.controlHue',style:{left:'$: "min(max(" + (($hsla.h / 360) * 100) + "%, 3px), calc(100% - 3px))"',backgroundColor:'$: "hsl(" + $hsla.h + "deg, 100%, 50%)"'},role:"slider","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":"$h"}})),hc=qd("alpha",()=>({$el:"div",attrs:{class:"$classes.alpha",style:{opacity:{if:"$alpha",then:"1",else:"0.5"},cursor:{if:"$alpha",then:"",else:"not-allowed"},filter:{if:"$alpha",then:"",else:"grayscale(1)"}}}})),mc=qd("canvasAlpha",()=>({$el:"canvas",attrs:{id:'$: "canvas-alpha-" + $id',class:'$classes.canvas + " " + $classes.canvasAlpha',width:256,height:10,"aria-hidden":"true",style:{pointerEvents:{if:"$alpha",then:"auto",else:"none"}}}})),gc=qd("controlAlpha",()=>({$el:"div",attrs:{tabindex:{if:"$disabled || $alpha === undefined",then:-1,else:0},onKeydown:"$handlers.alphaControlKeydown",class:'$classes.control + " " + $classes.controlAlpha',style:{left:'$: "min(max(" + ($hsla.a * 100) + "%, 3px), calc(100% - 3px))"',backgroundImage:'$: "linear-gradient(to right, hsla(" + $hsla.h + "deg, " + ($hsla.s / 255) * 100 + "%, " + ($hsla.l / 255) * 100 + "%, " + $hsla.a + "), hsla(" + $hsla.h + "deg, " + ($hsla.s / 255) * 100 + "%, " + ($hsla.l / 255) * 100 + "%, " + $hsla.a + ")), linear-gradient(to right, white, white)"',pointerEvents:{if:"$alpha",then:"auto",else:"none"}},role:"slider","aria-valuemin":0,"aria-valuemax":1,"aria-valuenow":"$hsla.a"}})),$c=qd("preview",()=>({$el:"div",attrs:{class:"$classes.preview"}})),bc=qd("canvasPreview",()=>({$el:"canvas",attrs:{id:'$: "canvas-preview-" + $id',class:'$classes.canvas + " " + $classes.canvasPreview',width:33,height:33,"aria-hidden":"true"}})),yc=qd("canvasSwatchPreview",()=>({$el:"div",attrs:{class:"$classes.canvasSwatchPreviewWrapper"},children:[{$el:"canvas",attrs:{id:'$: "canvas-swatch-preview-" + $id',class:'$classes.canvas + " " + $classes.canvasSwatchPreview',width:33,height:33,"aria-hidden":"true"}}]})),xc=qd("eyeDropper",()=>({$el:"div",attrs:{tabindex:{if:"$disabled",then:-1,else:0},role:"button",onKeydown:"$handlers.eyeDropperKeydown",id:'$: "eye-dropper-" + $id',class:"$classes.eyeDropper"}})),wc=qd("formatField",()=>({$el:"div",attrs:{class:"$classes.formatField"}})),_c=qd("colorInputGroup",()=>({$el:"div",attrs:{class:"$classes.colorInputGroup","aria-role":"group"}})),kc=qd("hexField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.hexFieldGroup'},children:[{$el:"input",attrs:{onInput:"$handlers.hexInput",onKeydown:"$handlers.hexKeydown",onFocus:"$handlers.hexFocus",onBlur:"$handlers.hexBlur",id:'$: "hex-" + $id',tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",class:'$classes.colorField + " " + $classes.hexField',value:"$hex",autocomplete:"off"}},{$el:"label",children:"HEX",attrs:{for:'$: "hex-" + $id',class:"$classes.fieldLabel"}}]})),Sc=qd("rField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.rFieldGroup'},children:[{$el:"input",attrs:{id:'$: "r-" + $id',onInput:'$handlers.rangeLimitInput("rgba", 0, 255)',onKeydown:'$handlers.rangeLimitKeydown("rgba", 0, 255, 1)',type:"number",class:'$classes.colorField + " " + $classes.rField',min:0,max:255,step:1,tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$rgba.r",autocomplete:"off"}},{$el:"label",children:"R",attrs:{for:'$: "r-" + $id',class:"$classes.fieldLabel"}}]})),Lc=qd("gField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.gFieldGroup'},children:[{$el:"input",attrs:{id:'$: "g-" + $id',onInput:'$handlers.rangeLimitInput("rgba", 0, 255)',onKeydown:'$handlers.rangeLimitKeydown("rgba", 0, 255, 1)',type:"number",class:'$classes.colorField + " " + $classes.gField',min:0,max:255,step:1,tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$rgba.g",autocomplete:"off"}},{$el:"label",children:"G",attrs:{for:'$: "g-" + $id',class:"$classes.fieldLabel"}}]})),Ic=qd("bField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.bFieldGroup'},children:[{$el:"input",attrs:{id:'$: "b-" + $id',onInput:'$handlers.rangeLimitInput("rgba", 0, 255)',onKeydown:'$handlers.rangeLimitKeydown("rgba", 0, 255, 1)',type:"number",class:'$classes.colorField + " " + $classes.bField',min:0,max:255,step:1,tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$rgba.b",autocomplete:"off"}},{$el:"label",children:"B",attrs:{for:'$: "b-" + $id',class:"$classes.fieldLabel"}}]})),Ac=qd("aField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.aFieldGroup'},children:[{$el:"input",attrs:{id:'$: "a-" + $id',onInput:'$handlers.rangeLimitInput("alpha", 0, 1)',onKeydown:'$handlers.rangeLimitKeydown("alpha", 0, 1, 0.01)',type:"text",class:'$classes.colorField + " " + $classes.aField',value:"$rgba.a",tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled || $alpha === undefined",autocomplete:"off",style:{opacity:{if:"$alpha",then:"1",else:"0.33"},cursor:{if:"$alpha",then:void 0,else:"not-allowed"}},"aria-valuemin":0,"aria-valuemax":1,"aria-valuenow":"$rgba.a"}},{$el:"label",children:"A",attrs:{for:'$: "a-" + $id',class:"$classes.fieldLabel",style:{opacity:{if:"$alpha",then:"1",else:"0.33"}}}}]})),Cc=qd("hField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.hFieldGroup'},children:[{$el:"input",attrs:{id:'$: "h-" + $id',onInput:'$handlers.rangeLimitInput("hsla", 0, 360)',onKeydown:'$handlers.rangeLimitKeydown("hsla", 0, 360, 1)',type:"text",class:'$classes.colorField + " " + $classes.hField',tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$hslaPercent.h",autocomplete:"off","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":"$hsla.h"}},{$el:"label",children:"H",attrs:{for:'$: "h-" + $id',class:"$classes.fieldLabel"}}]})),Dc=qd("sField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.sFieldGroup'},children:[{$el:"input",attrs:{id:'$: "s-" + $id',onInput:'$handlers.rangeLimitInput("hsla", 0, 100)',onKeydown:'$handlers.rangeLimitKeydown("hsla", 0, 100, 1)',type:"text",class:'$classes.colorField + " " + $classes.sField',tabindex:{if:"$disabled",then:-1,else:0},value:"$hslaPercent.s",autocomplete:"off","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":"$hsla.s"}},{$el:"label",children:"S",attrs:{for:'$: "s-" + $id',class:"$classes.fieldLabel"}}]})),Tc=qd("lField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.lFieldGroup'},children:[{$el:"input",attrs:{id:'$: "l-" + $id',onInput:'$handlers.rangeLimitInput("hsla", 0, 100)',onKeydown:'$handlers.rangeLimitKeydown("hsla", 0, 100, 1)',type:"text",class:'$classes.colorField + " " + $classes.lField',tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$hslaPercent.l",autocomplete:"off","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":"$hsla.l"}},{$el:"label",children:"L",attrs:{for:'$: "l-" + $id',class:"$classes.fieldLabel"}}]})),Ec=qd("formatSwitcher",()=>({$el:"div",attrs:{class:"$classes.formatSwitcher",onClick:"$handlers.toggleFormat",tabindex:{if:"$disabled",then:-1,else:0},onKeydown:"$handlers.formatSwitcherKeydown",role:"button","aria-label":"$ui.next.value"}})),Oc=qd("swatches",()=>({$el:"div",attrs:{id:'$: "swatches-" + $id',class:"$classes.swatches","data-keyboard-nav":"$swatchIsUsingKeyboardNav"}})),Mc=qd("swatch",()=>({$el:"div",for:["swatch","index","$options"],if:"$swatch",attrs:{if:"$swatch.group",then:{class:"$classes.swatchGroup"},else:{class:"$classes.swatch",title:"$swatch.label"}},children:{if:"$swatch.group",then:[{$el:"span",attrs:{class:"$classes.swatchGroupLabel"},children:"$swatch.group"},{$el:"div",for:["groupSwatch","swatchIndex","$swatch.options"],attrs:{class:"$classes.swatch",title:"$groupSwatch.label"},children:[{$el:"canvas",attrs:{class:"$classes.swatchCanvas",width:21,height:21,onClick:"$handlers.swatchClick",onKeydown:"$handlers.swatchKeydown",tabindex:{if:"$: ($focusedSwatch === $fns.anyToHsvaString($groupSwatch.value, 0))",then:{if:"$disabled",then:-1,else:0},else:-1},key:'$groupSwatch.label + "-" + $groupSwatch.value',"data-color":"$fns.anyToHsvaString($groupSwatch.value, 0)","data-color-precise":"$fns.anyToHsvaString($groupSwatch.value, 2)","data-group":"$index","data-label":"$swatch.label",role:"button","aria-label":"$swatch.label"}}]}],else:{$el:"canvas",attrs:{class:"$classes.swatchCanvas",width:21,height:21,onClick:"$handlers.swatchClick",onKeydown:"$handlers.swatchKeydown",tabindex:{if:"$: ($focusedSwatch === $fns.anyToHsvaString($swatch.value, 0))",then:{if:"$disabled",then:-1,else:0},else:-1},key:'$swatch.label + "-" + $swatch.value',"data-color":"$fns.anyToHsvaString($swatch.value, 0)","data-color-precise":"$fns.anyToHsvaString($swatch.value, 2)","data-group":0,"data-label":"$swatch.label",role:"button","aria-label":"$swatch.label"}}}})),Vc=/rgba?\((\d+%?)\s*(?:,?\s*|\s+)(\d+%?)\s*(?:,?\s*|\s+)(\d+%?)(?:\s*(?:,?\s*|\s+|\/\s*)(\d*(?:\.\d+)?%?))?\)/i,Fc=/^hsla?\((\d{1,3}deg|[\d.]+)\s*,?\s*([\d.]+%)\s*,?\s*([\d.]+%)(?:\s*,?\s*([\d.]+%?))?\)$/i;function Pc(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}function Bc(e){const[t,o,n,r]=function(e){e=e.replace("#",""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16),r=e.length>=8?parseInt(e.slice(6,8),16)/255:1;return function(e,t,o,n=1){const r=e/255,s=t/255,a=o/255,l=Math.max(r,s,a),i=Math.min(r,s,a);let p,d=0;const c=(l+i)/2;if(l===i)d=p=0;else{const e=l-i;switch(p=c>.5?e/(2-l-i):e/(l+i),l){case r:d=(s-a)/e+(s<a?6:0);break;case s:d=(a-r)/e+2;break;case a:d=(r-s)/e+4}d*=60}return[d,255*p,255*c,n]}(t,o,n,r)}(e);return[...Rc(t,o,n,r)]}function Hc(e,t,o,n=1){const r=t/100,s=o/100,a=(2-r)*s/2;return 0!==a&&(1===a||(t=a<.5?r*s/(2*a):r*s/(2-2*a))),[e,Pc(255*t,2),Pc(255*a,2),n]}function Rc(e,t,o,n=1){const r=Pc(t/255,4),s=Pc(o/255,4);if(1===s)return[e,0,100,n];const a=Pc(s+r*Math.min(s,1-s),4);let l=t/2.55;return 0!==a&&(l=1!==s&&0!==s?2*(a-s)/a*100:t/2.55),[e,Pc(l,2),Pc(100*a,2),n]}function Nc(e,t,o,n=1){const r=o/100,s=r*(t/100),a=s*(1-Math.abs(e/60%2-1)),l=r-s;let i=0,p=0,d=0;return[i,p,d]=e<60?[s,a,0]:e<120?[a,s,0]:e<180?[0,s,a]:e<240?[0,a,s]:e<300?[a,0,s]:[s,0,a],i=Math.round(255*(i+l)),p=Math.round(255*(p+l)),d=Math.round(255*(d+l)),[Math.min(Math.max(i,0),255),Math.min(Math.max(p,0),255),Math.min(Math.max(d,0),255),n]}function Kc(e,t,o,n=1){const r=e/255,s=t/255,a=o/255,l=Math.max(r,s,a),i=Math.min(r,s,a);let p=0;const d=l,c=l-i,u=0===l?0:c/l;if(l!==i){switch(l){case r:p=(s-a)/c+(s<a?6:0);break;case s:p=(a-r)/c+2;break;case a:p=(r-s)/c+4}p/=6}return[360*p,100*u,100*d,n]}function Wc(e,t,o,n=1){const[r,s,a,l]=Nc(e,t,o,n);return function(e,t,o,n=1){const r=e=>Math.round(e).toString(16).padStart(2,"0").toUpperCase(),s=function(e){return Math.round(255*e).toString(16).padStart(2,"0").toUpperCase()}(n);return"#"+r(e)+r(t)+r(o)+`${"FF"===s?"":s}`}(r,s,a,l)}function Uc(e){return/^(#?)([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(e)}function Yc(e){if(e){if(Uc(e))return Bc(e);if(e.startsWith("rgb")){const t=e.match(Vc);if(!t)return[0,0,0,1];const o=e=>e.endsWith("%")?Math.round(2.55*Number(e.slice(0,-1))):Number(e);return Kc(o(t[1]),o(t[2]),o(t[3]),t[4]?t[4].endsWith("%")?Number(t[4].slice(0,-1))/100:Number(t[4]):1)}if(e.startsWith("hsl")){const t=e.match(Fc);if(!t)return[0,0,0,1];const o=Number(t[1].replace("deg","").trim()),n=Number(t[2].slice(0,-1))/100,r=Number(t[3].slice(0,-1))/100,s=t[4]?t[4].endsWith("%")?Number(t[4].slice(0,-1))/100:Number(t[4]):1;return Rc(o,Pc(255*n,2),Pc(255*r,2),s)}}}function jc(e){const[t,o,n,r]=e.split("-").map(e=>Number(e));return[t,o,n,r]}function qc(e,t=150,o=!0){let n=null,r=!0;return(...s)=>{const a=()=>{e(...s),n=null};o&&r&&(r=!1,a()),n||(n=setTimeout(a,t))}}function zc(e){return!1!==e&&"false"!==e}function Gc(e){return e.tabIndex>=0&&!e.disabled&&null!==e.offsetParent}const Zc={"canvas-ls":"LS","canvas-hue":"Hue","canvas-alpha":"Alpha"};const Xc={schema:/* #__PURE__ */zd(/* #__PURE__ */Gd(/* #__PURE__ */Xd("$label"),/* #__PURE__ */Me("$inline && $help",/* #__PURE__ */ec("$help")),/* #__PURE__ */Zd(/* #__PURE__ */Me("($inline === undefined || $inline === false) && $prefixIcon !== undefined",/* #__PURE__ */nc("prefix","label")),/* #__PURE__ */Me("$inline === undefined || $inline === false",/* #__PURE__ */Jd()),/* #__PURE__ */Me("$inline === undefined || $inline === false",/* #__PURE__ */rc(/* #__PURE__ */yc(),/* #__PURE__ */Me("$showValue",/* #__PURE__ */sc()))),/* #__PURE__ */Me("$inline || $expanded)",/* #__PURE__ */ac(/* #__PURE__ */Me("$showPanelClose && ($inline === undefined || $inline === false)",/* #__PURE__ */lc(/* #__PURE__ */nc("close"))),/* #__PURE__ */Me("$panelControls",/* #__PURE__ */ic(/* #__PURE__ */pc(/* #__PURE__ */dc(),/* #__PURE__ */cc()),/* #__PURE__ */$c(/* #__PURE__ */bc()),/* #__PURE__ */uc(/* #__PURE__ */fc(),/* #__PURE__ */vc()),/* #__PURE__ */hc(/* #__PURE__ */mc(),/* #__PURE__ */gc()),/* #__PURE__ */Me("$eyeDropper && $hasNativeEyeDropper",/* #__PURE__ */xc(/* #__PURE__ */nc("eyeDropper"))))),/* #__PURE__ */Me("$panelFormat",/* #__PURE__ */wc(/* #__PURE__ */_c(/* #__PURE__ */Me('$panelActiveFormat === "hex"',/* #__PURE__ */kc()),/* #__PURE__ */Me('$panelActiveFormat === "rgba"',/* #__PURE__ */Sc()),/* #__PURE__ */Me('$panelActiveFormat === "rgba"',/* #__PURE__ */Lc()),/* #__PURE__ */Me('$panelActiveFormat === "rgba"',/* #__PURE__ */Ic()),/* #__PURE__ */Me('$panelActiveFormat === "hsla"',/* #__PURE__ */Cc()),/* #__PURE__ */Me('$panelActiveFormat === "hsla"',/* #__PURE__ */Dc()),/* #__PURE__ */Me('$panelActiveFormat === "hsla"',/* #__PURE__ */Tc()),/* #__PURE__ */Me('$panelActiveFormat === "rgba" || $panelActiveFormat === "hsla"',/* #__PURE__ */Ac())),/* #__PURE__ */Ec(/* #__PURE__ */nc("switch")))),/* #__PURE__ */Me("$options",/* #__PURE__ */Oc(/* #__PURE__ */Mc())))),/* #__PURE__ */Me("$inline === undefined || $inline === false",/* #__PURE__ */Qd()),/* #__PURE__ */Me("($inline === undefined || $inline === false) && $suffixIcon !== undefined",/* #__PURE__ */nc("suffix"))),/* #__PURE__ */Me("$: ($inline === undefined || $inline === false) && $help",/* #__PURE__ */ec("$help"))),/* #__PURE__ */tc(/* #__PURE__ */oc("$message.value"))),type:"input",family:"text",props:["disbaled","format","valueFormat","alpha","panelControls","panelFormat","eyeDropper","inline","options","showValue","closeOnSelect","allowPaste"],features:[function(e){let t,o=null,n=null,a=null,l=null,i=null,p=null,d=null,c=0;const u=["hex","rgba","hsla"],f=qc(function(){if(!n)return;const t=n.getContext("2d");if(!t)return;const{width:o,height:r}=n,s=e.props.h||0;t.fillStyle=`hsl(${s}, 100%, 50%)`,t.fillRect(0,0,o,r);const a=t.createLinearGradient(0,0,o,0);a.addColorStop(0,"rgba(255, 255, 255, 1)"),a.addColorStop(1,"rgba(255, 255, 255, 0)"),t.fillStyle=a,t.fillRect(0,0,o,r);const l=t.createLinearGradient(0,0,0,r);l.addColorStop(0,"rgba(0,0,0,0)"),l.addColorStop(1,"rgba(0,0,0,1)"),t.fillStyle=l,t.fillRect(0,0,o,r)},2),v=qc(function(){if(!l)return;const t=l.getContext("2d");if(!t)return;const o=Math.round(l.width),n=Math.round(l.height);t.clearRect(0,0,o,n),F(l,n/2);const r=e.props.rgba.r||0,s=e.props.rgba.g||0,a=e.props.rgba.b||0,i=t.createLinearGradient(0,0,o,0);i.addColorStop(0,`rgba(${r}, ${s}, ${a}, 0)`),i.addColorStop(1,`rgba(${r}, ${s}, ${a}, 1)`),t.fillStyle=i,t.fillRect(0,0,o,n)},2),h=qc(C,2),m=qc(D,2),g=qc(H,2),$=qc(P,10,!1);function b(t){var n,r;if(!e.context||!e.props.allowPaste||e.props.disabled)return;const s=null===(n=e.props.__root)||void 0===n?void 0:n.activeElement;if(o&&o.contains(s)){const o=null===(r=t.clipboardData)||void 0===r?void 0:r.getData("text");if(!o)return;if("INPUT"===s.tagName&&!Uc(o)&&!Vc.test(o)&&!Fc.test(o))return;(Uc(o)||o.startsWith("hsl")||o.startsWith("rgb"))&&(e.props.hexInputFocused&&(e.props.hexInputFocused=!1,setTimeout(()=>{e.props.hexInputFocused=!0},10)),t.preventDefault(),y(o))}}function y(t){var o;if(!t)return;const n=Yc(t);if(n){const[o,r,s,a]=n;"undefined"!==t&&("number"!=typeof o||isNaN(o)||"number"!=typeof r||isNaN(r)||"number"!=typeof s||isNaN(s)||"number"!=typeof a||isNaN(a)||Pc(o,2)===e.props.h&&Pc(r,2)===e.props.s&&Pc(s,2)===e.props.v&&Pc(a,2)===e.props.a)||(e.props.alpha&&(e.props.a=Pc(a,2)),H(o,r,s))}else{const n=null===(o=e.props.options)||void 0===o?void 0:o.find(e=>{var o;return(null===(o=e.label)||void 0===o?void 0:o.toLowerCase())===t.toLowerCase()});if(n&&n.value){const t=Yc(n.value);if(t){const[o,n,r,s]=t;e.props.alpha&&(e.props.a=Pc(s,2)),H(o,n,r)}else H(e.props.h,e.props.s,e.props.v)}else H(e.props.h,e.props.s,e.props.v)}}function x(t){if(!e.context||!d)return;const o=d[t];o&&(e.props.focusedSwatch=o.dataset.color)}function w(e,t){new ResizeObserver(()=>{const o=e.getBoundingClientRect();e.width=Math.round(o.width),e.height=Math.round(o.height),t(e)}).observe(e)}function _(){e.context&&e.props.eyeDropper&&(e.context.hasNativeEyeDropper=!("undefined"==typeof window||!window.EyeDropper),s(`eye-dropper-${e.props.id}`,()=>{var t;const o=new window.EyeDropper,n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`eye-dropper-${e.props.id}`);null==n||n.addEventListener("click",async()=>{const t=await o.open();if(!t.sRGBHex)return;const[n,r,s]=Bc(t.sRGBHex);e.props.alpha&&(e.props.a=1),H(n,r,s)})},e.props.__root))}function k(){S("canvas-ls",e=>{n=e},f,O),S("canvas-hue",e=>{a=e},A,M),S("canvas-alpha",e=>{l=e},v,V),L(`canvas-preview-${e.props.id}`,e=>{i=e,C()},h),L(`canvas-swatch-preview-${e.props.id}`,e=>{p=e,D()},m),I()}function S(o,n,r,s){let a=!1;const l=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",c)},i=e=>{1===e.buttons&&t&&s(e)},p=e=>{t&&s(e)},d=()=>{t=void 0,l()},c=()=>{t=void 0,l()};L(`${o}-${e.props.id}`,e=>{const l=e.nextElementSibling;n(e),r(),function(e,t){const o=o=>{e&&(o.preventDefault(),t(o))};null==e||e.addEventListener("mousedown",o),null==e||e.addEventListener("touchstart",o)}(e,s),a||function(e,t){a=!0,e.addEventListener("blur",()=>{e.removeAttribute("data-prevent-focus-style")}),t.addEventListener("touchend",()=>{e.removeAttribute("data-prevent-focus-style"),e.blur()}),e.addEventListener("keydown",t=>{["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)&&e.removeAttribute("data-prevent-focus-style")})}(l,e),e.addEventListener("mousedown",e=>{l.focus(),l.setAttribute("data-prevent-focus-style","true"),t=Zc[o],s(e),document.addEventListener("mousemove",i),document.addEventListener("mouseup",d)}),e.addEventListener("touchstart",()=>{l.setAttribute("data-prevent-focus-style","true"),l.focus(),t=Zc[o],document.addEventListener("touchmove",p),document.addEventListener("touchend",c)})},r)}function L(t,o,n){s(t,()=>{var r;const s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(t);s&&(o(s),n&&w(s,n))},e.props.__root)}function I(){s(`swatches-${e.props.id}`,()=>{var t,o,n;d=Array.from((null===(t=e.props.__root)||void 0===t?void 0:t.querySelectorAll(`#swatches-${e.props.id} canvas`))||[]),d.forEach(e=>{w(e,T)}),e.props.focusedSwatch=null===(n=null===(o=d[0])||void 0===o?void 0:o.dataset)||void 0===n?void 0:n.color,P()},e.props.__root)}function A(){if(!a)return;const e=a.getContext("2d");if(!e)return;const t=a.width,o=a.height;for(let n=0;n<t;n++){const r=Math.floor(n/t*360);e.fillStyle=`hsl(${r}, 100%, 50%)`,e.fillRect(n,0,1,o)}}function C(){if(!i)return;const t=i.getContext("2d");if(!t)return;F(i,i.width/3);const{r:o,g:n,b:r,a:s}=e.props.rgba;t.fillStyle=`rgba(${o}, ${n}, ${r}, ${s})`,t.fillRect(0,0,i.width,i.height)}function D(){if(!p)return;const t=p.getContext("2d");if(!t)return;F(p,p.height/2);const{r:o,g:n,b:r,a:s}=e.props.rgba;t.fillStyle=`rgba(${o}, ${n}, ${r}, ${s})`,t.fillRect(0,0,p.width,p.height)}function T(e){if(!e)return;const t=e.getContext("2d");if(!t)return;F(e,e.width/2);const o=e.dataset.colorPrecise;if(!o)return;const[n,r,s,a]=jc(o),[l,i,p,d]=Hc(n,r,s,a);t.fillStyle=`hsla(${l}, ${i/255*100}%, ${p/255*100}%, ${d})`,t.fillRect(0,0,Math.round(e.width),Math.round(e.height))}function E(e,o,n){let r=null;const s=e=>{null!==r&&cancelAnimationFrame(r),r=requestAnimationFrame(()=>{if(!o)return;const t=o.getBoundingClientRect();let r,s;"touches"in e?(r=e.touches[0].clientX-t.left,s=e.touches[0].clientY-t.top):(r=e.clientX-t.left,s=e.clientY-t.top),r=Math.min(Math.max(r,0),t.width),s=Math.min(Math.max(s,0),t.height),n(r,s)})};s(e);const a=e=>{e.preventDefault(),s(e)},l=e=>{e.preventDefault(),s(e)},i=()=>{t=void 0,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",i)},p=()=>{t=void 0,document.removeEventListener("touchmove",l),document.removeEventListener("touchend",p)};"touches"in e?(document.addEventListener("touchmove",l),document.addEventListener("touchend",p)):(document.addEventListener("mousemove",a),document.addEventListener("mouseup",i))}function O(t){E(t,n,(t,o)=>{const r=t/n.width*100,s=100-o/n.height*100;g(e.props.hue,r,s)})}function M(t){E(t,a,(t,o)=>{if(!a)return;const n=a.width,r=Math.floor(t/n*360);e.props.h=r,g(e.props.h,e.props.s,e.props.v)})}function V(t){e.props.alpha&&E(t,l,(t,o)=>{const n=t/l.width*100/100;e.props.a=n,g(e.props.hue,e.props.s,e.props.v)})}function F(e,t){const o=e.getContext("2d");if(!o)return;const n=Math.ceil(e.height/t),r=Math.ceil(e.width/t);for(let e=0;e<n;e++)for(let n=0;n<r;n++)o.fillStyle=(e+n)%2==1?"#FFFFFF":"#CCCCCC",o.fillRect(n*t,e*t,t,t)}function P(){var t,o;if(!e.context||!e.props.options||!d)return;const{h:n,s:r,v:s,a:a}=e.props,l=function(e,t,o,n=1){const r=0===o?0:t;return`${Pc(0===o||100===o&&0===t?0:e,0)}-${Pc(r,0)}-${Pc(o,0)}-${Pc(n,2)}`}(n,r,s,a);let i=!1,p=!1;d.forEach(e=>{const t=e.dataset.color;if(!t)return;const[o,n,r,c]=t.split("-");"0"===r&&0===s&&c===`${a}`&&(p=!0);const u=e.parentElement;p||t===l?(u.dataset.active="true",e.ariaSelected="true",p=!1,!i&&d&&(x(d.indexOf(e)),i=!0)):(delete u.dataset.active,e.ariaSelected="false")}),i||(e.props.focusedSwatch=null===(o=null===(t=d[0])||void 0===t?void 0:t.dataset)||void 0===o?void 0:o.color)}function B(t){t=t.replace("#",""),e.props.hexInputFocused||3!==t.length||(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),t=`#${t=t.toUpperCase()}`,e.props.hex=t.slice(0,9)}function H(t,n,r,s=!1){e.props.h=void 0===t||isNaN(t)?e.props.h:Pc(Math.max(Math.min(t,360),0),2),e.props.s=void 0===n||isNaN(n)?e.props.s:Pc(Math.max(Math.min(n,100),0),2),e.props.v=void 0===r||isNaN(r)?e.props.v:Pc(Math.max(Math.min(r,100),0),2);const{h:a,s:l,v:i,a:p}=e.props,[d,c,u]=Hc(a,l,i),[f,v,h]=Nc(a,l,i),m=e.props.hexInputFocused?e.props.hex:Wc(a,l,i,p),g=Pc(p,2);e.props.hsla={h:a,s:c,l:u,a:g},e.props.hslaPercent={h:Pc(a,0),s:100===i&&0===l?0:Pc(0===i?c/255:Math.max(Math.min(c/255*100,100),0),0),l:Pc(Math.max(Math.min(e.props.hsla.l/255*100,100),0),0),a:g},e.props.hslaString=`hsla(${e.props.hslaPercent.h}, ${e.props.hslaPercent.s}%, ${e.props.hslaPercent.l}%, ${g})`,e.props.hslaStringPrecise=`hsla(${a}, ${Pc(0===i?c/255:c/255*100,2)}%, ${Pc(u/255*100,2)}%, ${g})`,e.props.rgba={r:f,g:v,b:h,a:g},e.props.rgbaString=`rgba(${f}, ${v}, ${h}, ${g})`,B(m),setTimeout(()=>{var t;R(),function(){const t=e.props.s,o=100-e.props.v;e.props.controlLSPosition={x:t,y:o}}(),$(),o||"undefined"==typeof window||(o=null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`[data-id="${e.props.id}"]`))},0);const b=e.props.valueFormat?e.props.valueFormat:e.props.format;s||("hex"===b?e.input(e.props.hex):"rgba"===b?e.input(e.props.rgbaString):"hsla"===b&&e.input(e.props.hslaStringPrecise))}function R(){f(),v(),h(),m()}e.addProps(["expanded","h","s","v","a","hsla","hslaPercent","hslaString","hslaStringPrecise","rgba","rgbaString","hex","controlLSPosition","panelActiveFormat","hexInputFocused","hasNativeEyeDropper","focusedSwatch","swatchIsUsingKeyboardNav","showPanelClose"]),e.props.h=e.props.h||void 0,e.props.s=e.props.s||void 0,e.props.v=e.props.v||void 0,e.props.a=e.props.a||1,e.props.controlLSPosition=e.props.controlLSPosition||{x:0,y:0},e.props.switchIcon=e.props.switchIcon||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M34.2 179.7L154.4 66.2c1.4-1.3 3.5-2.2 5.6-2.2s4.2 .8 5.6 2.2L285.8 179.7c1.4 1.3 2.2 3.2 2.2 5.2c0 3.9-3.2 7.1-7.1 7.1H39.1c-3.9 0-7.1-3.2-7.1-7.1c0-2 .8-3.8 2.2-5.2zm-22-23.3C4.4 163.8 0 174.1 0 184.9C0 206.5 17.5 224 39.1 224H280.9c21.6 0 39.1-17.5 39.1-39.1c0-10.8-4.4-21.1-12.3-28.4L187.6 42.9C180.1 35.9 170.2 32 160 32s-20.1 3.9-27.6 10.9L12.3 156.4zm22 175.9c-1.4-1.3-2.2-3.2-2.2-5.2c0-3.9 3.2-7.1 7.1-7.1H280.9c3.9 0 7.1 3.2 7.1 7.1c0 2-.8 3.8-2.2 5.2L165.6 445.8c-1.4 1.3-3.5 2.2-5.6 2.2s-4.2-.8-5.6-2.2L34.2 332.3zm-22 23.3L132.4 469.1c7.4 7 17.4 10.9 27.6 10.9s20.1-3.9 27.6-10.9L307.7 355.6c7.8-7.4 12.3-17.7 12.3-28.5c0-21.6-17.5-39.1-39.1-39.1H39.1C17.5 288 0 305.5 0 327.1c0 10.8 4.4 21.1 12.3 28.5z"/></svg>',e.props.hexInputFocused=!1,e.props.swatchIsUsingKeyboardNav=!1,e.on("destroying",()=>{e.context&&"undefined"!=typeof document&&document.removeEventListener("paste",b)}),e.on("created",()=>{var t,n;e.context&&("undefined"!=typeof window&&document.addEventListener("paste",b),e.props.expanded=!1,e.props.panelActiveFormat=e.props.format||u[0],e.props.panelControls=zc(e.props.panelControls),e.props.eyeDropper=zc(e.props.eyeDropper),e.props.panelFormat=zc(e.props.panelFormat),e.props.showValue=zc(e.props.showValue),e.props.allowPaste=zc(e.props.allowPaste),e.props.inline=r(e.props.inline),e.props.disabled=r(e.props.disabled),e.props.format=e.props.format||"hex",e.props.alpha=r(null===(n=null===(t=e.props)||void 0===t?void 0:t.alpha)||void 0===n||n),e.props.valueFormat=e.props.valueFormat||e.props.format,e.props.closeOnSelect=r(e.props.closeOnSelect),e.props.focusedSwatch=void 0,void 0===e.value||""===e.value||null===e.value?(e.props.rgba={r:0,g:0,b:0},H(0,0,0,!0)):y(`${e.value}`),e.on("input",({payload:t})=>{o&&void 0!==e.props.__root&&!o.contains(e.props.__root.activeElement)&&y(t)}),setTimeout(()=>{_()},5),k(),e.on("prop:expanded",()=>{var t;if(e.props.expanded)_(),k(),I(),document.addEventListener("keydown",o),window.innerWidth<=430&&!window.matchMedia("(hover: hover)").matches?e.props.showPanelClose=!0:e.props.showPanelClose=!1,setTimeout(()=>{var t;const o=null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`[data-id="${e.props.id}"] *:not(.formkit-swatch-preview)[tabindex="0"]`);o&&o.focus()},0);else{document.removeEventListener("keydown",o);(null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`[data-id="${e.props.id}"] *[tabindex="0"]`)).focus()}function o(t){"Escape"===t.key&&(t.preventDefault(),e.props.expanded=!1)}}),e.context.fns.anyToHsvaString=(e,t)=>{const o=Yc(e);if(!o)return"0-0-0-1";let[n,r,s,a]=o;return 0===t&&(n=0===s||100===s&&0===r?0:n),`${Pc(n,t)}-${Pc(r,t)}-${Pc(s,t)}-${Pc(a,2)}`},e.context.handlers.inputPreviewClick=t=>{e.props.expanded=!e.props.expanded},e.context.handlers.inputPreviewFocusout=t=>{var o,n,r;const s=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(`[data-id="${e.props.id}"] .formkit-inner`),a=t.relatedTarget;if(s.contains(a)){function l(t){var o,n;s.contains(t.target)||(e.props.expanded=!1,null===(o=e.props.__root)||void 0===o||o.removeEventListener("mousedown",l),null===(n=e.props.__root)||void 0===n||n.removeEventListener("touchstart",l))}null===(n=e.props.__root)||void 0===n||n.addEventListener("mousedown",l),null===(r=e.props.__root)||void 0===r||r.addEventListener("touchstart",l)}else e.props.expanded=!1},e.context.handlers.inputPreviewKeydown=t=>{"Escape"===t.key&&(t.preventDefault(),e.props.expanded=!1),"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.props.expanded=!e.props.expanded)},e.context.handlers.closePanel=()=>{e.props.expanded=!1},e.context.handlers.panelCloseKeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.props.expanded=!1)},e.context.handlers.toggleFormat=(t=1)=>{t="number"==typeof t?t:1;const o=(u.indexOf(e.props.panelActiveFormat)+t+u.length)%u.length;e.props.panelActiveFormat=u[o]},e.context.handlers.panelKeydown=t=>{var o,n,r;if("Tab"===t.key&&e.props.expanded){t.preventDefault();const s=Array.from((null===(o=e.props.__root)||void 0===o?void 0:o.querySelectorAll(`[data-id="${e.props.id}"] *:not(.formkit-swatch-preview)[tabindex="0"]`))||[]).filter(Gc),a=s.indexOf((null===(n=e.props.__root)||void 0===n?void 0:n.activeElement)?null===(r=e.props.__root)||void 0===r?void 0:r.activeElement:e.props.__root);let l;l=t.shiftKey?(a-1+s.length)%s.length:(a+1)%s.length,s[l].focus()}},e.context.handlers.lsKeydown=t=>{if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const{h:o,s:n,v:r}=e.props,s=t.shiftKey?10:1;switch(t.key){case"ArrowLeft":H(o,n-s,r);break;case"ArrowRight":H(o,n+s,r);break;case"ArrowUp":H(o,n,r+s);break;case"ArrowDown":H(o,n,r-s);break;case"PageUp":H(o,n,r+10);break;case"PageDown":H(o,n,r-10);break;case"Home":H(o,n-10,r);break;case"End":H(o,n+10,r)}R()}},e.context.handlers.hueControlKeydown=t=>{if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const{h:o,s:n,v:r}=e.props,s=t.shiftKey?10:1;switch(t.key){case"ArrowLeft":case"ArrowDown":H(o-s,n,r);break;case"ArrowRight":case"ArrowUp":H(o+s,n,r);break;case"PageUp":H(o+10,n,r);break;case"PageDown":H(o-10,n,r);break;case"Home":H(0,n,r);break;case"End":H(360,n,r)}R()}},e.context.handlers.alphaControlKeydown=t=>{if(e.props.alpha&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const{h:o,s:n,v:r,a:s}=e.props,a=t.shiftKey?.1:.01;switch(t.key){case"ArrowLeft":case"ArrowDown":e.props.a=Pc(Math.min(Math.max(s-a,0),1),2);break;case"ArrowRight":case"ArrowUp":e.props.a=Pc(Math.min(Math.max(s+a,0),1),2);break;case"PageUp":e.props.a=Pc(Math.min(Math.max(s+.1,0),1),2);break;case"PageDown":e.props.a=Pc(Math.min(Math.max(s-.1,0),1),2);break;case"Home":e.props.a=0;break;case"End":e.props.a=1}H(o,n,r)}},e.context.handlers.eyeDropperKeydown=t=>{var o;if("Enter"===t.key||" "===t.key){t.preventDefault();const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`eye-dropper-${e.props.id}`);null==n||n.click()}},e.context.handlers.formatSwitcherKeydown=t=>{e.context&&("Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),e.context.handlers.toggleFormat()),"ArrowUp"===t.key&&(t.preventDefault(),e.context.handlers.toggleFormat(-1)))},e.context.handlers.hexInput=t=>{const o=t.target,n=o.value.startsWith("#")?9:8,r=o.value.slice(0,n);if(o.value=e.props.alpha?r:r.slice(0,7),Uc(r)){const[t,o,n,s]=Bc(r);e.props.alpha&&(e.props.a=s),B(r),H(t,o,n)}},e.context.handlers.hexKeydown=t=>{const o=t.target,n=o.value;let r="";if(!Uc(n))return;const s=n.startsWith("#")?n.slice(1):n,a=8===s.length,l=a?s.substring(0,6):s,i=a?s.substring(6,8):"",p=t.shiftKey?10:1,d=16777215;let c;if(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key))switch(t.preventDefault(),t.key){case"ArrowUp":c=(parseInt(l,16)+p)%16777216;break;case"ArrowDown":c=(parseInt(l,16)-p+d+1)%16777216;break;case"PageUp":c=(parseInt(l,16)+10)%16777216;break;case"PageDown":c=(parseInt(l,16)-10+d+1)%16777216;break;case"Home":c=0;break;case"End":c=d}void 0!==c&&(r=c.toString(16).padStart(6,"0").toUpperCase()),r&&(o.value=a?`#${r}${i}`:`#${r}`),e.context&&e.context.handlers.hexInput(t)},e.context.handlers.hexFocus=()=>{e.context&&(e.props.hexInputFocused=!0)},e.context.handlers.hexBlur=t=>{if(!e.context)return;e.props.hexInputFocused=!1;const o=t.target.value;Uc(o)&&B(o)},e.context.handlers.rangeLimitInput=(t,o,n,r)=>s=>{const a=r||s;if(!a||!e.context)return;const l=a.target;if(l.value.endsWith("."))return;const i=Math.max(Math.min(Number(l.value),n),o);l.value=`${i}`;const p=l.id;if("hsla"===t){switch(p){case`h-${e.props.id}`:e.props.h=i;break;case`s-${e.props.id}`:e.props.hslaPercent.s=i;break;case`l-${e.props.id}`:e.props.hslaPercent.l=i}const[t,o,n]=Rc(e.props.h,2.55*e.props.hslaPercent.s,2.55*e.props.hslaPercent.l);H(t,o,n)}else if("rgba"===t){switch(p){case`r-${e.props.id}`:e.props.rgba.r=i;break;case`g-${e.props.id}`:e.props.rgba.g=i;break;case`b-${e.props.id}`:e.props.rgba.b=i}const[t,o,n]=Kc(e.props.rgba.r,e.props.rgba.g,e.props.rgba.b);H(t,o,n)}else"alpha"==t&&e.props.alpha&&(e.props.a=i,H())},e.context.handlers.rangeLimitKeydown=(t,o,n,r)=>s=>{if(!e.context)return;if(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Backspace","Tab","Enter"].includes(s.key)||s.metaKey||!/[a-zA-Z!@#$%^&*()_+={}\[\]:;"'<,>?\/|\\`~]/g.test(s.key)){if(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(s.key)){const a=s.target,l=Number(a.value),i=s.shiftKey?10*r:r;switch(s.key){case"ArrowUp":s.preventDefault(),a.value=`${Math.min(l+i,n)}`;break;case"ArrowDown":s.preventDefault(),a.value=`${Math.max(l-i,o)}`;break;case"PageUp":s.preventDefault(),a.value=`${Math.min(l+10*r,n)}`;break;case"PageDown":s.preventDefault(),a.value=`${Math.max(l-10*r,o)}`;break;case"Home":s.preventDefault(),a.value=`${o}`;break;case"End":s.preventDefault(),a.value=`${n}`}e.context.handlers.rangeLimitInput(t,o,n,s)()}}else s.preventDefault()},e.context.handlers.swatchClick=t=>{const o=t.target;if(o.dataset.colorPrecise){const[t,n,r,s]=jc(o.dataset.colorPrecise);e.props.alpha&&(e.props.a=s),H(t,n,r),e.props.closeOnSelect&&(e.props.expanded=!1)}e.context&&"keydown"!==t.type&&e.context.handlers.swatchKeydown(t)},e.context.handlers.swatchKeydown=t=>{var o,n,r,s;if(!e.context||!d||!d.length)return;const a=d.indexOf(t.currentTarget);let l=null;const i=function(e){var t;if(!e.length)return 0;const o=null===(t=e[0].parentElement)||void 0===t?void 0:t.parentElement;if(!o)return 0;const n=o.getBoundingClientRect().width,r=e[0].parentElement;if(!r)return 0;const s=r.getBoundingClientRect(),a=window.getComputedStyle(r),l=parseFloat(a.marginLeft)+parseFloat(a.marginRight),i=s.width+l;return Math.floor(n/i)}(d),p=d.length;let u=0,f=p,v=!1;const h=d[a].dataset.group;if(void 0!==h){const e=d.filter(e=>e.dataset.group===h);u=d.indexOf(e[0]),f=d.indexOf(e[e.length-1])}const m=(a-u)%i;if(!t.key||"Tab"===t.key)return t.key||(e.props.swatchIsUsingKeyboardNav=!1,c=m,x(a)),"Tab"===t.key&&(e.props.swatchIsUsingKeyboardNav=!1),void d.forEach(e=>{delete e.parentElement.dataset.focused});if("Enter"===t.key||" "===t.key)return t.preventDefault(),c=m,e.context.handlers.swatchClick(t),void x(a);switch("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(e.props.swatchIsUsingKeyboardNav=!0,t.preventDefault()),t.key){case"ArrowUp":l=Math.max(a-i,a-(i-(c-m))),v=!0;break;case"ArrowDown":l=Math.max(a+i,a+(i+(c-m))),v=!0;break;case"ArrowLeft":l=a-1,c=(l-u)%i;break;case"ArrowRight":l=a+1,c=(l-u)%i}if(v&&null!==l&&(l<u||l>f)){let e;e=l<u?null===(n=null===(o=d[u-1])||void 0===o?void 0:o.dataset)||void 0===n?void 0:n.group:null===(s=null===(r=d[f+1])||void 0===r?void 0:r.dataset)||void 0===s?void 0:s.group;const t=d.filter(e=>e.dataset.group===h),p=d.filter(t=>t.dataset.group===e),v=(a-u)%i,m=t.length%i||i,g=a>=u+t.length-m;if(l<u){const e=p.length%i||i;l=u-e+Math.min(Math.max(v,c),e-1)}else l>f&&(l=g?Math.min(f+Math.max(v,c)+1,d.indexOf(p[p.length-1])):Math.min(l,f))}if(null!==l&&l>=0&&l<p){x(l),d.forEach(e=>{delete e.parentElement.dataset.focused});const e=d[l],t=e.parentElement;e.focus(),t.dataset.focused="true"}})})},Yo,b,
|
|
61
|
+
/* #__PURE__ */$("removeAllValues"),b,function(e){!function(e){e.addProps(["search","options","selectedItems","activeValue","activeIndex","activeDescendant","targetOptions","sourceOptions","optionLoader","isLoadingOptions","filterOptions","inputText","hasNextPage","page","targetLoading","searchable","sourceLabel","targetLabel","transferOnSelect","disabled","placeholder","filter","showSourceEmptyMessage","showTargetEmptyMessage","sourceEmptyMessage","targetEmptyMessage","clearOnSelect","max","maxReached","debounce","sourceListActive","optionLoaderValues","optionLoadingCounter","optionsLoadingCounter","memoOptions","optionsLoaded","selectedSourceItems","selectedTargetItems","draggable","loadMore","loadMoreOption","targetSearchable","targetInputText"]),e.props.loadMoreOption={label:"Load more",value:bd},void 0===e.props.draggable?e.props.draggable=!0:"false"===e.props.draggable&&(e.props.draggable=!1),e.props.optionsLoaderValues=[],e.props.selectedSourceItems=[],e.props.selectedTargetItems=[],e.props.optionsLoaded=void 0,e.props.memoOptions=[],e.props.multiple=!0,e.props.debounce=e.props.debounce?parseInt(e.props.debounce):200,e.props.optionLoaderValues=[],e.props.optionsLoadingCounter=0,e.props.optionLoadingCounter=0,e.props.page=1,e.props.hasNextPage=Ft.bind(null,e),e.props.options?e.props.options=[...e.props.options]:e.props.options=[],e.props.sourceOptions=[],e.props.targetOptions=[],"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.props.searchable=r(e.props.searchable),e.props.searchable&&(e.props.inputText=""),e.props.targetSearchable=r(e.props.targetSearchable),e.props.targetSearchable&&(e.props.targetInputText=""),e.props.clearOnSelect=r(e.props.clearOnSelect),void 0===e.props.transferOnSelect?e.props.transferOnSelect=!0:"false"===e.props.transferOnSelect&&(e.props.transferOnSelect=!1),e.props.targetOptions.length&&(e.props.targetOptionValues=e.props.targetOptions.map(e=>vt(e))),e.props.initialOptions=[...e.props.options],e.props.max&&(e.props.max=parseInt(e.props.max)),e.props.sourceListOrigin=void 0,"function"!=typeof e.props.filter&&(e.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase()))}(e),function(e){e.on("commit",async({payload:t})=>{if(e.props.activeValue=void 0,e.props.max){const o=Array.isArray(t)?t.length:0;e.props.maxReached=o>=e.props.max}e.props.clearOnSelect&&e.props.inputText&&(e.props.reFilter=!0,e.props.inputText=""),e.props.memoOptions=[...new Set([...e.props.targetOptions,...e.props.memoOptions])],e.props.searchable&&e.props.reFilter&&!e.props.initialLoad?(St(e,e.props.inputText),e.props.reFilter=!1):e.props.initialLoad||(e.isCreated||(e.props.skipSetActiveValue=!0),Ld(e)),"function"==typeof e.props.optionLoader?Cd(e):e.props.initialLoad||(e.props.memoOptions=[...new Set([...e.props.targetOptions,...e.props.memoOptions])])})}(e),Md(e),function(e){e.on("prop:options",()=>{e.props.appendingOptions&&(e.props.skipSetActiveValue=!0,e.props.appendingOptions=!1),Ld(e)}),e.on("prop:memoOptions",()=>{e.props.skipSetActiveValue=!0,Ld(e)}),e.on("prop:sourceOptions",()=>{0===e.props.sourceOptions.length?e.props.showSourceEmptyMessage=!0:e.props.showSourceEmptyMessage=!1,yd.delete(e)}),e.on("prop:targetOptions",()=>{0===e.props.targetOptions.length?e.props.showTargetEmptyMessage=!0:e.props.showTargetEmptyMessage=!1}),e.on("prop:activeValue",({payload:t})=>{if(e.props.isDragging)return void(e.props.activeDescendant=void 0);if(t===bd)return void(e.props.activeDescendant=`${e.props.id}_load_more`);const o=(e.props.sourceListOrigin?e.props.sourceOptions:e.props.targetOptions).findIndex(e=>n(vt(e),t));o>=0&&e.props.sourceListOrigin?e.props.activeDescendant=`${e.props.id}_source_list_item_${o}`:e.props.activeDescendant=o>=0?`${e.props.id}_target_list_item_${o}`:void 0}),e.on("prop:mouseOnSource",({payload:t})=>{var o;if(t&&!0!==e.props.disabled&&!e.props.isDragging){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(e.props.id+"_source_list_items");if(!t)return;e.props.mouseOnTarget=!1,e.props.sourceListOrigin=!0,yd.delete(e),Fd(e,t)}}),e.on("prop:mouseOnTarget",({payload:t})=>{var o;if(t&&!0!==e.props.disabled&&!e.props.isDragging){const t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`);if(!t)return;e.props.mouseOnSource=!1,e.props.sourceListOrigin=!1,xd.delete(e),Fd(e,t)}}),e.on("prop:optionsLoadingCounter",({payload:t})=>{0===t&&0===e.props.optionLoadingCounter&&e.store.set(Ct)}),e.on("prop:optionLoadingCounter",({payload:t})=>{0===t&&0===e.props.optionsLoadingCounter&&(e.store.set(Ct),e.props.skipSetActiveValue=!0,Ld(e))})}(e)}]};const Hd=/* #__PURE__ */Te("sl"),{outer:Nd,wrapper:Rd,inner:Kd,icon:Wd,prefix:Ud,suffix:Yd,help:jd,messages:qd,message:zd}=/* #__PURE__ */Oe(Hd),Gd=Hd("label",()=>({if:"$label",$el:"label",attrs:{id:"$id + '_label'"}})),Zd=Hd("chart",()=>({$el:"div",if:"$chart"})),Xd=Hd("chartBar",()=>({$el:"div",for:["bar","index","$chart"],attrs:{"data-active":{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:"$bar.at >= $_value.0 && $bar.at <= $_value.1",else:"$bar.at >= $_value.1 && $bar.at <= $_value.0"},else:"$bar.at <= $_value"},style:{left:'$bar.at / ($max - $min) * 100 + "%"',width:'$: "calc(" + (100 / $chart.length) + "% - 2px)"',height:{if:"$largestBar",then:'$bar.value / $largestBar * 100 + "%"'}}}})),Jd=Hd("sliderInner",()=>({$el:"div",attrs:{"data-has-mark-labels":"$markLabels && $marks.length > 0"}})),Qd=Hd("track",()=>({$el:"div",attrs:{id:"$: 'track-' + $id",onClick:"$handlers.clickTrack"}})),ec=Hd("trackWrapper",()=>({$el:"div"})),tc=Hd("trackInner",()=>({$el:"div"})),oc=Hd("fill",()=>({$el:"div",attrs:{style:"$fillStyles"}})),nc=Hd("linkedValues",()=>({$el:"div"})),rc=Hd("maxValue",()=>({$formkit:"number",bind:"$computedMaxInputAttrs",ignore:!0,number:!0,value:{if:"$isMulti",then:"$_value.1",else:"$_value"},tabindex:{if:"$disabled",then:-1},onNode:"$handlers.maxNode",onBlur:"$handlers.inputBlur"})),sc=Hd("minValue",()=>({$formkit:"number",if:"$isMulti",bind:"$computedMinInputAttrs",ignore:!0,number:!0,value:{if:"$isMulti",then:"$_value.0",else:"$_value"},tabindex:{if:"$disabled",then:-1},onNode:"$handlers.minNode",onBlur:"$handlers.inputBlur"})),ac=Hd("marks",()=>({$el:"div",if:"$marks"})),lc=Hd("mark",()=>({$el:"span",for:["step","index","$marks"],attrs:{"data-active":{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:"$step.at >= $_value.0 && $step.at <= $_value.1",else:"$step.at >= $_value.1 && $step.at <= $_value.0"},else:"$step.at <= $_value"},class:{if:"$step.class",then:'$: $classes.mark + " " + $step.class',else:"$classes.mark"},style:{left:'$: $fns.calculateMarkPosition($step.at) + "%"'}}})),ic=Hd("markLabel",()=>({$el:"span",if:"$markLabels",children:{if:"$step.label !== undefined",then:"$step.label",else:""},attrs:{class:'$: $classes.markLabel + " " + $step.labelClass'}})),pc=Hd("handles",()=>({$el:"ul"})),dc=Hd("handleMax",()=>({$el:"li",attrs:{"data-active":"$dragging","data-is-target":'$lastHandleInteraction === "max"',"data-handle":"max","data-show-tooltip":"$tooltip",class:"$: 'formkit-handle ' + $classes.handle + ' ' + $classes.handleMax",onFocus:"$handlers.focus",onClick:"$handlers.clickHandle",onMousedown:"$handlers.startDrag",onTouchstartPassive:"$handlers.startDrag",style:"$maxHandleStyles",tabindex:{if:"$disabled",then:-1,else:0},onBlur:"$handlers.blur",onKeydown:"$handlers.keydown"}})),cc=Hd("handleMin",()=>({$el:"li",if:"$isMulti",attrs:{"data-active":"$dragging","data-is-target":'$lastHandleInteraction === "min"',"data-handle":"min","data-show-tooltip":"$tooltip",class:"$: $classes.handle + ' ' + $classes.handleMin",onFocus:"$handlers.focus",onClick:"$handlers.clickHandle",onMousedown:"$handlers.startDrag",onTouchstartPassive:"$handlers.startDrag",style:"$minHandleStyles",tabindex:{if:"$disabled",then:-1,else:0},onBlur:"$handlers.blur",onKeydown:"$handlers.keydown"}})),uc=Hd("handleMinInner",()=>({$el:"div",attrs:{class:'$: $classes.handleInner + " " + $classes.handleMinInner'}})),fc=Hd("handleMaxInner",()=>({$el:"div",attrs:{class:'$: $classes.handleInner + " " + $classes.handleMaxInner'}})),vc=Hd("tooltipMax",()=>({$el:"div",if:'$tooltip === true || $tooltip === "auto"',children:{if:"$isMulti",then:{if:"$_value.0 < $_value.1",then:'$tooltipFormat($_value.1, "max")',else:'$tooltipFormat($_value.0, "max")'},else:'$tooltipFormat($_value, "max")'},attrs:{class:"$classes.tooltip + ' ' + $classes.tooltipMax"}})),hc=Hd("tooltipMin",()=>({$el:"div",if:'$isMulti && ($tooltip === true || $tooltip === "auto")',children:{if:"$_value.0 < $_value.1",then:'$tooltipFormat($_value.0, "min")',else:'$tooltipFormat($_value.1, "min")'},attrs:{class:"$classes.tooltip + ' ' + $classes.tooltipMin"}})),mc={schema:/* #__PURE__ */Nd(/* #__PURE__ */Rd(/* #__PURE__ */Gd("$label"),/* #__PURE__ */jd("$help"),/* #__PURE__ */Jd(/* #__PURE__ */Wd("prefix"),/* #__PURE__ */Ud(),/* #__PURE__ */Qd(/* #__PURE__ */Zd(/* #__PURE__ */Xd()),/* #__PURE__ */ec(/* #__PURE__ */tc(/* #__PURE__ */oc(),/* #__PURE__ */ac(/* #__PURE__ */lc(/* #__PURE__ */ic())),/* #__PURE__ */pc(/* #__PURE__ */cc(/* #__PURE__ */hc(),/* #__PURE__ */uc()),/* #__PURE__ */dc(/* #__PURE__ */vc(),/* #__PURE__ */fc()))))),/* #__PURE__ */Yd(),/* #__PURE__ */Wd("suffix"),/* #__PURE__ */Me("$showInput && $isMulti === false",/* #__PURE__ */rc())),/* #__PURE__ */Me("$showInput && $isMulti",/* #__PURE__ */nc(/* #__PURE__ */sc(),/* #__PURE__ */rc())),/* #__PURE__ */qd(/* #__PURE__ */zd("$message.value")))),type:"input",family:"",props:["min","max","step","showInput","tooltip","tooltipFormat","inputAttrs","maxInputAttrs","minInputAttrs","marks","markLabels","snapToMarks","chart","scalingFunction","intervals"],features:[function(e){let t,o,a;e.addProps(["isMulti","maxHandleStyles","minHandleStyles","fillStyles","decimals","dragging","lastHandleInteraction","largestBar","computedMaxInputAttrs","computedMinInputAttrs"]);const l={linear:{forward:e=>e,reverse:e=>e},log:{forward:(t,o=e.props.min,n=e.props.max)=>n*Math.pow(t/n,1.5),reverse:(t,o=e.props.min,n=e.props.max)=>n*Math.pow(t/n,1/1.5)}};let i=!1;function p(){const e=document.activeElement;if(e instanceof HTMLInputElement){const t=e.value;e.value="",e.value=t}}function d(e){if(!e)return;const t={disabled:e.props.disabled,min:"number"==typeof e.props.min?e.props.min:0,max:"number"==typeof e.props.max?e.props.max:void 0,step:e.props.step||1};e.props.minInputAttrs=Object.assign(e.props.minInputAttrs||{},t),e.props.maxInputAttrs=Object.assign(e.props.maxInputAttrs||{},t),e.props.inputAttrs=e.props.inputAttrs&&"object"==typeof e.props.inputAttrs?Object.assign(e.props.inputAttrs,t):t,e.props.computedMaxInputAttrs=e.props.maxInputAttrs&&"object"==typeof e.props.maxInputAttrs?Object.assign({},e.props.inputAttrs,e.props.maxInputAttrs):e.props.inputAttrs,e.props.computedMinInputAttrs=e.props.minInputAttrs&&"object"==typeof e.props.minInputAttrs?Object.assign({},e.props.inputAttrs,e.props.minInputAttrs):e.props.inputAttrs}function c(t=e.props.chart){return Array.isArray(t)?t.reduce((e,t)=>{const o=parseFloat(`${t.value}`);return Number.isFinite(o)&&o>e?o:e},0):0}function u(t){const{min:o,max:n,intervals:r}=e.props;if(t=Math.min(Math.max(t,0),100),!r||0===r.length){k();const r=o+t/100*(n-o);return e.props.scalingFunction.reverse(r,o,n)}const s=v(r,o,n);for(let e=0;e<s.length;e++){const{value:o,step:n,left:r,width:a,stepsInInterval:l}=s[e];if(t>=r&&t<=r+a){const e=o+(t-r)/a*l*n,s=e%n;return y(s<n/2?e-s:e+(n-s))}}return t>100?n:t<0?o:void 0}function f(t,o=e.props.min,n=e.props.max){const r=e.props.intervals;if(!r||0===r.length){k();return(e.props.scalingFunction.forward(t,o,n)-o)/(n-o)*100}const s=v(r,o,n);for(let e=0;e<s.length;e++){const{value:o,step:r,left:a,width:l,stepsInInterval:i}=s[e],p=e<s.length-1?s[e+1].value:n;if(t>=o&&t<=p){return 100*((a+(t-o)/r/i*l)/100)}}return 100}function v(t,o=e.props.min,n=e.props.max){(t=[...t]).sort((e,t)=>e.value-t.value),t[0].value!==o&&t.unshift({value:o,step:e.props.step});let r=0;for(let e=0;e<t.length;e++){const o=t[e].value,s=((e<t.length-1?t[e+1].value:n)-o)/t[e].step;r+=s}let s=0;return t.map((e,o)=>{const a=e.value,l=((o<t.length-1?t[o+1].value:n)-a)/e.step,i=s/r*100;return s+=l,{value:e.value,step:e.step,left:i,width:l/r*100,stepsInInterval:l,totalSteps:r}})}function h(t=e._value){const o=parseFloat(`${e.props.min}`),n=parseFloat(`${e.props.max}`);let r,s=0;if(Array.isArray(t)){const e=[...t].sort(m);s=parseFloat(`${e[0]}`),r=parseFloat(`${e[1]}`)}else r=parseFloat(`${t}`);isNaN(s)&&(s=o),isNaN(r)&&(r=o),e.props.maxHandleStyles={left:`${f(r,o,n)}%`},e.props.isMulti&&Array.isArray(t)?(e.props.minHandleStyles={left:`${f(s,o,n)}%`},e.props.fillStyles={left:`${f(s,o,n)}%`,width:f(r,o,n)-f(s,o,n)+"%"}):e.props.fillStyles={left:"0%",width:`${f(r,o,n)}%`}}function m(e,t){return parseFloat(`${e}`)-parseFloat(`${t}`)}function g(o,n=!0){if(e.props.disabled)return;let r;if(void 0===o){if(e.props.isMulti){const t=[x(e.props.min),x(e.props.max)];e.input(t),h(t)}else{const t=x(e.props.min+(e.props.max-e.props.min)/2);e.input(t),h(t)}return}if(e.props.isMulti&&Array.isArray(e._value)&&!Array.isArray(o)){const n="min"===e.props.lastHandleInteraction?0:1,s=[...e._value];s[n]=o;const[a,l]=s;if(a>=l){const o=null==t?void 0:t.querySelector(`[data-handle="${"min"===e.props.lastHandleInteraction?"max":"min"}"]`);null==o||o.focus()}r=x([...s].sort(m))}else Array.isArray(o)?r=x(o):(r=x(o),r=isNaN(r)?e.props.min:r);e.props.snapToMarks&&(r=w(r));const s=x(b(r));n&&e.input(s),h(s)}function $(){if(e.props.isMulti&&Array.isArray(e._value)){const[t,n]=[...e._value];o&&o.input(y(t)),a&&a.input(y(n))}else a&&a.input(e._value)}function b(t){return e.props.isMulti&&Array.isArray(t)?[b(t[0]),b(t[1])]:(t=isNaN(t)?e.props.min:t,Math.min(Math.max(parseFloat(`${t}`),e.props.min),e.props.max))}function y(t){return parseFloat(t.toFixed(e.props.decimals))}function x(t){if(e.props.snapToMarks)return t;if(!e.props.intervals)return Array.isArray(t)?t.map(t=>y(Math.round(t/e.props.step)*e.props.step)):y(Math.round(t/e.props.step)*e.props.step);const o=v(e.props.intervals);if(Array.isArray(t))return t.map(t=>{const n=o.find((n,r)=>{var s;return t>=n.value&&t<((null===(s=o[r+1])||void 0===s?void 0:s.value)||e.props.max)});if(!n)return t;return y(n.value+Math.round((t-n.value)/n.step)*n.step)});{const n=o.find((n,r)=>{var s;return t>=n.value&&t<((null===(s=o[r+1])||void 0===s?void 0:s.value)||e.props.max)});if(!n)return t;return y(n.value+Math.round((t-n.value)/n.step)*n.step)}}function w(t){if(Array.isArray(t))return t[0]=w(t[0]),t[1]=w(t[1]),t;{const o=e.props.marks,n=o.reduce((e,o)=>Math.abs(o.at-t)<Math.abs(e.at-t)?o:e,o[0]);return n.at}}function k(){if(i)return;r(e.props.scalingFunction)?"string"==typeof e.props.scalingFunction?e.props.scalingFunction=l[e.props.scalingFunction]||l.linear:"object"==typeof e.props.scalingFunction&&(e.props.scalingFunction={...l.linear,...e.props.scalingFunction}):e.props.scalingFunction=l.linear,i=!0}e.props.maxHandleStyles={left:"0%"},e.props.fillStyles={left:"0%",width:"0%"},e.props.isMulti=!1,e.props.step=1,e.props.min=0,e.props.max=100,e.props.tooltipFormat="function"==typeof e.props.tooltipFormat?e.props.tooltipFormat:(e,t)=>{if(t)return e},e.props.largestBar=0,"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),e.on("created",()=>{var l;k(),e.props.isMulti=Array.isArray(e.value),e.props.step=parseFloat(`${e.props.step}`),e.props.decimals=(null===(l=e.props.step.toString().split(".")[1])||void 0===l?void 0:l.length)||0,e.props.min=e.props.min?parseFloat(`${e.props.min}`):0,e.props.max=e.props.max?parseFloat(`${e.props.max}`):100;const i=r(e.props.tooltip);e.props.tooltip=void 0===e.props.tooltip?"auto":i;const $=r(e.props.marks);if(e.props.marks=!!$&&(Array.isArray(e.props.marks)?e.props.marks:function(){const{min:t,max:o,step:n}=e.props,r=[];for(let e=t;e<=o;e+=n)r.push({at:e,label:e});return r}()),e.props.markLabels=r(e.props.markLabels),e.props.snapToMarks=r(e.props.snapToMarks),e.props.showInput=r(e.props.showInput),e.props.largestBar=e.props.chart?c():e.props.largestBar,d(e),s(`track-${e.props.id}`,()=>{var o;t=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`track-${e.props.id}`),g(e.value,!1),h()},e.props.__root),e.context){let r=0,s="";const l=e.context.handlers.blur;e.context.handlers.blur=t=>{l(t),e.emit("blur")},e.context.handlers.clickTrack=o=>{if(!t)return;e.props.dragging=!1;const{left:n,width:r}=t.getBoundingClientRect(),s=(o.clientX-n)/r;if(e.props.isMulti&&Array.isArray(e.value)){const[t,o]=e.value,n=Math.abs(t-s*e.props.max)<Math.abs(o-s*e.props.max)?"min":"max",r="min"===n?0:1;e.props.lastHandleInteraction=n,e.value[r]=u(100*s),g(e._value)}else g(u(100*s))},e.context.handlers.focus=o=>{if(!t)return;const n=o.target.dataset.handle;n&&(e.props.lastHandleInteraction=n)},e.context.handlers.clickHandle=t=>{t.stopPropagation(),e.props.attrs.onClick&&e.props.attrs.onClick(t),e.props.dragging=!1,g(e._value)},e.context.handlers.startDrag=o=>{if(!t)return;e.props.dragging=!0;const n="touchstart"===o.type,r=n?"touchmove":"mousemove",s=n?"touchend":"mouseup";e.props.lastHandleInteraction=o.target.dataset.handle||e.props.lastHandleInteraction,document.addEventListener(r,_,{passive:!1}),document.addEventListener(s,()=>{e.context&&(e.props.dragging=!1,document.removeEventListener(r,_),n&&o.target instanceof HTMLElement&&o.target.blur())})},e.context.handlers.keydown=t=>{if(["1","2","3","4","5","6","7","8","9","0",".","-"].includes(t.key)){t.preventDefault(),clearTimeout(r),s+=t.key;const e="-"===s?-1:1;r=window.setTimeout(()=>{"-"!==s?(g(parseFloat(s)*e),s=""):s=""},350)}if(["ArrowLeft","ArrowDown","ArrowRight","ArrowUp","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const o="min"===e.props.lastHandleInteraction?0:1,n=Array.isArray(e._value)?e._value[o]:e._value,r=function(t,o){if(!e.props.intervals)return e.props.step;const n=v(e.props.intervals);if(t>=e.props.max)return n[n.length-1].step;let r=n.find((o,r)=>{var s;return t>=o.value&&t<((null===(s=n[r+1])||void 0===s?void 0:s.value)||e.props.max)});if(!r)return e.props.step;if(-1===o){t-r.step<r.value&&(r=n[n.indexOf(r)-1]||r)}return r.step}(n,["ArrowLeft","ArrowDown","PageDown"].includes(t.key)?-1:1);if(e.props.marks&&e.props.snapToMarks){const o=w(n),r=e.props.marks.find(e=>e.at===o),s=e.props.marks.indexOf(r),a=["ArrowLeft","ArrowDown"].includes(t.key)?-1:1,l=Math.min(Math.max(0,s+a),e.props.marks.length-1);return void g(e.props.marks[l].at)}if(t.metaKey)return void("ArrowLeft"===t.key||"ArrowDown"===t.key?g(e.props.min):g(e.props.max));if("Home"===t.key)return void g(e.props.min);if("End"===t.key)return void g(e.props.max);if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)){g(n+(t.shiftKey?10*r:r)*(["ArrowLeft","ArrowDown"].includes(t.key)?-1:1))}"PageUp"===t.key?g(n+10*r):"PageDown"===t.key&&g(n-10*r)}},e.context.handlers.maxNode=t=>{a=t,t.hook.commit((o,r)=>{if(n(t.value,o))return r(o);if(`${t.value}`.includes(".")&&!`${o}`.includes(".")&&p(),e.props.isMulti&&Array.isArray(e._value)){g([e._value[0],o])}else g(o);return r(b(o))})},e.context.handlers.minNode=t=>{o=t,t.hook.commit((o,r)=>{if(n(t.value,o))return r(o);if(`${t.value}`.includes(".")&&!`${o}`.includes(".")&&p(),e.props.isMulti&&Array.isArray(e._value)){g([o,e._value[1]])}else g(o);return r(b(o))})},e.context.handlers.inputBlur=()=>{if(e.props.isMulti&&Array.isArray(e._value)){g([...e._value].sort(m))}},e.context.fns.calculateMarkPosition=t=>f(t,e.props.min,e.props.max)}let y;function _(o){var n;if(!t||!e.props.dragging)return;o.preventDefault();const r=o.clientX||(null===(n=o.touches)||void 0===n?void 0:n.length)&&o.touches[0].clientX,{left:s,width:a}=t.getBoundingClientRect(),l=x(u((r-s)/a*100));y!==l&&(y=l,g(l))}g(e.value)}),e.on("input",({payload:e})=>{g(e,!1),$()}),e.on("prop:disabled",()=>{d(e),e.props.disabled||(g(e._value,!1),$())}),e.on("prop:max",()=>{e.props.max=e.props.max?parseFloat(`${e.props.max}`):100,g(e.value),d(e)}),e.on("prop:min",()=>{e.props.min=e.props.min?parseFloat(`${e.props.min}`):0,g(e.value),d(e)}),e.on("prop:chart",({payload:t})=>{e.props.largestBar=c(t)})}]},gc=/* #__PURE__ */Te("cp"),{outer:$c,wrapper:bc,inner:yc,label:xc,prefix:wc,suffix:kc,help:_c,messages:Sc,message:Lc,icon:Ic}=/* #__PURE__ */Oe(gc),Ac=gc("swatchPreview",()=>({$el:"div",attrs:{id:"$id",class:"$classes.swatchPreview",tabindex:{if:"$disabled",then:-1,else:0},onClick:"$handlers.inputPreviewClick",onFocusout:"$handlers.inputPreviewFocusout",onKeydown:"$handlers.inputPreviewKeydown",role:"button","aria-valuetext":'$: "Current color: " + $value'}})),Cc=gc("valueString",()=>({$el:"span",attrs:{class:"$classes.valueString"},children:{if:'$format === "hex"',then:"$hex",else:{if:'$format === "rgba"',then:"$rgbaString",else:{if:'$format === "hsla"',then:"$hslaString",else:""}}}})),Dc=gc("panel",()=>({$el:"div",attrs:{id:'$: $id + "_popover"',class:"$classes.panel",onKeydown:"$handlers.panelKeydown","aria-role":{if:"$layout === popover",then:"dialog"},"aria-modal":{if:"$layout === popover",then:"true"},"aria-label":"$label",popover:"$popover",style:{if:"$usePopover",then:{margin:0,top:'$popoverCoordinates.y + "px"',left:'$popoverCoordinates.x + "px"'},else:{position:{if:"$inline === undefined || $inline === false",then:"absolute"}}}}})),Tc=gc("panelClose",()=>({$el:"button",attrs:{type:"button",class:"$classes.panelClose",onClick:"$handlers.closePanel",tabindex:{if:"$showPanelClose",then:-1,else:0},onKeydown:"$handlers.panelCloseKeydown","aria-label":"$ui.close.value"}})),Oc=gc("controlGroup",()=>({$el:"div",attrs:{class:"$classes.controlGroup","data-eye-dropper":"$hasNativeEyeDropper && $eyeDropper",role:"group"}})),Ec=gc("LS",()=>({$el:"div",attrs:{class:"$classes.LS"}})),Mc=gc("canvasLS",()=>({$el:"canvas",attrs:{id:'$: "canvas-ls-" + $id',class:'$classes.canvas + " " + $classes.canvasLS',width:256,height:256,"aria-hidden":"true"}})),Vc=gc("controlLS",()=>({$el:"div",attrs:{tabindex:{if:"$disabled",then:-1,else:0},class:'$classes.control + " " + $classes.controlLS',onKeydown:"$handlers.lsKeydown",style:{left:'$controlLSPosition.x + "%"',top:'$controlLSPosition.y + "%"',backgroundColor:'$: "hsl(" + $hsla.h + "deg, " + ($hsla.s / 255) * 100 + "%, " + ($hsla.l / 255) * 100 + "%)"'},role:"slider","aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":'$: "Lightness: " + $hslaPercent.l + "%, Saturation: " + $hslaPercent.s + "%"'}})),Fc=gc("hue",()=>({$el:"div",attrs:{class:"$classes.hue"}})),Pc=gc("canvasHue",()=>({$el:"canvas",attrs:{id:'$: "canvas-hue-" + $id',class:'$classes.canvas + " " + $classes.canvasHue',width:256,height:10,"aria-hidden":"true"}})),Bc=gc("controlHue",()=>({$el:"div",attrs:{tabindex:{if:"$disabled",then:-1,else:0},onKeydown:"$handlers.hueControlKeydown",class:'$classes.control + " " + $classes.controlHue',style:{left:'$: "min(max(" + (($hsla.h / 360) * 100) + "%, 3px), calc(100% - 3px))"',backgroundColor:'$: "hsl(" + $hsla.h + "deg, 100%, 50%)"'},role:"slider","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":"$h"}})),Hc=gc("alpha",()=>({$el:"div",attrs:{class:"$classes.alpha",style:{opacity:{if:"$alpha",then:"1",else:"0.5"},cursor:{if:"$alpha",then:"",else:"not-allowed"},filter:{if:"$alpha",then:"",else:"grayscale(1)"}}}})),Nc=gc("canvasAlpha",()=>({$el:"canvas",attrs:{id:'$: "canvas-alpha-" + $id',class:'$classes.canvas + " " + $classes.canvasAlpha',width:256,height:10,"aria-hidden":"true",style:{pointerEvents:{if:"$alpha",then:"auto",else:"none"}}}})),Rc=gc("controlAlpha",()=>({$el:"div",attrs:{tabindex:{if:"$disabled || $alpha === undefined",then:-1,else:0},onKeydown:"$handlers.alphaControlKeydown",class:'$classes.control + " " + $classes.controlAlpha',style:{left:'$: "min(max(" + ($hsla.a * 100) + "%, 3px), calc(100% - 3px))"',backgroundImage:'$: "linear-gradient(to right, hsla(" + $hsla.h + "deg, " + ($hsla.s / 255) * 100 + "%, " + ($hsla.l / 255) * 100 + "%, " + $hsla.a + "), hsla(" + $hsla.h + "deg, " + ($hsla.s / 255) * 100 + "%, " + ($hsla.l / 255) * 100 + "%, " + $hsla.a + ")), linear-gradient(to right, white, white)"',pointerEvents:{if:"$alpha",then:"auto",else:"none"}},role:"slider","aria-valuemin":0,"aria-valuemax":1,"aria-valuenow":"$hsla.a"}})),Kc=gc("preview",()=>({$el:"div",attrs:{class:"$classes.preview"}})),Wc=gc("canvasPreview",()=>({$el:"canvas",attrs:{id:'$: "canvas-preview-" + $id',class:'$classes.canvas + " " + $classes.canvasPreview',width:33,height:33,"aria-hidden":"true"}})),Uc=gc("canvasSwatchPreview",()=>({$el:"div",attrs:{class:"$classes.canvasSwatchPreviewWrapper"},children:[{$el:"canvas",attrs:{id:'$: "canvas-swatch-preview-" + $id',class:'$classes.canvas + " " + $classes.canvasSwatchPreview',width:33,height:33,"aria-hidden":"true"}}]})),Yc=gc("eyeDropper",()=>({$el:"div",attrs:{tabindex:{if:"$disabled",then:-1,else:0},role:"button",onKeydown:"$handlers.eyeDropperKeydown",id:'$: "eye-dropper-" + $id',class:"$classes.eyeDropper"}})),jc=gc("formatField",()=>({$el:"div",attrs:{class:"$classes.formatField"}})),qc=gc("colorInputGroup",()=>({$el:"div",attrs:{class:"$classes.colorInputGroup","aria-role":"group"}})),zc=gc("hexField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.hexFieldGroup'},children:[{$el:"input",attrs:{onInput:"$handlers.hexInput",onKeydown:"$handlers.hexKeydown",onFocus:"$handlers.hexFocus",onBlur:"$handlers.hexBlur",id:'$: "hex-" + $id',tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",class:'$classes.colorField + " " + $classes.hexField',value:"$hex",autocomplete:"off"}},{$el:"label",children:"HEX",attrs:{for:'$: "hex-" + $id',class:"$classes.fieldLabel"}}]})),Gc=gc("rField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.rFieldGroup'},children:[{$el:"input",attrs:{id:'$: "r-" + $id',onInput:'$handlers.rangeLimitInput("rgba", 0, 255)',onKeydown:'$handlers.rangeLimitKeydown("rgba", 0, 255, 1)',type:"number",class:'$classes.colorField + " " + $classes.rField',min:0,max:255,step:1,tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$rgba.r",autocomplete:"off"}},{$el:"label",children:"R",attrs:{for:'$: "r-" + $id',class:"$classes.fieldLabel"}}]})),Zc=gc("gField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.gFieldGroup'},children:[{$el:"input",attrs:{id:'$: "g-" + $id',onInput:'$handlers.rangeLimitInput("rgba", 0, 255)',onKeydown:'$handlers.rangeLimitKeydown("rgba", 0, 255, 1)',type:"number",class:'$classes.colorField + " " + $classes.gField',min:0,max:255,step:1,tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$rgba.g",autocomplete:"off"}},{$el:"label",children:"G",attrs:{for:'$: "g-" + $id',class:"$classes.fieldLabel"}}]})),Xc=gc("bField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.bFieldGroup'},children:[{$el:"input",attrs:{id:'$: "b-" + $id',onInput:'$handlers.rangeLimitInput("rgba", 0, 255)',onKeydown:'$handlers.rangeLimitKeydown("rgba", 0, 255, 1)',type:"number",class:'$classes.colorField + " " + $classes.bField',min:0,max:255,step:1,tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$rgba.b",autocomplete:"off"}},{$el:"label",children:"B",attrs:{for:'$: "b-" + $id',class:"$classes.fieldLabel"}}]})),Jc=gc("aField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.aFieldGroup'},children:[{$el:"input",attrs:{id:'$: "a-" + $id',onInput:'$handlers.rangeLimitInput("alpha", 0, 1)',onKeydown:'$handlers.rangeLimitKeydown("alpha", 0, 1, 0.01)',type:"text",class:'$classes.colorField + " " + $classes.aField',value:"$rgba.a",tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled || $alpha === undefined",autocomplete:"off",style:{opacity:{if:"$alpha",then:"1",else:"0.33"},cursor:{if:"$alpha",then:void 0,else:"not-allowed"}},"aria-valuemin":0,"aria-valuemax":1,"aria-valuenow":"$rgba.a"}},{$el:"label",children:"A",attrs:{for:'$: "a-" + $id',class:"$classes.fieldLabel",style:{opacity:{if:"$alpha",then:"1",else:"0.33"}}}}]})),Qc=gc("hField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.hFieldGroup'},children:[{$el:"input",attrs:{id:'$: "h-" + $id',onInput:'$handlers.rangeLimitInput("hsla", 0, 360)',onKeydown:'$handlers.rangeLimitKeydown("hsla", 0, 360, 1)',type:"text",class:'$classes.colorField + " " + $classes.hField',tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$hslaPercent.h",autocomplete:"off","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":"$hsla.h"}},{$el:"label",children:"H",attrs:{for:'$: "h-" + $id',class:"$classes.fieldLabel"}}]})),eu=gc("sField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.sFieldGroup'},children:[{$el:"input",attrs:{id:'$: "s-" + $id',onInput:'$handlers.rangeLimitInput("hsla", 0, 100)',onKeydown:'$handlers.rangeLimitKeydown("hsla", 0, 100, 1)',type:"text",class:'$classes.colorField + " " + $classes.sField',tabindex:{if:"$disabled",then:-1,else:0},value:"$hslaPercent.s",autocomplete:"off","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":"$hsla.s"}},{$el:"label",children:"S",attrs:{for:'$: "s-" + $id',class:"$classes.fieldLabel"}}]})),tu=gc("lField",()=>({$el:"div",attrs:{class:'$classes.fieldGroup + " " + $classes.lFieldGroup'},children:[{$el:"input",attrs:{id:'$: "l-" + $id',onInput:'$handlers.rangeLimitInput("hsla", 0, 100)',onKeydown:'$handlers.rangeLimitKeydown("hsla", 0, 100, 1)',type:"text",class:'$classes.colorField + " " + $classes.lField',tabindex:{if:"$disabled",then:-1,else:0},disabled:"$disabled",value:"$hslaPercent.l",autocomplete:"off","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":"$hsla.l"}},{$el:"label",children:"L",attrs:{for:'$: "l-" + $id',class:"$classes.fieldLabel"}}]})),ou=gc("formatSwitcher",()=>({$el:"div",attrs:{class:"$classes.formatSwitcher",onClick:"$handlers.toggleFormat",tabindex:{if:"$disabled",then:-1,else:0},onKeydown:"$handlers.formatSwitcherKeydown",role:"button","aria-label":"$ui.next.value"}})),nu=gc("swatches",()=>({$el:"div",attrs:{id:'$: "swatches-" + $id',class:"$classes.swatches","data-keyboard-nav":"$swatchIsUsingKeyboardNav"}})),ru=gc("swatch",()=>({$el:"div",for:["swatch","index","$options"],if:"$swatch",attrs:{if:"$swatch.group",then:{class:"$classes.swatchGroup"},else:{class:"$classes.swatch",title:"$swatch.label"}},children:{if:"$swatch.group",then:[{$el:"span",attrs:{class:"$classes.swatchGroupLabel"},children:"$swatch.group"},{$el:"div",for:["groupSwatch","swatchIndex","$swatch.options"],attrs:{class:"$classes.swatch",title:"$groupSwatch.label"},children:[{$el:"canvas",attrs:{class:"$classes.swatchCanvas",width:21,height:21,onClick:"$handlers.swatchClick",onKeydown:"$handlers.swatchKeydown",tabindex:{if:"$: ($focusedSwatch === $fns.anyToHsvaString($groupSwatch.value, 0))",then:{if:"$disabled",then:-1,else:0},else:-1},key:'$groupSwatch.label + "-" + $groupSwatch.value',"data-color":"$fns.anyToHsvaString($groupSwatch.value, 0)","data-color-precise":"$fns.anyToHsvaString($groupSwatch.value, 2)","data-group":"$index","data-label":"$swatch.label",role:"button","aria-label":"$swatch.label"}}]}],else:{$el:"canvas",attrs:{class:"$classes.swatchCanvas",width:21,height:21,onClick:"$handlers.swatchClick",onKeydown:"$handlers.swatchKeydown",tabindex:{if:"$: ($focusedSwatch === $fns.anyToHsvaString($swatch.value, 0))",then:{if:"$disabled",then:-1,else:0},else:-1},key:'$swatch.label + "-" + $swatch.value',"data-color":"$fns.anyToHsvaString($swatch.value, 0)","data-color-precise":"$fns.anyToHsvaString($swatch.value, 2)","data-group":0,"data-label":"$swatch.label",role:"button","aria-label":"$swatch.label"}}}})),su=/rgba?\((\d+%?)\s*(?:,?\s*|\s+)(\d+%?)\s*(?:,?\s*|\s+)(\d+%?)(?:\s*(?:,?\s*|\s+|\/\s*)(\d*(?:\.\d+)?%?))?\)/i,au=/^hsla?\((\d{1,3}deg|[\d.]+)\s*,?\s*([\d.]+%)\s*,?\s*([\d.]+%)(?:\s*,?\s*([\d.]+%?))?\)$/i;function lu(e,t){const o=Math.pow(10,t);return Math.round(e*o)/o}function iu(e){const[t,o,n,r]=function(e){e=e.replace("#",""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16),r=e.length>=8?parseInt(e.slice(6,8),16)/255:1;return function(e,t,o,n=1){const r=e/255,s=t/255,a=o/255,l=Math.max(r,s,a),i=Math.min(r,s,a);let p,d=0;const c=(l+i)/2;if(l===i)d=p=0;else{const e=l-i;switch(p=c>.5?e/(2-l-i):e/(l+i),l){case r:d=(s-a)/e+(s<a?6:0);break;case s:d=(a-r)/e+2;break;case a:d=(r-s)/e+4}d*=60}return[d,255*p,255*c,n]}(t,o,n,r)}(e);return[...du(t,o,n,r)]}function pu(e,t,o,n=1){const r=t/100,s=o/100,a=(2-r)*s/2;return 0!==a&&(1===a||(t=a<.5?r*s/(2*a):r*s/(2-2*a))),[e,lu(255*t,2),lu(255*a,2),n]}function du(e,t,o,n=1){const r=lu(t/255,4),s=lu(o/255,4);if(1===s)return[e,0,100,n];const a=lu(s+r*Math.min(s,1-s),4);let l=t/2.55;return 0!==a&&(l=1!==s&&0!==s?2*(a-s)/a*100:t/2.55),[e,lu(l,2),lu(100*a,2),n]}function cu(e,t,o,n=1){const r=o/100,s=r*(t/100),a=s*(1-Math.abs(e/60%2-1)),l=r-s;let i=0,p=0,d=0;return[i,p,d]=e<60?[s,a,0]:e<120?[a,s,0]:e<180?[0,s,a]:e<240?[0,a,s]:e<300?[a,0,s]:[s,0,a],i=Math.round(255*(i+l)),p=Math.round(255*(p+l)),d=Math.round(255*(d+l)),[Math.min(Math.max(i,0),255),Math.min(Math.max(p,0),255),Math.min(Math.max(d,0),255),n]}function uu(e,t,o,n=1){const r=e/255,s=t/255,a=o/255,l=Math.max(r,s,a),i=Math.min(r,s,a);let p=0;const d=l,c=l-i,u=0===l?0:c/l;if(l!==i){switch(l){case r:p=(s-a)/c+(s<a?6:0);break;case s:p=(a-r)/c+2;break;case a:p=(r-s)/c+4}p/=6}return[360*p,100*u,100*d,n]}function fu(e,t,o,n=1){const[r,s,a,l]=cu(e,t,o,n);return function(e,t,o,n=1){const r=e=>Math.round(e).toString(16).padStart(2,"0").toUpperCase(),s=function(e){return Math.round(255*e).toString(16).padStart(2,"0").toUpperCase()}(n);return"#"+r(e)+r(t)+r(o)+`${"FF"===s?"":s}`}(r,s,a,l)}function vu(e){return/^(#?)([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.test(e)}function hu(e){if(e){if(vu(e))return iu(e);if(e.startsWith("rgb")){const t=e.match(su);if(!t)return[0,0,0,1];const o=e=>e.endsWith("%")?Math.round(2.55*Number(e.slice(0,-1))):Number(e);return uu(o(t[1]),o(t[2]),o(t[3]),t[4]?t[4].endsWith("%")?Number(t[4].slice(0,-1))/100:Number(t[4]):1)}if(e.startsWith("hsl")){const t=e.match(au);if(!t)return[0,0,0,1];const o=Number(t[1].replace("deg","").trim()),n=Number(t[2].slice(0,-1))/100,r=Number(t[3].slice(0,-1))/100,s=t[4]?t[4].endsWith("%")?Number(t[4].slice(0,-1))/100:Number(t[4]):1;return du(o,lu(255*n,2),lu(255*r,2),s)}}}function mu(e){const[t,o,n,r]=e.split("-").map(e=>Number(e));return[t,o,n,r]}function gu(e,t=150,o=!0){let n=null,r=!0;return(...s)=>{const a=()=>{e(...s),n=null};o&&r&&(r=!1,a()),n||(n=setTimeout(a,t))}}function $u(e){return!1!==e&&"false"!==e}function bu(e){return e.tabIndex>=0&&!e.disabled&&null!==e.offsetParent}const yu={"canvas-ls":"LS","canvas-hue":"Hue","canvas-alpha":"Alpha"};const xu={schema:/* #__PURE__ */$c(/* #__PURE__ */bc(/* #__PURE__ */xc("$label"),/* #__PURE__ */Me("$inline && $help",/* #__PURE__ */_c("$help")),/* #__PURE__ */yc(/* #__PURE__ */Me("($inline === undefined || $inline === false) && $prefixIcon !== undefined",/* #__PURE__ */Ic("prefix","label")),/* #__PURE__ */Me("$inline === undefined || $inline === false",/* #__PURE__ */wc()),/* #__PURE__ */Me("$inline === undefined || $inline === false",/* #__PURE__ */Ac(/* #__PURE__ */Uc(),/* #__PURE__ */Me("$showValue",/* #__PURE__ */Cc()))),/* #__PURE__ */Me("$inline || $expanded)",/* #__PURE__ */Dc(/* #__PURE__ */Me("$showPanelClose && ($inline === undefined || $inline === false)",/* #__PURE__ */Tc(/* #__PURE__ */Ic("close"))),/* #__PURE__ */Me("$panelControls",/* #__PURE__ */Oc(/* #__PURE__ */Ec(/* #__PURE__ */Mc(),/* #__PURE__ */Vc()),/* #__PURE__ */Kc(/* #__PURE__ */Wc()),/* #__PURE__ */Fc(/* #__PURE__ */Pc(),/* #__PURE__ */Bc()),/* #__PURE__ */Hc(/* #__PURE__ */Nc(),/* #__PURE__ */Rc()),/* #__PURE__ */Me("$eyeDropper && $hasNativeEyeDropper",/* #__PURE__ */Yc(/* #__PURE__ */Ic("eyeDropper"))))),/* #__PURE__ */Me("$panelFormat",/* #__PURE__ */jc(/* #__PURE__ */qc(/* #__PURE__ */Me('$panelActiveFormat === "hex"',/* #__PURE__ */zc()),/* #__PURE__ */Me('$panelActiveFormat === "rgba"',/* #__PURE__ */Gc()),/* #__PURE__ */Me('$panelActiveFormat === "rgba"',/* #__PURE__ */Zc()),/* #__PURE__ */Me('$panelActiveFormat === "rgba"',/* #__PURE__ */Xc()),/* #__PURE__ */Me('$panelActiveFormat === "hsla"',/* #__PURE__ */Qc()),/* #__PURE__ */Me('$panelActiveFormat === "hsla"',/* #__PURE__ */eu()),/* #__PURE__ */Me('$panelActiveFormat === "hsla"',/* #__PURE__ */tu()),/* #__PURE__ */Me('$panelActiveFormat === "rgba" || $panelActiveFormat === "hsla"',/* #__PURE__ */Jc())),/* #__PURE__ */ou(/* #__PURE__ */Ic("switch")))),/* #__PURE__ */Me("$options",/* #__PURE__ */nu(/* #__PURE__ */ru())))),/* #__PURE__ */Me("$inline === undefined || $inline === false",/* #__PURE__ */kc()),/* #__PURE__ */Me("($inline === undefined || $inline === false) && $suffixIcon !== undefined",/* #__PURE__ */Ic("suffix"))),/* #__PURE__ */Me("$: ($inline === undefined || $inline === false) && $help",/* #__PURE__ */_c("$help"))),/* #__PURE__ */Sc(/* #__PURE__ */Lc("$message.value"))),type:"input",family:"text",props:["disbaled","format","valueFormat","alpha","panelControls","panelFormat","eyeDropper","inline","options","showValue","closeOnSelect","allowPaste"],features:[function(e){let t,o=null,n=null,a=null,l=null,i=null,p=null,d=null,c=0;const u=["hex","rgba","hsla"],f=new WeakSet;let v=!1;const h=gu(function(){if(!n)return;const t=n.getContext("2d");if(!t)return;const{width:o,height:r}=n,s=e.props.h||0;t.fillStyle=`hsl(${s}, 100%, 50%)`,t.fillRect(0,0,o,r);const a=t.createLinearGradient(0,0,o,0);a.addColorStop(0,"rgba(255, 255, 255, 1)"),a.addColorStop(1,"rgba(255, 255, 255, 0)"),t.fillStyle=a,t.fillRect(0,0,o,r);const l=t.createLinearGradient(0,0,0,r);l.addColorStop(0,"rgba(0,0,0,0)"),l.addColorStop(1,"rgba(0,0,0,1)"),t.fillStyle=l,t.fillRect(0,0,o,r)},2),m=gu(function(){if(!l)return;const t=l.getContext("2d");if(!t)return;const o=Math.round(l.width),n=Math.round(l.height);t.clearRect(0,0,o,n),B(l,n/2);const r=e.props.rgba.r||0,s=e.props.rgba.g||0,a=e.props.rgba.b||0,i=t.createLinearGradient(0,0,o,0);i.addColorStop(0,`rgba(${r}, ${s}, ${a}, 0)`),i.addColorStop(1,`rgba(${r}, ${s}, ${a}, 1)`),t.fillStyle=i,t.fillRect(0,0,o,n)},2),g=gu(T,2),$=gu(O,2),b=gu(R,2),y=gu(H,10,!1);function x(t){var n,r;if(!e.context||!e.props.allowPaste||e.props.disabled)return;const s=null===(n=e.props.__root)||void 0===n?void 0:n.activeElement;if(o&&o.contains(s)){const o=null===(r=t.clipboardData)||void 0===r?void 0:r.getData("text");if(!o)return;if("INPUT"===s.tagName&&!vu(o)&&!su.test(o)&&!au.test(o))return;(vu(o)||o.startsWith("hsl")||o.startsWith("rgb"))&&(e.props.hexInputFocused&&(e.props.hexInputFocused=!1,setTimeout(()=>{e.props.hexInputFocused=!0},10)),t.preventDefault(),w(o))}}function w(t){var o;if(!t)return;const n=hu(t);if(n){const[o,r,s,a]=n;"undefined"!==t&&("number"!=typeof o||isNaN(o)||"number"!=typeof r||isNaN(r)||"number"!=typeof s||isNaN(s)||"number"!=typeof a||isNaN(a)||lu(o,2)===e.props.h&&lu(r,2)===e.props.s&&lu(s,2)===e.props.v&&lu(a,2)===e.props.a)||(e.props.alpha&&(e.props.a=lu(a,2)),R(o,r,s))}else{const n=null===(o=e.props.options)||void 0===o?void 0:o.find(e=>{var o;return(null===(o=e.label)||void 0===o?void 0:o.toLowerCase())===t.toLowerCase()});if(n&&n.value){const t=hu(n.value);if(t){const[o,n,r,s]=t;e.props.alpha&&(e.props.a=lu(s,2)),R(o,n,r)}else R(e.props.h,e.props.s,e.props.v)}else R(e.props.h,e.props.s,e.props.v)}}function k(t){if(!e.context||!d)return;const o=d[t];o&&(e.props.focusedSwatch=o.dataset.color)}function _(e,t){new ResizeObserver(()=>{const o=e.getBoundingClientRect();e.width=Math.round(o.width),e.height=Math.round(o.height),t(e)}).observe(e)}function S(){e.context&&e.props.eyeDropper&&(e.context.hasNativeEyeDropper=!("undefined"==typeof window||!window.EyeDropper),s(`eye-dropper-${e.props.id}`,()=>{var t;if("undefined"==typeof window||!window.EyeDropper)return;const o=new window.EyeDropper,n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`eye-dropper-${e.props.id}`);if(!n||f.has(n))return;const r=async()=>{if(!v){v=!0;try{const t=await o.open();if(!t.sRGBHex)return;const[n,r,s]=iu(t.sRGBHex);e.props.alpha&&(e.props.a=1),R(n,r,s)}catch{return}finally{v=!1}}};f.add(n),n.addEventListener("click",r),e.on("destroying",()=>{n.removeEventListener("click",r)})},e.props.__root))}function L(){I("canvas-ls",e=>{n=e},h,V),I("canvas-hue",e=>{a=e},D,F),I("canvas-alpha",e=>{l=e},m,P),A(`canvas-preview-${e.props.id}`,e=>{i=e,T()},g),A(`canvas-swatch-preview-${e.props.id}`,e=>{p=e,O()},$),C()}function I(o,n,r,s){let a=!1;const l=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",c)},i=e=>{1===e.buttons&&t&&s(e)},p=e=>{t&&s(e)},d=()=>{t=void 0,l()},c=()=>{t=void 0,l()};A(`${o}-${e.props.id}`,e=>{const l=e.nextElementSibling;n(e),r(),function(e,t){const o=o=>{e&&(o.preventDefault(),t(o))};null==e||e.addEventListener("mousedown",o),null==e||e.addEventListener("touchstart",o)}(e,s),a||function(e,t){a=!0,e.addEventListener("blur",()=>{e.removeAttribute("data-prevent-focus-style")}),t.addEventListener("touchend",()=>{e.removeAttribute("data-prevent-focus-style"),e.blur()}),e.addEventListener("keydown",t=>{["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key)&&e.removeAttribute("data-prevent-focus-style")})}(l,e),e.addEventListener("mousedown",e=>{l.focus(),l.setAttribute("data-prevent-focus-style","true"),t=yu[o],s(e),document.addEventListener("mousemove",i),document.addEventListener("mouseup",d)}),e.addEventListener("touchstart",()=>{l.setAttribute("data-prevent-focus-style","true"),l.focus(),t=yu[o],document.addEventListener("touchmove",p),document.addEventListener("touchend",c)})},r)}function A(t,o,n){s(t,()=>{var r;const s=null===(r=e.props.__root)||void 0===r?void 0:r.getElementById(t);s&&(o(s),n&&_(s,n))},e.props.__root)}function C(){s(`swatches-${e.props.id}`,()=>{var t,o,n;d=Array.from((null===(t=e.props.__root)||void 0===t?void 0:t.querySelectorAll(`#swatches-${e.props.id} canvas`))||[]),d.forEach(e=>{_(e,E)}),e.props.focusedSwatch=null===(n=null===(o=d[0])||void 0===o?void 0:o.dataset)||void 0===n?void 0:n.color,H()},e.props.__root)}function D(){if(!a)return;const e=a.getContext("2d");if(!e)return;const t=a.width,o=a.height;for(let n=0;n<t;n++){const r=Math.floor(n/t*360);e.fillStyle=`hsl(${r}, 100%, 50%)`,e.fillRect(n,0,1,o)}}function T(){if(!i)return;const t=i.getContext("2d");if(!t)return;B(i,i.width/3);const{r:o,g:n,b:r,a:s}=e.props.rgba;t.fillStyle=`rgba(${o}, ${n}, ${r}, ${s})`,t.fillRect(0,0,i.width,i.height)}function O(){if(!p)return;const t=p.getContext("2d");if(!t)return;B(p,p.height/2);const{r:o,g:n,b:r,a:s}=e.props.rgba;t.fillStyle=`rgba(${o}, ${n}, ${r}, ${s})`,t.fillRect(0,0,p.width,p.height)}function E(e){if(!e)return;const t=e.getContext("2d");if(!t)return;B(e,e.width/2);const o=e.dataset.colorPrecise;if(!o)return;const[n,r,s,a]=mu(o),[l,i,p,d]=pu(n,r,s,a);t.fillStyle=`hsla(${l}, ${i/255*100}%, ${p/255*100}%, ${d})`,t.fillRect(0,0,Math.round(e.width),Math.round(e.height))}function M(e,o,n){let r=null;const s=e=>{null!==r&&cancelAnimationFrame(r),r=requestAnimationFrame(()=>{if(!o)return;const t=o.getBoundingClientRect();let r,s;"touches"in e?(r=e.touches[0].clientX-t.left,s=e.touches[0].clientY-t.top):(r=e.clientX-t.left,s=e.clientY-t.top),r=Math.min(Math.max(r,0),t.width),s=Math.min(Math.max(s,0),t.height),n(r,s)})};s(e);const a=e=>{e.preventDefault(),s(e)},l=e=>{e.preventDefault(),s(e)},i=()=>{t=void 0,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",i)},p=()=>{t=void 0,document.removeEventListener("touchmove",l),document.removeEventListener("touchend",p)};"touches"in e?(document.addEventListener("touchmove",l),document.addEventListener("touchend",p)):(document.addEventListener("mousemove",a),document.addEventListener("mouseup",i))}function V(t){M(t,n,(t,o)=>{const r=t/n.width*100,s=100-o/n.height*100;b(e.props.hue,r,s)})}function F(t){M(t,a,(t,o)=>{if(!a)return;const n=a.width,r=Math.floor(t/n*360);e.props.h=r,b(e.props.h,e.props.s,e.props.v)})}function P(t){e.props.alpha&&M(t,l,(t,o)=>{const n=t/l.width*100/100;e.props.a=n,b(e.props.hue,e.props.s,e.props.v)})}function B(e,t){const o=e.getContext("2d");if(!o)return;const n=Math.ceil(e.height/t),r=Math.ceil(e.width/t);for(let e=0;e<n;e++)for(let n=0;n<r;n++)o.fillStyle=(e+n)%2==1?"#FFFFFF":"#CCCCCC",o.fillRect(n*t,e*t,t,t)}function H(){var t,o;if(!e.context||!e.props.options||!d)return;const{h:n,s:r,v:s,a:a}=e.props,l=function(e,t,o,n=1){const r=0===o?0:t;return`${lu(0===o||100===o&&0===t?0:e,0)}-${lu(r,0)}-${lu(o,0)}-${lu(n,2)}`}(n,r,s,a);let i=!1,p=!1;d.forEach(e=>{const t=e.dataset.color;if(!t)return;const[o,n,r,c]=t.split("-");"0"===r&&0===s&&c===`${a}`&&(p=!0);const u=e.parentElement;p||t===l?(u.dataset.active="true",e.ariaSelected="true",p=!1,!i&&d&&(k(d.indexOf(e)),i=!0)):(delete u.dataset.active,e.ariaSelected="false")}),i||(e.props.focusedSwatch=null===(o=null===(t=d[0])||void 0===t?void 0:t.dataset)||void 0===o?void 0:o.color)}function N(t){t=t.replace("#",""),e.props.hexInputFocused||3!==t.length||(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),t=`#${t=t.toUpperCase()}`,e.props.hex=t.slice(0,9)}function R(t,n,r,s=!1){e.props.h=void 0===t||isNaN(t)?e.props.h:lu(Math.max(Math.min(t,360),0),2),e.props.s=void 0===n||isNaN(n)?e.props.s:lu(Math.max(Math.min(n,100),0),2),e.props.v=void 0===r||isNaN(r)?e.props.v:lu(Math.max(Math.min(r,100),0),2);const{h:a,s:l,v:i,a:p}=e.props,[d,c,u]=pu(a,l,i),[f,v,h]=cu(a,l,i),m=e.props.hexInputFocused?e.props.hex:fu(a,l,i,p),g=lu(p,2);e.props.hsla={h:a,s:c,l:u,a:g},e.props.hslaPercent={h:lu(a,0),s:100===i&&0===l?0:lu(0===i?c/255:Math.max(Math.min(c/255*100,100),0),0),l:lu(Math.max(Math.min(e.props.hsla.l/255*100,100),0),0),a:g},e.props.hslaString=`hsla(${e.props.hslaPercent.h}, ${e.props.hslaPercent.s}%, ${e.props.hslaPercent.l}%, ${g})`,e.props.hslaStringPrecise=`hsla(${a}, ${lu(0===i?c/255:c/255*100,2)}%, ${lu(u/255*100,2)}%, ${g})`,e.props.rgba={r:f,g:v,b:h,a:g},e.props.rgbaString=`rgba(${f}, ${v}, ${h}, ${g})`,N(m),setTimeout(()=>{var t;K(),function(){const t=e.props.s,o=100-e.props.v;e.props.controlLSPosition={x:t,y:o}}(),y(),o||"undefined"==typeof window||(o=null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`[data-id="${e.props.id}"]`))},0);const $=e.props.valueFormat?e.props.valueFormat:e.props.format;s||("hex"===$?e.input(e.props.hex):"rgba"===$?e.input(e.props.rgbaString):"hsla"===$&&e.input(e.props.hslaStringPrecise))}function K(){h(),m(),g(),$()}e.addProps(["expanded","h","s","v","a","hsla","hslaPercent","hslaString","hslaStringPrecise","rgba","rgbaString","hex","controlLSPosition","panelActiveFormat","hexInputFocused","hasNativeEyeDropper","focusedSwatch","swatchIsUsingKeyboardNav","showPanelClose"]),e.props.h=e.props.h||void 0,e.props.s=e.props.s||void 0,e.props.v=e.props.v||void 0,e.props.a=e.props.a||1,e.props.controlLSPosition=e.props.controlLSPosition||{x:0,y:0},e.props.switchIcon=e.props.switchIcon||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M34.2 179.7L154.4 66.2c1.4-1.3 3.5-2.2 5.6-2.2s4.2 .8 5.6 2.2L285.8 179.7c1.4 1.3 2.2 3.2 2.2 5.2c0 3.9-3.2 7.1-7.1 7.1H39.1c-3.9 0-7.1-3.2-7.1-7.1c0-2 .8-3.8 2.2-5.2zm-22-23.3C4.4 163.8 0 174.1 0 184.9C0 206.5 17.5 224 39.1 224H280.9c21.6 0 39.1-17.5 39.1-39.1c0-10.8-4.4-21.1-12.3-28.4L187.6 42.9C180.1 35.9 170.2 32 160 32s-20.1 3.9-27.6 10.9L12.3 156.4zm22 175.9c-1.4-1.3-2.2-3.2-2.2-5.2c0-3.9 3.2-7.1 7.1-7.1H280.9c3.9 0 7.1 3.2 7.1 7.1c0 2-.8 3.8-2.2 5.2L165.6 445.8c-1.4 1.3-3.5 2.2-5.6 2.2s-4.2-.8-5.6-2.2L34.2 332.3zm-22 23.3L132.4 469.1c7.4 7 17.4 10.9 27.6 10.9s20.1-3.9 27.6-10.9L307.7 355.6c7.8-7.4 12.3-17.7 12.3-28.5c0-21.6-17.5-39.1-39.1-39.1H39.1C17.5 288 0 305.5 0 327.1c0 10.8 4.4 21.1 12.3 28.5z"/></svg>',e.props.hexInputFocused=!1,e.props.swatchIsUsingKeyboardNav=!1,e.on("destroying",()=>{e.context&&"undefined"!=typeof document&&document.removeEventListener("paste",x)}),e.on("created",()=>{var t,n;e.context&&("undefined"!=typeof window&&document.addEventListener("paste",x),e.props.expanded=!1,e.props.panelActiveFormat=e.props.format||u[0],e.props.panelControls=$u(e.props.panelControls),e.props.eyeDropper=$u(e.props.eyeDropper),e.props.panelFormat=$u(e.props.panelFormat),e.props.showValue=$u(e.props.showValue),e.props.allowPaste=$u(e.props.allowPaste),e.props.inline=r(e.props.inline),e.props.disabled=r(e.props.disabled),e.props.format=e.props.format||"hex",e.props.alpha=r(null===(n=null===(t=e.props)||void 0===t?void 0:t.alpha)||void 0===n||n),e.props.valueFormat=e.props.valueFormat||e.props.format,e.props.closeOnSelect=r(e.props.closeOnSelect),e.props.focusedSwatch=void 0,void 0===e.value||""===e.value||null===e.value?(e.props.rgba={r:0,g:0,b:0},R(0,0,0,!0)):w(`${e.value}`),e.on("input",({payload:t})=>{o&&void 0!==e.props.__root&&!o.contains(e.props.__root.activeElement)&&w(t)}),setTimeout(()=>{S()},5),L(),e.on("prop:expanded",()=>{var t;if(e.props.expanded)S(),L(),C(),document.addEventListener("keydown",o),window.innerWidth<=430&&!window.matchMedia("(hover: hover)").matches?e.props.showPanelClose=!0:e.props.showPanelClose=!1,setTimeout(()=>{var t;const o=null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`[data-id="${e.props.id}"] *:not(.formkit-swatch-preview)[tabindex="0"]`);o&&o.focus()},0);else{document.removeEventListener("keydown",o);(null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`[data-id="${e.props.id}"] *[tabindex="0"]`)).focus()}function o(t){"Escape"===t.key&&(t.preventDefault(),e.props.expanded=!1)}}),e.context.fns.anyToHsvaString=(e,t)=>{const o=hu(e);if(!o)return"0-0-0-1";let[n,r,s,a]=o;return 0===t&&(n=0===s||100===s&&0===r?0:n),`${lu(n,t)}-${lu(r,t)}-${lu(s,t)}-${lu(a,2)}`},e.context.handlers.inputPreviewClick=t=>{e.props.expanded=!e.props.expanded},e.context.handlers.inputPreviewFocusout=t=>{var o,n,r;const s=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(`[data-id="${e.props.id}"] .formkit-inner`),a=t.relatedTarget;if(s.contains(a)){function l(t){var o,n;s.contains(t.target)||(e.props.expanded=!1,null===(o=e.props.__root)||void 0===o||o.removeEventListener("mousedown",l),null===(n=e.props.__root)||void 0===n||n.removeEventListener("touchstart",l))}null===(n=e.props.__root)||void 0===n||n.addEventListener("mousedown",l),null===(r=e.props.__root)||void 0===r||r.addEventListener("touchstart",l)}else e.props.expanded=!1},e.context.handlers.inputPreviewKeydown=t=>{"Escape"===t.key&&(t.preventDefault(),e.props.expanded=!1),"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.props.expanded=!e.props.expanded)},e.context.handlers.closePanel=()=>{e.props.expanded=!1},e.context.handlers.panelCloseKeydown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.props.expanded=!1)},e.context.handlers.toggleFormat=(t=1)=>{t="number"==typeof t?t:1;const o=(u.indexOf(e.props.panelActiveFormat)+t+u.length)%u.length;e.props.panelActiveFormat=u[o]},e.context.handlers.panelKeydown=t=>{var o,n,r;if("Tab"===t.key&&e.props.expanded){t.preventDefault();const s=Array.from((null===(o=e.props.__root)||void 0===o?void 0:o.querySelectorAll(`[data-id="${e.props.id}"] *:not(.formkit-swatch-preview)[tabindex="0"]`))||[]).filter(bu),a=s.indexOf((null===(n=e.props.__root)||void 0===n?void 0:n.activeElement)?null===(r=e.props.__root)||void 0===r?void 0:r.activeElement:e.props.__root);let l;l=t.shiftKey?(a-1+s.length)%s.length:(a+1)%s.length,s[l].focus()}},e.context.handlers.lsKeydown=t=>{if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const{h:o,s:n,v:r}=e.props,s=t.shiftKey?10:1;switch(t.key){case"ArrowLeft":R(o,n-s,r);break;case"ArrowRight":R(o,n+s,r);break;case"ArrowUp":R(o,n,r+s);break;case"ArrowDown":R(o,n,r-s);break;case"PageUp":R(o,n,r+10);break;case"PageDown":R(o,n,r-10);break;case"Home":R(o,n-10,r);break;case"End":R(o,n+10,r)}K()}},e.context.handlers.hueControlKeydown=t=>{if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const{h:o,s:n,v:r}=e.props,s=t.shiftKey?10:1;switch(t.key){case"ArrowLeft":case"ArrowDown":R(o-s,n,r);break;case"ArrowRight":case"ArrowUp":R(o+s,n,r);break;case"PageUp":R(o+10,n,r);break;case"PageDown":R(o-10,n,r);break;case"Home":R(0,n,r);break;case"End":R(360,n,r)}K()}},e.context.handlers.alphaControlKeydown=t=>{if(e.props.alpha&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const{h:o,s:n,v:r,a:s}=e.props,a=t.shiftKey?.1:.01;switch(t.key){case"ArrowLeft":case"ArrowDown":e.props.a=lu(Math.min(Math.max(s-a,0),1),2);break;case"ArrowRight":case"ArrowUp":e.props.a=lu(Math.min(Math.max(s+a,0),1),2);break;case"PageUp":e.props.a=lu(Math.min(Math.max(s+.1,0),1),2);break;case"PageDown":e.props.a=lu(Math.min(Math.max(s-.1,0),1),2);break;case"Home":e.props.a=0;break;case"End":e.props.a=1}R(o,n,r)}},e.context.handlers.eyeDropperKeydown=t=>{var o;if("Enter"===t.key||" "===t.key){t.preventDefault();const n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`eye-dropper-${e.props.id}`);null==n||n.click()}},e.context.handlers.formatSwitcherKeydown=t=>{e.context&&("Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),e.context.handlers.toggleFormat()),"ArrowUp"===t.key&&(t.preventDefault(),e.context.handlers.toggleFormat(-1)))},e.context.handlers.hexInput=t=>{const o=t.target,n=o.value.startsWith("#")?9:8,r=o.value.slice(0,n);if(o.value=e.props.alpha?r:r.slice(0,7),vu(r)){const[t,o,n,s]=iu(r);e.props.alpha&&(e.props.a=s),N(r),R(t,o,n)}},e.context.handlers.hexKeydown=t=>{const o=t.target,n=o.value;let r="";if(!vu(n))return;const s=n.startsWith("#")?n.slice(1):n,a=8===s.length,l=a?s.substring(0,6):s,i=a?s.substring(6,8):"",p=t.shiftKey?10:1,d=16777215;let c;if(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(t.key))switch(t.preventDefault(),t.key){case"ArrowUp":c=(parseInt(l,16)+p)%16777216;break;case"ArrowDown":c=(parseInt(l,16)-p+d+1)%16777216;break;case"PageUp":c=(parseInt(l,16)+10)%16777216;break;case"PageDown":c=(parseInt(l,16)-10+d+1)%16777216;break;case"Home":c=0;break;case"End":c=d}void 0!==c&&(r=c.toString(16).padStart(6,"0").toUpperCase()),r&&(o.value=a?`#${r}${i}`:`#${r}`),e.context&&e.context.handlers.hexInput(t)},e.context.handlers.hexFocus=()=>{e.context&&(e.props.hexInputFocused=!0)},e.context.handlers.hexBlur=t=>{if(!e.context)return;e.props.hexInputFocused=!1;const o=t.target.value;vu(o)&&N(o)},e.context.handlers.rangeLimitInput=(t,o,n,r)=>s=>{const a=r||s;if(!a||!e.context)return;const l=a.target;if(l.value.endsWith("."))return;const i=Math.max(Math.min(Number(l.value),n),o);l.value=`${i}`;const p=l.id;if("hsla"===t){switch(p){case`h-${e.props.id}`:e.props.h=i;break;case`s-${e.props.id}`:e.props.hslaPercent.s=i;break;case`l-${e.props.id}`:e.props.hslaPercent.l=i}const[t,o,n]=du(e.props.h,2.55*e.props.hslaPercent.s,2.55*e.props.hslaPercent.l);R(t,o,n)}else if("rgba"===t){switch(p){case`r-${e.props.id}`:e.props.rgba.r=i;break;case`g-${e.props.id}`:e.props.rgba.g=i;break;case`b-${e.props.id}`:e.props.rgba.b=i}const[t,o,n]=uu(e.props.rgba.r,e.props.rgba.g,e.props.rgba.b);R(t,o,n)}else"alpha"==t&&e.props.alpha&&(e.props.a=i,R())},e.context.handlers.rangeLimitKeydown=(t,o,n,r)=>s=>{if(!e.context)return;if(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End","Backspace","Tab","Enter"].includes(s.key)||s.metaKey||!/[a-zA-Z!@#$%^&*()_+={}\[\]:;"'<,>?\/|\\`~]/g.test(s.key)){if(["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(s.key)){const a=s.target,l=Number(a.value),i=s.shiftKey?10*r:r;switch(s.key){case"ArrowUp":s.preventDefault(),a.value=`${Math.min(l+i,n)}`;break;case"ArrowDown":s.preventDefault(),a.value=`${Math.max(l-i,o)}`;break;case"PageUp":s.preventDefault(),a.value=`${Math.min(l+10*r,n)}`;break;case"PageDown":s.preventDefault(),a.value=`${Math.max(l-10*r,o)}`;break;case"Home":s.preventDefault(),a.value=`${o}`;break;case"End":s.preventDefault(),a.value=`${n}`}e.context.handlers.rangeLimitInput(t,o,n,s)()}}else s.preventDefault()},e.context.handlers.swatchClick=t=>{const o=t.target;if(o.dataset.colorPrecise){const[t,n,r,s]=mu(o.dataset.colorPrecise);e.props.alpha&&(e.props.a=s),R(t,n,r),e.props.closeOnSelect&&(e.props.expanded=!1)}e.context&&"keydown"!==t.type&&e.context.handlers.swatchKeydown(t)},e.context.handlers.swatchKeydown=t=>{var o,n,r,s;if(!e.context||!d||!d.length)return;const a=d.indexOf(t.currentTarget);let l=null;const i=function(e){var t;if(!e.length)return 0;const o=null===(t=e[0].parentElement)||void 0===t?void 0:t.parentElement;if(!o)return 0;const n=o.getBoundingClientRect().width,r=e[0].parentElement;if(!r)return 0;const s=r.getBoundingClientRect(),a=window.getComputedStyle(r),l=parseFloat(a.marginLeft)+parseFloat(a.marginRight),i=s.width+l;return Math.floor(n/i)}(d),p=d.length;let u=0,f=p,v=!1;const h=d[a].dataset.group;if(void 0!==h){const e=d.filter(e=>e.dataset.group===h);u=d.indexOf(e[0]),f=d.indexOf(e[e.length-1])}const m=(a-u)%i;if(!t.key||"Tab"===t.key)return t.key||(e.props.swatchIsUsingKeyboardNav=!1,c=m,k(a)),"Tab"===t.key&&(e.props.swatchIsUsingKeyboardNav=!1),void d.forEach(e=>{delete e.parentElement.dataset.focused});if("Enter"===t.key||" "===t.key)return t.preventDefault(),c=m,e.context.handlers.swatchClick(t),void k(a);switch("ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(e.props.swatchIsUsingKeyboardNav=!0,t.preventDefault()),t.key){case"ArrowUp":l=Math.max(a-i,a-(i-(c-m))),v=!0;break;case"ArrowDown":l=Math.max(a+i,a+(i+(c-m))),v=!0;break;case"ArrowLeft":l=a-1,c=(l-u)%i;break;case"ArrowRight":l=a+1,c=(l-u)%i}if(v&&null!==l&&(l<u||l>f)){let e;e=l<u?null===(n=null===(o=d[u-1])||void 0===o?void 0:o.dataset)||void 0===n?void 0:n.group:null===(s=null===(r=d[f+1])||void 0===r?void 0:r.dataset)||void 0===s?void 0:s.group;const t=d.filter(e=>e.dataset.group===h),p=d.filter(t=>t.dataset.group===e),v=(a-u)%i,m=t.length%i||i,g=a>=u+t.length-m;if(l<u){const e=p.length%i||i;l=u-e+Math.min(Math.max(v,c),e-1)}else l>f&&(l=g?Math.min(f+Math.max(v,c)+1,d.indexOf(p[p.length-1])):Math.min(l,f))}if(null!==l&&l>=0&&l<p){k(l),d.forEach(e=>{delete e.parentElement.dataset.focused});const e=d[l],t=e.parentElement;e.focus(),t.dataset.focused="true"}})})},en,b,
|
|
62
62
|
/* #__PURE__ */g("eyeDropper","color"),
|
|
63
63
|
/* #__PURE__ */g("close","close"),
|
|
64
64
|
/* #__PURE__ */$("close"),
|
|
65
|
-
/* #__PURE__ */$("next")]},Jc=/* #__PURE__ */Te("tb"),{outer:Qc,inner:eu,wrapper:tu,prefix:ou,suffix:nu,help:ru,messages:su,message:au,icon:lu}=/* #__PURE__ */Ee(Jc),iu=Jc("label",()=>({if:"$label",$el:"label",attrs:{id:"$id + '_label'"}})),pu=Jc("singleToggle",()=>({bind:"$attrs",$el:"button",attrs:{id:"$id",type:"button","aria-label":"$label","aria-pressed":"$fns.isChecked($onValue, $value)",onClick:"$handlers.toggleValue()",disabled:"$disabled",class:"$classes.input",onBlur:"$handlers.blur"}})),du=Jc("multiToggle",()=>({bind:"$attrs",$el:"button",attrs:{type:"button",id:"$id+'_'+$index","aria-label":"$label","aria-pressed":"$fns.isChecked($option, $value)",onClick:"$handlers.toggleValue($option)",class:"$classes.input",title:"$option.help",disabled:"$disabled || $option.disabled",onBlur:"$handlers.blur"}})),cu=Jc("inputInner",()=>({bind:"$attrs",$el:"span"})),uu=Jc("options",()=>({$el:"ul",attrs:{id:"$id","data-vertical":'$vertical && "true" || "false"',"aria-labelledby":"$id"}})),fu=Jc("option",()=>({$el:"li",for:["option","index","$options"],attrs:{key:"$option.value","data-index":"$index"}}));function vu(e,t){return t=(null==t?void 0:t.hasOwnProperty("__original"))?null==t?void 0:t.__original:null==t?void 0:t.value,e.props.multiple?!!Array.isArray(e.value)&&e.value.filter(e=>n(e,t)).length>0:void 0!==t?n(e.value,t):(e.props._isChecked=n(e.value,e.props.onValue),e.props._isChecked)}const hu={schema:/* #__PURE__ */Qc(/* #__PURE__ */Me("$options",/* #__PURE__ */tu(/* #__PURE__ */iu("$label"),/* #__PURE__ */uu(/* #__PURE__ */fu(/* #__PURE__ */du(/* #__PURE__ */Me("$fns.isChecked($option) === true",/* #__PURE__ */cu("$slots.default || $slots.on || $option.onLabel || $option.label"),/* #__PURE__ */cu("$slots.default || $slots.off || $option.offLabel || $option.label")))))),/* #__PURE__ */tu(/* #__PURE__ */Me("$label && ($slots.default || $slots.on || $onLabel)",/* #__PURE__ */iu("$label")),/* #__PURE__ */pu(/* #__PURE__ */lu("prefix"),/* #__PURE__ */ou(),/* #__PURE__ */Me("$_isChecked === true",/* #__PURE__ */cu("$slots.default || $slots.on || $onLabel || $label"),/* #__PURE__ */cu("$slots.default || $slots.off || $offLabel || $label")),/* #__PURE__ */nu(),/* #__PURE__ */lu("suffix")))),/* #__PURE__ */ru("$help"),/* #__PURE__ */su(/* #__PURE__ */au("$message.value"))),type:"input",family:"button",props:["options"],features:[function(e){var t,o,s,a;e.addProps(["enforced","multiple","offLabel","offValue","disabled","onLabel","onValue","vertical","_isChecked"]),e.props._isChecked=!1,e.props.enforced=r(e.props.enforced),e.props.multiple=r(e.props.multiple),e.props.vertical=r(e.props.vertical),"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),null!==(t=(s=e.props).onValue)&&void 0!==t||(s.onValue=!0),null!==(o=(a=e.props).offValue)&&void 0!==o||(a.offValue=!1),e.on("created",()=>{var t;e.props._isChecked=vu(e,null),e.props.options&&e.props.multiple&&e.input(null!==(t=e.value)&&void 0!==t?t:[],!1),e.context&&(e.context.fns.isChecked=t=>vu(e,t),e.context.handlers.toggleValue=t=>o=>function(e,t,o){if(o.preventDefault(),t=t?vt(t):t,e.props.options)if(e.props.multiple){const o=Array.isArray(e.value)?[...e.value]:[],r=o.findIndex(e=>n(e,t));r>-1&&(!e.props.enforced||o.length>1)?o.splice(r,1):-1===r&&o.push(t),e.input(o)}else n(e.value,t)&&!e.props.enforced?e.input(void 0):e.input(t);else e.input(n(e.value,e.props.onValue)?e.props.offValue:e.props.onValue)}(e,t,o))})},b]},mu=/* #__PURE__ */Te("ut"),{outer:gu,inner:$u,wrapper:bu,label:yu,prefix:xu,suffix:wu,help:_u,messages:ku,message:Su,icon:Lu}=/* #__PURE__ */Ee(mu),Iu=mu("input",()=>({$el:"input",bind:"$attrs",attrs:{name:"$node.name",autocomplete:"$attrs.autocomplete || off",id:"$id",onChange:"$handlers.handleInput",onBlur:"$handlers.unitBlur",onInput:"$handlers.handleInput",onKeydown:"$handlers.handleKeyDown",onBeforeinput:"$handlers.handleBeforeInput",readonly:"$readonly",inputmode:"decimal",placeholder:"$placeholder || $unitParts.unit",disabled:"$disabled","data-unit":"$unit","data-currency":"$currency","data-display-locale":"$displayLocale","data-value-locale":"$valueLocale","data-decimals":"$decimals","data-trailing":"$trailingZeros","data-numeric-value":"$_numericValue","data-align":"$_valueAlignAuto","aria-required":"$state.required || undefined"}})),Au={meter:{kilometer:.001,meter:1,centimeter:100,millimeter:1e3,mile:621371e-9,yard:1.09361,foot:3.28084,inch:39.3701,"mile-scandinavian":1e-4},kilometer:{kilometer:1,meter:1e3,centimeter:1e5,millimeter:1e6,mile:.621371,yard:1093.61,foot:3280.84,inch:39370.1,"mile-scandinavian":10},centimeter:{kilometer:1e-5,meter:.01,centimeter:1,millimeter:10,mile:62137e-10,yard:.0109361,foot:.0328084,inch:.393701,"mile-scandinavian":1e-6},millimeter:{kilometer:1e-6,meter:.001,centimeter:.1,millimeter:1,mile:6.21371e-7,yard:.00109361,foot:.00328084,inch:.0393701,"mile-scandinavian":1e-7},mile:{kilometer:1.60934,meter:1609.34,centimeter:160934,millimeter:1609340,mile:1,yard:1760,foot:5280,inch:63360,"mile-scandinavian":.160934},yard:{kilometer:9144e-7,meter:.9144,centimeter:91.44,millimeter:914.4,mile:568182e-9,yard:1,foot:3,inch:36,"mile-scandinavian":9144e-8},foot:{kilometer:3048e-7,meter:.3048,centimeter:30.48,millimeter:304.8,mile:189394e-9,yard:.333333,foot:1,inch:12,"mile-scandinavian":3048e-8},inch:{kilometer:254e-7,meter:.0254,centimeter:2.54,millimeter:25.4,mile:15783e-9,yard:.0277778,foot:.0833333,inch:1,"mile-scandinavian":254e-8},"mile-scandinavian":{kilometer:10,meter:1e4,centimeter:1e6,millimeter:1e7,mile:6.21371,yard:10936.1,foot:32808.4,inch:393701,"mile-scandinavian":1}},Cu={celsius:{celsius:e=>e,fahrenheit:e=>1.8*e+32},fahrenheit:{celsius:e=>5/9*(e-32),fahrenheit:e=>e}},Du={acre:{acre:1,hectare:.404686},hectare:{acre:2.47105,hectare:1}},Tu={gram:{gram:1,kilogram:.001,ounce:.035274,pound:.00220462},kilogram:{gram:1e3,kilogram:1,ounce:35.274,pound:2.20462},ounce:{gram:28.3495,kilogram:.0283495,ounce:1,pound:.0625},pound:{gram:453.592,kilogram:.453592,ounce:16,pound:1},stone:{gram:6350.29,kilogram:6.35029,ounce:224,pound:14,stone:1}},Eu={liter:{liter:1,milliliter:1e3,gallon:.264172,"fluid-ounce":33.814},milliliter:{liter:.001,milliliter:1,gallon:264172e-9,"fluid-ounce":.033814},gallon:{liter:3.78541,milliliter:3785.41,gallon:1,"fluid-ounce":128},"fluid-ounce":{liter:.0295735,milliliter:29.5735,gallon:.0078125,"fluid-ounce":1}},Ou={day:{day:1,hour:24,microsecond:864e8,millisecond:864e5,minute:1440,month:.0328767,nanosecond:864e14,second:86400,week:.142857,year:.00273973},hour:{day:.0416667,hour:1,microsecond:36e8,millisecond:36e5,minute:60,month:.00136986,nanosecond:36e11,second:3600,week:.00595238,year:114155e-9},microsecond:{day:115741e-19,hour:277778e-18,microsecond:1,millisecond:.001,minute:1.66667e-8,month:380517e-24,nanosecond:1e3,second:1e-6,week:165344e-20,year:3171e-20},millisecond:{day:1.15741e-8,hour:2.77778e-7,microsecond:1e3,millisecond:1,minute:166667e-10,month:380517e-19,nanosecond:1e6,second:.001,week:165344e-16,year:3171e-16},minute:{day:694444e-9,hour:.0166667,microsecond:6e7,millisecond:6e4,minute:1,month:228311e-10,nanosecond:6e10,second:60,week:992063e-10,year:190132e-11},month:{day:30.4368,hour:730.484,microsecond:2628e12,millisecond:2628e9,minute:43800,month:1,nanosecond:2628e15,second:2628e6,week:4.34524,year:.0833333},nanosecond:{day:1.15741e-20,hour:277778e-24,microsecond:.001,millisecond:1e-6,minute:166667e-19,month:380517e-28,nanosecond:1,second:1e-9,week:165344e-26,year:3171e-26},second:{day:115741e-10,hour:277778e-9,microsecond:1e6,millisecond:1e3,minute:.0166667,month:380517e-16,nanosecond:1e9,second:1,week:1.65344e-8,year:3.171e-10},week:{day:7,hour:168,microsecond:6048e11,millisecond:6048e8,minute:10080,month:.230137,nanosecond:6048e14,second:604800,week:1,year:.0191781},year:{day:365,hour:8760,microsecond:3154e13,millisecond:3154e10,minute:525600,month:12,nanosecond:3154e16,second:3154e4,week:52.1429,year:1}},Mu={bit:{bit:1,byte:.125,kilobit:.001,kilobyte:125e-6,megabit:1e-6,megabyte:125e-9,gigabit:1e-9,gigabyte:1.25e-10,terabit:1e-12,terabyte:125e-15,petabyte:125e-18},byte:{bit:8,byte:1,kilobit:.008,kilobyte:.001,megabit:8e-6,megabyte:1e-6,gigabit:8e-9,gigabyte:1e-9,terabit:8e-12,terabyte:1e-12,petabyte:1e-15},kilobit:{bit:1e3,byte:125,kilobit:1,kilobyte:.125,megabit:.001,megabyte:125e-6,gigabit:1e-6,gigabyte:125e-9,terabit:1e-9,terabyte:1.25e-10,petabyte:125e-15},kilobyte:{bit:8e3,byte:1e3,kilobit:8,kilobyte:1,megabit:.008,megabyte:.001,gigabit:8e-6,gigabyte:1e-6,terabit:8e-9,terabyte:1e-9,petabyte:1e-12},megabit:{bit:1e6,byte:125e3,kilobit:1e3,kilobyte:125,megabit:1,megabyte:.125,gigabit:.001,gigabyte:125e-6,terabit:1e-6,terabyte:125e-9,petabyte:1.25e-10},megabyte:{bit:8e6,byte:1e6,kilobit:8e3,kilobyte:1e3,megabit:8,megabyte:1,gigabit:.008,gigabyte:.001,terabit:8e-6,terabyte:1e-6,petabyte:1e-9},gigabit:{bit:1e9,byte:125e6,kilobit:1e6,kilobyte:125e3,megabit:1e3,megabyte:125,gigabit:1,gigabyte:.125,terabit:.001,terabyte:125e-6,petabyte:125e-9},gigabyte:{bit:8e9,byte:1e9,kilobit:8e6,kilobyte:1e6,megabit:8e3,megabyte:1e3,gigabit:8,gigabyte:1,terabit:.008,terabyte:.001,petabyte:1e-6},terabit:{bit:1e12,byte:125e9,kilobit:1e9,kilobyte:125e6,megabit:1e6,megabyte:125e3,gigabit:1e3,gigabyte:125,terabit:1,terabyte:.125,petabyte:125e-6},terabyte:{bit:8e12,byte:1e12,kilobit:8e9,kilobyte:1e9,megabit:8e6,megabyte:1e6,gigabit:8e3,gigabyte:1e3,terabit:8,terabyte:1,petabyte:.001},petabyte:{bit:1e15,byte:125e12,kilobit:1e12,kilobyte:125e9,megabit:1e9,megabyte:125e6,gigabit:1e6,gigabyte:125e3,terabit:1e3,terabyte:125,petabyte:1}};function Vu(e){let t=!1;function o(o){var n,r,s;const i=(`${o}`.match(/\-/g)||[]).length%2==1;o=function(t){t=function(e){return e.replace(/[\u0660-\u0669\u06f0-\u06f9]/g,e=>(15&e.charCodeAt(0)).toString())}(`${t}`),isNaN(t)&&(t=t.split(e.props.unitParts.decimal).map(e=>e.replace(/[^0-9]/g,"")).join("."));if(t=t.replace(/[^0-9\.]/g,""),t.includes(".")){const o=t.split(".");0===e.props.decimals?t=o[0]:"currency"===e.props.type&&(o[1]=o[1].padEnd(p(),"0").slice(0,p()),t=o.join("."))}return t}(o);const d={};"unit"!==a()&&"decimal"!==a()||(d.minimumFractionDigits=o.includes(".")?1:0),d.maximumFractionDigits="currency"===e.props.type?p():e.props.decimals,e.props.minDecimals&&(d.minimumFractionDigits=e.props.minDecimals,o&&!o.includes(".")&&(o+=".".padEnd(e.props.minDecimals+1,"0"))),0===d.maximumFractionDigits&&o.includes(".")&&(o=o.split(".")[0]);let c="";if(!isNaN(o)&&""!==o.trim()&&(o=i?`-${o}`:o,e.props.max&&!isNaN(e.props.max)&&(o=Number(o)>e.props.max?`${e.props.max}`:o),e.props.min&&!isNaN(e.props.min)&&(o=Number(o)<e.props.min?`${e.props.min}`:o),o.includes(".")&&"currency"===e.props.type?o=o.split(".")[0].padStart(1,"0")+"."+(null!==(n=o.split(".")[1])&&void 0!==n?n:"0"):"currency"===e.props.type&&(d.maximumFractionDigits=null!==(r=d.minimumFractionDigits)&&void 0!==r?r:0),c=l(e.props.displayLocale,d).format(o),"unit"===e.props.type&&"."===o[o.length-1])){const t=c.lastIndexOf(e.props.unitParts.decimal);c=c.slice(0,t+1)+c.slice(t+2),o=o.slice(0,-1)}let u,f=o.split(".");"currency"===e.props.type&&(f=f[0]+(null!==(s=f[1])&&void 0!==s?s:"").padEnd(p(),"0"),f.length>1&&(f=f.replace(/^0+/,""),f=""!==o&&""===f?"0":f)),e.props.valueStore={number:o,integer:f,string:c},t=!0,e.props.valueStore&&(u=e.props.valueStore.hasOwnProperty(e.props.valueFormat)?e.props.valueStore[e.props.valueFormat]:e.props.valueStore.number),e.input(""===u?void 0:u).then(()=>(t=!1,Promise.resolve()))}function n(){s(`${e.props.id}`,t=>{var o,n;t instanceof HTMLInputElement&&(t.value=null!==(n=null===(o=e.props.valueStore)||void 0===o?void 0:o.string)&&void 0!==n?n:"")},e.props.__root)}function r(){var t,o;const n=null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`#${e.props.id}_inner input`);return null!==(o=null==n?void 0:n.value)&&void 0!==o?o:""}function a(){return e.props.currency?"currency":e.props.unit?"unit":"decimal"}function l(t,o={}){const n=a(),r=Object.assign({},{style:n,roundingMode:"trunc"},o);return"unit"===e.props.type&&(r.unitDisplay=e.props.unitDisplay),"currency"===e.props.type&&(r.currencyDisplay=e.props.currencyDisplay),"currency"===n&&(r.currency=e.props.currency),"unit"===n&&(r.unit=e.props.unit),new Intl.NumberFormat(t,r)}function i(t,o){var n,s,a,l,i;const p=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input`);if(!p)return;const d=(null!==(a=null===(s=e.props.unitParts.unit)||void 0===s?void 0:s.length)&&void 0!==a?a:0)+(null!==(i=null===(l=e.props.unitParts.literal)||void 0===l?void 0:l.length)&&void 0!==i?i:0);e.props.unitParts.unitLeft?t=Math.max(t,d):(t=Math.min(t,r().length-d),"insertText"===o&&0===t&&(t=1)),p.setSelectionRange(t,t)}function p(){return void 0!==e.props.decimals?e.props.decimals:void 0!==e.props.minDecimals&&e.props.minDecimals>e.props.unitParts.fractionLength?e.props.minDecimals:e.props.unitParts.fractionLength}e.props.valueStore=null,e.on("input",({payload:e})=>{t||(o(e),n())}),e.context&&(e.context.handlers.init=(t=null)=>{var r;e.props.skipInit?e.props.skipInit=!1:function(){var t,o,n,r,s,a,i;e.props.skipInit=!0;const p=l(e.props.displayLocale).formatToParts(12345678.12345678);e.props.unitParts={decimal:null===(t=p.find(e=>"decimal"==e.type))||void 0===t?void 0:t.value,group:null===(o=p.find(e=>"group"==e.type))||void 0===o?void 0:o.value,unit:null===(n=p.find(e=>["unit","currency"].includes(e.type)))||void 0===n?void 0:n.value,unitLeft:["unit","currency"].includes(p[0].type),literal:null!==(s=null===(r=p.find(e=>"literal"==e.type))||void 0===r?void 0:r.value)&&void 0!==s?s:"",fractionLength:null!==(i=null===(a=p.find(e=>"fraction"==e.type))||void 0===a?void 0:a.value.length)&&void 0!==i?i:0}}();let s=null!==(r=null!=t?t:e._value)&&void 0!==r?r:"";e.props.valueStore?s=e.props.valueStore.number:"integer"===e.props.valueFormat&&(s=function(e){var t;return(parseFloat(`${e}`)/Math.pow(10,null!==(t=p())&&void 0!==t?t:0)).toString().replace(".",p())}(`${null!=s?s:""}`)),"unit"===e.props.type&&e.props.valueUnit&&e.props.unit&&e.props.valueUnit!==e.props.unit&&e.hook.input((t,o)=>{const n=function(e,t,o){if(Au[e]&&Au[e][o])return t*Au[e][o];if(Cu[e]&&Cu[e][o])return Cu[e][o](t);if(Du[e]&&Du[e][o])return t*Du[e][o];if(Tu[e]&&Tu[e][o])return t*Tu[e][o];if(Eu[e]&&Eu[e][o])return t*Eu[e][o];if(Ou[e]&&Ou[e][o])return t*Ou[e][o];if(Mu[e]&&Mu[e][o])return t*Mu[e][o];throw new Error("Conversion not supported")}(e.props.unit,t,e.props.valueUnit);return isNaN(n)?o(t):o(+n.toFixed(Number(e.props.valueDecimals)||2))}),o(s),n()},e.context.handlers.handleBeforeInput=t=>{var n,r,s,a,l,p,d,c,u;if(!e.props.inExecCommand&&"insertLineBreak"!==t.inputType&&(t.preventDefault(),t.stopPropagation(),t.target instanceof HTMLInputElement)){const f=t.target,v=null!==(n=t.data)&&void 0!==n?n:"",h=null!==(r=t.target.value)&&void 0!==r?r:"",m=null!==(s=t.target.selectionStart)&&void 0!==s?s:0,g=null!==(a=t.target.selectionEnd)&&void 0!==a?a:0,$=g-m,b=h.indexOf(e.props.unitParts.decimal);let y=(null!==(l=t.target.selectionStart)&&void 0!==l?l:0)+(t.data?0:-1),x=h,w=1;if(h.includes(e.props.unitParts.decimal)&&v===e.props.unitParts.decimal)return v===e.props.unitParts.decimal&&(y=x.indexOf(e.props.unitParts.decimal)+1),void i(y);if(!(null===e.props.min||e.props.min<0||e.props.max<0)&&"-"===v)return;if(v.match(/[a-zA-Z]/))return;if(v===e.props.unitParts.decimal&&0===e.props.decimals)return;if("deleteByCut"===t.inputType&&$>0&&(x=x.slice(0,m)+x.slice(g),y=g),"insertFromPaste"===t.inputType){const e=null!==(p=t.data)&&void 0!==p?p:"";x=x.slice(0,m)+e+x.slice(g)}if("deleteContentBackward"===t.inputType&&h[m-1]===e.props.unitParts.group?(w+=1,y-=1):"deleteContentForward"===t.inputType&&h[m]===e.props.unitParts.group&&(w+=1,y+=1),-1!==b&&y>b&&"insertText"===t.inputType?x=function(e,t,o){return e.substring(0,t)+o+e.substring(t+o.length)}(x,y,null!==(d=t.data)&&void 0!==d?d:"0"):"insertText"===t.inputType?(y=g,x=x.slice(0,m)+t.data+x.slice(g)):"deleteContentForward"===t.inputType?(y+=2,x=0===$?x.slice(0,m)+x.slice(g+w):x.slice(0,m)+x.slice(g)):"deleteContentBackward"===t.inputType&&(y+=1,0===$?x=x.slice(0,Math.max(m-w,0))+x.slice(g):$>0&&(x=x.slice(0,m)+x.slice(g))),"deleteContentForward"===t.inputType&&h[m]===e.props.unitParts.decimal){const t=x.slice(m-1);x=x.slice(0,m),t.includes(e.props.unitParts.unit)&&(x+=" "+e.props.unitParts.unit)}else if("deleteContentBackward"===t.inputType&&h[m-1]===e.props.unitParts.decimal){const t=x.slice(m-1);x=x.slice(0,m-1),t.includes(e.props.unitParts.unit)&&(x+=" "+e.props.unitParts.unit)}if(o(x),x=(null===(c=e.props.valueStore)||void 0===c?void 0:c.string)||(null===(u=e.props.valueStore)||void 0===u?void 0:u.number)||"",y=x.length-h.length+y,x.length===h.length&&y>b&&(y+=t.inputType.includes("delete")?-1:1),f.setSelectionRange(0,h.length),e.props.inExecCommand=!0,document.execCommand("insertText",void 0,x),e.props.inExecCommand=!1,v===e.props.unitParts.decimal?y=x.indexOf(e.props.unitParts.decimal)+1:h.includes(e.props.unitParts.decimal)&&!x.includes(e.props.unitParts.decimal)&&(y=x.length),"insertText"===t.inputType&&e.props.minDecimals&&(!e.value||0===m&&g===h.length||-1===b&&e.props.minDecimals&&h)){let t=0;t=e.props.unitParts.unit?e.props.unitParts.unit.length+1:0,y-=e.props.minDecimals,e.props.unitParts.unitLeft?y-=t-1:y-=t+1}i(Math.max(0,y),t.inputType)}},e.context.handlers.handleInput=t=>{e.emit("dom-input-event",t),t.target instanceof HTMLInputElement&&(e.props.inputText=t.target.value,o(t.target.value))},e.context.handlers.handleKeyDown=t=>{var s,a;if(t.target instanceof HTMLInputElement&&("ArrowUp"===t.key||"ArrowDown"===t.key)){const l="ArrowUp"===t.key?1*e.props.step:-1*e.props.step;o(function(e,t){var o,n,r,s;const a=`${e}`.split("."),l=`${t}`.split(".");let i=null!==(o=a[0])&&void 0!==o?o:"0",p=null!==(n=l[0])&&void 0!==n?n:"0";const d=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(s=l[1])&&void 0!==s?s:"",u=Math.max(d.length,c.length);u>0&&(i+=d.padEnd(u,"0"),p+=c.padEnd(u,"0"));const f=BigInt(BigInt(i)+BigInt(p)).toString();return u>0?f.slice(0,-1*u)+"."+f.slice(-1*u):f}(null!==(a=null===(s=e.props.valueStore)||void 0===s?void 0:s.number)&&void 0!==a?a:0,l)),n(),setTimeout(()=>{i(r().length)},1)}})}const Fu={schema:/* #__PURE__ */gu(/* #__PURE__ */bu(/* #__PURE__ */yu("$label"),/* #__PURE__ */$u(/* #__PURE__ */Lu("prefix"),/* #__PURE__ */xu(),/* #__PURE__ */Iu(),/* #__PURE__ */wu(),/* #__PURE__ */Lu("suffix"))),/* #__PURE__ */_u("$help"),/* #__PURE__ */ku(/* #__PURE__ */Su("$message.value"))),type:"input",family:"text",features:[function(e){var t,o,n,r,s,a;const l=["unit","decimals","minDecimals","displayLocale","min","max","step","valueFormat","unitDisplay","placeholder","unitParts","valueUnit","valueDecimals"];e.addProps(l),null!==(t=(r=e.props).displayLocale)&&void 0!==t||(r.displayLocale=e.props.locale||"en-US"),e.props.unitDisplay=e.props.unitDisplay||"short","false"===e.props.decimals||!1===e.props.decimals?e.props.decimals=0:void 0!==e.props.decimals?e.props.decimals=Number(e.props.decimals):e.props.decimals=2,e.props.minDecimals=void 0!==e.props.minDecimals?Number(e.props.minDecimals):void 0,void 0!==e.props.min&&(e.props.min=Number(e.props.min)),void 0!==e.props.max&&(e.props.max=Number(e.props.max)),null!==(o=(s=e.props).step)&&void 0!==o||(s.step=1),null!==(n=(a=e.props).valueFormat)&&void 0!==n||(a.valueFormat="number"),-1===["string","number"].indexOf(e.props.valueFormat)&&(e.props.valueFormat="number"),e.on("created",()=>{e.context&&(e.context.handlers.unitBlur=t=>{if(!(t.target instanceof HTMLInputElement))return;let o=t.target.value;(function(e){e=e.trim();const t=/\d+\,\s*%?$/;return/\d+\.\s*%?$/.test(e)||t.test(e)})(o)&&(o=o.replace(e.props.unitParts.decimal,""),t.target.value=o),e.context&&e.context.handlers.blur(t)},Vu(e),e.context.handlers.init(),l.forEach(t=>{e.on(`prop:${t}`,()=>{var t;null===(t=null==e?void 0:e.context)||void 0===t||t.handlers.init()})}))})}]},Pu=/* #__PURE__ */Te("cr"),{outer:Bu,inner:Hu,wrapper:Ru,label:Nu,prefix:Ku,suffix:Wu,help:Uu,messages:Yu,message:ju,icon:qu}=/* #__PURE__ */Ee(Pu),zu=Pu("input",()=>({$el:"input",bind:"$attrs",attrs:{name:"$node.name",autocomplete:"$attrs.autocomplete || off",id:"$id",onChange:"$handlers.handleInput",onBlur:"$handlers.blur",onInput:"$handlers.handleInput",onKeydown:"$handlers.handleKeyDown",onBeforeinput:"$handlers.handleBeforeInput",readonly:"$readonly",disabled:"$disabled",placeholder:"$placeholder || $unitParts.unit",inputmode:"decimal","data-unit":"$unit","data-currency":"$currency","data-display-locale":"$displayLocale","data-value-locale":"$valueLocale","data-decimals":"$decimals","data-trailing":"$trailingZeros","data-numeric-value":"$_numericValue","data-align":"$_valueAlignAuto","aria-required":"$state.required || undefined"}}));const Gu={schema:/* #__PURE__ */Bu(/* #__PURE__ */Ru(/* #__PURE__ */Nu("$label"),/* #__PURE__ */Hu(/* #__PURE__ */qu("prefix"),/* #__PURE__ */Ku(),/* #__PURE__ */zu(),/* #__PURE__ */Wu(),/* #__PURE__ */qu("suffix"))),/* #__PURE__ */Uu("$help"),/* #__PURE__ */Yu(/* #__PURE__ */ju("$message.value"))),type:"input",family:"text",props:["options"],features:[function(e){var t,o,n,r,s,a,l,i;const p=["currency","decimals","maxDecimals","minDecimals","displayLocale","min","max","step","valueFormat","currencyDisplay","placeholder","unitParts"];e.addProps(p),e.addProps(["inputText"]),null!==(t=(s=e.props).displayLocale)&&void 0!==t||(s.displayLocale=e.props.locale||"en-US"),null!==(o=(a=e.props).currency)&&void 0!==o||(a.currency=e.props.currency||"USD"),"false"===e.props.decimals||!1===e.props.decimals?e.props.decimals=0:void 0!==e.props.decimals&&(e.props.decimals=Number(e.props.decimals)),e.props.minDecimals=void 0!==e.props.minDecimals?Number(e.props.minDecimals):void 0,void 0!==e.props.min&&(e.props.min=Number(e.props.min)),void 0!==e.props.max&&(e.props.max=Number(e.props.max)),null!==(n=(l=e.props).step)&&void 0!==n||(l.step=1),null!==(r=(i=e.props).valueFormat)&&void 0!==r||(i.valueFormat="number"),-1===["string","number","integer"].indexOf(e.props.valueFormat)&&(e.props.valueFormat="number"),e.on("created",()=>{e.context&&(Vu(e),e.context.handlers.init(),p.forEach(t=>{e.on(`prop:${t}`,()=>{var t;null===(t=null==e?void 0:e.context)||void 0===t||t.handlers.init()})}))})}]};var Zu=/*#__PURE__*/Object.freeze({__proto__:null,autocomplete:hs,colorpicker:Xc,currency:Gu,datepicker:di,dropdown:jo,mask:np,rating:Dr,repeater:Yn,slider:jd,taglist:Oi,toggle:fn,togglebuttons:hu,transferlist:vd,unit:Fu});const Xu="undefined"!=typeof window?setInterval:()=>0,Ju=new WeakSet;function Qu(e,t={}){const o=e;try{if(!o)throw new Error("FormKitNoKey");function n(t){if(Ju.has(t)){const o=e=>{t.props.definition&&(t.props.definition.schema=e||[{$el:re(13919),children:`${re(451228594)}${re(32863693)}`}]),t.emit("schema"),setTimeout(()=>t.destroy(),1e3)};!function(e,t){fe[e]?fe[e].add(t):fe[e]=new Set([t])}(e,o)}}return function(e){const t=()=>{throw new Error(`InvalidFormKitKey ${e}`)};if(!/^fk-/i.test(e))return t();const o=e.substring(3);if(!Q.test(o))return t();const n=parseInt(o,16).toString(),r=Number(n[0])<6?Number(n[0]):6,s=n.substring(r,r+(n.length-6)),a=n.substring(0,r)+n.substring(r+s.length),l=a.slice(0,2),i=`${a[a.length-1]}${a[0]}`;Number(s)!==Math.floor(Number(a)*Number(l)/Number(i))&&t()}(o),n.library=o=>{if(o.props.type in t){const{schema:n,...r}=t[o.props.type];Ju.add(o),o.define({...r,schema:n(e)})}Xu(()=>ie.has(e)&&o.emit(952679114..toString(32)),4e3)},n}catch(r){throw r instanceof Error&&function(e){if("FormKitNoKey"===e.message)throw new Error("A FormKit API key is required, please visit https://formkit.com/pro")}(r),r}}export{Me as $if,hs as autocomplete,Xc as colorpicker,Ee as createBaseSections,Qu as createProPlugin,Te as createSectionFactory,Gu as currency,di as datepicker,jo as dropdown,Zu as inputs,np as mask,Dr as rating,Yn as repeater,jd as slider,Oi as taglist,fn as toggle,hu as togglebuttons,vd as transferlist,Fu as unit};
|
|
65
|
+
/* #__PURE__ */$("next")]},wu=/* #__PURE__ */Te("tb"),{outer:ku,inner:_u,wrapper:Su,prefix:Lu,suffix:Iu,help:Au,messages:Cu,message:Du,icon:Tu}=/* #__PURE__ */Oe(wu),Ou=wu("label",()=>({if:"$label",$el:"label",attrs:{id:"$id + '_label'"}})),Eu=wu("singleToggle",()=>({bind:"$attrs",$el:"button",attrs:{id:"$id",type:"button","aria-pressed":"$fns.isChecked($onValue, $value)",onClick:"$handlers.toggleValue()",disabled:"$disabled",class:"$classes.input",onBlur:"$handlers.blur"}})),Mu=wu("multiToggle",()=>({bind:"$attrs",$el:"button",attrs:{type:"button",id:"$id+'_'+$index","aria-pressed":"$fns.isChecked($option, $value)",onClick:"$handlers.toggleValue($option)",class:"$classes.input",title:"$option.help",disabled:"$disabled || $option.disabled",onBlur:"$handlers.blur"}})),Vu=wu("inputInner",()=>({bind:"$attrs",$el:"span"})),Fu=wu("options",()=>({$el:"ul",attrs:{id:"$id","data-vertical":'$vertical && "true" || "false"',"aria-labelledby":"$id"}})),Pu=wu("option",()=>({$el:"li",for:["option","index","$options"],attrs:{key:"$option.value","data-index":"$index"}}));function Bu(e,t){return t=(null==t?void 0:t.hasOwnProperty("__original"))?null==t?void 0:t.__original:null==t?void 0:t.value,e.props.multiple?!!Array.isArray(e.value)&&e.value.filter(e=>n(e,t)).length>0:void 0!==t?n(e.value,t):(e.props._isChecked=n(e.value,e.props.onValue),e.props._isChecked)}const Hu={schema:/* #__PURE__ */ku(/* #__PURE__ */Me("$options",/* #__PURE__ */Su(/* #__PURE__ */Ou("$label"),/* #__PURE__ */Fu(/* #__PURE__ */Pu(/* #__PURE__ */Mu(/* #__PURE__ */Me("$fns.isChecked($option) === true",/* #__PURE__ */Vu("$slots.default || $slots.on || $option.onLabel || $option.label"),/* #__PURE__ */Vu("$slots.default || $slots.off || $option.offLabel || $option.label")))))),/* #__PURE__ */Su(/* #__PURE__ */Me("$label && ($slots.default || $slots.on || $onLabel)",/* #__PURE__ */Ou("$label")),/* #__PURE__ */Eu(/* #__PURE__ */Tu("prefix"),/* #__PURE__ */Lu(),/* #__PURE__ */Me("$_isChecked === true",/* #__PURE__ */Vu("$slots.default || $slots.on || $onLabel || $label"),/* #__PURE__ */Vu("$slots.default || $slots.off || $offLabel || $label")),/* #__PURE__ */Iu(),/* #__PURE__ */Tu("suffix")))),/* #__PURE__ */Au("$help"),/* #__PURE__ */Cu(/* #__PURE__ */Du("$message.value"))),type:"input",family:"button",props:["options"],features:[function(e){var t,o,s,a;e.addProps(["enforced","multiple","offLabel","offValue","disabled","onLabel","onValue","vertical","_isChecked"]),e.props._isChecked=!1,e.props.enforced=r(e.props.enforced),e.props.multiple=r(e.props.multiple),e.props.vertical=r(e.props.vertical),"disabled"in e.props&&(e.props.disabled=r(e.props.disabled)),null!==(t=(s=e.props).onValue)&&void 0!==t||(s.onValue=!0),null!==(o=(a=e.props).offValue)&&void 0!==o||(a.offValue=!1),e.on("created",()=>{var t;e.props._isChecked=Bu(e,null),e.props.options&&e.props.multiple&&e.input(null!==(t=e.value)&&void 0!==t?t:[],!1),e.context&&(e.context.fns.isChecked=t=>Bu(e,t),e.context.handlers.toggleValue=t=>o=>function(e,t,o){if(o.preventDefault(),t=t?vt(t):t,e.props.options)if(e.props.multiple){const o=Array.isArray(e.value)?[...e.value]:[],r=o.findIndex(e=>n(e,t));r>-1&&(!e.props.enforced||o.length>1)?o.splice(r,1):-1===r&&o.push(t),e.input(o)}else n(e.value,t)&&!e.props.enforced?e.input(void 0):e.input(t);else e.input(n(e.value,e.props.onValue)?e.props.offValue:e.props.onValue)}(e,t,o))})},b]},Nu=/* #__PURE__ */Te("ut"),{outer:Ru,inner:Ku,wrapper:Wu,label:Uu,prefix:Yu,suffix:ju,help:qu,messages:zu,message:Gu,icon:Zu}=/* #__PURE__ */Oe(Nu),Xu=Nu("input",()=>({$el:"input",bind:"$attrs",attrs:{name:"$node.name",autocomplete:"$attrs.autocomplete || off",id:"$id",onChange:"$handlers.handleInput",onBlur:"$handlers.unitBlur",onInput:"$handlers.handleInput",onKeydown:"$handlers.handleKeyDown",onBeforeinput:"$handlers.handleBeforeInput",readonly:"$readonly",inputmode:"decimal",placeholder:"$placeholder || $unitParts.unit",disabled:"$disabled","data-unit":"$unit","data-currency":"$currency","data-display-locale":"$displayLocale","data-value-locale":"$valueLocale","data-decimals":"$decimals","data-trailing":"$trailingZeros","data-numeric-value":"$_numericValue","data-align":"$_valueAlignAuto","aria-required":"$state.required || undefined"}})),Ju={meter:{kilometer:.001,meter:1,centimeter:100,millimeter:1e3,mile:621371e-9,yard:1.09361,foot:3.28084,inch:39.3701,"mile-scandinavian":1e-4},kilometer:{kilometer:1,meter:1e3,centimeter:1e5,millimeter:1e6,mile:.621371,yard:1093.61,foot:3280.84,inch:39370.1,"mile-scandinavian":10},centimeter:{kilometer:1e-5,meter:.01,centimeter:1,millimeter:10,mile:62137e-10,yard:.0109361,foot:.0328084,inch:.393701,"mile-scandinavian":1e-6},millimeter:{kilometer:1e-6,meter:.001,centimeter:.1,millimeter:1,mile:6.21371e-7,yard:.00109361,foot:.00328084,inch:.0393701,"mile-scandinavian":1e-7},mile:{kilometer:1.60934,meter:1609.34,centimeter:160934,millimeter:1609340,mile:1,yard:1760,foot:5280,inch:63360,"mile-scandinavian":.160934},yard:{kilometer:9144e-7,meter:.9144,centimeter:91.44,millimeter:914.4,mile:568182e-9,yard:1,foot:3,inch:36,"mile-scandinavian":9144e-8},foot:{kilometer:3048e-7,meter:.3048,centimeter:30.48,millimeter:304.8,mile:189394e-9,yard:.333333,foot:1,inch:12,"mile-scandinavian":3048e-8},inch:{kilometer:254e-7,meter:.0254,centimeter:2.54,millimeter:25.4,mile:15783e-9,yard:.0277778,foot:.0833333,inch:1,"mile-scandinavian":254e-8},"mile-scandinavian":{kilometer:10,meter:1e4,centimeter:1e6,millimeter:1e7,mile:6.21371,yard:10936.1,foot:32808.4,inch:393701,"mile-scandinavian":1}},Qu={celsius:{celsius:e=>e,fahrenheit:e=>1.8*e+32},fahrenheit:{celsius:e=>5/9*(e-32),fahrenheit:e=>e}},ef={acre:{acre:1,hectare:.404686},hectare:{acre:2.47105,hectare:1}},tf={gram:{gram:1,kilogram:.001,ounce:.035274,pound:.00220462},kilogram:{gram:1e3,kilogram:1,ounce:35.274,pound:2.20462},ounce:{gram:28.3495,kilogram:.0283495,ounce:1,pound:.0625},pound:{gram:453.592,kilogram:.453592,ounce:16,pound:1},stone:{gram:6350.29,kilogram:6.35029,ounce:224,pound:14,stone:1}},of={liter:{liter:1,milliliter:1e3,gallon:.264172,"fluid-ounce":33.814},milliliter:{liter:.001,milliliter:1,gallon:264172e-9,"fluid-ounce":.033814},gallon:{liter:3.78541,milliliter:3785.41,gallon:1,"fluid-ounce":128},"fluid-ounce":{liter:.0295735,milliliter:29.5735,gallon:.0078125,"fluid-ounce":1}},nf={day:{day:1,hour:24,microsecond:864e8,millisecond:864e5,minute:1440,month:.0328767,nanosecond:864e14,second:86400,week:.142857,year:.00273973},hour:{day:.0416667,hour:1,microsecond:36e8,millisecond:36e5,minute:60,month:.00136986,nanosecond:36e11,second:3600,week:.00595238,year:114155e-9},microsecond:{day:115741e-19,hour:277778e-18,microsecond:1,millisecond:.001,minute:1.66667e-8,month:380517e-24,nanosecond:1e3,second:1e-6,week:165344e-20,year:3171e-20},millisecond:{day:1.15741e-8,hour:2.77778e-7,microsecond:1e3,millisecond:1,minute:166667e-10,month:380517e-19,nanosecond:1e6,second:.001,week:165344e-16,year:3171e-16},minute:{day:694444e-9,hour:.0166667,microsecond:6e7,millisecond:6e4,minute:1,month:228311e-10,nanosecond:6e10,second:60,week:992063e-10,year:190132e-11},month:{day:30.4368,hour:730.484,microsecond:2628e12,millisecond:2628e9,minute:43800,month:1,nanosecond:2628e15,second:2628e6,week:4.34524,year:.0833333},nanosecond:{day:1.15741e-20,hour:277778e-24,microsecond:.001,millisecond:1e-6,minute:166667e-19,month:380517e-28,nanosecond:1,second:1e-9,week:165344e-26,year:3171e-26},second:{day:115741e-10,hour:277778e-9,microsecond:1e6,millisecond:1e3,minute:.0166667,month:380517e-16,nanosecond:1e9,second:1,week:1.65344e-8,year:3.171e-10},week:{day:7,hour:168,microsecond:6048e11,millisecond:6048e8,minute:10080,month:.230137,nanosecond:6048e14,second:604800,week:1,year:.0191781},year:{day:365,hour:8760,microsecond:3154e13,millisecond:3154e10,minute:525600,month:12,nanosecond:3154e16,second:3154e4,week:52.1429,year:1}},rf={bit:{bit:1,byte:.125,kilobit:.001,kilobyte:125e-6,megabit:1e-6,megabyte:125e-9,gigabit:1e-9,gigabyte:1.25e-10,terabit:1e-12,terabyte:125e-15,petabyte:125e-18},byte:{bit:8,byte:1,kilobit:.008,kilobyte:.001,megabit:8e-6,megabyte:1e-6,gigabit:8e-9,gigabyte:1e-9,terabit:8e-12,terabyte:1e-12,petabyte:1e-15},kilobit:{bit:1e3,byte:125,kilobit:1,kilobyte:.125,megabit:.001,megabyte:125e-6,gigabit:1e-6,gigabyte:125e-9,terabit:1e-9,terabyte:1.25e-10,petabyte:125e-15},kilobyte:{bit:8e3,byte:1e3,kilobit:8,kilobyte:1,megabit:.008,megabyte:.001,gigabit:8e-6,gigabyte:1e-6,terabit:8e-9,terabyte:1e-9,petabyte:1e-12},megabit:{bit:1e6,byte:125e3,kilobit:1e3,kilobyte:125,megabit:1,megabyte:.125,gigabit:.001,gigabyte:125e-6,terabit:1e-6,terabyte:125e-9,petabyte:1.25e-10},megabyte:{bit:8e6,byte:1e6,kilobit:8e3,kilobyte:1e3,megabit:8,megabyte:1,gigabit:.008,gigabyte:.001,terabit:8e-6,terabyte:1e-6,petabyte:1e-9},gigabit:{bit:1e9,byte:125e6,kilobit:1e6,kilobyte:125e3,megabit:1e3,megabyte:125,gigabit:1,gigabyte:.125,terabit:.001,terabyte:125e-6,petabyte:125e-9},gigabyte:{bit:8e9,byte:1e9,kilobit:8e6,kilobyte:1e6,megabit:8e3,megabyte:1e3,gigabit:8,gigabyte:1,terabit:.008,terabyte:.001,petabyte:1e-6},terabit:{bit:1e12,byte:125e9,kilobit:1e9,kilobyte:125e6,megabit:1e6,megabyte:125e3,gigabit:1e3,gigabyte:125,terabit:1,terabyte:.125,petabyte:125e-6},terabyte:{bit:8e12,byte:1e12,kilobit:8e9,kilobyte:1e9,megabit:8e6,megabyte:1e6,gigabit:8e3,gigabyte:1e3,terabit:8,terabyte:1,petabyte:.001},petabyte:{bit:1e15,byte:125e12,kilobit:1e12,kilobyte:125e9,megabit:1e9,megabyte:125e6,gigabit:1e6,gigabyte:125e3,terabit:1e3,terabyte:125,petabyte:1}};function sf(e){let t=!1;function o(o,n={}){var r,s,p,c,u,f,v;const h="boolean"==typeof n?{async:n}:n,m=null===(r=h.async)||void 0===r||r,g=null===(s=h.enforceBounds)||void 0===s||s,$=null!==(p=h.parseLocale)&&void 0!==p&&p,b=null===(c=h.emitInput)||void 0===c||c,y=(`${o}`.match(/\-/g)||[]).length%2==1;o=function(t,o=!1){t=function(e){return e.replace(/[\u0660-\u0669\u06f0-\u06f9]/g,e=>(15&e.charCodeAt(0)).toString())}(`${t}`),o&&(t=function(t){e.props.unitParts.group&&(t=t.split(e.props.unitParts.group).join(""));e.props.unitParts.decimal&&"."!==e.props.unitParts.decimal&&(t=t.split(e.props.unitParts.decimal).join("."));return t}(t));if(isNaN(t)){const n=o?".":e.props.unitParts.decimal;t=t.split(n).map(e=>e.replace(/[^0-9]/g,"")).join(".")}if(t=t.replace(/[^0-9\.]/g,""),t.includes(".")){const o=t.split(".");0===e.props.decimals?t=o[0]:"currency"===e.props.type&&(o[1]=o[1].padEnd(d(),"0").slice(0,d()),t=o.join("."))}return t}(o,$);const x={};"unit"!==a()&&"decimal"!==a()||(x.minimumFractionDigits=o.includes(".")?1:0),x.maximumFractionDigits="currency"===e.props.type?d():e.props.decimals,e.props.minDecimals&&(x.minimumFractionDigits=e.props.minDecimals,o&&!o.includes(".")&&(o+=".".padEnd(e.props.minDecimals+1,"0"))),0===x.maximumFractionDigits&&o.includes(".")&&(o=o.split(".")[0]);let w="";if(!isNaN(o)&&""!==o.trim()&&(o=y?`-${o}`:o,g&&l(e.props.max)&&(o=Number(o)>e.props.max?`${e.props.max}`:o),g&&l(e.props.min)&&(o=Number(o)<e.props.min?`${e.props.min}`:o),o.includes(".")&&"currency"===e.props.type?o=o.split(".")[0].padStart(1,"0")+"."+(null!==(u=o.split(".")[1])&&void 0!==u?u:"0"):"currency"===e.props.type&&(x.maximumFractionDigits=null!==(f=x.minimumFractionDigits)&&void 0!==f?f:0),w=i(e.props.displayLocale,x).format(o),"unit"===e.props.type&&"."===o[o.length-1])){const t=w.lastIndexOf(e.props.unitParts.decimal);w=w.slice(0,t+1)+w.slice(t+2),o=o.slice(0,-1)}let k,_=o.split(".");if("currency"===e.props.type&&(_=_[0]+(null!==(v=_[1])&&void 0!==v?v:"").padEnd(d(),"0"),_.length>1&&(_=_.replace(/^0+/,""),_=""!==o&&""===_?"0":_)),e.props.valueStore={number:o,integer:_,string:w},e.props.valueStore&&(k=e.props.valueStore.hasOwnProperty(e.props.valueFormat)?e.props.valueStore[e.props.valueFormat]:e.props.valueStore.number),b){const o=""===k?void 0:k;t=!0;try{e.input(o,m)}finally{t=!1}}}function n(){s(`${e.props.id}`,t=>{var o,n;t instanceof HTMLInputElement&&(t.value=null!==(n=null===(o=e.props.valueStore)||void 0===o?void 0:o.string)&&void 0!==n?n:"")},e.props.__root)}function r(){var t,o;const n=null===(t=e.props.__root)||void 0===t?void 0:t.querySelector(`#${e.props.id}_inner input`);return null!==(o=null==n?void 0:n.value)&&void 0!==o?o:""}function a(){return e.props.currency?"currency":e.props.unit?"unit":"decimal"}function l(e){return null!=e&&!isNaN(Number(e))}function i(t,o={}){const n=a(),r=Object.assign({},{style:n,roundingMode:"trunc"},o);return"unit"===e.props.type&&(r.unitDisplay=e.props.unitDisplay),"currency"===e.props.type&&(r.currencyDisplay=e.props.currencyDisplay),"currency"===n&&(r.currency=e.props.currency),"unit"===n&&(r.unit=e.props.unit),new Intl.NumberFormat(t,r)}function p(t,o){var n,s,a,l,i;const p=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input`);if(!p)return;const d=(null!==(a=null===(s=e.props.unitParts.unit)||void 0===s?void 0:s.length)&&void 0!==a?a:0)+(null!==(i=null===(l=e.props.unitParts.literal)||void 0===l?void 0:l.length)&&void 0!==i?i:0);e.props.unitParts.unitLeft?t=Math.max(t,d):(t=Math.min(t,r().length-d),"insertText"===o&&0===t&&(t=1)),p.setSelectionRange(t,t)}function d(){return void 0!==e.props.decimals?e.props.decimals:void 0!==e.props.minDecimals&&e.props.minDecimals>e.props.unitParts.fractionLength?e.props.minDecimals:e.props.unitParts.fractionLength}if(e.props.valueStore=null,e.on("input",({payload:e})=>{t||(o(e),n())}),e.context){const t=e.context.handlers.blur;e.context.handlers.blur=e=>{o((null==e?void 0:e.target)instanceof HTMLInputElement?e.target.value:r(),{parseLocale:!0}),n(),t(e)},e.context.handlers.init=(t=null)=>{var r,s;e.props.skipInit?e.props.skipInit=!1:function(){var t,o,n,r,s,a,l;e.props.skipInit=!0;const p=i(e.props.displayLocale).formatToParts(12345678.12345678);e.props.unitParts={decimal:null===(t=p.find(e=>"decimal"==e.type))||void 0===t?void 0:t.value,group:null===(o=p.find(e=>"group"==e.type))||void 0===o?void 0:o.value,unit:null===(n=p.find(e=>["unit","currency"].includes(e.type)))||void 0===n?void 0:n.value,unitLeft:["unit","currency"].includes(p[0].type),literal:null!==(s=null===(r=p.find(e=>"literal"==e.type))||void 0===r?void 0:r.value)&&void 0!==s?s:"",fractionLength:null!==(l=null===(a=p.find(e=>"fraction"==e.type))||void 0===a?void 0:a.value.length)&&void 0!==l?l:0}}();const a=!!e.props.valueStore;let l=null!==(r=null!=t?t:e._value)&&void 0!==r?r:"";e.props.valueStore?l=e.props.valueStore.number:"integer"===e.props.valueFormat&&(l=function(e){var t;return(parseFloat(`${e}`)/Math.pow(10,null!==(t=d())&&void 0!==t?t:0)).toString().replace(".",d())}(`${null!=l?l:""}`)),"unit"===e.props.type&&e.props.valueUnit&&e.props.unit&&e.props.valueUnit!==e.props.unit&&e.hook.input((t,o)=>{const n=function(e,t,o){if(Ju[e]&&Ju[e][o])return t*Ju[e][o];if(Qu[e]&&Qu[e][o])return Qu[e][o](t);if(ef[e]&&ef[e][o])return t*ef[e][o];if(tf[e]&&tf[e][o])return t*tf[e][o];if(of[e]&&of[e][o])return t*of[e][o];if(nf[e]&&nf[e][o])return t*nf[e][o];if(rf[e]&&rf[e][o])return t*rf[e][o];throw new Error("Conversion not supported")}(e.props.unit,t,e.props.valueUnit);return isNaN(n)?o(t):o(+n.toFixed(Number(e.props.valueDecimals)||2))}),o(l,{async:!0===(null===(s=e.context)||void 0===s?void 0:s.didMount),emitInput:a||""!==l}),n()},e.context.handlers.handleBeforeInput=t=>{var n,r,s,a,l,i,d,c,u;if(!e.props.inExecCommand&&"insertLineBreak"!==t.inputType&&(t.preventDefault(),t.stopPropagation(),t.target instanceof HTMLInputElement)){const f=t.target,v=null!==(n=t.data)&&void 0!==n?n:"",h=null!==(r=t.target.value)&&void 0!==r?r:"",m=null!==(s=t.target.selectionStart)&&void 0!==s?s:0,g=null!==(a=t.target.selectionEnd)&&void 0!==a?a:0,$=g-m,b=h.indexOf(e.props.unitParts.decimal);let y=(null!==(l=t.target.selectionStart)&&void 0!==l?l:0)+(t.data?0:-1),x=h,w=1;if(h.includes(e.props.unitParts.decimal)&&v===e.props.unitParts.decimal)return v===e.props.unitParts.decimal&&(y=x.indexOf(e.props.unitParts.decimal)+1),void p(y);if(!(null===e.props.min||e.props.min<0||e.props.max<0)&&"-"===v)return;if(v.match(/[a-zA-Z]/))return;if(v===e.props.unitParts.decimal&&0===e.props.decimals)return;if("deleteByCut"===t.inputType&&$>0&&(x=x.slice(0,m)+x.slice(g),y=g),"insertFromPaste"===t.inputType){const e=null!==(i=t.data)&&void 0!==i?i:"";x=x.slice(0,m)+e+x.slice(g)}if("deleteContentBackward"===t.inputType&&h[m-1]===e.props.unitParts.group?(w+=1,y-=1):"deleteContentForward"===t.inputType&&h[m]===e.props.unitParts.group&&(w+=1,y+=1),-1!==b&&y>b&&"insertText"===t.inputType?x=function(e,t,o){return e.substring(0,t)+o+e.substring(t+o.length)}(x,y,null!==(d=t.data)&&void 0!==d?d:"0"):"insertText"===t.inputType?(y=g,x=x.slice(0,m)+t.data+x.slice(g)):"deleteContentForward"===t.inputType?(y+=2,x=0===$?x.slice(0,m)+x.slice(g+w):x.slice(0,m)+x.slice(g)):"deleteContentBackward"===t.inputType&&(y+=1,0===$?x=x.slice(0,Math.max(m-w,0))+x.slice(g):$>0&&(x=x.slice(0,m)+x.slice(g))),"deleteContentForward"===t.inputType&&h[m]===e.props.unitParts.decimal){const t=x.slice(m-1);x=x.slice(0,m),t.includes(e.props.unitParts.unit)&&(x+=" "+e.props.unitParts.unit)}else if("deleteContentBackward"===t.inputType&&h[m-1]===e.props.unitParts.decimal){const t=x.slice(m-1);x=x.slice(0,m-1),t.includes(e.props.unitParts.unit)&&(x+=" "+e.props.unitParts.unit)}if(o(x,{enforceBounds:!1,parseLocale:!0}),x=(null===(c=e.props.valueStore)||void 0===c?void 0:c.string)||(null===(u=e.props.valueStore)||void 0===u?void 0:u.number)||"",y=x.length-h.length+y,x.length===h.length&&y>b&&(y+=t.inputType.includes("delete")?-1:1),f.setSelectionRange(0,h.length),e.props.inExecCommand=!0,document.execCommand("insertText",void 0,x),e.props.inExecCommand=!1,v===e.props.unitParts.decimal?y=x.indexOf(e.props.unitParts.decimal)+1:h.includes(e.props.unitParts.decimal)&&!x.includes(e.props.unitParts.decimal)&&(y=x.length),"insertText"===t.inputType&&e.props.minDecimals&&(!e.value||0===m&&g===h.length||-1===b&&e.props.minDecimals&&h)){const t=x.indexOf(e.props.unitParts.decimal);-1!==t&&(y=t)}p(Math.max(0,y),t.inputType)}},e.context.handlers.handleInput=t=>{e.emit("dom-input-event",t),t.target instanceof HTMLInputElement&&(e.props.inputText=t.target.value,o(t.target.value,{enforceBounds:!1,parseLocale:!0}))},e.context.handlers.handleKeyDown=t=>{var s,a;if(t.target instanceof HTMLInputElement&&("ArrowUp"===t.key||"ArrowDown"===t.key)){const l="ArrowUp"===t.key?1*e.props.step:-1*e.props.step;o(function(e,t){var o,n,r,s;const a=`${e}`.split("."),l=`${t}`.split(".");let i=null!==(o=a[0])&&void 0!==o?o:"0",p=null!==(n=l[0])&&void 0!==n?n:"0";const d=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(s=l[1])&&void 0!==s?s:"",u=Math.max(d.length,c.length);u>0&&(i+=d.padEnd(u,"0"),p+=c.padEnd(u,"0"));const f=BigInt(BigInt(i)+BigInt(p)).toString();return u>0?f.slice(0,-1*u)+"."+f.slice(-1*u):f}(null!==(a=null===(s=e.props.valueStore)||void 0===s?void 0:s.number)&&void 0!==a?a:0,l)),n(),setTimeout(()=>{p(r().length)},1)}}}}const af={schema:/* #__PURE__ */Ru(/* #__PURE__ */Wu(/* #__PURE__ */Uu("$label"),/* #__PURE__ */Ku(/* #__PURE__ */Zu("prefix"),/* #__PURE__ */Yu(),/* #__PURE__ */Xu(),/* #__PURE__ */ju(),/* #__PURE__ */Zu("suffix"))),/* #__PURE__ */qu("$help"),/* #__PURE__ */zu(/* #__PURE__ */Gu("$message.value"))),type:"input",family:"text",features:[function(e){var t,o,n,r,s,a;const l=["unit","decimals","minDecimals","displayLocale","min","max","step","valueFormat","unitDisplay","placeholder","unitParts","valueUnit","valueDecimals"];e.addProps(l),null!==(t=(r=e.props).displayLocale)&&void 0!==t||(r.displayLocale=e.props.locale||"en-US"),e.props.unitDisplay=e.props.unitDisplay||"short","false"===e.props.decimals||!1===e.props.decimals?e.props.decimals=0:void 0!==e.props.decimals?e.props.decimals=Number(e.props.decimals):e.props.decimals=2,e.props.minDecimals=void 0!==e.props.minDecimals?Number(e.props.minDecimals):void 0,void 0!==e.props.min&&(e.props.min=Number(e.props.min)),void 0!==e.props.max&&(e.props.max=Number(e.props.max)),null!==(o=(s=e.props).step)&&void 0!==o||(s.step=1),null!==(n=(a=e.props).valueFormat)&&void 0!==n||(a.valueFormat="number"),-1===["string","number"].indexOf(e.props.valueFormat)&&(e.props.valueFormat="number"),e.on("created",()=>{e.context&&(e.context.handlers.unitBlur=t=>{if(!(t.target instanceof HTMLInputElement))return;let o=t.target.value;(function(e){e=e.trim();const t=/\d+\,\s*%?$/;return/\d+\.\s*%?$/.test(e)||t.test(e)})(o)&&(o=o.replace(e.props.unitParts.decimal,""),t.target.value=o),e.context&&e.context.handlers.blur(t)},sf(e),e.context.handlers.init(),l.forEach(t=>{e.on(`prop:${t}`,()=>{var t;null===(t=null==e?void 0:e.context)||void 0===t||t.handlers.init()})}))})}]},lf=/* #__PURE__ */Te("cr"),{outer:pf,inner:df,wrapper:cf,label:uf,prefix:ff,suffix:vf,help:hf,messages:mf,message:gf,icon:$f}=/* #__PURE__ */Oe(lf),bf=lf("input",()=>({$el:"input",bind:"$attrs",attrs:{name:"$node.name",autocomplete:"$attrs.autocomplete || off",id:"$id",onChange:"$handlers.handleInput",onBlur:"$handlers.blur",onInput:"$handlers.handleInput",onKeydown:"$handlers.handleKeyDown",onBeforeinput:"$handlers.handleBeforeInput",readonly:"$readonly",disabled:"$disabled",placeholder:"$placeholder || $unitParts.unit",inputmode:"decimal","data-unit":"$unit","data-currency":"$currency","data-display-locale":"$displayLocale","data-value-locale":"$valueLocale","data-decimals":"$decimals","data-trailing":"$trailingZeros","data-numeric-value":"$_numericValue","data-align":"$_valueAlignAuto","aria-required":"$state.required || undefined"}}));const yf={schema:/* #__PURE__ */pf(/* #__PURE__ */cf(/* #__PURE__ */uf("$label"),/* #__PURE__ */df(/* #__PURE__ */$f("prefix"),/* #__PURE__ */ff(),/* #__PURE__ */bf(),/* #__PURE__ */vf(),/* #__PURE__ */$f("suffix"))),/* #__PURE__ */hf("$help"),/* #__PURE__ */mf(/* #__PURE__ */gf("$message.value"))),type:"input",family:"text",props:["options"],features:[function(e){var t,o,n,r,s,a,l,i;const p=["currency","decimals","maxDecimals","minDecimals","displayLocale","min","max","step","valueFormat","currencyDisplay","placeholder","unitParts"];e.addProps(p),e.addProps(["inputText"]),null!==(t=(s=e.props).displayLocale)&&void 0!==t||(s.displayLocale=e.props.locale||"en-US"),null!==(o=(a=e.props).currency)&&void 0!==o||(a.currency=e.props.currency||"USD"),"false"===e.props.decimals||!1===e.props.decimals?e.props.decimals=0:void 0!==e.props.decimals&&(e.props.decimals=Number(e.props.decimals)),e.props.minDecimals=void 0!==e.props.minDecimals?Number(e.props.minDecimals):void 0,void 0!==e.props.min&&(e.props.min=Number(e.props.min)),void 0!==e.props.max&&(e.props.max=Number(e.props.max)),null!==(n=(l=e.props).step)&&void 0!==n||(l.step=1),null!==(r=(i=e.props).valueFormat)&&void 0!==r||(i.valueFormat="number"),-1===["string","number","integer"].indexOf(e.props.valueFormat)&&(e.props.valueFormat="number"),e.on("created",()=>{e.context&&(sf(e),e.context.handlers.init(),p.forEach(t=>{e.on(`prop:${t}`,()=>{var t;null===(t=null==e?void 0:e.context)||void 0===t||t.handlers.init()})}))})}]};var xf=/*#__PURE__*/Object.freeze({__proto__:null,autocomplete:As,colorpicker:xu,currency:yf,datepicker:Mi,dropdown:tn,mask:Ip,rating:Rr,repeater:er,slider:mc,taglist:np,toggle:wn,togglebuttons:Hu,transferlist:Bd,unit:af});const wf="undefined"!=typeof window?setInterval:()=>0,kf=new WeakSet;function _f(e,t={}){const o=e;try{if(!o)throw new Error("FormKitNoKey");function n(t){if(kf.has(t)){const o=e=>{t.props.definition&&(t.props.definition.schema=e||[{$el:re(13919),children:`${re(451228594)}${re(32863693)}`}]),t.emit("schema"),setTimeout(()=>t.destroy(),1e3)};!function(e,t){fe[e]?fe[e].add(t):fe[e]=new Set([t])}(e,o),t.on("destroyed",()=>function(e,t){fe[e]&&(fe[e].delete(t),0===fe[e].size&&delete fe[e])}(e,o))}}return function(e){const t=()=>{throw new Error(`InvalidFormKitKey ${e}`)};if(!/^fk-/i.test(e))return t();const o=e.substring(3);if(!Q.test(o))return t();const n=parseInt(o,16).toString(),r=Number(n[0])<6?Number(n[0]):6,s=n.substring(r,r+(n.length-6)),a=n.substring(0,r)+n.substring(r+s.length),l=a.slice(0,2),i=`${a[a.length-1]}${a[0]}`;Number(s)!==Math.floor(Number(a)*Number(l)/Number(i))&&t()}(o),n.library=o=>{if(o.props.type in t){const{schema:n,...r}=t[o.props.type];kf.add(o),o.define({...r,schema:n(e)})}wf(()=>ie.has(e)&&o.emit(952679114..toString(32)),4e3)},n}catch(r){throw r instanceof Error&&function(e){if("FormKitNoKey"===e.message)throw new Error("A FormKit API key is required, please visit https://formkit.com/pro")}(r),r}}export{Me as $if,As as autocomplete,xu as colorpicker,Oe as createBaseSections,_f as createProPlugin,Te as createSectionFactory,yf as currency,Mi as datepicker,tn as dropdown,xf as inputs,Ip as mask,Rr as rating,er as repeater,mc as slider,np as taglist,wn as toggle,Hu as togglebuttons,Bd as transferlist,af as unit};
|