@featherk/composables 0.13.4 → 0.13.6

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.
@@ -1,2 +1,2 @@
1
- (function(G,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(G=typeof globalThis<"u"?globalThis:G||self,t(G.FeatherKComposables={},G.Vue,G.useFocusTrap))})(this,(function(G,t,Le){"use strict";const Ne=(e,n)=>{const o=t.ref(null);let d=!1,a=null,f=null;const w=[],S=".k-table-row[data-grid-row-index] [tabindex]",$=()=>{const c=e?.value?.$el;return c?c.closest(".k-grid"):null},L=c=>{const T=$();if(!T)return!1;const g=c.closest(".k-grid-aria-root");if(g)return T.contains(g);const k=c.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return k?T.contains(k):!1},x=c=>c.key==="Enter"||c.code==="Enter"||c.code==="NumpadEnter",R=()=>e?.value?.columns,E=c=>{const T=c.key||c.code;([" ","Spacebar","Space"].includes(T)||x(c))&&(c.preventDefault(),c.stopPropagation(),o.value=c.target,c.target.click())},A=c=>{if(!o.value)return;if(c.code==="Escape"){c.stopPropagation(),o.value&&o.value.focus();return}const T=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),g=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(g){if(c.code==="Tab"){const k=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],I=n?.focusableMenuSelectors??k,D=Array.from(g.querySelectorAll(I.join(",")));if(D.length===0)return;const P=D.findIndex(W=>W===document.activeElement);let z;P===-1?z=0:c.shiftKey?z=(P-1+D.length)%D.length:z=(P+1)%D.length,c.preventDefault(),c.stopPropagation(),D[z]?.focus()}}else if(c.code==="ArrowUp"||c.code==="ArrowDown"){c.preventDefault(),c.stopPropagation();const k=T.findIndex(D=>D===document.activeElement);let I=k;c.code==="ArrowUp"?I=k>0?k-1:T.length-1:c.code==="ArrowDown"&&(I=k<T.length-1?k+1:0),T[I]?.focus();return}if(c.code==="Tab"){c.preventDefault(),c.stopPropagation();const k=o.value?.parentElement;(c.shiftKey?k?.previousElementSibling:k?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},V=()=>{a=new MutationObserver(c=>{c.forEach(T=>{T.addedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const k=g;if(k.classList.contains("k-animation-container")){const D=o.value;D&&(D.dataset.featherKSortable==="true"||t.nextTick(()=>{k.querySelectorAll(".k-columnmenu-item-wrapper").forEach(W=>{W.textContent?.toLowerCase().includes("sort")&&W.remove()})})),k.addEventListener("keydown",A),t.nextTick(()=>{const P=()=>{const z=Array.from(k.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(z.length===1)z[0].focus(),z[0].click(),P.attempts=0;else if(z.length>1){P.attempts=0;return}else P.attempts===void 0&&(P.attempts=0),P.attempts++<3&&setTimeout(P,200)};P()})}k.querySelectorAll(".k-animation-container").forEach(D=>{D.addEventListener("keydown",A)})}}),T.removedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const k=g;k.classList.contains("k-animation-container")&&k.removeEventListener("keydown",A),k.querySelectorAll(".k-animation-container").forEach(D=>{D.removeEventListener("keydown",A)})}})})}),a.observe(document.body,{childList:!0,subtree:!0})},m=c=>{const T=c.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(T)||c.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},s=c=>{if(!c.type||!c)return;const T=c.target;if(!T)return;const g=T.closest(".k-table-row[data-grid-row-index]");if(!L(T))return;const k=["ArrowLeft","ArrowRight"].includes(c.code);if(!(m(T)&&!(g&&k))){if(c.code==="Escape"){const I=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(I){c.preventDefault(),c.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(P=>P.setAttribute("tabindex","-1"))}catch{}I.setAttribute("tabindex","0"),I.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(c.code)){if(T.classList.contains("k-grid-header-menu")&&T.classList.contains("k-grid-column-menu")){o.value=T;return}if(g){if(["ArrowDown","ArrowUp"].includes(c.code)){c.preventDefault(),c.stopPropagation();const I=(P,z)=>{let W=z==="next"?P.nextElementSibling:P.previousElementSibling;for(;W;){const ee=W;try{if(ee.classList.contains("k-table-row"))return ee}catch{}W=z==="next"?W.nextElementSibling:W.previousElementSibling}return null},D=c.code==="ArrowDown"?I(g,"next"):I(g,"previous");D&&(g.setAttribute("tabindex","-1"),D.setAttribute("tabindex","0"),D.focus());return}if(["ArrowLeft","ArrowRight"].includes(c.code)){c.preventDefault(),c.stopPropagation();const I=g.querySelectorAll(S);if(I.length===0)return;let D=Array.from(I).findIndex(P=>P===document.activeElement);if(D===-1&&document.activeElement===g){I[0].focus();return}c.code==="ArrowRight"?D=D===I.length-1?0:D+1:c.code==="ArrowLeft"&&(D=D===0?I.length-1:D-1),I[D].focus();return}}}}},h=()=>{t.nextTick(()=>{const c=e.value?.$el;if(!c||typeof c.closest!="function")return;const T=c.closest(".k-grid");T&&T.classList.add("fk-grid")})},M=()=>{if(!f)try{const c=()=>{try{const k=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!k||k.length===0||k.filter(P=>P.getAttribute("tabindex")==="0").length===1)return;const D=k.find(P=>P===document.activeElement||P.contains(document.activeElement));if(k.forEach(P=>P.setAttribute("tabindex","-1")),D){D.setAttribute("tabindex","0");return}k[0].setAttribute("tabindex","0")}catch(k){console.error("ensureSingleTabindex error:",k)}},T=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));T.length>0&&T.forEach((k,I)=>{k.setAttribute("tabindex",I===0?"0":"-1")});const g=e.value.$el.querySelector(".k-table-tbody");g&&(f=new MutationObserver(()=>{c()}),f.observe(g,{childList:!0,subtree:!0}))}catch(c){console.error("Error setting up row navigation:",c)}},N=()=>{t.nextTick(()=>{const T=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");T&&T.forEach(g=>{g.setAttribute("role","button"),g.addEventListener("keydown",E)}),V(),H()})},Y=()=>{const T=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");T&&T.forEach(g=>{g.removeEventListener("keydown",E)}),a&&(a.disconnect(),a=null),f&&(f.disconnect(),f=null),w.forEach(g=>g()),w.length=0},H=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((g,k)=>{if(g.dataset.featherKHeaderBound==="true")return;const I=g.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!I)return;const D=R();if(D&&D[k]){const l=D[k].field??"";g.setAttribute("data-feather-k-field",l),g.setAttribute("data-feather-k-filterable",D[k].filterable===!1?"false":"true"),g.setAttribute("data-feather-k-sortable",D[k].sortable===!1?"false":"true")}const P=g.dataset.featherKFilterable!=="false",z=g.dataset.featherKSortable!=="false";I.setAttribute("tabindex","-1"),P||z?g.style.cursor="pointer":g.style.cursor="default",P?(g.setAttribute("tabindex","0"),g.setAttribute("role","button"),g.setAttribute("aria-haspopup","menu")):(g.setAttribute("tabindex","0"),g.setAttribute("role","columnheader"),g.removeAttribute("aria-haspopup"));const W=l=>{l.target?.closest(".k-column-resizer")||(o.value=g,I.click())},ee=l=>{if(P)o.value=g,l.preventDefault(),l.stopPropagation(),W(l);else if(z){o.value=g;const b=g.querySelector(".k-link");b&&b.click()}};g.addEventListener("click",ee),w.push(()=>{g.removeEventListener("click",ee)});const ae=l=>{if((x(l)||l.code==="Space")&&(P||z)){if(l.preventDefault(),l.stopPropagation(),o.value=g,o.value.focus(),P)W(l);else if(z){const b=g.querySelector(".k-link");b&&b.click()}}};g.addEventListener("keydown",ae,!0),w.push(()=>{g.removeEventListener("keydown",ae,!0)}),g.dataset.featherKHeaderBound="true"});const T=document.querySelector(".k-grid-header .k-table-thead");if(T&&T.dataset.featherKHeaderBound!=="true"){const g=k=>{const I=k.target.closest("th");I&&(x(k)||k.code==="Space")&&I.dataset.featherKFilterable==="false"&&I.dataset.featherKSortable==="false"&&(k.preventDefault(),k.stopImmediatePropagation())};T.addEventListener("keydown",g,!0),w.push(()=>{T.removeEventListener("keydown",g,!0)}),T.dataset.featherKHeaderBound="true"}},Z=function(c,T){const g=c?.event?.event.target,k=R();if(!g||!k)return;const I=g.classList.contains("k-grid-header-menu"),D=g.classList.contains("k-columnmenu-item"),P=k.find(z=>z.field===c?.event?.field)?.sortable&&!0;if(!I){if(D&&!P){c?.event?.sort?.filter(W=>W.field!==c?.event?.field);return}typeof T=="function"&&t.nextTick(()=>{o.value&&o.value.focus(),T(c),t.nextTick(()=>{H()})})}},j=()=>{if(!d)try{h(),M(),N(),d=!0}catch(c){console.error("initA11y failed:",c),Y()}};return t.onBeforeUnmount(()=>{Y()}),{activeFilterButton:o,handleGridKeyDown:s,handleSortChange:Z,initA11y:j}},qe=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ke=e=>!!e&&typeof e=="object"&&"field"in e,Ee=(e,n)=>!e||typeof e!="object"?!1:qe(e)?e.filters.some(o=>Ee(o,n)):Ke(e)?e.field===n:!1,Ue=e=>n=>e.value?.filters&&e.value.filters.some(o=>Ee(o,n))?"active":"",ze=["button","a","input","select","textarea",'[role="button"]','[role="checkbox"]','[role="link"]','[role="menuitem"]','[role="option"]',".k-checkbox",".k-button",".k-dropdown",".k-picker",".k-hierarchy-cell",".k-grid-header-menu",".k-column-menu"],Be=e=>{const{onRowAction:n,gridRef:o,dataItems:d,ignoreSelectors:a=[],shouldIgnoreTarget:f,enableKeyboardAction:w=!0}=e,S=[...ze,...a],$=(m,s)=>{if(!m)return!1;const h=S.join(",");return m.closest&&m.closest(h)?!0:f&&s?f(m,s):!1},L=m=>{const h=m?.closest?.(".k-table-row[data-grid-row-index]")?.getAttribute("data-grid-row-index");if(h==null)return;const M=parseInt(h,10);return Number.isNaN(M)?void 0:M},x=m=>{if(!m||typeof m.clientX!="number")return;const s=typeof window<"u"&&window.scrollX||0,h=typeof window<"u"&&window.scrollY||0,M=typeof window<"u"&&window.screenX||0,N=typeof window<"u"&&window.screenY||0;return{clientX:m.clientX,clientY:m.clientY,pageX:typeof m.pageX=="number"?m.pageX:m.clientX+s,pageY:typeof m.pageY=="number"?m.pageY:m.clientY+h,screenX:typeof m.screenX=="number"?m.screenX:m.clientX+M,screenY:typeof m.screenY=="number"?m.screenY:m.clientY+N}},R=m=>{if(!m||typeof m.getBoundingClientRect!="function")return;const s=m.getBoundingClientRect();if(!s)return;const h=s.left,M=s.bottom,N=typeof window<"u"&&window.scrollX||0,Y=typeof window<"u"&&window.scrollY||0;return{clientX:h,clientY:M,pageX:h+N,pageY:M+Y,screenX:h,screenY:M}},E=m=>{if(typeof window>"u")return!1;const s=window.getSelection();if(!s||s.isCollapsed||!s.toString().trim())return!1;if(m&&s.anchorNode&&s.focusNode){const h=m.closest(".k-table-row")||m.closest(".k-grid")||m,M=s.anchorNode.nodeType===Node.ELEMENT_NODE?s.anchorNode:s.anchorNode.parentElement,N=s.focusNode.nodeType===Node.ELEMENT_NODE?s.focusNode:s.focusNode.parentElement,Y=!!(M&&h.contains(M)),H=!!(N&&h.contains(N));return Y||H}return!0};return{handleRowClick:m=>{const s=m?.htmlEvent||m?.event||m?.nativeEvent||(m instanceof Event?m:void 0);if(s&&s.button!==void 0&&s.button!==0)return;const h=s?.target||m?.target;if(h&&$(h,s||m)||E(h))return;const M={dataItem:m.dataItem,rowIndex:m.rowIndex??L(h),field:m.field,event:s||m,triggerType:"click",ctrlKey:!!s?.ctrlKey,shiftKey:!!s?.shiftKey,metaKey:!!s?.metaKey,altKey:!!s?.altKey,coordinates:x(s)??R(h)};n(m.dataItem,M)},handleRowKeyDown:(m,s)=>{if(!w)return;const h=m.key||m.code;if(!(h==="Enter"||h==="NumpadEnter"||h===" "||h==="Space"||m.code==="Enter"||m.code==="NumpadEnter"||m.code==="Space"))return;const N=m.target;if(!N)return;const Y=N.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!Y||$(N,m))return;m.preventDefault(),m.stopPropagation();const H=Y.getAttribute("data-grid-row-index"),Z=H!==null?parseInt(H,10):void 0;let j=s;if(j===void 0){const T=(Array.isArray(d)?d:d?.value)||o?.value?.props?.dataItems||o?.value?.dataItems;T&&Z!==void 0&&Z>=0&&Z<T.length&&(j=T[Z])}if(j===void 0)return;const c={dataItem:j,rowIndex:Z,event:m,triggerType:"keyboard",ctrlKey:!!m.ctrlKey,shiftKey:!!m.shiftKey,metaKey:!!m.metaKey,altKey:!!m.altKey,coordinates:R(Y)};n(j,c)},isIgnoredTarget:$}},Ye="Enter a valid ZIP code with exactly 5 or 9 digits.",Te=e=>{const n=e.replace(/\D/g,"").slice(0,9);return n.length>5?`${n.slice(0,5)}-${n.slice(5)}`:n},He=(e,n)=>e.slice(0,Math.max(0,n)).replace(/\D/g,"").length,Xe=e=>e<=5?e:Math.min(e+1,10),xe=e=>{const n=t.ref(Te(e.initialValue??"")),o=t.ref(!1),d=t.ref(e.errorMessage?.trim()||Ye),a=t.computed(()=>n.value.replace(/\D/g,"")),f=t.computed(()=>{const A=a.value.length;return A===5||A===9}),w=t.computed(()=>o.value&&!f.value),S=t.computed(()=>!o.value||f.value),$=t.computed(()=>o.value),L=(A,V)=>{const m=Xe(V);t.nextTick(()=>{A.isConnected&&A.setSelectionRange(m,m)})};return{zipDisplay:n,submitted:o,errorMessage:d,wrapperClass:"fk-zip-textbox",zipRaw:a,isZipValid:f,showZipError:w,textBoxValid:S,textBoxValidate:$,handleZipInput:(...A)=>{const V=A[0],s=V?.event?.target,h=V?.value,M=Array.isArray(h)?h.join(""):String(h??""),N=s?.selectionStart!==void 0&&s.selectionStart!==null?He(s.value,s.selectionStart):M.replace(/\D/g,"").length;n.value=Te(M),s&&L(s,N)},submitAndValidate:A=>{o.value=!0;const V=f.value;return!V&&A?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),V},buildPayload:()=>({zip:a.value})}};function Me(e,n){const o=t.ref(!1);t.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!n.isValid()))});function d(f){const w=e.value??f.currentTarget,S=f.relatedTarget;(!w||!w.contains(S))&&(o.value=!0)}function a(){o.value=!1}return{touched:o,onFocusout:d,reset:a}}function Ie(e,n){const o=t.ref(!1),d=t.ref(!1),a=t.computed(()=>t.toValue(n.submitted)||o.value),f=t.computed(()=>!a.value||n.isValid()),w=Me(e,{isValid:()=>f.value});function S(E){return t.computed(()=>!a.value||t.toValue(E))}function $(E){return Object.fromEntries(Object.entries(E).map(([A,V])=>[A,S(V)]))}function L(E){const A=t.toValue(E);if(!A)return;A.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function x(E){if(d.value){d.value=!1;return}w.onFocusout(E),w.touched.value&&(o.value=!0)}function R(){o.value=!1,d.value=!0,w.reset()}return{touched:o,fieldsetValidate:a,onFocusout:x,reset:R,createFieldValidity:S,createFieldValidationsMap:$,focusFirstInvalidField:L}}const Ze=[{label:"Alabama",value:"AL"},{label:"Alaska",value:"AK"},{label:"Arizona",value:"AZ"},{label:"Arkansas",value:"AR"},{label:"California",value:"CA"},{label:"Colorado",value:"CO"},{label:"Connecticut",value:"CT"},{label:"Delaware",value:"DE"},{label:"Florida",value:"FL"},{label:"Georgia",value:"GA"},{label:"Hawaii",value:"HI"},{label:"Idaho",value:"ID"},{label:"Illinois",value:"IL"},{label:"Indiana",value:"IN"},{label:"Iowa",value:"IA"},{label:"Kansas",value:"KS"},{label:"Kentucky",value:"KY"},{label:"Louisiana",value:"LA"},{label:"Maine",value:"ME"},{label:"Maryland",value:"MD"},{label:"Massachusetts",value:"MA"},{label:"Michigan",value:"MI"},{label:"Minnesota",value:"MN"},{label:"Mississippi",value:"MS"},{label:"Missouri",value:"MO"},{label:"Montana",value:"MT"},{label:"Nebraska",value:"NE"},{label:"Nevada",value:"NV"},{label:"New Hampshire",value:"NH"},{label:"New Jersey",value:"NJ"},{label:"New Mexico",value:"NM"},{label:"New York",value:"NY"},{label:"North Carolina",value:"NC"},{label:"North Dakota",value:"ND"},{label:"Ohio",value:"OH"},{label:"Oklahoma",value:"OK"},{label:"Oregon",value:"OR"},{label:"Pennsylvania",value:"PA"},{label:"Rhode Island",value:"RI"},{label:"South Carolina",value:"SC"},{label:"South Dakota",value:"SD"},{label:"Tennessee",value:"TN"},{label:"Texas",value:"TX"},{label:"Utah",value:"UT"},{label:"Vermont",value:"VT"},{label:"Virginia",value:"VA"},{label:"Washington",value:"WA"},{label:"West Virginia",value:"WV"},{label:"Wisconsin",value:"WI"},{label:"Wyoming",value:"WY"}];function ye(e){if(e&&typeof e=="object"&&"value"in e){const n=e.value;return typeof n=="string"?n:String(n??"")}return""}function We(){const e=t.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...w)=>{e.address1=ye(w[0])},onAddress2Input:(...w)=>{e.address2=ye(w[0])},onCityInput:(...w)=>{e.city=ye(w[0])},onStateChange:w=>{e.state=w.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function _e(e,n="zip"){const o=xe({id:n}),{zipDisplay:d,zipRaw:a,isZipValid:f,wrapperClass:w,handleZipInput:S}=o;return t.watch(a,L=>{e.zip=L}),{zipDisplay:d,isZipValid:f,zipWrapperClass:w,onZipInput:S,resetZip:()=>{d.value="",e.zip=""}}}function Ge(e){const n=t.computed(()=>e.formData.address1.trim()!==""),o=t.computed(()=>e.formData.city.trim()!==""),d=t.computed(()=>!!e.formData.state),a=t.computed(()=>t.toValue(e.isZipValid)),f=t.computed(()=>n.value&&o.value&&d.value&&a.value);return{strictAddress1Valid:n,strictCityValid:o,strictStateValid:d,strictZipValid:a,strictAddressValid:f}}function je(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Je(e,n){const o=e??n.currentTarget,d=n.relatedTarget;return!o||!o.contains(d)}function Qe(e){const n=t.ref(t.toValue(e.fieldsetRef));t.watchEffect(()=>{n.value=t.toValue(e.fieldsetRef)});const o=t.ref(!1),d=t.ref(!1),a=t.computed(()=>t.toValue(e.required)??!0),{formData:f,onAddress1Input:w,onAddress2Input:S,onCityInput:$,onStateChange:L,resetFormData:x}=We(),R=`${e.addressId}-zip`,{zipDisplay:E,isZipValid:A,zipWrapperClass:V,onZipInput:m,resetZip:s}=_e(f,R),{strictAddress1Valid:h,strictCityValid:M,strictStateValid:N,strictZipValid:Y,strictAddressValid:H}=Ge({formData:f,isZipValid:A}),Z=Ie(n,{submitted:o,isValid:()=>H.value}),{touched:j,fieldsetValidate:c,onFocusout:T,reset:g}=Z,k=Z.createFieldValidationsMap({address1:h,city:M,state:N,zip:Y,address:H}),{address1:I,city:D,state:P,zip:z,address:W}=k,ee=t.computed(()=>a.value?c.value:!1),ae=t.computed(()=>a.value?I.value:!0),l=t.computed(()=>a.value?D.value:!0),b=t.computed(()=>a.value?P.value:!0),q=t.computed(()=>a.value?z.value:!0),p=t.computed(()=>a.value?W.value:!0),y={value:null,label:"State"},O=Ze.map(({label:v,value:F})=>({label:v,value:F})),r=t.computed(()=>({address1:f.address1.trim(),address2:f.address2.trim(),city:f.city.trim(),state:(f.state??"").trim().toUpperCase(),zip:f.zip.replace(/\D/g,"")})),u=t.computed(()=>f.address1.trim()===""&&f.address2.trim()===""&&f.city.trim()===""&&(f.state??"").trim()===""&&f.zip.replace(/\D/g,"")===""),C=t.computed(()=>!u.value),K=t.computed(()=>!a.value&&C.value&&(!h.value||!M.value||!N.value)),U=t.computed(()=>{const v=f.zip.replace(/\D/g,"");return!a.value&&C.value&&v.length!==5&&v.length!==9}),J=t.computed(()=>!a.value&&C.value&&!H.value),X=t.computed(()=>!a.value&&J.value&&(d.value||o.value));return t.watch(r,()=>{a.value||(d.value=!1)}),t.watch(a,v=>{v||(o.value=!1,d.value=!1,g())}),{formData:f,submitted:o,touched:j,addressValidate:ee,address1Valid:ae,cityValid:l,stateValid:b,zipValid:q,addressValid:p,optionalFeedbackActive:X,optionalPartialInvalid:J,optionalMissingRequiredFields:K,optionalZipInvalid:U,stateDefaultItem:y,stateOptions:O,zipDisplay:E,zipWrapperClass:V,onAddress1Input:w,onAddress2Input:S,onCityInput:$,onStateChange:L,onZipInput:m,onFieldsetFocusout:v=>{const F=Je(n.value,v);T(v),!a.value&&F&&(d.value=!0)},normalizedPayload:r,validateForSubmit:async()=>a.value?(o.value=!0,H.value?{isValid:!0,payload:r.value}:(await t.nextTick(),je(n.value),{isValid:!1,payload:null})):u.value||H.value?(o.value=!1,{isValid:!0,payload:r.value}):(o.value=!0,{isValid:!1,payload:null}),reset:()=>{o.value=!1,d.value=!1,g(),x(),s()}}}const Ce=e=>e==="left"?"right":e==="right"?"left":"center",Re=e=>e==="top"?"bottom":e==="bottom"?"top":"center",be=(e,n,o,d)=>{const a=e.left+(o.horizontal==="right"?e.width:o.horizontal==="center"?e.width/2:0),f=e.top+(o.vertical==="bottom"?e.height:o.vertical==="center"?e.height/2:0),w=n?d.horizontal==="right"?n.width:d.horizontal==="center"?n.width/2:0:0,S=n?d.vertical==="bottom"?n.height:d.vertical==="center"?n.height/2:0:0;return{left:a-w,top:f-S}},Fe=(e,n,o,d)=>n>=d-o?o:Math.min(Math.max(e,o),d-n),Pe=({anchor:e,popup:n,anchorAlign:o,popupAlign:d,bounds:a,collision:f})=>{const w=be(e,n,o,d);if(!n)return w;let{left:S,top:$}=w;if(f.horizontal==="fit")S=Fe(S,n.width,a.left,a.right);else{const L=S+n.width-a.right,x=a.left-S;if(L>0||x>0){const R=be(e,n,{horizontal:Ce(o.horizontal),vertical:o.vertical},{horizontal:Ce(d.horizontal),vertical:d.vertical}),E=Math.max(L,0)+Math.max(x,0);Math.max(R.left+n.width-a.right,0)+Math.max(a.left-R.left,0)<E&&(S=R.left)}}if(f.vertical==="fit")$=Fe($,n.height,a.top,a.bottom);else{const L=$+n.height-a.bottom,x=a.top-$;if(L>0||x>0){const R=be(e,n,{horizontal:o.horizontal,vertical:Re(o.vertical)},{horizontal:d.horizontal,vertical:Re(d.vertical)}),E=Math.max(L,0)+Math.max(x,0);Math.max(R.top+n.height-a.bottom,0)+Math.max(a.top-R.top,0)<E&&($=R.top)}}return{left:S,top:$}},et=(e="fkid")=>{const n=`${e}-${t.useId()}`;return{instanceId:n,compose:(...d)=>[n,...d].filter(a=>a!=null).map(String).join("-")}},tt=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const nt=Object.prototype.toString,rt=e=>nt.call(e)==="[object Object]",he=()=>{};function we(e){return Array.isArray(e)?e:[e]}function ot(e,n,o){return t.watch(e,n,{...o,immediate:!0})}const $e=tt?window:void 0;function me(e){var n;const o=t.toValue(e);return(n=o?.$el)!==null&&n!==void 0?n:o}function Se(...e){const n=(d,a,f,w)=>(d.addEventListener(a,f,w),()=>d.removeEventListener(a,f,w)),o=t.computed(()=>{const d=we(t.toValue(e[0])).filter(a=>a!=null);return d.every(a=>typeof a!="string")?d:void 0});return ot(()=>{var d,a;return[(d=(a=o.value)===null||a===void 0?void 0:a.map(f=>me(f)))!==null&&d!==void 0?d:[$e].filter(f=>f!=null),we(t.toValue(o.value?e[1]:e[0])),we(t.unref(o.value?e[2]:e[1])),t.toValue(o.value?e[3]:e[2])]},([d,a,f,w],S,$)=>{if(!d?.length||!a?.length||!f?.length)return;const L=rt(w)?{...w}:w,x=d.flatMap(R=>a.flatMap(E=>f.map(A=>n(R,E,A,L))));$(()=>{x.forEach(R=>R())})},{flush:"post"})}function Ve(e,n,o={}){const{window:d=$e,ignore:a=[],capture:f=!0,detectIframe:w=!1,controls:S=!1}=o;if(!d)return S?{stop:he,cancel:he,trigger:he}:he;let $=!0;const L=s=>t.toValue(a).some(h=>{if(typeof h=="string")return Array.from(d.document.querySelectorAll(h)).some(M=>M===s.target||s.composedPath().includes(M));{const M=me(h);return M&&(s.target===M||s.composedPath().includes(M))}});function x(s){const h=t.toValue(s);return h&&h.$.subTree.shapeFlag===16}function R(s,h){const M=t.toValue(s),N=M.$.subTree&&M.$.subTree.children;return N==null||!Array.isArray(N)?!1:N.some(Y=>Y.el===h.target||h.composedPath().includes(Y.el))}const E=s=>{const h=me(e);if(s.target!=null&&!(!(h instanceof Element)&&x(e)&&R(e,s))&&!(!h||h===s.target||s.composedPath().includes(h))){if("detail"in s&&s.detail===0&&($=!L(s)),!$){$=!0;return}n(s)}};let A=!1;const V=[Se(d,"click",s=>{A||(A=!0,setTimeout(()=>{A=!1},0),E(s))},{passive:!0,capture:f}),Se(d,"pointerdown",s=>{const h=me(e);$=!L(s)&&!!(h&&!s.composedPath().includes(h))},{passive:!0}),w&&Se(d,"blur",s=>{setTimeout(()=>{const h=me(e);let M=d.document.activeElement;for(;M?.shadowRoot;)M=M.shadowRoot.activeElement;M?.tagName==="IFRAME"&&!h?.contains(d.document.activeElement)&&n(s)},0)},{passive:!0})].filter(Boolean),m=()=>V.forEach(s=>s());return S?{stop:m,cancel:()=>{$=!1},trigger:s=>{$=!0,E(s),$=!1}}:m}const Oe=e=>{let n=null;const o=()=>{n?.disconnect(),n=null};return typeof window<"u"&&typeof window.IntersectionObserver=="function"&&t.watch([e.target,()=>e.root()],([a,f])=>{o(),a&&(n=new IntersectionObserver(([w])=>{w&&e.onChange(w)},{root:f,threshold:e.threshold??1}),n.observe(a))},{immediate:!0}),t.onUnmounted(o),{disconnect:o}},at=".k-table-row",ue=e=>{if(e instanceof HTMLElement)return e;const n=e?.$el;return n instanceof HTMLElement?n:null},lt=(e,n)=>n==="row"?e.matches("tr.k-table-row"):!e.matches("tr.k-table-row"),it=(e,n)=>{console.warn(`usePopupMenu: triggerMode "${n}" does not match resolved element <${e.tagName.toLowerCase()}${e.className?`.${e.className.split(" ").join(".")}`:""}>; ARIA management skipped.`)},st=e=>{let n=e.parentElement,o=null;for(;n;){const{overflow:d,overflowX:a,overflowY:f}=window.getComputedStyle(n),w=/auto|scroll|overlay/.test(`${d} ${a}`),S=/auto|scroll|overlay/.test(`${d} ${f}`);if((w||S)&&(o??=n),w&&n.scrollWidth>n.clientWidth||S&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return o},ct=e=>{const n=t.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",d=e.triggerMode,a=e.anchor===!0?{}:e.anchor,f=a?.activationPoint?a.activationPoint===!0?{}:a.activationPoint:null,w=t.shallowRef(null),S=t.shallowRef(null),$=a?.anchorAlign??{horizontal:"left",vertical:"bottom"},L=a?.popupAlign??{horizontal:"left",vertical:"top"},x=a?.collision??{horizontal:"flip",vertical:"flip"},R=t.shallowRef(null),E=()=>ue(e.triggerRef.value),A=t.computed(()=>E()),V=t.computed(()=>a&&a.hideWhenAnchorClipped!==!1?A.value:null),m=()=>{const p=a?.clipRoot?t.toValue(a.clipRoot):null;if(p){const y=p.getBoundingClientRect();return{left:y.left,top:y.top,right:y.right,bottom:y.bottom}}return{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},s=t.computed(()=>{const p=w.value;if(!e.isOpen.value||!p)return{left:0,top:0};const y=m(),O=Pe({anchor:p,popup:R.value,anchorAlign:$,popupAlign:L,bounds:y,collision:x});return{left:O.left+window.scrollX,top:O.top+window.scrollY}}),h=()=>{const p=e.resolveFocusTarget?.()??ue(e.focusTargetRef?.value);return p||(e.focusTargetContainerSelector?E()?.closest(e.focusTargetContainerSelector)??null:null)},M=(p,y)=>{if(!f)return!1;const O=ue(p);if(!O)return S.value=null,!1;const r=O.getBoundingClientRect();if(y.triggerType==="keyboard"){const u=f.keyboardPosition,C=u?.y??"center",K=typeof C=="number"?C:C==="top"?0:C==="bottom"?r.height:r.height/2;return S.value={trigger:O,point:{x:u?.x??8,y:K},hasMatchedTrigger:!1},!0}return y.coordinates?(S.value={trigger:O,point:{x:y.coordinates.clientX-r.left+(f.pointerOffset?.x??0),y:y.coordinates.clientY-r.top+(f.pointerOffset?.y??0)},hasMatchedTrigger:!1},!0):(S.value=null,!1)},N=()=>{if(d!=="button")return null;if(e.escapeFocusTarget)return e.escapeFocusTarget();const p=e.escapeFocusContainerSelector??at;return(E()??document.activeElement)?.closest(p)??null},Y=()=>{const p=h()??N();if(p)return p.focus(),!0;const y=E();return y?.focus(),!!y},H=()=>{ue(e.menuRef.value)?.querySelector(o)?.focus({preventScroll:!0})},Z=t.shallowRef(null),j=t.shallowRef(null);let c=!1;const T=()=>{const p=n.value;if(p==="keyboard"||p==="escape"){const y=Z.value??j.value;y?.focus(),p==="keyboard"&&y&&y===j.value&&(c=!0)}else n.value==="mouse-selection"&&j.value?.focus();n.value=null,Z.value=null,j.value=null},g=p=>{e.isOpen.value&&(n.value=p,Z.value=h()??(p==="escape"?N():null),j.value=E(),z(!1),e.requestHide(),t.nextTick(T))};t.watch([A,S],([p],y,O)=>{if(!a||!p){w.value=null;return}let r=null;const u=()=>{r=null;const U=S.value;if(f){U&&U.trigger===p?U.hasMatchedTrigger=!0:U?.hasMatchedTrigger&&(U.trigger=p);const J=p.getBoundingClientRect();w.value=U?.trigger===p?new DOMRect(J.left+U.point.x,J.top+U.point.y,0,0):null;return}w.value=a.getRect?.(p)??p.getBoundingClientRect()},C=()=>{r===null&&(r=window.requestAnimationFrame(u))},K=typeof window.ResizeObserver=="function"?new window.ResizeObserver(C):null;K?.observe(p),window.addEventListener("scroll",C,{capture:!0,passive:!0}),window.addEventListener("resize",C,{passive:!0}),C(),O(()=>{r!==null&&window.cancelAnimationFrame(r),K?.disconnect(),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)})},{immediate:!0,flush:"post"});const k=()=>{const p=ue(e.popupContentRef?.value??e.menuRef.value);return p?.closest(".k-popup")??p};a&&t.watch(e.isOpen,(p,y,O)=>{if(!p){R.value=null;return}let r=null;const u=()=>{r=null;const J=k();R.value=J?.getBoundingClientRect()??null},C=()=>{r===null&&(r=window.requestAnimationFrame(u))},K=k(),U=K&&typeof window.ResizeObserver=="function"?new window.ResizeObserver(C):null;U?.observe(K),C(),O(()=>{r!==null&&window.cancelAnimationFrame(r),U?.disconnect()})},{immediate:!0,flush:"post"}),Oe({target:V,root:()=>a?.clipRoot?t.toValue(a.clipRoot):A.value?st(A.value):null,threshold:a?.intersectionThreshold??(f?0:.5),onChange:p=>{p.isIntersecting||g("anchor-hidden")}}),Ve(e.menuRef,()=>g("outside-click"),{ignore:[A]});let I=null,D=null;const P=()=>{I?.isConnected&&I.setAttribute("aria-expanded","false"),I=null},z=p=>{if(e.manageMenuTriggerAria===!1)return;const y=A.value;if(!y){I?.isConnected&&I.setAttribute("aria-expanded",p?"true":"false");return}if(!lt(y,d)){it(y,d),P();return}I&&I!==y&&P(),y.setAttribute("aria-expanded",p?"true":"false"),I=y},W=()=>{const p=ue(e.menuRef.value),y=p?.matches('[role="menubar"]')?p:p?.querySelector('[role="menubar"]'),O=t.toValue(e.menuLabel)?.trim();D&&D!==y&&D.removeAttribute("aria-label"),y&&(O?y.setAttribute("aria-label",O):y.removeAttribute("aria-label")),D=y??null};t.watch([e.isOpen,e.triggerRef],([p])=>{z(p),!p&&f&&(S.value=null,w.value=null)},{immediate:!0,flush:"post"}),t.watch([e.isOpen,e.menuRef,()=>t.toValue(e.menuLabel)],W,{immediate:!0,flush:"post"}),t.onUnmounted(()=>{S.value=null,P(),D?.removeAttribute("aria-label")}),t.watch(e.isOpen,p=>{p&&H()},{flush:"post"});const ee=(...p)=>{const y=p[0];if(c){c=!1;return}if(e.isOpen.value){g("trigger-click");return}e.requestShow(y)};return{setAnchorActivation:M,handleMenuSelect:(p,y)=>{g(p.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),y?.(p)},handleTriggerClick:ee,handleTriggerKeydown:(...p)=>{const y=p[0],O=p[1];if(y.key==="Enter"||y.code==="Space"){y.preventDefault(),ee(O);return}if(y.key==="Escape"){if(y.preventDefault(),y.stopPropagation(),e.isOpen.value){g("escape");return}Y()}},handleMenuEscape:p=>{p.preventDefault(),p.stopPropagation(),g("escape")},handlePopupClose:()=>{t.nextTick(T)},offset:s}},ut=()=>{const e=new Set;return{register:a=>{e.add(a),t.onUnmounted(()=>e.delete(a))},deactivateOthers:a=>{e.forEach(f=>{f!==a&&f.deactivate()})},deactivateAll:()=>{e.forEach(a=>a.deactivate())}}},dt=e=>{if(e instanceof HTMLElement)return e;const n=e&&"$el"in e?e.$el:null;return n instanceof HTMLElement?n:null},ft=()=>{const e=t.shallowReactive(new Map),n=t.ref(null),o=(S,$)=>{const L=dt($);L?e.set(S,L):e.delete(S)},d=S=>e.get(S)??null,a=S=>{n.value=S},f=()=>{n.value=null},w=S=>n.value===S;return{activeId:t.readonly(n),isActive:t.computed(()=>n.value!==null),activeElement:t.computed(()=>n.value!==null?d(n.value):null),register:o,resolve:d,activate:a,deactivate:f,isIdActive:w}};function pt(e){const n=t.ref(""),o=t.ref(void 0),d=t.ref(!!e.debug),a=t.ref(e.dateFormat??"mm/dd/yyyy"),f=t.computed(()=>!!e.required),w=1e3,S=t.ref(!1),$=["ArrowUp","ArrowDown"],L=["ArrowLeft","ArrowRight"],x=t.computed(()=>(n.value??"").replace(/\D/g,"")),R=l=>l<=2?"mm":l<=5?"dd":x.value.length<=10?"yyyy":"mm",E=t.computed(()=>{const l=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(l).toString().padStart(2,"0")}),A=t.computed(()=>{const l=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(l).toString().padStart(2,"0")}),V=t.computed(()=>{const l=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(l).toString().padStart(4,"0")}),m=l=>{if(x.value.length===0){e.onChange({value:null,event:l});return}if(x.value.length<8){e.onChange({value:null,event:l});return}if((n.value??"").length===10&&x.value.length===8){const[b,q,p]=n.value.split("/"),y=parseInt(b),O=parseInt(q),r=parseInt(p);if(H(r,y,O)){const u=N(r,y,O);s(u)?e.onChange({value:u,event:l}):e.onChange({value:null,event:l})}else e.onChange({value:null,event:l})}},s=l=>{const b=e.min??void 0,q=e.max??void 0;return!(b&&l<b||q&&l>q)},h=t.computed(()=>{if((n.value??"").length===10&&x.value.length===8){const[l,b,q]=(n.value??"").split("/"),p=parseInt(l),y=parseInt(b),O=parseInt(q);if(H(O,p,y))return N(O,p,y)}return null}),M=t.computed(()=>(n.value??"").length===10&&x.value.length===8),N=(l,b,q)=>{const p=new Date(0);return p.setFullYear(l,b-1,q),p.setHours(0,0,0,0),p},Y=(l,b)=>N(l,b+1,0).getDate(),H=(l,b,q)=>b>=1&&b<=12&&l>=w&&q>=1&&q<=Y(l,b),Z=l=>{n.value=l.value;const b=l.event?.target;o.value=b?.selectionStart??0,m(l)},j=l=>{o.value=l.target.selectionStart??0},c=(l,b,q)=>{const p=b?.selectionStart??o.value??0;o.value=p;let y=parseInt(E.value),O=parseInt(A.value),r=parseInt(V.value);if(!(x.value.length>=8)||!H(r,y,O)){const _=e.defaultValue??new Date;y=_.getMonth()+1,O=_.getDate(),r=_.getFullYear(),n.value=`${String(y).padStart(2,"0")}/${String(O).padStart(2,"0")}/${String(r)}`;const le=N(r,y,O);e.onChange({value:s(le)?le:null,event:q}),D({useRAF:!0});return}const C=R(p);if(C==="mm")y=l==="ArrowUp"?y<12?y+1:1:y>1?y-1:12;else if(C==="dd"){const _=new Date(r,y,0).getDate();O=l==="ArrowUp"?O<_?O+1:1:O>1?O-1:_}else C==="yyyy"&&(r=l==="ArrowUp"?r+1:Math.max(1,r-1));n.value=`${String(y).padStart(2,"0")}/${String(O).padStart(2,"0")}/${String(r)}`;const[K,U,J]=n.value.split("/"),X=N(parseInt(J),parseInt(K),parseInt(U));X.toString()!=="Invalid Date"&&parseInt(J)>=1e3?e.onChange({value:s(X)?X:null,event:q}):e.onChange({value:null,event:q}),D({useRAF:!0})},T=l=>{if(l.code==="Space"||l.key===" "){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if(l.key==="ArrowDown"&&l.altKey){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if($.includes(l.key)){if(l.altKey)return;l.preventDefault(),l.stopPropagation();const b=l.target;c(l.key,b,l);return}},g=l=>{l.preventDefault();const b=l.deltaY<0?"ArrowUp":"ArrowDown";c(b,l.target,l)},k=l=>{const b=l.target;if(L.includes(l.key)){o.value=b?.selectionStart??0;return}if($.includes(l.key)){if(l.altKey)return;o.value=b?.selectionStart??0}},I=l=>{S.value=!0,f.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&x.value.length===0&&(e.externalValue.value="");const b=l.target;b&&(o.value=b.selectionStart??0)},D=l=>{const b=()=>{const q=document.getElementById(e.id);if(!q)return;const p=l?.pos??o.value??q.value.length;try{q.focus(),q.setSelectionRange(p,p)}catch{}};t.nextTick(()=>{if(l?.delay&&l.delay>0){setTimeout(b,l.delay);return}if(l?.useRAF){requestAnimationFrame(b);return}b()})};e.externalValue&&t.watch(e.externalValue,l=>{if(l){const b=new Date(l);if(b.toString()!=="Invalid Date"){const q=(b.getMonth()+1).toString().padStart(2,"0"),p=b.getDate().toString().padStart(2,"0"),y=b.getFullYear().toString();n.value=`${q}/${p}/${y}`,D({delay:50});return}}},{immediate:!0});const P=t.computed(()=>[["Date",`${E.value} / ${A.value} / ${V.value}`],["Digits only",x.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),z=t.computed(()=>{if(!f.value){if(!M.value)return!0;const b=h.value;return b?s(b):!1}if(!S.value)return!0;const l=h.value;return!M.value||!l?!1:s(l)}),W=t.computed(()=>{if(!f.value){if(!M.value)return;const b=h.value;return b?s(b)?"valid":"out-of-bounds":"invalid-date"}if(!S.value)return;if(x.value.length===0||!M.value)return"incomplete";const l=h.value;return l?s(l)?"valid":"out-of-bounds":"invalid-date"}),ee=t.computed(()=>{const l=W.value;if(!l||l==="valid")return"";if(l==="incomplete")return"Required";if(l==="invalid-date")return`Must be in ${a.value} format.`;const b=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,q=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(l==="out-of-bounds"){if(b&&q)return`Must be between ${b} and ${q}.`;if(b)return`Must be on or after ${b}.`;if(q)return`Must be on or before ${q}.`}return""}),ae=()=>{t.nextTick(()=>{const l=document.getElementById(e.id);if(!l){console.warn(`ID (#${e.id}) not found for styling.`);return}const b=l.closest(".k-datepicker");if(!b){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const q=b.parentElement;if(q){if(q.classList.contains("fk-datepicker"))return;q.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{ae()}),{raw:n,cursorPos:o,debugEnabled:d,debugLines:P,placeholder:a,isValid:z,reason:t.readonly(W),validationMessage:ee,digitsOnly:x,month:t.readonly(E),day:t.readonly(A),year:t.readonly(V),datePart:R,handleChange:Z,handleKeyDown:T,handleWheel:g,handleKeyUp:k,handleClick:j,handleBlur:I,initStyling:ae}}function mt(e){const n=t.ref(""),o=t.ref(void 0),d=t.ref(!!e.debug),a=t.ref(!1),f=1440*60*1e3,w=365*f,S=new Date,$=new Date(S.getTime()-w),L=new Date(S.getTime()+w);e.min=e.min??$,e.max=e.max??L;const x=t.computed(()=>(n.value??"").replace(/\D/g,"")),R=(i,v)=>new Date(i,v,0).getDate(),E=(i,v,F)=>v>=1&&v<=12&&i>=1e3&&F>=1&&F<=R(i,v),A=i=>Date.UTC(i.getFullYear(),i.getMonth(),i.getDate()),V=i=>{if(!i)return null;const v=e.min??new Date(Date.now()-90*f),F=e.max??new Date,B=A(i);return B<A(v)||B>A(F)?null:i},m=(i,v)=>e.allowReverse??!1?!0:i<=v,s=t.computed(()=>(n.value?.length??0)>=23&&x.value.length>=16),h=i=>{if((i??"").length<23||x.value.length<16)return{start:null,end:null};const v=i.substring(0,10),F=i.substring(13,23),[B,te,ne]=v.split("/").map(ce=>parseInt(ce||"0",10)),[se,de,fe]=F.split("/").map(ce=>parseInt(ce||"0",10)),pe=new Date(ne,B-1,te),ge=new Date(fe,se-1,de),ke=E(ne,B,te)&&pe.toString()!=="Invalid Date",Ae=E(fe,se,de)&&ge.toString()!=="Invalid Date";return{start:ke?pe:null,end:Ae?ge:null}},M=e.externalValid??t.ref(!0),N=t.computed(()=>h(n.value)),Y=t.computed(()=>{const i=V(N.value.start),v=V(N.value.end);return{start:i,end:v}}),H=t.computed(()=>{if(!s.value)return;const i=Y.value.start,v=Y.value.end;if(!i||!v)return;const F=Math.abs(A(v)-A(i));return Math.round(F/864e5+1)}),Z=t.ref(!1),j=t.computed(()=>{if(!Z.value)return;const{start:i,end:v}=N.value;if(!s.value)return"incomplete";if(!i||!v)return"invalid-date";if(!Y.value.start||!Y.value.end)return"out-of-bounds";const F=Y.value.start,B=Y.value.end;return m(F,B)?typeof e.maxSpanDays=="number"&&H.value!==void 0&&H.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),c=t.computed(()=>{const i=j.value;return i===void 0||i==="valid"}),T=t.computed(()=>{const{min:i,max:v}=e,F=j.value;if(!F)return"";switch(F){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return i&&v?`Dates must be between ${D(i)} and ${D(v)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";default:return""}}),g=["ArrowUp","ArrowDown"],k=["ArrowLeft","ArrowRight"],I=(i,v)=>String(i).padStart(v,"0"),D=i=>`${I(i.getMonth()+1,2)}/${I(i.getDate(),2)}/${I(i.getFullYear(),4)}`,P=i=>i<=2?{side:"start",part:"mm"}:i<=5?{side:"start",part:(i<=3,"dd")}:i<=11?{side:"start",part:"yyyy"}:i<=15?{side:"end",part:"mm"}:i<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},z=(i,v,F)=>{const B=v?.selectionStart??o.value??0;o.value=B;const{start:te,end:ne}=h(n.value);if(!te&&!ne){const Q=new Date,ie=D(Q);n.value=`${ie} - ${ie}`,e.onChange({value:{start:Q,end:Q},event:F}),t.nextTick(()=>{requestAnimationFrame(()=>{const re=document.getElementById(e.id),oe=o.value??0;re&&(re.focus(),re.setSelectionRange(oe,oe))})});return}const se=new Date,de=P(B);let fe=te?new Date(te):new Date(se),pe=ne?new Date(ne):new Date(se);const ge=(Q,ie)=>{if(ie==="mm"){const re=Q.getMonth()+1,oe=i==="ArrowUp"?re<12?re+1:1:re>1?re-1:12;Q.setMonth(oe-1);const ve=R(Q.getFullYear(),oe);Q.getDate()>ve&&Q.setDate(ve)}else if(ie==="dd"){const re=R(Q.getFullYear(),Q.getMonth()+1),oe=Q.getDate(),ve=i==="ArrowUp"?oe<re?oe+1:1:oe>1?oe-1:re;Q.setDate(ve)}else if(ie==="yyyy"){const re=Q.getFullYear();Q.setFullYear(i==="ArrowUp"?re+1:Math.max(1,re-1));const oe=R(Q.getFullYear(),Q.getMonth()+1);Q.getDate()>oe&&Q.setDate(oe)}};de.side==="start"?ge(fe,de.part):ge(pe,de.part);const ke=D(fe),Ae=D(pe);n.value=`${ke} - ${Ae}`;const ce=V(fe),De=V(pe);ce&&De&&m(ce,De)?e.onChange({value:{start:ce,end:De},event:F}):e.onChange({value:null,event:F}),t.nextTick(()=>{requestAnimationFrame(()=>{const Q=document.getElementById(e.id),ie=o.value??0;Q&&(Q.focus(),Q.setSelectionRange(ie,ie))})})},W=i=>{const{start:v,end:F}=h(n.value);if(!v||!F){e.onChange({value:null,event:i});return}const B=V(v),te=V(F);if(!B||!te){e.onChange({value:null,event:i});return}if(!m(B,te)){e.onChange({value:null,event:i});return}e.onChange({value:{start:B,end:te},event:i})},ee=i=>{const v=i.value??"",F=i.event;if(!v&&F&&F.type==="click"){O(F);return}n.value=v;const B=F?.target;o.value=B?.selectionStart??0,W(i)},ae=i=>{o.value=i.target.selectionStart??0},l=i=>{if(i.code==="Space"||i.key===" "){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(i.key==="ArrowDown"&&i.altKey){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(g.includes(i.key)){i.preventDefault(),i.stopPropagation();const v=i.target;z(i.key,v,i);return}},b=i=>{i.preventDefault();const v=i.deltaY<0?"ArrowUp":"ArrowDown";z(v,i.target,i)},q=i=>{if(k.includes(i.key)||g.includes(i.key)){const v=i.target;o.value=v?.selectionStart??0}},p=()=>{Z.value=!0,(e.manageValid??!0)&&(M.value=c.value)},y=i=>{p()},O=i=>{n.value="",o.value=0,e.onChange({value:null,event:i}),p(),t.nextTick(()=>{const v=document.getElementById(e.id);v&&(v.focus(),v.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,i=>{const v=i?.start??null,F=i?.end??null;if(v&&F){if(n.value=`${D(v)} - ${D(F)}`,e.isOpen?.value&&a.value&&e.onRequestClose){const B=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),a.value=!1,p()},B)}return}},{immediate:!0});const r=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),u=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),C=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),K=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),U=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),J=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),X=t.computed(()=>{const{start:i,end:v}=h(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(r.value).padStart(2,"0")} / ${String(u.value).padStart(2,"0")} / ${String(C.value).padStart(4,"0")}`},{label:"End",value:`${String(K.value).padStart(2,"0")} / ${String(U.value).padStart(2,"0")} / ${String(J.value).padStart(4,"0")}`},{label:"Digits only",value:x.value},{label:"Mask complete",value:`${s.value}`},{label:"Parsed",value:`${i?i.toDateString():"-"} | ${v?v.toDateString():"-"}`},{label:"Valid (managed)",value:`${M.value??"-"}`},{label:"Span (days)",value:`${H.value??"-"}`},{label:"Reason",value:`${j.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const F=o.value??0,B=P(F);return`${B.side}.${B.part}`})()})`}]}),_=()=>{t.nextTick(()=>{const i=document.getElementById(e.id);if(!i){console.warn(`#${e.id} not found for styling.`);return}const v=i.closest("div");if(!v){console.warn(`Parent div of #${e.id} not found for styling.`);return}v.classList.contains("fk-daterangepicker")||v.classList.add("fk-daterangepicker")})};t.onMounted(()=>{_()});const le=()=>{t.nextTick(()=>{try{const i=Array.from(document.querySelectorAll(".k-animation-container"));if(!i.length)return;const F=[...i].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!F)return;const B=F.querySelectorAll(".k-calendar-table");let te=!1;B.forEach(ne=>{ne.tabIndex===0&&(te?ne.tabIndex=-1:te=!0)})}catch(i){console.warn(i)}})};return e.isOpen&&t.watch(e.isOpen,i=>{i&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:n,cursorPos:o,debugEnabled:d,debugLines:X,digitsOnly:x,valid:M,validComputed:t.readonly(c),reason:t.readonly(j),validationMessage:t.readonly(T),spanDays:t.readonly(H),month1:t.readonly(r),day1:t.readonly(u),year1:t.readonly(C),month2:t.readonly(K),day2:t.readonly(U),year2:t.readonly(J),handleChange:ee,handleKeyDown:l,handleWheel:b,handleKeyUp:q,handleClick:ae,handleBlur:y,handleClear:O,onCalendarChange:()=>{a.value=!0},initStyling:_}}function gt(e){const n=t.ref(""),o=t.ref(void 0),d=t.ref(!!e.debug),a=t.ref(e.timeFormat??"hh:mm AM"),f=t.computed(()=>!!e.required),w=t.ref(!1),S=["ArrowUp","ArrowDown"],$=["ArrowLeft","ArrowRight"],L=t.computed(()=>(n.value??"").replace(/\D/g,"")),x={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},R=r=>r<=2?"hh":r<=5?"mm":"ampm",E=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",u=parseInt(r);return Math.min(Math.max(u,0),23)}),A=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",u=parseInt(r);return Math.min(Math.max(u,0),59)}),V=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),m=t.computed(()=>{const r=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),u=V.value;return r===12?u==="AM"?0:12:u==="PM"?r+12:r}),s=t.computed(()=>h.value?`${String(m.value).padStart(2,"0")}:${String(A.value).padStart(2,"0")}:00`:null),h=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),M=(r,u,C)=>{let K=r%12;return K===0&&(K=12),`${String(K).padStart(2,"0")}:${String(u).padStart(2,"0")} ${C}`},N=r=>{const u=r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!u)return null;const C=parseInt(u[1]),K=parseInt(u[2]),U=u[3].toUpperCase();if(C<1||C>12||K<0||K>59)return null;let J=C%12;U==="PM"&&(J+=12);const X=new Date;return X.setSeconds(0,0),X.setHours(J),X.setMinutes(K),X},Y=r=>{if(L.value.length===0){e.onChange({value:null,event:r});return}if(!h.value){e.onChange({value:null,event:r});return}const u=N(n.value);u&&Z(u)?e.onChange({value:u,event:r}):e.onChange({value:null,event:r})},H=r=>r.getHours()*60+r.getMinutes(),Z=r=>{const u=e.min??void 0,C=e.max??void 0,K=H(r);if(u){const U=H(u);if(K<U)return!1}if(C){const U=H(C);if(K>U)return!1}return!0},j=r=>{const u=r.getHours(),C=u>=12?"PM":"AM";n.value=M(u,r.getMinutes(),C)},c=(r,u)=>{e.onChange({value:r,event:u})},T=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const r=document.getElementById(e.id);if(r){r.focus();const u=(r.value??"").length;r.setSelectionRange(u,u)}})})})},g=r=>{const u=r?.event?.target;return u?u.closest(".k-time-now")?"now":u.closest(".k-time-accept")?"set":null:null},k=(r,u)=>{r&&Z(r)?c(r,u):c(null,u)},I=(...r)=>{const u=r[0];if(!u)return;const C=g(u);if(C==="now"){const U=new Date;j(U),k(U,u),T();return}if(u?.value instanceof Date){const U=new Date(u.value);j(U),k(U,u),C==="set"&&T();return}if(u?.value===null){n.value="",c(null,u);return}n.value=u.value;const K=u.event?.target;o.value=K?.selectionStart??0;try{const U=o.value??0;if(R(U)==="ampm"&&(n.value??"").length>=8){const J=n.value.charAt(6);/[Aa]/.test(J)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const X=document.getElementById(e.id);X&&(X.focus(),X.setSelectionRange(8,8))})})):/[Pp]/.test(J)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const X=document.getElementById(e.id);X&&(X.focus(),X.setSelectionRange(8,8))})}))}}catch{}Y(u)},D=r=>{o.value=r.target.selectionStart??0},P=(r,u,C)=>{const K=u?.selectionStart??o.value??0;o.value=K;const U=R(K),J=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!J){if((n.value??"").length===0||L.value.length===0){const v=new Date,F=v.getHours(),B=F>=12?"PM":"AM";n.value=M(F,v.getMinutes(),B);const te=N(n.value);k(te,C),t.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),se=o.value??0;ne&&(ne.focus(),ne.setSelectionRange(se,se))})})}return}let X=parseInt(J[1]),_=parseInt(J[2]),le=J[3].toUpperCase();if(U==="hh")r==="ArrowUp"?X=X<12?X+1:1:X=X>1?X-1:12;else if(U==="mm"){const v=e.minuteStepRef?.value??e.minuteStep??1;if(v===1)r==="ArrowUp"?_=_<59?_+1:0:_=_>0?_-1:59;else if(r==="ArrowUp"){const F=_%v;let B=F===0?_+v:_+(v-F);B>=60&&(B=0),_=B}else{const F=_%v;let B=F===0?_-v:_-F;B<0&&(B=60-v),_=B}}else U==="ampm"&&(le=le==="AM"?"PM":"AM");n.value=`${String(X).padStart(2,"0")}:${String(_).padStart(2,"0")} ${le}`;const i=N(n.value);k(i,C),t.nextTick(()=>{requestAnimationFrame(()=>{const v=document.getElementById(e.id),F=o.value??0;v&&(v.focus(),v.setSelectionRange(F,F))})})},z=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowPicker(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowPicker(r);return}if(S.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const u=r.target;P(r.key,u,r);return}},W=r=>{r.preventDefault();const u=r.deltaY<0?"ArrowUp":"ArrowDown";P(u,r.target,r)},ee=r=>{const u=r.target;if($.includes(r.key)){o.value=u?.selectionStart??0;return}if(S.includes(r.key)){if(r.altKey)return;o.value=u?.selectionStart??0}},ae=r=>{w.value=!0,f.value&&e.externalValue&&e.externalValue.value===void 0&&L.value.length===0&&(e.externalValue.value="");const u=r.target;u&&(o.value=u.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const u=new Date(r);if(u.toString()!=="Invalid Date"){const C=u.getHours(),K=C>=12?"PM":"AM";n.value=M(C,u.getMinutes(),K);return}}},{immediate:!0});const l=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",m.value],["Minute",A.value],["Period",V.value],["Time (24h)",s.value??"--:--:--"],["Digits only",L.value],["Parsed Date",b.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",q.value],["reason",p.value],["validationMessage",y.value]]),b=t.computed(()=>N(n.value)??null),q=t.computed(()=>{if(!f.value){if(!h.value)return!0;const u=b.value;return u?Z(u):!1}if(!w.value)return!0;const r=b.value;return!h.value||!r?!1:Z(r)}),p=t.computed(()=>{if(!f.value){if(!h.value)return;const u=b.value;return u?Z(u)?"valid":"out-of-bounds":"invalid-time"}if(!w.value)return;if(L.value.length===0||!h.value)return"incomplete";const r=b.value;return r?Z(r)?"valid":"out-of-bounds":"invalid-time"}),y=t.computed(()=>{const r=p.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="invalid-time")return`Must be in ${a.value} format.`;const u={hour:"2-digit",minute:"2-digit"},C=e.min?e.min.toLocaleTimeString("en-US",u):null,K=e.max?e.max.toLocaleTimeString("en-US",u):null;if(r==="out-of-bounds"){if(C&&K)return`Must be between ${C} and ${K}.`;if(C)return`Must be ${C} or later.`;if(K)return`Must be ${K} or earlier.`}return""}),O=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const u=r.closest(".k-timepicker");if(!u){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const C=u.parentElement;if(!C){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}C.classList.contains("fk-timepicker")||C.classList.add("fk-timepicker")})};return t.onMounted(()=>{O()}),{raw:n,rules:x,debugEnabled:d,debugLines:l,placeholder:a,isValid:q,reason:t.readonly(p),validationMessage:y,isComplete:h,inRangeTime:Z,cursorPos:o,hour:t.readonly(E),hour24:t.readonly(m),minute:t.readonly(A),period:t.readonly(V),time24:t.readonly(s),parsedRawTime:t.readonly(b),handleChange:I,handleKeyDown:z,handleKeyUp:ee,handleClick:D,handleWheel:W,handleBlur:ae,initStyling:O}}const ht={returnFocusToTrigger:!1,focusTrapOptions:{returnFocusOnDeactivate:!1}};function vt(e){const n=t.shallowRef(null),o=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],d=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??o].flat(),a=x=>x?typeof e.initialFocus=="string"?x.querySelector(e.initialFocus)??x:typeof e.initialFocus=="function"?e.initialFocus(x)??x:x.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??x:null,{activate:f,deactivate:w}=Le.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>n.value,initialFocus:()=>a(n.value),...e.focusTrapOptions??{}});let S=null,$=t.ref(null);const L=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const x=(E,A)=>{const V=Array.from(E.querySelectorAll(A));if(!V.length)return null;const m=V.filter(s=>s.offsetParent!==null||s.getClientRects().length>0);return m[m.length-1]??V[V.length-1]??null},R=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of d){const A=x(R,E);if(A)return A}for(const E of d){const A=x(document,E);if(A)return A}return null};return Ve(n,x=>{$.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",x)}),t.watch(()=>e.isOpen.value,x=>{x?($.value=null,t.nextTick(()=>{const R=L();R&&(R.tabIndex<0&&(R.tabIndex=-1),n.value=R,setTimeout(()=>{try{f()}catch(E){console.warn("usePopupTrap: focus trap failed to activate",E)}},0),S||(S=E=>{E.key==="Escape"&&($.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",S,!0)))})):(w(),S&&(document.removeEventListener("keydown",S,!0),S=null),n.value=null,$.value==="outside"&&t.nextTick(()=>{const R=()=>{const E=e.triggerEl?.value,A=E?.querySelector("input"),V=document.activeElement;V&&(V===A||E&&E.contains(V))&&(A??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(R,0))}),e.returnFocusToTrigger!==!1&&$.value==="escape"&&e.triggerEl?.value&&t.nextTick(()=>{const R=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(R,0))}))}),{popupRef:n,activate:f,deactivate:w,lastCloseReason:t.readonly($),setPopupEl:x=>n.value=x}}G.POPUP_MENU_TRAP_OPTIONS=ht,G.computeCollisionOffset=Pe,G.useActiveIdRegistry=ft,G.useCompositeId=et,G.useExclusiveGroup=ut,G.useFieldsetTouchTracker=Me,G.useFieldsetValidationKit=Ie,G.useGridA11y=Ne,G.useGridActiveFilter=Ue,G.useGridRowAction=Be,G.useIntersectionObserver=Oe,G.useMaskedDateInput=pt,G.useMaskedDateRangeInput=mt,G.useMaskedTimeInput=gt,G.usePopupMenu=ct,G.usePopupTrap=vt,G.useUSAddress=Qe,G.useZipTextBox=xe,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(j,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],n):(j=typeof globalThis<"u"?globalThis:j||self,n(j.FeatherKComposables={},j.Vue,j.useFocusTrap))})(this,(function(j,n,Ne){"use strict";const ze=(e,t)=>{const o=n.ref(null);let u=!1,l=null,d=null;const b=[],k=".k-table-row[data-grid-row-index] [tabindex]",P=()=>{const a=e?.value?.$el;return a?a.closest(".k-grid"):null},N=a=>{const h=P();if(!h)return!1;const g=a.closest(".k-grid-aria-root");if(g)return h.contains(g);const A=a.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return A?h.contains(A):!1},x=a=>a.key==="Enter"||a.code==="Enter"||a.code==="NumpadEnter",R=()=>e?.value?.columns,T=a=>{const h=a.key||a.code;([" ","Spacebar","Space"].includes(h)||x(a))&&(a.preventDefault(),a.stopPropagation(),o.value=a.target,a.target.click())},D=a=>{if(!o.value)return;if(a.code==="Escape"){a.stopPropagation(),o.value&&o.value.focus();return}const h=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),g=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(g){if(a.code==="Tab"){const A=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],I=t?.focusableMenuSelectors??A,E=Array.from(g.querySelectorAll(I.join(",")));if(E.length===0)return;const L=E.findIndex(X=>X===document.activeElement);let K;L===-1?K=0:a.shiftKey?K=(L-1+E.length)%E.length:K=(L+1)%E.length,a.preventDefault(),a.stopPropagation(),E[K]?.focus()}}else if(a.code==="ArrowUp"||a.code==="ArrowDown"){a.preventDefault(),a.stopPropagation();const A=h.findIndex(E=>E===document.activeElement);let I=A;a.code==="ArrowUp"?I=A>0?A-1:h.length-1:a.code==="ArrowDown"&&(I=A<h.length-1?A+1:0),h[I]?.focus();return}if(a.code==="Tab"){a.preventDefault(),a.stopPropagation();const A=o.value?.parentElement;(a.shiftKey?A?.previousElementSibling:A?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},V=()=>{l=new MutationObserver(a=>{a.forEach(h=>{h.addedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const A=g;if(A.classList.contains("k-animation-container")){const E=o.value;E&&(E.dataset.featherKSortable==="true"||n.nextTick(()=>{A.querySelectorAll(".k-columnmenu-item-wrapper").forEach(X=>{X.textContent?.toLowerCase().includes("sort")&&X.remove()})})),A.addEventListener("keydown",D),n.nextTick(()=>{const L=()=>{const K=Array.from(A.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(K.length===1)K[0].focus(),K[0].click(),L.attempts=0;else if(K.length>1){L.attempts=0;return}else L.attempts===void 0&&(L.attempts=0),L.attempts++<3&&setTimeout(L,200)};L()})}A.querySelectorAll(".k-animation-container").forEach(E=>{E.addEventListener("keydown",D)})}}),h.removedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const A=g;A.classList.contains("k-animation-container")&&A.removeEventListener("keydown",D),A.querySelectorAll(".k-animation-container").forEach(E=>{E.removeEventListener("keydown",D)})}})})}),l.observe(document.body,{childList:!0,subtree:!0})},p=a=>{const h=a.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(h)||a.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},c=a=>{if(!a.type||!a)return;const h=a.target;if(!h)return;const g=h.closest(".k-table-row[data-grid-row-index]");if(!N(h))return;const A=["ArrowLeft","ArrowRight"].includes(a.code);if(!(p(h)&&!(g&&A))){if(a.code==="Escape"){const I=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(I){a.preventDefault(),a.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(L=>L.setAttribute("tabindex","-1"))}catch{}I.setAttribute("tabindex","0"),I.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(a.code)){if(h.classList.contains("k-grid-header-menu")&&h.classList.contains("k-grid-column-menu")){o.value=h;return}if(g){if(["ArrowDown","ArrowUp"].includes(a.code)){a.preventDefault(),a.stopPropagation();const I=(L,K)=>{let X=K==="next"?L.nextElementSibling:L.previousElementSibling;for(;X;){const ee=X;try{if(ee.classList.contains("k-table-row"))return ee}catch{}X=K==="next"?X.nextElementSibling:X.previousElementSibling}return null},E=a.code==="ArrowDown"?I(g,"next"):I(g,"previous");E&&(g.setAttribute("tabindex","-1"),E.setAttribute("tabindex","0"),E.focus());return}if(["ArrowLeft","ArrowRight"].includes(a.code)){a.preventDefault(),a.stopPropagation();const I=g.querySelectorAll(k);if(I.length===0)return;let E=Array.from(I).findIndex(L=>L===document.activeElement);if(E===-1&&document.activeElement===g){I[0].focus();return}a.code==="ArrowRight"?E=E===I.length-1?0:E+1:a.code==="ArrowLeft"&&(E=E===0?I.length-1:E-1),I[E].focus();return}}}}},v=()=>{n.nextTick(()=>{const a=e.value?.$el;if(!a||typeof a.closest!="function")return;const h=a.closest(".k-grid");h&&h.classList.add("fk-grid")})},M=()=>{if(!d)try{const a=()=>{try{const A=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!A||A.length===0||A.filter(L=>L.getAttribute("tabindex")==="0").length===1)return;const E=A.find(L=>L===document.activeElement||L.contains(document.activeElement));if(A.forEach(L=>L.setAttribute("tabindex","-1")),E){E.setAttribute("tabindex","0");return}A[0].setAttribute("tabindex","0")}catch(A){console.error("ensureSingleTabindex error:",A)}},h=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));h.length>0&&h.forEach((A,I)=>{A.setAttribute("tabindex",I===0?"0":"-1")});const g=e.value.$el.querySelector(".k-table-tbody");g&&(d=new MutationObserver(()=>{a()}),d.observe(g,{childList:!0,subtree:!0}))}catch(a){console.error("Error setting up row navigation:",a)}},O=()=>{n.nextTick(()=>{const h=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");h&&h.forEach(g=>{g.setAttribute("role","button"),g.addEventListener("keydown",T)}),V(),H()})},W=()=>{const h=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");h&&h.forEach(g=>{g.removeEventListener("keydown",T)}),l&&(l.disconnect(),l=null),d&&(d.disconnect(),d=null),b.forEach(g=>g()),b.length=0},H=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((g,A)=>{if(g.dataset.featherKHeaderBound==="true")return;const I=g.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!I)return;const E=R();if(E&&E[A]){const i=E[A].field??"";g.setAttribute("data-feather-k-field",i),g.setAttribute("data-feather-k-filterable",E[A].filterable===!1?"false":"true"),g.setAttribute("data-feather-k-sortable",E[A].sortable===!1?"false":"true")}const L=g.dataset.featherKFilterable!=="false",K=g.dataset.featherKSortable!=="false";I.setAttribute("tabindex","-1"),L||K?g.style.cursor="pointer":g.style.cursor="default",L?(g.setAttribute("tabindex","0"),g.setAttribute("role","button"),g.setAttribute("aria-haspopup","menu")):(g.setAttribute("tabindex","0"),g.setAttribute("role","columnheader"),g.removeAttribute("aria-haspopup"));const X=i=>{i.target?.closest(".k-column-resizer")||(o.value=g,I.click())},ee=i=>{if(L)o.value=g,i.preventDefault(),i.stopPropagation(),X(i);else if(K){o.value=g;const S=g.querySelector(".k-link");S&&S.click()}};g.addEventListener("click",ee),b.push(()=>{g.removeEventListener("click",ee)});const oe=i=>{if((x(i)||i.code==="Space")&&(L||K)){if(i.preventDefault(),i.stopPropagation(),o.value=g,o.value.focus(),L)X(i);else if(K){const S=g.querySelector(".k-link");S&&S.click()}}};g.addEventListener("keydown",oe,!0),b.push(()=>{g.removeEventListener("keydown",oe,!0)}),g.dataset.featherKHeaderBound="true"});const h=document.querySelector(".k-grid-header .k-table-thead");if(h&&h.dataset.featherKHeaderBound!=="true"){const g=A=>{const I=A.target.closest("th");I&&(x(A)||A.code==="Space")&&I.dataset.featherKFilterable==="false"&&I.dataset.featherKSortable==="false"&&(A.preventDefault(),A.stopImmediatePropagation())};h.addEventListener("keydown",g,!0),b.push(()=>{h.removeEventListener("keydown",g,!0)}),h.dataset.featherKHeaderBound="true"}},_=function(a,h){const g=a?.event?.event.target,A=R();if(!g||!A)return;const I=g.classList.contains("k-grid-header-menu"),E=g.classList.contains("k-columnmenu-item"),L=A.find(K=>K.field===a?.event?.field)?.sortable&&!0;if(!I){if(E&&!L){a?.event?.sort?.filter(X=>X.field!==a?.event?.field);return}typeof h=="function"&&n.nextTick(()=>{o.value&&o.value.focus(),h(a),n.nextTick(()=>{H()})})}},F=()=>{if(!u)try{v(),M(),O(),u=!0}catch(a){console.error("initA11y failed:",a),W()}};return n.onBeforeUnmount(()=>{W()}),{activeFilterButton:o,handleGridKeyDown:c,handleSortChange:_,initA11y:F}},qe=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ke=e=>!!e&&typeof e=="object"&&"field"in e,Te=(e,t)=>!e||typeof e!="object"?!1:qe(e)?e.filters.some(o=>Te(o,t)):Ke(e)?e.field===t:!1,Ue=e=>t=>e.value?.filters&&e.value.filters.some(o=>Te(o,t))?"active":"",Be=["button","a","input","select","textarea",'[role="button"]','[role="checkbox"]','[role="link"]','[role="menuitem"]','[role="option"]',".k-checkbox",".k-button",".k-dropdown",".k-picker",".k-hierarchy-cell",".k-grid-header-menu",".k-column-menu"],Ye=e=>{const{onRowAction:t,gridRef:o,dataItems:u,ignoreSelectors:l=[],shouldIgnoreTarget:d,enableKeyboardAction:b=!0}=e,k=[...Be,...l],P=(p,c)=>{if(!p)return!1;const v=k.join(",");return p.closest&&p.closest(v)?!0:d&&c?d(p,c):!1},N=p=>{const v=p?.closest?.(".k-table-row[data-grid-row-index]")?.getAttribute("data-grid-row-index");if(v==null)return;const M=parseInt(v,10);return Number.isNaN(M)?void 0:M},x=p=>{if(!p||typeof p.clientX!="number")return;const c=typeof window<"u"&&window.scrollX||0,v=typeof window<"u"&&window.scrollY||0,M=typeof window<"u"&&window.screenX||0,O=typeof window<"u"&&window.screenY||0;return{clientX:p.clientX,clientY:p.clientY,pageX:typeof p.pageX=="number"?p.pageX:p.clientX+c,pageY:typeof p.pageY=="number"?p.pageY:p.clientY+v,screenX:typeof p.screenX=="number"?p.screenX:p.clientX+M,screenY:typeof p.screenY=="number"?p.screenY:p.clientY+O}},R=p=>{if(!p||typeof p.getBoundingClientRect!="function")return;const c=p.getBoundingClientRect();if(!c)return;const v=c.left,M=c.bottom,O=typeof window<"u"&&window.scrollX||0,W=typeof window<"u"&&window.scrollY||0;return{clientX:v,clientY:M,pageX:v+O,pageY:M+W,screenX:v,screenY:M}},T=p=>{if(typeof window>"u")return!1;const c=window.getSelection();if(!c||c.isCollapsed||!c.toString().trim())return!1;if(p&&c.anchorNode&&c.focusNode){const v=p.closest(".k-table-row")||p.closest(".k-grid")||p,M=c.anchorNode.nodeType===Node.ELEMENT_NODE?c.anchorNode:c.anchorNode.parentElement,O=c.focusNode.nodeType===Node.ELEMENT_NODE?c.focusNode:c.focusNode.parentElement,W=!!(M&&v.contains(M)),H=!!(O&&v.contains(O));return W||H}return!0};return{handleRowClick:p=>{const c=p?.htmlEvent||p?.event||p?.nativeEvent||(p instanceof Event?p:void 0);if(c&&c.button!==void 0&&c.button!==0)return;const v=c?.target||p?.target;if(v&&P(v,c||p)||T(v))return;const M={dataItem:p.dataItem,rowIndex:p.rowIndex??N(v),field:p.field,event:c||p,triggerType:"click",ctrlKey:!!c?.ctrlKey,shiftKey:!!c?.shiftKey,metaKey:!!c?.metaKey,altKey:!!c?.altKey,coordinates:x(c)??R(v)};t(p.dataItem,M)},handleRowKeyDown:(p,c)=>{if(!b)return;const v=p.key||p.code;if(!(v==="Enter"||v==="NumpadEnter"||v===" "||v==="Space"||p.code==="Enter"||p.code==="NumpadEnter"||p.code==="Space"))return;const O=p.target;if(!O)return;const W=O.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!W||P(O,p))return;p.preventDefault(),p.stopPropagation();const H=W.getAttribute("data-grid-row-index"),_=H!==null?parseInt(H,10):void 0;let F=c;if(F===void 0){const h=(Array.isArray(u)?u:u?.value)||o?.value?.props?.dataItems||o?.value?.dataItems;h&&_!==void 0&&_>=0&&_<h.length&&(F=h[_])}if(F===void 0)return;const a={dataItem:F,rowIndex:_,event:p,triggerType:"keyboard",ctrlKey:!!p.ctrlKey,shiftKey:!!p.shiftKey,metaKey:!!p.metaKey,altKey:!!p.altKey,coordinates:R(W)};t(F,a)},isIgnoredTarget:P}},We="Enter a valid ZIP code with exactly 5 or 9 digits.",xe=e=>{const t=e.replace(/\D/g,"").slice(0,9);return t.length>5?`${t.slice(0,5)}-${t.slice(5)}`:t},He=(e,t)=>e.slice(0,Math.max(0,t)).replace(/\D/g,"").length,Xe=e=>e<=5?e:Math.min(e+1,10),Me=e=>{const t=n.ref(xe(e.initialValue??"")),o=n.ref(!1),u=n.ref(e.errorMessage?.trim()||We),l=n.computed(()=>t.value.replace(/\D/g,"")),d=n.computed(()=>{const D=l.value.length;return D===5||D===9}),b=n.computed(()=>o.value&&!d.value),k=n.computed(()=>!o.value||d.value),P=n.computed(()=>o.value),N=(D,V)=>{const p=Xe(V);n.nextTick(()=>{D.isConnected&&D.setSelectionRange(p,p)})};return{zipDisplay:t,submitted:o,errorMessage:u,wrapperClass:"fk-zip-textbox",zipRaw:l,isZipValid:d,showZipError:b,textBoxValid:k,textBoxValidate:P,handleZipInput:(...D)=>{const V=D[0],c=V?.event?.target,v=V?.value,M=Array.isArray(v)?v.join(""):String(v??""),O=c?.selectionStart!==void 0&&c.selectionStart!==null?He(c.value,c.selectionStart):M.replace(/\D/g,"").length;t.value=xe(M),c&&N(c,O)},submitAndValidate:D=>{o.value=!0;const V=d.value;return!V&&D?.focus&&n.nextTick(()=>{document.getElementById(e.id)?.focus()}),V},buildPayload:()=>({zip:l.value})}};function Ie(e,t){const o=n.ref(!1);n.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!t.isValid()))});function u(d){const b=e.value??d.currentTarget,k=d.relatedTarget;(!b||!b.contains(k))&&(o.value=!0)}function l(){o.value=!1}return{touched:o,onFocusout:u,reset:l}}function Ce(e,t){const o=n.ref(!1),u=n.ref(!1),l=n.computed(()=>n.toValue(t.submitted)||o.value),d=n.computed(()=>!l.value||t.isValid()),b=Ie(e,{isValid:()=>d.value});function k(T){return n.computed(()=>!l.value||n.toValue(T))}function P(T){return Object.fromEntries(Object.entries(T).map(([D,V])=>[D,k(V)]))}function N(T){const D=n.toValue(T);if(!D)return;D.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function x(T){if(u.value){u.value=!1;return}b.onFocusout(T),b.touched.value&&(o.value=!0)}function R(){o.value=!1,u.value=!0,b.reset()}return{touched:o,fieldsetValidate:l,onFocusout:x,reset:R,createFieldValidity:k,createFieldValidationsMap:P,focusFirstInvalidField:N}}const _e=[{label:"Alabama",value:"AL"},{label:"Alaska",value:"AK"},{label:"Arizona",value:"AZ"},{label:"Arkansas",value:"AR"},{label:"California",value:"CA"},{label:"Colorado",value:"CO"},{label:"Connecticut",value:"CT"},{label:"Delaware",value:"DE"},{label:"Florida",value:"FL"},{label:"Georgia",value:"GA"},{label:"Hawaii",value:"HI"},{label:"Idaho",value:"ID"},{label:"Illinois",value:"IL"},{label:"Indiana",value:"IN"},{label:"Iowa",value:"IA"},{label:"Kansas",value:"KS"},{label:"Kentucky",value:"KY"},{label:"Louisiana",value:"LA"},{label:"Maine",value:"ME"},{label:"Maryland",value:"MD"},{label:"Massachusetts",value:"MA"},{label:"Michigan",value:"MI"},{label:"Minnesota",value:"MN"},{label:"Mississippi",value:"MS"},{label:"Missouri",value:"MO"},{label:"Montana",value:"MT"},{label:"Nebraska",value:"NE"},{label:"Nevada",value:"NV"},{label:"New Hampshire",value:"NH"},{label:"New Jersey",value:"NJ"},{label:"New Mexico",value:"NM"},{label:"New York",value:"NY"},{label:"North Carolina",value:"NC"},{label:"North Dakota",value:"ND"},{label:"Ohio",value:"OH"},{label:"Oklahoma",value:"OK"},{label:"Oregon",value:"OR"},{label:"Pennsylvania",value:"PA"},{label:"Rhode Island",value:"RI"},{label:"South Carolina",value:"SC"},{label:"South Dakota",value:"SD"},{label:"Tennessee",value:"TN"},{label:"Texas",value:"TX"},{label:"Utah",value:"UT"},{label:"Vermont",value:"VT"},{label:"Virginia",value:"VA"},{label:"Washington",value:"WA"},{label:"West Virginia",value:"WV"},{label:"Wisconsin",value:"WI"},{label:"Wyoming",value:"WY"}];function ye(e){if(e&&typeof e=="object"&&"value"in e){const t=e.value;return typeof t=="string"?t:String(t??"")}return""}function Ze(){const e=n.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...b)=>{e.address1=ye(b[0])},onAddress2Input:(...b)=>{e.address2=ye(b[0])},onCityInput:(...b)=>{e.city=ye(b[0])},onStateChange:b=>{e.state=b.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function je(e,t="zip"){const o=Me({id:t}),{zipDisplay:u,zipRaw:l,isZipValid:d,wrapperClass:b,handleZipInput:k}=o;return n.watch(l,N=>{e.zip=N}),{zipDisplay:u,isZipValid:d,zipWrapperClass:b,onZipInput:k,resetZip:()=>{u.value="",e.zip=""}}}function Ge(e){const t=n.computed(()=>e.formData.address1.trim()!==""),o=n.computed(()=>e.formData.city.trim()!==""),u=n.computed(()=>!!e.formData.state),l=n.computed(()=>n.toValue(e.isZipValid)),d=n.computed(()=>t.value&&o.value&&u.value&&l.value);return{strictAddress1Valid:t,strictCityValid:o,strictStateValid:u,strictZipValid:l,strictAddressValid:d}}function Je(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Qe(e,t){const o=e??t.currentTarget,u=t.relatedTarget;return!o||!o.contains(u)}function et(e){const t=n.ref(n.toValue(e.fieldsetRef));n.watchEffect(()=>{t.value=n.toValue(e.fieldsetRef)});const o=n.ref(!1),u=n.ref(!1),l=n.computed(()=>n.toValue(e.required)??!0),{formData:d,onAddress1Input:b,onAddress2Input:k,onCityInput:P,onStateChange:N,resetFormData:x}=Ze(),R=`${e.addressId}-zip`,{zipDisplay:T,isZipValid:D,zipWrapperClass:V,onZipInput:p,resetZip:c}=je(d,R),{strictAddress1Valid:v,strictCityValid:M,strictStateValid:O,strictZipValid:W,strictAddressValid:H}=Ge({formData:d,isZipValid:D}),_=Ce(t,{submitted:o,isValid:()=>H.value}),{touched:F,fieldsetValidate:a,onFocusout:h,reset:g}=_,A=_.createFieldValidationsMap({address1:v,city:M,state:O,zip:W,address:H}),{address1:I,city:E,state:L,zip:K,address:X}=A,ee=n.computed(()=>l.value?a.value:!1),oe=n.computed(()=>l.value?I.value:!0),i=n.computed(()=>l.value?E.value:!0),S=n.computed(()=>l.value?L.value:!0),q=n.computed(()=>l.value?K.value:!0),m=n.computed(()=>l.value?X.value:!0),w={value:null,label:"State"},z=_e.map(({label:y,value:$})=>({label:y,value:$})),r=n.computed(()=>({address1:d.address1.trim(),address2:d.address2.trim(),city:d.city.trim(),state:(d.state??"").trim().toUpperCase(),zip:d.zip.replace(/\D/g,"")})),f=n.computed(()=>d.address1.trim()===""&&d.address2.trim()===""&&d.city.trim()===""&&(d.state??"").trim()===""&&d.zip.replace(/\D/g,"")===""),C=n.computed(()=>!f.value),U=n.computed(()=>!l.value&&C.value&&(!v.value||!M.value||!O.value)),B=n.computed(()=>{const y=d.zip.replace(/\D/g,"");return!l.value&&C.value&&y.length!==5&&y.length!==9}),J=n.computed(()=>!l.value&&C.value&&!H.value),Z=n.computed(()=>!l.value&&J.value&&(u.value||o.value));return n.watch(r,()=>{l.value||(u.value=!1)}),n.watch(l,y=>{y||(o.value=!1,u.value=!1,g())}),{formData:d,submitted:o,touched:F,addressValidate:ee,address1Valid:oe,cityValid:i,stateValid:S,zipValid:q,addressValid:m,optionalFeedbackActive:Z,optionalPartialInvalid:J,optionalMissingRequiredFields:U,optionalZipInvalid:B,stateDefaultItem:w,stateOptions:z,zipDisplay:T,zipWrapperClass:V,onAddress1Input:b,onAddress2Input:k,onCityInput:P,onStateChange:N,onZipInput:p,onFieldsetFocusout:y=>{const $=Qe(t.value,y);h(y),!l.value&&$&&(u.value=!0)},normalizedPayload:r,validateForSubmit:async()=>l.value?(o.value=!0,H.value?{isValid:!0,payload:r.value}:(await n.nextTick(),Je(t.value),{isValid:!1,payload:null})):f.value||H.value?(o.value=!1,{isValid:!0,payload:r.value}):(o.value=!0,{isValid:!1,payload:null}),reset:()=>{o.value=!1,u.value=!1,g(),x(),c()}}}const Re=e=>e==="left"?"right":e==="right"?"left":"center",Fe=e=>e==="top"?"bottom":e==="bottom"?"top":"center",we=(e,t,o,u)=>{const l=e.left+(o.horizontal==="right"?e.width:o.horizontal==="center"?e.width/2:0),d=e.top+(o.vertical==="bottom"?e.height:o.vertical==="center"?e.height/2:0),b=t?u.horizontal==="right"?t.width:u.horizontal==="center"?t.width/2:0:0,k=t?u.vertical==="bottom"?t.height:u.vertical==="center"?t.height/2:0:0;return{left:l-b,top:d-k}},Pe=(e,t,o,u)=>t>=u-o?o:Math.min(Math.max(e,o),u-t),Le=({anchor:e,popup:t,anchorAlign:o,popupAlign:u,bounds:l,collision:d})=>{const b=we(e,t,o,u);if(!t)return b;let{left:k,top:P}=b;if(d.horizontal==="fit")k=Pe(k,t.width,l.left,l.right);else{const N=k+t.width-l.right,x=l.left-k;if(N>0||x>0){const R=we(e,t,{horizontal:Re(o.horizontal),vertical:o.vertical},{horizontal:Re(u.horizontal),vertical:u.vertical}),T=Math.max(N,0)+Math.max(x,0);Math.max(R.left+t.width-l.right,0)+Math.max(l.left-R.left,0)<T&&(k=R.left)}}if(d.vertical==="fit")P=Pe(P,t.height,l.top,l.bottom);else{const N=P+t.height-l.bottom,x=l.top-P;if(N>0||x>0){const R=we(e,t,{horizontal:o.horizontal,vertical:Fe(o.vertical)},{horizontal:u.horizontal,vertical:Fe(u.vertical)}),T=Math.max(N,0)+Math.max(x,0);Math.max(R.top+t.height-l.bottom,0)+Math.max(l.top-R.top,0)<T&&(P=R.top)}}return{left:k,top:P}},tt=(e="fkid")=>{const t=`${e}-${n.useId()}`;return{instanceId:t,compose:(...u)=>[t,...u].filter(l=>l!=null).map(String).join("-")}},nt=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ot=Object.prototype.toString,rt=e=>ot.call(e)==="[object Object]",he=()=>{};function be(e){return Array.isArray(e)?e:[e]}function at(e,t,o){return n.watch(e,t,{...o,immediate:!0})}const $e=nt?window:void 0;function me(e){var t;const o=n.toValue(e);return(t=o?.$el)!==null&&t!==void 0?t:o}function Se(...e){const t=(u,l,d,b)=>(u.addEventListener(l,d,b),()=>u.removeEventListener(l,d,b)),o=n.computed(()=>{const u=be(n.toValue(e[0])).filter(l=>l!=null);return u.every(l=>typeof l!="string")?u:void 0});return at(()=>{var u,l;return[(u=(l=o.value)===null||l===void 0?void 0:l.map(d=>me(d)))!==null&&u!==void 0?u:[$e].filter(d=>d!=null),be(n.toValue(o.value?e[1]:e[0])),be(n.unref(o.value?e[2]:e[1])),n.toValue(o.value?e[3]:e[2])]},([u,l,d,b],k,P)=>{if(!u?.length||!l?.length||!d?.length)return;const N=rt(b)?{...b}:b,x=u.flatMap(R=>l.flatMap(T=>d.map(D=>t(R,T,D,N))));P(()=>{x.forEach(R=>R())})},{flush:"post"})}function Ve(e,t,o={}){const{window:u=$e,ignore:l=[],capture:d=!0,detectIframe:b=!1,controls:k=!1}=o;if(!u)return k?{stop:he,cancel:he,trigger:he}:he;let P=!0;const N=c=>n.toValue(l).some(v=>{if(typeof v=="string")return Array.from(u.document.querySelectorAll(v)).some(M=>M===c.target||c.composedPath().includes(M));{const M=me(v);return M&&(c.target===M||c.composedPath().includes(M))}});function x(c){const v=n.toValue(c);return v&&v.$.subTree.shapeFlag===16}function R(c,v){const M=n.toValue(c),O=M.$.subTree&&M.$.subTree.children;return O==null||!Array.isArray(O)?!1:O.some(W=>W.el===v.target||v.composedPath().includes(W.el))}const T=c=>{const v=me(e);if(c.target!=null&&!(!(v instanceof Element)&&x(e)&&R(e,c))&&!(!v||v===c.target||c.composedPath().includes(v))){if("detail"in c&&c.detail===0&&(P=!N(c)),!P){P=!0;return}t(c)}};let D=!1;const V=[Se(u,"click",c=>{D||(D=!0,setTimeout(()=>{D=!1},0),T(c))},{passive:!0,capture:d}),Se(u,"pointerdown",c=>{const v=me(e);P=!N(c)&&!!(v&&!c.composedPath().includes(v))},{passive:!0}),b&&Se(u,"blur",c=>{setTimeout(()=>{const v=me(e);let M=u.document.activeElement;for(;M?.shadowRoot;)M=M.shadowRoot.activeElement;M?.tagName==="IFRAME"&&!v?.contains(u.document.activeElement)&&t(c)},0)},{passive:!0})].filter(Boolean),p=()=>V.forEach(c=>c());return k?{stop:p,cancel:()=>{P=!1},trigger:c=>{P=!0,T(c),P=!1}}:p}const Oe=e=>{let t=null;const o=()=>{t?.disconnect(),t=null};return typeof window<"u"&&typeof window.IntersectionObserver=="function"&&n.watch([e.target,()=>e.root()],([l,d])=>{o(),l&&(t=new IntersectionObserver(([b])=>{b&&e.onChange(b)},{root:d,threshold:e.threshold??1}),t.observe(l))},{immediate:!0}),n.onUnmounted(o),{disconnect:o}},lt=".k-table-row",ue=e=>{if(e instanceof HTMLElement)return e;const t=e?.$el;return t instanceof HTMLElement?t:null},it=(e,t)=>t==="row"?e.matches("tr.k-table-row"):!e.matches("tr.k-table-row"),st=(e,t)=>{console.warn(`usePopupMenu: triggerMode "${t}" does not match resolved element <${e.tagName.toLowerCase()}${e.className?`.${e.className.split(" ").join(".")}`:""}>; ARIA management skipped.`)},ct=e=>{let t=e.parentElement,o=null;for(;t;){const{overflow:u,overflowX:l,overflowY:d}=window.getComputedStyle(t),b=/auto|scroll|overlay/.test(`${u} ${l}`),k=/auto|scroll|overlay/.test(`${u} ${d}`);if((b||k)&&(o??=t),b&&t.scrollWidth>t.clientWidth||k&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return o},ut=e=>{const t=n.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",u=e.triggerMode,l=e.anchor===!0?{}:e.anchor,d=l?.activationPoint?l.activationPoint===!0?{}:l.activationPoint:null,b=n.shallowRef(null),k=n.shallowRef(null),P=l?.anchorAlign??{horizontal:"left",vertical:"bottom"},N=l?.popupAlign??{horizontal:"left",vertical:"top"},x=l?.collision??{horizontal:"flip",vertical:"flip"},R=n.shallowRef(null),T=()=>ue(e.triggerRef.value),D=n.computed(()=>T()),V=n.computed(()=>l&&l.hideWhenAnchorClipped!==!1?D.value:null),p=()=>{const m=l?.clipRoot?n.toValue(l.clipRoot):null;if(m){const w=m.getBoundingClientRect();return{left:w.left,top:w.top,right:w.right,bottom:w.bottom}}return{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},c=n.computed(()=>{const m=b.value;if(!e.isOpen.value||!m)return{left:0,top:0};const w=p(),z=Le({anchor:m,popup:R.value,anchorAlign:P,popupAlign:N,bounds:w,collision:x});return{left:z.left+window.scrollX,top:z.top+window.scrollY}}),v=()=>{const m=e.resolveFocusTarget?.()??ue(e.focusTargetRef?.value);return m||(e.focusTargetContainerSelector?T()?.closest(e.focusTargetContainerSelector)??null:null)},M=(m,w)=>{if(!d)return!1;const z=ue(m);if(!z)return k.value=null,!1;const r=z.getBoundingClientRect();if(w.triggerType==="keyboard"){const f=d.keyboardPosition,C=f?.y??"center",U=typeof C=="number"?C:C==="top"?0:C==="bottom"?r.height:r.height/2;return k.value={trigger:z,point:{x:f?.x??8,y:U},hasMatchedTrigger:!1},!0}return w.coordinates?(k.value={trigger:z,point:{x:w.coordinates.clientX-r.left+(d.pointerOffset?.x??0),y:w.coordinates.clientY-r.top+(d.pointerOffset?.y??0)},hasMatchedTrigger:!1},!0):(k.value=null,!1)},O=()=>{if(u!=="button")return null;if(e.escapeFocusTarget)return e.escapeFocusTarget();const m=e.escapeFocusContainerSelector??lt;return(T()??document.activeElement)?.closest(m)??null},W=()=>{const m=v()??O();if(m)return m.focus(),!0;const w=T();return w?.focus(),!!w},H=()=>{ue(e.menuRef.value)?.querySelector(o)?.focus({preventScroll:!0})},_=n.shallowRef(null),F=n.shallowRef(null);let a=!1;const h=()=>{const m=t.value;if(m==="keyboard"||m==="escape"){const w=_.value??F.value;w?.focus(),m==="keyboard"&&w&&w===F.value&&(a=!0)}else t.value==="mouse-selection"&&F.value?.focus();t.value=null,_.value=null,F.value=null},g=m=>{e.isOpen.value&&(t.value=m,_.value=v()??(m==="escape"?O():null),F.value=T(),K(!1),e.requestHide(),n.nextTick(h))};n.watch([D,k],([m],w,z)=>{if(!l||!m){b.value=null;return}let r=null;const f=()=>{r=null;const B=k.value;if(d){B&&B.trigger===m?B.hasMatchedTrigger=!0:B?.hasMatchedTrigger&&(B.trigger=m);const J=m.getBoundingClientRect();b.value=B?.trigger===m?new DOMRect(J.left+B.point.x,J.top+B.point.y,0,0):null;return}b.value=l.getRect?.(m)??m.getBoundingClientRect()},C=()=>{r===null&&(r=window.requestAnimationFrame(f))},U=typeof window.ResizeObserver=="function"?new window.ResizeObserver(C):null;U?.observe(m),window.addEventListener("scroll",C,{capture:!0,passive:!0}),window.addEventListener("resize",C,{passive:!0}),C(),z(()=>{r!==null&&window.cancelAnimationFrame(r),U?.disconnect(),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)})},{immediate:!0,flush:"post"});const A=()=>{const m=ue(e.popupContentRef?.value??e.menuRef.value);return m?.closest(".k-popup")??m};l&&n.watch(e.isOpen,(m,w,z)=>{if(!m){R.value=null;return}let r=null;const f=()=>{r=null;const J=A();R.value=J?.getBoundingClientRect()??null},C=()=>{r===null&&(r=window.requestAnimationFrame(f))},U=A(),B=U&&typeof window.ResizeObserver=="function"?new window.ResizeObserver(C):null;B?.observe(U),C(),z(()=>{r!==null&&window.cancelAnimationFrame(r),B?.disconnect()})},{immediate:!0,flush:"post"}),Oe({target:V,root:()=>l?.clipRoot?n.toValue(l.clipRoot):D.value?ct(D.value):null,threshold:l?.intersectionThreshold??(d?0:.5),onChange:m=>{m.isIntersecting||g("anchor-hidden")}}),Ve(e.menuRef,()=>g("outside-click"),{ignore:[D]});let I=null,E=null;const L=()=>{I?.isConnected&&I.setAttribute("aria-expanded","false"),I=null},K=m=>{if(e.manageMenuTriggerAria===!1)return;const w=D.value;if(!w){I?.isConnected&&I.setAttribute("aria-expanded",m?"true":"false");return}if(!it(w,u)){st(w,u),L();return}I&&I!==w&&L(),w.setAttribute("aria-expanded",m?"true":"false"),I=w},X=()=>{const m=ue(e.menuRef.value),w=m?.matches('[role="menubar"]')?m:m?.querySelector('[role="menubar"]'),z=n.toValue(e.menuLabel)?.trim();E&&E!==w&&E.removeAttribute("aria-label"),w&&(z?w.setAttribute("aria-label",z):w.removeAttribute("aria-label")),E=w??null};n.watch([e.isOpen,e.triggerRef],([m])=>{K(m),!m&&d&&(k.value=null,b.value=null)},{immediate:!0,flush:"post"}),n.watch([e.isOpen,e.menuRef,()=>n.toValue(e.menuLabel)],X,{immediate:!0,flush:"post"}),n.onUnmounted(()=>{k.value=null,L(),E?.removeAttribute("aria-label")}),n.watch(e.isOpen,m=>{m&&H()},{flush:"post"});const ee=(...m)=>{const w=m[0];if(a){a=!1;return}if(e.isOpen.value){g("trigger-click");return}e.requestShow(w)};return{setAnchorActivation:M,handleMenuSelect:(m,w)=>{g(m.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),w?.(m)},handleTriggerClick:ee,handleTriggerKeydown:(...m)=>{const w=m[0],z=m[1];if(w.key==="Enter"||w.code==="Space"){w.preventDefault(),ee(z);return}if(w.key==="Escape"){if(w.preventDefault(),w.stopPropagation(),e.isOpen.value){g("escape");return}W()}},handleMenuEscape:m=>{m.preventDefault(),m.stopPropagation(),g("escape")},handlePopupClose:()=>{n.nextTick(h)},offset:c}},dt=()=>{const e=new Set;return{register:l=>{e.add(l),n.onUnmounted(()=>e.delete(l))},deactivateOthers:l=>{e.forEach(d=>{d!==l&&d.deactivate()})},deactivateAll:()=>{e.forEach(l=>l.deactivate())}}},ft=e=>{if(e instanceof HTMLElement)return e;const t=e&&"$el"in e?e.$el:null;return t instanceof HTMLElement?t:null},pt=()=>{const e=n.shallowReactive(new Map),t=n.ref(null),o=(k,P)=>{const N=ft(P);N?e.set(k,N):e.delete(k)},u=k=>e.get(k)??null,l=k=>{t.value=k},d=()=>{t.value=null},b=k=>t.value===k;return{activeId:n.readonly(t),isActive:n.computed(()=>t.value!==null),activeElement:n.computed(()=>t.value!==null?u(t.value):null),register:o,resolve:u,activate:l,deactivate:d,isIdActive:b}},ke={title:"My Window",draggable:!0,resizable:!0,closable:!0,fixed:!0,minimizeButton:!0,maximizeButton:!0,initialWidth:500,initialHeight:500,width:500,height:500,left:void 0,top:void 0},mt=e=>e==="DEFAULT"||e==="MINIMIZED"||e==="FULLSCREEN",gt=(e,t,o)=>Math.max(e-t-o,0);function ht(e={}){n.isRef(e.settings)&&(e.settings.value={...ke,...e.settings.value});const t=n.isRef(e.settings)?e.settings:n.ref({...ke,...e.settings}),o=n.shallowRef(null),u=n.ref(!1),l=n.ref(e.initialStage??"DEFAULT"),d=n.ref(!1),b=n.ref(!1),k=n.ref(0),P=n.ref(0),N=async F=>{const a=t.value.left!==void 0&&t.value.top!==void 0;if(F?.resetPosition||!a){const h=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize),g=Number.isFinite(h)?h:16,A=t.value.fixed?0:window.scrollX,I=t.value.fixed?0:window.scrollY;t.value.left=void 0,t.value.top=void 0,t.value.width=void 0,t.value.height=void 0,k.value=A+gt(window.innerWidth,t.value.initialWidth,g),P.value=I+g,u.value=!0,await n.nextTick(),t.value.width=t.value.initialWidth,t.value.height=t.value.initialHeight}else u.value=!0;e.onOpen?.()},x=()=>{l.value="DEFAULT",u.value=!1,e.onClose?.()},R=(...F)=>{const a=F[2];if(typeof a!="object"||a===null||!("state"in a)||!mt(a.state))return;const h=a.state;h!==l.value&&(l.value=h,e.onStageChange?.(h))},T=(...F)=>{const a=F[0];if(typeof a=="object"&&a!==null&&"drag"in a&&"left"in a&&"top"in a&&"width"in a&&"height"in a&&typeof a.left=="number"&&typeof a.top=="number"&&typeof a.width=="number"&&typeof a.height=="number"){const h=a,g=o.value?.$el,I=(g instanceof Element?g.querySelector(".k-window-titlebar"):null)?.getBoundingClientRect(),E=I?.width??h.width,L=I?.height??h.height,K=t.value.fixed?0:window.scrollX,X=t.value.fixed?0:window.scrollY,ee=K+document.documentElement.clientWidth,oe=X+document.documentElement.clientHeight,i=Math.max(ee-E,K),S=Math.max(oe-L,X);t.value.left=Math.min(Math.max(h.left,K),i),t.value.top=Math.min(Math.max(h.top,X),S),d.value=h.drag&&!h.end,e.onMove?.(h)}},D=(...F)=>{const a=F[0];if(typeof a=="object"&&a!==null&&"drag"in a&&"left"in a&&"top"in a&&"width"in a&&"height"in a&&typeof a.left=="number"&&typeof a.top=="number"&&typeof a.width=="number"&&typeof a.height=="number"){const h=a;t.value.left=h.left,t.value.top=h.top,t.value.width=h.width,t.value.height=h.height,b.value=h.drag&&!h.end,e.onResize?.(h)}},V=F=>{F.target instanceof Element&&F.target.closest(".k-resize-handle")&&F.preventDefault()},p=F=>{n.toValue(e.titlebarDoubleClick)===!1&&F.target instanceof Element&&F.target.closest(".k-window-titlebar")&&(F.preventDefault(),F.stopPropagation())};let c,v;const M=()=>{c?.(),c=void 0},O=()=>{v?.(),v=void 0};n.watch(o,F=>{M(),O();const a=F?.$el;a instanceof HTMLElement&&(a.addEventListener("pointerdown",V,{capture:!0}),c=()=>a.removeEventListener("pointerdown",V,{capture:!0}),a.addEventListener("dblclick",p,{capture:!0}),v=()=>a.removeEventListener("dblclick",p,{capture:!0}))},{flush:"post"}),n.onScopeDispose(M),n.onScopeDispose(O);const W=n.computed(()=>{const F=["fk-window"];return t.value.draggable&&l.value!=="FULLSCREEN"&&F.push("fk-window-can-drag"),d.value&&F.push("fk-window-is-dragging"),b.value&&F.push("fk-window-is-resizing"),t.value.fixed&&F.push("fk-window-fixed"),t.value.minimizeButton||F.push("fk-window-hide-minimize"),t.value.maximizeButton||F.push("fk-window-hide-maximize"),t.value.closable||F.push("fk-window-hide-close"),F.join(" ")}),H=n.computed(()=>({title:t.value.title,draggable:t.value.draggable,resizable:t.value.resizable,left:t.value.left,top:t.value.top,initialLeft:k.value,initialTop:P.value,initialWidth:t.value.initialWidth,initialHeight:t.value.initialHeight,width:t.value.width,height:t.value.height,stage:l.value,windowClass:W.value}));return{windowRef:o,settings:t,visible:u,stage:l,isDragging:d,isResizing:b,props:H,events:{move:T,resize:D,stagechange:R,close:x},open:N,close:x}}function vt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),l=n.ref(e.dateFormat??"mm/dd/yyyy"),d=n.computed(()=>!!e.required),b=1e3,k=n.ref(!1),P=["ArrowUp","ArrowDown"],N=["ArrowLeft","ArrowRight"],x=n.computed(()=>(t.value??"").replace(/\D/g,"")),R=i=>i<=2?"mm":i<=5?"dd":x.value.length<=10?"yyyy":"mm",T=n.computed(()=>{const i=t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(i).toString().padStart(2,"0")}),D=n.computed(()=>{const i=t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(i).toString().padStart(2,"0")}),V=n.computed(()=>{const i=t.value&&t.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(i).toString().padStart(4,"0")}),p=i=>{if(x.value.length===0){e.onChange({value:null,event:i});return}if(x.value.length<8){e.onChange({value:null,event:i});return}if((t.value??"").length===10&&x.value.length===8){const[S,q,m]=t.value.split("/"),w=parseInt(S),z=parseInt(q),r=parseInt(m);if(H(r,w,z)){const f=O(r,w,z);c(f)?e.onChange({value:f,event:i}):e.onChange({value:null,event:i})}else e.onChange({value:null,event:i})}},c=i=>{const S=e.min??void 0,q=e.max??void 0;return!(S&&i<S||q&&i>q)},v=n.computed(()=>{if((t.value??"").length===10&&x.value.length===8){const[i,S,q]=(t.value??"").split("/"),m=parseInt(i),w=parseInt(S),z=parseInt(q);if(H(z,m,w))return O(z,m,w)}return null}),M=n.computed(()=>(t.value??"").length===10&&x.value.length===8),O=(i,S,q)=>{const m=new Date(0);return m.setFullYear(i,S-1,q),m.setHours(0,0,0,0),m},W=(i,S)=>O(i,S+1,0).getDate(),H=(i,S,q)=>S>=1&&S<=12&&i>=b&&q>=1&&q<=W(i,S),_=i=>{t.value=i.value;const S=i.event?.target;o.value=S?.selectionStart??0,p(i)},F=i=>{o.value=i.target.selectionStart??0},a=(i,S,q)=>{const m=S?.selectionStart??o.value??0;o.value=m;let w=parseInt(T.value),z=parseInt(D.value),r=parseInt(V.value);if(!(x.value.length>=8)||!H(r,w,z)){const G=e.defaultValue??new Date;w=G.getMonth()+1,z=G.getDate(),r=G.getFullYear(),t.value=`${String(w).padStart(2,"0")}/${String(z).padStart(2,"0")}/${String(r)}`;const le=O(r,w,z);e.onChange({value:c(le)?le:null,event:q}),E({useRAF:!0});return}const C=R(m);if(C==="mm")w=i==="ArrowUp"?w<12?w+1:1:w>1?w-1:12;else if(C==="dd"){const G=new Date(r,w,0).getDate();z=i==="ArrowUp"?z<G?z+1:1:z>1?z-1:G}else C==="yyyy"&&(r=i==="ArrowUp"?r+1:Math.max(1,r-1));t.value=`${String(w).padStart(2,"0")}/${String(z).padStart(2,"0")}/${String(r)}`;const[U,B,J]=t.value.split("/"),Z=O(parseInt(J),parseInt(U),parseInt(B));Z.toString()!=="Invalid Date"&&parseInt(J)>=1e3?e.onChange({value:c(Z)?Z:null,event:q}):e.onChange({value:null,event:q}),E({useRAF:!0})},h=i=>{if(i.code==="Space"||i.key===" "){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(i.key==="ArrowDown"&&i.altKey){i.preventDefault(),i.stopPropagation(),e.onShowCalendar(i);return}if(P.includes(i.key)){if(i.altKey)return;i.preventDefault(),i.stopPropagation();const S=i.target;a(i.key,S,i);return}},g=i=>{i.preventDefault();const S=i.deltaY<0?"ArrowUp":"ArrowDown";a(S,i.target,i)},A=i=>{const S=i.target;if(N.includes(i.key)){o.value=S?.selectionStart??0;return}if(P.includes(i.key)){if(i.altKey)return;o.value=S?.selectionStart??0}},I=i=>{k.value=!0,d.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&x.value.length===0&&(e.externalValue.value="");const S=i.target;S&&(o.value=S.selectionStart??0)},E=i=>{const S=()=>{const q=document.getElementById(e.id);if(!q)return;const m=i?.pos??o.value??q.value.length;try{q.focus(),q.setSelectionRange(m,m)}catch{}};n.nextTick(()=>{if(i?.delay&&i.delay>0){setTimeout(S,i.delay);return}if(i?.useRAF){requestAnimationFrame(S);return}S()})};e.externalValue&&n.watch(e.externalValue,i=>{if(i){const S=new Date(i);if(S.toString()!=="Invalid Date"){const q=(S.getMonth()+1).toString().padStart(2,"0"),m=S.getDate().toString().padStart(2,"0"),w=S.getFullYear().toString();t.value=`${q}/${m}/${w}`,E({delay:50});return}}},{immediate:!0});const L=n.computed(()=>[["Date",`${T.value} / ${D.value} / ${V.value}`],["Digits only",x.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),K=n.computed(()=>{if(!d.value){if(!M.value)return!0;const S=v.value;return S?c(S):!1}if(!k.value)return!0;const i=v.value;return!M.value||!i?!1:c(i)}),X=n.computed(()=>{if(!d.value){if(!M.value)return;const S=v.value;return S?c(S)?"valid":"out-of-bounds":"invalid-date"}if(!k.value)return;if(x.value.length===0||!M.value)return"incomplete";const i=v.value;return i?c(i)?"valid":"out-of-bounds":"invalid-date"}),ee=n.computed(()=>{const i=X.value;if(!i||i==="valid")return"";if(i==="incomplete")return"Required";if(i==="invalid-date")return`Must be in ${l.value} format.`;const S=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,q=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(i==="out-of-bounds"){if(S&&q)return`Must be between ${S} and ${q}.`;if(S)return`Must be on or after ${S}.`;if(q)return`Must be on or before ${q}.`}return""}),oe=()=>{n.nextTick(()=>{const i=document.getElementById(e.id);if(!i){console.warn(`ID (#${e.id}) not found for styling.`);return}const S=i.closest(".k-datepicker");if(!S){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const q=S.parentElement;if(q){if(q.classList.contains("fk-datepicker"))return;q.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return n.onMounted(()=>{oe()}),{raw:t,cursorPos:o,debugEnabled:u,debugLines:L,placeholder:l,isValid:K,reason:n.readonly(X),validationMessage:ee,digitsOnly:x,month:n.readonly(T),day:n.readonly(D),year:n.readonly(V),datePart:R,handleChange:_,handleKeyDown:h,handleWheel:g,handleKeyUp:A,handleClick:F,handleBlur:I,initStyling:oe}}function yt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),l=n.ref(!1),d=1440*60*1e3,b=365*d,k=new Date,P=new Date(k.getTime()-b),N=new Date(k.getTime()+b);e.min=e.min??P,e.max=e.max??N;const x=n.computed(()=>(t.value??"").replace(/\D/g,"")),R=(s,y)=>new Date(s,y,0).getDate(),T=(s,y,$)=>y>=1&&y<=12&&s>=1e3&&$>=1&&$<=R(s,y),D=s=>Date.UTC(s.getFullYear(),s.getMonth(),s.getDate()),V=s=>{if(!s)return null;const y=e.min??new Date(Date.now()-90*d),$=e.max??new Date,Y=D(s);return Y<D(y)||Y>D($)?null:s},p=(s,y)=>e.allowReverse??!1?!0:s<=y,c=n.computed(()=>(t.value?.length??0)>=23&&x.value.length>=16),v=s=>{if((s??"").length<23||x.value.length<16)return{start:null,end:null};const y=s.substring(0,10),$=s.substring(13,23),[Y,te,ne]=y.split("/").map(ce=>parseInt(ce||"0",10)),[se,de,fe]=$.split("/").map(ce=>parseInt(ce||"0",10)),pe=new Date(ne,Y-1,te),ge=new Date(fe,se-1,de),Ae=T(ne,Y,te)&&pe.toString()!=="Invalid Date",De=T(fe,se,de)&&ge.toString()!=="Invalid Date";return{start:Ae?pe:null,end:De?ge:null}},M=e.externalValid??n.ref(!0),O=n.computed(()=>v(t.value)),W=n.computed(()=>{const s=V(O.value.start),y=V(O.value.end);return{start:s,end:y}}),H=n.computed(()=>{if(!c.value)return;const s=W.value.start,y=W.value.end;if(!s||!y)return;const $=Math.abs(D(y)-D(s));return Math.round($/864e5+1)}),_=n.ref(!1),F=n.computed(()=>{if(!_.value)return;const{start:s,end:y}=O.value;if(!c.value)return"incomplete";if(!s||!y)return"invalid-date";if(!W.value.start||!W.value.end)return"out-of-bounds";const $=W.value.start,Y=W.value.end;return p($,Y)?typeof e.maxSpanDays=="number"&&H.value!==void 0&&H.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),a=n.computed(()=>{const s=F.value;return s===void 0||s==="valid"}),h=n.computed(()=>{const{min:s,max:y}=e,$=F.value;if(!$)return"";switch($){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return s&&y?`Dates must be between ${E(s)} and ${E(y)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";default:return""}}),g=["ArrowUp","ArrowDown"],A=["ArrowLeft","ArrowRight"],I=(s,y)=>String(s).padStart(y,"0"),E=s=>`${I(s.getMonth()+1,2)}/${I(s.getDate(),2)}/${I(s.getFullYear(),4)}`,L=s=>s<=2?{side:"start",part:"mm"}:s<=5?{side:"start",part:(s<=3,"dd")}:s<=11?{side:"start",part:"yyyy"}:s<=15?{side:"end",part:"mm"}:s<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},K=(s,y,$)=>{const Y=y?.selectionStart??o.value??0;o.value=Y;const{start:te,end:ne}=v(t.value);if(!te&&!ne){const Q=new Date,ie=E(Q);t.value=`${ie} - ${ie}`,e.onChange({value:{start:Q,end:Q},event:$}),n.nextTick(()=>{requestAnimationFrame(()=>{const re=document.getElementById(e.id),ae=o.value??0;re&&(re.focus(),re.setSelectionRange(ae,ae))})});return}const se=new Date,de=L(Y);let fe=te?new Date(te):new Date(se),pe=ne?new Date(ne):new Date(se);const ge=(Q,ie)=>{if(ie==="mm"){const re=Q.getMonth()+1,ae=s==="ArrowUp"?re<12?re+1:1:re>1?re-1:12;Q.setMonth(ae-1);const ve=R(Q.getFullYear(),ae);Q.getDate()>ve&&Q.setDate(ve)}else if(ie==="dd"){const re=R(Q.getFullYear(),Q.getMonth()+1),ae=Q.getDate(),ve=s==="ArrowUp"?ae<re?ae+1:1:ae>1?ae-1:re;Q.setDate(ve)}else if(ie==="yyyy"){const re=Q.getFullYear();Q.setFullYear(s==="ArrowUp"?re+1:Math.max(1,re-1));const ae=R(Q.getFullYear(),Q.getMonth()+1);Q.getDate()>ae&&Q.setDate(ae)}};de.side==="start"?ge(fe,de.part):ge(pe,de.part);const Ae=E(fe),De=E(pe);t.value=`${Ae} - ${De}`;const ce=V(fe),Ee=V(pe);ce&&Ee&&p(ce,Ee)?e.onChange({value:{start:ce,end:Ee},event:$}):e.onChange({value:null,event:$}),n.nextTick(()=>{requestAnimationFrame(()=>{const Q=document.getElementById(e.id),ie=o.value??0;Q&&(Q.focus(),Q.setSelectionRange(ie,ie))})})},X=s=>{const{start:y,end:$}=v(t.value);if(!y||!$){e.onChange({value:null,event:s});return}const Y=V(y),te=V($);if(!Y||!te){e.onChange({value:null,event:s});return}if(!p(Y,te)){e.onChange({value:null,event:s});return}e.onChange({value:{start:Y,end:te},event:s})},ee=s=>{const y=s.value??"",$=s.event;if(!y&&$&&$.type==="click"){z($);return}t.value=y;const Y=$?.target;o.value=Y?.selectionStart??0,X(s)},oe=s=>{o.value=s.target.selectionStart??0},i=s=>{if(s.code==="Space"||s.key===" "){s.preventDefault(),s.stopPropagation(),e.onShowCalendar(s);return}if(s.key==="ArrowDown"&&s.altKey){s.preventDefault(),s.stopPropagation(),e.onShowCalendar(s);return}if(g.includes(s.key)){s.preventDefault(),s.stopPropagation();const y=s.target;K(s.key,y,s);return}},S=s=>{s.preventDefault();const y=s.deltaY<0?"ArrowUp":"ArrowDown";K(y,s.target,s)},q=s=>{if(A.includes(s.key)||g.includes(s.key)){const y=s.target;o.value=y?.selectionStart??0}},m=()=>{_.value=!0,(e.manageValid??!0)&&(M.value=a.value)},w=s=>{m()},z=s=>{t.value="",o.value=0,e.onChange({value:null,event:s}),m(),n.nextTick(()=>{const y=document.getElementById(e.id);y&&(y.focus(),y.setSelectionRange(0,0))})};e.externalValue&&n.watch(e.externalValue,s=>{const y=s?.start??null,$=s?.end??null;if(y&&$){if(t.value=`${E(y)} - ${E($)}`,e.isOpen?.value&&l.value&&e.onRequestClose){const Y=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),l.value=!1,m()},Y)}return}},{immediate:!0});const r=n.computed(()=>t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0"),f=n.computed(()=>t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0"),C=n.computed(()=>t.value&&t.value.substring(6,10).replace(/\D/g,"0")||"0"),U=n.computed(()=>t.value&&t.value.substring(13,15).replace(/\D/g,"0")||"0"),B=n.computed(()=>t.value&&t.value.substring(16,18).replace(/\D/g,"0")||"0"),J=n.computed(()=>t.value&&t.value.substring(19,23).replace(/\D/g,"0")||"0"),Z=n.computed(()=>{const{start:s,end:y}=v(t.value);return[{label:"Raw",value:t.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(r.value).padStart(2,"0")} / ${String(f.value).padStart(2,"0")} / ${String(C.value).padStart(4,"0")}`},{label:"End",value:`${String(U.value).padStart(2,"0")} / ${String(B.value).padStart(2,"0")} / ${String(J.value).padStart(4,"0")}`},{label:"Digits only",value:x.value},{label:"Mask complete",value:`${c.value}`},{label:"Parsed",value:`${s?s.toDateString():"-"} | ${y?y.toDateString():"-"}`},{label:"Valid (managed)",value:`${M.value??"-"}`},{label:"Span (days)",value:`${H.value??"-"}`},{label:"Reason",value:`${F.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const $=o.value??0,Y=L($);return`${Y.side}.${Y.part}`})()})`}]}),G=()=>{n.nextTick(()=>{const s=document.getElementById(e.id);if(!s){console.warn(`#${e.id} not found for styling.`);return}const y=s.closest("div");if(!y){console.warn(`Parent div of #${e.id} not found for styling.`);return}y.classList.contains("fk-daterangepicker")||y.classList.add("fk-daterangepicker")})};n.onMounted(()=>{G()});const le=()=>{n.nextTick(()=>{try{const s=Array.from(document.querySelectorAll(".k-animation-container"));if(!s.length)return;const $=[...s].reverse().find(ne=>ne.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!$)return;const Y=$.querySelectorAll(".k-calendar-table");let te=!1;Y.forEach(ne=>{ne.tabIndex===0&&(te?ne.tabIndex=-1:te=!0)})}catch(s){console.warn(s)}})};return e.isOpen&&n.watch(e.isOpen,s=>{s&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:t,cursorPos:o,debugEnabled:u,debugLines:Z,digitsOnly:x,valid:M,validComputed:n.readonly(a),reason:n.readonly(F),validationMessage:n.readonly(h),spanDays:n.readonly(H),month1:n.readonly(r),day1:n.readonly(f),year1:n.readonly(C),month2:n.readonly(U),day2:n.readonly(B),year2:n.readonly(J),handleChange:ee,handleKeyDown:i,handleWheel:S,handleKeyUp:q,handleClick:oe,handleBlur:w,handleClear:z,onCalendarChange:()=>{l.value=!0},initStyling:G}}function wt(e){const t=n.ref(""),o=n.ref(void 0),u=n.ref(!!e.debug),l=n.ref(e.timeFormat??"hh:mm AM"),d=n.computed(()=>!!e.required),b=n.ref(!1),k=["ArrowUp","ArrowDown"],P=["ArrowLeft","ArrowRight"],N=n.computed(()=>(t.value??"").replace(/\D/g,"")),x={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},R=r=>r<=2?"hh":r<=5?"mm":"ampm",T=n.computed(()=>{const r=t.value&&t.value.substring(0,2).replace(/\D/g,"0")||"0",f=parseInt(r);return Math.min(Math.max(f,0),23)}),D=n.computed(()=>{const r=t.value&&t.value.substring(3,5).replace(/\D/g,"0")||"0",f=parseInt(r);return Math.min(Math.max(f,0),59)}),V=n.computed(()=>(t.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),p=n.computed(()=>{const r=parseInt(t.value?.substring(0,2).replace(/\D/g,"0")||"0"),f=V.value;return r===12?f==="AM"?0:12:f==="PM"?r+12:r}),c=n.computed(()=>v.value?`${String(p.value).padStart(2,"0")}:${String(D.value).padStart(2,"0")}:00`:null),v=n.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(t.value??"")),M=(r,f,C)=>{let U=r%12;return U===0&&(U=12),`${String(U).padStart(2,"0")}:${String(f).padStart(2,"0")} ${C}`},O=r=>{const f=r.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!f)return null;const C=parseInt(f[1]),U=parseInt(f[2]),B=f[3].toUpperCase();if(C<1||C>12||U<0||U>59)return null;let J=C%12;B==="PM"&&(J+=12);const Z=new Date;return Z.setSeconds(0,0),Z.setHours(J),Z.setMinutes(U),Z},W=r=>{if(N.value.length===0){e.onChange({value:null,event:r});return}if(!v.value){e.onChange({value:null,event:r});return}const f=O(t.value);f&&_(f)?e.onChange({value:f,event:r}):e.onChange({value:null,event:r})},H=r=>r.getHours()*60+r.getMinutes(),_=r=>{const f=e.min??void 0,C=e.max??void 0,U=H(r);if(f){const B=H(f);if(U<B)return!1}if(C){const B=H(C);if(U>B)return!1}return!0},F=r=>{const f=r.getHours(),C=f>=12?"PM":"AM";t.value=M(f,r.getMinutes(),C)},a=(r,f)=>{e.onChange({value:r,event:f})},h=()=>{n.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const r=document.getElementById(e.id);if(r){r.focus();const f=(r.value??"").length;r.setSelectionRange(f,f)}})})})},g=r=>{const f=r?.event?.target;return f?f.closest(".k-time-now")?"now":f.closest(".k-time-accept")?"set":null:null},A=(r,f)=>{r&&_(r)?a(r,f):a(null,f)},I=(...r)=>{const f=r[0];if(!f)return;const C=g(f);if(C==="now"){const B=new Date;F(B),A(B,f),h();return}if(f?.value instanceof Date){const B=new Date(f.value);F(B),A(B,f),C==="set"&&h();return}if(f?.value===null){t.value="",a(null,f);return}t.value=f.value;const U=f.event?.target;o.value=U?.selectionStart??0;try{const B=o.value??0;if(R(B)==="ampm"&&(t.value??"").length>=8){const J=t.value.charAt(6);/[Aa]/.test(J)?(t.value=`${t.value.slice(0,6)}AM${t.value.slice(8)}`,n.nextTick(()=>{requestAnimationFrame(()=>{const Z=document.getElementById(e.id);Z&&(Z.focus(),Z.setSelectionRange(8,8))})})):/[Pp]/.test(J)&&(t.value=`${t.value.slice(0,6)}PM${t.value.slice(8)}`,n.nextTick(()=>{requestAnimationFrame(()=>{const Z=document.getElementById(e.id);Z&&(Z.focus(),Z.setSelectionRange(8,8))})}))}}catch{}W(f)},E=r=>{o.value=r.target.selectionStart??0},L=(r,f,C)=>{const U=f?.selectionStart??o.value??0;o.value=U;const B=R(U),J=(t.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!J){if((t.value??"").length===0||N.value.length===0){const y=new Date,$=y.getHours(),Y=$>=12?"PM":"AM";t.value=M($,y.getMinutes(),Y);const te=O(t.value);A(te,C),n.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),se=o.value??0;ne&&(ne.focus(),ne.setSelectionRange(se,se))})})}return}let Z=parseInt(J[1]),G=parseInt(J[2]),le=J[3].toUpperCase();if(B==="hh")r==="ArrowUp"?Z=Z<12?Z+1:1:Z=Z>1?Z-1:12;else if(B==="mm"){const y=e.minuteStepRef?.value??e.minuteStep??1;if(y===1)r==="ArrowUp"?G=G<59?G+1:0:G=G>0?G-1:59;else if(r==="ArrowUp"){const $=G%y;let Y=$===0?G+y:G+(y-$);Y>=60&&(Y=0),G=Y}else{const $=G%y;let Y=$===0?G-y:G-$;Y<0&&(Y=60-y),G=Y}}else B==="ampm"&&(le=le==="AM"?"PM":"AM");t.value=`${String(Z).padStart(2,"0")}:${String(G).padStart(2,"0")} ${le}`;const s=O(t.value);A(s,C),n.nextTick(()=>{requestAnimationFrame(()=>{const y=document.getElementById(e.id),$=o.value??0;y&&(y.focus(),y.setSelectionRange($,$))})})},K=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowPicker(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowPicker(r);return}if(k.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const f=r.target;L(r.key,f,r);return}},X=r=>{r.preventDefault();const f=r.deltaY<0?"ArrowUp":"ArrowDown";L(f,r.target,r)},ee=r=>{const f=r.target;if(P.includes(r.key)){o.value=f?.selectionStart??0;return}if(k.includes(r.key)){if(r.altKey)return;o.value=f?.selectionStart??0}},oe=r=>{b.value=!0,d.value&&e.externalValue&&e.externalValue.value===void 0&&N.value.length===0&&(e.externalValue.value="");const f=r.target;f&&(o.value=f.selectionStart??0)};e.externalValue&&n.watch(e.externalValue,r=>{if(r){const f=new Date(r);if(f.toString()!=="Invalid Date"){const C=f.getHours(),U=C>=12?"PM":"AM";t.value=M(C,f.getMinutes(),U);return}}},{immediate:!0});const i=n.computed(()=>[["Time",t.value||"--:-- --"],["Hour (12h)",T.value],["Hour (24h)",p.value],["Minute",D.value],["Period",V.value],["Time (24h)",c.value??"--:--:--"],["Digits only",N.value],["Parsed Date",S.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",q.value],["reason",m.value],["validationMessage",w.value]]),S=n.computed(()=>O(t.value)??null),q=n.computed(()=>{if(!d.value){if(!v.value)return!0;const f=S.value;return f?_(f):!1}if(!b.value)return!0;const r=S.value;return!v.value||!r?!1:_(r)}),m=n.computed(()=>{if(!d.value){if(!v.value)return;const f=S.value;return f?_(f)?"valid":"out-of-bounds":"invalid-time"}if(!b.value)return;if(N.value.length===0||!v.value)return"incomplete";const r=S.value;return r?_(r)?"valid":"out-of-bounds":"invalid-time"}),w=n.computed(()=>{const r=m.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="invalid-time")return`Must be in ${l.value} format.`;const f={hour:"2-digit",minute:"2-digit"},C=e.min?e.min.toLocaleTimeString("en-US",f):null,U=e.max?e.max.toLocaleTimeString("en-US",f):null;if(r==="out-of-bounds"){if(C&&U)return`Must be between ${C} and ${U}.`;if(C)return`Must be ${C} or later.`;if(U)return`Must be ${U} or earlier.`}return""}),z=()=>{n.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const f=r.closest(".k-timepicker");if(!f){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const C=f.parentElement;if(!C){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}C.classList.contains("fk-timepicker")||C.classList.add("fk-timepicker")})};return n.onMounted(()=>{z()}),{raw:t,rules:x,debugEnabled:u,debugLines:i,placeholder:l,isValid:q,reason:n.readonly(m),validationMessage:w,isComplete:v,inRangeTime:_,cursorPos:o,hour:n.readonly(T),hour24:n.readonly(p),minute:n.readonly(D),period:n.readonly(V),time24:n.readonly(c),parsedRawTime:n.readonly(S),handleChange:I,handleKeyDown:K,handleKeyUp:ee,handleClick:E,handleWheel:X,handleBlur:oe,initStyling:z}}const bt={returnFocusToTrigger:!1,focusTrapOptions:{returnFocusOnDeactivate:!1}};function St(e){const t=n.shallowRef(null),o=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],u=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??o].flat(),l=x=>x?typeof e.initialFocus=="string"?x.querySelector(e.initialFocus)??x:typeof e.initialFocus=="function"?e.initialFocus(x)??x:x.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??x:null,{activate:d,deactivate:b}=Ne.useFocusTrap(t,{escapeDeactivates:!1,clickOutsideDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>t.value,initialFocus:()=>l(t.value),...e.focusTrapOptions??{}});let k=null,P=n.ref(null);const N=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const x=(T,D)=>{const V=Array.from(T.querySelectorAll(D));if(!V.length)return null;const p=V.filter(c=>c.offsetParent!==null||c.getClientRects().length>0);return p[p.length-1]??V[V.length-1]??null},R=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const T of u){const D=x(R,T);if(D)return D}for(const T of u){const D=x(document,T);if(D)return D}return null};return Ve(t,x=>{P.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",x)}),n.watch(()=>e.isOpen.value,x=>{x?(P.value=null,n.nextTick(()=>{const R=N();R&&(R.tabIndex<0&&(R.tabIndex=-1),t.value=R,setTimeout(()=>{try{d()}catch(T){console.warn("usePopupTrap: focus trap failed to activate",T)}},0),k||(k=T=>{T.key==="Escape"&&(P.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",T))},document.addEventListener("keydown",k,!0)))})):(b(),k&&(document.removeEventListener("keydown",k,!0),k=null),t.value=null,P.value==="outside"&&n.nextTick(()=>{const R=()=>{const T=e.triggerEl?.value,D=T?.querySelector("input"),V=document.activeElement;V&&(V===D||T&&T.contains(V))&&(D??T)?.blur?.()};requestAnimationFrame(()=>setTimeout(R,0))}),e.returnFocusToTrigger!==!1&&P.value==="escape"&&e.triggerEl?.value&&n.nextTick(()=>{const R=()=>{const T=e.triggerEl?.value;if(!T)return;(T.querySelector("input")??T)?.focus?.()};requestAnimationFrame(()=>setTimeout(R,0))}))}),{popupRef:t,activate:d,deactivate:b,lastCloseReason:n.readonly(P),setPopupEl:x=>t.value=x}}j.POPUP_MENU_TRAP_OPTIONS=bt,j.WINDOW_SETTINGS_DEFAULTS=ke,j.computeCollisionOffset=Le,j.useActiveIdRegistry=pt,j.useCompositeId=tt,j.useExclusiveGroup=dt,j.useFieldsetTouchTracker=Ie,j.useFieldsetValidationKit=Ce,j.useGridA11y=ze,j.useGridActiveFilter=Ue,j.useGridRowAction=Ye,j.useIntersectionObserver=Oe,j.useMaskedDateInput=vt,j.useMaskedDateRangeInput=yt,j.useMaskedTimeInput=wt,j.usePopupMenu=ut,j.usePopupTrap=St,j.useUSAddress=et,j.useWindow=ht,j.useZipTextBox=Me,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
2
2
  //# sourceMappingURL=featherk-composables.umd.js.map