react-admin-crud-manager 1.1.1 → 1.2.0

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.
Files changed (30) hide show
  1. package/README.md +1322 -207
  2. package/dist/index.cjs.js +20 -55
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.es.js +4092 -2529
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/types/components/CrudPage.d.ts +2 -211
  7. package/dist/types/components/Details/Details.d.ts +11 -0
  8. package/dist/types/components/Details/components/CardGroup.d.ts +9 -1
  9. package/dist/types/components/Details/components/DetailRow.d.ts +9 -1
  10. package/dist/types/components/Details/components/GroupRow.d.ts +9 -1
  11. package/dist/types/components/Filter/FilterDrawer.d.ts +2 -2
  12. package/dist/types/components/Form/components/AudioPicker.d.ts +2 -1
  13. package/dist/types/components/Form/components/Checkbox.d.ts +2 -1
  14. package/dist/types/components/Form/components/ImagePicker.d.ts +2 -1
  15. package/dist/types/components/Form/components/Input.d.ts +1 -0
  16. package/dist/types/components/Form/components/MultiImagePicker.d.ts +21 -0
  17. package/dist/types/components/Form/components/PhoneInput.d.ts +2 -1
  18. package/dist/types/components/Form/components/Radio.d.ts +2 -1
  19. package/dist/types/components/Form/components/RenderFields.d.ts +3 -2
  20. package/dist/types/components/Form/components/Select.d.ts +5 -2
  21. package/dist/types/components/Form/components/Switch.d.ts +1 -0
  22. package/dist/types/components/Form/components/TextArea.d.ts +2 -0
  23. package/dist/types/components/Form/components/TinyEditor.d.ts +3 -1
  24. package/dist/types/components/Form/components/VideoPicker.d.ts +2 -1
  25. package/dist/types/components/Modal/Modal.d.ts +11 -10
  26. package/dist/types/index.d.ts +2 -5
  27. package/dist/types/lib/crudClasses.d.ts +94 -0
  28. package/dist/types/types/crudtypes.d.ts +268 -0
  29. package/package.json +10 -8
  30. package/dist/tailwind.css +0 -2364
package/dist/index.cjs.js CHANGED
@@ -1,37 +1,31 @@
1
- "use strict";const t=require("react/jsx-runtime"),b=require("react"),U=require("lucide-react"),Ft=require("react-dom"),ce=require("@iconify/react"),It=require("@tinymce/tinymce-react"),le=require("notistack");function Tt(n){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:()=>n[e]})}}return a.default=n,Object.freeze(a)}const ie=Tt(b),gt=(n,a="DD MMM YYYY")=>{if(!n)return"N/A";const e=new Date(n);if(isNaN(e.getTime()))return"Invalid Date";const r=i=>String(i).padStart(2,"0"),o={YYYY:e.getFullYear(),YY:String(e.getFullYear()).slice(-2),MMMM:e.toLocaleString("en-US",{month:"long"}),MMM:e.toLocaleString("en-US",{month:"short"}),MM:r(e.getMonth()+1),M:e.getMonth()+1,DD:r(e.getDate()),D:e.getDate(),dddd:e.toLocaleString("en-US",{weekday:"long"}),ddd:e.toLocaleString("en-US",{weekday:"short"}),HH:r(e.getHours()),hh:r(e.getHours()%12||12),mm:r(e.getMinutes()),ss:r(e.getSeconds()),A:e.getHours()>=12?"PM":"AM"};return a.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,i=>String(o[i]))},Ot=(n,a,e=[])=>{if(!(a!=null&&a.trim()))return n;const r=a.toLowerCase(),o=i=>i==null?[]:typeof i=="object"?Object.values(i).flatMap(o):[String(i)];return n.filter(i=>{let s=[];return e.length>0?e.forEach(c=>{i[c]!==void 0&&s.push(...o(i[c]))}):s=o(i),s.some(c=>c.toLowerCase().includes(r))})},ae=b.forwardRef(({className:n="",variant:a="contained",color:e="default",size:r="default",fullWidth:o=!1,children:i,...s},c)=>{var g;const f="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",d={sm:"h-8 px-3 rounded-md text-sm",md:"h-9 px-4 rounded-md text-sm",lg:"h-11 px-6 rounded-md text-base",xl:"h-12 px-8 rounded-lg text-lg",default:"h-9 px-4 rounded-md text-sm"},p={primary:{contained:"bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",outlined:"border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",text:"bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500"},success:{contained:"bg-green-600 text-white hover:bg-green-700 focus:ring-green-500 shadow-sm",outlined:"border border-green-600 bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500",text:"bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500"},error:{contained:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500 shadow-sm",outlined:"border border-red-600 bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500",text:"bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500"},default:{contained:"border bg-gray-200 text-gray-800 hover:bg-gray-300 focus:ring-gray-300 shadow-sm dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600 dark:focus:ring-gray-600",outlined:"border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",text:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"}},h=((g=p[e])==null?void 0:g[a])||p.default.contained,l=d[r]||d.default,m=`
2
- ${f}
3
- ${h}
4
- ${l}
5
- ${o?"w-full":""}
6
- ${n}
7
- `.trim();return t.jsx("button",{ref:c,type:s.type||"button",className:m,...s,children:i})});ae.displayName="Button";function Q({label:n,required:a=!1,infoText:e=""}){return t.jsx(t.Fragment,{children:t.jsxs("label",{className:"flex text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[n,a&&t.jsx("span",{className:"ml-1",children:"*"}),e&&t.jsxs("span",{className:"ml-2 relative group inline-flex items-center cursor-pointer",children:[t.jsx(U.Info,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),t.jsx("span",{className:`absolute left-1/2 top-full mt-2\r
1
+ "use strict";const t=require("react/jsx-runtime"),g=require("react"),J=require("lucide-react"),Kt=require("react-dom"),ue=require("@iconify/react"),Wt=require("@tinymce/tinymce-react"),je=require("notistack");function Ht(a){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(o,e,r.get?r:{enumerable:!0,get:()=>a[e]})}}return o.default=a,Object.freeze(o)}const ke=Ht(g),Zt='@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap";*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 0 0% 3.9%;--card: 0 0% 100%;--card-foreground: 0 0% 3.9%;--popover: 0 0% 100%;--popover-foreground: 0 0% 3.9%;--primary: 0 0% 9%;--primary-foreground: 0 0% 98%;--secondary: 0 0% 96.1%;--secondary-foreground: 0 0% 9%;--muted: 0 0% 96.1%;--muted-foreground: 0 0% 45.1%;--accent: 0 0% 96.1%;--accent-foreground: 0 0% 9%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 0 0% 89.8%;--input: 0 0% 89.8%;--ring: 0 0% 3.9%;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%;--radius: .5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.-bottom-4{bottom:-1rem}.-right-2{right:-.5rem}.-right-6{right:-1.5rem}.-top-2{top:-.5rem}.-top-6{top:-1.5rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-3{left:.75rem}.right-0{right:0}.right-1{right:.25rem}.right-1\\/2{right:50%}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-\\[50\\%\\]{right:50%}.top-0{top:0}.top-1{top:.25rem}.top-1\\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\\[80\\%\\]{top:80%}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.col-span-12{grid-column:span 12 / span 12}.col-span-6{grid-column:span 6 / span 6}.mb-0{margin-bottom:0}.mb-1{margin-bottom:.25rem}.mb-3{margin-bottom:.75rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-auto{margin-top:auto}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.table-row{display:table-row}.grid{display:grid}.hidden{display:none}.h-1{height:.25rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-20{height:5rem}.h-28{height:7rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-72{height:18rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\\[10px\\]{height:10px}.h-\\[150px\\]{height:150px}.h-\\[36px\\]{height:36px}.h-\\[40px\\]{height:40px}.h-full{height:100%}.max-h-40{max-height:10rem}.max-h-60{max-height:15rem}.max-h-\\[260px\\]{max-height:260px}.max-h-\\[90vh\\]{max-height:90vh}.min-h-\\[52px\\]{min-height:52px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-80{width:20rem}.w-\\[260px\\]{width:260px}.w-\\[28rem\\]{width:28rem}.w-\\[36px\\]{width:36px}.w-\\[42\\%\\]{width:42%}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.min-w-0{min-width:0px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.min-w-\\[220px\\]{min-width:220px}.min-w-\\[40px\\]{min-width:40px}.min-w-\\[78px\\]{min-width:78px}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-\\[200px\\]{max-width:200px}.max-w-\\[300px\\]{max-width:300px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-full{--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(-.5rem * var(--tw-space-x-reverse));margin-left:calc(-.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(243 244 246 / var(--tw-divide-opacity))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-8{border-width:8px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-dashed{border-style:dashed}.border-blue-300{--tw-border-opacity: 1;border-color:rgb(147 197 253 / var(--tw-border-opacity))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity))}.border-green-600{--tw-border-opacity: 1;border-color:rgb(22 163 74 / var(--tw-border-opacity))}.border-primary,.border-primary-500{border-color:var(--primary-500)}.border-purple-300{--tw-border-opacity: 1;border-color:rgb(216 180 254 / var(--tw-border-opacity))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity))}.border-teal-300{--tw-border-opacity: 1;border-color:rgb(94 234 212 / var(--tw-border-opacity))}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-white\\/30{border-color:#ffffff4d}.border-yellow-300{--tw-border-opacity: 1;border-color:rgb(253 224 71 / var(--tw-border-opacity))}.border-t-gray-200{--tw-border-opacity: 1;border-top-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity))}.\\!bg-transparent{background-color:transparent!important}.bg-black\\/50{background-color:#00000080}.bg-black\\/70{background-color:#000000b3}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.bg-blue-500\\/10{background-color:#3b82f61a}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.bg-primary{background-color:var(--primary-500)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-red-500\\/95{background-color:#ef4444f2}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.bg-teal-100{--tw-bg-opacity: 1;background-color:rgb(204 251 241 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-white\\/90{background-color:#ffffffe6}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pl-9{padding-left:2.25rem}.pr-10{padding-right:2.5rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-none{line-height:1}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity))}.text-primary{color:var(--primary-500)}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity))}.text-teal-700{--tw-text-opacity: 1;color:rgb(15 118 110 / var(--tw-text-opacity))}.text-teal-800{--tw-text-opacity: 1;color:rgb(17 94 89 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-blue-100{--tw-ring-opacity: 1;--tw-ring-color: rgb(219 234 254 / var(--tw-ring-opacity))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}:root{--primary-50: #eff6ff;--primary-100: #dbeafe;--primary-200: #bfdbfe;--primary-300: #93c5fd;--primary-400: #60a5fa;--primary-500: #3b82f6;--primary-600: #2563eb;--primary-700: #1d4ed8;--primary-800: #1e40af;--primary-900: #1e3a8a}.primary-bg{background-color:var(--primary-500)}.primary-bg-light{background-color:var(--primary-100)}.primary-bg-dark{background-color:var(--primary-700)}.primary-text{color:var(--primary-600)}.primary-border{border-color:var(--primary-300)}.primary-hover:hover{background-color:var(--primary-600)}:root{--foreground-rgb: 0, 0, 0;--background-start-rgb: 214, 219, 220;--background-end-rgb: 255, 255, 255}@media (prefers-color-scheme: dark){:root{--foreground-rgb: 255, 255, 255;--background-start-rgb: 0, 0, 0;--background-end-rgb: 0, 0, 0}}html,body{height:100%}:root{--scrollbar-thumb: #d1d5db;--scrollbar-thumb-hover: #9ca3af}.dark{--scrollbar-thumb: #4b5563;--scrollbar-thumb-hover: #6b7280}*{scrollbar-width:thin;scrollbar-color:var(--scrollbar-thumb) transparent}*::-webkit-scrollbar{width:6px;height:6px}*::-webkit-scrollbar-track{background:transparent}*::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb);border-radius:3px}*::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover)}h1{font-size:1.5rem;line-height:2rem;font-weight:700;--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}:is(.dark h1){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}p{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}:is(.dark p){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.table-search-field{position:relative;width:100%}@media (min-width: 640px){.table-search-field{min-width:300px!important}}.table-search-field .search-icon{position:absolute;left:.75rem;top:50%;height:1rem;width:1rem;--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}:is(.dark .table-search-field .search-icon){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}.table-search-field input{height:36px;width:100%;border-radius:calc(var(--radius) - 2px);border-width:1px;--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity));padding:.75rem 1rem .75rem 2.25rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.table-search-field input::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity))}.table-search-field input::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity))}.table-search-field input:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity))}.table-search-field input:disabled{opacity:.5}:is(.dark .table-search-field input){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}:is(.dark .table-search-field input)::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}:is(.dark .table-search-field input)::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}:is(.dark .table-search-field input){--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity))}.filter-button-wrapper{position:relative;width:100%}@media (min-width: 640px){.filter-button-wrapper{width:auto!important}}.filter-button-wrapper .red-dot{position:absolute;top:.25rem;right:.25rem;height:.5rem;width:.5rem;border-radius:9999px;--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.table-container{overflow:hidden;border-radius:var(--radius);border-width:1px;--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}:is(.dark .table-container){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.table-container table{min-width:100%}.table-container table>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity))}:is(.dark .table-container table)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(55 65 81 / var(--tw-divide-opacity))}.table-container thead{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}:is(.dark .table-container thead){background-color:#37415199}.table-container tbody>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity))}.table-container tbody{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}:is(.dark .table-container tbody)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(55 65 81 / var(--tw-divide-opacity))}:is(.dark .table-container tbody){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.table-container .table-head-data{min-width:-moz-max-content;min-width:max-content;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1rem 1.5rem;text-align:left;font-size:.75rem;line-height:1rem;font-weight:500;text-transform:uppercase;letter-spacing:.05em;--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}:is(.dark .table-container .table-head-data){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.table-container .no-data-message{padding-top:2.5rem;padding-bottom:2.5rem;text-align:center;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}:is(.dark .table-container .no-data-message){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.table-container .table-row{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.table-container .table-row:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}:is(.dark .table-container .table-row:hover){background-color:#1e40af1a}.table-container .table-data{min-width:-moz-max-content;min-width:max-content;padding:1rem 1.5rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}:is(.dark .table-container .table-data){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity))}.table-container .pagination-wrapper{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem;border-top-width:1px;--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity));padding:.75rem 1.5rem}:is(.dark .table-container .pagination-wrapper){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity));background-color:#37415199}.table-container .pagination-wrapper span{font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}:is(.dark .table-container .pagination-wrapper span){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}.table-container .pagination-wrapper .rows-number-select{border-radius:calc(var(--radius) - 2px);border-width:1px;--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:.25rem .5rem;font-size:.875rem;line-height:1.25rem}.table-container .pagination-wrapper .rows-number-select:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity))}:is(.dark .table-container .pagination-wrapper .rows-number-select){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.table-container .pagination-wrapper .arrow-icons{border-radius:calc(var(--radius) - 2px);padding:.5rem;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.table-container .pagination-wrapper .arrow-icons:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.table-container .pagination-wrapper .arrow-icons:disabled{opacity:.5}:is(.dark .table-container .pagination-wrapper .arrow-icons){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}:is(.dark .table-container .pagination-wrapper .arrow-icons:hover){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}.no-spinner::-webkit-outer-spin-button,.no-spinner::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.no-spinner{-moz-appearance:textfield}.tox.tox-tinymce .tox-edit-area:before{border:0!important;box-shadow:none!important}.hover\\:-translate-y-0:hover{--tw-translate-y: -0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:-translate-y-0\\.5:hover{--tw-translate-y: -.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.hover\\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity))}.hover\\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.hover\\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.hover\\:bg-green-50:hover{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity))}.hover\\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.hover\\:bg-primary-50:hover{background-color:var(--primary-50)}.hover\\:bg-primary-600:hover{background-color:var(--primary-600)}.hover\\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity))}.hover\\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.hover\\:bg-white:hover{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.hover\\:bg-white\\/20:hover{background-color:#fff3}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.hover\\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-blue-200:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity))}.focus\\:ring-blue-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity))}.focus\\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity))}.focus\\:ring-gray-300:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity))}.focus\\:ring-green-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(34 197 94 / var(--tw-ring-opacity))}.focus\\:ring-primary-500:focus{--tw-ring-color: var(--primary-500)}.focus\\:ring-red-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity))}.focus\\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\\:ring-blue-400:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(96 165 250 / var(--tw-ring-opacity))}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\\:opacity-100{opacity:1}.peer:checked~.peer-checked\\:translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\\:bg-primary-600{background-color:var(--primary-600)}.peer:focus~.peer-focus\\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:disabled~.peer-disabled\\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\\:opacity-50{opacity:.5}:is(.dark .dark\\:divide-gray-800)>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 41 55 / var(--tw-divide-opacity))}:is(.dark .dark\\:border-blue-700){--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-600){--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-700){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-700\\/60){border-color:#37415199}:is(.dark .dark\\:border-gray-800){--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity))}:is(.dark .dark\\:border-green-700){--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity))}:is(.dark .dark\\:border-purple-700){--tw-border-opacity: 1;border-color:rgb(126 34 206 / var(--tw-border-opacity))}:is(.dark .dark\\:border-red-700){--tw-border-opacity: 1;border-color:rgb(185 28 28 / var(--tw-border-opacity))}:is(.dark .dark\\:border-teal-700){--tw-border-opacity: 1;border-color:rgb(15 118 110 / var(--tw-border-opacity))}:is(.dark .dark\\:border-yellow-700){--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity))}:is(.dark .dark\\:bg-black){--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}:is(.dark .dark\\:bg-black\\/80){background-color:#000c}:is(.dark .dark\\:bg-blue-900\\/20){background-color:#1e3a8a33}:is(.dark .dark\\:bg-blue-900\\/30){background-color:#1e3a8a4d}:is(.dark .dark\\:bg-gray-600){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-700){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-800){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-800\\/80){background-color:#1f2937cc}:is(.dark .dark\\:bg-gray-900){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-900\\/30){background-color:#1118274d}:is(.dark .dark\\:bg-green-900\\/30){background-color:#14532d4d}:is(.dark .dark\\:bg-purple-900\\/30){background-color:#581c874d}:is(.dark .dark\\:bg-red-900\\/30){background-color:#7f1d1d4d}:is(.dark .dark\\:bg-teal-900\\/30){background-color:#134e4a4d}:is(.dark .dark\\:bg-yellow-900\\/30){background-color:#713f124d}:is(.dark .dark\\:text-blue-300){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity))}:is(.dark .dark\\:text-blue-400){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-100){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-200){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-300){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-400){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-500){--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}:is(.dark .dark\\:text-green-300){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity))}:is(.dark .dark\\:text-purple-300){--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity))}:is(.dark .dark\\:text-red-300){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}:is(.dark .dark\\:text-red-500){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}:is(.dark .dark\\:text-teal-300){--tw-text-opacity: 1;color:rgb(94 234 212 / var(--tw-text-opacity))}:is(.dark .dark\\:text-white){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}:is(.dark .dark\\:text-yellow-300){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity))}:is(.dark .dark\\:placeholder-gray-400)::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}:is(.dark .dark\\:placeholder-gray-400)::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity))}:is(.dark .dark\\:hover\\:bg-gray-600:hover){--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity))}:is(.dark .dark\\:hover\\:bg-gray-700:hover){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}:is(.dark .dark\\:hover\\:bg-gray-800:hover){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}:is(.dark .dark\\:hover\\:text-gray-200:hover){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}:is(.dark .dark\\:hover\\:text-gray-300:hover){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity))}:is(.dark .dark\\:focus\\:ring-blue-200:focus){--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity))}:is(.dark .dark\\:focus\\:ring-blue-400:focus){--tw-ring-opacity: 1;--tw-ring-color: rgb(96 165 250 / var(--tw-ring-opacity))}:is(.dark .dark\\:focus\\:ring-gray-500:focus){--tw-ring-opacity: 1;--tw-ring-color: rgb(107 114 128 / var(--tw-ring-opacity))}:is(.dark .dark\\:focus\\:ring-gray-600:focus){--tw-ring-opacity: 1;--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity))}:is(.dark .dark\\:focus\\:ring-offset-gray-800:focus){--tw-ring-offset-color: #1f2937}@media (min-width: 640px){.sm\\:\\!w-auto{width:auto!important}.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\\:\\!flex-row{flex-direction:row!important}.sm\\:\\!flex-wrap{flex-wrap:wrap!important}.sm\\:\\!items-center{align-items:center!important}.sm\\:\\!px-6{padding-left:1.5rem!important;padding-right:1.5rem!important}.sm\\:opacity-0{opacity:0}.group:hover .sm\\:group-hover\\:opacity-100{opacity:1}}@media (min-width: 1024px){.lg\\:\\!w-auto{width:auto!important}.lg\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\\:\\!flex-row{flex-direction:row!important}.lg\\:\\!items-end{align-items:flex-end!important}.lg\\:\\!justify-between{justify-content:space-between!important}}.\\[\\&\\>svg\\]\\:h-3\\.5>svg{height:.875rem}.\\[\\&\\>svg\\]\\:h-4>svg{height:1rem}.\\[\\&\\>svg\\]\\:w-3\\.5>svg{width:.875rem}.\\[\\&\\>svg\\]\\:w-4>svg{width:1rem}',et=(a,o="DD MMM YYYY")=>{if(!a)return"N/A";const e=new Date(a);if(isNaN(e.getTime()))return"Invalid Date";const r=s=>String(s).padStart(2,"0"),n={YYYY:e.getFullYear(),YY:String(e.getFullYear()).slice(-2),MMMM:e.toLocaleString("en-US",{month:"long"}),MMM:e.toLocaleString("en-US",{month:"short"}),MM:r(e.getMonth()+1),M:e.getMonth()+1,DD:r(e.getDate()),D:e.getDate(),dddd:e.toLocaleString("en-US",{weekday:"long"}),ddd:e.toLocaleString("en-US",{weekday:"short"}),HH:r(e.getHours()),hh:r(e.getHours()%12||12),mm:r(e.getMinutes()),ss:r(e.getSeconds()),A:e.getHours()>=12?"PM":"AM"};return o.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,s=>String(n[s]))},Vt=(a,o,e=[])=>{if(!(o!=null&&o.trim()))return a;const r=o.toLowerCase(),n=s=>s==null?[]:typeof s=="object"?Object.values(s).flatMap(n):[String(s)];return a.filter(s=>{let i=[];return e.length>0?e.forEach(c=>{s[c]!==void 0&&i.push(...n(s[c]))}):i=n(s),i.some(c=>c.toLowerCase().includes(r))})},v=(...a)=>a.filter(Boolean).join(" "),f={crudPage:{root:"crud_page",deleteContent:"crud_page_delete_content"},button:{root:"crud_button"},chip:{root:"crud_chip"},modal:{root:"crud_modal",overlay:"crud_modal_overlay",container:"crud_modal_container",header:"crud_modal_header",title:"crud_modal_title",closeButton:"crud_modal_close_button",body:"crud_modal_body",footer:"crud_modal_footer",actionButton:"crud_modal_action_button",loadingIndicator:"crud_modal_loading_indicator"},table:{root:"crud_table",toolbar:"crud_table_toolbar",searchField:"crud_table_search_field",searchInput:"crud_table_search_input",container:"crud_table_container",element:"crud_table_element",head:"crud_table_head",headRow:"crud_table_head_row",headCell:"crud_table_head_cell",body:"crud_table_body",row:"crud_table_row",cell:"crud_table_cell",noData:"crud_table_no_data",actionButton:"crud_table_action_button",menu:"crud_table_menu",menuItem:"crud_table_menu_item",pagination:"crud_table_pagination"},tableSkeleton:{root:"crud_table_skeleton",table:"crud_table_skeleton_table"},sortDropdown:{root:"crud_sort_dropdown",trigger:"crud_sort_dropdown_trigger",menu:"crud_sort_dropdown_menu",item:"crud_sort_dropdown_item"},imagePreview:{root:"crud_image_preview",container:"crud_image_preview_container",image:"crud_image_preview_image"},filterDrawer:{overlay:"crud_filter_overlay",panel:"crud_filter_panel",header:"crud_filter_header",body:"crud_filter_body",footer:"crud_filter_footer"},form:{root:"crud_form",loading:"crud_form_loading"},field:{wrapper:"crud_field_wrapper",label:"crud_field_label",input:"crud_field_input",error:"crud_field_error"},mediaPicker:{image:"crud_media_image_picker",multiImage:"crud_media_multi_image_picker",audio:"crud_media_audio_picker",video:"crud_media_video_picker",dropzone:"crud_media_dropzone",cropModal:"crud_media_crop_modal"},details:{root:"crud_details",container:"crud_details_container",row:"crud_details_row"}},he=g.forwardRef(({className:a="",variant:o="contained",color:e="default",size:r="default",fullWidth:n=!1,children:s,...i},c)=>{var m;const b="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",p={sm:"h-8 px-3 rounded-md text-sm",md:"h-9 px-4 rounded-md text-sm",lg:"h-11 px-6 rounded-md text-base",xl:"h-12 px-8 rounded-lg text-lg",default:"h-9 px-4 rounded-md text-sm"},h={primary:{contained:"bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",outlined:"border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",text:"bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500"},success:{contained:"bg-green-600 text-white hover:bg-green-700 focus:ring-green-500 shadow-sm",outlined:"border border-green-600 bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500",text:"bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500"},error:{contained:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500 shadow-sm",outlined:"border border-red-600 bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500",text:"bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500"},default:{contained:"border bg-gray-200 text-gray-800 hover:bg-gray-300 focus:ring-gray-300 shadow-sm dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600 dark:focus:ring-gray-600",outlined:"border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",text:"bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"}},u=((m=h[e])==null?void 0:m[o])||h.default.contained,l=p[r]||p.default,w=v(f.button.root,b,u,l,n?"w-full":"",a);return t.jsx("button",{ref:c,type:i.type||"button",className:w,...i,children:s})});he.displayName="Button";function be({label:a,required:o=!1,infoText:e=""}){return t.jsx(t.Fragment,{children:t.jsxs("label",{className:v(f.field.label,"flex text-sm font-medium text-gray-700 dark:text-gray-300 mb-1"),children:[a,o&&t.jsx("span",{className:"ml-1",children:"*"}),e&&t.jsxs("span",{className:"ml-2 relative group inline-flex items-center cursor-pointer",children:[t.jsx(J.Info,{className:"w-4 h-4 text-gray-500 dark:text-gray-400"}),t.jsx("span",{className:`absolute left-1/2 top-full mt-2\r
8
2
  w-max max-w-xs bg-white text-black dark:bg-black dark:text-white text-xs\r
9
3
  rounded px-2 py-1 opacity-0 shadow-lg\r
10
4
  group-hover:opacity-100 transition-opacity\r
11
- duration-200 pointer-events-none z-50`,children:e})]})]})})}const zt=({options:n=[],value:a="",defaultValue:e="",onChange:r,placeholder:o="Select option",className:i="",disabled:s=!1,search:c=!1,label:f="",required:d=!1,name:p="",parentClass:h="",multiple:l=!1,dropdownMaxHeight:m="",formData:g={},dependencyKey:j=""})=>{var B;const[v,R]=b.useState(!1),[A,L]=b.useState(""),[C,I]=b.useState(!0),E=b.useRef(null),x=b.useRef(null),[w,S]=b.useState([]),D=a||a===!1?a:e,P=M=>M==null||M===""?"":String(typeof M=="boolean"?M:M??"");b.useEffect(()=>{(async()=>{if(typeof n=="function"){const k=await n(g);S(k||[])}else S(n||[])})()},j?[n,g==null?void 0:g[j]]:[n]);const Y=l?(D||[]).map(P):P(D),ee=w.filter(M=>M.label.toLowerCase().includes(A.toLowerCase())),G=M=>{const k=P(M);return l?Y.includes(k):k===Y};b.useEffect(()=>{const M=k=>{E.current&&!E.current.contains(k.target)&&(R(!1),L(""))};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]),b.useEffect(()=>{if(v&&E.current){const M=E.current.getBoundingClientRect(),z=window.innerHeight-M.bottom;I(z<200)}},[v]),b.useEffect(()=>{v&&x.current&&x.current.focus()},[v]);const N=M=>{let k=M;if(M==="true"?k=!0:M==="false"&&(k=!1),l){const z=Y.includes(P(M));let H;z?H=(Array.isArray(a)?a:[]).filter(F=>P(F)!==P(M)):H=[...Array.isArray(a)?a:[],k],r==null||r(H)}else r==null||r(k),R(!1);L("")},X=l?w.filter(M=>G(M.value)).map(M=>M.label).join(", "):(B=w.find(M=>G(M.value)))==null?void 0:B.label;return b.useEffect(()=>{(D||D===!1)&&setTimeout(()=>{r==null||r(D)},100)},[]),t.jsxs("div",{className:h||"col-span-12",children:[t.jsx(Q,{label:f,required:d}),t.jsxs("div",{className:`relative ${i}`,ref:E,children:[t.jsx("select",{name:"hidden_select_for_validation",value:X||"",required:d,multiple:l,className:"absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",onChange:()=>{},children:t.jsx("option",{hidden:!0,value:X,children:X})}),t.jsxs("button",{type:"button",onClick:()=>!s&&R(!v),disabled:s,className:`w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
12
- ${X?"dark:text-white":"text-gray-500 dark:text-gray-400"}
13
- ${s?"opacity-50 cursor-not-allowed":"dark:bg-gray-700"}`,children:[t.jsx("span",{className:"truncate",children:X||o}),t.jsx(U.ChevronDown,{className:`w-4 h-4 transition-transform ${v?"rotate-180":""}`})]}),v&&t.jsxs("div",{className:`absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
14
- ${C?"bottom-full mb-1":"top-full mt-1"}`,children:[c&&t.jsx("div",{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:t.jsxs("div",{className:"relative",children:[t.jsx(U.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx("input",{ref:x,type:"text",value:A,onChange:M=>L(M.target.value),placeholder:"Search...",className:"w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"})]})}),t.jsx("div",{className:"max-h-40 overflow-y-auto",style:{maxHeight:m||""},children:ee.length>0?ee.map(M=>t.jsxs("button",{type:"button",onClick:()=>N(String(M.value)),className:`w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
15
- ${G(M.value)?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":""}`,children:[t.jsx("span",{children:M.label}),l&&G(M.value)&&t.jsx(U.Check,{className:"w-4 h-4"})]},String(M.value))):t.jsx("div",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:"No options found"})})]})]})]},p)},mt=b.forwardRef(({label:n,required:a,parentClass:e="col-span-12",className:r="",value:o=!1,onChange:i,disabled:s=!1,...c},f)=>t.jsxs("div",{className:`flex justify-between ${e}`,children:[n&&t.jsx(Q,{label:n,required:a}),t.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",ref:f,className:"sr-only peer",checked:o,onChange:d=>i==null?void 0:i(d.target.checked),disabled:s,...c}),t.jsx("div",{className:`
5
+ duration-200 pointer-events-none z-50`,children:e})]})]})})}const Ie=[{label:"Afghanistan",code:"AF",phone:"93"},{label:"Aland Islands",code:"AX",phone:"358"},{label:"Albania",code:"AL",phone:"355"},{label:"Algeria",code:"DZ",phone:"213"},{label:"American Samoa",code:"AS",phone:"1"},{label:"Andorra",code:"AD",phone:"376"},{label:"Angola",code:"AO",phone:"244"},{label:"Anguilla",code:"AI",phone:"1"},{label:"Antarctica",code:"AQ",phone:"672"},{label:"Antigua and Barbuda",code:"AG",phone:"1"},{label:"Argentina",code:"AR",phone:"54"},{label:"Armenia",code:"AM",phone:"374"},{label:"Aruba",code:"AW",phone:"297"},{label:"Australia",code:"AU",phone:"61"},{label:"Austria",code:"AT",phone:"43"},{label:"Azerbaijan",code:"AZ",phone:"994"},{label:"Bahrain",code:"BH",phone:"973"},{label:"Bangladesh",code:"BD",phone:"880"},{label:"Barbados",code:"BB",phone:"1"},{label:"Belarus",code:"BY",phone:"375"},{label:"Belgium",code:"BE",phone:"32"},{label:"Belize",code:"BZ",phone:"501"},{label:"Benin",code:"BJ",phone:"229"},{label:"Bermuda",code:"BM",phone:"1"},{label:"Bhutan",code:"BT",phone:"975"},{label:"Bolivia",code:"BO",phone:"591"},{label:"Bonaire, Sint Eustatius and Saba",code:"BQ",phone:"599"},{label:"Bosnia and Herzegovina",code:"BA",phone:"387"},{label:"Botswana",code:"BW",phone:"267"},{label:"Bouvet Island",code:"BV",phone:"0055"},{label:"Brazil",code:"BR",phone:"55"},{label:"British Indian Ocean Territory",code:"IO",phone:"246"},{label:"Brunei",code:"BN",phone:"673"},{label:"Bulgaria",code:"BG",phone:"359"},{label:"Burkina Faso",code:"BF",phone:"226"},{label:"Burundi",code:"BI",phone:"257"},{label:"Cambodia",code:"KH",phone:"855"},{label:"Cameroon",code:"CM",phone:"237"},{label:"Canada",code:"CA",phone:"1"},{label:"Cape Verde",code:"CV",phone:"238"},{label:"Cayman Islands",code:"KY",phone:"1"},{label:"Central African Republic",code:"CF",phone:"236"},{label:"Chad",code:"TD",phone:"235"},{label:"Chile",code:"CL",phone:"56"},{label:"China",code:"CN",phone:"86"},{label:"Christmas Island",code:"CX",phone:"61"},{label:"Cocos (Keeling) Islands",code:"CC",phone:"61"},{label:"Colombia",code:"CO",phone:"57"},{label:"Comoros",code:"KM",phone:"269"},{label:"Congo",code:"CG",phone:"242"},{label:"Cook Islands",code:"CK",phone:"682"},{label:"Costa Rica",code:"CR",phone:"506"},{label:"Croatia",code:"HR",phone:"385"},{label:"Cuba",code:"CU",phone:"53"},{label:"Curaçao",code:"CW",phone:"599"},{label:"Cyprus",code:"CY",phone:"357"},{label:"Czech Republic",code:"CZ",phone:"420"},{label:"Democratic Republic of the Congo",code:"CD",phone:"243"},{label:"Denmark",code:"DK",phone:"45"},{label:"Djibouti",code:"DJ",phone:"253"},{label:"Dominica",code:"DM",phone:"1"},{label:"Dominican Republic",code:"DO",phone:"1"},{label:"Ecuador",code:"EC",phone:"593"},{label:"Egypt",code:"EG",phone:"20"},{label:"El Salvador",code:"SV",phone:"503"},{label:"Equatorial Guinea",code:"GQ",phone:"240"},{label:"Eritrea",code:"ER",phone:"291"},{label:"Estonia",code:"EE",phone:"372"},{label:"Eswatini",code:"SZ",phone:"268"},{label:"Ethiopia",code:"ET",phone:"251"},{label:"Falkland Islands",code:"FK",phone:"500"},{label:"Faroe Islands",code:"FO",phone:"298"},{label:"Fiji Islands",code:"FJ",phone:"679"},{label:"Finland",code:"FI",phone:"358"},{label:"France",code:"FR",phone:"33"},{label:"French Guiana",code:"GF",phone:"594"},{label:"French Polynesia",code:"PF",phone:"689"},{label:"French Southern Territories",code:"TF",phone:"262"},{label:"Gabon",code:"GA",phone:"241"},{label:"Georgia",code:"GE",phone:"995"},{label:"Germany",code:"DE",phone:"49"},{label:"Ghana",code:"GH",phone:"233"},{label:"Gibraltar",code:"GI",phone:"350"},{label:"Greece",code:"GR",phone:"30"},{label:"Greenland",code:"GL",phone:"299"},{label:"Grenada",code:"GD",phone:"1"},{label:"Guadeloupe",code:"GP",phone:"590"},{label:"Guam",code:"GU",phone:"1"},{label:"Guatemala",code:"GT",phone:"502"},{label:"Guernsey",code:"GG",phone:"44"},{label:"Guinea",code:"GN",phone:"224"},{label:"Guinea-Bissau",code:"GW",phone:"245"},{label:"Guyana",code:"GY",phone:"592"},{label:"Haiti",code:"HT",phone:"509"},{label:"Heard Island and McDonald Islands",code:"HM",phone:"672"},{label:"Honduras",code:"HN",phone:"504"},{label:"Hong Kong S.A.R.",code:"HK",phone:"852"},{label:"Hungary",code:"HU",phone:"36"},{label:"Iceland",code:"IS",phone:"354"},{label:"India",code:"IN",phone:"91"},{label:"Indonesia",code:"ID",phone:"62"},{label:"Iran",code:"IR",phone:"98"},{label:"Iraq",code:"IQ",phone:"964"},{label:"Ireland",code:"IE",phone:"353"},{label:"Israel",code:"IL",phone:"972"},{label:"Italy",code:"IT",phone:"39"},{label:"Ivory Coast",code:"CI",phone:"225"},{label:"Jamaica",code:"JM",phone:"1"},{label:"Japan",code:"JP",phone:"81"},{label:"Jersey",code:"JE",phone:"44"},{label:"Jordan",code:"JO",phone:"962"},{label:"Kazakhstan",code:"KZ",phone:"7"},{label:"Kenya",code:"KE",phone:"254"},{label:"Kiribati",code:"KI",phone:"686"},{label:"Kosovo",code:"XK",phone:"383"},{label:"Kuwait",code:"KW",phone:"965"},{label:"Kyrgyzstan",code:"KG",phone:"996"},{label:"Laos",code:"LA",phone:"856"},{label:"Latvia",code:"LV",phone:"371"},{label:"Lebanon",code:"LB",phone:"961"},{label:"Lesotho",code:"LS",phone:"266"},{label:"Liberia",code:"LR",phone:"231"},{label:"Libya",code:"LY",phone:"218"},{label:"Liechtenstein",code:"LI",phone:"423"},{label:"Lithuania",code:"LT",phone:"370"},{label:"Luxembourg",code:"LU",phone:"352"},{label:"Macau S.A.R.",code:"MO",phone:"853"},{label:"Madagascar",code:"MG",phone:"261"},{label:"Malawi",code:"MW",phone:"265"},{label:"Malaysia",code:"MY",phone:"60"},{label:"Maldives",code:"MV",phone:"960"},{label:"Mali",code:"ML",phone:"223"},{label:"Malta",code:"MT",phone:"356"},{label:"Man (Isle of)",code:"IM",phone:"44"},{label:"Marshall Islands",code:"MH",phone:"692"},{label:"Martinique",code:"MQ",phone:"596"},{label:"Mauritania",code:"MR",phone:"222"},{label:"Mauritius",code:"MU",phone:"230"},{label:"Mayotte",code:"YT",phone:"262"},{label:"Mexico",code:"MX",phone:"52"},{label:"Micronesia",code:"FM",phone:"691"},{label:"Moldova",code:"MD",phone:"373"},{label:"Monaco",code:"MC",phone:"377"},{label:"Mongolia",code:"MN",phone:"976"},{label:"Montenegro",code:"ME",phone:"382"},{label:"Montserrat",code:"MS",phone:"1"},{label:"Morocco",code:"MA",phone:"212"},{label:"Mozambique",code:"MZ",phone:"258"},{label:"Myanmar",code:"MM",phone:"95"},{label:"Namibia",code:"NA",phone:"264"},{label:"Nauru",code:"NR",phone:"674"},{label:"Nepal",code:"NP",phone:"977"},{label:"Netherlands",code:"NL",phone:"31"},{label:"New Caledonia",code:"NC",phone:"687"},{label:"New Zealand",code:"NZ",phone:"64"},{label:"Nicaragua",code:"NI",phone:"505"},{label:"Niger",code:"NE",phone:"227"},{label:"Nigeria",code:"NG",phone:"234"},{label:"Niue",code:"NU",phone:"683"},{label:"Norfolk Island",code:"NF",phone:"672"},{label:"North Korea",code:"KP",phone:"850"},{label:"North Macedonia",code:"MK",phone:"389"},{label:"Northern Mariana Islands",code:"MP",phone:"1"},{label:"Norway",code:"NO",phone:"47"},{label:"Oman",code:"OM",phone:"968"},{label:"Pakistan",code:"PK",phone:"92"},{label:"Palau",code:"PW",phone:"680"},{label:"Palestinian Territory Occupied",code:"PS",phone:"970"},{label:"Panama",code:"PA",phone:"507"},{label:"Papua New Guinea",code:"PG",phone:"675"},{label:"Paraguay",code:"PY",phone:"595"},{label:"Peru",code:"PE",phone:"51"},{label:"Philippines",code:"PH",phone:"63"},{label:"Pitcairn Island",code:"PN",phone:"870"},{label:"Poland",code:"PL",phone:"48"},{label:"Portugal",code:"PT",phone:"351"},{label:"Puerto Rico",code:"PR",phone:"1"},{label:"Qatar",code:"QA",phone:"974"},{label:"Reunion",code:"RE",phone:"262"},{label:"Romania",code:"RO",phone:"40"},{label:"Russia",code:"RU",phone:"7"},{label:"Rwanda",code:"RW",phone:"250"},{label:"Saint Helena",code:"SH",phone:"290"},{label:"Saint Kitts and Nevis",code:"KN",phone:"1"},{label:"Saint Lucia",code:"LC",phone:"1"},{label:"Saint Pierre and Miquelon",code:"PM",phone:"508"},{label:"Saint Vincent and the Grenadines",code:"VC",phone:"1"},{label:"Saint-Barthelemy",code:"BL",phone:"590"},{label:"Saint-Martin (French part)",code:"MF",phone:"590"},{label:"Samoa",code:"WS",phone:"685"},{label:"San Marino",code:"SM",phone:"378"},{label:"Sao Tome and Principe",code:"ST",phone:"239"},{label:"Saudi Arabia",code:"SA",phone:"966"},{label:"Senegal",code:"SN",phone:"221"},{label:"Serbia",code:"RS",phone:"381"},{label:"Seychelles",code:"SC",phone:"248"},{label:"Sierra Leone",code:"SL",phone:"232"},{label:"Singapore",code:"SG",phone:"65"},{label:"Sint Maarten (Dutch part)",code:"SX",phone:"1721"},{label:"Slovakia",code:"SK",phone:"421"},{label:"Slovenia",code:"SI",phone:"386"},{label:"Solomon Islands",code:"SB",phone:"677"},{label:"Somalia",code:"SO",phone:"252"},{label:"South Africa",code:"ZA",phone:"27"},{label:"South Georgia",code:"GS",phone:"500"},{label:"South Korea",code:"KR",phone:"82"},{label:"South Sudan",code:"SS",phone:"211"},{label:"Spain",code:"ES",phone:"34"},{label:"Sri Lanka",code:"LK",phone:"94"},{label:"Sudan",code:"SD",phone:"249"},{label:"Suriname",code:"SR",phone:"597"},{label:"Svalbard and Jan Mayen Islands",code:"SJ",phone:"47"},{label:"Sweden",code:"SE",phone:"46"},{label:"Switzerland",code:"CH",phone:"41"},{label:"Syria",code:"SY",phone:"963"},{label:"Taiwan",code:"TW",phone:"886"},{label:"Tajikistan",code:"TJ",phone:"992"},{label:"Tanzania",code:"TZ",phone:"255"},{label:"Thailand",code:"TH",phone:"66"},{label:"The Bahamas",code:"BS",phone:"1"},{label:"The Gambia",code:"GM",phone:"220"},{label:"Timor-Leste",code:"TL",phone:"670"},{label:"Togo",code:"TG",phone:"228"},{label:"Tokelau",code:"TK",phone:"690"},{label:"Tonga",code:"TO",phone:"676"},{label:"Trinidad and Tobago",code:"TT",phone:"1"},{label:"Tunisia",code:"TN",phone:"216"},{label:"Turkey",code:"TR",phone:"90"},{label:"Turkmenistan",code:"TM",phone:"993"},{label:"Turks and Caicos Islands",code:"TC",phone:"1"},{label:"Tuvalu",code:"TV",phone:"688"},{label:"Uganda",code:"UG",phone:"256"},{label:"Ukraine",code:"UA",phone:"380"},{label:"United Arab Emirates",code:"AE",phone:"971"},{label:"United Kingdom",code:"GB",phone:"44"},{label:"United States",code:"US",phone:"1"},{label:"United States Minor Outlying Islands",code:"UM",phone:"1"},{label:"Uruguay",code:"UY",phone:"598"},{label:"Uzbekistan",code:"UZ",phone:"998"},{label:"Vanuatu",code:"VU",phone:"678"},{label:"Vatican City State (Holy See)",code:"VA",phone:"379"},{label:"Venezuela",code:"VE",phone:"58"},{label:"Vietnam",code:"VN",phone:"84"},{label:"Virgin Islands (British)",code:"VG",phone:"1"},{label:"Virgin Islands (US)",code:"VI",phone:"1"},{label:"Wallis and Futuna Islands",code:"WF",phone:"681"},{label:"Western Sahara",code:"EH",phone:"212"},{label:"Yemen",code:"YE",phone:"967"},{label:"Zambia",code:"ZM",phone:"260"},{label:"Zimbabwe",code:"ZW",phone:"263"}],Xt=({options:a=[],value:o="",defaultValue:e="",onChange:r,placeholder:n="Select option",className:s="",disabled:i=!1,search:c=!1,label:b="",required:p=!1,name:h="",parentClass:u="",multiple:l=!1,dropdownMaxHeight:w="",formData:m={},countriesList:x=!1,dependencyKey:N="",errorMessage:k=""})=>{var D;const[S,L]=g.useState(!1),[z,F]=g.useState(""),[P,U]=g.useState(!0),y=g.useRef(null),_=g.useRef(null),[C,A]=g.useState([]),B=o||o===!1?o:e,G=R=>R==null||R===""?"":String(typeof R=="boolean"?R:R??""),ee=()=>Ie.map(Y=>({value:Y.code,label:Y.label,code:Y.code}));g.useEffect(()=>{(async()=>{if(x==!0)A(ee());else if(typeof a=="function"){const Y=await a(m);A(Y||[])}else A(a||[])})()},N?[a,m==null?void 0:m[N]]:[a]);const te=l?(B||[]).map(G):G(B),E=C.filter(R=>R.label.toLowerCase().includes(z.toLowerCase())),se=R=>{const Y=G(R);return l?te.includes(Y):Y===te};g.useEffect(()=>{const R=Y=>{y.current&&!y.current.contains(Y.target)&&(L(!1),F(""))};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]),g.useEffect(()=>{if(S&&y.current){const R=y.current.getBoundingClientRect(),I=window.innerHeight-R.bottom;U(I<200)}},[S]),g.useEffect(()=>{S&&_.current&&_.current.focus()},[S]);const H=R=>{let Y=R;if(R==="true"?Y=!0:R==="false"&&(Y=!1),l){const I=te.includes(G(R));let le;I?le=(Array.isArray(o)?o:[]).filter(me=>G(me)!==G(R)):le=[...Array.isArray(o)?o:[],Y],r==null||r(le)}else r==null||r(Y),L(!1);F("")},Q=l?C.filter(R=>se(R.value)).map(R=>R.label).join(", "):(D=C.find(R=>se(R.value)))==null?void 0:D.label;return g.useEffect(()=>{(B||B===!1)&&setTimeout(()=>{r==null||r(B)},100)},[]),t.jsxs("div",{className:v(f.field.wrapper,u||"col-span-12"),children:[t.jsx(be,{label:b,required:p}),t.jsxs("div",{className:v(f.field.input,"relative",s),ref:y,children:[t.jsx("select",{name:"hidden_select_for_validation",value:Q||"",required:p,multiple:l,id:`field-${h}`,className:"absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",onChange:()=>{},children:t.jsx("option",{hidden:!0,value:Q,children:Q})}),t.jsxs("button",{type:"button",onClick:()=>!i&&L(!S),disabled:i,className:`w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
6
+ ${Q?"dark:text-white":"text-gray-500 dark:text-gray-400"}
7
+ ${i?"opacity-50 cursor-not-allowed":"dark:bg-gray-700"}
8
+ ${k?"border-red-500":""}`,children:[t.jsx("span",{className:"truncate",children:Q||n}),t.jsx(J.ChevronDown,{className:`w-4 h-4 transition-transform ${S?"rotate-180":""}`})]}),S&&t.jsxs("div",{className:`absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
9
+ ${P?"bottom-full mb-1":"top-full mt-1"}`,children:[c&&t.jsx("div",{className:"p-2 border-b border-gray-200 dark:border-gray-600",children:t.jsxs("div",{className:"relative",children:[t.jsx(J.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx("input",{ref:_,type:"text",value:z,onChange:R=>F(R.target.value),placeholder:"Search...",className:"w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"})]})}),t.jsx("div",{className:"max-h-40 overflow-y-auto",style:{maxHeight:w||""},children:E.length>0?E.map(R=>t.jsxs("button",{type:"button",onClick:()=>H(String(R.value)),className:`w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
10
+ ${se(R.value)?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":""}`,children:[t.jsxs("div",{className:"flex gap-2 items-center",children:[x&&(R==null?void 0:R.code)&&t.jsx("img",{src:`https://flagcdn.com/w20/${R==null?void 0:R.code.toLowerCase()}.png`,alt:R.code,className:"w-5 h-3 object-cover"}),t.jsx("span",{children:R.label})]}),l&&se(R.value)&&t.jsx(J.Check,{className:"w-4 h-4"})]},String(R.value))):t.jsx("div",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:"No options found"})})]})]}),k&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:k})]},h)},Rt=g.forwardRef(({label:a,required:o,parentClass:e="col-span-12",className:r="",value:n=!1,onChange:s,disabled:i=!1,errorMessage:c="",name:b,...p},h)=>t.jsxs("div",{className:v(f.field.wrapper,"flex justify-between",e),children:[a&&t.jsx(be,{label:a,required:o}),t.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",ref:h,id:`field-${b}`,className:v(f.field.input,"sr-only peer"),checked:n,onChange:u=>s==null?void 0:s(u.target.checked),disabled:i,...p}),t.jsx("div",{className:`
16
11
  w-11 h-6 bg-gray-200 peer-focus:outline-none
17
12
  rounded-full peer dark:bg-gray-700
18
13
  peer-checked:bg-primary-600
19
14
  peer-disabled:opacity-50 peer-disabled:cursor-not-allowed
20
15
  transition-colors duration-200
16
+ ${c?"border-red-500":""}
21
17
  ${r}
22
18
  `}),t.jsx("div",{className:`\r
23
19
  absolute left-1 top-1\r
24
20
  w-4 h-4 bg-white rounded-full\r
25
21
  transition-transform duration-200\r
26
22
  peer-checked:translate-x-5\r
27
- `})]})]}));mt.displayName="Switch";const Ie=[{label:"Afghanistan",code:"AF",phone:"93"},{label:"Aland Islands",code:"AX",phone:"358"},{label:"Albania",code:"AL",phone:"355"},{label:"Algeria",code:"DZ",phone:"213"},{label:"American Samoa",code:"AS",phone:"1"},{label:"Andorra",code:"AD",phone:"376"},{label:"Angola",code:"AO",phone:"244"},{label:"Anguilla",code:"AI",phone:"1"},{label:"Antarctica",code:"AQ",phone:"672"},{label:"Antigua and Barbuda",code:"AG",phone:"1"},{label:"Argentina",code:"AR",phone:"54"},{label:"Armenia",code:"AM",phone:"374"},{label:"Aruba",code:"AW",phone:"297"},{label:"Australia",code:"AU",phone:"61"},{label:"Austria",code:"AT",phone:"43"},{label:"Azerbaijan",code:"AZ",phone:"994"},{label:"Bahrain",code:"BH",phone:"973"},{label:"Bangladesh",code:"BD",phone:"880"},{label:"Barbados",code:"BB",phone:"1"},{label:"Belarus",code:"BY",phone:"375"},{label:"Belgium",code:"BE",phone:"32"},{label:"Belize",code:"BZ",phone:"501"},{label:"Benin",code:"BJ",phone:"229"},{label:"Bermuda",code:"BM",phone:"1"},{label:"Bhutan",code:"BT",phone:"975"},{label:"Bolivia",code:"BO",phone:"591"},{label:"Bonaire, Sint Eustatius and Saba",code:"BQ",phone:"599"},{label:"Bosnia and Herzegovina",code:"BA",phone:"387"},{label:"Botswana",code:"BW",phone:"267"},{label:"Bouvet Island",code:"BV",phone:"0055"},{label:"Brazil",code:"BR",phone:"55"},{label:"British Indian Ocean Territory",code:"IO",phone:"246"},{label:"Brunei",code:"BN",phone:"673"},{label:"Bulgaria",code:"BG",phone:"359"},{label:"Burkina Faso",code:"BF",phone:"226"},{label:"Burundi",code:"BI",phone:"257"},{label:"Cambodia",code:"KH",phone:"855"},{label:"Cameroon",code:"CM",phone:"237"},{label:"Canada",code:"CA",phone:"1"},{label:"Cape Verde",code:"CV",phone:"238"},{label:"Cayman Islands",code:"KY",phone:"1"},{label:"Central African Republic",code:"CF",phone:"236"},{label:"Chad",code:"TD",phone:"235"},{label:"Chile",code:"CL",phone:"56"},{label:"China",code:"CN",phone:"86"},{label:"Christmas Island",code:"CX",phone:"61"},{label:"Cocos (Keeling) Islands",code:"CC",phone:"61"},{label:"Colombia",code:"CO",phone:"57"},{label:"Comoros",code:"KM",phone:"269"},{label:"Congo",code:"CG",phone:"242"},{label:"Cook Islands",code:"CK",phone:"682"},{label:"Costa Rica",code:"CR",phone:"506"},{label:"Croatia",code:"HR",phone:"385"},{label:"Cuba",code:"CU",phone:"53"},{label:"Curaçao",code:"CW",phone:"599"},{label:"Cyprus",code:"CY",phone:"357"},{label:"Czech Republic",code:"CZ",phone:"420"},{label:"Democratic Republic of the Congo",code:"CD",phone:"243"},{label:"Denmark",code:"DK",phone:"45"},{label:"Djibouti",code:"DJ",phone:"253"},{label:"Dominica",code:"DM",phone:"1"},{label:"Dominican Republic",code:"DO",phone:"1"},{label:"Ecuador",code:"EC",phone:"593"},{label:"Egypt",code:"EG",phone:"20"},{label:"El Salvador",code:"SV",phone:"503"},{label:"Equatorial Guinea",code:"GQ",phone:"240"},{label:"Eritrea",code:"ER",phone:"291"},{label:"Estonia",code:"EE",phone:"372"},{label:"Eswatini",code:"SZ",phone:"268"},{label:"Ethiopia",code:"ET",phone:"251"},{label:"Falkland Islands",code:"FK",phone:"500"},{label:"Faroe Islands",code:"FO",phone:"298"},{label:"Fiji Islands",code:"FJ",phone:"679"},{label:"Finland",code:"FI",phone:"358"},{label:"France",code:"FR",phone:"33"},{label:"French Guiana",code:"GF",phone:"594"},{label:"French Polynesia",code:"PF",phone:"689"},{label:"French Southern Territories",code:"TF",phone:"262"},{label:"Gabon",code:"GA",phone:"241"},{label:"Georgia",code:"GE",phone:"995"},{label:"Germany",code:"DE",phone:"49"},{label:"Ghana",code:"GH",phone:"233"},{label:"Gibraltar",code:"GI",phone:"350"},{label:"Greece",code:"GR",phone:"30"},{label:"Greenland",code:"GL",phone:"299"},{label:"Grenada",code:"GD",phone:"1"},{label:"Guadeloupe",code:"GP",phone:"590"},{label:"Guam",code:"GU",phone:"1"},{label:"Guatemala",code:"GT",phone:"502"},{label:"Guernsey",code:"GG",phone:"44"},{label:"Guinea",code:"GN",phone:"224"},{label:"Guinea-Bissau",code:"GW",phone:"245"},{label:"Guyana",code:"GY",phone:"592"},{label:"Haiti",code:"HT",phone:"509"},{label:"Heard Island and McDonald Islands",code:"HM",phone:"672"},{label:"Honduras",code:"HN",phone:"504"},{label:"Hong Kong S.A.R.",code:"HK",phone:"852"},{label:"Hungary",code:"HU",phone:"36"},{label:"Iceland",code:"IS",phone:"354"},{label:"India",code:"IN",phone:"91"},{label:"Indonesia",code:"ID",phone:"62"},{label:"Iran",code:"IR",phone:"98"},{label:"Iraq",code:"IQ",phone:"964"},{label:"Ireland",code:"IE",phone:"353"},{label:"Israel",code:"IL",phone:"972"},{label:"Italy",code:"IT",phone:"39"},{label:"Ivory Coast",code:"CI",phone:"225"},{label:"Jamaica",code:"JM",phone:"1"},{label:"Japan",code:"JP",phone:"81"},{label:"Jersey",code:"JE",phone:"44"},{label:"Jordan",code:"JO",phone:"962"},{label:"Kazakhstan",code:"KZ",phone:"7"},{label:"Kenya",code:"KE",phone:"254"},{label:"Kiribati",code:"KI",phone:"686"},{label:"Kosovo",code:"XK",phone:"383"},{label:"Kuwait",code:"KW",phone:"965"},{label:"Kyrgyzstan",code:"KG",phone:"996"},{label:"Laos",code:"LA",phone:"856"},{label:"Latvia",code:"LV",phone:"371"},{label:"Lebanon",code:"LB",phone:"961"},{label:"Lesotho",code:"LS",phone:"266"},{label:"Liberia",code:"LR",phone:"231"},{label:"Libya",code:"LY",phone:"218"},{label:"Liechtenstein",code:"LI",phone:"423"},{label:"Lithuania",code:"LT",phone:"370"},{label:"Luxembourg",code:"LU",phone:"352"},{label:"Macau S.A.R.",code:"MO",phone:"853"},{label:"Madagascar",code:"MG",phone:"261"},{label:"Malawi",code:"MW",phone:"265"},{label:"Malaysia",code:"MY",phone:"60"},{label:"Maldives",code:"MV",phone:"960"},{label:"Mali",code:"ML",phone:"223"},{label:"Malta",code:"MT",phone:"356"},{label:"Man (Isle of)",code:"IM",phone:"44"},{label:"Marshall Islands",code:"MH",phone:"692"},{label:"Martinique",code:"MQ",phone:"596"},{label:"Mauritania",code:"MR",phone:"222"},{label:"Mauritius",code:"MU",phone:"230"},{label:"Mayotte",code:"YT",phone:"262"},{label:"Mexico",code:"MX",phone:"52"},{label:"Micronesia",code:"FM",phone:"691"},{label:"Moldova",code:"MD",phone:"373"},{label:"Monaco",code:"MC",phone:"377"},{label:"Mongolia",code:"MN",phone:"976"},{label:"Montenegro",code:"ME",phone:"382"},{label:"Montserrat",code:"MS",phone:"1"},{label:"Morocco",code:"MA",phone:"212"},{label:"Mozambique",code:"MZ",phone:"258"},{label:"Myanmar",code:"MM",phone:"95"},{label:"Namibia",code:"NA",phone:"264"},{label:"Nauru",code:"NR",phone:"674"},{label:"Nepal",code:"NP",phone:"977"},{label:"Netherlands",code:"NL",phone:"31"},{label:"New Caledonia",code:"NC",phone:"687"},{label:"New Zealand",code:"NZ",phone:"64"},{label:"Nicaragua",code:"NI",phone:"505"},{label:"Niger",code:"NE",phone:"227"},{label:"Nigeria",code:"NG",phone:"234"},{label:"Niue",code:"NU",phone:"683"},{label:"Norfolk Island",code:"NF",phone:"672"},{label:"North Korea",code:"KP",phone:"850"},{label:"North Macedonia",code:"MK",phone:"389"},{label:"Northern Mariana Islands",code:"MP",phone:"1"},{label:"Norway",code:"NO",phone:"47"},{label:"Oman",code:"OM",phone:"968"},{label:"Pakistan",code:"PK",phone:"92"},{label:"Palau",code:"PW",phone:"680"},{label:"Palestinian Territory Occupied",code:"PS",phone:"970"},{label:"Panama",code:"PA",phone:"507"},{label:"Papua New Guinea",code:"PG",phone:"675"},{label:"Paraguay",code:"PY",phone:"595"},{label:"Peru",code:"PE",phone:"51"},{label:"Philippines",code:"PH",phone:"63"},{label:"Pitcairn Island",code:"PN",phone:"870"},{label:"Poland",code:"PL",phone:"48"},{label:"Portugal",code:"PT",phone:"351"},{label:"Puerto Rico",code:"PR",phone:"1"},{label:"Qatar",code:"QA",phone:"974"},{label:"Reunion",code:"RE",phone:"262"},{label:"Romania",code:"RO",phone:"40"},{label:"Russia",code:"RU",phone:"7"},{label:"Rwanda",code:"RW",phone:"250"},{label:"Saint Helena",code:"SH",phone:"290"},{label:"Saint Kitts and Nevis",code:"KN",phone:"1"},{label:"Saint Lucia",code:"LC",phone:"1"},{label:"Saint Pierre and Miquelon",code:"PM",phone:"508"},{label:"Saint Vincent and the Grenadines",code:"VC",phone:"1"},{label:"Saint-Barthelemy",code:"BL",phone:"590"},{label:"Saint-Martin (French part)",code:"MF",phone:"590"},{label:"Samoa",code:"WS",phone:"685"},{label:"San Marino",code:"SM",phone:"378"},{label:"Sao Tome and Principe",code:"ST",phone:"239"},{label:"Saudi Arabia",code:"SA",phone:"966"},{label:"Senegal",code:"SN",phone:"221"},{label:"Serbia",code:"RS",phone:"381"},{label:"Seychelles",code:"SC",phone:"248"},{label:"Sierra Leone",code:"SL",phone:"232"},{label:"Singapore",code:"SG",phone:"65"},{label:"Sint Maarten (Dutch part)",code:"SX",phone:"1721"},{label:"Slovakia",code:"SK",phone:"421"},{label:"Slovenia",code:"SI",phone:"386"},{label:"Solomon Islands",code:"SB",phone:"677"},{label:"Somalia",code:"SO",phone:"252"},{label:"South Africa",code:"ZA",phone:"27"},{label:"South Georgia",code:"GS",phone:"500"},{label:"South Korea",code:"KR",phone:"82"},{label:"South Sudan",code:"SS",phone:"211"},{label:"Spain",code:"ES",phone:"34"},{label:"Sri Lanka",code:"LK",phone:"94"},{label:"Sudan",code:"SD",phone:"249"},{label:"Suriname",code:"SR",phone:"597"},{label:"Svalbard and Jan Mayen Islands",code:"SJ",phone:"47"},{label:"Sweden",code:"SE",phone:"46"},{label:"Switzerland",code:"CH",phone:"41"},{label:"Syria",code:"SY",phone:"963"},{label:"Taiwan",code:"TW",phone:"886"},{label:"Tajikistan",code:"TJ",phone:"992"},{label:"Tanzania",code:"TZ",phone:"255"},{label:"Thailand",code:"TH",phone:"66"},{label:"The Bahamas",code:"BS",phone:"1"},{label:"The Gambia",code:"GM",phone:"220"},{label:"Timor-Leste",code:"TL",phone:"670"},{label:"Togo",code:"TG",phone:"228"},{label:"Tokelau",code:"TK",phone:"690"},{label:"Tonga",code:"TO",phone:"676"},{label:"Trinidad and Tobago",code:"TT",phone:"1"},{label:"Tunisia",code:"TN",phone:"216"},{label:"Turkey",code:"TR",phone:"90"},{label:"Turkmenistan",code:"TM",phone:"993"},{label:"Turks and Caicos Islands",code:"TC",phone:"1"},{label:"Tuvalu",code:"TV",phone:"688"},{label:"Uganda",code:"UG",phone:"256"},{label:"Ukraine",code:"UA",phone:"380"},{label:"United Arab Emirates",code:"AE",phone:"971"},{label:"United Kingdom",code:"GB",phone:"44"},{label:"United States",code:"US",phone:"1"},{label:"United States Minor Outlying Islands",code:"UM",phone:"1"},{label:"Uruguay",code:"UY",phone:"598"},{label:"Uzbekistan",code:"UZ",phone:"998"},{label:"Vanuatu",code:"VU",phone:"678"},{label:"Vatican City State (Holy See)",code:"VA",phone:"379"},{label:"Venezuela",code:"VE",phone:"58"},{label:"Vietnam",code:"VN",phone:"84"},{label:"Virgin Islands (British)",code:"VG",phone:"1"},{label:"Virgin Islands (US)",code:"VI",phone:"1"},{label:"Wallis and Futuna Islands",code:"WF",phone:"681"},{label:"Western Sahara",code:"EH",phone:"212"},{label:"Yemen",code:"YE",phone:"967"},{label:"Zambia",code:"ZM",phone:"260"},{label:"Zimbabwe",code:"ZW",phone:"263"}];function Bt({label:n="",value:a="",name:e="",parentClass:r="",onChange:o,disabled:i=!1,required:s=!1,placeholder:c="Phone number",search:f=!1,countriesList:d=!1,defaultCountry:p=""}){const h=w=>Ie.find(S=>S.code==w),[l,m]=b.useState(h(p)||Ie[0]),[g,j]=b.useState(""),[v,R]=b.useState(!1),[A,L]=b.useState(""),C=b.useRef(null);b.useEffect(()=>{if(typeof a=="string"&&a.startsWith("+")){const w=Ie.filter(S=>a.startsWith("+"+S.phone)).sort((S,D)=>D.phone.length-S.phone.length)[0];if(w){m(w),j(a.replace("+"+w.phone,""));return}}j(a||"")},[a]);const I=w=>{const S=w.target.value.replace(/\D/g,"");j(S),l&&o&&o("+"+l.phone+S)},E=w=>{m(w),o&&o("+"+w.phone+g),R(!1),L("")};b.useEffect(()=>{const w=S=>{C.current&&!C.current.contains(S.target)&&R(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]);const x=Ie.filter(w=>w.label.toLowerCase().includes(A.toLowerCase())||w.phone.includes(A));if(!d){const w=S=>{const D=S.target.value.replace(/[^+\d]/g,""),P=D.startsWith("+")?"+"+D.replace(/[+]/g,"").slice(0):D;o==null||o(P)};return t.jsx(t.Fragment,{children:t.jsxs("div",{className:r||"col-span-12",children:[t.jsx(Q,{label:n,required:s}),t.jsx("input",{type:"text",value:a,onChange:w,placeholder:c,disabled:i,required:s,className:`w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
23
+ `})]}),c&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:c})]}));Rt.displayName="Switch";function qt({label:a="",value:o="",name:e="",parentClass:r="",onChange:n,disabled:s=!1,required:i=!1,placeholder:c="Phone number",search:b=!1,countriesList:p=!1,defaultCountry:h="",errorMessage:u=""}){const l=_=>Ie.find(C=>C.code==_),[w,m]=g.useState(l(h)||Ie[0]),[x,N]=g.useState(""),[k,S]=g.useState(!1),[L,z]=g.useState(""),F=g.useRef(null);g.useEffect(()=>{if(typeof o=="string"&&o.startsWith("+")){const _=Ie.filter(C=>o.startsWith("+"+C.phone)).sort((C,A)=>A.phone.length-C.phone.length)[0];if(_){m(_),N(o.replace("+"+_.phone,""));return}}N(o||"")},[o]);const P=_=>{const C=_.target.value.replace(/\D/g,"");N(C),w&&n&&n("+"+w.phone+C)},U=_=>{m(_),n&&n("+"+_.phone+x),S(!1),z("")};g.useEffect(()=>{const _=C=>{F.current&&!F.current.contains(C.target)&&S(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const y=Ie.filter(_=>_.label.toLowerCase().includes(L.toLowerCase())||_.phone.includes(L));if(!p){const _=C=>{const A=C.target.value.replace(/[^+\d]/g,""),B=A.startsWith("+")?"+"+A.replace(/[+]/g,"").slice(0):A;n==null||n(B)};return t.jsx(t.Fragment,{children:t.jsxs("div",{className:v(f.field.wrapper,r||"col-span-12"),children:[t.jsx(be,{label:a,required:i}),t.jsx("input",{type:"text",value:o,onChange:_,placeholder:c,disabled:s,required:i,className:`w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
28
24
  bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
29
- focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,inputMode:"tel",pattern:"^\\+\\d{1,15}$"})]},e)})}return t.jsx(t.Fragment,{children:t.jsxs("div",{className:r||"col-span-12",children:[t.jsx(Q,{label:n,required:s}),t.jsxs("div",{className:"relative ",ref:C,children:[t.jsxs("div",{className:`h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
30
- ${v?"ring-0.5 ring-blue-100 border-blue-300":"border-gray-300 dark:border-gray-600"}
31
- ${i?"opacity-60 cursor-not-allowed":""}`,children:[t.jsxs("button",{type:"button",disabled:i,onClick:()=>R(!v),className:"flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",children:[l?t.jsx("img",{src:`https://flagcdn.com/w20/${l.code.toLowerCase()}.png`,alt:l.code,className:"w-5 h-3 object-cover"}):t.jsx("span",{className:"text-gray-400 text-xs",children:"🌐"}),t.jsx(U.ChevronDown,{className:"w-3 h-3 text-gray-500"})]}),l&&t.jsxs("span",{className:"ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap",children:["+",l.phone]}),t.jsx("input",{type:"tel",value:g,onChange:I,required:s,disabled:i||!l,placeholder:l?c:"Select a country",className:"flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"}),t.jsx("input",{type:"tel",required:s,tabIndex:-1,readOnly:!0,value:l&&g?"+"+l.phone+g:"",style:{position:"absolute",opacity:0,pointerEvents:"none",height:0},onChange:()=>{}})]}),v&&t.jsxs("div",{className:"absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto",children:[f&&t.jsx("div",{className:"p-2 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"relative",children:[t.jsx(U.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx("input",{type:"text",value:A,onChange:w=>L(w.target.value),placeholder:"Search country...",className:"w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "})]})}),x.map(w=>t.jsxs("button",{type:"button",onClick:()=>E(w),className:"w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",children:[t.jsx("img",{src:`https://flagcdn.com/w20/${w.code.toLowerCase()}.png`,alt:w.code,className:"w-5 h-3 object-cover"}),t.jsxs("span",{children:[w.label," (+",w.phone,")"]})]},w.code))]})]})]},e)})}const xt=b.forwardRef(({className:n="",label:a,required:e,...r},o)=>{const i=`
32
- placeholder-gray-400 dark:placeholder-gray-400
33
- ${n}
34
- `.trim();return t.jsx(t.Fragment,{children:t.jsxs("div",{className:r.parentClass||"col-span-12",children:[t.jsx(Q,{label:a,required:e}),t.jsx("div",{className:"relative",children:t.jsx("textarea",{className:i,ref:o,required:e,...r})})]},r.name)})});xt.displayName="TextArea";var Ke=function(n,a){return Ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])},Ke(n,a)};function $t(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");Ke(n,a);function e(){this.constructor=n}n.prototype=a===null?Object.create(a):(e.prototype=a.prototype,new e)}var W=function(){return W=Object.assign||function(a){for(var e,r=1,o=arguments.length;r<o;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(a[i]=e[i])}return a},W.apply(this,arguments)};function Ut(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var tt=!1,he,We,He,ze,Be,yt,$e,Ze,Ye,Ve,vt,Xe,qe,wt,jt;function q(){if(!tt){tt=!0;var n=navigator.userAgent,a=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(n),e=/(Mac OS X)|(Windows)|(Linux)/.exec(n);if(Xe=/\b(iPhone|iP[ao]d)/.exec(n),qe=/\b(iP[ao]d)/.exec(n),Ve=/Android/i.exec(n),wt=/FBAN\/\w+;/i.exec(n),jt=/Mobile/i.exec(n),vt=!!/Win64/.exec(n),a){he=a[1]?parseFloat(a[1]):a[5]?parseFloat(a[5]):NaN,he&&document&&document.documentMode&&(he=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(n);yt=r?parseFloat(r[1])+4:he,We=a[2]?parseFloat(a[2]):NaN,He=a[3]?parseFloat(a[3]):NaN,ze=a[4]?parseFloat(a[4]):NaN,ze?(a=/(?:Chrome\/(\d+\.\d+))/.exec(n),Be=a&&a[1]?parseFloat(a[1]):NaN):Be=NaN}else he=We=He=Be=ze=NaN;if(e){if(e[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(n);$e=o?parseFloat(o[1].replace("_",".")):!0}else $e=!1;Ze=!!e[2],Ye=!!e[3]}else $e=Ze=Ye=!1}}var Je={ie:function(){return q()||he},ieCompatibilityMode:function(){return q()||yt>he},ie64:function(){return Je.ie()&&vt},firefox:function(){return q()||We},opera:function(){return q()||He},webkit:function(){return q()||ze},safari:function(){return Je.webkit()},chrome:function(){return q()||Be},windows:function(){return q()||Ze},osx:function(){return q()||$e},linux:function(){return q()||Ye},iphone:function(){return q()||Xe},mobile:function(){return q()||Xe||qe||Ve||jt},nativeApp:function(){return q()||wt},android:function(){return q()||Ve},ipad:function(){return q()||qe}},Gt=Je,Kt=!!(typeof window<"u"&&window.document&&window.document.createElement),Wt={canUseDOM:Kt},Ht=Wt,kt=Ht,St;kt.canUseDOM&&(St=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
25
+ focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,inputMode:"tel",pattern:"^\\+\\d{1,15}$"})]},e)})}return t.jsx(t.Fragment,{children:t.jsxs("div",{className:v(f.field.wrapper,r||"col-span-12"),children:[t.jsx(be,{label:a,required:i}),t.jsxs("div",{className:"relative ",ref:F,children:[t.jsxs("div",{className:`h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
26
+ ${k?"ring-0.5 ring-blue-100 border-blue-300":"border-gray-300 dark:border-gray-600"}
27
+ ${s?"opacity-60 cursor-not-allowed":""}
28
+ ${u?"border-red-500":""}`,children:[t.jsxs("button",{type:"button",disabled:s,onClick:()=>S(!k),className:"flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",children:[w?t.jsx("img",{src:`https://flagcdn.com/w20/${w.code.toLowerCase()}.png`,alt:w.code,className:"w-5 h-3 object-cover"}):t.jsx("span",{className:"text-gray-400 text-xs",children:"🌐"}),t.jsx(J.ChevronDown,{className:"w-3 h-3 text-gray-500"})]}),w&&t.jsxs("span",{className:"ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap",children:["+",w.phone]}),t.jsx("input",{type:"tel",value:x,onChange:P,required:i,id:`field-${e}`,disabled:s||!w,placeholder:w?c:"Select a country",className:"flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"}),t.jsx("input",{type:"tel",required:i,tabIndex:-1,readOnly:!0,value:w&&x?"+"+w.phone+x:"",style:{position:"absolute",opacity:0,pointerEvents:"none",height:0},onChange:()=>{}})]}),k&&t.jsxs("div",{className:"absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto",children:[b&&t.jsx("div",{className:"p-2 border-b border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"relative",children:[t.jsx(J.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx("input",{type:"text",value:L,onChange:_=>z(_.target.value),placeholder:"Search country...",className:"w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "})]})}),y.map(_=>t.jsxs("button",{type:"button",onClick:()=>U(_),className:"w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",children:[t.jsx("img",{src:`https://flagcdn.com/w20/${_.code.toLowerCase()}.png`,alt:_.code,className:"w-5 h-3 object-cover"}),t.jsxs("span",{children:[_.label," (+",_.phone,")"]})]},_.code))]})]}),u&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:u})]},e)})}const Ct=g.forwardRef(({className:a="",label:o,required:e,errorMessage:r="",name:n,...s},i)=>{const c=v(f.field.input,"placeholder-gray-400 dark:placeholder-gray-400",r?"border-red-500":"",a);return t.jsx(t.Fragment,{children:t.jsxs("div",{className:v(f.field.wrapper,s.parentClass||"col-span-12"),children:[t.jsx(be,{label:o,required:e}),t.jsxs("div",{className:"relative",children:[t.jsx("textarea",{className:c,ref:i,id:`field-${n}`,required:e,...s}),r&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:r})]})]},n)})});Ct.displayName="TextArea";var tt=function(a,o){return tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])},tt(a,o)};function Jt(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");tt(a,o);function e(){this.constructor=a}a.prototype=o===null?Object.create(o):(e.prototype=o.prototype,new e)}var ie=function(){return ie=Object.assign||function(o){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(o[s]=e[s])}return o},ie.apply(this,arguments)};function Qt(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var pt=!1,Se,rt,at,Ve,Xe,Mt,qe,ot,nt,it,Dt,st,lt,Lt,Pt;function pe(){if(!pt){pt=!0;var a=navigator.userAgent,o=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(a),e=/(Mac OS X)|(Windows)|(Linux)/.exec(a);if(st=/\b(iPhone|iP[ao]d)/.exec(a),lt=/\b(iP[ao]d)/.exec(a),it=/Android/i.exec(a),Lt=/FBAN\/\w+;/i.exec(a),Pt=/Mobile/i.exec(a),Dt=!!/Win64/.exec(a),o){Se=o[1]?parseFloat(o[1]):o[5]?parseFloat(o[5]):NaN,Se&&document&&document.documentMode&&(Se=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(a);Mt=r?parseFloat(r[1])+4:Se,rt=o[2]?parseFloat(o[2]):NaN,at=o[3]?parseFloat(o[3]):NaN,Ve=o[4]?parseFloat(o[4]):NaN,Ve?(o=/(?:Chrome\/(\d+\.\d+))/.exec(a),Xe=o&&o[1]?parseFloat(o[1]):NaN):Xe=NaN}else Se=rt=at=Xe=Ve=NaN;if(e){if(e[1]){var n=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(a);qe=n?parseFloat(n[1].replace("_",".")):!0}else qe=!1;ot=!!e[2],nt=!!e[3]}else qe=ot=nt=!1}}var ct={ie:function(){return pe()||Se},ieCompatibilityMode:function(){return pe()||Mt>Se},ie64:function(){return ct.ie()&&Dt},firefox:function(){return pe()||rt},opera:function(){return pe()||at},webkit:function(){return pe()||Ve},safari:function(){return ct.webkit()},chrome:function(){return pe()||Xe},windows:function(){return pe()||ot},osx:function(){return pe()||qe},linux:function(){return pe()||nt},iphone:function(){return pe()||st},mobile:function(){return pe()||st||lt||it||Pt},nativeApp:function(){return pe()||Lt},android:function(){return pe()||it},ipad:function(){return pe()||lt}},er=ct,tr=!!(typeof window<"u"&&window.document&&window.document.createElement),rr={canUseDOM:tr},ar=rr,Et=ar,At;Et.canUseDOM&&(At=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
35
29
  * Checks if an event is supported in the current execution environment.
36
30
  *
37
31
  * NOTE: This will not work correctly for non-generic events such as `change`,
@@ -44,7 +38,7 @@
44
38
  * @return {boolean} True if the event is supported.
45
39
  * @internal
46
40
  * @license Modernizr 3.0.0pre (Custom Build) | MIT
47
- */function Zt(n,a){if(!kt.canUseDOM||a&&!("addEventListener"in document))return!1;var e="on"+n,r=e in document;if(!r){var o=document.createElement("div");o.setAttribute(e,"return;"),r=typeof o[e]=="function"}return!r&&St&&n==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var Yt=Zt,Vt=Gt,Xt=Yt,rt=10,at=40,nt=800;function Nt(n){var a=0,e=0,r=0,o=0;return"detail"in n&&(e=n.detail),"wheelDelta"in n&&(e=-n.wheelDelta/120),"wheelDeltaY"in n&&(e=-n.wheelDeltaY/120),"wheelDeltaX"in n&&(a=-n.wheelDeltaX/120),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(a=e,e=0),r=a*rt,o=e*rt,"deltaY"in n&&(o=n.deltaY),"deltaX"in n&&(r=n.deltaX),(r||o)&&n.deltaMode&&(n.deltaMode==1?(r*=at,o*=at):(r*=nt,o*=nt)),r&&!a&&(a=r<1?-1:1),o&&!e&&(e=o<1?-1:1),{spinX:a,spinY:e,pixelX:r,pixelY:o}}Nt.getEventType=function(){return Vt.firefox()?"DOMMouseScroll":Xt("wheel")?"wheel":"mousewheel"};var qt=Nt,Jt=qt;const Qt=Ut(Jt);function er(n,a,e,r,o,i){i===void 0&&(i=0);var s=me(n,a,i),c=s.width,f=s.height,d=Math.min(c,e),p=Math.min(f,r);return d>p*o?{width:p*o,height:p}:{width:d,height:d/o}}function tr(n){return n.width>n.height?n.width/n.naturalWidth:n.height/n.naturalHeight}function ke(n,a,e,r,o){o===void 0&&(o=0);var i=me(a.width,a.height,o),s=i.width,c=i.height;return{x:ot(n.x,s,e.width,r),y:ot(n.y,c,e.height,r)}}function ot(n,a,e,r){var o=a*r/2-e/2;return Ue(n,-o,o)}function st(n,a){return Math.sqrt(Math.pow(n.y-a.y,2)+Math.pow(n.x-a.x,2))}function it(n,a){return Math.atan2(a.y-n.y,a.x-n.x)*180/Math.PI}function rr(n,a,e,r,o,i,s){i===void 0&&(i=0),s===void 0&&(s=!0);var c=s?ar:nr,f=me(a.width,a.height,i),d=me(a.naturalWidth,a.naturalHeight,i),p={x:c(100,((f.width-e.width/o)/2-n.x/o)/f.width*100),y:c(100,((f.height-e.height/o)/2-n.y/o)/f.height*100),width:c(100,e.width/f.width*100/o),height:c(100,e.height/f.height*100/o)},h=Math.round(c(d.width,p.width*d.width/100)),l=Math.round(c(d.height,p.height*d.height/100)),m=d.width>=d.height*r,g=m?{width:Math.round(l*r),height:l}:{width:h,height:Math.round(h/r)},j=W(W({},g),{x:Math.round(c(d.width-g.width,p.x*d.width/100)),y:Math.round(c(d.height-g.height,p.y*d.height/100))});return{croppedAreaPercentages:p,croppedAreaPixels:j}}function ar(n,a){return Math.min(n,Math.max(0,a))}function nr(n,a){return a}function or(n,a,e,r,o,i){var s=me(a.width,a.height,e),c=Ue(r.width/s.width*(100/n.width),o,i),f={x:c*s.width/2-r.width/2-s.width*c*(n.x/100),y:c*s.height/2-r.height/2-s.height*c*(n.y/100)};return{crop:f,zoom:c}}function sr(n,a,e){var r=tr(a);return e.height>e.width?e.height/(n.height*r):e.width/(n.width*r)}function ir(n,a,e,r,o,i){e===void 0&&(e=0);var s=me(a.naturalWidth,a.naturalHeight,e),c=Ue(sr(n,a,r),o,i),f=r.height>r.width?r.height/n.height:r.width/n.width,d={x:((s.width-n.width)/2-n.x)*f,y:((s.height-n.height)/2-n.y)*f};return{crop:d,zoom:c}}function lt(n,a){return{x:(a.x+n.x)/2,y:(a.y+n.y)/2}}function lr(n){return n*Math.PI/180}function me(n,a,e){var r=lr(e);return{width:Math.abs(Math.cos(r)*n)+Math.abs(Math.sin(r)*a),height:Math.abs(Math.sin(r)*n)+Math.abs(Math.cos(r)*a)}}function Ue(n,a,e){return Math.min(Math.max(n,a),e)}function Te(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return n.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var cr=`.reactEasyCrop_Container {
41
+ */function or(a,o){if(!Et.canUseDOM||o&&!("addEventListener"in document))return!1;var e="on"+a,r=e in document;if(!r){var n=document.createElement("div");n.setAttribute(e,"return;"),r=typeof n[e]=="function"}return!r&&At&&a==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var nr=or,ir=er,sr=nr,ut=10,ht=40,bt=800;function Ft(a){var o=0,e=0,r=0,n=0;return"detail"in a&&(e=a.detail),"wheelDelta"in a&&(e=-a.wheelDelta/120),"wheelDeltaY"in a&&(e=-a.wheelDeltaY/120),"wheelDeltaX"in a&&(o=-a.wheelDeltaX/120),"axis"in a&&a.axis===a.HORIZONTAL_AXIS&&(o=e,e=0),r=o*ut,n=e*ut,"deltaY"in a&&(n=a.deltaY),"deltaX"in a&&(r=a.deltaX),(r||n)&&a.deltaMode&&(a.deltaMode==1?(r*=ht,n*=ht):(r*=bt,n*=bt)),r&&!o&&(o=r<1?-1:1),n&&!e&&(e=n<1?-1:1),{spinX:o,spinY:e,pixelX:r,pixelY:n}}Ft.getEventType=function(){return ir.firefox()?"DOMMouseScroll":sr("wheel")?"wheel":"mousewheel"};var lr=Ft,cr=lr;const dr=Qt(cr);function pr(a,o,e,r,n,s){s===void 0&&(s=0);var i=Me(a,o,s),c=i.width,b=i.height,p=Math.min(c,e),h=Math.min(b,r);return p>h*n?{width:h*n,height:h}:{width:p,height:p/n}}function ur(a){return a.width>a.height?a.width/a.naturalWidth:a.height/a.naturalHeight}function Fe(a,o,e,r,n){n===void 0&&(n=0);var s=Me(o.width,o.height,n),i=s.width,c=s.height;return{x:gt(a.x,i,e.width,r),y:gt(a.y,c,e.height,r)}}function gt(a,o,e,r){var n=o*r/2-e/2;return Je(a,-n,n)}function wt(a,o){return Math.sqrt(Math.pow(a.y-o.y,2)+Math.pow(a.x-o.x,2))}function mt(a,o){return Math.atan2(o.y-a.y,o.x-a.x)*180/Math.PI}function hr(a,o,e,r,n,s,i){s===void 0&&(s=0),i===void 0&&(i=!0);var c=i?br:gr,b=Me(o.width,o.height,s),p=Me(o.naturalWidth,o.naturalHeight,s),h={x:c(100,((b.width-e.width/n)/2-a.x/n)/b.width*100),y:c(100,((b.height-e.height/n)/2-a.y/n)/b.height*100),width:c(100,e.width/b.width*100/n),height:c(100,e.height/b.height*100/n)},u=Math.round(c(p.width,h.width*p.width/100)),l=Math.round(c(p.height,h.height*p.height/100)),w=p.width>=p.height*r,m=w?{width:Math.round(l*r),height:l}:{width:u,height:Math.round(u/r)},x=ie(ie({},m),{x:Math.round(c(p.width-m.width,h.x*p.width/100)),y:Math.round(c(p.height-m.height,h.y*p.height/100))});return{croppedAreaPercentages:h,croppedAreaPixels:x}}function br(a,o){return Math.min(a,Math.max(0,o))}function gr(a,o){return o}function wr(a,o,e,r,n,s){var i=Me(o.width,o.height,e),c=Je(r.width/i.width*(100/a.width),n,s),b={x:c*i.width/2-r.width/2-i.width*c*(a.x/100),y:c*i.height/2-r.height/2-i.height*c*(a.y/100)};return{crop:b,zoom:c}}function mr(a,o,e){var r=ur(o);return e.height>e.width?e.height/(a.height*r):e.width/(a.width*r)}function fr(a,o,e,r,n,s){e===void 0&&(e=0);var i=Me(o.naturalWidth,o.naturalHeight,e),c=Je(mr(a,o,r),n,s),b=r.height>r.width?r.height/a.height:r.width/a.width,p={x:((i.width-a.width)/2-a.x)*b,y:((i.height-a.height)/2-a.y)*b};return{crop:p,zoom:c}}function ft(a,o){return{x:(o.x+a.x)/2,y:(o.y+a.y)/2}}function xr(a){return a*Math.PI/180}function Me(a,o,e){var r=xr(e);return{width:Math.abs(Math.cos(r)*a)+Math.abs(Math.sin(r)*o),height:Math.abs(Math.sin(r)*a)+Math.abs(Math.cos(r)*o)}}function Je(a,o,e){return Math.min(Math.max(a,o),e)}function He(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];return a.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var yr=`.reactEasyCrop_Container {
48
42
  position: absolute;
49
43
  top: 0;
50
44
  left: 0;
@@ -124,42 +118,13 @@
124
118
  border-left: 0;
125
119
  border-right: 0;
126
120
  }
127
- `,dr=1,ur=3,hr=1,pr=function(n){$t(a,n);function a(){var e=n!==null&&n.apply(this,arguments)||this;return e.cropperRef=ie.createRef(),e.imageRef=ie.createRef(),e.videoRef=ie.createRef(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.previousCropSize=null,e.isInitialized=!1,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var r=!0;e.resizeObserver=new window.ResizeObserver(function(o){if(r){r=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(r){return r.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturechange",e.onGestureChange),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var r=e.computeSizes();r&&(e.previousCropSize=r,e.emitCropData(),e.setInitialCrop(r),e.isInitialized=!0),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(r){if(e.props.initialCroppedAreaPercentages){var o=or(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,r,e.props.minZoom,e.props.maxZoom),i=o.crop,s=o.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}else if(e.props.initialCroppedAreaPixels){var c=ir(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,r,e.props.minZoom,e.props.maxZoom),i=c.crop,s=c.zoom;e.props.onCropChange(i),e.props.onZoomChange&&e.props.onZoomChange(s)}},e.computeSizes=function(){var r,o,i,s,c,f,d=e.imageRef.current||e.videoRef.current;if(d&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var p=e.containerRect.width/e.containerRect.height,h=((r=e.imageRef.current)===null||r===void 0?void 0:r.naturalWidth)||((o=e.videoRef.current)===null||o===void 0?void 0:o.videoWidth)||0,l=((i=e.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((s=e.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,m=d.offsetWidth<h||d.offsetHeight<l,g=h/l,j=void 0;if(m)switch(e.state.mediaObjectFit){default:case"contain":j=p>g?{width:e.containerRect.height*g,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/g};break;case"horizontal-cover":j={width:e.containerRect.width,height:e.containerRect.width/g};break;case"vertical-cover":j={width:e.containerRect.height*g,height:e.containerRect.height};break}else j={width:d.offsetWidth,height:d.offsetHeight};e.mediaSize=W(W({},j),{naturalWidth:h,naturalHeight:l}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var v=e.props.cropSize?e.props.cropSize:er(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((c=e.state.cropSize)===null||c===void 0?void 0:c.height)!==v.height||((f=e.state.cropSize)===null||f===void 0?void 0:f.width)!==v.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(v),e.setState({cropSize:v},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(v),v}},e.saveContainerPosition=function(){if(e.containerRef){var r=e.containerRef.getBoundingClientRect();e.containerPosition={x:r.left,y:r.top}}},e.onMouseDown=function(r){e.currentDoc&&(r.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(a.getMousePoint(r)))},e.onMouseMove=function(r){return e.onDrag(a.getMousePoint(r))},e.onScroll=function(r){e.currentDoc&&(r.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(r){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(r))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),r.touches.length===2?e.onPinchStart(r):r.touches.length===1&&e.onDragStart(a.getTouchPoint(r.touches[0]))))},e.onTouchMove=function(r){r.preventDefault(),r.touches.length===2?e.onPinchMove(r):r.touches.length===1&&e.onDrag(a.getTouchPoint(r.touches[0]))},e.onGestureStart=function(r){e.currentDoc&&(r.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureChange),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureChange=function(r){if(r.preventDefault(),!e.isTouching){var o=a.getMousePoint(r),i=e.gestureZoomStart-1+r.scale;if(e.setNewZoom(i,o,{shouldUpdatePosition:!0}),e.props.onRotationChange){var s=e.gestureRotationStart+r.rotation;e.props.onRotationChange(s)}}},e.onGestureEnd=function(r){e.cleanEvents()},e.onDragStart=function(r){var o,i,s=r.x,c=r.y;e.dragStartPosition={x:s,y:c},e.dragStartCrop=W({},e.props.crop),(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o)},e.onDrag=function(r){var o=r.x,i=r.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(o===void 0||i===void 0)){var s=o-e.dragStartPosition.x,c=i-e.dragStartPosition.y,f={x:e.dragStartCrop.x+s,y:e.dragStartCrop.y+c},d=e.props.restrictPosition?ke(f,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):f;e.props.onCropChange(d)}}))},e.onDragStopped=function(){var r,o;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(o=(r=e.props).onInteractionEnd)===null||o===void 0||o.call(r)},e.onWheel=function(r){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(r))){r.preventDefault();var o=a.getMousePoint(r),i=Qt(r).pixelY,s=e.props.zoom-i*e.props.zoomSpeed/200;e.setNewZoom(s,o,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var c,f;return(f=(c=e.props).onInteractionStart)===null||f===void 0?void 0:f.call(c)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var c,f;return(f=(c=e.props).onInteractionEnd)===null||f===void 0?void 0:f.call(c)})},250)}},e.getPointOnContainer=function(r,o){var i=r.x,s=r.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(i-o.x),y:e.containerRect.height/2-(s-o.y)}},e.getPointOnMedia=function(r){var o=r.x,i=r.y,s=e.props,c=s.crop,f=s.zoom;return{x:(o+c.x)/f,y:(i+c.y)/f}},e.setNewZoom=function(r,o,i){var s=i===void 0?{}:i,c=s.shouldUpdatePosition,f=c===void 0?!0:c;if(!(!e.state.cropSize||!e.props.onZoomChange)){var d=Ue(r,e.props.minZoom,e.props.maxZoom);if(f){var p=e.getPointOnContainer(o,e.containerPosition),h=e.getPointOnMedia(p),l={x:h.x*d-p.x,y:h.y*d-p.y},m=e.props.restrictPosition?ke(l,e.mediaSize,e.state.cropSize,d,e.props.rotation):l;e.props.onCropChange(m)}e.props.onZoomChange(d)}},e.getCropData=function(){if(!e.state.cropSize)return null;var r=e.props.restrictPosition?ke(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return rr(r,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var r=e.getCropData();if(r){var o=r.croppedAreaPercentages,i=r.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(o,i),e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.emitCropAreaChange=function(){var r=e.getCropData();if(r){var o=r.croppedAreaPercentages,i=r.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(o,i)}},e.recomputeCropPosition=function(){var r,o;if(e.state.cropSize){var i=e.props.crop;if(e.isInitialized&&(!((r=e.previousCropSize)===null||r===void 0)&&r.width)&&(!((o=e.previousCropSize)===null||o===void 0)&&o.height)){var s=Math.abs(e.previousCropSize.width-e.state.cropSize.width)>1e-6||Math.abs(e.previousCropSize.height-e.state.cropSize.height)>1e-6;if(s){var c=e.state.cropSize.width/e.previousCropSize.width,f=e.state.cropSize.height/e.previousCropSize.height;i={x:e.props.crop.x*c,y:e.props.crop.y*f}}}var d=e.props.restrictPosition?ke(i,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):i;e.previousCropSize=e.state.cropSize,e.props.onCropChange(d),e.emitCropData()}},e.onKeyDown=function(r){var o,i,s=e.props,c=s.crop,f=s.onCropChange,d=s.keyboardStep,p=s.zoom,h=s.rotation,l=d;if(e.state.cropSize){r.shiftKey&&(l*=.2);var m=W({},c);switch(r.key){case"ArrowUp":m.y-=l,r.preventDefault();break;case"ArrowDown":m.y+=l,r.preventDefault();break;case"ArrowLeft":m.x-=l,r.preventDefault();break;case"ArrowRight":m.x+=l,r.preventDefault();break;default:return}e.props.restrictPosition&&(m=ke(m,e.mediaSize,e.state.cropSize,p,h)),r.repeat||(i=(o=e.props).onInteractionStart)===null||i===void 0||i.call(o),f(m)}},e.onKeyUp=function(r){var o,i;switch(r.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":r.preventDefault();break;default:return}e.emitCropData(),(i=(o=e.props).onInteractionEnd)===null||i===void 0||i.call(o)},e}return a.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=cr,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},a.prototype.componentWillUnmount=function(){var e,r;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((r=this.styleRef.parentNode)===null||r===void 0||r.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},a.prototype.componentDidUpdate=function(e){var r,o,i,s,c,f,d,p,h;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((r=e.cropSize)===null||r===void 0?void 0:r.height)!==((o=this.props.cropSize)===null||o===void 0?void 0:o.height)||((i=e.cropSize)===null||i===void 0?void 0:i.width)!==((s=this.props.cropSize)===null||s===void 0?void 0:s.width)?this.computeSizes():(((c=e.crop)===null||c===void 0?void 0:c.x)!==((f=this.props.crop)===null||f===void 0?void 0:f.x)||((d=e.crop)===null||d===void 0?void 0:d.y)!==((p=this.props.crop)===null||p===void 0?void 0:p.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((h=this.videoRef.current)===null||h===void 0||h.load());var l=this.getObjectFit();l!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:l},this.computeSizes)},a.prototype.getAspect=function(){var e=this.props,r=e.cropSize,o=e.aspect;return r?r.width/r.height:o},a.prototype.getObjectFit=function(){var e,r,o,i;if(this.props.objectFit==="cover"){var s=this.imageRef.current||this.videoRef.current;if(s&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var c=this.containerRect.width/this.containerRect.height,f=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((r=this.videoRef.current)===null||r===void 0?void 0:r.videoWidth)||0,d=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,p=f/d;return p<c?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},a.prototype.onPinchStart=function(e){var r=a.getTouchPoint(e.touches[0]),o=a.getTouchPoint(e.touches[1]);this.lastPinchDistance=st(r,o),this.lastPinchRotation=it(r,o),this.onDragStart(lt(r,o))},a.prototype.onPinchMove=function(e){var r=this;if(!(!this.currentDoc||!this.currentWindow)){var o=a.getTouchPoint(e.touches[0]),i=a.getTouchPoint(e.touches[1]),s=lt(o,i);this.onDrag(s),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var c=st(o,i),f=r.props.zoom*(c/r.lastPinchDistance);r.setNewZoom(f,s,{shouldUpdatePosition:!1}),r.lastPinchDistance=c;var d=it(o,i),p=r.props.rotation+(d-r.lastPinchRotation);r.props.onRotationChange&&r.props.onRotationChange(p),r.lastPinchRotation=d})}},a.prototype.render=function(){var e=this,r,o=this.props,i=o.image,s=o.video,c=o.mediaProps,f=o.cropperProps,d=o.transform,p=o.crop,h=p.x,l=p.y,m=o.rotation,g=o.zoom,j=o.cropShape,v=o.showGrid,R=o.roundCropAreaPixels,A=o.style,L=A.containerStyle,C=A.cropAreaStyle,I=A.mediaStyle,E=o.classes,x=E.containerClassName,w=E.cropAreaClassName,S=E.mediaClassName,D=(r=this.state.mediaObjectFit)!==null&&r!==void 0?r:this.getObjectFit();return ie.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(Y){return e.containerRef=Y},"data-testid":"container",style:L,className:Te("reactEasyCrop_Container",x)},i?ie.createElement("img",W({alt:"",className:Te("reactEasyCrop_Image",D==="contain"&&"reactEasyCrop_Contain",D==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",D==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",S)},c,{src:i,ref:this.imageRef,style:W(W({},I),{transform:d||"translate(".concat(h,"px, ").concat(l,"px) rotate(").concat(m,"deg) scale(").concat(g,")")}),onLoad:this.onMediaLoad})):s&&ie.createElement("video",W({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:Te("reactEasyCrop_Video",D==="contain"&&"reactEasyCrop_Contain",D==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",D==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",S)},c,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:W(W({},I),{transform:d||"translate(".concat(h,"px, ").concat(l,"px) rotate(").concat(m,"deg) scale(").concat(g,")")}),controls:!1}),(Array.isArray(s)?s:[{src:s}]).map(function(P){return ie.createElement("source",W({key:P.src},P))})),this.state.cropSize&&ie.createElement("div",W({ref:this.cropperRef,style:W(W({},C),{width:R?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:R?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:Te("reactEasyCrop_CropArea",j==="round"&&"reactEasyCrop_CropAreaRound",v&&"reactEasyCrop_CropAreaGrid",w)},f)))},a.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:ur,minZoom:dr,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:hr},a.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},a.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},a}(ie.Component);const ct=ae,fr=n=>new Promise((a,e)=>{const r=new Image;r.addEventListener("load",()=>a(r)),r.addEventListener("error",o=>e(o)),r.setAttribute("crossOrigin","anonymous"),r.src=n}),Mt=n=>n*Math.PI/180,br=(n,a,e)=>{const r=Mt(e);return{width:Math.abs(Math.cos(r)*n)+Math.abs(Math.sin(r)*a),height:Math.abs(Math.sin(r)*n)+Math.abs(Math.cos(r)*a)}},gr=async(n,a,e="image/jpeg",r=0)=>{const o=await fr(n),i=document.createElement("canvas"),s=i.getContext("2d");if(!s)throw new Error("Canvas context is not available");const c=Mt(r),{width:f,height:d}=br(o.width,o.height,r);i.width=f,i.height=d,s.translate(f/2,d/2),s.rotate(c),s.translate(-o.width/2,-o.height/2),s.drawImage(o,0,0);const p=document.createElement("canvas"),h=p.getContext("2d");if(!h)throw new Error("Canvas context is not available");return p.width=a.width,p.height=a.height,h.drawImage(i,a.x,a.y,a.width,a.height,0,0,a.width,a.height),new Promise((l,m)=>{p.toBlob(g=>{if(!g){m(new Error("Image cropping failed"));return}l(g)},e,.95)})},mr=({isOpen:n,imageSrc:a,fileType:e="image/jpeg",fileName:r="cropped-image",aspect:o=1/1,title:i="Crop Image",onClose:s,onApply:c})=>{const[f,d]=b.useState({x:0,y:0}),[p,h]=b.useState(1),[l,m]=b.useState(null);b.useEffect(()=>{n&&(d({x:0,y:0}),h(1),m(null))},[n]);const g=b.useCallback((v,R)=>{m(R)},[]),j=async()=>{var v,R;if(!(!a||!l))try{const A=await gr(a,l,e),L=((R=(v=e==null?void 0:e.split("/"))==null?void 0:v[1])==null?void 0:R.replace("jpeg","jpg"))||"jpg",C=new File([A],`${r}.${L}`,{type:e});c==null||c(C)}catch{s==null||s()}};return n?t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-gray-500 opacity-75",onClick:s}),t.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col dark:bg-gray-800",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:i}),t.jsx("button",{type:"button",onClick:s,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close crop modal",children:t.jsx(ce.Icon,{icon:"mdi:close",className:"w-6 h-6"})})]}),t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("div",{className:"relative h-72 w-full bg-gray-900 rounded-md overflow-hidden",children:a&&t.jsx(pr,{image:a,crop:f,zoom:p,aspect:o,onCropChange:d,onZoomChange:h,onCropComplete:g})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Zoom"}),t.jsx("input",{type:"range",min:1,max:3,step:.1,value:p,onChange:v=>h(Number(v.target.value)),className:"w-full"})]})]}),t.jsxs("div",{className:"px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:!px-6",children:[t.jsx(ct,{type:"button",onClick:s,variant:"outlined",color:"default",children:"Cancel"}),t.jsx(ct,{type:"button",onClick:j,variant:"contained",color:"primary",children:"Apply Crop"})]})]})]}):null},xr=ae,ue=n=>{typeof n=="string"&&n.startsWith("blob:")&&URL.revokeObjectURL(n)},yr=({label:n="",value:a=null,onChange:e,required:r=!1,accept:o="image/*",aspect:i="1",id:s,dragDrop:c=!1,cropImage:f=!1,name:d="",parentClass:p=""})=>{const[h,l]=b.useState(a),[m,g]=b.useState(!1),[j,v]=b.useState(!1),[R,A]=b.useState(""),[L,C]=b.useState("image/jpeg"),[I,E]=b.useState("cropped-image"),x=b.useRef(null),w=b.useRef(""),S=b.useRef("");b.useEffect(()=>{if(a instanceof File){const k=URL.createObjectURL(a);ue(S.current),S.current=k,l({file:a,preview:k})}else a&&typeof a=="object"&&"preview"in a,l(a)},[a]),b.useEffect(()=>()=>{ue(S.current),ue(w.current)},[]);const D=()=>{v(!1),ue(w.current),w.current="",A(""),x.current&&(x.current.value="")},P=k=>{const z=URL.createObjectURL(k);ue(S.current),S.current=z,l({file:k,preview:z}),e==null||e(k),D()},Y=k=>{if(!k||k.length===0)return;const z=k[0];if(f){const F=URL.createObjectURL(z);ue(w.current),w.current=F,A(F),C(z.type||"image/jpeg"),E((z.name||"cropped-image").replace(/\.[^/.]+$/,"")),v(!0);return}const H=URL.createObjectURL(z);ue(S.current),S.current=H,l({file:z,preview:H}),e==null||e(z)},ee=k=>{k&&k.stopPropagation(),ue(S.current),S.current="",l(null),e==null||e(null),x.current&&(x.current.value="")},G=k=>{c&&(k.preventDefault(),g(!0))},N=k=>{c&&(k.preventDefault(),g(!1))},X=k=>{var z,H,F,te;c&&(k.preventDefault(),g(!1),(te=(F=(H=(z=k.dataTransfer)==null?void 0:z.files)==null?void 0:H[0])==null?void 0:F.type)!=null&&te.includes("image/")&&Y(k.dataTransfer.files))},B=()=>{var k;(k=x.current)==null||k.click()},M=h&&typeof h=="object"&&"preview"in h?h.preview:typeof h=="string"?h:"";return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:p||"col-span-12",children:[t.jsx(Q,{label:n,required:r}),t.jsxs("div",{className:`relative rounded-md p-2 transition-all ${m?"border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,onDragOver:G,onDragLeave:N,onDrop:X,children:[t.jsx("input",{ref:x,id:s,type:"file",accept:o,onChange:k=>Y(k.target.files),required:r&&!h,className:"absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"}),t.jsxs("div",{className:`flex items-center space-x-4 transition-all ${m?"opacity-50":""}`,children:[h?t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:M,alt:"preview",className:"object-cover w-20 h-20 rounded-full shadow-md"}),!r&&t.jsx("button",{type:"button",onClick:ee,className:"absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2","aria-label":"Remove image",children:t.jsx(ce.Icon,{icon:"mdi:close",className:"w-3 h-3"})})]}):t.jsx("div",{className:"rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center",children:t.jsx(ce.Icon,{icon:"ri:image-add-fill",className:"text-gray-400 w-10 h-10"})}),t.jsxs("div",{className:"flex flex-col items-center space-y-1",children:[t.jsx(xr,{type:"button",onClick:B,variant:"outlined",color:"default",children:h?"Change Image":"Select Image"}),c&&!h&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"or drag and drop"})]})]}),c&&m&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md",children:t.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold text-lg",children:"Drop image here"})})]})]},d),t.jsx(mr,{isOpen:j,imageSrc:R,fileType:L,fileName:I,onClose:D,onApply:P,aspect:Number(i)})]})},Rt=b.forwardRef(({label:n,value:a,required:e,parentClass:r="",className:o="",type:i="text",onKeyDown:s,negativeNumberAllow:c=!0,defaultValue:f="",field:d={},onChange:p,mask:h="",maskApplyOnValue:l=!0,...m},g)=>{const[j,v]=b.useState(!1),R=C=>{if(i==="number"){if(["e","E","+"].includes(C.key)){C.preventDefault();return}if(c==!1&&C.key==="-"){C.preventDefault();return}if(["ArrowUp","ArrowDown"].includes(C.key)){C.preventDefault();return}}s==null||s(C)},A=`
128
- h-10 placeholder-gray-400 dark:placeholder-gray-400
129
- ${i==="password"?"pr-10":""}
130
- ${i==="number"?"no-spinner":""}
131
- ${o}
132
- `.trim();function L(C,I){if(!C)return C;const E=String(C).replace(/[^a-zA-Z0-9]/g,"");let x="",w=0;for(let S=0;S<(I==null?void 0:I.length)&&w<E.length;S++){const D=I[S],P=E[w];D==="9"?/\d/.test(P)?(x+=P,w++):(w++,S--):D==="A"?/[a-zA-Z]/.test(P)?(x+=P,w++):(w++,S--):D==="X"?/[a-zA-Z0-9]/.test(P)?(x+=P,w++):(w++,S--):D==="*"?(x+=P,w++):(x+=D,P===D&&w++)}return x}return b.useEffect(()=>{if(f){const C=a||f;setTimeout(()=>{p==null||p(C)},100)}},[f]),t.jsx(t.Fragment,{children:t.jsxs("div",{className:r||"col-span-12",children:[t.jsx(Q,{label:n,required:e,infoText:d==null?void 0:d.infoText}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:i==="password"&&j?"text":i,ref:g,required:e,onKeyDown:R,className:A,value:h?L(a,h):a,onChange:C=>{p(h&&l?L(C.target.value,h):C.target.value)},...m}),i==="password"&&t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>v(C=>!C),className:"absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",children:t.jsx(ce.Icon,{icon:j?"mdi:eye-outline":"mdi:eye-off-outline",className:"w-5 h-5"})})]})]},m.name)})});Rt.displayName="Input";const vr=({editorKey:n="",value:a="",onChange:e,label:r="",required:o=!1,placeholder:i="",parentClass:s="col-span-12",height:c=400,inline:f=!1,disabled:d=!1,plugins:p,toolbar:h,menubar:l=!1,fontFamily:m="Inter, sans-serif",initConfig:g={},imageUploadHandler:j})=>{const v=["advlist","autolink","lists","link","image","charmap","preview","anchor","searchreplace","visualblocks","code","fullscreen","insertdatetime","media","table","help","wordcount"],R="undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",A=L=>new Promise((C,I)=>{if(!j){C(`data:${L.blob().type};base64,${L.base64()}`);return}j(L).then(E=>{E?C(E):I("Upload failed: No URL returned")}).catch(E=>{I(typeof E=="string"?E:(E==null?void 0:E.message)||"Image upload failed")})});return t.jsxs("div",{className:s,children:[r&&t.jsx(Q,{label:r,required:o}),t.jsx(It.Editor,{apiKey:n,value:a,disabled:d,init:{height:c,inline:f,menubar:l,branding:!1,statusbar:!0,automatic_uploads:!0,images_upload_handler:A,plugins:p??v,toolbar:h??R,placeholder:i,content_style:`
121
+ `,vr=1,kr=3,jr=1,Nr=function(a){Jt(o,a);function o(){var e=a!==null&&a.apply(this,arguments)||this;return e.cropperRef=ke.createRef(),e.imageRef=ke.createRef(),e.videoRef=ke.createRef(),e.containerPosition={x:0,y:0},e.containerRef=null,e.styleRef=null,e.containerRect=null,e.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},e.dragStartPosition={x:0,y:0},e.dragStartCrop={x:0,y:0},e.gestureZoomStart=0,e.gestureRotationStart=0,e.isTouching=!1,e.lastPinchDistance=0,e.lastPinchRotation=0,e.rafDragTimeout=null,e.rafPinchTimeout=null,e.wheelTimer=null,e.currentDoc=typeof document<"u"?document:null,e.currentWindow=typeof window<"u"?window:null,e.resizeObserver=null,e.previousCropSize=null,e.isInitialized=!1,e.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},e.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!e.containerRef)){var r=!0;e.resizeObserver=new window.ResizeObserver(function(n){if(r){r=!1;return}e.computeSizes()}),e.resizeObserver.observe(e.containerRef)}},e.preventZoomSafari=function(r){return r.preventDefault()},e.cleanEvents=function(){e.currentDoc&&(e.currentDoc.removeEventListener("mousemove",e.onMouseMove),e.currentDoc.removeEventListener("mouseup",e.onDragStopped),e.currentDoc.removeEventListener("touchmove",e.onTouchMove),e.currentDoc.removeEventListener("touchend",e.onDragStopped),e.currentDoc.removeEventListener("gesturechange",e.onGestureChange),e.currentDoc.removeEventListener("gestureend",e.onGestureEnd),e.currentDoc.removeEventListener("scroll",e.onScroll))},e.clearScrollEvent=function(){e.containerRef&&e.containerRef.removeEventListener("wheel",e.onWheel),e.wheelTimer&&clearTimeout(e.wheelTimer)},e.onMediaLoad=function(){var r=e.computeSizes();r&&(e.previousCropSize=r,e.emitCropData(),e.setInitialCrop(r),e.isInitialized=!0),e.props.onMediaLoaded&&e.props.onMediaLoaded(e.mediaSize)},e.setInitialCrop=function(r){if(e.props.initialCroppedAreaPercentages){var n=wr(e.props.initialCroppedAreaPercentages,e.mediaSize,e.props.rotation,r,e.props.minZoom,e.props.maxZoom),s=n.crop,i=n.zoom;e.props.onCropChange(s),e.props.onZoomChange&&e.props.onZoomChange(i)}else if(e.props.initialCroppedAreaPixels){var c=fr(e.props.initialCroppedAreaPixels,e.mediaSize,e.props.rotation,r,e.props.minZoom,e.props.maxZoom),s=c.crop,i=c.zoom;e.props.onCropChange(s),e.props.onZoomChange&&e.props.onZoomChange(i)}},e.computeSizes=function(){var r,n,s,i,c,b,p=e.imageRef.current||e.videoRef.current;if(p&&e.containerRef){e.containerRect=e.containerRef.getBoundingClientRect(),e.saveContainerPosition();var h=e.containerRect.width/e.containerRect.height,u=((r=e.imageRef.current)===null||r===void 0?void 0:r.naturalWidth)||((n=e.videoRef.current)===null||n===void 0?void 0:n.videoWidth)||0,l=((s=e.imageRef.current)===null||s===void 0?void 0:s.naturalHeight)||((i=e.videoRef.current)===null||i===void 0?void 0:i.videoHeight)||0,w=p.offsetWidth<u||p.offsetHeight<l,m=u/l,x=void 0;if(w)switch(e.state.mediaObjectFit){default:case"contain":x=h>m?{width:e.containerRect.height*m,height:e.containerRect.height}:{width:e.containerRect.width,height:e.containerRect.width/m};break;case"horizontal-cover":x={width:e.containerRect.width,height:e.containerRect.width/m};break;case"vertical-cover":x={width:e.containerRect.height*m,height:e.containerRect.height};break}else x={width:p.offsetWidth,height:p.offsetHeight};e.mediaSize=ie(ie({},x),{naturalWidth:u,naturalHeight:l}),e.props.setMediaSize&&e.props.setMediaSize(e.mediaSize);var N=e.props.cropSize?e.props.cropSize:pr(e.mediaSize.width,e.mediaSize.height,e.containerRect.width,e.containerRect.height,e.props.aspect,e.props.rotation);return(((c=e.state.cropSize)===null||c===void 0?void 0:c.height)!==N.height||((b=e.state.cropSize)===null||b===void 0?void 0:b.width)!==N.width)&&e.props.onCropSizeChange&&e.props.onCropSizeChange(N),e.setState({cropSize:N},e.recomputeCropPosition),e.props.setCropSize&&e.props.setCropSize(N),N}},e.saveContainerPosition=function(){if(e.containerRef){var r=e.containerRef.getBoundingClientRect();e.containerPosition={x:r.left,y:r.top}}},e.onMouseDown=function(r){e.currentDoc&&(r.preventDefault(),e.currentDoc.addEventListener("mousemove",e.onMouseMove),e.currentDoc.addEventListener("mouseup",e.onDragStopped),e.saveContainerPosition(),e.onDragStart(o.getMousePoint(r)))},e.onMouseMove=function(r){return e.onDrag(o.getMousePoint(r))},e.onScroll=function(r){e.currentDoc&&(r.preventDefault(),e.saveContainerPosition())},e.onTouchStart=function(r){e.currentDoc&&(e.isTouching=!0,!(e.props.onTouchRequest&&!e.props.onTouchRequest(r))&&(e.currentDoc.addEventListener("touchmove",e.onTouchMove,{passive:!1}),e.currentDoc.addEventListener("touchend",e.onDragStopped),e.saveContainerPosition(),r.touches.length===2?e.onPinchStart(r):r.touches.length===1&&e.onDragStart(o.getTouchPoint(r.touches[0]))))},e.onTouchMove=function(r){r.preventDefault(),r.touches.length===2?e.onPinchMove(r):r.touches.length===1&&e.onDrag(o.getTouchPoint(r.touches[0]))},e.onGestureStart=function(r){e.currentDoc&&(r.preventDefault(),e.currentDoc.addEventListener("gesturechange",e.onGestureChange),e.currentDoc.addEventListener("gestureend",e.onGestureEnd),e.gestureZoomStart=e.props.zoom,e.gestureRotationStart=e.props.rotation)},e.onGestureChange=function(r){if(r.preventDefault(),!e.isTouching){var n=o.getMousePoint(r),s=e.gestureZoomStart-1+r.scale;if(e.setNewZoom(s,n,{shouldUpdatePosition:!0}),e.props.onRotationChange){var i=e.gestureRotationStart+r.rotation;e.props.onRotationChange(i)}}},e.onGestureEnd=function(r){e.cleanEvents()},e.onDragStart=function(r){var n,s,i=r.x,c=r.y;e.dragStartPosition={x:i,y:c},e.dragStartCrop=ie({},e.props.crop),(s=(n=e.props).onInteractionStart)===null||s===void 0||s.call(n)},e.onDrag=function(r){var n=r.x,s=r.y;e.currentWindow&&(e.rafDragTimeout&&e.currentWindow.cancelAnimationFrame(e.rafDragTimeout),e.rafDragTimeout=e.currentWindow.requestAnimationFrame(function(){if(e.state.cropSize&&!(n===void 0||s===void 0)){var i=n-e.dragStartPosition.x,c=s-e.dragStartPosition.y,b={x:e.dragStartCrop.x+i,y:e.dragStartCrop.y+c},p=e.props.restrictPosition?Fe(b,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):b;e.props.onCropChange(p)}}))},e.onDragStopped=function(){var r,n;e.isTouching=!1,e.cleanEvents(),e.emitCropData(),(n=(r=e.props).onInteractionEnd)===null||n===void 0||n.call(r)},e.onWheel=function(r){if(e.currentWindow&&!(e.props.onWheelRequest&&!e.props.onWheelRequest(r))){r.preventDefault();var n=o.getMousePoint(r),s=dr(r).pixelY,i=e.props.zoom-s*e.props.zoomSpeed/200;e.setNewZoom(i,n,{shouldUpdatePosition:!0}),e.state.hasWheelJustStarted||e.setState({hasWheelJustStarted:!0},function(){var c,b;return(b=(c=e.props).onInteractionStart)===null||b===void 0?void 0:b.call(c)}),e.wheelTimer&&clearTimeout(e.wheelTimer),e.wheelTimer=e.currentWindow.setTimeout(function(){return e.setState({hasWheelJustStarted:!1},function(){var c,b;return(b=(c=e.props).onInteractionEnd)===null||b===void 0?void 0:b.call(c)})},250)}},e.getPointOnContainer=function(r,n){var s=r.x,i=r.y;if(!e.containerRect)throw new Error("The Cropper is not mounted");return{x:e.containerRect.width/2-(s-n.x),y:e.containerRect.height/2-(i-n.y)}},e.getPointOnMedia=function(r){var n=r.x,s=r.y,i=e.props,c=i.crop,b=i.zoom;return{x:(n+c.x)/b,y:(s+c.y)/b}},e.setNewZoom=function(r,n,s){var i=s===void 0?{}:s,c=i.shouldUpdatePosition,b=c===void 0?!0:c;if(!(!e.state.cropSize||!e.props.onZoomChange)){var p=Je(r,e.props.minZoom,e.props.maxZoom);if(b){var h=e.getPointOnContainer(n,e.containerPosition),u=e.getPointOnMedia(h),l={x:u.x*p-h.x,y:u.y*p-h.y},w=e.props.restrictPosition?Fe(l,e.mediaSize,e.state.cropSize,p,e.props.rotation):l;e.props.onCropChange(w)}e.props.onZoomChange(p)}},e.getCropData=function(){if(!e.state.cropSize)return null;var r=e.props.restrictPosition?Fe(e.props.crop,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):e.props.crop;return hr(r,e.mediaSize,e.state.cropSize,e.getAspect(),e.props.zoom,e.props.rotation,e.props.restrictPosition)},e.emitCropData=function(){var r=e.getCropData();if(r){var n=r.croppedAreaPercentages,s=r.croppedAreaPixels;e.props.onCropComplete&&e.props.onCropComplete(n,s),e.props.onCropAreaChange&&e.props.onCropAreaChange(n,s)}},e.emitCropAreaChange=function(){var r=e.getCropData();if(r){var n=r.croppedAreaPercentages,s=r.croppedAreaPixels;e.props.onCropAreaChange&&e.props.onCropAreaChange(n,s)}},e.recomputeCropPosition=function(){var r,n;if(e.state.cropSize){var s=e.props.crop;if(e.isInitialized&&(!((r=e.previousCropSize)===null||r===void 0)&&r.width)&&(!((n=e.previousCropSize)===null||n===void 0)&&n.height)){var i=Math.abs(e.previousCropSize.width-e.state.cropSize.width)>1e-6||Math.abs(e.previousCropSize.height-e.state.cropSize.height)>1e-6;if(i){var c=e.state.cropSize.width/e.previousCropSize.width,b=e.state.cropSize.height/e.previousCropSize.height;s={x:e.props.crop.x*c,y:e.props.crop.y*b}}}var p=e.props.restrictPosition?Fe(s,e.mediaSize,e.state.cropSize,e.props.zoom,e.props.rotation):s;e.previousCropSize=e.state.cropSize,e.props.onCropChange(p),e.emitCropData()}},e.onKeyDown=function(r){var n,s,i=e.props,c=i.crop,b=i.onCropChange,p=i.keyboardStep,h=i.zoom,u=i.rotation,l=p;if(e.state.cropSize){r.shiftKey&&(l*=.2);var w=ie({},c);switch(r.key){case"ArrowUp":w.y-=l,r.preventDefault();break;case"ArrowDown":w.y+=l,r.preventDefault();break;case"ArrowLeft":w.x-=l,r.preventDefault();break;case"ArrowRight":w.x+=l,r.preventDefault();break;default:return}e.props.restrictPosition&&(w=Fe(w,e.mediaSize,e.state.cropSize,h,u)),r.repeat||(s=(n=e.props).onInteractionStart)===null||s===void 0||s.call(n),b(w)}},e.onKeyUp=function(r){var n,s;switch(r.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":r.preventDefault();break;default:return}e.emitCropData(),(s=(n=e.props).onInteractionEnd)===null||s===void 0||s.call(n)},e}return o.prototype.componentDidMount=function(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=yr,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},o.prototype.componentWillUnmount=function(){var e,r;!this.currentDoc||!this.currentWindow||(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&((r=this.styleRef.parentNode)===null||r===void 0||r.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},o.prototype.componentDidUpdate=function(e){var r,n,s,i,c,b,p,h,u;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((r=e.cropSize)===null||r===void 0?void 0:r.height)!==((n=this.props.cropSize)===null||n===void 0?void 0:n.height)||((s=e.cropSize)===null||s===void 0?void 0:s.width)!==((i=this.props.cropSize)===null||i===void 0?void 0:i.width)?this.computeSizes():(((c=e.crop)===null||c===void 0?void 0:c.x)!==((b=this.props.crop)===null||b===void 0?void 0:b.x)||((p=e.crop)===null||p===void 0?void 0:p.y)!==((h=this.props.crop)===null||h===void 0?void 0:h.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&((u=this.videoRef.current)===null||u===void 0||u.load());var l=this.getObjectFit();l!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:l},this.computeSizes)},o.prototype.getAspect=function(){var e=this.props,r=e.cropSize,n=e.aspect;return r?r.width/r.height:n},o.prototype.getObjectFit=function(){var e,r,n,s;if(this.props.objectFit==="cover"){var i=this.imageRef.current||this.videoRef.current;if(i&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var c=this.containerRect.width/this.containerRect.height,b=((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((r=this.videoRef.current)===null||r===void 0?void 0:r.videoWidth)||0,p=((n=this.imageRef.current)===null||n===void 0?void 0:n.naturalHeight)||((s=this.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,h=b/p;return h<c?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},o.prototype.onPinchStart=function(e){var r=o.getTouchPoint(e.touches[0]),n=o.getTouchPoint(e.touches[1]);this.lastPinchDistance=wt(r,n),this.lastPinchRotation=mt(r,n),this.onDragStart(ft(r,n))},o.prototype.onPinchMove=function(e){var r=this;if(!(!this.currentDoc||!this.currentWindow)){var n=o.getTouchPoint(e.touches[0]),s=o.getTouchPoint(e.touches[1]),i=ft(n,s);this.onDrag(i),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var c=wt(n,s),b=r.props.zoom*(c/r.lastPinchDistance);r.setNewZoom(b,i,{shouldUpdatePosition:!1}),r.lastPinchDistance=c;var p=mt(n,s),h=r.props.rotation+(p-r.lastPinchRotation);r.props.onRotationChange&&r.props.onRotationChange(h),r.lastPinchRotation=p})}},o.prototype.render=function(){var e=this,r,n=this.props,s=n.image,i=n.video,c=n.mediaProps,b=n.cropperProps,p=n.transform,h=n.crop,u=h.x,l=h.y,w=n.rotation,m=n.zoom,x=n.cropShape,N=n.showGrid,k=n.roundCropAreaPixels,S=n.style,L=S.containerStyle,z=S.cropAreaStyle,F=S.mediaStyle,P=n.classes,U=P.containerClassName,y=P.cropAreaClassName,_=P.mediaClassName,C=(r=this.state.mediaObjectFit)!==null&&r!==void 0?r:this.getObjectFit();return ke.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(B){return e.containerRef=B},"data-testid":"container",style:L,className:He("reactEasyCrop_Container",U)},s?ke.createElement("img",ie({alt:"",className:He("reactEasyCrop_Image",C==="contain"&&"reactEasyCrop_Contain",C==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",C==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",_)},c,{src:s,ref:this.imageRef,style:ie(ie({},F),{transform:p||"translate(".concat(u,"px, ").concat(l,"px) rotate(").concat(w,"deg) scale(").concat(m,")")}),onLoad:this.onMediaLoad})):i&&ke.createElement("video",ie({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:He("reactEasyCrop_Video",C==="contain"&&"reactEasyCrop_Contain",C==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",C==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",_)},c,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:ie(ie({},F),{transform:p||"translate(".concat(u,"px, ").concat(l,"px) rotate(").concat(w,"deg) scale(").concat(m,")")}),controls:!1}),(Array.isArray(i)?i:[{src:i}]).map(function(A){return ke.createElement("source",ie({key:A.src},A))})),this.state.cropSize&&ke.createElement("div",ie({ref:this.cropperRef,style:ie(ie({},z),{width:k?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:k?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:He("reactEasyCrop_CropArea",x==="round"&&"reactEasyCrop_CropAreaRound",N&&"reactEasyCrop_CropAreaGrid",y)},b)))},o.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:kr,minZoom:vr,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:jr},o.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},o.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},o}(ke.Component);const xt=he,Sr=a=>new Promise((o,e)=>{const r=new Image;r.addEventListener("load",()=>o(r)),r.addEventListener("error",n=>e(n)),r.setAttribute("crossOrigin","anonymous"),r.src=a}),It=a=>a*Math.PI/180,_r=(a,o,e)=>{const r=It(e);return{width:Math.abs(Math.cos(r)*a)+Math.abs(Math.sin(r)*o),height:Math.abs(Math.sin(r)*a)+Math.abs(Math.cos(r)*o)}},Rr=async(a,o,e="image/jpeg",r=0)=>{const n=await Sr(a),s=document.createElement("canvas"),i=s.getContext("2d");if(!i)throw new Error("Canvas context is not available");const c=It(r),{width:b,height:p}=_r(n.width,n.height,r);s.width=b,s.height=p,i.translate(b/2,p/2),i.rotate(c),i.translate(-n.width/2,-n.height/2),i.drawImage(n,0,0);const h=document.createElement("canvas"),u=h.getContext("2d");if(!u)throw new Error("Canvas context is not available");return h.width=o.width,h.height=o.height,u.drawImage(s,o.x,o.y,o.width,o.height,0,0,o.width,o.height),new Promise((l,w)=>{h.toBlob(m=>{if(!m){w(new Error("Image cropping failed"));return}l(m)},e,.95)})},zt=({isOpen:a,imageSrc:o,fileType:e="image/jpeg",fileName:r="cropped-image",aspect:n=1/1,title:s="Crop Image",onClose:i,onApply:c})=>{const[b,p]=g.useState({x:0,y:0}),[h,u]=g.useState(1),[l,w]=g.useState(null);g.useEffect(()=>{a&&(p({x:0,y:0}),u(1),w(null))},[a]);const m=g.useCallback((N,k)=>{w(k)},[]),x=async()=>{var N,k;if(!(!o||!l))try{const S=await Rr(o,l,e),L=((k=(N=e==null?void 0:e.split("/"))==null?void 0:N[1])==null?void 0:k.replace("jpeg","jpg"))||"jpg",z=new File([S],`${r}.${L}`,{type:e});c==null||c(z)}catch{i==null||i()}};return a?t.jsxs("div",{className:v(f.mediaPicker.cropModal,"fixed inset-0 z-50 flex items-center justify-center p-4"),children:[t.jsx("div",{className:"fixed inset-0 bg-gray-500 opacity-75",onClick:i}),t.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col dark:bg-gray-800",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:s}),t.jsx("button",{type:"button",onClick:i,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close crop modal",children:t.jsx(ue.Icon,{icon:"mdi:close",className:"w-6 h-6"})})]}),t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("div",{className:"relative h-72 w-full bg-gray-900 rounded-md overflow-hidden",children:o&&t.jsx(Nr,{image:o,crop:b,zoom:h,aspect:n,onCropChange:p,onZoomChange:u,onCropComplete:m})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Zoom"}),t.jsx("input",{type:"range",min:1,max:3,step:.1,value:h,onChange:N=>u(Number(N.target.value)),className:"w-full"})]})]}),t.jsxs("div",{className:"px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:!px-6",children:[t.jsx(xt,{type:"button",onClick:i,variant:"outlined",color:"default",children:"Cancel"}),t.jsx(xt,{type:"button",onClick:x,variant:"contained",color:"primary",children:"Apply Crop"})]})]})]}):null},Cr=he,Ne=a=>{typeof a=="string"&&a.startsWith("blob:")&&URL.revokeObjectURL(a)},Mr=({label:a="",value:o=null,onChange:e,required:r=!1,accept:n="image/*",aspect:s="1",id:i,dragDrop:c=!1,cropImage:b=!1,name:p="",parentClass:h="",errorMessage:u=""})=>{const[l,w]=g.useState(o),[m,x]=g.useState(!1),[N,k]=g.useState(!1),[S,L]=g.useState(""),[z,F]=g.useState("image/jpeg"),[P,U]=g.useState("cropped-image"),y=g.useRef(null),_=g.useRef(""),C=g.useRef("");g.useEffect(()=>{if(o instanceof File){const D=URL.createObjectURL(o);Ne(C.current),C.current=D,w({file:o,preview:D})}else o&&typeof o=="object"&&"preview"in o,w(o)},[o]),g.useEffect(()=>()=>{Ne(C.current),Ne(_.current)},[]);const A=()=>{k(!1),Ne(_.current),_.current="",L(""),y.current&&(y.current.value="")},B=D=>{const R=URL.createObjectURL(D);Ne(C.current),C.current=R,w({file:D,preview:R}),e==null||e(D),A()},G=D=>{if(!D||D.length===0)return;const R=D[0];if(b){const I=URL.createObjectURL(R);Ne(_.current),_.current=I,L(I),F(R.type||"image/jpeg"),U((R.name||"cropped-image").replace(/\.[^/.]+$/,"")),k(!0);return}const Y=URL.createObjectURL(R);Ne(C.current),C.current=Y,w({file:R,preview:Y}),e==null||e(R)},ee=D=>{D&&D.stopPropagation(),Ne(C.current),C.current="",w(null),e==null||e(null),y.current&&(y.current.value="")},te=D=>{c&&(D.preventDefault(),x(!0))},E=D=>{c&&(D.preventDefault(),x(!1))},se=D=>{var R,Y,I,le;c&&(D.preventDefault(),x(!1),(le=(I=(Y=(R=D.dataTransfer)==null?void 0:R.files)==null?void 0:Y[0])==null?void 0:I.type)!=null&&le.includes("image/")&&G(D.dataTransfer.files))},H=()=>{var D;(D=y.current)==null||D.click()},Q=l&&typeof l=="object"&&"preview"in l?l.preview:typeof l=="string"?l:"";return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:v(f.mediaPicker.image,f.field.wrapper,h||"col-span-12"),children:[t.jsx(be,{label:a,required:r}),t.jsxs("div",{className:v(f.mediaPicker.dropzone,"relative rounded-md p-2 transition-all",m?"border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",u?"border-red-500":""),onDragOver:te,onDragLeave:E,onDrop:se,id:`field-${p}`,children:[t.jsx("input",{ref:y,id:i,type:"file",accept:n,onChange:D=>G(D.target.files),required:r&&!l,className:"absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"}),t.jsxs("div",{className:`flex items-center space-x-4 transition-all ${m?"opacity-50":""}`,children:[l?t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:Q,alt:"preview",className:"object-cover w-20 h-20 rounded-full shadow-md"}),!r&&t.jsx("button",{type:"button",onClick:ee,className:"absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2","aria-label":"Remove image",children:t.jsx(ue.Icon,{icon:"mdi:close",className:"w-3 h-3"})})]}):t.jsx("div",{className:"rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center",children:t.jsx(ue.Icon,{icon:"ri:image-add-fill",className:"text-gray-400 w-10 h-10"})}),t.jsxs("div",{className:"flex flex-col items-center space-y-1",children:[t.jsx(Cr,{type:"button",onClick:H,variant:"outlined",color:"default",children:l?"Change Image":"Select Image"}),c&&!l&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"or drag and drop"})]})]}),c&&m&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md",children:t.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold text-lg",children:"Drop image here"})})]}),u&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:u})]},p),t.jsx(zt,{isOpen:N,imageSrc:S,fileType:z,fileName:P,onClose:A,onApply:B,aspect:Number(s)})]})},Ot=g.forwardRef(({label:a,value:o,name:e,required:r,parentClass:n="",className:s="",type:i="text",onKeyDown:c,negativeNumberAllow:b=!0,defaultValue:p="",field:h={},onChange:u,mask:l="",errorMessage:w="",maskApplyOnValue:m=!0,...x},N)=>{const[k,S]=g.useState(!1),L=P=>{if(i==="number"){if(["e","E","+"].includes(P.key)){P.preventDefault();return}if(b==!1&&P.key==="-"){P.preventDefault();return}if(["ArrowUp","ArrowDown"].includes(P.key)){P.preventDefault();return}}c==null||c(P)},z=v(f.field.input,"h-10 placeholder-gray-400 dark:placeholder-gray-400",i==="password"?"pr-10":"",i==="number"?"no-spinner":"",s,w?"border-red-500":"");function F(P,U){if(!P)return P;const y=String(P).replace(/[^a-zA-Z0-9]/g,"");let _="",C=0;for(let A=0;A<(U==null?void 0:U.length)&&C<y.length;A++){const B=U[A],G=y[C];B==="9"?/\d/.test(G)?(_+=G,C++):(C++,A--):B==="A"?/[a-zA-Z]/.test(G)?(_+=G,C++):(C++,A--):B==="X"?/[a-zA-Z0-9]/.test(G)?(_+=G,C++):(C++,A--):B==="*"?(_+=G,C++):(_+=B,G===B&&C++)}return _}return g.useEffect(()=>{if(p){const P=o||p;setTimeout(()=>{u==null||u(P)},100)}},[p]),t.jsx(t.Fragment,{children:t.jsxs("div",{className:v(f.field.wrapper,n||"col-span-12"),children:[t.jsx(be,{label:a,required:r,infoText:h==null?void 0:h.infoText}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:i==="password"&&k?"text":i,ref:N,id:`field-${e}`,required:r,onKeyDown:L,className:z,value:l?F(o,l):o,onChange:P=>{u(l&&m?F(P.target.value,l):P.target.value)},...x}),w&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:w}),i==="password"&&t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>S(P=>!P),className:"absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",children:t.jsx(ue.Icon,{icon:k?"mdi:eye-outline":"mdi:eye-off-outline",className:"w-5 h-5"})})]})]},e)})});Ot.displayName="Input";const Dr=({editorKey:a="",value:o="",name:e="",onChange:r,label:n="",required:s=!1,placeholder:i="",parentClass:c="col-span-12",height:b=400,inline:p=!1,disabled:h=!1,plugins:u,toolbar:l,menubar:w=!1,fontFamily:m="Inter, sans-serif",initConfig:x={},imageUploadHandler:N,errorMessage:k=""})=>{const S=["advlist","autolink","lists","link","image","charmap","preview","anchor","searchreplace","visualblocks","code","fullscreen","insertdatetime","media","table","help","wordcount"],L="undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",z=F=>new Promise((P,U)=>{if(!N){P(`data:${F.blob().type};base64,${F.base64()}`);return}N(F).then(y=>{y?P(y):U("Upload failed: No URL returned")}).catch(y=>{U(typeof y=="string"?y:(y==null?void 0:y.message)||"Image upload failed")})});return t.jsxs("div",{className:v(f.field.wrapper,c),id:`field-${e}`,children:[n&&t.jsx(be,{label:n,required:s}),t.jsx(Wt.Editor,{apiKey:a,value:o,disabled:h,init:{height:b,inline:p,menubar:w,branding:!1,statusbar:!0,automatic_uploads:!0,images_upload_handler:z,plugins:u??S,toolbar:l??L,placeholder:i,content_style:`
133
122
  body {
134
123
  font-family: ${m};
124
+ border: ${k?"1px solid blue":""};
135
125
  }
136
- `,...g},onEditorChange:L=>{e==null||e(L)}})]})},wr=({name:n="",label:a="",options:e=[],value:r=null,onChange:o,disabled:i=!1,required:s=!1,parentClass:c="col-span-12",className:f="",multiSelect:d=!1})=>{const p=Array.isArray(e)&&e.length>0,h=g=>p?d?Array.isArray(r)&&r.includes(g):r===g:!!r,l=g=>{o==null||o(g.target.checked,n)},m=(g,j)=>{if(o)if(!d)o(j?g:"",n);else{const v=Array.isArray(r)?[...r]:[];if(j)v.includes(g)||v.push(g);else{const R=v.indexOf(g);R>-1&&v.splice(R,1)}o(v,n)}};return p?t.jsx(t.Fragment,{children:t.jsxs("div",{className:`${c}`,children:[t.jsx(Q,{label:a,required:s}),t.jsx("div",{className:"flex flex-col space-y-2",children:e.map((g,j)=>t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",name:n,value:g.value,checked:h(g.value),disabled:i||!!g.disabled,required:s&&j===0,onChange:v=>m(g.value,v.target.checked),className:`h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${f}`},n),g.label&&t.jsx("label",{htmlFor:n,className:"ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",children:g.label})]},g.value||g.label))})]})}):t.jsxs("div",{className:`flex items-center ${c}`,children:[t.jsx("input",{type:"checkbox",name:n,checked:h(),disabled:i,required:s,onChange:l,className:`h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${f}`}),a&&t.jsx("label",{htmlFor:n,className:"ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",children:a})]})},dt=ae,jr=({label:n="",value:a=null,onChange:e,required:r=!1,accept:o="audio/*",id:i,dragDrop:s=!1,name:c="",parentClass:f="",maxSize:d=0})=>{const[p,h]=b.useState(null),[l,m]=b.useState(!1),g=b.useRef(null),j=d*1024*1024;b.useEffect(()=>{if(!a){v(),h(null);return}if(a instanceof File){const x=URL.createObjectURL(a);return h({file:a,preview:x}),()=>{URL.revokeObjectURL(x)}}else typeof a=="string"?h({preview:a}):a!=null&&a.preview&&h(a)},[a]);const v=()=>{p!=null&&p.preview&&p.preview.startsWith("blob:")&&URL.revokeObjectURL(p.preview)},R=x=>{if(!x||x.length===0)return;const w=x[0];if(j&&w.size>j){le.enqueueSnackbar(`Audio is too large. Maximum allowed size is ${d} MB`,{variant:"warning"});return}const S=URL.createObjectURL(w);v(),h({file:w,preview:S}),e==null||e(w)},A=x=>{x&&x.stopPropagation(),v(),h(null),e==null||e(null),g.current&&(g.current.value="")},L=x=>{s&&(x.preventDefault(),m(!0))},C=x=>{s&&(x.preventDefault(),m(!1))},I=x=>{var w,S,D,P;s&&(x.preventDefault(),m(!1),(P=(D=(S=(w=x.dataTransfer)==null?void 0:w.files)==null?void 0:S[0])==null?void 0:D.type)!=null&&P.includes("audio/")&&R(x.dataTransfer.files))},E=()=>{var x;(x=g.current)==null||x.click()};return t.jsxs("div",{className:f||"col-span-12",children:[t.jsx(Q,{label:n,required:r}),t.jsxs("div",{className:`relative rounded-lg p-2 transition-all ${l?"border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,onDragOver:L,onDragLeave:C,onDrop:I,children:[t.jsx("input",{ref:g,id:i,type:"file",accept:o,onChange:x=>R(x.target.files),required:r&&!p,className:"absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"}),t.jsx("div",{className:`flex items-center space-x-4 transition-all ${l?"opacity-50":""}`,children:p?t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("div",{className:"relative w-full",children:[!r&&t.jsx("button",{type:"button",onClick:A,className:"absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800","aria-label":"Remove audio",children:t.jsx(ce.Icon,{icon:"mdi:close",className:"w-3 h-3"})}),t.jsx("audio",{src:p.preview,controls:!0,controlsList:"nodownload"},p.preview)]}),t.jsx(dt,{type:"button",onClick:E,children:t.jsx("span",{children:"Change Audio File"})})]}):t.jsxs("div",{className:"flex items-center justify-center space-x-4",children:[t.jsx("div",{className:"rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center",children:t.jsx(ce.Icon,{icon:"mdi:music",className:"text-gray-400 w-10 h-10"})}),t.jsx(dt,{type:"button",onClick:E,variant:"outlined",children:t.jsx("span",{children:"Choose Audio File"})}),s&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"or drag and drop your audio file here"})]})}),s&&l&&!p&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg",children:t.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg",children:"Drop audio here"})})]})]},c)},Qe=({src:n,alt:a="preview",isOpen:e,setIsOpen:r})=>{const o=()=>r(!1);return b.useEffect(()=>{const i=s=>{s.key==="Escape"&&o()};return e&&(document.body.style.overflow="hidden",document.addEventListener("keydown",i)),()=>{document.body.style.overflow="",document.removeEventListener("keydown",i)}},[e]),t.jsx(t.Fragment,{children:t.jsxs("div",{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
137
- backdrop-blur-sm animate-in fade-in duration-200`,onClick:o,children:[t.jsx("button",{onClick:o,className:`absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
138
- hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,children:t.jsx(U.X,{size:20})}),t.jsx("div",{className:"max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",onClick:i=>i.stopPropagation(),children:t.jsx("img",{src:n,alt:a,className:"w-full max-h-[90vh] object-contain rounded-xl"})})]})})},Ct=({col:n,data:a})=>{const e=a[n.titleKey],r=a[n.subtitleKey],o=a[n.imageKey],i=n.fallback_icon,[s,c]=b.useState(null),[f,d]=b.useState(!1),p=h=>{let l=h;h&&h.src instanceof File&&(l={...h,src:URL.createObjectURL(h.src)}),c(l),d(!0)};return t.jsxs(t.Fragment,{children:[f&&s&&t.jsx(Qe,{src:s.src,alt:s.alt,isOpen:f,setIsOpen:d}),t.jsxs("div",{className:`col-span-12 flex items-center space-x-4 p-4 rounded-xl
139
- bg-gray-100 dark:bg-gray-900
140
- ${n.blockClass}`,children:[o?t.jsx("img",{src:o instanceof File?URL.createObjectURL(o):o,alt:e,onClick:()=>p({src:o,alt:e}),className:"w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"}):i?i instanceof Function?i(a):i:t.jsx("div",{className:"w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600",children:t.jsx(U.User,{className:"w-8 h-8 text-gray-400"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:e}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:r})]})]})]})},Dt=({col:n,data:a})=>{const e=a[n.titleKey],r=a[n.subtitleKey],o=a[n.imageKey],i=n.label,s=n==null?void 0:n.icon,c=n.fallback_icon,[f,d]=b.useState(null),[p,h]=b.useState(!1),l=m=>{let g=m;m&&m.src instanceof File&&(g={...m,src:URL.createObjectURL(m.src)}),d(g),h(!0)};return t.jsxs(t.Fragment,{children:[p&&f&&t.jsx(Qe,{src:f.src,alt:f.alt,isOpen:p,setIsOpen:h}),t.jsxs("div",{className:`col-span-12 flex items-center space-x-4 p-4 rounded-xl
141
- bg-gray-100 dark:bg-gray-900
142
- ${n.blockClass}`,children:[s&&t.jsx("div",{className:"flex-shrink-0",children:s}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:i}),t.jsxs("div",{className:"flex items-center",children:[o?t.jsx("img",{src:o instanceof File?URL.createObjectURL(o):o,alt:e,onClick:()=>l({src:o,alt:e}),className:"w-8 h-8 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"}):c?c instanceof Function?c(a):c:t.jsx("div",{className:"w-8 h-8 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600",children:t.jsx(U.User,{className:"w-6 h-6 text-gray-400"})}),t.jsxs("div",{className:"ml-2",children:[t.jsx("p",{className:"mb-0 text-sm text-gray-900 dark:text-white break-words",children:e}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:r})]})]})]})]})]})},ut={blue:{bg:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",border:"border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"},teal:{bg:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",border:"border border-teal-300 text-teal-700 dark:border-teal-700 dark:text-teal-300"},purple:{bg:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",border:"border border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300"},yellow:{bg:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",border:"border border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300"},green:{bg:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",border:"border border-green-300 text-green-700 dark:border-green-700 dark:text-green-300"},red:{bg:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",border:"border border-red-300 text-red-700 dark:border-red-700 dark:text-red-300"},gray:{bg:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",border:"border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"}},ht={contained:"bg",outline:"border !bg-transparent",soft:"bg opacity-90"},Et=({label:n,variant:a="contained",color:e="green",className:r=""})=>{const o=ut[e]||ut.green,i=ht[a]||ht.contained,s=a==="outline"?o.border:o.bg;return t.jsx("span",{className:`inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
143
- ${s}
144
- ${i}
145
- ${r}`,children:n})},_t=({col:n,data:a})=>{var f;const e=n==null?void 0:n.icon,r=n.label;let o=a[n.key];const i=n.type,s=n.variant||"outline";let c=n.defaultColor;if(i==="chip"&&((f=n.chipOptions)==null?void 0:f.length)>0){const d=n==null?void 0:n.chipOptions.find(p=>p.value==o);d&&(o=d.label,c=d.color)}return t.jsxs("div",{className:`col-span-12 flex items-center space-x-4 p-4 rounded-xl
146
- bg-gray-100 dark:bg-gray-900 ${n.blockClass||""}`,children:[e&&t.jsx("div",{className:"flex-shrink-0",children:e}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:r}),i==="chip"?t.jsx(Et,{label:o,variant:s,color:c,className:"mt-1"}):i==="tinyEditor"?t.jsx("p",{className:"mt-1 text-sm text-gray-900 dark:text-white break-words",dangerouslySetInnerHTML:{__html:o}}):i==="audio"?o?t.jsx("audio",{controls:!0,src:o instanceof File?URL.createObjectURL(o):o,onClick:d=>d.stopPropagation(),className:"shadow-md rounded-full mt-1"},o instanceof File?URL.createObjectURL(o):o):t.jsx("p",{className:"mt-1 text-sm text-gray-400",children:"N/A"}):t.jsx("p",{className:"mt-1 text-sm text-gray-900 dark:text-white break-words",children:i=="date"?t.jsx("span",{children:gt(o,n.format||"DD MMM YYYY")}):o||"N/A"})]})]})},kr=({value:n=!0,onChange:a,text:e,options:r=[],label:o,required:i,name:s="",disabled:c=!1,parentClass:f=""})=>{const d=r.length>0?r:[{label:"Active",value:!0},{label:"Inactive",value:!1}];return t.jsx(t.Fragment,{children:t.jsxs("div",{className:f||"col-span-12",children:[t.jsx(Q,{label:o,required:i}),t.jsxs("div",{className:"flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600",children:[e&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:e}),t.jsx("div",{className:"flex items-center gap-6",children:d.map((p,h)=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx("input",{type:"radio",name:"switch-field",required:i&&h===0,value:String(p.value),disabled:c,checked:n===p.value,onChange:()=>a==null?void 0:a(p.value),className:"w-4 h-4 border-gray-300 cursor-pointer"}),t.jsx("span",{className:"text-sm text-gray-700 dark:text-white",children:p.label})]},h))})]})]},s)})},pt=ae,Sr=({label:n="",value:a=null,onChange:e,required:r=!1,accept:o="video/*",id:i,dragDrop:s=!1,name:c="",parentClass:f="",maxSize:d=0})=>{const[p,h]=b.useState(null),[l,m]=b.useState(!1),g=b.useRef(null),j=d*1024*1024;b.useEffect(()=>{if(!a){v(),h(null);return}if(a instanceof File){const x=URL.createObjectURL(a);return h({file:a,preview:x}),()=>{URL.revokeObjectURL(x)}}else typeof a=="string"?h({preview:a}):a!=null&&a.preview&&h(a)},[a]);const v=()=>{p!=null&&p.preview&&p.preview.startsWith("blob:")&&URL.revokeObjectURL(p.preview)},R=x=>{if(!x||x.length===0)return;const w=x[0];if(j&&w.size>j){le.enqueueSnackbar(`File is too large. Maximum allowed size is ${d} MB`,{variant:"warning"});return}const S=URL.createObjectURL(w);v(),h({file:w,preview:S}),e==null||e(w)},A=x=>{x&&x.stopPropagation(),v(),h(null),e==null||e(null),g.current&&(g.current.value="")},L=x=>{s&&(x.preventDefault(),m(!0))},C=x=>{s&&(x.preventDefault(),m(!1))},I=x=>{var w,S,D,P;s&&(x.preventDefault(),m(!1),(P=(D=(S=(w=x.dataTransfer)==null?void 0:w.files)==null?void 0:S[0])==null?void 0:D.type)!=null&&P.includes("video/")&&R(x.dataTransfer.files))},E=()=>{var x;(x=g.current)==null||x.click()};return t.jsxs("div",{className:f||"col-span-12",children:[t.jsx(Q,{label:n,required:r}),t.jsxs("div",{className:`relative rounded-lg p-2 transition-all ${l?"border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,onDragOver:L,onDragLeave:C,onDrop:I,children:[t.jsx("input",{ref:g,id:i,type:"file",accept:o,onChange:x=>R(x.target.files),required:r&&!p,className:"absolute opacity-0 pointer-events-none h-[10px]"}),t.jsx("div",{className:`flex items-center space-x-4 transition-all ${l?"opacity-50":""}`,children:p?t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("div",{className:"relative",children:[!r&&t.jsx("button",{type:"button",onClick:A,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 shadow hover:bg-red-600 z-10",children:t.jsx(ce.Icon,{icon:"mdi:close",className:"w-3 h-3"})}),t.jsx("video",{src:p.preview,controls:!0,controlsList:"nodownload",className:"w-[260px] h-[150px] rounded-md object-cover"},p.preview)]}),t.jsx(pt,{type:"button",onClick:E,children:"Change Video File"})]}):t.jsxs("div",{className:"flex items-center justify-center space-x-4",children:[t.jsx("div",{className:"rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center",children:t.jsx(ce.Icon,{icon:"mdi:video",className:"text-gray-400 w-10 h-10"})}),t.jsx(pt,{type:"button",onClick:E,variant:"outlined",children:"Choose Video File"}),s&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"or drag and drop your video here"})]})}),s&&l&&!p&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg",children:t.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg",children:"Drop video here"})})]})]},c)},Pt=({field:n,formData:a,handleChange:e})=>{const{key:r,label:o,type:i,options:s,placeholder:c,rows:f,inputClass:d,search:p,accept:h,text:l,required:m=!1,minLength:g,dragDrop:j,parentClass:v,countriesList:R,defaultCountry:A,multiple:L,dropdownMaxHeight:C,editorKey:I,fontFamily:E,disabled:x,negativeNumberAllow:w,defaultValue:S,renderCondition:D,pattern:P,renderType:Y,cropImage:ee,aspectRatio:G,dependencyKey:N,mask:X,maskApplyOnValue:B,maxSize:M}=n;let k=a==null?void 0:a[r];k==null&&(k="");const z=c||(i==="select"?`Select ${o}`:`Enter ${o}`),H="w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";if(D&&typeof D=="function"&&!D(a))return null;if(Y&&Y=="details")switch(i){case"group":return t.jsx(Ct,{col:n,data:a});case"cardGroup":return t.jsx(Dt,{col:n,data:a});default:return t.jsx(_t,{col:n,data:a})}switch(i){case"select":return t.jsx(zt,{options:s||[],value:k,formData:a,dependencyKey:N,onChange:F=>e(r,F),placeholder:z,className:d||"",search:p,required:m,defaultValue:S,label:o||"",name:r,disabled:x,parentClass:v||"",multiple:L,dropdownMaxHeight:C});case"checkbox":return t.jsx(wr,{name:r,label:o||"",options:s||[],value:k,onChange:F=>e(r,F),required:m,parentClass:v||"",className:d||"",multiSelect:L,disabled:x});case"radio":return t.jsx(kr,{value:k,onChange:F=>e(r,F),text:l,options:s||[],label:o||"",required:m,name:r,disabled:x,parentClass:v||""});case"switch":return t.jsx(mt,{value:!!k,onChange:F=>e(r,F),label:o||"",required:m,name:r,disabled:x,className:"",parentClass:v||""});case"phone":return t.jsx(Bt,{value:k,onChange:F=>e(r,F),countriesList:R,defaultCountry:A,required:m,placeholder:z,search:p,label:o||"",name:r,disabled:x,parentClass:v||""});case"textarea":return t.jsx(xt,{value:k,onChange:F=>e(r,F.target.value),placeholder:z,rows:f||3,className:`${H} ${d||""}`,required:m,name:r,label:o||"",disabled:x,parentClass:v||""});case"image":return t.jsx(yr,{value:k,onChange:F=>e(r,F),required:m,accept:h||"image/*",aspect:G,id:`file-${r}`,dragDrop:j,cropImage:ee,label:o||"",name:r,parentClass:v||""});case"audio":return t.jsx(jr,{value:k,onChange:F=>e(r,F),required:m,accept:h||"audio/*",id:`file-${r}`,dragDrop:j,label:o||"",name:r,parentClass:v||"",maxSize:M});case"video":return t.jsx(Sr,{value:k,onChange:F=>e(r,F),required:m,accept:h||"video/*",id:`file-${r}`,dragDrop:j,label:o||"",name:r,maxSize:M,parentClass:v||""});case"tinyEditor":return t.jsx(vr,{value:k,onChange:F=>e(r,F),required:m,placeholder:z,label:o||"",parentClass:v||"",fontFamily:E,editorKey:I||"",disabled:x});default:return t.jsx(Rt,{field:n,type:i||"text",defaultValue:S,value:k,onChange:F=>e(r,F),placeholder:z,className:`${H} ${d||""}`,required:m,name:r,minLength:g,label:o||"",negativeNumberAllow:w,parentClass:v||"",disabled:x,pattern:P,mask:X,maskApplyOnValue:B})}},Nr=({isOpen:n,onClose:a,config:e,onApply:r})=>{var p;const[o,i]=b.useState({}),s=(h,l)=>{i(m=>({...m,[h]:l}))},c=()=>{r(o),a()},f=()=>{i({}),r({}),a()},d=e==null?void 0:e.component;return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${n?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,onClick:a}),t.jsxs("div",{className:`fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
147
- transform transition-transform duration-300 ease-in-out
148
- ${n?"translate-x-0":"translate-x-full"}
149
- `,children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Filters"}),t.jsx("button",{onClick:a,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",children:t.jsx(U.X,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),n&&t.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:d?t.jsx(d,{filters:o,onFilterChange:s}):t.jsx("div",{className:"space-y-4",children:(p=e==null?void 0:e.fields)==null?void 0:p.map(h=>t.jsx(Pt,{field:h,formData:o,handleChange:s},h.key))})}),t.jsxs("div",{className:"flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700",children:[t.jsx(ae,{onClick:c,variant:"contained",color:"primary",fullWidth:!0,children:"Apply Filters"}),t.jsx(ae,{onClick:f,variant:"contained",className:"min-w-[150px]",children:"Reset"})]})]})]})},Mr=({rows:n=5,columns:a=5})=>t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-full mb-6 inline-flex justify-end items-center",children:t.jsx("div",{className:"h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse"})}),t.jsx("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:t.jsxs("table",{className:"w-full border-collapse",children:[t.jsx("thead",{children:t.jsx("tr",{className:"bg-gray-50 dark:bg-gray-900",children:Array.from({length:a}).map((e,r)=>t.jsx("th",{className:"px-4 py-3",children:t.jsx("div",{className:"h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center"})},r))})}),t.jsx("tbody",{children:Array.from({length:n}).map((e,r)=>t.jsx("tr",{className:"border-t border-gray-200 dark:border-gray-800",children:Array.from({length:a}).map((o,i)=>t.jsx("td",{className:"px-4 py-6",children:t.jsx("div",{className:"h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse"})},i))},r))})]})})]}),Rr=({options:n=[],value:a="",onChange:e,clearLabel:r=""})=>{const[o,i]=b.useState(!1),s=b.useRef(null),c=!!a;b.useEffect(()=>{const d=p=>{s.current&&!s.current.contains(p.target)&&i(!1)};return document.addEventListener("click",d),()=>document.removeEventListener("click",d)},[]);const f=d=>{const p=n.find(h=>h.value===d);e(d,p||null),i(!1)};return n!=null&&n.length?t.jsxs("div",{className:"relative",ref:s,children:[t.jsxs("button",{type:"button",onClick:()=>i(d=>!d),className:"relative inline-flex items-center justify-center h-[36px] w-[36px] rounded-md border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600 transition","aria-label":"Open sort options",children:[t.jsx(U.ArrowUpDown,{className:"w-4 h-4"}),c&&t.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"})]}),o&&t.jsxs("div",{className:"absolute right-0 mt-2 z-20 min-w-[220px] max-h-[260px] overflow-auto rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg",children:[!!(r!=null&&r.trim())&&t.jsx("button",{type:"button",onClick:()=>f(""),className:`w-full text-left px-3 py-2 text-sm transition hover:bg-gray-100 dark:hover:bg-gray-700 ${a?"text-gray-700 dark:text-gray-200":"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white"}`,children:r}),n.map(d=>t.jsx("button",{type:"button",onClick:()=>f(d.value),className:`w-full text-left px-3 py-2 text-sm transition hover:bg-gray-100 dark:hover:bg-gray-700 ${a===d.value?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-700 dark:text-gray-200"}`,children:d.label},d.value))]})]}):null},Ge={enabled:!1,useServerSideSorting:!1,options:[],fields:[],defaultValue:"",autoGenerate:!0,clearLabel:"",onChange:null},Cr=n=>n===!0?{...Ge,enabled:!0}:!n||typeof n!="object"?Ge:{...Ge,...n,enabled:n.enabled??!0,autoGenerate:n.autoGenerate??!0},Dr=(n=[])=>n.filter(a=>{const e=["menu_actions","index","audio","avatar"];return a.type&&e.includes(a.type)?!1:!!(a.sortKey||(a.type==="group"?a.titleKey:a.key))}),Er=n=>{if(n.sortType)return n.sortType;if(n.type==="date")return"date";if(n.type==="number")return"number";const a=String(n.sortKey||(n.type==="group"?n.titleKey:n.key)||"").toLowerCase();return["phone","mobile","contact","tel","whatsapp"].some(r=>a.includes(r))?"phone":Array.isArray(n.chipOptions)&&n.chipOptions.length>0&&n.chipOptions.every(o=>typeof o.value=="boolean")?"boolean":"string"},ft=(n=[])=>n.flatMap(a=>{const e=a.sortKey||(a.type==="group"?a.titleKey:a.key),r=a.sortLabel||a.title||e,o=Er(a);return e?o==="number"?[{value:`${e}_asc`,label:`${r} (Low-High)`,key:e,order:"asc",type:o},{value:`${e}_desc`,label:`${r} (High-Low)`,key:e,order:"desc",type:o}]:o==="phone"?[{value:`${e}_asc`,label:`${r} (0-9)`,key:e,order:"asc",type:o},{value:`${e}_desc`,label:`${r} (9-0)`,key:e,order:"desc",type:o}]:o==="date"?[{value:`${e}_desc`,label:`${r} (Newest First)`,key:e,order:"desc",type:o},{value:`${e}_asc`,label:`${r} (Oldest First)`,key:e,order:"asc",type:o}]:o==="boolean"?[{value:`${e}_desc`,label:`${r} (True First)`,key:e,order:"desc",type:o},{value:`${e}_asc`,label:`${r} (False First)`,key:e,order:"asc",type:o}]:[{value:`${e}_asc`,label:`${r} (A-Z)`,key:e,order:"asc",type:o},{value:`${e}_desc`,label:`${r} (Z-A)`,key:e,order:"desc",type:o}]:[]}),_r=(n,a=[])=>{if(Array.isArray(n.options)&&n.options.length>0)return n.options.map(o=>({...o,type:o.type||"string",order:o.order==="desc"?"desc":"asc"}));const r=Array.isArray(n.fields)?n.fields:[];if(r.length>0){const o=r.map(i=>{const s=typeof i=="string"?i:i.key,c=a.find(f=>f.key===s||f.sortKey===s||f.type==="group"&&f.titleKey===s);return c?{...c,sortKey:typeof i=="object"&&i.key?i.key:c.sortKey,sortType:typeof i=="object"&&i.type?i.type:c.sortType,sortLabel:typeof i=="object"&&i.label?i.label:c.sortLabel}:null}).filter(i=>i!==null);return ft(o)}return n.autoGenerate?ft(a):[]},Pr=(n=[],a="",e,r=[])=>{if(!(e!=null&&e.enabled)||!a||e!=null&&e.useServerSideSorting)return n;const o=r==null?void 0:r.find(d=>d.value===a);if(!(o!=null&&o.key))return n;const i=o.order==="desc"?"desc":"asc",s=o.key,c=o.type||"string",f=d=>String(d??"").replace(/[^\d]/g,"").trim();return[...n].sort((d,p)=>{const h=d==null?void 0:d[s],l=p==null?void 0:p[s];if(h==null&&l==null)return 0;if(h==null)return i==="asc"?1:-1;if(l==null)return i==="asc"?-1:1;let m=0;return c==="number"?m=Number(h)-Number(l):c==="phone"?m=f(h).localeCompare(f(l),void 0,{numeric:!0}):c==="date"?m=new Date(h).getTime()-new Date(l).getTime():c==="boolean"?m=+!!h-+!!l:m=String(h).localeCompare(String(l)),i==="asc"?m:-m})},Ar=({config:n,setShowAdd:a,title:e,buttonText:r,description:o,showAddButton:i})=>{const{data:s=[],table_head:c=[],loading:f=!1,search:d={enabled:!1,placeholder:"Search...",useServerSideSearch:!1},filter:p={enabled:!1,useServerSideFilters:!1},sort:h={enabled:!1},pagination:l={enabled:!1,rows_per_page:10,useServerSidePagination:!1},emptyMessage:m="No data available",onMenuAction:g,setServerSidePaginationData:j=()=>{},onFilterApply:v,filterConfig:R=null,rowClick:A=null}=n,[L,C]=b.useState(""),[I,E]=b.useState(null),[x,w]=b.useState([]),[S,D]=b.useState({top:0,left:0}),[P,Y]=b.useState(!1),[ee,G]=b.useState({}),N=b.useMemo(()=>Cr(h),[h]),X=b.useMemo(()=>Dr(c),[c]),B=b.useMemo(()=>_r(N,X),[N,X]),[M,k]=b.useState((N==null?void 0:N.defaultValue)||""),[z,H]=b.useState(null),[F,te]=b.useState(!1),pe=b.useMemo(()=>!d.enabled||!L.trim()||d.useServerSideSearch?s:Ot(s,L,d.searchKeys||[]),[s,L,d]),ne=b.useMemo(()=>Pr(pe,M,N,B),[pe,M,N,B]),[V,re]=b.useState(1),[J,xe]=b.useState((l==null?void 0:l.rows_per_page)||50),[ye,Se]=b.useState(pe.length||0),fe=l!=null&&l.useServerSidePagination?l.total_pages:Math.ceil(pe.length/J),ve=b.useMemo(()=>{if(l.useServerSidePagination)return ne;const u=(V-1)*J;return ne.slice(u,u+J)},[ne,V,J,l.useServerSidePagination]),be=b.useRef(null),we=b.useRef({}),ge=b.useRef(null),Ne=u=>{C(u),re(1),d.useServerSideSearch&&(ge.current&&clearTimeout(ge.current),ge.current=setTimeout(async()=>{try{await j(y=>({...y,search:u,current_page:1}))}catch(y){console.error("Search error:",y)}},800))},Me=(u,y=null)=>{k(u),re(1);const T={value:u,option:y,key:(y==null?void 0:y.key)||"",order:(y==null?void 0:y.order)||"",type:(y==null?void 0:y.type)||""};typeof(N==null?void 0:N.onChange)=="function"&&N.onChange(T)},Re=(u,y,T)=>{T.stopPropagation(),E(null),g==null||g(u.type,y)},Ce=(u,y,T)=>{y.stopPropagation(),w(T);const $=y.currentTarget;we.current[u]=$;const Z=$.getBoundingClientRect(),se=192,de=T.length*40,Fe=window.innerWidth,et=window.innerHeight,At=Fe-Z.right<se?Z.left-se+Z.width:Z.left,Lt=et-Z.bottom<de&&Z.top>de?Z.top-de-2:Z.bottom+2;D({top:Math.max(8,Math.min(Lt,et-de-8)),left:Math.max(8,Math.min(At,Fe-se-8))}),E(I===u?null:u)},De=u=>(V-1)*J+u+1,Ee=u=>{let y=u;y&&y.src instanceof File&&(y={...y,src:URL.createObjectURL(y.src)}),H(y),te(!0)},je=(u,y,T,$=null,Z=null)=>t.jsx(t.Fragment,{children:u?t.jsx("img",{src:u instanceof File?URL.createObjectURL(u):u,alt:y||"Avatar",onClick:se=>{se.stopPropagation(),se.preventDefault(),Ee({src:u,alt:y})},className:`w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${T||""}`}):t.jsx(t.Fragment,{children:$?typeof $=="function"?$(Z):$:t.jsx("div",{className:`w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${T||""}`,children:t.jsx(U.User,{className:"w-6 h-6 text-gray-400 dark:text-gray-400"})})})}),_e=(u,y)=>t.jsx(t.Fragment,{children:u?t.jsx("audio",{controls:!0,src:u instanceof File?URL.createObjectURL(u):u,onClick:T=>{T.stopPropagation()},className:`w-64 cursor-pointer ${y||""}`},u instanceof File?URL.createObjectURL(u):u):t.jsx(t.Fragment,{children:t.jsx("div",{className:`w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${y||""}`,children:t.jsx(U.Music,{className:"w-6 h-6 text-gray-400 dark:text-gray-400"})})})}),Pe=(u,y)=>t.jsxs("div",{className:`flex items-center space-x-4 ${y.className||""}`,children:[y.imageKey?je(u[y.imageKey],u[y.titleKey],"group-avatar",y.fallback_icon,u):"",t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white group-title",children:u[y.titleKey]||""}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 group-sub-title",children:u[y.subtitleKey]||""})]})]}),Ae=(u,y)=>{var se;let T=String(u);const $=y.variant||"contained";let Z=y.defaultColor;if(((se=y==null?void 0:y.chipOptions)==null?void 0:se.length)>0){const de=y==null?void 0:y.chipOptions.find(Fe=>Fe.value==u);de&&(T=de.label,Z=de.color)}return t.jsx(Et,{label:T,variant:$,color:Z,className:y.className||""})},Le=(u,y,T)=>{const $=y[u.key];return u.type==="menu_actions"?t.jsx("div",{className:`text-center ${u.className||""}`,children:t.jsx("button",{ref:Z=>{we.current[y.id||y._id]=Z},onClick:Z=>Ce(y.id||y._id,Z,u.menuList),className:"p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300",children:t.jsx(U.EllipsisVertical,{className:"h-4 w-4"})})}):u.type==="index"?t.jsx("span",{className:u.className||"",children:De(T)}):u.type==="group"?Pe(y,u):u.type==="chip"?t.jsx(t.Fragment,{children:Ae($,u)}):u.type==="date"?t.jsx("span",{className:u.className||"",children:gt($,u.format||"DD MMM YYYY")}):u.type==="avatar"?t.jsx(t.Fragment,{children:t.jsx("div",{className:"min-w-[40px]",children:je($,u.alt,u.className,u.fallback_icon,y)})}):u.type==="audio"?t.jsx(t.Fragment,{children:_e($,u.className)}):t.jsx("span",{className:u.className||"",children:$||"N/A"})},_=u=>{if(typeof A=="function")return A(u);if(A)return g==null?void 0:g("view",u)},O=(u,y)=>{if(u.onClickDetails)return g==null?void 0:g("view",y);if(typeof u.handleClick=="function")return u.handleClick(y)},K=()=>A||typeof A=="function",oe=u=>u.onClickDetails||typeof u.handleClick=="function";return b.useEffect(()=>{const u=()=>{I&&E(null)};return window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("scroll",u,!0)}},[I]),b.useEffect(()=>{const u=y=>{be.current&&!be.current.contains(y.target)&&E(null)};return document.addEventListener("click",u),()=>document.removeEventListener("click",u)},[]),b.useEffect(()=>{l!=null&&l.rows_per_page&&(l!=null&&l.useServerSidePagination)&&xe((l==null?void 0:l.rows_per_page)||50),l.current_page&&re(l.current_page)},[l.rows_per_page,l==null?void 0:l.useServerSidePagination,l.current_page]),b.useEffect(()=>{Se(l!=null&&l.useServerSidePagination?l.total_records:ne.length),ne.length<=J*(V-1)&&!(l!=null&&l.useServerSidePagination)&&re(u=>u-1||1)},[ne.length,l.total_records,l==null?void 0:l.useServerSidePagination]),b.useEffect(()=>{if(!(N!=null&&N.enabled)){k("");return}if(B.some(y=>y.value===N.defaultValue)){k(N.defaultValue);return}k("")},[N,B]),b.useEffect(()=>{if(!(N!=null&&N.enabled)||!(N!=null&&N.useServerSideSorting))return;const u=B==null?void 0:B.find(y=>y.value===M);j(y=>({...y,current_page:1,sort_by:(u==null?void 0:u.key)||"",sort_order:(u==null?void 0:u.order)||""}))},[M,N==null?void 0:N.enabled,N==null?void 0:N.useServerSideSorting,B,j]),t.jsxs(t.Fragment,{children:[f?t.jsx(Mr,{rows:6,columns:6}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col lg:!flex-row lg:!justify-between gap-4 mb-3",children:[t.jsxs("div",{className:"table-heading",children:[t.jsx("h1",{children:e}),t.jsx("p",{children:o})]}),t.jsxs("div",{className:"flex flex-col justify-end items-stretch lg:!items-end gap-2 w-full lg:!w-auto",children:[i&&t.jsxs(ae,{onClick:()=>a(!0),variant:"contained",color:"primary",children:[t.jsx(U.Plus,{className:"w-4 h-4 mr-2"}),r||"Add New"]}),t.jsxs("div",{className:"flex flex-col sm:!flex-row sm:!flex-wrap justify-end items-stretch sm:!items-center gap-2 w-full",children:[d.enabled&&t.jsx("div",{className:"w-full sm:!w-auto",children:t.jsxs("div",{className:"table-search-field",children:[t.jsx(U.Search,{className:"search-icon"}),t.jsx("input",{type:"text",placeholder:d.placeholder||"Search...",value:L,onChange:u=>Ne(u.target.value)})]})}),N!=null&&N.enabled&&(B==null?void 0:B.length)>0||R&&p.enabled?t.jsxs("div",{className:"flex items-center justify-end gap-2 w-full sm:!w-auto",children:[R&&p.enabled&&t.jsxs("div",{className:"filter-button-wrapper",children:[t.jsxs(ae,{onClick:()=>Y(!0),variant:"contained",className:"w-full sm:!w-auto",children:[t.jsx(U.Filter,{className:"w-4 h-4 mr-2"}),"Filters"]}),Object.keys(ee).length>0&&t.jsx("span",{className:"red-dot"})]}),(N==null?void 0:N.enabled)&&(B==null?void 0:B.length)>0&&t.jsx(Rr,{options:B,value:M,onChange:Me,clearLabel:N==null?void 0:N.clearLabel})]}):null]})]})]}),t.jsxs("div",{className:"table-container",children:[t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{children:[t.jsx("thead",{children:t.jsx("tr",{children:c.map(u=>t.jsx("th",{className:`table-head-data ${u.headClass||""}`,children:u.title},u.key))})}),t.jsx("tbody",{children:ve.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:c.length,className:"no-data-message",children:m})}):ve.map((u,y)=>t.jsx("tr",{className:`table-row ${K()?"cursor-pointer":""}`,onClick:()=>{K()&&_(u)},children:c.map(T=>t.jsx("td",{className:`table-data ${T.type=="audio"?"":"max-w-[300px]"} truncate ${oe(T)?"cursor-pointer":""}`,title:String(u[T.key]??""),onClick:$=>{oe(T)&&($.stopPropagation(),$.preventDefault(),O(T,u))},children:T.render?T.render(u,y):Le(T,u,y)},T.key))},u.id||u._id||y))})]})}),(l==null?void 0:l.enabled)&&ne.length>0&&t.jsxs("div",{className:"pagination-wrapper",children:[t.jsxs("span",{children:["Showing ",(V-1)*J+1," to"," ",Math.min(V*J,ye)," of"," ",ye," results"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:"Rows per page:"}),t.jsx("select",{value:J,onChange:u=>{const y=Number(u.target.value);xe(y),re(1),l.useServerSidePagination&&j(T=>({...T,current_page:1,rows_per_page:y}))},className:"rows-number-select",children:[10,25,50,100].map(u=>t.jsx("option",{value:u,children:u},u))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>{if(V>1){const u=V-1;re(u),l.useServerSidePagination&&j(y=>({...y,current_page:u}))}},disabled:V===1,className:"arrow-icons",children:t.jsx(U.ChevronLeft,{className:"h-4 w-4"})}),t.jsxs("span",{children:["Page ",V," of ",fe]}),t.jsx("button",{onClick:()=>{if(V<fe){const u=V+1;re(u),l.useServerSidePagination&&j(y=>({...y,current_page:u}))}},disabled:V===fe,className:"arrow-icons",children:t.jsx(U.ChevronRight,{className:"h-4 w-4"})})]})]})]})]})]}),I&&Ft.createPortal(t.jsx("div",{ref:be,style:{position:"fixed",top:`${S.top}px`,left:`${S.left}px`,zIndex:9999},className:"w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",children:x.map((u,y)=>t.jsxs("button",{onClick:T=>Re(u,s.find($=>$.id===I||$._id==I),T),className:`w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${u.variant==="danger"?"text-red-600 dark:text-red-500":"text-gray-700 dark:text-gray-200"}`,children:[u.icon&&t.jsx("span",{className:"shrink-0",children:u.icon}),u.title]},y))}),document.body),R&&t.jsx(Nr,{isOpen:P,onClose:()=>Y(!1),config:R,onApply:u=>{G(u),v==null||v(u)}}),F&&z&&t.jsx(Qe,{src:z.src,alt:z.alt,isOpen:F,setIsOpen:te})]})},Oe=({isOpen:n,onClose:a,icon:e,title:r,children:o,size:i="md",actionButtons:s=[],onFormSubmit:c=()=>{},loadingBtn:f=!1,executeFunction:d=()=>{},selectedItem:p=null})=>{if(!n)return null;const h={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-full"};return t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[t.jsx("div",{className:"fixed inset-0 bg-gray-500 opacity-75",onClick:()=>a()}),t.jsxs("div",{className:`relative bg-white rounded-lg shadow-xl w-full ${h[i]||h.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[e&&t.jsx("span",{children:e}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:r})]}),t.jsx("button",{onClick:()=>a(),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:t.jsx(U.X,{className:"w-6 h-6"})})]}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:o}),s.length>0&&t.jsx("div",{className:"px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:!px-6",children:s.map((l,m)=>t.jsx(ae,{onClick:g=>{l.type=="submit"?c(g):d(()=>{var j;return Promise.resolve((j=l==null?void 0:l.onClick)==null?void 0:j.call(l,g,p))},j=>a==null?void 0:a(j))},disabled:f||l.disabled,variant:l.variant||"contained",color:l.color||"primary",className:`min-w-[100px] ${l.className||""}`,type:l.type||"button",children:f?t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2"}),l.label||"Submit","..."]}):l.label||"Submit"},`${l.label||"action"}-${m}`))})]})]})},bt=({config:n,onSubmit:a,initialData:e,fetchRowDetails:r,type:o})=>{const i=e||{},{formClass:s="grid grid-cols-12 gap-4",formFields:c=[]}=n||{},[f,d]=b.useState(i),[p,h]=b.useState(!0),l=async()=>{r==null||r(i).then(j=>{d(j.data)}).catch(j=>{le.enqueueSnackbar(j.message,{variant:"error"})}).finally(()=>{h(!1)})};b.useEffect(()=>{r instanceof Function?l():(d(i),h(!1))},[]);const m=(j,v)=>{d(R=>({...R,[j]:v}))},g=j=>{j.preventDefault();const v=j.currentTarget;if(!v.checkValidity()){v.reportValidity();return}a(f)};return p?t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsx("div",{className:"rounded-full border-4 border-blue-500 border-t-gray-200 animate-spin w-8 h-8",style:{borderTopColor:"border-primary-500"}})}):t.jsx("form",{id:o==="add"?"addForm":o==="edit"?"editForm":"defaultForm",onSubmit:g,className:s,noValidate:!1,children:c.map(j=>t.jsx(Pt,{field:j,formData:f,handleChange:m},j.key))})};function Lr({data:n,config:a,fetchRowDetails:e}){const{fields:r=[],containerClass:o}=a||{},i=n||{},[s,c]=b.useState(i),[f,d]=b.useState(!0),p=async()=>{e==null||e(i).then(h=>{c(h.data)}).catch(h=>{le.enqueueSnackbar(h.message,{variant:"error"})}).finally(()=>{d(!1)})};return b.useEffect(()=>{e instanceof Function?p():(c(i),d(!1))},[]),f?t.jsx("div",{className:"flex items-center justify-center h-64",children:t.jsx("div",{className:"rounded-full border-4 border-blue-500 border-t-gray-200 animate-spin w-8 h-8",style:{borderTopColor:"border-primary-500"}})}):t.jsx(t.Fragment,{children:t.jsx("div",{className:`grid grid-cols-12 gap-4 ${o||""}`,children:r.map(h=>h.renderCondition&&typeof h.renderCondition=="function"&&!h.renderCondition(s)?null:h.type=="group"?t.jsx(Ct,{col:h,data:s},h.key||h.titleKey):h.type=="cardGroup"?t.jsx(Dt,{col:h,data:s},h.key||h.titleKey):t.jsx(_t,{col:h,data:s},h.key||h.label))})})}const Fr=({config:n})=>{var J,xe,ye,Se,fe,ve,be,we,ge,Ne,Me,Re,Ce,De,Ee,je,_e,Pe,Ae,Le;const{title:a,fetchData:e,fetchRowDetails:r,isStaticData:o=!1,tableConfig:i,modalConfig:s,filterConfig:c}=n,[f,d]=b.useState(!0),[p,h]=b.useState(!1),[l,m]=b.useState([]),[g,j]=b.useState(null),[v,R]=b.useState({search:"",rows_per_page:50,current_page:1,sort_by:"",sort_order:""}),[A,L]=b.useState({}),[C,I]=b.useState(!1),[E,x]=b.useState(!1),[w,S]=b.useState(!1),[D,P]=b.useState(!1),[Y,ee]=b.useState(!1),[G,N]=b.useState(null),X=(_,O)=>{_==="edit"?(N(O),S(!0)):_==="view"?(N(O),ee(!0)):_==="delete"&&(N(O),P(!0))},B=async(_,O,K="",oe="")=>{h(!0);try{if(!_)return;const u=await _();(K||u!=null&&u.message)&&le.enqueueSnackbar(K||u.message||"Success",{variant:"success"}),O==null||O(u)}catch(u){(oe||u!=null&&u.message)&&le.enqueueSnackbar(oe||u.message||"Error occurred",{variant:"error"})}finally{h(!1)}},M=_=>{const O=_.newObject;o?(m(K=>[O,...K]),j(K=>({...K,current_page:1}))):(R(K=>({...K,current_page:1})),v.current_page===1&&te()),x(!1)},k=_=>{const{newObject:O,targetObject:K}=_;o?m(oe=>oe.map(u=>u.id===K.id?{...u,...O}:u)):te(),S(!1)},z=_=>{if(!_){P(!1),N(null);return}o?m(O=>O.filter(K=>K.id!==_.targetObject.id)):l.length===1&&v.current_page>1?R(O=>({...O,current_page:O.current_page-1})):te(),P(!1),N(null)},H=_=>B(()=>{var O;return(O=s==null?void 0:s.addModal)!=null&&O.handleSubmit?s.addModal.handleSubmit(_):Promise.resolve({newObject:null})},M),F=_=>B(()=>{var O;return(O=s==null?void 0:s.editModal)!=null&&O.handleSubmit?s.editModal.handleSubmit(_,G):Promise.resolve({newObject:null,targetObject:null})},k),te=async()=>{d(!0);try{const _=await e({...v,...A});m(_.data||[]),j(_.pagination||null)}catch(_){le.enqueueSnackbar(_.message||"Failed to fetch data",{variant:"error"})}finally{d(!1)}},pe=_=>{var O;L(()=>({..._})),(O=i==null?void 0:i.filter)!=null&&O.useServerSideFilters&&I(K=>!K)},ne=(_,O)=>_.filter(K=>Object.entries(O).every(([oe,u])=>K[oe]===u)),V=b.useMemo(()=>{var _;return(_=i==null?void 0:i.filter)!=null&&_.useServerSideFilters?l:ne(l,A)},[l,A,(J=i==null?void 0:i.filter)==null?void 0:J.useServerSideFilters]),re=(xe=s==null?void 0:s.viewModal)==null?void 0:xe.component;return b.useEffect(()=>{te()},[v.search,v.rows_per_page,v.current_page,v.sort_by,v.sort_order,C]),t.jsxs("div",{children:[t.jsx(Ar,{title:a,setShowAdd:x,description:n.description,buttonText:n.buttonText,showAddButton:!!(s!=null&&s.addModal),config:{...i,pagination:{...i.pagination,...g},data:V,setServerSidePaginationData:R,onMenuAction:X,filterConfig:c,onFilterApply:pe,loading:f}}),t.jsx(Oe,{isOpen:E,onClose:()=>{p||x(!1)},icon:(ye=s==null?void 0:s.addModal)==null?void 0:ye.icon,title:((Se=s==null?void 0:s.addModal)==null?void 0:Se.title)||"Add New",size:((fe=s==null?void 0:s.addModal)==null?void 0:fe.size)||"md",onFormSubmit:()=>{var _;return(_=document.querySelector("#addForm"))==null?void 0:_.requestSubmit()},loadingBtn:p,actionButtons:((ve=s==null?void 0:s.addModal)==null?void 0:ve.actionButtons)||[],children:t.jsx(bt,{config:(s==null?void 0:s.addModal)||{},onSubmit:H,initialData:{},type:"add",loading:p})}),t.jsx(Oe,{isOpen:w,onClose:()=>{p||S(!1)},icon:(be=s==null?void 0:s.editModal)==null?void 0:be.icon,title:((we=s==null?void 0:s.editModal)==null?void 0:we.title)||"Edit",size:((ge=s==null?void 0:s.editModal)==null?void 0:ge.size)||"md",onFormSubmit:()=>{var _;return(_=document.querySelector("#editForm"))==null?void 0:_.requestSubmit()},actionButtons:((Ne=s==null?void 0:s.editModal)==null?void 0:Ne.actionButtons)||[],loadingBtn:p,children:t.jsx(bt,{config:(s==null?void 0:s.editModal)||{},onSubmit:F,initialData:G,type:"edit",loading:p,fetchRowDetails:r})}),D&&t.jsx(Oe,{isOpen:D,onClose:_=>{z(_)},icon:((Me=s==null?void 0:s.deleteModal)==null?void 0:Me.icon)||t.jsx(ce.Icon,{icon:"ph:warning-bold",className:"w-6 h-6 text-red-500"}),title:((Re=s==null?void 0:s.deleteModal)==null?void 0:Re.title)||"Confirm Delete",size:((Ce=s==null?void 0:s.deleteModal)==null?void 0:Ce.size)||"md",loading:p,actionButtons:((De=s==null?void 0:s.deleteModal)==null?void 0:De.actionButtons)||[],executeFunction:B,selectedItem:G,children:t.jsx("div",{className:"flex items-center space-x-2 py-3",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-md text-gray-700 dark:text-white",children:((Ee=s==null?void 0:s.deleteModal)==null?void 0:Ee.confirmText)||"Are you sure you want to delete this item?"}),((je=s==null?void 0:s.deleteModal)==null?void 0:je.referenceKey)&&t.jsx("p",{className:"text-md font-semibold text-gray-700 dark:text-white",children:G==null?void 0:G[(_e=s==null?void 0:s.deleteModal)==null?void 0:_e.referenceKey]})]})})}),(s==null?void 0:s.viewModal)&&t.jsx(Oe,{isOpen:Y,onClose:()=>{ee(!1),N(null)},icon:(Pe=s==null?void 0:s.viewModal)==null?void 0:Pe.icon,title:((Ae=s==null?void 0:s.viewModal)==null?void 0:Ae.title)||"View Details",size:((Le=s==null?void 0:s.viewModal)==null?void 0:Le.size)||"lg",footerConfig:s==null?void 0:s.viewModal.footer,children:re?t.jsx(re,{data:G}):t.jsx(Lr,{data:G,fetchRowDetails:r,config:(s==null?void 0:s.viewModal)||{}})})]})};function Ir({children:n}){return le.useSnackbar(),n}function Tr({children:n}){try{return t.jsx(Ir,{children:n})}catch{return t.jsx(le.SnackbarProvider,{anchorOrigin:{vertical:"bottom",horizontal:"right"},action:e=>t.jsx("button",{onClick:()=>{window.dispatchEvent(new CustomEvent("closeSnackbar",{detail:e}))},className:"p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",children:t.jsx(U.X,{className:"h-4 w-4"})}),maxSnack:3,autoHideDuration:3e3,children:n})}}const Or=()=>{if(typeof document>"u"||document.getElementById("react-admin-crud-manager-styles"))return;const n=document.createElement("style");n.id="react-admin-crud-manager-styles",n.textContent=`
150
- .no-spinner::-webkit-outer-spin-button,
151
- .no-spinner::-webkit-inner-spin-button {
152
- -webkit-appearance: none;
153
- margin: 0;
154
- }
155
-
156
- .no-spinner {
157
- -moz-appearance: textfield;
158
- }
159
-
160
- .tox.tox-tinymce .tox-edit-area::before {
161
- border: 0 !important;
162
- box-shadow: none !important;
163
- }
164
- `,document.head.appendChild(n)};function zr({config:n}){return b.useEffect(()=>{Or()},[]),t.jsx(Tr,{children:t.jsx(Fr,{config:n})})}module.exports=zr;
126
+ `,...x},onEditorChange:F=>{r==null||r(F)}}),k&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:k})]})},Lr=({name:a="",label:o="",options:e=[],value:r=null,onChange:n,disabled:s=!1,required:i=!1,parentClass:c="col-span-12",className:b="",errorMessage:p="",multiSelect:h=!1})=>{const u=Array.isArray(e)&&e.length>0,l=x=>u?h?Array.isArray(r)&&r.includes(x):r===x:!!r,w=x=>{n==null||n(x.target.checked,a)},m=(x,N)=>{if(n)if(!h)n(N?x:"",a);else{const k=Array.isArray(r)?[...r]:[];if(N)k.includes(x)||k.push(x);else{const S=k.indexOf(x);S>-1&&k.splice(S,1)}n(k,a)}};return u?t.jsx(t.Fragment,{children:t.jsxs("div",{className:v(f.field.wrapper,c),children:[t.jsx(be,{label:o,required:i}),t.jsx("div",{className:"flex flex-col space-y-2",children:e.map((x,N)=>t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",name:a,id:`field-${a}`,value:x.value,checked:l(x.value),disabled:s||!!x.disabled,required:i&&N===0,onChange:k=>m(x.value,k.target.checked),className:v(f.field.input,"h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",b)},a),x.label&&t.jsx("label",{htmlFor:a,className:"ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",children:x.label})]},x.value||x.label))}),p&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:p})]})}):t.jsxs("div",{className:v(f.field.wrapper,"flex items-center",c),children:[t.jsx("input",{type:"checkbox",name:a,checked:l(),disabled:s,required:i,onChange:w,className:v(f.field.input,"h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",b)}),o&&t.jsx("label",{htmlFor:a,className:"ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",children:o})]})},yt=he,Pr=({label:a="",value:o=null,onChange:e,required:r=!1,accept:n="audio/*",id:s,dragDrop:i=!1,name:c="",parentClass:b="",errorMessage:p="",maxSize:h=0})=>{const[u,l]=g.useState(null),[w,m]=g.useState(!1),x=g.useRef(null),N=h*1024*1024;g.useEffect(()=>{if(!o){k(),l(null);return}if(o instanceof File){const y=URL.createObjectURL(o);return l({file:o,preview:y}),()=>{URL.revokeObjectURL(y)}}else typeof o=="string"?l({preview:o}):o!=null&&o.preview&&l(o)},[o]);const k=()=>{u!=null&&u.preview&&u.preview.startsWith("blob:")&&URL.revokeObjectURL(u.preview)},S=y=>{if(!y||y.length===0)return;const _=y[0];if(N&&_.size>N){je.enqueueSnackbar(`Audio is too large. Maximum allowed size is ${h} MB`,{variant:"warning"});return}const C=URL.createObjectURL(_);k(),l({file:_,preview:C}),e==null||e(_)},L=y=>{y&&y.stopPropagation(),k(),l(null),e==null||e(null),x.current&&(x.current.value="")},z=y=>{i&&(y.preventDefault(),m(!0))},F=y=>{i&&(y.preventDefault(),m(!1))},P=y=>{var _,C,A,B;i&&(y.preventDefault(),m(!1),(B=(A=(C=(_=y.dataTransfer)==null?void 0:_.files)==null?void 0:C[0])==null?void 0:A.type)!=null&&B.includes("audio/")&&S(y.dataTransfer.files))},U=()=>{var y;(y=x.current)==null||y.click()};return t.jsxs("div",{className:v(f.mediaPicker.audio,f.field.wrapper,b||"col-span-12"),children:[t.jsx(be,{label:a,required:r}),t.jsxs("div",{className:v(f.mediaPicker.dropzone,"relative rounded-lg p-2 transition-all",w?"border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",p?"border-red-500":""),onDragOver:z,onDragLeave:F,onDrop:P,id:`field-${c}`,children:[t.jsx("input",{ref:x,id:s,type:"file",accept:n,onChange:y=>S(y.target.files),required:r&&!u,className:"absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"}),t.jsx("div",{className:`flex items-center space-x-4 transition-all ${w?"opacity-50":""}`,children:u?t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("div",{className:"relative w-full",children:[!r&&t.jsx("button",{type:"button",onClick:L,className:"absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800","aria-label":"Remove audio",children:t.jsx(ue.Icon,{icon:"mdi:close",className:"w-3 h-3"})}),t.jsx("audio",{src:u.preview,controls:!0,controlsList:"nodownload"},u.preview)]}),t.jsx(yt,{type:"button",onClick:U,children:t.jsx("span",{children:"Change Audio File"})})]}):t.jsxs("div",{className:"flex items-center justify-center space-x-4",children:[t.jsx("div",{className:"rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center",children:t.jsx(ue.Icon,{icon:"mdi:music",className:"text-gray-400 w-10 h-10"})}),t.jsxs("div",{className:"flex flex-col items-center space-y-1",children:[t.jsx(yt,{type:"button",onClick:U,variant:"outlined",children:t.jsx("span",{children:"Choose Audio File"})}),i&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"or drag and drop your audio file here"})]})]})}),i&&w&&!u&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg",children:t.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg",children:"Drop audio here"})})]}),p&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:p})]},c)},vt=he,Er=a=>{if(!a)return null;if(a instanceof File){const o=URL.createObjectURL(a);return{id:`${Date.now()}-${Math.random()}`,file:a,preview:o,createdBlobUrl:o}}if(typeof a=="string")return{id:`${Date.now()}-${Math.random()}`,file:null,preview:a};if(typeof a=="object"){if(a.preview)return{id:`${Date.now()}-${Math.random()}`,file:a.file||null,preview:a.preview};if(a.file){const o=URL.createObjectURL(a.file);return{id:`${Date.now()}-${Math.random()}`,file:a.file,preview:o,createdBlobUrl:o}}}return null},Ar=({label:a="",value:o=[],onChange:e,required:r=!1,accept:n="image/*",aspect:s="1",id:i,dragDrop:c=!1,cropImage:b=!1,name:p="",parentClass:h="",maxImages:u,errorMessage:l=""})=>{const[w,m]=g.useState([]),[x,N]=g.useState(!1),[k,S]=g.useState(!1),[L,z]=g.useState(""),[F,P]=g.useState("image/jpeg"),[U,y]=g.useState("cropped-image"),[_,C]=g.useState(null),A=g.useRef(null),B=g.useRef(null),G=g.useRef(""),ee=g.useRef([]);g.useEffect(()=>{ee.current=w},[w]),g.useEffect(()=>()=>{ee.current.forEach(M=>{M.createdBlobUrl&&URL.revokeObjectURL(M.createdBlobUrl)}),G.current&&URL.revokeObjectURL(G.current)},[]),g.useEffect(()=>{if(!Array.isArray(o)){m([]);return}const M=o.map(T=>Er(T)).filter(Boolean);m(T=>(T.forEach(V=>{V.createdBlobUrl&&URL.revokeObjectURL(V.createdBlobUrl)}),M))},[o]);const te=typeof u=="number"&&u>0?Math.max(u-w.length,0):Number.POSITIVE_INFINITY,E=()=>{S(!1),G.current&&(URL.revokeObjectURL(G.current),G.current=""),z(""),C(null),A.current&&(A.current.value="")},se=M=>{var T,V;z(M.preview),P(((T=M.file)==null?void 0:T.type)||"image/jpeg"),y((((V=M.file)==null?void 0:V.name)||"cropped-image").replace(/\.[^/.]+$/,"")),C(M.id),S(!0)},H=M=>{const T=URL.createObjectURL(M);m(V=>{const X=V.map(K=>K.id!==_?K:(K.createdBlobUrl&&URL.revokeObjectURL(K.createdBlobUrl),{...K,file:M,preview:T,createdBlobUrl:T}));return e==null||e(X.map(K=>K.file?K.file:K.preview)),X}),E()},Q=M=>{if(!M||M.length===0||te===0)return;const T=Array.from(M).filter(X=>X.type.includes("image/")).slice(0,te);if(T.length===0)return;const V=T.map(X=>{const K=URL.createObjectURL(X);return{id:`${Date.now()}-${Math.random()}`,file:X,preview:K,createdBlobUrl:K}});m(X=>{const K=[...X,...V];return e==null||e(K.map(re=>re.file?re.file:re.preview)),K}),A.current&&(A.current.value="")},D=M=>{m(T=>{const V=T.find(K=>K.id===M);V!=null&&V.createdBlobUrl&&URL.revokeObjectURL(V.createdBlobUrl);const X=T.filter(K=>K.id!==M);return e==null||e(X.map(K=>K.file?K.file:K.preview)),X}),A.current&&(A.current.value="")},R=M=>{var T;C(M),(T=B.current)==null||T.click()},Y=M=>{if(!M||M.length===0||!_)return;const T=Array.from(M).find(X=>X.type.includes("image/"));if(!T)return;const V=URL.createObjectURL(T);m(X=>{const K=X.map(re=>re.id!==_?re:(re.createdBlobUrl&&URL.revokeObjectURL(re.createdBlobUrl),{...re,file:T,preview:V,createdBlobUrl:V}));return e==null||e(K.map(re=>re.file?re.file:re.preview)),K}),C(null),B.current&&(B.current.value="")},I=M=>{c&&(M.preventDefault(),N(!0))},le=M=>{c&&(M.preventDefault(),N(!1))},me=M=>{var T;c&&(M.preventDefault(),N(!1),Q(((T=M.dataTransfer)==null?void 0:T.files)||null))},ge=()=>{var M;(M=A.current)==null||M.click()},ne=typeof u=="number"&&u>0?w.length<u:!0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:v(f.mediaPicker.multiImage,f.field.wrapper,h||"col-span-12"),children:[t.jsx(be,{label:a,required:r}),t.jsxs("div",{className:v(f.mediaPicker.dropzone,"relative rounded-md p-2 transition-all",x?"border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",l?"border-red-500":""),onDragOver:I,onDragLeave:le,onDrop:me,id:`field-${p}`,children:[t.jsx("input",{ref:A,id:i,type:"file",accept:n,multiple:!0,onChange:M=>Q(M.target.files),required:r&&w.length===0,className:"absolute opacity-0 pointer-events-none h-1 w-1"}),t.jsx("input",{ref:B,type:"file",accept:n,onChange:M=>Y(M.target.files),className:"absolute opacity-0 pointer-events-none h-1 w-1"}),w.length===0?t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsx("div",{className:"rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center",children:t.jsx(ue.Icon,{icon:"ri:multi-image-fill",className:"text-gray-400 w-10 h-10"})}),t.jsxs("div",{className:"flex flex-col items-center space-y-1",children:[t.jsx(vt,{type:"button",onClick:ge,variant:"outlined",color:"default",children:t.jsx("span",{className:"text-sm font-medium",children:"Choose Images"})}),c&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"or drag and drop your images here"})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[t.jsx(vt,{type:"button",onClick:ge,disabled:!ne,variant:"outlined",color:"default",children:t.jsx("span",{className:"text-sm font-medium",children:"Upload Images"})}),t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:u?`${w.length}/${u}`:`${w.length} selected`})]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3",children:w.map(M=>t.jsxs("div",{className:"relative group rounded-md overflow-hidden border border-gray-200 dark:border-gray-700",children:[t.jsx("img",{src:M.preview,alt:"preview",className:"w-full h-28 object-cover"}),t.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[t.jsx("button",{type:"button",onClick:()=>R(M.id),className:"w-7 h-7 rounded-full bg-white/90 text-gray-800 hover:bg-white flex items-center justify-center shadow","aria-label":"Replace image",children:t.jsx(ue.Icon,{icon:"solar:refresh-bold",className:"w-4 h-4"})}),b&&t.jsx("button",{type:"button",onClick:()=>se(M),className:"w-7 h-7 rounded-full bg-white/90 text-gray-800 hover:bg-white flex items-center justify-center shadow","aria-label":"Crop image",children:t.jsx(ue.Icon,{icon:"solar:crop-bold",className:"w-4 h-4"})}),t.jsx("button",{type:"button",onClick:()=>D(M.id),className:"w-7 h-7 rounded-full bg-red-500/95 text-white hover:bg-red-600 flex items-center justify-center shadow","aria-label":"Delete image",children:t.jsx(ue.Icon,{icon:"solar:trash-bin-trash-bold",className:"w-4 h-4"})})]})]},M.id))})]}),c&&x&&w.length===0&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg",children:t.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg",children:"Drop images here"})})]}),l&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:l})]},p),t.jsx(zt,{isOpen:k,imageSrc:L,fileType:F,fileName:U,onClose:E,onApply:H,aspect:Number(s)})]})},xe=({src:a,alt:o="preview",isOpen:e,setIsOpen:r})=>{const n=()=>r(!1);return g.useEffect(()=>{const s=i=>{i.key==="Escape"&&n()};return e&&(document.body.style.overflow="hidden",document.addEventListener("keydown",s)),()=>{document.body.style.overflow="",document.removeEventListener("keydown",s)}},[e]),t.jsx(t.Fragment,{children:t.jsxs("div",{className:v(f.imagePreview.root,"fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 backdrop-blur-sm animate-in fade-in duration-200"),onClick:n,children:[t.jsx("button",{onClick:n,className:`absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
127
+ hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,children:t.jsx(J.X,{size:20})}),t.jsx("div",{className:v(f.imagePreview.container,"max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95"),onClick:s=>s.stopPropagation(),children:t.jsx("img",{src:a,alt:o,className:v(f.imagePreview.image,"w-full max-h-[90vh] object-contain rounded-xl")})})]})})},Ut=({col:a,data:o,uiVariant:e="default",styleConfig:r={}})=>{const n=o[a.titleKey],s=o[a.subtitleKey],i=o[a.imageKey],c=a.fallback_icon,[b,p]=g.useState(null),[h,u]=g.useState(!1),l=m=>{let x=m;m&&m.src instanceof File&&(x={...m,src:URL.createObjectURL(m.src)}),p(x),u(!0)},w=m=>{const N={sm:{img:"w-8 h-8",wrap:"w-8 h-8",icon:"w-4 h-4"},md:{img:"w-12 h-12",wrap:"w-12 h-12",icon:"w-6 h-6"},lg:{img:"w-16 h-16",wrap:"w-16 h-16",icon:"w-8 h-8"}}[m];return i?t.jsx("img",{src:i instanceof File?URL.createObjectURL(i):i,alt:n,onClick:()=>l({src:i,alt:n}),className:`${N.img} cursor-pointer rounded-full object-cover border-2 border-white dark:border-gray-700 shadow flex-shrink-0`}):c?c instanceof Function?c(o):c:t.jsx("div",{className:`${N.wrap} flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-600 flex-shrink-0`,children:t.jsx(J.User,{className:`${N.icon} text-gray-400`})})};return e==="card"?t.jsxs(t.Fragment,{children:[h&&b&&t.jsx(xe,{src:b.src,alt:b.alt,isOpen:h,setIsOpen:u}),t.jsxs("div",{className:v(f.details.row,"col-span-12 relative overflow-hidden rounded-xl bg-gradient-to-r from-primary/10 via-primary/5 to-transparent dark:from-primary/20 dark:via-primary/10 border border-primary/20 dark:border-primary/30 p-5 flex items-center gap-4",r.rowClass||"",r.groupClass||"",a.blockClass||""),children:[t.jsx("div",{className:"pointer-events-none absolute -right-6 -top-6 w-32 h-32 rounded-full bg-primary/8 dark:bg-primary/12"}),t.jsx("div",{className:"pointer-events-none absolute -right-2 -bottom-4 w-20 h-20 rounded-full bg-primary/5"}),w("lg"),t.jsxs("div",{className:"min-w-0 z-10",children:[t.jsx("h3",{className:`text-lg font-bold text-gray-900 dark:text-white truncate ${r.valueClass||""}`,children:n}),t.jsx("p",{className:`text-sm text-primary/70 dark:text-primary/60 font-medium truncate ${r.labelClass||""}`,children:s})]})]})]}):e==="split"?t.jsxs(t.Fragment,{children:[h&&b&&t.jsx(xe,{src:b.src,alt:b.alt,isOpen:h,setIsOpen:u}),t.jsxs("div",{className:v(f.details.row,"flex items-center gap-3 px-5 py-4 bg-gradient-to-r from-primary/8 via-primary/4 to-transparent dark:from-primary/15 dark:via-primary/8",r.rowClass||"",r.groupClass||"",a.blockClass||""),children:[w("md"),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h3",{className:`text-base font-bold text-gray-900 dark:text-white truncate ${r.valueClass||""}`,children:n}),t.jsx("p",{className:`text-xs font-semibold text-primary/70 dark:text-primary/60 truncate ${r.labelClass||""}`,children:s})]})]})]}):t.jsxs(t.Fragment,{children:[h&&b&&t.jsx(xe,{src:b.src,alt:b.alt,isOpen:h,setIsOpen:u}),t.jsxs("div",{className:v(f.details.row,"col-span-12 flex items-center space-x-4 p-4 rounded-xl bg-gray-100 dark:bg-gray-900",r.rowClass||"",r.groupClass||"",a.blockClass||""),children:[w("lg"),t.jsxs("div",{children:[t.jsx("h3",{className:`text-xl font-semibold text-gray-900 dark:text-white ${r.valueClass||""}`,children:n}),t.jsx("p",{className:`text-sm text-gray-500 dark:text-gray-400 ${r.labelClass||""}`,children:s})]})]})]})},Tt=({col:a,data:o,uiVariant:e="default",styleConfig:r={}})=>{const n=o[a.titleKey],s=o[a.subtitleKey],i=o[a.imageKey],c=a.label,b=a==null?void 0:a.icon,p=a.fallback_icon,[h,u]=g.useState(null),[l,w]=g.useState(!1),m=N=>{let k=N;N&&N.src instanceof File&&(k={...N,src:URL.createObjectURL(N.src)}),u(k),w(!0)},x=()=>i?t.jsx("img",{src:i instanceof File?URL.createObjectURL(i):i,alt:n,onClick:()=>m({src:i,alt:n}),className:"w-8 h-8 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700 flex-shrink-0"}):p?p instanceof Function?p(o):p:t.jsx("div",{className:"w-8 h-8 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 flex-shrink-0",children:t.jsx(J.User,{className:"w-5 h-5 text-gray-400"})});return e==="card"?t.jsxs(t.Fragment,{children:[l&&h&&t.jsx(xe,{src:h.src,alt:h.alt,isOpen:l,setIsOpen:w}),t.jsxs("div",{className:v(f.details.row,a.blockClass||"col-span-6","group bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/60 shadow-sm hover:shadow-md hover:-translate-y-0.5 transition-all duration-200 p-4 flex flex-col gap-2.5",r.rowClass||"",r.cardGroupClass||""),children:[b&&t.jsx("div",{className:`w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center text-primary flex-shrink-0 [&>svg]:w-4 [&>svg]:h-4 ${r.iconClass||""}`,children:b}),t.jsx("p",{className:`text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 leading-none ${r.labelClass||""}`,children:c}),t.jsxs("div",{className:"flex items-center gap-2 mt-auto",children:[x(),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:`text-sm font-semibold text-gray-800 dark:text-gray-100 truncate ${r.valueClass||""}`,children:n}),s&&t.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:s})]})]})]})]}):e==="split"?t.jsxs(t.Fragment,{children:[l&&h&&t.jsx(xe,{src:h.src,alt:h.alt,isOpen:l,setIsOpen:w}),t.jsxs("div",{className:v(f.details.row,"flex items-stretch min-h-[52px]",r.rowClass||"",r.cardGroupClass||"",a.blockClass||""),children:[t.jsxs("div",{className:"w-[42%] flex-shrink-0 flex items-center gap-2 px-4 py-3 bg-gray-50 dark:bg-gray-800/80 border-r border-gray-200 dark:border-gray-700",children:[b&&t.jsx("span",{className:`text-primary/60 dark:text-primary/50 flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5 ${r.iconClass||""}`,children:b}),t.jsx("p",{className:`text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400 leading-tight ${r.labelClass||""}`,children:c})]}),t.jsxs("div",{className:"flex-1 flex items-center gap-2.5 px-4 py-3 bg-white dark:bg-gray-900",children:[x(),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:`text-sm text-gray-800 dark:text-gray-100 break-words ${r.valueClass||""}`,children:n}),s&&t.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",children:s})]})]})]})]}):t.jsxs(t.Fragment,{children:[l&&h&&t.jsx(xe,{src:h.src,alt:h.alt,isOpen:l,setIsOpen:w}),t.jsxs("div",{className:v(f.details.row,"col-span-12 flex items-center space-x-4 p-4 rounded-xl bg-gray-100 dark:bg-gray-900",r.rowClass||"",r.cardGroupClass||"",a.blockClass||""),children:[b&&t.jsx("div",{className:`flex-shrink-0 ${r.iconClass||""}`,children:b}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:`text-sm font-medium text-gray-500 dark:text-gray-400 ${r.labelClass||""}`,children:c}),t.jsxs("div",{className:"flex items-center mt-1",children:[x(),t.jsxs("div",{className:"ml-2",children:[t.jsx("p",{className:`mb-0 text-sm text-gray-900 dark:text-white break-words ${r.valueClass||""}`,children:n}),t.jsx("p",{className:`text-xs text-gray-500 dark:text-gray-400 ${r.labelClass||""}`,children:s})]})]})]})]})]})},kt={blue:{bg:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",border:"border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"},teal:{bg:"bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",border:"border border-teal-300 text-teal-700 dark:border-teal-700 dark:text-teal-300"},purple:{bg:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",border:"border border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300"},yellow:{bg:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",border:"border border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300"},green:{bg:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",border:"border border-green-300 text-green-700 dark:border-green-700 dark:text-green-300"},red:{bg:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",border:"border border-red-300 text-red-700 dark:border-red-700 dark:text-red-300"},gray:{bg:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",border:"border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"}},jt={contained:"bg",outline:"border !bg-transparent",soft:"bg opacity-90"},$t=({label:a,variant:o="contained",color:e="green",className:r=""})=>{const n=kt[e]||kt.green,s=jt[o]||jt.contained,i=o==="outline"?n.border:n.bg;return t.jsx("span",{className:v(f.chip.root,"inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]",i,s,r),children:a})},Bt=({col:a,data:o,uiVariant:e="default",styleConfig:r={}})=>{var k;const[n,s]=g.useState(null),[i,c]=g.useState(!1),b=a==null?void 0:a.icon,p=a.label;let h=o[a.key];const u=a.type,l=a.variant||"outline";let w=a.defaultColor;if(u==="chip"&&((k=a.chipOptions)==null?void 0:k.length)>0){const S=a==null?void 0:a.chipOptions.find(L=>L.value==h);S&&(h=S.label,w=S.color)}const m=S=>{if(!S)return"";if(typeof S=="string")return S;if(S instanceof File)return URL.createObjectURL(S);if(typeof S=="object"){if(typeof S.preview=="string")return S.preview;if(typeof S.src=="string")return S.src;if(S.src instanceof File)return URL.createObjectURL(S.src);if(S.file instanceof File)return URL.createObjectURL(S.file)}return""},x=(S,L)=>{s({src:S,alt:L}),c(!0)},N=(S="text-sm text-gray-900 dark:text-white break-words")=>u==="chip"?t.jsx($t,{label:h,variant:l,color:w,className:"mt-1"}):u==="tinyEditor"?t.jsx("p",{className:`${S} ${r.valueClass||""}`,dangerouslySetInnerHTML:{__html:h}}):u==="audio"?h?t.jsx("audio",{controls:!0,src:h instanceof File?URL.createObjectURL(h):h,onClick:L=>L.stopPropagation(),className:"shadow-sm rounded-full mt-1 w-full max-w-xs"},h instanceof File?URL.createObjectURL(h):h):t.jsx("p",{className:"text-sm text-gray-400",children:"N/A"}):u==="multiImage"?Array.isArray(h)&&h.length>0?t.jsx("div",{className:`mt-1 grid grid-cols-3 sm:grid-cols-4 gap-2 ${r.mediaGridClass||""}`,children:h.map((L,z)=>{const F=m(L);return F?t.jsx("button",{type:"button",onClick:()=>x(F,`Gallery ${z+1}`),className:"w-full h-16 rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 hover:border-primary/50 transition-colors",children:t.jsx("img",{src:F,alt:`gallery-${z+1}`,className:"w-full h-full object-cover"})},`${F}-${z}`):null})}):t.jsx("p",{className:"text-sm text-gray-400",children:"N/A"}):t.jsx("p",{className:`${S} ${r.valueClass||""}`,children:u==="date"?t.jsx("span",{children:et(h,a.format||"DD MMM YYYY")}):t.jsx("span",{children:h||"N/A"})});return e==="card"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:v(f.details.row,a.blockClass||"col-span-6","group bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700/60 shadow-sm hover:shadow-md hover:-translate-y-0.5 transition-all duration-200 p-4 flex flex-col gap-2.5",r.rowClass||""),children:[b&&t.jsx("div",{className:`w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center text-primary flex-shrink-0 [&>svg]:w-4 [&>svg]:h-4 ${r.iconClass||""}`,children:b}),t.jsx("p",{className:`text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 leading-none ${r.labelClass||""}`,children:p}),t.jsx("div",{className:"mt-auto",children:N("text-sm font-semibold text-gray-800 dark:text-gray-100 break-words leading-snug")})]}),i&&n&&t.jsx(xe,{src:n.src,alt:n.alt,isOpen:i,setIsOpen:c})]}):e==="split"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:v(f.details.row,"flex items-stretch min-h-[52px]",r.rowClass||"",a.blockClass||""),children:[t.jsxs("div",{className:"w-[42%] flex-shrink-0 flex items-center gap-2 px-4 py-3 bg-gray-50 dark:bg-gray-800/80 border-r border-gray-200 dark:border-gray-700",children:[b&&t.jsx("span",{className:`text-primary/60 dark:text-primary/50 flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5 ${r.iconClass||""}`,children:b}),t.jsx("p",{className:`text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400 leading-tight ${r.labelClass||""}`,children:p})]}),t.jsx("div",{className:"flex-1 flex items-center px-4 py-3 bg-white dark:bg-gray-900",children:N("text-sm text-gray-800 dark:text-gray-100 break-words")})]}),i&&n&&t.jsx(xe,{src:n.src,alt:n.alt,isOpen:i,setIsOpen:c})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:v(f.details.row,"col-span-12 flex items-center space-x-4 p-4 rounded-xl bg-gray-100 dark:bg-gray-900",r.rowClass||"",a.blockClass||""),children:[b&&t.jsx("div",{className:`flex-shrink-0 ${r.iconClass||""}`,children:b}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:`text-sm font-medium text-gray-500 dark:text-gray-400 ${r.labelClass||""}`,children:p}),N("mt-1 text-sm text-gray-900 dark:text-white break-words")]})]}),i&&n&&t.jsx(xe,{src:n.src,alt:n.alt,isOpen:i,setIsOpen:c})]})},Fr=({value:a=!0,onChange:o,text:e,options:r=[],label:n,required:s,name:i="",disabled:c=!1,parentClass:b="",errorMessage:p=""})=>{const h=r.length>0?r:[{label:"Active",value:!0},{label:"Inactive",value:!1}];return t.jsx(t.Fragment,{children:t.jsxs("div",{className:v(f.field.wrapper,b||"col-span-12"),children:[t.jsx(be,{label:n,required:s}),t.jsxs("div",{className:`flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600
128
+ ${p?"border-red-500":""}`,children:[e&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]",children:e}),t.jsx("div",{className:"flex items-center gap-6",children:h.map((u,l)=>t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[t.jsx("input",{type:"radio",name:"switch-field",required:s&&l===0,value:String(u.value),disabled:c,id:`field-${i}`,checked:a===u.value,onChange:()=>o==null?void 0:o(u.value),className:v(f.field.input,"w-4 h-4 border-gray-300 cursor-pointer")}),t.jsx("span",{className:"text-sm text-gray-700 dark:text-white",children:u.label})]},l))})]}),p&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:p})]},i)})},Nt=he,Ir=({label:a="",value:o=null,onChange:e,required:r=!1,accept:n="video/*",id:s,dragDrop:i=!1,name:c="",parentClass:b="",maxSize:p=0,errorMessage:h=""})=>{const[u,l]=g.useState(null),[w,m]=g.useState(!1),x=g.useRef(null),N=p*1024*1024;g.useEffect(()=>{if(!o){k(),l(null);return}if(o instanceof File){const y=URL.createObjectURL(o);return l({file:o,preview:y}),()=>{URL.revokeObjectURL(y)}}else typeof o=="string"?l({preview:o}):o!=null&&o.preview&&l(o)},[o]);const k=()=>{u!=null&&u.preview&&u.preview.startsWith("blob:")&&URL.revokeObjectURL(u.preview)},S=y=>{if(!y||y.length===0)return;const _=y[0];if(N&&_.size>N){je.enqueueSnackbar(`File is too large. Maximum allowed size is ${p} MB`,{variant:"warning"});return}const C=URL.createObjectURL(_);k(),l({file:_,preview:C}),e==null||e(_)},L=y=>{y&&y.stopPropagation(),k(),l(null),e==null||e(null),x.current&&(x.current.value="")},z=y=>{i&&(y.preventDefault(),m(!0))},F=y=>{i&&(y.preventDefault(),m(!1))},P=y=>{var _,C,A,B;i&&(y.preventDefault(),m(!1),(B=(A=(C=(_=y.dataTransfer)==null?void 0:_.files)==null?void 0:C[0])==null?void 0:A.type)!=null&&B.includes("video/")&&S(y.dataTransfer.files))},U=()=>{var y;(y=x.current)==null||y.click()};return t.jsxs("div",{className:v(f.mediaPicker.video,f.field.wrapper,b||"col-span-12"),children:[t.jsx(be,{label:a,required:r}),t.jsxs("div",{className:v(f.mediaPicker.dropzone,"relative rounded-lg p-2 transition-all",w?"border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800",h?"border-red-500":""),onDragOver:z,onDragLeave:F,onDrop:P,id:`field-${c}`,children:[t.jsx("input",{ref:x,id:s,type:"file",accept:n,onChange:y=>S(y.target.files),required:r&&!u,className:"absolute opacity-0 pointer-events-none h-[10px]"}),t.jsx("div",{className:`flex items-center space-x-4 transition-all ${w?"opacity-50":""}`,children:u?t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("div",{className:"relative",children:[!r&&t.jsx("button",{type:"button",onClick:L,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 shadow hover:bg-red-600 z-10",children:t.jsx(ue.Icon,{icon:"mdi:close",className:"w-3 h-3"})}),t.jsx("video",{src:u.preview,controls:!0,controlsList:"nodownload",className:"w-[260px] h-[150px] rounded-md object-cover"},u.preview)]}),t.jsx(Nt,{type:"button",onClick:U,children:"Change Video File"})]}):t.jsxs("div",{className:"flex items-center justify-center space-x-4",children:[t.jsx("div",{className:"rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center",children:t.jsx(ue.Icon,{icon:"mdi:video",className:"text-gray-400 w-10 h-10"})}),t.jsxs("div",{className:"flex flex-col items-center space-y-1",children:[t.jsx(Nt,{type:"button",onClick:U,variant:"outlined",children:"Choose Video File"}),i&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"or drag and drop your video here"})]})]})}),i&&w&&!u&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg",children:t.jsx("span",{className:"text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg",children:"Drop video here"})})]}),h&&t.jsx("span",{className:v(f.field.error,"text-red-500 text-xs mt-1"),children:h})]},c)},Gt=({field:a,formData:o,handleChange:e,errorMessage:r})=>{const{key:n,label:s,type:i,options:c,placeholder:b,rows:p,inputClass:h,search:u,accept:l,text:w,required:m=!1,minLength:x,dragDrop:N,parentClass:k,countriesList:S,defaultCountry:L,multiple:z,dropdownMaxHeight:F,editorKey:P,fontFamily:U,disabled:y,negativeNumberAllow:_,defaultValue:C,renderCondition:A,pattern:B,renderType:G,cropImage:ee,aspectRatio:te,dependencyKey:E,mask:se,maskApplyOnValue:H,maxSize:Q}=a;let D=o==null?void 0:o[n];D==null&&(D="");const R=b||(i==="select"?`Select ${s}`:`Enter ${s}`),Y="w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";if(A&&typeof A=="function"&&!A(o))return null;if(G&&G=="details")switch(i){case"group":return t.jsx(Ut,{col:a,data:o});case"cardGroup":return t.jsx(Tt,{col:a,data:o});default:return t.jsx(Bt,{col:a,data:o})}switch(i){case"select":return t.jsx(Xt,{options:c||[],value:D,formData:o,dependencyKey:E,onChange:I=>e(n,I),placeholder:R,className:h||"",search:u,required:m,defaultValue:C,label:s||"",name:n,countriesList:S,disabled:y,parentClass:k||"",multiple:z,dropdownMaxHeight:F,errorMessage:r});case"checkbox":return t.jsx(t.Fragment,{children:t.jsx(Lr,{name:n,label:s||"",options:c||[],value:D,onChange:I=>e(n,I),required:m,parentClass:k||"",className:h||"",multiSelect:z,disabled:y,errorMessage:r})});case"radio":return t.jsx(Fr,{value:D,onChange:I=>e(n,I),text:w,options:c||[],label:s||"",required:m,name:n,disabled:y,parentClass:k||"",errorMessage:r});case"switch":return t.jsx(Rt,{value:!!D,onChange:I=>e(n,I),label:s||"",required:m,name:n,disabled:y,className:"",parentClass:k||"",errorMessage:r});case"phone":return t.jsx(qt,{value:D,onChange:I=>e(n,I),countriesList:S,defaultCountry:L,required:m,placeholder:R,search:u,label:s||"",name:n,disabled:y,errorMessage:r,parentClass:k||""});case"textarea":return t.jsx(Ct,{value:D,onChange:I=>e(n,I.target.value),placeholder:R,rows:p||3,className:`${Y} ${h||""}`,required:m,name:n,label:s||"",disabled:y,parentClass:k||"",errorMessage:r});case"image":case"multiImage":return z||i==="multiImage"?t.jsx(Ar,{value:Array.isArray(D)?D:[],onChange:I=>e(n,I),required:m,accept:l||"image/*",aspect:te,id:`file-${n}`,dragDrop:N,cropImage:ee,label:s||"",name:n,parentClass:k||"",maxImages:a.maxImages,errorMessage:r}):t.jsx(Mr,{value:D,onChange:I=>e(n,I),required:m,accept:l||"image/*",aspect:te,id:`file-${n}`,dragDrop:N,cropImage:ee,label:s||"",name:n,parentClass:k||"",errorMessage:r});case"audio":return t.jsx(Pr,{value:D,onChange:I=>e(n,I),required:m,accept:l||"audio/*",id:`file-${n}`,dragDrop:N,label:s||"",name:n,parentClass:k||"",maxSize:Q,errorMessage:r});case"video":return t.jsx(Ir,{value:D,onChange:I=>e(n,I),required:m,accept:l||"video/*",id:`file-${n}`,dragDrop:N,label:s||"",name:n,maxSize:Q,parentClass:k||"",errorMessage:r});case"tinyEditor":return t.jsx(Dr,{value:D,name:n,onChange:I=>e(n,I),required:m,placeholder:R,label:s||"",parentClass:k||"",fontFamily:U,editorKey:P||"",disabled:y,errorMessage:r});default:return t.jsx(Ot,{field:a,type:i||"text",defaultValue:C,value:D,onChange:I=>e(n,I),placeholder:R,className:`${Y} ${h||""}`,required:m,name:n,minLength:x,label:s||"",negativeNumberAllow:_,parentClass:k||"",disabled:y,pattern:B,mask:se,errorMessage:r,maskApplyOnValue:H})}},zr=({isOpen:a,onClose:o,config:e,onApply:r})=>{var h;const[n,s]=g.useState({}),i=(u,l)=>{s(w=>({...w,[u]:l}))},c=()=>{r(n),o()},b=()=>{s({}),r({}),o()},p=e==null?void 0:e.component;return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:v(f.filterDrawer.overlay,"fixed inset-0 bg-black/50 z-40 transition-opacity duration-300",a?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:o}),t.jsxs("div",{className:v(f.filterDrawer.panel,"fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700 transform transition-transform duration-300 ease-in-out",a?"translate-x-0":"translate-x-full"),children:[t.jsxs("div",{className:v(f.filterDrawer.header,"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700"),children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Filters"}),t.jsx("button",{onClick:o,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",children:t.jsx(J.X,{className:"w-5 h-5 text-gray-500 dark:text-gray-400"})})]}),a&&t.jsx("div",{className:v(f.filterDrawer.body,"flex-1 overflow-y-auto px-4 py-3"),children:p?t.jsx(p,{filters:n,onFilterChange:i}):t.jsx("div",{className:"space-y-4",children:(h=e==null?void 0:e.fields)==null?void 0:h.map(u=>t.jsx(Gt,{field:u,formData:n,handleChange:i},u.key))})}),t.jsxs("div",{className:v(f.filterDrawer.footer,"flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700"),children:[t.jsx(he,{onClick:c,variant:"contained",color:"primary",fullWidth:!0,children:"Apply Filters"}),t.jsx(he,{onClick:b,variant:"contained",className:"min-w-[150px]",children:"Reset"})]})]})]})},Or=({rows:a=5,columns:o=5})=>t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-full mb-6 inline-flex justify-end items-center",children:t.jsx("div",{className:"h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse"})}),t.jsx("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:t.jsxs("table",{className:v(f.tableSkeleton.root,f.tableSkeleton.table,"w-full border-collapse"),children:[t.jsx("thead",{children:t.jsx("tr",{className:"bg-gray-50 dark:bg-gray-900",children:Array.from({length:o}).map((e,r)=>t.jsx("th",{className:"px-4 py-3",children:t.jsx("div",{className:"h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center"})},r))})}),t.jsx("tbody",{children:Array.from({length:a}).map((e,r)=>t.jsx("tr",{className:"border-t border-gray-200 dark:border-gray-800",children:Array.from({length:o}).map((n,s)=>t.jsx("td",{className:"px-4 py-6",children:t.jsx("div",{className:"h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse"})},s))},r))})]})})]}),Ur=({options:a=[],value:o="",onChange:e,clearLabel:r=""})=>{const[n,s]=g.useState(!1),i=g.useRef(null),c=!!o;g.useEffect(()=>{const p=h=>{i.current&&!i.current.contains(h.target)&&s(!1)};return document.addEventListener("click",p),()=>document.removeEventListener("click",p)},[]);const b=p=>{const h=a.find(u=>u.value===p);e(p,h||null),s(!1)};return a!=null&&a.length?t.jsxs("div",{className:v(f.sortDropdown.root,"relative"),ref:i,children:[t.jsxs("button",{type:"button",onClick:()=>s(p=>!p),className:v(f.sortDropdown.trigger,"relative inline-flex items-center justify-center h-[36px] w-[36px] rounded-md border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600 transition"),"aria-label":"Open sort options",children:[t.jsx(J.ArrowUpDown,{className:"w-4 h-4"}),c&&t.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"})]}),n&&t.jsxs("div",{className:v(f.sortDropdown.menu,"absolute right-0 mt-2 z-20 min-w-[220px] max-h-[260px] overflow-auto rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg"),children:[!!(r!=null&&r.trim())&&t.jsx("button",{type:"button",onClick:()=>b(""),className:v(f.sortDropdown.item,"w-full text-left px-3 py-2 text-sm transition hover:bg-gray-100 dark:hover:bg-gray-700",o?"text-gray-700 dark:text-gray-200":"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white"),children:r}),a.map(p=>t.jsx("button",{type:"button",onClick:()=>b(p.value),className:v(f.sortDropdown.item,"w-full text-left px-3 py-2 text-sm transition hover:bg-gray-100 dark:hover:bg-gray-700",o===p.value?"bg-gray-100 dark:bg-gray-700 text-gray-900 dark:text-white":"text-gray-700 dark:text-gray-200"),children:p.label},p.value))]})]}):null},Qe={enabled:!1,useServerSideSorting:!1,options:[],fields:[],defaultValue:"",autoGenerate:!0,clearLabel:"",onChange:null},Tr=a=>a===!0?{...Qe,enabled:!0}:!a||typeof a!="object"?Qe:{...Qe,...a,enabled:a.enabled??!0,autoGenerate:a.autoGenerate??!0},$r=(a=[])=>a.filter(o=>{const e=["menu_actions","index","audio","avatar"];return o.type&&e.includes(o.type)?!1:!!(o.sortKey||(o.type==="group"?o.titleKey:o.key))}),Br=a=>{if(a.sortType)return a.sortType;if(a.type==="date")return"date";if(a.type==="number")return"number";const o=String(a.sortKey||(a.type==="group"?a.titleKey:a.key)||"").toLowerCase();return["phone","mobile","contact","tel","whatsapp"].some(r=>o.includes(r))?"phone":Array.isArray(a.chipOptions)&&a.chipOptions.length>0&&a.chipOptions.every(n=>typeof n.value=="boolean")?"boolean":"string"},St=(a=[])=>a.flatMap(o=>{const e=o.sortKey||(o.type==="group"?o.titleKey:o.key),r=o.sortLabel||o.title||e,n=Br(o);return e?n==="number"?[{value:`${e}_asc`,label:`${r} (Low-High)`,key:e,order:"asc",type:n},{value:`${e}_desc`,label:`${r} (High-Low)`,key:e,order:"desc",type:n}]:n==="phone"?[{value:`${e}_asc`,label:`${r} (0-9)`,key:e,order:"asc",type:n},{value:`${e}_desc`,label:`${r} (9-0)`,key:e,order:"desc",type:n}]:n==="date"?[{value:`${e}_desc`,label:`${r} (Newest First)`,key:e,order:"desc",type:n},{value:`${e}_asc`,label:`${r} (Oldest First)`,key:e,order:"asc",type:n}]:n==="boolean"?[{value:`${e}_desc`,label:`${r} (True First)`,key:e,order:"desc",type:n},{value:`${e}_asc`,label:`${r} (False First)`,key:e,order:"asc",type:n}]:[{value:`${e}_asc`,label:`${r} (A-Z)`,key:e,order:"asc",type:n},{value:`${e}_desc`,label:`${r} (Z-A)`,key:e,order:"desc",type:n}]:[]}),Gr=(a,o=[])=>{if(Array.isArray(a.options)&&a.options.length>0)return a.options.map(n=>({...n,type:n.type||"string",order:n.order==="desc"?"desc":"asc"}));const r=Array.isArray(a.fields)?a.fields:[];if(r.length>0){const n=r.map(s=>{const i=typeof s=="string"?s:s.key,c=o.find(b=>b.key===i||b.sortKey===i||b.type==="group"&&b.titleKey===i);return c?{...c,sortKey:typeof s=="object"&&s.key?s.key:c.sortKey,sortType:typeof s=="object"&&s.type?s.type:c.sortType,sortLabel:typeof s=="object"&&s.label?s.label:c.sortLabel}:null}).filter(s=>s!==null);return St(n)}return a.autoGenerate?St(o):[]},Yr=(a=[],o="",e,r=[])=>{if(!(e!=null&&e.enabled)||!o||e!=null&&e.useServerSideSorting)return a;const n=r==null?void 0:r.find(p=>p.value===o);if(!(n!=null&&n.key))return a;const s=n.order==="desc"?"desc":"asc",i=n.key,c=n.type||"string",b=p=>String(p??"").replace(/[^\d]/g,"").trim();return[...a].sort((p,h)=>{const u=p==null?void 0:p[i],l=h==null?void 0:h[i];if(u==null&&l==null)return 0;if(u==null)return s==="asc"?1:-1;if(l==null)return s==="asc"?-1:1;let w=0;return c==="number"?w=Number(u)-Number(l):c==="phone"?w=b(u).localeCompare(b(l),void 0,{numeric:!0}):c==="date"?w=new Date(u).getTime()-new Date(l).getTime():c==="boolean"?w=+!!u-+!!l:w=String(u).localeCompare(String(l)),s==="asc"?w:-w})},Kr=({config:a,setShowAdd:o,title:e,buttonText:r,description:n,showAddButton:s})=>{const{data:i=[],table_head:c=[],loading:b=!1,search:p={enabled:!1,placeholder:"Search...",useServerSideSearch:!1},filter:h={enabled:!1,useServerSideFilters:!1},sort:u={enabled:!1},pagination:l={enabled:!1,rows_per_page:10,useServerSidePagination:!1},exportCSV:w={enabled:!1,fileName:"",fields:[]},emptyMessage:m="No data available",onMenuAction:x,setServerSidePaginationData:N=()=>{},onFilterApply:k,filterConfig:S=null,rowClick:L=null}=a,[z,F]=g.useState(""),[P,U]=g.useState(null),[y,_]=g.useState([]),[C,A]=g.useState({top:0,left:0}),[B,G]=g.useState(!1),[ee,te]=g.useState({}),E=g.useMemo(()=>Tr(u),[u]),se=g.useMemo(()=>$r(c),[c]),H=g.useMemo(()=>Gr(E,se),[E,se]),[Q,D]=g.useState((E==null?void 0:E.defaultValue)||""),[R,Y]=g.useState(null),[I,le]=g.useState(!1),me=g.useMemo(()=>!p.enabled||!z.trim()||p.useServerSideSearch?i:Vt(i,z,p.searchKeys||[]),[i,z,p]),ge=g.useMemo(()=>Yr(me,Q,E,H),[me,Q,E,H]),[ne,M]=g.useState(1),[T,V]=g.useState((l==null?void 0:l.rows_per_page)||50),[X,K]=g.useState(me.length||0),re=l!=null&&l.useServerSidePagination?l.total_pages:Math.ceil(me.length/T),_e=g.useMemo(()=>{if(l.useServerSidePagination)return ge;const d=(ne-1)*T;return ge.slice(d,d+T)},[ge,ne,T,l.useServerSidePagination]),Re=g.useRef(null),De=g.useRef({}),Ce=g.useRef(null),ze=d=>{F(d),M(1),p.useServerSideSearch&&(Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(async()=>{try{await N(j=>({...j,search:d,current_page:1}))}catch(j){console.error("Search error:",j)}},800))},Oe=(d,j=null)=>{D(d),M(1);const $={value:d,option:j,key:(j==null?void 0:j.key)||"",order:(j==null?void 0:j.order)||"",type:(j==null?void 0:j.type)||""};typeof(E==null?void 0:E.onChange)=="function"&&E.onChange($)},Ue=(d,j,$)=>{$.stopPropagation(),U(null),x==null||x(d.type,j)},Te=(d,j,$)=>{j.stopPropagation(),_($);const Z=j.currentTarget;De.current[d]=Z;const q=Z.getBoundingClientRect(),ce=192,we=$.length*40,de=window.innerWidth,fe=window.innerHeight,ve=de-q.right<ce?q.left-ce+q.width:q.left,Ae=fe-q.bottom<we&&q.top>we?q.top-we-2:q.bottom+2;A({top:Math.max(8,Math.min(Ae,fe-we-8)),left:Math.max(8,Math.min(ve,de-ce-8))}),U(P===d?null:d)},$e=d=>(ne-1)*T+d+1,Le=d=>{let j=d;j&&j.src instanceof File&&(j={...j,src:URL.createObjectURL(j.src)}),Y(j),le(!0)},Be=d=>{if(!d)return"";if(typeof d=="string")return d;if(d instanceof File)return URL.createObjectURL(d);if(typeof d=="object"){if(typeof d.preview=="string")return d.preview;if(typeof d.src=="string")return d.src;if(d.src instanceof File)return URL.createObjectURL(d.src);if(d.file instanceof File)return URL.createObjectURL(d.file)}return""},Ge=(d,j)=>{const $=Array.isArray(d)?d:[];if($.length===0)return t.jsx("span",{className:j.className||"",children:"N/A"});const Z=j.maxPreview||3,q=$.slice(0,Z),ce=$.length-q.length;return t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"flex -space-x-2",children:q.map((we,de)=>{const fe=Be(we);return fe?t.jsx("button",{type:"button",onClick:Ee=>{Ee.stopPropagation(),Le({src:fe,alt:`Gallery ${de+1}`})},className:"w-8 h-8 rounded-full border-2 border-white dark:border-gray-800 overflow-hidden",children:t.jsx("img",{src:fe,alt:`gallery-${de+1}`,className:"w-full h-full object-cover"})},`${fe}-${de}`):null})}),ce>0&&t.jsxs("span",{className:"ml-2 text-xs font-medium text-gray-600 dark:text-gray-300",children:["+",ce]})]})},Pe=(d,j,$,Z=null,q=null)=>t.jsx(t.Fragment,{children:d?t.jsx("img",{src:d instanceof File?URL.createObjectURL(d):d,alt:j||"Avatar",onClick:ce=>{ce.stopPropagation(),ce.preventDefault(),Le({src:d,alt:j})},className:`w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${$||""}`}):t.jsx(t.Fragment,{children:Z?typeof Z=="function"?Z(q):Z:t.jsx("div",{className:`w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${$||""}`,children:t.jsx(J.User,{className:"w-6 h-6 text-gray-400 dark:text-gray-400"})})})}),Ye=(d,j)=>t.jsx(t.Fragment,{children:d?t.jsx("audio",{controls:!0,src:d instanceof File?URL.createObjectURL(d):d,onClick:$=>{$.stopPropagation()},className:`w-64 cursor-pointer ${j||""}`},d instanceof File?URL.createObjectURL(d):d):t.jsx(t.Fragment,{children:t.jsx("div",{className:`w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${j||""}`,children:t.jsx(J.Music,{className:"w-6 h-6 text-gray-400 dark:text-gray-400"})})})}),Ke=(d,j)=>t.jsxs("div",{className:`flex items-center space-x-4 ${j.className||""}`,children:[j.imageKey?Pe(d[j.imageKey],d[j.titleKey],"group-avatar",j.fallback_icon,d):"",t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white group-title",children:d[j.titleKey]||""}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 group-sub-title",children:d[j.subtitleKey]||""})]})]}),We=(d,j)=>{var ce;let $=String(d);const Z=j.variant||"contained";let q=j.defaultColor;if(((ce=j==null?void 0:j.chipOptions)==null?void 0:ce.length)>0){const we=j==null?void 0:j.chipOptions.find(de=>de.value==d);we&&($=we.label,q=we.color)}return t.jsx($t,{label:$,variant:Z,color:q,className:j.className||""})},O=(d,j,$)=>{const Z=j[d.key];return d.type==="menu_actions"?t.jsx("div",{className:`text-center ${d.className||""}`,children:t.jsx("button",{ref:q=>{De.current[j.id||j._id]=q},onClick:q=>Te(j.id||j._id,q,d.menuList),className:v(f.table.actionButton,"p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300"),children:t.jsx(J.EllipsisVertical,{className:"h-4 w-4"})})}):d.type==="index"?t.jsx("span",{className:d.className||"",children:$e($)}):d.type==="group"?Ke(j,d):d.type==="chip"?t.jsx(t.Fragment,{children:We(Z,d)}):d.type==="date"?t.jsx("span",{className:d.className||"",children:et(Z,d.format||"DD MMM YYYY")}):d.type==="avatar"?t.jsx(t.Fragment,{children:t.jsx("div",{className:"min-w-[40px]",children:Pe(Z,d.alt,d.className,d.fallback_icon,j)})}):d.type==="audio"?t.jsx(t.Fragment,{children:Ye(Z,d.className)}):d.type==="multiImage"?t.jsx(t.Fragment,{children:Ge(Z,d)}):t.jsx("span",{className:d.className||"",children:Z||"N/A"})},W=d=>{if(typeof L=="function")return L(d);if(L)return x==null?void 0:x("view",d)},ae=(d,j)=>{if(d.onClickDetails)return x==null?void 0:x("view",j);if(typeof d.handleClick=="function")return d.handleClick(j)},ye=()=>L||typeof L=="function",oe=d=>d.onClickDetails||typeof d.handleClick=="function",Yt=()=>{var Ee;if(!(i!=null&&i.length)||!((Ee=w==null?void 0:w.fields)!=null&&Ee.length))return;const d=w.fields.map(ve=>ve.label),j=_e.map(ve=>w.fields.map(dt=>{const Ae=ve==null?void 0:ve[dt.key];return`"${Ae??""}"`})),$=[d.join(","),...j.map(ve=>ve.join(","))].join(`
129
+ `),q=`export-${et(new Date,"YYYY-MM-DD_HH-mm-ss")}.csv`,ce=w.fileName||q,we=new Blob([$],{type:"text/csv;charset=utf-8;"}),de=document.createElement("a"),fe=URL.createObjectURL(we);de.href=fe,de.download=ce,document.body.appendChild(de),de.click(),document.body.removeChild(de),URL.revokeObjectURL(fe)};return g.useEffect(()=>{const d=()=>{P&&U(null)};return window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("scroll",d,!0)}},[P]),g.useEffect(()=>{const d=j=>{Re.current&&!Re.current.contains(j.target)&&U(null)};return document.addEventListener("click",d),()=>document.removeEventListener("click",d)},[]),g.useEffect(()=>{l!=null&&l.rows_per_page&&(l!=null&&l.useServerSidePagination)&&V((l==null?void 0:l.rows_per_page)||50),l.current_page&&M(l.current_page)},[l.rows_per_page,l==null?void 0:l.useServerSidePagination,l.current_page]),g.useEffect(()=>{K(l!=null&&l.useServerSidePagination?l.total_records:ge.length),ge.length<=T*(ne-1)&&!(l!=null&&l.useServerSidePagination)&&M(d=>d-1||1)},[ge.length,l.total_records,l==null?void 0:l.useServerSidePagination]),g.useEffect(()=>{if(!(E!=null&&E.enabled)){D("");return}if(H.some(j=>j.value===E.defaultValue)){D(E.defaultValue);return}D("")},[E,H]),g.useEffect(()=>{if(!(E!=null&&E.enabled)||!(E!=null&&E.useServerSideSorting))return;const d=H==null?void 0:H.find(j=>j.value===Q);N(j=>({...j,current_page:1,sort_by:(d==null?void 0:d.key)||"",sort_order:(d==null?void 0:d.order)||""}))},[Q,E==null?void 0:E.enabled,E==null?void 0:E.useServerSideSorting,H,N]),t.jsxs(t.Fragment,{children:[b?t.jsx(Or,{rows:6,columns:6}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:v(f.table.toolbar,"flex flex-col lg:!flex-row lg:!justify-between gap-4 mb-3"),children:[t.jsxs("div",{className:"table-heading",children:[t.jsx("h1",{children:e}),t.jsx("p",{children:n})]}),t.jsxs("div",{className:"flex flex-col justify-end items-stretch lg:!items-end gap-2 w-full lg:!w-auto",children:[s&&t.jsxs(he,{onClick:()=>o(!0),variant:"contained",color:"primary",children:[t.jsx(J.Plus,{className:"w-4 h-4 mr-2"}),r||"Add New"]}),t.jsxs("div",{className:"flex flex-col sm:!flex-row sm:!flex-wrap justify-end items-stretch sm:!items-center gap-2 w-full",children:[p.enabled&&t.jsx("div",{className:"w-full sm:!w-auto",children:t.jsxs("div",{className:v(f.table.searchField,"table-search-field"),children:[t.jsx(J.Search,{className:"search-icon"}),t.jsx("input",{type:"text",placeholder:p.placeholder||"Search...",value:z,onChange:d=>ze(d.target.value),className:f.table.searchInput})]})}),E!=null&&E.enabled&&(H==null?void 0:H.length)>0||S&&h.enabled||w&&w.enabled?t.jsxs("div",{className:"flex items-center justify-end gap-2 w-full sm:!w-auto",children:[S&&h.enabled&&t.jsxs("div",{className:"filter-button-wrapper",children:[t.jsxs(he,{onClick:()=>G(!0),variant:"contained",className:"w-full sm:!w-auto",children:[t.jsx(J.Filter,{className:"w-4 h-4 mr-2"}),"Filters"]}),Object.keys(ee).length>0&&t.jsx("span",{className:"red-dot"})]}),w&&w.enabled&&t.jsx("div",{className:"filter-button-wrapper",children:t.jsxs(he,{onClick:()=>Yt(),variant:"contained",className:"w-full sm:!w-auto",children:[t.jsx(J.Download,{className:"w-4 h-4 mr-2"}),"Export CSV"]})}),(E==null?void 0:E.enabled)&&(H==null?void 0:H.length)>0&&t.jsx(Ur,{options:H,value:Q,onChange:Oe,clearLabel:E==null?void 0:E.clearLabel})]}):null]})]})]}),t.jsxs("div",{className:v(f.table.root,f.table.container,"table-container"),children:[t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:f.table.element,children:[t.jsx("thead",{className:f.table.head,children:t.jsx("tr",{className:f.table.headRow,children:c.map(d=>t.jsx("th",{className:v(f.table.headCell,"table-head-data",d.headClass||""),children:d.title},d.key))})}),t.jsx("tbody",{className:f.table.body,children:_e.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:c.length,className:v(f.table.noData,"no-data-message"),children:m})}):_e.map((d,j)=>t.jsx("tr",{className:v(f.table.row,"table-row",ye()?"cursor-pointer":""),onClick:()=>{ye()&&W(d)},children:c.map($=>t.jsx("td",{className:v(f.table.cell,"table-data",$.type=="audio"?"":"max-w-[300px]","truncate",oe($)?"cursor-pointer":""),title:String(d[$.key]??""),onClick:Z=>{oe($)&&(Z.stopPropagation(),Z.preventDefault(),ae($,d))},children:$.render?$.render(d,j):O($,d,j)},$.key))},d.id||d._id||j))})]})}),(l==null?void 0:l.enabled)&&ge.length>0&&t.jsxs("div",{className:v(f.table.pagination,"pagination-wrapper"),children:[t.jsxs("span",{children:["Showing ",(ne-1)*T+1," to"," ",Math.min(ne*T,X)," of"," ",X," results"]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:"Rows per page:"}),t.jsx("select",{value:T,onChange:d=>{const j=Number(d.target.value);V(j),M(1),l.useServerSidePagination&&N($=>({...$,current_page:1,rows_per_page:j}))},className:"rows-number-select",children:[10,25,50,100].map(d=>t.jsx("option",{value:d,children:d},d))})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>{if(ne>1){const d=ne-1;M(d),l.useServerSidePagination&&N(j=>({...j,current_page:d}))}},disabled:ne===1,className:"arrow-icons",children:t.jsx(J.ChevronLeft,{className:"h-4 w-4"})}),t.jsxs("span",{children:["Page ",ne," of ",re]}),t.jsx("button",{onClick:()=>{if(ne<re){const d=ne+1;M(d),l.useServerSidePagination&&N(j=>({...j,current_page:d}))}},disabled:ne===re,className:"arrow-icons",children:t.jsx(J.ChevronRight,{className:"h-4 w-4"})})]})]})]})]})]}),P&&Kt.createPortal(t.jsx("div",{ref:Re,style:{position:"fixed",top:`${C.top}px`,left:`${C.left}px`,zIndex:9999},className:v(f.table.menu,"w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600"),children:y.map((d,j)=>t.jsxs("button",{onClick:$=>Ue(d,i.find(Z=>Z.id===P||Z._id==P),$),className:v(f.table.menuItem,"w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600",d.variant==="danger"?"text-red-600 dark:text-red-500":"text-gray-700 dark:text-gray-200"),children:[d.icon&&t.jsx("span",{className:"shrink-0",children:d.icon}),d.title]},j))}),document.body),S&&t.jsx(zr,{isOpen:B,onClose:()=>G(!1),config:S,onApply:d=>{te(d),k==null||k(d)}}),I&&R&&t.jsx(xe,{src:R.src,alt:R.alt,isOpen:I,setIsOpen:le})]})},Ze=({isOpen:a,onClose:o,icon:e,title:r,children:n,size:s="md",actionButtons:i=[],onFormSubmit:c=()=>{},loadingBtn:b=!1,executeFunction:p=()=>{},selectedItem:h=null,footerConfig:u,classNames:l})=>{if(!a)return null;const w={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-full"},m=i.length>0||!!(u!=null&&u.cancelButton);return t.jsxs("div",{className:v(f.modal.root,"fixed inset-0 z-50 flex items-center justify-center p-4"),children:[t.jsx("div",{className:v(f.modal.overlay,"fixed inset-0 bg-gray-500 opacity-75",l==null?void 0:l.overlay),onClick:()=>o()}),t.jsxs("div",{className:v(f.modal.container,"relative bg-white rounded-lg shadow-xl w-full max-h-[90vh] flex flex-col dark:bg-gray-800",w[s]||w.md,l==null?void 0:l.container),children:[t.jsxs("div",{className:v(f.modal.header,"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",l==null?void 0:l.header),children:[t.jsxs("div",{className:"flex items-center gap-1",children:[e&&t.jsx("span",{children:e}),t.jsx("h3",{className:v(f.modal.title,"text-lg font-medium text-gray-900 dark:text-white",l==null?void 0:l.title),children:r})]}),t.jsx("button",{onClick:()=>o(),className:v(f.modal.closeButton,"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",l==null?void 0:l.closeButton),children:t.jsx(J.X,{className:"w-6 h-6"})})]}),t.jsx("div",{className:v(f.modal.body,"flex-1 overflow-y-auto p-4",l==null?void 0:l.body),children:n}),m&&t.jsxs("div",{className:v(f.modal.footer,"px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:!px-6",l==null?void 0:l.footer),children:[(u==null?void 0:u.cancelButton)&&t.jsx(he,{onClick:()=>o(),variant:"outlined",color:"default",className:v(f.modal.actionButton,"min-w-[100px]"),type:"button",children:(u==null?void 0:u.cancelText)||"Cancel"}),i.map((x,N)=>t.jsx(he,{onClick:k=>{x.type=="submit"?c(k):p(()=>{var S;return Promise.resolve((S=x==null?void 0:x.onClick)==null?void 0:S.call(x,k,h))},S=>o==null?void 0:o(S))},disabled:b||x.disabled,variant:x.variant||"contained",color:x.color||"primary",className:v(f.modal.actionButton,"min-w-[100px]",x.className||""),type:x.type||"button",children:b?t.jsxs("div",{className:v(f.modal.loadingIndicator,"flex items-center"),children:[t.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2"}),x.label||"Submit","..."]}):x.label||"Submit"},`${x.label||"action"}-${N}`))]})]})]})},_t=({config:a,onSubmit:o,initialData:e,fetchRowDetails:r,type:n})=>{const s=e||{},{formClass:i="grid grid-cols-12 gap-4",formFields:c=[]}=a||{},[b,p]=g.useState(s),[h,u]=g.useState(!0),[l,w]=g.useState({}),m=async()=>{r==null||r(s).then(k=>{p(k.data)}).catch(k=>{je.enqueueSnackbar(k.message,{variant:"error"})}).finally(()=>{u(!1)})};g.useEffect(()=>{r instanceof Function?m():(p(s),u(!1))},[]);const x=(k,S)=>{p(L=>({...L,[k]:S})),w(L=>({...L,[k]:""}))},N=k=>{k.preventDefault();const S=k.currentTarget;if(!S.checkValidity()){S.reportValidity();return}const L={};let z=!1;for(const F of c){const P=b[F.key]||"";if(F.customValidation){const U=F.customValidation(P);if(U!==!1&&(L[F.key]=U,!z)){const y=S.querySelector(`[id="field-${F.key}"]`);y==null||y.focus(),z=!0}}}w(L),!(Object.keys(L).length>0)&&o(b)};return h?t.jsx("div",{className:v(f.form.loading,"flex items-center justify-center h-64"),children:t.jsx("div",{className:"rounded-full border-4 border-blue-500 border-t-gray-200 animate-spin w-8 h-8",style:{borderTopColor:"border-primary-500"}})}):t.jsx("form",{id:n==="add"?"addForm":n==="edit"?"editForm":"defaultForm",onSubmit:N,className:v(f.form.root,i),noValidate:!1,children:c.map(k=>t.jsx(Gt,{field:k,formData:b,errorMessage:l[k.key]||"",handleChange:x},k.key))})};function Wr({data:a,config:o,fetchRowDetails:e}){const{fields:r=[],containerClass:n,variant:s="default",styles:i={}}=o||{},c=a||{},[b,p]=g.useState(c),[h,u]=g.useState(!0),l=async()=>{e==null||e(c).then(m=>{p(m.data)}).catch(m=>{je.enqueueSnackbar(m.message,{variant:"error"})}).finally(()=>{u(!1)})};if(g.useEffect(()=>{e instanceof Function?l():(p(c),u(!1))},[]),h)return t.jsx("div",{className:v(f.form.loading,"flex items-center justify-center h-64"),children:t.jsx("div",{className:"rounded-full border-4 border-blue-500 border-t-gray-200 animate-spin w-8 h-8",style:{borderTopColor:"border-primary-500"}})});const w={default:"grid grid-cols-12 gap-4",card:"grid grid-cols-12 gap-3",split:"rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden divide-y divide-gray-100 dark:divide-gray-800"};return t.jsx(t.Fragment,{children:t.jsx("div",{className:v(f.details.root,f.details.container,w[s]||w.default,n||"",i.containerClass||""),children:r.map(m=>m.renderCondition&&typeof m.renderCondition=="function"&&!m.renderCondition(b)?null:m.type=="group"?t.jsx(Ut,{col:m,data:b,uiVariant:s,styleConfig:i},m.key||m.titleKey):m.type=="cardGroup"?t.jsx(Tt,{col:m,data:b,uiVariant:s,styleConfig:i},m.key||m.titleKey):t.jsx(Bt,{col:m,data:b,uiVariant:s,styleConfig:i},m.key||m.label))})})}const Hr=({config:a})=>{var M,T,V,X,K,re,_e,Re,De,Ce,ze,Oe,Ue,Te,$e,Le,Be,Ge,Pe,Ye,Ke,We;const{title:o,fetchData:e,fetchRowDetails:r,isStaticData:n=!1,tableConfig:s,modalConfig:i,filterConfig:c}=a,[b,p]=g.useState(!0),[h,u]=g.useState(!1),[l,w]=g.useState([]),[m,x]=g.useState(null),[N,k]=g.useState({search:"",rows_per_page:50,current_page:1,sort_by:"",sort_order:""}),[S,L]=g.useState({}),[z,F]=g.useState(!1),[P,U]=g.useState(!1),[y,_]=g.useState(!1),[C,A]=g.useState(!1),[B,G]=g.useState(!1),[ee,te]=g.useState(null),E=(O,W)=>{O==="edit"?(te(W),_(!0)):O==="view"?(te(W),G(!0)):O==="delete"&&(te(W),A(!0))},se=async(O,W,ae="",ye="")=>{u(!0);try{if(!O)return;const oe=await O();(ae||oe!=null&&oe.message)&&je.enqueueSnackbar(ae||oe.message||"Success",{variant:"success"}),W==null||W(oe)}catch(oe){(ye||oe!=null&&oe.message)&&je.enqueueSnackbar(ye||oe.message||"Error occurred",{variant:"error"})}finally{u(!1)}},H=O=>{const W=O.newObject;n?(w(ae=>[W,...ae]),x(ae=>({...ae,current_page:1}))):(k(ae=>({...ae,current_page:1})),N.current_page===1&&I()),U(!1)},Q=O=>{const{newObject:W,targetObject:ae}=O;n?w(ye=>ye.map(oe=>oe.id===ae.id?{...oe,...W}:oe)):I(),_(!1)},D=O=>{if(!O){A(!1),te(null);return}n?w(W=>W.filter(ae=>ae.id!==O.targetObject.id)):l.length===1&&N.current_page>1?k(W=>({...W,current_page:W.current_page-1})):I(),A(!1),te(null)},R=O=>se(()=>{var W;return(W=i==null?void 0:i.addModal)!=null&&W.handleSubmit?i.addModal.handleSubmit(O):Promise.resolve({newObject:null})},H),Y=O=>se(()=>{var W;return(W=i==null?void 0:i.editModal)!=null&&W.handleSubmit?i.editModal.handleSubmit(O,ee):Promise.resolve({newObject:null,targetObject:null})},Q),I=async()=>{p(!0);try{const O=await e({...N,...S});w(O.data||[]),x(O.pagination||null)}catch(O){je.enqueueSnackbar(O.message||"Failed to fetch data",{variant:"error"})}finally{p(!1)}},le=O=>{var W;L(ae=>({...O})),(W=s==null?void 0:s.filter)!=null&&W.useServerSideFilters&&F(ae=>!ae)},me=(O,W)=>O.filter(ae=>Object.entries(W).every(([ye,oe])=>ae[ye]===oe)),ge=g.useMemo(()=>{var O;return(O=s==null?void 0:s.filter)!=null&&O.useServerSideFilters?l:me(l,S)},[l,S,(M=s==null?void 0:s.filter)==null?void 0:M.useServerSideFilters]),ne=(T=i==null?void 0:i.viewModal)==null?void 0:T.component;return g.useEffect(()=>{I()},[N.search,N.rows_per_page,N.current_page,N.sort_by,N.sort_order,z]),t.jsxs("div",{className:f.crudPage.root,children:[t.jsx(Kr,{title:o,setShowAdd:U,description:a.description,buttonText:a.buttonText,showAddButton:!!(i!=null&&i.addModal),config:{...s,pagination:{...s.pagination,...m},data:ge,setServerSidePaginationData:k,onMenuAction:E,filterConfig:c,onFilterApply:le,loading:b}}),t.jsx(Ze,{isOpen:P,onClose:()=>{h||U(!1)},icon:(V=i==null?void 0:i.addModal)==null?void 0:V.icon,title:((X=i==null?void 0:i.addModal)==null?void 0:X.title)||"Add New",size:((K=i==null?void 0:i.addModal)==null?void 0:K.size)||"md",onFormSubmit:()=>{var O;return(O=document.querySelector("#addForm"))==null?void 0:O.requestSubmit()},loadingBtn:h,actionButtons:((re=i==null?void 0:i.addModal)==null?void 0:re.actionButtons)||[],children:t.jsx(_t,{config:(i==null?void 0:i.addModal)||{},onSubmit:R,initialData:{},type:"add",loading:h})}),t.jsx(Ze,{isOpen:y,onClose:()=>{h||_(!1)},icon:(_e=i==null?void 0:i.editModal)==null?void 0:_e.icon,title:((Re=i==null?void 0:i.editModal)==null?void 0:Re.title)||"Edit",size:((De=i==null?void 0:i.editModal)==null?void 0:De.size)||"md",onFormSubmit:()=>{var O;return(O=document.querySelector("#editForm"))==null?void 0:O.requestSubmit()},actionButtons:((Ce=i==null?void 0:i.editModal)==null?void 0:Ce.actionButtons)||[],loadingBtn:h,children:t.jsx(_t,{config:(i==null?void 0:i.editModal)||{},onSubmit:Y,initialData:ee,type:"edit",loading:h,fetchRowDetails:r})}),C&&t.jsx(Ze,{isOpen:C,onClose:O=>{D(O)},icon:((ze=i==null?void 0:i.deleteModal)==null?void 0:ze.icon)||t.jsx(ue.Icon,{icon:"ph:warning-bold",className:"w-6 h-6 text-red-500"}),title:((Oe=i==null?void 0:i.deleteModal)==null?void 0:Oe.title)||"Confirm Delete",size:((Ue=i==null?void 0:i.deleteModal)==null?void 0:Ue.size)||"md",loading:h,actionButtons:((Te=i==null?void 0:i.deleteModal)==null?void 0:Te.actionButtons)||[],executeFunction:se,selectedItem:ee,children:t.jsx("div",{className:v(f.crudPage.deleteContent,"flex items-center space-x-2 py-3"),children:t.jsxs("div",{children:[t.jsx("p",{className:"text-md text-gray-700 dark:text-white",children:(($e=i==null?void 0:i.deleteModal)==null?void 0:$e.confirmText)||"Are you sure you want to delete this item?"}),((Le=i==null?void 0:i.deleteModal)==null?void 0:Le.referenceKey)&&t.jsx("p",{className:"text-md font-semibold text-gray-700 dark:text-white",children:ee==null?void 0:ee[(Be=i==null?void 0:i.deleteModal)==null?void 0:Be.referenceKey]})]})})}),(i==null?void 0:i.viewModal)&&t.jsx(Ze,{isOpen:B,onClose:()=>{G(!1),te(null)},icon:(Ge=i==null?void 0:i.viewModal)==null?void 0:Ge.icon,title:((Pe=i==null?void 0:i.viewModal)==null?void 0:Pe.title)||"View Details",size:((Ye=i==null?void 0:i.viewModal)==null?void 0:Ye.size)||"lg",footerConfig:(Ke=i==null?void 0:i.viewModal)==null?void 0:Ke.footer,classNames:(We=i==null?void 0:i.viewModal)==null?void 0:We.modalClassNames,children:ne?t.jsx(ne,{data:ee}):t.jsx(Wr,{data:ee,fetchRowDetails:r,config:(i==null?void 0:i.viewModal)||{}})})]})};function Zr({children:a}){return je.useSnackbar(),a}function Vr({children:a}){try{return t.jsx(Zr,{children:a})}catch{return t.jsx(je.SnackbarProvider,{anchorOrigin:{vertical:"bottom",horizontal:"right"},action:e=>t.jsx("button",{onClick:()=>{window.dispatchEvent(new CustomEvent("closeSnackbar",{detail:e}))},className:"p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",children:t.jsx(J.X,{className:"h-4 w-4"})}),maxSnack:3,autoHideDuration:3e3,children:a})}}const Xr=()=>{if(typeof document>"u"||document.getElementById("react-admin-crud-manager-styles"))return;const a=document.createElement("style");a.id="react-admin-crud-manager-styles",a.textContent=Zt,document.head.appendChild(a)};function qr({config:a}){return g.useEffect(()=>{Xr()},[]),t.jsx(Vr,{children:t.jsx(Hr,{config:a})})}module.exports=qr;
165
130
  //# sourceMappingURL=index.cjs.js.map