1import{defineComponent as $,useModel as E,ref as k,computed as m,toRef as O,watch as S,nextTick as P,openBlock as w,createBlock as q,withCtx as M,renderSlot as z,createVNode as b,unref as f,createElementVNode as A,normalizeClass as R,mergeModels as I}from"vue";import{e as Z,bJ as j,bX as J,cy as y,Z as L}from"./logger-B4OCWT-4.js";import{M as v}from"./component3-composition-Cx3jgoEb.js";import{M as Q}from"./mask-input-DL8myFdv.js";import{t as U}from"./use-fingerprint-BKylMFtN.js";import{c as X}from"./plugin-feature-flags-D9VJsscs.js";import{C as Y}from"./calendar-D6LAfl71.js";import{b as G}from"./custom-html-CSF7RBTT.js";import{g as H}from"./test-manager-DesYLJOQ.js";function K(e,l){if(e.length!==l.length)return!1;const i=[...l];for(const[u,o]of[...e].entries()){const t=i[u];if(!t)return!1;if(o==="d"||o==="m"||o==="y"){if(Number.isNaN(Number(t)))return!1}else if(o!==t)return!1}return!0}function W(e,l){if(!K(e,l))return;const i=e.indexOf("dd"),u=e.indexOf("mm"),o=e.indexOf("yyyy"),t=l.slice(i,i+2),r=l.slice(u,u+2),d=l.slice(o,o+4);return{day:Number(t),month:Number(r),year:Number(d)}}function _(e){return new Z(e).formatToParts(new Date(2e3,0,1)).map(u=>{switch(u.type){case"day":return"dd";case"month":return"mm";case"year":return"yyyy";default:return u.value}}).join("").replace(/[\p{P}\p{Z}]+$/u,"")}const ee=["min","max"],te=$({__name:"date-input",props:I({status:{},testId:{},disabled:{type:Boolean},hint:{},errorMessage:{},autofocus:{type:Boolean},placeholder:{},min:{},max:{}},{modelValue:{},modelModifiers:{}}),emits:I(["firstInput","changeInnerError","changeInnerModel"],["update:modelValue"]),setup(e,{emit:l}){const i=l,u=(a,s)=>{const n={dd:s.getDate(),mm:s.getMonth()+1,yyyy:s.getFullYear()};return a.replaceAll(/dd|mm|yyyy/g,g=>String(n[g]).padStart(g.length,"0"))},o=E(e,"modelValue"),t=G(),r=k(),d=k(!1),x=j(void 0,{month:"2-digit",day:"2-digit",year:"numeric"}),c=m(()=>_(x.value.resolvedOptions().locale)),C=m(()=>c.value.replaceAll(/\w/g,"_")),D=O(()=>!!r.value&&!o.value),N=J(),V=()=>{d.value=!0},B=()=>{h(),d.value=!1},h=async()=>{t.value?.style&&(t.value.style.display="none"),await P(),t.value?.style&&(t.value.style.display="")},F=a=>{const{value:s}=a.target??{};s?o.value=s:(o.value=void 0,r.value=void 0),N.value||(t.value?.blur(),h())},T=async()=>{t.value?.focus(),t.value?.showPicker()},p=m(()=>({mask:c.value,blocks:{dd:{mask:v,from:1,to:31,autofix:"pad"},mm:{mask:v,from:1,to:12,autofix:"pad"},yyyy:{mask:v,from:1,to:9999,autofix:"pad"}}}));return S(r,(a,s)=>{if(a&&!s&&i("firstInput"),!a){o.value=void 0;return}const n=W(c.value,a);if(!n){o.value=void 0;return}o.value=`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}),y([o,p],([a])=>{if(!a||typeof a!="string"){t.value&&(t.value.value="");return}P(()=>{const s=U(a);if(!s){t.value&&(t.value.value=""),r.value=void 0;return}r.value=u(c.value,s),t.value&&(t.value.value=a)})}),y(D,a=>{i("changeInnerError",a)}),y(r,a=>{i("changeInnerModel",a)}),(a,s)=>(w(),q(Q,{modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=n=>r.value=n),status:e.status,"test-id":e.testId,disabled:e.disabled,hint:e.hint,"error-message":e.errorMessage,autofocus:e.autofocus,"mask-model":"","is-pattern-placeholder":"","mask-options":p.value,placeholder:r.value??d.value?C.value:e.placeholder,onFocus:V,onBlur:B},{iconEnd:M(({iconSize:n})=>[z(a.$slots,"iconEnd",{iconSize:n},()=>[b(f(X),{size:"s",variant:"accent","test-id":f(H)("datePickerButton",e.testId),onClick:T},{default:M(()=>[b(f(Y),{size:n},null,8,["size"])]),_:2},1032,["test-id"]),A("input",{ref_key:"datePicker",ref:t,tabindex:"-1",class:R(a.$style.datePicker),type:"date",min:e.min,max:e.max,onChange:F},null,42,ee)])]),_:3},8,["modelValue","status","test-id","disabled","hint","error-message","autofocus","mask-options","placeholder"]))}}),ae="date-input_datePicker-4qQqq",oe={datePicker:ae},se={$style:oe},ye=L(te,[["__cssModules",se]]);export{ye as D}; 2(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".date-input_datePicker-4qQqq{position:absolute;bottom:0;left:0;transform:scale(0)}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.