aha-components 1.7.11 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +10 -0
  2. package/dist/Avatar.esm.js +2 -0
  3. package/dist/Avatar.esm.js.map +1 -0
  4. package/dist/Avatar.js +2 -0
  5. package/dist/Avatar.js.map +1 -0
  6. package/dist/Badge.esm.js +2 -0
  7. package/dist/Badge.esm.js.map +1 -0
  8. package/dist/Badge.js +2 -0
  9. package/dist/Badge.js.map +1 -0
  10. package/dist/Checkbox.esm.js +1 -1
  11. package/dist/Checkbox.esm.js.map +1 -1
  12. package/dist/Checkbox.js +1 -1
  13. package/dist/Checkbox.js.map +1 -1
  14. package/dist/Radio.esm.js +1 -1
  15. package/dist/Radio.esm.js.map +1 -1
  16. package/dist/Radio.js +1 -1
  17. package/dist/Radio.js.map +1 -1
  18. package/dist/Table.esm.js +1 -1
  19. package/dist/Table.esm.js.map +1 -1
  20. package/dist/Table.js +1 -1
  21. package/dist/Table.js.map +1 -1
  22. package/dist/Tag.esm.js +1 -1
  23. package/dist/Tag.esm.js.map +1 -1
  24. package/dist/Tag.js +1 -1
  25. package/dist/Tag.js.map +1 -1
  26. package/dist/Textarea.esm.js +1 -1
  27. package/dist/Textarea.esm.js.map +1 -1
  28. package/dist/Textarea.js +1 -1
  29. package/dist/Textarea.js.map +1 -1
  30. package/dist/components/Avatar/Avatar.stories.d.ts +12 -0
  31. package/dist/components/Avatar/index.d.ts +42 -0
  32. package/dist/components/Badge/Badge.stories.d.ts +15 -0
  33. package/dist/components/Badge/index.d.ts +71 -0
  34. package/dist/components/Checkbox/Checkbox.stories.d.ts +5 -4
  35. package/dist/components/Checkbox/index.d.ts +6 -0
  36. package/dist/components/Radio/Radio.stories.d.ts +6 -4
  37. package/dist/components/Radio/index.d.ts +6 -0
  38. package/dist/components/Tag/Tag.stories.d.ts +5 -8
  39. package/dist/components/Tag/index.d.ts +24 -2
  40. package/dist/components/Textarea/Textarea.stories.d.ts +2 -0
  41. package/dist/components/Textarea/Textarea.test.d.ts +1 -0
  42. package/dist/components/Textarea/index.d.ts +12 -0
  43. package/dist/design-tokens/theme.css +26 -0
  44. package/dist/design-tokens/theme.tailwind4.css +26 -0
  45. package/dist/index.css +3848 -0
  46. package/dist/index.d.ts +153 -4
  47. package/dist/index.esm.css +3848 -0
  48. package/dist/index.esm.js +1 -1
  49. package/dist/index.esm.js.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/theme.css +26 -0
  53. package/dist/tokens.d.ts +28 -0
  54. package/package.json +1 -1
package/dist/Table.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("react-dom"),o=function(){return o=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},o.apply(this,arguments)};function r(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}function i(e,n,t){if(t||2===arguments.length)for(var o,r=0,i=n.length;r<i;r++)!o&&r in n||(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var a={primaryColor:"#FB6011"},l=n.createContext(a),d=function(){var e=n.useContext(l);return e||a},s={sm:"sm",md:"md",lg:"lg",xl:"xl",small:"sm",mediumSmall:"sm",medium:"md",large:"xl"},c={primary:"primary",secondary:"secondary",tertiary:"tertiary","link-color":"link-color","link-gray":"link-gray","destructive-primary":"destructive-primary","destructive-secondary":"destructive-secondary","destructive-tertiary":"destructive-tertiary","destructive-link":"destructive-link",default:"secondary"},u={sm:{height:36,paddingX:12,paddingXLg:12,fontSize:14,lineHeight:20,iconSize:20,gap:4,iconOnlyPad:8},md:{height:40,paddingX:14,paddingXLg:14,fontSize:14,lineHeight:20,iconSize:20,gap:4,iconOnlyPad:10},lg:{height:44,paddingX:16,paddingXLg:16,fontSize:16,lineHeight:24,iconSize:20,gap:6,iconOnlyPad:12},xl:{height:48,paddingX:18,paddingXLg:18,fontSize:16,lineHeight:24,iconSize:20,gap:6,iconOnlyPad:14}},p=function(n){var t=n.size,o=n.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"@keyframes aha-button-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}"}),e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"aha-button-spin 1s linear infinite",flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:o,strokeWidth:"2",opacity:"0.25"}),e.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",stroke:o,strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})]})},f=function(t){var i=t.children,a=t.type,l=void 0===a?"secondary":a,f=t.size,h=void 0===f?"md":f,x=t.disabled,g=void 0!==x&&x,v=t.loading,m=void 0!==v&&v,y=t.iconOnly,b=t.focused,w=void 0!==b&&b,k=t.onClick,j=t.htmlType,C=void 0===j?"button":j,S=t.className,F=void 0===S?"":S,z=t.style,A=t.icon,W=t.iconPosition,L=void 0===W?"left":W,E=r(t,["children","type","size","disabled","loading","iconOnly","focused","onClick","htmlType","className","style","icon","iconPosition"]),I=d().primaryColor,B=n.useState(!1),D=B[0],M=B[1],N=n.useState(!1),R=N[0],H=N[1],T=c[l]||"secondary",O=u[s[h]||"md"],P=null!=y?y:!!A&&null==i,_="link-color"===T||"link-gray"===T||"destructive-link"===T,K=g||m,X=w,q=I,Y=function(){if(g)return"primary"===T||"secondary"===T||"destructive-primary"===T||"destructive-secondary"===T?{bg:"var(--color-bg-disabled, #f5f5f4)",color:"var(--color-fg-disabled, #a9a29d)",iconColor:"var(--color-fg-disabled, #a9a29d)",border:"1px solid var(--color-border-disabled_subtle, #e7e5e4)",boxShadow:"none"}:{bg:"transparent",color:"var(--color-fg-disabled, #a9a29d)",iconColor:"var(--color-fg-disabled, #a9a29d)",border:"none",boxShadow:"none"};var e=D||R;return"primary"===T?{bg:e?"var(--color-bg-brand-solid_hover, #ec470a)":q||"var(--color-bg-brand-solid, #fb6011)",color:"var(--color-text-white, #ffffff)",iconColor:"var(--color-brand-300, #feb073)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic, 0 1px 2px 0 rgba(10,13,18,.05))"}:"secondary"===T?{bg:e?"var(--color-bg-primary_hover, #fafaf9)":"var(--color-bg-primary, #ffffff)",color:e?"var(--color-text-secondary_hover, #292524)":"var(--color-text-secondary, #44403c)",iconColor:e?"var(--color-fg-quaternary_hover, #79716b)":"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic)"}:"tertiary"===T?{bg:e?"var(--color-bg-primary_hover, #fafaf9)":"transparent",color:e?"var(--color-text-tertiary_hover, #44403c)":"var(--color-text-tertiary, #57534e)",iconColor:e?"var(--color-fg-quaternary_hover, #79716b)":"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"none"}:"link-color"===T?{bg:"transparent",color:e?"var(--color-text-brand-secondary_hover, #c4330a)":"var(--color-text-brand-secondary, #ec470a)",iconColor:"var(--color-fg-brand-secondary_alt, #fb6011)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}:"link-gray"===T?{bg:"transparent",color:e?"var(--color-text-tertiary_hover, #44403c)":"var(--color-text-tertiary, #57534e)",iconColor:"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}:"destructive-primary"===T?{bg:e?"var(--color-error-600)":"var(--color-error-500)",color:"var(--color-text-white)",iconColor:e?"var(--color-error-200)":"var(--color-error-300)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic)"}:"destructive-secondary"===T?{bg:e?"var(--color-bg-error-primary)":"var(--color-bg-primary)",color:"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"inset 0 0 0 1px var(--color-border-error_subtle), inset 0 -2px 0 0 rgba(10,13,18,0.05), 0 1px 2px 0 rgba(10,13,18,0.05)"}:"destructive-tertiary"===T?{bg:e?"var(--color-bg-error-primary)":"transparent",color:"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"none"}:{bg:"transparent",color:e?"var(--color-text-error-primary_hover)":"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}}(),V=function(){if(X)return"destructive-primary"===T||"destructive-secondary"===T||"destructive-tertiary"===T||"destructive-link"===T?"destructive-primary"===T||"destructive-secondary"===T?"var(--focus-ring-error-shadow-xs-skeuomorphic)":"var(--focus-ring-error)":"primary"===T||"secondary"===T?"var(--focus-ring-shadow-xs-skeuomorphic, 0 0 0 2px #fff, 0 0 0 4px #fb6011)":"var(--focus-ring, 0 0 0 2px #fff, 0 0 0 4px #fb6011)"}(),J=o({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:O.gap,fontFamily:'var(--font-family-body, "DM Sans", system-ui, sans-serif)',fontWeight:600,fontSize:O.fontSize,lineHeight:"".concat(O.lineHeight,"px"),cursor:K?"not-allowed":"pointer",outline:"none",transition:"background-color .15s ease, color .15s ease, box-shadow .15s ease",userSelect:"none",WebkitTapHighlightColor:"transparent",whiteSpace:"nowrap",backgroundColor:Y.bg,color:Y.color,border:Y.border,boxShadow:null!=V?V:Y.boxShadow,textDecoration:Y.textDecoration},z);_?(J.borderRadius="4px",J.overflow="hidden",P?(J.width=O.height,J.height=O.height,J.padding=0):(J.height=O.height,J.paddingLeft=O.paddingX,J.paddingRight=O.paddingX)):(J.borderRadius="var(--radius-md, 8px)",P?(J.width=O.height,J.height=O.height,J.padding=0):(J.height=O.height,J.paddingLeft=O.paddingX,J.paddingRight=O.paddingX));var Q=function(){return m?e.jsx(p,{size:O.iconSize,color:Y.iconColor}):A?e.jsx("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:O.iconSize,height:O.iconSize,color:Y.iconColor,flexShrink:0},children:A}):null},U=m||A&&"left"===L,G=!m&&A&&"right"===L;return e.jsxs("button",o({type:C,className:["aha-button","aha-button--".concat(T),"aha-button--".concat(s[h]||"md"),P&&"aha-button--icon-only",K&&"aha-button--disabled",m&&"aha-button--loading",X&&"aha-button--focused",F].filter(Boolean).join(" "),disabled:K,onClick:function(e){K?e.preventDefault():null==k||k(e)},onMouseEnter:function(){return!K&&M(!0)},onMouseLeave:function(){M(!1),H(!1)},onMouseDown:function(){return!K&&H(!0)},onMouseUp:function(){return H(!1)},style:J},E,{children:[U&&Q(),!P&&i,G&&Q(),P&&!A&&!m&&i]}))};f.displayName="Button";var h=n.forwardRef(function(t,i){var a=t.size,l=void 0===a?"medium":a,s=t.disabled,c=void 0!==s&&s,u=t.error,p=void 0!==u&&u,f=t.readOnly,h=void 0!==f&&f,x=t.prefix,g=t.suffix,v=t.allowClear,m=void 0!==v&&v,y=t.onClear,b=t.className,w=void 0===b?"":b,k=t.style,j=t.type,C=void 0===j?"text":j,S=t.placeholder,F=t.value,z=t.defaultValue,A=t.onChange,W=t.onFocus,L=t.onBlur,E=t.onPressEnter,I=r(t,["size","disabled","error","readOnly","prefix","suffix","allowClear","onClear","className","style","type","placeholder","value","defaultValue","onChange","onFocus","onBlur","onPressEnter"]),B=d().primaryColor,D=void 0===B?"#FB6011":B,M=n.useRef(null),N=n.useState(z||F||""),R=N[0],H=N[1],T=n.useState(!1),O=T[0],P=T[1];n.useEffect(function(){"function"==typeof i?i(M.current):i&&(i.current=M.current)},[i]);var _=void 0!==F,K=_?F:R,X=function(e){var n;e.stopPropagation(),_||H("");null==A||A({target:{value:""},currentTarget:{value:""}}),null==y||y(),null===(n=M.current)||void 0===n||n.focus()},q=m&&K&&!c,Y={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px"}},V=g||q?"40px":"12px",J=o({width:"100%",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(p?"#F04438":O?D:"#D7D3D0"),backgroundColor:c||h?"#FAFAF9":"#FFFFFF",color:c?"#98A2B3":"#1C1917",fontSize:"16px",fontWeight:400,lineHeight:"24px",paddingLeft:x?"40px":"12px",paddingRight:V,paddingTop:Y[l].paddingTop,paddingBottom:Y[l].paddingBottom,transition:"all 0.2s",outline:"none",WebkitAppearance:"none",MozAppearance:"textfield",appearance:"none"},k);return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:'\n .aha-input-wrapper input::placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-webkit-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-moz-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input:-ms-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n /* 移动端优化 */\n .aha-input-wrapper input {\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n touch-action: manipulation;\n }\n /* 移除数字输入框的上下箭头 */\n .aha-input-wrapper input[type="number"]::-webkit-inner-spin-button,\n .aha-input-wrapper input[type="number"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n .aha-input-wrapper input[type="number"] {\n -moz-appearance: textfield;\n }\n '}),e.jsxs("div",{className:"aha-input-wrapper ".concat(w),style:{position:"relative",display:"inline-flex",alignItems:"center",width:"100%"},children:[x&&e.jsx("span",{style:{position:"absolute",left:"12px",display:"flex",alignItems:"center",color:c?"#98A2B3":"#78716C",zIndex:1,pointerEvents:"none"},children:x}),e.jsx("input",o({ref:M,type:C,value:K,placeholder:S,disabled:c,readOnly:h,onChange:function(e){_||H(e.target.value),null==A||A(e)},onFocus:function(e){P(!0),null==W||W(e)},onBlur:function(e){P(!1),null==L||L(e)},onKeyDown:function(e){var n;"Enter"===e.key&&E&&E(e),null===(n=I.onKeyDown)||void 0===n||n.call(I,e)},style:J,autoComplete:I.autoComplete||"off",autoCorrect:I.autoCorrect||"off",autoCapitalize:I.autoCapitalize||"off",spellCheck:I.spellCheck||!1},I)),(g||q)&&e.jsxs("span",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px",color:c?"#98A2B3":"#78716C",zIndex:1},children:[q&&e.jsx(function(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:X,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),g&&e.jsx("span",{style:{pointerEvents:"none"},children:g})]})]})]})});h.displayName="Input";var x=function(r){var a,l=r.value,s=r.defaultValue,c=r.options,u=void 0===c?[]:c,p=r.mode,f=r.disabled,h=void 0!==f&&f,x=r.error,g=void 0!==x&&x,v=r.placeholder,m=void 0===v?"Please select":v,y=r.size,b=void 0===y?"medium":y,w=r.showSearch,k=void 0!==w&&w,j=r.filterOption,C=void 0===j||j,S=r.allowClear,F=void 0!==S&&S,z=r.onChange,A=r.onSelect,W=r.onDeselect,L=r.onSearch,E=r.onFocus,I=r.onBlur,B=r.onDropdownVisibleChange,D=r.className,M=void 0===D?"":D,N=r.style,R=r.dropdownClassName,H=void 0===R?"":R,T=r.dropdownStyle,O=r.defaultOpen,P=void 0!==O&&O,_=r.open,K=r.maxTagCount,X=r.tagRender,q=r.optionRender,Y=d().primaryColor,V=void 0===Y?"#FB6011":Y,J=n.useState(void 0!==s?s:p?[]:void 0),Q=J[0],U=J[1],G=n.useState(P),Z=G[0],$=G[1],ee=n.useState(""),ne=ee[0],te=ee[1],oe=n.useState(-1),re=oe[0],ie=oe[1],ae=n.useRef(null),le=n.useRef(null),de=n.useRef(null),se=n.useState(null),ce=se[0],ue=se[1],pe=void 0!==l,fe=void 0!==_,he=pe?l:Q,xe=fe?_:Z,ge="multiple"===p||"tags"===p,ve=n.useCallback(function(){if(!he)return[];var e=Array.isArray(he)?he:[he];return u.filter(function(n){return e.includes(n.value)})},[he,u]),me=n.useCallback(function(){return k&&ne?!1===C?u:"function"==typeof C?u.filter(function(e){return C(ne,e)}):u.filter(function(e){var n=String(e.label||"").toLowerCase(),t=ne.toLowerCase();return n.includes(t)}):u},[u,ne,k,C]),ye=n.useMemo(function(){return me()},[me]);n.useEffect(function(){if(xe&&ae.current){var e=function(){var e,n;if(ae.current){var t=ae.current.getBoundingClientRect(),o=null!==(n=null===(e=de.current)||void 0===e?void 0:e.offsetHeight)&&void 0!==n?n:Math.min(256,Math.max(40,40*ye.length)),r=window.innerHeight-t.bottom,i=t.top,a=r<o+4&&i>r,l=a?t.top+window.scrollY-o-4:t.bottom+window.scrollY+4;ue({top:l,left:t.left+window.scrollX,width:t.width,placement:a?"top":"bottom"})}};return e(),requestAnimationFrame(e),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}}ue(null)},[xe,ye.length]),n.useEffect(function(){var e=function(e){var n=e.target;ae.current&&!ae.current.contains(n)&&de.current&&!de.current.contains(n)&&(fe||$(!1),null==B||B(!1),te(""))};if(xe)return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),function(){document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0)}},[xe,fe,B]),n.useEffect(function(){if(xe){var e=function(e){var n;if("ArrowDown"===e.key)e.preventDefault(),ie(function(e){return e<ye.length-1?e+1:e});else if("ArrowUp"===e.key)e.preventDefault(),ie(function(e){return e>0?e-1:0});else if("Enter"===e.key&&re>=0){e.preventDefault();var t=ye[re];t&&!t.disabled&&be(t)}else"Escape"===e.key&&(e.preventDefault(),fe||$(!1),null==B||B(!1),null===(n=ae.current)||void 0===n||n.focus())};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}},[xe,ye,re,fe,B]),n.useEffect(function(){if(re>=0&&de.current){var e=de.current.querySelectorAll(".aha-select-option")[re];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[re]);var be=n.useCallback(function(e){var n;if(!e.disabled)if(ge){var t,o=Array.isArray(he)?he:[];o.includes(e.value)?(t=o.filter(function(n){return n!==e.value}),null==W||W(e.value,e)):(t=i(i([],o,!0),[e.value],!1),null==A||A(e.value,e)),pe||U(t);var r=u.filter(function(e){return t.includes(e.value)});null==z||z(t,r)}else pe||U(e.value),null==z||z(e.value,e),null==A||A(e.value,e),fe||$(!1),null==B||B(!1),te(""),null===(n=ae.current)||void 0===n||n.focus()},[ge,he,pe,fe,u,z,A,W,B]),we=n.useCallback(function(e,n){if(e.stopPropagation(),ge&&Array.isArray(he)){var t=he.filter(function(e){return e!==n}),o=u.find(function(e){return e.value===n});pe||U(t),null==z||z(t,ve()),null==W||W(n,o)}},[ge,he,pe,u,z,W,ve]),ke=function(e){e.stopPropagation();var n=ge?[]:void 0;pe||U(n),null==z||z(n,[]),te("")},je={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px",fontSize:"16px",lineHeight:"24px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px",fontSize:"16px",lineHeight:"24px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px",fontSize:"16px",lineHeight:"24px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px",fontSize:"16px",lineHeight:"24px"}},Ce=n.useMemo(function(){return ve()},[ve]),Se=n.useMemo(function(){return F&&he&&!h},[F,he,h]),Fe=n.useMemo(function(){return ge?Array.isArray(he)&&he.length>0:null!=he&&""!==he},[ge,he]),ze=n.useMemo(function(){if(!ge||!Array.isArray(he)||0===he.length)return null;var t="responsive"===K?Ce.slice(0,2):K?Ce.slice(0,K):Ce,o=K&&Ce.length>t.length?Ce.length-t.length:0;return e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",flex:1,minWidth:0},children:[t.map(function(t){var o={label:t.label,value:t.value,closable:!h,onClose:function(){return we({},t.value)}};return X?e.jsx(n.Fragment,{children:X(o)},t.value):e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",backgroundColor:"#F5F5F4",borderRadius:"4px",fontSize:"12px",lineHeight:"18px",color:"#101828",fontFamily:"DM Sans, sans-serif",maxWidth:"100%"},children:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.label}),!h&&e.jsx("span",{onClick:function(e){return we(e,t.value)},style:{cursor:"pointer",display:"flex",alignItems:"center",color:"#78716C",marginLeft:"4px"},children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]},t.value)}),o>0&&e.jsxs("span",{style:{fontSize:"12px",lineHeight:"18px",color:"#78716C",fontFamily:"DM Sans, sans-serif"},children:["+",o]})]})},[ge,he,Ce,K,h,X]);return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n @keyframes dropdownFadeIn {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n "}),e.jsxs("div",{ref:ae,className:"aha-select ".concat(M),style:o({position:"relative",display:"inline-flex",alignItems:"center",width:"100%",minWidth:"120px",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(g?"#F04438":xe?V:"#D7D3D0"),backgroundColor:h?"#FAFAF9":"#FFFFFF",cursor:h?"not-allowed":"pointer",transition:"all 0.2s",paddingLeft:"12px",paddingRight:"36px",paddingTop:je[b].paddingTop,paddingBottom:je[b].paddingBottom,fontSize:je[b].fontSize,lineHeight:je[b].lineHeight,fontWeight:400,WebkitTapHighlightColor:"transparent",WebkitTouchCallout:"none",touchAction:"manipulation",userSelect:"none"},N),onClick:function(){if(!h){var e=!xe;fe||$(e),null==B||B(e),e&&k?setTimeout(function(){var e;null===(e=le.current)||void 0===e||e.focus()},0):te("")}},onFocus:function(e){null==E||E(e)},onBlur:function(e){null==I||I(e)},onTouchStart:function(e){h||(e.currentTarget.style.opacity="0.8")},onTouchEnd:function(e){e.currentTarget.style.opacity="1"},tabIndex:h?-1:0,children:[e.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,minWidth:0,gap:"8px"},children:ge?ze||(m?e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400},children:m}):e.jsx("span",{style:{flex:1,minHeight:"24px"}})):k&&xe?e.jsx("input",{ref:le,type:"text",value:ne,onChange:function(e){var n=e.target.value;te(n),null==L||L(n),ie(-1)},onClick:function(e){return e.stopPropagation()},onFocus:function(e){return e.stopPropagation()},style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:"16px",lineHeight:"24px",fontWeight:400,color:h?"#98A2B3":"#1C1917",fontFamily:"DM Sans, sans-serif",minWidth:0,WebkitAppearance:"none",appearance:"none"},placeholder:Fe?void 0:m,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:Fe?h?"#98A2B3":"#1C1917":"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400,minHeight:"24px",display:"inline-block"},children:Fe?(null===(a=Ce[0])||void 0===a?void 0:a.label)||he:m||" "})}),e.jsxs("div",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px"},children:[Se&&e.jsx(function(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:ke,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),e.jsx(function(n){var t=n.isOpen;return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out",flexShrink:0},children:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#78716C",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{isOpen:xe})]})]}),xe&&ce&&t.createPortal(e.jsx("div",{ref:de,className:"aha-select-dropdown ".concat(H),style:o({position:"absolute",top:"".concat(ce.top,"px"),left:"".concat(ce.left,"px"),width:"".concat(ce.width,"px"),zIndex:1050,backgroundColor:"#FFFFFF",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",border:"1px solid #E7E5E4",maxHeight:"256px",overflow:"auto",opacity:0,transform:"top"===ce.placement?"translateY(8px)":"translateY(-8px)",animation:"dropdownFadeIn 0.2s ease-out forwards",transformOrigin:"top"===ce.placement?"bottom center":"top center",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},T),children:0===ye.length?e.jsx("div",{style:{padding:"8px 16px",textAlign:"center",color:"#78716C",fontSize:"14px",fontFamily:"DM Sans, sans-serif"},children:"No data"}):ye.map(function(n,t){var o=ge?Array.isArray(he)&&he.includes(n.value):he===n.value,r=t===re;return q?e.jsx("div",{className:"aha-select-option ".concat(n.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(o?"bg-[#FAFAF9]":""),onClick:function(){return!n.disabled&&be(n)},style:{cursor:n.disabled?"not-allowed":"pointer",transition:"background-color 0.2s"},children:q(n,{selected:o,focused:r,disabled:n.disabled||!1})},n.value):e.jsxs("div",{className:"aha-select-option ".concat(n.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(o?"bg-[#FAFAF9]":""),onClick:function(){return be(n)},style:{padding:"8px 16px",cursor:n.disabled?"not-allowed":"pointer",color:n.disabled?"#98A2B3":"#101828",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif",display:"flex",alignItems:"center",justifyContent:"space-between",transition:"background-color 0.2s"},children:[e.jsx("span",{children:n.label}),o&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r?"hidden":"",children:e.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:V,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},n.value)})}),document.body)]})};x.displayName="Select";var g=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M11.6666 3.5L5.24992 9.91667L2.33325 7",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},v=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M3.5 7H10.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})},m=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},y=function(n){var t=n.className,o=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:[e.jsx("path",{d:"M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},b=function(n){var t=n.className,o=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:[e.jsx("path",{d:"M8.5 7.5L6 10L3.5 7.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8.5 4.5L6 2L3.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},w=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M15.8334 10H4.16675M4.16675 10L10.0001 15.8334M4.16675 10L10.0001 4.16669",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},k=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M4.16675 10H15.8334M15.8334 10L10.0001 4.16669M15.8334 10L10.0001 15.8334",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},j=function(t){var r=t.current,i=t.defaultCurrent,a=void 0===i?1:i,l=t.total,s=void 0===l?0:l,c=t.pageSize,u=t.defaultPageSize,p=void 0===u?10:u,g=t.showSizeChanger,v=void 0!==g&&g,m=t.pageSizeOptions,y=void 0===m?["10","20","50","100"]:m,b=t.showQuickJumper,j=void 0!==b&&b,C=t.showTotal,S=t.onChange,F=t.onShowSizeChange,z=t.simple,A=void 0!==z&&z,W=t.disabled,L=void 0!==W&&W,E=t.hideOnSinglePage,I=void 0!==E&&E,B=t.className,D=void 0===B?"":B,M=t.style,N=t.size,R=void 0===N?"default":N,H=t.responsive,T=void 0!==H&&H;t.showLessItems;var O=t.itemRender,P=d().primaryColor,_=void 0===P?"#FB6011":P,K=n.useState(a),X=K[0],q=K[1],Y=n.useState(p),V=Y[0],J=Y[1],Q=n.useState(""),U=Q[0],G=Q[1],Z=null!=r?r:X,$=null!=c?c:V,ee=n.useMemo(function(){return Math.ceil(s/$)},[s,$]);n.useEffect(function(){void 0!==r&&q(r)},[r]),n.useEffect(function(){void 0!==c&&J(c)},[c]);var ne=function(e){e<1||e>ee||e===Z||L||(void 0===r&&q(e),null==S||S(e,$))},te=function(){var e=parseInt(U,10);e>=1&&e<=ee&&(ne(e),G(""))};if(I&&ee<=1)return null;if(A)return e.jsxs("div",{className:"aha-pagination aha-pagination-simple ".concat(D),style:M,children:[e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:L||1===Z,type:"default",size:"default"===R?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(w,{})}),e.jsxs("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[Z," / ",ee]}),e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:L||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(k,{})})]});var oe=(Z-1)*$+1,re=Math.min(Z*$,s);return e.jsxs("div",{className:"aha-pagination w-full ".concat(D),style:o({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:T?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},M),children:[C&&e.jsx("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:C(s,[oe,re])}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[s>0&&e.jsx(e.Fragment,{children:O?O(Z-1,"prev",e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:L||1===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(w,{})})):e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:L||1===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(w,{})})}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:function(){if(ee<=7)return Array.from({length:ee},function(e,n){return n+1});var e=[];if(Z<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(ee)}else if(Z>=ee-3){e.push(1),e.push("jump-prev");for(n=ee-4;n<=ee;n++)e.push(n)}else{e.push(1),e.push("jump-prev");for(n=Z-1;n<=Z+1;n++)e.push(n);e.push("jump-next"),e.push(ee)}return e}().map(function(n){return function(n){if("number"==typeof n){var t=n===Z,o=e.jsx(f,{onClick:function(){return ne(n)},disabled:L,type:t?"primary":"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,fontWeight:t?500:400,border:t?"1px solid ".concat(_):void 0,boxShadow:"none",borderRadius:"8px"},children:n},n);return O?O(n,"page",o):o}if("jump-prev"===n)return o=e.jsx(f,{onClick:function(){return ne(Math.max(1,Z-5))},disabled:L,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),O?O(Z-5,"jump-prev",o):o;if("jump-next"===n)return o=e.jsx(f,{onClick:function(){return ne(Math.min(ee,Z+5))},disabled:L,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),O?O(Z+5,"jump-next",o):o;return null}(n)})}),s>0&&e.jsx(e.Fragment,{children:O?O(Z+1,"next",e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:L||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(k,{})})):e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:L||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(k,{})})}),v&&e.jsx(x,{value:$,options:y.map(function(e){return{label:"".concat(e," / page"),value:Number(e)}}),onChange:function(e){return n=Number(e),t=Math.ceil(s/n),o=Z>t?t:Z,void 0===c&&J(n),void 0===r&&q(o),null==F||F(o,n),void(null==S||S(o,n));var n,t,o},disabled:L,size:"small"===R?"small":"medium",style:{minWidth:"small"===R?80:96}}),j&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"Go to"}),e.jsx(h,{type:"number",min:1,value:U,onChange:function(e){return G(e.target.value)},onPressEnter:te,disabled:L,size:"small"===R?"small":"medium",style:{width:56,minWidth:56}}),e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"page"}),"object"==typeof j&&j.goButton?e.jsx(f,{onClick:te,disabled:L,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:j.goButton}):e.jsx(f,{onClick:te,disabled:L,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"OK"})]})]})]})},C=function(n){var t=n.checked,r=void 0!==t&&t,i=n.indeterminate,a=void 0!==i&&i,l=n.disabled,s=void 0!==l&&l,c=n.onChange,u=n.className,p=void 0===u?"":u,f=n.style,h=n.children,x=d().primaryColor,m=r||a,y=s?"#FAFAF9":m?x:"white",b=s?"#FAFAF9":m?x:"#D7D3D0";return e.jsxs("div",{className:"aha-checkbox ".concat(p),style:o({display:"inline-flex",alignItems:"center",gap:"8px",cursor:s?"not-allowed":"pointer"},f),onClick:function(e){s||(null==c||c({target:{checked:!r},currentTarget:{checked:!r}}))},children:[e.jsx("div",{style:{position:"relative",width:"20px",height:"20px",minWidth:"20px",minHeight:"20px",borderRadius:"4px",border:"1px solid ".concat(b),backgroundColor:y,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s",flexShrink:0,boxSizing:"border-box"},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"14px",height:"14px",opacity:m?1:0,transition:"opacity 0.2s",pointerEvents:"none"},children:a?e.jsx(v,{style:{width:"14px",height:"14px",display:"block"}}):e.jsx(g,{style:{width:"14px",height:"14px",display:"block"}})})}),h&&e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:s?"#98A2B3":"#101828",fontFamily:"DM Sans, sans-serif"},children:h}),e.jsx("input",{type:"checkbox",checked:r,ref:function(e){e&&(e.indeterminate=a)},onChange:c,disabled:s,style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"},"aria-hidden":"true"})]})};C.displayName="Checkbox";var S=function(n){var t=n.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n @keyframes aha-table-loading-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "}),e.jsxs("svg",{width:32,height:32,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"aha-table-loading-spin 1s linear infinite"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"24",opacity:.3}),e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"16"})]})]})},F=function(n){var t=n.loading,o=n.spinColor;if(!t)return null;var r=!0===t?e.jsx(S,{color:o}):t;return e.jsx("div",{role:"status","aria-live":"polite","aria-label":"Loading",className:"aha-table-loading-overlay",style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.55)",pointerEvents:"auto"},children:r})},z=function(e,n){return"string"==typeof n?null==e?void 0:e[n]:n.reduce(function(e,n){return null==e?void 0:e[n]},e)},A=function(e,n){var t,o;return"function"==typeof n?n(e):"string"==typeof n?null!==(t=z(e,n))&&void 0!==t?t:"":null!==(o=e.key)&&void 0!==o?o:""},W=function(n){var t=n.order,o=d().primaryColor;return"ascend"===t?e.jsx(b,{style:{color:o}}):"descend"===t?e.jsx(y,{style:{color:o}}):e.jsx(m,{})};exports.default=function(t){var a,l,s,c,u=t.columns,p=void 0===u?[]:u,f=t.dataSource,h=void 0===f?[]:f,x=t.rowKey,g=void 0===x?"key":x,v=t.rowSelection,m=t.pagination,y=void 0!==m&&m,b=t.size,w=void 0===b?"middle":b,k=t.bordered,S=void 0!==k&&k,L=t.loading,E=void 0!==L&&L,I=t.locale,B=t.showHeader,D=void 0===B||B,M=t.title,N=t.footer,R=t.summary,H=t.scroll,T=t.tableLayout,O=void 0===T?"auto":T,P=t.onChange,_=t.onSorterChange,K=t.onPaginationChange,X=t.onRow,q=t.className,Y=void 0===q?"":q,V=t.innerClassName,J=void 0===V?"":V,Q=t.style,U=t.expandable,G=t.rowClassName,Z=t.onHeaderRow;t.sticky;var $=r(t,["columns","dataSource","rowKey","rowSelection","pagination","size","bordered","loading","locale","showHeader","title","footer","summary","scroll","tableLayout","onChange","onSorterChange","onPaginationChange","onRow","className","innerClassName","style","expandable","rowClassName","onHeaderRow","sticky"]),ee=d().primaryColor||"#FB6011",ne=n.useState((null==v?void 0:v.selectedRowKeys)||(null==v?void 0:v.defaultSelectedRowKeys)||[]),te=ne[0],oe=ne[1];n.useEffect(function(){void 0!==(null==v?void 0:v.selectedRowKeys)&&oe(v.selectedRowKeys)},[null==v?void 0:v.selectedRowKeys]);var re=n.useState(new Map),ie=re[0],ae=re[1],le=n.useState((null==U?void 0:U.defaultExpandedRowKeys)||[]),de=le[0],se=le[1],ce=n.useState(y&&"object"==typeof y&&(y.current||y.defaultCurrent)||1),ue=ce[0],pe=ce[1],fe=n.useState(y&&"object"==typeof y&&(y.pageSize||y.defaultPageSize)||10),he=fe[0],xe=fe[1];n.useEffect(function(){y&&"object"==typeof y&&(void 0!==y.current&&pe(y.current),void 0!==y.pageSize&&xe(y.pageSize))},[y]);var ge=n.useState(null),ve=ge[0],me=ge[1],ye=n.useState(null),be=ye[0],we=ye[1],ke=n.useState(!1),je=ke[0],Ce=ke[1],Se=n.useRef(null),Fe=n.useRef(null);n.useEffect(function(){var e=function(){Ce(window.innerWidth<768)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var ze=n.useCallback(function(e,n){var t,o,r,a=null===(t=null==v?void 0:v.getCheckboxProps)||void 0===t?void 0:t.call(v,e);if(!(null==a?void 0:a.disabled)){var l,d=A(e,g);l="radio"===(null==v?void 0:v.type)?n?[d]:[]:n?i(i([],te,!0),[d],!1):te.filter(function(e){return e!==d}),oe(l);var s=h.filter(function(e){return l.includes(A(e,g))});null===(o=null==v?void 0:v.onChange)||void 0===o||o.call(v,l,s),null===(r=null==v?void 0:v.onSelect)||void 0===r||r.call(v,e,n,s,new Event("select"))}},[te,g,v,h]),Ae=n.useCallback(function(e,n){var t,o,r=n.filter(function(e){var n;return!(null===(n=null==v?void 0:v.getCheckboxProps)||void 0===n?void 0:n.call(v,e).disabled)}).map(function(e){return A(e,g)}),i=e?r:[];oe(i);var a=h.filter(function(e){return i.includes(A(e,g))}),l=e?n.filter(function(e){var n;return!(null===(n=null==v?void 0:v.getCheckboxProps)||void 0===n?void 0:n.call(v,e).disabled)}):[];null===(t=null==v?void 0:v.onChange)||void 0===t||t.call(v,i,a),null===(o=null==v?void 0:v.onSelectAll)||void 0===o||o.call(v,e,a,l)},[g,v,h]),We=n.useCallback(function(e,n){var t=e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex);if(t){var o=new Map(ie);null===n?o.delete(t):o.set(t,n),ae(o);var r=Array.from(o.entries()).map(function(n){var t=n[0],o=n[1];return{column:p.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t})||e,order:o,field:t,columnKey:t}}),i={column:e,order:n,field:t,columnKey:t};e.onSorterChange&&e.onSorterChange(i),_&&_(1===r.length?r[0]:r),P&&P({current:ue,pageSize:he},{},1===r.length?r[0]:r,{currentDataSource:h,action:"sort"})}},[ie,P,_,ue,he,h,p]);n.useCallback(function(e,n){var t,o,r,a=A(e,g);r=n?i(i([],de,!0),[a],!1):de.filter(function(e){return e!==a}),se(r),null===(t=null==U?void 0:U.onExpand)||void 0===t||t.call(U,n,e),null===(o=null==U?void 0:U.onExpandedRowsChange)||void 0===o||o.call(U,r)},[de,g,U]);var Le,Ee=n.useCallback(function(){var e=i([],h,!0);return ie.size>0&&e.sort(function(e,n){for(var t=function(t,o){var r=p.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t});if(!r)return"continue";var i=0;if("function"==typeof r.sorter)i=r.sorter(e,n);else if(!0===r.sorter){var a=z(e,r.dataIndex||t),l=z(n,r.dataIndex||t);a<l?i=-1:a>l&&(i=1)}return 0!==i?{value:"ascend"===o?i:-i}:void 0},o=0,r=Array.from(ie.entries());o<r.length;o++){var i=r[o],a=t(i[0],i[1]);if("object"==typeof a)return a.value}return 0}),e},[h,ie,p]),Ie=Ee(),Be=Boolean(y&&"object"==typeof y&&void 0!==y.total),De=n.useMemo(function(){if(!1===y||!y)return Ie;if(Be)return Ie;var e=(ue-1)*he,n=e+he;return Ie.slice(e,n)},[Ie,ue,he,y,Be]),Me=n.useCallback(function(e,n){var t,o,r=null!=n?n:he;if(pe(e),n&&xe(n),K&&K(e,r),y&&"object"==typeof y&&(null===(t=y.onChange)||void 0===t||t.call(y,e,n),n&&(null===(o=y.onShowSizeChange)||void 0===o||o.call(y,e,n))),P){var i=Array.from(ie.entries()).map(function(e){var n=e[0],t=e[1];return{column:p.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===n}),order:t,field:n,columnKey:n}});P({current:e,pageSize:r},{},1===i.length?i[0]:i,{currentDataSource:Ie,action:"paginate"})}},[y,K,P,he,ie,p,Ie]),Ne=n.useCallback(function(e,n,t){var o=z(n,e.dataIndex||"");return e.render?e.render(o,n,t):o},[]),Re=n.useCallback(function(e,n,t){if(n){var o=!0===n?"left":n,r=0;if("left"===o){if(v&&("left"===v.fixed||!0===v.fixed))r+="number"==typeof v.columnWidth?v.columnWidth:"string"==typeof v.columnWidth?parseInt(v.columnWidth):60;for(var i=0;i<e;i++){if("left"===(a=p[i]).fixed||!0===a.fixed)r+=a.width?"number"==typeof a.width?a.width:parseInt(a.width)||0:150}return r}if("right"===o){for(i=e+1;i<p.length;i++){var a;if("right"===(a=p[i]).fixed)r+=a.width?"number"==typeof a.width?a.width:parseInt(a.width)||0:150}if(v&&"right"===v.fixed)r+="number"==typeof v.columnWidth?v.columnWidth:"string"==typeof v.columnWidth?parseInt(v.columnWidth):60;return r}}},[p,v]),He=n.useCallback(function(){if(!D)return null;var n,t,r,i,a=p.map(function(n,t){var r,i=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||t,a=ie.get(i)||null,l=Re(t,n.fixed,!0),d=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("th",o({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:{width:d,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:d||void 0,maxWidth:d,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==l?"".concat(l,"px"):"0":void 0,right:"right"===n.fixed?void 0!==l?"".concat(l,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:(n.fixed,"#F9FAFB"),boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"12px 16px",textAlign:n.align||"left",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif"}},(null===(r=n.onHeaderCell)||void 0===r?void 0:r.call(n,n))||{},{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",justifyContent:"right"===n.align?"flex-end":"center"===n.align?"center":"flex-start"},children:[e.jsx("span",{style:{fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467"},children:"function"==typeof n.title?n.title({sortOrder:a,sortColumn:n}):n.title}),n.sorter&&e.jsx("button",{onClick:function(){We(n,null===a?"ascend":"ascend"===a?"descend":null)},style:{border:"none",background:"none",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px",color:a?"#475467":"#98A2B3"},children:e.jsx(W,{order:a||void 0})})]})}),i)});if(v){var l="number"==typeof v.columnWidth?"".concat(v.columnWidth,"px"):"string"==typeof v.columnWidth?v.columnWidth:"60px",d=e.jsx("th",{style:{width:l,position:v.fixed?"sticky":"relative",left:"left"===v.fixed||!0===v.fixed?"0px":void 0,right:"right"===v.fixed?"0px":void 0,zIndex:v.fixed?"left"===v.fixed||!0===v.fixed?12:11:1,backgroundColor:"#F9FAFB",padding:"12px 16px",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif",textAlign:"center"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[!v.hideSelectAll&&"radio"!==v.type&&(n=De.filter(function(e){var n;return!(null===(n=v.getCheckboxProps)||void 0===n?void 0:n.call(v,e).disabled)}),t=n.map(function(e){return A(e,g)}),r=n.length>0&&t.every(function(e){return te.includes(e)}),i=t.some(function(e){return te.includes(e)}),e.jsx(C,{checked:r,indeterminate:i&&!r,onChange:function(e){return Ae(e.target.checked,De)}})),v.columnTitle&&e.jsx("span",{style:{marginLeft:v.hideSelectAll?0:"8px"},children:v.columnTitle})]})},"selection");a.unshift(d)}var s=null==Z?void 0:Z(p,0);return e.jsx("thead",{ref:Fe,children:e.jsx("tr",o({},s||{},{children:a}))})},[p,D,ie,v,te,De,g,We,Ae,I,Z,Re]),Te=n.useCallback(function(e){me(e)},[]),Oe=n.useCallback(function(e,n){e.preventDefault(),we(n)},[]),Pe=n.useCallback(function(e,n){if(e.preventDefault(),null===ve||ve===n)return me(null),void we(null);var t=i([],De,!0),o=t[ve];t.splice(ve,1),t.splice(n,0,o),me(null),we(null)},[ve,De]),_e=n.useCallback(function(){me(null),we(null)},[]),Ke=n.useCallback(function(){var n=null==I?void 0:I.emptyText,t="function"==typeof n?n():void 0!==n?n:"No data",o=p.length+(v?1:0);return e.jsx("tr",{className:"aha-table-placeholder",children:e.jsx("td",{colSpan:o,style:{padding:"48px 16px",textAlign:"center",color:"#98A2B3",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif",borderBottom:"none",backgroundColor:"white"},children:t})})},[null==I?void 0:I.emptyText,p.length,v]),Xe=n.useCallback(function(){return 0===De.length?Ke():De.map(function(t,r){var i,a=A(t,g),l=te.includes(a),d=de.includes(a),s=(null==X?void 0:X(t,r))||{},c=r===De.length-1;return e.jsxs(n.Fragment,{children:[e.jsxs("tr",o({className:"".concat("function"==typeof G?G(t,r):G||""," ").concat(ve===r?"dragging":""," ").concat(be===r?"drag-over":""),draggable:!0,onDragStart:function(){return Te(r)},onDragOver:function(e){return Oe(e,r)},onDrop:function(e){return Pe(e,r)},onDragEnd:_e,style:o({cursor:"move",opacity:ve===r?.5:1,backgroundColor:be===r?"#F9FAFB":"white",transition:"background-color 0.2s"},s.style),onMouseEnter:function(e){ve!==r&&be!==r&&(e.currentTarget.style.backgroundColor="#F9FAFB")},onMouseLeave:function(e){ve!==r&&be!==r&&(e.currentTarget.style.backgroundColor="white")}},s,{children:[v&&e.jsx("td",{style:{width:"number"==typeof v.columnWidth?"".concat(v.columnWidth,"px"):"string"==typeof v.columnWidth?v.columnWidth:"60px",position:v.fixed?"sticky":"relative",left:"left"===v.fixed||!0===v.fixed?"0px":void 0,right:"right"===v.fixed?"0px":void 0,zIndex:v.fixed?"left"===v.fixed||!0===v.fixed?12:11:1,backgroundColor:"white",padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",textAlign:"center"},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(C,{checked:l,onChange:function(e){return ze(t,e.target.checked)},disabled:null===(i=v.getCheckboxProps)||void 0===i?void 0:i.call(v,t).disabled})})}),p.map(function(n,i){var a,l=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||i,d=(null===(a=n.onCell)||void 0===a?void 0:a.call(n,t,r))||{},s=Re(i,n.fixed,!1),u=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("td",o({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:o({width:u,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:u||void 0,maxWidth:u,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,right:"right"===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:"white",boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",fontSize:"14px",lineHeight:"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",textAlign:n.align||"left"},d.style),colSpan:n.colSpan,rowSpan:n.rowSpan},d,{children:Ne(n,t,r)}),l)})]})),(null==U?void 0:U.expandedRowRender)&&d&&e.jsx("tr",{children:e.jsx("td",{colSpan:p.length+(v?1:0),children:U.expandedRowRender(t,r,0,!0)})})]},a)})},[De,g,te,de,v,p,X,G,ze,Ne,U,ve,be,Te,Oe,Pe,_e,Re,Ke]),qe=function(){var n;if(!1===y||!y)return null;var t=null!==(n=y.total)&&void 0!==n?n:Ie.length,o=y.position||"bottomRight";return e.jsx("div",{style:{marginTop:"16px",display:"flex",justifyContent:o.includes("Right")?"flex-end":o.includes("Left")?"flex-start":"center"},children:e.jsx(j,{current:ue,total:t,pageSize:he,showSizeChanger:y.showSizeChanger,pageSizeOptions:y.pageSizeOptions,showQuickJumper:y.showQuickJumper,showTotal:y.showTotal,onChange:Me,onShowSizeChange:Me,simple:y.simple,responsive:y.responsive,size:"small"===w?"small":"default"})})},Ye=n.useMemo(function(){return p.some(function(e){return e.fixed})||v&&v.fixed},[p,v]),Ve=n.useMemo(function(){return p.every(function(e){return e.width})&&(!v||v.columnWidth)},[p,v]),Je=n.useMemo(function(){if(null==H?void 0:H.x){if("number"==typeof H.x)return H.x;if(!0===H.x)return p.reduce(function(e,n){return e+(n.width?"number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0:150)},0)+(v?"number"==typeof v.columnWidth?v.columnWidth:parseInt(String(v.columnWidth||"60").replace("px",""))||60:0)}if(Ye)return p.reduce(function(e,n){return n.fixed&&n.width?e+("number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0):e},0)+(v&&v.fixed&&v.columnWidth?"number"==typeof v.columnWidth?v.columnWidth:parseInt(String(v.columnWidth).replace("px",""))||60:0)},[p,null==H?void 0:H.x,v,Ye]),Qe=n.useMemo(function(){return"fixed"===O||Ye||Ve||p.some(function(e){return e.width})?"fixed":O},[O,Ye,Ve,p]),Ue=o(o({width:"100%",minWidth:Je?"".concat(Je,"px"):"100%",borderCollapse:"separate",borderSpacing:0,tableLayout:Qe,backgroundColor:"white"},S&&{borderRadius:"8px",border:"1px solid #EAECF0"}),{overflow:"hidden"}),Ge=o({position:"relative",width:"100%",maxWidth:"100%",maxHeight:"number"==typeof(null==H?void 0:H.y)?"".concat(H.y,"px"):void 0,borderRadius:"8px"},Q);if(je)return e.jsxs("div",o({ref:Se,className:"aha-table aha-table-mobile-wrapper ".concat(Y),style:Ge,"aria-busy":!!E||void 0},$,{children:[M&&e.jsx("div",{style:{marginBottom:"16px"},children:M(Ie)}),y&&"object"==typeof y&&(null===(a=y.position)||void 0===a?void 0:a.startsWith("top"))&&qe(),(Le="function"==typeof(null==I?void 0:I.emptyText)?I.emptyText():void 0!==(null==I?void 0:I.emptyText)?I.emptyText:"No data",0===De.length?e.jsx("div",{className:"aha-table-mobile aha-table-placeholder",style:{padding:"48px 16px",textAlign:"center",color:"#98A2B3",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif"},children:Le}):e.jsx("div",{className:"aha-table-mobile",children:De.map(function(n,t){var o,r=A(n,g),i=te.includes(r);return e.jsxs("div",{className:"aha-table-mobile-row ".concat(i?"selected":""),style:{border:"1px solid #e8e8e8",borderRadius:"4px",padding:"12px",marginBottom:"12px",backgroundColor:i?"#e6f7ff":"white"},children:[v&&e.jsx("div",{style:{marginBottom:"8px"},children:e.jsx(C,{checked:i,onChange:function(e){return ze(n,e.target.checked)},disabled:null===(o=v.getCheckboxProps)||void 0===o?void 0:o.call(v,n).disabled})}),p.map(function(o){var r=o.key||(Array.isArray(o.dataIndex)?o.dataIndex.join("."):o.dataIndex),i=z(n,o.dataIndex||""),a=o.render?o.render(i,n,t):i;return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px",paddingBottom:"8px",borderBottom:"1px solid #f0f0f0"},children:[e.jsxs("span",{style:{fontWeight:"bold",color:"#666"},children:["function"==typeof o.title?o.title({}):o.title,":"]}),e.jsx("span",{style:{flex:1,textAlign:"right"},children:a})]},r)})]},r)})})),N&&e.jsx("div",{style:{marginTop:"16px"},children:N(Ie)}),y&&("object"!=typeof y||!(null===(l=y.position)||void 0===l?void 0:l.startsWith("top")))&&qe(),e.jsx(F,{loading:E,spinColor:ee})]}));var Ze={position:"relative",overflowX:(null==H?void 0:H.x)||Ye?"auto":"visible",overflowY:(null==H?void 0:H.y)?"auto":"visible",width:"100%",maxWidth:!0===(null==H?void 0:H.x)?"100%":"number"==typeof(null==H?void 0:H.x)?"".concat(H.x,"px"):void 0,maxHeight:"number"==typeof(null==H?void 0:H.y)?"".concat(H.y,"px"):void 0,borderRadius:"8px"};return e.jsxs("div",o({ref:Se,className:"aha-table ".concat(Y),style:Ge,"aria-busy":!!E||void 0},$,{children:[M&&e.jsx("div",{style:{marginBottom:"16px"},children:M(Ie)}),y&&"object"==typeof y&&(null===(s=y.position)||void 0===s?void 0:s.startsWith("top"))&&qe(),e.jsx("div",{style:Ze,children:e.jsx("div",{style:{width:"100%",minWidth:Je?"".concat(Je,"px"):"100%",display:"block"},children:e.jsxs("table",{style:Ue,className:J,children:[He(),e.jsx("tbody",{children:Xe()}),R&&e.jsx("tfoot",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:p.length+(v?1:0),children:R(Ie)})})})]})})}),N&&e.jsx("div",{style:{marginTop:"16px"},children:N(Ie)}),y&&("object"!=typeof y||!(null===(c=y.position)||void 0===c?void 0:c.startsWith("top")))&&qe(),e.jsx(F,{loading:E,spinColor:ee})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("react-dom"),o=function(){return o=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},o.apply(this,arguments)};function r(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}function i(e,n,t){if(t||2===arguments.length)for(var o,r=0,i=n.length;r<i;r++)!o&&r in n||(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return e.concat(o||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var a={primaryColor:"#FB6011"},l=n.createContext(a),d=function(){var e=n.useContext(l);return e||a},s={sm:"sm",md:"md",lg:"lg",xl:"xl",small:"sm",mediumSmall:"sm",medium:"md",large:"xl"},c={primary:"primary",secondary:"secondary",tertiary:"tertiary","link-color":"link-color","link-gray":"link-gray","destructive-primary":"destructive-primary","destructive-secondary":"destructive-secondary","destructive-tertiary":"destructive-tertiary","destructive-link":"destructive-link",default:"secondary"},u={sm:{height:36,paddingX:12,paddingXLg:12,fontSize:14,lineHeight:20,iconSize:20,gap:4,iconOnlyPad:8},md:{height:40,paddingX:14,paddingXLg:14,fontSize:14,lineHeight:20,iconSize:20,gap:4,iconOnlyPad:10},lg:{height:44,paddingX:16,paddingXLg:16,fontSize:16,lineHeight:24,iconSize:20,gap:6,iconOnlyPad:12},xl:{height:48,paddingX:18,paddingXLg:18,fontSize:16,lineHeight:24,iconSize:20,gap:6,iconOnlyPad:14}},p=function(n){var t=n.size,o=n.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"@keyframes aha-button-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}"}),e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"aha-button-spin 1s linear infinite",flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:o,strokeWidth:"2",opacity:"0.25"}),e.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",stroke:o,strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})]})},f=function(t){var i=t.children,a=t.type,l=void 0===a?"secondary":a,f=t.size,x=void 0===f?"md":f,h=t.disabled,v=void 0!==h&&h,g=t.loading,m=void 0!==g&&g,y=t.iconOnly,b=t.focused,w=void 0!==b&&b,k=t.onClick,j=t.htmlType,C=void 0===j?"button":j,S=t.className,F=void 0===S?"":S,z=t.style,A=t.icon,W=t.iconPosition,L=void 0===W?"left":W,E=r(t,["children","type","size","disabled","loading","iconOnly","focused","onClick","htmlType","className","style","icon","iconPosition"]),I=d().primaryColor,M=n.useState(!1),B=M[0],D=M[1],N=n.useState(!1),R=N[0],H=N[1],T=c[l]||"secondary",O=u[s[x]||"md"],P=null!=y?y:!!A&&null==i,_="link-color"===T||"link-gray"===T||"destructive-link"===T,K=v||m,X=w,q=I,Y=function(){if(v)return"primary"===T||"secondary"===T||"destructive-primary"===T||"destructive-secondary"===T?{bg:"var(--color-bg-disabled, #f5f5f4)",color:"var(--color-fg-disabled, #a9a29d)",iconColor:"var(--color-fg-disabled, #a9a29d)",border:"1px solid var(--color-border-disabled_subtle, #e7e5e4)",boxShadow:"none"}:{bg:"transparent",color:"var(--color-fg-disabled, #a9a29d)",iconColor:"var(--color-fg-disabled, #a9a29d)",border:"none",boxShadow:"none"};var e=B||R;return"primary"===T?{bg:e?"var(--color-bg-brand-solid_hover, #ec470a)":q||"var(--color-bg-brand-solid, #fb6011)",color:"var(--color-text-white, #ffffff)",iconColor:"var(--color-brand-300, #feb073)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic, 0 1px 2px 0 rgba(10,13,18,.05))"}:"secondary"===T?{bg:e?"var(--color-bg-primary_hover, #fafaf9)":"var(--color-bg-primary, #ffffff)",color:e?"var(--color-text-secondary_hover, #292524)":"var(--color-text-secondary, #44403c)",iconColor:e?"var(--color-fg-quaternary_hover, #79716b)":"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic)"}:"tertiary"===T?{bg:e?"var(--color-bg-primary_hover, #fafaf9)":"transparent",color:e?"var(--color-text-tertiary_hover, #44403c)":"var(--color-text-tertiary, #57534e)",iconColor:e?"var(--color-fg-quaternary_hover, #79716b)":"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"none"}:"link-color"===T?{bg:"transparent",color:e?"var(--color-text-brand-secondary_hover, #c4330a)":"var(--color-text-brand-secondary, #ec470a)",iconColor:"var(--color-fg-brand-secondary_alt, #fb6011)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}:"link-gray"===T?{bg:"transparent",color:e?"var(--color-text-tertiary_hover, #44403c)":"var(--color-text-tertiary, #57534e)",iconColor:"var(--color-fg-quaternary, #a9a29d)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}:"destructive-primary"===T?{bg:e?"var(--color-error-600)":"var(--color-error-500)",color:"var(--color-text-white)",iconColor:e?"var(--color-error-200)":"var(--color-error-300)",border:"none",boxShadow:"var(--shadow-xs-skeuomorphic)"}:"destructive-secondary"===T?{bg:e?"var(--color-bg-error-primary)":"var(--color-bg-primary)",color:"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"inset 0 0 0 1px var(--color-border-error_subtle), inset 0 -2px 0 0 rgba(10,13,18,0.05), 0 1px 2px 0 rgba(10,13,18,0.05)"}:"destructive-tertiary"===T?{bg:e?"var(--color-bg-error-primary)":"transparent",color:"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"none"}:{bg:"transparent",color:e?"var(--color-text-error-primary_hover)":"var(--color-text-error-primary)",iconColor:"var(--color-fg-error-secondary)",border:"none",boxShadow:"none",textDecoration:e?"underline":"none"}}(),V=function(){if(X)return"destructive-primary"===T||"destructive-secondary"===T||"destructive-tertiary"===T||"destructive-link"===T?"destructive-primary"===T||"destructive-secondary"===T?"var(--focus-ring-error-shadow-xs-skeuomorphic)":"var(--focus-ring-error)":"primary"===T||"secondary"===T?"var(--focus-ring-shadow-xs-skeuomorphic, 0 0 0 2px #fff, 0 0 0 4px #fb6011)":"var(--focus-ring, 0 0 0 2px #fff, 0 0 0 4px #fb6011)"}(),J=o({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:O.gap,fontFamily:'var(--font-family-body, "DM Sans", system-ui, sans-serif)',fontWeight:600,fontSize:O.fontSize,lineHeight:"".concat(O.lineHeight,"px"),cursor:K?"not-allowed":"pointer",outline:"none",transition:"background-color .15s ease, color .15s ease, box-shadow .15s ease",userSelect:"none",WebkitTapHighlightColor:"transparent",whiteSpace:"nowrap",backgroundColor:Y.bg,color:Y.color,border:Y.border,boxShadow:null!=V?V:Y.boxShadow,textDecoration:Y.textDecoration},z);_?(J.borderRadius="4px",J.overflow="hidden",P?(J.width=O.height,J.height=O.height,J.padding=0):(J.height=O.height,J.paddingLeft=O.paddingX,J.paddingRight=O.paddingX)):(J.borderRadius="var(--radius-md, 8px)",P?(J.width=O.height,J.height=O.height,J.padding=0):(J.height=O.height,J.paddingLeft=O.paddingX,J.paddingRight=O.paddingX));var Q=function(){return m?e.jsx(p,{size:O.iconSize,color:Y.iconColor}):A?e.jsx("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:O.iconSize,height:O.iconSize,color:Y.iconColor,flexShrink:0},children:A}):null},U=m||A&&"left"===L,G=!m&&A&&"right"===L;return e.jsxs("button",o({type:C,className:["aha-button","aha-button--".concat(T),"aha-button--".concat(s[x]||"md"),P&&"aha-button--icon-only",K&&"aha-button--disabled",m&&"aha-button--loading",X&&"aha-button--focused",F].filter(Boolean).join(" "),disabled:K,onClick:function(e){K?e.preventDefault():null==k||k(e)},onMouseEnter:function(){return!K&&D(!0)},onMouseLeave:function(){D(!1),H(!1)},onMouseDown:function(){return!K&&H(!0)},onMouseUp:function(){return H(!1)},style:J},E,{children:[U&&Q(),!P&&i,G&&Q(),P&&!A&&!m&&i]}))};f.displayName="Button";var x=n.forwardRef(function(t,i){var a=t.size,l=void 0===a?"medium":a,s=t.disabled,c=void 0!==s&&s,u=t.error,p=void 0!==u&&u,f=t.readOnly,x=void 0!==f&&f,h=t.prefix,v=t.suffix,g=t.allowClear,m=void 0!==g&&g,y=t.onClear,b=t.className,w=void 0===b?"":b,k=t.style,j=t.type,C=void 0===j?"text":j,S=t.placeholder,F=t.value,z=t.defaultValue,A=t.onChange,W=t.onFocus,L=t.onBlur,E=t.onPressEnter,I=r(t,["size","disabled","error","readOnly","prefix","suffix","allowClear","onClear","className","style","type","placeholder","value","defaultValue","onChange","onFocus","onBlur","onPressEnter"]),M=d().primaryColor,B=void 0===M?"#FB6011":M,D=n.useRef(null),N=n.useState(z||F||""),R=N[0],H=N[1],T=n.useState(!1),O=T[0],P=T[1];n.useEffect(function(){"function"==typeof i?i(D.current):i&&(i.current=D.current)},[i]);var _=void 0!==F,K=_?F:R,X=function(e){var n;e.stopPropagation(),_||H("");null==A||A({target:{value:""},currentTarget:{value:""}}),null==y||y(),null===(n=D.current)||void 0===n||n.focus()},q=m&&K&&!c,Y={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px"}},V=v||q?"40px":"12px",J=o({width:"100%",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(p?"#F04438":O?B:"#D7D3D0"),backgroundColor:c||x?"#FAFAF9":"#FFFFFF",color:c?"#98A2B3":"#1C1917",fontSize:"16px",fontWeight:400,lineHeight:"24px",paddingLeft:h?"40px":"12px",paddingRight:V,paddingTop:Y[l].paddingTop,paddingBottom:Y[l].paddingBottom,transition:"all 0.2s",outline:"none",WebkitAppearance:"none",MozAppearance:"textfield",appearance:"none"},k);return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:'\n .aha-input-wrapper input::placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-webkit-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input::-moz-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n .aha-input-wrapper input:-ms-input-placeholder {\n color: #D7D3D0;\n font-size: 16px;\n font-weight: 400;\n opacity: 1;\n }\n /* 移动端优化 */\n .aha-input-wrapper input {\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n touch-action: manipulation;\n }\n /* 移除数字输入框的上下箭头 */\n .aha-input-wrapper input[type="number"]::-webkit-inner-spin-button,\n .aha-input-wrapper input[type="number"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n .aha-input-wrapper input[type="number"] {\n -moz-appearance: textfield;\n }\n '}),e.jsxs("div",{className:"aha-input-wrapper ".concat(w),style:{position:"relative",display:"inline-flex",alignItems:"center",width:"100%"},children:[h&&e.jsx("span",{style:{position:"absolute",left:"12px",display:"flex",alignItems:"center",color:c?"#98A2B3":"#78716C",zIndex:1,pointerEvents:"none"},children:h}),e.jsx("input",o({ref:D,type:C,value:K,placeholder:S,disabled:c,readOnly:x,onChange:function(e){_||H(e.target.value),null==A||A(e)},onFocus:function(e){P(!0),null==W||W(e)},onBlur:function(e){P(!1),null==L||L(e)},onKeyDown:function(e){var n;"Enter"===e.key&&E&&E(e),null===(n=I.onKeyDown)||void 0===n||n.call(I,e)},style:J,autoComplete:I.autoComplete||"off",autoCorrect:I.autoCorrect||"off",autoCapitalize:I.autoCapitalize||"off",spellCheck:I.spellCheck||!1},I)),(v||q)&&e.jsxs("span",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px",color:c?"#98A2B3":"#78716C",zIndex:1},children:[q&&e.jsx(function(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:X,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),v&&e.jsx("span",{style:{pointerEvents:"none"},children:v})]})]})]})});x.displayName="Input";var h=function(r){var a,l=r.value,s=r.defaultValue,c=r.options,u=void 0===c?[]:c,p=r.mode,f=r.disabled,x=void 0!==f&&f,h=r.error,v=void 0!==h&&h,g=r.placeholder,m=void 0===g?"Please select":g,y=r.size,b=void 0===y?"medium":y,w=r.showSearch,k=void 0!==w&&w,j=r.filterOption,C=void 0===j||j,S=r.allowClear,F=void 0!==S&&S,z=r.onChange,A=r.onSelect,W=r.onDeselect,L=r.onSearch,E=r.onFocus,I=r.onBlur,M=r.onDropdownVisibleChange,B=r.className,D=void 0===B?"":B,N=r.style,R=r.dropdownClassName,H=void 0===R?"":R,T=r.dropdownStyle,O=r.defaultOpen,P=void 0!==O&&O,_=r.open,K=r.maxTagCount,X=r.tagRender,q=r.optionRender,Y=d().primaryColor,V=void 0===Y?"#FB6011":Y,J=n.useState(void 0!==s?s:p?[]:void 0),Q=J[0],U=J[1],G=n.useState(P),Z=G[0],$=G[1],ee=n.useState(""),ne=ee[0],te=ee[1],oe=n.useState(-1),re=oe[0],ie=oe[1],ae=n.useRef(null),le=n.useRef(null),de=n.useRef(null),se=n.useState(null),ce=se[0],ue=se[1],pe=void 0!==l,fe=void 0!==_,xe=pe?l:Q,he=fe?_:Z,ve="multiple"===p||"tags"===p,ge=n.useCallback(function(){if(!xe)return[];var e=Array.isArray(xe)?xe:[xe];return u.filter(function(n){return e.includes(n.value)})},[xe,u]),me=n.useCallback(function(){return k&&ne?!1===C?u:"function"==typeof C?u.filter(function(e){return C(ne,e)}):u.filter(function(e){var n=String(e.label||"").toLowerCase(),t=ne.toLowerCase();return n.includes(t)}):u},[u,ne,k,C]),ye=n.useMemo(function(){return me()},[me]);n.useEffect(function(){if(he&&ae.current){var e=function(){var e,n;if(ae.current){var t=ae.current.getBoundingClientRect(),o=null!==(n=null===(e=de.current)||void 0===e?void 0:e.offsetHeight)&&void 0!==n?n:Math.min(256,Math.max(40,40*ye.length)),r=window.innerHeight-t.bottom,i=t.top,a=r<o+4&&i>r,l=a?t.top+window.scrollY-o-4:t.bottom+window.scrollY+4;ue({top:l,left:t.left+window.scrollX,width:t.width,placement:a?"top":"bottom"})}};return e(),requestAnimationFrame(e),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}}ue(null)},[he,ye.length]),n.useEffect(function(){var e=function(e){var n=e.target;ae.current&&!ae.current.contains(n)&&de.current&&!de.current.contains(n)&&(fe||$(!1),null==M||M(!1),te(""))};if(he)return document.addEventListener("mousedown",e,!0),document.addEventListener("touchstart",e,!0),function(){document.removeEventListener("mousedown",e,!0),document.removeEventListener("touchstart",e,!0)}},[he,fe,M]),n.useEffect(function(){if(he){var e=function(e){var n;if("ArrowDown"===e.key)e.preventDefault(),ie(function(e){return e<ye.length-1?e+1:e});else if("ArrowUp"===e.key)e.preventDefault(),ie(function(e){return e>0?e-1:0});else if("Enter"===e.key&&re>=0){e.preventDefault();var t=ye[re];t&&!t.disabled&&be(t)}else"Escape"===e.key&&(e.preventDefault(),fe||$(!1),null==M||M(!1),null===(n=ae.current)||void 0===n||n.focus())};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}},[he,ye,re,fe,M]),n.useEffect(function(){if(re>=0&&de.current){var e=de.current.querySelectorAll(".aha-select-option")[re];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[re]);var be=n.useCallback(function(e){var n;if(!e.disabled)if(ve){var t,o=Array.isArray(xe)?xe:[];o.includes(e.value)?(t=o.filter(function(n){return n!==e.value}),null==W||W(e.value,e)):(t=i(i([],o,!0),[e.value],!1),null==A||A(e.value,e)),pe||U(t);var r=u.filter(function(e){return t.includes(e.value)});null==z||z(t,r)}else pe||U(e.value),null==z||z(e.value,e),null==A||A(e.value,e),fe||$(!1),null==M||M(!1),te(""),null===(n=ae.current)||void 0===n||n.focus()},[ve,xe,pe,fe,u,z,A,W,M]),we=n.useCallback(function(e,n){if(e.stopPropagation(),ve&&Array.isArray(xe)){var t=xe.filter(function(e){return e!==n}),o=u.find(function(e){return e.value===n});pe||U(t),null==z||z(t,ge()),null==W||W(n,o)}},[ve,xe,pe,u,z,W,ge]),ke=function(e){e.stopPropagation();var n=ve?[]:void 0;pe||U(n),null==z||z(n,[]),te("")},je={small:{height:"32px",paddingTop:"3px",paddingBottom:"3px",fontSize:"16px",lineHeight:"24px"},mediumSmall:{height:"36px",paddingTop:"5px",paddingBottom:"5px",fontSize:"16px",lineHeight:"24px"},medium:{height:"40px",paddingTop:"7px",paddingBottom:"7px",fontSize:"16px",lineHeight:"24px"},large:{height:"48px",paddingTop:"11px",paddingBottom:"11px",fontSize:"16px",lineHeight:"24px"}},Ce=n.useMemo(function(){return ge()},[ge]),Se=n.useMemo(function(){return F&&xe&&!x},[F,xe,x]),Fe=n.useMemo(function(){return ve?Array.isArray(xe)&&xe.length>0:null!=xe&&""!==xe},[ve,xe]),ze=n.useMemo(function(){if(!ve||!Array.isArray(xe)||0===xe.length)return null;var t="responsive"===K?Ce.slice(0,2):K?Ce.slice(0,K):Ce,o=K&&Ce.length>t.length?Ce.length-t.length:0;return e.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",flex:1,minWidth:0},children:[t.map(function(t){var o={label:t.label,value:t.value,closable:!x,onClose:function(){return we({},t.value)}};return X?e.jsx(n.Fragment,{children:X(o)},t.value):e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",backgroundColor:"#F5F5F4",borderRadius:"4px",fontSize:"12px",lineHeight:"18px",color:"#101828",fontFamily:"DM Sans, sans-serif",maxWidth:"100%"},children:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.label}),!x&&e.jsx("span",{onClick:function(e){return we(e,t.value)},style:{cursor:"pointer",display:"flex",alignItems:"center",color:"#78716C",marginLeft:"4px"},children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]},t.value)}),o>0&&e.jsxs("span",{style:{fontSize:"12px",lineHeight:"18px",color:"#78716C",fontFamily:"DM Sans, sans-serif"},children:["+",o]})]})},[ve,xe,Ce,K,x,X]);return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n @keyframes dropdownFadeIn {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n "}),e.jsxs("div",{ref:ae,className:"aha-select ".concat(D),style:o({position:"relative",display:"inline-flex",alignItems:"center",width:"100%",minWidth:"120px",boxSizing:"border-box",fontFamily:"DM Sans, sans-serif",borderRadius:"8px",border:"1px solid ".concat(v?"#F04438":he?V:"#D7D3D0"),backgroundColor:x?"#FAFAF9":"#FFFFFF",cursor:x?"not-allowed":"pointer",transition:"all 0.2s",paddingLeft:"12px",paddingRight:"36px",paddingTop:je[b].paddingTop,paddingBottom:je[b].paddingBottom,fontSize:je[b].fontSize,lineHeight:je[b].lineHeight,fontWeight:400,WebkitTapHighlightColor:"transparent",WebkitTouchCallout:"none",touchAction:"manipulation",userSelect:"none"},N),onClick:function(){if(!x){var e=!he;fe||$(e),null==M||M(e),e&&k?setTimeout(function(){var e;null===(e=le.current)||void 0===e||e.focus()},0):te("")}},onFocus:function(e){null==E||E(e)},onBlur:function(e){null==I||I(e)},onTouchStart:function(e){x||(e.currentTarget.style.opacity="0.8")},onTouchEnd:function(e){e.currentTarget.style.opacity="1"},tabIndex:x?-1:0,children:[e.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,minWidth:0,gap:"8px"},children:ve?ze||(m?e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400},children:m}):e.jsx("span",{style:{flex:1,minHeight:"24px"}})):k&&he?e.jsx("input",{ref:le,type:"text",value:ne,onChange:function(e){var n=e.target.value;te(n),null==L||L(n),ie(-1)},onClick:function(e){return e.stopPropagation()},onFocus:function(e){return e.stopPropagation()},style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:"16px",lineHeight:"24px",fontWeight:400,color:x?"#98A2B3":"#1C1917",fontFamily:"DM Sans, sans-serif",minWidth:0,WebkitAppearance:"none",appearance:"none"},placeholder:Fe?void 0:m,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:Fe?x?"#98A2B3":"#1C1917":"#79716B",fontSize:"16px",lineHeight:"24px",fontWeight:400,minHeight:"24px",display:"inline-block"},children:Fe?(null===(a=Ce[0])||void 0===a?void 0:a.label)||xe:m||" "})}),e.jsxs("div",{style:{position:"absolute",right:"12px",display:"flex",alignItems:"center",gap:"4px"},children:[Se&&e.jsx(function(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:ke,style:{cursor:"pointer",flexShrink:0,color:"#78716C"},children:e.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{}),e.jsx(function(n){var t=n.isOpen;return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease-in-out",flexShrink:0},children:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:"#78716C",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},{isOpen:he})]})]}),he&&ce&&t.createPortal(e.jsx("div",{ref:de,className:"aha-select-dropdown ".concat(H),style:o({position:"absolute",top:"".concat(ce.top,"px"),left:"".concat(ce.left,"px"),width:"".concat(ce.width,"px"),zIndex:1050,backgroundColor:"#FFFFFF",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",border:"1px solid #E7E5E4",maxHeight:"256px",overflow:"auto",opacity:0,transform:"top"===ce.placement?"translateY(8px)":"translateY(-8px)",animation:"dropdownFadeIn 0.2s ease-out forwards",transformOrigin:"top"===ce.placement?"bottom center":"top center",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain"},T),children:0===ye.length?e.jsx("div",{style:{padding:"8px 16px",textAlign:"center",color:"#78716C",fontSize:"14px",fontFamily:"DM Sans, sans-serif"},children:"No data"}):ye.map(function(n,t){var o=ve?Array.isArray(xe)&&xe.includes(n.value):xe===n.value,r=t===re;return q?e.jsx("div",{className:"aha-select-option ".concat(n.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(o?"bg-[#FAFAF9]":""),onClick:function(){return!n.disabled&&be(n)},style:{cursor:n.disabled?"not-allowed":"pointer",transition:"background-color 0.2s"},children:q(n,{selected:o,focused:r,disabled:n.disabled||!1})},n.value):e.jsxs("div",{className:"aha-select-option ".concat(n.disabled?"":"hover:bg-[#FAFAF9]"," ").concat(o?"bg-[#FAFAF9]":""),onClick:function(){return be(n)},style:{padding:"8px 16px",cursor:n.disabled?"not-allowed":"pointer",color:n.disabled?"#98A2B3":"#101828",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif",display:"flex",alignItems:"center",justifyContent:"space-between",transition:"background-color 0.2s"},children:[e.jsx("span",{children:n.label}),o&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r?"hidden":"",children:e.jsx("path",{d:"M13.3333 4L6 11.3333L2.66667 8",stroke:V,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},n.value)})}),document.body)]})};h.displayName="Select";var v=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})},g=function(n){var t=n.className,o=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:[e.jsx("path",{d:"M3.5 4.5L6 2L8.5 4.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M3.5 7.5L6 10L8.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},m=function(n){var t=n.className,o=n.style;return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:[e.jsx("path",{d:"M8.5 7.5L6 10L3.5 7.5",stroke:"#A9A29D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8.5 4.5L6 2L3.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},y=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M15.8334 10H4.16675M4.16675 10L10.0001 15.8334M4.16675 10L10.0001 4.16669",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},b=function(n){var t=n.className,o=n.style;return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:o,children:e.jsx("path",{d:"M4.16675 10H15.8334M15.8334 10L10.0001 4.16669M15.8334 10L10.0001 15.8334",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})})},w=function(t){var r=t.current,i=t.defaultCurrent,a=void 0===i?1:i,l=t.total,s=void 0===l?0:l,c=t.pageSize,u=t.defaultPageSize,p=void 0===u?10:u,v=t.showSizeChanger,g=void 0!==v&&v,m=t.pageSizeOptions,w=void 0===m?["10","20","50","100"]:m,k=t.showQuickJumper,j=void 0!==k&&k,C=t.showTotal,S=t.onChange,F=t.onShowSizeChange,z=t.simple,A=void 0!==z&&z,W=t.disabled,L=void 0!==W&&W,E=t.hideOnSinglePage,I=void 0!==E&&E,M=t.className,B=void 0===M?"":M,D=t.style,N=t.size,R=void 0===N?"default":N,H=t.responsive,T=void 0!==H&&H;t.showLessItems;var O=t.itemRender,P=d().primaryColor,_=void 0===P?"#FB6011":P,K=n.useState(a),X=K[0],q=K[1],Y=n.useState(p),V=Y[0],J=Y[1],Q=n.useState(""),U=Q[0],G=Q[1],Z=null!=r?r:X,$=null!=c?c:V,ee=n.useMemo(function(){return Math.ceil(s/$)},[s,$]);n.useEffect(function(){void 0!==r&&q(r)},[r]),n.useEffect(function(){void 0!==c&&J(c)},[c]);var ne=function(e){e<1||e>ee||e===Z||L||(void 0===r&&q(e),null==S||S(e,$))},te=function(){var e=parseInt(U,10);e>=1&&e<=ee&&(ne(e),G(""))};if(I&&ee<=1)return null;if(A)return e.jsxs("div",{className:"aha-pagination aha-pagination-simple ".concat(B),style:D,children:[e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:L||1===Z,type:"default",size:"default"===R?"medium":"small",style:{marginRight:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(y,{})}),e.jsxs("span",{style:{margin:"0 8px",fontSize:"14px",lineHeight:"20px",color:"#475467",fontFamily:"DM Sans, sans-serif"},children:[Z," / ",ee]}),e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:L||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{marginLeft:"8px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(b,{})})]});var oe=(Z-1)*$+1,re=Math.min(Z*$,s);return e.jsxs("div",{className:"aha-pagination w-full ".concat(B),style:o({display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:T?"wrap":"nowrap",fontFamily:"DM Sans, sans-serif"},D),children:[C&&e.jsx("div",{className:"justify-start text-Text-text-secondary text-sm font-medium font-['DM_Sans'] leading-5",children:C(s,[oe,re])}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[s>0&&e.jsx(e.Fragment,{children:O?O(Z-1,"prev",e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:L||1===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(y,{})})):e.jsx(f,{onClick:function(){return ne(Z-1)},disabled:L||1===Z,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(y,{})})}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:function(){if(ee<=7)return Array.from({length:ee},function(e,n){return n+1});var e=[];if(Z<=4){for(var n=1;n<=5;n++)e.push(n);e.push("jump-next"),e.push(ee)}else if(Z>=ee-3){e.push(1),e.push("jump-prev");for(n=ee-4;n<=ee;n++)e.push(n)}else{e.push(1),e.push("jump-prev");for(n=Z-1;n<=Z+1;n++)e.push(n);e.push("jump-next"),e.push(ee)}return e}().map(function(n){return function(n){if("number"==typeof n){var t=n===Z,o=e.jsx(f,{onClick:function(){return ne(n)},disabled:L,type:t?"primary":"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,fontWeight:t?500:400,border:t?"1px solid ".concat(_):void 0,boxShadow:"none",borderRadius:"8px"},children:n},n);return O?O(n,"page",o):o}if("jump-prev"===n)return o=e.jsx(f,{onClick:function(){return ne(Math.max(1,Z-5))},disabled:L,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-prev"),O?O(Z-5,"jump-prev",o):o;if("jump-next"===n)return o=e.jsx(f,{onClick:function(){return ne(Math.min(ee,Z+5))},disabled:L,type:"default",size:"default"===R?"medium":"small",style:{minWidth:"small"===R?"32px":"36px",height:"small"===R?"32px":"36px",padding:"0 12px",margin:0,border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"•••"},"jump-next"),O?O(Z+5,"jump-next",o):o;return null}(n)})}),s>0&&e.jsx(e.Fragment,{children:O?O(Z+1,"next",e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:L||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(b,{})})):e.jsx(f,{onClick:function(){return ne(Z+1)},disabled:L||Z===ee,type:"default",size:"default"===R?"medium":"small",style:{height:"small"===R?"32px":"36px",padding:"0 12px",gap:"4px",border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:e.jsx(b,{})})}),g&&e.jsx(h,{value:$,options:w.map(function(e){return{label:"".concat(e," / page"),value:Number(e)}}),onChange:function(e){return n=Number(e),t=Math.ceil(s/n),o=Z>t?t:Z,void 0===c&&J(n),void 0===r&&q(o),null==F||F(o,n),void(null==S||S(o,n));var n,t,o},disabled:L,size:"small"===R?"small":"medium",style:{minWidth:"small"===R?80:96}}),j&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontFamily:"DM Sans, sans-serif"},children:[e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"Go to"}),e.jsx(x,{type:"number",min:1,value:U,onChange:function(e){return G(e.target.value)},onPressEnter:te,disabled:L,size:"small"===R?"small":"medium",style:{width:56,minWidth:56}}),e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",color:"#475467"},children:"page"}),"object"==typeof j&&j.goButton?e.jsx(f,{onClick:te,disabled:L,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:j.goButton}):e.jsx(f,{onClick:te,disabled:L,type:"default",size:"default"===R?"medium":"small",style:{border:"1px solid #EAECF0",boxShadow:"none",borderRadius:"8px"},children:"OK"})]})]})]})},k=function(t){var r=t.checked,i=void 0!==r&&r,a=t.indeterminate,l=void 0!==a&&a,d=t.disabled,s=void 0!==d&&d,c=t.onChange,u=t.className,p=void 0===u?"":u,f=t.style,x=t.children,h=t.size,v=void 0===h?"sm":h,g=t.hint,m=t.isFocused,y=n.useState(!1),b=y[0],w=y[1],k=n.useState(!1),j=k[0],C=k[1],S=i||l,F=null!=m?m:j,z=function(){s||(null==c||c({target:{checked:!i},currentTarget:{checked:!i}}))},A="sm"===v?"16px":"20px",W="sm"===v?"12px":"14px",L="sm"===v?"var(--radius-xs, 4px)":"var(--radius-sm, 6px)",E="sm"===v?"var(--font-size-text-sm, 14px)":"var(--font-size-text-md, 16px)",I="sm"===v?"var(--line-height-text-sm, 20px)":"var(--line-height-text-md, 24px)",M="sm"===v?"var(--spacing-md, 8px)":"var(--spacing-lg, 12px)",B=s&&S?"var(--color-fg-disabled_subtle, #d7d3d0)":"var(--color-fg-white, #ffffff)",D=x||g;return e.jsxs("div",{className:"aha-checkbox ".concat(p),role:"checkbox","aria-checked":l?"mixed":i,"aria-disabled":s,tabIndex:s?-1:0,style:o({display:"inline-flex",alignItems:"flex-start",gap:M,cursor:s?"not-allowed":"pointer",outline:"none"},f),onClick:z,onKeyDown:function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),z())},onMouseEnter:function(){return!s&&w(!0)},onMouseLeave:function(){return w(!1)},onFocus:function(){return!s&&C(!0)},onBlur:function(){return C(!1)},children:[e.jsxs("div",{style:{position:"relative",width:A,height:A,minWidth:A,minHeight:A,flexShrink:0,borderRadius:L,border:s?"1px solid var(--color-border-disabled, #d7d3d0)":S?b?"1px solid var(--color-bg-brand-solid_hover, #ec470a)":"1px solid var(--color-bg-brand-solid, #fb6011)":"1px solid var(--color-border-primary, #d7d3d0)",backgroundColor:s?"var(--color-bg-disabled_subtle, #fafaf9)":S?b?"var(--color-bg-brand-solid_hover, #ec470a)":"var(--color-bg-brand-solid, #fb6011)":b?"var(--color-bg-primary_hover, #fafaf9)":"var(--color-bg-primary, #ffffff)",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.15s, border-color 0.15s, box-shadow 0.15s",boxSizing:"border-box",boxShadow:F?"var(--focus-ring, 0px 0px 0px 2px #ffffff, 0px 0px 0px 4px #fb6011)":"none",marginTop:D?"2px":"0"},children:[e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 14 14",fill:"none",style:{position:"absolute",width:W,height:W,color:B,opacity:l?1:0,transition:"opacity 0.15s",pointerEvents:"none"},children:e.jsx("path",{d:"M2.91675 7H11.0834",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 14 14",fill:"none",style:{position:"absolute",width:W,height:W,color:B,opacity:i&&!l?1:0,transition:"opacity 0.15s",pointerEvents:"none"},children:e.jsx("path",{d:"M11.6666 3.5L5.24992 9.91667L2.33325 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),D&&e.jsxs("div",{style:{display:"inline-flex",flexDirection:"column",gap:"md"===v?"var(--spacing-xxs, 2px)":"0"},children:[x&&e.jsx("span",{style:{fontSize:E,lineHeight:I,fontWeight:"var(--font-weight-medium, 500)",fontFamily:'var(--font-family-body, "DM Sans", sans-serif)',color:s?"var(--color-text-disabled, #79716b)":"var(--color-text-secondary, #44403c)",userSelect:"none"},children:x}),g&&e.jsx("span",{style:{fontSize:E,lineHeight:I,fontWeight:"var(--font-weight-regular, 400)",fontFamily:'var(--font-family-body, "DM Sans", sans-serif)',color:"var(--color-text-tertiary, #57534e)"},onClick:function(e){return e.stopPropagation()},children:g})]})]})};k.displayName="Checkbox";var j=function(n){var t=n.color;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n @keyframes aha-table-loading-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "}),e.jsxs("svg",{width:32,height:32,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,style:{animation:"aha-table-loading-spin 1s linear infinite"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"24",opacity:.3}),e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"16"})]})]})},C=function(n){var t=n.loading,o=n.spinColor;if(!t)return null;var r=!0===t?e.jsx(j,{color:o}):t;return e.jsx("div",{role:"status","aria-live":"polite","aria-label":"Loading",className:"aha-table-loading-overlay",style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.55)",pointerEvents:"auto"},children:r})},S=function(e,n){return"string"==typeof n?null==e?void 0:e[n]:n.reduce(function(e,n){return null==e?void 0:e[n]},e)},F=function(e,n){var t,o;return"function"==typeof n?n(e):"string"==typeof n?null!==(t=S(e,n))&&void 0!==t?t:"":null!==(o=e.key)&&void 0!==o?o:""},z=function(n){var t=n.order,o=d().primaryColor;return"ascend"===t?e.jsx(m,{style:{color:o}}):"descend"===t?e.jsx(g,{style:{color:o}}):e.jsx(v,{})};exports.default=function(t){var a,l,s,c,u=t.columns,p=void 0===u?[]:u,f=t.dataSource,x=void 0===f?[]:f,h=t.rowKey,v=void 0===h?"key":h,g=t.rowSelection,m=t.pagination,y=void 0!==m&&m,b=t.size,j=void 0===b?"middle":b,A=t.bordered,W=void 0!==A&&A,L=t.loading,E=void 0!==L&&L,I=t.locale,M=t.showHeader,B=void 0===M||M,D=t.title,N=t.footer,R=t.summary,H=t.scroll,T=t.tableLayout,O=void 0===T?"auto":T,P=t.onChange,_=t.onSorterChange,K=t.onPaginationChange,X=t.onRow,q=t.className,Y=void 0===q?"":q,V=t.innerClassName,J=void 0===V?"":V,Q=t.style,U=t.expandable,G=t.rowClassName,Z=t.onHeaderRow;t.sticky;var $=r(t,["columns","dataSource","rowKey","rowSelection","pagination","size","bordered","loading","locale","showHeader","title","footer","summary","scroll","tableLayout","onChange","onSorterChange","onPaginationChange","onRow","className","innerClassName","style","expandable","rowClassName","onHeaderRow","sticky"]),ee=d().primaryColor||"#FB6011",ne=n.useState((null==g?void 0:g.selectedRowKeys)||(null==g?void 0:g.defaultSelectedRowKeys)||[]),te=ne[0],oe=ne[1];n.useEffect(function(){void 0!==(null==g?void 0:g.selectedRowKeys)&&oe(g.selectedRowKeys)},[null==g?void 0:g.selectedRowKeys]);var re=n.useState(new Map),ie=re[0],ae=re[1],le=n.useState((null==U?void 0:U.defaultExpandedRowKeys)||[]),de=le[0],se=le[1],ce=n.useState(y&&"object"==typeof y&&(y.current||y.defaultCurrent)||1),ue=ce[0],pe=ce[1],fe=n.useState(y&&"object"==typeof y&&(y.pageSize||y.defaultPageSize)||10),xe=fe[0],he=fe[1];n.useEffect(function(){y&&"object"==typeof y&&(void 0!==y.current&&pe(y.current),void 0!==y.pageSize&&he(y.pageSize))},[y]);var ve=n.useState(null),ge=ve[0],me=ve[1],ye=n.useState(null),be=ye[0],we=ye[1],ke=n.useState(!1),je=ke[0],Ce=ke[1],Se=n.useRef(null),Fe=n.useRef(null);n.useEffect(function(){var e=function(){Ce(window.innerWidth<768)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]);var ze=n.useCallback(function(e,n){var t,o,r,a=null===(t=null==g?void 0:g.getCheckboxProps)||void 0===t?void 0:t.call(g,e);if(!(null==a?void 0:a.disabled)){var l,d=F(e,v);l="radio"===(null==g?void 0:g.type)?n?[d]:[]:n?i(i([],te,!0),[d],!1):te.filter(function(e){return e!==d}),oe(l);var s=x.filter(function(e){return l.includes(F(e,v))});null===(o=null==g?void 0:g.onChange)||void 0===o||o.call(g,l,s),null===(r=null==g?void 0:g.onSelect)||void 0===r||r.call(g,e,n,s,new Event("select"))}},[te,v,g,x]),Ae=n.useCallback(function(e,n){var t,o,r=n.filter(function(e){var n;return!(null===(n=null==g?void 0:g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}).map(function(e){return F(e,v)}),i=e?r:[];oe(i);var a=x.filter(function(e){return i.includes(F(e,v))}),l=e?n.filter(function(e){var n;return!(null===(n=null==g?void 0:g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}):[];null===(t=null==g?void 0:g.onChange)||void 0===t||t.call(g,i,a),null===(o=null==g?void 0:g.onSelectAll)||void 0===o||o.call(g,e,a,l)},[v,g,x]),We=n.useCallback(function(e,n){var t=e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex);if(t){var o=new Map(ie);null===n?o.delete(t):o.set(t,n),ae(o);var r=Array.from(o.entries()).map(function(n){var t=n[0],o=n[1];return{column:p.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t})||e,order:o,field:t,columnKey:t}}),i={column:e,order:n,field:t,columnKey:t};e.onSorterChange&&e.onSorterChange(i),_&&_(1===r.length?r[0]:r),P&&P({current:ue,pageSize:xe},{},1===r.length?r[0]:r,{currentDataSource:x,action:"sort"})}},[ie,P,_,ue,xe,x,p]);n.useCallback(function(e,n){var t,o,r,a=F(e,v);r=n?i(i([],de,!0),[a],!1):de.filter(function(e){return e!==a}),se(r),null===(t=null==U?void 0:U.onExpand)||void 0===t||t.call(U,n,e),null===(o=null==U?void 0:U.onExpandedRowsChange)||void 0===o||o.call(U,r)},[de,v,U]);var Le,Ee=n.useCallback(function(){var e=i([],x,!0);return ie.size>0&&e.sort(function(e,n){for(var t=function(t,o){var r=p.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===t});if(!r)return"continue";var i=0;if("function"==typeof r.sorter)i=r.sorter(e,n);else if(!0===r.sorter){var a=S(e,r.dataIndex||t),l=S(n,r.dataIndex||t);a<l?i=-1:a>l&&(i=1)}return 0!==i?{value:"ascend"===o?i:-i}:void 0},o=0,r=Array.from(ie.entries());o<r.length;o++){var i=r[o],a=t(i[0],i[1]);if("object"==typeof a)return a.value}return 0}),e},[x,ie,p]),Ie=Ee(),Me=Boolean(y&&"object"==typeof y&&void 0!==y.total),Be=n.useMemo(function(){if(!1===y||!y)return Ie;if(Me)return Ie;var e=(ue-1)*xe,n=e+xe;return Ie.slice(e,n)},[Ie,ue,xe,y,Me]),De=n.useCallback(function(e,n){var t,o,r=null!=n?n:xe;if(pe(e),n&&he(n),K&&K(e,r),y&&"object"==typeof y&&(null===(t=y.onChange)||void 0===t||t.call(y,e,n),n&&(null===(o=y.onShowSizeChange)||void 0===o||o.call(y,e,n))),P){var i=Array.from(ie.entries()).map(function(e){var n=e[0],t=e[1];return{column:p.find(function(e){return(e.key||(Array.isArray(e.dataIndex)?e.dataIndex.join("."):e.dataIndex))===n}),order:t,field:n,columnKey:n}});P({current:e,pageSize:r},{},1===i.length?i[0]:i,{currentDataSource:Ie,action:"paginate"})}},[y,K,P,xe,ie,p,Ie]),Ne=n.useCallback(function(e,n,t){var o=S(n,e.dataIndex||"");return e.render?e.render(o,n,t):o},[]),Re=n.useCallback(function(e,n,t){if(n){var o=!0===n?"left":n,r=0;if("left"===o){if(g&&("left"===g.fixed||!0===g.fixed))r+="number"==typeof g.columnWidth?g.columnWidth:"string"==typeof g.columnWidth?parseInt(g.columnWidth):60;for(var i=0;i<e;i++){if("left"===(a=p[i]).fixed||!0===a.fixed)r+=a.width?"number"==typeof a.width?a.width:parseInt(a.width)||0:150}return r}if("right"===o){for(i=e+1;i<p.length;i++){var a;if("right"===(a=p[i]).fixed)r+=a.width?"number"==typeof a.width?a.width:parseInt(a.width)||0:150}if(g&&"right"===g.fixed)r+="number"==typeof g.columnWidth?g.columnWidth:"string"==typeof g.columnWidth?parseInt(g.columnWidth):60;return r}}},[p,g]),He=n.useCallback(function(){if(!B)return null;var n,t,r,i,a=p.map(function(n,t){var r,i=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||t,a=ie.get(i)||null,l=Re(t,n.fixed,!0),d=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("th",o({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:{width:d,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:d||void 0,maxWidth:d,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==l?"".concat(l,"px"):"0":void 0,right:"right"===n.fixed?void 0!==l?"".concat(l,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:(n.fixed,"#F9FAFB"),boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"12px 16px",textAlign:n.align||"left",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif"}},(null===(r=n.onHeaderCell)||void 0===r?void 0:r.call(n,n))||{},{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",justifyContent:"right"===n.align?"flex-end":"center"===n.align?"center":"flex-start"},children:[e.jsx("span",{style:{fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467"},children:"function"==typeof n.title?n.title({sortOrder:a,sortColumn:n}):n.title}),n.sorter&&e.jsx("button",{onClick:function(){We(n,null===a?"ascend":"ascend"===a?"descend":null)},style:{border:"none",background:"none",cursor:"pointer",display:"flex",alignItems:"center",padding:"2px",color:a?"#475467":"#98A2B3"},children:e.jsx(z,{order:a||void 0})})]})}),i)});if(g){var l="number"==typeof g.columnWidth?"".concat(g.columnWidth,"px"):"string"==typeof g.columnWidth?g.columnWidth:"60px",d=e.jsx("th",{style:{width:l,position:g.fixed?"sticky":"relative",left:"left"===g.fixed||!0===g.fixed?"0px":void 0,right:"right"===g.fixed?"0px":void 0,zIndex:g.fixed?"left"===g.fixed||!0===g.fixed?12:11:1,backgroundColor:"#F9FAFB",padding:"12px 16px",borderBottom:"1px solid #EAECF0",fontWeight:600,fontSize:"12px",lineHeight:"18px",color:"#475467",fontFamily:"DM Sans, sans-serif",textAlign:"center"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:[!g.hideSelectAll&&"radio"!==g.type&&(n=Be.filter(function(e){var n;return!(null===(n=g.getCheckboxProps)||void 0===n?void 0:n.call(g,e).disabled)}),t=n.map(function(e){return F(e,v)}),r=n.length>0&&t.every(function(e){return te.includes(e)}),i=t.some(function(e){return te.includes(e)}),e.jsx(k,{checked:r,indeterminate:i&&!r,onChange:function(e){return Ae(e.target.checked,Be)}})),g.columnTitle&&e.jsx("span",{style:{marginLeft:g.hideSelectAll?0:"8px"},children:g.columnTitle})]})},"selection");a.unshift(d)}var s=null==Z?void 0:Z(p,0);return e.jsx("thead",{ref:Fe,children:e.jsx("tr",o({},s||{},{children:a}))})},[p,B,ie,g,te,Be,v,We,Ae,I,Z,Re]),Te=n.useCallback(function(e){me(e)},[]),Oe=n.useCallback(function(e,n){e.preventDefault(),we(n)},[]),Pe=n.useCallback(function(e,n){if(e.preventDefault(),null===ge||ge===n)return me(null),void we(null);var t=i([],Be,!0),o=t[ge];t.splice(ge,1),t.splice(n,0,o),me(null),we(null)},[ge,Be]),_e=n.useCallback(function(){me(null),we(null)},[]),Ke=n.useCallback(function(){var n=null==I?void 0:I.emptyText,t="function"==typeof n?n():void 0!==n?n:"No data",o=p.length+(g?1:0);return e.jsx("tr",{className:"aha-table-placeholder",children:e.jsx("td",{colSpan:o,style:{padding:"48px 16px",textAlign:"center",color:"#98A2B3",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif",borderBottom:"none",backgroundColor:"white"},children:t})})},[null==I?void 0:I.emptyText,p.length,g]),Xe=n.useCallback(function(){return 0===Be.length?Ke():Be.map(function(t,r){var i,a=F(t,v),l=te.includes(a),d=de.includes(a),s=(null==X?void 0:X(t,r))||{},c=r===Be.length-1;return e.jsxs(n.Fragment,{children:[e.jsxs("tr",o({className:"".concat("function"==typeof G?G(t,r):G||""," ").concat(ge===r?"dragging":""," ").concat(be===r?"drag-over":""),draggable:!0,onDragStart:function(){return Te(r)},onDragOver:function(e){return Oe(e,r)},onDrop:function(e){return Pe(e,r)},onDragEnd:_e,style:o({cursor:"move",opacity:ge===r?.5:1,backgroundColor:be===r?"#F9FAFB":"white",transition:"background-color 0.2s"},s.style),onMouseEnter:function(e){ge!==r&&be!==r&&(e.currentTarget.style.backgroundColor="#F9FAFB")},onMouseLeave:function(e){ge!==r&&be!==r&&(e.currentTarget.style.backgroundColor="white")}},s,{children:[g&&e.jsx("td",{style:{width:"number"==typeof g.columnWidth?"".concat(g.columnWidth,"px"):"string"==typeof g.columnWidth?g.columnWidth:"60px",position:g.fixed?"sticky":"relative",left:"left"===g.fixed||!0===g.fixed?"0px":void 0,right:"right"===g.fixed?"0px":void 0,zIndex:g.fixed?"left"===g.fixed||!0===g.fixed?12:11:1,backgroundColor:"white",padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",textAlign:"center"},children:e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(k,{checked:l,onChange:function(e){return ze(t,e.target.checked)},disabled:null===(i=g.getCheckboxProps)||void 0===i?void 0:i.call(g,t).disabled})})}),p.map(function(n,i){var a,l=n.key||(Array.isArray(n.dataIndex)?n.dataIndex.join("."):n.dataIndex)||i,d=(null===(a=n.onCell)||void 0===a?void 0:a.call(n,t,r))||{},s=Re(i,n.fixed,!1),u=n.width?"number"==typeof n.width?"".concat(n.width,"px"):n.width:void 0;return e.jsx("td",o({className:"".concat(n.className||""," ").concat(n.align?"text-".concat(n.align):""),style:o({width:u,minWidth:n.minWidth?"number"==typeof n.minWidth?"".concat(n.minWidth,"px"):n.minWidth:u||void 0,maxWidth:u,position:n.fixed?"sticky":"relative",left:"left"===n.fixed||!0===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,right:"right"===n.fixed?void 0!==s?"".concat(s,"px"):"0":void 0,zIndex:n.fixed?"left"===n.fixed||!0===n.fixed?10:9:1,backgroundColor:"white",boxShadow:"left"===n.fixed||!0===n.fixed?"2px 0 4px rgba(0, 0, 0, 0.05)":"right"===n.fixed?"-2px 0 4px rgba(0, 0, 0, 0.05)":void 0,padding:"16px",borderBottom:c?"none":"1px solid #EAECF0",fontSize:"14px",lineHeight:"20px",color:"#101828",fontFamily:"DM Sans, sans-serif",textAlign:n.align||"left"},d.style),colSpan:n.colSpan,rowSpan:n.rowSpan},d,{children:Ne(n,t,r)}),l)})]})),(null==U?void 0:U.expandedRowRender)&&d&&e.jsx("tr",{children:e.jsx("td",{colSpan:p.length+(g?1:0),children:U.expandedRowRender(t,r,0,!0)})})]},a)})},[Be,v,te,de,g,p,X,G,ze,Ne,U,ge,be,Te,Oe,Pe,_e,Re,Ke]),qe=function(){var n;if(!1===y||!y)return null;var t=null!==(n=y.total)&&void 0!==n?n:Ie.length,o=y.position||"bottomRight";return e.jsx("div",{style:{marginTop:"16px",display:"flex",justifyContent:o.includes("Right")?"flex-end":o.includes("Left")?"flex-start":"center"},children:e.jsx(w,{current:ue,total:t,pageSize:xe,showSizeChanger:y.showSizeChanger,pageSizeOptions:y.pageSizeOptions,showQuickJumper:y.showQuickJumper,showTotal:y.showTotal,onChange:De,onShowSizeChange:De,simple:y.simple,responsive:y.responsive,size:"small"===j?"small":"default"})})},Ye=n.useMemo(function(){return p.some(function(e){return e.fixed})||g&&g.fixed},[p,g]),Ve=n.useMemo(function(){return p.every(function(e){return e.width})&&(!g||g.columnWidth)},[p,g]),Je=n.useMemo(function(){if(null==H?void 0:H.x){if("number"==typeof H.x)return H.x;if(!0===H.x)return p.reduce(function(e,n){return e+(n.width?"number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0:150)},0)+(g?"number"==typeof g.columnWidth?g.columnWidth:parseInt(String(g.columnWidth||"60").replace("px",""))||60:0)}if(Ye)return p.reduce(function(e,n){return n.fixed&&n.width?e+("number"==typeof n.width?n.width:parseInt(String(n.width).replace("px",""))||0):e},0)+(g&&g.fixed&&g.columnWidth?"number"==typeof g.columnWidth?g.columnWidth:parseInt(String(g.columnWidth).replace("px",""))||60:0)},[p,null==H?void 0:H.x,g,Ye]),Qe=n.useMemo(function(){return"fixed"===O||Ye||Ve||p.some(function(e){return e.width})?"fixed":O},[O,Ye,Ve,p]),Ue=o(o({width:"100%",minWidth:Je?"".concat(Je,"px"):"100%",borderCollapse:"separate",borderSpacing:0,tableLayout:Qe,backgroundColor:"white"},W&&{borderRadius:"8px",border:"1px solid #EAECF0"}),{overflow:"hidden"}),Ge=o({position:"relative",width:"100%",maxWidth:"100%",maxHeight:"number"==typeof(null==H?void 0:H.y)?"".concat(H.y,"px"):void 0,borderRadius:"8px"},Q);if(je)return e.jsxs("div",o({ref:Se,className:"aha-table aha-table-mobile-wrapper ".concat(Y),style:Ge,"aria-busy":!!E||void 0},$,{children:[D&&e.jsx("div",{style:{marginBottom:"16px"},children:D(Ie)}),y&&"object"==typeof y&&(null===(a=y.position)||void 0===a?void 0:a.startsWith("top"))&&qe(),(Le="function"==typeof(null==I?void 0:I.emptyText)?I.emptyText():void 0!==(null==I?void 0:I.emptyText)?I.emptyText:"No data",0===Be.length?e.jsx("div",{className:"aha-table-mobile aha-table-placeholder",style:{padding:"48px 16px",textAlign:"center",color:"#98A2B3",fontSize:"14px",lineHeight:"20px",fontFamily:"DM Sans, sans-serif"},children:Le}):e.jsx("div",{className:"aha-table-mobile",children:Be.map(function(n,t){var o,r=F(n,v),i=te.includes(r);return e.jsxs("div",{className:"aha-table-mobile-row ".concat(i?"selected":""),style:{border:"1px solid #e8e8e8",borderRadius:"4px",padding:"12px",marginBottom:"12px",backgroundColor:i?"#e6f7ff":"white"},children:[g&&e.jsx("div",{style:{marginBottom:"8px"},children:e.jsx(k,{checked:i,onChange:function(e){return ze(n,e.target.checked)},disabled:null===(o=g.getCheckboxProps)||void 0===o?void 0:o.call(g,n).disabled})}),p.map(function(o){var r=o.key||(Array.isArray(o.dataIndex)?o.dataIndex.join("."):o.dataIndex),i=S(n,o.dataIndex||""),a=o.render?o.render(i,n,t):i;return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px",paddingBottom:"8px",borderBottom:"1px solid #f0f0f0"},children:[e.jsxs("span",{style:{fontWeight:"bold",color:"#666"},children:["function"==typeof o.title?o.title({}):o.title,":"]}),e.jsx("span",{style:{flex:1,textAlign:"right"},children:a})]},r)})]},r)})})),N&&e.jsx("div",{style:{marginTop:"16px"},children:N(Ie)}),y&&("object"!=typeof y||!(null===(l=y.position)||void 0===l?void 0:l.startsWith("top")))&&qe(),e.jsx(C,{loading:E,spinColor:ee})]}));var Ze={position:"relative",overflowX:(null==H?void 0:H.x)||Ye?"auto":"visible",overflowY:(null==H?void 0:H.y)?"auto":"visible",width:"100%",maxWidth:!0===(null==H?void 0:H.x)?"100%":"number"==typeof(null==H?void 0:H.x)?"".concat(H.x,"px"):void 0,maxHeight:"number"==typeof(null==H?void 0:H.y)?"".concat(H.y,"px"):void 0,borderRadius:"8px"};return e.jsxs("div",o({ref:Se,className:"aha-table ".concat(Y),style:Ge,"aria-busy":!!E||void 0},$,{children:[D&&e.jsx("div",{style:{marginBottom:"16px"},children:D(Ie)}),y&&"object"==typeof y&&(null===(s=y.position)||void 0===s?void 0:s.startsWith("top"))&&qe(),e.jsx("div",{style:Ze,children:e.jsx("div",{style:{width:"100%",minWidth:Je?"".concat(Je,"px"):"100%",display:"block"},children:e.jsxs("table",{style:Ue,className:J,children:[He(),e.jsx("tbody",{children:Xe()}),R&&e.jsx("tfoot",{children:e.jsx("tr",{children:e.jsx("td",{colSpan:p.length+(g?1:0),children:R(Ie)})})})]})})}),N&&e.jsx("div",{style:{marginTop:"16px"},children:N(Ie)}),y&&("object"!=typeof y||!(null===(c=y.position)||void 0===c?void 0:c.startsWith("top")))&&qe(),e.jsx(C,{loading:E,spinColor:ee})]}))};
2
2
  //# sourceMappingURL=Table.js.map