@featherk/composables 0.10.7 → 0.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/featherk-composables.es.js +1162 -1088
- 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/grid/index.d.ts +2 -0
- package/dist/grid/useGridRowAction.d.ts +86 -0
- package/dist/grid/useGridRowAction.test.d.ts +1 -0
- package/dist/types/kendo.d.ts +7 -0
- package/docs/grid/useGridRowAction.md +169 -0
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(_,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(_=typeof globalThis<"u"?globalThis:_||self,t(_.FeatherKComposables={},_.Vue,_.useFocusTrap))})(this,(function(_,t,Pe){"use strict";const $e=(e,n)=>{const l=t.ref(null);let w=!1,g=null,y=null;const T=[],b=".k-table-row[data-grid-row-index] [tabindex]",x=()=>{const i=e?.value?.$el;return i?i.closest(".k-grid"):null},V=i=>{const k=x();if(!k)return!1;const d=i.closest(".k-grid-aria-root");if(d)return k.contains(d);const p=i.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return p?k.contains(p):!1},h=i=>i.key==="Enter"||i.code==="Enter"||i.code==="NumpadEnter",P=()=>e?.value?.columns,E=i=>{const k=i.key||i.code;([" ","Spacebar","Space"].includes(k)||h(i))&&(i.preventDefault(),i.stopPropagation(),l.value=i.target,i.target.click())},c=i=>{if(!l.value)return;if(i.code==="Escape"){i.stopPropagation(),l.value&&l.value.focus();return}const k=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),d=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(d){if(i.code==="Tab"){const p=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],M=n?.focusableMenuSelectors??p,v=Array.from(d.querySelectorAll(M.join(",")));if(v.length===0)return;const I=v.findIndex(H=>H===document.activeElement);let L;I===-1?L=0:i.shiftKey?L=(I-1+v.length)%v.length:L=(I+1)%v.length,i.preventDefault(),i.stopPropagation(),v[L]?.focus()}}else if(i.code==="ArrowUp"||i.code==="ArrowDown"){i.preventDefault(),i.stopPropagation();const p=k.findIndex(v=>v===document.activeElement);let M=p;i.code==="ArrowUp"?M=p>0?p-1:k.length-1:i.code==="ArrowDown"&&(M=p<k.length-1?p+1:0),k[M]?.focus();return}if(i.code==="Tab"){i.preventDefault(),i.stopPropagation();const p=l.value?.parentElement;(i.shiftKey?p?.previousElementSibling:p?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},S=()=>{g=new MutationObserver(i=>{i.forEach(k=>{k.addedNodes.forEach(d=>{if(d.nodeType===Node.ELEMENT_NODE){const p=d;if(p.classList.contains("k-animation-container")){const v=l.value;v&&(v.dataset.featherKSortable==="true"||t.nextTick(()=>{p.querySelectorAll(".k-columnmenu-item-wrapper").forEach(H=>{H.textContent?.toLowerCase().includes("sort")&&H.remove()})})),p.addEventListener("keydown",c),t.nextTick(()=>{const I=()=>{const L=Array.from(p.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(L.length===1)L[0].focus(),L[0].click(),I.attempts=0;else if(L.length>1){I.attempts=0;return}else I.attempts===void 0&&(I.attempts=0),I.attempts++<3&&setTimeout(I,200)};I()})}p.querySelectorAll(".k-animation-container").forEach(v=>{v.addEventListener("keydown",c)})}}),k.removedNodes.forEach(d=>{if(d.nodeType===Node.ELEMENT_NODE){const p=d;p.classList.contains("k-animation-container")&&p.removeEventListener("keydown",c),p.querySelectorAll(".k-animation-container").forEach(v=>{v.removeEventListener("keydown",c)})}})})}),g.observe(document.body,{childList:!0,subtree:!0})},z=i=>{const k=i.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(k)||i.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},m=i=>{if(!i.type||!i)return;const k=i.target;if(!k)return;const d=k.closest(".k-table-row[data-grid-row-index]");if(!V(k))return;const p=["ArrowLeft","ArrowRight"].includes(i.code);if(!(z(k)&&!(d&&p))){if(i.code==="Escape"){const M=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(M){i.preventDefault(),i.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(I=>I.setAttribute("tabindex","-1"))}catch{}M.setAttribute("tabindex","0"),M.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(i.code)){if(k.classList.contains("k-grid-header-menu")&&k.classList.contains("k-grid-column-menu")){l.value=k;return}if(d){if(["ArrowDown","ArrowUp"].includes(i.code)){i.preventDefault(),i.stopPropagation();const M=(I,L)=>{let H=L==="next"?I.nextElementSibling:I.previousElementSibling;for(;H;){const te=H;try{if(te.classList.contains("k-table-row"))return te}catch{}H=L==="next"?H.nextElementSibling:H.previousElementSibling}return null},v=i.code==="ArrowDown"?M(d,"next"):M(d,"previous");v&&(d.setAttribute("tabindex","-1"),v.setAttribute("tabindex","0"),v.focus());return}if(["ArrowLeft","ArrowRight"].includes(i.code)){i.preventDefault(),i.stopPropagation();const M=d.querySelectorAll(b);if(M.length===0)return;let v=Array.from(M).findIndex(I=>I===document.activeElement);if(v===-1&&document.activeElement===d){M[0].focus();return}i.code==="ArrowRight"?v=v===M.length-1?0:v+1:i.code==="ArrowLeft"&&(v=v===0?M.length-1:v-1),M[v].focus();return}}}}},A=()=>{t.nextTick(()=>{const i=e.value?.$el;if(!i||typeof i.closest!="function")return;const k=i.closest(".k-grid");k&&k.classList.add("fk-grid")})},$=()=>{if(!y)try{const i=()=>{try{const p=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!p||p.length===0||p.filter(I=>I.getAttribute("tabindex")==="0").length===1)return;const v=p.find(I=>I===document.activeElement||I.contains(document.activeElement));if(p.forEach(I=>I.setAttribute("tabindex","-1")),v){v.setAttribute("tabindex","0");return}p[0].setAttribute("tabindex","0")}catch(p){console.error("ensureSingleTabindex error:",p)}},k=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));k.length>0&&k.forEach((p,M)=>{p.setAttribute("tabindex",M===0?"0":"-1")});const d=e.value.$el.querySelector(".k-table-tbody");d&&(y=new MutationObserver(()=>{i()}),y.observe(d,{childList:!0,subtree:!0}))}catch(i){console.error("Error setting up row navigation:",i)}},N=()=>{t.nextTick(()=>{const k=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");k&&k.forEach(d=>{d.setAttribute("role","button"),d.addEventListener("keydown",E)}),S(),j()})},J=()=>{const k=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");k&&k.forEach(d=>{d.removeEventListener("keydown",E)}),g&&(g.disconnect(),g=null),y&&(y.disconnect(),y=null),T.forEach(d=>d()),T.length=0},j=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((d,p)=>{if(d.dataset.featherKHeaderBound==="true")return;const M=d.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!M)return;const v=P();if(v&&v[p]){const r=v[p].field??"";d.setAttribute("data-feather-k-field",r),d.setAttribute("data-feather-k-filterable",v[p].filterable===!1?"false":"true"),d.setAttribute("data-feather-k-sortable",v[p].sortable===!1?"false":"true")}const I=d.dataset.featherKFilterable!=="false",L=d.dataset.featherKSortable!=="false";M.setAttribute("tabindex","-1"),I||L?d.style.cursor="pointer":d.style.cursor="default",I?(d.setAttribute("tabindex","0"),d.setAttribute("role","button"),d.setAttribute("aria-haspopup","menu")):(d.setAttribute("tabindex","0"),d.setAttribute("role","columnheader"),d.removeAttribute("aria-haspopup"));const H=r=>{r.target?.closest(".k-column-resizer")||(l.value=d,M.click())},te=r=>{if(I)l.value=d,r.preventDefault(),r.stopPropagation(),H(r);else if(L){l.value=d;const f=d.querySelector(".k-link");f&&f.click()}};d.addEventListener("click",te),T.push(()=>{d.removeEventListener("click",te)});const oe=r=>{if((h(r)||r.code==="Space")&&(I||L)){if(r.preventDefault(),r.stopPropagation(),l.value=d,l.value.focus(),I)H(r);else if(L){const f=d.querySelector(".k-link");f&&f.click()}}};d.addEventListener("keydown",oe,!0),T.push(()=>{d.removeEventListener("keydown",oe,!0)}),d.dataset.featherKHeaderBound="true"});const k=document.querySelector(".k-grid-header .k-table-thead");if(k&&k.dataset.featherKHeaderBound!=="true"){const d=p=>{const M=p.target.closest("th");M&&(h(p)||p.code==="Space")&&M.dataset.featherKFilterable==="false"&&M.dataset.featherKSortable==="false"&&(p.preventDefault(),p.stopImmediatePropagation())};k.addEventListener("keydown",d,!0),T.push(()=>{k.removeEventListener("keydown",d,!0)}),k.dataset.featherKHeaderBound="true"}},X=function(i,k){const d=i?.event?.event.target,p=P();if(!d||!p)return;const M=d.classList.contains("k-grid-header-menu"),v=d.classList.contains("k-columnmenu-item"),I=p.find(L=>L.field===i?.event?.field)?.sortable&&!0;if(!M){if(v&&!I){i?.event?.sort?.filter(H=>H.field!==i?.event?.field);return}typeof k=="function"&&t.nextTick(()=>{l.value&&l.value.focus(),k(i),t.nextTick(()=>{j()})})}},ae=()=>{if(!w)try{A(),$(),N(),w=!0}catch(i){console.error("initA11y failed:",i),J()}};return t.onBeforeUnmount(()=>{J()}),{activeFilterButton:l,handleGridKeyDown:m,handleSortChange:X,initA11y:ae}},Re=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Le=e=>!!e&&typeof e=="object"&&"field"in e,De=(e,n)=>!e||typeof e!="object"?!1:Re(e)?e.filters.some(l=>De(l,n)):Le(e)?e.field===n:!1,qe=e=>n=>e.value?.filters&&e.value.filters.some(l=>De(l,n))?"active":"",Oe="Enter a valid ZIP code with exactly 5 or 9 digits.",Ee=e=>{const n=e.replace(/\D/g,"").slice(0,9);return n.length>5?`${n.slice(0,5)}-${n.slice(5)}`:n},Ue=(e,n)=>e.slice(0,Math.max(0,n)).replace(/\D/g,"").length,Be=e=>e<=5?e:Math.min(e+1,10),xe=e=>{const n=t.ref(Ee(e.initialValue??"")),l=t.ref(!1),w=t.ref(e.errorMessage?.trim()||Oe),g=t.computed(()=>n.value.replace(/\D/g,"")),y=t.computed(()=>{const c=g.value.length;return c===5||c===9}),T=t.computed(()=>l.value&&!y.value),b=t.computed(()=>!l.value||y.value),x=t.computed(()=>l.value),V=(c,S)=>{const z=Be(S);t.nextTick(()=>{c.isConnected&&c.setSelectionRange(z,z)})};return{zipDisplay:n,submitted:l,errorMessage:w,wrapperClass:"fk-zip-textbox",zipRaw:g,isZipValid:y,showZipError:T,textBoxValid:b,textBoxValidate:x,handleZipInput:(...c)=>{const S=c[0],m=S?.event?.target,A=S?.value,$=Array.isArray(A)?A.join(""):String(A??""),N=m?.selectionStart!==void 0&&m.selectionStart!==null?Ue(m.value,m.selectionStart):$.replace(/\D/g,"").length;n.value=Ee($),m&&V(m,N)},submitAndValidate:c=>{l.value=!0;const S=y.value;return!S&&c?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),S},buildPayload:()=>({zip:g.value})}};function Me(e,n){const l=t.ref(!1);t.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!n.isValid()))});function w(y){const T=e.value??y.currentTarget,b=y.relatedTarget;(!T||!T.contains(b))&&(l.value=!0)}function g(){l.value=!1}return{touched:l,onFocusout:w,reset:g}}function Te(e,n){const l=t.ref(!1),w=t.ref(!1),g=t.computed(()=>t.toValue(n.submitted)||l.value),y=t.computed(()=>!g.value||n.isValid()),T=Me(e,{isValid:()=>y.value});function b(E){return t.computed(()=>!g.value||t.toValue(E))}function x(E){return Object.fromEntries(Object.entries(E).map(([c,S])=>[c,b(S)]))}function V(E){const c=t.toValue(E);if(!c)return;c.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function h(E){if(w.value){w.value=!1;return}T.onFocusout(E),T.touched.value&&(l.value=!0)}function P(){l.value=!1,w.value=!0,T.reset()}return{touched:l,fieldsetValidate:g,onFocusout:h,reset:P,createFieldValidity:b,createFieldValidationsMap:x,focusFirstInvalidField:V}}const Ke=[{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 ve(e){if(e&&typeof e=="object"&&"value"in e){const n=e.value;return typeof n=="string"?n:String(n??"")}return""}function Ne(){const e=t.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...T)=>{e.address1=ve(T[0])},onAddress2Input:(...T)=>{e.address2=ve(T[0])},onCityInput:(...T)=>{e.city=ve(T[0])},onStateChange:T=>{e.state=T.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function ze(e,n="zip"){const l=xe({id:n}),{zipDisplay:w,zipRaw:g,isZipValid:y,wrapperClass:T,handleZipInput:b}=l;return t.watch(g,V=>{e.zip=V}),{zipDisplay:w,isZipValid:y,zipWrapperClass:T,onZipInput:b,resetZip:()=>{w.value="",e.zip=""}}}function He(e){const n=t.computed(()=>e.formData.address1.trim()!==""),l=t.computed(()=>e.formData.city.trim()!==""),w=t.computed(()=>!!e.formData.state),g=t.computed(()=>t.toValue(e.isZipValid)),y=t.computed(()=>n.value&&l.value&&w.value&&g.value);return{strictAddress1Valid:n,strictCityValid:l,strictStateValid:w,strictZipValid:g,strictAddressValid:y}}function Ze(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Ye(e,n){const l=e??n.currentTarget,w=n.relatedTarget;return!l||!l.contains(w)}function We(e){const n=t.ref(t.toValue(e.fieldsetRef));t.watchEffect(()=>{n.value=t.toValue(e.fieldsetRef)});const l=t.ref(!1),w=t.ref(!1),g=t.computed(()=>t.toValue(e.required)??!0),{formData:y,onAddress1Input:T,onAddress2Input:b,onCityInput:x,onStateChange:V,resetFormData:h}=Ne(),P=`${e.addressId}-zip`,{zipDisplay:E,isZipValid:c,zipWrapperClass:S,onZipInput:z,resetZip:m}=ze(y,P),{strictAddress1Valid:A,strictCityValid:$,strictStateValid:N,strictZipValid:J,strictAddressValid:j}=He({formData:y,isZipValid:c}),X=Te(n,{submitted:l,isValid:()=>j.value}),{touched:ae,fieldsetValidate:i,onFocusout:k,reset:d}=X,p=X.createFieldValidationsMap({address1:A,city:$,state:N,zip:J,address:j}),{address1:M,city:v,state:I,zip:L,address:H}=p,te=t.computed(()=>g.value?i.value:!1),oe=t.computed(()=>g.value?M.value:!0),r=t.computed(()=>g.value?v.value:!0),f=t.computed(()=>g.value?I.value:!0),F=t.computed(()=>g.value?L.value:!0),U=t.computed(()=>g.value?H.value:!0),B={value:null,label:"State"},Z=Ke.map(({label:u,value:D})=>({label:u,value:D})),a=t.computed(()=>({address1:y.address1.trim(),address2:y.address2.trim(),city:y.city.trim(),state:(y.state??"").trim().toUpperCase(),zip:y.zip.replace(/\D/g,"")})),s=t.computed(()=>y.address1.trim()===""&&y.address2.trim()===""&&y.city.trim()===""&&(y.state??"").trim()===""&&y.zip.replace(/\D/g,"")===""),C=t.computed(()=>!s.value),q=t.computed(()=>!g.value&&C.value&&(!A.value||!$.value||!N.value)),Y=t.computed(()=>{const u=y.zip.replace(/\D/g,"");return!g.value&&C.value&&u.length!==5&&u.length!==9}),G=t.computed(()=>!g.value&&C.value&&!j.value),O=t.computed(()=>!g.value&&G.value&&(w.value||l.value));return t.watch(a,()=>{g.value||(w.value=!1)}),t.watch(g,u=>{u||(l.value=!1,w.value=!1,d())}),{formData:y,submitted:l,touched:ae,addressValidate:te,address1Valid:oe,cityValid:r,stateValid:f,zipValid:F,addressValid:U,optionalFeedbackActive:O,optionalPartialInvalid:G,optionalMissingRequiredFields:q,optionalZipInvalid:Y,stateDefaultItem:B,stateOptions:Z,zipDisplay:E,zipWrapperClass:S,onAddress1Input:T,onAddress2Input:b,onCityInput:x,onStateChange:V,onZipInput:z,onFieldsetFocusout:u=>{const D=Ye(n.value,u);k(u),!g.value&&D&&(w.value=!0)},normalizedPayload:a,validateForSubmit:async()=>g.value?(l.value=!0,j.value?{isValid:!0,payload:a.value}:(await t.nextTick(),Ze(n.value),{isValid:!1,payload:null})):s.value||j.value?(l.value=!1,{isValid:!0,payload:a.value}):(l.value=!0,{isValid:!1,payload:null}),reset:()=>{l.value=!1,w.value=!1,d(),h(),m()}}}function je(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const Ie=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ge=Object.prototype.toString,_e=e=>Ge.call(e)==="[object Object]",ce=()=>{},Je=Xe();function Xe(){var e,n;return Ie&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((n=window?.navigator)==null?void 0:n.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function he(e){return Array.isArray(e)?e:[e]}function Qe(e,n,l){return t.watch(e,n,{...l,immediate:!0})}const Ce=Ie?window:void 0;function me(e){var n;const l=t.toValue(e);return(n=l?.$el)!=null?n:l}function be(...e){const n=[],l=()=>{n.forEach(b=>b()),n.length=0},w=(b,x,V,h)=>(b.addEventListener(x,V,h),()=>b.removeEventListener(x,V,h)),g=t.computed(()=>{const b=he(t.toValue(e[0])).filter(x=>x!=null);return b.every(x=>typeof x!="string")?b:void 0}),y=Qe(()=>{var b,x;return[(x=(b=g.value)==null?void 0:b.map(V=>me(V)))!=null?x:[Ce].filter(V=>V!=null),he(t.toValue(g.value?e[1]:e[0])),he(t.unref(g.value?e[2]:e[1])),t.toValue(g.value?e[3]:e[2])]},([b,x,V,h])=>{if(l(),!b?.length||!x?.length||!V?.length)return;const P=_e(h)?{...h}:h;n.push(...b.flatMap(E=>x.flatMap(c=>V.map(S=>w(E,c,S,P)))))},{flush:"post"}),T=()=>{y(),l()};return je(l),T}let Fe=!1;function Ve(e,n,l={}){const{window:w=Ce,ignore:g=[],capture:y=!0,detectIframe:T=!1,controls:b=!1}=l;if(!w)return b?{stop:ce,cancel:ce,trigger:ce}:ce;if(Je&&!Fe){Fe=!0;const m={passive:!0};Array.from(w.document.body.children).forEach(A=>A.addEventListener("click",ce,m)),w.document.documentElement.addEventListener("click",ce,m)}let x=!0;const V=m=>t.toValue(g).some(A=>{if(typeof A=="string")return Array.from(w.document.querySelectorAll(A)).some($=>$===m.target||m.composedPath().includes($));{const $=me(A);return $&&(m.target===$||m.composedPath().includes($))}});function h(m){const A=t.toValue(m);return A&&A.$.subTree.shapeFlag===16}function P(m,A){const $=t.toValue(m),N=$.$.subTree&&$.$.subTree.children;return N==null||!Array.isArray(N)?!1:N.some(J=>J.el===A.target||A.composedPath().includes(J.el))}const E=m=>{const A=me(e);if(m.target!=null&&!(!(A instanceof Element)&&h(e)&&P(e,m))&&!(!A||A===m.target||m.composedPath().includes(A))){if("detail"in m&&m.detail===0&&(x=!V(m)),!x){x=!0;return}n(m)}};let c=!1;const S=[be(w,"click",m=>{c||(c=!0,setTimeout(()=>{c=!1},0),E(m))},{passive:!0,capture:y}),be(w,"pointerdown",m=>{const A=me(e);x=!V(m)&&!!(A&&!m.composedPath().includes(A))},{passive:!0}),T&&be(w,"blur",m=>{setTimeout(()=>{var A;const $=me(e);((A=w.document.activeElement)==null?void 0:A.tagName)==="IFRAME"&&!$?.contains(w.document.activeElement)&&n(m)},0)},{passive:!0})].filter(Boolean),z=()=>S.forEach(m=>m());return b?{stop:z,cancel:()=>{x=!1},trigger:m=>{x=!0,E(m),x=!1}}:z}const Se=e=>{if(e instanceof HTMLElement)return e;const n=e?.$el;return n instanceof HTMLElement?n:null},et=e=>e instanceof HTMLButtonElement||e.getAttribute("role")==="button"||e.hasAttribute("aria-haspopup"),tt=e=>{const n=t.ref(null),l=e.menuItemSelector??".k-menu-item:not(.k-disabled)",w=()=>Se(e.triggerRef.value),g=()=>e.resolveFocusTarget?.()??Se(e.focusTargetRef?.value),y=()=>{const c=g();if(c)return c.focus(),!0;const S=w();return S?.focus(),!!S},T=()=>{Se(e.menuRef.value)?.querySelector(l)?.focus()},b=c=>{e.isOpen.value&&(n.value=c,e.requestHide())};Ve(e.menuRef,()=>b("outside-click"),{ignore:[e.triggerRef]}),e.manageAriaExpanded!==!1&&t.watch([e.isOpen,e.triggerRef],([c])=>{const S=w();!S||!et(S)||S.setAttribute("aria-expanded",c?"true":"false")},{immediate:!0,flush:"post"});const x=()=>{if(e.isOpen.value){b("trigger-click");return}e.requestShow(),t.nextTick(T)};return{handleMenuSelect:(c,S)=>{b(c.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),S?.(c)},handleActionButtonClick:x,handleActionButtonKeydown:c=>{if(c.key==="Enter"||c.code==="Space"){c.preventDefault(),x();return}if(c.key==="Escape"){if(c.preventDefault(),c.stopPropagation(),e.isOpen.value){b("keyboard");return}y()}},handleActionMenuEscape:c=>{c.preventDefault(),c.stopPropagation(),b("keyboard")},handlePopupClose:()=>{t.nextTick(()=>{n.value==="keyboard"?y():n.value==="mouse-selection"&&w()?.focus(),n.value=null})}}};function nt(e){const n=t.ref(""),l=t.ref(void 0),w=t.ref(!!e.debug),g=t.ref(e.dateFormat??"mm/dd/yyyy"),y=t.computed(()=>!!e.required),T=1e3,b=t.ref(!1),x=["ArrowUp","ArrowDown"],V=["ArrowLeft","ArrowRight"],h=t.computed(()=>(n.value??"").replace(/\D/g,"")),P=r=>r<=2?"mm":r<=5?"dd":h.value.length<=10?"yyyy":"mm",E=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),c=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),S=t.computed(()=>{const r=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(4,"0")}),z=r=>{if(h.value.length===0){e.onChange({value:null,event:r});return}if(h.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&h.value.length===8){const[f,F,U]=n.value.split("/"),B=parseInt(f),Z=parseInt(F),a=parseInt(U);if(j(a,B,Z)){const s=N(a,B,Z);m(s)?e.onChange({value:s,event:r}):e.onChange({value:null,event:r})}else e.onChange({value:null,event:r})}},m=r=>{const f=e.min??void 0,F=e.max??void 0;return!(f&&r<f||F&&r>F)},A=t.computed(()=>{if((n.value??"").length===10&&h.value.length===8){const[r,f,F]=(n.value??"").split("/"),U=parseInt(r),B=parseInt(f),Z=parseInt(F);if(j(Z,U,B))return N(Z,U,B)}return null}),$=t.computed(()=>(n.value??"").length===10&&h.value.length===8),N=(r,f,F)=>{const U=new Date(0);return U.setFullYear(r,f-1,F),U.setHours(0,0,0,0),U},J=(r,f)=>N(r,f+1,0).getDate(),j=(r,f,F)=>f>=1&&f<=12&&r>=T&&F>=1&&F<=J(r,f),X=r=>{n.value=r.value;const f=r.event?.target;l.value=f?.selectionStart??0,z(r)},ae=r=>{l.value=r.target.selectionStart??0},i=(r,f,F)=>{const U=f?.selectionStart??l.value??0;l.value=U;let B=parseInt(E.value),Z=parseInt(c.value),a=parseInt(S.value);if(!(h.value.length>=8)||!j(a,B,Z)){const K=e.defaultValue??new Date;B=K.getMonth()+1,Z=K.getDate(),a=K.getFullYear(),n.value=`${String(B).padStart(2,"0")}/${String(Z).padStart(2,"0")}/${String(a)}`;const le=N(a,B,Z);e.onChange({value:m(le)?le:null,event:F}),v({useRAF:!0});return}const C=P(U);if(C==="mm")B=r==="ArrowUp"?B<12?B+1:1:B>1?B-1:12;else if(C==="dd"){const K=new Date(a,B,0).getDate();Z=r==="ArrowUp"?Z<K?Z+1:1:Z>1?Z-1:K}else C==="yyyy"&&(a=r==="ArrowUp"?a+1:Math.max(1,a-1));n.value=`${String(B).padStart(2,"0")}/${String(Z).padStart(2,"0")}/${String(a)}`;const[q,Y,G]=n.value.split("/"),O=N(parseInt(G),parseInt(q),parseInt(Y));O.toString()!=="Invalid Date"&&parseInt(G)>=1e3?e.onChange({value:m(O)?O:null,event:F}):e.onChange({value:null,event:F}),v({useRAF:!0})},k=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(x.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const f=r.target;i(r.key,f,r);return}},d=r=>{r.preventDefault();const f=r.deltaY<0?"ArrowUp":"ArrowDown";i(f,r.target,r)},p=r=>{const f=r.target;if(V.includes(r.key)){l.value=f?.selectionStart??0;return}if(x.includes(r.key)){if(r.altKey)return;l.value=f?.selectionStart??0}},M=r=>{b.value=!0,y.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&h.value.length===0&&(e.externalValue.value="");const f=r.target;f&&(l.value=f.selectionStart??0)},v=r=>{const f=()=>{const F=document.getElementById(e.id);if(!F)return;const U=r?.pos??l.value??F.value.length;try{F.focus(),F.setSelectionRange(U,U)}catch{}};t.nextTick(()=>{if(r?.delay&&r.delay>0){setTimeout(f,r.delay);return}if(r?.useRAF){requestAnimationFrame(f);return}f()})};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const f=new Date(r);if(f.toString()!=="Invalid Date"){const F=(f.getMonth()+1).toString().padStart(2,"0"),U=f.getDate().toString().padStart(2,"0"),B=f.getFullYear().toString();n.value=`${F}/${U}/${B}`,v({delay:50});return}}},{immediate:!0});const I=t.computed(()=>[["Date",`${E.value} / ${c.value} / ${S.value}`],["Digits only",h.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]]),L=t.computed(()=>{if(!y.value){if(!$.value)return!0;const f=A.value;return f?m(f):!1}if(!b.value)return!0;const r=A.value;return!$.value||!r?!1:m(r)}),H=t.computed(()=>{if(!y.value){if(!$.value)return;const f=A.value;return f?m(f)?"valid":"out-of-bounds":"invalid-date"}if(!b.value)return;if(h.value.length===0||!$.value)return"incomplete";const r=A.value;return r?m(r)?"valid":"out-of-bounds":"invalid-date"}),te=t.computed(()=>{const r=H.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="invalid-date")return`Must be in ${g.value} format.`;const f=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,F=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(r==="out-of-bounds"){if(f&&F)return`Must be between ${f} and ${F}.`;if(f)return`Must be on or after ${f}.`;if(F)return`Must be on or before ${F}.`}return""}),oe=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`ID (#${e.id}) not found for styling.`);return}const f=r.closest(".k-datepicker");if(!f){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const F=f.parentElement;if(F){if(F.classList.contains("fk-datepicker"))return;F.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{oe()}),{raw:n,cursorPos:l,debugEnabled:w,debugLines:I,placeholder:g,isValid:L,reason:t.readonly(H),validationMessage:te,digitsOnly:h,month:t.readonly(E),day:t.readonly(c),year:t.readonly(S),datePart:P,handleChange:X,handleKeyDown:k,handleWheel:d,handleKeyUp:p,handleClick:ae,handleBlur:M,initStyling:oe}}function at(e){const n=t.ref(""),l=t.ref(void 0),w=t.ref(!!e.debug),g=t.ref(!1),y=1440*60*1e3,T=365*y,b=new Date,x=new Date(b.getTime()-T),V=new Date(b.getTime()+T);e.min=e.min??x,e.max=e.max??V;const h=t.computed(()=>(n.value??"").replace(/\D/g,"")),P=(o,u)=>new Date(o,u,0).getDate(),E=(o,u,D)=>u>=1&&u<=12&&o>=1e3&&D>=1&&D<=P(o,u),c=o=>Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()),S=o=>{if(!o)return null;const u=e.min??new Date(Date.now()-90*y),D=e.max??new Date,R=c(o);return R<c(u)||R>c(D)?null:o},z=(o,u)=>e.allowReverse??!1?!0:o<=u,m=t.computed(()=>(n.value?.length??0)>=23&&h.value.length>=16),A=o=>{if((o??"").length<23||h.value.length<16)return{start:null,end:null};const u=o.substring(0,10),D=o.substring(13,23),[R,Q,ee]=u.split("/").map(ue=>parseInt(ue||"0",10)),[se,de,fe]=D.split("/").map(ue=>parseInt(ue||"0",10)),pe=new Date(ee,R-1,Q),ge=new Date(fe,se-1,de),ke=E(ee,R,Q)&&pe.toString()!=="Invalid Date",we=E(fe,se,de)&&ge.toString()!=="Invalid Date";return{start:ke?pe:null,end:we?ge:null}},$=e.externalValid??t.ref(!0),N=t.computed(()=>A(n.value)),J=t.computed(()=>{const o=S(N.value.start),u=S(N.value.end);return{start:o,end:u}}),j=t.computed(()=>{if(!m.value)return;const o=J.value.start,u=J.value.end;if(!o||!u)return;const D=Math.abs(c(u)-c(o));return Math.round(D/864e5+1)}),X=t.ref(!1),ae=t.computed(()=>{if(!X.value)return;const{start:o,end:u}=N.value;if(!m.value)return"incomplete";if(!o||!u)return"invalid-date";if(!J.value.start||!J.value.end)return"out-of-bounds";const D=J.value.start,R=J.value.end;return z(D,R)?typeof e.maxSpanDays=="number"&&j.value!==void 0&&j.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),i=t.computed(()=>{const o=ae.value;return o===void 0||o==="valid"}),k=t.computed(()=>{const{min:o,max:u}=e,D=ae.value;if(!D)return"";switch(D){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 o&&u?`Dates must be between ${v(o)} and ${v(u)}.`:"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""}}),d=["ArrowUp","ArrowDown"],p=["ArrowLeft","ArrowRight"],M=(o,u)=>String(o).padStart(u,"0"),v=o=>`${M(o.getMonth()+1,2)}/${M(o.getDate(),2)}/${M(o.getFullYear(),4)}`,I=o=>o<=2?{side:"start",part:"mm"}:o<=5?{side:"start",part:(o<=3,"dd")}:o<=11?{side:"start",part:"yyyy"}:o<=15?{side:"end",part:"mm"}:o<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},L=(o,u,D)=>{const R=u?.selectionStart??l.value??0;l.value=R;const{start:Q,end:ee}=A(n.value);if(!Q&&!ee){const W=new Date,ie=v(W);n.value=`${ie} - ${ie}`,e.onChange({value:{start:W,end:W},event:D}),t.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),re=l.value??0;ne&&(ne.focus(),ne.setSelectionRange(re,re))})});return}const se=new Date,de=I(R);let fe=Q?new Date(Q):new Date(se),pe=ee?new Date(ee):new Date(se);const ge=(W,ie)=>{if(ie==="mm"){const ne=W.getMonth()+1,re=o==="ArrowUp"?ne<12?ne+1:1:ne>1?ne-1:12;W.setMonth(re-1);const ye=P(W.getFullYear(),re);W.getDate()>ye&&W.setDate(ye)}else if(ie==="dd"){const ne=P(W.getFullYear(),W.getMonth()+1),re=W.getDate(),ye=o==="ArrowUp"?re<ne?re+1:1:re>1?re-1:ne;W.setDate(ye)}else if(ie==="yyyy"){const ne=W.getFullYear();W.setFullYear(o==="ArrowUp"?ne+1:Math.max(1,ne-1));const re=P(W.getFullYear(),W.getMonth()+1);W.getDate()>re&&W.setDate(re)}};de.side==="start"?ge(fe,de.part):ge(pe,de.part);const ke=v(fe),we=v(pe);n.value=`${ke} - ${we}`;const ue=S(fe),Ae=S(pe);ue&&Ae&&z(ue,Ae)?e.onChange({value:{start:ue,end:Ae},event:D}):e.onChange({value:null,event:D}),t.nextTick(()=>{requestAnimationFrame(()=>{const W=document.getElementById(e.id),ie=l.value??0;W&&(W.focus(),W.setSelectionRange(ie,ie))})})},H=o=>{const{start:u,end:D}=A(n.value);if(!u||!D){e.onChange({value:null,event:o});return}const R=S(u),Q=S(D);if(!R||!Q){e.onChange({value:null,event:o});return}if(!z(R,Q)){e.onChange({value:null,event:o});return}e.onChange({value:{start:R,end:Q},event:o})},te=o=>{const u=o.value??"",D=o.event;if(!u&&D&&D.type==="click"){Z(D);return}n.value=u;const R=D?.target;l.value=R?.selectionStart??0,H(o)},oe=o=>{l.value=o.target.selectionStart??0},r=o=>{if(o.code==="Space"||o.key===" "){o.preventDefault(),o.stopPropagation(),e.onShowCalendar(o);return}if(o.key==="ArrowDown"&&o.altKey){o.preventDefault(),o.stopPropagation(),e.onShowCalendar(o);return}if(d.includes(o.key)){o.preventDefault(),o.stopPropagation();const u=o.target;L(o.key,u,o);return}},f=o=>{o.preventDefault();const u=o.deltaY<0?"ArrowUp":"ArrowDown";L(u,o.target,o)},F=o=>{if(p.includes(o.key)||d.includes(o.key)){const u=o.target;l.value=u?.selectionStart??0}},U=()=>{X.value=!0,(e.manageValid??!0)&&($.value=i.value)},B=o=>{U()},Z=o=>{n.value="",l.value=0,e.onChange({value:null,event:o}),U(),t.nextTick(()=>{const u=document.getElementById(e.id);u&&(u.focus(),u.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,o=>{const u=o?.start??null,D=o?.end??null;if(u&&D){if(n.value=`${v(u)} - ${v(D)}`,e.isOpen?.value&&g.value&&e.onRequestClose){const R=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),g.value=!1,U()},R)}return}},{immediate:!0});const a=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),s=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),C=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),q=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),Y=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),G=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),O=t.computed(()=>{const{start:o,end:u}=A(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(a.value).padStart(2,"0")} / ${String(s.value).padStart(2,"0")} / ${String(C.value).padStart(4,"0")}`},{label:"End",value:`${String(q.value).padStart(2,"0")} / ${String(Y.value).padStart(2,"0")} / ${String(G.value).padStart(4,"0")}`},{label:"Digits only",value:h.value},{label:"Mask complete",value:`${m.value}`},{label:"Parsed",value:`${o?o.toDateString():"-"} | ${u?u.toDateString():"-"}`},{label:"Valid (managed)",value:`${$.value??"-"}`},{label:"Span (days)",value:`${j.value??"-"}`},{label:"Reason",value:`${ae.value??"-"}`},{label:"Cursor in",value:`${l.value??"-"} (${(()=>{const D=l.value??0,R=I(D);return`${R.side}.${R.part}`})()})`}]}),K=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const u=o.closest("div");if(!u){console.warn(`Parent div of #${e.id} not found for styling.`);return}u.classList.contains("fk-daterangepicker")||u.classList.add("fk-daterangepicker")})};t.onMounted(()=>{K()});const le=()=>{t.nextTick(()=>{try{const o=Array.from(document.querySelectorAll(".k-animation-container"));if(!o.length)return;const D=[...o].reverse().find(ee=>ee.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!D)return;const R=D.querySelectorAll(".k-calendar-table");let Q=!1;R.forEach(ee=>{ee.tabIndex===0&&(Q?ee.tabIndex=-1:Q=!0)})}catch(o){console.warn(o)}})};return e.isOpen&&t.watch(e.isOpen,o=>{o&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:n,cursorPos:l,debugEnabled:w,debugLines:O,digitsOnly:h,valid:$,validComputed:t.readonly(i),reason:t.readonly(ae),validationMessage:t.readonly(k),spanDays:t.readonly(j),month1:t.readonly(a),day1:t.readonly(s),year1:t.readonly(C),month2:t.readonly(q),day2:t.readonly(Y),year2:t.readonly(G),handleChange:te,handleKeyDown:r,handleWheel:f,handleKeyUp:F,handleClick:oe,handleBlur:B,handleClear:Z,onCalendarChange:()=>{g.value=!0},initStyling:K}}function rt(e){const n=t.ref(""),l=t.ref(void 0),w=t.ref(!!e.debug),g=t.ref(e.timeFormat??"hh:mm AM"),y=t.computed(()=>!!e.required),T=t.ref(!1),b=["ArrowUp","ArrowDown"],x=["ArrowLeft","ArrowRight"],V=t.computed(()=>(n.value??"").replace(/\D/g,"")),h={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},P=a=>a<=2?"hh":a<=5?"mm":"ampm",E=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",s=parseInt(a);return Math.min(Math.max(s,0),23)}),c=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",s=parseInt(a);return Math.min(Math.max(s,0),59)}),S=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),z=t.computed(()=>{const a=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),s=S.value;return a===12?s==="AM"?0:12:s==="PM"?a+12:a}),m=t.computed(()=>A.value?`${String(z.value).padStart(2,"0")}:${String(c.value).padStart(2,"0")}:00`:null),A=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),$=(a,s,C)=>{let q=a%12;return q===0&&(q=12),`${String(q).padStart(2,"0")}:${String(s).padStart(2,"0")} ${C}`},N=a=>{const s=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!s)return null;const C=parseInt(s[1]),q=parseInt(s[2]),Y=s[3].toUpperCase();if(C<1||C>12||q<0||q>59)return null;let G=C%12;Y==="PM"&&(G+=12);const O=new Date;return O.setSeconds(0,0),O.setHours(G),O.setMinutes(q),O},J=a=>{if(V.value.length===0){e.onChange({value:null,event:a});return}if(!A.value){e.onChange({value:null,event:a});return}const s=N(n.value);s&&X(s)?e.onChange({value:s,event:a}):e.onChange({value:null,event:a})},j=a=>a.getHours()*60+a.getMinutes(),X=a=>{const s=e.min??void 0,C=e.max??void 0,q=j(a);if(s){const Y=j(s);if(q<Y)return!1}if(C){const Y=j(C);if(q>Y)return!1}return!0},ae=a=>{const s=a.getHours(),C=s>=12?"PM":"AM";n.value=$(s,a.getMinutes(),C)},i=(a,s)=>{e.onChange({value:a,event:s})},k=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const s=(a.value??"").length;a.setSelectionRange(s,s)}})})})},d=a=>{const s=a?.event?.target;return s?s.closest(".k-time-now")?"now":s.closest(".k-time-accept")?"set":null:null},p=(a,s)=>{a&&X(a)?i(a,s):i(null,s)},M=(...a)=>{const s=a[0];if(!s)return;const C=d(s);if(C==="now"){const Y=new Date;ae(Y),p(Y,s),k();return}if(s?.value instanceof Date){const Y=new Date(s.value);ae(Y),p(Y,s),C==="set"&&k();return}if(s?.value===null){n.value="",i(null,s);return}n.value=s.value;const q=s.event?.target;l.value=q?.selectionStart??0;try{const Y=l.value??0;if(P(Y)==="ampm"&&(n.value??"").length>=8){const G=n.value.charAt(6);/[Aa]/.test(G)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})})):/[Pp]/.test(G)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})}))}}catch{}J(s)},v=a=>{l.value=a.target.selectionStart??0},I=(a,s,C)=>{const q=s?.selectionStart??l.value??0;l.value=q;const Y=P(q),G=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!G){if((n.value??"").length===0||V.value.length===0){const u=new Date,D=u.getHours(),R=D>=12?"PM":"AM";n.value=$(D,u.getMinutes(),R);const Q=N(n.value);p(Q,C),t.nextTick(()=>{requestAnimationFrame(()=>{const ee=document.getElementById(e.id),se=l.value??0;ee&&(ee.focus(),ee.setSelectionRange(se,se))})})}return}let O=parseInt(G[1]),K=parseInt(G[2]),le=G[3].toUpperCase();if(Y==="hh")a==="ArrowUp"?O=O<12?O+1:1:O=O>1?O-1:12;else if(Y==="mm"){const u=e.minuteStepRef?.value??e.minuteStep??1;if(u===1)a==="ArrowUp"?K=K<59?K+1:0:K=K>0?K-1:59;else if(a==="ArrowUp"){const D=K%u;let R=D===0?K+u:K+(u-D);R>=60&&(R=0),K=R}else{const D=K%u;let R=D===0?K-u:K-D;R<0&&(R=60-u),K=R}}else Y==="ampm"&&(le=le==="AM"?"PM":"AM");n.value=`${String(O).padStart(2,"0")}:${String(K).padStart(2,"0")} ${le}`;const o=N(n.value);p(o,C),t.nextTick(()=>{requestAnimationFrame(()=>{const u=document.getElementById(e.id),D=l.value??0;u&&(u.focus(),u.setSelectionRange(D,D))})})},L=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(b.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const s=a.target;I(a.key,s,a);return}},H=a=>{a.preventDefault();const s=a.deltaY<0?"ArrowUp":"ArrowDown";I(s,a.target,a)},te=a=>{const s=a.target;if(x.includes(a.key)){l.value=s?.selectionStart??0;return}if(b.includes(a.key)){if(a.altKey)return;l.value=s?.selectionStart??0}},oe=a=>{T.value=!0,y.value&&e.externalValue&&e.externalValue.value===void 0&&V.value.length===0&&(e.externalValue.value="");const s=a.target;s&&(l.value=s.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const s=new Date(a);if(s.toString()!=="Invalid Date"){const C=s.getHours(),q=C>=12?"PM":"AM";n.value=$(C,s.getMinutes(),q);return}}},{immediate:!0});const r=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",z.value],["Minute",c.value],["Period",S.value],["Time (24h)",m.value??"--:--:--"],["Digits only",V.value],["Parsed Date",f.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",F.value],["reason",U.value],["validationMessage",B.value]]),f=t.computed(()=>N(n.value)??null),F=t.computed(()=>{if(!y.value){if(!A.value)return!0;const s=f.value;return s?X(s):!1}if(!T.value)return!0;const a=f.value;return!A.value||!a?!1:X(a)}),U=t.computed(()=>{if(!y.value){if(!A.value)return;const s=f.value;return s?X(s)?"valid":"out-of-bounds":"invalid-time"}if(!T.value)return;if(V.value.length===0||!A.value)return"incomplete";const a=f.value;return a?X(a)?"valid":"out-of-bounds":"invalid-time"}),B=t.computed(()=>{const a=U.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-time")return`Must be in ${g.value} format.`;const s={hour:"2-digit",minute:"2-digit"},C=e.min?e.min.toLocaleTimeString("en-US",s):null,q=e.max?e.max.toLocaleTimeString("en-US",s):null;if(a==="out-of-bounds"){if(C&&q)return`Must be between ${C} and ${q}.`;if(C)return`Must be ${C} or later.`;if(q)return`Must be ${q} or earlier.`}return""}),Z=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`#${e.id} not found for styling.`);return}const s=a.closest(".k-timepicker");if(!s){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const C=s.parentElement;if(!C){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}C.classList.contains("fk-timepicker")||C.classList.add("fk-timepicker")})};return t.onMounted(()=>{Z()}),{raw:n,rules:h,debugEnabled:w,debugLines:r,placeholder:g,isValid:F,reason:t.readonly(U),validationMessage:B,isComplete:A,inRangeTime:X,cursorPos:l,hour:t.readonly(E),hour24:t.readonly(z),minute:t.readonly(c),period:t.readonly(S),time24:t.readonly(m),parsedRawTime:t.readonly(f),handleChange:M,handleKeyDown:L,handleKeyUp:te,handleClick:v,handleWheel:H,handleBlur:oe,initStyling:Z}}function ot(e){const n=t.shallowRef(null),l=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],w=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??l].flat(),g=h=>h?typeof e.initialFocus=="string"?h.querySelector(e.initialFocus)??h:typeof e.initialFocus=="function"?e.initialFocus(h)??h:h.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??h:null,{activate:y,deactivate:T}=Pe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>g(n.value),...e.focusTrapOptions??{}});let b=null,x=t.ref(null);const V=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const h=(E,c)=>{const S=Array.from(E.querySelectorAll(c));if(!S.length)return null;const z=S.filter(m=>m.offsetParent!==null||m.getClientRects().length>0);return z[z.length-1]??S[S.length-1]??null},P=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of w){const c=h(P,E);if(c)return c}for(const E of w){const c=h(document,E);if(c)return c}return null};return Ve(n,h=>{x.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",h)}),t.watch(()=>e.isOpen.value,h=>{h?(x.value=null,t.nextTick(()=>{const P=V();P&&(n.value=P,setTimeout(()=>y(),0),b||(b=E=>{E.key==="Escape"&&(x.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",b,!0)))})):(T(),b&&(document.removeEventListener("keydown",b,!0),b=null),n.value=null,x.value==="outside"&&t.nextTick(()=>{const P=()=>{const E=e.triggerEl?.value,c=E?.querySelector("input"),S=document.activeElement;S&&(S===c||E&&E.contains(S))&&(c??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(P,0))}),e.returnFocusToTrigger!==!1&&x.value==="escape"&&e.triggerEl?.value&&t.nextTick(()=>{const P=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(P,0))}))}),{popupRef:n,activate:y,deactivate:T,lastCloseReason:t.readonly(x),setPopupEl:h=>n.value=h}}_.useFieldsetTouchTracker=Me,_.useFieldsetValidationKit=Te,_.useGridA11y=$e,_.useGridActiveFilter=qe,_.useMaskedDateInput=nt,_.useMaskedDateRangeInput=at,_.useMaskedTimeInput=rt,_.usePopupMenu=tt,_.usePopupTrap=ot,_.useUSAddress=We,_.useZipTextBox=xe,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(J,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(J=typeof globalThis<"u"?globalThis:J||self,t(J.FeatherKComposables={},J.Vue,J.useFocusTrap))})(this,(function(J,t,Fe){"use strict";const Ve=(e,n)=>{const o=t.ref(null);let g=!1,p=null,m=null;const A=[],M=".k-table-row[data-grid-row-index] [tabindex]",C=()=>{const s=e?.value?.$el;return s?s.closest(".k-grid"):null},q=s=>{const w=C();if(!w)return!1;const f=s.closest(".k-grid-aria-root");if(f)return w.contains(f);const b=s.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return b?w.contains(b):!1},D=s=>s.key==="Enter"||s.code==="Enter"||s.code==="NumpadEnter",R=()=>e?.value?.columns,u=s=>{const w=s.key||s.code;([" ","Spacebar","Space"].includes(w)||D(s))&&(s.preventDefault(),s.stopPropagation(),o.value=s.target,s.target.click())},i=s=>{if(!o.value)return;if(s.code==="Escape"){s.stopPropagation(),o.value&&o.value.focus();return}const w=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),f=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(f){if(s.code==="Tab"){const b=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],x=n?.focusableMenuSelectors??b,k=Array.from(f.querySelectorAll(x.join(",")));if(k.length===0)return;const T=k.findIndex(Z=>Z===document.activeElement);let K;T===-1?K=0:s.shiftKey?K=(T-1+k.length)%k.length:K=(T+1)%k.length,s.preventDefault(),s.stopPropagation(),k[K]?.focus()}}else if(s.code==="ArrowUp"||s.code==="ArrowDown"){s.preventDefault(),s.stopPropagation();const b=w.findIndex(k=>k===document.activeElement);let x=b;s.code==="ArrowUp"?x=b>0?b-1:w.length-1:s.code==="ArrowDown"&&(x=b<w.length-1?b+1:0),w[x]?.focus();return}if(s.code==="Tab"){s.preventDefault(),s.stopPropagation();const b=o.value?.parentElement;(s.shiftKey?b?.previousElementSibling:b?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},h=()=>{p=new MutationObserver(s=>{s.forEach(w=>{w.addedNodes.forEach(f=>{if(f.nodeType===Node.ELEMENT_NODE){const b=f;if(b.classList.contains("k-animation-container")){const k=o.value;k&&(k.dataset.featherKSortable==="true"||t.nextTick(()=>{b.querySelectorAll(".k-columnmenu-item-wrapper").forEach(Z=>{Z.textContent?.toLowerCase().includes("sort")&&Z.remove()})})),b.addEventListener("keydown",i),t.nextTick(()=>{const T=()=>{const K=Array.from(b.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(),T.attempts=0;else if(K.length>1){T.attempts=0;return}else T.attempts===void 0&&(T.attempts=0),T.attempts++<3&&setTimeout(T,200)};T()})}b.querySelectorAll(".k-animation-container").forEach(k=>{k.addEventListener("keydown",i)})}}),w.removedNodes.forEach(f=>{if(f.nodeType===Node.ELEMENT_NODE){const b=f;b.classList.contains("k-animation-container")&&b.removeEventListener("keydown",i),b.querySelectorAll(".k-animation-container").forEach(k=>{k.removeEventListener("keydown",i)})}})})}),p.observe(document.body,{childList:!0,subtree:!0})},L=s=>{const w=s.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(w)||s.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},v=s=>{if(!s.type||!s)return;const w=s.target;if(!w)return;const f=w.closest(".k-table-row[data-grid-row-index]");if(!q(w))return;const b=["ArrowLeft","ArrowRight"].includes(s.code);if(!(L(w)&&!(f&&b))){if(s.code==="Escape"){const x=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(x){s.preventDefault(),s.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(T=>T.setAttribute("tabindex","-1"))}catch{}x.setAttribute("tabindex","0"),x.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(s.code)){if(w.classList.contains("k-grid-header-menu")&&w.classList.contains("k-grid-column-menu")){o.value=w;return}if(f){if(["ArrowDown","ArrowUp"].includes(s.code)){s.preventDefault(),s.stopPropagation();const x=(T,K)=>{let Z=K==="next"?T.nextElementSibling:T.previousElementSibling;for(;Z;){const te=Z;try{if(te.classList.contains("k-table-row"))return te}catch{}Z=K==="next"?Z.nextElementSibling:Z.previousElementSibling}return null},k=s.code==="ArrowDown"?x(f,"next"):x(f,"previous");k&&(f.setAttribute("tabindex","-1"),k.setAttribute("tabindex","0"),k.focus());return}if(["ArrowLeft","ArrowRight"].includes(s.code)){s.preventDefault(),s.stopPropagation();const x=f.querySelectorAll(M);if(x.length===0)return;let k=Array.from(x).findIndex(T=>T===document.activeElement);if(k===-1&&document.activeElement===f){x[0].focus();return}s.code==="ArrowRight"?k=k===x.length-1?0:k+1:s.code==="ArrowLeft"&&(k=k===0?x.length-1:k-1),x[k].focus();return}}}}},S=()=>{t.nextTick(()=>{const s=e.value?.$el;if(!s||typeof s.closest!="function")return;const w=s.closest(".k-grid");w&&w.classList.add("fk-grid")})},I=()=>{if(!m)try{const s=()=>{try{const b=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!b||b.length===0||b.filter(T=>T.getAttribute("tabindex")==="0").length===1)return;const k=b.find(T=>T===document.activeElement||T.contains(document.activeElement));if(b.forEach(T=>T.setAttribute("tabindex","-1")),k){k.setAttribute("tabindex","0");return}b[0].setAttribute("tabindex","0")}catch(b){console.error("ensureSingleTabindex error:",b)}},w=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));w.length>0&&w.forEach((b,x)=>{b.setAttribute("tabindex",x===0?"0":"-1")});const f=e.value.$el.querySelector(".k-table-tbody");f&&(m=new MutationObserver(()=>{s()}),m.observe(f,{childList:!0,subtree:!0}))}catch(s){console.error("Error setting up row navigation:",s)}},$=()=>{t.nextTick(()=>{const w=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");w&&w.forEach(f=>{f.setAttribute("role","button"),f.addEventListener("keydown",u)}),h(),G()})},H=()=>{const w=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");w&&w.forEach(f=>{f.removeEventListener("keydown",u)}),p&&(p.disconnect(),p=null),m&&(m.disconnect(),m=null),A.forEach(f=>f()),A.length=0},G=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((f,b)=>{if(f.dataset.featherKHeaderBound==="true")return;const x=f.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!x)return;const k=R();if(k&&k[b]){const r=k[b].field??"";f.setAttribute("data-feather-k-field",r),f.setAttribute("data-feather-k-filterable",k[b].filterable===!1?"false":"true"),f.setAttribute("data-feather-k-sortable",k[b].sortable===!1?"false":"true")}const T=f.dataset.featherKFilterable!=="false",K=f.dataset.featherKSortable!=="false";x.setAttribute("tabindex","-1"),T||K?f.style.cursor="pointer":f.style.cursor="default",T?(f.setAttribute("tabindex","0"),f.setAttribute("role","button"),f.setAttribute("aria-haspopup","menu")):(f.setAttribute("tabindex","0"),f.setAttribute("role","columnheader"),f.removeAttribute("aria-haspopup"));const Z=r=>{r.target?.closest(".k-column-resizer")||(o.value=f,x.click())},te=r=>{if(T)o.value=f,r.preventDefault(),r.stopPropagation(),Z(r);else if(K){o.value=f;const y=f.querySelector(".k-link");y&&y.click()}};f.addEventListener("click",te),A.push(()=>{f.removeEventListener("click",te)});const oe=r=>{if((D(r)||r.code==="Space")&&(T||K)){if(r.preventDefault(),r.stopPropagation(),o.value=f,o.value.focus(),T)Z(r);else if(K){const y=f.querySelector(".k-link");y&&y.click()}}};f.addEventListener("keydown",oe,!0),A.push(()=>{f.removeEventListener("keydown",oe,!0)}),f.dataset.featherKHeaderBound="true"});const w=document.querySelector(".k-grid-header .k-table-thead");if(w&&w.dataset.featherKHeaderBound!=="true"){const f=b=>{const x=b.target.closest("th");x&&(D(b)||b.code==="Space")&&x.dataset.featherKFilterable==="false"&&x.dataset.featherKSortable==="false"&&(b.preventDefault(),b.stopImmediatePropagation())};w.addEventListener("keydown",f,!0),A.push(()=>{w.removeEventListener("keydown",f,!0)}),w.dataset.featherKHeaderBound="true"}},_=function(s,w){const f=s?.event?.event.target,b=R();if(!f||!b)return;const x=f.classList.contains("k-grid-header-menu"),k=f.classList.contains("k-columnmenu-item"),T=b.find(K=>K.field===s?.event?.field)?.sortable&&!0;if(!x){if(k&&!T){s?.event?.sort?.filter(Z=>Z.field!==s?.event?.field);return}typeof w=="function"&&t.nextTick(()=>{o.value&&o.value.focus(),w(s),t.nextTick(()=>{G()})})}},ae=()=>{if(!g)try{S(),I(),$(),g=!0}catch(s){console.error("initA11y failed:",s),H()}};return t.onBeforeUnmount(()=>{H()}),{activeFilterButton:o,handleGridKeyDown:v,handleSortChange:_,initA11y:ae}},Re=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Pe=e=>!!e&&typeof e=="object"&&"field"in e,De=(e,n)=>!e||typeof e!="object"?!1:Re(e)?e.filters.some(o=>De(o,n)):Pe(e)?e.field===n:!1,$e=e=>n=>e.value?.filters&&e.value.filters.some(o=>De(o,n))?"active":"",Le=["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"],Ke=e=>{const{onRowAction:n,gridRef:o,dataItems:g,ignoreSelectors:p=[],shouldIgnoreTarget:m,enableKeyboardAction:A=!0}=e,M=[...Le,...p],C=(u,i)=>{if(!u)return!1;const h=M.join(",");return u.closest&&u.closest(h)?!0:m&&i?m(u,i):!1},q=u=>{if(typeof window>"u")return!1;const i=window.getSelection();if(!i||i.isCollapsed||!i.toString().trim())return!1;if(u&&i.anchorNode&&i.focusNode){const h=u.closest(".k-table-row")||u.closest(".k-grid")||u,L=i.anchorNode.nodeType===Node.ELEMENT_NODE?i.anchorNode:i.anchorNode.parentElement,v=i.focusNode.nodeType===Node.ELEMENT_NODE?i.focusNode:i.focusNode.parentElement,S=!!(L&&h.contains(L)),I=!!(v&&h.contains(v));return S||I}return!0};return{handleRowClick:u=>{const i=u?.htmlEvent||u?.event||u?.nativeEvent||(u instanceof Event?u:void 0);if(i&&i.button!==void 0&&i.button!==0)return;const h=i?.target||u?.target;if(h&&C(h,i||u)||q(h))return;const L={dataItem:u.dataItem,rowIndex:u.rowIndex,field:u.field,event:i||u,triggerType:"click",ctrlKey:!!i?.ctrlKey,shiftKey:!!i?.shiftKey,metaKey:!!i?.metaKey,altKey:!!i?.altKey};n(u.dataItem,L)},handleRowKeyDown:(u,i)=>{if(!A)return;const h=u.key||u.code;if(!(h==="Enter"||h==="NumpadEnter"||h===" "||h==="Space"||u.code==="Enter"||u.code==="NumpadEnter"||u.code==="Space"))return;const v=u.target;if(!v)return;const S=v.closest(".k-table-row[data-grid-row-index], .k-table-row");if(!S||C(v,u))return;u.preventDefault(),u.stopPropagation();const I=S.getAttribute("data-grid-row-index"),$=I!==null?parseInt(I,10):void 0;let H=i;if(H===void 0){const _=(Array.isArray(g)?g:g?.value)||o?.value?.props?.dataItems||o?.value?.dataItems;_&&$!==void 0&&$>=0&&$<_.length&&(H=_[$])}if(H===void 0)return;const G={dataItem:H,rowIndex:$,event:u,triggerType:"keyboard",ctrlKey:!!u.ctrlKey,shiftKey:!!u.shiftKey,metaKey:!!u.metaKey,altKey:!!u.altKey};n(H,G)},isIgnoredTarget:C}},qe="Enter a valid ZIP code with exactly 5 or 9 digits.",Ee=e=>{const n=e.replace(/\D/g,"").slice(0,9);return n.length>5?`${n.slice(0,5)}-${n.slice(5)}`:n},Ne=(e,n)=>e.slice(0,Math.max(0,n)).replace(/\D/g,"").length,Oe=e=>e<=5?e:Math.min(e+1,10),xe=e=>{const n=t.ref(Ee(e.initialValue??"")),o=t.ref(!1),g=t.ref(e.errorMessage?.trim()||qe),p=t.computed(()=>n.value.replace(/\D/g,"")),m=t.computed(()=>{const i=p.value.length;return i===5||i===9}),A=t.computed(()=>o.value&&!m.value),M=t.computed(()=>!o.value||m.value),C=t.computed(()=>o.value),q=(i,h)=>{const L=Oe(h);t.nextTick(()=>{i.isConnected&&i.setSelectionRange(L,L)})};return{zipDisplay:n,submitted:o,errorMessage:g,wrapperClass:"fk-zip-textbox",zipRaw:p,isZipValid:m,showZipError:A,textBoxValid:M,textBoxValidate:C,handleZipInput:(...i)=>{const h=i[0],v=h?.event?.target,S=h?.value,I=Array.isArray(S)?S.join(""):String(S??""),$=v?.selectionStart!==void 0&&v.selectionStart!==null?Ne(v.value,v.selectionStart):I.replace(/\D/g,"").length;n.value=Ee(I),v&&q(v,$)},submitAndValidate:i=>{o.value=!0;const h=m.value;return!h&&i?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),h},buildPayload:()=>({zip:p.value})}};function Ie(e,n){const o=t.ref(!1);t.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!n.isValid()))});function g(m){const A=e.value??m.currentTarget,M=m.relatedTarget;(!A||!A.contains(M))&&(o.value=!0)}function p(){o.value=!1}return{touched:o,onFocusout:g,reset:p}}function Te(e,n){const o=t.ref(!1),g=t.ref(!1),p=t.computed(()=>t.toValue(n.submitted)||o.value),m=t.computed(()=>!p.value||n.isValid()),A=Ie(e,{isValid:()=>m.value});function M(u){return t.computed(()=>!p.value||t.toValue(u))}function C(u){return Object.fromEntries(Object.entries(u).map(([i,h])=>[i,M(h)]))}function q(u){const i=t.toValue(u);if(!i)return;i.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function D(u){if(g.value){g.value=!1;return}A.onFocusout(u),A.touched.value&&(o.value=!0)}function R(){o.value=!1,g.value=!0,A.reset()}return{touched:o,fieldsetValidate:p,onFocusout:D,reset:R,createFieldValidity:M,createFieldValidationsMap:C,focusFirstInvalidField:q}}const Ue=[{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 he(e){if(e&&typeof e=="object"&&"value"in e){const n=e.value;return typeof n=="string"?n:String(n??"")}return""}function Be(){const e=t.reactive({address1:"",address2:"",city:"",state:null,zip:""});return{formData:e,onAddress1Input:(...A)=>{e.address1=he(A[0])},onAddress2Input:(...A)=>{e.address2=he(A[0])},onCityInput:(...A)=>{e.city=he(A[0])},onStateChange:A=>{e.state=A.value},resetFormData:()=>{e.address1="",e.address2="",e.city="",e.state=null,e.zip=""}}}function ze(e,n="zip"){const o=xe({id:n}),{zipDisplay:g,zipRaw:p,isZipValid:m,wrapperClass:A,handleZipInput:M}=o;return t.watch(p,q=>{e.zip=q}),{zipDisplay:g,isZipValid:m,zipWrapperClass:A,onZipInput:M,resetZip:()=>{g.value="",e.zip=""}}}function He(e){const n=t.computed(()=>e.formData.address1.trim()!==""),o=t.computed(()=>e.formData.city.trim()!==""),g=t.computed(()=>!!e.formData.state),p=t.computed(()=>t.toValue(e.isZipValid)),m=t.computed(()=>n.value&&o.value&&g.value&&p.value);return{strictAddress1Valid:n,strictCityValid:o,strictStateValid:g,strictZipValid:p,strictAddressValid:m}}function Ze(e){if(!e)return;e.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function Ye(e,n){const o=e??n.currentTarget,g=n.relatedTarget;return!o||!o.contains(g)}function We(e){const n=t.ref(t.toValue(e.fieldsetRef));t.watchEffect(()=>{n.value=t.toValue(e.fieldsetRef)});const o=t.ref(!1),g=t.ref(!1),p=t.computed(()=>t.toValue(e.required)??!0),{formData:m,onAddress1Input:A,onAddress2Input:M,onCityInput:C,onStateChange:q,resetFormData:D}=Be(),R=`${e.addressId}-zip`,{zipDisplay:u,isZipValid:i,zipWrapperClass:h,onZipInput:L,resetZip:v}=ze(m,R),{strictAddress1Valid:S,strictCityValid:I,strictStateValid:$,strictZipValid:H,strictAddressValid:G}=He({formData:m,isZipValid:i}),_=Te(n,{submitted:o,isValid:()=>G.value}),{touched:ae,fieldsetValidate:s,onFocusout:w,reset:f}=_,b=_.createFieldValidationsMap({address1:S,city:I,state:$,zip:H,address:G}),{address1:x,city:k,state:T,zip:K,address:Z}=b,te=t.computed(()=>p.value?s.value:!1),oe=t.computed(()=>p.value?x.value:!0),r=t.computed(()=>p.value?k.value:!0),y=t.computed(()=>p.value?T.value:!0),V=t.computed(()=>p.value?K.value:!0),U=t.computed(()=>p.value?Z.value:!0),B={value:null,label:"State"},Y=Ue.map(({label:d,value:E})=>({label:d,value:E})),a=t.computed(()=>({address1:m.address1.trim(),address2:m.address2.trim(),city:m.city.trim(),state:(m.state??"").trim().toUpperCase(),zip:m.zip.replace(/\D/g,"")})),c=t.computed(()=>m.address1.trim()===""&&m.address2.trim()===""&&m.city.trim()===""&&(m.state??"").trim()===""&&m.zip.replace(/\D/g,"")===""),F=t.computed(()=>!c.value),N=t.computed(()=>!p.value&&F.value&&(!S.value||!I.value||!$.value)),W=t.computed(()=>{const d=m.zip.replace(/\D/g,"");return!p.value&&F.value&&d.length!==5&&d.length!==9}),X=t.computed(()=>!p.value&&F.value&&!G.value),O=t.computed(()=>!p.value&&X.value&&(g.value||o.value));return t.watch(a,()=>{p.value||(g.value=!1)}),t.watch(p,d=>{d||(o.value=!1,g.value=!1,f())}),{formData:m,submitted:o,touched:ae,addressValidate:te,address1Valid:oe,cityValid:r,stateValid:y,zipValid:V,addressValid:U,optionalFeedbackActive:O,optionalPartialInvalid:X,optionalMissingRequiredFields:N,optionalZipInvalid:W,stateDefaultItem:B,stateOptions:Y,zipDisplay:u,zipWrapperClass:h,onAddress1Input:A,onAddress2Input:M,onCityInput:C,onStateChange:q,onZipInput:L,onFieldsetFocusout:d=>{const E=Ye(n.value,d);w(d),!p.value&&E&&(g.value=!0)},normalizedPayload:a,validateForSubmit:async()=>p.value?(o.value=!0,G.value?{isValid:!0,payload:a.value}:(await t.nextTick(),Ze(n.value),{isValid:!1,payload:null})):c.value||G.value?(o.value=!1,{isValid:!0,payload:a.value}):(o.value=!0,{isValid:!1,payload:null}),reset:()=>{o.value=!1,g.value=!1,f(),D(),v()}}}const Ge=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const je=Object.prototype.toString,_e=e=>je.call(e)==="[object Object]",ye=()=>{};function ve(e){return Array.isArray(e)?e:[e]}function Je(e,n,o){return t.watch(e,n,{...o,immediate:!0})}const Me=Ge?window:void 0;function pe(e){var n;const o=t.toValue(e);return(n=o?.$el)!==null&&n!==void 0?n:o}function be(...e){const n=(g,p,m,A)=>(g.addEventListener(p,m,A),()=>g.removeEventListener(p,m,A)),o=t.computed(()=>{const g=ve(t.toValue(e[0])).filter(p=>p!=null);return g.every(p=>typeof p!="string")?g:void 0});return Je(()=>{var g,p;return[(g=(p=o.value)===null||p===void 0?void 0:p.map(m=>pe(m)))!==null&&g!==void 0?g:[Me].filter(m=>m!=null),ve(t.toValue(o.value?e[1]:e[0])),ve(t.unref(o.value?e[2]:e[1])),t.toValue(o.value?e[3]:e[2])]},([g,p,m,A],M,C)=>{if(!g?.length||!p?.length||!m?.length)return;const q=_e(A)?{...A}:A,D=g.flatMap(R=>p.flatMap(u=>m.map(i=>n(R,u,i,q))));C(()=>{D.forEach(R=>R())})},{flush:"post"})}function Ce(e,n,o={}){const{window:g=Me,ignore:p=[],capture:m=!0,detectIframe:A=!1,controls:M=!1}=o;if(!g)return M?{stop:ye,cancel:ye,trigger:ye}:ye;let C=!0;const q=v=>t.toValue(p).some(S=>{if(typeof S=="string")return Array.from(g.document.querySelectorAll(S)).some(I=>I===v.target||v.composedPath().includes(I));{const I=pe(S);return I&&(v.target===I||v.composedPath().includes(I))}});function D(v){const S=t.toValue(v);return S&&S.$.subTree.shapeFlag===16}function R(v,S){const I=t.toValue(v),$=I.$.subTree&&I.$.subTree.children;return $==null||!Array.isArray($)?!1:$.some(H=>H.el===S.target||S.composedPath().includes(H.el))}const u=v=>{const S=pe(e);if(v.target!=null&&!(!(S instanceof Element)&&D(e)&&R(e,v))&&!(!S||S===v.target||v.composedPath().includes(S))){if("detail"in v&&v.detail===0&&(C=!q(v)),!C){C=!0;return}n(v)}};let i=!1;const h=[be(g,"click",v=>{i||(i=!0,setTimeout(()=>{i=!1},0),u(v))},{passive:!0,capture:m}),be(g,"pointerdown",v=>{const S=pe(e);C=!q(v)&&!!(S&&!v.composedPath().includes(S))},{passive:!0}),A&&be(g,"blur",v=>{setTimeout(()=>{const S=pe(e);let I=g.document.activeElement;for(;I?.shadowRoot;)I=I.shadowRoot.activeElement;I?.tagName==="IFRAME"&&!S?.contains(g.document.activeElement)&&n(v)},0)},{passive:!0})].filter(Boolean),L=()=>h.forEach(v=>v());return M?{stop:L,cancel:()=>{C=!1},trigger:v=>{C=!0,u(v),C=!1}}:L}const ke=e=>{if(e instanceof HTMLElement)return e;const n=e?.$el;return n instanceof HTMLElement?n:null},Xe=e=>e instanceof HTMLButtonElement||e.getAttribute("role")==="button"||e.hasAttribute("aria-haspopup"),Qe=e=>{const n=t.ref(null),o=e.menuItemSelector??".k-menu-item:not(.k-disabled)",g=()=>ke(e.triggerRef.value),p=()=>e.resolveFocusTarget?.()??ke(e.focusTargetRef?.value),m=()=>{const i=p();if(i)return i.focus(),!0;const h=g();return h?.focus(),!!h},A=()=>{ke(e.menuRef.value)?.querySelector(o)?.focus()},M=i=>{e.isOpen.value&&(n.value=i,e.requestHide())};Ce(e.menuRef,()=>M("outside-click"),{ignore:[e.triggerRef]}),e.manageAriaExpanded!==!1&&t.watch([e.isOpen,e.triggerRef],([i])=>{const h=g();!h||!Xe(h)||h.setAttribute("aria-expanded",i?"true":"false")},{immediate:!0,flush:"post"});const C=()=>{if(e.isOpen.value){M("trigger-click");return}e.requestShow(),t.nextTick(A)};return{handleMenuSelect:(i,h)=>{M(i.event?.type?.startsWith("key")?"keyboard":"mouse-selection"),h?.(i)},handleActionButtonClick:C,handleActionButtonKeydown:i=>{if(i.key==="Enter"||i.code==="Space"){i.preventDefault(),C();return}if(i.key==="Escape"){if(i.preventDefault(),i.stopPropagation(),e.isOpen.value){M("keyboard");return}m()}},handleActionMenuEscape:i=>{i.preventDefault(),i.stopPropagation(),M("keyboard")},handlePopupClose:()=>{t.nextTick(()=>{n.value==="keyboard"?m():n.value==="mouse-selection"&&g()?.focus(),n.value=null})}}};function et(e){const n=t.ref(""),o=t.ref(void 0),g=t.ref(!!e.debug),p=t.ref(e.dateFormat??"mm/dd/yyyy"),m=t.computed(()=>!!e.required),A=1e3,M=t.ref(!1),C=["ArrowUp","ArrowDown"],q=["ArrowLeft","ArrowRight"],D=t.computed(()=>(n.value??"").replace(/\D/g,"")),R=r=>r<=2?"mm":r<=5?"dd":D.value.length<=10?"yyyy":"mm",u=t.computed(()=>{const r=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),i=t.computed(()=>{const r=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(2,"0")}),h=t.computed(()=>{const r=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(r).toString().padStart(4,"0")}),L=r=>{if(D.value.length===0){e.onChange({value:null,event:r});return}if(D.value.length<8){e.onChange({value:null,event:r});return}if((n.value??"").length===10&&D.value.length===8){const[y,V,U]=n.value.split("/"),B=parseInt(y),Y=parseInt(V),a=parseInt(U);if(G(a,B,Y)){const c=$(a,B,Y);v(c)?e.onChange({value:c,event:r}):e.onChange({value:null,event:r})}else e.onChange({value:null,event:r})}},v=r=>{const y=e.min??void 0,V=e.max??void 0;return!(y&&r<y||V&&r>V)},S=t.computed(()=>{if((n.value??"").length===10&&D.value.length===8){const[r,y,V]=(n.value??"").split("/"),U=parseInt(r),B=parseInt(y),Y=parseInt(V);if(G(Y,U,B))return $(Y,U,B)}return null}),I=t.computed(()=>(n.value??"").length===10&&D.value.length===8),$=(r,y,V)=>{const U=new Date(0);return U.setFullYear(r,y-1,V),U.setHours(0,0,0,0),U},H=(r,y)=>$(r,y+1,0).getDate(),G=(r,y,V)=>y>=1&&y<=12&&r>=A&&V>=1&&V<=H(r,y),_=r=>{n.value=r.value;const y=r.event?.target;o.value=y?.selectionStart??0,L(r)},ae=r=>{o.value=r.target.selectionStart??0},s=(r,y,V)=>{const U=y?.selectionStart??o.value??0;o.value=U;let B=parseInt(u.value),Y=parseInt(i.value),a=parseInt(h.value);if(!(D.value.length>=8)||!G(a,B,Y)){const z=e.defaultValue??new Date;B=z.getMonth()+1,Y=z.getDate(),a=z.getFullYear(),n.value=`${String(B).padStart(2,"0")}/${String(Y).padStart(2,"0")}/${String(a)}`;const le=$(a,B,Y);e.onChange({value:v(le)?le:null,event:V}),k({useRAF:!0});return}const F=R(U);if(F==="mm")B=r==="ArrowUp"?B<12?B+1:1:B>1?B-1:12;else if(F==="dd"){const z=new Date(a,B,0).getDate();Y=r==="ArrowUp"?Y<z?Y+1:1:Y>1?Y-1:z}else F==="yyyy"&&(a=r==="ArrowUp"?a+1:Math.max(1,a-1));n.value=`${String(B).padStart(2,"0")}/${String(Y).padStart(2,"0")}/${String(a)}`;const[N,W,X]=n.value.split("/"),O=$(parseInt(X),parseInt(N),parseInt(W));O.toString()!=="Invalid Date"&&parseInt(X)>=1e3?e.onChange({value:v(O)?O:null,event:V}):e.onChange({value:null,event:V}),k({useRAF:!0})},w=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(C.includes(r.key)){if(r.altKey)return;r.preventDefault(),r.stopPropagation();const y=r.target;s(r.key,y,r);return}},f=r=>{r.preventDefault();const y=r.deltaY<0?"ArrowUp":"ArrowDown";s(y,r.target,r)},b=r=>{const y=r.target;if(q.includes(r.key)){o.value=y?.selectionStart??0;return}if(C.includes(r.key)){if(r.altKey)return;o.value=y?.selectionStart??0}},x=r=>{M.value=!0,m.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&D.value.length===0&&(e.externalValue.value="");const y=r.target;y&&(o.value=y.selectionStart??0)},k=r=>{const y=()=>{const V=document.getElementById(e.id);if(!V)return;const U=r?.pos??o.value??V.value.length;try{V.focus(),V.setSelectionRange(U,U)}catch{}};t.nextTick(()=>{if(r?.delay&&r.delay>0){setTimeout(y,r.delay);return}if(r?.useRAF){requestAnimationFrame(y);return}y()})};e.externalValue&&t.watch(e.externalValue,r=>{if(r){const y=new Date(r);if(y.toString()!=="Invalid Date"){const V=(y.getMonth()+1).toString().padStart(2,"0"),U=y.getDate().toString().padStart(2,"0"),B=y.getFullYear().toString();n.value=`${V}/${U}/${B}`,k({delay:50});return}}},{immediate:!0});const T=t.computed(()=>[["Date",`${u.value} / ${i.value} / ${h.value}`],["Digits only",D.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=t.computed(()=>{if(!m.value){if(!I.value)return!0;const y=S.value;return y?v(y):!1}if(!M.value)return!0;const r=S.value;return!I.value||!r?!1:v(r)}),Z=t.computed(()=>{if(!m.value){if(!I.value)return;const y=S.value;return y?v(y)?"valid":"out-of-bounds":"invalid-date"}if(!M.value)return;if(D.value.length===0||!I.value)return"incomplete";const r=S.value;return r?v(r)?"valid":"out-of-bounds":"invalid-date"}),te=t.computed(()=>{const r=Z.value;if(!r||r==="valid")return"";if(r==="incomplete")return"Required";if(r==="invalid-date")return`Must be in ${p.value} format.`;const y=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,V=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(r==="out-of-bounds"){if(y&&V)return`Must be between ${y} and ${V}.`;if(y)return`Must be on or after ${y}.`;if(V)return`Must be on or before ${V}.`}return""}),oe=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`ID (#${e.id}) not found for styling.`);return}const y=r.closest(".k-datepicker");if(!y){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const V=y.parentElement;if(V){if(V.classList.contains("fk-datepicker"))return;V.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{oe()}),{raw:n,cursorPos:o,debugEnabled:g,debugLines:T,placeholder:p,isValid:K,reason:t.readonly(Z),validationMessage:te,digitsOnly:D,month:t.readonly(u),day:t.readonly(i),year:t.readonly(h),datePart:R,handleChange:_,handleKeyDown:w,handleWheel:f,handleKeyUp:b,handleClick:ae,handleBlur:x,initStyling:oe}}function tt(e){const n=t.ref(""),o=t.ref(void 0),g=t.ref(!!e.debug),p=t.ref(!1),m=1440*60*1e3,A=365*m,M=new Date,C=new Date(M.getTime()-A),q=new Date(M.getTime()+A);e.min=e.min??C,e.max=e.max??q;const D=t.computed(()=>(n.value??"").replace(/\D/g,"")),R=(l,d)=>new Date(l,d,0).getDate(),u=(l,d,E)=>d>=1&&d<=12&&l>=1e3&&E>=1&&E<=R(l,d),i=l=>Date.UTC(l.getFullYear(),l.getMonth(),l.getDate()),h=l=>{if(!l)return null;const d=e.min??new Date(Date.now()-90*m),E=e.max??new Date,P=i(l);return P<i(d)||P>i(E)?null:l},L=(l,d)=>e.allowReverse??!1?!0:l<=d,v=t.computed(()=>(n.value?.length??0)>=23&&D.value.length>=16),S=l=>{if((l??"").length<23||D.value.length<16)return{start:null,end:null};const d=l.substring(0,10),E=l.substring(13,23),[P,Q,ee]=d.split("/").map(ue=>parseInt(ue||"0",10)),[se,ce,de]=E.split("/").map(ue=>parseInt(ue||"0",10)),fe=new Date(ee,P-1,Q),me=new Date(de,se-1,ce),Se=u(ee,P,Q)&&fe.toString()!=="Invalid Date",we=u(de,se,ce)&&me.toString()!=="Invalid Date";return{start:Se?fe:null,end:we?me:null}},I=e.externalValid??t.ref(!0),$=t.computed(()=>S(n.value)),H=t.computed(()=>{const l=h($.value.start),d=h($.value.end);return{start:l,end:d}}),G=t.computed(()=>{if(!v.value)return;const l=H.value.start,d=H.value.end;if(!l||!d)return;const E=Math.abs(i(d)-i(l));return Math.round(E/864e5+1)}),_=t.ref(!1),ae=t.computed(()=>{if(!_.value)return;const{start:l,end:d}=$.value;if(!v.value)return"incomplete";if(!l||!d)return"invalid-date";if(!H.value.start||!H.value.end)return"out-of-bounds";const E=H.value.start,P=H.value.end;return L(E,P)?typeof e.maxSpanDays=="number"&&G.value!==void 0&&G.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),s=t.computed(()=>{const l=ae.value;return l===void 0||l==="valid"}),w=t.computed(()=>{const{min:l,max:d}=e,E=ae.value;if(!E)return"";switch(E){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 l&&d?`Dates must be between ${k(l)} and ${k(d)}.`:"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""}}),f=["ArrowUp","ArrowDown"],b=["ArrowLeft","ArrowRight"],x=(l,d)=>String(l).padStart(d,"0"),k=l=>`${x(l.getMonth()+1,2)}/${x(l.getDate(),2)}/${x(l.getFullYear(),4)}`,T=l=>l<=2?{side:"start",part:"mm"}:l<=5?{side:"start",part:(l<=3,"dd")}:l<=11?{side:"start",part:"yyyy"}:l<=15?{side:"end",part:"mm"}:l<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},K=(l,d,E)=>{const P=d?.selectionStart??o.value??0;o.value=P;const{start:Q,end:ee}=S(n.value);if(!Q&&!ee){const j=new Date,ie=k(j);n.value=`${ie} - ${ie}`,e.onChange({value:{start:j,end:j},event:E}),t.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),re=o.value??0;ne&&(ne.focus(),ne.setSelectionRange(re,re))})});return}const se=new Date,ce=T(P);let de=Q?new Date(Q):new Date(se),fe=ee?new Date(ee):new Date(se);const me=(j,ie)=>{if(ie==="mm"){const ne=j.getMonth()+1,re=l==="ArrowUp"?ne<12?ne+1:1:ne>1?ne-1:12;j.setMonth(re-1);const ge=R(j.getFullYear(),re);j.getDate()>ge&&j.setDate(ge)}else if(ie==="dd"){const ne=R(j.getFullYear(),j.getMonth()+1),re=j.getDate(),ge=l==="ArrowUp"?re<ne?re+1:1:re>1?re-1:ne;j.setDate(ge)}else if(ie==="yyyy"){const ne=j.getFullYear();j.setFullYear(l==="ArrowUp"?ne+1:Math.max(1,ne-1));const re=R(j.getFullYear(),j.getMonth()+1);j.getDate()>re&&j.setDate(re)}};ce.side==="start"?me(de,ce.part):me(fe,ce.part);const Se=k(de),we=k(fe);n.value=`${Se} - ${we}`;const ue=h(de),Ae=h(fe);ue&&Ae&&L(ue,Ae)?e.onChange({value:{start:ue,end:Ae},event:E}):e.onChange({value:null,event:E}),t.nextTick(()=>{requestAnimationFrame(()=>{const j=document.getElementById(e.id),ie=o.value??0;j&&(j.focus(),j.setSelectionRange(ie,ie))})})},Z=l=>{const{start:d,end:E}=S(n.value);if(!d||!E){e.onChange({value:null,event:l});return}const P=h(d),Q=h(E);if(!P||!Q){e.onChange({value:null,event:l});return}if(!L(P,Q)){e.onChange({value:null,event:l});return}e.onChange({value:{start:P,end:Q},event:l})},te=l=>{const d=l.value??"",E=l.event;if(!d&&E&&E.type==="click"){Y(E);return}n.value=d;const P=E?.target;o.value=P?.selectionStart??0,Z(l)},oe=l=>{o.value=l.target.selectionStart??0},r=l=>{if(l.code==="Space"||l.key===" "){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if(l.key==="ArrowDown"&&l.altKey){l.preventDefault(),l.stopPropagation(),e.onShowCalendar(l);return}if(f.includes(l.key)){l.preventDefault(),l.stopPropagation();const d=l.target;K(l.key,d,l);return}},y=l=>{l.preventDefault();const d=l.deltaY<0?"ArrowUp":"ArrowDown";K(d,l.target,l)},V=l=>{if(b.includes(l.key)||f.includes(l.key)){const d=l.target;o.value=d?.selectionStart??0}},U=()=>{_.value=!0,(e.manageValid??!0)&&(I.value=s.value)},B=l=>{U()},Y=l=>{n.value="",o.value=0,e.onChange({value:null,event:l}),U(),t.nextTick(()=>{const d=document.getElementById(e.id);d&&(d.focus(),d.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,l=>{const d=l?.start??null,E=l?.end??null;if(d&&E){if(n.value=`${k(d)} - ${k(E)}`,e.isOpen?.value&&p.value&&e.onRequestClose){const P=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),p.value=!1,U()},P)}return}},{immediate:!0});const a=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),c=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),F=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),N=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),W=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),X=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),O=t.computed(()=>{const{start:l,end:d}=S(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(a.value).padStart(2,"0")} / ${String(c.value).padStart(2,"0")} / ${String(F.value).padStart(4,"0")}`},{label:"End",value:`${String(N.value).padStart(2,"0")} / ${String(W.value).padStart(2,"0")} / ${String(X.value).padStart(4,"0")}`},{label:"Digits only",value:D.value},{label:"Mask complete",value:`${v.value}`},{label:"Parsed",value:`${l?l.toDateString():"-"} | ${d?d.toDateString():"-"}`},{label:"Valid (managed)",value:`${I.value??"-"}`},{label:"Span (days)",value:`${G.value??"-"}`},{label:"Reason",value:`${ae.value??"-"}`},{label:"Cursor in",value:`${o.value??"-"} (${(()=>{const E=o.value??0,P=T(E);return`${P.side}.${P.part}`})()})`}]}),z=()=>{t.nextTick(()=>{const l=document.getElementById(e.id);if(!l){console.warn(`#${e.id} not found for styling.`);return}const d=l.closest("div");if(!d){console.warn(`Parent div of #${e.id} not found for styling.`);return}d.classList.contains("fk-daterangepicker")||d.classList.add("fk-daterangepicker")})};t.onMounted(()=>{z()});const le=()=>{t.nextTick(()=>{try{const l=Array.from(document.querySelectorAll(".k-animation-container"));if(!l.length)return;const E=[...l].reverse().find(ee=>ee.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!E)return;const P=E.querySelectorAll(".k-calendar-table");let Q=!1;P.forEach(ee=>{ee.tabIndex===0&&(Q?ee.tabIndex=-1:Q=!0)})}catch(l){console.warn(l)}})};return e.isOpen&&t.watch(e.isOpen,l=>{l&&setTimeout(()=>le(),0)},{immediate:!1}),{raw:n,cursorPos:o,debugEnabled:g,debugLines:O,digitsOnly:D,valid:I,validComputed:t.readonly(s),reason:t.readonly(ae),validationMessage:t.readonly(w),spanDays:t.readonly(G),month1:t.readonly(a),day1:t.readonly(c),year1:t.readonly(F),month2:t.readonly(N),day2:t.readonly(W),year2:t.readonly(X),handleChange:te,handleKeyDown:r,handleWheel:y,handleKeyUp:V,handleClick:oe,handleBlur:B,handleClear:Y,onCalendarChange:()=>{p.value=!0},initStyling:z}}function nt(e){const n=t.ref(""),o=t.ref(void 0),g=t.ref(!!e.debug),p=t.ref(e.timeFormat??"hh:mm AM"),m=t.computed(()=>!!e.required),A=t.ref(!1),M=["ArrowUp","ArrowDown"],C=["ArrowLeft","ArrowRight"],q=t.computed(()=>(n.value??"").replace(/\D/g,"")),D={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",u=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",c=parseInt(a);return Math.min(Math.max(c,0),23)}),i=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",c=parseInt(a);return Math.min(Math.max(c,0),59)}),h=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),L=t.computed(()=>{const a=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),c=h.value;return a===12?c==="AM"?0:12:c==="PM"?a+12:a}),v=t.computed(()=>S.value?`${String(L.value).padStart(2,"0")}:${String(i.value).padStart(2,"0")}:00`:null),S=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),I=(a,c,F)=>{let N=a%12;return N===0&&(N=12),`${String(N).padStart(2,"0")}:${String(c).padStart(2,"0")} ${F}`},$=a=>{const c=a.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!c)return null;const F=parseInt(c[1]),N=parseInt(c[2]),W=c[3].toUpperCase();if(F<1||F>12||N<0||N>59)return null;let X=F%12;W==="PM"&&(X+=12);const O=new Date;return O.setSeconds(0,0),O.setHours(X),O.setMinutes(N),O},H=a=>{if(q.value.length===0){e.onChange({value:null,event:a});return}if(!S.value){e.onChange({value:null,event:a});return}const c=$(n.value);c&&_(c)?e.onChange({value:c,event:a}):e.onChange({value:null,event:a})},G=a=>a.getHours()*60+a.getMinutes(),_=a=>{const c=e.min??void 0,F=e.max??void 0,N=G(a);if(c){const W=G(c);if(N<W)return!1}if(F){const W=G(F);if(N>W)return!1}return!0},ae=a=>{const c=a.getHours(),F=c>=12?"PM":"AM";n.value=I(c,a.getMinutes(),F)},s=(a,c)=>{e.onChange({value:a,event:c})},w=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const a=document.getElementById(e.id);if(a){a.focus();const c=(a.value??"").length;a.setSelectionRange(c,c)}})})})},f=a=>{const c=a?.event?.target;return c?c.closest(".k-time-now")?"now":c.closest(".k-time-accept")?"set":null:null},b=(a,c)=>{a&&_(a)?s(a,c):s(null,c)},x=(...a)=>{const c=a[0];if(!c)return;const F=f(c);if(F==="now"){const W=new Date;ae(W),b(W,c),w();return}if(c?.value instanceof Date){const W=new Date(c.value);ae(W),b(W,c),F==="set"&&w();return}if(c?.value===null){n.value="",s(null,c);return}n.value=c.value;const N=c.event?.target;o.value=N?.selectionStart??0;try{const W=o.value??0;if(R(W)==="ampm"&&(n.value??"").length>=8){const X=n.value.charAt(6);/[Aa]/.test(X)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})})):/[Pp]/.test(X)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const O=document.getElementById(e.id);O&&(O.focus(),O.setSelectionRange(8,8))})}))}}catch{}H(c)},k=a=>{o.value=a.target.selectionStart??0},T=(a,c,F)=>{const N=c?.selectionStart??o.value??0;o.value=N;const W=R(N),X=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!X){if((n.value??"").length===0||q.value.length===0){const d=new Date,E=d.getHours(),P=E>=12?"PM":"AM";n.value=I(E,d.getMinutes(),P);const Q=$(n.value);b(Q,F),t.nextTick(()=>{requestAnimationFrame(()=>{const ee=document.getElementById(e.id),se=o.value??0;ee&&(ee.focus(),ee.setSelectionRange(se,se))})})}return}let O=parseInt(X[1]),z=parseInt(X[2]),le=X[3].toUpperCase();if(W==="hh")a==="ArrowUp"?O=O<12?O+1:1:O=O>1?O-1:12;else if(W==="mm"){const d=e.minuteStepRef?.value??e.minuteStep??1;if(d===1)a==="ArrowUp"?z=z<59?z+1:0:z=z>0?z-1:59;else if(a==="ArrowUp"){const E=z%d;let P=E===0?z+d:z+(d-E);P>=60&&(P=0),z=P}else{const E=z%d;let P=E===0?z-d:z-E;P<0&&(P=60-d),z=P}}else W==="ampm"&&(le=le==="AM"?"PM":"AM");n.value=`${String(O).padStart(2,"0")}:${String(z).padStart(2,"0")} ${le}`;const l=$(n.value);b(l,F),t.nextTick(()=>{requestAnimationFrame(()=>{const d=document.getElementById(e.id),E=o.value??0;d&&(d.focus(),d.setSelectionRange(E,E))})})},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(M.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const c=a.target;T(a.key,c,a);return}},Z=a=>{a.preventDefault();const c=a.deltaY<0?"ArrowUp":"ArrowDown";T(c,a.target,a)},te=a=>{const c=a.target;if(C.includes(a.key)){o.value=c?.selectionStart??0;return}if(M.includes(a.key)){if(a.altKey)return;o.value=c?.selectionStart??0}},oe=a=>{A.value=!0,m.value&&e.externalValue&&e.externalValue.value===void 0&&q.value.length===0&&(e.externalValue.value="");const c=a.target;c&&(o.value=c.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const c=new Date(a);if(c.toString()!=="Invalid Date"){const F=c.getHours(),N=F>=12?"PM":"AM";n.value=I(F,c.getMinutes(),N);return}}},{immediate:!0});const r=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",u.value],["Hour (24h)",L.value],["Minute",i.value],["Period",h.value],["Time (24h)",v.value??"--:--:--"],["Digits only",q.value],["Parsed Date",y.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",V.value],["reason",U.value],["validationMessage",B.value]]),y=t.computed(()=>$(n.value)??null),V=t.computed(()=>{if(!m.value){if(!S.value)return!0;const c=y.value;return c?_(c):!1}if(!A.value)return!0;const a=y.value;return!S.value||!a?!1:_(a)}),U=t.computed(()=>{if(!m.value){if(!S.value)return;const c=y.value;return c?_(c)?"valid":"out-of-bounds":"invalid-time"}if(!A.value)return;if(q.value.length===0||!S.value)return"incomplete";const a=y.value;return a?_(a)?"valid":"out-of-bounds":"invalid-time"}),B=t.computed(()=>{const a=U.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-time")return`Must be in ${p.value} format.`;const c={hour:"2-digit",minute:"2-digit"},F=e.min?e.min.toLocaleTimeString("en-US",c):null,N=e.max?e.max.toLocaleTimeString("en-US",c):null;if(a==="out-of-bounds"){if(F&&N)return`Must be between ${F} and ${N}.`;if(F)return`Must be ${F} or later.`;if(N)return`Must be ${N} or earlier.`}return""}),Y=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`#${e.id} not found for styling.`);return}const c=a.closest(".k-timepicker");if(!c){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const F=c.parentElement;if(!F){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}F.classList.contains("fk-timepicker")||F.classList.add("fk-timepicker")})};return t.onMounted(()=>{Y()}),{raw:n,rules:D,debugEnabled:g,debugLines:r,placeholder:p,isValid:V,reason:t.readonly(U),validationMessage:B,isComplete:S,inRangeTime:_,cursorPos:o,hour:t.readonly(u),hour24:t.readonly(L),minute:t.readonly(i),period:t.readonly(h),time24:t.readonly(v),parsedRawTime:t.readonly(y),handleChange:x,handleKeyDown:K,handleKeyUp:te,handleClick:k,handleWheel:Z,handleBlur:oe,initStyling:Y}}function at(e){const n=t.shallowRef(null),o=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],g=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??o].flat(),p=D=>D?typeof e.initialFocus=="string"?D.querySelector(e.initialFocus)??D:typeof e.initialFocus=="function"?e.initialFocus(D)??D:D.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??D:null,{activate:m,deactivate:A}=Fe.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>p(n.value),...e.focusTrapOptions??{}});let M=null,C=t.ref(null);const q=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const D=(u,i)=>{const h=Array.from(u.querySelectorAll(i));if(!h.length)return null;const L=h.filter(v=>v.offsetParent!==null||v.getClientRects().length>0);return L[L.length-1]??h[h.length-1]??null},R=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const u of g){const i=D(R,u);if(i)return i}for(const u of g){const i=D(document,u);if(i)return i}return null};return Ce(n,D=>{C.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",D)}),t.watch(()=>e.isOpen.value,D=>{D?(C.value=null,t.nextTick(()=>{const R=q();R&&(n.value=R,setTimeout(()=>m(),0),M||(M=u=>{u.key==="Escape"&&(C.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",u))},document.addEventListener("keydown",M,!0)))})):(A(),M&&(document.removeEventListener("keydown",M,!0),M=null),n.value=null,C.value==="outside"&&t.nextTick(()=>{const R=()=>{const u=e.triggerEl?.value,i=u?.querySelector("input"),h=document.activeElement;h&&(h===i||u&&u.contains(h))&&(i??u)?.blur?.()};requestAnimationFrame(()=>setTimeout(R,0))}),e.returnFocusToTrigger!==!1&&C.value==="escape"&&e.triggerEl?.value&&t.nextTick(()=>{const R=()=>{const u=e.triggerEl?.value;if(!u)return;(u.querySelector("input")??u)?.focus?.()};requestAnimationFrame(()=>setTimeout(R,0))}))}),{popupRef:n,activate:m,deactivate:A,lastCloseReason:t.readonly(C),setPopupEl:D=>n.value=D}}J.useFieldsetTouchTracker=Ie,J.useFieldsetValidationKit=Te,J.useGridA11y=Ve,J.useGridActiveFilter=$e,J.useGridRowAction=Ke,J.useMaskedDateInput=et,J.useMaskedDateRangeInput=tt,J.useMaskedTimeInput=nt,J.usePopupMenu=Qe,J.usePopupTrap=at,J.useUSAddress=We,J.useZipTextBox=xe,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=featherk-composables.umd.js.map
|