"use strict";const t=require("./Toggle-r0neBlcF.cjs"),i=require("./jsx-runtime-evvPGacs.cjs"),n=require("./css-SuMNMmEe.cjs"),C=require("react"),j=require("./Center-7mG_M7Co.cjs");require("./aggregator-Plx04vqJ.cjs");const R=require("react-hook-form"),T=({className:e,variant:r="error",...s})=>i.jsxRuntimeExports.jsx(t.Text,{className:n.CSS(n.CSS.B("input-help-text"),n.CSS.BM("input-help-text",r),e),level:"small",...s}),I=({className:e,...r})=>i.jsxRuntimeExports.jsx("label",{className:n.CSS(n.CSS.B("input-label"),e),...r}),D=e=>e.replace(/([A-Z])/g," $1").replace(/^./,r=>r.toUpperCase()),O=(e,r="x")=>e??(n.Cu.construct(r)==="y"?"stretch":"center"),h=({label:e,showLabel:r=!0,helpText:s,direction:x="y",className:u,children:S,align:o,size:f="small",padHelpText:a=!1,...g})=>{let l;return x==="x"?l=i.jsxRuntimeExports.jsxs(j.Space,{direction:"y",size:"small",children:[S,(a||s!=null&&s.length>0)&&i.jsxRuntimeExports.jsx(T,{children:s})]}):l=i.jsxRuntimeExports.jsxs(j.Space,{direction:"y",size:1/3,children:[S,(a||s!=null&&s.length>0)&&i.jsxRuntimeExports.jsx(T,{children:s})]}),i.jsxRuntimeExports.jsxs(j.Space,{className:n.CSS(n.CSS.B("input-item"),u),direction:x,size:f,align:O(o,x),...g,children:[r&&i.jsxRuntimeExports.jsx(I,{children:e}),l]})},b=t.componentRenderProp(t.Text$1),y=({name:e,rules:r,shouldUnregister:s,defaultValue:x,label:u,children:S=b,alsoValidate:o,padHelpText:f=!0,ref:a,...g})=>{var p;const{field:l,fieldState:d}=R.useController({rules:r,name:e}),{trigger:c}=R.useFormContext();u==null&&(u=D(e));const m=C.useCallback(()=>{l.onBlur(),o!=null&&c(o)},[l.onBlur,c,o,e]);return i.jsxRuntimeExports.jsx(h,{label:u,padHelpText:f,helpText:(p=d.error)==null?void 0:p.message,...g,children:S({onChange:l.onChange,value:l.value,onBlur:m})})},B=({value:e,onChange:r,onBlur:s,...x})=>{const u=new n.le(e,"UTC"),[S,o]=C.useState(u.fString("ISO","local").slice(0,-1)),[f,a]=C.useState(!0),g=d=>{let c=d.toString();o(c);let m=new n.le(d,"UTC");c.length<23&&(c+=".000"),m=m.add(BigInt(n.le.now().date().getTimezoneOffset()-m.date().getTimezoneOffset())*n.ae.MINUTE.valueOf());let p=!1;try{p=m.fString("ISO","local").slice(0,-1)===c}catch{console.error("e")}if(!p){a(!1);return}r(Number(m.valueOf())),a(!0)},l=d=>{a(!0),o(new n.le(e,"UTC").fString("ISO","local").slice(0,-1)),s==null||s(d)};return i.jsxRuntimeExports.jsx(t.Text$1,{type:"datetime-local",onBlur:l,required:!1,value:f?new n.le(e,"UTC").fString("ISO","local").slice(0,-1):S,onChange:g,...x})},q=Object.freeze(Object.defineProperty({__proto__:null,Date:t.Date,DateTime:B,DragButton:t.DragButton,HFItem:y,HelpText:T,Item:h,Label:I,Numeric:t.Numeric,Switch:t.Switch$1,Text:t.Text$1,TextArea:t.TextArea,Time:t.Time,combineDateAndTimeValue:t.combineDateAndTimeValue,useDate:t.useDate,useTime:t.useTime},Symbol.toStringTag,{value:"Module"}));exports.Item=h;exports.external=q;
//# sourceMappingURL=external-y11Yl1gK.cjs.map
