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