@lax-wp/design-system 0.10.26 → 0.10.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400
|
|
78
78
|
${D&&R?.color&&`bg-${R.color}-50`}
|
|
79
79
|
${h||""}
|
|
80
|
-
`,onChange:W=>{n(W.target.value)},value:r,defaultValue:i,id:t||e,style:k,autoComplete:"off",placeholder:j}),A.jsx("span",{className:"absolute inset-y-0 right-3 flex items-center z-[1000px] h-full dark:text-black-100",children:"%"})]}),a&&A.jsx($,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:a})]}),V&&R&&D&&P&&A.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:W=>W.stopPropagation(),onMouseDown:W=>W.preventDefault(),onKeyDown:W=>{W.key==="Escape"&&F(!1)},children:A.jsx(P,{riskDetails:R})})]})});t7.displayName="PercentageInputField";const r7=g.forwardRef(({onSubmit:t,...e},r)=>A.jsx("form",{ref:r,onSubmit:n=>{n.preventDefault(),t?.(n)},...e}));r7.displayName="Form";const n7=typeof window<"u"?g.useLayoutEffect:g.useEffect;function $g(t,e,r,n){const a=g.useRef(e);n7(()=>{a.current=e},[e]),g.useEffect(()=>{const i=r?.current||window;if(!(i&&i.addEventListener)||t===null)return;const s=o=>a.current(o);return i.addEventListener(t,s,n),()=>{i.removeEventListener(t,s)}},[t,r,n])}const fo=g.memo(g.forwardRef(({adjustWithScreen:t,children:e,renderViewClassName:r,fullHeight:n,...a},i)=>{const[s,o]=g.useState(window.innerHeight),l=g.useRef(null);return $g("resize",()=>{t&&o(window.innerHeight)}),g.useImperativeHandle(i,()=>({get getInstance(){return l.current},get view(){return l.current?.view??null},scrollToTop:()=>{l.current&&l.current.scrollToTop()},scrollToRight:()=>{l.current&&l.current.scrollToRight()}}),[]),A.jsx(zN.Scrollbars,{ref:l,autoHide:!0,renderTrackVertical:({style:c,...d})=>A.jsx("div",{style:c,className:"h-full top-0 right-0 rounded-md z-[1001] !w-scrollbar-size",...d}),renderThumbVertical:({style:c,...d})=>A.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute right-0.5 !w-2",...d}),renderTrackHorizontal:({style:c,...d})=>A.jsx("div",{style:c,className:"w-full bottom-0 left-0 rounded-md z-[1001] !h-scrollbar-size ",...d}),renderThumbHorizontal:({style:c,...d})=>A.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute bottom-0.5 !h-2",...d}),renderView:c=>A.jsx("div",{className:U("!-mr-scrollbar-size h-full !-mb-scrollbar-size",r,n?"!h-[calc(100%+var(--scroll-bar-size))]":""),...c}),...a,style:{...a.style||{},zIndex:0,...!a.autoHeight&&!a.style?.height?{height:n?"100%":s,overflowX:"hidden"}:{}},children:e})}));fo.displayName="CustomScrollbar";const nD=({id:t,value:e="",onChange:r,placeholder:n="Enter markdown content...",rows:a=1,disabled:i=!1,className:s,textareaClassName:o,previewClassName:l,defaultMode:u="markdown",mode:c,label:d,required:f=!1})=>{const[h,p]=g.useState(u),[b,y]=g.useState(!1),m=t||`md-input-${Math.random().toString(36).slice(2,11)}`,v=g.useMemo(()=>{if(!e)return a;const T=(e.match(/\n/g)||[]).length+1;return Math.min(18,T)},[e,a]),S=c??h,E=c!==void 0;return A.jsxs("div",{className:U("flex flex-col gap-2",s),children:[A.jsxs("div",{className:"flex items-center gap-3",children:[!E&&A.jsx("div",{className:"flex items-center gap-2",children:A.jsxs("div",{className:"inline-flex grow-0 p-1 rounded-lg bg-neutral-100 dark:bg-black-700 w-auto",children:[A.jsx("button",{className:U("rounded-md p-1 flex items-center justify-center",S==="markdown"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>p("markdown"),disabled:i,children:A.jsx($,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:U(S==="markdown"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Markdown"})}),A.jsx("button",{className:U("rounded-md p-1 flex items-center justify-center",S==="preview"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>p("preview"),disabled:i,children:A.jsx($,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:U(S==="preview"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Preview"})})]})}),d&&A.jsxs("label",{htmlFor:m,className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:[d,f&&A.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})]}),A.jsx("div",{className:"relative",children:S==="markdown"?A.jsx("textarea",{id:m,value:e,onChange:T=>r(T.target.value),placeholder:n,rows:v,disabled:i,required:f,className:U("w-full border rounded-lg bg-white dark:bg-black-600","py-2.5 px-3 font-inter font-medium text-sm","text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500","transition-colors duration-200","focus:ring-2 focus:outline-none resize-vertical","border-gray-300 dark:border-gray-600","focus:border-blue-500 focus:ring-blue-200 dark:focus:ring-blue-400/20",{"bg-gray-50 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":i},o),onClick:T=>T.stopPropagation()}):A.jsxs("div",{className:"relative",children:[A.jsx("div",{className:U("w-full rounded-lg","py-2.5 px-3 min-h-[calc(2.5rem*var(--rows,8))]","text-sm",l),style:{"--rows":v>3?v-3:v},children:A.jsx(fo,{autoHeight:!0,autoHeightMax:`calc(1rem * ${v>3?v-3:v})`,children:A.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:A.jsx(c1,{remarkPlugins:[d1],children:e||"*No content to preview*"})})})}),A.jsx("button",{onClick:()=>y(!0),className:"absolute bottom-2 right-2 p-1 rounded-md bg-neutral-100 dark:bg-black-600 hover:bg-gray-200 dark:hover:bg-black-500 transition-colors shadow-sm flex items-center justify-center",title:"Expand preview",type:"button",children:A.jsx(ge.OpenInFull,{sx:{fontSize:"16px"},className:"text-neutral-600 dark:text-neutral-400"})})]})}),A.jsx(nn,{open:b,onCancel:()=>y(!1),title:"Markdown Preview",width:800,footer:null,children:A.jsx(fo,{autoHeight:!0,autoHeightMax:"70vh",children:A.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:A.jsx(c1,{remarkPlugins:[d1],children:e||"*No content to preview*"})})})})]})},{Dragger:aD}=qe.Upload,iD=50*1024*1024,sD=({getFile:t,id:e,description:r,errorMessage:n=null,disabled:a=!1,defaultFile:i=null,acceptedFiles:s=null,isLoading:o=!1,asBase64:l=!1,toFileServer:u=!1,setFileUploading:c,fileUploading:d=!1,uploadToDocServer:f=!1,multiple:h=!1,getRealFileName:p=!1,onDelete:b,maxSize:y=iD,fileUploadService:m,systemMessages:v,toast:S})=>{const[E,T]=g.useState(null),[k,w]=g.useState([]),[O,C]=g.useState("#d9d9d9"),[_,N]=g.useState(!1),[R,D]=g.useState(null),P=async()=>{if(!m){console.warn("MultiFileUpload: File server upload requires fileUploadService");return}Promise.all(k.map(M=>{const V=new FormData;V.append("file",M);const F=Li({file_upload_path:f?"document-server":null,token:localStorage.getItem("token")});return m.uploadFileToFileServer(V,F)})).then(M=>{t(h?M?.map(V=>V?.fileUrl):M?.[0]?.fileUrl,p?E?.name:M?.[0]?.fileName),c?.(null),D(M?.[0])})},j={accept:s||"*",multiple:h,showUploadList:!1,disabled:a,onRemove:()=>{w([])},beforeUpload:(M,V)=>{if(M.size>y){const F=Math.round(y/1048576),B=v?.fileSizeLimit(String(F),"MB")||`File size must be less than ${F}MB`;return S?S.error(B,{toastId:B}):console.error(B),!1}return T(M),u?(c?.(e||"field-file-upload"),w(V)):(l?Promise.all((h?V:[M]).map(F=>new Promise(B=>{const W=new FileReader;W.onload=X=>{B({filename:F.name,content:X?.target?.result?.split(",")[1]})},W.readAsDataURL(F)}))).then(F=>{t(h?F:F[0])}):t(M),T(M)),!1}},z=async()=>{if(u&&R&&m){const M=Li({token:localStorage.getItem("token")});m.deleteFileFromFileServer(R?.fileName,M).then(()=>{D(null)})}T(null),w([]),t(""),b?.()};g.useEffect(()=>{i?.name&&T(i)},[i]),g.useEffect(()=>{C(n?"#EF4444":"#d9d9d9")},[n]),g.useEffect(()=>{k.length&&P()},[k]);const L=M=>M?M.length<=20?M:M.slice(0,14)+"...."+M.slice(-7):"";return A.jsxs("div",{children:[A.jsx("div",{className:"h-32",onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:A.jsx(aD,{...j,style:{borderColor:_&&!n?"#1890ff":O},disabled:a||d,children:E?A.jsxs("div",{className:"flex items-center justify-between mx-5",title:E?.name||i?.name,children:[A.jsxs("div",{className:"flex items-center justify-center gap-4",children:[E?.type==="application/pdf"?A.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:A.jsx(Dn.BsFiletypePdf,{size:20,fill:"#006CCF"})}):A.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:A.jsx(ge.DescriptionRounded,{sx:{height:"20px",width:"20px",color:"#006CCF"}})}),A.jsxs("div",{className:"text-left",children:[A.jsx($,{size:"small",variant:"medium",className:"font-inter text-md font-medium text-base",children:L(E?.name||i?.name)}),d?A.jsx($,{size:"small",variant:"medium",appearance:"subtitle",children:"Uploading..."}):E?.size>0?A.jsxs($,{size:"small",variant:"medium",appearance:"subtitle",children:[(E.size/1e3).toFixed(2)," ","KB"]}):null]})]}),o?A.jsx(ka.CgSpinner,{size:40,className:"spinner text-primary-600"}):A.jsx("button",{id:"btn-file-upload",className:"ml-4",onClick:M=>{M.stopPropagation(),z()},disabled:a,children:A.jsx(Vs.FiTrash2,{size:20,fill:"#98A2B3"})})]}):A.jsx("div",{className:"flex items-center justify-center",children:A.jsxs("div",{className:"flex-col",children:[A.jsx("div",{className:"mb-4 flex justify-center",children:A.jsx(Vs.FiDownload,{size:24,fill:"#98A2B3"})}),A.jsxs("div",{children:[A.jsxs("div",{className:"flex items-center justify-center",children:[A.jsx($,{size:"small",variant:"medium",className:"text-primary-600 dark:text-primary-300",appearance:"custom",children:"Click to upload"}),A.jsx($,{size:"small",variant:"medium",className:"ml-1",appearance:"subtitle",children:"or drag and drop"})]}),r?A.jsx($,{size:"small",variant:"medium",appearance:"subtitle",children:r}):null]})]})})})}),n&&A.jsx($,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:n})]})},oD=Object.keys(Eu).filter(t=>t?.endsWith("Rounded")),AD=[...oD||[],...(U4||[]).map(t=>`flag-${t}`)],lD=t=>{if(t?.startsWith("flag-")){const e=t?.replace("flag-","");return Yg(e||"")||e}return t.replaceAll(/([A-Z])/g," $1").trim()},uD=({onChange:t,selectedIcon:e,setOpen:r})=>{const[n,a]=g.useState(""),i=(AD||[]).filter(o=>{if(o?.startsWith("flag-")){const l=o?.replace("flag-","");return l?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")||Yg(l||"")?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}return o?.trim()?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}),s=(o,l)=>{if(l.stopPropagation(),e===o){t?.(null);return}t?.(o),r?.(!1)};return A.jsxs("div",{className:"flex flex-col gap-3",onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),o.stopPropagation())},children:[A.jsx(Bg,{id:"input-field-icon-picker",placeholder:"Search icons...",onChange:o=>a(o||""),fieldSuffix:A.jsx(Eu.Search,{sx:{width:16,height:16,color:"rgb(152 162 179)"}})}),A.jsx(h4.FixedSizeGrid,{columnCount:5,rowCount:Math.ceil((i?.length||0)/5),columnWidth:40,rowHeight:40,width:220,height:240,children:({columnIndex:o,rowIndex:l,style:u})=>{const c=l*5+o,d=i?.[c];return d?A.jsx("div",{style:{...u,padding:"4px"},children:A.jsx(qe.Tooltip,{title:lD(d),children:A.jsx(p4.IconButton,{type:"button",className:U("flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700",{"!bg-primary-50 dark:!bg-black-800":e===d}),onClick:f=>s(d,f),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),f.stopPropagation())},children:A.jsx(Jg,{iconName:d,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"})})})}):null}})]})},Jg=({iconName:t,sx:e,className:r,isHovering:n})=>{if(t?.startsWith?.("flag-")){const i=t?.replace("flag-","");return co?.(i||"",n||!1)||A.jsx("div",{children:"-"})}const a=Eu?.[t];return a?A.jsx(a,{sx:e,className:r,isHovering:n}):A.jsx("div",{children:"-"})},cD=({selectedIcon:t,onChange:e,label:r,required:n=!1,allowClear:a=!0,disabled:i=!1,errorMessage:s})=>{const[o,l]=g.useState(!1),u=g.useRef(!1),c=g.useRef(null),d=g.useRef(!1);g.useEffect(()=>{d.current&&!o&&c.current?.focus(),d.current=o},[o]);const f=h=>{h.stopPropagation(),e?.("")};return A.jsx(qe.Popover,{arrow:!1,placement:"bottom",trigger:"click",getPopupContainer:h=>h?.parentElement||document.body,open:o,onOpenChange:h=>{h?(u.current&&l(!0),u.current=!1):l(!1)},content:A.jsx(uD,{onChange:e,selectedIcon:t,setOpen:l}),children:A.jsxs("div",{className:"flex flex-col gap-1",children:[r?A.jsx(Xt,{label:r||"",required:n||!1}):null,A.jsxs("button",{ref:c,type:"button",id:`btn-icon-picker-icon-${t?"selected":"unselected"}`,className:`lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${i?"cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800":"bg-white dark:bg-black-800"} ${s?"border-red-500":"focus:border-primary-600 dark:focus:border-primary-400"} flex items-center justify-between gap-2`,disabled:i,onClick:h=>{if(i){h.preventDefault(),h.stopPropagation();return}h.detail>0&&(u.current=!0)},onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),o||h.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click())},children:[t?A.jsx(Jg,{iconName:t,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"}):A.jsx($,{size:"small",variant:"medium",appearance:"subtitle",children:"Select Icon"}),t&&a&&!i?A.jsx(Eu.CloseRounded,{sx:{width:20,height:20},className:"hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",onClick:f}):null]}),s&&A.jsx($,{size:"extra-small",className:"text-red-500 font-medium",children:s})]})})},dD=g.lazy(()=>Promise.resolve({default:t=>A.jsx(g.Suspense,{fallback:A.jsx("div",{className:"min-w-[83px] h-[30px] animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md"}),children:A.jsx(cD,{...t})})})),a7=g.forwardRef(({status:t,children:e,className:r,size:n="medium","aria-label":a},i)=>{const s=()=>{switch(n){case"small":return"text-xs px-1.5 py-0.5";case"large":return"text-base px-3 py-1.5";default:return"text-md px-1.5 py-1"}},o=()=>{switch(t?.toLowerCase()){case"purple":return"bg-purple-50 text-purple-500 border border-purple-100 dark:bg-purple-950 dark:text-purple-400 dark:border-purple-800";case"blue":return"bg-blue-50 text-blue-500 border border-blue-100 dark:bg-blue-950 dark:text-blue-400 dark:border-blue-800";case"teal":return"bg-teal-50 text-teal-500 border border-teal-100 dark:bg-teal-950 dark:text-teal-400 dark:border-teal-800";case"green":return"bg-green-50 text-green-500 border border-green-100 dark:bg-green-950 dark:text-green-400 dark:border-green-800";case"yellow":return"bg-yellow-50 text-yellow-600 border border-yellow-100 dark:bg-yellow-950 dark:text-yellow-400 dark:border-yellow-800";case"orange":return"bg-orange-50 text-orange-500 border border-orange-100 dark:bg-orange-950 dark:text-orange-400 dark:border-orange-800";case"peach":return"bg-orange-50 text-orange-400 border border-orange-100 dark:bg-orange-950 dark:text-orange-300 dark:border-orange-800";case"red":return"bg-red-50 text-red-500 border border-red-100 dark:bg-red-950 dark:text-red-400 dark:border-red-800";case"navy":return"bg-navy-50 text-navy-700 border border-navy-100 dark:bg-navy-950 dark:text-navy-400 dark:border-navy-800";case"grey":return"bg-neutral-50 text-neutral-500 border border-neutral-100 dark:bg-neutral-950 dark:text-neutral-400 dark:border-neutral-800";default:return"bg-blue-50 text-blue-600 border border-blue-200 dark:bg-blue-950 dark:text-blue-400 dark:border-blue-800"}};return A.jsx("span",{ref:i,className:U("inline-flex items-center justify-center font-medium rounded-md transition-colors",s(),o(),r),"aria-label":a||`Status: ${t||"default"}`,role:"status",children:e})});a7.displayName="StatusColorMapping";const i7=g.forwardRef(({status:t="default",children:e,appearance:r="outline",size:n="md",className:a,isRounded:i=!1,capitalize:s=!0,"aria-label":o},l)=>{const u=p=>!p||!s?p:p.replace(/\w\S*/g,b=>b.charAt(0).toUpperCase()+b.substr(1).toLowerCase()),c=()=>{switch(n){case"sm":return"text-xs px-1.5 py-0.5";case"lg":return"text-sm px-3 py-1.5";default:return"text-xs px-2 py-1"}},d=()=>{switch(t){case"primary":case"default":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";case"warning":return"bg-yellow-50 dark:bg-yellow-950 text-yellow-600 dark:text-yellow-300 border border-yellow-300 dark:border-yellow-700";case"error":return"bg-red-50 dark:bg-red-950 text-red-600 dark:text-red-300 border border-red-300 dark:border-red-700";case"neutral":return"bg-neutral-50 dark:bg-neutral-950 text-neutral-600 dark:text-neutral-300 border border-neutral-300 dark:border-neutral-700";case"success":return"bg-green-50 dark:bg-green-950 text-green-600 dark:text-green-300 border border-green-300 dark:border-green-700";case"info":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";default:return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700"}},f=()=>{switch(t){case"primary":case"default":return"bg-blue-600 dark:bg-blue-700 text-white";case"warning":return"bg-yellow-600 dark:bg-yellow-700 text-white";case"success":return"bg-green-600 dark:bg-green-700 text-white";case"error":return"bg-red-600 dark:bg-red-700 text-white";case"neutral":return"bg-neutral-600 dark:bg-neutral-700 text-white";case"info":return"bg-blue-600 dark:bg-blue-700 text-white";default:return"bg-blue-600 dark:bg-blue-700 text-white"}},h=()=>r==="filled"?f():d();return A.jsx("span",{ref:l,className:U("inline-flex items-center justify-center font-medium transition-colors",i?"rounded-full":"rounded",c(),h(),a),"aria-label":o||`Badge: ${t}`,role:"status",children:u(e)})});i7.displayName="Badge";const cs=({title:t,children:e})=>t?A.jsx(A.Fragment,{children:e}):null;cs.displayName="HelmetTitle";const eb=({children:t,className:e="",title:r,style:n,id:a})=>A.jsxs(A.Fragment,{children:[A.jsx(cs,{title:r}),A.jsx("div",{className:`bg-white dark:bg-black-800 border border-neutral-200 dark:border-black-600 rounded-lg shadow-100 w-full flex flex-col ${e}`,style:n,id:a,children:t})]});eb.displayName="Card";const Cu=({id:t,children:e,onClose:r,open:n,title:a,parentContainer:i="full-screen-container",resizable:s,width:o=400,placement:l="right",closable:u=!1,mask:c,classNames:d,styles:f,getContainer:h,zIndex:p,footer:b,...y})=>{const m=g.useRef(!1),[v,S]=g.useState(o);g.useEffect(()=>{S(o)},[n,o]);const E=g.useCallback(w=>{if(m.current)if(l==="right"){const O=document.body.offsetWidth-(w.clientX-document.body.offsetLeft);O>256&&S(O)}else w.clientX>256&&S(w.clientX)},[l,S]),T=g.useCallback(()=>{m.current&&(m.current=!1)},[]);g.useEffect(()=>(document.addEventListener("mousemove",E),document.addEventListener("mouseup",T),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",T)}),[E,T]);const k=typeof window<"u"?document.getElementById(i)||document.body:null;return k?pn.createPortal(A.jsxs(qe.Drawer,{id:t||"",closable:u,title:a,onClose:r,open:n,width:v,getContainer:h!==void 0?h:!1,placement:l,mask:c,classNames:d,styles:f,zIndex:p,footer:b,...y,children:[s&&A.jsx("div",{className:"cursor-ew-resize w-1 pl-[2px] absolute top-0 bottom-0 z-[2100] bg-transparent dark:bg-black-600 hover:bg-neutral-200 dark:hover:bg-black-700",onMouseDown:()=>{m.current=!0},style:l==="right"?{left:0}:{right:0}}),e]}),k):null};Cu.displayName="Drawer";const fD=({children:t,showAsModal:e,...r})=>e?A.jsx(nn,{onCancel:r.onClose,...r,children:t}):A.jsx(Cu,{...r,children:t});function s7(t){const[e,r]=g.useState(void 0),n=g.useRef(null);return g.useEffect(()=>{if(t.current)return n.current=new ResizeObserver(a=>{if(a[0]){const{width:i,height:s}=a[0].contentRect;r({width:i,height:s})}}),n.current.observe(t.current),()=>{n.current&&n.current.disconnect()}},[t]),e}const hD=({tags:t,size:e="sm",className:r="",maxVisible:n,icon:a,title:i=null,truncate:s=void 0,noWrap:o=!1,fitContent:l=!1,trailingContent:u})=>{const c=g.useRef(null),d=s7(c),f=E=>{switch(E){case"xs":return 6.5;case"sm":return 6.5;case"md":return 7;case"lg":return 7;default:return 6.5}},h=E=>{switch(E){case"xs":return 16;case"sm":return 20;case"md":return 24;case"lg":return 28;default:return 20}},p=(E,T)=>{if(!E)return 0;const k=T&&E.length>T?E.slice(0,T)+"...":E,w=f(e),O=h(e),C=a?16:0;return k.length*w+O+C},b=g.useMemo(()=>{if(!d||!t?.length)return{visibleTags:t||[],hiddenTags:[],truncateMap:new Map};const E=d.width,T=8,k=p("+ XX more")+10;let w=t.map((D,P)=>({index:P,width:p(D.label,s)}));if(w.reduce((P,j)=>P+j.width,0)+(w.length-1)*T<=E)return{visibleTags:t,hiddenTags:[],truncateMap:new Map};let C=0,_=0;const N=new Map;for(let D=0;D<w.length;D++){const P=w[D].width,j=D>0?T:0,z=w.length-D-1,L=z>0;if(_+j+P+(L?T+k:0)>E){if(z===1){const V=w[D+1].width;if(_+j+P+T+V<=E){C=D+2;break}}if(D===0){const F=Math.floor((E-h(e)-(a?16:0)-T-k)/f(e))-3;F>=10?(N.set(0,Math.max(10,F)),C=1):(C=1,N.set(0,10))}break}if(_+=j+P,C++,!L)break}return C=Math.max(1,Math.min(C,t.length)),n&&(C=Math.min(C,n)),t.length-C===1&&C<t.length&&w.slice(0,C+1).reduce((P,j)=>P+j.width,0)+C*T<=E&&C++,{visibleTags:t.slice(0,C),hiddenTags:t.slice(C),truncateMap:N}},[d,t,e,a,n,s]),{visibleTags:y,hiddenTags:m,truncateMap:v}=b;if(!t||t.length===0)return"-";const S=()=>A.jsxs(A.Fragment,{children:[A.jsx("style",{children:`
|
|
80
|
+
`,onChange:W=>{n(W.target.value)},value:r,defaultValue:i,id:t||e,style:k,autoComplete:"off",placeholder:j}),A.jsx("span",{className:"absolute inset-y-0 right-3 flex items-center z-[1000px] h-full dark:text-black-100",children:"%"})]}),a&&A.jsx($,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:a})]}),V&&R&&D&&P&&A.jsx("div",{role:"tooltip",tabIndex:0,className:"absolute left-0 right-0 top-[95%] mt-1 z-50 bg-white dark:bg-black-600 rounded-xl",onClick:W=>W.stopPropagation(),onMouseDown:W=>W.preventDefault(),onKeyDown:W=>{W.key==="Escape"&&F(!1)},children:A.jsx(P,{riskDetails:R})})]})});t7.displayName="PercentageInputField";const r7=g.forwardRef(({onSubmit:t,...e},r)=>A.jsx("form",{ref:r,onSubmit:n=>{n.preventDefault(),t?.(n)},...e}));r7.displayName="Form";const n7=typeof window<"u"?g.useLayoutEffect:g.useEffect;function $g(t,e,r,n){const a=g.useRef(e);n7(()=>{a.current=e},[e]),g.useEffect(()=>{const i=r?.current||window;if(!(i&&i.addEventListener)||t===null)return;const s=o=>a.current(o);return i.addEventListener(t,s,n),()=>{i.removeEventListener(t,s)}},[t,r,n])}const fo=g.memo(g.forwardRef(({adjustWithScreen:t,children:e,renderViewClassName:r,fullHeight:n,...a},i)=>{const[s,o]=g.useState(window.innerHeight),l=g.useRef(null);return $g("resize",()=>{t&&o(window.innerHeight)}),g.useImperativeHandle(i,()=>({get getInstance(){return l.current},get view(){return l.current?.view??null},scrollToTop:()=>{l.current&&l.current.scrollToTop()},scrollToRight:()=>{l.current&&l.current.scrollToRight()}}),[]),A.jsx(zN.Scrollbars,{ref:l,autoHide:!0,renderTrackVertical:({style:c,...d})=>A.jsx("div",{style:c,className:"h-full top-0 right-0 rounded-md z-[1001] !w-scrollbar-size",...d}),renderThumbVertical:({style:c,...d})=>A.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute right-0.5 !w-2",...d}),renderTrackHorizontal:({style:c,...d})=>A.jsx("div",{style:c,className:"w-full bottom-0 left-0 rounded-md z-[1001] !h-scrollbar-size ",...d}),renderThumbHorizontal:({style:c,...d})=>A.jsx("div",{style:c,className:"rounded-md bg-[#00000033] dark:bg-black-500 absolute bottom-0.5 !h-2",...d}),renderView:c=>A.jsx("div",{className:U("!-mr-scrollbar-size h-full !-mb-scrollbar-size",r,n?"!h-[calc(100%+var(--scroll-bar-size))]":""),...c}),...a,style:{...a.style||{},zIndex:0,...!a.autoHeight&&!a.style?.height?{height:n?"100%":s,overflowX:"hidden"}:{}},children:e})}));fo.displayName="CustomScrollbar";const nD=({id:t,value:e="",onChange:r,placeholder:n="Enter markdown content...",rows:a=1,disabled:i=!1,className:s,textareaClassName:o,previewClassName:l,defaultMode:u="markdown",mode:c,label:d,required:f=!1})=>{const[h,p]=g.useState(u),[b,y]=g.useState(!1),m=t||`md-input-${Math.random().toString(36).slice(2,11)}`,v=g.useMemo(()=>{if(!e)return a;const T=(e.match(/\n/g)||[]).length+1;return Math.min(18,T)},[e,a]),S=c??h,E=c!==void 0;return A.jsxs("div",{className:U("flex flex-col gap-2",s),children:[A.jsxs("div",{className:"flex items-center gap-3",children:[!E&&A.jsx("div",{className:"flex items-center gap-2",children:A.jsxs("div",{className:"inline-flex grow-0 p-1 rounded-lg bg-neutral-100 dark:bg-black-700 w-auto",children:[A.jsx("button",{className:U("rounded-md p-1 flex items-center justify-center",S==="markdown"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>p("markdown"),disabled:i,children:A.jsx($,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:U(S==="markdown"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Markdown"})}),A.jsx("button",{className:U("rounded-md p-1 flex items-center justify-center",S==="preview"?"bg-white dark:bg-black-700 !text-neutral-900 dark:!text-neutral-100":""),onClick:()=>p("preview"),disabled:i,children:A.jsx($,{variant:"semibold",size:"extra-small",appearance:"subtitle",className:U(S==="preview"?"!text-neutral-900 dark:!text-neutral-100":""),children:"Preview"})})]})}),d&&A.jsxs("label",{htmlFor:m,className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:[d,f&&A.jsx("span",{className:"text-red-500 ml-1",children:"*"})]})]}),A.jsx("div",{className:"relative",children:S==="markdown"?A.jsx("textarea",{id:m,value:e,onChange:T=>r(T.target.value),placeholder:n,rows:v,disabled:i,required:f,className:U("w-full border rounded-lg bg-white dark:bg-black-600","py-2.5 px-3 font-inter font-medium text-sm","text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500","transition-colors duration-200","focus:ring-2 focus:outline-none resize-vertical","border-gray-300 dark:border-gray-600","focus:border-blue-500 focus:ring-blue-200 dark:focus:ring-blue-400/20",{"bg-gray-50 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed":i},o),onClick:T=>T.stopPropagation()}):A.jsxs("div",{className:"relative",children:[A.jsx("div",{className:U("w-full rounded-lg","py-2.5 px-3 min-h-[calc(2.5rem*var(--rows,8))]","text-sm",l),style:{"--rows":v>3?v-3:v},children:A.jsx(fo,{autoHeight:!0,autoHeightMax:`calc(1rem * ${v>3?v-3:v})`,children:A.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:A.jsx(c1,{remarkPlugins:[d1],children:e||"*No content to preview*"})})})}),A.jsx("button",{onClick:()=>y(!0),className:"absolute bottom-2 right-2 p-1 rounded-md bg-neutral-100 dark:bg-black-600 hover:bg-gray-200 dark:hover:bg-black-500 transition-colors shadow-sm flex items-center justify-center",title:"Expand preview",type:"button",children:A.jsx(ge.OpenInFull,{sx:{fontSize:"16px"},className:"text-neutral-600 dark:text-neutral-400"})})]})}),A.jsx(nn,{open:b,onCancel:()=>y(!1),title:"Markdown Preview",width:800,footer:null,children:A.jsx(fo,{autoHeight:!0,autoHeightMax:"70vh",children:A.jsx("div",{className:"markdown-preview text-gray-900 dark:text-gray-100 [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-2 [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-2 [&_p]:mb-2 [&_p]:leading-relaxed [&_ul]:list-disc [&_ul]:ml-6 [&_ul]:mb-2 [&_ol]:list-decimal [&_ol]:ml-6 [&_ol]:mb-2 [&_li]:mb-1 [&_code]:bg-gray-100 [&_code]:dark:bg-gray-800 [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-sm [&_code]:font-mono [&_pre]:bg-gray-100 [&_pre]:dark:bg-gray-800 [&_pre]:p-3 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:mb-2 [&_blockquote]:border-l-4 [&_blockquote]:border-gray-300 [&_blockquote]:dark:border-gray-600 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:mb-2 [&_a]:text-blue-600 [&_a]:dark:text-blue-400 [&_a]:underline [&_strong]:font-bold [&_em]:italic [&_table]:w-full [&_table]:border-collapse [&_table]:mb-2 [&_th]:border [&_th]:border-gray-300 [&_th]:dark:border-gray-600 [&_th]:px-2 [&_th]:py-1 [&_th]:bg-gray-50 [&_th]:dark:bg-gray-700 [&_th]:font-semibold [&_td]:border [&_td]:border-gray-300 [&_td]:dark:border-gray-600 [&_td]:px-2 [&_td]:py-1 [&_hr]:my-4 [&_hr]:border-gray-300 [&_hr]:dark:border-gray-600",children:A.jsx(c1,{remarkPlugins:[d1],children:e||"*No content to preview*"})})})})]})},{Dragger:aD}=qe.Upload,iD=50*1024*1024,sD=({getFile:t,id:e,description:r,errorMessage:n=null,disabled:a=!1,defaultFile:i=null,acceptedFiles:s=null,isLoading:o=!1,asBase64:l=!1,toFileServer:u=!1,setFileUploading:c,fileUploading:d=!1,uploadToDocServer:f=!1,multiple:h=!1,getRealFileName:p=!1,onDelete:b,maxSize:y=iD,fileUploadService:m,systemMessages:v,toast:S})=>{const[E,T]=g.useState(null),[k,w]=g.useState([]),[O,C]=g.useState("#d9d9d9"),[_,N]=g.useState(!1),[R,D]=g.useState(null),P=async()=>{if(!m){console.warn("MultiFileUpload: File server upload requires fileUploadService");return}Promise.all(k.map(M=>{const V=new FormData;V.append("file",M);const F=Li({file_upload_path:f?"document-server":null,token:localStorage.getItem("token")});return m.uploadFileToFileServer(V,F)})).then(M=>{t(h?M?.map(V=>V?.fileUrl):M?.[0]?.fileUrl,p?E?.name:M?.[0]?.fileName),c?.(null),D(M?.[0])})},j={accept:s||"*",multiple:h,showUploadList:!1,disabled:a,onRemove:()=>{w([])},beforeUpload:(M,V)=>{if(M.size>y){const F=Math.round(y/1048576),B=v?.fileSizeLimit(String(F),"MB")||`File size must be less than ${F}MB`;return S?S.error(B,{toastId:B}):console.error(B),!1}return T(M),u?(c?.(e||"field-file-upload"),w(V)):(l?Promise.all((h?V:[M]).map(F=>new Promise(B=>{const W=new FileReader;W.onload=X=>{B({filename:F.name,content:X?.target?.result?.split(",")[1]})},W.readAsDataURL(F)}))).then(F=>{t(h?F:F[0])}):t(M),T(M)),!1}},z=async()=>{if(u&&R&&m){const M=Li({token:localStorage.getItem("token")});m.deleteFileFromFileServer(R?.fileName,M).then(()=>{D(null)})}T(null),w([]),t(""),b?.()};g.useEffect(()=>{i?.name&&T(i)},[i]),g.useEffect(()=>{C(n?"#EF4444":"#d9d9d9")},[n]),g.useEffect(()=>{k.length&&P()},[k]);const L=M=>M?M.length<=20?M:M.slice(0,14)+"...."+M.slice(-7):"";return A.jsxs("div",{children:[A.jsx("div",{className:"h-32",onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:A.jsx(aD,{...j,style:{borderColor:_&&!n?"#1890ff":O},disabled:a||d,children:E?A.jsxs("div",{className:"flex items-center justify-between mx-5",title:E?.name||i?.name,children:[A.jsxs("div",{className:"flex items-center justify-center gap-4",children:[E?.type==="application/pdf"?A.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:A.jsx(Dn.BsFiletypePdf,{size:20,fill:"#006CCF"})}):A.jsx("div",{className:"p-3 bg-[#E6F1FC] rounded-lg",children:A.jsx(ge.DescriptionRounded,{sx:{height:"20px",width:"20px",color:"#006CCF"}})}),A.jsxs("div",{className:"text-left",children:[A.jsx($,{size:"small",variant:"medium",className:"font-inter text-md font-medium text-base",children:L(E?.name||i?.name)}),d?A.jsx($,{size:"small",variant:"medium",appearance:"subtitle",children:"Uploading..."}):E?.size>0?A.jsxs($,{size:"small",variant:"medium",appearance:"subtitle",children:[(E.size/1e3).toFixed(2)," ","KB"]}):null]})]}),o?A.jsx(ka.CgSpinner,{size:40,className:"spinner text-primary-600"}):A.jsx("button",{id:"btn-file-upload",className:"ml-4",onClick:M=>{M.stopPropagation(),z()},disabled:a,children:A.jsx(Vs.FiTrash2,{size:20,fill:"#98A2B3"})})]}):A.jsx("div",{className:"flex items-center justify-center",children:A.jsxs("div",{className:"flex-col",children:[A.jsx("div",{className:"mb-4 flex justify-center",children:A.jsx(Vs.FiDownload,{size:24,fill:"#98A2B3"})}),A.jsxs("div",{children:[A.jsxs("div",{className:"flex items-center justify-center",children:[A.jsx($,{size:"small",variant:"medium",className:"text-primary-600 dark:text-primary-300",appearance:"custom",children:"Click to upload"}),A.jsx($,{size:"small",variant:"medium",className:"ml-1",appearance:"subtitle",children:"or drag and drop"})]}),r?A.jsx($,{size:"small",variant:"medium",appearance:"subtitle",children:r}):null]})]})})})}),n&&A.jsx($,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:n})]})},oD=Object.keys(Eu).filter(t=>t?.endsWith("Rounded")),AD=[...oD||[],...(U4||[]).map(t=>`flag-${t}`)],lD=t=>{if(t?.startsWith("flag-")){const e=t?.replace("flag-","");return Yg(e||"")||e}return t.replaceAll(/([A-Z])/g," $1").trim()},uD=({onChange:t,selectedIcon:e,setOpen:r})=>{const[n,a]=g.useState(""),i=(AD||[]).filter(o=>{if(o?.startsWith("flag-")){const l=o?.replace("flag-","");return l?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")||Yg(l||"")?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}return o?.trim()?.toLowerCase()?.includes(n?.trim()?.toLowerCase()||"")}),s=(o,l)=>{if(l.stopPropagation(),e===o){t?.(null);return}t?.(o),r?.(!1)};return A.jsxs("div",{className:"flex flex-col gap-3",onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),o.stopPropagation())},children:[A.jsx(Bg,{id:"input-field-icon-picker",placeholder:"Search icons...",onChange:o=>a(o||""),fieldSuffix:A.jsx(Eu.Search,{sx:{width:16,height:16,color:"rgb(152 162 179)"}})}),A.jsx(h4.FixedSizeGrid,{columnCount:5,rowCount:Math.ceil((i?.length||0)/5),columnWidth:40,rowHeight:40,width:220,height:240,children:({columnIndex:o,rowIndex:l,style:u})=>{const c=l*5+o,d=i?.[c];return d?A.jsx("div",{style:{...u,padding:"4px"},children:A.jsx(qe.Tooltip,{title:lD(d),placement:"bottom",children:A.jsx(p4.IconButton,{type:"button",className:U("flex items-center justify-center !rounded-md hover:bg-neutral-200 dark:hover:bg-black-700",{"!bg-primary-50 dark:!bg-black-800":e===d}),onClick:f=>s(d,f),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),f.stopPropagation())},children:A.jsx(Jg,{iconName:d,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"})})})}):null}})]})},Jg=({iconName:t,sx:e,className:r,isHovering:n})=>{if(t?.startsWith?.("flag-")){const i=t?.replace("flag-","");return co?.(i||"",n||!1)||A.jsx("div",{children:"-"})}const a=Eu?.[t];return a?A.jsx(a,{sx:e,className:r,isHovering:n}):A.jsx("div",{children:"-"})},cD=({selectedIcon:t,onChange:e,label:r,required:n=!1,allowClear:a=!0,disabled:i=!1,errorMessage:s})=>{const[o,l]=g.useState(!1),u=g.useRef(!1),c=g.useRef(null),d=g.useRef(!1);g.useEffect(()=>{d.current&&!o&&c.current?.focus(),d.current=o},[o]);const f=h=>{h.stopPropagation(),e?.("")};return A.jsx(qe.Popover,{arrow:!1,placement:"bottom",trigger:"click",getPopupContainer:h=>h?.parentElement||document.body,open:o,onOpenChange:h=>{h?(u.current&&l(!0),u.current=!1):l(!1)},content:A.jsx(uD,{onChange:e,selectedIcon:t,setOpen:l}),children:A.jsxs("div",{className:"flex flex-col gap-1",children:[r?A.jsx(Xt,{label:r||"",required:n||!1}):null,A.jsxs("button",{ref:c,type:"button",id:`btn-icon-picker-icon-${t?"selected":"unselected"}`,className:`lax-form-trigger min-w-[83px] py-1.5 px-3 rounded-md border ${i?"cursor-not-allowed opacity-60 bg-neutral-50 dark:bg-black-800":"bg-white dark:bg-black-800"} ${s?"border-red-500":"focus:border-primary-600 dark:focus:border-primary-400"} flex items-center justify-between gap-2`,disabled:i,onClick:h=>{if(i){h.preventDefault(),h.stopPropagation();return}h.detail>0&&(u.current=!0)},onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),o||h.currentTarget.closest("form")?.querySelector('button[type="submit"]')?.click())},children:[t?A.jsx(Jg,{iconName:t,sx:{width:20,height:20},className:"text-neutral-900 dark:text-white"}):A.jsx($,{size:"small",variant:"medium",appearance:"subtitle",children:"Select Icon"}),t&&a&&!i?A.jsx(Eu.CloseRounded,{sx:{width:20,height:20},className:"hover:bg-neutral-100 dark:hover:bg-black-800 rounded-full transition-colors cursor-pointer text-neutral-400 dark:text-neutral-500",onClick:f}):null]}),s&&A.jsx($,{size:"extra-small",className:"text-red-500 font-medium",children:s})]})})},dD=g.lazy(()=>Promise.resolve({default:t=>A.jsx(g.Suspense,{fallback:A.jsx("div",{className:"min-w-[83px] h-[30px] animate-pulse bg-neutral-100 dark:bg-black-800 rounded-md"}),children:A.jsx(cD,{...t})})})),a7=g.forwardRef(({status:t,children:e,className:r,size:n="medium","aria-label":a},i)=>{const s=()=>{switch(n){case"small":return"text-xs px-1.5 py-0.5";case"large":return"text-base px-3 py-1.5";default:return"text-md px-1.5 py-1"}},o=()=>{switch(t?.toLowerCase()){case"purple":return"bg-purple-50 text-purple-500 border border-purple-100 dark:bg-purple-950 dark:text-purple-400 dark:border-purple-800";case"blue":return"bg-blue-50 text-blue-500 border border-blue-100 dark:bg-blue-950 dark:text-blue-400 dark:border-blue-800";case"teal":return"bg-teal-50 text-teal-500 border border-teal-100 dark:bg-teal-950 dark:text-teal-400 dark:border-teal-800";case"green":return"bg-green-50 text-green-500 border border-green-100 dark:bg-green-950 dark:text-green-400 dark:border-green-800";case"yellow":return"bg-yellow-50 text-yellow-600 border border-yellow-100 dark:bg-yellow-950 dark:text-yellow-400 dark:border-yellow-800";case"orange":return"bg-orange-50 text-orange-500 border border-orange-100 dark:bg-orange-950 dark:text-orange-400 dark:border-orange-800";case"peach":return"bg-orange-50 text-orange-400 border border-orange-100 dark:bg-orange-950 dark:text-orange-300 dark:border-orange-800";case"red":return"bg-red-50 text-red-500 border border-red-100 dark:bg-red-950 dark:text-red-400 dark:border-red-800";case"navy":return"bg-navy-50 text-navy-700 border border-navy-100 dark:bg-navy-950 dark:text-navy-400 dark:border-navy-800";case"grey":return"bg-neutral-50 text-neutral-500 border border-neutral-100 dark:bg-neutral-950 dark:text-neutral-400 dark:border-neutral-800";default:return"bg-blue-50 text-blue-600 border border-blue-200 dark:bg-blue-950 dark:text-blue-400 dark:border-blue-800"}};return A.jsx("span",{ref:i,className:U("inline-flex items-center justify-center font-medium rounded-md transition-colors",s(),o(),r),"aria-label":a||`Status: ${t||"default"}`,role:"status",children:e})});a7.displayName="StatusColorMapping";const i7=g.forwardRef(({status:t="default",children:e,appearance:r="outline",size:n="md",className:a,isRounded:i=!1,capitalize:s=!0,"aria-label":o},l)=>{const u=p=>!p||!s?p:p.replace(/\w\S*/g,b=>b.charAt(0).toUpperCase()+b.substr(1).toLowerCase()),c=()=>{switch(n){case"sm":return"text-xs px-1.5 py-0.5";case"lg":return"text-sm px-3 py-1.5";default:return"text-xs px-2 py-1"}},d=()=>{switch(t){case"primary":case"default":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";case"warning":return"bg-yellow-50 dark:bg-yellow-950 text-yellow-600 dark:text-yellow-300 border border-yellow-300 dark:border-yellow-700";case"error":return"bg-red-50 dark:bg-red-950 text-red-600 dark:text-red-300 border border-red-300 dark:border-red-700";case"neutral":return"bg-neutral-50 dark:bg-neutral-950 text-neutral-600 dark:text-neutral-300 border border-neutral-300 dark:border-neutral-700";case"success":return"bg-green-50 dark:bg-green-950 text-green-600 dark:text-green-300 border border-green-300 dark:border-green-700";case"info":return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700";default:return"bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-300 border border-blue-300 dark:border-blue-700"}},f=()=>{switch(t){case"primary":case"default":return"bg-blue-600 dark:bg-blue-700 text-white";case"warning":return"bg-yellow-600 dark:bg-yellow-700 text-white";case"success":return"bg-green-600 dark:bg-green-700 text-white";case"error":return"bg-red-600 dark:bg-red-700 text-white";case"neutral":return"bg-neutral-600 dark:bg-neutral-700 text-white";case"info":return"bg-blue-600 dark:bg-blue-700 text-white";default:return"bg-blue-600 dark:bg-blue-700 text-white"}},h=()=>r==="filled"?f():d();return A.jsx("span",{ref:l,className:U("inline-flex items-center justify-center font-medium transition-colors",i?"rounded-full":"rounded",c(),h(),a),"aria-label":o||`Badge: ${t}`,role:"status",children:u(e)})});i7.displayName="Badge";const cs=({title:t,children:e})=>t?A.jsx(A.Fragment,{children:e}):null;cs.displayName="HelmetTitle";const eb=({children:t,className:e="",title:r,style:n,id:a})=>A.jsxs(A.Fragment,{children:[A.jsx(cs,{title:r}),A.jsx("div",{className:`bg-white dark:bg-black-800 border border-neutral-200 dark:border-black-600 rounded-lg shadow-100 w-full flex flex-col ${e}`,style:n,id:a,children:t})]});eb.displayName="Card";const Cu=({id:t,children:e,onClose:r,open:n,title:a,parentContainer:i="full-screen-container",resizable:s,width:o=400,placement:l="right",closable:u=!1,mask:c,classNames:d,styles:f,getContainer:h,zIndex:p,footer:b,...y})=>{const m=g.useRef(!1),[v,S]=g.useState(o);g.useEffect(()=>{S(o)},[n,o]);const E=g.useCallback(w=>{if(m.current)if(l==="right"){const O=document.body.offsetWidth-(w.clientX-document.body.offsetLeft);O>256&&S(O)}else w.clientX>256&&S(w.clientX)},[l,S]),T=g.useCallback(()=>{m.current&&(m.current=!1)},[]);g.useEffect(()=>(document.addEventListener("mousemove",E),document.addEventListener("mouseup",T),()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",T)}),[E,T]);const k=typeof window<"u"?document.getElementById(i)||document.body:null;return k?pn.createPortal(A.jsxs(qe.Drawer,{id:t||"",closable:u,title:a,onClose:r,open:n,width:v,getContainer:h!==void 0?h:!1,placement:l,mask:c,classNames:d,styles:f,zIndex:p,footer:b,...y,children:[s&&A.jsx("div",{className:"cursor-ew-resize w-1 pl-[2px] absolute top-0 bottom-0 z-[2100] bg-transparent dark:bg-black-600 hover:bg-neutral-200 dark:hover:bg-black-700",onMouseDown:()=>{m.current=!0},style:l==="right"?{left:0}:{right:0}}),e]}),k):null};Cu.displayName="Drawer";const fD=({children:t,showAsModal:e,...r})=>e?A.jsx(nn,{onCancel:r.onClose,...r,children:t}):A.jsx(Cu,{...r,children:t});function s7(t){const[e,r]=g.useState(void 0),n=g.useRef(null);return g.useEffect(()=>{if(t.current)return n.current=new ResizeObserver(a=>{if(a[0]){const{width:i,height:s}=a[0].contentRect;r({width:i,height:s})}}),n.current.observe(t.current),()=>{n.current&&n.current.disconnect()}},[t]),e}const hD=({tags:t,size:e="sm",className:r="",maxVisible:n,icon:a,title:i=null,truncate:s=void 0,noWrap:o=!1,fitContent:l=!1,trailingContent:u})=>{const c=g.useRef(null),d=s7(c),f=E=>{switch(E){case"xs":return 6.5;case"sm":return 6.5;case"md":return 7;case"lg":return 7;default:return 6.5}},h=E=>{switch(E){case"xs":return 16;case"sm":return 20;case"md":return 24;case"lg":return 28;default:return 20}},p=(E,T)=>{if(!E)return 0;const k=T&&E.length>T?E.slice(0,T)+"...":E,w=f(e),O=h(e),C=a?16:0;return k.length*w+O+C},b=g.useMemo(()=>{if(!d||!t?.length)return{visibleTags:t||[],hiddenTags:[],truncateMap:new Map};const E=d.width,T=8,k=p("+ XX more")+10;let w=t.map((D,P)=>({index:P,width:p(D.label,s)}));if(w.reduce((P,j)=>P+j.width,0)+(w.length-1)*T<=E)return{visibleTags:t,hiddenTags:[],truncateMap:new Map};let C=0,_=0;const N=new Map;for(let D=0;D<w.length;D++){const P=w[D].width,j=D>0?T:0,z=w.length-D-1,L=z>0;if(_+j+P+(L?T+k:0)>E){if(z===1){const V=w[D+1].width;if(_+j+P+T+V<=E){C=D+2;break}}if(D===0){const F=Math.floor((E-h(e)-(a?16:0)-T-k)/f(e))-3;F>=10?(N.set(0,Math.max(10,F)),C=1):(C=1,N.set(0,10))}break}if(_+=j+P,C++,!L)break}return C=Math.max(1,Math.min(C,t.length)),n&&(C=Math.min(C,n)),t.length-C===1&&C<t.length&&w.slice(0,C+1).reduce((P,j)=>P+j.width,0)+C*T<=E&&C++,{visibleTags:t.slice(0,C),hiddenTags:t.slice(C),truncateMap:N}},[d,t,e,a,n,s]),{visibleTags:y,hiddenTags:m,truncateMap:v}=b;if(!t||t.length===0)return"-";const S=()=>A.jsxs(A.Fragment,{children:[A.jsx("style",{children:`
|
|
81
81
|
.popover-tags-no-scrollbar {
|
|
82
82
|
scrollbar-width: none;
|
|
83
83
|
-ms-overflow-style: none;
|