@nice2dev/ui 1.0.30 → 1.1.5
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/CHANGELOG.md +848 -0
- package/README.md +30 -31
- package/dist/NiceCalendarScheduler.doc-BEtQkZjV.cjs +9 -0
- package/dist/NiceCalendarScheduler.doc-D__LRgOx.js +33 -0
- package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
- package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
- package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
- package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
- package/dist/NiceConfirmDialog-B57cl_F7.cjs +1 -0
- package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
- package/dist/NiceConfirmDialog-N9fBTLYm.js +81 -0
- package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
- package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
- package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
- package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
- package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
- package/dist/NiceDrawingCanvas.doc-Dv5vB4gY.js +32 -0
- package/dist/NiceDrawingCanvas.doc-Ww9zz17x.cjs +8 -0
- package/dist/NiceErrorBoundary-BD-uqk_q.js +709 -0
- package/dist/NiceErrorBoundary-CIPXaYik.cjs +1 -0
- package/dist/NiceFileManagerViews.doc-CKlnm6cX.cjs +1 -0
- package/dist/NiceFileManagerViews.doc-Cg21DArG.js +25 -0
- package/dist/NiceForm-BNZB31Pg.js +4499 -0
- package/dist/NiceForm-C6F0HvrX.cjs +1 -0
- package/dist/NiceForm-CCyfWgIs.js +4805 -0
- package/dist/NiceForm-CPyAXxBO.cjs +1 -0
- package/dist/NiceGantt-CSFLZD2y.js +328 -0
- package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
- package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
- package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
- package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
- package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
- package/dist/NiceMegaMenu.doc-7UyOCd3l.cjs +7 -0
- package/dist/NiceMegaMenu.doc-zeIyVa65.js +31 -0
- package/dist/NiceMention-CWoLD0SE.js +11082 -0
- package/dist/NiceMention-J1lUDLhg.cjs +430 -0
- package/dist/NiceMention.css +1 -0
- package/dist/NiceModal-0UxviEYE.cjs +1 -0
- package/dist/NiceModal-Bj53SKLI.js +95 -0
- package/dist/NiceModal-D-iOonog.js +95 -0
- package/dist/NiceModal-DC0UlQhc.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
- package/dist/NiceModuleLifecyclePanel-BBOg9g0b.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-DtuXRiLR.js +6991 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-Bjxy9aEc.js +172 -0
- package/dist/NicePagination-CPn-Q1h_.js +172 -0
- package/dist/NicePagination-CfFfNwrg.cjs +1 -0
- package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
- package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
- package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
- package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
- package/dist/NiceSavedQueryPanel-CH5c3rUG.js +6988 -0
- package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
- package/dist/NiceSavedQueryPanel-aQrEmmcC.cjs +596 -0
- package/dist/NiceScannerControl-Cd5KXJA9.js +12769 -0
- package/dist/NiceScannerControl-DZsERSw_.cjs +698 -0
- package/dist/NiceScannerControl.css +1 -0
- package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
- package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
- package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
- package/dist/NiceSelect-DHowflmX.js +433 -0
- package/dist/NiceWindow-BoDzlGk-.js +1621 -0
- package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
- package/dist/NiceWindow-DgONWxBm.cjs +1 -0
- package/dist/NiceWindow-xnTSHdHv.js +1623 -0
- package/dist/charts-B-sl1V9y.cjs +882 -0
- package/dist/charts-Bs0aDM0X.js +4671 -0
- package/dist/charts-DO2z6Ziu.js +31920 -0
- package/dist/charts-DjjKkw0q.cjs +761 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +7 -7
- package/dist/core-BUsZ7_vI.js +27914 -0
- package/dist/core-C2KhqEaU.cjs +1 -0
- package/dist/core-CLfcCDKc.cjs +122 -0
- package/dist/core-K2DIxXLn.js +795 -0
- package/dist/data-branching-D7l_kILW.cjs +1 -0
- package/dist/data-branching-DC6hcBQN.cjs +1 -0
- package/dist/data-branching-DykdTpjJ.js +6255 -0
- package/dist/data-branching-lJ07lDN-.js +6255 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +70 -44
- package/dist/data.mjs +17 -16
- package/dist/devops-Bi8MXtko.js +8165 -0
- package/dist/devops-CU0sOVEA.cjs +17 -0
- package/dist/devops-CXyEwQeM.js +8165 -0
- package/dist/devops-On_1wRf9.cjs +17 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +288 -432
- package/dist/editors.mjs +58 -62
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index-BDH1yDSg.js +69235 -0
- package/dist/index-C9njkNOD.cjs +5470 -0
- package/dist/index.cjs +5137 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +556 -929
- package/dist/index.mjs +66371 -1017
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +31 -213
- package/dist/navigation.mjs +105 -113
- package/dist/no-code-8lO7o6xi.js +7425 -0
- package/dist/no-code-C58g8_fb.cjs +332 -0
- package/dist/no-code-Cj4xJ3w9.js +7425 -0
- package/dist/no-code-K8tOLNew.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +10 -0
- package/dist/overlays.mjs +36 -36
- package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
- package/dist/pickerCommons-CORo9j2a.js +2119 -0
- package/dist/pickerCommons-COiSUiP2.js +1122 -0
- package/dist/pickerCommons-D3WShRrR.cjs +1 -0
- package/dist/style.css +6 -6
- package/dist/vendor-BPVpdtPp.js +271 -0
- package/dist/vendor-Bo2Q64AF.cjs +1 -0
- package/package.json +17 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),f=require("./core-CLfcCDKc.cjs"),a=require("react"),ke=require("./pickerCommons-D3WShRrR.cjs"),Wt=require("react-dom"),Mt=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:d,size:u="md",name:_,id:k,className:z,style:te,accessMode:$,displayStyle:w,value:B,defaultValue:le,onChange:H,onBlur:G,onKeyDown:V,placeholder:Y,rows:me=3,maxLength:x,resize:ae="vertical",autoFocus:O,showCount:X,counterPlacement:ie="bottom",submitOnEnter:L,onSubmit:A,showKeyboardHints:U,labelPlacement:T,errorPlacement:K,loading:R,labelWidth:q,controlWidth:W,displayMode:P},b)=>{const C=f.Dc($,k),Z=C==="hidden";C==="disabled"&&(s=!0),C==="readOnly"&&(d=!0);const{t:re}=f.Gt(),p=f.bc(k),v=f.rc("input",w),F=f.ac("input",w),ne=B?.length??0,he=x?ne>x:!1,xe=f.sc({enabled:P,readOnly:d,disabled:s}),J={key:"Enter",ctrl:!0,description:re("shortcuts.submit","Submit")},h=a.useCallback(oe=>{L&&f.Qc(oe,J)&&(oe.preventDefault(),A?.()),V?.(oe)},[L,A,V,J]),E=a.useMemo(()=>{const oe=[];return L&&oe.push(J),oe.push({key:"Tab",description:re("shortcuts.indent","Indent (when supported)")}),oe},[L,re,J]);return Z?null:e.jsxs("div",{className:`nice-field nice-field--${u} ${T==="left"?"nice-field--label-left":""} ${R?"nice-field--loading":""} ${z||""}`,style:{...te,...q!=null&&{"--nice-field-label-width":typeof q=="number"?`${q}px`:q},...W!=null&&{"--nice-field-control-width":typeof W=="number"?`${W}px`:W}},"aria-busy":R||void 0,children:[t&&e.jsxs("label",{htmlFor:p,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,U&&E.length>0&&e.jsx(f.ha,{shortcuts:E,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control nice-field__control--textarea",children:[xe.isDisplay?e.jsx(f.cc,{value:B??le??"",placeholder:Y,disabled:s,readOnly:d,onActivate:xe.enterEdit,ariaLabel:t,className:"nice-display-value--textarea"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0},children:[e.jsx("textarea",{ref:oe=>{typeof b=="function"?b(oe):b&&(b.current=oe),xe.autoFocusRef(oe)},id:p,className:`nice-textarea nice-input--${u} nice-textarea--ds-${F} ${n?"nice-textarea--error":""} ${s?"nice-textarea--disabled":""}`,style:{...v,resize:ae},name:_,value:B,defaultValue:le,placeholder:Y,rows:me,maxLength:x,disabled:s||R,readOnly:d,autoFocus:O,"aria-invalid":!!n,"aria-describedby":n?`${p}-error`:i?`${p}-helper`:void 0,onChange:oe=>H?.(oe.target.value),onBlur:oe=>{P&&xe.exitEdit(),G?.(oe)},onKeyDown:h}),ie!=="right"&&(X||x)&&e.jsxs("div",{className:`nice-textarea__counter ${he?"nice-textarea__counter--over":""}`,children:[ne,x?` / ${x}`:""]})]}),ie==="right"&&(X||x)&&e.jsxs("div",{className:`nice-textarea__counter nice-textarea__counter--right ${he?"nice-textarea__counter--over":""}`,children:[ne,x?` / ${x}`:""]})]}),R&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--textarea",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),K==="right"&&n&&e.jsx("div",{id:`${p}-error`,className:"nice-field__error",role:"alert",children:n}),K==="right"&&!n&&i&&e.jsx("div",{id:`${p}-helper`,className:"nice-field__helper",children:i})]}),K!=="right"&&n&&e.jsx("div",{id:`${p}-error`,className:"nice-field__error",role:"alert",children:n}),K!=="right"&&!n&&i&&e.jsx("div",{id:`${p}-helper`,className:"nice-field__helper",children:i})]})});Mt.displayName="NiceTextArea";const mn=Object.freeze(Object.defineProperty({__proto__:null,NiceTextArea:Mt},Symbol.toStringTag,{value:"Module"})),hn=["Su","Mo","Tu","We","Th","Fr","Sa"];function gn(t,i){return new Date(t,i+1,0).getDate()}function yn(t,i){return new Date(t,i,1).getDay()}function Kt(t,i,n){return`${t}-${String(i+1).padStart(2,"0")}-${String(n).padStart(2,"0")}`}function _n(t){const i=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()));i.setUTCDate(i.getUTCDate()+4-(i.getUTCDay()||7));const n=new Date(Date.UTC(i.getUTCFullYear(),0,1));return Math.ceil(((i.getTime()-n.getTime())/864e5+1)/7)}const qt=["January","February","March","April","May","June","July","August","September","October","November","December"],Et=({value:t,onChange:i,min:n,max:l,disabledDates:s=[],firstDayOfWeek:d=1,size:u="md",showWeekNumbers:_,onMonthChange:k,className:z,style:te,accessMode:$,id:w,multiple:B,selectedDates:le,onSelectedDatesChange:H,renderDay:G,showKeyboardHints:V,persistPreferences:Y=!1,fullWidth:me=!1,cookies:x=!1,localStorage:ae=!0,sessionStorage:O=!1,storageMode:X,storageKey:ie})=>{const L=f.Dc($,w),A=L==="hidden",U=L==="disabled"||L==="readOnly",{t:T}=f.Gt(),K=new Date,R=t?new Date(t):K,q=f.useStorageAdapter(ie??"nice-calendar"),W=a.useMemo(()=>Y?q.get("prefs")??{}:{},[Y,q]),P=W.firstDayOfWeek??d,[b,C]=a.useState(W.lastViewYear??R.getFullYear()),[Z,re]=a.useState(W.lastViewMonth??R.getMonth()),[p,v]=a.useState(W.preferredView??"days"),[F,ne]=a.useState([]),he=le??F,xe=a.useCallback(M=>{if(!Y)return;const pe=q.get("prefs")??{};q.set("prefs",{...pe,...M})},[Y,q]),J=a.useCallback(M=>{v(M),xe({preferredView:M})},[xe]),h=a.useCallback((M,pe)=>{xe({lastViewYear:M,lastViewMonth:pe})},[xe]),E=a.useMemo(()=>[f.Yc.moveUp,f.Yc.moveDown,f.Yc.moveLeft,f.Yc.moveRight,{key:"Enter",description:T("shortcuts.selectDate","Select date")},f.Yc.pageUp,f.Yc.pageDown],[T]),oe=a.useMemo(()=>gn(b,Z),[b,Z]),Te=a.useMemo(()=>(yn(b,Z)-P+7)%7,[b,Z,P]),je=a.useMemo(()=>{const M=[...hn];for(let pe=0;pe<P;pe++)M.push(M.shift());return M},[P]),ee=a.useCallback(M=>{const pe=D=>/^\d{4}-\d{2}-\d{2}/.test(D);return n&&pe(n)&&M<n||l&&pe(l)&&M>l?!0:s.includes(M)},[n,l,s]),se=a.useCallback(M=>{if(p==="years"){C(Ne=>Ne+M*10);return}if(p==="months"){C(Ne=>Ne+M);return}let pe=Z+M,D=b;pe<0&&(pe=11,D--),pe>11&&(pe=0,D++),re(pe),C(D),h(D,pe),k?.(D,pe)},[Z,b,k,p,h]),ye=Kt(K.getFullYear(),K.getMonth(),K.getDate()),$e=a.useCallback(M=>B?he.includes(M):M===t,[B,he,t]),m=a.useCallback(M=>{if(!U){if(B){const pe=he.includes(M)?he.filter(D=>D!==M):[...he,M];le===void 0&&ne(pe),H?.(pe)}i?.(M)}},[U,B,he,le,i,H]),o=a.useCallback(()=>{p==="days"?J("months"):p==="months"&&J("years")},[p,J]),N=a.useCallback(M=>{re(M),J("days"),h(b,M),k?.(b,M)},[b,k,J,h]),ue=a.useCallback(M=>{C(M),J("months")},[J]),de=p==="years"?`${b-b%10} – ${b-b%10+9}`:p==="months"?`${b}`:`${qt[Z]} ${b}`,Q=p==="years"?"decade":p==="months"?"year":"month",y=[];for(let M=0;M<Te;M++)y.push(null);for(let M=1;M<=oe;M++)y.push(M);for(;y.length%7!==0;)y.push(null);const Le=[];for(let M=0;M<y.length;M+=7)Le.push(y.slice(M,M+7));const He=b-b%10;return A?null:e.jsxs("div",{className:`nice-calendar nice-calendar--${u}${me?" nice-calendar--full-width":""} ${z||""}`,style:te,children:[e.jsxs("div",{className:"nice-calendar__header",children:[e.jsx("button",{type:"button",className:"nice-calendar__nav",onClick:()=>se(-1),"aria-label":`Previous ${Q}`,children:e.jsx(f.oa,{name:"chevron-left",size:16})}),e.jsx("button",{type:"button",className:"nice-calendar__title",onClick:o,"aria-label":p==="days"?"Show month picker":p==="months"?"Show year picker":void 0,disabled:p==="years",children:de}),e.jsx("button",{type:"button",className:"nice-calendar__nav",onClick:()=>se(1),"aria-label":`Next ${Q}`,children:e.jsx(f.oa,{name:"chevron-right",size:16})}),V&&e.jsx(f.ha,{shortcuts:E,size:"sm"})]}),p==="days"&&e.jsxs("table",{className:"nice-calendar__grid",role:"grid",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[_&&e.jsx("th",{className:"nice-calendar__wk",children:"W"}),je.map(M=>e.jsx("th",{children:M},M))]})}),e.jsx("tbody",{children:Le.map((M,pe)=>e.jsxs("tr",{children:[_&&e.jsx("td",{className:"nice-calendar__wk",children:M.find(D=>D!=null)?_n(new Date(b,Z,M.find(D=>D!=null))):""}),M.map((D,Ne)=>{if(D==null)return e.jsx("td",{className:"nice-calendar__empty-cell"},Ne);const ze=Kt(b,Z,D),be=ee(ze),Oe=$e(ze),Ke=ze===ye;return e.jsx("td",{className:`nice-calendar__day${Oe?" nice-calendar__day--selected":""}${Ke?" nice-calendar__day--today":""}${be?" nice-calendar__day--disabled":""}`,onClick:()=>!be&&m(ze),role:"gridcell","aria-selected":Oe,"aria-disabled":be,children:G?G(ze,D):D},Ne)})]},pe))})]}),p==="months"&&e.jsx("div",{className:"nice-calendar__picker-grid",children:qt.map((M,pe)=>e.jsx("button",{type:"button",className:`nice-calendar__picker-cell${pe===Z&&b===R.getFullYear()?" nice-calendar__picker-cell--selected":""}`,onClick:()=>N(pe),children:M.slice(0,3)},pe))}),p==="years"&&e.jsx("div",{className:"nice-calendar__picker-grid",children:Array.from({length:12},(M,pe)=>He-1+pe).map(M=>e.jsx("button",{type:"button",className:`nice-calendar__picker-cell${M===b?" nice-calendar__picker-cell--selected":""}${M<He||M>He+9?" nice-calendar__picker-cell--other":""}`,onClick:()=>ue(M),children:M},M))})]})};Et.displayName="NiceCalendar";const xn={"date-local":{inputType:"date",localized:!0},"date-utc":{inputType:"date",localized:!1},"datetime-local":{inputType:"datetime-local",localized:!0},"datetime-utc":{inputType:"datetime-local",localized:!1},"month-local":{inputType:"month",localized:!0},"month-utc":{inputType:"month",localized:!1},week:{inputType:"week",localized:!1},time:{inputType:"time",localized:!1}},Ot={date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm",month:"yyyy-MM",week:"yyyy-Www",time:"HH:mm"},bn={"yyyy-MM-dd":"YYYY-MM-DD","yyyy-MM-ddTHH:mm":"YYYY-MM-DDTHH:MM","yyyy-MM":"YYYY-MM","yyyy-Www":"YYYY-Www","HH:mm":"HH:MM"};function At(t){const i=(t||"").toLowerCase().replace("_","-"),n=i.split("-")[0],l={pl:"dd.MM.yyyy","pl-pl":"dd.MM.yyyy",de:"dd.MM.yyyy","de-de":"dd.MM.yyyy","de-at":"dd.MM.yyyy","de-ch":"dd.MM.yyyy",cs:"dd.MM.yyyy","cs-cz":"dd.MM.yyyy",sk:"dd.MM.yyyy","sk-sk":"dd.MM.yyyy",ru:"dd.MM.yyyy","ru-ru":"dd.MM.yyyy",fi:"dd.MM.yyyy","fi-fi":"dd.MM.yyyy",no:"dd.MM.yyyy",nb:"dd.MM.yyyy",nn:"dd.MM.yyyy",da:"dd.MM.yyyy","da-dk":"dd.MM.yyyy",tr:"dd.MM.yyyy","tr-tr":"dd.MM.yyyy",sl:"dd.MM.yyyy",hr:"dd.MM.yyyy",sr:"dd.MM.yyyy",ro:"dd.MM.yyyy",bg:"dd.MM.yyyy",uk:"dd.MM.yyyy",is:"dd.MM.yyyy",et:"dd.MM.yyyy",lv:"dd.MM.yyyy",lt:"dd.MM.yyyy","en-gb":"dd/MM/yyyy","en-au":"dd/MM/yyyy","en-ie":"dd/MM/yyyy","en-nz":"dd/MM/yyyy","en-in":"dd/MM/yyyy",fr:"dd/MM/yyyy","fr-fr":"dd/MM/yyyy","fr-be":"dd/MM/yyyy",es:"dd/MM/yyyy","es-es":"dd/MM/yyyy",pt:"dd/MM/yyyy","pt-pt":"dd/MM/yyyy","pt-br":"dd/MM/yyyy",it:"dd/MM/yyyy","it-it":"dd/MM/yyyy",nl:"dd-MM-yyyy","nl-nl":"dd-MM-yyyy","nl-be":"dd/MM/yyyy",el:"dd/MM/yyyy",hu:"yyyy.MM.dd",en:"MM/dd/yyyy","en-us":"MM/dd/yyyy","en-ca":"MM/dd/yyyy",ja:"yyyy/MM/dd","ja-jp":"yyyy/MM/dd",ko:"yyyy.MM.dd","ko-kr":"yyyy.MM.dd",zh:"yyyy/MM/dd","zh-cn":"yyyy/MM/dd","zh-tw":"yyyy/MM/dd",sv:"yyyy-MM-dd","sv-se":"yyyy-MM-dd"};if(l[i])return l[i];if(l[n])return l[n];try{const d=new Intl.DateTimeFormat(t,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2024,0,15));let u="";for(const _ of d)if(_.type==="day")u+="dd";else if(_.type==="month")u+="MM";else if(_.type==="year")u+="yyyy";else if(_.type==="literal"){const k=_.value.replace(/[\u00A0\u202F\u2009]/g," ").trim();u+=k||"."}return!/y/.test(u)||!/M/.test(u)||!/d/.test(u)?"yyyy-MM-dd":u}catch{return"yyyy-MM-dd"}}function Cn(t){const n=At(t).replace(/dd[^\w]*/g,"").replace(/[^\w]*dd/g,"");return!/y/.test(n)||!/M/.test(n)?"yyyy-MM":n}function vn(){if(typeof document<"u"){const t=document.documentElement?.lang;if(t&&/^[a-zA-Z]{2,}/.test(t))return t}return typeof navigator<"u"&&navigator.language?navigator.language:"en-US"}function Nn(t,i,n,l=!1){Ot[t]||(t="date");let s=Ot[t];l&&(t==="datetime-local"||t==="time")&&(s=s.replace("HH:mm","HH:mm:ss"));let d=s;i&&(t==="date"||t==="datetime-local"||t==="month")&&(t==="date"?d=At(n):t==="datetime-local"?d=`${At(n)} HH:mm${l?":ss":""}`:d=Cn(n)),t==="datetime-local"&&(d=d.replace("T"," · "));const u=bn[d]??d.replace(/y/g,"Y").replace(/M/g,"M").replace(/d/g,"D").replace(/H/g,"H").replace(/m/g,"M").replace(/s/g,"S");return{displayTpl:d,isoTpl:s,placeholder:u}}const jn=new Set(["y","M","d","H","m","s","w"]);function qe(t){return jn.has(t)}function Ut(t){let i=0;for(const n of t)qe(n)&&i++;return i}function Ft(t,i){let n="",l=0;for(const s of t)if(qe(s)){if(l>=i.length)break;n+=i[l++]}else{if(l===0)break;l>=i.length,n+=s}return n}function Mn(t,i,n){if(n.length===0)return"";const l={};let s=0;for(const _ of t)qe(_)&&(s>=n.length?(l[_]??(l[_]=[])).push(""):(l[_]??(l[_]=[])).push(n[s]),s++);const d={};let u="";for(const _ of i)if(qe(_)){const k=l[_]??[],z=d[_]??0;u+=k[z]??"",d[_]=z+1}return u}function at(t,i,n){if(n.length===0)return"";const l={};let s=0;for(const _ of i)qe(_)&&((l[_]??(l[_]=[])).push(n[s]??""),s++);const d={};let u="";for(const _ of t)if(qe(_)){const k=l[_]??[],z=d[_]??0;u+=k[z]??"",d[_]=z+1}return u.replace(/\s+$/,"")}function Zt(t,i,n){const l=Ut(i);if(n.length<l)return"";const s=Mn(t,i,n);if(s.length<l)return"";let d="",u=0;for(const _ of i)qe(_)?d+=s[u++]:d+=_;return d}function Jt(t,i,n){return t&&(i&&t<i?i:n&&t>n?n:t)}function Ae(t){return t.toString().padStart(2,"0")}function xt(t){const i=/(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(t);return i?{hours:Number(i[1]),minutes:Number(i[2]),seconds:Number(i[3]??0)}:null}function Qt(t,i,n,l,s){const d=s?`${Ae(i)}:${Ae(n)}:${Ae(l)}`:`${Ae(i)}:${Ae(n)}`;return t.replace(/\d{2}:\d{2}(?::\d{2})?$/,d)}function en(t,i){if(t<=0)return i;const n=Math.floor(t/864e5),l=`${Ae(Math.floor(t%864e5/36e5))}:${Ae(Math.floor(t%36e5/6e4))}:${Ae(Math.floor(t%6e4/1e3))}`;return n>0?`${n}d ${l}`:l}function kn(t,i){if(t<=0)return i;const n=Math.floor(t/864e5),l=Math.floor(t%864e5/36e5),s=Math.floor(t%36e5/6e4),d=Math.floor(t%6e4/1e3),u=[];return n&&u.push(`${n}d`),(n||l)&&u.push(`${l}h`),(n||l||s)&&u.push(`${s}m`),u.push(`${d}s`),u.join(" ")}function $n(t,i){if(t<=0)return i;const n=Math.floor(t/1e3),l=Math.floor(n/3600),s=Math.floor(n%3600/60),d=n%60;return l>0?`${Ae(l)}:${Ae(s)}:${Ae(d)}`:`${Ae(s)}:${Ae(d)}`}function wn(t,i){if(t<=0)return i;const n=Math.floor(t/1e3),l=Math.floor(n/86400);if(l)return`${l}d`;const s=Math.floor(n/3600);if(s)return`${s}h`;const d=Math.floor(n/60);return d?`${d}m`:`${n}s`}function Tn(t,i){if(t<=0)return i;const n=Math.floor(t/1e3),l=Math.floor(n/86400),s=Math.floor(n%86400/3600),d=Math.floor(n%3600/60),u=[];return l&&u.push(`${l} ${l===1?"day":"days"}`),s&&u.push(`${s} ${s===1?"hour":"hours"}`),d&&u.push(`${d} ${d===1?"minute":"minutes"}`),u.length?u.join(", "):"less than a minute"}const Sn={verbose:en,compact:kn,short:$n,minimal:wn,words:Tn};function Dn(t,i,n){const l=t?xt(t):null,{hours:s,minutes:d,seconds:u}=l??{hours:0,minutes:0,seconds:0},_=new Date(n);if(i!=null){const z=typeof i=="string"?new Date(i):new Date(i.getTime());if(!Number.isNaN(z.getTime()))return z.setHours(s,d,u,0),z}if(t&&/^\d{4}-\d{2}-\d{2}T/.test(t)){const z=new Date(t);if(!Number.isNaN(z.getTime()))return z}const k=new Date(_);return k.setHours(s,d,u,0),k.getTime()<=_.getTime()&&k.setDate(k.getDate()+1),k}function pt(t,i){if(!t)return"";const n=t.replace(/[^0-9]/g,""),l=Ut(i);return n.slice(0,l)}function Ge(t,i,n){const l=Ft(t,n);let s=0;const d=Math.min(i,l.length);for(let u=0;u<d;u++)qe(t[u])&&s++;return Math.min(s,n.length)}function Rn(t,i,n){if(n<=0)return 0;const l=Ft(t,i);let s=0;for(let d=0;d<l.length;d++)if(qe(t[d])&&(s++,s===n)){let u=d+1;for(;u<l.length&&!qe(t[u]);)u++;return u}return l.length}const Dt=30,An=({part:t,label:i,value:n,max:l,step:s,onPick:d,onStep:u,startHold:_,stopHold:k})=>{const z=a.useRef(null),te=a.useRef(!1),$=a.useRef(null),w=a.useRef(null),B=a.useMemo(()=>{const x=[],ae=s>0?s:1;for(let O=0;O<=l;O+=ae)x.push(O);return x},[l,s]),le=Math.max(0,Math.min(B.length-1,Math.round(n/(s>0?s:1)))),H=a.useRef(!1);a.useLayoutEffect(()=>{const x=z.current;if(!x)return;const ae=le*Dt;if(Math.abs(x.scrollTop-ae)<1)return;const O=Math.abs(x.scrollTop/Dt-le);te.current=!0,$.current&&(clearTimeout($.current),$.current=null),x.scrollTo({top:ae,behavior:H.current&&O<=3?"smooth":"auto"}),H.current=!0,w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{te.current=!1},380)},[le]),a.useEffect(()=>()=>{$.current&&clearTimeout($.current),w.current&&clearTimeout(w.current)},[]);const G=()=>{te.current||($.current&&clearTimeout($.current),$.current=setTimeout(()=>{const x=z.current;if(!x)return;const ae=Math.max(0,Math.min(B.length-1,Math.round(x.scrollTop/Dt))),O=B[ae];O!==n&&d(O)},110))},V=x=>{x.key==="ArrowUp"?(x.preventDefault(),u(-1)):x.key==="ArrowDown"&&(x.preventDefault(),u(1))},Y=x=>{const ae=x.replace(/\D/g,"");if(!ae)return;const O=Number(ae.slice(-2));d(Math.max(0,Math.min(l,O)))},me=x=>{z.current&&z.current.scrollBy({top:x.deltaY})};return e.jsxs("div",{className:"nice-datetime-popup__spinner",role:"group","aria-label":i,children:[e.jsx("div",{ref:z,className:"nice-datetime-popup__spin-column",role:"listbox",tabIndex:-1,"aria-label":i,"aria-activedescendant":`${t}-opt-${n}`,onScroll:G,children:B.map(x=>e.jsx("button",{type:"button",id:`${t}-opt-${x}`,role:"option","aria-selected":x===n,className:`nice-datetime-popup__spin-item${x===n?" is-selected":""}`,onClick:()=>d(x),tabIndex:-1,children:Ae(x)},x))}),e.jsxs("div",{className:"nice-datetime-popup__spin-center",onWheel:me,children:[e.jsx("button",{type:"button",className:"nice-datetime-popup__spin-btn",onClick:()=>u(-1),onPointerDown:()=>_(()=>u(-1)),onPointerUp:k,onPointerLeave:k,"aria-label":`${i} -`,tabIndex:-1,children:e.jsx(f.oa,{name:"chevron-up",size:14})}),e.jsx("input",{className:"nice-datetime-popup__spin-value",inputMode:"numeric","aria-label":i,value:Ae(n),onFocus:x=>x.currentTarget.select(),onChange:x=>Y(x.target.value),onKeyDown:V}),e.jsx("button",{type:"button",className:"nice-datetime-popup__spin-btn",onClick:()=>u(1),onPointerDown:()=>_(()=>u(1)),onPointerUp:k,onPointerLeave:k,"aria-label":`${i} +`,tabIndex:-1,children:e.jsx(f.oa,{name:"chevron-down",size:14})})]})]})},ft=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:d,size:u="md",name:_,id:k,className:z,style:te,accessMode:$,value:w,onChange:B,onBlur:le,onKeyDown:H,min:G,max:V,type:Y,dateFormatPreset:me,submitOnEnter:x,onSubmit:ae,showKeyboardHints:O,displayStyle:X,labelPlacement:ie,errorPlacement:L,loading:A,labelWidth:U,controlWidth:T,placeholder:K,clearable:R=!1,showPickerButton:q=!0,displayLocale:W,keyboardShortcuts:P=!0,showSeconds:b=!1,minuteStep:C=1,showNow:Z=!1,hourFormat:re="24",targetDate:p,onTargetChange:v,countdown:F=!1,countdownFormat:ne="verbose",formatCountdown:he,countdownLabel:xe,countdownInterval:J=1e3,countdownDoneText:h},E)=>{const oe=f.rc("input",X),Te=f.ac("input",X),je=f.Dc($,k),ee=je==="hidden";je==="disabled"&&(s=!0),je==="readOnly"&&(d=!0);const{t:se}=f.Gt(),ye=f.bc(k),$e=a.useRef(null),m=a.useRef(null),o=a.useRef(null),N=a.useRef(null),[ue,de]=a.useState(!1),[Q,y]=a.useState(null),[Le,He]=a.useState(""),pe=a.useContext(f.Er)?.portalTarget??(typeof document<"u"?document.body:null),{start:D,stop:Ne}=f.hc(),ze=me?xn[me]:null,be=ze?.inputType??Y??"date",Oe=ze?.localized??!1,Ke=W??vn(),j=a.useMemo(()=>Nn(be,Oe,Ke,b),[be,Oe,Ke,b]),Ee=a.useMemo(()=>Ut(j.isoTpl),[j.isoTpl]),[Ze,We]=a.useState(()=>{const c=pt(w,j.isoTpl);return at(j.displayTpl,j.isoTpl,c)}),Ve=a.useRef(Ze);a.useEffect(()=>{Ve.current=Ze},[Ze]);const Ye=a.useRef(w??""),Je=a.useRef(null);a.useEffect(()=>{const c=w??"";if(c===Ye.current)return;const g=pt(c,j.isoTpl),S=at(j.displayTpl,j.isoTpl,g);We(S),Ye.current=c},[w,j.displayTpl,j.isoTpl]),a.useEffect(()=>{const c=pt(w,j.isoTpl);We(at(j.displayTpl,j.isoTpl,c))},[j.displayTpl,j.isoTpl]),a.useEffect(()=>{if(Je.current==null)return;const c=Je.current;Je.current=null;const g=$e.current;if(g&&document.activeElement===g)try{g.setSelectionRange(c,c)}catch{}});const mt=a.useMemo(()=>Ft(j.displayTpl,Ze),[j.displayTpl,Ze]),et=K??j.placeholder,it=Math.max(j.displayTpl.length+1,9),bt=f.Zc({enabled:x,onSubmit:ae}),Ie=a.useCallback((c,g)=>{const S=c.slice(0,Ee);Ve.current=S,We(S),Je.current=Rn(j.displayTpl,S,Math.max(0,Math.min(S.length,g)));const ge=Jt(Zt(j.displayTpl,j.isoTpl,S),G,V);ge!==Ye.current&&(Ye.current=ge,B?.(ge))},[B,j.displayTpl,j.isoTpl,Ee,G,V]),st=a.useCallback(c=>{const g=Jt(c,G,V),S=pt(g,j.isoTpl);Ye.current=g,We(at(j.displayTpl,j.isoTpl,S)),B?.(g)},[B,j.displayTpl,j.isoTpl,G,V]),Qe=be==="time"||be==="datetime-local",Xe=a.useCallback(()=>Zt(j.displayTpl,j.isoTpl,Ve.current),[j.displayTpl,j.isoTpl]),ht=a.useCallback(()=>{if(s||d)return;const c=Xe(),g=c?xt(c):null;if(!g)return;const S=g.hours>=12?g.hours-12:g.hours+12;st(Qt(c,S,g.minutes,g.seconds,b))},[s,d,Xe,st,b]),Ct=(()=>{const c=xt(w??"");return c&&c.hours>=12?"PM":"AM"})(),wt=a.useCallback(c=>{if(bt(c),d||s){H?.(c);return}const g=c.key;if(c.ctrlKey||c.metaKey||c.altKey){H?.(c);return}if(Qe&&(g==="ArrowUp"||g==="ArrowDown")){const _e=Xe(),De=_e?xt(_e):null;if(De){c.preventDefault();const Ce=g==="ArrowUp"?1:-1;let{minutes:Fe,seconds:Pe}=De;b?Pe=((Pe+Ce)%60+60)%60:Fe=((Fe+Ce*C)%60+60)%60,st(Qt(_e,De.hours,Fe,Pe,b)),H?.(c);return}}const S=Ve.current;if(g==="Escape"&&S.length>0){c.preventDefault(),Ie("",0),H?.(c);return}if(P&&(j.isoTpl==="yyyy-MM-dd"||j.isoTpl==="yyyy-MM-ddTHH:mm"||j.isoTpl==="yyyy-MM")){const _e=Ce=>{const Fe=String(Ce.getFullYear()).padStart(4,"0"),Pe=String(Ce.getMonth()+1).padStart(2,"0"),dt=String(Ce.getDate()).padStart(2,"0");let ut="";if(j.isoTpl==="yyyy-MM")ut=Fe+Pe;else if(j.isoTpl==="yyyy-MM-dd")ut=Fe+Pe+dt;else{const pn=String(Ce.getHours()).padStart(2,"0"),fn=String(Ce.getMinutes()).padStart(2,"0");ut=Fe+Pe+dt+pn+fn}Ie(ut.slice(0,Ee),Ee)},De=()=>{if(w&&/^\d{4}-\d{2}/.test(w)){const Ce=new Date(w);if(!Number.isNaN(Ce.getTime()))return Ce}return new Date};if(g==="t"||g==="T"){c.preventDefault(),_e(new Date),H?.(c);return}if(g==="+"||g==="="||g==="-"){c.preventDefault();const Ce=g==="-"?-1:1,Fe=De();Fe.setDate(Fe.getDate()+Ce),_e(Fe),H?.(c);return}if(g==="m"||g==="M"){c.preventDefault();const Ce=De();Ce.setMonth(Ce.getMonth()+(g==="M"?-1:1)),_e(Ce),H?.(c);return}if(g==="y"||g==="Y"){c.preventDefault();const Ce=De();Ce.setFullYear(Ce.getFullYear()+(g==="Y"?-1:1)),_e(Ce),H?.(c);return}}const ge=c.currentTarget,Se=ge.selectionStart??0,Ue=ge.selectionEnd??0;if(/^[0-9]$/.test(g)){c.preventDefault();const _e=Ge(j.displayTpl,Se,S),De=Ge(j.displayTpl,Ue,S),Ce=S.slice(0,_e),Fe=S.slice(De);let Pe=(Ce+g+Fe).slice(0,Ee);_e===De&&Ce.length+1+Fe.length>Ee&&(Pe=(Ce+g+Fe.slice(1)).slice(0,Ee)),Ie(Pe,_e+1),H?.(c);return}if(g==="Backspace"){if(c.preventDefault(),Se!==Ue){const _e=Ge(j.displayTpl,Se,S),De=Ge(j.displayTpl,Ue,S),Ce=S.slice(0,_e)+S.slice(De);Ie(Ce,_e)}else{const _e=Ge(j.displayTpl,Se,S);if(_e===0){H?.(c);return}const De=S.slice(0,_e-1)+S.slice(_e);Ie(De,_e-1)}H?.(c);return}if(g==="Delete"){if(c.preventDefault(),Se!==Ue){const _e=Ge(j.displayTpl,Se,S),De=Ge(j.displayTpl,Ue,S),Ce=S.slice(0,_e)+S.slice(De);Ie(Ce,_e)}else{const _e=Ge(j.displayTpl,Se,S);if(_e>=S.length){H?.(c);return}const De=S.slice(0,_e)+S.slice(_e+1);Ie(De,_e)}H?.(c);return}H?.(c)},[Ie,s,bt,H,d,j.displayTpl,j.isoTpl,Ee,P,w,Qe,Xe,st,b,C]),[rt,Tt]=a.useState(()=>Date.now());a.useEffect(()=>{if(!F)return;const c=window.setInterval(()=>Tt(Date.now()),Math.max(100,J));return()=>window.clearInterval(c)},[F,J]);const tt=a.useMemo(()=>Dn(w,p,rt),[w,p,rt]),vt=a.useRef(0);a.useEffect(()=>{if(!v)return;const c=tt.getTime();c!==vt.current&&(vt.current=c,v(tt))},[tt,v]);const gt=a.useMemo(()=>{if(!F)return null;const c=tt.getTime()-rt;return he?he(c,tt):(Sn[ne]??en)(c,h??se("datetime.countdownDone","Done"))},[F,tt,rt,he,ne,h,se]),r=a.useCallback(c=>{if(d||s)return;const g=c.clipboardData.getData("text");if(!g)return;c.preventDefault();const S=Ve.current,ge=g.replace(/[^0-9]/g,"");let Se;ge.length===Ee&&(g.includes("-")||g.includes("T"))?Se=at(j.displayTpl,j.isoTpl,ge):Se=ge.slice(0,Ee);const Ue=c.currentTarget,_e=Ue.selectionStart??0,De=Ue.selectionEnd??0,Ce=Ge(j.displayTpl,_e,S),Fe=Ge(j.displayTpl,De,S),Pe=S.slice(0,Ce),dt=S.slice(Fe),ut=(Pe+Se+dt).slice(0,Ee);Ie(ut,Math.min(Ee,Pe.length+Se.length))},[Ie,s,d,j.displayTpl,j.isoTpl,Ee]),I=a.useCallback(c=>{const g=c;if(g.inputType==="insertText"||g.inputType==="insertCompositionText"||g.inputType==="insertFromComposition"){const S=g.data??"";if(!/^[0-9]+$/.test(S)){c.preventDefault();return}if(S.length>1){c.preventDefault();const ge=c.currentTarget,Se=ge.selectionStart??0,Ue=ge.selectionEnd??0,_e=Ve.current,De=Ge(j.displayTpl,Se,_e),Ce=Ge(j.displayTpl,Ue,_e),Fe=_e.slice(0,De),Pe=_e.slice(Ce),dt=(Fe+S+Pe).slice(0,Ee);Ie(dt,Math.min(Ee,Fe.length+S.length))}}},[Ie,j.displayTpl,Ee]),ce=a.useCallback(c=>{if(d||s)return;const g=c.target.value,S=g.replace(/[^0-9]/g,"").slice(0,Ee);if(S!==Ve.current)if(S.length===Ee&&(g.includes("-")||g.includes("T")||g.includes(":"))){const ge=at(j.displayTpl,j.isoTpl,S);Ie(ge,ge.length)}else Ie(S,S.length)},[Ie,s,d,j.displayTpl,j.isoTpl,Ee]),ve=a.useCallback(()=>{Ie("",0),requestAnimationFrame(()=>$e.current?.focus())},[Ie]),Me=a.useCallback(()=>{if(s||d)return;if(be==="date"||be==="datetime-local"||be==="time"){de(S=>!S);return}const c=m.current;if(!c)return;const g=c;try{if(typeof g.showPicker=="function"){g.showPicker();return}}catch{}c.focus(),c.click()},[s,d,be]),fe=a.useCallback(c=>{const g=c.target.value,S=pt(g,j.isoTpl),ge=at(j.displayTpl,j.isoTpl,S);Ye.current=g,We(ge),B?.(g),requestAnimationFrame(()=>$e.current?.focus())},[B,j.displayTpl,j.isoTpl]),Re=a.useCallback(()=>{if(s||d)return;const c=new Date,g=De=>String(De).padStart(2,"0"),S=`${c.getFullYear()}-${g(c.getMonth()+1)}-${g(c.getDate())}`,ge=`${g(c.getHours())}:${g(c.getMinutes())}`,Se=b?`${ge}:${g(c.getSeconds())}`:ge;let Ue;be==="time"?Ue=Se:be==="datetime-local"?Ue=`${S}T${Se}`:be==="month"?Ue=`${c.getFullYear()}-${g(c.getMonth()+1)}`:Ue=S;const _e=pt(Ue,j.isoTpl);Ye.current=Ue,We(at(j.displayTpl,j.isoTpl,_e)),B?.(Ue)},[s,d,be,b,B,j.displayTpl,j.isoTpl]),we=be==="date"||be==="datetime-local",Be=(()=>{const c=/^(\d{4}-\d{2}-\d{2})/.exec(w??"");return c?c[1]:""})(),lt=xt(w??"")??{hours:0,minutes:0,seconds:0},ct=()=>{const c=new Date;return`${c.getFullYear()}-${Ae(c.getMonth()+1)}-${Ae(c.getDate())}`},nt=(c,g)=>{const S=b?`${Ae(g.hours)}:${Ae(g.minutes)}:${Ae(g.seconds)}`:`${Ae(g.hours)}:${Ae(g.minutes)}`;let ge;be==="time"?ge=S:be==="datetime-local"?ge=`${c}T${S}`:ge=c,st(ge)},yt=c=>{c&&nt(c,Qe?lt:{hours:0,minutes:0,seconds:0})},ot=(c,g)=>{nt(we?Be||ct():"",{...lt,[c]:g})},Nt=c=>c==="hours"?23:59,jt=c=>c==="minutes"&&C&&C>0?C:1,_t=(c,g)=>{const S=Nt(c),ge=jt(c),Se=S+1,Ue=((lt[c]+g*ge)%Se+Se)%Se;ot(c,Ue)},St=(c,g,S)=>e.jsx(An,{part:c,label:se(g,S),value:lt[c],max:Nt(c),step:jt(c),onPick:ge=>ot(c,ge),onStep:ge=>_t(c,ge),startHold:D,stopHold:Ne}),cn=()=>{nt(ct(),Qe?lt:{hours:0,minutes:0,seconds:0})},on=()=>{de(!1),requestAnimationFrame(()=>$e.current?.focus())};a.useLayoutEffect(()=>{if(!ue)return;const c=o.current?.getBoundingClientRect();c&&(y({left:c.left,top:c.bottom+6}),He(ke.scopeThemeClass(o.current)))},[ue]),a.useEffect(()=>{if(!ue)return;const c=ge=>{const Se=ge.target;o.current?.contains(Se)||N.current?.contains(Se)||de(!1)},g=ge=>{ge.key==="Escape"&&de(!1)},S=()=>{const ge=o.current?.getBoundingClientRect();ge&&y({left:ge.left,top:ge.bottom+6})};return document.addEventListener("mousedown",c),document.addEventListener("keydown",g),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",g),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[ue]);const dn=a.useCallback(c=>{$e.current=c,typeof E=="function"?E(c):E&&(E.current=c)},[E]),Vt=a.useMemo(()=>{const c=[];return x&&c.push(f.Yc.submit),c.push({key:"Esc",description:se("shortcuts.clearDate","Clear value")}),c},[x,se]),un=be==="time";return ee?null:e.jsxs("div",{className:`nice-field nice-field--${u}${ie?` nice-field--label-${ie}`:""}${L==="right"?" nice-field--error-right":""} ${A?"nice-field--loading":""} ${z||""}`,style:{...te,...U!=null&&{"--nice-field-label-width":typeof U=="number"?`${U}px`:U},...T!=null&&{"--nice-field-control-width":typeof T=="number"?`${T}px`:T}},"aria-busy":A||void 0,children:[t&&e.jsxs("label",{htmlFor:ye,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,O&&Vt.length>0&&e.jsx(f.ha,{shortcuts:Vt,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{ref:o,className:`nice-input nice-input--date nice-input--${u} nice-input--ds-${Te} ${n?"nice-input--error":""} ${s?"nice-input--disabled":""} ${d?"nice-input--readonly":""}`,style:{...oe,width:"fit-content",position:"relative"},children:[e.jsx("input",{ref:dn,id:ye,className:"nice-input__native nice-masked-input",type:"text",name:_,value:mt,placeholder:et,disabled:s||A,readOnly:d,autoComplete:"off",spellCheck:!1,inputMode:"numeric","aria-invalid":!!n,"aria-label":t?void 0:se("controls.date","Date"),"data-display-tpl":j.displayTpl,"data-iso-tpl":j.isoTpl,style:{width:`${it}ch`,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontVariantNumeric:"tabular-nums"},onBeforeInput:I,onChange:ce,onBlur:le,onKeyDown:wt,onPaste:r}),R&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:ve,disabled:!w||s||d,"aria-label":se("controls.clear","Clear"),tabIndex:w&&!s&&!d?0:-1,children:e.jsx(f.oa,{name:"close",size:14})}),q&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"nice-input__picker-trigger",onClick:Me,"aria-label":se("controls.openPicker","Open picker"),tabIndex:-1,disabled:s||d,children:un?e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v5l3.5 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]}):e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",children:[e.jsx("rect",{x:"3.25",y:"4.5",width:"17.5",height:"16.5",rx:"2",stroke:"currentColor",strokeWidth:"1.7"}),e.jsx("line",{x1:"16",y1:"2.5",x2:"16",y2:"6.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),e.jsx("line",{x1:"8",y1:"2.5",x2:"8",y2:"6.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"}),e.jsx("line",{x1:"3.25",y1:"9.75",x2:"20.75",y2:"9.75",stroke:"currentColor",strokeWidth:"1.5"})]})}),e.jsx("input",{ref:m,type:be,className:"nice-input__picker-companion",value:w??"",min:G,max:V,step:be==="time"||be==="datetime-local"?b?1:C?C*60:void 0:void 0,onChange:fe,tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",width:0,height:0,opacity:0,pointerEvents:"none",border:0,padding:0,left:0,bottom:0}})]}),Qe&&re==="12"&&!s&&!d&&e.jsx("button",{type:"button",className:"nice-input__ampm",onClick:ht,disabled:!w,"aria-label":se("datetime.toggleAmPm","Toggle AM/PM"),tabIndex:-1,children:Ct}),Z&&!s&&!d&&e.jsx("button",{type:"button",className:"nice-input__now",onClick:Re,tabIndex:-1,children:se("controls.now","Now")})]}),ue&&Q&&pe&&Wt.createPortal(e.jsxs("div",{ref:N,className:`nice-datetime-popup${Le?` ${Le}`:""}`,style:{position:"fixed",left:Q.left,top:Q.top,zIndex:1e3},role:"dialog","aria-label":se("controls.openPicker","Open picker"),children:[e.jsxs("div",{className:"nice-datetime-popup__body",children:[we&&e.jsx("div",{className:"nice-datetime-popup__col nice-datetime-popup__col--date",children:e.jsx(Et,{value:Be,onChange:yt,min:G&&G.length>=10?G.slice(0,10):void 0,max:V&&V.length>=10?V.slice(0,10):void 0})}),Qe&&e.jsx("div",{className:"nice-datetime-popup__col nice-datetime-popup__col--time",children:e.jsxs("div",{className:"nice-datetime-popup__time",role:"group",children:[St("hours","datetime.hours","Hours"),e.jsx("span",{className:"nice-datetime-popup__time-sep",children:":"}),St("minutes","datetime.minutes","Minutes"),b&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"nice-datetime-popup__time-sep",children:":"}),St("seconds","datetime.seconds","Seconds")]})]})})]}),e.jsxs("div",{className:"nice-datetime-popup__footer",children:[R&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:ve,children:se("controls.clear","Clear")}),we&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:cn,children:se("controls.today","Today")}),Qe&&e.jsx("button",{type:"button",className:"nice-datetime-popup__btn",onClick:Re,children:se("controls.now","Now")}),e.jsx("button",{type:"button",className:"nice-datetime-popup__btn nice-datetime-popup__btn--primary",onClick:on,children:se("controls.confirm","Confirm")})]})]}),pe),F&>!=null&&e.jsxs("span",{className:"nice-datetime__countdown","aria-live":"polite",children:[xe&&e.jsxs("span",{className:"nice-datetime__countdown-label",children:[xe," "]}),e.jsx("span",{className:"nice-datetime__countdown-value",children:gt})]}),A&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),L==="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),L==="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]}),L!=="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),L!=="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})});ft.displayName="NiceDateTimePicker";const En=Object.freeze(Object.defineProperty({__proto__:null,NiceDateTimePicker:ft},Symbol.toStringTag,{value:"Module"})),It=({label:t,helperText:i,error:n,required:l,disabled:s,size:d="md",name:u,id:_,className:k,style:z,accessMode:te,options:$,value:w,onChange:B,direction:le="horizontal",showKeyboardHints:H,displayStyle:G,labelPlacement:V,errorPlacement:Y,labelWidth:me,controlWidth:x,loading:ae,readOnly:O})=>{f.ac("toggle",G);const X=f.Dc(te,_),ie=X==="hidden";(X==="disabled"||X==="readOnly")&&(s=!0);const{t:L}=f.Gt(),A=f.bc(_),U=u||A,T=a.useMemo(()=>[{key:"ArrowUp",description:L("shortcuts.previousOption","Previous option")},{key:"ArrowDown",description:L("shortcuts.nextOption","Next option")},{key:"Space",description:L("shortcuts.select","Select")}],[L]);return ie?null:e.jsxs("div",{className:`nice-field nice-field--inline nice-field--inline-block nice-field--${d} ${V==="left"?"nice-field--label-left":""} ${Y==="right"?"nice-field--error-right":""} ${ae?"nice-field--loading":""} ${k||""}`,style:{...z,...me!=null&&{"--nice-field-label-width":typeof me=="number"?`${me}px`:me},...x!=null&&{"--nice-field-control-width":typeof x=="number"?`${x}px`:x}},role:"radiogroup","aria-labelledby":`${A}-label`,"aria-busy":ae||void 0,children:[t&&e.jsxs("span",{id:`${A}-label`,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,H&&e.jsx(f.ha,{shortcuts:T,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsx("div",{className:`nice-radio-group ${le==="vertical"?"nice-radio-group--vertical":""}`,children:$.map(K=>e.jsxs("label",{className:`nice-radio ${s||K.disabled||ae?"nice-radio--disabled":""} ${O?"nice-radio--readonly":""}`,children:[e.jsx("input",{type:"radio",className:"nice-radio__input",name:U,value:K.value,checked:w===K.value,disabled:s||K.disabled||ae,"aria-readonly":O||void 0,onChange:()=>{O||B?.(K.value)}}),e.jsx("span",{className:"nice-radio__circle",children:e.jsx("span",{className:"nice-radio__dot"})}),e.jsx("span",{children:K.label})]},K.value))}),ae&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),Y==="right"&&n&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:n}),Y==="right"&&!n&&i&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:i})]}),Y!=="right"&&n&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:n}),Y!=="right"&&!n&&i&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:i})]})},Un=Object.freeze(Object.defineProperty({__proto__:null,NiceRadioGroup:It},Symbol.toStringTag,{value:"Module"})),kt=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,id:d,className:u,style:_,accessMode:k,value:z=0,onChange:te,min:$=0,max:w=100,step:B=1,showValue:le=!0,showMinMax:H=!1,formatValue:G,showKeyboardHints:V,displayStyle:Y,size:me="md",labelPlacement:x,errorPlacement:ae,labelWidth:O,controlWidth:X,loading:ie,showTicks:L=!1,tickInterval:A,maxTicks:U=21,showTickLabels:T=!1},K)=>{f.ac("input",Y);const R=f.Dc(k,d),q=R==="hidden";(R==="disabled"||R==="readOnly")&&(s=!0);const{t:W}=f.Gt(),P=f.bc(d),b=a.useMemo(()=>(z-$)/(w-$)*100,[z,$,w]),C=G?G(z):z.toString(),Z=a.useMemo(()=>{if(!L)return[];const v=w-$;if(v<=0)return[$,w];let F=A??B,ne=Math.floor(v/F)+1;return ne>U&&(F=v/(U-1),ne=U),Array.from({length:ne},(he,xe)=>{const J=$+xe*F;return xe===ne-1?w:J})},[L,$,w,B,A,U]),re=a.useMemo(()=>[f.Yc.increment,f.Yc.decrement,f.Yc.first,f.Yc.last,f.Yc.incrementBig,f.Yc.decrementBig],[]),p=x==="left";return q?null:e.jsxs("div",{className:`nice-field nice-field--${me} ${p?"nice-field--label-left":""} ${ie?"nice-field--loading":""} ${u||""}`,style:{..._,...O!=null&&{"--nice-field-label-width":typeof O=="number"?`${O}px`:O},...X!=null&&{"--nice-field-control-width":typeof X=="number"?`${X}px`:X}},"aria-busy":ie||void 0,children:[p?t&&e.jsxs("label",{htmlFor:P,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,V&&e.jsx(f.ha,{shortcuts:re,size:"sm"})]}):(t||le||V)&&e.jsxs("div",{className:"nice-slider__header",children:[t?e.jsxs("label",{htmlFor:P,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:[t,V&&e.jsx(f.ha,{shortcuts:re,size:"sm"})]}):e.jsx("span",{}),le&&e.jsx("span",{className:"nice-slider__value nice-slider__value--header",children:C})]}),e.jsxs("div",{className:"nice-field__control nice-field__control--slider",children:[e.jsxs("div",{className:`nice-slider ${s||ie?"nice-slider--disabled":""} ${L?"nice-slider--with-ticks":""}`,children:[e.jsxs("div",{className:"nice-slider__track-wrapper",children:[e.jsx("div",{className:"nice-slider__track",children:e.jsx("div",{className:"nice-slider__fill",style:{width:`${b}%`}})}),L&&Z.length>0&&e.jsx("div",{className:"nice-slider__ticks","aria-hidden":"true",children:Z.map((v,F)=>{const ne=(v-$)/(w-$)*100,he=v<=z;return e.jsx("span",{className:`nice-slider__tick ${he?"nice-slider__tick--active":""}`,style:{left:`${ne}%`},children:T&&e.jsx("span",{className:"nice-slider__tick-label",children:G?G(v):v})},F)})}),e.jsx("input",{ref:K,id:P,type:"range",className:"nice-slider__native",min:$,max:w,step:B,value:z,disabled:s||ie,"aria-valuenow":z,"aria-valuemin":$,"aria-valuemax":w,onChange:v=>te?.(parseFloat(v.target.value))}),e.jsx("div",{className:"nice-slider__thumb-visual",style:{left:`${b}%`}})]}),H&&e.jsxs("div",{className:"nice-slider__labels",children:[e.jsx("span",{children:G?G($):$}),e.jsx("span",{children:G?G(w):w})]})]}),p&&le&&e.jsx("span",{className:"nice-slider__value nice-slider__value--inline",children:C}),ie&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--slider",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),ae==="right"&&n&&e.jsx("div",{className:"nice-field__error nice-field__error--slider",role:"alert",children:n}),ae==="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper nice-field__helper--slider",children:i})]}),ae!=="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),ae!=="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})});kt.displayName="NiceSlider";const Fn=Object.freeze(Object.defineProperty({__proto__:null,NiceSlider:kt},Symbol.toStringTag,{value:"Module"}));function In({text:t,query:i}){if(!i)return e.jsx(e.Fragment,{children:t});const n=t.toLowerCase().indexOf(i.toLowerCase());return n<0?e.jsx(e.Fragment,{children:t}):e.jsxs("span",{children:[t.slice(0,n),e.jsx("strong",{children:t.slice(n,n+i.length)}),t.slice(n+i.length)]})}const tn=({options:t,value:i,onChange:n,minSearchLength:l=1,maxResults:s=10,onSearch:d,clearable:u,loading:_,multiple:k,renderOption:z,highlightMatch:te=!0,showAll:$=!0,menuGap:w,label:B,error:le,helperText:H,required:G,disabled:V,readOnly:Y,size:me="md",id:x,className:ae,style:O,accessMode:X,showKeyboardHints:ie,displayStyle:L,labelPlacement:A,errorPlacement:U,labelWidth:T,controlWidth:K})=>{f.rc("input",L),f.ac("input",L);const R=f.Dc(X,x),q=R==="hidden";(R==="disabled"||R==="readOnly")&&(V=!0);const W=f.bc(x),{t:P}=f.Gt(),b=a.useMemo(()=>k?Array.isArray(i)?i:i?[i]:[]:[],[i,k]),[C,Z]=a.useState(()=>k||Array.isArray(i)?"":t.find(o=>String(o.value)===i)?.label??i??""),[re,p]=a.useState(!1),v=a.useRef(null),[F,ne]=a.useState(-1),he=a.useRef(null),xe=a.useRef(null),{popupRef:J,coords:h,themeClass:E,portalTarget:oe}=ke.useAnchoredPopup(re,v,()=>p(!1)),Te=a.useMemo(()=>{const o=[f.Yc.moveDown,f.Yc.moveUp,f.Yc.submit,f.Yc.cancel];return k&&o.push({key:"Backspace",description:P("shortcuts.removeLastTag","Remove last tag")}),o},[k,P]);a.useEffect(()=>{k||Z(Array.isArray(i)?"":t.find(o=>String(o.value)===i)?.label??i??"")},[i,k,t]);const je=a.useMemo(()=>{if(C.length<l)return $?(d?t:[...t].sort((ue,de)=>ue.label.localeCompare(de.label))).slice(0,s):[];if(d)return t.slice(0,s);const o=C.toLowerCase();return t.filter(N=>N.label.toLowerCase().includes(o)).slice(0,s)},[t,C,l,s,d,$]),ee=a.useMemo(()=>{const o=new Map;for(const N of je){const ue=N.group||"";o.has(ue)||o.set(ue,[]),o.get(ue).push(N)}return o},[je]),se=a.useCallback(o=>{Y||(Z(o),p(o.length>=l),ne(0),d?.(o))},[l,d,Y]),ye=a.useCallback(o=>{if(!Y)if(k){const N=String(o.value),ue=b.includes(N)?b.filter(de=>de!==N):[...b,N];n?.(ue),Z("")}else Z(o.label),n?.(String(o.value)),p(!1)},[n,k,b,Y]),$e=o=>{if(!Y){if(k&&o.key==="Backspace"&&!C&&b.length>0){n?.(b.slice(0,-1));return}if(!re&&(o.key==="ArrowDown"||o.key==="ArrowUp")){o.preventDefault(),p(!0),ne(0);return}re&&(o.key==="ArrowDown"?(o.preventDefault(),ne(N=>N<0?0:Math.min(N+1,je.length-1))):o.key==="ArrowUp"?(o.preventDefault(),ne(N=>N<=0?je.length-1:N-1)):(o.key==="Enter"||o.key==="Tab")&&F>=0&&F<je.length?(o.preventDefault(),ye(je[F])):o.key==="Escape"&&p(!1))}},m=a.useCallback(o=>{Y||n?.(b.filter(N=>N!==o))},[b,n,Y]);return q?null:e.jsxs("div",{className:`nice-field nice-field--${me} ${A==="left"?"nice-field--label-left":""} ${_?"nice-field--loading":""} ${ae||""}`,style:{width:"fit-content",...O,...T!=null&&{"--nice-field-label-width":typeof T=="number"?`${T}px`:T},...K!=null&&{"--nice-field-control-width":typeof K=="number"?`${K}px`:K},...w!=null&&{"--nice-dropdown-gap":`${w}px`}},ref:he,"aria-busy":_||void 0,children:[B&&e.jsxs("label",{className:`nice-field__label ${G?"nice-field__label--required":""}`,htmlFor:W,children:[B,ie&&e.jsx(f.ha,{shortcuts:Te,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",style:{position:"relative"},children:[e.jsx("div",{ref:v,className:`nice-input nice-input--${me} ${le?"nice-input--error":""} ${V?"nice-input--disabled":""}`,style:{width:"220px"},children:e.jsxs("div",{className:"nice-field__input-wrap",style:{display:"flex",flexWrap:k?"wrap":"nowrap",gap:4,alignItems:"center",flex:1,minWidth:0},children:[k&&b.map(o=>{const N=t.find(ue=>String(ue.value)===o);return e.jsxs("span",{className:"nice-autocomplete__tag",children:[N?.label||o,!Y&&e.jsx("button",{type:"button",className:"nice-autocomplete__tag-remove",onClick:()=>m(o),"aria-label":P("controls.remove","Remove"),children:e.jsx(f.oa,{name:"close",size:14})})]},o)}),e.jsx("input",{ref:xe,id:W,type:"text",className:"nice-input__native",value:C,onChange:o=>se(o.target.value),onFocus:()=>!Y&&($||C.length>=l)&&p(!0),onKeyDown:$e,disabled:V,readOnly:Y,required:G,role:"combobox","aria-expanded":re,"aria-autocomplete":"list",autoComplete:"off",style:{flex:1,minWidth:60,border:"none",outline:"none",background:"transparent",color:"inherit",padding:0,font:"inherit"}}),u&&!k&&C&&!V&&!Y&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:()=>{Z(""),n?.("")},"aria-label":P("controls.clear","Clear"),children:e.jsx(f.oa,{name:"close",size:14})})]})}),re&&je.length>0&&h&&oe&&Wt.createPortal(e.jsx("ul",{ref:J,className:`nice-dropdown__list${E?` ${E}`:""}`,"data-theme":E==="nice-dark"?"dark":E==="nice-light"?"light":void 0,role:"listbox",style:{position:"fixed",left:h.left,top:h.top,width:h.width,minWidth:h.width,zIndex:1e3},children:Array.from(ee.entries()).map(([o,N])=>e.jsxs(a.Fragment,{children:[o&&e.jsx("li",{className:"nice-dropdown__group-label",children:o}),N.map(ue=>{const Q=je.indexOf(ue)===F,y=k&&b.includes(String(ue.value));return e.jsx("li",{role:"option",className:`nice-dropdown__option ${Q?"nice-dropdown__option--active":""} ${y?"nice-dropdown__option--selected":""}`,onMouseDown:Le=>{Le.preventDefault(),ye(ue)},"aria-selected":Q,children:z?z(ue,C):te?e.jsx(In,{text:ue.label,query:C}):ue.label},String(ue.value))})]},o))}),oe),_&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),U==="right"&&le&&e.jsx("div",{id:`${W}-error`,className:"nice-field__error",role:"alert",children:le}),U==="right"&&!le&&H&&e.jsx("div",{id:`${W}-helper`,className:"nice-field__helper",children:H})]}),U!=="right"&&le&&e.jsx("div",{id:`${W}-error`,className:"nice-field__error",role:"alert",children:le}),U!=="right"&&!le&&H&&e.jsx("div",{id:`${W}-helper`,className:"nice-field__helper",children:H})]})},nn=({options:t,suggestions:i,value:n,onChange:l,searchable:s=!0,clearable:d,maxTags:u,allowCustom:_,placeholder:k,label:z,error:te,helperText:$,required:w,disabled:B,size:le="md",loading:H,id:G,className:V,style:Y,accessMode:me,showKeyboardHints:x,labelPlacement:ae,errorPlacement:O,labelWidth:X,controlWidth:ie,readOnly:L,autoExpand:A=!1})=>{const U=f.Dc(me,G),T=U==="hidden";(U==="disabled"||U==="readOnly")&&(B=!0);const K=f.bc(G),{t:R}=f.Gt(),[q,W]=a.useState(!1),[P,b]=a.useState(""),C=a.useRef(null),Z=a.useRef(null);f.Sc(C,()=>W(!1));const re=a.useMemo(()=>[f.Yc.submit,f.Yc.cancel,{key:"Backspace",description:R("shortcuts.removeLastTag","Remove last tag")}],[R]),p=a.useMemo(()=>Array.isArray(t)&&t.length>0?t:Array.isArray(i)?i.map(h=>({label:h,value:h})):[],[t,i]),v=a.useMemo(()=>Array.isArray(n)?n:[],[n]),F=a.useMemo(()=>{let h=p.filter(E=>!v.includes(String(E.value)));if(P){const E=P.toLowerCase();h=h.filter(oe=>oe.label.toLowerCase().includes(E))}return h},[p,v,P]),ne=a.useCallback(h=>{u&&v.length>=u||(v.includes(h)||l([...v,h]),b(""))},[v,l,u]),he=a.useCallback(h=>{l(v.filter(E=>E!==h))},[v,l]),xe=h=>{L||(h.key==="Backspace"&&!P&&v.length>0?he(v[v.length-1]):h.key==="Enter"&&P?(h.preventDefault(),F.length>0?ne(String(F[0].value)):_&&ne(P)):h.key==="Escape"&&W(!1))},J=h=>p.find(E=>String(E.value)===h)?.label??h;return T?null:e.jsxs("div",{className:`nice-field nice-field--${le} ${ae==="left"?"nice-field--label-left":""} ${H?"nice-field--loading":""} ${V||""}`,style:{...Y,...X!=null&&{"--nice-field-label-width":typeof X=="number"?`${X}px`:X},...ie!=null&&{"--nice-field-control-width":typeof ie=="number"?`${ie}px`:ie}},ref:C,"aria-busy":H||void 0,children:[z&&e.jsxs("label",{className:`nice-field__label ${w?"nice-field__label--required":""}`,htmlFor:K,children:[z,x&&e.jsx(f.ha,{shortcuts:re,size:"sm"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{className:`nice-tagbox nice-tagbox--${le} ${A?"nice-tagbox--expand":"nice-tagbox--fixed"} ${te?"nice-tagbox--error":""} ${B?"nice-tagbox--disabled":""} ${L?"nice-tagbox--readonly":""}`,onClick:()=>{!B&&!H&&!L&&(W(!0),Z.current?.focus())},style:{position:"relative",cursor:B||H?"not-allowed":L?"default":"text"},children:[e.jsxs("div",{className:"nice-tagbox__tags",children:[v.map(h=>e.jsxs("span",{className:"nice-tag nice-tagbox__tag",children:[J(h),!B&&!L&&e.jsx("button",{type:"button",className:"nice-tag__remove",onClick:E=>{E.stopPropagation(),he(h)},"aria-label":R("controls.remove","Remove"),children:e.jsx(f.oa,{name:"close",size:14})})]},h)),s&&e.jsx("input",{ref:Z,id:K,type:"text",className:"nice-tagbox__input nice-input__native",value:P,onChange:h=>{b(h.target.value),W(!0)},onFocus:()=>W(!0),onKeyDown:xe,placeholder:v.length===0?k||R("controls.select","Select..."):"",disabled:B||H,readOnly:L,autoComplete:"off",style:{border:"none",outline:"none",background:"transparent",color:"inherit",flex:1,minWidth:80,padding:0,font:"inherit",caretColor:"var(--color-primary)"}})]}),d&&v.length>0&&!B&&!L&&e.jsx("button",{type:"button",className:"nice-input__clear",onClick:h=>{h.stopPropagation(),l([])},"aria-label":R("controls.clear","Clear"),children:e.jsx(f.oa,{name:"close",size:14})}),q&&(F.length>0||_&&P)&&e.jsxs("ul",{className:"nice-dropdown__list nice-tagbox__dropdown",role:"listbox",children:[F.map(h=>e.jsx("li",{role:"option",className:"nice-dropdown__option",onMouseDown:E=>{E.preventDefault(),ne(String(h.value))},children:h.label},String(h.value))),_&&P&&!F.some(h=>String(h.value).toLowerCase()===P.toLowerCase())&&e.jsxs("li",{role:"option",className:"nice-dropdown__option nice-dropdown__option--add",onMouseDown:h=>{h.preventDefault(),ne(P)},children:["+ ",R("controls.add","Add")," “",P,"”"]})]})]}),H&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),O==="right"&&te&&e.jsx("div",{id:`${K}-error`,className:"nice-field__error",role:"alert",children:te}),O==="right"&&!te&&$&&e.jsx("div",{id:`${K}-helper`,className:"nice-field__helper",children:$})]}),O!=="right"&&te&&e.jsx("div",{id:`${K}-error`,className:"nice-field__error",role:"alert",children:te}),O!=="right"&&!te&&$&&e.jsx("div",{id:`${K}-helper`,className:"nice-field__helper",children:$})]})},an={phone:"(999) 999-9999","credit-card":"9999 9999 9999 9999",date:"99/99/9999",ssn:"999-99-9999",zip:"99-999",time:"99:99",iban:"aa99 9999 9999 9999 9999 9999"};function Ln(t){return[...t].map(i=>i==="9"?{type:"digit"}:i==="a"?{type:"letter"}:i==="*"?{type:"alphanum"}:{type:"literal",literal:i})}function zn(t,i){return i.type==="digit"?/\d/.test(t):i.type==="letter"?/[a-zA-Z]/.test(t):i.type==="alphanum"?/[a-zA-Z0-9]/.test(t):!1}function Xt(t,i,n){let l=0,s="";for(const d of i)d.type==="literal"?s+=d.literal:l<t.length?(s+=t[l],l++):s+=n;return s}function Bn(t,i){return t.map(n=>n.type==="literal"?n.literal:i).join("")}const Lt=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:d,size:u="md",name:_,id:k,className:z,style:te,value:$="",onChange:w,onBlur:B,onKeyDown:le,mask:H,maskPreset:G,maskChar:V="_",placeholder:Y,showMaskAsPlaceholder:me=!0,clearable:x=!1,autoFocus:ae,labelPlacement:O,errorPlacement:X,loading:ie,labelWidth:L,controlWidth:A,...U},T)=>{const{t:K}=f.Gt(),R=f.bc(k),q=a.useRef(null),[W,P]=a.useState(!1),b=H||(G?an[G]:"")||"999",C=a.useMemo(()=>Ln(b),[b]),Z=a.useMemo(()=>Xt($,C,V),[$,C,V]),re=W||$?Z:"",p=Y??(me?Bn(C,V):void 0),v=a.useCallback(E=>{q.current=E,typeof T=="function"?T(E):T&&(T.current=E)},[T]),F=a.useCallback(E=>{const oe=Xt(E,C,V);w?.(E,oe)},[w,C,V]),ne=a.useCallback(E=>{const oe=E.currentTarget,Te=oe.value,je=oe.selectionStart??Te.length;let ee="",se=0;for(let ye=0;ye<Te.length&&se<C.length;ye++){const $e=Te[ye];for(;se<C.length&&C[se].type==="literal";)se++;if(se>=C.length)break;zn($e,C[se])&&(ee+=$e,se++)}F(ee),requestAnimationFrame(()=>{let ye=0,$e=0;for(let m=0;m<C.length;m++){if(C[m].type==="literal")ye=m+1;else if($e<ee.length)$e++,ye=m+1;else{ye=m;break}if(ye>=je&&$e>=ee.length)break}$e>=ee.length&&ee.length>0&&(ye=Math.min(ye,C.length)),oe.setSelectionRange(ye,ye)})},[C,F]),he=a.useCallback(E=>{if(E.key==="Backspace"&&$.length>0){E.preventDefault();const oe=$.slice(0,-1);F(oe)}le?.(E)},[$,F,le]),xe=a.useCallback(()=>P(!0),[]),J=a.useCallback(E=>{P(!1),B?.(E)},[B]),h=a.useCallback(()=>{F(""),q.current?.focus()},[F]);return e.jsxs("div",{className:`nice-field nice-field--masked nice-field--${u} ${O==="left"?"nice-field--label-left":""} ${ie?"nice-field--loading":""} ${z||""}`,style:{...te,...L!=null&&{"--nice-field-label-width":typeof L=="number"?`${L}px`:L},...A!=null&&{"--nice-field-control-width":typeof A=="number"?`${A}px`:A}},"aria-busy":ie||void 0,children:[t&&e.jsx("label",{htmlFor:R,className:`nice-field__label ${l?"nice-field__label--required":""}`,children:t}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{className:`nice-input nice-input--${u} ${n?"nice-input--error":""} ${s?"nice-input--disabled":""} ${d?"nice-input--readonly":""}`,style:{width:"fit-content",minWidth:0},children:[e.jsx("input",{ref:v,id:R,className:"nice-input__native nice-masked-input",type:"text",name:_,value:re,placeholder:p,disabled:s||ie,readOnly:d,autoFocus:ae,style:{width:`${b.length}ch`,minWidth:0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontVariantNumeric:"tabular-nums"},"aria-invalid":!!n,"aria-describedby":n?`${R}-error`:i?`${R}-helper`:void 0,onInput:ne,onChange:()=>{},onKeyDown:he,onFocus:xe,onBlur:J,...U}),x&&$&&e.jsx("button",{type:"button",className:"nice-input__clear",disabled:s||d,onClick:h,"aria-label":K("controls.clear","Clear"),children:e.jsx(f.oa,{name:"close",size:14})})]}),ie&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),X==="right"&&n&&e.jsx("div",{id:`${R}-error`,className:"nice-field__error",role:"alert",children:n}),X==="right"&&!n&&i&&e.jsx("div",{id:`${R}-helper`,className:"nice-field__helper",children:i})]}),X!=="right"&&n&&e.jsx("div",{id:`${R}-error`,className:"nice-field__error",role:"alert",children:n}),X!=="right"&&!n&&i&&e.jsx("div",{id:`${R}-helper`,className:"nice-field__helper",children:i})]})});Lt.displayName="NiceMaskedInput";const Pn=[{id:"length",label:"At least 8 characters",test:t=>t.length>=8},{id:"uppercase",label:"At least one uppercase letter",test:t=>/[A-Z]/.test(t)},{id:"lowercase",label:"At least one lowercase letter",test:t=>/[a-z]/.test(t)},{id:"digit",label:"At least one digit",test:t=>/\d/.test(t)},{id:"special",label:"At least one special character",test:t=>/[^a-zA-Z0-9]/.test(t)}];function Hn(t,i){if(!t)return{level:"none",passed:[],ratio:0};const n=i.filter(d=>d.test(t)).map(d=>d.id),l=n.length/i.length;let s="weak";return l>=1?s="strong":l>=.75?s="good":l>=.5&&(s="fair"),{level:s,passed:n,ratio:l}}const zt=a.forwardRef(({label:t,helperText:i,error:n,required:l,disabled:s,readOnly:d,size:u="md",name:_,id:k,className:z,style:te,value:$="",onChange:w,onBlur:B,onKeyDown:le,placeholder:H,maxLength:G,showToggle:V=!0,showStrength:Y=!1,strengthRules:me,validationPlacement:x="bottom",autoFocus:ae,autoComplete:O,labelPlacement:X,errorPlacement:ie,loading:L,labelWidth:A,controlWidth:U,...T},K)=>{const{t:R}=f.Gt(),q=f.bc(k),[W,P]=a.useState(!1),b=me??Pn,C=a.useMemo(()=>Y?Hn($,b):null,[Y,$,b]),Z=a.useCallback(()=>P(p=>!p),[]),re=Y&&C&&$?e.jsxs("div",{className:`nice-password__strength ${x==="right"?"nice-password__strength--right":""}`,children:[e.jsx("div",{className:"nice-password__meter",children:e.jsx("div",{className:`nice-password__meter-fill nice-password__meter-fill--${C.level}`,style:{width:`${C.ratio*100}%`}})}),e.jsx("span",{className:`nice-password__strength-label nice-password__strength-label--${C.level}`,children:R(`password.strength.${C.level}`,C.level.charAt(0).toUpperCase()+C.level.slice(1))}),e.jsx("ul",{className:"nice-password__rules",children:b.map(p=>{const v=C.passed.includes(p.id);return e.jsxs("li",{className:`nice-password__rule ${v?"nice-password__rule--passed":""}`,children:[e.jsx("span",{className:"nice-password__rule-icon",children:e.jsx(f.oa,{name:v?"check":"close",size:14})}),p.label]},p.id)})})]}):null;return e.jsxs("div",{className:`nice-field nice-field--${u} ${X==="left"?"nice-field--label-left":""} ${L?"nice-field--loading":""} ${z||""}`,style:{...te,...A!=null&&{"--nice-field-label-width":typeof A=="number"?`${A}px`:A},...U!=null&&{"--nice-field-control-width":typeof U=="number"?`${U}px`:U}},"aria-busy":L||void 0,children:[t&&e.jsx("label",{htmlFor:q,className:`nice-field__label ${l?"nice-field__label--required":""}`,style:x==="right"&&X==="left"?{alignSelf:"flex-start",paddingTop:6}:void 0,children:t}),e.jsxs("div",{className:"nice-field__control",style:x==="right"?{alignItems:"flex-start"}:void 0,children:[e.jsxs("div",{style:x==="right"?{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0}:{display:"contents"},children:[e.jsxs("div",{className:`nice-input nice-input--${u} ${n?"nice-input--error":""} ${s?"nice-input--disabled":""} ${d?"nice-input--readonly":""}`,children:[e.jsx("input",{ref:K,id:q,className:"nice-input__native",type:W?"text":"password",name:_,value:$,placeholder:H,disabled:s||L,readOnly:d,maxLength:G,autoFocus:ae,autoComplete:O,"aria-invalid":!!n,"aria-describedby":n?`${q}-error`:i?`${q}-helper`:void 0,onChange:p=>w?.(p.target.value),onBlur:B,onKeyDown:le,...T}),V&&e.jsx("button",{type:"button",className:"nice-password__toggle",onClick:Z,disabled:s,tabIndex:-1,"aria-label":W?R("password.hide","Hide password"):R("password.show","Show password"),children:e.jsx(f.oa,{name:W?"eye-off":"eye",size:18})})]}),x==="right"&&ie!=="right"&&n&&e.jsx("div",{id:`${q}-error`,className:"nice-field__error",role:"alert",children:n}),x==="right"&&ie!=="right"&&!n&&i&&e.jsx("div",{id:`${q}-helper`,className:"nice-field__helper",children:i})]}),L&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),x==="right"&&re,ie==="right"&&n&&e.jsx("div",{id:`${q}-error`,className:"nice-field__error",role:"alert",children:n}),ie==="right"&&!n&&i&&e.jsx("div",{id:`${q}-helper`,className:"nice-field__helper",children:i})]}),x!=="right"&&re,x!=="right"&&ie!=="right"&&n&&e.jsx("div",{id:`${q}-error`,className:"nice-field__error",role:"alert",children:n}),x!=="right"&&ie!=="right"&&!n&&i&&e.jsx("div",{id:`${q}-helper`,className:"nice-field__helper",children:i})]})});zt.displayName="NicePasswordInput";const Yn=({filled:t,size:i})=>e.jsxs("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t==="half"&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:"halfGrad",children:[e.jsx("stop",{offset:"50%",stopColor:"currentColor"}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87L18.18 22 12 18.27 5.82 22 7 14.14l-5-4.87 6.91-1.01L12 2z",fill:t==="full"?"currentColor":t==="half"?"url(#halfGrad)":"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})]}),Gn={xxs:10,xs:14,sm:18,md:22,lg:28,xl:34,xxl:42,small:18,medium:22,large:28},$t=a.forwardRef(({value:t=0,onChange:i,count:n=5,half:l=!1,readOnly:s=!1,disabled:d=!1,size:u="md",label:_,icon:k,name:z,error:te,helperText:$,required:w,id:B,className:le,style:H,labelPlacement:G,errorPlacement:V,labelWidth:Y,controlWidth:me,valuePlacement:x="none",valueTemplate:ae,loading:O,...X},ie)=>{const{t:L}=f.Gt(),A=f.bc(B),[U,T]=a.useState(null),K=Gn[u],R=!s&&!d&&!O,q=U??t,W=p=>q>=p+1?"full":l&&q>=p+.5?"half":"empty",P=a.useCallback((p,v)=>{if(!R)return;const F=v&&l?p+.5:p+1;i?.(F===t?0:F)},[R,l,i,t]),b=a.useCallback((p,v)=>{if(R)if(l){const F=v.currentTarget.getBoundingClientRect(),ne=v.clientX-F.left<F.width/2;T(ne?p+.5:p+1)}else T(p+1)},[R,l]),C=a.useCallback(()=>{R&&T(null)},[R]),Z=a.useCallback(p=>{if(!R)return;const v=l?.5:1;if(p.key==="ArrowRight"||p.key==="ArrowUp"){p.preventDefault();const F=Math.min(n,t+v);i?.(F)}else if(p.key==="ArrowLeft"||p.key==="ArrowDown"){p.preventDefault();const F=Math.max(0,t-v);i?.(F)}},[R,l,n,t,i]),re=ae?ae.replace("{value}",String(t)):String(t);return e.jsxs("div",{className:`nice-field nice-field--${u} ${G==="left"?"nice-field--label-left":""} ${O?"nice-field--loading":""} ${le||""}`,style:{...H,...Y!=null&&{"--nice-field-label-width":typeof Y=="number"?`${Y}px`:Y},...me!=null&&{"--nice-field-control-width":typeof me=="number"?`${me}px`:me}},"aria-busy":O||void 0,...X,children:[_&&e.jsx("label",{htmlFor:A,className:`nice-field__label ${w?"nice-field__label--required":""}`,children:_}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{ref:ie,id:A,className:`nice-rating nice-rating--${u} ${d?"nice-rating--disabled":""} ${s?"nice-rating--readonly":""}`,role:"slider","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":n,"aria-label":_||L("controls.rating","Rating"),"aria-invalid":!!te,tabIndex:R?0:-1,onMouseLeave:C,onKeyDown:Z,children:[z&&e.jsx("input",{type:"hidden",name:z,value:t}),Array.from({length:n},(p,v)=>{const F=W(v);return e.jsx("span",{className:`nice-rating__star nice-rating__star--${F}`,onClick:ne=>{if(!R)return;const he=ne.currentTarget.getBoundingClientRect(),xe=l&&ne.clientX-he.left<he.width/2;P(v,xe)},onMouseMove:ne=>b(v,ne),"aria-label":`${v+1} ${L("controls.star","star")}`,children:k?k(F):e.jsx(Yn,{filled:F,size:K})},v)}),O&&e.jsx("span",{className:"nice-rating__loading",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]}),x==="right"&&!O&&e.jsx("span",{className:"nice-rating__value",children:re}),x==="bottom"&&!O&&e.jsx("div",{className:"nice-rating__value nice-rating__value--bottom",children:re}),V==="right"&&te&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:te}),V==="right"&&!te&&$&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:$})]}),V!=="right"&&te&&e.jsx("div",{id:`${A}-error`,className:"nice-field__error",role:"alert",children:te}),V!=="right"&&!te&&$&&e.jsx("div",{id:`${A}-helper`,className:"nice-field__helper",children:$})]})});$t.displayName="NiceRating";const Vn=Object.freeze(Object.defineProperty({__proto__:null,NiceRating:$t},Symbol.toStringTag,{value:"Module"})),Kn=()=>`file-${Date.now()}-${Math.random().toString(36).slice(2,11)}`,Rt=t=>{if(t===0)return"0 B";const i=1024,n=["B","KB","MB","GB","TB"],l=Math.floor(Math.log(t)/Math.log(i));return`${parseFloat((t/Math.pow(i,l)).toFixed(2))} ${n[l]}`},Bt=t=>t.startsWith("image/"),Pt=t=>t.startsWith("video/"),sn=t=>t.startsWith("audio/"),qn=t=>Bt(t)?"image":Pt(t)?"video":sn(t)?"music":/pdf|word|document|text|json|xml/.test(t)?"file":/excel|spreadsheet/.test(t)?"table":/powerpoint|presentation/.test(t)?"monitor":/zip|rar|7z/.test(t)?"box":"folder",On=t=>{if(Bt(t.type)||Pt(t.type)||sn(t.type))return URL.createObjectURL(t)},Zn={xxs:24,xs:32,sm:48,md:80,lg:120,xl:160,xxl:200},Jn=(t,i)=>n=>{const l=new FormData;n.chunk?(l.append("chunk",n.chunk),l.append("chunkIndex",String(n.chunkIndex)),l.append("totalChunks",String(n.totalChunks)),l.append("fileName",n.file.name),l.append("fileId",n.fileId||"")):l.append("file",n.file);const s=new XMLHttpRequest;return new Promise(d=>{s.upload.addEventListener("progress",u=>{u.lengthComputable&&n.onProgress&&n.onProgress(u.loaded/u.total*100)}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300)try{const u=JSON.parse(s.responseText);d({success:!0,url:u.url,fileId:u.fileId||u.id,metadata:u})}catch{d({success:!0,url:s.responseText})}else d({success:!1,error:`Upload failed: ${s.status} ${s.statusText}`})}),s.addEventListener("error",()=>d({success:!1,error:"Network error"})),s.addEventListener("abort",()=>d({success:!1,error:"Upload cancelled"})),n.signal&&n.signal.addEventListener("abort",()=>s.abort()),s.open("POST",t),i&&Object.entries(i).forEach(([u,_])=>s.setRequestHeader(u,_)),s.send(l)})},Ht=a.forwardRef((t,i)=>{const{accept:n,multiple:l=!0,maxFileSize:s,maxFiles:d,minFileSize:u,onFilesSelected:_,uploadMode:k="instant",labelText:z,text:te,dropzoneText:$,browseText:w,dragActiveText:B,labelPlacement:le="right",icon:H="upload",showFileList:G=!0,imagePreview:V,showPreview:Y=!0,listMode:me="list",previewSize:x="md",fileProgress:ae,renderPreview:O,renderFileItem:X,variant:ie="dropzone",trigger:L,dropChildren:A,autoUpload:U=!1,uploadHandler:T,uploadUrl:K,uploadHeaders:R,concurrentUploads:q=3,maxRetries:W=3,chunkSize:P=5*1024*1024,chunkThreshold:b=10*1024*1024,validateFile:C,keepFilesAfterUpload:Z=!0,initialFiles:re,disabled:p,readOnly:v,onFilesAdded:F,onUploadComplete:ne,onUploadError:he,onProgress:xe,onFileRemoved:J,onChange:h,apiRef:E,pasteFromClipboard:oe,className:Te,style:je}=t,{t:ee}=f.Gt(),[se,ye]=a.useState(()=>re??[]),[$e,m]=a.useState(!1),o=a.useRef(se),N=a.useRef(null),ue=a.useRef(new Map),de=a.useRef([]),Q=a.useRef(new Set),y=a.useRef(0),Le=a.useRef(()=>{}),He=a.useRef(h),M=!!(T||K);a.useEffect(()=>{o.current=se},[se]),a.useEffect(()=>{He.current=h}),a.useEffect(()=>{He.current?.(se)},[se]),a.useEffect(()=>()=>{o.current.forEach(r=>r.previewUrl&&URL.revokeObjectURL(r.previewUrl))},[]);const pe=a.useCallback(r=>_(r.map(I=>I.file)),[_]),D=a.useCallback(r=>{if(C){const I=C(r);if(I)return I}if(s&&r.size>s)return ee("fileUpload.error.tooLarge","File is too large. Maximum size: {size}").replace("{size}",Rt(s));if(u&&r.size<u)return ee("fileUpload.error.tooSmall","File is too small. Minimum size: {size}").replace("{size}",Rt(u));if(n){const I=n.split(",").map(fe=>fe.trim().toLowerCase()),ce=r.type.toLowerCase(),ve="."+(r.name.split(".").pop()?.toLowerCase()??"");if(!I.some(fe=>fe.startsWith(".")?ve===fe:fe.endsWith("/*")?ce.startsWith(fe.replace("/*","/")):ce===fe))return ee("fileUpload.error.badType","File type not allowed. Accepted types: {accept}").replace("{accept}",n)}return null},[C,s,u,n,ee]),Ne=a.useCallback(()=>T||(K?Jn(K,R):null),[T,K,R]),ze=a.useCallback(async(r,I,ce)=>{const ve=r.file,Me=Math.ceil(ve.size/P);let fe=0,Re={success:!1};for(let we=0;we<Me;we++){if(ce.aborted)throw new Error("Upload cancelled");const Be=we*P,lt=Math.min(Be+P,ve.size),ct=ve.slice(Be,lt);let nt=0,yt=!1;for(;!yt&&nt<W;)try{Re=await I({file:ve,chunk:ct,chunkIndex:we,totalChunks:Me,fileId:r.id,onProgress:ot=>{const Nt=(fe+ct.size*ot/100)/ve.size*100;ye(jt=>jt.map(_t=>_t.id===r.id?{..._t,progress:Nt}:_t))},signal:ce}),Re.success?(yt=!0,fe+=ct.size):nt++}catch(ot){if(nt++,nt>=W)throw ot}if(!yt)throw new Error(`Failed to upload chunk ${we+1}/${Me}`)}return Re},[P,W]),be=a.useCallback(async(r,I)=>{const ce=o.current.find(Me=>Me.id===r);if(!ce||ce.status==="uploading"||ce.status==="success")return;const ve=new AbortController;ue.current.set(r,ve),Q.current.add(r),ye(Me=>Me.map(fe=>fe.id===r?{...fe,status:"uploading",progress:0,error:void 0}:fe));try{const Me=ce.file;let fe;if(Me.size>b?fe=await ze(ce,I,ve.signal):fe=await I({file:Me,onProgress:Re=>{ye(we=>we.map(Be=>Be.id===r?{...Be,progress:Re}:Be)),xe?.(ce,Re)},signal:ve.signal}),fe.success){if(ye(Re=>Re.map(we=>we.id===r?{...we,status:"success",progress:100,uploadedUrl:fe.url,uploadedAt:new Date}:we)),ne?.({...ce,status:"success",uploadedUrl:fe.url}),!Z){const Re=o.current.find(we=>we.id===r);Re?.previewUrl&&URL.revokeObjectURL(Re.previewUrl),ye(we=>we.filter(Be=>Be.id!==r))}}else throw new Error(fe.error||"Upload failed")}catch(Me){const fe=Me;if(fe.name==="AbortError"||fe.message==="Upload cancelled")ye(Re=>Re.map(we=>we.id===r?{...we,status:"cancelled",error:ee("fileUpload.status.cancelled","Cancelled")}:we));else{const Re=fe.message||ee("fileUpload.error.generic","Upload error");ye(we=>we.map(Be=>Be.id===r?{...Be,status:"error",error:Re}:Be)),he?.(ce,Re)}}finally{ue.current.delete(r),Q.current.delete(r),Le.current()}},[b,ze,xe,ne,he,Z,ee]),Oe=a.useRef(be);a.useEffect(()=>{Oe.current=be});const Ke=a.useCallback(()=>{const r=Ne();if(r)for(;de.current.length>0&&Q.current.size<q;){const I=de.current.shift();I&&Oe.current(I,r)}},[Ne,q]);a.useEffect(()=>{Le.current=Ke});const j=a.useCallback(r=>{const I=Ne();if(!I){console.error("No upload handler configured");return}Oe.current(r,I)},[Ne]),Ee=a.useCallback(r=>{ue.current.get(r)?.abort(),ye(I=>I.map(ce=>ce.id===r&&ce.status==="uploading"?{...ce,status:"cancelled",error:ee("fileUpload.status.cancelled","Cancelled")}:ce))},[ee]),Ze=a.useCallback(r=>{ye(I=>I.map(ce=>ce.id===r?{...ce,status:"pending",progress:0,error:void 0}:ce)),j(r)},[j]),We=a.useCallback(r=>{const I=o.current.find(ve=>ve.id===r);if(!I)return;ue.current.get(r)?.abort(),I.previewUrl&&URL.revokeObjectURL(I.previewUrl);const ce=o.current.filter(ve=>ve.id!==r);o.current=ce,ye(ve=>ve.filter(Me=>Me.id!==r)),J?.(I),k==="instant"&&pe(ce)},[J,k,pe]),Ve=a.useCallback(()=>{o.current.filter(r=>r.status==="pending").forEach(r=>de.current.push(r.id)),Ke()},[Ke]),Ye=a.useCallback(()=>{ue.current.forEach(r=>r.abort()),ye(r=>r.map(I=>I.status==="uploading"?{...I,status:"cancelled",error:ee("fileUpload.status.cancelled","Cancelled")}:I))},[ee]),Je=a.useCallback(()=>{Ye(),o.current.forEach(r=>r.previewUrl&&URL.revokeObjectURL(r.previewUrl)),ye([]),k==="instant"&&pe([])},[Ye,k,pe]),mt=a.useCallback(()=>{o.current.filter(r=>r.status==="error").forEach(r=>Ze(r.id))},[Ze]),et=a.useCallback(r=>{if(p||v)return;const I=o.current;let ce=l?r:r.slice(0,1);d&&(ce=ce.slice(0,Math.max(0,d-I.length)));const ve=ce.map(fe=>{const Re=D(fe);return{id:Kn(),file:fe,name:fe.name,size:fe.size,type:fe.type,status:Re?"error":"pending",progress:0,error:Re||void 0,previewUrl:On(fe)}}),Me=l?[...I,...ve]:ve;ye(Me),o.current=Me,F?.(ve),k==="instant"&&pe(Me),U&&(ve.filter(fe=>fe.status==="pending").forEach(fe=>de.current.push(fe.id)),Ke())},[p,v,l,d,D,F,k,pe,U,Ke]),it=a.useCallback(()=>N.current?.click(),[]);a.useImperativeHandle(E,()=>({addFiles:et,uploadAll:Ve,cancelAll:Ye,clearAll:Je,getFiles:()=>o.current,getFile:r=>o.current.find(I=>I.id===r),retryFailed:mt,openFileBrowser:it}),[et,Ve,Ye,Je,mt,it]),a.useEffect(()=>{if(!oe||p||v)return;const r=I=>{const ce=I.clipboardData?.items;if(!ce)return;const ve=[];for(let Me=0;Me<ce.length;Me++)if(ce[Me].kind==="file"){const fe=ce[Me].getAsFile();fe&&ve.push(fe)}ve.length>0&&(I.preventDefault(),et(ve))};return document.addEventListener("paste",r),()=>document.removeEventListener("paste",r)},[oe,p,v,et]);const bt=r=>{r.preventDefault(),!(p||v)&&(y.current++,m(!0))},Ie=r=>{r.preventDefault(),y.current--,y.current<=0&&(y.current=0,m(!1))},st=r=>{r.preventDefault(),y.current=0,m(!1),!(p||v)&&et(Array.from(r.dataTransfer.files))},Qe=r=>{r.target.files&&et(Array.from(r.target.files)),r.target.value=""},Xe=a.useMemo(()=>{const r={total:se.length,pending:0,uploading:0,success:0,error:0};for(const I of se)I.status==="pending"?r.pending++:I.status==="uploading"?r.uploading++:I.status==="success"?r.success++:I.status==="error"&&r.error++;return r},[se]),ht=z??te??$??ee("dropOrClick","Drop files here or click to browse"),Ct=B??ee("fileUpload.dropzone.dragActive","Drop files here"),wt=r=>ee(`fileUpload.status.${r}`,{pending:"Pending",uploading:"Uploading…",success:"Uploaded",error:"Error",cancelled:"Cancelled"}[r]),rt=r=>M||r.status!=="pending",Tt=r=>{if(O)return O(r);const I=Zn[x]??80,ce=V??Y;return ce&&r.previewUrl&&Bt(r.type)?e.jsx("img",{src:r.previewUrl,alt:r.name,className:"nice-fileuploader__thumb nice-upload__thumb nice-upload__preview",style:{width:I,height:I,objectFit:"cover"}}):ce&&r.previewUrl&&Pt(r.type)?e.jsxs("span",{className:"nice-upload__preview",style:{position:"relative",display:"inline-flex"},children:[e.jsx("video",{src:r.previewUrl,muted:!0,style:{width:I,height:I,objectFit:"cover"}}),e.jsx("span",{className:"nice-upload__preview-overlay","aria-hidden":"true",children:e.jsx(f.oa,{name:"play",size:20})})]}):e.jsx("span",{className:"nice-upload__preview nice-upload__preview--icon","aria-hidden":"true",children:e.jsx(f.oa,{name:qn(r.type),size:Math.round(I*.5)})})},tt=r=>{const I={upload:()=>j(r.id),cancel:()=>Ee(r.id),retry:()=>Ze(r.id),remove:()=>We(r.id)};if(X)return e.jsx(a.Fragment,{children:X(r,I)},r.id);const ce=ae?.[r.name]??r.progress,ve=rt(r);return e.jsxs("div",{className:`nice-fileuploader__file nice-upload__file nice-upload__item nice-upload__item--${r.status}`,children:[(V??Y)&&Tt(r),e.jsx("span",{className:"nice-fileuploader__filename nice-upload__filename",title:r.name,children:r.name}),e.jsx("span",{className:"nice-fileuploader__filesize nice-upload__filesize",children:Rt(r.size)}),ve&&e.jsx("span",{className:`nice-upload__badge nice-upload__badge--${r.status}`,children:wt(r.status)}),(r.status==="uploading"||ce!=null&&ce>0&&ce<100)&&e.jsx("div",{className:"nice-fileuploader__progress nice-upload__progress",children:e.jsx("div",{className:"nice-fileuploader__progress-bar nice-upload__progress-bar",style:{width:`${Math.min(100,Math.max(0,ce))}%`}})}),r.error&&r.status==="error"&&e.jsx("span",{className:"nice-upload__item-error",children:r.error}),r.uploadedUrl&&e.jsx("a",{className:"nice-upload__link",href:r.uploadedUrl,target:"_blank",rel:"noopener noreferrer",children:ee("fileUpload.openFile","Open file")}),!v&&!p&&e.jsxs("span",{className:"nice-upload__item-actions",children:[M&&r.status==="pending"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--upload",onClick:I.upload,title:ee("fileUpload.action.upload","Upload"),"aria-label":ee("fileUpload.action.upload","Upload"),children:e.jsx(f.oa,{name:"upload",size:14})}),r.status==="uploading"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--cancel",onClick:I.cancel,title:ee("fileUpload.action.cancel","Cancel"),"aria-label":ee("fileUpload.action.cancel","Cancel"),children:e.jsx(f.oa,{name:"stop",size:14})}),M&&r.status==="error"&&e.jsx("button",{type:"button",className:"nice-upload__btn nice-upload__btn--retry",onClick:I.retry,title:ee("fileUpload.action.retry","Retry"),"aria-label":ee("fileUpload.action.retry","Retry"),children:e.jsx(f.oa,{name:"refresh",size:14})}),r.status!=="uploading"&&e.jsx("button",{type:"button",className:"nice-fileuploader__remove nice-upload__remove nice-upload__btn nice-upload__btn--remove",onClick:I.remove,title:ee("remove","Remove"),"aria-label":ee("remove","Remove"),children:e.jsx(f.oa,{name:"close",size:14})})]})]},r.id)},vt=r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),it())},gt=e.jsx("input",{ref:N,type:"file",accept:n,multiple:l,hidden:!0,disabled:p,onChange:Qe});return e.jsxs("div",{ref:i,className:`nice-fileuploader nice-upload ${p?"nice-fileuploader--disabled nice-upload--disabled":""} ${v?"nice-upload--readonly":""} ${Te||""}`,style:je,children:[ie==="button"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"nice-upload__trigger nice-btn nice-btn--primary",onClick:it,disabled:p||v,children:L??ee("filePicker.label","Choose files")}),gt]}):!v&&e.jsxs("div",{className:`nice-fileuploader__dropzone nice-upload__dropzone nice-upload__dropzone--label-${le} ${!A&&!ht?"nice-upload__dropzone--icon-only":""} ${$e?"nice-fileuploader__dropzone--active nice-upload__dropzone--active":""}`,role:"button",tabIndex:p?-1:0,"aria-disabled":p||void 0,onDragEnter:bt,onDragOver:r=>r.preventDefault(),onDragLeave:Ie,onDrop:st,onClick:()=>!p&&it(),onKeyDown:vt,children:[gt,A??e.jsxs(e.Fragment,{children:[H&&e.jsx("div",{className:"nice-upload__icon","aria-hidden":"true",children:e.jsx(f.oa,{name:H,size:"lg"})}),($e?Ct:ht)&&e.jsxs("div",{className:"nice-fileuploader__label nice-upload__label",children:[$e?Ct:ht,w&&e.jsxs("span",{className:"nice-upload__browse",children:[" ",w]})]})]})]}),G&&se.length>0&&e.jsx("div",{className:`nice-fileuploader__list nice-upload__list nice-upload__list--${me}`,children:se.map(tt)}),M&&se.length>0&&!v&&e.jsxs("div",{className:"nice-upload__bulk",children:[Xe.pending>0&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-btn--sm",onClick:Ve,children:ee("fileUpload.bulk.uploadAll","Upload all ({n})").replace("{n}",String(Xe.pending))}),Xe.error>0&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:mt,children:ee("fileUpload.bulk.retryFailed","Retry failed ({n})").replace("{n}",String(Xe.error))}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:Je,children:ee("fileUpload.bulk.clear","Clear")})]}),!M&&k==="useButtons"&&se.length>0&&!v&&e.jsxs("div",{className:"nice-fileuploader__actions nice-upload__actions",children:[e.jsx("button",{type:"button",className:"nice-btn nice-btn--primary nice-btn--sm",onClick:()=>pe(o.current),children:ee("upload","Upload")}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:Je,children:ee("clearAll","Clear All")})]})]})});Ht.displayName="NiceUpload";const Qn=[{label:"Polska",value:"PL"},{label:"Deutschland",value:"DE"},{label:"Česko",value:"CZ"},{label:"Slovensko",value:"SK"},{label:"United Kingdom",value:"GB"},{label:"United States",value:"US"},{label:"France",value:"FR"},{label:"Italia",value:"IT"},{label:"España",value:"ES"},{label:"Nederland",value:"NL"}],Yt=({label:t,helperText:i,error:n,errorPlacement:l="bottom",required:s,disabled:d,readOnly:u,loading:_,size:k="md",className:z,style:te,accessMode:$,id:w,value:B,defaultValue:le,onChange:H,columns:G=2,showState:V=!1,showBuilding:Y=!0,showApartment:me=!0,showCountry:x=!0,countryOptions:ae=Qn,defaultCountry:O="PL",fieldLabels:X,fieldPlaceholders:ie,showLabel:L=!0,labelPlacement:A,labelWidth:U,controlWidth:T})=>{const K=f.Dc($,w),R=K==="hidden";K==="disabled"&&(d=!0),K==="readOnly"&&(u=!0);const{t:q}=f.Gt(),W=B!==void 0,[P,b]=a.useState(le??{}),C=W?B:P,Z=h=>{const E={...C,...h};W||b(E),H?.(E)},re={street:X?.street??q("address.street","Street"),building:X?.building??q("address.building","Building"),apartment:X?.apartment??q("address.apartment","Apt."),postalCode:X?.postalCode??q("address.postalCode","Postal code"),city:X?.city??q("address.city","City"),state:X?.state??q("address.state","State / Region"),country:X?.country??q("address.country","Country")},p=ie??{},v=C.country??O,F=A==="left"?"left":"top",ne={...te,...U!=null&&{"--nice-field-label-width":typeof U=="number"?`${U}px`:U},...T!=null&&{"--nice-field-control-width":typeof T=="number"?`${T}px`:T}},he={display:"grid",gridTemplateColumns:`repeat(${G}, minmax(0, 1fr))`,gap:"8px 12px"},xe=G===2?{gridColumn:"span 2"}:{},J={size:k,disabled:d||_,readOnly:u,labelPlacement:F};return R?null:e.jsxs("div",{className:`nice-field nice-field--${k} nice-address nice-address--cols-${G} ${_?"nice-field--loading":""} ${z||""}`,style:ne,"aria-busy":_||void 0,children:[L&&t&&e.jsx("label",{className:`nice-field__label ${s?"nice-field__label--required":""}`,children:t}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("div",{className:"nice-address__grid",style:he,children:[e.jsx("div",{style:xe,children:e.jsx(ke.NiceTextInput,{...J,label:re.street,value:C.street??"",onChange:h=>Z({street:h}),placeholder:p.street,required:s})}),Y&&e.jsx(ke.NiceTextInput,{...J,label:re.building,value:C.building??"",onChange:h=>Z({building:h}),placeholder:p.building}),me&&e.jsx(ke.NiceTextInput,{...J,label:re.apartment,value:C.apartment??"",onChange:h=>Z({apartment:h}),placeholder:p.apartment}),e.jsx(ke.NiceTextInput,{...J,label:re.postalCode,value:C.postalCode??"",onChange:h=>Z({postalCode:h}),placeholder:p.postalCode??"00-000",required:s}),e.jsx(ke.NiceTextInput,{...J,label:re.city,value:C.city??"",onChange:h=>Z({city:h}),placeholder:p.city,required:s}),V&&e.jsx(ke.NiceTextInput,{...J,label:re.state,value:C.state??"",onChange:h=>Z({state:h}),placeholder:p.state}),x&&e.jsx(ke.NiceSelect,{...J,label:re.country,value:v,onChange:h=>Z({country:typeof h=="string"?h:String(h??"")}),options:ae,required:s})]}),_&&e.jsx("span",{className:"nice-field__spinner nice-field__spinner--address",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),l==="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),l==="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]}),l!=="right"&&n&&e.jsx("div",{className:"nice-field__error",role:"alert",children:n}),l!=="right"&&!n&&i&&e.jsx("div",{className:"nice-field__helper",children:i})]})};Yt.displayName="NiceAddress";const ln=[{code:"US",name:"United States",dialCode:"+1",flag:"🇺🇸"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"🇬🇧"},{code:"DE",name:"Germany",dialCode:"+49",flag:"🇩🇪"},{code:"FR",name:"France",dialCode:"+33",flag:"🇫🇷"},{code:"PL",name:"Poland",dialCode:"+48",flag:"🇵🇱"},{code:"ES",name:"Spain",dialCode:"+34",flag:"🇪🇸"},{code:"IT",name:"Italy",dialCode:"+39",flag:"🇮🇹"},{code:"NL",name:"Netherlands",dialCode:"+31",flag:"🇳🇱"},{code:"BE",name:"Belgium",dialCode:"+32",flag:"🇧🇪"},{code:"AT",name:"Austria",dialCode:"+43",flag:"🇦🇹"},{code:"CH",name:"Switzerland",dialCode:"+41",flag:"🇨🇭"},{code:"SE",name:"Sweden",dialCode:"+46",flag:"🇸🇪"},{code:"NO",name:"Norway",dialCode:"+47",flag:"🇳🇴"},{code:"DK",name:"Denmark",dialCode:"+45",flag:"🇩🇰"},{code:"FI",name:"Finland",dialCode:"+358",flag:"🇫🇮"},{code:"PT",name:"Portugal",dialCode:"+351",flag:"🇵🇹"},{code:"IE",name:"Ireland",dialCode:"+353",flag:"🇮🇪"},{code:"CZ",name:"Czech Republic",dialCode:"+420",flag:"🇨🇿"},{code:"SK",name:"Slovakia",dialCode:"+421",flag:"🇸🇰"},{code:"HU",name:"Hungary",dialCode:"+36",flag:"🇭🇺"},{code:"RO",name:"Romania",dialCode:"+40",flag:"🇷🇴"},{code:"BG",name:"Bulgaria",dialCode:"+359",flag:"🇧🇬"},{code:"GR",name:"Greece",dialCode:"+30",flag:"🇬🇷"},{code:"UA",name:"Ukraine",dialCode:"+380",flag:"🇺🇦"},{code:"RU",name:"Russia",dialCode:"+7",flag:"🇷🇺"},{code:"CA",name:"Canada",dialCode:"+1",flag:"🇨🇦"},{code:"AU",name:"Australia",dialCode:"+61",flag:"🇦🇺"},{code:"NZ",name:"New Zealand",dialCode:"+64",flag:"🇳🇿"},{code:"JP",name:"Japan",dialCode:"+81",flag:"🇯🇵"},{code:"KR",name:"South Korea",dialCode:"+82",flag:"🇰🇷"},{code:"CN",name:"China",dialCode:"+86",flag:"🇨🇳"},{code:"IN",name:"India",dialCode:"+91",flag:"🇮🇳"},{code:"SG",name:"Singapore",dialCode:"+65",flag:"🇸🇬"},{code:"MY",name:"Malaysia",dialCode:"+60",flag:"🇲🇾"},{code:"TH",name:"Thailand",dialCode:"+66",flag:"🇹🇭"},{code:"VN",name:"Vietnam",dialCode:"+84",flag:"🇻🇳"},{code:"ID",name:"Indonesia",dialCode:"+62",flag:"🇮🇩"},{code:"PH",name:"Philippines",dialCode:"+63",flag:"🇵🇭"},{code:"BR",name:"Brazil",dialCode:"+55",flag:"🇧🇷"},{code:"MX",name:"Mexico",dialCode:"+52",flag:"🇲🇽"},{code:"AR",name:"Argentina",dialCode:"+54",flag:"🇦🇷"},{code:"CL",name:"Chile",dialCode:"+56",flag:"🇨🇱"},{code:"CO",name:"Colombia",dialCode:"+57",flag:"🇨🇴"},{code:"PE",name:"Peru",dialCode:"+51",flag:"🇵🇪"},{code:"ZA",name:"South Africa",dialCode:"+27",flag:"🇿🇦"},{code:"EG",name:"Egypt",dialCode:"+20",flag:"🇪🇬"},{code:"NG",name:"Nigeria",dialCode:"+234",flag:"🇳🇬"},{code:"KE",name:"Kenya",dialCode:"+254",flag:"🇰🇪"},{code:"AE",name:"United Arab Emirates",dialCode:"+971",flag:"🇦🇪"},{code:"SA",name:"Saudi Arabia",dialCode:"+966",flag:"🇸🇦"},{code:"IL",name:"Israel",dialCode:"+972",flag:"🇮🇱"},{code:"TR",name:"Turkey",dialCode:"+90",flag:"🇹🇷"},{code:"AF",name:"Afghanistan",dialCode:"+93",flag:"🇦🇫"},{code:"AL",name:"Albania",dialCode:"+355",flag:"🇦🇱"},{code:"DZ",name:"Algeria",dialCode:"+213",flag:"🇩🇿"},{code:"AD",name:"Andorra",dialCode:"+376",flag:"🇦🇩"},{code:"AO",name:"Angola",dialCode:"+244",flag:"🇦🇴"},{code:"AG",name:"Antigua and Barbuda",dialCode:"+1268",flag:"🇦🇬"},{code:"AM",name:"Armenia",dialCode:"+374",flag:"🇦🇲"},{code:"AZ",name:"Azerbaijan",dialCode:"+994",flag:"🇦🇿"},{code:"BS",name:"Bahamas",dialCode:"+1242",flag:"🇧🇸"},{code:"BH",name:"Bahrain",dialCode:"+973",flag:"🇧🇭"},{code:"BD",name:"Bangladesh",dialCode:"+880",flag:"🇧🇩"},{code:"BB",name:"Barbados",dialCode:"+1246",flag:"🇧🇧"},{code:"BY",name:"Belarus",dialCode:"+375",flag:"🇧🇾"},{code:"BZ",name:"Belize",dialCode:"+501",flag:"🇧🇿"},{code:"BJ",name:"Benin",dialCode:"+229",flag:"🇧🇯"},{code:"BT",name:"Bhutan",dialCode:"+975",flag:"🇧🇹"},{code:"BO",name:"Bolivia",dialCode:"+591",flag:"🇧🇴"},{code:"BA",name:"Bosnia and Herzegovina",dialCode:"+387",flag:"🇧🇦"},{code:"BW",name:"Botswana",dialCode:"+267",flag:"🇧🇼"},{code:"BN",name:"Brunei",dialCode:"+673",flag:"🇧🇳"},{code:"BF",name:"Burkina Faso",dialCode:"+226",flag:"🇧🇫"},{code:"BI",name:"Burundi",dialCode:"+257",flag:"🇧🇮"},{code:"CV",name:"Cape Verde",dialCode:"+238",flag:"🇨🇻"},{code:"KH",name:"Cambodia",dialCode:"+855",flag:"🇰🇭"},{code:"CM",name:"Cameroon",dialCode:"+237",flag:"🇨🇲"},{code:"CF",name:"Central African Republic",dialCode:"+236",flag:"🇨🇫"},{code:"TD",name:"Chad",dialCode:"+235",flag:"🇹🇩"},{code:"KM",name:"Comoros",dialCode:"+269",flag:"🇰🇲"},{code:"CG",name:"Congo",dialCode:"+242",flag:"🇨🇬"},{code:"CD",name:"DR Congo",dialCode:"+243",flag:"🇨🇩"},{code:"CR",name:"Costa Rica",dialCode:"+506",flag:"🇨🇷"},{code:"CI",name:"Côte d'Ivoire",dialCode:"+225",flag:"🇨🇮"},{code:"HR",name:"Croatia",dialCode:"+385",flag:"🇭🇷"},{code:"CU",name:"Cuba",dialCode:"+53",flag:"🇨🇺"},{code:"CY",name:"Cyprus",dialCode:"+357",flag:"🇨🇾"},{code:"DJ",name:"Djibouti",dialCode:"+253",flag:"🇩🇯"},{code:"DM",name:"Dominica",dialCode:"+1767",flag:"🇩🇲"},{code:"DO",name:"Dominican Republic",dialCode:"+1809",flag:"🇩🇴"},{code:"EC",name:"Ecuador",dialCode:"+593",flag:"🇪🇨"},{code:"SV",name:"El Salvador",dialCode:"+503",flag:"🇸🇻"},{code:"GQ",name:"Equatorial Guinea",dialCode:"+240",flag:"🇬🇶"},{code:"ER",name:"Eritrea",dialCode:"+291",flag:"🇪🇷"},{code:"EE",name:"Estonia",dialCode:"+372",flag:"🇪🇪"},{code:"SZ",name:"Eswatini",dialCode:"+268",flag:"🇸🇿"},{code:"ET",name:"Ethiopia",dialCode:"+251",flag:"🇪🇹"},{code:"FJ",name:"Fiji",dialCode:"+679",flag:"🇫🇯"},{code:"GA",name:"Gabon",dialCode:"+241",flag:"🇬🇦"},{code:"GM",name:"Gambia",dialCode:"+220",flag:"🇬🇲"},{code:"GE",name:"Georgia",dialCode:"+995",flag:"🇬🇪"},{code:"GH",name:"Ghana",dialCode:"+233",flag:"🇬🇭"},{code:"GD",name:"Grenada",dialCode:"+1473",flag:"🇬🇩"},{code:"GT",name:"Guatemala",dialCode:"+502",flag:"🇬🇹"},{code:"GN",name:"Guinea",dialCode:"+224",flag:"🇬🇳"},{code:"GW",name:"Guinea-Bissau",dialCode:"+245",flag:"🇬🇼"},{code:"GY",name:"Guyana",dialCode:"+592",flag:"🇬🇾"},{code:"HT",name:"Haiti",dialCode:"+509",flag:"🇭🇹"},{code:"HN",name:"Honduras",dialCode:"+504",flag:"🇭🇳"},{code:"HK",name:"Hong Kong",dialCode:"+852",flag:"🇭🇰"},{code:"IS",name:"Iceland",dialCode:"+354",flag:"🇮🇸"},{code:"IQ",name:"Iraq",dialCode:"+964",flag:"🇮🇶"},{code:"IR",name:"Iran",dialCode:"+98",flag:"🇮🇷"},{code:"JM",name:"Jamaica",dialCode:"+1876",flag:"🇯🇲"},{code:"JO",name:"Jordan",dialCode:"+962",flag:"🇯🇴"},{code:"KZ",name:"Kazakhstan",dialCode:"+7",flag:"🇰🇿"},{code:"KW",name:"Kuwait",dialCode:"+965",flag:"🇰🇼"},{code:"KG",name:"Kyrgyzstan",dialCode:"+996",flag:"🇰🇬"},{code:"LA",name:"Laos",dialCode:"+856",flag:"🇱🇦"},{code:"LV",name:"Latvia",dialCode:"+371",flag:"🇱🇻"},{code:"LB",name:"Lebanon",dialCode:"+961",flag:"🇱🇧"},{code:"LS",name:"Lesotho",dialCode:"+266",flag:"🇱🇸"},{code:"LR",name:"Liberia",dialCode:"+231",flag:"🇱🇷"},{code:"LY",name:"Libya",dialCode:"+218",flag:"🇱🇾"},{code:"LI",name:"Liechtenstein",dialCode:"+423",flag:"🇱🇮"},{code:"LT",name:"Lithuania",dialCode:"+370",flag:"🇱🇹"},{code:"LU",name:"Luxembourg",dialCode:"+352",flag:"🇱🇺"},{code:"MO",name:"Macau",dialCode:"+853",flag:"🇲🇴"},{code:"MK",name:"North Macedonia",dialCode:"+389",flag:"🇲🇰"},{code:"MG",name:"Madagascar",dialCode:"+261",flag:"🇲🇬"},{code:"MW",name:"Malawi",dialCode:"+265",flag:"🇲🇼"},{code:"MV",name:"Maldives",dialCode:"+960",flag:"🇲🇻"},{code:"ML",name:"Mali",dialCode:"+223",flag:"🇲🇱"},{code:"MT",name:"Malta",dialCode:"+356",flag:"🇲🇹"},{code:"MR",name:"Mauritania",dialCode:"+222",flag:"🇲🇷"},{code:"MU",name:"Mauritius",dialCode:"+230",flag:"🇲🇺"},{code:"MD",name:"Moldova",dialCode:"+373",flag:"🇲🇩"},{code:"MC",name:"Monaco",dialCode:"+377",flag:"🇲🇨"},{code:"MN",name:"Mongolia",dialCode:"+976",flag:"🇲🇳"},{code:"ME",name:"Montenegro",dialCode:"+382",flag:"🇲🇪"},{code:"MA",name:"Morocco",dialCode:"+212",flag:"🇲🇦"},{code:"MZ",name:"Mozambique",dialCode:"+258",flag:"🇲🇿"},{code:"MM",name:"Myanmar",dialCode:"+95",flag:"🇲🇲"},{code:"NA",name:"Namibia",dialCode:"+264",flag:"🇳🇦"},{code:"NP",name:"Nepal",dialCode:"+977",flag:"🇳🇵"},{code:"NI",name:"Nicaragua",dialCode:"+505",flag:"🇳🇮"},{code:"NE",name:"Niger",dialCode:"+227",flag:"🇳🇪"},{code:"KP",name:"North Korea",dialCode:"+850",flag:"🇰🇵"},{code:"OM",name:"Oman",dialCode:"+968",flag:"🇴🇲"},{code:"PK",name:"Pakistan",dialCode:"+92",flag:"🇵🇰"},{code:"PS",name:"Palestine",dialCode:"+970",flag:"🇵🇸"},{code:"PA",name:"Panama",dialCode:"+507",flag:"🇵🇦"},{code:"PG",name:"Papua New Guinea",dialCode:"+675",flag:"🇵🇬"},{code:"PY",name:"Paraguay",dialCode:"+595",flag:"🇵🇾"},{code:"QA",name:"Qatar",dialCode:"+974",flag:"🇶🇦"},{code:"RW",name:"Rwanda",dialCode:"+250",flag:"🇷🇼"},{code:"WS",name:"Samoa",dialCode:"+685",flag:"🇼🇸"},{code:"SM",name:"San Marino",dialCode:"+378",flag:"🇸🇲"},{code:"ST",name:"São Tomé and Príncipe",dialCode:"+239",flag:"🇸🇹"},{code:"SN",name:"Senegal",dialCode:"+221",flag:"🇸🇳"},{code:"RS",name:"Serbia",dialCode:"+381",flag:"🇷🇸"},{code:"SC",name:"Seychelles",dialCode:"+248",flag:"🇸🇨"},{code:"SL",name:"Sierra Leone",dialCode:"+232",flag:"🇸🇱"},{code:"SI",name:"Slovenia",dialCode:"+386",flag:"🇸🇮"},{code:"SB",name:"Solomon Islands",dialCode:"+677",flag:"🇸🇧"},{code:"SO",name:"Somalia",dialCode:"+252",flag:"🇸🇴"},{code:"SS",name:"South Sudan",dialCode:"+211",flag:"🇸🇸"},{code:"LK",name:"Sri Lanka",dialCode:"+94",flag:"🇱🇰"},{code:"SD",name:"Sudan",dialCode:"+249",flag:"🇸🇩"},{code:"SR",name:"Suriname",dialCode:"+597",flag:"🇸🇷"},{code:"SY",name:"Syria",dialCode:"+963",flag:"🇸🇾"},{code:"TW",name:"Taiwan",dialCode:"+886",flag:"🇹🇼"},{code:"TJ",name:"Tajikistan",dialCode:"+992",flag:"🇹🇯"},{code:"TZ",name:"Tanzania",dialCode:"+255",flag:"🇹🇿"},{code:"TL",name:"Timor-Leste",dialCode:"+670",flag:"🇹🇱"},{code:"TG",name:"Togo",dialCode:"+228",flag:"🇹🇬"},{code:"TO",name:"Tonga",dialCode:"+676",flag:"🇹🇴"},{code:"TT",name:"Trinidad and Tobago",dialCode:"+1868",flag:"🇹🇹"},{code:"TN",name:"Tunisia",dialCode:"+216",flag:"🇹🇳"},{code:"TM",name:"Turkmenistan",dialCode:"+993",flag:"🇹🇲"},{code:"UG",name:"Uganda",dialCode:"+256",flag:"🇺🇬"},{code:"UY",name:"Uruguay",dialCode:"+598",flag:"🇺🇾"},{code:"UZ",name:"Uzbekistan",dialCode:"+998",flag:"🇺🇿"},{code:"VU",name:"Vanuatu",dialCode:"+678",flag:"🇻🇺"},{code:"VA",name:"Vatican City",dialCode:"+379",flag:"🇻🇦"},{code:"VE",name:"Venezuela",dialCode:"+58",flag:"🇻🇪"},{code:"YE",name:"Yemen",dialCode:"+967",flag:"🇾🇪"},{code:"ZM",name:"Zambia",dialCode:"+260",flag:"🇿🇲"},{code:"ZW",name:"Zimbabwe",dialCode:"+263",flag:"🇿🇼"}],Gt=({value:t,defaultValue:i,onChange:n,placeholder:l,showSearch:s=!0,searchPlaceholder:d,showDialCode:u,showFlag:_,showFlagInValue:k,showFlagInMenu:z,showTextInValue:te,showTextInMenu:$,showDialCodeInValue:w,showDialCodeInMenu:B,showCodeInValue:le=!1,showCodeInMenu:H=!1,compact:G=!1,variant:V="default",dropdownAlign:Y,disabled:me=!1,countries:x,priorityCountries:ae=["US","GB","DE","FR","PL"],allowClear:O=!1,size:X="md",className:ie="",style:L,label:A,helperText:U,error:T,required:K,readOnly:R,loading:q,labelPlacement:W,errorPlacement:P,labelWidth:b,controlWidth:C,id:Z,"data-testid":re="nice-country-picker"})=>{const{t:p}=f.Gt(),v=a.useRef(null),F=a.useRef(null),ne=a.useRef(null),[he,xe]=a.useState(i),[J,h]=a.useState(!1),[E,oe]=a.useState(""),[Te,je]=a.useState(0),ee=k??_??!0,se=z??_??!0,ye=te??!G,$e=$??!0,m=w??u??!G,o=B??u??!0,N=ke.useDropdownAlignment(J,F,Y??(G?"auto":"left")),ue=t!==void 0?t:he,de=a.useMemo(()=>{let D=ln;if(x){const Ne=new Set(x.map(ze=>ze.toUpperCase()));D=D.filter(ze=>Ne.has(ze.code))}return D},[x]),Q=a.useMemo(()=>{if(!ae?.length)return de;const D=new Set(ae.map(be=>be.toUpperCase())),Ne=de.filter(be=>D.has(be.code)),ze=de.filter(be=>!D.has(be.code));return[...Ne,...ze]},[de,ae]),y=a.useMemo(()=>{if(!E)return Q;const D=E.toLowerCase();return Q.filter(Ne=>Ne.name.toLowerCase().includes(D)||Ne.code.toLowerCase().includes(D)||Ne.dialCode.includes(D))},[Q,E]),Le=a.useMemo(()=>ue?de.find(D=>D.code===ue)??null:null,[ue,de]);a.useEffect(()=>{if(!J)return;const D=Ne=>{v.current&&!v.current.contains(Ne.target)&&(h(!1),oe(""))};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[J]),a.useEffect(()=>{J&&s&&ne.current&&ne.current.focus()},[J,s]),a.useEffect(()=>{je(0)},[E]);const He=a.useCallback(D=>{t===void 0&&xe(D.code),n?.(D),h(!1),oe("")},[t,n]),M=a.useCallback(D=>{D.stopPropagation(),t===void 0&&xe(void 0),n?.(null)},[t,n]),pe=a.useCallback(D=>{if(!J){(D.key==="Enter"||D.key===" "||D.key==="ArrowDown")&&(D.preventDefault(),h(!0));return}switch(D.key){case"ArrowDown":D.preventDefault(),je(Ne=>Math.min(Ne+1,y.length-1));break;case"ArrowUp":D.preventDefault(),je(Ne=>Math.max(Ne-1,0));break;case"Enter":D.preventDefault(),y[Te]&&He(y[Te]);break;case"Escape":D.preventDefault(),h(!1),oe("");break}},[J,y,Te,He]);return e.jsxs("div",{ref:v,className:`nice-field nice-field--${X} nice-field--country-picker ${W==="left"?"nice-field--label-left":""} ${P==="right"?"nice-field--error-right":""} ${T?"nice-field--error":""} ${q?"nice-field--loading":""} nice-country-picker nice-country-picker--${X} ${G?"nice-country-picker--compact":""} ${V==="ghost"?"nice-country-picker--ghost":""} ${J?"nice-country-picker--open":""} ${me?"nice-country-picker--disabled":""} ${ie}`,style:{...L,...b!=null&&{"--nice-field-label-width":typeof b=="number"?`${b}px`:b},...C!=null&&{"--nice-field-control-width":typeof C=="number"?`${C}px`:C}},"data-testid":re,"aria-busy":q||void 0,children:[A&&e.jsxs("label",{className:"nice-field__label",htmlFor:Z,children:[A,K&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("button",{ref:F,type:"button",className:"nice-country-picker__trigger",onClick:()=>!me&&!R&&h(!J),onKeyDown:pe,disabled:me,id:Z,"aria-haspopup":"listbox","aria-expanded":J,"aria-invalid":T?!0:void 0,"data-testid":`${re}-trigger`,children:[Le?e.jsxs("span",{className:"nice-country-picker__value",children:[ee&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(ke.FlagIcon,{code:Le.code})}),ye&&e.jsx("span",{className:"nice-country-picker__name",children:Le.name}),le&&e.jsx("span",{className:"nice-country-picker__code",children:Le.code}),m&&e.jsxs("span",{className:"nice-country-picker__dial-code",children:["(",Le.dialCode,")"]})]}):e.jsx("span",{className:"nice-country-picker__placeholder",children:G?"":l??p("controls.select","Select country")}),e.jsxs("span",{className:"nice-country-picker__icons",children:[O&&Le&&!me&&!R&&e.jsx("span",{className:"nice-country-picker__clear",onClick:M,"aria-label":p("clear","Clear"),children:e.jsx(f.oa,{name:"close",size:14})}),V!=="ghost"&&e.jsx("span",{className:"nice-country-picker__arrow",children:e.jsx(f.oa,{name:J?"chevron-up":"chevron-down",size:16})})]})]}),J&&e.jsxs("div",{className:`nice-country-picker__dropdown nice-country-picker__dropdown--align-${N}`,role:"listbox","data-testid":`${re}-dropdown`,children:[s&&e.jsx("div",{className:"nice-country-picker__search",children:e.jsx("input",{ref:ne,type:"text",value:E,onChange:D=>oe(D.target.value),onKeyDown:pe,placeholder:d??p("search","Search"),className:"nice-country-picker__search-input","data-testid":`${re}-search`})}),e.jsx("div",{className:"nice-country-picker__list",children:y.length===0?e.jsx("div",{className:"nice-country-picker__empty",children:p("noData","No countries found")}):y.map((D,Ne)=>e.jsxs("div",{className:`nice-country-picker__option ${D.code===ue?"nice-country-picker__option--selected":""} ${Ne===Te?"nice-country-picker__option--highlighted":""}`,onClick:()=>He(D),onMouseEnter:()=>je(Ne),role:"option","aria-selected":D.code===ue,"data-testid":`${re}-option-${D.code}`,children:[se&&e.jsx("span",{className:"nice-country-picker__flag","aria-hidden":"true",children:e.jsx(ke.FlagIcon,{code:D.code})}),$e&&e.jsx("span",{className:"nice-country-picker__name",children:D.name}),H&&e.jsx("span",{className:"nice-country-picker__code",children:D.code}),o&&e.jsx("span",{className:"nice-country-picker__dial-code",children:D.dialCode})]},D.code))})]}),q&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),P==="right"&&T&&e.jsx("div",{className:"nice-field__error",role:"alert",children:T}),P==="right"&&!T&&U&&e.jsx("div",{className:"nice-field__helper",children:U})]}),P!=="right"&&T&&e.jsx("div",{className:"nice-field__error",role:"alert",children:T}),P!=="right"&&!T&&U&&e.jsx("div",{className:"nice-field__helper",children:U})]})};Gt.displayName="NiceCountryPicker";const rn=({items:t,data:i,onFieldChange:n,onSubmit:l,dataSource:s,recordKey:d,columns:u=1,responsiveColumns:_,gap:k=16,labelPosition:z="top",size:te="md",readOnly:$,disabled:w,className:B,style:le,accessMode:H,id:G,autoSaveDelay:V,onDirtyChange:Y,showActions:me,submitLabel:x="Submit",resetLabel:ae="Reset",onCancel:O,cancelLabel:X="Cancel"})=>{const ie=f.Dc(H,G),L=ie==="hidden";ie==="disabled"&&(w=!0),ie==="readOnly"&&($=!0);const A=f.kn(s??null,d),U=!!s&&d!=null,T=U?A.editData:i??{},[K]=a.useState(()=>({...T})),[R,q]=a.useState([]),W=a.useMemo(()=>Object.keys(T).some(m=>T[m]!==K[m]),[T,K]),P=a.useRef(!1);a.useEffect(()=>{W!==P.current&&(P.current=W,Y?.(W))},[W,Y]);const b=a.useRef(null),C=a.useCallback(()=>{V&&(b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{U?A.save():l?.(T)},V))},[V,U,A,l,T]),Z=a.useCallback((m,o)=>{$||w||(q(N=>[...N,{field:m,prev:T[m]}]),U?A.set(m,o):n?.(m,o),C())},[U,A,n,$,w,T,C]),re=a.useCallback(()=>{if(R.length===0)return;const m=R[R.length-1];q(o=>o.slice(0,-1)),U?A.set(m.field,m.prev):n?.(m.field,m.prev)},[R,U,A,n]),p=a.useCallback(m=>{m.preventDefault(),b.current&&clearTimeout(b.current),U?A.save():l?.(T)},[T,l,U,A]),v=a.useRef(null),[F,ne]=a.useState(u);a.useEffect(()=>{if(!_||!v.current){ne(u);return}const m=v.current,o=new ResizeObserver(N=>{const ue=N[0]?.contentRect.width??0,de=Object.keys(_).map(Number).sort((Q,y)=>y-Q);for(const Q of de)if(ue>=Q){ne(_[Q]);return}ne(u)});return o.observe(m),()=>o.disconnect()},[_,u]);const he=a.useMemo(()=>t.filter(m=>!(m.visible===!1||m.visibleWhen&&!m.visibleWhen(T))),[t,T]),xe=a.useMemo(()=>{const m=[];let o=null;for(const N of he)!o||o.name!==N.group?(o={name:N.group,items:[N]},m.push(o)):o.items.push(N);return m},[he]),J=a.useCallback(m=>{const o=T[m.field]!==void 0?T[m.field]:m.defaultValue,N=y=>Z(m.field,y);if(m.render)return m.render(o,N);const ue=m.type||"text",de=m.options?.map(y=>typeof y=="string"?{label:y,value:y}:{label:y.label,value:String(y.value)}),Q={size:te,disabled:w,readOnly:$};switch(ue){case"number":return e.jsx(ke.NiceNumberInput,{...Q,value:o??null,onChange:y=>N(y),required:m.required});case"currency":return e.jsx(ke.NiceNumberInput,{...Q,value:o??null,onChange:y=>N(y),required:m.required,precision:m.precision??2,step:m.step??100,suffix:m.unit??"PLN",formatPreset:"money"});case"textarea":return e.jsx(Mt,{...Q,value:o??"",onChange:y=>N(y),rows:3});case"address":return e.jsx(Yt,{...Q,value:o??{},onChange:y=>N(y),required:m.required,columns:m.columns??2});case"select":return e.jsx(ke.NiceSelect,{...Q,value:o??"",onChange:y=>N(y),options:de??[]});case"autocomplete":return e.jsx(tn,{...Q,value:o??"",onChange:y=>N(y),options:de??[],suggestions:(de??[]).map(y=>y.label)});case"radio":return e.jsx(It,{...Q,value:o??"",onChange:y=>N(y),options:de??[]});case"checkbox":return e.jsx(ke.NiceCheckbox,{...Q,checked:!!o,onChange:y=>N(y),label:m.label});case"toggle":return e.jsx(ke.NiceToggle,{...Q,checked:!!o,onChange:y=>N(y)});case"date":return e.jsx(ft,{...Q,value:o??"",onChange:y=>N(y)});case"time":return e.jsx(ft,{...Q,dateFormatPreset:"time",value:o??"",onChange:y=>N(y)});case"datetime":return e.jsx(ft,{...Q,dateFormatPreset:"datetime-local",value:o??"",onChange:y=>N(y)});case"color":return e.jsx(ke.NiceColorPicker,{...Q,value:o??"var(--text-primary, #000000)",onChange:y=>N(y)});case"slider":return e.jsx(kt,{...Q,value:typeof o=="number"?o:0,onChange:y=>N(y)});case"rating":return e.jsx($t,{...Q,value:typeof o=="number"?o:0,onChange:y=>N(y)});case"password":return e.jsx(zt,{...Q,value:o??"",onChange:y=>N(y),required:m.required});case"phone":case"tel":return e.jsx(ke.NiceTextInput,{...Q,type:"tel",value:o??"",onChange:y=>N(y),required:m.required});case"country":return e.jsx(Gt,{...Q,value:o??"",onChange:y=>N(y)});case"tags":return e.jsx(nn,{...Q,value:Array.isArray(o)?o:[],onChange:y=>N(y),options:de??[]});case"masked":return e.jsx(Lt,{...Q,value:o??"",mask:m.mask??"999-999-9999",onChange:y=>N(y)});case"file":return e.jsx(Ht,{...Q,onFilesSelected:y=>N(y)});case"email":return e.jsx(ke.NiceTextInput,{...Q,type:"email",value:o??"",onChange:y=>N(y),required:m.required});case"url":return e.jsx(ke.NiceTextInput,{...Q,type:"url",value:o??"",onChange:y=>N(y),required:m.required});default:return e.jsx(ke.NiceTextInput,{...Q,value:o??"",onChange:y=>N(y),required:m.required})}},[T,Z,w,$,te]),h=m=>e.jsxs("div",{className:"nice-form__item",style:{gridColumn:m.colSpan?`span ${m.colSpan}`:void 0},children:[m.label&&e.jsxs("label",{className:"nice-form__label",children:[m.label,m.required&&e.jsx("span",{className:"nice-field__required",children:"*"})]}),e.jsx("div",{className:"nice-form__control",children:J(m)}),m.hint&&e.jsx("div",{className:"nice-form__hint",children:m.hint})]},m.field),E={display:"grid",gridTemplateColumns:`repeat(${F}, 1fr)`,gap:k},oe=xe.some(m=>m.name!=null),Te=a.useMemo(()=>{const m=new Set,o=[];for(const N of he)N.tab&&!m.has(N.tab)&&(m.add(N.tab),o.push(N.tab));return o},[he]),je=Te.length>0,[ee,se]=a.useState("");a.useEffect(()=>{je&&!Te.includes(ee)&&se(Te[0])},[je,Te,ee]);const ye=m=>{const o=[];let N=null;for(const de of m)!N||N.name!==de.group?(N={name:de.group,items:[de]},o.push(N)):N.items.push(de);return o.some(de=>de.name!=null)?o.map((de,Q)=>e.jsxs("fieldset",{className:de.name?"nice-form__group":"nice-form__group nice-form__group--no-title",children:[de.name&&e.jsx("legend",{className:"nice-form__group-title",children:de.name}),e.jsx("div",{style:E,children:de.items.map(h)})]},Q)):e.jsx("div",{style:E,children:m.map(h)})},$e=me?e.jsxs("div",{className:"nice-form__actions",children:[e.jsxs("div",{className:"nice-form__actions-left",children:[O&&e.jsx(ke.NiceButton,{type:"button",variant:"secondary",size:te,onClick:O,children:X}),e.jsx(ke.NiceButton,{type:"button",variant:"ghost",size:te,onClick:re,disabled:R.length===0,children:ae})]}),e.jsx("div",{className:"nice-form__actions-right",children:e.jsx(ke.NiceButton,{type:"submit",variant:"primary",size:te,children:x})})]}):null;return L?null:e.jsxs("form",{ref:v,className:`nice-form nice-form--label-${z}${W?" nice-form--dirty":""} ${B||""}`,style:oe||je?{...le}:{...E,...le},onSubmit:p,noValidate:!0,children:[je?e.jsx(ke.NiceTabs,{className:"nice-form__tabs",activeTab:ee||Te[0],onChange:se,tabs:Te.map(m=>({id:m,label:m,content:e.jsx("div",{className:"nice-form__tab-panel",children:ye(he.filter(o=>(o.tab??Te[0])===m))})}))}):oe?xe.map((m,o)=>e.jsxs("fieldset",{className:m.name?"nice-form__group":"nice-form__group nice-form__group--no-title",children:[m.name&&e.jsx("legend",{className:"nice-form__group-title",children:m.name}),e.jsx("div",{style:E,children:m.items.map(h)})]},o)):he.map(h),$e]})};rn.displayName="NiceForm";exports.COUNTRIES=ln;exports.MASK_PRESETS=an;exports.NiceAddress=Yt;exports.NiceAutocomplete=tn;exports.NiceCalendar=Et;exports.NiceCountryPicker=Gt;exports.NiceDateTimePicker=ft;exports.NiceDateTimePicker$1=En;exports.NiceForm=rn;exports.NiceMaskedInput=Lt;exports.NicePasswordInput=zt;exports.NiceRadioGroup=It;exports.NiceRadioGroup$1=Un;exports.NiceRating=$t;exports.NiceRating$1=Vn;exports.NiceSlider=kt;exports.NiceSlider$1=Fn;exports.NiceTagBox=nn;exports.NiceTextArea=Mt;exports.NiceTextArea$1=mn;exports.NiceUpload=Ht;
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { jsxs as l, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { D as le, G as he } from "./charts-DO2z6Ziu.js";
|
|
3
|
+
import { useState as J, useRef as S, useEffect as T, useMemo as Y, useCallback as z } from "react";
|
|
4
|
+
const b = (m, N) => {
|
|
5
|
+
const y = new Date(m);
|
|
6
|
+
return y.setDate(y.getDate() + N), y;
|
|
7
|
+
}, E = (m, N) => Math.ceil((N.getTime() - m.getTime()) / 864e5), me = ({
|
|
8
|
+
tasks: m,
|
|
9
|
+
columns: N,
|
|
10
|
+
scale: y = "day",
|
|
11
|
+
rowHeight: _ = 36,
|
|
12
|
+
dayWidth: q = 30,
|
|
13
|
+
onTaskClick: O,
|
|
14
|
+
onTaskUpdate: w,
|
|
15
|
+
showDependencies: P = !0,
|
|
16
|
+
dependencyStyle: K = "square",
|
|
17
|
+
draggable: M,
|
|
18
|
+
zoomControls: V,
|
|
19
|
+
className: Z,
|
|
20
|
+
style: k,
|
|
21
|
+
accessMode: H,
|
|
22
|
+
id: U
|
|
23
|
+
}) => {
|
|
24
|
+
const ee = le(H, U) === "hidden", { t: _e } = he(), [o, C] = J(q), [f, B] = J(null), x = N || [{ field: "title", title: "Task", width: 200 }], j = x.reduce((e, t) => e + (t.width || 120), 0), A = S(null), X = S(null), W = S(!1);
|
|
25
|
+
T(() => {
|
|
26
|
+
const e = A.current, t = X.current;
|
|
27
|
+
if (!e || !t)
|
|
28
|
+
return;
|
|
29
|
+
const a = (c, i) => () => {
|
|
30
|
+
W.current || (W.current = !0, i.scrollTop = c.scrollTop, requestAnimationFrame(() => {
|
|
31
|
+
W.current = !1;
|
|
32
|
+
}));
|
|
33
|
+
}, n = a(e, t), r = a(t, e);
|
|
34
|
+
return e.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("scroll", r, { passive: !0 }), () => {
|
|
35
|
+
e.removeEventListener("scroll", n), t.removeEventListener("scroll", r);
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
const d = Y(() => {
|
|
39
|
+
const e = (t) => m.filter((n) => (n.parentId ?? null) === t).flatMap((n) => [n, ...e(n.id)]);
|
|
40
|
+
return e(null);
|
|
41
|
+
}, [m]), u = Y(() => {
|
|
42
|
+
if (d.length === 0)
|
|
43
|
+
return { start: /* @__PURE__ */ new Date(), end: /* @__PURE__ */ new Date(), days: 30 };
|
|
44
|
+
let e = new Date(d[0].start), t = new Date(d[0].end);
|
|
45
|
+
return d.forEach((a) => {
|
|
46
|
+
new Date(a.start) < e && (e = new Date(a.start)), new Date(a.end) > t && (t = new Date(a.end));
|
|
47
|
+
}), e = b(e, -2), t = b(t, 2), { start: e, end: t, days: E(e, t) };
|
|
48
|
+
}, [d]), G = u.days * o;
|
|
49
|
+
T(() => {
|
|
50
|
+
if (!f || !w)
|
|
51
|
+
return;
|
|
52
|
+
const e = (a) => {
|
|
53
|
+
const n = a.clientX - f.startX, r = Math.round(n / o);
|
|
54
|
+
if (r === 0)
|
|
55
|
+
return;
|
|
56
|
+
const c = m.find((i) => i.id === f.taskId);
|
|
57
|
+
if (c)
|
|
58
|
+
if (f.mode === "move")
|
|
59
|
+
w({
|
|
60
|
+
...c,
|
|
61
|
+
start: b(f.origStart, r),
|
|
62
|
+
end: b(f.origEnd, r)
|
|
63
|
+
});
|
|
64
|
+
else {
|
|
65
|
+
const i = b(f.origEnd, r);
|
|
66
|
+
i > f.origStart && w({ ...c, end: i });
|
|
67
|
+
}
|
|
68
|
+
}, t = () => B(null);
|
|
69
|
+
return document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), () => {
|
|
70
|
+
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t);
|
|
71
|
+
};
|
|
72
|
+
}, [f, o, m, w]);
|
|
73
|
+
const I = z(
|
|
74
|
+
(e, t, a) => {
|
|
75
|
+
if (!M || !w)
|
|
76
|
+
return;
|
|
77
|
+
a.stopPropagation();
|
|
78
|
+
const n = m.find((r) => r.id === e);
|
|
79
|
+
n && B({
|
|
80
|
+
taskId: e,
|
|
81
|
+
mode: t,
|
|
82
|
+
startX: a.clientX,
|
|
83
|
+
origStart: new Date(n.start),
|
|
84
|
+
origEnd: new Date(n.end)
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
[M, m, w]
|
|
88
|
+
), te = z(() => C((e) => Math.min(100, e + 5)), []), ne = z(() => C((e) => Math.max(8, e - 5)), []), ae = () => {
|
|
89
|
+
const e = [], t = [];
|
|
90
|
+
new Date(u.start);
|
|
91
|
+
const a = [
|
|
92
|
+
"Jan",
|
|
93
|
+
"Feb",
|
|
94
|
+
"Mar",
|
|
95
|
+
"Apr",
|
|
96
|
+
"May",
|
|
97
|
+
"Jun",
|
|
98
|
+
"Jul",
|
|
99
|
+
"Aug",
|
|
100
|
+
"Sep",
|
|
101
|
+
"Oct",
|
|
102
|
+
"Nov",
|
|
103
|
+
"Dec"
|
|
104
|
+
];
|
|
105
|
+
if (y === "day") {
|
|
106
|
+
let n = -1, r = 0;
|
|
107
|
+
for (let c = 0; c < u.days; c++) {
|
|
108
|
+
const i = b(u.start, c);
|
|
109
|
+
i.getMonth() !== n && (n >= 0 && e.push(
|
|
110
|
+
/* @__PURE__ */ l(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
className: "nice-gantt__header-cell",
|
|
114
|
+
style: { width: (c - r) * o },
|
|
115
|
+
children: [
|
|
116
|
+
a[n],
|
|
117
|
+
" ",
|
|
118
|
+
i.getFullYear()
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
`m${n}-${r}`
|
|
122
|
+
)
|
|
123
|
+
), n = i.getMonth(), r = c);
|
|
124
|
+
const h = i.getDay() === 0 || i.getDay() === 6;
|
|
125
|
+
t.push(
|
|
126
|
+
/* @__PURE__ */ s(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
className: `nice-gantt__header-cell nice-gantt__header-cell--sub ${h ? "nice-gantt__header-cell--weekend" : ""}`,
|
|
130
|
+
style: { width: o },
|
|
131
|
+
children: i.getDate()
|
|
132
|
+
},
|
|
133
|
+
c
|
|
134
|
+
)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
n >= 0 && e.push(
|
|
138
|
+
/* @__PURE__ */ s(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
className: "nice-gantt__header-cell",
|
|
142
|
+
style: { width: (u.days - r) * o },
|
|
143
|
+
children: a[n]
|
|
144
|
+
},
|
|
145
|
+
`m${n}-last`
|
|
146
|
+
)
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return /* @__PURE__ */ l("div", { className: "nice-gantt__chart-header", children: [
|
|
150
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: e }),
|
|
151
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__header-row", children: t })
|
|
152
|
+
] });
|
|
153
|
+
}, re = (e, t) => {
|
|
154
|
+
const a = E(u.start, new Date(e.start)) * o, n = Math.max(E(new Date(e.start), new Date(e.end)) * o, o), r = t * _ + 4, c = _ - 8, i = e.progress ?? 0;
|
|
155
|
+
return /* @__PURE__ */ l(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: `nice-gantt__bar ${M ? "nice-gantt__bar--draggable" : ""}`,
|
|
159
|
+
title: `${e.title} (${Math.round(i)}%)`,
|
|
160
|
+
style: {
|
|
161
|
+
left: a,
|
|
162
|
+
top: r,
|
|
163
|
+
width: n,
|
|
164
|
+
height: c,
|
|
165
|
+
backgroundColor: e.color || "var(--color-primary, #3b82f6)"
|
|
166
|
+
},
|
|
167
|
+
onClick: () => O?.(e),
|
|
168
|
+
onMouseDown: M ? (h) => I(e.id, "move", h) : void 0,
|
|
169
|
+
children: [
|
|
170
|
+
i > 0 && /* @__PURE__ */ s("div", { className: "nice-gantt__bar-progress", style: { width: `${i}%` } }),
|
|
171
|
+
/* @__PURE__ */ s("span", { className: "nice-gantt__bar-label", children: e.title }),
|
|
172
|
+
M && /* @__PURE__ */ s(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
className: "nice-gantt__bar-resize",
|
|
176
|
+
onMouseDown: (h) => I(e.id, "resize", h)
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
e.id
|
|
182
|
+
);
|
|
183
|
+
}, se = (e, t, a, n, r) => {
|
|
184
|
+
const h = e + 10, L = a - 14, R = (t + n) / 2, D = n >= t ? 1 : -1, Q = Math.abs(n - t) < 1, F = L <= h + 4, $ = Q ? t : R, g = F ? Math.max(h, e + 10) : h, v = F ? Math.min(L, a - 10) : L;
|
|
185
|
+
if (Q || !r)
|
|
186
|
+
return [
|
|
187
|
+
`M ${e} ${t}`,
|
|
188
|
+
`L ${g} ${t}`,
|
|
189
|
+
`L ${g} ${$}`,
|
|
190
|
+
`L ${v} ${$}`,
|
|
191
|
+
`L ${v} ${n}`,
|
|
192
|
+
`L ${a} ${n}`
|
|
193
|
+
].join(" ");
|
|
194
|
+
const ce = Math.max(0, v - g), oe = Math.abs(n - t), de = Math.min(oe / 2 || 10, ce / 2 || 10), p = Math.max(2, Math.min(10, de));
|
|
195
|
+
return [
|
|
196
|
+
`M ${e} ${t}`,
|
|
197
|
+
`L ${g - p} ${t}`,
|
|
198
|
+
`Q ${g} ${t} ${g} ${t + D * p}`,
|
|
199
|
+
`L ${g} ${$ - D * p}`,
|
|
200
|
+
`Q ${g} ${$} ${g + p} ${$}`,
|
|
201
|
+
`L ${v - p} ${$}`,
|
|
202
|
+
`Q ${v} ${$} ${v} ${$ + D * p}`,
|
|
203
|
+
`L ${v} ${n - D * p}`,
|
|
204
|
+
`Q ${v} ${n} ${v + p} ${n}`,
|
|
205
|
+
`L ${a} ${n}`
|
|
206
|
+
].join(" ");
|
|
207
|
+
}, ie = () => {
|
|
208
|
+
if (!P)
|
|
209
|
+
return null;
|
|
210
|
+
const e = [], t = new Map(d.map((a, n) => [a.id, n]));
|
|
211
|
+
return d.forEach((a) => {
|
|
212
|
+
(a.dependencies || []).forEach((n) => {
|
|
213
|
+
const r = t.get(n), c = t.get(a.id);
|
|
214
|
+
if (r == null || c == null)
|
|
215
|
+
return;
|
|
216
|
+
const i = d[r], h = E(u.start, new Date(i.end)) * o, L = r * _ + _ / 2, R = E(u.start, new Date(a.start)) * o, D = c * _ + _ / 2;
|
|
217
|
+
e.push(
|
|
218
|
+
/* @__PURE__ */ s(
|
|
219
|
+
"path",
|
|
220
|
+
{
|
|
221
|
+
d: se(h, L, R, D, K === "rounded"),
|
|
222
|
+
fill: "none",
|
|
223
|
+
stroke: "var(--text-secondary, #6b7280)",
|
|
224
|
+
strokeWidth: 1.5,
|
|
225
|
+
strokeLinejoin: "round",
|
|
226
|
+
strokeLinecap: "round",
|
|
227
|
+
markerEnd: "url(#arrowhead)"
|
|
228
|
+
},
|
|
229
|
+
`${n}-${a.id}`
|
|
230
|
+
)
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
}), /* @__PURE__ */ l(
|
|
234
|
+
"svg",
|
|
235
|
+
{
|
|
236
|
+
className: "nice-gantt__deps",
|
|
237
|
+
width: G,
|
|
238
|
+
height: d.length * _,
|
|
239
|
+
style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" },
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ s("defs", { children: /* @__PURE__ */ s("marker", { id: "arrowhead", markerWidth: "6", markerHeight: "4", refX: "5", refY: "2", orient: "auto", children: /* @__PURE__ */ s("polygon", { points: "0 0, 6 2, 0 4", fill: "var(--text-secondary, #6b7280)" }) }) }),
|
|
242
|
+
e
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
return ee ? null : /* @__PURE__ */ l("div", { className: `nice-gantt ${Z || ""}`, style: k, children: [
|
|
248
|
+
V && /* @__PURE__ */ l("div", { className: "nice-gantt__zoom-controls", children: [
|
|
249
|
+
/* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: ne, children: "−" }),
|
|
250
|
+
/* @__PURE__ */ l("span", { className: "nice-gantt__zoom-label", children: [
|
|
251
|
+
o,
|
|
252
|
+
"px"
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ s("button", { type: "button", className: "nice-btn nice-btn--sm", onClick: te, children: "+" })
|
|
255
|
+
] }),
|
|
256
|
+
/* @__PURE__ */ l("div", { className: "nice-gantt__container", children: [
|
|
257
|
+
/* @__PURE__ */ l("div", { className: "nice-gantt__table", style: { width: j, minWidth: j }, children: [
|
|
258
|
+
/* @__PURE__ */ l("div", { className: "nice-gantt__table-header", children: [
|
|
259
|
+
/* @__PURE__ */ s(
|
|
260
|
+
"div",
|
|
261
|
+
{
|
|
262
|
+
className: "nice-gantt__table-header-row nice-gantt__table-header-row--main",
|
|
263
|
+
"aria-hidden": "true",
|
|
264
|
+
children: " "
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__table-header-row nice-gantt__table-header-row--sub", children: x.map((e, t) => /* @__PURE__ */ s(
|
|
268
|
+
"div",
|
|
269
|
+
{
|
|
270
|
+
className: "nice-gantt__table-header-cell",
|
|
271
|
+
style: { width: e.width || 120 },
|
|
272
|
+
children: e.title
|
|
273
|
+
},
|
|
274
|
+
t
|
|
275
|
+
)) })
|
|
276
|
+
] }),
|
|
277
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__table-body", ref: A, children: d.map((e, t) => /* @__PURE__ */ s("div", { className: "nice-gantt__table-row", style: { height: _ }, children: x.map((a, n) => /* @__PURE__ */ s(
|
|
278
|
+
"div",
|
|
279
|
+
{
|
|
280
|
+
className: "nice-gantt__table-cell",
|
|
281
|
+
style: { width: a.width || 120 },
|
|
282
|
+
children: e[a.field]
|
|
283
|
+
},
|
|
284
|
+
n
|
|
285
|
+
)) }, e.id)) })
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ s("div", { className: "nice-gantt__chart", children: /* @__PURE__ */ l("div", { className: "nice-gantt__chart-body-wrap", ref: X, children: [
|
|
288
|
+
ae(),
|
|
289
|
+
/* @__PURE__ */ l(
|
|
290
|
+
"div",
|
|
291
|
+
{
|
|
292
|
+
className: "nice-gantt__chart-body",
|
|
293
|
+
style: {
|
|
294
|
+
width: G,
|
|
295
|
+
height: d.length * _,
|
|
296
|
+
position: "relative"
|
|
297
|
+
},
|
|
298
|
+
children: [
|
|
299
|
+
Array.from({ length: u.days }, (e, t) => {
|
|
300
|
+
const a = b(u.start, t), n = a.getDay() === 0 || a.getDay() === 6;
|
|
301
|
+
return /* @__PURE__ */ s(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
className: `nice-gantt__gridline ${n ? "nice-gantt__gridline--weekend" : ""}`,
|
|
305
|
+
style: {
|
|
306
|
+
left: t * o,
|
|
307
|
+
width: o,
|
|
308
|
+
height: "100%",
|
|
309
|
+
position: "absolute",
|
|
310
|
+
top: 0
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
t
|
|
314
|
+
);
|
|
315
|
+
}),
|
|
316
|
+
d.map((e, t) => re(e, t)),
|
|
317
|
+
ie()
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
] }) })
|
|
322
|
+
] })
|
|
323
|
+
] });
|
|
324
|
+
};
|
|
325
|
+
me.displayName = "NiceGantt";
|
|
326
|
+
export {
|
|
327
|
+
me as NiceGantt
|
|
328
|
+
};
|