@matthiaskrijgsman/mat-ui 0.0.26 → 0.0.27

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.
@@ -1,4 +1,4 @@
1
- (function(B,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],S):(B=typeof globalThis<"u"?globalThis:B||self,S(B.MatUI={},B.React,B.ReactDOM))})(this,(function(B,S,Tu){"use strict";function Co(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const C=Co(S),Po=Co(Tu);function Ao(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yn={exports:{}},Wt={};/**
1
+ (function(B,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],S):(B=typeof globalThis<"u"?globalThis:B||self,S(B.MatUI={},B.React,B.ReactDOM))})(this,(function(B,S,Tu){"use strict";"use client";function Co(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const C=Co(S),Po=Co(Tu);function Ao(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yn={exports:{}},Wt={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -179,5 +179,5 @@ Valid keys: `+JSON.stringify(Object.keys(g),null," "));var D=de($,Q,_,z,H+"."+Q
179
179
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lx(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cx(e){if(Array.isArray(e))return lo(e)}function Gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function Xc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gc(Object(n),!0).forEach(function(i){Zc(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gc(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Zc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hn(e,t){return px(e)||dx(e,t)||Jc(e,t)||ux()}function ux(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
180
180
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jc(e,t){if(e){if(typeof e=="string")return lo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lo(e,t)}}function lo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function dx(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],r=!0,o=!1,s,a;try{for(n=n.call(e);!(r=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));r=!0);}catch(l){o=!0,a=l}finally{try{!r&&n.return!=null&&n.return()}finally{if(o)throw a}}return i}}function px(e){if(Array.isArray(e))return e}var fx=typeof ao=="function"?ao:ao.default,mx="file-invalid-type",hx="file-too-large",gx="file-too-small",vx="too-many-files",xx=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),i=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:mx,message:"File type must be ".concat(i)}},Qc=function(t){return{code:hx,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},eu=function(t){return{code:gx,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},yx={code:vx,message:"Too many files"};function bx(e){return e.type===""&&typeof e.getAsFile=="function"}function tu(e,t){var n=e.type==="application/x-moz-file"||fx(e,t)||bx(e);return[n,n?null:xx(t)]}function nu(e,t,n){if(xt(e.size))if(xt(t)&&xt(n)){if(e.size>n)return[!1,Qc(n)];if(e.size<t)return[!1,eu(t)]}else{if(xt(t)&&e.size<t)return[!1,eu(t)];if(xt(n)&&e.size>n)return[!1,Qc(n)]}return[!0,null]}function xt(e){return e!=null}function wx(e){var t=e.files,n=e.accept,i=e.minSize,r=e.maxSize,o=e.multiple,s=e.maxFiles,a=e.validator;return!o&&t.length>1||o&&s>=1&&t.length>s?!1:t.every(function(l){var u=tu(l,n),c=hn(u,1),d=c[0],f=nu(l,i,r),m=hn(f,1),v=m[0],x=a?a(l):null;return d&&v&&!x})}function ni(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function gn(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function iu(e){e.preventDefault()}function Tx(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Sx(e){return e.indexOf("Edge/")!==-1}function kx(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Tx(e)||Sx(e)}function Be(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return t.some(function(a){return!ni(i)&&a&&a.apply(void 0,[i].concat(o)),ni(i)})}}function jx(){return"showOpenFilePicker"in window}function Ex(e){if(xt(e)){var t=Object.entries(e).filter(function(n){var i=hn(n,2),r=i[0],o=i[1],s=!0;return ru(r)||(console.warn('Skipped "'.concat(r,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),s=!1),(!Array.isArray(o)||!o.every(ou))&&(console.warn('Skipped "'.concat(r,'" because an invalid file extension was provided.')),s=!1),s}).reduce(function(n,i){var r=hn(i,2),o=r[0],s=r[1];return Xc(Xc({},n),{},Zc({},o,s))},{});return[{description:"Files",accept:t}]}return e}function Cx(e){if(xt(e))return Object.entries(e).reduce(function(t,n){var i=hn(n,2),r=i[0],o=i[1];return[].concat(Yc(t),[r],Yc(o))},[]).filter(function(t){return ru(t)||ou(t)}).join(",")}function Px(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Ax(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function ru(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function ou(e){return/^.*\.[\w]+$/.test(e)}var Dx=["children"],Rx=["open"],Ox=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Mx=["refKey","onChange","onClick"];function su(e){return Fx(e)||Nx(e)||au(e)||Ix()}function Ix(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
181
181
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nx(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Fx(e){if(Array.isArray(e))return uo(e)}function co(e,t){return Lx(e)||_x(e,t)||au(e,t)||Vx()}function Vx(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
182
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function au(e,t){if(e){if(typeof e=="string")return uo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uo(e,t)}}function uo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _x(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],r=!0,o=!1,s,a;try{for(n=n.call(e);!(r=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));r=!0);}catch(l){o=!0,a=l}finally{try{!r&&n.return!=null&&n.return()}finally{if(o)throw a}}return i}}function Lx(e){if(Array.isArray(e))return e}function lu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(n),!0).forEach(function(i){po(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lu(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ii(e,t){if(e==null)return{};var n=zx(e,t),i,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)i=o[r],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function zx(e,t){if(e==null)return{};var n={},i=Object.keys(e),r,o;for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}var fo=S.forwardRef(function(e,t){var n=e.children,i=ii(e,Dx),r=ho(i),o=r.open,s=ii(r,Rx);return S.useImperativeHandle(t,function(){return{open:o}},[o]),S.createElement(S.Fragment,null,n(oe(oe({},s),{},{open:o})))});fo.displayName="Dropzone";var cu={disabled:!1,getFilesFromEvent:Xv,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};fo.defaultProps=cu,fo.propTypes={children:re.func,accept:re.objectOf(re.arrayOf(re.string)),multiple:re.bool,preventDropOnDocument:re.bool,noClick:re.bool,noKeyboard:re.bool,noDrag:re.bool,noDragEventsBubbling:re.bool,minSize:re.number,maxSize:re.number,maxFiles:re.number,disabled:re.bool,getFilesFromEvent:re.func,onFileDialogCancel:re.func,onFileDialogOpen:re.func,useFsAccessApi:re.bool,autoFocus:re.bool,onDragEnter:re.func,onDragLeave:re.func,onDragOver:re.func,onDrop:re.func,onDropAccepted:re.func,onDropRejected:re.func,onError:re.func,validator:re.func};var mo={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function ho(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=oe(oe({},cu),e),n=t.accept,i=t.disabled,r=t.getFilesFromEvent,o=t.maxSize,s=t.minSize,a=t.multiple,l=t.maxFiles,u=t.onDragEnter,c=t.onDragLeave,d=t.onDragOver,f=t.onDrop,m=t.onDropAccepted,v=t.onDropRejected,x=t.onFileDialogCancel,b=t.onFileDialogOpen,h=t.useFsAccessApi,T=t.autoFocus,w=t.preventDropOnDocument,k=t.noClick,y=t.noKeyboard,P=t.noDrag,E=t.noDragEventsBubbling,A=t.onError,M=t.validator,W=S.useMemo(function(){return Cx(n)},[n]),O=S.useMemo(function(){return Ex(n)},[n]),J=S.useMemo(function(){return typeof b=="function"?b:uu},[b]),Y=S.useMemo(function(){return typeof x=="function"?x:uu},[x]),F=S.useRef(null),ee=S.useRef(null),ie=S.useReducer(Bx,mo),X=co(ie,2),q=X[0],Z=X[1],g=q.isFocused,j=q.isFileDialogActive,I=S.useRef(typeof window<"u"&&window.isSecureContext&&h&&jx()),V=function(){!I.current&&j&&setTimeout(function(){if(ee.current){var U=ee.current.files;U.length||(Z({type:"closeDialog"}),Y())}},300)};S.useEffect(function(){return window.addEventListener("focus",V,!1),function(){window.removeEventListener("focus",V,!1)}},[ee,j,Y,I]);var _=S.useRef([]),z=S.useRef([]),H=function(U){F.current&&F.current.contains(U.target)||(U.preventDefault(),_.current=[])};S.useEffect(function(){return w&&(document.addEventListener("dragover",iu,!1),document.addEventListener("drop",H,!1)),function(){w&&(document.removeEventListener("dragover",iu),document.removeEventListener("drop",H))}},[F,w]),S.useEffect(function(){var R=function($e){z.current=[].concat(su(z.current),[$e.target]),gn($e)&&Z({isDragGlobal:!0,type:"setDragGlobal"})},U=function($e){z.current=z.current.filter(function(Ge){return Ge!==$e.target&&Ge!==null}),!(z.current.length>0)&&Z({isDragGlobal:!1,type:"setDragGlobal"})},ce=function(){z.current=[],Z({isDragGlobal:!1,type:"setDragGlobal"})},me=function(){z.current=[],Z({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",R,!1),document.addEventListener("dragleave",U,!1),document.addEventListener("dragend",ce,!1),document.addEventListener("drop",me,!1),function(){document.removeEventListener("dragenter",R),document.removeEventListener("dragleave",U),document.removeEventListener("dragend",ce),document.removeEventListener("drop",me)}},[F]),S.useEffect(function(){return!i&&T&&F.current&&F.current.focus(),function(){}},[F,T,i]);var $=S.useCallback(function(R){A?A(R):console.error(R)},[A]),L=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R),_.current=[].concat(su(_.current),[R.target]),gn(R)&&Promise.resolve(r(R)).then(function(U){if(!(ni(R)&&!E)){var ce=U.length,me=ce>0&&wx({files:U,accept:W,minSize:s,maxSize:o,multiple:a,maxFiles:l,validator:M}),xe=ce>0&&!me;Z({isDragAccept:me,isDragReject:xe,isDragActive:!0,type:"setDraggedFiles"}),u&&u(R)}}).catch(function(U){return $(U)})},[r,u,$,E,W,s,o,a,l,M]),G=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R);var U=gn(R);if(U&&R.dataTransfer)try{R.dataTransfer.dropEffect="copy"}catch{}return U&&d&&d(R),!1},[d,E]),Q=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R);var U=_.current.filter(function(me){return F.current&&F.current.contains(me)}),ce=U.indexOf(R.target);ce!==-1&&U.splice(ce,1),_.current=U,!(U.length>0)&&(Z({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),gn(R)&&c&&c(R))},[F,c,E]),de=S.useCallback(function(R,U){var ce=[],me=[];R.forEach(function(xe){var $e=tu(xe,W),Ge=co($e,2),bo=Ge[0],wo=Ge[1],To=nu(xe,s,o),si=co(To,2),So=si[0],ko=si[1],jo=M?M(xe):null;if(bo&&So&&!jo)ce.push(xe);else{var Eo=[wo,ko];jo&&(Eo=Eo.concat(jo)),me.push({file:xe,errors:Eo.filter(function(Ty){return Ty})})}}),(!a&&ce.length>1||a&&l>=1&&ce.length>l)&&(ce.forEach(function(xe){me.push({file:xe,errors:[yx]})}),ce.splice(0)),Z({acceptedFiles:ce,fileRejections:me,type:"setFiles"}),f&&f(ce,me,U),me.length>0&&v&&v(me,U),ce.length>0&&m&&m(ce,U)},[Z,a,W,s,o,l,f,m,v,M]),D=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R),_.current=[],gn(R)&&Promise.resolve(r(R)).then(function(U){ni(R)&&!E||de(U,R)}).catch(function(U){return $(U)}),Z({type:"reset"})},[r,de,$,E]),ve=S.useCallback(function(){if(I.current){Z({type:"openDialog"}),J();var R={multiple:a,types:O};window.showOpenFilePicker(R).then(function(U){return r(U)}).then(function(U){de(U,null),Z({type:"closeDialog"})}).catch(function(U){Px(U)?(Y(U),Z({type:"closeDialog"})):Ax(U)?(I.current=!1,ee.current?(ee.current.value=null,ee.current.click()):$(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):$(U)});return}ee.current&&(Z({type:"openDialog"}),J(),ee.current.value=null,ee.current.click())},[Z,J,Y,h,de,$,O,a]),yt=S.useCallback(function(R){!F.current||!F.current.isEqualNode(R.target)||(R.key===" "||R.key==="Enter"||R.keyCode===32||R.keyCode===13)&&(R.preventDefault(),ve())},[F,ve]),xn=S.useCallback(function(){Z({type:"focus"})},[]),bu=S.useCallback(function(){Z({type:"blur"})},[]),wu=S.useCallback(function(){k||(kx()?setTimeout(ve,0):ve())},[k,ve]),$t=function(U){return i?null:U},yo=function(U){return y?null:$t(U)},ri=function(U){return P?null:$t(U)},oi=function(U){E&&U.stopPropagation()},yy=S.useMemo(function(){return function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=R.refKey,ce=U===void 0?"ref":U,me=R.role,xe=R.onKeyDown,$e=R.onFocus,Ge=R.onBlur,bo=R.onClick,wo=R.onDragEnter,To=R.onDragOver,si=R.onDragLeave,So=R.onDrop,ko=ii(R,Ox);return oe(oe(po({onKeyDown:yo(Be(xe,yt)),onFocus:yo(Be($e,xn)),onBlur:yo(Be(Ge,bu)),onClick:$t(Be(bo,wu)),onDragEnter:ri(Be(wo,L)),onDragOver:ri(Be(To,G)),onDragLeave:ri(Be(si,Q)),onDrop:ri(Be(So,D)),role:typeof me=="string"&&me!==""?me:"presentation"},ce,F),!i&&!y?{tabIndex:0}:{}),ko)}},[F,yt,xn,bu,wu,L,G,Q,D,y,P,i]),by=S.useCallback(function(R){R.stopPropagation()},[]),wy=S.useMemo(function(){return function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=R.refKey,ce=U===void 0?"ref":U,me=R.onChange,xe=R.onClick,$e=ii(R,Mx),Ge=po({accept:W,multiple:a,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:$t(Be(me,D)),onClick:$t(Be(xe,by)),tabIndex:-1},ce,ee);return oe(oe({},Ge),$e)}},[ee,n,a,D,i]);return oe(oe({},q),{},{isFocused:g&&!i,getRootProps:yy,getInputProps:wy,rootRef:F,inputRef:ee,open:$t(ve)})}function Bx(e,t){switch(t.type){case"focus":return oe(oe({},e),{},{isFocused:!0});case"blur":return oe(oe({},e),{},{isFocused:!1});case"openDialog":return oe(oe({},mo),{},{isFileDialogActive:!0});case"closeDialog":return oe(oe({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return oe(oe({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return oe(oe({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return oe(oe({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return oe({},mo);default:return e}}function uu(){}const $x={sm:"h-7",md:"h-8",lg:"h-10"},Wx={sm:"px-2.5",md:"px-3",lg:"px-4"},Ux={sm:"text-xs",md:"text-sm",lg:"text-sm"},qx=e=>{const{label:t,description:n,error:i,placeholder:r="No file chosen",buttonText:o="Choose",Icon:s=Oh,size:a="md",value:l,isUploaded:u=!1,isUploading:c=!1,onChange:d,onDropRejected:f,accept:m,maxSize:v,minSize:x,disabled:b=!1,className:h}=e,T=async M=>{const[W]=M;W&&await d?.(W)},{getRootProps:w,getInputProps:k,open:y,isDragActive:P,isFocused:E}=ho({multiple:!1,accept:m,maxSize:v,minSize:x,disabled:b,onDrop:T,onDropRejected:f}),A=l?.name;return p.jsx(Ke.Provider,{value:a,children:p.jsxs("div",{className:N("flex flex-col",h),children:[p.jsx(Ve,{children:t}),p.jsxs("div",{...w({className:N("flex flex-row items-center","border input-base rounded-xl shadow-sm transition-all duration-150","ring-0 focus:outline-none",(E||P)&&"ring-4",i&&"input-error",b&&"opacity-60 cursor-not-allowed",et[a],ut[a],"gap-3")}),children:[p.jsx("input",{...k()}),p.jsx(s,{className:N("input-icon shrink-0",pt[a])}),p.jsx("span",{className:N("flex-1 truncate",qe[a],!A&&"text-[var(--color-input-placeholder)]"),children:A??r}),i&&p.jsx(He,{}),c&&!i&&p.jsx("div",{className:"h-5 w-5 flex items-center justify-center",children:p.jsx(It,{className:"h-4 w-4 text-[var(--color-input-icon)]"})}),u&&!c&&!i&&p.jsx("div",{className:"h-5 w-5",children:p.jsx(Dr,{className:"h-5 w-5 text-[var(--color-status-success)]"})}),p.jsx("button",{type:"button",disabled:b,onClick:M=>{M.stopPropagation(),y()},className:N("inline-flex flex-row items-center justify-center shrink-0","border button-white shadow-sm rounded-[calc(var(--border-radius-input)-0.25rem)]","font-semibold cursor-pointer select-none transition-all duration-150","button-ring ring-0 hover:ring-4 active:ring-1 focus:outline-none focus:ring-4","disabled:cursor-default","mr-1.5",$x[a],Wx[a],Ux[a]),children:o})]}),p.jsx(Se,{children:n}),p.jsx(ke,{children:i})]})})},Hx=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`,du=e=>{const{file:t,isUploaded:n=!1,isUploading:i=!1,error:r,onRemove:o,className:s}=e,a=i||n||!!r;return p.jsxs("div",{className:N("flex flex-row items-center gap-3","border input-base rounded-xl shadow-sm","pl-4 pr-1 py-1",r&&"input-error",s),children:[a&&p.jsx("div",{className:"shrink-0 h-5 w-5 flex items-center justify-center",children:r?p.jsx(Rr,{className:"h-5 w-5 input-error-icon"}):i?p.jsx(It,{className:"h-4 w-4 text-[var(--color-input-icon)]"}):p.jsx(Dr,{className:"h-5 w-5 text-[var(--color-status-success)]"})}),p.jsx("div",{className:"flex-1 min-w-0 font-medium truncate",children:t.name}),p.jsx("div",{className:"shrink-0 text-sm text-[var(--color-input-description-text)]",children:Hx(t.size)}),o&&p.jsx(_n,{variant:"transparent",size:"sm",Icon:ft,onClick:o,"aria-label":"Remove file",className:"shrink-0"})]})},Kx=e=>{const{label:t,description:n,error:i,title:r="Drop files here",hint:o,Icon:s=Ah,onUpload:a,onFileRemoved:l,onDropRejected:u,renderFileTile:c,accept:d,maxSize:f,minSize:m,maxFiles:v,disabled:x=!1,className:b}=e,[h,T]=S.useState([]),w=S.useRef(0),k=(O,J)=>{T(Y=>Y.map(F=>F.id===O?{...F,...J}:F))},y=O=>{if(O.length===0)return;const J=O.map(Y=>({id:String(++w.current),file:Y,status:a?"uploading":"idle"}));if(T(Y=>[...Y,...J]),!!a)for(const Y of J)Promise.resolve().then(()=>a(Y.file)).then(()=>k(Y.id,{status:"uploaded"})).catch(F=>{k(Y.id,{status:"error",error:F instanceof Error?F:new Error(String(F))})})},P=O=>{const J=h.find(Y=>Y.id===O);T(Y=>Y.filter(F=>F.id!==O)),J&&l?.(J.file)},{getRootProps:E,getInputProps:A,isDragActive:M,isFocused:W}=ho({multiple:!0,accept:d,maxSize:f,minSize:m,maxFiles:v,disabled:x,onDrop:y,onDropRejected:u});return p.jsxs("div",{className:N("flex flex-col",b),children:[p.jsx(Ve,{children:t}),p.jsxs("div",{...E({className:N("flex flex-col items-center justify-center gap-1","border-2 border-dashed input-base rounded-xl bg-transparent!","py-10 px-6 cursor-pointer transition-all duration-150","ring-0 focus:outline-none",(W||M)&&"ring-4",i&&"input-error",x&&"opacity-60 cursor-not-allowed")}),children:[p.jsx("input",{...A()}),p.jsx("div",{className:"h-14 w-14 rounded-xl flex items-center justify-center bg-[var(--color-input-file-icon-bg)] mb-2",children:p.jsx(s,{className:"h-7 w-7 input-icon"})}),p.jsx("div",{className:"text-base font-semibold",children:r}),o&&p.jsx("div",{className:"text-sm text-[var(--color-input-description-text)] ",children:o})]}),h.length>0&&p.jsx("div",{className:"flex flex-col gap-2 mt-3",children:h.map(O=>{const J={file:O.file,isUploading:O.status==="uploading",isUploaded:O.status==="uploaded",error:O.status==="error"?O.error?.message:void 0,onRemove:()=>P(O.id)};return p.jsx(C.Fragment,{children:c?c(O.file,J):p.jsx(du,{...J})},O.id)})}),p.jsx(Se,{children:n}),p.jsx(ke,{children:i})]})},Yx=e=>{const{className:t,label:n,description:i,options:r,error:o,size:s="md",...a}=e;return p.jsx(Ke.Provider,{value:s,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",children:[p.jsx("select",{className:N("appearance-none border input-base bg-none transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none",et[s],qe[s],ut[s],dt[s]),...a,children:r&&r.map((l,u)=>p.jsx("option",{value:l.value,disabled:l.disabled,children:l.label},u))}),p.jsxs(tt,{children:[o&&p.jsx(He,{}),p.jsx(Ye,{Icon:cn})]})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:o})]})})},vn=e=>{const{children:t,onClick:n,selected:i,disabled:r=!1}=e;return p.jsxs("div",{onClick:()=>!r&&n&&n(),className:N("option-base px-4 py-2 rounded-xl cursor-pointer transition-all duration-150 select-none flex flex-row gap-3 items-center",i&&!r&&"option-selected",r&&"option-disabled cursor-not-allowed hover:bg-transparent active:bg-transparent"),children:[p.jsx("div",{className:"flex-1",children:t}),i&&!r&&p.jsx("div",{className:"shrink-0",children:p.jsx(Eh,{className:"h-5 w-5"})})]})},pu=e=>{const{className:t,label:n,description:i,options:r,onChange:o,value:s,placeholder:a,maxHeight:l=300,error:u,size:c="md"}=e,[d,f]=S.useState(!1),m=C.useRef(null),v=r?.find(h=>h.value===s);_t(d,()=>f(!1)),S.useEffect(()=>{d&&m.current?.focus({preventScroll:!0})},[d]);const{anchorRef:x,Popover:b}=gt({placement:"bottom",fullWidth:!0,onOutsideClick:()=>f(!1)});return p.jsx(Ke.Provider,{value:c,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",ref:x,children:[p.jsxs("div",{ref:m,role:"button",tabIndex:0,className:N("flex flex-row items-center border select-trigger transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none select-none",et[c],qe[c],ut[c],dt[c],u&&"select-trigger-error",d&&"ring-4"),onKeyDown:h=>h.key===" "&&f(T=>!T),onClick:()=>f(!d),children:[v&&p.jsx("span",{children:v.label}),!v&&a&&p.jsx("span",{className:"select-placeholder",children:a})]}),p.jsxs(tt,{children:[u&&p.jsx(He,{}),!!s&&p.jsx(Ye,{Icon:ft,onClick:()=>o(null)}),p.jsx(Ye,{Icon:cn})]}),p.jsx(b,{open:d,children:p.jsx(mt,{className:"!p-0",style:{maxHeight:l},children:p.jsx("div",{className:"flex flex-col p-2 gap-1",children:r.map(h=>{const T=h.value===s;return p.jsx(vn,{onClick:()=>{!h.disabled&&o&&(o(h.value),f(!1))},selected:T,disabled:h.disabled,children:h.label},String(h.value))})})})})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:u})]})})},Gx=e=>{const{className:t,label:n,description:i,options:r,onChange:o,onSearch:s,value:a,placeholder:l,maxHeight:u=300,error:c,size:d="md"}=e,[f,m]=S.useState(!1),[v,x]=S.useState(r),[b,h]=S.useState(""),T=C.useRef(null),w=C.useRef(null),k=r?.find(E=>E.value===a);_t(f,()=>m(!1)),S.useEffect(()=>{x(s(b))},[b,r,s]),S.useEffect(()=>{f&&setTimeout(()=>w.current?.focus(),100)},[f]);const{anchorRef:y,Popover:P}=gt({placement:"bottom",fullWidth:!0,onOutsideClick:()=>m(!1)});return p.jsx(Ke.Provider,{value:d,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",ref:y,children:[p.jsxs("div",{ref:T,role:"button",tabIndex:0,className:N("flex flex-row items-center border select-trigger transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none select-none",et[d],qe[d],ut[d],dt[d],c&&"select-trigger-error",f&&"ring-4"),onKeyDown:E=>E.key===" "&&m(A=>!A),onClick:()=>m(!f),children:[k&&p.jsx("span",{children:k.label}),!k&&l&&p.jsx("span",{className:"select-placeholder",children:l})]}),p.jsxs(tt,{children:[c&&p.jsx(He,{}),!!a&&p.jsx(Ye,{Icon:ft,onClick:()=>o(null)}),p.jsx(Ye,{Icon:cn})]}),p.jsx(P,{open:f,children:p.jsxs(mt,{className:"gap-0 !p-0",style:{maxHeight:u},children:[p.jsxs("div",{className:"sticky top-0 border-b select-search-bar py-1 backdrop-blur-sm",children:[p.jsx("input",{ref:w,type:"text",placeholder:"Search",value:b,className:"appearance-none border-none w-full bg-transparent rounded- pl-10 transition-all duration-150 focus:outline-none ring-0 placeholder:text-[var(--color-input-placeholder)]",onChange:E=>h(E.target.value)}),p.jsx(Ar,{className:"absolute select-search-icon left-4 top-4 h-4 w-4"})]}),p.jsxs("div",{className:"flex flex-col gap-1 p-2",children:[b!==""&&p.jsxs(p.Fragment,{children:[v.length===0&&p.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:p.jsx(Ul,{className:"h-6 w-6 text-[var(--color-input-text)]"})}),v.map(E=>{const A=E.value===a;return p.jsx(vn,{onClick:()=>{!E.disabled&&o&&(o(E.value),m(!1))},selected:A,disabled:E.disabled,children:E.label},String(E.value))})]}),b===""&&p.jsx(p.Fragment,{children:r.map(E=>{const A=E.value===a;return p.jsx(vn,{onClick:()=>{!E.disabled&&o&&(o(E.value),m(!1))},selected:A,disabled:E.disabled,children:E.label},String(E.value))})})]})]})})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:c})]})})},Xx=(e,t)=>{const[n,i]=S.useState(e);return S.useEffect(()=>{const r=setTimeout(()=>{i(e)},t);return()=>{clearTimeout(r)}},[e,t]),n},Zx=e=>{const{className:t,label:n,description:i,onChange:r,fetchOptionsByQuery:o,fetchOptionByValue:s,onSearchDebounceMs:a=300,value:l,placeholder:u,maxHeight:c=300,error:d,size:f="md"}=e,[m,v]=S.useState(!1),x=C.useRef(null),[b,h]=S.useState(""),[T,w]=S.useState([]),[k,y]=S.useState(null),P=C.useRef(null),[E,A]=S.useState(!1),[M,W]=S.useState(!1);_t(m,()=>v(!1));const O=Xx(b,a);S.useEffect(()=>{(async()=>{A(!0);const ee=await o(O);w(ee),A(!1)})()},[O,o]),S.useEffect(()=>{if(l==null){y(null);return}const F=T?.find(ee=>ee.value===l);F?y(F):(async()=>{W(!0);const ie=await s(l);y(ie),W(!1)})()},[s,T,l]),S.useEffect(()=>{m&&setTimeout(()=>P.current?.focus(),100)},[m]);const{anchorRef:J,Popover:Y}=gt({placement:"bottom",fullWidth:!0,onOutsideClick:()=>v(!1)});return p.jsx(Ke.Provider,{value:f,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",ref:J,children:[p.jsxs("div",{ref:x,role:"button",tabIndex:0,className:N("flex flex-row items-center border select-trigger transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none select-none",et[f],qe[f],ut[f],dt[f],d&&"select-trigger-error",m&&"ring-4"),onKeyDown:F=>F.key===" "&&v(ee=>!ee),onClick:()=>v(!m),children:[!M&&k&&p.jsx("span",{children:k.label}),!M&&!k&&u&&p.jsx("span",{className:"select-placeholder",children:u}),M&&p.jsx(It,{className:"h-4 w-4 text-[var(--color-input-text)]"})]}),p.jsxs(tt,{children:[d&&p.jsx(He,{}),!!l&&p.jsx(Ye,{Icon:ft,onClick:()=>r(null)}),p.jsx(Ye,{Icon:cn})]}),p.jsx(Y,{open:m,children:p.jsxs(mt,{className:"gap-0 !p-0",style:{maxHeight:c},children:[p.jsxs("div",{className:"sticky top-0 border-b select-search-bar py-1 backdrop-blur-sm",children:[p.jsx("input",{ref:P,type:"text",placeholder:"Search",value:b,className:"appearance-none border-none w-full bg-transparent rounded- pl-10 transition-all duration-150 focus:outline-none ring-0 placeholder:text-[var(--color-input-placeholder)]",onChange:F=>h(F.target.value)}),p.jsx(Ar,{className:"absolute select-search-icon left-4 top-4 h-4 w-4"})]}),p.jsxs("div",{className:"flex flex-col gap-1 p-2",children:[!E&&T.length===0&&p.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:p.jsx(Ul,{className:"h-6 w-6 text-[var(--color-input-text)]"})}),E&&p.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:p.jsx(It,{className:"h-6 w-6 text-[var(--color-input-text)]"})}),!E&&p.jsx(p.Fragment,{children:T.map(F=>{const ee=F.value===l;return p.jsx(vn,{onClick:()=>{!F.disabled&&r&&(r(F.value),v(!1))},selected:ee,disabled:F.disabled,children:F.label},String(F.value))})})]})]})})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:d})]})})},Jx=C.forwardRef((e,t)=>{const{className:n,children:i,...r}=e;return p.jsx("div",{ref:t,className:N("flex flex-col gap-6 border panel-base rounded-2xl shadow-sm px-6 py-6",n),...r,children:i})}),Qx=C.forwardRef((e,t)=>{const{className:n,children:i,...r}=e;return p.jsx("div",{ref:t,className:N("flex flex-col gap-1 border panel-base rounded-2xl shadow-sm p-2",n),...r,children:i})}),fu="input-description text-sm font-medium",ey=e=>{const{className:t,label:n,children:i,orientation:r="vertical",...o}=e;return r==="horizontal"?p.jsxs("div",{className:N("flex flex-row items-center gap-3 px-3 py-2",t),...o,children:[p.jsx("div",{className:N(fu,"w-1/2 line-clamp-1 break-all"),children:n}),p.jsx("div",{className:"w-1/2 line-clamp-1 break-all",children:i})]}):p.jsxs("div",{className:N("flex flex-col gap-1 px-3 py-2",t),...o,children:[n&&p.jsx("div",{className:fu,children:n}),p.jsx("div",{children:i})]})},ty={error:Rr,warning:Ih,success:Dr,info:Nh},ny={error:"text-[var(--color-status-error)]",warning:"text-[var(--color-status-warning)]",success:"text-[var(--color-status-success)]",info:"text-[var(--color-status-info)]"},mu="inline-flex flex-row gap-3 items-center justify-between h-10 px-3 font-semibold ring-0 dropdown-item rounded-lg cursor-pointer transition-all duration-150 select-none focus:outline-none focus:ring-0 border border-transparent bg-transparent",iy=e=>{const{className:t,children:n,Icon:i,status:r,...o}=e,s=r?ty[r]:null,a=p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"inline-flex flex-row items-center gap-3 min-w-0",children:[i&&p.jsx(i,{className:"h-5 w-5 shrink-0"}),p.jsx("span",{className:"truncate",children:n})]}),p.jsxs("span",{className:"inline-flex flex-row items-center gap-2 shrink-0",children:[s&&r&&p.jsx(s,{className:N("h-5 w-5",ny[r])}),p.jsx(Ch,{className:"h-5 w-5 text-[var(--color-input-icon-button-icon)]"})]})]});if(o.href!==void 0){const{href:l,...u}=o;return p.jsx("a",{href:l,className:N(mu,t),...u,children:a})}return p.jsx("button",{className:N(mu,t),...o,children:a})},ry=e=>{const{className:t,vertical:n=!1,...i}=e;return p.jsx("div",{className:N(n?"w-px h-full bg-[var(--color-divider)]":"w-full h-px bg-[var(--color-divider)]",t),...i})},oy=e=>{const{children:t,content:n,className:i,placement:r="top",minWidth:o=100,maxWidth:s=200}=e,[a,l]=S.useState(!1),{anchorRef:u,Popover:c}=gt({placement:r,minWidth:o,maxWidth:s});return p.jsxs("span",{ref:u,className:i,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[t,p.jsx(c,{open:a,children:p.jsx(mt,{children:n})})]})},sy=e=>{const{open:t,onDismiss:n,enableDismissOnOutsideClick:i,enableDismissOnEscKey:r,enableDismissButton:o,className:s,children:a,maxWidth:l=600}=e;return _t(!!r&&t,n||(()=>{})),p.jsx(An,{children:t&&p.jsxs(Yr,{children:[p.jsx(Fe.div,{style:{transformOrigin:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},children:p.jsx(Gr,{className:"modal-overlay backdrop-blur-[1px] z-10",onClick:i?n:void 0,lockScroll:!0})}),p.jsx("div",{className:"fixed inset-0 flex flex-col items-center pointer-events-none p-4 lg:p-12 overflow-y-auto z-20",children:p.jsxs(Fe.div,{className:N("flex flex-col modal-content rounded-2xl shadow-xl p-6 lg:p-12 pointer-events-auto w-full relative",s),style:{transformOrigin:"bottom",maxWidth:l},initial:{opacity:0,scale:.98,translateY:10},animate:{opacity:1,scale:1,translateY:0},exit:{opacity:0,scale:.98,translateY:10},transition:{duration:.15,ease:"easeInOut"},children:[o&&p.jsx(Pr,{Icon:ft,className:"absolute top-4 right-4",variant:"transparent",size:"sm",onClick:n}),a]})})]})})},ay=e=>{const{open:t,onDismiss:n,enableDismissOnOutsideClick:i,enableDismissOnEscKey:r,enableDismissButton:o,className:s,children:a,maxWidth:l=480}=e;return _t(!!r&&t,n||(()=>{})),p.jsx(An,{children:t&&p.jsxs(Yr,{children:[p.jsx(Fe.div,{style:{transformOrigin:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},children:p.jsx(Gr,{className:"modal-overlay backdrop-blur-[1px] z-10",onClick:i?n:void 0,lockScroll:!0})}),p.jsx("div",{className:"fixed inset-0 flex flex-row justify-end pointer-events-none z-20",children:p.jsxs(Fe.div,{className:N("flex flex-col modal-content shadow-xl p-6 lg:p-12 pointer-events-auto h-full w-full overflow-y-auto relative",s),style:{maxWidth:l},initial:{translateX:"100%"},animate:{translateX:0},exit:{translateX:"100%"},transition:{duration:.25,ease:[.32,.72,0,1]},children:[o&&p.jsx(Pr,{Icon:ft,className:"absolute top-4 right-4",variant:"transparent",size:"sm",onClick:n}),a]})})]})})},hu={red:"bg-red-100 text-red-700 ring-red-200 dark:bg-red-950 dark:text-red-300 dark:ring-red-800",orange:"bg-orange-100 text-orange-700 ring-orange-200 dark:bg-orange-950 dark:text-orange-300 dark:ring-orange-800",amber:"bg-amber-100 text-amber-700 ring-amber-200 dark:bg-amber-950 dark:text-amber-300 dark:ring-amber-800",yellow:"bg-yellow-100 text-yellow-700 ring-yellow-200 dark:bg-yellow-950 dark:text-yellow-300 dark:ring-yellow-800",lime:"bg-lime-100 text-lime-700 ring-lime-200 dark:bg-lime-950 dark:text-lime-300 dark:ring-lime-800",green:"bg-green-100 text-green-700 ring-green-200 dark:bg-green-950 dark:text-green-300 dark:ring-green-800",emerald:"bg-emerald-100 text-emerald-700 ring-emerald-200 dark:bg-emerald-950 dark:text-emerald-300 dark:ring-emerald-800",teal:"bg-teal-100 text-teal-700 ring-teal-200 dark:bg-teal-950 dark:text-teal-300 dark:ring-teal-800",cyan:"bg-cyan-100 text-cyan-700 ring-cyan-200 dark:bg-cyan-950 dark:text-cyan-300 dark:ring-cyan-800",sky:"bg-sky-100 text-sky-700 ring-sky-200 dark:bg-sky-950 dark:text-sky-300 dark:ring-sky-800",blue:"bg-blue-100 text-blue-700 ring-blue-200 dark:bg-blue-950 dark:text-blue-300 dark:ring-blue-800",indigo:"bg-indigo-100 text-indigo-700 ring-indigo-200 dark:bg-indigo-950 dark:text-indigo-300 dark:ring-indigo-800",violet:"bg-violet-100 text-violet-700 ring-violet-200 dark:bg-violet-950 dark:text-violet-300 dark:ring-violet-800",purple:"bg-purple-100 text-purple-700 ring-purple-200 dark:bg-purple-950 dark:text-purple-300 dark:ring-purple-800",fuchsia:"bg-fuchsia-100 text-fuchsia-700 ring-fuchsia-200 dark:bg-fuchsia-950 dark:text-fuchsia-300 dark:ring-fuchsia-800",pink:"bg-pink-100 text-pink-700 ring-pink-200 dark:bg-pink-950 dark:text-pink-300 dark:ring-pink-800",rose:"bg-rose-100 text-rose-700 ring-rose-200 dark:bg-rose-950 dark:text-rose-300 dark:ring-rose-800",slate:"bg-slate-100 text-slate-700 ring-slate-200 dark:bg-slate-950 dark:text-slate-300 dark:ring-slate-800",gray:"bg-gray-100 text-gray-700 ring-gray-200 dark:bg-gray-950 dark:text-gray-300 dark:ring-gray-800",zinc:"bg-zinc-100 text-zinc-700 ring-zinc-200 dark:bg-zinc-950 dark:text-zinc-300 dark:ring-zinc-800",neutral:"bg-neutral-100 text-neutral-700 ring-neutral-200 dark:bg-neutral-950 dark:text-neutral-300 dark:ring-neutral-800",stone:"bg-stone-100 text-stone-700 ring-stone-200 dark:bg-stone-950 dark:text-stone-300 dark:ring-stone-800",white:"bg-[var(--color-badge-white-bg)] text-[var(--color-badge-white-text)] ring-[var(--color-badge-white-ring)]",black:"bg-[var(--color-badge-black-bg)] text-[var(--color-badge-black-text)] ring-[var(--color-badge-black-ring)]"},go=C.forwardRef((e,t)=>{const{className:n,children:i,onClick:r,showCloseIcon:o,Icon:s,color:a="gray"}=e,l=N("inline-flex align-top items-center gap-2 px-3 h-7 rounded-lg font-semibold",hu[a],n);return r?p.jsx("div",{ref:t,children:p.jsxs("button",{className:N("cursor-pointer ring-0 hover:ring-4 active:ring-1 transition-all duration-100 select-none focus:outline-none focus:ring-4",l),onClick:r,children:[s&&p.jsx(s,{className:"h-4 w-4 shrink-0"}),p.jsx("div",{className:"break-all line-clamp-1 text-left",children:i}),o&&p.jsx(ft,{className:"h-4 w-4 shrink-0"})]})}):p.jsxs("div",{className:l,ref:t,children:[s&&p.jsx(s,{className:"h-4 w-4 shrink-0"}),p.jsx("div",{className:"break-all line-clamp-1 text-left",children:i})]})}),gu=e=>{const{className:t,tabs:n}=e;return p.jsx("div",{className:N("h-12 tab-container p-1 rounded-xl inline-flex flex-row space-x-1 overflow-x-auto mat-ui-hide-scrollbars",t),children:n.map((i,r)=>{const o=N("shrink-0 px-4 h-full inline-flex flex-row items-center font-semibold rounded-xl cursor-pointer border border-transparent ing-0 tab-button transition-all duration-150 select-none focus:outline-none focus:ring-0",i.active&&"tab-button-active shadow-sm");return i.href?p.jsxs("a",{href:i.href,className:o,children:[i.Icon&&p.jsx(i.Icon,{className:"h-5 w-5 shrink-0 mr-2 -ml-1"}),i.label]},r):p.jsxs("button",{className:o,onClick:i.onClick,children:[i.Icon&&p.jsx(i.Icon,{className:"h-5 w-5 shrink-0 mr-2 -ml-1"}),i.label]},r)})})},ly=e=>{const{duration:t=.3,ease:n="easeInOut",horizontal:i=!1,children:r,className:o,...s}=e,a=C.useRef(null),l=C.useRef(null),u=C.useRef(null);return C.useEffect(()=>{const c=a.current,d=l.current;if(!c||!d)return;let f=!0;const m=()=>{const x=i?c.scrollWidth-c.clientWidth:c.scrollHeight-c.clientHeight,b=i?c.scrollLeft:c.scrollTop;if(!(x<=0||Math.abs(x-b)<1)){if(f){f=!1,i?c.scrollLeft=x:c.scrollTop=x;return}u.current?.stop(),u.current=fh(b,x,{duration:t,ease:n,onUpdate:h=>{i?c.scrollLeft=h:c.scrollTop=h}})}},v=new ResizeObserver(m);return v.observe(d),()=>{v.disconnect(),u.current?.stop()}},[t,n,i]),p.jsx("div",{ref:a,className:N("min-h-0 min-w-0",i?"overflow-x-auto":"overflow-y-auto",o),...s,children:p.jsx("div",{ref:l,children:r})})};function cy(e){const{onDelta:t,onDragStart:n,onDragEnd:i,disabled:r=!1,primaryButtonOnly:o=!0,preventScrollOnMove:s=!0}=e,[a,l]=C.useState(!1),u=C.useRef(!1),c=C.useRef(0),d=C.useRef(0),f=C.useRef(0),m=C.useRef(null),v=C.useRef(null),x=C.useRef({onDelta:t,onDragStart:n,onDragEnd:i,preventScrollOnMove:s});C.useEffect(()=>{x.current={onDelta:t,onDragStart:n,onDragEnd:i,preventScrollOnMove:s}});const b=C.useRef({}),h=C.useCallback(w=>{if(!u.current)return;const k={clientX:w??d.current,startX:c.current,totalDeltaX:f.current,target:m.current};u.current=!1,l(!1);const{move:y,up:P,keydown:E}=b.current;y&&window.removeEventListener("pointermove",y,!0),P&&(window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0)),E&&window.removeEventListener("keydown",E,!0),b.current={},v.current!=null&&(cancelAnimationFrame(v.current),v.current=null),x.current.onDragEnd?.(k),m.current=null,f.current=0},[]),T=C.useCallback(w=>{if(r||o&&w.button!==0)return;w.target.setPointerCapture?.(w.pointerId),c.current=w.clientX,d.current=w.clientX,f.current=0,m.current=w.target,u.current=!0,l(!0);const k={clientX:w.clientX,startX:w.clientX,totalDeltaX:0,target:w.target};x.current.onDragStart?.(k);const y=A=>{u.current&&v.current==null&&(v.current=requestAnimationFrame(()=>{v.current=null;const M=A.clientX,W=M-d.current;if(W===0)return;d.current=M,f.current+=W;const O={clientX:M,startX:c.current,totalDeltaX:f.current,target:m.current};x.current.preventScrollOnMove&&A.preventDefault(),x.current.onDelta(W,O)}))},P=A=>{h(A.clientX)},E=A=>{A.key==="Escape"&&(A.preventDefault(),h())};b.current={move:y,up:P,keydown:E},window.addEventListener("pointermove",y,{passive:!s,capture:!0}),window.addEventListener("pointerup",P,{capture:!0}),window.addEventListener("pointercancel",P,{capture:!0}),window.addEventListener("keydown",E,!0)},[h,r,s,o]);return C.useEffect(()=>()=>{u.current&&h()},[h]),{isDragging:a,bind:{onPointerDown:T,role:"separator",style:{touchAction:"none",cursor:"col-resize",userSelect:"none"}}}}const vu=e=>{const{column:t,width:n,height:i,onResize:r,sortDirection:o,onSortClick:s}=e,a=!!t.sortable,{bind:l}=cy({onDelta:u=>r(u)});return p.jsxs("div",{style:{width:n,height:i},className:"flex flex-row items-stretch select-none shrink-0",children:[p.jsxs("div",{className:N("flex-1 min-w-0 px-4 table-header-cell transition-colors duration-100 flex flex-row items-center gap-2",a&&"cursor-pointer"),onClick:a?s:void 0,children:[p.jsx("span",{className:"truncate",children:t.header}),a&&o==="asc"&&p.jsx(Ph,{className:"h-4 w-4 shrink-0"}),a&&o==="desc"&&p.jsx(cn,{className:"h-4 w-4 shrink-0"})]}),p.jsx("div",{...l,className:"cursor-ew-resize group py-4 table-resize-handle w-[8px]",children:p.jsx("div",{className:"w-0.5 h-full mx-auto table-resize-divider table-resize-divider-hover pointer-events-none"})})]})},Bt=200,uy=60,dy=e=>{const t={};for(const n of e)t[n.id]=n.defaultWidth??Bt;return t},xu=e=>{const{columns:t,rows:n,getRowId:i,onRowClick:r,sort:o,onSortChange:s,className:a,rowHeight:l=44,headerHeight:u=44}=e,[c,d]=S.useState(()=>dy(t));S.useEffect(()=>{d(h=>{const T={};let w=Object.keys(h).length!==t.length;for(const k of t)k.id in h?T[k.id]=h[k.id]:(T[k.id]=k.defaultWidth??Bt,w=!0);return w?T:h})},[t]);const f=S.useCallback((h,T,w)=>{d(k=>{const y=k[h]??Bt,P=Math.max(w,y+T);return P===y?k:{...k,[h]:P}})},[]),m=S.useCallback(h=>{if(s){if(!o||o.columnId!==h){s({columnId:h,direction:"asc"});return}if(o.direction==="asc"){s({columnId:h,direction:"desc"});return}s(null)}},[o,s]),v=t.reduce((h,T)=>h+(c[T.id]??T.defaultWidth??Bt),0),x=S.useRef(null),b=h=>{x.current&&(x.current.scrollLeft=h.currentTarget.scrollLeft)};return p.jsxs("div",{className:N("flex flex-col h-full w-full",a),children:[p.jsx("div",{ref:x,className:"overflow-hidden shrink-0",style:{height:u},children:p.jsx("div",{className:"flex flex-row table-header font-medium",style:{width:v,minWidth:"100%"},children:t.map(h=>p.jsx(vu,{column:h,width:c[h.id]??h.defaultWidth??Bt,height:u,onResize:T=>f(h.id,T,h.minWidth??uy),sortDirection:o?.columnId===h.id?o.direction:null,onSortClick:()=>m(h.id)},h.id))})}),p.jsx("div",{className:"flex-1 overflow-auto",onScroll:b,children:p.jsx("div",{className:"flex flex-col",style:{width:v,minWidth:"100%"},children:n.map((h,T)=>p.jsx("div",{className:N("flex flex-row table-body-row transition-colors duration-100",r&&"cursor-pointer"),onClick:r?()=>r(h,T):void 0,children:t.map(w=>p.jsx("div",{className:"shrink-0 content-center px-4 relative",style:{width:c[w.id]??w.defaultWidth??Bt,height:l},children:p.jsx("div",{className:"break-all line-clamp-1",children:w.renderCell(h,T)})},w.id))},i(h,T)))})})]})},yu=S.createContext(void 0),py=()=>({dismiss:S.useContext(yu)||(()=>{})}),fy="inline-flex flex-row items-center gap-3 h-10 px-3 font-semibold ring-0 dropdown-item rounded-lg cursor-pointer transition-all duration-150 select-none focus:outline-none focus:ring-0 border border-transparent bg-transparent",Te=C.forwardRef((e,t)=>{const{className:n,children:i,Icon:r,onClick:o,dismissOnClick:s=!0,...a}=e,{dismiss:l}=py(),u=c=>{o&&o(c),s&&l()};return p.jsxs("button",{ref:t,className:N(fy,n),onClick:u,...a,children:[r&&p.jsx(r,{className:"h-5 w-5"}),i]})}),vo=e=>{const{label:t,children:n,className:i}=e;return p.jsxs("div",{className:N("flex flex-col dropdown-button-group",i),children:[t&&p.jsx("div",{className:"mb-2 text-sm dropdown-group-label font-semibold px-3",children:t}),n]})},xo=e=>{const{trigger:t,children:n,placement:i="bottom-end",minWidth:r=200,className:o}=e,[s,a]=S.useState(!1),{Popover:l,anchorRef:u}=gt({placement:i,onOutsideClick:()=>a(!1),minWidth:r});return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:u,className:o,onClick:()=>a(!s),children:t}),p.jsx(l,{open:s,children:p.jsx(mt,{padding:"sm",children:p.jsx(yu.Provider,{value:()=>a(!1),children:n})})})]})},my=()=>p.jsx("div",{}),hy=[{id:1,email:"sarah.jennings@example.com",firstname:"Sarah",lastname:"Jennings",status:"active"},{id:2,email:"liam.patel@outlook.com",firstname:"Liam",lastname:"Patel",status:"inactive"},{id:3,email:"emily.wong@gmail.com",firstname:"Emily",lastname:"Wong",status:"active"},{id:4,email:"noah.thompson@yahoo.com",firstname:"Noah",lastname:"Thompson",status:"active"},{id:5,email:"isabella.martin@protonmail.com",firstname:"Isabella",lastname:"Martin",status:"active"},{id:6,email:"ethan.ross@company.io",firstname:"Ethan",lastname:"Ross",status:"inactive"},{id:7,email:"olivia.nguyen@example.org",firstname:"Olivia",lastname:"Nguyen",status:"active"},{id:8,email:"lucas.henderson@gmail.com",firstname:"Lucas",lastname:"Henderson",status:"inactive"},{id:9,email:"mia.johnson@workmail.com",firstname:"Mia",lastname:"Johnson",status:"active"},{id:10,email:"jackson.rivera@outlook.com",firstname:"Jackson",lastname:"Rivera",status:"active"},{id:11,email:"ava.sanders@example.com",firstname:"Ava",lastname:"Sanders",status:"active"},{id:12,email:"logan.bennett@company.io",firstname:"Logan",lastname:"Bennett",status:"inactive"}],gy=[{id:"id",header:"ID",renderCell:e=>e.id},{id:"email",header:"Email",renderCell:e=>p.jsx(go,{Icon:Fh,onClick:()=>{},children:e.email})},{id:"firstname",header:"First Name",renderCell:e=>e.firstname},{id:"lastname",header:"Last Name",renderCell:e=>e.lastname},{id:"status",header:"Status",renderCell:()=>p.jsx(xy,{})}],vy=()=>p.jsxs("div",{className:"flex flex-col gap-6",children:[p.jsxs("div",{className:"flex flex-row items-center justify-start gap-3",children:[p.jsx(Or,{Icon:Ar,placeholder:"Search..."}),p.jsx(_n,{Icon:ql}),p.jsx(Bl,{Icon:Wl,children:"New"}),p.jsxs(xo,{trigger:p.jsx(_n,{Icon:ql}),children:[p.jsx(Te,{dismissOnClick:!1,Icon:Wl,children:"Add new"}),p.jsx(Te,{Icon:Mh,children:"Remove"}),p.jsxs(vo,{label:"Test",className:"mt-2",children:[p.jsx(Te,{children:"Item 1"}),p.jsx(Te,{children:"Item 2"}),p.jsx(Te,{children:"Item 3"}),p.jsx(Te,{children:"Item 4"})]}),p.jsxs(vo,{label:"Test",className:"mt-2",children:[p.jsx(Te,{children:"Item 1"}),p.jsx(Te,{children:"Item 2"}),p.jsx(Te,{children:"Item 3"}),p.jsx(Te,{children:"Item 4"})]})]}),p.jsx(gu,{tabs:[{label:"Tab 1",Icon:$l,active:!0,onClick:()=>{}},{label:"Tab 2",active:!1,onClick:()=>{}},{label:"Tab 3",Icon:$l,active:!1,onClick:()=>{}}]})]}),p.jsx(pu,{options:[{label:"Option 1",value:1},{label:"Option 2",value:2},{label:"Option 3",value:3}],value:null,onChange:()=>{}}),p.jsx(xu,{className:"h-[300px] w-[300px]",columns:gy,rows:hy,getRowId:e=>e.id}),p.jsx(my,{})]}),xy=()=>p.jsx(p.Fragment,{children:p.jsxs(xo,{placement:"bottom-end",className:"inline-block",trigger:p.jsx(go,{onClick:()=>{},children:"Test"}),children:[p.jsx(Te,{children:"Option 1"}),p.jsx(Te,{children:"Option 2"}),p.jsx(Te,{children:"Option 3"})]})});B.AutoScroll=ly,B.Badge=go,B.BadgeColor=hu,B.Button=Bl,B.ButtonIconRound=Pr,B.ButtonIconSquare=_n,B.Divider=ry,B.DropdownButton=Te,B.DropdownButtonGroup=vo,B.DropdownMenu=xo,B.DropdownPanel=mt,B.Input=Or,B.InputCheck=_v,B.InputColor=Dv,B.InputDescription=Se,B.InputError=ke,B.InputErrorIcon=He,B.InputFileMultiple=Kx,B.InputFileSingle=qx,B.InputIconButton=Ye,B.InputIconButtonTray=tt,B.InputLabel=Ve,B.InputPassword=Rv,B.InputRadio=Fv,B.InputSelect=pu,B.InputSelectNative=Yx,B.InputSelectOption=vn,B.InputSelectSearchable=Gx,B.InputSelectSearchableAsync=Zx,B.InputTextArea=Nv,B.InputToggle=Vv,B.Modal=sy,B.Panel=Jx,B.PanelField=ey,B.PanelLink=iy,B.PanelStack=Qx,B.PopoverBase=Pc,B.SidebarModal=ay,B.Spinner=It,B.TabButtons=gu,B.Table=xu,B.TableColumnHead=vu,B.Test=vy,B.Tooltip=oy,B.UploadFileTile=du,B.usePopover=gt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
182
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function au(e,t){if(e){if(typeof e=="string")return uo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uo(e,t)}}function uo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function _x(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i=[],r=!0,o=!1,s,a;try{for(n=n.call(e);!(r=(s=n.next()).done)&&(i.push(s.value),!(t&&i.length===t));r=!0);}catch(l){o=!0,a=l}finally{try{!r&&n.return!=null&&n.return()}finally{if(o)throw a}}return i}}function Lx(e){if(Array.isArray(e))return e}function lu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,i)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(n),!0).forEach(function(i){po(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lu(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ii(e,t){if(e==null)return{};var n=zx(e,t),i,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)i=o[r],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function zx(e,t){if(e==null)return{};var n={},i=Object.keys(e),r,o;for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}var fo=S.forwardRef(function(e,t){var n=e.children,i=ii(e,Dx),r=ho(i),o=r.open,s=ii(r,Rx);return S.useImperativeHandle(t,function(){return{open:o}},[o]),S.createElement(S.Fragment,null,n(oe(oe({},s),{},{open:o})))});fo.displayName="Dropzone";var cu={disabled:!1,getFilesFromEvent:Xv,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};fo.defaultProps=cu,fo.propTypes={children:re.func,accept:re.objectOf(re.arrayOf(re.string)),multiple:re.bool,preventDropOnDocument:re.bool,noClick:re.bool,noKeyboard:re.bool,noDrag:re.bool,noDragEventsBubbling:re.bool,minSize:re.number,maxSize:re.number,maxFiles:re.number,disabled:re.bool,getFilesFromEvent:re.func,onFileDialogCancel:re.func,onFileDialogOpen:re.func,useFsAccessApi:re.bool,autoFocus:re.bool,onDragEnter:re.func,onDragLeave:re.func,onDragOver:re.func,onDrop:re.func,onDropAccepted:re.func,onDropRejected:re.func,onError:re.func,validator:re.func};var mo={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function ho(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=oe(oe({},cu),e),n=t.accept,i=t.disabled,r=t.getFilesFromEvent,o=t.maxSize,s=t.minSize,a=t.multiple,l=t.maxFiles,u=t.onDragEnter,c=t.onDragLeave,d=t.onDragOver,f=t.onDrop,m=t.onDropAccepted,v=t.onDropRejected,x=t.onFileDialogCancel,b=t.onFileDialogOpen,h=t.useFsAccessApi,T=t.autoFocus,w=t.preventDropOnDocument,k=t.noClick,y=t.noKeyboard,P=t.noDrag,E=t.noDragEventsBubbling,A=t.onError,M=t.validator,W=S.useMemo(function(){return Cx(n)},[n]),O=S.useMemo(function(){return Ex(n)},[n]),J=S.useMemo(function(){return typeof b=="function"?b:uu},[b]),Y=S.useMemo(function(){return typeof x=="function"?x:uu},[x]),F=S.useRef(null),ee=S.useRef(null),ie=S.useReducer(Bx,mo),X=co(ie,2),q=X[0],Z=X[1],g=q.isFocused,j=q.isFileDialogActive,I=S.useRef(typeof window<"u"&&window.isSecureContext&&h&&jx()),V=function(){!I.current&&j&&setTimeout(function(){if(ee.current){var U=ee.current.files;U.length||(Z({type:"closeDialog"}),Y())}},300)};S.useEffect(function(){return window.addEventListener("focus",V,!1),function(){window.removeEventListener("focus",V,!1)}},[ee,j,Y,I]);var _=S.useRef([]),z=S.useRef([]),H=function(U){F.current&&F.current.contains(U.target)||(U.preventDefault(),_.current=[])};S.useEffect(function(){return w&&(document.addEventListener("dragover",iu,!1),document.addEventListener("drop",H,!1)),function(){w&&(document.removeEventListener("dragover",iu),document.removeEventListener("drop",H))}},[F,w]),S.useEffect(function(){var R=function($e){z.current=[].concat(su(z.current),[$e.target]),gn($e)&&Z({isDragGlobal:!0,type:"setDragGlobal"})},U=function($e){z.current=z.current.filter(function(Ge){return Ge!==$e.target&&Ge!==null}),!(z.current.length>0)&&Z({isDragGlobal:!1,type:"setDragGlobal"})},ce=function(){z.current=[],Z({isDragGlobal:!1,type:"setDragGlobal"})},me=function(){z.current=[],Z({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",R,!1),document.addEventListener("dragleave",U,!1),document.addEventListener("dragend",ce,!1),document.addEventListener("drop",me,!1),function(){document.removeEventListener("dragenter",R),document.removeEventListener("dragleave",U),document.removeEventListener("dragend",ce),document.removeEventListener("drop",me)}},[F]),S.useEffect(function(){return!i&&T&&F.current&&F.current.focus(),function(){}},[F,T,i]);var $=S.useCallback(function(R){A?A(R):console.error(R)},[A]),L=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R),_.current=[].concat(su(_.current),[R.target]),gn(R)&&Promise.resolve(r(R)).then(function(U){if(!(ni(R)&&!E)){var ce=U.length,me=ce>0&&wx({files:U,accept:W,minSize:s,maxSize:o,multiple:a,maxFiles:l,validator:M}),xe=ce>0&&!me;Z({isDragAccept:me,isDragReject:xe,isDragActive:!0,type:"setDraggedFiles"}),u&&u(R)}}).catch(function(U){return $(U)})},[r,u,$,E,W,s,o,a,l,M]),G=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R);var U=gn(R);if(U&&R.dataTransfer)try{R.dataTransfer.dropEffect="copy"}catch{}return U&&d&&d(R),!1},[d,E]),Q=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R);var U=_.current.filter(function(me){return F.current&&F.current.contains(me)}),ce=U.indexOf(R.target);ce!==-1&&U.splice(ce,1),_.current=U,!(U.length>0)&&(Z({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),gn(R)&&c&&c(R))},[F,c,E]),de=S.useCallback(function(R,U){var ce=[],me=[];R.forEach(function(xe){var $e=tu(xe,W),Ge=co($e,2),bo=Ge[0],wo=Ge[1],To=nu(xe,s,o),si=co(To,2),So=si[0],ko=si[1],jo=M?M(xe):null;if(bo&&So&&!jo)ce.push(xe);else{var Eo=[wo,ko];jo&&(Eo=Eo.concat(jo)),me.push({file:xe,errors:Eo.filter(function(Ty){return Ty})})}}),(!a&&ce.length>1||a&&l>=1&&ce.length>l)&&(ce.forEach(function(xe){me.push({file:xe,errors:[yx]})}),ce.splice(0)),Z({acceptedFiles:ce,fileRejections:me,type:"setFiles"}),f&&f(ce,me,U),me.length>0&&v&&v(me,U),ce.length>0&&m&&m(ce,U)},[Z,a,W,s,o,l,f,m,v,M]),D=S.useCallback(function(R){R.preventDefault(),R.persist(),oi(R),_.current=[],gn(R)&&Promise.resolve(r(R)).then(function(U){ni(R)&&!E||de(U,R)}).catch(function(U){return $(U)}),Z({type:"reset"})},[r,de,$,E]),ve=S.useCallback(function(){if(I.current){Z({type:"openDialog"}),J();var R={multiple:a,types:O};window.showOpenFilePicker(R).then(function(U){return r(U)}).then(function(U){de(U,null),Z({type:"closeDialog"})}).catch(function(U){Px(U)?(Y(U),Z({type:"closeDialog"})):Ax(U)?(I.current=!1,ee.current?(ee.current.value=null,ee.current.click()):$(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):$(U)});return}ee.current&&(Z({type:"openDialog"}),J(),ee.current.value=null,ee.current.click())},[Z,J,Y,h,de,$,O,a]),yt=S.useCallback(function(R){!F.current||!F.current.isEqualNode(R.target)||(R.key===" "||R.key==="Enter"||R.keyCode===32||R.keyCode===13)&&(R.preventDefault(),ve())},[F,ve]),xn=S.useCallback(function(){Z({type:"focus"})},[]),bu=S.useCallback(function(){Z({type:"blur"})},[]),wu=S.useCallback(function(){k||(kx()?setTimeout(ve,0):ve())},[k,ve]),$t=function(U){return i?null:U},yo=function(U){return y?null:$t(U)},ri=function(U){return P?null:$t(U)},oi=function(U){E&&U.stopPropagation()},yy=S.useMemo(function(){return function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=R.refKey,ce=U===void 0?"ref":U,me=R.role,xe=R.onKeyDown,$e=R.onFocus,Ge=R.onBlur,bo=R.onClick,wo=R.onDragEnter,To=R.onDragOver,si=R.onDragLeave,So=R.onDrop,ko=ii(R,Ox);return oe(oe(po({onKeyDown:yo(Be(xe,yt)),onFocus:yo(Be($e,xn)),onBlur:yo(Be(Ge,bu)),onClick:$t(Be(bo,wu)),onDragEnter:ri(Be(wo,L)),onDragOver:ri(Be(To,G)),onDragLeave:ri(Be(si,Q)),onDrop:ri(Be(So,D)),role:typeof me=="string"&&me!==""?me:"presentation"},ce,F),!i&&!y?{tabIndex:0}:{}),ko)}},[F,yt,xn,bu,wu,L,G,Q,D,y,P,i]),by=S.useCallback(function(R){R.stopPropagation()},[]),wy=S.useMemo(function(){return function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},U=R.refKey,ce=U===void 0?"ref":U,me=R.onChange,xe=R.onClick,$e=ii(R,Mx),Ge=po({accept:W,multiple:a,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:$t(Be(me,D)),onClick:$t(Be(xe,by)),tabIndex:-1},ce,ee);return oe(oe({},Ge),$e)}},[ee,n,a,D,i]);return oe(oe({},q),{},{isFocused:g&&!i,getRootProps:yy,getInputProps:wy,rootRef:F,inputRef:ee,open:$t(ve)})}function Bx(e,t){switch(t.type){case"focus":return oe(oe({},e),{},{isFocused:!0});case"blur":return oe(oe({},e),{},{isFocused:!1});case"openDialog":return oe(oe({},mo),{},{isFileDialogActive:!0});case"closeDialog":return oe(oe({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return oe(oe({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return oe(oe({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return oe(oe({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return oe({},mo);default:return e}}function uu(){}const $x={sm:"h-7",md:"h-8",lg:"h-10"},Wx={sm:"px-2.5",md:"px-3",lg:"px-4"},Ux={sm:"text-xs",md:"text-sm",lg:"text-sm"},qx=e=>{const{label:t,description:n,error:i,placeholder:r="No file chosen",buttonText:o="Choose",Icon:s=Oh,size:a="md",value:l,isUploaded:u=!1,isUploading:c=!1,onChange:d,onDropRejected:f,accept:m,maxSize:v,minSize:x,disabled:b=!1,className:h}=e,T=async M=>{const[W]=M;W&&await d?.(W)},{getRootProps:w,getInputProps:k,open:y,isDragActive:P,isFocused:E}=ho({multiple:!1,accept:m,maxSize:v,minSize:x,disabled:b,onDrop:T,onDropRejected:f}),A=l?.name;return p.jsx(Ke.Provider,{value:a,children:p.jsxs("div",{className:N("flex flex-col",h),children:[p.jsx(Ve,{children:t}),p.jsxs("div",{...w({className:N("flex flex-row items-center","border input-base rounded-xl shadow-sm transition-all duration-150","ring-0 focus:outline-none",(E||P)&&"ring-4",i&&"input-error",b&&"opacity-60 cursor-not-allowed",et[a],ut[a],"gap-3")}),children:[p.jsx("input",{...k()}),p.jsx(s,{className:N("input-icon shrink-0",pt[a])}),p.jsx("span",{className:N("flex-1 truncate",qe[a],!A&&"text-[var(--color-input-placeholder)]"),children:A??r}),i&&p.jsx(He,{}),c&&!i&&p.jsx("div",{className:"h-5 w-5 flex items-center justify-center",children:p.jsx(It,{className:"h-4 w-4 text-[var(--color-input-icon)]"})}),u&&!c&&!i&&p.jsx("div",{className:"h-5 w-5",children:p.jsx(Dr,{className:"h-5 w-5 text-[var(--color-status-success)]"})}),p.jsx("button",{type:"button",disabled:b,onClick:M=>{M.stopPropagation(),y()},className:N("inline-flex flex-row items-center justify-center shrink-0","border button-white shadow-sm rounded-[calc(var(--border-radius-input)-0.25rem)]","font-semibold cursor-pointer select-none transition-all duration-150","button-ring ring-0 hover:ring-4 active:ring-1 focus:outline-none focus:ring-4","disabled:cursor-default","mr-1.5",$x[a],Wx[a],Ux[a]),children:o})]}),p.jsx(Se,{children:n}),p.jsx(ke,{children:i})]})})},Hx=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`,du=e=>{const{file:t,isUploaded:n=!1,isUploading:i=!1,error:r,onRemove:o,className:s}=e,a=i||n||!!r;return p.jsxs("div",{className:N("flex flex-row items-center gap-3","border input-base rounded-xl shadow-sm","pl-4 pr-1 py-1",r&&"input-error",s),children:[a&&p.jsx("div",{className:"shrink-0 h-5 w-5 flex items-center justify-center",children:r?p.jsx(Rr,{className:"h-5 w-5 input-error-icon"}):i?p.jsx(It,{className:"h-4 w-4 text-[var(--color-input-icon)]"}):p.jsx(Dr,{className:"h-5 w-5 text-[var(--color-status-success)]"})}),p.jsx("div",{className:"flex-1 min-w-0 font-medium truncate",children:t.name}),p.jsx("div",{className:"shrink-0 text-sm text-[var(--color-input-description-text)]",children:Hx(t.size)}),o&&p.jsx(_n,{variant:"transparent",size:"sm",Icon:ft,onClick:o,"aria-label":"Remove file",className:"shrink-0"})]})},Kx=e=>{const{label:t,description:n,error:i,title:r="Drop files here",hint:o,Icon:s=Ah,onUpload:a,onFileRemoved:l,onDropRejected:u,renderFileTile:c,accept:d,maxSize:f,minSize:m,maxFiles:v,disabled:x=!1,className:b}=e,[h,T]=S.useState([]),w=S.useRef(0),k=(O,J)=>{T(Y=>Y.map(F=>F.id===O?{...F,...J}:F))},y=O=>{if(O.length===0)return;const J=O.map(Y=>({id:String(++w.current),file:Y,status:a?"uploading":"idle"}));if(T(Y=>[...Y,...J]),!!a)for(const Y of J)Promise.resolve().then(()=>a(Y.file)).then(()=>k(Y.id,{status:"uploaded"})).catch(F=>{k(Y.id,{status:"error",error:F instanceof Error?F:new Error(String(F))})})},P=O=>{const J=h.find(Y=>Y.id===O);T(Y=>Y.filter(F=>F.id!==O)),J&&l?.(J.file)},{getRootProps:E,getInputProps:A,isDragActive:M,isFocused:W}=ho({multiple:!0,accept:d,maxSize:f,minSize:m,maxFiles:v,disabled:x,onDrop:y,onDropRejected:u});return p.jsxs("div",{className:N("flex flex-col",b),children:[p.jsx(Ve,{children:t}),p.jsxs("div",{...E({className:N("flex flex-col items-center justify-center gap-1","border-2 border-dashed input-base rounded-xl bg-transparent!","py-10 px-6 cursor-pointer transition-all duration-150","ring-0 focus:outline-none",(W||M)&&"ring-4",i&&"input-error",x&&"opacity-60 cursor-not-allowed")}),children:[p.jsx("input",{...A()}),p.jsx("div",{className:"h-14 w-14 rounded-xl flex items-center justify-center bg-[var(--color-input-file-icon-bg)] mb-2",children:p.jsx(s,{className:"h-7 w-7 input-icon"})}),p.jsx("div",{className:"text-base font-semibold",children:r}),o&&p.jsx("div",{className:"text-sm text-[var(--color-input-description-text)] ",children:o})]}),h.length>0&&p.jsx("div",{className:"flex flex-col gap-2 mt-3",children:h.map(O=>{const J={file:O.file,isUploading:O.status==="uploading",isUploaded:O.status==="uploaded",error:O.status==="error"?O.error?.message:void 0,onRemove:()=>P(O.id)};return p.jsx(C.Fragment,{children:c?c(O.file,J):p.jsx(du,{...J})},O.id)})}),p.jsx(Se,{children:n}),p.jsx(ke,{children:i})]})},Yx=e=>{const{className:t,label:n,description:i,options:r,error:o,size:s="md",...a}=e;return p.jsx(Ke.Provider,{value:s,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",children:[p.jsx("select",{className:N("appearance-none border input-base bg-none transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none",et[s],qe[s],ut[s],dt[s]),...a,children:r&&r.map((l,u)=>p.jsx("option",{value:l.value,disabled:l.disabled,children:l.label},u))}),p.jsxs(tt,{children:[o&&p.jsx(He,{}),p.jsx(Ye,{Icon:cn})]})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:o})]})})},vn=e=>{const{children:t,onClick:n,selected:i,disabled:r=!1}=e;return p.jsxs("div",{onClick:()=>!r&&n&&n(),className:N("option-base px-4 py-2 rounded-xl cursor-pointer transition-all duration-150 select-none flex flex-row gap-3 items-center",i&&!r&&"option-selected",r&&"option-disabled cursor-not-allowed hover:bg-transparent active:bg-transparent"),children:[p.jsx("div",{className:"flex-1",children:t}),i&&!r&&p.jsx("div",{className:"shrink-0",children:p.jsx(Eh,{className:"h-5 w-5"})})]})},pu=e=>{const{className:t,label:n,description:i,options:r,onChange:o,value:s,placeholder:a,maxHeight:l=300,error:u,size:c="md"}=e,[d,f]=S.useState(!1),m=C.useRef(null),v=r?.find(h=>h.value===s);_t(d,()=>f(!1)),S.useEffect(()=>{d&&m.current?.focus({preventScroll:!0})},[d]);const{anchorRef:x,Popover:b}=gt({placement:"bottom",fullWidth:!0,onOutsideClick:()=>f(!1)});return p.jsx(Ke.Provider,{value:c,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",ref:x,children:[p.jsxs("div",{ref:m,role:"button",tabIndex:0,className:N("flex flex-row items-center border select-trigger transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none select-none",et[c],qe[c],ut[c],dt[c],u&&"select-trigger-error",d&&"ring-4"),onKeyDown:h=>h.key===" "&&f(T=>!T),onClick:()=>f(!d),children:[v&&p.jsx("span",{children:v.label}),!v&&a&&p.jsx("span",{className:"select-placeholder",children:a})]}),p.jsxs(tt,{children:[u&&p.jsx(He,{}),!!s&&p.jsx(Ye,{Icon:ft,onClick:()=>o(null)}),p.jsx(Ye,{Icon:cn})]}),p.jsx(b,{open:d,children:p.jsx(mt,{className:"!p-0",style:{maxHeight:l},children:p.jsx("div",{className:"flex flex-col p-2 gap-1",children:r.map(h=>{const T=h.value===s;return p.jsx(vn,{onClick:()=>{!h.disabled&&o&&(o(h.value),f(!1))},selected:T,disabled:h.disabled,children:h.label},String(h.value))})})})})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:u})]})})},Gx=e=>{const{className:t,label:n,description:i,options:r,onChange:o,onSearch:s,value:a,placeholder:l,maxHeight:u=300,error:c,size:d="md"}=e,[f,m]=S.useState(!1),[v,x]=S.useState(r),[b,h]=S.useState(""),T=C.useRef(null),w=C.useRef(null),k=r?.find(E=>E.value===a);_t(f,()=>m(!1)),S.useEffect(()=>{x(s(b))},[b,r,s]),S.useEffect(()=>{f&&setTimeout(()=>w.current?.focus(),100)},[f]);const{anchorRef:y,Popover:P}=gt({placement:"bottom",fullWidth:!0,onOutsideClick:()=>m(!1)});return p.jsx(Ke.Provider,{value:d,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",ref:y,children:[p.jsxs("div",{ref:T,role:"button",tabIndex:0,className:N("flex flex-row items-center border select-trigger transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none select-none",et[d],qe[d],ut[d],dt[d],c&&"select-trigger-error",f&&"ring-4"),onKeyDown:E=>E.key===" "&&m(A=>!A),onClick:()=>m(!f),children:[k&&p.jsx("span",{children:k.label}),!k&&l&&p.jsx("span",{className:"select-placeholder",children:l})]}),p.jsxs(tt,{children:[c&&p.jsx(He,{}),!!a&&p.jsx(Ye,{Icon:ft,onClick:()=>o(null)}),p.jsx(Ye,{Icon:cn})]}),p.jsx(P,{open:f,children:p.jsxs(mt,{className:"gap-0 !p-0",style:{maxHeight:u},children:[p.jsxs("div",{className:"sticky top-0 border-b select-search-bar py-1 backdrop-blur-sm",children:[p.jsx("input",{ref:w,type:"text",placeholder:"Search",value:b,className:"appearance-none border-none w-full bg-transparent rounded- pl-10 transition-all duration-150 focus:outline-none ring-0 placeholder:text-[var(--color-input-placeholder)]",onChange:E=>h(E.target.value)}),p.jsx(Ar,{className:"absolute select-search-icon left-4 top-4 h-4 w-4"})]}),p.jsxs("div",{className:"flex flex-col gap-1 p-2",children:[b!==""&&p.jsxs(p.Fragment,{children:[v.length===0&&p.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:p.jsx(Ul,{className:"h-6 w-6 text-[var(--color-input-text)]"})}),v.map(E=>{const A=E.value===a;return p.jsx(vn,{onClick:()=>{!E.disabled&&o&&(o(E.value),m(!1))},selected:A,disabled:E.disabled,children:E.label},String(E.value))})]}),b===""&&p.jsx(p.Fragment,{children:r.map(E=>{const A=E.value===a;return p.jsx(vn,{onClick:()=>{!E.disabled&&o&&(o(E.value),m(!1))},selected:A,disabled:E.disabled,children:E.label},String(E.value))})})]})]})})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:c})]})})},Xx=(e,t)=>{const[n,i]=S.useState(e);return S.useEffect(()=>{const r=setTimeout(()=>{i(e)},t);return()=>{clearTimeout(r)}},[e,t]),n},Zx=e=>{const{className:t,label:n,description:i,onChange:r,fetchOptionsByQuery:o,fetchOptionByValue:s,onSearchDebounceMs:a=300,value:l,placeholder:u,maxHeight:c=300,error:d,size:f="md"}=e,[m,v]=S.useState(!1),x=C.useRef(null),[b,h]=S.useState(""),[T,w]=S.useState([]),[k,y]=S.useState(null),P=C.useRef(null),[E,A]=S.useState(!1),[M,W]=S.useState(!1);_t(m,()=>v(!1));const O=Xx(b,a);S.useEffect(()=>{(async()=>{A(!0);const ee=await o(O);w(ee),A(!1)})()},[O,o]),S.useEffect(()=>{if(l==null){y(null);return}const F=T?.find(ee=>ee.value===l);F?y(F):(async()=>{W(!0);const ie=await s(l);y(ie),W(!1)})()},[s,T,l]),S.useEffect(()=>{m&&setTimeout(()=>P.current?.focus(),100)},[m]);const{anchorRef:J,Popover:Y}=gt({placement:"bottom",fullWidth:!0,onOutsideClick:()=>v(!1)});return p.jsx(Ke.Provider,{value:f,children:p.jsxs("div",{className:N("flex flex-col",t),children:[p.jsx(Ve,{children:n}),p.jsxs("div",{className:"relative flex w-full flex-col",ref:J,children:[p.jsxs("div",{ref:x,role:"button",tabIndex:0,className:N("flex flex-row items-center border select-trigger transition-all duration-150 rounded-xl shadow-sm ring-0 focus:ring-4 focus:outline-none select-none",et[f],qe[f],ut[f],dt[f],d&&"select-trigger-error",m&&"ring-4"),onKeyDown:F=>F.key===" "&&v(ee=>!ee),onClick:()=>v(!m),children:[!M&&k&&p.jsx("span",{children:k.label}),!M&&!k&&u&&p.jsx("span",{className:"select-placeholder",children:u}),M&&p.jsx(It,{className:"h-4 w-4 text-[var(--color-input-text)]"})]}),p.jsxs(tt,{children:[d&&p.jsx(He,{}),!!l&&p.jsx(Ye,{Icon:ft,onClick:()=>r(null)}),p.jsx(Ye,{Icon:cn})]}),p.jsx(Y,{open:m,children:p.jsxs(mt,{className:"gap-0 !p-0",style:{maxHeight:c},children:[p.jsxs("div",{className:"sticky top-0 border-b select-search-bar py-1 backdrop-blur-sm",children:[p.jsx("input",{ref:P,type:"text",placeholder:"Search",value:b,className:"appearance-none border-none w-full bg-transparent rounded- pl-10 transition-all duration-150 focus:outline-none ring-0 placeholder:text-[var(--color-input-placeholder)]",onChange:F=>h(F.target.value)}),p.jsx(Ar,{className:"absolute select-search-icon left-4 top-4 h-4 w-4"})]}),p.jsxs("div",{className:"flex flex-col gap-1 p-2",children:[!E&&T.length===0&&p.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:p.jsx(Ul,{className:"h-6 w-6 text-[var(--color-input-text)]"})}),E&&p.jsx("div",{className:"flex flex-col items-center justify-center py-6",children:p.jsx(It,{className:"h-6 w-6 text-[var(--color-input-text)]"})}),!E&&p.jsx(p.Fragment,{children:T.map(F=>{const ee=F.value===l;return p.jsx(vn,{onClick:()=>{!F.disabled&&r&&(r(F.value),v(!1))},selected:ee,disabled:F.disabled,children:F.label},String(F.value))})})]})]})})]}),p.jsx(Se,{children:i}),p.jsx(ke,{children:d})]})})},Jx=C.forwardRef((e,t)=>{const{className:n,children:i,...r}=e;return p.jsx("div",{ref:t,className:N("flex flex-col gap-6 border panel-base rounded-2xl shadow-sm px-6 py-6",n),...r,children:i})}),Qx=C.forwardRef((e,t)=>{const{className:n,children:i,...r}=e;return p.jsx("div",{ref:t,className:N("flex flex-col gap-1 border panel-base rounded-2xl shadow-sm p-2",n),...r,children:i})}),fu="input-description text-sm font-medium",ey=e=>{const{className:t,label:n,children:i,orientation:r="vertical",...o}=e;return r==="horizontal"?p.jsxs("div",{className:N("flex flex-row items-center gap-3 px-3 py-2",t),...o,children:[p.jsx("div",{className:N(fu,"w-1/2 line-clamp-1 break-all"),children:n}),p.jsx("div",{className:"w-1/2 line-clamp-1 break-all",children:i})]}):p.jsxs("div",{className:N("flex flex-col gap-1 px-3 py-2",t),...o,children:[n&&p.jsx("div",{className:fu,children:n}),p.jsx("div",{children:i})]})},ty={error:Rr,warning:Ih,success:Dr,info:Nh},ny={error:"text-[var(--color-status-error)]",warning:"text-[var(--color-status-warning)]",success:"text-[var(--color-status-success)]",info:"text-[var(--color-status-info)]"},mu="inline-flex flex-row gap-3 items-center justify-between h-10 px-3 font-semibold ring-0 dropdown-item rounded-lg cursor-pointer transition-all duration-150 select-none focus:outline-none focus:ring-0 border border-transparent bg-transparent",iy=e=>{const{className:t,children:n,Icon:i,status:r,...o}=e,s=r?ty[r]:null,a=p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"inline-flex flex-row items-center gap-3 min-w-0",children:[i&&p.jsx(i,{className:"h-5 w-5 shrink-0"}),p.jsx("span",{className:"truncate",children:n})]}),p.jsxs("span",{className:"inline-flex flex-row items-center gap-2 shrink-0",children:[s&&r&&p.jsx(s,{className:N("h-5 w-5",ny[r])}),p.jsx(Ch,{className:"h-5 w-5 text-[var(--color-input-icon-button-icon)]"})]})]});if(o.href!==void 0){const{href:l,...u}=o;return p.jsx("a",{href:l,className:N(mu,t),...u,children:a})}return p.jsx("button",{className:N(mu,t),...o,children:a})},ry=e=>{const{className:t,vertical:n=!1,...i}=e;return p.jsx("div",{className:N(n?"w-px h-full bg-[var(--color-divider)]":"w-full h-px bg-[var(--color-divider)]",t),...i})},oy=e=>{const{children:t,content:n,className:i,placement:r="top",minWidth:o=100,maxWidth:s=200}=e,[a,l]=S.useState(!1),{anchorRef:u,Popover:c}=gt({placement:r,minWidth:o,maxWidth:s});return p.jsxs("span",{ref:u,className:i,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[t,p.jsx(c,{open:a,children:p.jsx(mt,{children:n})})]})},sy=e=>{const{open:t,onDismiss:n,enableDismissOnOutsideClick:i,enableDismissOnEscKey:r,enableDismissButton:o,className:s,children:a,maxWidth:l=600}=e;return _t(!!r&&t,n||(()=>{})),p.jsx(An,{children:t&&p.jsxs(Yr,{children:[p.jsx(Fe.div,{style:{transformOrigin:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},children:p.jsx(Gr,{className:"modal-overlay backdrop-blur-[1px] z-10",onClick:i?n:void 0,lockScroll:!0})}),p.jsx("div",{className:"fixed inset-0 flex flex-col items-center pointer-events-none p-4 lg:p-12 overflow-y-auto z-20",children:p.jsxs(Fe.div,{className:N("flex flex-col modal-content rounded-2xl shadow-xl p-6 lg:p-12 pointer-events-auto w-full relative",s),style:{transformOrigin:"bottom",maxWidth:l},initial:{opacity:0,scale:.98,translateY:10},animate:{opacity:1,scale:1,translateY:0},exit:{opacity:0,scale:.98,translateY:10},transition:{duration:.15,ease:"easeInOut"},children:[o&&p.jsx(Pr,{Icon:ft,className:"absolute top-4 right-4",variant:"transparent",size:"sm",onClick:n}),a]})})]})})},ay=e=>{const{open:t,onDismiss:n,enableDismissOnOutsideClick:i,enableDismissOnEscKey:r,enableDismissButton:o,className:s,children:a,maxWidth:l=480}=e;return _t(!!r&&t,n||(()=>{})),p.jsx(An,{children:t&&p.jsxs(Yr,{children:[p.jsx(Fe.div,{style:{transformOrigin:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},children:p.jsx(Gr,{className:"modal-overlay backdrop-blur-[1px] z-10",onClick:i?n:void 0,lockScroll:!0})}),p.jsx("div",{className:"fixed inset-0 flex flex-row justify-end pointer-events-none z-20",children:p.jsxs(Fe.div,{className:N("flex flex-col modal-content shadow-xl p-6 lg:p-12 pointer-events-auto h-full w-full overflow-y-auto relative",s),style:{maxWidth:l},initial:{translateX:"100%"},animate:{translateX:0},exit:{translateX:"100%"},transition:{duration:.25,ease:[.32,.72,0,1]},children:[o&&p.jsx(Pr,{Icon:ft,className:"absolute top-4 right-4",variant:"transparent",size:"sm",onClick:n}),a]})})]})})},hu={red:"bg-red-100 text-red-700 ring-red-200 dark:bg-red-950 dark:text-red-300 dark:ring-red-800",orange:"bg-orange-100 text-orange-700 ring-orange-200 dark:bg-orange-950 dark:text-orange-300 dark:ring-orange-800",amber:"bg-amber-100 text-amber-700 ring-amber-200 dark:bg-amber-950 dark:text-amber-300 dark:ring-amber-800",yellow:"bg-yellow-100 text-yellow-700 ring-yellow-200 dark:bg-yellow-950 dark:text-yellow-300 dark:ring-yellow-800",lime:"bg-lime-100 text-lime-700 ring-lime-200 dark:bg-lime-950 dark:text-lime-300 dark:ring-lime-800",green:"bg-green-100 text-green-700 ring-green-200 dark:bg-green-950 dark:text-green-300 dark:ring-green-800",emerald:"bg-emerald-100 text-emerald-700 ring-emerald-200 dark:bg-emerald-950 dark:text-emerald-300 dark:ring-emerald-800",teal:"bg-teal-100 text-teal-700 ring-teal-200 dark:bg-teal-950 dark:text-teal-300 dark:ring-teal-800",cyan:"bg-cyan-100 text-cyan-700 ring-cyan-200 dark:bg-cyan-950 dark:text-cyan-300 dark:ring-cyan-800",sky:"bg-sky-100 text-sky-700 ring-sky-200 dark:bg-sky-950 dark:text-sky-300 dark:ring-sky-800",blue:"bg-blue-100 text-blue-700 ring-blue-200 dark:bg-blue-950 dark:text-blue-300 dark:ring-blue-800",indigo:"bg-indigo-100 text-indigo-700 ring-indigo-200 dark:bg-indigo-950 dark:text-indigo-300 dark:ring-indigo-800",violet:"bg-violet-100 text-violet-700 ring-violet-200 dark:bg-violet-950 dark:text-violet-300 dark:ring-violet-800",purple:"bg-purple-100 text-purple-700 ring-purple-200 dark:bg-purple-950 dark:text-purple-300 dark:ring-purple-800",fuchsia:"bg-fuchsia-100 text-fuchsia-700 ring-fuchsia-200 dark:bg-fuchsia-950 dark:text-fuchsia-300 dark:ring-fuchsia-800",pink:"bg-pink-100 text-pink-700 ring-pink-200 dark:bg-pink-950 dark:text-pink-300 dark:ring-pink-800",rose:"bg-rose-100 text-rose-700 ring-rose-200 dark:bg-rose-950 dark:text-rose-300 dark:ring-rose-800",slate:"bg-slate-100 text-slate-700 ring-slate-200 dark:bg-slate-950 dark:text-slate-300 dark:ring-slate-800",gray:"bg-gray-100 text-gray-700 ring-gray-200 dark:bg-gray-950 dark:text-gray-300 dark:ring-gray-800",zinc:"bg-zinc-100 text-zinc-700 ring-zinc-200 dark:bg-zinc-950 dark:text-zinc-300 dark:ring-zinc-800",neutral:"bg-neutral-100 text-neutral-700 ring-neutral-200 dark:bg-neutral-950 dark:text-neutral-300 dark:ring-neutral-800",stone:"bg-stone-100 text-stone-700 ring-stone-200 dark:bg-stone-950 dark:text-stone-300 dark:ring-stone-800",white:"bg-[var(--color-badge-white-bg)] text-[var(--color-badge-white-text)] ring-[var(--color-badge-white-ring)]",black:"bg-[var(--color-badge-black-bg)] text-[var(--color-badge-black-text)] ring-[var(--color-badge-black-ring)]"},go=C.forwardRef((e,t)=>{const{className:n,children:i,onClick:r,showCloseIcon:o,Icon:s,color:a="gray"}=e,l=N("inline-flex align-top items-center gap-2 px-3 h-7 rounded-lg font-semibold",hu[a],n);return r?p.jsx("div",{ref:t,children:p.jsxs("button",{className:N("cursor-pointer ring-0 hover:ring-4 active:ring-1 transition-all duration-100 select-none focus:outline-none focus:ring-4",l),onClick:r,children:[s&&p.jsx(s,{className:"h-4 w-4 shrink-0"}),p.jsx("div",{className:"break-all line-clamp-1 text-left",children:i}),o&&p.jsx(ft,{className:"h-4 w-4 shrink-0"})]})}):p.jsxs("div",{className:l,ref:t,children:[s&&p.jsx(s,{className:"h-4 w-4 shrink-0"}),p.jsx("div",{className:"break-all line-clamp-1 text-left",children:i})]})}),gu=e=>{const{className:t,tabs:n}=e;return p.jsx("div",{className:N("h-12 tab-container p-1 rounded-xl inline-flex flex-row space-x-1 overflow-x-auto mat-ui-hide-scrollbars",t),children:n.map((i,r)=>{const o=N("shrink-0 px-4 h-full inline-flex flex-row items-center font-semibold rounded-xl cursor-pointer border border-transparent ing-0 tab-button transition-all duration-150 select-none focus:outline-none focus:ring-0",i.active&&"tab-button-active shadow-sm");return i.href?p.jsxs("a",{href:i.href,className:o,children:[i.Icon&&p.jsx(i.Icon,{className:"h-5 w-5 shrink-0 mr-2 -ml-1"}),i.label]},r):p.jsxs("button",{className:o,onClick:i.onClick,children:[i.Icon&&p.jsx(i.Icon,{className:"h-5 w-5 shrink-0 mr-2 -ml-1"}),i.label]},r)})})},ly=e=>{const{duration:t=.3,ease:n="easeInOut",horizontal:i=!1,children:r,className:o,...s}=e,a=C.useRef(null),l=C.useRef(null),u=C.useRef(null);return C.useEffect(()=>{const c=a.current,d=l.current;if(!c||!d)return;let f=!0;const m=()=>{const x=i?c.scrollWidth-c.clientWidth:c.scrollHeight-c.clientHeight,b=i?c.scrollLeft:c.scrollTop;if(!(x<=0||Math.abs(x-b)<1)){if(f){f=!1,i?c.scrollLeft=x:c.scrollTop=x;return}u.current?.stop(),u.current=fh(b,x,{duration:t,ease:n,onUpdate:h=>{i?c.scrollLeft=h:c.scrollTop=h}})}},v=new ResizeObserver(m);return v.observe(d),()=>{v.disconnect(),u.current?.stop()}},[t,n,i]),p.jsx("div",{ref:a,className:N("min-h-0 min-w-0",i?"overflow-x-auto":"overflow-y-auto",o),...s,children:p.jsx("div",{ref:l,children:r})})};function cy(e){const{onDelta:t,onDragStart:n,onDragEnd:i,disabled:r=!1,primaryButtonOnly:o=!0,preventScrollOnMove:s=!0}=e,[a,l]=C.useState(!1),u=C.useRef(!1),c=C.useRef(0),d=C.useRef(0),f=C.useRef(0),m=C.useRef(null),v=C.useRef(null),x=C.useRef({onDelta:t,onDragStart:n,onDragEnd:i,preventScrollOnMove:s});C.useEffect(()=>{x.current={onDelta:t,onDragStart:n,onDragEnd:i,preventScrollOnMove:s}});const b=C.useRef({}),h=C.useCallback(w=>{if(!u.current)return;const k={clientX:w??d.current,startX:c.current,totalDeltaX:f.current,target:m.current};u.current=!1,l(!1);const{move:y,up:P,keydown:E}=b.current;y&&window.removeEventListener("pointermove",y,!0),P&&(window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0)),E&&window.removeEventListener("keydown",E,!0),b.current={},v.current!=null&&(cancelAnimationFrame(v.current),v.current=null),x.current.onDragEnd?.(k),m.current=null,f.current=0},[]),T=C.useCallback(w=>{if(r||o&&w.button!==0)return;w.target.setPointerCapture?.(w.pointerId),c.current=w.clientX,d.current=w.clientX,f.current=0,m.current=w.target,u.current=!0,l(!0);const k={clientX:w.clientX,startX:w.clientX,totalDeltaX:0,target:w.target};x.current.onDragStart?.(k);const y=A=>{u.current&&v.current==null&&(v.current=requestAnimationFrame(()=>{v.current=null;const M=A.clientX,W=M-d.current;if(W===0)return;d.current=M,f.current+=W;const O={clientX:M,startX:c.current,totalDeltaX:f.current,target:m.current};x.current.preventScrollOnMove&&A.preventDefault(),x.current.onDelta(W,O)}))},P=A=>{h(A.clientX)},E=A=>{A.key==="Escape"&&(A.preventDefault(),h())};b.current={move:y,up:P,keydown:E},window.addEventListener("pointermove",y,{passive:!s,capture:!0}),window.addEventListener("pointerup",P,{capture:!0}),window.addEventListener("pointercancel",P,{capture:!0}),window.addEventListener("keydown",E,!0)},[h,r,s,o]);return C.useEffect(()=>()=>{u.current&&h()},[h]),{isDragging:a,bind:{onPointerDown:T,role:"separator",style:{touchAction:"none",cursor:"col-resize",userSelect:"none"}}}}const vu=e=>{const{column:t,width:n,height:i,onResize:r,sortDirection:o,onSortClick:s}=e,a=!!t.sortable,{bind:l}=cy({onDelta:u=>r(u)});return p.jsxs("div",{style:{width:n,height:i},className:"flex flex-row items-stretch select-none shrink-0",children:[p.jsxs("div",{className:N("flex-1 min-w-0 px-4 table-header-cell transition-colors duration-100 flex flex-row items-center gap-2",a&&"cursor-pointer"),onClick:a?s:void 0,children:[p.jsx("span",{className:"truncate",children:t.header}),a&&o==="asc"&&p.jsx(Ph,{className:"h-4 w-4 shrink-0"}),a&&o==="desc"&&p.jsx(cn,{className:"h-4 w-4 shrink-0"})]}),p.jsx("div",{...l,className:"cursor-ew-resize group py-4 table-resize-handle w-[8px]",children:p.jsx("div",{className:"w-0.5 h-full mx-auto table-resize-divider table-resize-divider-hover pointer-events-none"})})]})},Bt=200,uy=60,dy=e=>{const t={};for(const n of e)t[n.id]=n.defaultWidth??Bt;return t},xu=e=>{const{columns:t,rows:n,getRowId:i,onRowClick:r,sort:o,onSortChange:s,className:a,rowHeight:l=44,headerHeight:u=44}=e,[c,d]=S.useState(()=>dy(t));S.useEffect(()=>{d(h=>{const T={};let w=Object.keys(h).length!==t.length;for(const k of t)k.id in h?T[k.id]=h[k.id]:(T[k.id]=k.defaultWidth??Bt,w=!0);return w?T:h})},[t]);const f=S.useCallback((h,T,w)=>{d(k=>{const y=k[h]??Bt,P=Math.max(w,y+T);return P===y?k:{...k,[h]:P}})},[]),m=S.useCallback(h=>{if(s){if(!o||o.columnId!==h){s({columnId:h,direction:"asc"});return}if(o.direction==="asc"){s({columnId:h,direction:"desc"});return}s(null)}},[o,s]),v=t.reduce((h,T)=>h+(c[T.id]??T.defaultWidth??Bt),0),x=S.useRef(null),b=h=>{x.current&&(x.current.scrollLeft=h.currentTarget.scrollLeft)};return p.jsxs("div",{className:N("flex flex-col h-full w-full",a),children:[p.jsx("div",{ref:x,className:"overflow-hidden shrink-0 table-header-strip",style:{height:u},children:p.jsx("div",{className:"flex flex-row table-header font-medium",style:{width:v,minWidth:"100%"},children:t.map(h=>p.jsx(vu,{column:h,width:c[h.id]??h.defaultWidth??Bt,height:u,onResize:T=>f(h.id,T,h.minWidth??uy),sortDirection:o?.columnId===h.id?o.direction:null,onSortClick:()=>m(h.id)},h.id))})}),p.jsx("div",{className:"flex-1 overflow-auto",onScroll:b,children:p.jsx("div",{className:"flex flex-col",style:{width:v,minWidth:"100%"},children:n.map((h,T)=>p.jsx("div",{className:N("flex flex-row table-body-row transition-colors duration-100",r&&"cursor-pointer"),onClick:r?()=>r(h,T):void 0,children:t.map(w=>p.jsx("div",{className:"shrink-0 content-center px-4 relative",style:{width:c[w.id]??w.defaultWidth??Bt,height:l},children:p.jsx("div",{className:"break-all line-clamp-1",children:w.renderCell(h,T)})},w.id))},i(h,T)))})})]})},yu=S.createContext(void 0),py=()=>({dismiss:S.useContext(yu)||(()=>{})}),fy="inline-flex flex-row items-center gap-3 h-10 px-3 font-semibold ring-0 dropdown-item rounded-lg cursor-pointer transition-all duration-150 select-none focus:outline-none focus:ring-0 border border-transparent bg-transparent",Te=C.forwardRef((e,t)=>{const{className:n,children:i,Icon:r,onClick:o,dismissOnClick:s=!0,...a}=e,{dismiss:l}=py(),u=c=>{o&&o(c),s&&l()};return p.jsxs("button",{ref:t,className:N(fy,n),onClick:u,...a,children:[r&&p.jsx(r,{className:"h-5 w-5"}),i]})}),vo=e=>{const{label:t,children:n,className:i}=e;return p.jsxs("div",{className:N("flex flex-col dropdown-button-group",i),children:[t&&p.jsx("div",{className:"mb-2 text-sm dropdown-group-label font-semibold px-3",children:t}),n]})},xo=e=>{const{trigger:t,children:n,placement:i="bottom-end",minWidth:r=200,className:o}=e,[s,a]=S.useState(!1),{Popover:l,anchorRef:u}=gt({placement:i,onOutsideClick:()=>a(!1),minWidth:r});return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:u,className:o,onClick:()=>a(!s),children:t}),p.jsx(l,{open:s,children:p.jsx(mt,{padding:"sm",children:p.jsx(yu.Provider,{value:()=>a(!1),children:n})})})]})},my=()=>p.jsx("div",{}),hy=[{id:1,email:"sarah.jennings@example.com",firstname:"Sarah",lastname:"Jennings",status:"active"},{id:2,email:"liam.patel@outlook.com",firstname:"Liam",lastname:"Patel",status:"inactive"},{id:3,email:"emily.wong@gmail.com",firstname:"Emily",lastname:"Wong",status:"active"},{id:4,email:"noah.thompson@yahoo.com",firstname:"Noah",lastname:"Thompson",status:"active"},{id:5,email:"isabella.martin@protonmail.com",firstname:"Isabella",lastname:"Martin",status:"active"},{id:6,email:"ethan.ross@company.io",firstname:"Ethan",lastname:"Ross",status:"inactive"},{id:7,email:"olivia.nguyen@example.org",firstname:"Olivia",lastname:"Nguyen",status:"active"},{id:8,email:"lucas.henderson@gmail.com",firstname:"Lucas",lastname:"Henderson",status:"inactive"},{id:9,email:"mia.johnson@workmail.com",firstname:"Mia",lastname:"Johnson",status:"active"},{id:10,email:"jackson.rivera@outlook.com",firstname:"Jackson",lastname:"Rivera",status:"active"},{id:11,email:"ava.sanders@example.com",firstname:"Ava",lastname:"Sanders",status:"active"},{id:12,email:"logan.bennett@company.io",firstname:"Logan",lastname:"Bennett",status:"inactive"}],gy=[{id:"id",header:"ID",renderCell:e=>e.id},{id:"email",header:"Email",renderCell:e=>p.jsx(go,{Icon:Fh,onClick:()=>{},children:e.email})},{id:"firstname",header:"First Name",renderCell:e=>e.firstname},{id:"lastname",header:"Last Name",renderCell:e=>e.lastname},{id:"status",header:"Status",renderCell:()=>p.jsx(xy,{})}],vy=()=>p.jsxs("div",{className:"flex flex-col gap-6",children:[p.jsxs("div",{className:"flex flex-row items-center justify-start gap-3",children:[p.jsx(Or,{Icon:Ar,placeholder:"Search..."}),p.jsx(_n,{Icon:ql}),p.jsx(Bl,{Icon:Wl,children:"New"}),p.jsxs(xo,{trigger:p.jsx(_n,{Icon:ql}),children:[p.jsx(Te,{dismissOnClick:!1,Icon:Wl,children:"Add new"}),p.jsx(Te,{Icon:Mh,children:"Remove"}),p.jsxs(vo,{label:"Test",className:"mt-2",children:[p.jsx(Te,{children:"Item 1"}),p.jsx(Te,{children:"Item 2"}),p.jsx(Te,{children:"Item 3"}),p.jsx(Te,{children:"Item 4"})]}),p.jsxs(vo,{label:"Test",className:"mt-2",children:[p.jsx(Te,{children:"Item 1"}),p.jsx(Te,{children:"Item 2"}),p.jsx(Te,{children:"Item 3"}),p.jsx(Te,{children:"Item 4"})]})]}),p.jsx(gu,{tabs:[{label:"Tab 1",Icon:$l,active:!0,onClick:()=>{}},{label:"Tab 2",active:!1,onClick:()=>{}},{label:"Tab 3",Icon:$l,active:!1,onClick:()=>{}}]})]}),p.jsx(pu,{options:[{label:"Option 1",value:1},{label:"Option 2",value:2},{label:"Option 3",value:3}],value:null,onChange:()=>{}}),p.jsx(xu,{className:"h-[300px] w-[300px]",columns:gy,rows:hy,getRowId:e=>e.id}),p.jsx(my,{})]}),xy=()=>p.jsx(p.Fragment,{children:p.jsxs(xo,{placement:"bottom-end",className:"inline-block",trigger:p.jsx(go,{onClick:()=>{},children:"Test"}),children:[p.jsx(Te,{children:"Option 1"}),p.jsx(Te,{children:"Option 2"}),p.jsx(Te,{children:"Option 3"})]})});B.AutoScroll=ly,B.Badge=go,B.BadgeColor=hu,B.Button=Bl,B.ButtonIconRound=Pr,B.ButtonIconSquare=_n,B.Divider=ry,B.DropdownButton=Te,B.DropdownButtonGroup=vo,B.DropdownMenu=xo,B.DropdownPanel=mt,B.Input=Or,B.InputCheck=_v,B.InputColor=Dv,B.InputDescription=Se,B.InputError=ke,B.InputErrorIcon=He,B.InputFileMultiple=Kx,B.InputFileSingle=qx,B.InputIconButton=Ye,B.InputIconButtonTray=tt,B.InputLabel=Ve,B.InputPassword=Rv,B.InputRadio=Fv,B.InputSelect=pu,B.InputSelectNative=Yx,B.InputSelectOption=vn,B.InputSelectSearchable=Gx,B.InputSelectSearchableAsync=Zx,B.InputTextArea=Nv,B.InputToggle=Vv,B.Modal=sy,B.Panel=Jx,B.PanelField=ey,B.PanelLink=iy,B.PanelStack=Qx,B.PopoverBase=Pc,B.SidebarModal=ay,B.Spinner=It,B.TabButtons=gu,B.Table=xu,B.TableColumnHead=vu,B.Test=vy,B.Tooltip=oy,B.UploadFileTile=du,B.usePopover=gt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
183
183
  //# sourceMappingURL=index.umd.cjs.map