@featherk/composables 0.15.2 → 0.15.4

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