@formkit/pro 0.127.20 → 0.127.21
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/index.cjs +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
package/autocomplete/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$if as e,$attrs as i,createSectionFactory as t,createBaseSections as o}from"../index.mjs";import{icon as n}from"@formkit/inputs";const a=(e,i)=>()=>n(e,i);function l(t){const o=t("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=t("listbox",(()=>({$el:"ul",if:"$expanded || $setForceExpanded",attrs:{style:"$listboxStyles",id:'$id + "_listbox"',role:"listbox","aria-activedescendant":"$activeDescendant","aria-labelledby":'$id + "_label"'}}))),l=t("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"}}))),d=t("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"}}))),s=t("loadMoreInner","span"),$=t("emptyMessage",(()=>({$el:"li",if:"$showEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}}))),r=t("emptyMessageInner","span"),p=t("option",(()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option)"}}))),u=t("listitems",(()=>({$el:null,if:"$options.length",for:["option","index","$option.options || $options"]}))),c=t("innerListitems",(()=>({$el:null,for:["option","innerIndex","$option.options"]}))),v=t("listitemGroup",(()=>({$el:"li",attrs:{"aria-label":"$option.group",role:"group",onClick:"$handlers.listitemGroupClick",tabindex:"-1"}}))),b=t("groupLabel","span"),m=t("groupList",(()=>({$el:"ul",attrs:{role:"group"}})));return()=>o(n($(r("$emptyMessage")),u(e("$option.group",v(b("$option.group"),m(c(i((()=>({id:'$id + "_listitem_" + $index + "_" + $innerIndex'})),l(e("$fns.isSelected($option)",a("selected")),p("$option.label")))))),l(e("$fns.isSelected($option)",a("selected")),p("$option.label")))),d(e("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",s(e("$state.loading",a("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value")))))}const d=/* #__PURE__ */t("ac"),{outer:s,wrapper:$,inner:r,icon:p,label:u,prefix:c,suffix:v,help:b,messages:m,message:h}=/* #__PURE__ */o(d),f=d("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:"$
|
|
1
|
+
import{$if as e,$attrs as i,createSectionFactory as t,createBaseSections as o}from"../index.mjs";import{icon as n}from"@formkit/inputs";const a=(e,i)=>()=>n(e,i);function l(t){const o=t("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=t("listbox",(()=>({$el:"ul",if:"$expanded || $setForceExpanded",attrs:{style:"$listboxStyles",id:'$id + "_listbox"',role:"listbox","aria-activedescendant":"$activeDescendant","aria-labelledby":'$id + "_label"'}}))),l=t("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"}}))),d=t("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"}}))),s=t("loadMoreInner","span"),$=t("emptyMessage",(()=>({$el:"li",if:"$showEmptyMessage && $state.loading !== true",attrs:{id:'$id + "_empty_message"',key:"$emptyMessage",role:"presentation"}}))),r=t("emptyMessageInner","span"),p=t("option",(()=>({$el:"div",attrs:{"data-checked":"$fns.isSelected($option)"}}))),u=t("listitems",(()=>({$el:null,if:"$options.length",for:["option","index","$option.options || $options"]}))),c=t("innerListitems",(()=>({$el:null,for:["option","innerIndex","$option.options"]}))),v=t("listitemGroup",(()=>({$el:"li",attrs:{"aria-label":"$option.group",role:"group",onClick:"$handlers.listitemGroupClick",tabindex:"-1"}}))),b=t("groupLabel","span"),m=t("groupList",(()=>({$el:"ul",attrs:{role:"group"}})));return()=>o(n($(r("$emptyMessage")),u(e("$option.group",v(b("$option.group"),m(c(i((()=>({id:'$id + "_listitem_" + $index + "_" + $innerIndex'})),l(e("$fns.isSelected($option)",a("selected")),p("$option.label")))))),l(e("$fns.isSelected($option)",a("selected")),p("$option.label")))),d(e("$state.loading && $optionLoadingCounter === 0 || $state.hasNextPage",s(e("$state.loading",a("loader")),"$state.loading && $ui.isLoading.value || $ui.loadMore.value")))))}const d=/* #__PURE__ */t("ac"),{outer:s,wrapper:$,inner:r,icon:p,label:u,prefix:c,suffix:v,help:b,messages:m,message:h}=/* #__PURE__ */o(d),f=d("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"}}))),x=d("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"}}))),g=d("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)"}}))),y=d("selection",(()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}}))),_=d("selections",(()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}}))),k=d("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"}}))),S=d("optionLoading","span"),w=d("option",(()=>({$el:"div",if:"$value !== undefined"}))),C=/* #__PURE__ */l(d);export{d as createSection,b as help,p as icon,r as inner,f as input,u as label,C as listbox,x as listboxButton,h as message,m as messages,w as option,S as optionLoading,s as outer,c as prefix,k as removeSelection,y as selection,g as selectionWrapper,_ as selections,v as suffix,$ as wrapper};
|
package/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/* #__PURE__ */o.defaultIcon("remove","trash"),
|
|
17
17
|
/* #__PURE__ */o.defaultIcon("add","add"),
|
|
18
18
|
/* #__PURE__ */o.defaultIcon("moveUp","arrowUp"),
|
|
19
|
-
/* #__PURE__ */o.defaultIcon("moveDown","arrowDown")]},Zo=new WeakMap;function Go(e,t){const o={onItems:[],offItems:[]},n=t||Number(e.value||0);for(let t=0;t<e.props.max;t++)if(t<n&&t+1>=n){const r=e.props.rightToLeft?100-100*(n-t):100*(n-t);o.onItems.push(r+"%"),o.offItems.push(100-r+"%")}else t<n?(o.offItems.push("0%"),o.onItems.push("100%")):t>=n&&(o.offItems.push("100%"),o.onItems.push("0%"));e.props.itemsToPercentages=o}function Xo(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function Jo(e,t){const{x:o,y:n}=ln(t);let r=document.elementFromPoint(o,n);const s=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));let a=!0;for(;r&&a;){if(s.includes(r)){a=!1;break}r=r.parentNode}if(!a){const t=s.indexOf(r);if(1===e.props.step)return void e.input(t+1,!1)}}function Qo(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?pn(e,t,o):e.input(t+1,!1))}function en(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,Go(e);const o=Zo.get(e);o&&(o.abort(),Zo.delete(e))}function tn(e,t,o){if(e.props.hoverHighlight||e.props.disabled)return;o.preventDefault(),e.props.hoverHighlight=!0,e.props.dragStarted=!0;const n=new AbortController;document.addEventListener("mouseup",(t=>en(e,t)),{signal:n.signal}),Zo.set(e,n),1===e.props.step?e.input(t+1,!1):pn(e,t,o)}function on(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=e.value?dn(e.value+1*e.props.step,e.props.step):e.props.min+1*e.props.step,n=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(e.value?`#${e.props.id}_inner input[value="${t}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,n&&n instanceof HTMLInputElement&&n.focus(),e.props.preventFocus=!1,e.input(Number(t))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=e.value?dn(e.value-1*e.props.step,e.props.step):e.props.max,o=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${t}"]`);e.props.preventFocus=!0,o&&o instanceof HTMLInputElement&&o.focus(),e.props.preventFocus=!0,e.input(Number(t)),e.props.preventFocus=!1}}function nn(e,t){if(!e.props.preventFocus)if(e.props.preventFocus=!0,setTimeout((()=>{e.props.preventFocus=!1}),50),t.relatedTarget instanceof HTMLElement&&t.relatedTarget.id===e.props.id+"_items_wrapper")e.props.arrow>0?setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+"_0_0"))||void 0===o||o.focus()})):e.props.arrow<0&&setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+`_${e.props.max-1}_${e.props.stepsPerValue-1}`))||void 0===o||o.focus()}));else if(t.target instanceof HTMLInputElement){if(Number(t.target.value)===e.props.step&&e.value===e.props.max||Number(t.target.value)===e.props.max&&e.value===e.props.step){const t=document.getElementById(e.props.id+"_items_wrapper");return null==t||t.focus(),void e.input(0)}e.input(Number(t.target.value))}}function rn(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(Go(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):pn(e,t,o,!!e.props.dragStarted)))}function sn(e){Go(e)}function an(e,t,o){if(!e.props.disabled&&"touchstart"!==o.type&&(o.preventDefault(),(0!==o.clientX||0!==o.clientY)&&o.currentTarget instanceof HTMLElement))return 1===e.props.step?e.props.deselect&&Number(e.value)===t+1?void e.input(0):void e.input(t+1):void pn(e,t,o)}function ln(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function pn(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r,y:s}=ln(o),a=o.currentTarget.getBoundingClientRect();let l=dn((r-a.x)/a.width+t,e.props.step);l=l>e.props.min?l:e.props.min,l=l<e.props.max?l:e.props.max,!e.props.deselect||l!==Number(e.value)||e.props.dragStarted?n?e.input(l,!1):Go(e,l):e.input(0)}function dn(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const cn=/* #__PURE__ */K("rt"),{outer:un,wrapper:fn,inner:vn,label:hn,prefix:mn,suffix:gn,help:$n,messages:bn,message:yn,icon:xn}=/* #__PURE__ */W(cn),wn=cn("itemsWrapper",(()=>({$el:"span",attrs:{style:{"flex-direction":'$rightToLeft && "row-reverse" || undefined'},tabindex:"$value !== undefined && $value !== 0 && '-1' || '0'",id:"$id + _items_wrapper",onKeydown:"$handlers.handleWrapperKeydown","data-disabled":"$disabled",onBlur:"$handlers.handleWrapperBlur",onMouseleave:"$hoverHighlight && $handlers.handleMouseleave"}}))),_n=cn("ratingItem",(()=>({for:["item","index","$max"],$el:"span",attrs:{id:'$id + "_item_" + $index',onClick:"$handlers.handleItemClick($item)",draggable:"$hoverHighlight !== true && && $disabled !== true && true",onMousemove:"$handlers.handleMousemove($item)",onDragstart:"$handlers.handleDragstart($item)",onDragend:"$handlers.handleDragend",onTouchstartPassive:"$handlers.handleTouchstart($item)",onTouchmovePassive:"$handlers.handleTouchmove"}}))),kn=cn("template",(()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null}))),Sn=cn("itemLabel",(()=>({$el:"label",attrs:{id:'$id + "_label_" + $index + "_" + $stepIndex',for:'$id + "_" + $index + "_" + $stepIndex',"data-checked":'$value === $fns.getValue($item, $increment) && "true" || "false"',style:{width:'$fns.showLabel($fns.getValue($item, $increment), $stepIndex, $item) && "100%" || "0%"'}}}))),Ln=cn("itemLabelInner",(()=>({$el:"span",children:"$fns.getValue($item, $increment)"}))),In=cn("input",(()=>({$el:"input",attrs:{type:"radio",value:"$fns.getValue($item, $increment)",id:'$id + "_" + $index + "_" + $stepIndex',onFocus:"$handlers.handleFocus",tabindex:'$value === $fns.getValue($item, $increment) && "0" || "-1"',disabled:"$disabled",name:"$id","data-value":"$fns.getValue($item, $increment)",checked:"$value === $fns.getValue($item, $increment) && true",onKeydown:"$handlers.handleKeydown($fns.getValue($item, $increment))"}}))),Dn=cn("onItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}}))),An=cn("offItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item, false)",display:"flex","flex-direction":"row-reverse",position:"absolute",zIndex:"$offItemStyles && 100",overflow:"hidden",top:"0",right:"0"}}}))),Cn=cn("onItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$onColor"}}}))),Tn=cn("offItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$offColor"}}}))),En=()=>U("$slots.onItem",(()=>()=>"$slots.onItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),On=()=>U("$slots.offItem",(()=>()=>"$slots.offItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),Mn={schema:/* #__PURE__ */un(/* #__PURE__ */fn(/* #__PURE__ */hn("$label"),/* #__PURE__ */vn(/* #__PURE__ */xn("prefix"),/* #__PURE__ */mn(),/* #__PURE__ */wn(/* #__PURE__ */_n(/* #__PURE__ */kn(/* #__PURE__ */Sn(/* #__PURE__ */Dn(/* #__PURE__ */Cn(/* #__PURE__ */En())),/* #__PURE__ */An(/* #__PURE__ */Tn(/* #__PURE__ */On())),/* #__PURE__ */Ln()),/* #__PURE__ */In()))),/* #__PURE__ */gn(),/* #__PURE__ */xn("suffix"))),/* #__PURE__ */$n("$help"),/* #__PURE__ */bn(/* #__PURE__ */yn("$message.value"))),type:"input",props:[],features:[function(t){function o(e){setTimeout((()=>{const t=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));for(let e=0;e<t.length;e++){const o=t[e].querySelectorAll(".formkit-onItemWrapper"),n=t[e].querySelectorAll(".formkit-offItemWrapper");for(let n=0;n<o.length;n++)o[n].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`;for(let o=0;o<n.length;o++)n[o].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`}}))}t.addProps(["max","step","stepsPerValue","itemsToPercentages","rightToLeft","onItemStyles","offItemStyles","hoverHighlight","deselect","disabled","wrapperWidth","onColor","offColor"]),!1!==t.props.hoverHighlight&&"false"!==t.props.hoverHighlight&&(t.props.hoverHighlight=!0),t.props.deselect=e.undefine(t.props.deselect),t.props.max=Number(t.props.max)||5,t.props.min=Number(t.props.min)||0,t.props.step=Number(t.props.step)||1,t.props.numberOfSteps=t.props.max/t.props.step,t.props.lastIndex=1/t.props.step-1,t.props.itemsToPercentages={},"disabled"in t.props&&(t.props.disabled=e.undefine(t.props.disabled)),t.props.rightToLeft?(t.props.onItemStyles=void 0,t.props.offItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%",zIndex:100}):t.props.onItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%"},t.props.stepsPerValue=1/t.props.step,t.hook.input(((e,o)=>{if(null===e||""===e||isNaN(e))return o(e);const n=Number(e),r=Number(t.props.min),s=Number(t.props.max);return n>s?o(s):t.props.min&&n<=r?o(r):o(n)})),t.on("commit",(({payload:e})=>{const o=Number(e||0);Go(t,o)})),t.on("created",(()=>{t.context&&(e.whenAvailable(`${t.props.id}_items_wrapper`,(()=>{o(t),function(e){var t;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_items_wrapper`);if(!n)return;new ResizeObserver((()=>{o(e)})).observe(n)}(t),setTimeout((()=>o(t)),100)}),t.props.__root),t.context.fns.getPercentage=(e,t,o=!0)=>(o?e.onItems:e.offItems)[t],t.context.fns.getValue=(e,o)=>e+Number((o*t.props.step+t.props.step).toFixed(1)),t.context.fns.showLabel=(e,o)=>{const n=Number(t.value||0);return 0===n&&0===o||n&&e===n||e>n&&0===o||n>e&&o===t.props.lastIndex},t.context.handlers.handleFocus=e=>nn.call(null,t,e),t.context.handlers.handleWrapperKeydown=e=>on.call(null,t,e),t.context.handlers.handleWrapperBlur=e=>Xo.call(null,t,e),t.context.handlers.handleItemClick=e=>o=>an.call(null,t,e,o),t.context.handlers.handleMousemove=e=>o=>rn.call(null,t,e,o),t.context.handlers.handleMouseleave=()=>sn.call(null,t),t.context.handlers.handleDragstart=e=>o=>tn.call(null,t,e,o),t.context.handlers.handleMouseup=e=>en.call(null,t,e),t.context.handlers.handleTouchstart=e=>o=>Qo.call(null,t,e,o),t.context.handlers.handleTouchmove=e=>Jo.call(null,t,e),t.context.handlers.handleKeydown=e=>o=>function(e,t,o){const n=Number(e.value);e.props.deselect&&" "===o.key&&n===t?e.input(0):" "===o.key&&e.input(t)}(t,e,o))}))},/* #__PURE__ */o.defaultIcon("rating","star")]},Vn=/* #__PURE__ */K("ac"),{outer:Fn,wrapper:Pn,inner:Bn,icon:Hn,label:Rn,prefix:Nn,suffix:Kn,help:Wn,messages:qn,message:Un}=/* #__PURE__ */W(Vn),zn=Vn("input",(()=>({$el:"input",bind:"$attrs",attrs:{id:"$id",type:"text",onClick:"$handlers.click",onBlur:"$handlers.blur",onKeydown:"$handlers.keydown",onInput:"$handlers.input",onFocus:"$handlers.focus",value:"$state.loading !== true && $inputText || undefined",name:"$node.name",placeholder:"$state.loading && $ui.isLoading.value || $placeholder || undefined",tabindex:'$disabled && "-1" || 0',role:"combobox",autocomplete:'$attrs.autocomplete || "off"',autocapitalize:"none",readonly:"$attrs.readonly || $state.loading || $multiple && $max && $value && $value.length >= $max && $hasHighlightedRange !== true || undefined","data-selection-appearance":"$selectionAppearance",disabled:"$disabled || $disabledInternally || undefined",onTouchmovePassive:"$handlers.touchmove",onTouchstartPassive:"$handlers.touchmove",onTouchend:"$handlers.touchend","aria-autocomplete":"list","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy","aria-activedescendant":"$expanded && $activeDescendant || undefined","aria-required":"$state.required || undefined"}}))),Yn=Vn("listboxButton",(()=>({$el:"div",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',role:"button","aria-label":"$expanded && $ui.close.value || $ui.open.value",onClick:"$handlers.toggleListbox",onKeydown:"$handlers.toggleListboxKeydown",tabindex:'$disabled && "-1" || 0',"aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-disabled":"$disabled || $state.loading || undefined","data-disabled":"$disabled || $disabledInternally || undefined"}}))),jn=Vn("selectionWrapper",(()=>({for:["option","index","$selections"],$el:"div",attrs:{id:'$id + "_selection_wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:'$disabled && "-1" || 0',onKeydown:"$handlers.selectionKeydown && $handlers.selectionKeydown($multiple && $option || undefined)",onClick:"$handlers.selectionClick && $handlers.selectionClick($multiple && $option || undefined)",onFocus:"$handlers.selectionFocus && $handlers.selectionFocus($multiple && $option || undefined)",onBlur:"$handlers.selectionBlur && $handlers.selectionBlur($multiple && $option || undefined)","data-is-selection":"true","data-active-selection":"$fns.isActiveSelection && $fns.isActiveSelection($activeSelectionValue, $option)"}}))),Zn=Vn("selection",(()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}}))),Gn=Vn("selections",(()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}}))),Xn=Vn("removeSelection",(()=>({$el:"button",attrs:{id:'$selectionAppearance === "option" && $multiple && $id + "_remove_selection_" + $index || $id + "_remove_selection"',tabindex:"0",title:"$ui.remove.value",type:"button","aria-label":"$ui.remove.value",onClick:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)",onTouchend:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)","aria-controls":"$id"}}))),Jn=Vn("optionLoading","span"),Qn=Vn("option",(()=>({$el:"div",if:"$value !== undefined"}))),er=/* #__PURE__ */z(Vn);function tr(t){"option"!==t.props.selectionAppearance||t.props.multiple||!1===t.props.selectionRemovable||"false"===t.props.selectionRemovable||(t.props.selectionRemovable=!0),t.props.multiple||(t.props.clearSearchOnOpen=e.undefine(t.props.clearSearchOnOpen)),t.props.selectionRemovable=e.undefine(t.props.selectionRemovable),t.props.openOnClick=e.undefine(t.props.openOnClick),"option"!==t.props.selectionAppearance||t.props.multiple||(t.props.isSingleOption=!0),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),void 0===t.props.selectionAppearance&&(t.props.selectionAppearance="text-input"),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),t.props.closeOnSelect?t.props.resetSearchOnCommit=!1:void 0===t.props.resetSearchOnCommit&&(t.props.resetSearchOnCommit=t.props.multiple),t.props.allowNewValues=e.undefine(t.props.allowNewValues)}function or(t){t.addProps(["inputText","selectionAppearance","searchValue","openOnClick","filteredOptions","search","debounce","showInput","visibilityStyles","selectionStyles","multiple","filter","hasHighlightedRange","clearOnClick","debounce"]),void 0===t.props.debounce?t.props.debounce=200:t.props.debounce=parseInt(t.props.debounce),t.props.nonceKey="searchValue",t.props.searchValue="",t.props.inputText="",t.props.filterOptions=De.bind(null,t),t.props.reloadOnCommit=e.undefine(t.props.reloadOnCommit),void 0===t.props.alwaysLoadOnOpen?t.props.alwaysLoadOnOpen=!0:t.props.alwaysLoadOnOpen=e.undefine(t.props.alwaysLoadOnOpen),"function"!=typeof t.props.filter&&(t.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase())),t.on("created",(()=>{t.context&&c&&(t.context.handlers.focus=sr.bind(null,t),t.context.handlers.input=nr.bind(null,t),t.context.handlers.focus=sr.bind(null,t),t.context.handlers.click=rr.bind(null,t),t.context.handlers.toggleListbox=ar.bind(null,t),t.context.handlers.toggleListboxKeydown=lr.bind(null,t),t.context.handlers.keydown=St.bind(null,t),t.context.handlers.selectionKeydown=e=>o=>_t(t,e,o),t.context.handlers.searchInputTagKeydown=e=>o=>function(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":gt(e);break;case"ArrowRight":case"ArrowLeft":$t(e,t,o);break;case"Delete":case"Backspace":bt(e,t,o)}}(t,e,o),t.on("prop:options",(({payload:e})=>{if((0===t.props.initialOptions.length&&"function"!=typeof t.props.optionsLoader||!t.props.searchValue&&e.length)&&(t.props.initialOptions=[...e]),t.props.selections&&t.props.selections.length&&e.length)for(let o=0;o<t.props.selections.length;o++){const n=t.props.selections[o],r=e.find((e=>Se(e)===n.value));r&&(t.props.selections[o]=r)}})))})),t.on("prop:expanded",(({payload:e})=>{e||Le.delete(t)}))}function nr(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&De(e,e.props.searchValue,!0)}function rr(e,t){t.stopPropagation(),e.props.disabled||e.props.disabledInternally||(e.props.attrs.onClick&&e.props.attrs.onClick(t),(!e.props.expanded&&e.props.openOnClick||e.props.openOnFocus)&&(e.props.expanded=!0))}function sr(e){e.props.disabled||e.props.disabledInternally||(e.props.attrs.onFocus&&e.props.attrs.onFocus(),e.props.activeSelectionValue=void 0,e.props.skipOpen?e.props.skipOpen=!1:e.props.openOnFocus&&(e.props.expanded=!0))}function ar(e){var t,o,n;e.props.disabled||e.props.disabledInternally||(null===(t=e.context)||void 0===t?void 0:t.state.loading)||(e.props.expanded=!e.props.expanded,e.props.openOnFocus||null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`))||void 0===n||n.focus())}function lr(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),ar(e))}const ir=new WeakMap,pr="undefined"!=typeof window,dr=new WeakMap;let cr=!1;function ur(t){t.props.searchValue=null,t.on("commit",(()=>{t.props.searchValue=null,t.props.highlightedRange||fr(t)})),t.on("created",(()=>{if(!t.context||!pr)return;t.on("handleSearchInput",(({payload:e})=>{""===e?(t.props.searchValue=null,t.input([])):e&&0===t.props.inputStd.length?t.props.searchValue=e:e&&t.props.inputStd.length>0&&(t.props.searchValue=function(e){var t;const o=hr(e);if(e.props.highlightedRange){const[t,n]=vr(e,o);return e.props.inputText.slice(t,n)}return e.props.inputText.slice((null===(t=o[o.length-1])||void 0===t?void 0:t.end)+2)}(t)),!t.props.expanded&&e?t.props.expanded=!0:!e&&t.props.expanded&&(t.props.expanded=!1)})),function(t){e.whenAvailable(`${t.props.id}`,(e=>{e instanceof HTMLInputElement&&dr.set(e,t)}),t.props.__root),pr&&!cr&&(cr=!0,document.addEventListener("selectionchange",(()=>{const e=ke();if(e instanceof HTMLInputElement&&dr.has(e)){const t=dr.get(e);t&&function(e){clearTimeout(ir.get(e)),ir.set(e,setTimeout((()=>{var t,o,n,r;const s=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(s instanceof HTMLInputElement){const t=hr(e),a=t.findIndex((e=>null!==s.selectionStart?s.selectionStart>=e.start&&s.selectionStart<=e.end:null!==s.selectionEnd&&(s.selectionEnd>=e.start&&s.selectionEnd<=e.end))),l=null===(o=t[t.length-1])||void 0===o?void 0:o.end;if(0===s.selectionStart&&s.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))return;if("string"==typeof e.props.searchValue&&e.props.highlightedRange){if(t.length){const o=e.props.highlightedRange,[n,r]=vr(e,t);if(null!==s.selectionEnd&&(s.selectionEnd<n||s.selectionEnd>r)){const t=o.end-o.start-(r-n),a=s.selectionEnd;e.props.inputText=e.props.option.label,e.props.highlightedRange=void 0,e.props.searchValue=null,s.value=e.props.inputText,s.selectionStart=s.selectionEnd=a+(a>n?t:0)}}}else if(a>=0&&null!==s.selectionStart&&(l!==(null===(r=e.props.inputText)||void 0===r?void 0:r.length)||s.selectionStart<l)){const o=t[a],n=e.props.inputText.substr(0,l),r=o.start+(o.index>0?1:0),i=o.end+(t.length-1>o.index?-1:0);n!==e.props.inputText&&(e.props.inputText=n,s.value=n),e.props.highlightedRange=o,s.selectionStart=r,s.selectionEnd=i}else e.props.highlightedRange=void 0,fr(e);if(null!==s.selectionStart&&s.selectionStart>=l&&", "!==e.props.inputText.substring(l,l+2)){let t=e.props.inputText.substring(0,l);t=e.props.multiple&&e.props.max&&Array.isArray(e.props.inputStd)&&e.props.inputStd.length>=e.props.max?t:`${t},`,e.props.inputText=`${t} ${e.props.inputText.substring(l).replace(/^[,\s]{1,2}/,"")}`}}}),5))}(t)}})))}(t);const n=t.context.handlers.keydown;t.context.handlers.keydown=e=>{n(e),function(e,t){var n,r,s,a;if(["ArrowRight","ArrowLeft"].includes(t.key)&&t.target instanceof HTMLInputElement&&null!==t.target.selectionEnd&&null!==t.target.selectionStart){if(0===t.target.selectionStart&&t.target.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))"ArrowLeft"===t.key?o(0):o(-1);else if(!e.props.searchValue){e.props.searchValue=null;const o=hr(e),n=null===(r=o[o.length-1])||void 0===r?void 0:r.end;t.target.selectionStart<n&&(t.target.selectionStart=Math.max(0,"ArrowLeft"===t.key?t.target.selectionStart-2:t.target.selectionEnd+2))}}else if(["Delete","Backspace"].includes(t.key))e.props.highlightedRange&&!e.props.searchValue?(He(e,e.props.highlightedRange.option),0===e.props.inputStd.length&&(e.props.highlightedRange=void 0)):t.target instanceof HTMLInputElement&&(e.props.searchValue=null,o(-1,!0)&&t.preventDefault());else if(t.target instanceof HTMLInputElement&&0===t.target.selectionStart&&t.target.selectionEnd===(null===(s=e.props.inputText)||void 0===s?void 0:s.length)&&(null===(a=e.props.inputText)||void 0===a?void 0:a.length)&&0===e.props.selections.length)t.preventDefault();else if("Tab"===t.key)return;"ArrowLeft"===t.key&&o(-1,!0)&&t.preventDefault()}(t,e)};const r=t.context.handlers.focus;t.context.handlers.focus=e=>{r(t,e);const o=new Event("selectionchange");document.dispatchEvent(o)},t.on("blur",(()=>{t.props.selections.length?(t.props.inputText=t.props.selections.map((e=>e.label)).join(", "),t.props.searchValue=null):t.props.selections.length||(t.props.inputText="",t.props.searchValue="")}))})),t.on("prop:expanded",(({payload:e})=>{e||t.props.inputStd.length?e&&(t.props.options.length&&!t.props.alwaysLoadOnOpen||(t.props.options=[],De(t,t.props.searchValue))):(t.props.searchValue="",t.props.inputText="")})),t.on("prop:selections",(()=>{var e;const o=[...t.props.selections].map((e=>e.label)).join(", ");let n="";if(pr&&t.isCreated){const o=null===(e=t.props.__root)||void 0===e?void 0:e.getElementById(`${t.props.id}`);if(ke()===o&&Array.isArray(t._value)&&t._value.length){if(t.props.max&&t._value.length>=Number(t.props.max))return;n=", "}}t.props.inputText=`${o}${n}`,t.props.reloadOnCommit&&(t.props.searchValue="",De(t,t.props.searchValue))}));const o=(e,o=!1)=>{var n,r;const s=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(`${t.props.id}`);if(!(s instanceof HTMLInputElement))return!1;const a=hr(t),l=e>=0?e:a.length-1;if(void 0===a[l])return!1;const i=null===(r=a[l])||void 0===r?void 0:r.end;return null!==s.selectionStart&&(!o||s.selectionStart>=i&&s.selectionStart<=i+2)&&(s.selectionStart=a[l].start+(l>0?1:0),s.selectionEnd=a[l].end+(l<a.length-1?-1:0),!0)};let n;t.on("selectRange",(({payload:e})=>o(...e))),t.on("prop:highlightedRange",(({payload:e})=>{t.props.hasHighlightedRange=!!e,e&&t.props.expanded&&n!==e.option&&(n=e.option,Ne(t))}))}function fr(e){var t;if(!pr)return;const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);o&&o.scrollTo({left:o.scrollWidth,behavior:"smooth"})}function vr(e,t){var o;const n=e.props.highlightedRange,r=n.index,s=n.start+(r?1:0),a=t.length-1>r?t[t.length-1].end-t[r+1].start:0;return[s,(null===(o=e.props.inputText)||void 0===o?void 0:o.length)-a+(t.length-1>n.index?-1:0)]}function hr(e){const t=Be(e);return Array.isArray(t)&&t.length?t.reduce(((e,o,n)=>{var r;const s=(null===(r=e[n-1])||void 0===r?void 0:r.end)||0;let a=0;return t.length-1!==n&&a++,0!==n&&a++,e.push({option:o,index:n,start:s,end:s+o.label.length+a}),e}),[]):[]}function mr(e){!function(e){e.on("prop:expanded",(({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0))):(e.props.searchValue="",e.props.inputText="")}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{t&&!e.props.expanded?(e.props.searchExpand=!0,e.props.expanded=!0):!t&&e.props.expanded&&(e.props.expanded=!1),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(()=>{e.isCreated&&(e.props.inputText="",e.props.searchValue="",e.props.optionRemoved||e.props.reloadOnCommit&&De(e,e.props.searchValue,!0))}))}(e)}function gr(e){!function(e){function t(e){0===e.props.inputStd.length?(e.props.inputText="",e.props.searchValue=""):(e.props.inputText=e.props.selections[0].label,e.props.searchValue=e.props.selections[0].label)}function o(e){e.props.clearSearchOnOpen&&!e.props.searchExpand&&(e.props.inputText="",e.props.searchValue=""),e.props.searchValue=e.props.inputText,e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0)),e.props.searchExpand&&(e.props.searchExpand=!1)}e.on("prop:expanded",(({payload:n})=>{n?o(e):t(e)}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{""===t?(0===e.props.inputStd.length&&(e.props.expanded=!1),e.input(void 0)):t&&!e.props.expanded&&(e.props.searchExpand=!0,e.props.expanded=!0),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(({payload:t})=>{e.props.inputText=t.length?t[0].label:"",e.props.searchValue=t.length?t[0].label:"",e.isCreated&&e.props.expanded&&0===t.length&&De(e,e.props.searchValue,!0)}))}(e)}function $r(t){if(t.props.multiple)if(t.props.multiple&&"option"===t.props.selectionAppearance){function o(){return Array.isArray(t.value)?t.value:[]}function r(e){t.input(e)}mr(t),t.on("created",(()=>{t.props.disabled&&(t.props.draggable=!1),e.whenAvailable(`${t.props.id}_selections`,(e=>{if(e instanceof HTMLElement&&t.context){const s={draggingClass:t.context.classes.dragging,dropZoneClass:t.context.classes.dropZone,root:t.props.__root,disabled:!t.props.draggable,plugins:[n.animations()],touchDraggingClass:t.context.classes.touchDragging,touchDropZoneClass:t.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-selection")};n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s}),t.on("prop:disabled",(({payload:t})=>{s.disabled=t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})})),t.on("prop:draggable",(({payload:t})=>{s.disabled=!t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})}))}}),t.props.__root)}))}else t.props.multiple&&"text-input"===t.props.selectionAppearance&&ur(t);else gr(t)}const br={schema:/* #__PURE__ */Fn(/* #__PURE__ */Pn(/* #__PURE__ */Rn("$label"),/* #__PURE__ */Bn(/* #__PURE__ */Hn("prefix"),/* #__PURE__ */Nn(),/* #__PURE__ */zn(),/* #__PURE__ */U("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */U("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U("$selectionRemovable && $isSingleOption",/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */U("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")),/* #__PURE__ */U('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */Yn(/* #__PURE__ */Hn("select")))),/* #__PURE__ */U("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */Yn(/* #__PURE__ */Hn("select"))),/* #__PURE__ */er(),/* #__PURE__ */Kn(),/* #__PURE__ */Hn("suffix")),/* #__PURE__ */U("$multiple && $selectionAppearance === option",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading && $fns.hasOptionLoaderValue($option)",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */Wn("$help"),/* #__PURE__ */qn(/* #__PURE__ */Un("$message.value"))),type:"input",family:"dropdown",props:[],features:[
|
|
19
|
+
/* #__PURE__ */o.defaultIcon("moveDown","arrowDown")]},Zo=new WeakMap;function Go(e,t){const o={onItems:[],offItems:[]},n=t||Number(e.value||0);for(let t=0;t<e.props.max;t++)if(t<n&&t+1>=n){const r=e.props.rightToLeft?100-100*(n-t):100*(n-t);o.onItems.push(r+"%"),o.offItems.push(100-r+"%")}else t<n?(o.offItems.push("0%"),o.onItems.push("100%")):t>=n&&(o.offItems.push("100%"),o.onItems.push("0%"));e.props.itemsToPercentages=o}function Xo(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function Jo(e,t){const{x:o,y:n}=ln(t);let r=document.elementFromPoint(o,n);const s=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));let a=!0;for(;r&&a;){if(s.includes(r)){a=!1;break}r=r.parentNode}if(!a){const t=s.indexOf(r);if(1===e.props.step)return void e.input(t+1,!1)}}function Qo(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?pn(e,t,o):e.input(t+1,!1))}function en(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,Go(e);const o=Zo.get(e);o&&(o.abort(),Zo.delete(e))}function tn(e,t,o){if(e.props.hoverHighlight||e.props.disabled)return;o.preventDefault(),e.props.hoverHighlight=!0,e.props.dragStarted=!0;const n=new AbortController;document.addEventListener("mouseup",(t=>en(e,t)),{signal:n.signal}),Zo.set(e,n),1===e.props.step?e.input(t+1,!1):pn(e,t,o)}function on(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=e.value?dn(e.value+1*e.props.step,e.props.step):e.props.min+1*e.props.step,n=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(e.value?`#${e.props.id}_inner input[value="${t}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,n&&n instanceof HTMLInputElement&&n.focus(),e.props.preventFocus=!1,e.input(Number(t))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=e.value?dn(e.value-1*e.props.step,e.props.step):e.props.max,o=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${t}"]`);e.props.preventFocus=!0,o&&o instanceof HTMLInputElement&&o.focus(),e.props.preventFocus=!0,e.input(Number(t)),e.props.preventFocus=!1}}function nn(e,t){if(!e.props.preventFocus)if(e.props.preventFocus=!0,setTimeout((()=>{e.props.preventFocus=!1}),50),t.relatedTarget instanceof HTMLElement&&t.relatedTarget.id===e.props.id+"_items_wrapper")e.props.arrow>0?setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+"_0_0"))||void 0===o||o.focus()})):e.props.arrow<0&&setTimeout((()=>{var t,o;null===(o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(e.props.id+`_${e.props.max-1}_${e.props.stepsPerValue-1}`))||void 0===o||o.focus()}));else if(t.target instanceof HTMLInputElement){if(Number(t.target.value)===e.props.step&&e.value===e.props.max||Number(t.target.value)===e.props.max&&e.value===e.props.step){const t=document.getElementById(e.props.id+"_items_wrapper");return null==t||t.focus(),void e.input(0)}e.input(Number(t.target.value))}}function rn(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(Go(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):pn(e,t,o,!!e.props.dragStarted)))}function sn(e){Go(e)}function an(e,t,o){if(!e.props.disabled&&"touchstart"!==o.type&&(o.preventDefault(),(0!==o.clientX||0!==o.clientY)&&o.currentTarget instanceof HTMLElement))return 1===e.props.step?e.props.deselect&&Number(e.value)===t+1?void e.input(0):void e.input(t+1):void pn(e,t,o)}function ln(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function pn(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r,y:s}=ln(o),a=o.currentTarget.getBoundingClientRect();let l=dn((r-a.x)/a.width+t,e.props.step);l=l>e.props.min?l:e.props.min,l=l<e.props.max?l:e.props.max,!e.props.deselect||l!==Number(e.value)||e.props.dragStarted?n?e.input(l,!1):Go(e,l):e.input(0)}function dn(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const cn=/* #__PURE__ */K("rt"),{outer:un,wrapper:fn,inner:vn,label:hn,prefix:mn,suffix:gn,help:$n,messages:bn,message:yn,icon:xn}=/* #__PURE__ */W(cn),wn=cn("itemsWrapper",(()=>({$el:"span",attrs:{style:{"flex-direction":'$rightToLeft && "row-reverse" || undefined'},tabindex:"$value !== undefined && $value !== 0 && '-1' || '0'",id:"$id + _items_wrapper",onKeydown:"$handlers.handleWrapperKeydown","data-disabled":"$disabled",onBlur:"$handlers.handleWrapperBlur",onMouseleave:"$hoverHighlight && $handlers.handleMouseleave"}}))),_n=cn("ratingItem",(()=>({for:["item","index","$max"],$el:"span",attrs:{id:'$id + "_item_" + $index',onClick:"$handlers.handleItemClick($item)",draggable:"$hoverHighlight !== true && && $disabled !== true && true",onMousemove:"$handlers.handleMousemove($item)",onDragstart:"$handlers.handleDragstart($item)",onDragend:"$handlers.handleDragend",onTouchstartPassive:"$handlers.handleTouchstart($item)",onTouchmovePassive:"$handlers.handleTouchmove"}}))),kn=cn("template",(()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null}))),Sn=cn("itemLabel",(()=>({$el:"label",attrs:{id:'$id + "_label_" + $index + "_" + $stepIndex',for:'$id + "_" + $index + "_" + $stepIndex',"data-checked":'$value === $fns.getValue($item, $increment) && "true" || "false"',style:{width:'$fns.showLabel($fns.getValue($item, $increment), $stepIndex, $item) && "100%" || "0%"'}}}))),Ln=cn("itemLabelInner",(()=>({$el:"span",children:"$fns.getValue($item, $increment)"}))),In=cn("input",(()=>({$el:"input",attrs:{type:"radio",value:"$fns.getValue($item, $increment)",id:'$id + "_" + $index + "_" + $stepIndex',onFocus:"$handlers.handleFocus",tabindex:'$value === $fns.getValue($item, $increment) && "0" || "-1"',disabled:"$disabled",name:"$id","data-value":"$fns.getValue($item, $increment)",checked:"$value === $fns.getValue($item, $increment) && true",onKeydown:"$handlers.handleKeydown($fns.getValue($item, $increment))"}}))),Dn=cn("onItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}}))),An=cn("offItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item, false)",display:"flex","flex-direction":"row-reverse",position:"absolute",zIndex:"$offItemStyles && 100",overflow:"hidden",top:"0",right:"0"}}}))),Cn=cn("onItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$onColor"}}}))),Tn=cn("offItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$offColor"}}}))),En=()=>U("$slots.onItem",(()=>()=>"$slots.onItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),On=()=>U("$slots.offItem",(()=>()=>"$slots.offItem"),U("$slots.default",(()=>()=>"$slots.default"),xn("rating"))),Mn={schema:/* #__PURE__ */un(/* #__PURE__ */fn(/* #__PURE__ */hn("$label"),/* #__PURE__ */vn(/* #__PURE__ */xn("prefix"),/* #__PURE__ */mn(),/* #__PURE__ */wn(/* #__PURE__ */_n(/* #__PURE__ */kn(/* #__PURE__ */Sn(/* #__PURE__ */Dn(/* #__PURE__ */Cn(/* #__PURE__ */En())),/* #__PURE__ */An(/* #__PURE__ */Tn(/* #__PURE__ */On())),/* #__PURE__ */Ln()),/* #__PURE__ */In()))),/* #__PURE__ */gn(),/* #__PURE__ */xn("suffix"))),/* #__PURE__ */$n("$help"),/* #__PURE__ */bn(/* #__PURE__ */yn("$message.value"))),type:"input",props:[],features:[function(t){function o(e){setTimeout((()=>{const t=Array.from(document.querySelectorAll(`#${e.props.id}_items_wrapper > .formkit-ratingItem`));for(let e=0;e<t.length;e++){const o=t[e].querySelectorAll(".formkit-onItemWrapper"),n=t[e].querySelectorAll(".formkit-offItemWrapper");for(let n=0;n<o.length;n++)o[n].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`;for(let o=0;o<n.length;o++)n[o].style.flex=`0 0 ${t[e].getBoundingClientRect().width}px`}}))}t.addProps(["max","step","stepsPerValue","itemsToPercentages","rightToLeft","onItemStyles","offItemStyles","hoverHighlight","deselect","disabled","wrapperWidth","onColor","offColor"]),!1!==t.props.hoverHighlight&&"false"!==t.props.hoverHighlight&&(t.props.hoverHighlight=!0),t.props.deselect=e.undefine(t.props.deselect),t.props.max=Number(t.props.max)||5,t.props.min=Number(t.props.min)||0,t.props.step=Number(t.props.step)||1,t.props.numberOfSteps=t.props.max/t.props.step,t.props.lastIndex=1/t.props.step-1,t.props.itemsToPercentages={},"disabled"in t.props&&(t.props.disabled=e.undefine(t.props.disabled)),t.props.rightToLeft?(t.props.onItemStyles=void 0,t.props.offItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%",zIndex:100}):t.props.onItemStyles={position:"absolute",top:"0",left:"0",overflow:"hidden",height:"100%"},t.props.stepsPerValue=1/t.props.step,t.hook.input(((e,o)=>{if(null===e||""===e||isNaN(e))return o(e);const n=Number(e),r=Number(t.props.min),s=Number(t.props.max);return n>s?o(s):t.props.min&&n<=r?o(r):o(n)})),t.on("commit",(({payload:e})=>{const o=Number(e||0);Go(t,o)})),t.on("created",(()=>{t.context&&(e.whenAvailable(`${t.props.id}_items_wrapper`,(()=>{o(t),function(e){var t;const n=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}_items_wrapper`);if(!n)return;new ResizeObserver((()=>{o(e)})).observe(n)}(t),setTimeout((()=>o(t)),100)}),t.props.__root),t.context.fns.getPercentage=(e,t,o=!0)=>(o?e.onItems:e.offItems)[t],t.context.fns.getValue=(e,o)=>e+Number((o*t.props.step+t.props.step).toFixed(1)),t.context.fns.showLabel=(e,o)=>{const n=Number(t.value||0);return 0===n&&0===o||n&&e===n||e>n&&0===o||n>e&&o===t.props.lastIndex},t.context.handlers.handleFocus=e=>nn.call(null,t,e),t.context.handlers.handleWrapperKeydown=e=>on.call(null,t,e),t.context.handlers.handleWrapperBlur=e=>Xo.call(null,t,e),t.context.handlers.handleItemClick=e=>o=>an.call(null,t,e,o),t.context.handlers.handleMousemove=e=>o=>rn.call(null,t,e,o),t.context.handlers.handleMouseleave=()=>sn.call(null,t),t.context.handlers.handleDragstart=e=>o=>tn.call(null,t,e,o),t.context.handlers.handleMouseup=e=>en.call(null,t,e),t.context.handlers.handleTouchstart=e=>o=>Qo.call(null,t,e,o),t.context.handlers.handleTouchmove=e=>Jo.call(null,t,e),t.context.handlers.handleKeydown=e=>o=>function(e,t,o){const n=Number(e.value);e.props.deselect&&" "===o.key&&n===t?e.input(0):" "===o.key&&e.input(t)}(t,e,o))}))},/* #__PURE__ */o.defaultIcon("rating","star")]},Vn=/* #__PURE__ */K("ac"),{outer:Fn,wrapper:Pn,inner:Bn,icon:Hn,label:Rn,prefix:Nn,suffix:Kn,help:Wn,messages:qn,message:Un}=/* #__PURE__ */W(Vn),zn=Vn("input",(()=>({$el:"input",bind:"$attrs",attrs:{id:"$id",type:"text",onClick:"$handlers.click",onBlur:"$handlers.blur",onKeydown:"$handlers.keydown",onInput:"$handlers.input",onFocus:"$handlers.focus",value:"$inputText || undefined",name:"$node.name",placeholder:"$state.loading && $ui.isLoading.value || $placeholder || undefined",tabindex:'$disabled && "-1" || 0',role:"combobox",autocomplete:'$attrs.autocomplete || "off"',autocapitalize:"none",readonly:"$attrs.readonly || $state.loading || $multiple && $max && $value && $value.length >= $max && $hasHighlightedRange !== true || undefined","data-selection-appearance":"$selectionAppearance",disabled:"$disabled || $disabledInternally || undefined",onTouchmovePassive:"$handlers.touchmove",onTouchstartPassive:"$handlers.touchmove",onTouchend:"$handlers.touchend","aria-autocomplete":"list","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy","aria-activedescendant":"$expanded && $activeDescendant || undefined","aria-required":"$state.required || undefined"}}))),Yn=Vn("listboxButton",(()=>({$el:"div",attrs:{style:"$visibilityStyles",id:'$id + "_listbox_button"',role:"button","aria-label":"$expanded && $ui.close.value || $ui.open.value",onClick:"$handlers.toggleListbox",onKeydown:"$handlers.toggleListboxKeydown",tabindex:'$disabled && "-1" || 0',"aria-haspopup":"true","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-disabled":"$disabled || $state.loading || undefined","data-disabled":"$disabled || $disabledInternally || undefined"}}))),jn=Vn("selectionWrapper",(()=>({for:["option","index","$selections"],$el:"div",attrs:{id:'$id + "_selection_wrapper_" + $index',key:"$option.value","data-value":"$option.value",tabindex:'$disabled && "-1" || 0',onKeydown:"$handlers.selectionKeydown && $handlers.selectionKeydown($multiple && $option || undefined)",onClick:"$handlers.selectionClick && $handlers.selectionClick($multiple && $option || undefined)",onFocus:"$handlers.selectionFocus && $handlers.selectionFocus($multiple && $option || undefined)",onBlur:"$handlers.selectionBlur && $handlers.selectionBlur($multiple && $option || undefined)","data-is-selection":"true","data-active-selection":"$fns.isActiveSelection && $fns.isActiveSelection($activeSelectionValue, $option)"}}))),Zn=Vn("selection",(()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}}))),Gn=Vn("selections",(()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}}))),Xn=Vn("removeSelection",(()=>({$el:"button",attrs:{id:'$selectionAppearance === "option" && $multiple && $id + "_remove_selection_" + $index || $id + "_remove_selection"',tabindex:"0",title:"$ui.remove.value",type:"button","aria-label":"$ui.remove.value",onClick:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)",onTouchend:"$handlers.removeSelection && $handlers.removeSelection($multiple && $option || undefined)","aria-controls":"$id"}}))),Jn=Vn("optionLoading","span"),Qn=Vn("option",(()=>({$el:"div",if:"$value !== undefined"}))),er=/* #__PURE__ */z(Vn);function tr(t){"option"!==t.props.selectionAppearance||t.props.multiple||!1===t.props.selectionRemovable||"false"===t.props.selectionRemovable||(t.props.selectionRemovable=!0),t.props.multiple||(t.props.clearSearchOnOpen=e.undefine(t.props.clearSearchOnOpen)),t.props.selectionRemovable=e.undefine(t.props.selectionRemovable),t.props.openOnClick=e.undefine(t.props.openOnClick),"option"!==t.props.selectionAppearance||t.props.multiple||(t.props.isSingleOption=!0),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),void 0===t.props.selectionAppearance&&(t.props.selectionAppearance="text-input"),void 0===t.props.closeOnSelect&&(t.props.closeOnSelect=!0),t.props.closeOnSelect?t.props.resetSearchOnCommit=!1:void 0===t.props.resetSearchOnCommit&&(t.props.resetSearchOnCommit=t.props.multiple),t.props.allowNewValues=e.undefine(t.props.allowNewValues)}function or(t){t.addProps(["inputText","selectionAppearance","searchValue","openOnClick","filteredOptions","search","debounce","showInput","visibilityStyles","selectionStyles","multiple","filter","hasHighlightedRange","clearOnClick","debounce"]),void 0===t.props.debounce?t.props.debounce=200:t.props.debounce=parseInt(t.props.debounce),t.props.nonceKey="searchValue",t.props.searchValue="",t.props.inputText="",t.props.filterOptions=De.bind(null,t),t.props.reloadOnCommit=e.undefine(t.props.reloadOnCommit),void 0===t.props.alwaysLoadOnOpen?t.props.alwaysLoadOnOpen=!0:t.props.alwaysLoadOnOpen=e.undefine(t.props.alwaysLoadOnOpen),"function"!=typeof t.props.filter&&(t.props.filter=(e,t)=>e.label.toLowerCase().includes(t.toLowerCase())),t.on("created",(()=>{t.context&&c&&(t.context.handlers.focus=sr.bind(null,t),t.context.handlers.input=nr.bind(null,t),t.context.handlers.focus=sr.bind(null,t),t.context.handlers.click=rr.bind(null,t),t.context.handlers.toggleListbox=ar.bind(null,t),t.context.handlers.toggleListboxKeydown=lr.bind(null,t),t.context.handlers.keydown=St.bind(null,t),t.context.handlers.selectionKeydown=e=>o=>_t(t,e,o),t.context.handlers.searchInputTagKeydown=e=>o=>function(e,t,o){if(o.stopPropagation(),e.props.disabled)return;switch(o.key){case"ArrowDown":gt(e);break;case"ArrowRight":case"ArrowLeft":$t(e,t,o);break;case"Delete":case"Backspace":bt(e,t,o)}}(t,e,o),t.on("prop:options",(({payload:e})=>{if((0===t.props.initialOptions.length&&"function"!=typeof t.props.optionsLoader||!t.props.searchValue&&e.length)&&(t.props.initialOptions=[...e]),t.props.selections&&t.props.selections.length&&e.length)for(let o=0;o<t.props.selections.length;o++){const n=t.props.selections[o],r=e.find((e=>Se(e)===n.value));r&&(t.props.selections[o]=r)}})))})),t.on("prop:expanded",(({payload:e})=>{e||Le.delete(t)}))}function nr(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&De(e,e.props.searchValue,!0)}function rr(e,t){t.stopPropagation(),e.props.disabled||e.props.disabledInternally||(e.props.attrs.onClick&&e.props.attrs.onClick(t),(!e.props.expanded&&e.props.openOnClick||e.props.openOnFocus)&&(e.props.expanded=!0))}function sr(e){e.props.disabled||e.props.disabledInternally||(e.props.attrs.onFocus&&e.props.attrs.onFocus(),e.props.activeSelectionValue=void 0,e.props.skipOpen?e.props.skipOpen=!1:e.props.openOnFocus&&(e.props.expanded=!0))}function ar(e){var t,o,n;e.props.disabled||e.props.disabledInternally||(null===(t=e.context)||void 0===t?void 0:t.state.loading)||(e.props.expanded=!e.props.expanded,e.props.openOnFocus||null===(n=null===(o=e.props.__root)||void 0===o?void 0:o.getElementById(`${e.props.id}`))||void 0===n||n.focus())}function lr(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),ar(e))}const ir=new WeakMap,pr="undefined"!=typeof window,dr=new WeakMap;let cr=!1;function ur(t){t.props.searchValue=null,t.on("commit",(()=>{t.props.searchValue=null,t.props.highlightedRange||fr(t)})),t.on("created",(()=>{if(!t.context||!pr)return;t.on("handleSearchInput",(({payload:e})=>{""===e?(t.props.searchValue=null,t.input([])):e&&0===t.props.inputStd.length?t.props.searchValue=e:e&&t.props.inputStd.length>0&&(t.props.searchValue=function(e){var t;const o=hr(e);if(e.props.highlightedRange){const[t,n]=vr(e,o);return e.props.inputText.slice(t,n)}return e.props.inputText.slice((null===(t=o[o.length-1])||void 0===t?void 0:t.end)+2)}(t)),!t.props.expanded&&e?t.props.expanded=!0:!e&&t.props.expanded&&(t.props.expanded=!1)})),function(t){e.whenAvailable(`${t.props.id}`,(e=>{e instanceof HTMLInputElement&&dr.set(e,t)}),t.props.__root),pr&&!cr&&(cr=!0,document.addEventListener("selectionchange",(()=>{const e=ke();if(e instanceof HTMLInputElement&&dr.has(e)){const t=dr.get(e);t&&function(e){clearTimeout(ir.get(e)),ir.set(e,setTimeout((()=>{var t,o,n,r;const s=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(s instanceof HTMLInputElement){const t=hr(e),a=t.findIndex((e=>null!==s.selectionStart?s.selectionStart>=e.start&&s.selectionStart<=e.end:null!==s.selectionEnd&&(s.selectionEnd>=e.start&&s.selectionEnd<=e.end))),l=null===(o=t[t.length-1])||void 0===o?void 0:o.end;if(0===s.selectionStart&&s.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))return;if("string"==typeof e.props.searchValue&&e.props.highlightedRange){if(t.length){const o=e.props.highlightedRange,[n,r]=vr(e,t);if(null!==s.selectionEnd&&(s.selectionEnd<n||s.selectionEnd>r)){const t=o.end-o.start-(r-n),a=s.selectionEnd;e.props.inputText=e.props.option.label,e.props.highlightedRange=void 0,e.props.searchValue=null,s.value=e.props.inputText,s.selectionStart=s.selectionEnd=a+(a>n?t:0)}}}else if(a>=0&&null!==s.selectionStart&&(l!==(null===(r=e.props.inputText)||void 0===r?void 0:r.length)||s.selectionStart<l)){const o=t[a],n=e.props.inputText.substr(0,l),r=o.start+(o.index>0?1:0),i=o.end+(t.length-1>o.index?-1:0);n!==e.props.inputText&&(e.props.inputText=n,s.value=n),e.props.highlightedRange=o,s.selectionStart=r,s.selectionEnd=i}else e.props.highlightedRange=void 0,fr(e);if(null!==s.selectionStart&&s.selectionStart>=l&&", "!==e.props.inputText.substring(l,l+2)){let t=e.props.inputText.substring(0,l);t=e.props.multiple&&e.props.max&&Array.isArray(e.props.inputStd)&&e.props.inputStd.length>=e.props.max?t:`${t},`,e.props.inputText=`${t} ${e.props.inputText.substring(l).replace(/^[,\s]{1,2}/,"")}`}}}),5))}(t)}})))}(t);const n=t.context.handlers.keydown;t.context.handlers.keydown=e=>{n(e),function(e,t){var n,r,s,a;if(["ArrowRight","ArrowLeft"].includes(t.key)&&t.target instanceof HTMLInputElement&&null!==t.target.selectionEnd&&null!==t.target.selectionStart){if(0===t.target.selectionStart&&t.target.selectionEnd===(null===(n=e.props.inputText)||void 0===n?void 0:n.length))"ArrowLeft"===t.key?o(0):o(-1);else if(!e.props.searchValue){e.props.searchValue=null;const o=hr(e),n=null===(r=o[o.length-1])||void 0===r?void 0:r.end;t.target.selectionStart<n&&(t.target.selectionStart=Math.max(0,"ArrowLeft"===t.key?t.target.selectionStart-2:t.target.selectionEnd+2))}}else if(["Delete","Backspace"].includes(t.key))e.props.highlightedRange&&!e.props.searchValue?(He(e,e.props.highlightedRange.option),0===e.props.inputStd.length&&(e.props.highlightedRange=void 0)):t.target instanceof HTMLInputElement&&(e.props.searchValue=null,o(-1,!0)&&t.preventDefault());else if(t.target instanceof HTMLInputElement&&0===t.target.selectionStart&&t.target.selectionEnd===(null===(s=e.props.inputText)||void 0===s?void 0:s.length)&&(null===(a=e.props.inputText)||void 0===a?void 0:a.length)&&0===e.props.selections.length)t.preventDefault();else if("Tab"===t.key)return;"ArrowLeft"===t.key&&o(-1,!0)&&t.preventDefault()}(t,e)};const r=t.context.handlers.focus;t.context.handlers.focus=e=>{r(t,e);const o=new Event("selectionchange");document.dispatchEvent(o)},t.on("blur",(()=>{t.props.selections.length?(t.props.inputText=t.props.selections.map((e=>e.label)).join(", "),t.props.searchValue=null):t.props.selections.length||(t.props.inputText="",t.props.searchValue="")}))})),t.on("prop:expanded",(({payload:e})=>{e||t.props.inputStd.length?e&&(t.props.options.length&&!t.props.alwaysLoadOnOpen||(t.props.options=[],De(t,t.props.searchValue))):(t.props.searchValue="",t.props.inputText="")})),t.on("prop:selections",(()=>{var e;const o=[...t.props.selections].map((e=>e.label)).join(", ");let n="";if(pr&&t.isCreated){const o=null===(e=t.props.__root)||void 0===e?void 0:e.getElementById(`${t.props.id}`);if(ke()===o&&Array.isArray(t._value)&&t._value.length){if(t.props.max&&t._value.length>=Number(t.props.max))return;n=", "}}t.props.inputText=`${o}${n}`,t.props.reloadOnCommit&&(t.props.searchValue="",De(t,t.props.searchValue))}));const o=(e,o=!1)=>{var n,r;const s=null===(n=t.props.__root)||void 0===n?void 0:n.getElementById(`${t.props.id}`);if(!(s instanceof HTMLInputElement))return!1;const a=hr(t),l=e>=0?e:a.length-1;if(void 0===a[l])return!1;const i=null===(r=a[l])||void 0===r?void 0:r.end;return null!==s.selectionStart&&(!o||s.selectionStart>=i&&s.selectionStart<=i+2)&&(s.selectionStart=a[l].start+(l>0?1:0),s.selectionEnd=a[l].end+(l<a.length-1?-1:0),!0)};let n;t.on("selectRange",(({payload:e})=>o(...e))),t.on("prop:highlightedRange",(({payload:e})=>{t.props.hasHighlightedRange=!!e,e&&t.props.expanded&&n!==e.option&&(n=e.option,Ne(t))}))}function fr(e){var t;if(!pr)return;const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);o&&o.scrollTo({left:o.scrollWidth,behavior:"smooth"})}function vr(e,t){var o;const n=e.props.highlightedRange,r=n.index,s=n.start+(r?1:0),a=t.length-1>r?t[t.length-1].end-t[r+1].start:0;return[s,(null===(o=e.props.inputText)||void 0===o?void 0:o.length)-a+(t.length-1>n.index?-1:0)]}function hr(e){const t=Be(e);return Array.isArray(t)&&t.length?t.reduce(((e,o,n)=>{var r;const s=(null===(r=e[n-1])||void 0===r?void 0:r.end)||0;let a=0;return t.length-1!==n&&a++,0!==n&&a++,e.push({option:o,index:n,start:s,end:s+o.label.length+a}),e}),[]):[]}function mr(e){!function(e){e.on("prop:expanded",(({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0))):(e.props.searchValue="",e.props.inputText="")}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{t&&!e.props.expanded?(e.props.searchExpand=!0,e.props.expanded=!0):!t&&e.props.expanded&&(e.props.expanded=!1),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(()=>{e.isCreated&&(e.props.inputText="",e.props.searchValue="",e.props.optionRemoved||e.props.reloadOnCommit&&De(e,e.props.searchValue,!0))}))}(e)}function gr(e){!function(e){function t(e){0===e.props.inputStd.length?(e.props.inputText="",e.props.searchValue=""):(e.props.inputText=e.props.selections[0].label,e.props.searchValue=e.props.selections[0].label)}function o(e){e.props.clearSearchOnOpen&&!e.props.searchExpand&&(e.props.inputText="",e.props.searchValue=""),e.props.searchValue=e.props.inputText,e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],De(e,e.props.searchValue,!0)),e.props.searchExpand&&(e.props.searchExpand=!1)}e.on("prop:expanded",(({payload:n})=>{n?o(e):t(e)}))}(e),function(e){e.on("handleSearchInput",(({payload:t})=>{""===t?(0===e.props.inputStd.length&&(e.props.expanded=!1),e.input(void 0)):t&&!e.props.expanded&&(e.props.searchExpand=!0,e.props.expanded=!0),e.props.searchValue=e.props.inputText}))}(e),function(e){e.on("prop:selections",(({payload:t})=>{e.props.inputText=t.length?t[0].label:"",e.props.searchValue=t.length?t[0].label:"",e.isCreated&&e.props.expanded&&0===t.length&&De(e,e.props.searchValue,!0)}))}(e)}function $r(t){if(t.props.multiple)if(t.props.multiple&&"option"===t.props.selectionAppearance){function o(){return Array.isArray(t.value)?t.value:[]}function r(e){t.input(e)}mr(t),t.on("created",(()=>{t.props.disabled&&(t.props.draggable=!1),e.whenAvailable(`${t.props.id}_selections`,(e=>{if(e instanceof HTMLElement&&t.context){const s={draggingClass:t.context.classes.dragging,dropZoneClass:t.context.classes.dropZone,root:t.props.__root,disabled:!t.props.draggable,plugins:[n.animations()],touchDraggingClass:t.context.classes.touchDragging,touchDropZoneClass:t.context.classes.touchDropZone,draggable:e=>e.hasAttribute("data-is-selection")};n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s}),t.on("prop:disabled",(({payload:t})=>{s.disabled=t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})})),t.on("prop:draggable",(({payload:t})=>{s.disabled=!t,n.dragAndDrop({parent:e,getValues:o,setValues:r,config:s})}))}}),t.props.__root)}))}else t.props.multiple&&"text-input"===t.props.selectionAppearance&&ur(t);else gr(t)}const br={schema:/* #__PURE__ */Fn(/* #__PURE__ */Pn(/* #__PURE__ */Rn("$label"),/* #__PURE__ */Bn(/* #__PURE__ */Hn("prefix"),/* #__PURE__ */Nn(),/* #__PURE__ */zn(),/* #__PURE__ */U("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */U("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U("$selectionRemovable && $isSingleOption",/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */U("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */Hn("loader")),/* #__PURE__ */U('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")),/* #__PURE__ */U('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */Yn(/* #__PURE__ */Hn("select")))),/* #__PURE__ */U("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */Yn(/* #__PURE__ */Hn("select"))),/* #__PURE__ */er(),/* #__PURE__ */Kn(),/* #__PURE__ */Hn("suffix")),/* #__PURE__ */U("$multiple && $selectionAppearance === option",/* #__PURE__ */Gn(/* #__PURE__ */jn(/* #__PURE__ */Zn(/* #__PURE__ */Qn(/* #__PURE__ */U("$state.loading && $fns.hasOptionLoaderValue($option)",/* #__PURE__ */Jn("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Xn(/* #__PURE__ */Hn("close")))))),/* #__PURE__ */Wn("$help"),/* #__PURE__ */qn(/* #__PURE__ */Un("$message.value"))),type:"input",family:"dropdown",props:[],features:[
|
|
20
20
|
/* #__PURE__ */o.defaultIcon("select","select"),
|
|
21
21
|
/* #__PURE__ */o.defaultIcon("close","close"),
|
|
22
22
|
/* #__PURE__ */o.defaultIcon("selected","check"),
|
package/index.mjs
CHANGED
|
@@ -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")]},Kn=new WeakMap;function Wn(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 Un(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function Yn(e,t){const{x:o,y:n}=er(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 jn(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?tr(e,t,o):e.input(t+1,!1))}function qn(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,Wn(e);const o=Kn.get(e);o&&(o.abort(),Kn.delete(e))}function zn(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=>qn(e,t)),{signal:n.signal}),Kn.set(e,n),1===e.props.step?e.input(t+1,!1):tr(e,t,o)}function Zn(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=e.value?or(e.value+1*e.props.step,e.props.step):e.props.min+1*e.props.step,n=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(e.value?`#${e.props.id}_inner input[value="${t}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,n&&n instanceof HTMLInputElement&&n.focus(),e.props.preventFocus=!1,e.input(Number(t))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=e.value?or(e.value-1*e.props.step,e.props.step):e.props.max,o=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${t}"]`);e.props.preventFocus=!0,o&&o instanceof HTMLInputElement&&o.focus(),e.props.preventFocus=!0,e.input(Number(t)),e.props.preventFocus=!1}}function Gn(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 Xn(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(Wn(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):tr(e,t,o,!!e.props.dragStarted)))}function Jn(e){Wn(e)}function Qn(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 tr(e,t,o)}function er(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function tr(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r,y:s}=er(o),a=o.currentTarget.getBoundingClientRect();let l=or((r-a.x)/a.width+t,e.props.step);l=l>e.props.min?l:e.props.min,l=l<e.props.max?l:e.props.max,!e.props.deselect||l!==Number(e.value)||e.props.dragStarted?n?e.input(l,!1):Wn(e,l):e.input(0)}function or(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const nr=/* #__PURE__ */Me("rt"),{outer:rr,wrapper:sr,inner:ar,label:lr,prefix:ir,suffix:pr,help:dr,messages:cr,message:ur,icon:fr}=/* #__PURE__ */Ve(nr),vr=nr("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"}}))),hr=nr("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"}}))),mr=nr("template",(()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null}))),gr=nr("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%"'}}}))),$r=nr("itemLabelInner",(()=>({$el:"span",children:"$fns.getValue($item, $increment)"}))),br=nr("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))"}}))),yr=nr("onItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}}))),xr=nr("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"}}}))),wr=nr("onItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$onColor"}}}))),_r=nr("offItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$offColor"}}}))),kr=()=>Be("$slots.onItem",(()=>()=>"$slots.onItem"),Be("$slots.default",(()=>()=>"$slots.default"),fr("rating"))),Sr=()=>Be("$slots.offItem",(()=>()=>"$slots.offItem"),Be("$slots.default",(()=>()=>"$slots.default"),fr("rating"))),Lr={schema:/* #__PURE__ */rr(/* #__PURE__ */sr(/* #__PURE__ */lr("$label"),/* #__PURE__ */ar(/* #__PURE__ */fr("prefix"),/* #__PURE__ */ir(),/* #__PURE__ */vr(/* #__PURE__ */hr(/* #__PURE__ */mr(/* #__PURE__ */gr(/* #__PURE__ */yr(/* #__PURE__ */wr(/* #__PURE__ */kr())),/* #__PURE__ */xr(/* #__PURE__ */_r(/* #__PURE__ */Sr())),/* #__PURE__ */$r()),/* #__PURE__ */br()))),/* #__PURE__ */pr(),/* #__PURE__ */fr("suffix"))),/* #__PURE__ */dr("$help"),/* #__PURE__ */cr(/* #__PURE__ */ur("$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);Wn(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=>Gn.call(null,e,t),e.context.handlers.handleWrapperKeydown=t=>Zn.call(null,e,t),e.context.handlers.handleWrapperBlur=t=>Un.call(null,e,t),e.context.handlers.handleItemClick=t=>o=>Qn.call(null,e,t,o),e.context.handlers.handleMousemove=t=>o=>Xn.call(null,e,t,o),e.context.handlers.handleMouseleave=()=>Jn.call(null,e),e.context.handlers.handleDragstart=t=>o=>zn.call(null,e,t,o),e.context.handlers.handleMouseup=t=>qn.call(null,e,t),e.context.handlers.handleTouchstart=t=>o=>jn.call(null,e,t,o),e.context.handlers.handleTouchmove=t=>Yn.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")]},Ir=/* #__PURE__ */Me("ac"),{outer:Dr,wrapper:Ar,inner:Cr,icon:Tr,label:Er,prefix:Or,suffix:Mr,help:Vr,messages:Fr,message:Br}=/* #__PURE__ */Ve(Ir),Pr=Ir("input",(()=>({$el:"input",bind:"$attrs",attrs:{id:"$id",type:"text",onClick:"$handlers.click",onBlur:"$handlers.blur",onKeydown:"$handlers.keydown",onInput:"$handlers.input",onFocus:"$handlers.focus",value:"$state.loading !== true && $inputText || undefined",name:"$node.name",placeholder:"$state.loading && $ui.isLoading.value || $placeholder || undefined",tabindex:'$disabled && "-1" || 0',role:"combobox",autocomplete:'$attrs.autocomplete || "off"',autocapitalize:"none",readonly:"$attrs.readonly || $state.loading || $multiple && $max && $value && $value.length >= $max && $hasHighlightedRange !== true || undefined","data-selection-appearance":"$selectionAppearance",disabled:"$disabled || $disabledInternally || undefined",onTouchmovePassive:"$handlers.touchmove",onTouchstartPassive:"$handlers.touchmove",onTouchend:"$handlers.touchend","aria-autocomplete":"list","aria-expanded":"$expanded","aria-controls":'$expanded && $id + "_listbox" || undefined',"aria-describedBy":"$describedBy","aria-activedescendant":"$expanded && $activeDescendant || undefined","aria-required":"$state.required || undefined"}}))),Hr=Ir("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"}}))),Rr=Ir("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)"}}))),Nr=Ir("selection",(()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}}))),Kr=Ir("selections",(()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}}))),Wr=Ir("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"}}))),Ur=Ir("optionLoading","span"),Yr=Ir("option",(()=>({$el:"div",if:"$value !== undefined"}))),jr=/* #__PURE__ */Pe(Ir);function qr(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 zr(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=yt.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&&ne&&(e.context.handlers.focus=Xr.bind(null,e),e.context.handlers.input=Zr.bind(null,e),e.context.handlers.focus=Xr.bind(null,e),e.context.handlers.click=Gr.bind(null,e),e.context.handlers.toggleListbox=Jr.bind(null,e),e.context.handlers.toggleListboxKeydown=Qr.bind(null,e),e.context.handlers.keydown=$o.bind(null,e),e.context.handlers.selectionKeydown=t=>o=>mo(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":po(e);break;case"ArrowRight":case"ArrowLeft":co(e,t,o);break;case"Delete":case"Backspace":uo(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=>gt(e)===n.value));r&&(e.props.selections[o]=r)}})))})),e.on("prop:expanded",(({payload:t})=>{t||$t.delete(e)}))}function Zr(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&yt(e,e.props.searchValue,!0)}function Gr(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 Xr(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 Jr(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 Qr(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),Jr(e))}const es=new WeakMap,ts="undefined"!=typeof window,os=new WeakMap;let ns=!1;function rs(e){e.props.searchValue=null,e.on("commit",(()=>{e.props.searchValue=null,e.props.highlightedRange||ss(e)})),e.on("created",(()=>{if(!e.context||!ts)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=ls(e);if(e.props.highlightedRange){const[t,n]=as(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&&os.set(t,e)}),e.props.__root),ts&&!ns&&(ns=!0,document.addEventListener("selectionchange",(()=>{const e=mt();if(e instanceof HTMLInputElement&&os.has(e)){const t=os.get(e);t&&function(e){clearTimeout(es.get(e)),es.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=ls(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]=as(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,ss(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=ls(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?(Tt(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=[],yt(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(ts&&e.isCreated){const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(mt()===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="",yt(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=ls(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,Ot(e))}))}function ss(e){var t;if(!ts)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 as(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 ls(e){const t=Ct(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 is(e){!function(e){e.on("prop:expanded",(({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],yt(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&&yt(e,e.props.searchValue,!0))}))}(e)}function ps(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=[],yt(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&&yt(e,e.props.searchValue,!0)}))}(e)}function ds(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)}is(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()],touchDraggingClass:e.context.classes.touchDragging,touchDropZoneClass: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&&rs(e);else ps(e)}const cs={schema:/* #__PURE__ */Dr(/* #__PURE__ */Ar(/* #__PURE__ */Er("$label"),/* #__PURE__ */Cr(/* #__PURE__ */Tr("prefix"),/* #__PURE__ */Or(),/* #__PURE__ */Pr(),/* #__PURE__ */Be("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */Kr(/* #__PURE__ */Rr(/* #__PURE__ */Nr(/* #__PURE__ */Yr(/* #__PURE__ */Be("$state.loading",/* #__PURE__ */Ur("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Be("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */Tr("loader")),/* #__PURE__ */Be("$selectionRemovable && $isSingleOption",/* #__PURE__ */Wr(/* #__PURE__ */Tr("close")))))),/* #__PURE__ */Be("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */Tr("loader")),/* #__PURE__ */Be('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */Wr(/* #__PURE__ */Tr("close")),/* #__PURE__ */Be('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */Hr(/* #__PURE__ */Tr("select")))),/* #__PURE__ */Be("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */Hr(/* #__PURE__ */Tr("select"))),/* #__PURE__ */jr(),/* #__PURE__ */Mr(),/* #__PURE__ */Tr("suffix")),/* #__PURE__ */Be("$multiple && $selectionAppearance === option",/* #__PURE__ */Kr(/* #__PURE__ */Rr(/* #__PURE__ */Nr(/* #__PURE__ */Yr(/* #__PURE__ */Be("$state.loading && $fns.hasOptionLoaderValue($option)",/* #__PURE__ */Ur("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Wr(/* #__PURE__ */Tr("close")))))),/* #__PURE__ */Vr("$help"),/* #__PURE__ */Fr(/* #__PURE__ */Br("$message.value"))),type:"input",family:"dropdown",props:[],features:[
|
|
19
|
+
/* #__PURE__ */g("moveDown","arrowDown")]},Kn=new WeakMap;function Wn(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 Un(e,t){var o;null===(o=e.context)||void 0===o||o.handlers.blur(t)}function Yn(e,t){const{x:o,y:n}=er(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 jn(e,t,o){e.props.disabled||(o.preventDefault(),e.props.hoverHighlight=!0,e.props.touchStarted=!0,1!==e.props.step?tr(e,t,o):e.input(t+1,!1))}function qn(e,t){if(!e.props.dragStarted)return;t.preventDefault(),e.props.hoverHighlight=!1,e.props.dragStarted=!1,Wn(e);const o=Kn.get(e);o&&(o.abort(),Kn.delete(e))}function zn(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=>qn(e,t)),{signal:n.signal}),Kn.set(e,n),1===e.props.step?e.input(t+1,!1):tr(e,t,o)}function Zn(e,t){var o,n;if(document.activeElement===t.currentTarget)if("ArrowRight"===t.key||"ArrowDown"===t.key){e.props.arrow=1;const t=e.value?or(e.value+1*e.props.step,e.props.step):e.props.min+1*e.props.step,n=null===(o=e.props.__root)||void 0===o?void 0:o.querySelector(e.value?`#${e.props.id}_inner input[value="${t}"]`:"#"+(e.props.id+"_0_0"));e.props.preventFocus=!0,n&&n instanceof HTMLInputElement&&n.focus(),e.props.preventFocus=!1,e.input(Number(t))}else if("ArrowLeft"===t.key||"ArrowUp"===t.key){e.props.arrow=-1;const t=e.value?or(e.value-1*e.props.step,e.props.step):e.props.max,o=null===(n=e.props.__root)||void 0===n?void 0:n.querySelector(`#${e.props.id}_inner input[value="${t}"]`);e.props.preventFocus=!0,o&&o instanceof HTMLInputElement&&o.focus(),e.props.preventFocus=!0,e.input(Number(t)),e.props.preventFocus=!1}}function Gn(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 Xn(e,t,o){e.props.hoverHighlight&&(e.props.disabled||(1===e.props.step?(Wn(e,t+1),e.props.dragStarted&&e.input(t+1,!1)):tr(e,t,o,!!e.props.dragStarted)))}function Jn(e){Wn(e)}function Qn(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 tr(e,t,o)}function er(e){return e instanceof MouseEvent?{x:e.clientX,y:e.clientY}:{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}}function tr(e,t,o,n=!0){if(!(o.currentTarget instanceof HTMLElement))return;const{x:r,y:s}=er(o),a=o.currentTarget.getBoundingClientRect();let l=or((r-a.x)/a.width+t,e.props.step);l=l>e.props.min?l:e.props.min,l=l<e.props.max?l:e.props.max,!e.props.deselect||l!==Number(e.value)||e.props.dragStarted?n?e.input(l,!1):Wn(e,l):e.input(0)}function or(e,t){t||(t=1);const o=1/t;return Math.ceil(e*o)/o}const nr=/* #__PURE__ */Me("rt"),{outer:rr,wrapper:sr,inner:ar,label:lr,prefix:ir,suffix:pr,help:dr,messages:cr,message:ur,icon:fr}=/* #__PURE__ */Ve(nr),vr=nr("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"}}))),hr=nr("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"}}))),mr=nr("template",(()=>({for:["increment","stepIndex","$stepsPerValue"],$el:null}))),gr=nr("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%"'}}}))),$r=nr("itemLabelInner",(()=>({$el:"span",children:"$fns.getValue($item, $increment)"}))),br=nr("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))"}}))),yr=nr("onItemRow",(()=>({$el:"span",attrs:{style:{width:"$fns.getPercentage($itemsToPercentages, $item)",display:"flex",position:"relative",overflow:"hidden",top:"0",left:"0",bottom:"0"}}}))),xr=nr("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"}}}))),wr=nr("onItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$onColor"}}}))),_r=nr("offItemWrapper",(()=>({$el:"div",attrs:{style:{color:"$offColor"}}}))),kr=()=>Be("$slots.onItem",(()=>()=>"$slots.onItem"),Be("$slots.default",(()=>()=>"$slots.default"),fr("rating"))),Sr=()=>Be("$slots.offItem",(()=>()=>"$slots.offItem"),Be("$slots.default",(()=>()=>"$slots.default"),fr("rating"))),Lr={schema:/* #__PURE__ */rr(/* #__PURE__ */sr(/* #__PURE__ */lr("$label"),/* #__PURE__ */ar(/* #__PURE__ */fr("prefix"),/* #__PURE__ */ir(),/* #__PURE__ */vr(/* #__PURE__ */hr(/* #__PURE__ */mr(/* #__PURE__ */gr(/* #__PURE__ */yr(/* #__PURE__ */wr(/* #__PURE__ */kr())),/* #__PURE__ */xr(/* #__PURE__ */_r(/* #__PURE__ */Sr())),/* #__PURE__ */$r()),/* #__PURE__ */br()))),/* #__PURE__ */pr(),/* #__PURE__ */fr("suffix"))),/* #__PURE__ */dr("$help"),/* #__PURE__ */cr(/* #__PURE__ */ur("$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);Wn(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=>Gn.call(null,e,t),e.context.handlers.handleWrapperKeydown=t=>Zn.call(null,e,t),e.context.handlers.handleWrapperBlur=t=>Un.call(null,e,t),e.context.handlers.handleItemClick=t=>o=>Qn.call(null,e,t,o),e.context.handlers.handleMousemove=t=>o=>Xn.call(null,e,t,o),e.context.handlers.handleMouseleave=()=>Jn.call(null,e),e.context.handlers.handleDragstart=t=>o=>zn.call(null,e,t,o),e.context.handlers.handleMouseup=t=>qn.call(null,e,t),e.context.handlers.handleTouchstart=t=>o=>jn.call(null,e,t,o),e.context.handlers.handleTouchmove=t=>Yn.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")]},Ir=/* #__PURE__ */Me("ac"),{outer:Dr,wrapper:Ar,inner:Cr,icon:Tr,label:Er,prefix:Or,suffix:Mr,help:Vr,messages:Fr,message:Br}=/* #__PURE__ */Ve(Ir),Pr=Ir("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"}}))),Hr=Ir("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"}}))),Rr=Ir("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)"}}))),Nr=Ir("selection",(()=>({$el:"div",attrs:{id:'$id + "_selection_" + $index'}}))),Kr=Ir("selections",(()=>({$el:"div",attrs:{"aria-live":"polite",id:'$id + "_selections"'}}))),Wr=Ir("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"}}))),Ur=Ir("optionLoading","span"),Yr=Ir("option",(()=>({$el:"div",if:"$value !== undefined"}))),jr=/* #__PURE__ */Pe(Ir);function qr(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 zr(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=yt.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&&ne&&(e.context.handlers.focus=Xr.bind(null,e),e.context.handlers.input=Zr.bind(null,e),e.context.handlers.focus=Xr.bind(null,e),e.context.handlers.click=Gr.bind(null,e),e.context.handlers.toggleListbox=Jr.bind(null,e),e.context.handlers.toggleListboxKeydown=Qr.bind(null,e),e.context.handlers.keydown=$o.bind(null,e),e.context.handlers.selectionKeydown=t=>o=>mo(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":po(e);break;case"ArrowRight":case"ArrowLeft":co(e,t,o);break;case"Delete":case"Backspace":uo(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=>gt(e)===n.value));r&&(e.props.selections[o]=r)}})))})),e.on("prop:expanded",(({payload:t})=>{t||$t.delete(e)}))}function Zr(e,t){if(e.props.disabled)return;const o=t.target;e.props.inputText=o.value,e.emit("handleSearchInput",o.value),e.props.searchValue&&yt(e,e.props.searchValue,!0)}function Gr(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 Xr(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 Jr(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 Qr(e,t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),Jr(e))}const es=new WeakMap,ts="undefined"!=typeof window,os=new WeakMap;let ns=!1;function rs(e){e.props.searchValue=null,e.on("commit",(()=>{e.props.searchValue=null,e.props.highlightedRange||ss(e)})),e.on("created",(()=>{if(!e.context||!ts)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=ls(e);if(e.props.highlightedRange){const[t,n]=as(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&&os.set(t,e)}),e.props.__root),ts&&!ns&&(ns=!0,document.addEventListener("selectionchange",(()=>{const e=mt();if(e instanceof HTMLInputElement&&os.has(e)){const t=os.get(e);t&&function(e){clearTimeout(es.get(e)),es.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=ls(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]=as(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,ss(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=ls(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?(Tt(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=[],yt(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(ts&&e.isCreated){const o=null===(t=e.props.__root)||void 0===t?void 0:t.getElementById(`${e.props.id}`);if(mt()===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="",yt(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=ls(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,Ot(e))}))}function ss(e){var t;if(!ts)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 as(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 ls(e){const t=Ct(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 is(e){!function(e){e.on("prop:expanded",(({payload:t})=>{t?(e.props.searchValue="",e.props.options.length&&!e.props.alwaysLoadOnOpen||(e.props.options=[],yt(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&&yt(e,e.props.searchValue,!0))}))}(e)}function ps(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=[],yt(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&&yt(e,e.props.searchValue,!0)}))}(e)}function ds(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)}is(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()],touchDraggingClass:e.context.classes.touchDragging,touchDropZoneClass: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&&rs(e);else ps(e)}const cs={schema:/* #__PURE__ */Dr(/* #__PURE__ */Ar(/* #__PURE__ */Er("$label"),/* #__PURE__ */Cr(/* #__PURE__ */Tr("prefix"),/* #__PURE__ */Or(),/* #__PURE__ */Pr(),/* #__PURE__ */Be("$multiple !== true && $selectionAppearance === option && $expanded === false",/* #__PURE__ */Kr(/* #__PURE__ */Rr(/* #__PURE__ */Nr(/* #__PURE__ */Yr(/* #__PURE__ */Be("$state.loading",/* #__PURE__ */Ur("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Be("$state.loading && $isSingleOption !== true && $optionLoaderValues.includes($option.value)",/* #__PURE__ */Tr("loader")),/* #__PURE__ */Be("$selectionRemovable && $isSingleOption",/* #__PURE__ */Wr(/* #__PURE__ */Tr("close")))))),/* #__PURE__ */Be("$state.loading && ($isSingleOption !== true || $selections.length === 0)",/* #__PURE__ */Tr("loader")),/* #__PURE__ */Be('$selectionRemovable && $selectionAppearance === "text-input" && $selections.length > 0',/* #__PURE__ */Wr(/* #__PURE__ */Tr("close")),/* #__PURE__ */Be('$selectionAppearance === "text-input" || ($selectionAppearance === "option" && $multiple)',/* #__PURE__ */Hr(/* #__PURE__ */Tr("select")))),/* #__PURE__ */Be("$isSingleOption && ($inputStd.length === 0 || $selectionRemovable === undefined || ($expanded) || $state.loading || $optionLoaderValues.length > 0)",/* #__PURE__ */Hr(/* #__PURE__ */Tr("select"))),/* #__PURE__ */jr(),/* #__PURE__ */Mr(),/* #__PURE__ */Tr("suffix")),/* #__PURE__ */Be("$multiple && $selectionAppearance === option",/* #__PURE__ */Kr(/* #__PURE__ */Rr(/* #__PURE__ */Nr(/* #__PURE__ */Yr(/* #__PURE__ */Be("$state.loading && $fns.hasOptionLoaderValue($option)",/* #__PURE__ */Ur("$ui.isLoading.value"),"$option.label"))),/* #__PURE__ */Wr(/* #__PURE__ */Tr("close")))))),/* #__PURE__ */Vr("$help"),/* #__PURE__ */Fr(/* #__PURE__ */Br("$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"),
|