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