@realtek/core-theme 0.0.369 → 0.0.371
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-lib/index.cjs +1 -1
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.js +1204 -528
- package/dist-lib/index.js.map +1 -1
- package/package.json +1 -1
package/dist-lib/index.cjs
CHANGED
|
@@ -53,5 +53,5 @@ Please contact the lead now.`}}},hA={lead_not_reviewed:{label:`Lead`,tone:`pink`
|
|
|
53
53
|
`)],{type:`text/csv`}));Object.assign(document.createElement(`a`),{href:n,download:`settings-change-history-${(0,m.default)().format(`YYYY-MM-DD`)}.csv`}).click(),URL.revokeObjectURL(n)},b=[{title:`#`,key:`n`,width:50,render:(e,t,n)=>n+1},{title:`Event / activity`,dataIndex:`action`,render:e=>(0,p.jsx)(uk,{tone:qA(e),icon:GA[KA(e)]?.icon,children:WA(e)})},{title:`Module`,key:`module`,render:(e,t)=>GA[KA(t.action)]?.label??`Settings`},{title:`Changed by`,key:`by`,render:(e,t)=>(0,p.jsxs)(`span`,{className:`cc-settings-who`,children:[(0,p.jsx)(dk,{name:ej(t)}),ej(t)]}),sorter:(e,t)=>ej(e).localeCompare(ej(t))},{title:`Date & time`,dataIndex:`at`,width:180,render:e=>(0,m.default)(e).format(`MMM D, YYYY, h:mm A`),sorter:(e,t)=>(0,m.default)(e.at).valueOf()-(0,m.default)(t.at).valueOf()},{title:`Details`,key:`details`,ellipsis:!0,render:(e,t)=>(0,p.jsx)(HA,{type:`secondary`,style:{fontSize:12},children:$A(t)})},{title:``,key:`view`,width:56,render:(e,t)=>(0,p.jsx)(d.Button,{size:`small`,type:`text`,icon:(0,p.jsx)(f.EyeOutlined,{}),"aria-label":`View ${WA(t.action)}`,onClick:()=>a(t)})}],x=l.filter(e=>(0,m.default)(e.at).isSame((0,m.default)(),`day`)).length,S=l.filter(e=>(0,m.default)(e.at).isAfter((0,m.default)().subtract(7,`day`))).length,C=i?ZA(i):[],w=i?QA(i.details):[];return(0,p.jsxs)(`div`,{className:`settings-section cc-settings-history`,style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr)`,gap:16},children:[(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,icon:(0,p.jsx)(f.InfoCircleOutlined,{}),message:`Sensitive values such as passwords and secret keys are never shown in history.`}),e.error?(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:e.error,action:(0,p.jsx)(d.Button,{size:`small`,onClick:s,children:`Retry`})}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(lk,{items:[{key:`all`,label:`Total changes`,value:l.length,sub:`${x} today · ${S} this week`,icon:(0,p.jsx)(f.HistoryOutlined,{}),tone:`pink`},...Object.entries(GA).map(([e,t])=>({key:e,label:t.label,value:v(e),icon:t.icon,tone:t.tone}))]}),(0,p.jsxs)(Y,{children:[(0,p.jsxs)(`div`,{className:`cc-settings-filters`,children:[(0,p.jsx)(d.Input,{allowClear:!0,prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search by event, person or module…`,value:n.q,onChange:e=>c(`q`)(e.target.value),style:{width:260,maxWidth:`100%`}}),(0,p.jsx)(d.Select,{value:n.module,onChange:c(`module`),style:{minWidth:170},"aria-label":`Module`,options:[{value:`all`,label:`All modules`},...Object.entries(GA).map(([e,t])=>({value:e,label:t.label}))]}),(0,p.jsx)(d.Select,{value:n.tone,onChange:c(`tone`),style:{minWidth:150},"aria-label":`Activity`,options:[{value:`all`,label:`All activities`},{value:`green`,label:`Added / tested / resumed`},{value:`blue`,label:`Changed`},{value:`amber`,label:`Paused / turned off`},{value:`violet`,label:`Rotated`},{value:`red`,label:`Deleted`}]}),(0,p.jsx)(d.Select,{value:n.user,onChange:c(`user`),style:{minWidth:150},"aria-label":`Changed by`,showSearch:!0,options:[{value:`all`,label:`All users`},...h.map(e=>({value:e,label:e}))]}),(0,p.jsx)(d.DatePicker.RangePicker,{value:n.range,onChange:c(`range`),format:`MMM D, YYYY`,allowClear:!0}),(0,p.jsx)(`span`,{style:{flex:1}}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:s,children:`Reload`}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.DownloadOutlined,{}),onClick:y,disabled:!_.length,children:`Export`})]}),(0,p.jsx)(d.Table,{rowKey:e=>String(e._id),size:`middle`,loading:e.loading,columns:b,dataSource:_,scroll:{x:960},onRow:e=>({onDoubleClick:()=>a(e)}),pagination:{pageSize:10,showSizeChanger:!0,pageSizeOptions:[10,20,50],showTotal:(e,[t,n])=>`Showing ${t}–${n} of ${e} changes`},locale:{emptyText:(0,p.jsx)(d.Empty,{description:l.length?`No change matches these filters.`:`No changes recorded yet.`})}})]})]}),(0,p.jsx)(d.Drawer,{title:`Change details`,open:!!i,onClose:()=>a(null),width:460,rootClassName:`cc-settings-drawer`,children:i?(0,p.jsxs)(`div`,{className:`cc-history-detail`,children:[(0,p.jsxs)(`div`,{className:`cc-history-detail__head`,children:[(0,p.jsx)(`span`,{className:`cc-settings-icon-tile`,"aria-hidden":`true`,children:GA[KA(i.action)]?.icon??(0,p.jsx)(f.HistoryOutlined,{})}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`cc-history-detail__title`,children:WA(i.action)}),(0,p.jsx)(HA,{type:`secondary`,children:$A(i)||`No further details were recorded.`})]})]}),(0,p.jsxs)(`dl`,{className:`cc-history-detail__facts`,children:[(0,p.jsx)(`dt`,{children:`Module`}),(0,p.jsx)(`dd`,{children:GA[KA(i.action)]?.label??`Settings`}),(0,p.jsx)(`dt`,{children:`Changed by`}),(0,p.jsx)(`dd`,{children:(0,p.jsxs)(`span`,{className:`cc-settings-who`,children:[(0,p.jsx)(dk,{name:ej(i)}),ej(i)]})}),(0,p.jsx)(`dt`,{children:`Date & time`}),(0,p.jsx)(`dd`,{children:(0,m.default)(i.at).format(`MMM D, YYYY, h:mm A`)}),i.target?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`dt`,{children:`Item`}),(0,p.jsx)(`dd`,{style:{wordBreak:`break-all`},children:i.target})]}):null]}),C.length?(0,p.jsxs)(`section`,{className:`cc-history-detail__changes`,children:[(0,p.jsxs)(`div`,{className:`cc-history-detail__section`,children:[(0,p.jsx)(f.SwapOutlined,{}),` Changes (`,C.length,` item`,C.length===1?``:`s`,`)`]}),C.map(e=>(0,p.jsxs)(`div`,{className:`cc-history-change`,children:[(0,p.jsx)(`div`,{className:`cc-history-change__label`,children:JA[e.field]??XA(e.field)}),(0,p.jsxs)(`div`,{className:`cc-history-change__row`,children:[(0,p.jsxs)(`div`,{className:`cc-history-change__from`,children:[(0,p.jsx)(`small`,{children:`Previous value`}),(0,p.jsx)(`strong`,{children:YA(e.field,e.from)})]}),(0,p.jsx)(f.ArrowRightOutlined,{"aria-label":`changed to`}),(0,p.jsxs)(`div`,{className:`cc-history-change__to`,children:[(0,p.jsx)(`small`,{children:`Current value`}),(0,p.jsx)(`strong`,{children:YA(e.field,e.to)})]})]})]},e.field))]}):null,w.length?(0,p.jsxs)(`section`,{className:`cc-history-detail__extra`,children:[(0,p.jsxs)(`div`,{className:`cc-history-detail__section`,children:[(0,p.jsx)(f.InfoCircleOutlined,{}),` Additional details`]}),(0,p.jsx)(`ul`,{children:w.map(([e,t])=>(0,p.jsxs)(`li`,{children:[XA(e),`: `,YA(e,t)]},e))})]}):null]}):null})]})}var{Text:nj}=d.Typography,rj=e=>e?.data?.error||e?.data?.message||e?.message||`Something went wrong`,ij=e=>Object.entries(e).map(([e,t])=>({value:e,label:t})),aj=e=>`…${String(e??``).slice(-6)}`,oj=e=>e.orgName||(e.isHead?`Franchise head`:`Franchise ${aj(e.businessUnitId)}`);function sj({userTypes:e=[]}){let t=(0,h.useNavigate)(),[n]=d.Form.useForm(),[r,i]=(0,u.useState)({loading:!0}),[a,o]=(0,u.useState)(0),[s,c]=(0,u.useState)(null),[l,m]=(0,u.useState)(!1),g=t=>e.find(e=>Number(e.value)===Number(t))?.label??t??`–`;(0,u.useEffect)(()=>{let e=!0;return Uk().then(t=>e&&i({loading:!1,...t}),t=>e&&i({loading:!1,error:t?.status===403?`Only the platform owner can manage franchises. You don't have permission to use this page. Ask your administrator to switch on Settings for your user type (Admin → User Types → Config).`:rj(t)})),()=>{e=!1}},[a]);let _=[...r.franchises??[]].sort((e,t)=>Number(t.isHead)-Number(e.isHead)||oj(e).localeCompare(oj(t))),v=d.Form.useWatch(`model`,n),y=e=>{let t=e.config??{};c(e),n.setFieldsValue({orgName:t.orgName||e.orgName,model:t.model||`CENTRAL`,paymentMode:t.paymentMode||`BANK_TRANSFER`,settlementCycle:t.settlementCycle||`MONTHLY`,commissionPct:(Number(t.commissionBps)||0)/100,platformFee:rA(t.platformFeePaise),liveClassFree:e.isHead?e.liveClasses?.free:t.liveClassFree??0,liveClassPaid:t.liveClassPaid??0,liveClassPrice:rA(t.liveClassPricePaise),linkedAccountId:t.linkedAccountId,notes:t.notes,otherCharges:(t.otherCharges??[]).map(e=>({label:e.label,amount:rA(e.amountPaise)}))})},b=async()=>{let e=await n.validateFields(),t={orgName:e.orgName??``,model:e.model,paymentMode:e.paymentMode,settlementCycle:e.settlementCycle,commissionBps:Math.round((Number(e.commissionPct)||0)*100),platformFeePaise:iA(e.platformFee),...s.isHead?{}:{liveClassFree:Number(e.liveClassFree)||0},liveClassPaid:Number(e.liveClassPaid)||0,liveClassPricePaise:iA(e.liveClassPrice),otherCharges:(e.otherCharges??[]).filter(e=>e?.label).map(e=>({label:e.label,amountPaise:iA(e.amount)})),linkedAccountId:e.linkedAccountId??``,notes:e.notes??``},r=e.orgName||oj(s);await pk({title:`Update franchise terms`,icon:(0,p.jsx)(f.AuditOutlined,{}),heading:`Update the terms of ${r}?`,text:`New terms apply to settlements recorded from now on. Past payments and settlements do not change.`,warning:`The organisation sees the new charges and payment method on its Payments page at once.`,okText:`Update terms`,onOk:async()=>{m(!0);try{await Rk(t,s.isOwn?{}:{businessUnitId:s.businessUnitId,businessId:s.businessId}),c(null),o(e=>e+1),mk({ok:!0,title:`Franchise terms updated`,heading:`Franchise terms updated`,text:`${r} now uses these terms.`,rows:[{key:`m`,icon:(0,p.jsx)(f.BankOutlined,{}),label:`Payment arrangement`,value:Yk[t.model]??t.model},{key:`c`,icon:(0,p.jsx)(f.PercentageOutlined,{}),label:`Commission`,value:`${t.commissionBps/100}%`},{key:`f`,icon:(0,p.jsx)(f.WalletOutlined,{}),label:`Platform fee per cycle`,value:aA(t.platformFeePaise)},{key:`b`,icon:(0,p.jsx)(f.CalendarOutlined,{}),label:`Billing cycle`,value:Jk[t.settlementCycle]??t.settlementCycle},{key:`p`,icon:(0,p.jsx)(f.SafetyCertificateOutlined,{}),label:`Payment method`,value:qk[t.paymentMode]??t.paymentMode}]})}catch(e){throw d.message.error(rj(e)),e}finally{m(!1)}}}).catch(()=>{})},[x,S]=(0,u.useState)(`all`),[C,w]=(0,u.useState)(``),[T,E]=(0,u.useState)(null),D=_.filter(e=>(x===`all`||x===`head`==!!e.isHead)&&(!C||oj(e).toLowerCase().includes(C.toLowerCase()))),O=_.reduce((e,t)=>({users:e.users+(Number(t.userCount)||0),free:e.free+(Number(t.liveClasses?.free)||0),paid:e.paid+(Number(t.liveClasses?.paid)||0)}),{users:0,free:0,paid:0}),k=e=>{let t=e.config??{},n=[];return Number(t.commissionBps)&&n.push(`Commission (${Number(t.commissionBps)/100}%)`),Number(e.perCyclePaise)&&n.push(`${aA(e.perCyclePaise)} / ${String(Jk[t.settlementCycle]??``).toLowerCase()}`),n.join(` + `)||(e.isHead?`Platform (own)`:`No charges set`)};return(0,p.jsxs)(`div`,{className:`settings-section cc-settings-franchises`,style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr)`,gap:16},children:[r.loading?(0,p.jsx)(Y,{children:(0,p.jsx)(d.Skeleton,{active:!0})}):r.error?(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:r.error,action:(0,p.jsx)(d.Button,{size:`small`,onClick:()=>{i({loading:!0}),o(e=>e+1)},children:`Retry`})}):(0,p.jsxs)(p.Fragment,{children:[r.platformOwnerConfigured?null:(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`No platform owner is set on the server yet, so every business unit counts as its own head. Set PLATFORM_OWNER_BUSINESS_UNIT_IDS to the head's business unit before adding franchises.`}),(0,p.jsx)(lk,{items:[{key:`o`,label:`Total organisations`,value:_.length,icon:(0,p.jsx)(f.ApartmentOutlined,{}),tone:`pink`},{key:`h`,label:`Head organisation`,value:_.filter(e=>e.isHead).length,icon:(0,p.jsx)(f.CrownOutlined,{}),tone:`violet`},{key:`f`,label:`Franchises`,value:_.filter(e=>!e.isHead).length,icon:(0,p.jsx)(f.ShopOutlined,{}),tone:`blue`},{key:`u`,label:`Total users`,value:O.users,icon:(0,p.jsx)(f.TeamOutlined,{}),tone:`green`},{key:`l`,label:`Total live-class allowance`,value:O.free+O.paid,sub:`Free: ${O.free} | Paid: ${O.paid}`,icon:(0,p.jsx)(f.VideoCameraOutlined,{}),tone:`amber`}]}),(0,p.jsxs)(Y,{children:[(0,p.jsxs)(`div`,{className:`cc-settings-filters`,children:[(0,p.jsx)(d.Segmented,{value:x,onChange:S,options:[{value:`all`,label:`All organisations (${_.length})`},{value:`head`,label:`Head organisation (${_.filter(e=>e.isHead).length})`},{value:`franchise`,label:`Franchises (${_.filter(e=>!e.isHead).length})`}]}),(0,p.jsx)(`span`,{style:{flex:1}}),(0,p.jsx)(d.Input,{allowClear:!0,prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search by organisation name…`,value:C,onChange:e=>w(e.target.value),style:{width:260,maxWidth:`100%`}}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:()=>{i({loading:!0}),o(e=>e+1)},children:`Reload`})]}),(0,p.jsx)(d.Table,{rowKey:`businessUnitId`,size:`middle`,columns:[{title:`Organisation name`,key:`org`,width:250,render:(e,t)=>(0,p.jsxs)(d.Space,{size:10,children:[(0,p.jsx)(`span`,{className:`cc-settings-provider-icon`,"aria-hidden":`true`,children:t.isHead?(0,p.jsx)(f.CrownOutlined,{}):(0,p.jsx)(f.ShopOutlined,{})}),(0,p.jsxs)(d.Space,{direction:`vertical`,size:0,children:[(0,p.jsx)(nj,{strong:!0,children:oj(t)}),(0,p.jsxs)(nj,{type:`secondary`,style:{fontSize:12},children:[`Business unit `,aj(t.businessUnitId),t.isOwn?` · you`:``]})]})]}),sorter:(e,t)=>oj(e).localeCompare(oj(t))},{title:`Status`,key:`status`,width:120,render:(e,t)=>t.configured||t.isHead?(0,p.jsx)(uk,{tone:`green`,children:`Active`}):(0,p.jsx)(uk,{tone:`amber`,children:`Terms not set`})},{title:`Type`,key:`type`,width:170,render:(e,t)=>t.isHead?(0,p.jsx)(uk,{tone:`violet`,children:`Head organisation`}):(0,p.jsx)(uk,{tone:`blue`,children:`Franchise`})},{title:`Plan`,key:`plan`,width:190,render:(e,t)=>(0,p.jsxs)(d.Space,{direction:`vertical`,size:0,children:[(0,p.jsx)(nj,{children:Yk[t.config?.model]??t.config?.model}),(0,p.jsx)(nj,{type:`secondary`,style:{fontSize:12},children:qk[t.config?.paymentMode]??`–`})]})},{title:`Users`,dataIndex:`userCount`,width:90,align:`right`,render:e=>(0,p.jsxs)(d.Space,{size:4,children:[(0,p.jsx)(f.TeamOutlined,{}),e??0]}),sorter:(e,t)=>(e.userCount??0)-(t.userCount??0)},{title:`Billing arrangement`,key:`billing`,width:220,render:(e,t)=>k(t)},{title:`Live-class allowance`,key:`live`,width:210,render:(e,t)=>(0,p.jsxs)(d.Space,{direction:`vertical`,size:0,children:[(0,p.jsxs)(nj,{strong:!0,children:[(0,p.jsx)(f.VideoCameraOutlined,{}),` `,t.liveClasses?.limit??0]}),(0,p.jsxs)(nj,{type:`secondary`,style:{fontSize:12},children:[`(Free: `,t.liveClasses?.free??0,` | Paid: `,t.liveClasses?.paid??0,`) · `,t.liveClassesInUse??0,` in use`]})]})},{title:`Actions`,key:`act`,width:150,fixed:`right`,render:(e,n)=>(0,p.jsxs)(d.Space,{size:4,children:[(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.EyeOutlined,{}),onClick:()=>E(n),children:`View`}),(0,p.jsx)(d.Dropdown,{trigger:[`click`],menu:{items:[{key:`edit`,icon:(0,p.jsx)(f.EditOutlined,{}),label:`Edit terms`,onClick:()=>y(n)},{key:`statement`,icon:(0,p.jsx)(f.FileTextOutlined,{}),label:`View statement`,onClick:()=>t(`?section=payments${n.isOwn?``:`&businessUnitId=${n.businessUnitId}&businessId=${n.businessId}`}`)}]},children:(0,p.jsx)(d.Button,{size:`small`,type:`text`,icon:(0,p.jsx)(f.MoreOutlined,{}),"aria-label":`More for ${oj(n)}`})})]})}],dataSource:D,pagination:{pageSize:10,hideOnSinglePage:!0},scroll:{x:1400},locale:{emptyText:(0,p.jsx)(d.Empty,{description:`No organisation matches.`})}})]})]}),(0,p.jsx)(d.Drawer,{title:T?oj(T):``,open:!!T,onClose:()=>E(null),width:620,rootClassName:`cc-settings-drawer`,extra:T?(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>{let e=T;E(null),y(e)},children:`Edit terms`}):null,children:T?(0,p.jsx)(d.Tabs,{items:[{key:`overview`,label:`Overview`,children:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(d.Space,{wrap:!0,style:{margin:`4px 0 12px`},children:[T.isHead?(0,p.jsx)(uk,{tone:`violet`,children:`Head organisation`}):(0,p.jsx)(uk,{tone:`blue`,children:`Franchise`}),(0,p.jsx)(uk,{tone:`green`,children:`Active`})]}),(0,p.jsx)(lk,{items:[{key:`u`,label:`Users`,value:T.userCount??0,icon:(0,p.jsx)(f.TeamOutlined,{}),tone:`green`},{key:`l`,label:`Live classes in use`,value:`${T.liveClassesInUse??0} / ${T.liveClasses?.limit??0}`,icon:(0,p.jsx)(f.VideoCameraOutlined,{}),tone:`amber`}]}),(0,p.jsx)(d.Descriptions,{size:`small`,column:1,bordered:!0,items:[{key:`m`,label:`Payment arrangement`,children:Yk[T.config?.model]??T.config?.model},{key:`p`,label:`Fixed payment method`,children:qk[T.config?.paymentMode]??`–`},{key:`b`,label:`Billing cycle`,children:Jk[T.config?.settlementCycle]??`–`},{key:`c`,label:`Commission`,children:`${(Number(T.config?.commissionBps)||0)/100}%`},{key:`f`,label:`Platform fee per cycle`,children:aA(T.config?.platformFeePaise)},{key:`t`,label:`Total charges per cycle`,children:(0,p.jsx)(nj,{strong:!0,children:aA(T.perCyclePaise)})},{key:`l`,label:`Live classes`,children:`Free ${T.liveClasses?.free??0} · Paid ${T.liveClasses?.paid??0} at ${aA(T.config?.liveClassPricePaise)} each`},...(T.charges??[]).length?[{key:`ch`,label:`Charges per cycle`,children:(T.charges??[]).map(e=>`${e.label}: ${aA(e.amountPaise)}`).join(` · `)}]:[],...T.config?.notes?[{key:`n`,label:`Agreement`,children:T.config.notes}]:[]]})]})},{key:`users`,label:`Users (${T.userCount??0})`,children:(0,p.jsx)(d.Table,{size:`small`,rowKey:e=>String(e._id),pagination:(T.users??[]).length>10&&{pageSize:10},dataSource:T.users??[],locale:{emptyText:(0,p.jsx)(d.Empty,{description:`No users yet.`})},columns:[{title:`Name`,key:`name`,render:(e,t)=>(0,p.jsxs)(d.Space,{size:8,children:[(0,p.jsx)(dk,{name:[t.firstName,t.lastName].filter(Boolean).join(` `)}),[t.firstName,t.lastName].filter(Boolean).join(` `)||`–`]})},{title:`Email`,dataIndex:`email`},{title:`User type`,dataIndex:`roleId`,render:g},{title:`Status`,dataIndex:`activeStatus`,render:e=>e===!1?(0,p.jsx)(uk,{tone:`grey`,children:`Inactive`}):(0,p.jsx)(uk,{tone:`green`,children:`Active`})}]})}]}):null}),(0,p.jsx)(d.Drawer,{rootClassName:`cc-settings-drawer`,title:s?`Edit ${oj(s)}`:``,open:!!s,onClose:()=>c(null),width:560,destroyOnClose:!0,extra:(0,p.jsx)(d.Button,{type:`primary`,loading:l,onClick:b,children:`Save`}),children:(0,p.jsxs)(d.Form,{form:n,layout:`vertical`,requiredMark:`optional`,children:[(0,p.jsx)(d.Form.Item,{name:`orgName`,label:`Organisation name`,extra:`Shown in the header after sign-in for this organisation's users.`,rules:[{max:120}],children:(0,p.jsx)(d.Input,{placeholder:`e.g. BFSI and IT`})}),(0,p.jsxs)(d.Row,{gutter:12,children:[(0,p.jsx)(d.Col,{xs:24,sm:12,children:(0,p.jsx)(d.Form.Item,{name:`model`,label:`Collection model`,rules:[{required:!0}],children:(0,p.jsx)(d.Select,{options:ij(Yk)})})}),(0,p.jsx)(d.Col,{xs:24,sm:12,children:(0,p.jsx)(d.Form.Item,{name:`paymentMode`,label:`Payment mode (fixed)`,rules:[{required:!0}],extra:`The franchise pays only by this mode.`,children:(0,p.jsx)(d.Select,{options:ij(qk)})})}),(0,p.jsx)(d.Col,{xs:24,sm:12,children:(0,p.jsx)(d.Form.Item,{name:`settlementCycle`,label:`Billing cycle`,rules:[{required:!0}],children:(0,p.jsx)(d.Select,{options:ij(Jk)})})}),(0,p.jsx)(d.Col,{xs:24,sm:12,children:(0,p.jsx)(d.Form.Item,{name:`commissionPct`,label:`Commission on student payments`,rules:[{required:!0}],children:(0,p.jsx)(d.InputNumber,{min:0,max:100,step:.5,precision:2,addonAfter:`%`,style:{width:`100%`}})})}),(0,p.jsx)(d.Col,{xs:24,sm:12,children:(0,p.jsx)(d.Form.Item,{name:`platformFee`,label:`Platform fee per cycle`,children:(0,p.jsx)(d.InputNumber,{min:0,precision:2,addonBefore:`₹`,style:{width:`100%`}})})}),v===`SPLIT`?(0,p.jsx)(d.Col,{xs:24,sm:12,children:(0,p.jsx)(d.Form.Item,{name:`linkedAccountId`,label:`Razorpay Route linked account`,rules:[{required:!0,pattern:/^acc_[A-Za-z0-9]{8,32}$/,message:`acc_… from Razorpay Route`}],children:(0,p.jsx)(d.Input,{placeholder:`acc_XXXXXXXXXXXX`})})}):null]}),(0,p.jsx)(nj,{strong:!0,children:`Live classes at a time`}),(0,p.jsxs)(d.Row,{gutter:12,style:{marginTop:8},children:[(0,p.jsx)(d.Col,{xs:24,sm:8,children:(0,p.jsx)(d.Form.Item,{name:`liveClassFree`,label:`Free`,extra:s?.isHead?`What is left of the free pool.`:`Out of the ${r.freePool??5} free.`,children:(0,p.jsx)(d.InputNumber,{min:0,max:r.freePool??5,disabled:s?.isHead,style:{width:`100%`}})})}),(0,p.jsx)(d.Col,{xs:24,sm:8,children:(0,p.jsx)(d.Form.Item,{name:`liveClassPaid`,label:`Paid`,children:(0,p.jsx)(d.InputNumber,{min:0,max:1e3,style:{width:`100%`}})})}),(0,p.jsx)(d.Col,{xs:24,sm:8,children:(0,p.jsx)(d.Form.Item,{name:`liveClassPrice`,label:`Price each`,extra:`Per paid class, per cycle.`,children:(0,p.jsx)(d.InputNumber,{min:0,precision:2,addonBefore:`₹`,style:{width:`100%`}})})})]}),(0,p.jsx)(nj,{strong:!0,children:`Other charges per cycle`}),(0,p.jsx)(d.Form.List,{name:`otherCharges`,children:(e,{add:t,remove:n})=>(0,p.jsxs)(`div`,{style:{marginTop:8},children:[e.map(({key:e,name:t})=>(0,p.jsxs)(d.Space,{align:`start`,style:{display:`flex`},children:[(0,p.jsx)(d.Form.Item,{name:[t,`label`],rules:[{required:!0,message:`Label`},{max:80}],children:(0,p.jsx)(d.Input,{placeholder:`e.g. Support fee`})}),(0,p.jsx)(d.Form.Item,{name:[t,`amount`],rules:[{required:!0,message:`Amount`}],children:(0,p.jsx)(d.InputNumber,{min:0,precision:2,addonBefore:`₹`})}),(0,p.jsx)(d.Button,{type:`text`,"aria-label":`Remove charge`,icon:(0,p.jsx)(f.DeleteOutlined,{}),onClick:()=>n(t)})]},e)),(0,p.jsx)(d.Button,{type:`dashed`,icon:(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>t({label:``,amount:0}),disabled:e.length>=20,children:`Add charge`})]})}),(0,p.jsx)(d.Form.Item,{name:`notes`,label:`Agreement notes`,style:{marginTop:16},children:(0,p.jsx)(d.Input.TextArea,{rows:2,maxLength:1e3})})]})})]})}var{Text:cj}=d.Typography,lj=e=>e?.data?.error||e?.data?.message||e?.message||`Something went wrong`;function uj(){let[e,t]=(0,u.useState)({loading:!0}),[n,r]=(0,u.useState)(0),[i,a]=(0,u.useState)(null),[o,s]=(0,u.useState)(0),[c,l]=(0,u.useState)(!1);(0,u.useEffect)(()=>{let e=!0;return Wk().then(n=>e&&t({loading:!1,...n}),n=>e&&t({loading:!1,error:n?.status===403?`You don't have permission to use this page. Ask your administrator to switch on Settings for your user type (Admin → User Types → Config).`:lj(n)})),()=>{e=!1}},[n]);let h=()=>{t({loading:!0}),r(e=>e+1)},g=e.allowance??{},_=Number(e.inUse)||0,v=Number(g.limit)||0,y=Math.max(v-_,0),b=Array.isArray(e.franchises)?e.franchises:null,x=Number(g.givenOut)||0,S=Number(g.pool)||5,C=async()=>{l(!0);try{await Gk(i.businessUnitId,Number(o)),d.message.success(`Free live classes saved`),a(null),h()}catch(e){d.message.error(lj(e))}finally{l(!1)}};if(e.loading)return(0,p.jsx)(Y,{children:(0,p.jsx)(d.Skeleton,{active:!0})});if(e.error)return(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:e.error,action:(0,p.jsx)(d.Button,{size:`small`,onClick:h,children:`Retry`})});let w=[{title:`Batch`,dataIndex:`batchName`,render:(e,t)=>(0,p.jsxs)(d.Space,{direction:`vertical`,size:0,children:[(0,p.jsx)(cj,{strong:!0,children:e||`Batch`}),(0,p.jsxs)(cj,{type:`secondary`,style:{fontSize:12},children:[`Session `,t.sessionKey]})]})},{title:`Started at`,dataIndex:`startedAt`,render:e=>e?(0,m.default)(e).format(`h:mm A`):`–`},{title:`Ends`,dataIndex:`endsAt`,render:e=>e?(0,m.default)(e).format(`h:mm A`):`–`},{title:`Duration`,key:`dur`,render:(e,t)=>t.startedAt&&t.endsAt?`${Math.max(0,(0,m.default)(t.endsAt).diff((0,m.default)(t.startedAt),`minute`))} min`:`–`},{title:`Slot status`,key:`st`,render:()=>(0,p.jsx)(uk,{tone:`green`,icon:(0,p.jsx)(f.CheckCircleFilled,{}),children:`In use`})},{title:`Platform`,key:`pl`,render:()=>`In-app live`}],T=e=>v?Math.round(e/v*100):0;return(0,p.jsxs)(`div`,{className:`settings-section cc-settings-live`,style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr)`,gap:16},children:[(0,p.jsx)(`div`,{className:`cc-settings-toolbar`,style:{marginBottom:0,justifyContent:`flex-end`},children:(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:h,children:`Reload`})}),(0,p.jsx)(lk,{items:[{key:`total`,label:`Total allowed live classes`,value:v,icon:(0,p.jsx)(f.VideoCameraOutlined,{}),tone:`pink`},{key:`run`,label:`Currently running`,value:_,icon:(0,p.jsx)(f.PlayCircleOutlined,{}),tone:`green`},{key:`avail`,label:`Available slots`,value:y,icon:(0,p.jsx)(f.CalendarOutlined,{}),tone:y?`blue`:`red`},{key:`free`,label:`Free live classes`,value:Number(g.free)||0,sub:g.isHead?`${x} shared with franchises`:`Given by the franchise head`,icon:(0,p.jsx)(f.GiftOutlined,{}),tone:`amber`},{key:`paid`,label:`Paid live classes`,value:Number(g.paid)||0,sub:Number(g.pricePaise)?`${aA(g.pricePaise)} each per ${String(Jk[g.billingCycle]??`billing`).toLowerCase()} cycle`:`Set in Franchise Management`,icon:(0,p.jsx)(f.CrownOutlined,{}),tone:`violet`}]}),(0,p.jsxs)(`div`,{className:`cc-live-banner${y?``:` is-full`}`,children:[(0,p.jsxs)(`span`,{children:[(0,p.jsx)(f.InfoCircleOutlined,{}),` Classes using external meeting links are not counted toward in-app live class limits.`]}),(0,p.jsxs)(`span`,{className:`cc-live-banner__state`,children:[y?(0,p.jsx)(f.CheckCircleFilled,{}):(0,p.jsx)(f.WarningFilled,{}),(0,p.jsxs)(`span`,{children:[(0,p.jsxs)(`strong`,{children:[y,` slot`,y===1?``:`s`,` available`]}),(0,p.jsx)(`br`,{}),(0,p.jsx)(`small`,{children:v===0?`No live classes allowed`:y?`Limit healthy`:`Limit reached`})]})]})]}),v===0||!y?(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:v===0?`No live classes are available for your organisation.`:`All live class slots are in use.`,description:`A new in-app class cannot start until a slot frees up. Contact your admin to increase the live classes count.`}):null,(0,p.jsxs)(d.Row,{gutter:[16,16],children:[(0,p.jsx)(d.Col,{xs:24,xl:16,children:(0,p.jsxs)(Y,{children:[(0,p.jsxs)(cj,{strong:!0,style:{fontSize:15},children:[(0,p.jsx)(f.PlayCircleOutlined,{}),` Currently running classes`]}),(0,p.jsx)(d.Table,{style:{marginTop:10},scroll:{x:`max-content`},size:`middle`,rowKey:e=>String(e._id),pagination:!1,dataSource:e.running??[],locale:{emptyText:(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:`No live class is running right now.`})},columns:w})]})}),(0,p.jsxs)(d.Col,{xs:24,xl:8,children:[(0,p.jsxs)(Y,{children:[(0,p.jsx)(cj,{strong:!0,style:{fontSize:15},children:`Slot usage summary`}),(0,p.jsxs)(`div`,{className:`cc-live-usage`,children:[(0,p.jsx)(`span`,{children:`Total slots`}),(0,p.jsx)(d.Progress,{percent:100,showInfo:!1,size:`small`}),(0,p.jsx)(`strong`,{children:v}),(0,p.jsx)(`span`,{children:`Running`}),(0,p.jsx)(d.Progress,{percent:T(_),showInfo:!1,size:`small`}),(0,p.jsx)(`strong`,{children:_}),(0,p.jsx)(`span`,{children:`Available`}),(0,p.jsx)(d.Progress,{percent:T(y),showInfo:!1,size:`small`}),(0,p.jsx)(`strong`,{children:y})]}),(0,p.jsxs)(cj,{type:`secondary`,style:{fontSize:12},children:[_,` / `,v,` in use now`]})]}),(0,p.jsxs)(Y,{style:{marginTop:16},children:[(0,p.jsx)(cj,{strong:!0,style:{fontSize:15},children:`Quick notes`}),(0,p.jsxs)(`ul`,{className:`cc-live-notes`,children:[(0,p.jsx)(`li`,{children:`Increase the allowance before starting more in-app classes once the limit is reached.`}),(0,p.jsx)(`li`,{children:`Free and paid live classes count together toward the limit.`}),(0,p.jsx)(`li`,{children:`External meeting links do not use live-class slots.`})]})]})]})]}),b?(0,p.jsxs)(Y,{children:[(0,p.jsxs)(`div`,{className:`cc-settings-toolbar`,children:[(0,p.jsxs)(cj,{strong:!0,style:{fontSize:15},children:[(0,p.jsx)(f.ShareAltOutlined,{}),` Free live class allocation`]}),(0,p.jsxs)(cj,{type:`secondary`,children:[S,` free classes · `,x,` shared with franchises · `,Number(g.free)||0,` kept by the head`]})]}),(0,p.jsx)(d.Progress,{percent:Math.round(x/S*100),success:{percent:0},format:()=>`${x} / ${S} shared`}),(0,p.jsx)(d.Table,{style:{marginTop:12},size:`middle`,scroll:{x:`max-content`},rowKey:`businessUnitId`,pagination:!1,dataSource:b,locale:{emptyText:(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:`No franchises yet.`})},columns:[{title:`Franchise`,key:`name`,render:(e,t)=>t.orgName||(0,p.jsxs)(cj,{type:`secondary`,children:[`Business unit …`,String(t.businessUnitId).slice(-6)]})},{title:`Free`,key:`free`,align:`right`,render:(e,t)=>t.liveClasses?.free??0},{title:`Paid`,key:`paid`,align:`right`,render:(e,t)=>t.liveClasses?.paid??0},{title:`At a time`,key:`limit`,align:`right`,render:(e,t)=>(0,p.jsx)(uk,{tone:`pink`,children:t.liveClasses?.limit??0})},{title:``,key:`act`,width:100,render:(e,t)=>(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>{a(t),s(t.liveClasses?.free??0)},children:`Edit`})}]})]}):null,(0,p.jsx)(d.Modal,{title:`Edit live class allocation`,open:!!i,centered:!0,rootClassName:`cc-settings-dialog`,onCancel:()=>a(null),onOk:C,okText:`Save allocation`,confirmLoading:c,okButtonProps:{disabled:i&&Number(o)===Number(i.liveClasses?.free??0)},children:i?(0,p.jsxs)(`div`,{className:`cc-settings-dialog__body`,children:[(0,p.jsx)(`span`,{className:`cc-settings-dialog__art`,"aria-hidden":`true`,children:(0,p.jsx)(f.GiftOutlined,{})}),(0,p.jsx)(`div`,{className:`cc-settings-dialog__heading`,children:i.orgName||`Franchise`}),(0,p.jsxs)(`div`,{className:`cc-settings-dialog__text`,children:[`Free live classes this franchise may run at the same time. `,S-x+(i.liveClasses?.free??0),` of the `,S,` free classes can still be given.`]}),(0,p.jsx)(d.InputNumber,{style:{marginTop:14,width:160},min:0,max:S,value:o,onChange:e=>s(e??0),"aria-label":`Free live classes`}),(0,p.jsx)(`div`,{className:`cc-settings-dialog__warning`,children:(0,p.jsx)(`span`,{children:`Paid classes and their price are set in Franchise Management.`})})]}):null})]})}var dj=`cc-settings-home-tip-hidden`,fj={payments:()=>Lk({}).then(e=>[`${Jk[e?.config?.settlementCycle]??`Monthly`} billing`,e?.perCyclePaise?`${aA(e.perCyclePaise)} per cycle`:`No fixed charges`]),reminders:()=>Xk().then(e=>{let t=e?.rules??[],n=t.filter(e=>e.active).length;return{ok:n>0,parts:[`${n} active`,`${t.length-n} paused`]}}),credentials:()=>Sk().then(e=>{let t=e?.providers??[],n=t.filter(e=>e.credential?.active).length;return{ok:n>0,parts:[`${n} active`,`${t.filter(e=>!e.credential).length} not configured`]}}),mappings:()=>c.r().then(e=>({ok:!0,parts:[e?.settings?.mode===`equal_daily`?`Equal daily distribution`:`Round-robin distribution`]})),"live-classes":()=>Wk().then(e=>{let t=Number(e?.allowance?.limit)||0,n=Number(e?.inUse)||0;return{ok:t>n,parts:[`${n} running`,`${Math.max(t-n,0)} available`]}}),franchises:()=>Uk().then(e=>[`${(e?.franchises??[]).length} organisations`]),history:()=>xk().then(e=>{let t=Date.now()-2592e6;return[`${(e??[]).filter(e=>new Date(e.at).getTime()>=t).length} changes (last 30 days)`]})},pj={payments:`View statements, charges, commission and settlements.`,reminders:`Set up and manage automated reminders and admin alerts.`,credentials:`Manage service accounts for Email, SMS / Calling, Payments and Lead Ads.`,mappings:`Facebook course mapping, counsellor distribution and lead flow.`,"live-classes":`View and manage in-app live class limits, usage and allocations.`,franchises:`View franchises and manage their business and payment terms.`,history:`See every change made to settings, with who, when and what.`,users:`Users, user types and what each user type may see and do.`};function mj(e){let[t,n]=(0,u.useState)({loading:!!fj[e]});return(0,u.useEffect)(()=>{if(!fj[e])return;let t=!0;return Promise.resolve().then(fj[e]).then(e=>t&&n({loading:!1,...Array.isArray(e)?{parts:e}:e}),()=>t&&n({loading:!1})),()=>{t=!1}},[e]),t}function hj({section:e,onOpen:t}){let n=mj(e.key);return(0,p.jsxs)(`div`,{className:`cc-settings-home__card`,"data-section":e.key,children:[(0,p.jsx)(`span`,{className:`cc-settings-icon-tile`,"aria-hidden":`true`,children:e.icon}),(0,p.jsxs)(`div`,{style:{minWidth:0},children:[(0,p.jsx)(`div`,{className:`cc-settings-home__title`,children:e.label}),(0,p.jsx)(`div`,{className:`cc-settings-home__text`,children:pj[e.key]}),n.loading?(0,p.jsx)(d.Skeleton.Input,{active:!0,size:`small`,style:{width:160,height:18}}):n.parts?.length?(0,p.jsxs)(`div`,{className:`cc-settings-home__status`,children:[n.ok?(0,p.jsx)(f.CheckCircleFilled,{"aria-hidden":`true`}):null,n.parts.map((e,t)=>(0,p.jsxs)(`span`,{children:[t>0?(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{opacity:.4,marginRight:10},children:`|`}):null,e]},e))]}):null]}),(0,p.jsxs)(d.Button,{className:`cc-settings-home__open`,onClick:()=>t(e.key),"aria-label":`Open ${e.label}`,children:[`Open `,(0,p.jsx)(f.ArrowRightOutlined,{})]})]})}function gj({sections:e,onOpen:t}){let[n,r]=(0,u.useState)(()=>{try{return localStorage.getItem(dj)===`1`}catch{return!1}});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ck,{icon:(0,p.jsx)(f.SettingOutlined,{}),title:`Settings`,crumbs:[],subtitle:`Manage your organisation's payments, reminders, service connections, live-class limits and franchise settings.`}),n?null:(0,p.jsx)(d.Alert,{className:`cc-settings-home__tip`,type:`info`,showIcon:!0,closable:!0,onClose:()=>{r(!0);try{localStorage.setItem(dj,`1`)}catch{}},message:`Tip: you can manage the following settings. The options you see depend on your user type and permissions.`}),(0,p.jsx)(`div`,{className:`cc-settings-home__grid`,children:e.map(e=>(0,p.jsx)(hj,{section:e,onOpen:t},e.key))})]})}var _j=(0,u.lazy)(()=>Promise.resolve().then(()=>require("./FacebookCourseMappingsSection-AYu5JiEt.cjs")).then(e=>e.n)),vj=(0,u.lazy)(()=>Promise.resolve().then(()=>fC)),{Title:yj}=d.Typography,bj=[{key:`mappings`,label:`Mapping & Distributions`,icon:(0,p.jsx)(f.BranchesOutlined,{}),subtitle:`Facebook form course mapping, counsellor distribution and lead flow.`},{key:`credentials`,label:`Credentials`,icon:(0,p.jsx)(f.KeyOutlined,{}),subtitle:`Service accounts for Email, SMS / Calling / WhatsApp, Payments and Lead Ads.`},{key:`reminders`,label:`Reminders`,icon:(0,p.jsx)(f.BellOutlined,{}),subtitle:`Automated reminders and admin alerts for leads, classes and services.`},{key:`payments`,label:`Payments`,icon:(0,p.jsx)(f.WalletOutlined,{}),subtitle:`Payment arrangement, collections, charges and the final payable or receivable amount.`},{key:`live-classes`,label:`Live Class Manager`,icon:(0,p.jsx)(f.VideoCameraOutlined,{}),subtitle:`In-app live class capacity, running classes and available slots.`},{key:`franchises`,label:`Franchise Management`,icon:(0,p.jsx)(f.ShopOutlined,{}),ownerOnly:!0,subtitle:`The platform organisation and its franchises: plans, billing and live-class allowance.`},{key:`history`,label:`Change History`,icon:(0,p.jsx)(f.HistoryOutlined,{}),subtitle:`Every change made to settings, payments, reminders and providers.`},{key:`users`,label:`Users & User Types`,icon:(0,p.jsx)(f.TeamOutlined,{}),subtitle:`People who use the system, their user types and what each type may do.`}],xj=[{value:`users`,label:`User List`},{value:`roles`,label:`User Types & Permissions`}];function Sj(){let[e,t]=(0,h.useSearchParams)(),n=d.Grid.useBreakpoint().md!==!1,[r,i]=(0,u.useState)([]),[a,o]=(0,u.useState)(!1),s=bj.filter(e=>!e.ownerOnly||a).map(({ownerOnly:e,subtitle:t,...n})=>n),c=e.get(`section`),l=e.get(`view`)===`roles`?`roles`:`users`,f=bj.some(e=>e.key===c)&&(c!==`franchises`||a)?c:``,m=bj.find(e=>e.key===f);(0,u.useEffect)(()=>{let e=!0;return bk().then(t=>e&&o(!!t?.isPlatformOwner),()=>{}),()=>{e=!1}},[]),(0,u.useEffect)(()=>{if(f!==`reminders`&&f!==`franchises`)return;let e=!0;return Rh().then(t=>e&&i((t??[]).map(e=>({value:Number(e.user_type_id),label:e.user_type_name}))),()=>{}),()=>{e=!1}},[f]);let g=e=>t(t=>{let n=new URLSearchParams(t);return e?n.set(`section`,e):n.delete(`section`),[`view`,`businessUnitId`,`businessId`].forEach(e=>n.delete(e)),n});if(!f)return(0,p.jsx)(`div`,{className:`cc-settings-page`,style:{padding:n?24:16},children:(0,p.jsx)(gj,{sections:bj.filter(e=>!e.ownerOnly||a),isOwner:a,onOpen:g})});let _={payments:(0,p.jsx)(dA,{}),reminders:(0,p.jsx)(CA,{userTypes:r}),credentials:(0,p.jsx)(VA,{}),"live-classes":(0,p.jsx)(uj,{}),franchises:(0,p.jsx)(sj,{userTypes:r}),mappings:(0,p.jsx)(`div`,{className:`settings-section cc-settings-mappings`,children:(0,p.jsx)(Y,{children:(0,p.jsx)(u.Suspense,{fallback:(0,p.jsx)(d.Skeleton,{active:!0}),children:(0,p.jsx)(_j,{})})})}),history:(0,p.jsx)(tj,{}),users:(0,p.jsx)(`div`,{className:`settings-section cc-settings-users`,children:(0,p.jsxs)(Y,{children:[(0,p.jsx)(d.Segmented,{block:!n,options:xj,value:l,style:{marginBottom:16,maxWidth:`100%`},onChange:e=>t(t=>{let n=new URLSearchParams(t);return n.set(`view`,e),n})}),(0,p.jsx)(u.Suspense,{fallback:(0,p.jsx)(d.Skeleton,{active:!0}),children:(0,p.jsx)(vj,{embedded:!0,initialTab:l},l)})]})})}[f];return(0,p.jsx)(`div`,{className:`cc-settings-page`,style:{padding:n?24:16},children:(0,p.jsxs)(d.Flex,{gap:n?24:12,vertical:!n,align:`flex-start`,children:[n?(0,p.jsxs)(`div`,{className:`cc-settings-side`,style:{width:248,flexShrink:0,position:`sticky`,top:16},children:[(0,p.jsx)(yj,{level:4,className:`cc-settings-side__title`,children:`Settings`}),(0,p.jsx)(d.Menu,{className:`cc-settings-nav`,mode:`inline`,selectedKeys:[f],items:s,onClick:({key:e})=>g(e),style:{borderRadius:8,padding:8}})]}):(0,p.jsx)(d.Tabs,{className:`cc-settings-nav`,activeKey:f,onChange:g,items:s,style:{width:`100%`,minWidth:0}}),(0,p.jsxs)(`div`,{className:`cc-settings-body`,style:{flex:1,minWidth:0,width:`100%`},children:[(0,p.jsx)(ck,{icon:m.icon,title:m.label,subtitle:m.subtitle,onHome:()=>g(``)}),_]})]})})}var{Text:Cj}=d.Typography,wj=[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`}],Tj={fileText:(0,p.jsx)(f.FileTextOutlined,{}),checkCircle:(0,p.jsx)(f.CheckCircleOutlined,{}),user:(0,p.jsx)(f.UserOutlined,{}),filter:(0,p.jsx)(f.FilterOutlined,{})};function Ej({stats:e=wj}){return(0,p.jsx)(d.Card,{children:(0,p.jsx)(d.Row,{gutter:[12,12],children:e.map(e=>(0,p.jsx)(d.Col,{xs:24,sm:24,md:8,lg:8,xl:8,children:(0,p.jsxs)(d.Card,{className:`stats-inner-card`,children:[(0,p.jsxs)(d.Space,{align:`center`,children:[Tj[e.icon]??Tj.fileText,(0,p.jsx)(Cj,{children:e.label})]}),(0,p.jsx)(d.Statistic,{value:e.value})]})},e.label))})})}var{Text:Dj}=d.Typography;function Oj(e){return e?.USER_NAME??e?.user_name??e?.username??e?.name??e?.full_name??e?.fullName??e?.email??`User ${e?.USER_ID??e?.user_id??`?`}`}function kj(e){return{...e,key:e.USER_ID??e.user_id??e.userId??e.id??e._id,_name:Oj(e),_email:e.email??e.EMAIL??e.user_email??``,_role:e.role_name??e.roleName??e.ROLE_NAME??``,_rawRef:e}}function Aj(){let[e,t]=(0,u.useState)([]),[r,i]=(0,u.useState)(0),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(1),[l,m]=(0,u.useState)(10),[h,g]=(0,u.useState)(``),_=(0,u.useCallback)(async({offset:e,limit:r,searchQuery:a}={})=>{o(!0);try{let o=await n.$i({offset:e,limit:r,searchQuery:a??``}),s=(o.users??[]).map(kj);t(s),i(o.total??s.length)}catch{d.message.error(`Failed to load users`)}finally{o(!1)}},[]);return(0,u.useEffect)(()=>{queueMicrotask(()=>{_({offset:(s-1)*l,limit:l,searchQuery:h})})},[_,s,l,h]),(0,p.jsx)(Y,{icon:(0,p.jsx)(f.TeamOutlined,{}),title:`Users`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,p.jsx)(tl,{listName:`Users`,dataSource:e,fields:[{label:`Name`,value:`_name`,width:220,render:(e,t)=>(0,p.jsxs)(`div`,{children:[(0,p.jsx)(Dj,{strong:!0,style:{fontSize:13},children:e}),t._email&&(0,p.jsx)(`div`,{style:{fontSize:11,color:`var(--color-text-muted)`},children:t._email})]})},{label:`Role`,value:`_role`,width:180}],loading:a,total:r,current:s,pageSize:l,onPageChange:e=>c(e),onPageSizeChange:e=>{m(e),c(1)},onSearch:e=>{g(e),c(1)}})})}var{Text:jj}=d.Typography,Mj=[{key:`job`,label:`Jobs`},{key:`candidate`,label:`Candidates`},{key:`submissions`,label:`Submissions`}],Nj=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`form`,label:`Form`}];function Pj({field:e,index:t,onToggle:n,onReorder:r}){let i=(0,u.useRef)(null),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1);function l(e){i.current=t,e.dataTransfer.effectAllowed=`move`,c(!0)}function m(){c(!1),o(!1)}function h(e){e.preventDefault(),o(!0)}function g(){o(!1)}function _(e){e.preventDefault(),o(!1),i.current!==null&&i.current!==t&&r(i.current,t),i.current=null}return(0,p.jsxs)(`div`,{draggable:!0,onDragStart:l,onDragEnd:m,onDragOver:h,onDragLeave:g,onDrop:_,className:`uss-field-row with-edit${a?` drag-over`:``}${s?` dragging`:``}`,children:[(0,p.jsx)(`span`,{className:`uss-drag-handle`,children:(0,p.jsx)(f.HolderOutlined,{})}),(0,p.jsxs)(`span`,{className:`uss-field-name`,children:[e.fieldName,(0,p.jsx)(`span`,{className:`uss-field-key`,children:e.fieldKey})]}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:e.isVisible,onChange:e=>n(t,`isVisible`,e)})}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:!!e.isEditable,onChange:e=>n(t,`isEditable`,e)})}),(0,p.jsx)(`span`,{className:`uss-toggle-cell`,children:(0,p.jsx)(d.Switch,{size:`small`,checked:!!e.ismandatory,onChange:e=>n(t,`ismandatory`,e)})})]})}function Fj({team:e,configType:t}){let[r,i]=(0,u.useState)({}),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)({}),[l,f]=(0,u.useState)(`job`);(0,u.useEffect)(()=>{e&&(o(!0),n.Ma(e,t).then(i).catch(()=>d.message.error(`Failed to load field config`)).finally(()=>o(!1)))},[e,t]);let m=r[l]??[];function h(e,t){i(n=>({...n,[e]:typeof t==`function`?t(n[e]??[]):t}))}function g(e,t,n){h(l,r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))}function _(e,t){h(l,n=>{let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r.map((e,t)=>({...e,order:t}))})}async function v(){let r=l;c(e=>({...e,[r]:!0}));try{await n.ao(e,r,m,t),d.message.success(`Saved`)}catch{d.message.error(`Save failed`)}finally{c(e=>({...e,[r]:!1}))}}return(0,p.jsxs)(d.Spin,{spinning:a,children:[(0,p.jsx)(d.Tabs,{size:`small`,activeKey:l,onChange:f,items:Mj.map(e=>({key:e.key,label:e.label}))}),(0,p.jsxs)(`div`,{className:`uss-field-header with-edit`,children:[(0,p.jsx)(`span`,{}),(0,p.jsx)(`span`,{children:`Field`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Visible`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Editable`}),(0,p.jsx)(`span`,{style:{textAlign:`center`},children:`Mandatory`})]}),(0,p.jsxs)(`div`,{className:`uss-field-list`,children:[m.length===0&&!a&&(0,p.jsx)(`div`,{className:`uss-empty`,children:`No fields found.`}),m.map((e,t)=>(0,p.jsx)(Pj,{field:e,index:t,onToggle:g,onReorder:_},e.fieldKey??t))]}),(0,p.jsx)(`div`,{className:`uss-modal-footer`,children:(0,p.jsxs)(d.Button,{type:`primary`,size:`small`,loading:s[l],onClick:v,children:[`Save `,Mj.find(e=>e.key===l)?.label]})})]})}function Ij(){let[e,t]=(0,u.useState)(null),[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(`listView`),[l,m]=(0,u.useState)([]),[h,g]=(0,u.useState)(0),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(``),[x,S]=(0,u.useState)(!1),C=(0,u.useCallback)(async()=>{v(!0);try{let e=await n.Qi();m(e.teams),g(e.total)}catch{d.message.error(`Failed to load teams`)}finally{v(!1)}},[]);(0,u.useEffect)(()=>{C()},[C]);function w(e){t(e),c(`listView`),i(!0)}function T(e){t(e),b(e.teamName??``),o(!0)}async function E(){if(!y.trim()){d.message.warning(`Team name is required`);return}S(!0);try{await n.io(e,{teamName:y.trim(),managerId:e.managerId,memberIds:e.memberIds}),d.message.success(`Team updated`),o(!1),C()}catch{d.message.error(`Failed to update team`)}finally{S(!1)}}return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Y,{icon:(0,p.jsx)(f.TeamOutlined,{}),title:`Teams`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,p.jsx)(tl,{listName:`Teams`,dataSource:l,fields:[{label:`Team Name`,value:`teamName`,width:200},{label:`Manager`,value:`manager`,width:200},{label:`Members`,value:`memberCount`,width:90,sorter:!1},{label:`Actions`,value:`_actions`,width:160,sorter:!1,render:(e,t)=>(0,p.jsxs)(`div`,{style:{display:`flex`,gap:4},children:[(0,p.jsx)(d.Button,{size:`small`,type:`link`,onClick:()=>T(t),children:`Edit`}),(0,p.jsx)(d.Button,{size:`small`,type:`link`,onClick:()=>w(t),children:`Configure`})]})}],loading:_,total:h})}),(0,p.jsx)(d.Modal,{open:a,onCancel:()=>o(!1),title:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f.TeamOutlined,{style:{color:`var(--color-brand)`,marginRight:6}}),`Edit Team`]}),width:420,footer:null,destroyOnClose:!0,children:(0,p.jsxs)(`div`,{className:`uss-edit-team-body`,style:{paddingTop:12},children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`uss-edit-team-label`,children:`Team Name`}),(0,p.jsx)(d.Input,{value:y,onChange:e=>b(e.target.value),onPressEnter:E,placeholder:`Enter team name`})]}),(0,p.jsxs)(`div`,{className:`uss-modal-footer`,children:[(0,p.jsx)(d.Button,{onClick:()=>o(!1),children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,loading:x,onClick:E,children:`Save`})]})]})}),(0,p.jsxs)(d.Modal,{className:`uss-modal`,open:r,onCancel:()=>i(!1),title:(0,p.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.TeamOutlined,{style:{color:`var(--color-brand)`}}),(0,p.jsxs)(`span`,{children:[`Configure: `,e?.teamName]})]}),width:720,footer:null,destroyOnClose:!0,children:[(0,p.jsx)(`div`,{style:{marginBottom:12},children:(0,p.jsx)(`div`,{className:`uss-config-toggle`,children:Nj.map(e=>(0,p.jsx)(`button`,{className:`uss-config-btn${s===e.key?` active`:``}`,onClick:()=>c(e.key),children:e.label},e.key))})}),e&&(0,p.jsx)(Fj,{team:e,configType:s},`${e?.teamId}-${s}`)]})]})}var Lj=[`view`,`add`,`edit`,`delete`],Rj={view:`View`,add:`Add`,edit:`Edit`,delete:`Delete`,sourcing:`Sourcing`,assign:`Assign`,share:`Share`,change_status:`Status`,my_jobs:`My Jobs`,all_jobs:`All Jobs`,po_msa:`PO MSA`,reApprove:`ReApprove`,sendApprove:`Send Approve`};function zj(e){return Rj[e]??e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Bj(e){let t=Lj.filter(t=>e.includes(t)),n=e.filter(e=>!Lj.includes(e)).sort();return[...t,...n]}function Vj(e){let t=new Set;return Object.values(e).forEach(({permissions:e})=>Object.keys(e??{}).forEach(e=>t.add(e))),Bj([...t])}function Hj(e){let t=0,n=0;return Object.entries(e).forEach(([e,{permissions:r}])=>{Object.entries(r??{}).forEach(([r,{value:i}])=>{Qh(e,r)&&(n++,i===`1`&&t++)})}),{enabled:t,total:n}}function Uj(e={}){if(!e||typeof e!=`object`)return e;let t=Object.keys(e).find(e=>String(e).trim().toLowerCase()===`onboarding`);if(!t)return e;let n=e[t]??{},r={...n.permissions??{}};for(let e of[`sendApprove`,`reApprove`])Object.keys(r).some(t=>t.toLowerCase()===e.toLowerCase())||(r[e]={id:0,value:`0`});return{...e,[t]:{...n,permissions:r}}}function Wj({value:e,onSave:t,className:n}){let[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(e);(0,u.useEffect)(()=>{o(e)},[e]);function s(){i(!1);let n=a.trim();n&&n!==e?t(n):o(e)}return r?(0,p.jsx)(`input`,{autoFocus:!0,className:`perm-inline-input${n?` ${n}`:``}`,value:a,style:{width:Math.max(48,a.length*8)},onChange:e=>o(e.target.value),onBlur:s,onKeyDown:t=>{t.key===`Enter`&&s(),t.key===`Escape`&&(i(!1),o(e)),t.stopPropagation()},onClick:e=>e.stopPropagation()}):(0,p.jsxs)(`span`,{className:`perm-editable-name${n?` ${n}`:``}`,onDoubleClick:e=>{e.stopPropagation(),i(!0)},children:[e,(0,p.jsx)(f.EditOutlined,{className:`perm-name-edit-icon`})]})}function Gj({entry:e,label:t,onToggle:n,onLabelSave:r}){let[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(t),c=e?.value===`1`,l=!!e;(0,u.useEffect)(()=>{s(t)},[t]);function m(){a(!1);let e=o.trim();e&&e!==t?r(e):s(t)}return(0,p.jsx)(d.Tooltip,{title:l?c?`Click to disable`:`Click to enable`:`Not applicable for this module`,children:(0,p.jsxs)(`div`,{className:`perm-action-pill${c?` on`:``}${l?``:` na`}`,onClick:()=>{!i&&l&&n()},children:[(0,p.jsx)(`span`,{className:`perm-action-pill-dot${c?` on`:``}`}),i?(0,p.jsx)(`input`,{autoFocus:!0,className:`perm-pill-input`,value:o,style:{width:Math.max(36,o.length*7)},onChange:e=>s(e.target.value),onBlur:m,onKeyDown:e=>{e.key===`Enter`&&m(),e.key===`Escape`&&(a(!1),s(t)),e.stopPropagation()},onClick:e=>e.stopPropagation()}):(0,p.jsx)(`span`,{className:`perm-action-pill-label`,onDoubleClick:e=>{e.stopPropagation(),a(!0)},children:t}),c&&!i&&(0,p.jsx)(f.CheckOutlined,{className:`perm-action-pill-check`})]})})}function Kj({menuName:e,menuData:t,permKeys:n,onChange:r,displayName:i,actionLabels:a,onModuleLabelSave:o,onActionLabelSave:s}){let c=t?.permissions??{},l=n.filter(t=>Qh(e,t)),u=l.filter(e=>c[e]?.value===`1`).length,d=l.filter(e=>c[e]).length,f=d>0&&u===d;return(0,p.jsxs)(`div`,{className:`perm-module-card${f?` all-on`:u>0&&!f?` some-on`:``}`,children:[(0,p.jsxs)(`div`,{className:`perm-module-card-header`,children:[(0,p.jsx)(Wj,{value:i,onSave:t=>o(e,t),className:`perm-module-card-name`}),d>0&&(0,p.jsxs)(`span`,{className:`perm-module-card-badge${u>0?` active`:``}`,children:[u,`/`,d]})]}),(0,p.jsx)(`div`,{className:`perm-module-card-body`,children:l.map(t=>(0,p.jsx)(Gj,{entry:c[t],label:a[t]??zj(t),onToggle:()=>r(e,t),onLabelSave:e=>s(t,e)},t))})]})}function qj({role:e,moduleLabels:t={},actionLabels:r={},onModuleLabelSave:i=()=>{},onActionLabelSave:a=()=>{}}){let[o,s]=(0,u.useState)({}),[c,l]=(0,u.useState)({}),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(!1),b=n.Da(e);(0,u.useEffect)(()=>{b&&(h(!0),y(!1),n.Aa(b).then(e=>{let t=Uj(e);s(t),l(t)}).catch(()=>d.message.error(`Failed to load permissions`)).finally(()=>h(!1)))},[b]);function x(e,t){y(!0),l(n=>{let r=n[e]??{menuId:o[e]?.menuId??0,permissions:{}},i=r.permissions?.[t]??{id:0,value:`0`};return{...n,[e]:{...r,permissions:{...r.permissions,[t]:{...i,value:i.value===`1`?`0`:`1`}}}}})}async function S(){_(!0);try{await n.no(b,c),s(c),y(!1),d.message.success(`Permissions saved`)}catch(e){d.message.error(e?.message||`Save failed`)}finally{_(!1)}}let C=(0,u.useMemo)(()=>Object.keys(c).sort(),[c]),w=(0,u.useMemo)(()=>Vj(c),[c]),{enabled:T,total:E}=(0,u.useMemo)(()=>Hj(c),[c]);return(0,p.jsxs)(d.Spin,{spinning:m,children:[(0,p.jsxs)(`div`,{className:`perm-panel-header`,children:[(0,p.jsxs)(`div`,{className:`perm-panel-title`,children:[(0,p.jsx)(f.LockOutlined,{style:{color:`var(--color-brand)`,marginRight:6}}),(0,p.jsx)(`span`,{children:e?.roleName}),!m&&E>0&&(0,p.jsxs)(d.Tag,{color:`blue`,style:{marginLeft:8,fontSize:11},children:[T,`/`,E,` enabled`]})]}),(0,p.jsx)(d.Button,{type:`primary`,size:`small`,icon:(0,p.jsx)(f.UnlockOutlined,{}),loading:g,disabled:!v,onClick:S,children:`Save Changes`})]}),(0,p.jsxs)(`div`,{className:`perm-hint`,children:[(0,p.jsx)(f.InfoCircleOutlined,{className:`perm-hint-icon`}),(0,p.jsxs)(`span`,{children:[`Click a pill to toggle. `,(0,p.jsx)(`strong`,{children:`Double-click`}),` a module name or action label to rename it — labels are saved locally.`]})]}),C.length===0&&!m?(0,p.jsx)(`div`,{className:`perm-empty`,children:`No permission entries found for this role.`}):(0,p.jsx)(`div`,{className:`perm-cards-grid`,children:C.map(e=>(0,p.jsx)(Kj,{menuName:e,menuData:c[e],permKeys:w,onChange:x,displayName:t[e]??e,actionLabels:r,onModuleLabelSave:i,onActionLabelSave:a},e))})]})}var{Text:Jj}=d.Typography,Yj=[{key:`listView`,label:`List View`},{key:`filter`,label:`Filter`},{key:`form`,label:`Form`},{key:`permissions`,label:`Permissions`}];function Xj(e){return String(e||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}function Zj(e){return String(e||``).trim().toLowerCase()}function Qj(e){return e?.key||e?.collectionName||e?.value||``}function $j(e=[],t=[]){let n=[],r=new Set,i=new Set,a=new Set;return e.forEach(e=>{let t=Qj(e);if(!t)return;let o=Zj(e.key||t),s=Zj(e.collectionName);e.seeded&&(i.add(o),s&&i.add(s)),s&&a.add(s),r.add(t),n.push({label:e.label||Xj(t),value:t,disabled:!!e.seeded})}),t.forEach(e=>{let t=String(e||``).trim();if(!t||r.has(t))return;let o=Zj(t);a.has(o)||i.has(o)||(r.add(t),n.push({label:Xj(t),value:t,disabled:!1}))}),n}function eM(){let[e,t]=(0,u.useState)(null),[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(`listView`),[s,c]=(0,u.useState)([]),[l,m]=(0,u.useState)(0),[h,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)([]),[y,b]=(0,u.useState)([]),[x,S]=(0,u.useState)(!1),[C,w]=(0,u.useState)(!1),T=(0,u.useMemo)(()=>_.filter(e=>!e.disabled),[_]),E=!x&&T.length===0,D=(0,u.useCallback)(async()=>{g(!0);try{let e=await n.Zi();c(e.roles),m(e.total)}catch{d.message.error(`Failed to load roles`)}finally{g(!1)}},[]),O=(0,u.useCallback)(async()=>{S(!0);try{let[e,t]=await Promise.all([n.ua(),n.ta()]),r=$j(e.modules,t),i=new Set(r.filter(e=>!e.disabled).map(e=>e.value));v(r),b(e=>e.filter(e=>i.has(e)))}catch{d.message.error(`Failed to load seed status`)}finally{S(!1)}},[]);(0,u.useEffect)(()=>{D()},[D]),(0,u.useEffect)(()=>{O()},[O]);async function k(){if(y.length===0){d.message.warning(E?`All modules already seeded.`:`Select at least one module to seed.`);return}w(!0);try{await n.qa(y),d.message.success(`Role field config seeded`),b([]),await O()}catch(e){d.message.error(e?.message||`Seed failed`)}finally{w(!1)}}function A(e,n=`listView`){t(e),o(n),i(!0)}return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(Y,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Field Config Seed`,style:{marginBottom:12},children:[(0,p.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,p.jsx)(`div`,{style:{minWidth:320,flex:1},children:(0,p.jsx)(d.Select,{mode:`multiple`,allowClear:!0,showSearch:!0,value:y,options:_,placeholder:E?`All modules already seeded`:`Select modules or collections to seed`,disabled:x||C||E,loading:x,onChange:b,style:{width:`100%`}})}),(0,p.jsx)(d.Button,{type:`primary`,loading:C,disabled:x||y.length===0,onClick:k,children:`Seed Field Config`})]}),(0,p.jsx)(Jj,{type:`secondary`,style:{display:`block`,marginTop:8,fontSize:12},children:E?`Seed is disabled because all configured modules already have role field config data.`:`Already seeded modules are disabled. New modules or collections can still be seeded.`})]}),(0,p.jsx)(Y,{icon:(0,p.jsx)(f.SafetyOutlined,{}),title:`Roles`,style:{marginBottom:0},bodyStyle:{padding:0},children:(0,p.jsx)(tl,{listName:`Roles`,dataSource:s,fields:[{label:`Role Name`,value:`roleName`,width:200},{label:`Description`,value:`description`,width:240},{label:`Users`,value:`userCount`,width:70,sorter:!1},{label:`Actions`,value:`_configure`,width:200,sorter:!1,render:(e,t)=>(0,p.jsxs)(d.Space,{size:2,children:[(0,p.jsx)(d.Button,{size:`small`,type:`link`,onClick:()=>A(t),children:`Configure`}),(0,p.jsx)(d.Button,{size:`small`,type:`link`,icon:(0,p.jsx)(f.LockOutlined,{}),onClick:()=>A(t,`permissions`),children:`Permissions`})]})}],loading:h,total:l})}),(0,p.jsxs)(d.Modal,{className:`uss-modal`,open:r,onCancel:()=>i(!1),title:(0,p.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.SafetyOutlined,{style:{color:`var(--color-brand)`}}),(0,p.jsxs)(`span`,{children:[`Configure: `,e?.roleName]})]}),width:720,footer:null,destroyOnClose:!0,children:[(0,p.jsx)(`div`,{style:{marginBottom:12},children:(0,p.jsx)(`div`,{className:`uss-config-toggle`,children:Yj.map(e=>(0,p.jsx)(`button`,{className:`uss-config-btn${a===e.key?` active`:``}`,onClick:()=>o(e.key),children:e.label},e.key))})}),e&&(a===`permissions`?(0,p.jsx)(qj,{role:e},e?.roleId):(0,p.jsx)(bg,{role:e,configType:a},`${e?.roleId}-${a}`))]})]})}var tM=`perm-module-labels`,nM=`perm-action-labels`;function rM(e){try{return JSON.parse(localStorage.getItem(e)??`{}`)}catch{return{}}}function iM(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function aM({label:e,onSave:t,onDelete:n,loading:r}){let[i,a]=(0,u.useState)(!1),[o,s]=(0,u.useState)(e);function c(){a(!1);let n=o.trim();n&&n!==e?t(n):s(e)}return(0,p.jsxs)(`div`,{className:`perm-manage-row`,children:[i?(0,p.jsx)(`input`,{autoFocus:!0,className:`perm-inline-input`,value:o,style:{flex:1,minWidth:0},onChange:e=>s(e.target.value),onBlur:c,onKeyDown:t=>{t.key===`Enter`&&c(),t.key===`Escape`&&(a(!1),s(e))}}):(0,p.jsx)(`span`,{className:`perm-manage-row-label`,children:e}),(0,p.jsxs)(`div`,{className:`perm-manage-row-actions`,children:[(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>{s(e),a(!0)},loading:r}),(0,p.jsx)(d.Popconfirm,{title:`Delete this item?`,onConfirm:n,okText:`Delete`,cancelText:`Cancel`,okType:`danger`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.DeleteOutlined,{}),danger:!0})})]})]})}function oM({open:e,onClose:t}){let[r,i]=(0,u.useState)(`modules`),[a,o]=(0,u.useState)([]),[s,c]=(0,u.useState)(!1),[l,m]=(0,u.useState)(``),[h,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)([]),[y,b]=(0,u.useState)(!1),[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)(``),[T,E]=(0,u.useState)(!1);(0,u.useEffect)(()=>{e&&(D(),O())},[e]);async function D(){c(!0);try{o(await n.va())}catch{d.message.error(`Failed to load modules`)}finally{c(!1)}}async function O(){b(!0);try{v(await n._a())}catch{d.message.error(`Failed to load actions`)}finally{b(!1)}}async function k(){let e=l.trim();if(!e){d.message.warning(`Enter a module name`);return}g(!0);try{let t=await n.Mi({menuName:e});o(e=>[...e,t]),m(``),d.message.success(`Module added`)}catch{d.message.error(`Failed to add module`)}finally{g(!1)}}async function A(e,t){try{await n.Qa(e,{menuName:t}),o(n=>n.map(n=>n.MENUID===e?{...n,MENUNAME:t}:n))}catch{d.message.error(`Failed to update module`)}}async function j(e){try{await n.Vi(e),o(t=>t.filter(t=>t.MENUID!==e)),d.message.success(`Module deleted`)}catch{d.message.error(`Failed to delete module`)}}async function M(){let e=x.trim(),t=C.trim().toLowerCase().replace(/\s+/g,`_`);if(!e||!t){d.message.warning(`Enter both name and key`);return}E(!0);try{let r=await n.ji({permissionName:e,permissionKey:t});v(e=>[...e,r]),S(``),w(``),d.message.success(`Action added`)}catch(e){d.message.error(e?.message?.includes(`409`)||e?.status===409?`Permission key already exists`:`Failed to add action`)}finally{E(!1)}}async function N(e,t){try{await n.Za(e,{permissionName:t}),v(n=>n.map(n=>n.permissionId===e?{...n,permissionName:t}:n))}catch{d.message.error(`Failed to update action`)}}async function P(e){try{await n.Bi(e),v(t=>t.filter(t=>t.permissionId!==e)),d.message.success(`Action deleted`)}catch{d.message.error(`Failed to delete action`)}}let F=[{key:`modules`,label:`Modules`,children:(0,p.jsxs)(d.Spin,{spinning:s,children:[(0,p.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,p.jsx)(d.Input,{placeholder:`Module name`,value:l,onChange:e=>m(e.target.value),onPressEnter:k,style:{flex:1},size:`small`}),(0,p.jsx)(d.Button,{type:`primary`,size:`small`,icon:(0,p.jsx)(f.PlusOutlined,{}),loading:h,onClick:k,children:`Add`})]}),(0,p.jsxs)(`div`,{className:`perm-manage-list`,children:[a.length===0&&!s&&(0,p.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No modules found`}),a.map(e=>(0,p.jsx)(aM,{label:e.MENUNAME,onSave:t=>A(e.MENUID,t),onDelete:()=>j(e.MENUID)},e.MENUID))]})]})},{key:`actions`,label:`Actions`,children:(0,p.jsxs)(d.Spin,{spinning:y,children:[(0,p.jsxs)(`div`,{className:`perm-manage-add-row`,children:[(0,p.jsx)(d.Input,{placeholder:`Action name (e.g. Approve)`,value:x,onChange:e=>S(e.target.value),style:{flex:1},size:`small`}),(0,p.jsx)(d.Input,{placeholder:`Key (e.g. approve)`,value:C,onChange:e=>w(e.target.value),onPressEnter:M,style:{width:140},size:`small`}),(0,p.jsx)(d.Button,{type:`primary`,size:`small`,icon:(0,p.jsx)(f.PlusOutlined,{}),loading:T,onClick:M,children:`Add`})]}),(0,p.jsxs)(`div`,{className:`perm-manage-list`,children:[_.length===0&&!y&&(0,p.jsx)(`div`,{className:`perm-empty`,style:{paddingTop:24},children:`No actions found`}),_.map(e=>(0,p.jsx)(aM,{label:`${e.permissionName} (${e.permissionKey})`,onSave:t=>N(e.permissionId,t),onDelete:()=>P(e.permissionId)},e.permissionId))]})]})}];return(0,p.jsx)(d.Modal,{open:e,onCancel:t,title:(0,p.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.SettingOutlined,{style:{color:`var(--color-brand)`}}),`Manage Modules & Actions`]}),width:520,footer:null,destroyOnClose:!0,children:(0,p.jsx)(d.Tabs,{activeKey:r,onChange:i,size:`small`,items:F})})}function sM(){let[e,t]=(0,u.useState)([]),[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(null),[s,c]=(0,u.useState)(``),[l,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(()=>rM(tM)),[_,v]=(0,u.useState)(()=>rM(nM)),y=(0,u.useCallback)((e,t)=>{g(n=>{let r={...n,[e]:t};return iM(tM,r),r})},[]),b=(0,u.useCallback)((e,t)=>{v(n=>{let r={...n,[e]:t};return iM(nM,r),r})},[]);function x(){g({}),v({}),iM(tM,{}),iM(nM,{}),d.message.success(`Labels reset to defaults`)}let S=(0,u.useCallback)(async()=>{i(!0);try{let{roles:e}=await n.Zi();t(e),e.length>0&&o(e[0])}catch{d.message.error(`Failed to load roles`)}finally{i(!1)}},[]);(0,u.useEffect)(()=>{S()},[S]);let C=(0,u.useMemo)(()=>{let t=s.trim().toLowerCase();return t?e.filter(e=>e.roleName.toLowerCase().includes(t)):e},[e,s]),w=Object.keys(h).length>0||Object.keys(_).length>0;return(0,p.jsxs)(`div`,{className:`perm-page`,children:[(0,p.jsxs)(Y,{className:`perm-left-card`,icon:(0,p.jsx)(f.SafetyOutlined,{}),title:`Roles`,bodyStyle:{padding:0},children:[(0,p.jsx)(`div`,{className:`perm-role-search`,children:(0,p.jsx)(d.Input,{prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search roles…`,allowClear:!0,size:`small`,value:s,onChange:e=>c(e.target.value)})}),(0,p.jsx)(d.Spin,{spinning:r,children:(0,p.jsxs)(`div`,{className:`perm-role-list`,children:[C.length===0&&!r&&(0,p.jsx)(`div`,{className:`perm-role-empty`,children:`No roles found`}),C.map(e=>{let t=a?.roleId===e.roleId,n=e.description&&e.description!==`N/A`?e.description:e.roleType===0?`Default role`:`Custom role`;return(0,p.jsxs)(`div`,{className:`perm-role-item${t?` active`:``}`,onClick:()=>o(e),children:[(0,p.jsx)(`div`,{className:`perm-role-item-name`,children:e.roleName}),(0,p.jsx)(`div`,{className:`perm-role-item-desc`,children:n})]},e.roleId)})]})})]}),(0,p.jsx)(Y,{className:`perm-right-card`,icon:(0,p.jsx)(f.LockOutlined,{}),title:`Module Permissions`,extra:(0,p.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[w&&(0,p.jsx)(`button`,{className:`perm-reset-btn`,onClick:x,children:`Reset labels`}),(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.SettingOutlined,{}),onClick:()=>m(!0),children:`Manage`})]}),bodyStyle:{padding:`12px 16px`},children:a?(0,p.jsx)(qj,{role:a,moduleLabels:h,actionLabels:_,onModuleLabelSave:y,onActionLabelSave:b},a.roleId):(0,p.jsx)(`div`,{className:`perm-empty`,children:`Select a role from the left to manage its permissions.`})}),(0,p.jsx)(oM,{open:l,onClose:()=>m(!1)})]})}var{Title:cM,Text:lM}=d.Typography,uM=[{label:`In Progress`,value:107,sub:`Under review`,color:`blue`},{label:`Hired`,value:2,sub:`Onboarded`,color:`green`},{label:`Project Completed`,value:2,sub:`Project cycle closed`,color:`purple`},{label:`Archive`,value:2,sub:`No longer active`,color:`peach`}];function dM({items:e=uM}){return(0,p.jsx)(d.Card,{className:`onboarding-card`,title:(0,p.jsx)(cM,{level:5,children:`Onboarding`}),extra:(0,p.jsx)(d.Button,{type:`link`,children:`View all`}),children:(0,p.jsx)(d.Row,{gutter:[12,12],children:e.map(e=>(0,p.jsx)(d.Col,{xs:12,sm:6,md:6,lg:12,xl:12,children:(0,p.jsxs)(`div`,{className:`onboarding-item ${e.color}`,children:[(0,p.jsx)(lM,{className:`onboarding-item-label`,children:e.label}),(0,p.jsx)(d.Statistic,{value:e.value,className:`onboarding-stat`}),(0,p.jsx)(`div`,{className:`onboarding-item-footer`,children:(0,p.jsx)(lM,{className:`onboarding-item-sub`,children:e.sub})})]})},e.label))})})}var{Text:fM,Title:pM}=d.Typography,mM=[{group:`Dashboard`,items:[{id:`dashboard`,label:`Admin Dashboard`,icon:(0,p.jsx)(f.DashboardOutlined,{})}]},{group:`Settings`,items:[{id:`org`,label:`Organization`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Organization Settings`,desc:`Manage your company profile and location details`,cards:[{label:`Company Information`,icon:(0,p.jsx)(f.BankOutlined,{}),desc:`Manage company profile, address and business details.`},{label:`Location`,icon:(0,p.jsx)(f.BuildOutlined,{}),desc:`Manage office locations, branches and regions.`}]},{id:`users`,label:`Users`,icon:(0,p.jsx)(f.UserOutlined,{}),heading:`Users`,desc:`Manage platform users and configure their field views.`,component:`users`},{id:`teams`,label:`Teams`,icon:(0,p.jsx)(f.TeamOutlined,{}),heading:`Teams`,desc:`Organize users into teams and configure field visibility per team.`,component:`teams`},{id:`roles`,label:`Roles`,icon:(0,p.jsx)(f.SafetyOutlined,{}),heading:`Roles`,desc:`Control permissions and configure field visibility per role.`,component:`roles`},{id:`permissions`,label:`Permissions`,icon:(0,p.jsx)(f.LockOutlined,{}),heading:`Permissions`,desc:`Manage module-wise action permissions (view, add, edit, delete, and more) per role.`,component:`permissions`},{id:`templates`,label:`Templates`,icon:(0,p.jsx)(f.FileTextOutlined,{}),heading:`Templates`,desc:`Email and signature templates for communications`,component:`templates`},{id:`ai-services`,label:`AI Services`,icon:(0,p.jsx)(f.ThunderboltOutlined,{}),heading:`AI Services`,desc:`Register the AI/automation backends (base URL + auth) that admin-configured AI Actions call.`,component:`ai-services`},{id:`bgc-integration`,label:`Integrations`,icon:(0,p.jsx)(f.SafetyOutlined,{}),heading:`Integrations`,desc:`Manage manual and API integrations used across application workflows.`,component:`bgc-integration`}]},{group:`Clients`,items:[{id:`clients`,label:`Clients`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Clients`,desc:`Manage client accounts and settings`,cards:[{label:`Clients`,icon:(0,p.jsx)(f.BankOutlined,{}),desc:`Manage client companies and account details.`}]}]},{group:`Forms`,items:[{id:`form-groups`,label:`Form Groups`,icon:(0,p.jsx)(f.AppstoreAddOutlined,{}),heading:`Form Groups`,desc:`Define field groups for module add/edit forms with validations and dropdown sources.`,component:`form-groups`},{id:`detail-groups`,label:`Detail Groups`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),heading:`Detail Groups`,desc:`Customize the detail view per module: labels, prefix/suffix, colour, capitalization, reference lookups and merged fields.`,component:`detail-groups`},{id:`row-actions`,label:`Actions`,icon:(0,p.jsx)(f.ToolOutlined,{}),heading:`Actions`,desc:`Configure which action buttons appear per row in each module's list view, scoped per role.`,component:`row-actions`}]},{group:`Master`,items:[{id:`jobs`,label:`Jobs`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),heading:`Jobs Master`,desc:`Configure job sources and status types`,cards:[{label:`Sources`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Manage job source master values.`},{label:`Job Status`,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),desc:`Configure job workflow status.`}]},{id:`candidates`,label:`Candidates`,icon:(0,p.jsx)(f.UserOutlined,{}),heading:`Candidates Master`,desc:`Skills, sources and work authorization settings`,cards:[{label:`Sources`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Manage candidate source values.`},{label:`Skills`,icon:(0,p.jsx)(f.SettingOutlined,{}),desc:`Manage skill master data.`},{label:`Work Authorization`,icon:(0,p.jsx)(f.SafetyOutlined,{}),desc:`Manage visa and authorization types.`}]},{id:`submissions`,label:`Submissions`,icon:(0,p.jsx)(f.FileTextOutlined,{}),heading:`Submissions Master`,desc:`Rejection reasons and submission status configuration`,cards:[{label:`Rejection Reasons`,icon:(0,p.jsx)(f.FileTextOutlined,{}),desc:`Manage common rejection reasons.`},{label:`Client Submission Status`,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),desc:`Manage client submission statuses.`}]},{id:`clientmaster`,label:`Client Master`,icon:(0,p.jsx)(f.BankOutlined,{}),heading:`Client Master`,desc:`Payment terms, client types and contact types`,cards:[{label:`Payment Terms`,icon:(0,p.jsx)(f.FileTextOutlined,{}),desc:`Manage billing and payment terms.`},{label:`Client Type`,icon:(0,p.jsx)(f.AppstoreOutlined,{}),desc:`Classify client business types.`},{label:`Client Contact Type`,icon:(0,p.jsx)(f.TeamOutlined,{}),desc:`Manage client contact categories.`}]}]}],hM=[{label:`Sourced`,count:312,color:`#378ADD`,pct:35},{label:`Screened`,count:223,color:`#7F77DD`,pct:25},{label:`Interview`,count:161,color:`#1D9E75`,pct:18},{label:`Offered`,count:107,color:`#EF9F27`,pct:12},{label:`Rejected`,count:89,color:`#E24B4A`,pct:10}],gM=[{name:`Tcs`,jobs:14,candidates:86},{name:`Empasis`,jobs:9,candidates:64},{name:`NovaSystems`,jobs:7,candidates:51},{name:`Brightwave`,jobs:5,candidates:38}],_M=[{text:`New candidate Ravi Kumar added to Java Developer role`,time:`2 min ago`,color:`#378ADD`},{text:`Submission approved by Acme Corp for Sr. React Dev`,time:`18 min ago`,color:`#1D9E75`},{text:`User Priya S. added to Recruiters team`,time:`1 hr ago`,color:`#7F77DD`},{text:`Job Data Analyst — TechFlow moved to archived`,time:`3 hr ago`,color:`#EF9F27`},{text:`Candidate rejected — work authorization mismatch`,time:`5 hr ago`,color:`#E24B4A`}];function vM(){return(0,p.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,p.jsxs)(Y,{icon:(0,p.jsx)(f.DashboardOutlined,{}),title:`Admin Dashboard`,children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(pM,{level:5,children:`Admin Dashboard`}),(0,p.jsx)(fM,{type:`secondary`,children:`Overview of jobs, candidates, onboarding and recent activity`})]}),(0,p.jsx)(`div`,{className:`admin-dashboard-stats`,children:(0,p.jsx)(Ej,{stats:[{label:`Total Jobs`,value:1697,icon:`fileText`},{label:`Active Jobs`,value:1685,icon:`checkCircle`},{label:`My Jobs`,value:600,icon:`user`},{label:`Total Candidates`,value:4320,icon:`team`},{label:`Submissions`,value:892,icon:`fileText`}]})}),(0,p.jsxs)(`div`,{className:`admin-dashboard-mid-row`,children:[(0,p.jsx)(dM,{}),(0,p.jsxs)(Y,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Candidate Pipeline`,children:[(0,p.jsx)(fM,{type:`secondary`,style:{fontSize:12},children:`By stage (892 total)`}),(0,p.jsx)(`div`,{className:`admin-pipeline-bar`,children:hM.map(e=>(0,p.jsx)(`div`,{className:`admin-pipeline-seg`,style:{width:`${e.pct}%`,background:e.color}},e.label))}),(0,p.jsx)(`div`,{className:`admin-pipeline-legend`,children:hM.map(e=>(0,p.jsxs)(`div`,{className:`admin-pipeline-legend-item`,children:[(0,p.jsx)(`span`,{className:`admin-pipeline-dot`,style:{background:e.color}}),e.label,` `,e.count]},e.label))}),(0,p.jsx)(`div`,{className:`admin-divider`}),(0,p.jsx)(fM,{strong:!0,style:{fontSize:12},children:`Submission status`}),(0,p.jsxs)(`div`,{className:`admin-sub-status-list`,style:{marginTop:6},children:[(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(fM,{style:{fontSize:13},children:`Pending client review`}),(0,p.jsx)(`span`,{className:`admin-badge warn`,children:`312`})]}),(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(fM,{style:{fontSize:13},children:`Client approved`}),(0,p.jsx)(`span`,{className:`admin-badge success`,children:`248`})]}),(0,p.jsxs)(`div`,{className:`admin-sub-status-item`,children:[(0,p.jsx)(fM,{style:{fontSize:13},children:`Rejected`}),(0,p.jsx)(`span`,{className:`admin-badge danger`,children:`89`})]})]})]})]}),(0,p.jsxs)(`div`,{className:`admin-dashboard-bottom-row`,children:[(0,p.jsx)(Y,{icon:(0,p.jsx)(f.BankOutlined,{}),title:`Top Clients`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`View all`}),children:gM.map(e=>(0,p.jsxs)(`div`,{className:`admin-client-row`,children:[(0,p.jsxs)(`div`,{className:`admin-client-left`,children:[(0,p.jsx)(`div`,{className:`admin-client-icon`,children:(0,p.jsx)(f.BankOutlined,{})}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`admin-client-name`,children:e.name}),(0,p.jsxs)(`div`,{className:`admin-client-sub`,children:[e.jobs,` open jobs`]})]})]}),(0,p.jsxs)(`div`,{className:`admin-client-right`,children:[(0,p.jsx)(`div`,{className:`admin-client-val`,children:e.candidates}),(0,p.jsx)(`div`,{className:`admin-client-sub`,children:`candidates`})]})]},e.name))}),(0,p.jsx)(Y,{icon:(0,p.jsx)(f.BellOutlined,{}),title:`Recent Activity`,children:_M.map((e,t)=>(0,p.jsxs)(`div`,{className:`admin-activity-row`,children:[(0,p.jsx)(`div`,{className:`admin-activity-dot`,style:{background:e.color}}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`admin-activity-text`,children:e.text}),(0,p.jsx)(`div`,{className:`admin-activity-time`,children:e.time})]})]},t))})]}),(0,p.jsx)(Y,{icon:(0,p.jsx)(f.SettingOutlined,{}),title:`Admin Configuration Overview`,extra:(0,p.jsx)(d.Button,{type:`link`,size:`small`,children:`Manage`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(fM,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Settings`}),[[`Organization`,2],[`User Settings`,4],[`Templates`,2]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(fM,{style:{fontSize:12},children:e}),(0,p.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(fM,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`Master`}),[[`Jobs`,2],[`Candidates`,3],[`Submissions`,2]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(fM,{style:{fontSize:12},children:e}),(0,p.jsxs)(`span`,{className:`admin-badge info`,children:[t,` items`]})]},e))]}),(0,p.jsxs)(d.Col,{span:8,children:[(0,p.jsx)(fM,{type:`secondary`,style:{fontSize:12,fontWeight:500},children:`System`}),[[`Total Groups`,4],[`Total Modules`,9],[`Config Items`,19]].map(([e,t])=>(0,p.jsxs)(`div`,{className:`admin-cfg-overview-row`,children:[(0,p.jsx)(fM,{style:{fontSize:12},children:e}),(0,p.jsx)(fM,{strong:!0,style:{fontSize:12},children:t})]},e))]})]})})]})}function yM({activeSection:e,activeGroup:t,filteredCards:n,searchText:r,setSearchText:i,allItems:a,handleNav:o}){return(0,p.jsxs)(d.Row,{gutter:[16,16],children:[(0,p.jsx)(d.Col,{span:24,children:(0,p.jsxs)(Y,{icon:e?.icon,title:e?.heading,extra:(0,p.jsx)(d.Input,{className:`admin-search`,prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search settings…`,allowClear:!0,value:r,onChange:e=>i(e.target.value)}),children:[(0,p.jsx)(`div`,{className:`admin-accent-bar`}),(0,p.jsx)(pM,{level:5,children:e?.heading}),(0,p.jsx)(fM,{type:`secondary`,children:e?.desc})]})}),(0,p.jsx)(d.Col,{xs:24,xl:16,style:{alignSelf:`flex-start`},children:(0,p.jsx)(Y,{icon:(0,p.jsx)(f.AppstoreOutlined,{}),title:`Configuration Items`,extra:(0,p.jsxs)(fM,{type:`secondary`,children:[n.length,` item`,n.length===1?``:`s`]}),children:(0,p.jsx)(d.Row,{gutter:[14,14],children:n.length>0?n.map(e=>(0,p.jsx)(d.Col,{xs:24,sm:12,xl:8,children:(0,p.jsxs)(`div`,{className:`admin-config-item`,children:[(0,p.jsx)(`div`,{className:`admin-config-top-bar`}),(0,p.jsxs)(`div`,{className:`admin-config-body`,children:[(0,p.jsx)(`div`,{className:`admin-config-icon`,children:e.icon}),(0,p.jsxs)(`div`,{className:`admin-config-text`,children:[(0,p.jsx)(`span`,{className:`admin-config-label`,children:e.label}),(0,p.jsx)(`span`,{className:`admin-config-desc`,children:e.desc})]})]}),(0,p.jsx)(`div`,{className:`admin-config-divider`}),(0,p.jsx)(d.Button,{type:`link`,size:`small`,className:`admin-config-manage`,icon:(0,p.jsx)(f.RightOutlined,{}),iconPosition:`end`,children:`Manage`})]})},e.label)):(0,p.jsx)(d.Col,{span:24,children:(0,p.jsx)(`div`,{className:`admin-config-empty`,children:(0,p.jsx)(d.Empty,{description:`No settings found`,image:d.Empty.PRESENTED_IMAGE_SIMPLE})})})})})}),(0,p.jsx)(d.Col,{xs:24,xl:8,style:{alignSelf:`flex-start`},children:(0,p.jsxs)(Y,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Section Overview`,children:[(0,p.jsx)(`div`,{className:`admin-overview-list`,children:mM.filter(e=>e.group!==`Dashboard`).map(e=>{let n=e.group===t?.group;return(0,p.jsxs)(`div`,{className:`admin-overview-item${n?` active`:``}`,onClick:()=>{let t=e.items[0];t&&o(t.id)},children:[(0,p.jsxs)(`div`,{className:`admin-overview-left`,children:[(0,p.jsx)(`div`,{className:`admin-overview-icon`,children:e.items[0]?.icon}),(0,p.jsxs)(`div`,{className:`admin-overview-text`,children:[(0,p.jsx)(`span`,{className:`admin-overview-name`,children:e.group}),(0,p.jsxs)(`span`,{className:`admin-overview-sub`,children:[e.items.length,` module`,e.items.length===1?``:`s`]})]})]}),(0,p.jsx)(`span`,{className:`admin-overview-count${n?` active`:``}`,children:e.items.length})]},e.group)})}),(0,p.jsxs)(`div`,{className:`admin-overview-footer`,children:[(0,p.jsx)(`span`,{className:`admin-overview-footer-label`,children:`Total configuration items`}),(0,p.jsx)(`span`,{className:`admin-overview-footer-value`,children:a.filter(e=>e.cards).reduce((e,t)=>e+t.cards.length,0)})]})]})})]})}function bM(){let[e,t]=(0,u.useState)(`dashboard`),[n,r]=(0,u.useState)(``),i=(0,u.useMemo)(()=>mM.flatMap(e=>e.items),[]),a=(0,u.useMemo)(()=>i.find(t=>t.id===e),[i,e]),o=(0,u.useMemo)(()=>mM.find(t=>t.items.some(t=>t.id===e)),[e]),s=(0,u.useMemo)(()=>{if(!a?.cards)return[];let e=n.trim().toLowerCase();return e?a.cards.filter(t=>t.label.toLowerCase().includes(e)||t.desc.toLowerCase().includes(e)):a.cards},[a,n]),c=(0,u.useMemo)(()=>mM.map(e=>({key:e.group,type:`group`,label:e.group,children:e.items.map(e=>({key:e.id,icon:e.icon,label:e.label}))})),[]),l=e=>{t(e),r(``)};return e===`dashboard`||a?.heading,(0,p.jsxs)(`main`,{className:`admin-page`,children:[(0,p.jsx)(`div`,{className:`admin-breadcrumb`,children:(0,p.jsx)(d.Breadcrumb,{items:[{title:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f.HomeOutlined,{}),` Home`]})},{title:`Admin`}]})}),(0,p.jsxs)(d.Row,{gutter:[16,16],className:`admin-wrapper`,children:[(0,p.jsx)(d.Col,{xs:24,lg:6,xl:5,children:(0,p.jsxs)(Y,{title:`Admin Console`,icon:(0,p.jsx)(f.SettingOutlined,{}),children:[(0,p.jsxs)(`div`,{className:`admin-sidebar-banner`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-banner-title`,children:`Admin Panel`}),(0,p.jsx)(`span`,{className:`admin-sidebar-banner-sub`,children:`Configuration Center`}),(0,p.jsxs)(d.Row,{gutter:[8,0],children:[(0,p.jsx)(d.Col,{span:12,children:(0,p.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Groups`}),(0,p.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:mM.length})]})}),(0,p.jsx)(d.Col,{span:12,children:(0,p.jsxs)(`div`,{className:`admin-sidebar-pill`,children:[(0,p.jsx)(`span`,{className:`admin-sidebar-pill-label`,children:`Modules`}),(0,p.jsx)(`span`,{className:`admin-sidebar-pill-value`,children:i.length})]})})]})]}),(0,p.jsx)(d.Menu,{mode:`inline`,selectedKeys:[e],items:c,onClick:({key:e})=>l(e),className:`admin-sidebar-menu`})]})}),(0,p.jsx)(d.Col,{xs:24,lg:18,xl:19,children:e===`dashboard`?(0,p.jsx)(vM,{}):a?.component===`form-groups`?(0,p.jsx)(Fy,{}):a?.component===`detail-groups`?(0,p.jsx)(Ob,{}):a?.component===`row-actions`?(0,p.jsx)(Px,{}):a?.component===`users`?(0,p.jsx)(Aj,{}):a?.component===`teams`?(0,p.jsx)(Ij,{}):a?.component===`roles`?(0,p.jsx)(eM,{}):a?.component===`permissions`?(0,p.jsx)(sM,{}):a?.component===`templates`?(0,p.jsx)(Kx,{}):a?.component===`ai-services`?(0,p.jsx)(Xx,{}):a?.component===`bgc-integration`?(0,p.jsx)(pS,{}):(0,p.jsx)(yM,{activeSection:a,activeGroup:o,filteredCards:s,searchText:n,setSearchText:r,allItems:i,handleNav:l})})]})]})}var{Title:xM}=d.Typography;function SM(){let e=(0,h.useNavigate)(),{state:t}=(0,h.useLocation)(),n=t?.moduleName||`stickyNotes`,r=t?.title||`Sticky Notes`,i={...t?.request,params:{...t?.request?.params,limit:200,offset:0}};return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.ArrowLeftOutlined,{}),onClick:()=>e(-1),style:{marginBottom:12},children:`Back`}),(0,p.jsx)(It,{moduleName:n,title:r,columns:4,request:i,viewAll:!1})]})}var{Text:CM,Title:wM}=d.Typography,TM=10485760,EM=`/templates/test_cases_flow_template.base64.txt`,DM=`test_cases_flow_template.xlsx`,OM=`module | subModule | step_order | description | actions | key | value | expected | scenario`,kM={idle:0,module_set:1,encoding:1,validating:2,preview:3,inserting:3,done:4,error:1},AM=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Bulk upload`,href:`/bulk-upload`}];function jM(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]),r.onerror=n,r.readAsDataURL(e)})}function MM(e){return e.filter(e=>e.row_status===`valid`).map(e=>{let t={...e};return delete t.row_status,delete t.errors,t})}function NM(e){return e.flatMap(e=>(e.errors??[]).map(t=>({id:e.id,...t})))}function PM({errors:e}){return(0,p.jsx)(`div`,{className:`bulk-tooltip-errors`,children:(e??[]).map((e,t)=>(0,p.jsx)(`div`,{children:e.message},`${e.field}-${t}`))})}function FM({errors:e,expanded:t,onToggle:n,onSummaryClick:r}){return e.length===0?null:(0,p.jsxs)(`div`,{className:`bulk-error-banner`,children:[(0,p.jsxs)(`div`,{className:`bulk-error-summary`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`bulk-error-summary-main`,onClick:r,"aria-label":`Scroll to first invalid row`,children:[(0,p.jsx)(f.ExclamationCircleOutlined,{className:`bulk-error-icon`}),(0,p.jsxs)(`span`,{children:[e.length,` validation error(s) found`]})]}),(0,p.jsx)(d.Button,{type:`link`,onClick:n,"aria-expanded":t,children:t?`Hide Errors`:`View Errors`})]}),t&&(0,p.jsx)(`div`,{className:`bulk-error-list`,role:`region`,"aria-label":`Validation error details`,children:e.map((e,t)=>(0,p.jsxs)(`div`,{className:`bulk-error-line`,children:[(0,p.jsxs)(`span`,{className:`bulk-row-chip`,children:[`Row `,e.id]}),(0,p.jsx)(`span`,{children:e.message})]},`${e.id}-${e.field}-${t}`))})]})}function IM({rows:e,view:t,onViewChange:n,onConfirm:r,onReset:i,saving:a,firstInvalidRowId:o,firstInvalidRowRef:s}){let c=e.filter(e=>e.row_status===`invalid`),l=t===`errors`?c:e,u=c.length>0||a;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(d.Row,{justify:`space-between`,align:`middle`,gutter:[16,16],className:`bulk-table-toolbar`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space.Compact,{children:[(0,p.jsx)(d.Button,{type:t===`all`?`primary`:`default`,onClick:()=>n(`all`),children:`All rows`}),(0,p.jsx)(d.Button,{type:t===`errors`?`primary`:`default`,onClick:()=>n(`errors`),children:`Errors only`})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsxs)(CM,{type:`secondary`,children:[e.length,` row(s)`]})})]}),(0,p.jsx)(`div`,{className:`bulk-table-wrap`,children:(0,p.jsxs)(`table`,{className:`bulk-preview-table`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`bulk-col-row`,children:`Row`}),(0,p.jsx)(`th`,{className:`bulk-col-flow`,children:`Submodule`}),(0,p.jsx)(`th`,{className:`bulk-col-description`,children:`Description`}),(0,p.jsx)(`th`,{className:`bulk-col-keyword`,children:`Action`}),(0,p.jsx)(`th`,{className:`bulk-col-target`,children:`Key`}),(0,p.jsx)(`th`,{className:`bulk-col-status`,children:`Status`}),(0,p.jsx)(`th`,{className:`bulk-col-error`,children:`Error`})]})}),(0,p.jsx)(`tbody`,{children:l.map(e=>{let t=e.errors??[],n=e.row_status===`invalid`;return(0,p.jsxs)(`tr`,{ref:n&&e.id===o?s:null,className:n?`bulk-row-invalid`:``,children:[(0,p.jsx)(`td`,{children:e.id}),(0,p.jsx)(`td`,{title:e.submodule,children:e.submodule}),(0,p.jsx)(`td`,{title:e.description,children:e.description?e.description:(0,p.jsx)(`span`,{className:`bulk-empty-text`,children:`-empty-`})}),(0,p.jsx)(`td`,{children:(0,p.jsx)(`code`,{className:`bulk-code-chip`,children:e.actions})}),(0,p.jsx)(`td`,{title:e.key,children:e.key}),(0,p.jsx)(`td`,{children:n?(0,p.jsx)(d.Tag,{color:`red`,children:`Error`}):(0,p.jsx)(d.Tag,{color:`green`,children:`Valid`})}),(0,p.jsx)(`td`,{children:n?(0,p.jsx)(d.Tooltip,{title:(0,p.jsx)(PM,{errors:t}),placement:`left`,children:(0,p.jsxs)(`button`,{type:`button`,className:`bulk-error-info`,"aria-label":`View ${t.length} error(s) for row ${e.id}`,children:[(0,p.jsx)(f.InfoCircleOutlined,{}),(0,p.jsx)(d.Badge,{count:t.length,size:`small`})]})}):(0,p.jsx)(`span`,{className:`bulk-error-none`,children:`-`})})]},`${e.id}-${e.step_order}`)})})]})}),(0,p.jsxs)(d.Space,{className:`bulk-actions`,children:[(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:i,children:`Reset`}),(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.SaveOutlined,{}),loading:a,disabled:u,onClick:r,children:c.length>0?`Fix ${c.length} error(s) to proceed`:`Save to database`})]})]})}function LM(){let e=(0,h.useNavigate)(),r=(0,u.useMemo)(()=>t.l(),[]),i=(0,u.useRef)(null),a=(0,u.useRef)(null),[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(``),[m,g]=(0,u.useState)(`idle`),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),[x,S]=(0,u.useState)([]),[C,w]=(0,u.useState)(`all`),[T,E]=(0,u.useState)(null),[D,O]=(0,u.useState)(null),[k,A]=(0,u.useState)(!1),j=o.map(e=>({value:e.modulename,label:e.modulename})),M=NM(x),N=m===`encoding`||m===`validating`,P=!!c&&!N,F=kM[m]??0,I=x.find(e=>e.row_status===`invalid`)?.id,L=(0,u.useCallback)(()=>{l(``),g(`idle`),v(!1),b(null),S([]),w(`all`),E(null),O(null),i.current&&(i.current.value=``)},[]);(0,u.useEffect)(()=>{async function e(){try{let e=await th({project:r?.name??``,activeOnly:!0});s(e?.items??[])}catch(e){console.error(e),d.message.error(`Unable to load modules.`)}}e()},[r?.name]);let R=e=>{l(e??``),S([]),O(null),E(null),b(null),A(!1),g(e?`module_set`:`idle`)},z=async e=>{if(!e||!P)return;let t=e.name.split(`.`).pop()?.toLowerCase();if(![`xlsx`,`csv`].includes(t)){g(`module_set`),E({message:`Invalid file type. Please upload an Excel .xlsx or CSV .csv file.`});return}if(e.size>TM){g(`module_set`),E({message:`File must be 10 MB or smaller.`});return}E(null),S([]),O(null),b({name:e.name,size:e.size}),g(`encoding`);try{let n=await jM(e);g(`validating`);let i=await Xm({filename:e.name,project:r?.name??``,module:c,file_base64:n,file_type:t});S(i?.rows??[]),w(`all`),g(`preview`)}catch(e){console.error(e),E(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),g(`error`)}},B=async()=>{try{let e=await fetch(EM);if(!e.ok)throw Error(`Template file not found (${e.status})`);let t=(await e.text()).trim(),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);let i=new Blob([r],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=DM,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(a),d.message.success(`Sample template downloaded.`)}catch(e){console.error(e),d.message.error(`Unable to download sample template.`)}},V=async()=>{g(`inserting`),E(null);try{let t=await Zm({project:r?.name??``,module:c,uploaded_by:localStorage.getItem(`user_Email`)??``,rows:MM(x)});O(t),g(`done`),d.message.success(`Bulk upload saved. Redirecting to view test cases...`),window.setTimeout(()=>e(`/viewTestCase`),900)}catch(e){console.error(e),E(e.payload??{code:`NETWORK_ERROR`,message:e.message||`Could not reach the server.`}),g(`preview`)}},H=(0,u.useCallback)(()=>{a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[]),U=[`bulk-dropzone`,_?`bulk-dropzone-dragging`:``,y?`bulk-dropzone-has-file`:``,T&&m!==`preview`?`bulk-dropzone-error`:``,c?``:`bulk-dropzone-disabled`].filter(Boolean).join(` `);return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(n.Dt,{items:AM})}),r?.name&&(0,p.jsx)(d.Col,{children:(0,p.jsx)(CM,{strong:!0,children:r.name})})]}),(0,p.jsxs)(`div`,{className:`zt-page zt-page-wide bulk-page`,children:[(0,p.jsxs)(`div`,{className:`bulk-header`,children:[(0,p.jsx)(wM,{level:3,children:`Bulk upload test cases`}),(0,p.jsxs)(d.Space,{direction:`vertical`,size:4,children:[(0,p.jsx)(CM,{type:`secondary`,children:OM}),(0,p.jsx)(CM,{type:`secondary`,children:`Use the sample template for the required columns. Uploaded rows are saved as Active by default.`})]})]}),(0,p.jsx)(`div`,{className:`bulk-stepbar`,children:[`Select`,`Upload`,`Validate`,`Save`].map((e,t)=>(0,p.jsxs)(`span`,{className:t<F?`bulk-step-active`:``,children:[t+1,` `,e]},e))}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:`1. Module selector`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,className:`bulk-module-select`,placeholder:`Choose a module`,options:j,value:c||void 0,onChange:R})}),c&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`2. File upload`,extra:(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.DownloadOutlined,{}),onClick:B,children:`Download Sample Template`}),children:[(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,message:`First time uploading?`,description:`Download the sample template, keep the column names unchanged, fill your test steps, and upload either .xlsx or .csv.`,className:`bulk-inline-alert`}),(0,p.jsxs)(`button`,{type:`button`,className:U,disabled:!P,onClick:()=>i.current?.click(),onDragOver:e=>{e.preventDefault(),P&&v(!0)},onDragLeave:()=>v(!1),onDrop:e=>{e.preventDefault(),v(!1),z(e.dataTransfer.files?.[0])},children:[(0,p.jsx)(f.CloudUploadOutlined,{className:`bulk-upload-icon`}),y?(0,p.jsxs)(`span`,{className:`bulk-file-chip`,children:[y.name,` - `,Math.ceil(y.size/1024),` KB`]}):(0,p.jsx)(`span`,{children:`Drag & drop here, or click to browse`})]}),(0,p.jsx)(`input`,{ref:i,hidden:!0,type:`file`,accept:`.xlsx,.csv`,onChange:e=>z(e.target.files?.[0])}),N&&(0,p.jsx)(d.Progress,{percent:m===`encoding`?45:82,showInfo:!1,size:`small`}),T&&m!==`preview`&&(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:T.message,className:`bulk-inline-alert`})]}),x.length>0&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`3. Validation result`,children:[(0,p.jsx)(FM,{errors:M,expanded:k,onToggle:()=>A(e=>!e),onSummaryClick:H}),T&&m===`preview`&&(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:T.message,className:`bulk-inline-alert`}),(0,p.jsx)(IM,{rows:x,view:C,onViewChange:w,onConfirm:V,onReset:L,saving:m===`inserting`,firstInvalidRowId:I,firstInvalidRowRef:a})]}),D&&m===`done`&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:`4. Upload complete`,children:[(0,p.jsxs)(d.Row,{gutter:[16,16],className:`bulk-metrics`,children:[(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(CM,{children:`Total`}),(0,p.jsx)(`strong`,{children:x.length})]})}),(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(CM,{children:`Inserted`}),(0,p.jsx)(`strong`,{children:D.inserted??0})]})}),(0,p.jsx)(d.Col,{xs:24,md:8,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(CM,{children:`Failed`}),(0,p.jsx)(`strong`,{children:D.failed??0})]})})]}),(0,p.jsx)(d.Alert,{type:`success`,showIcon:!0,icon:(0,p.jsx)(f.CheckCircleOutlined,{}),message:`${D.inserted??0} test cases saved to database - module: ${c}`,className:`bulk-inline-alert`}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:L,children:`Upload another file`})]})]})]})}var RM=[{value:`navigate`,label:`Navigate`},{value:`fill`,label:`Fill`},{value:`click`,label:`Click`},{value:`select`,label:`Select`},{value:`press_key`,label:`Press Key`},{value:`type_and_select`,label:`Type and Select`},{value:`type_and_select_modal`,label:`Type and Select (Modal)`},{value:`upload_file`,label:`Upload File`},{value:`check_checkbox`,label:`Check Checkbox`},{value:`check_filter_checkbox`,label:`Check Filter Checkbox`},{value:`select_page_size`,label:`Select Page Size`},{value:`check_n_checkboxes`,label:`Check N Checkboxes`},{value:`store_text`,label:`Store Text`},{value:`reset_session`,label:`Reset Session`},{value:`switch_to_new_tab`,label:`Switch To New Tab`},{value:`close_tab`,label:`Close Tab`},{value:`assert_visible`,label:`Assert Visible`},{value:`assert_hidden`,label:`Assert Hidden`},{value:`assert_text`,label:`Assert Text`},{value:`assert_url`,label:`Assert URL`},{value:`assert_body_contains`,label:`Assert Body Contains`},{value:`assert_button_disabled`,label:`Assert Button Disabled`},{value:`assert_field_error`,label:`Assert Field Error`},{value:`assert_field_accepted`,label:`Assert Field Accepted`},{value:`assert_children_disabled`,label:`Assert Children Disabled`},{value:`assert_children_visible`,label:`Assert Children Visible`},{value:`assert_element_count`,label:`Assert Element Count`},{value:`assert_toast`,label:`Assert Toast`},{value:`assert_toast_success`,label:`Assert Toast Success`},{value:`assert_toast_error`,label:`Assert Toast Error`},{value:`wait_for_visible`,label:`Wait For Visible`},{value:`wait_for_hidden`,label:`Wait For Hidden`},{value:`wait_for_text`,label:`Wait For Text`}],{Text:zM}=d.Typography,BM=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}],VM={tags:`regression`,active:1},HM={module:{dbName:`Modules`,formField:`module`,label:`Module`}};function UM(e=[]){return e.map(e=>({value:e,label:e}))}function WM(e=``){return String(e??``).trim()}function GM(e=``){return WM(e).toLowerCase()}function KM(e=[]){let t=new Map;return e.forEach(e=>{let n=WM(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function qM(e=[],t,n){let r=WM(t).toLowerCase(),i=WM(n).toLowerCase();return e.reduce((e,t)=>{let n=WM(t?.module).toLowerCase(),a=WM(t?.flow).toLowerCase();if(n!==r||a!==i)return e;let o=Number(t?.step_order)||0;return Math.max(e,o)},0)+1}function JM({icon:e,title:t}){return(0,p.jsxs)(d.Space,{size:10,align:`center`,children:[(0,p.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,p.jsx)(zM,{strong:!0,className:`v1-section-label`,children:t})]})}function YM(){let[e]=d.Form.useForm(),[t]=d.Form.useForm(),[r,i]=(0,u.useState)([]),[a,o]=(0,u.useState)([]),[s,c]=(0,u.useState)([]),[l,m]=(0,u.useState)(!1),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)({open:!1,typeKey:`module`}),[b,x]=(0,u.useState)(!1),[S,C]=(0,u.useState)(!1),[w,T]=(0,u.useState)(!1),E=(0,h.useNavigate)(),D=HM[v.typeKey],O=(0,u.useMemo)(()=>UM(r),[r]),k=d.Form.useWatch(`module`,e),A=d.Form.useWatch(`flow`,e),j=!!WM(k),M=!!WM(A),N=!j,P=!j||!M,F=(e,t=[])=>{e===`module`&&i(t)},I=async()=>{m(!0);try{let e=await Gm(HM.module.dbName);i(e?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),d.message.error(`Unable to load testing options.`)}finally{m(!1)}},L=(0,u.useCallback)(async t=>{let n=WM(t);if(o([]),c([]),e.setFieldsValue({step_order:void 0}),n){_(!0);try{let e=await Ym({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];o(t),c(KM(t))}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{_(!1)}}},[e]),R=(0,u.useCallback)(async(t,n,r)=>{let i=WM(t),a=WM(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}C(!0);try{e.setFieldsValue({step_order:qM(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),d.message.error(`Unable to load step order.`)}finally{C(!1)}},[e]);(0,u.useEffect)(()=>{Promise.resolve().then(I)},[]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>L(k))},[L,k]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>R(k,A,a))},[a,R,A,k]);let z=async t=>{let n={module:WM(t.module),flow:WM(t.flow),step_order:Number(t.step_order),description:WM(t.description),keyword:GM(t.keyword),target:WM(t.target),value:WM(t.value),expected:WM(t.expected),tags:t.tags?WM(t.tags):VM.tags,active:Number(t.active)};T(!0);try{await Jm(n),d.message.success(`Test case details saved successfully.`),e.resetFields(),o([]),c([])}catch(e){console.error(`Unable to save test case:`,e),d.message.error(`Unable to save test case.`)}finally{T(!1)}},B=(t,n)=>{e.setFieldsValue({[t]:WM(n)})},V=t=>{e.setFieldsValue({module:WM(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:VM.tags,value:void 0,expected:void 0})},H=t=>{e.setFieldsValue({flow:WM(t),step_order:void 0})},U=e=>{let n=HM[e];y({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},W=()=>{y(e=>({...e,open:!1})),t.resetFields()},G=async()=>{try{let n=WM((await t.validateFields()).name),r=await Km({name:n,type:D.dbName});F(v.typeKey,r?.items??[]),e.setFieldsValue({[D.formField]:n}),d.message.success(`${D.label} added successfully.`),W()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),d.message.error(`Unable to add ${D.label.toLowerCase()}.`)}finally{x(!1)}};return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(n.Dt,{items:BM})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>E(`/zinnext-home`),children:`View Table`})})]}),(0,p.jsx)(`div`,{className:`v1-page`,children:(0,p.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,p.jsx)(`div`,{className:`v1-page-header`,children:(0,p.jsxs)(d.Space,{align:`center`,size:10,children:[(0,p.jsx)(f.ProfileOutlined,{className:`v1-outer-icon`}),(0,p.jsx)(`div`,{children:(0,p.jsx)(zM,{strong:!0,style:{fontSize:16},children:`Add Test Case`})})]})}),(0,p.jsx)(Y,{children:(0,p.jsxs)(d.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:VM,onFinish:z,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(JM,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`Test Case Details`}),extra:(0,p.jsx)(zM,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,loading:l,optionFilterProp:`label`,placeholder:`Select module`,options:O,onChange:V})}),(0,p.jsx)(d.Button,{"aria-label":`Add module`,icon:(0,p.jsx)(f.PlusOutlined,{}),style:{marginTop:30},onClick:()=>U(`module`)})]})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Flow`,name:`flow`,children:(0,p.jsx)(d.AutoComplete,{maxLength:100,allowClear:!0,disabled:N,options:s,placeholder:g?`Loading flows`:`Enter flow`,onChange:H,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,disabled:!0,placeholder:S?`Loading step order`:`Step order`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`keyword`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,disabled:P,optionFilterProp:`label`,placeholder:`Select action`,options:RM,onChange:t=>e.setFieldsValue({keyword:GM(t)})})})}),(0,p.jsx)(d.Col,{xs:24,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:3,maxLength:255,disabled:P,placeholder:`Enter description`,showCount:!0,onBlur:e=>B(`description`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`target`,children:(0,p.jsx)(d.Input,{maxLength:255,disabled:P,placeholder:`Enter target`,onBlur:e=>B(`target`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Tags`,name:`tags`,children:(0,p.jsx)(d.Input,{maxLength:200,disabled:P,placeholder:`Enter tags`,prefix:(0,p.jsx)(f.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>B(`tags`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:P,placeholder:`Enter value`,onBlur:e=>B(`value`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:P,placeholder:`Enter expected result`,onBlur:e=>B(`expected`,e.target.value)})})})]})}),(0,p.jsx)(`div`,{className:`v1-form-actions`,children:(0,p.jsx)(d.Form.Item,{children:(0,p.jsxs)(d.Space,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:w,disabled:P,children:`Submit`}),(0,p.jsx)(d.Button,{onClick:()=>{e.resetFields(),o([]),c([])},children:`Reset`})]})})})]})}),(0,p.jsx)(d.Modal,{title:`Add ${D.label}`,open:v.open,confirmLoading:b,okText:`Add`,onCancel:W,onOk:()=>{x(!0),G()},destroyOnHidden:!0,children:(0,p.jsxs)(d.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,p.jsx)(d.Form.Item,{label:`Name`,name:`name`,children:(0,p.jsx)(d.Input,{maxLength:100,placeholder:`Enter ${D.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:WM(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var{Text:XM}=d.Typography,ZM=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`}];function QM(e=``){return String(e??``).trim()}function $M(e=[],t){return e.map(e=>({value:e.id,label:e[t]}))}var eN=[{label:`Step`,value:`step_order`,width:70},{label:`Action`,value:`actions`,width:140},{label:`Key`,value:`key`,width:160,ellipsis:!0},{label:`Value`,value:`value`,ellipsis:!0},{label:`Description`,value:`description`,ellipsis:!0},{label:`Scenario`,value:`scenario`,width:110,render:e=>e===1?(0,p.jsx)(d.Tag,{color:`green`,children:`Positive`}):(0,p.jsx)(d.Tag,{color:`red`,children:`Negative`})}],tN={key:!1,value:!1,expected:!1};function nN(e,t){return t?e[t]??tN:tN}function rN(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function iN(){let[e]=d.Form.useForm(),r=(0,h.useNavigate)(),[i]=(0,h.useSearchParams)(),a=i.get(`edit`),o=!!a,s=(0,u.useMemo)(()=>t.l(),[]),[c,l]=(0,u.useState)([]),[m,g]=(0,u.useState)([]),[_,v]=(0,u.useState)([]),[y,b]=(0,u.useState)(RM),[x,S]=(0,u.useState)({}),[C,w]=(0,u.useState)(!1),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(!1),[k,A]=(0,u.useState)(!1),[j,M]=(0,u.useState)(!1),N=d.Form.useWatch(`module`,e),P=d.Form.useWatch(`submodule`,e),F=d.Form.useWatch(`actions`,e),I=!!N,L=!!P,R=(0,u.useMemo)(()=>nN(x,F),[x,F]),z=(0,u.useMemo)(()=>$M(c,`modulename`),[c]),B=(0,u.useMemo)(()=>$M(m,`submodulename`),[m]),V=(0,u.useMemo)(()=>c.find(e=>e.id===N)?.modulename??``,[c,N]),H=(0,u.useMemo)(()=>m.find(e=>e.id===P)?.submodulename??``,[P,m]),U=(0,u.useCallback)(async()=>{try{let e=await qm();Array.isArray(e?.options)&&e.options.length>0&&b(e.options),e?.rules&&typeof e.rules==`object`&&S(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),d.message.error(`Unable to load action validation rules.`)}},[]),W=(0,u.useCallback)(async e=>{if(!e){l([]);return}w(!0);try{let t=await th({project:e,activeOnly:!0});l(t?.items??[])}catch(e){console.error(`Unable to load modules:`,e),d.message.error(`Unable to load modules.`)}finally{w(!1)}},[]),G=(0,u.useCallback)(async(e,t)=>{if(!e||!t){g([]);return}E(!0);try{let n=await ih({project:e,module:t,activeOnly:!0});g(n?.items??[])}catch(e){console.error(`Unable to load submodules:`,e),d.message.error(`Unable to load submodules.`)}finally{E(!1)}},[]),ee=(0,u.useCallback)(async(t,n,r,i=``)=>{if(!t||!n||!r){v([]),e.setFieldsValue({step_order:void 0});return}O(!0);try{let[a,o]=await Promise.all([sh({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r,actions:i,limit:1e3}),uh({product_parent_ID:t,module_parent_ID:n,submodule_parent_ID:r})]);v(a?.items??[]),e.setFieldsValue({step_order:o?.step_order??1})}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{O(!1)}},[e]),te=(0,u.useCallback)(async(e=``)=>{if(!(!s?.id||!N||!P)){O(!0);try{let t=await sh({product_parent_ID:s.id,module_parent_ID:N,submodule_parent_ID:P,actions:e,limit:1e3});v(t?.items??[])}catch(e){console.error(`Unable to load action flows:`,e),d.message.error(`Unable to load action steps.`)}finally{O(!1)}}},[s?.id,N,P]),ne=(0,u.useCallback)(async()=>{if(!(!a||!s?.name)){M(!0);try{let t=await lh(a);await G(s.name,t.module);let n=await sh({product_parent_ID:t.product_parent_ID,module_parent_ID:t.module_parent_ID,submodule_parent_ID:t.submodule_parent_ID,limit:1e3});v(n?.items??[]),e.setFieldsValue({module:t.module_parent_ID,submodule:t.submodule_parent_ID,step_order:t.step_order,actions:t.actions,key:t.key,value:t.value,expected:t.expected,description:t.description,scenario:t.scenario===1,active:Number(t.active)!==0})}catch(e){console.error(`Unable to load test flow:`,e),d.message.error(`Unable to load test flow for edit.`),r(`/viewTestCase`)}finally{M(!1)}}},[a,e,G,r,s?.name]);return(0,u.useEffect)(()=>{if(!s){r(`/select-project`,{replace:!0});return}Promise.resolve().then(async()=>{await U(),await W(s.name),a&&await ne()})},[s,r,U,W,a,ne]),s?(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(n.Dt,{items:ZM})}),(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(XM,{strong:!0,children:s.name})]})})]}),(0,p.jsx)(`div`,{className:`zt-page`,children:(0,p.jsxs)(d.Form,{form:e,layout:`vertical`,colon:!1,className:`v1-form`,initialValues:{scenario:!0,active:!0},onFinish:async t=>{let n={product_parent_ID:Number(s?.id),module_parent_ID:Number(t.module),submodule_parent_ID:Number(t.submodule),description:QM(t.description),actions:QM(t.actions),key:QM(t.key),value:QM(t.value),expected:QM(t.expected),scenario:+!!t.scenario,active:+!!t.active};A(!0);try{if(o){await dh(a,{...n,step_order:Number(t.step_order)}),d.message.success(`Test case updated successfully.`),r(`/viewTestCase`);return}await ch(n),d.message.success(`Step saved (#${t.step_order}).`),e.setFieldsValue({actions:void 0,key:void 0,value:void 0,expected:void 0,description:void 0}),await ee(n.product_parent_ID,n.module_parent_ID,n.submodule_parent_ID)}catch(e){console.error(`Unable to save test case:`,e),d.message.error(o?`Unable to update test case.`:`Unable to save step.`)}finally{A(!1)}},autoComplete:`off`,disabled:j,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:8,className:`zt-section-title`,children:[(0,p.jsx)(`span`,{className:`zt-step-tag`,children:`1`}),(0,p.jsx)(`span`,{children:`Module & Submodule`})]}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],align:`bottom`,children:[(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,loading:C,placeholder:`Select module`,options:z,onChange:t=>{let n=c.find(e=>e.id===t)?.modulename??``;e.setFieldsValue({module:t,submodule:void 0,step_order:void 0,actions:void 0,key:void 0,value:void 0,expected:void 0}),rN(e,[`actions`,`key`,`value`,`expected`]),g([]),v([]),G(s?.name,n)}})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Submodule`,name:`submodule`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,disabled:!I,loading:T,placeholder:I?`Select submodule`:`Select module first`,options:B,onChange:t=>{e.setFieldsValue({submodule:t,actions:void 0,key:void 0,value:void 0,expected:void 0}),rN(e,[`actions`,`key`,`value`,`expected`]),ee(s?.id,N,t)}})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Scenario`,name:`scenario`,valuePropName:`checked`,children:(0,p.jsx)(d.Switch,{disabled:!L,checkedChildren:`Positive`,unCheckedChildren:`Negative`})})}),(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Active`,name:`active`,valuePropName:`checked`,children:(0,p.jsx)(d.Switch,{checkedChildren:`Active`,unCheckedChildren:`Inactive`})})})]})}),L&&(0,p.jsxs)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:8,className:`zt-section-title`,children:[(0,p.jsx)(`span`,{className:`zt-step-tag`,children:`2`}),(0,p.jsx)(f.FileTextOutlined,{}),(0,p.jsx)(`span`,{children:`Step Details`})]}),extra:(0,p.jsxs)(XM,{type:`secondary`,children:[V,` / `,H]}),children:[(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:6,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,children:(0,p.jsx)(d.Input,{disabled:!0,placeholder:D?`Loading…`:`Auto`})})}),(0,p.jsx)(d.Col,{xs:24,md:18,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`actions`,rules:[{required:!0,message:`Mandatory Field`}],children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`Select action`,options:y,onChange:t=>{let n=nN(x,t);e.setFieldsValue({actions:t,key:n.key?e.getFieldValue(`key`):void 0,value:n.value?e.getFieldValue(`value`):void 0,expected:n.expected?e.getFieldValue(`expected`):void 0}),rN(e,[`key`,`value`,`expected`]),te(t||``)}})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`key`,rules:[{required:R.key,message:`Key is required for this action`}],children:(0,p.jsx)(d.Input,{maxLength:255,disabled:F&&!R.key,placeholder:F?R.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,rules:[{required:R.value,message:`Value is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:1,autoSize:{minRows:1,maxRows:4},disabled:F&&!R.value,placeholder:F?R.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:R.expected,message:`Expected result is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:2,disabled:F&&!R.expected,placeholder:F?R.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:2,maxLength:255,showCount:!0,placeholder:`Enter description`})})})]}),(0,p.jsxs)(d.Space,{className:`zt-actions`,children:[(0,p.jsx)(d.Button,{onClick:()=>{if(o){r(`/viewTestCase`);return}e.resetFields(),g([]),v([]),E(!1),O(!1)},children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:k||j,children:o?`Update Test Case`:`Save & Continue`})]})]},`${N}-${P}`),L&&(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.TableOutlined,{}),(0,p.jsx)(`span`,{children:`Added Steps`})]}),extra:(0,p.jsx)(d.Tag,{children:F?`${_.length} ${F} step(s)`:`${_.length} step(s)`}),children:(0,p.jsx)(tl,{listName:`Added Steps`,loading:D,fields:eN,dataSource:_,current:1,pageSize:Math.max(_.length,1),total:_.length,rowSelection:!1,className:`zt-list-plain zt-list-static`})})]})})]}):null}var{Text:aN}=d.Typography,oN=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`}];function sN(){let e=(0,h.useNavigate)(),r=(0,u.useMemo)(()=>t.l(),[]),[i,a]=(0,u.useState)([]),[o,s]=(0,u.useState)({}),[c,l]=(0,u.useState)(!1),[m,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)(``),[y,b]=(0,u.useState)(!1),[x,S]=(0,u.useState)(1),[C,w]=(0,u.useState)(10),T=(0,u.useCallback)(async e=>{if(!e){a([]);return}l(!0);try{let[t,n]=await Promise.all([th({project:e}),ih({project:e})]);a(t?.items??[]);let r={};(n?.items??[]).forEach(e=>{let t=e.modulename;r[t]=(r[t]??0)+1}),s(r)}catch(e){console.error(e),d.message.error(`Unable to load modules.`)}finally{l(!1)}},[]);(0,u.useEffect)(()=>{if(!r){e(`/select-project`,{replace:!0});return}Promise.resolve().then(()=>T(r.name))},[r,e,T]);let E=async(e,t)=>{try{await rh(e.id,+!!t),a(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),d.message.success(`Module ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),d.message.error(`Unable to update module status.`)}},D=async()=>{let e=_.trim();if(!e){d.message.warning(`Enter a module name.`);return}b(!0);try{await nh({project:r.name,modulename:e}),d.message.success(`Module added.`),g(!1),v(``),S(1),T(r.name)}catch(e){console.error(e),d.message.error(`Unable to add module (maybe it already exists).`)}finally{b(!1)}},O=t=>{e(`/test-cases/zinnext/submodules?module=${encodeURIComponent(t.modulename)}`)};return r?(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(n.Dt,{items:oN})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,p.jsxs)(`div`,{className:`zt-page`,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-bar`,children:(0,p.jsxs)(d.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(`span`,{children:`Project:`}),(0,p.jsx)(aN,{strong:!0,children:r.name})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>g(!0),children:`Add Module`})})]})}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Modules`})]}),children:(0,p.jsx)(tl,{listName:`Modules`,loading:c,fields:[{label:`Module`,value:`modulename`},{label:`Submodules`,value:`submoduleCount`,width:140,render:(e,t)=>(0,p.jsxs)(d.Button,{type:`link`,className:`zt-count-link`,onClick:()=>O(t),children:[o[t.modulename]??0,` submodule(s)`]})},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,p.jsx)(d.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>E(t,e)})}],dataSource:i,current:x,pageSize:C,total:i.length,onPageChange:S,onPageSizeChange:e=>{S(1),w(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,p.jsx)(d.Modal,{title:`Add Module`,open:m,confirmLoading:y,okText:`Add`,onOk:D,onCancel:()=>{g(!1),v(``)},destroyOnHidden:!0,children:(0,p.jsxs)(d.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,p.jsxs)(aN,{type:`secondary`,children:[`Project: `,(0,p.jsx)(`b`,{children:r.name})]}),(0,p.jsx)(d.Input,{placeholder:`Enter module name`,maxLength:100,value:_,onChange:e=>v(e.target.value),onPressEnter:D})]})})]}):null}var{Text:cN}=d.Typography,lN=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Manage Modules`,href:`/manageModules`},{label:`Manage Submodules`,href:`/test-cases/zinnext/submodules`}];function uN(){let e=(0,h.useNavigate)(),[r]=(0,h.useSearchParams)(),i=(0,u.useMemo)(()=>t.l(),[]),a=r.get(`module`)??``,[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(!1),[m,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)(``),[y,b]=(0,u.useState)(!1),[x,S]=(0,u.useState)(1),[C,w]=(0,u.useState)(10),T=(0,u.useCallback)(async(e,t)=>{if(!e||!t){s([]);return}l(!0);try{let n=await ih({project:e,module:t});s(n?.items??[])}catch(e){console.error(e),d.message.error(`Unable to load submodules.`)}finally{l(!1)}},[]);(0,u.useEffect)(()=>{if(!i){e(`/select-project`,{replace:!0});return}if(!a){e(`/manageModules`,{replace:!0});return}Promise.resolve().then(()=>T(i.name,a))},[i,a,e,T]);let E=async(e,t)=>{try{await oh(e.id,+!!t),s(n=>n.map(n=>n.id===e.id?{...n,active:+!!t}:n)),d.message.success(`Submodule ${t?`activated`:`deactivated`}.`)}catch(e){console.error(e),d.message.error(`Unable to update submodule status.`)}},D=async()=>{let e=_.trim();if(!e){d.message.warning(`Enter a submodule name.`);return}b(!0);try{await ah({project:i.name,modulename:a,submodulename:e}),d.message.success(`Submodule added.`),g(!1),v(``),S(1),T(i.name,a)}catch(e){console.error(e),d.message.error(`Unable to add submodule (maybe it already exists).`)}finally{b(!1)}};return!i||!a?null:(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(n.Dt,{items:lN})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/manageModules`),children:`Back to Modules`})})]}),(0,p.jsxs)(`div`,{className:`zt-page`,children:[(0,p.jsx)(d.Card,{className:`v1-card zt-bar`,children:(0,p.jsxs)(d.Row,{gutter:[16,16],align:`middle`,justify:`space-between`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsxs)(d.Space,{size:16,wrap:!0,className:`zt-section-title`,children:[(0,p.jsxs)(d.Space,{size:6,children:[(0,p.jsx)(f.ProjectOutlined,{}),(0,p.jsx)(`span`,{children:`Project:`}),(0,p.jsx)(cN,{strong:!0,children:i.name})]}),(0,p.jsxs)(d.Space,{size:6,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Module:`}),(0,p.jsx)(cN,{strong:!0,children:a})]})]})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`primary`,icon:(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>g(!0),children:`Add Submodule`})})]})}),(0,p.jsx)(d.Card,{className:`v1-card zt-fall`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.AppstoreOutlined,{}),(0,p.jsx)(`span`,{children:`Submodules`})]}),children:(0,p.jsx)(tl,{listName:`Submodules`,loading:c,fields:[{label:`Submodule`,value:`submodulename`},{label:`Active`,value:`active`,width:120,render:(e,t)=>(0,p.jsx)(d.Switch,{checked:e===1,checkedChildren:`On`,unCheckedChildren:`Off`,onChange:e=>E(t,e)})}],dataSource:o,current:x,pageSize:C,total:o.length,onPageChange:S,onPageSizeChange:e=>{S(1),w(e)},rowSelection:!1,className:`zt-list-plain`})})]}),(0,p.jsx)(d.Modal,{title:`Add Submodule`,open:m,confirmLoading:y,okText:`Add`,onOk:D,onCancel:()=>{g(!1),v(``)},destroyOnHidden:!0,children:(0,p.jsxs)(d.Space,{direction:`vertical`,className:`zt-modal-stack`,children:[(0,p.jsxs)(cN,{type:`secondary`,children:[`Project: `,(0,p.jsx)(`b`,{children:i.name}),` \xA0|\xA0 Module: `,(0,p.jsx)(`b`,{children:a})]}),(0,p.jsx)(d.Input,{placeholder:`Enter submodule name`,maxLength:100,value:_,onChange:e=>v(e.target.value),onPressEnter:D})]})})]})}var{Text:dN}=d.Typography,fN=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/addTestCase`},{label:`Table`,href:`/viewTestCase`}];function pN(){let e=(0,h.useNavigate)(),[r,i]=(0,u.useState)([]),[a,o]=(0,u.useState)(0),[s,c]=(0,u.useState)(!1),l=(0,u.useMemo)(()=>t.l(),[]),[m,g]=(0,u.useState)(``),[_,v]=(0,u.useState)(1),[y,b]=(0,u.useState)(20),[x,S]=(0,u.useState)(null),C=(0,u.useCallback)(async(e={})=>{c(!0);try{let t=await sh({product_parent_ID:e.project??l?.id??``,search:e.search??m??``,limit:e.pageSize??y,offset:((e.page??_)-1)*(e.pageSize??y)});i(t?.items??[]),o(t?.total??0)}catch(e){console.error(e),d.message.error(`Unable to load test flows.`)}finally{c(!1)}},[l?.id,m,_,y]),w=e=>{d.Modal.confirm({title:`Delete Test Case`,icon:(0,p.jsx)(f.ExclamationCircleOutlined,{}),content:`Are you sure you want to delete this test case?`,okText:`Delete`,okButtonProps:{danger:!0,loading:x===e.id},cancelText:`Cancel`,async onOk(){S(e.id);try{await fh(e.id),d.message.success(`Test case deleted successfully.`);let t=r.length===1&&_>1?_-1:_;v(t),await C({page:t})}catch(e){throw console.error(`Unable to delete test flow:`,e),d.message.error(`Unable to delete test case.`),e}finally{S(null)}}})};return(0,u.useEffect)(()=>{Promise.resolve().then(()=>{if(!l?.id){e(`/select-project`,{replace:!0});return}C({page:1})})},[]),(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(n.Dt,{items:fN})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>e(`/addTestCase`),children:`Back to Form`})})]}),(0,p.jsx)(`div`,{className:`zt-page zt-page-wide`,children:(0,p.jsxs)(d.Card,{className:`v1-card`,title:(0,p.jsxs)(d.Space,{size:6,className:`zt-section-title`,children:[(0,p.jsx)(f.TableOutlined,{}),(0,p.jsx)(`span`,{children:`Test Flows`})]}),extra:(0,p.jsxs)(dN,{type:`secondary`,children:[a,` row(s)`]}),children:[(0,p.jsxs)(d.Space,{wrap:!0,className:`zt-toolbar`,children:[(0,p.jsx)(d.Input.Search,{allowClear:!0,className:`zt-search-filter`,placeholder:`Search module / key / description`,value:m,onChange:e=>g(e.target.value),onSearch:()=>{v(1),C({page:1})}}),(0,p.jsx)(d.Button,{icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:()=>C(),children:`Refresh`})]}),(0,p.jsx)(tl,{listName:`Test Flows`,loading:s,fields:[{label:`Actions`,value:`rowActions`,width:112,fixed:`left`,sorter:!1,render:(t,n)=>(0,p.jsxs)(d.Space,{size:4,className:`zt-row-actions`,children:[(0,p.jsx)(d.Tooltip,{title:`Edit`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.EditOutlined,{}),onClick:()=>e(`/addTestCase?edit=${n.id}`)})}),(0,p.jsx)(d.Tooltip,{title:`Delete`,children:(0,p.jsx)(d.Button,{danger:!0,type:`text`,size:`small`,icon:(0,p.jsx)(f.DeleteOutlined,{}),loading:x===n.id,onClick:()=>w(n)})})]})},{label:`ID`,value:`id`,width:70,fixed:`left`},{label:`Project`,value:`project`,width:130},{label:`Module`,value:`module`,width:130},{label:`Submodule`,value:`submodule`,width:140},{label:`Step`,value:`step_order`,width:70},{label:`Action`,value:`actions`,width:140},{label:`Key`,value:`key`,width:160,ellipsis:!0},{label:`Value`,value:`value`,width:200,ellipsis:!0},{label:`Expected`,value:`expected`,width:180,ellipsis:!0},{label:`Description`,value:`description`,width:180,ellipsis:!0},{label:`Scenario`,value:`scenario`,width:110,render:e=>e===1?(0,p.jsx)(d.Tag,{color:`green`,children:`Positive`}):(0,p.jsx)(d.Tag,{color:`red`,children:`Negative`})},{label:`Active`,value:`active`,width:90,render:e=>e===1?(0,p.jsx)(d.Tag,{color:`blue`,children:`Active`}):(0,p.jsx)(d.Tag,{children:`Inactive`})}],dataSource:r,current:_,pageSize:y,total:a,onPageChange:e=>{v(e),C({page:e})},onPageSizeChange:e=>{v(1),b(e),C({page:1,pageSize:e})},rowSelection:!1,className:`zt-list-plain`})]})})]})}var mN=[{label:`Home`,href:`/`},{label:`Test Cases`,href:`/test-cases`}];function hN(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(n.Dt,{items:mN}),(0,p.jsx)(n.rt,{moduleName:`test-flows`,rowKey:`id`})]})}var{Text:gN}=d.Typography,_N=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}],vN={tags:`regression`,active:1},yN={module:{dbName:`Modules`,formField:`module`,label:`Module`}},bN={key:!1,value:!1,expected:!1};function xN(e,t){return t?e[t]??bN:bN}function SN(e,t){e.setFields(t.map(e=>({name:e,errors:[]})))}function CN(e=[]){return e.map(e=>({value:e,label:e}))}function wN(e=``){return String(e??``).trim()}function TN(e=[]){let t=new Map;return e.forEach(e=>{let n=wN(e?.flow),r=n.toLowerCase();n&&!t.has(r)&&t.set(r,n)}),Array.from(t.values()).map(e=>({value:e,label:e}))}function EN(e=[],t,n){let r=wN(t).toLowerCase(),i=wN(n).toLowerCase();return e.reduce((e,t)=>{let n=wN(t?.module).toLowerCase(),a=wN(t?.flow).toLowerCase();if(n!==r||a!==i)return e;let o=Number(t?.step_order)||0;return Math.max(e,o)},0)+1}function DN({icon:e,title:t}){return(0,p.jsxs)(d.Space,{size:10,align:`center`,children:[(0,p.jsx)(`div`,{className:`v1-section-icon-box`,children:e}),(0,p.jsx)(gN,{strong:!0,className:`v1-section-label`,children:t})]})}function ON(){let[e]=d.Form.useForm(),[t]=d.Form.useForm(),[r,i]=(0,u.useState)([]),[a,o]=(0,u.useState)([]),[s,c]=(0,u.useState)([]),[l,m]=(0,u.useState)(RM),[g,_]=(0,u.useState)({}),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(!1),[S,C]=(0,u.useState)({open:!1,typeKey:`module`}),[w,T]=(0,u.useState)(!1),[E,D]=(0,u.useState)(!1),[O,k]=(0,u.useState)(!1),A=(0,h.useNavigate)(),j=yN[S.typeKey],M=(0,u.useMemo)(()=>CN(r),[r]),N=d.Form.useWatch(`module`,e),P=d.Form.useWatch(`flow`,e),F=d.Form.useWatch(`keyword`,e),I=!!wN(N),L=!!wN(P),R=!I,z=!I||!L,B=(0,u.useMemo)(()=>xN(g,F),[g,F]),V=(e,t=[])=>{e===`module`&&i(t)},H=async()=>{y(!0);try{let e=await Gm(yN.module.dbName);i(e?.items??[])}catch(e){console.error(`Unable to load testing options:`,e),d.message.error(`Unable to load testing options.`)}finally{y(!1)}},U=async()=>{try{let e=await qm();Array.isArray(e?.options)&&e.options.length>0&&m(e.options),e?.rules&&typeof e.rules==`object`&&_(e.rules)}catch(e){console.error(`Unable to load action field rules:`,e),d.message.error(`Unable to load action validation rules.`)}},W=(0,u.useCallback)(async t=>{let n=wN(t);if(o([]),c([]),e.setFieldsValue({step_order:void 0}),n){x(!0);try{let e=await $m({limit:1e4,offset:0,module:n}),t=Array.isArray(e?.items)?e.items:[];o(t),c(TN(t))}catch(e){console.error(`Unable to load flows:`,e),d.message.error(`Unable to load flows.`)}finally{x(!1)}}},[e]),G=(0,u.useCallback)(async(t,n,r)=>{let i=wN(t),a=wN(n);if(!i||!a){e.setFieldsValue({step_order:void 0});return}D(!0);try{e.setFieldsValue({step_order:EN(r,i,a)})}catch(e){console.error(`Unable to load step order:`,e),d.message.error(`Unable to load step order.`)}finally{D(!1)}},[e]);(0,u.useEffect)(()=>{Promise.resolve().then(async()=>{await Promise.all([H(),U()])})},[]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>W(N))},[W,N]),(0,u.useEffect)(()=>{Promise.resolve().then(()=>G(N,P,a))},[a,G,P,N]);let ee=async t=>{let n={module:wN(t.module),flow:wN(t.flow),step_order:Number(t.step_order),description:wN(t.description),keyword:wN(t.keyword),target:wN(t.target),value:wN(t.value),expected:wN(t.expected),tags:t.tags?wN(t.tags):vN.tags,active:Number(t.active)};k(!0);try{await Qm(n),d.message.success(`LMS case details saved successfully.`),e.resetFields(),o([]),c([])}catch(e){console.error(`Unable to save LMS case:`,e),d.message.error(`Unable to save LMS case.`)}finally{k(!1)}},te=(t,n)=>{e.setFieldsValue({[t]:wN(n)})},ne=t=>{e.setFieldsValue({module:wN(t),flow:void 0,step_order:void 0,keyword:void 0,description:void 0,target:void 0,tags:vN.tags,value:void 0,expected:void 0}),SN(e,[`keyword`,`target`,`value`,`expected`])},re=t=>{e.setFieldsValue({flow:wN(t),step_order:void 0,keyword:void 0,target:void 0,value:void 0,expected:void 0}),SN(e,[`keyword`,`target`,`value`,`expected`])},ie=t=>{let n=xN(g,t);e.setFieldsValue({keyword:wN(t),target:n.key?e.getFieldValue(`target`):void 0,value:n.value?e.getFieldValue(`value`):void 0,expected:n.expected?e.getFieldValue(`expected`):void 0}),SN(e,[`target`,`value`,`expected`])},ae=e=>{let n=yN[e];C({open:!0,typeKey:e}),t.setFieldsValue({name:``,type:n.label})},oe=()=>{C(e=>({...e,open:!1})),t.resetFields()},se=async()=>{try{let n=wN((await t.validateFields()).name),r=await Km({name:n,type:j.dbName});V(S.typeKey,r?.items??[]),e.setFieldsValue({[j.formField]:n}),d.message.success(`${j.label} added successfully.`),oe()}catch(e){if(e?.errorFields)return;console.error(`Unable to save testing option:`,e),d.message.error(`Unable to add ${j.label.toLowerCase()}.`)}finally{T(!1)}};return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsxs)(d.Row,{align:`middle`,justify:`space-between`,className:`breadcrumb-action-wrapper`,children:[(0,p.jsx)(d.Col,{children:(0,p.jsx)(n.Dt,{items:_N})}),(0,p.jsx)(d.Col,{children:(0,p.jsx)(d.Button,{type:`link`,onClick:()=>A(`/lms-home`),children:`View Table`})})]}),(0,p.jsx)(`div`,{className:`v1-page`,children:(0,p.jsxs)(`div`,{className:`v1-page-inner`,children:[(0,p.jsx)(`div`,{className:`v1-page-header`,children:(0,p.jsxs)(d.Space,{align:`center`,size:10,children:[(0,p.jsx)(f.ProfileOutlined,{className:`v1-outer-icon`}),(0,p.jsx)(`div`,{children:(0,p.jsx)(gN,{strong:!0,style:{fontSize:16},children:`Add LMS Case`})})]})}),(0,p.jsx)(Y,{children:(0,p.jsxs)(d.Form,{form:e,className:`v1-form`,layout:`vertical`,colon:!1,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),initialValues:vN,onFinish:ee,autoComplete:`off`,children:[(0,p.jsx)(d.Card,{className:`v1-card`,title:(0,p.jsx)(DN,{icon:(0,p.jsx)(f.FileTextOutlined,{}),title:`LMS Case Details`}),extra:(0,p.jsx)(gN,{type:`secondary`,className:`v1-card-subtitle`,children:`Module, flow, step order and execution data`}),children:(0,p.jsxs)(d.Row,{gutter:[24,0],children:[(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsxs)(d.Space.Compact,{style:{width:`100%`},children:[(0,p.jsx)(d.Form.Item,{label:`Module`,name:`module`,style:{flex:1},children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,loading:v,optionFilterProp:`label`,placeholder:`Select module`,options:M,onChange:ne})}),(0,p.jsx)(d.Button,{"aria-label":`Add module`,icon:(0,p.jsx)(f.PlusOutlined,{}),style:{marginTop:30},onClick:()=>ae(`module`)})]})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Flow`,name:`flow`,children:(0,p.jsx)(d.AutoComplete,{maxLength:100,allowClear:!0,disabled:R,options:s,placeholder:b?`Loading flows`:`Enter flow`,onChange:re,filterOption:(e,t)=>t?.value?.toLowerCase().includes(e.toLowerCase())})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Step Order`,name:`step_order`,validateTrigger:[`onBlur`,`onChange`],children:(0,p.jsx)(d.Input,{maxLength:10,disabled:!0,placeholder:E?`Loading step order`:`Step order`})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Action`,name:`keyword`,children:(0,p.jsx)(d.Select,{allowClear:!0,showSearch:!0,disabled:z,optionFilterProp:`label`,placeholder:`Select action`,options:l,onChange:ie})})}),(0,p.jsx)(d.Col,{xs:24,children:(0,p.jsx)(d.Form.Item,{label:`Description`,name:`description`,children:(0,p.jsx)(d.Input.TextArea,{rows:3,maxLength:255,disabled:z,placeholder:`Enter description`,showCount:!0,onBlur:e=>te(`description`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Key`,name:`target`,rules:[{required:B.key,message:`Key is required for this action`}],children:(0,p.jsx)(d.Input,{maxLength:255,disabled:z||!!F&&!B.key,placeholder:z?`Select module and flow first`:F?B.key?`Required — Enter selector / locator`:`Not needed for this action`:`Select an action first`,onBlur:e=>te(`target`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Tags`,name:`tags`,children:(0,p.jsx)(d.Input,{maxLength:200,disabled:z,placeholder:`Enter tags`,prefix:(0,p.jsx)(f.TagsOutlined,{className:`v1-input-icon`}),onBlur:e=>te(`tags`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Value`,name:`value`,rules:[{required:B.value,message:`Value is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:z||!!F&&!B.value,placeholder:z?`Select module and flow first`:F?B.value?`Required — Enter value`:`Not needed for this action`:`Select an action first`,onBlur:e=>te(`value`,e.target.value)})})}),(0,p.jsx)(d.Col,{xs:24,md:12,children:(0,p.jsx)(d.Form.Item,{label:`Expected`,name:`expected`,rules:[{required:B.expected,message:`Expected result is required for this action`}],children:(0,p.jsx)(d.Input.TextArea,{rows:4,disabled:z||!!F&&!B.expected,placeholder:z?`Select module and flow first`:F?B.expected?`Required — Enter expected result`:`Not needed for this action`:`Select an action first`,onBlur:e=>te(`expected`,e.target.value)})})})]})}),(0,p.jsx)(`div`,{className:`v1-form-actions`,children:(0,p.jsx)(d.Form.Item,{children:(0,p.jsxs)(d.Space,{children:[(0,p.jsx)(d.Button,{type:`primary`,htmlType:`submit`,loading:O,disabled:z,children:`Submit`}),(0,p.jsx)(d.Button,{onClick:()=>{e.resetFields(),o([]),c([])},children:`Reset`})]})})})]})}),(0,p.jsx)(d.Modal,{title:`Add ${j.label}`,open:S.open,confirmLoading:w,okText:`Add`,onCancel:oe,onOk:()=>{T(!0),se()},destroyOnHidden:!0,children:(0,p.jsxs)(d.Form,{form:t,layout:`vertical`,colon:!1,className:`v1-form`,requiredMark:(e,{required:t})=>(0,p.jsxs)(p.Fragment,{children:[e,t&&(0,p.jsx)(`span`,{className:`v1-required-mark`,children:` *`})]}),children:[(0,p.jsx)(d.Form.Item,{label:`Name`,name:`name`,children:(0,p.jsx)(d.Input,{maxLength:100,placeholder:`Enter ${j.label.toLowerCase()} name`,onBlur:e=>{t.setFieldsValue({name:wN(e.target.value)})}})}),(0,p.jsx)(d.Form.Item,{label:`Type`,name:`type`,children:(0,p.jsx)(d.Input,{disabled:!0})})]})})]})})]})}var kN=[{label:`Home`,href:`/`},{label:`LMS Cases`,href:`/lms-cases`}];function AN(){return(0,p.jsxs)(`main`,{className:`jobs-list-page`,children:[(0,p.jsx)(n.Dt,{items:kN}),(0,p.jsx)(n.rt,{moduleName:`lms-flows`,rowKey:`id`})]})}var jN=[`referenceId`,`ReferenceId`,`candidateId`,`CandidateId`,`entityId`,`EntityId`,`id`,`Id`,`_id`];function MN(e=jN){return function(t){if(!t||typeof t!=`object`)return``;for(let n of e){let e=t[n];if(e!=null&&e!==``)return String(e)}return``}}function NN(e,t=jN){if(!e||typeof e!=`object`)return[];let n=[];for(let r of t){let t=e[r];t!=null&&t!==``&&n.push(String(t))}return n}var PN=MN();function FN(e){return typeof e==`function`?e:typeof e==`string`?MN([e]):Array.isArray(e)?MN(e):PN}function IN(e,t,n){return!t||typeof t!=`object`?e:{...t,...e,id:e?.id??t?.id??n}}function LN(e,t,n={}){return{status:`success`,total:t,data:{data:e,...n}}}var RN=[`fields`,`fieldConfig`,`tabs`,`tabField`,`actionRules`,`actions`,`columnActions`];function zN(e){let t=e?.data??e,n={};for(let r of RN){let i=e?.[r]??t?.[r];i==null||Array.isArray(i)&&i.length===0||(n[r]=i)}return n}var BN=e=>String(e??``).replace(/[^a-zA-Z0-9]/g,``).toLowerCase();function VN(e,t,n){let r=(Array.isArray(n)?n:[n]).map(BN).filter(Boolean),i=r.length?e.findIndex(e=>r.includes(BN(e?.value))||r.includes(BN(e?.label))):-1;if(i===-1)return[...e,...t];let a=Number(e[i]?.order),o=Number.isFinite(a)?t.map((e,n)=>e.order==null||e.order===``?{...e,order:a+(n+1)/(t.length+1)}:e):t;return[...e.slice(0,i+1),...o,...e.slice(i+1)]}var HN=(e,t)=>n.kt(e,t).rows,UN=(e,t)=>{let{rows:r,total:i}=n.kt(e,t);return{rows:r,total:i}};function WN(e,t){return function(n,r,i,a={}){return e(t??n,r,i,a)}}function GN(e){return!e||typeof e!=`object`||typeof(e.fetchByKeys??e.fetch??e.function)!=`function`?null:{...e,fetchByKeys:typeof e.fetchByKeys==`function`?e.fetchByKeys:null,fetch:typeof e.fetch==`function`?e.fetch:null,function:typeof e.function==`function`?e.function:null,extractRows:typeof e.extractRows==`function`?e.extractRows:HN,mergeRow:typeof e.mergeRow==`function`?e.mergeRow:IN,fetchById:typeof e.fetchById==`function`?e.fetchById:null}}function KN({fetchSecondaryByKeys:e,fetchSecondary:t,extractSecondaryRows:n,fetchSecondaryById:r,secondaryKey:i,mergeRow:a,secondaryFetchLimit:o}){return!e&&!t&&!r?[]:[GN({key:i,fetchByKeys:e?(t,n,r)=>e(t,n,r):null,function:t?({moduleName:e,options:n})=>t(e,o,0,n):null,extractRows:n,fetchById:r,mergeRow:a})].filter(Boolean)}function qN(e){if(typeof e==`function`)return t=>{let n=e(t);return n==null||n===``?[]:[String(n)]};let t=typeof e==`string`?[e]:Array.isArray(e)&&e.length?e:jN;return e=>NN(e,t)}function JN(e,t){let n=new Map;return e.forEach(e=>{for(let r of t(e))n.has(r)||n.set(r,e)}),n}function YN({moduleName:e,limit:t,offset:n,options:r,keys:i,primaryResponse:a,primaryRows:o,pageRows:s,total:c,source:l}){return{moduleName:e,limit:t,offset:n,options:r,keys:i,primaryResponse:a,primaryRows:o,pageRows:s,total:c,source:l}}async function XN(e,t){if(typeof e.args==`function`){let n=e.args(t);return(e.fetch??e.function??e.fetchByKeys)(...Array.isArray(n)?n:[n])}if(Array.isArray(e.args))return(e.fetch??e.function??e.fetchByKeys)(...e.args);if(e.fetchByKeys&&Array.isArray(t.keys))return e.fetchByKeys(t.moduleName,t.keys,t.options,t);let n=e.fetch??e.function;return typeof n==`function`?n(t):null}function ZN({fetchPrimaryPage:e,extractPrimaryPage:t=UN,fetchSecondaryByKeys:n,joinSources:r=[],fetchPrimary:i,extractPrimaryRows:a=HN,fetchSecondary:o,extractSecondaryRows:s=HN,fetchSecondaryById:c,primaryKey:l,secondaryKey:u,mergeRow:d=IN,secondaryFetchLimit:f=200,extraFields:p=[],extraFieldsAfter:m}){let h=Array.isArray(r)&&r.length?r.map(GN).filter(Boolean):KN({fetchSecondaryByKeys:n,fetchSecondary:o,extractSecondaryRows:s,fetchSecondaryById:c,secondaryKey:u,mergeRow:d,secondaryFetchLimit:f}),g=0;async function _(e,t,n,r){if(!e.fetchById||!r)return null;try{let i=await e.fetchById(n,r);return i&&t(i).includes(String(r))?i:null}catch(e){return console.error(`[mergedListApi] per-id join lookup failed for "${r}"`,e),null}}async function v(e,t,n,r,i){if(!n)return e;let a=t.extractRows(n,r)??[],o=FN(t.primaryKey??l),s=qN(t.key),c=JN(a,s);return Promise.all(e.map(async e=>{let n=o(e),a=c.get(n)??(i()?null:await _(t,s,r,n));return t.mergeRow(e,a,n)}))}async function y(e,t,n,r){let i=e;for(let e of t)i=await v(i,e.source,e.response,n,r);return i}function b(e,t,n){let r={};for(let e of n){if(!e)continue;let t=zN(e);for(let e of Object.keys(t))r[e]??(r[e]=t[e])}return p.length&&(r.fields=VN(r.fields??[],p,m)),LN(e,t,r)}async function x({moduleName:e,limit:t,offset:n,options:r,primaryResponse:i,primaryRows:a,pageRows:o,total:s}){return Promise.all(h.map(async c=>{try{let u=FN(c.primaryKey??l),d=[...new Set(o.map(u).filter(Boolean))];return c.fetchByKeys&&d.length===0?{source:c,response:null}:{source:c,response:await XN(c,YN({moduleName:e,limit:t,offset:n,options:r,keys:d,primaryResponse:i,primaryRows:a,pageRows:o,total:s,source:c}))}}catch(e){return console.error(`[mergedListApi] join fetch failed — rendering page without that join`,e),{source:c,response:null}}}))}async function S(n,r,i,a,o){let s=await e(n,r,i,a),c=t(s,n)??{},l=Array.isArray(c.rows)?c.rows:[],u=Number.isFinite(Number(c.total))?Number(c.total):l.length,d=await x({moduleName:n,limit:r,offset:i,options:a,primaryResponse:s,primaryRows:l,pageRows:l,total:u});return b(await y(l,d,n,o),u,[s,...d.map(e=>e.response)])}async function C(e,t,n,r,o){let s=await i(e,t,n,r),c=a(s,e)??[],l=c.length,u=c.slice(n,n+t),d=await x({moduleName:e,limit:t,offset:n,options:r,primaryResponse:s,primaryRows:c,pageRows:u,total:l});return b(await y(u,d,e,o),l,[s,...d.map(e=>e.response)])}return async function(t,n=10,r=0,i={}){let a=++g,o=()=>a!==g;return e?S(t,n,r,i,o):C(t,n,r,i,o)}}function QN(e,t,r={}){return ZN({fetchPrimary:()=>WE(e,t),extractPrimaryRows:HE,fetchSecondary:n.$t,fetchSecondaryById:GE,secondaryFetchLimit:r.moduleFetchLimit??200})}function $N(e){let t=String(e??``).trim().split(/[^a-zA-Z0-9]+/).filter(Boolean);return t.length?`${t.map((e,t)=>t===0?e.toLowerCase():e[0].toUpperCase()+e.slice(1).toLowerCase()).join(``)}Count`:``}function eP(e){let t=Array.isArray(e?.stages)?e.stages:[];if(!t.length)return e;let n={};for(let e of t){let t=$N(e?.stageName);t&&(n[t]=Number(e?.count)||0)}return{...n,...e}}var tP=e=>{let t=Number(e?.targetSubmission??e?.targetSubmissions);return Number.isFinite(t)&&t>0?t:null};function nP({submittedCountField:e=`submittedCount`,progressField:t=`targetSubmissionProgress`}={}){return function(n,r,i){let a=IN(n,r,i),o=tP(a);return o!=null&&(a[t]=`${Number(a?.[e])||0} of ${o}`),a}}function rP(e={}){let t=nP();return ZN({primaryKey:`_id`,extraFields:e.extraFields,extraFieldsAfter:e.extraFieldsAfter,fetchPrimaryPage:n.$t,joinSources:[{key:`entityId`,fetchByKeys:(e,t,n,r)=>{let i=Math.max(1,Number(r?.limit)||10);return UE(Math.floor((Number(r?.offset)||0)/i)+1,i)},extractRows:e=>(e?.items??[]).map(eP),mergeRow:(e,n,r)=>{let i=t(e,n,r);return n?._id&&(i.workflowId=n._id),i}}]})}async function iP(e,t=10,r=0,i={},a={}){let o=await rP(a)(e,t,r,i);return n.kt(o,e)}async function aP(e,t,r,i=10,a=0,o={}){let s=await QN(e,t)(r,i,a,o);return n.kt(s,r)}var oP=Object.freeze({OPTIONS:`options`,BOOLEAN:`boolean`,DATE:`date`,NUMBER_RANGE:`numberRange`,TEXT:`text`}),sP=Object.freeze([{label:`Yes`,value:`true`},{label:`No`,value:`false`}]);function cP(e){return e.label??e.fieldLabel??e.name??e.fieldName??e.value}function lP(e){return e.value??e.field??e.fieldName??e.name??e.label}function uP(e){let t=lP(e),n=String(e?.filterArrayValueField??``).trim();return n?`${t}.${n}`:t}function dP(e){let t=e?.isVisible??e?.is_visible??e?.visible;return t==null?!0:typeof t==`boolean`?t:typeof t==`string`?![`false`,`0`,`no`,`hide`,`hidden`].includes(t.toLowerCase()):!!t}function fP(e){switch(e?.filterInputType||(e?.type===`boolean`?`boolean`:null)||(e?.type===`date`?`datepicker`:null)||(e?.type===`number`?`number-range`:null)||`dropdown`){case`boolean`:return oP.BOOLEAN;case`datepicker`:return oP.DATE;case`number-range`:return oP.NUMBER_RANGE;case`text`:return oP.TEXT;default:return oP.OPTIONS}}function pP(e,t,n){if(String(e??``).trim().toLowerCase()!==`sourcecandidates`)return n;let r=String(lP(t)??``).trim().toLowerCase(),i=String(cP(t)??``).trim().toLowerCase();return[`firstname`,`candidatename`,`candidate_name`,`fullname`].includes(r)||i===`candidate name`?[`firstName`,`lastName`]:n.map(e=>{let t=String(e??``).trim();switch(t.toLowerCase()){case`customfields.diceprofiledata.firstname`:return`firstName`;case`customfields.diceprofiledata.lastname`:return`lastName`;default:return t}}).filter(Boolean)}function mP(e,t=``){let n=new Set;return(Array.isArray(e)?e:[]).filter(e=>e&&dP(e)).map(e=>{let n=pP(t,e,Array.isArray(e.filterGroupFields)?e.filterGroupFields:[]);return{key:lP(e),label:cP(e),filterField:uP(e),filterInputType:e.filterInputType,type:e.type,kind:fP(e),groupFields:n,fetchMeta:{dataSource:e.lookup?.collection?`lookup`:e.dataSource,groupName:e.groupName,lookup:e.lookup??null,groupFields:n,groupSeparator:e.filterGroupSeparator??` `,arrayLabelField:e.filterArrayLabelField??``,arrayValueField:e.filterArrayValueField??``}}}).filter(e=>{if(!e.key||!e.label)return!1;let t=String(e.key);return!n.has(t)&&(n.add(t),!0)})}function hP(e){return e!=null&&String(e).trim()!==``}var gP=new Set(Object.values(oP));function _P(e){let t=new Set;return(Array.isArray(e)?e:[]).filter(e=>e&&typeof e==`object`&&hP(e.key)).map(e=>{let t=gP.has(e.kind)?e.kind:oP.OPTIONS,n=Array.isArray(e.options)?e.options.map(e=>e&&typeof e==`object`?{value:e.value,label:String(e.label??e.value)}:{value:e,label:String(e)}).filter(e=>e.value!==void 0&&e.value!==null&&e.value!==``):null,r=t===oP.NUMBER_RANGE&&e.slider&&typeof e.slider==`object`?{min:Number.isFinite(Number(e.slider.min))?Number(e.slider.min):0,max:Number.isFinite(Number(e.slider.max))?Number(e.slider.max):100,step:Number(e.slider.step)>0?Number(e.slider.step):1,suffix:typeof e.slider.suffix==`string`?e.slider.suffix:``}:null;return{key:String(e.key),label:hP(e.label)?String(e.label):``,filterField:hP(e.field)?String(e.field):String(e.key),filterInputType:t===oP.TEXT?`text`:void 0,type:void 0,kind:t,groupFields:[],fetchMeta:{},host:!0,options:n,all:t===oP.OPTIONS&&hP(e.all)?String(e.all):``,slider:r&&r.max>r.min?r:null,placeholder:hP(e.placeholder)?String(e.placeholder):``,bare:e.bare===!0,more:e.more===!0,open:e.open!==!1}}).filter(e=>!e.label&&!e.bare||t.has(e.key)?!1:(t.add(e.key),!0))}function vP(e){let t=[],n=``;return(Array.isArray(e)?e:[]).forEach(e=>{if(e?.field===`$search`){typeof e.value==`string`&&e.value.trim()&&(n=e.value.trim());return}t.push(e)}),{filters:t,search:n}}function yP(e,t={},n={}){let r=[];return e.forEach(e=>{let i=t[e.key];if(i!=null){if(e.kind===oP.OPTIONS||e.kind===oP.BOOLEAN){let t=(Array.isArray(i)?i:[i]).filter(e=>e!=null&&e!==``);if(!t.length)return;let a=n[e.key]??{},o={};t.forEach(e=>{let t=a[String(e)];t!==void 0&&(o[String(e)]=t)}),r.push({operator:`and`,field:e.filterField,values:t,valueLabels:o,fieldLabel:e.label,filterInputType:e.filterInputType,groupFields:e.groupFields});return}if(e.kind===oP.DATE){let t=hP(i.from)?String(i.from):null,n=hP(i.to)?String(i.to):null;if(!t&&!n)return;r.push({operator:`and`,field:e.filterField,values:[t,n].filter(Boolean),from:t??void 0,to:n??void 0,fieldLabel:e.label,filterInputType:e.filterInputType});return}if(e.kind===oP.NUMBER_RANGE){let t=typeof i.min==`number`&&Number.isFinite(i.min)?i.min:null,n=typeof i.max==`number`&&Number.isFinite(i.max)?i.max:null;if(t===null&&n===null)return;r.push({operator:`and`,field:e.filterField,values:[t,n].filter(e=>e!=null),from:t==null?void 0:String(t),to:n==null?void 0:String(n),fieldLabel:e.label,filterInputType:e.filterInputType});return}if(e.kind===oP.TEXT){let t=typeof i==`string`?i.trim():``;if(!t)return;r.push({operator:`and`,field:e.filterField,value:t,values:[],fieldLabel:e.label,filterInputType:`text`})}}}),r}function bP(e,t=[]){let n={};return(Array.isArray(t)?t:[]).forEach(t=>{if(!t?.field)return;let r=e.find(e=>String(e.filterField)===String(t.field)||String(e.key)===String(t.field));if(r)switch(r.kind){case oP.OPTIONS:case oP.BOOLEAN:n[r.key]=Array.isArray(t.values)?[...t.values]:[];break;case oP.DATE:n[r.key]={from:t.from??null,to:t.to??null};break;case oP.NUMBER_RANGE:{let e=t.from!==void 0&&t.from!==null&&t.from!==``?Number(t.from):null,i=t.to!==void 0&&t.to!==null&&t.to!==``?Number(t.to):null;n[r.key]={min:Number.isFinite(e)?e:null,max:Number.isFinite(i)?i:null};break}case oP.TEXT:n[r.key]=typeof t.value==`string`?t.value:``}}),n}function xP(e){return(Array.isArray(e)?e:[]).filter(e=>e?.field).length}function SP(e){let t=(Array.isArray(e)?e:[]).filter(e=>e?.field).map(e=>({f:String(e.field),v:Array.isArray(e.values)?e.values.map(String).sort():[],a:e.from??null,b:e.to??null,t:e.value??null,k:e.filterInputType??null})).sort((e,t)=>e.f<t.f?-1:+(e.f>t.f));return JSON.stringify(t)}var CP=[`operator`,`field`,`values`,`from`,`to`,`value`,`filterInputType`,`groupFields`,`fieldLabel`,`valueLabels`],wP=50;function TP(e){let t=(Array.isArray(e)?e:[]).filter(e=>e?.field).slice(0,wP);return t.length?JSON.stringify(t.map(e=>{let t={};return CP.forEach(n=>{e[n]!==void 0&&(t[n]=e[n])}),t})):``}function EP(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?t.slice(0,wP).filter(e=>e&&typeof e==`object`&&typeof e.field==`string`&&e.field.trim()!==``).map(e=>{let t={field:e.field,operator:e.operator===`or`?`or`:`and`};return t.values=Array.isArray(e.values)?e.values.filter(e=>[`string`,`number`,`boolean`].includes(typeof e)):[],[`from`,`to`,`value`,`filterInputType`,`fieldLabel`].forEach(n=>{typeof e[n]==`string`&&(t[n]=e[n])}),Array.isArray(e.groupFields)&&(t.groupFields=e.groupFields.filter(e=>typeof e==`string`)),e.valueLabels&&typeof e.valueLabels==`object`&&!Array.isArray(e.valueLabels)&&(t.valueLabels=Object.fromEntries(Object.entries(e.valueLabels).filter(([,e])=>typeof e==`string`))),t}):[]}var DP=[],OP=300;function kP({moduleName:e,view:t=``,scope:r=``,scopeConditions:i=DP,value:a=DP,onChange:o,title:s=`Filters`,collapsed:c=!1,onExpand:l,onCollapse:m,defaultExpandedCount:h=4,optionLimit:g=6,className:_=``,fields:v=null,optionCounts:y=null,moreLabel:b=`More Filters`}){let x=Array.isArray(v),{fields:S,loading:C,error:w}=n.Wt(x?``:e,{view:t}),T=x?JSON.stringify(v):``,E=(0,u.useMemo)(()=>T?_P(JSON.parse(T)):mP(S,e),[T,S,e]),D=!x&&C,O=x?null:w,k=E.map(e=>e.key).join(`|`),{valuesByField:A,loadingFields:j,fetchValues:M}=n.Tt(e),N=Array.isArray(i)&&i.length?JSON.stringify(i):``,P=(0,u.useMemo)(()=>N?{scopeConditions:JSON.parse(N)}:null,[N]),F=SP(a),[I,L]=(0,u.useState)(()=>bP(E,a)),[R,z]=(0,u.useState)(F),[B,V]=(0,u.useState)(`${F}#${k}`),H=`${F}#${k}`;H!==B&&(V(H),(B.split(`#`)[1]!==k||F!==R)&&(L(bP(E,a)),z(F)));let U=(0,u.useMemo)(()=>{let e={};return(Array.isArray(a)?a:[]).forEach(t=>{let n=E.find(e=>String(e.filterField)===String(t.field));n&&t.valueLabels&&(e[n.key]={...t.valueLabels})}),Object.entries(A).forEach(([t,n])=>{e[t]={...e[t]??{}},(n??[]).forEach(n=>{e[t][String(n.value)]=String(n.label??n.value)})}),e},[a,A,E]),W=(0,u.useRef)(null),G=(0,u.useRef)({draft:I,labelsByField:U,railFields:E,onChange:o});(0,u.useEffect)(()=>{G.current={draft:I,labelsByField:U,railFields:E,onChange:o}}),(0,u.useEffect)(()=>()=>clearTimeout(W.current),[]);let ee=(0,u.useCallback)(e=>{clearTimeout(W.current),W.current=null;let{labelsByField:t,railFields:n,onChange:r}=G.current,i=yP(n,e??G.current.draft,t);z(SP(i)),r?.(i)},[]),te=(0,u.useCallback)((e,t,{immediate:n=!1,deferred:r=!1}={})=>{let i={...G.current.draft,[e]:t};G.current={...G.current,draft:i},L(i),clearTimeout(W.current),W.current=null,!r&&(W.current=setTimeout(()=>ee(),n?0:OP))},[ee]),ne=(0,u.useCallback)(()=>{clearTimeout(W.current),L({}),G.current={...G.current,draft:{}},z(SP([])),G.current.onChange?.([])},[]),[re,ie]=(0,u.useState)(()=>new Set),[ae,oe]=(0,u.useState)(``);if(k&&ae!==k){oe(k);let e=new Set(x?E.filter(e=>e.bare||e.open&&!e.more).map(e=>e.key):E.slice(0,h).map(e=>e.key));E.forEach(t=>{I[t.key]!==void 0&&e.add(t.key)}),ie(e)}let se=(0,u.useRef)(new Set);(0,u.useEffect)(()=>{E.forEach(e=>{if(e.kind!==oP.OPTIONS||!re.has(e.key)||Array.isArray(e.options))return;let t=`${e.key}|${r}|${N}`;se.current.has(t)||(se.current.add(t),M(e.key,``,{...e.fetchMeta,scope:r,...P??{}}))})},[re,E,r,N,P,M]);let ce=e=>{ie(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},K=xP(a);return c?(0,p.jsx)(`aside`,{className:`cc-filter-rail cc-filter-rail--collapsed ${_}`.trim(),"aria-label":s,children:(0,p.jsx)(d.Tooltip,{title:K?`Show ${s.toLowerCase()} (${K} active)`:`Show ${s.toLowerCase()}`,placement:`right`,children:(0,p.jsx)(d.Button,{type:`text`,className:`cc-filter-rail__expand`,"aria-label":`Show ${s.toLowerCase()}`,"aria-expanded":!1,onClick:l,icon:(0,p.jsx)(d.Badge,{count:K,size:`small`,offset:[4,-4],children:(0,p.jsx)(f.DoubleRightOutlined,{})})})})}):(0,p.jsxs)(`aside`,{className:`cc-filter-rail ${_}`.trim(),"aria-label":s,children:[(0,p.jsxs)(`div`,{className:`cc-filter-rail__head`,children:[(0,p.jsxs)(`span`,{className:`cc-filter-rail__title`,children:[s,K>0&&(0,p.jsx)(`span`,{className:`cc-filter-rail__count`,children:K})]}),(0,p.jsxs)(`span`,{className:`cc-filter-rail__head-actions`,children:[(0,p.jsx)(d.Button,{type:`link`,size:`small`,onClick:ne,disabled:K===0&&Object.keys(I).length===0,children:`Clear All`}),m&&(0,p.jsx)(d.Tooltip,{title:`Hide ${s.toLowerCase()}`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,className:`cc-filter-rail__collapse`,icon:(0,p.jsx)(f.DoubleLeftOutlined,{}),"aria-label":`Hide ${s.toLowerCase()}`,"aria-expanded":!0,onClick:m})})]})]}),(0,p.jsxs)(`div`,{className:`cc-filter-rail__body`,children:[D&&E.length===0&&(0,p.jsxs)(`div`,{className:`cc-filter-rail__state`,children:[(0,p.jsx)(d.Spin,{size:`small`}),` `,(0,p.jsx)(`span`,{children:`Loading filters…`})]}),!D&&O&&(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:`Filters could not be loaded`,description:String(O)}),!D&&!O&&E.length===0&&(0,p.jsx)(`div`,{className:`cc-filter-rail__state cc-filter-rail__state--muted`,children:`No filters are configured for this module. An administrator can add them under Configure → Filter.`}),E.map((e,t)=>{let n=re.has(e.key),i=I[e.key]!==void 0&&AP(e,I[e.key]),a=e.kind===oP.BOOLEAN?sP:e.options??A[e.key]??[],o=y&&typeof y==`object`?y[e.filterField]??y[e.key]??null:null,s=(0,p.jsx)(jP,{field:e,value:I[e.key],options:a,loading:j.has(e.key),labels:U[e.key]??{},optionLimit:g,counts:o,total:y?.total,onChange:(t,n)=>te(e.key,t,n),onCommit:()=>ee(),onSearch:t=>M(e.key,t,{...e.fetchMeta,scope:r,...P??{}})}),c=e.more&&!E.slice(0,t).some(e=>e.more);return e.bare?(0,p.jsx)(`div`,{className:`cc-filter-section cc-filter-section--bare`,children:s},e.key):(0,p.jsxs)(`section`,{className:`cc-filter-section${e.more?` cc-filter-section--more`:``}`,"data-first-more":c||void 0,children:[c&&(0,p.jsx)(`div`,{className:`cc-filter-rail__more-label`,children:b}),(0,p.jsxs)(`button`,{type:`button`,className:`cc-filter-section__toggle`,"aria-expanded":n,onClick:()=>ce(e.key),children:[(0,p.jsxs)(`span`,{className:`cc-filter-section__label`,children:[e.label,i&&(0,p.jsx)(`span`,{className:`cc-filter-section__dot`,"aria-label":`active`})]}),n?(0,p.jsx)(f.DownOutlined,{}):(0,p.jsx)(f.RightOutlined,{})]}),n&&(0,p.jsx)(`div`,{className:`cc-filter-section__content`,children:s})]},e.key)})]})]})}function AP(e,t){if(t==null)return!1;switch(e.kind){case oP.OPTIONS:case oP.BOOLEAN:return Array.isArray(t)&&t.length>0;case oP.DATE:return!!(t.from||t.to);case oP.NUMBER_RANGE:return t.min!=null||t.max!=null;case oP.TEXT:return typeof t==`string`&&t.trim()!==``;default:return!1}}function jP({field:e,value:t,options:n,loading:r,labels:i,optionLimit:a,counts:o,total:s,onChange:c,onCommit:l,onSearch:u}){if(e.kind===oP.DATE){let e=[t?.from?(0,m.default)(t.from):null,t?.to?(0,m.default)(t.to):null];return(0,p.jsx)(d.DatePicker.RangePicker,{size:`small`,allowEmpty:[!0,!0],value:e,onChange:e=>{let[t,n]=Array.isArray(e)?e:[null,null];c({from:t&&t.isValid()?t.format(`YYYY-MM-DD`):null,to:n&&n.isValid()?n.format(`YYYY-MM-DD`):null},{immediate:!0})},style:{width:`100%`}})}if(e.kind===oP.NUMBER_RANGE&&e.slider){let{min:n,max:r,step:i,suffix:a}=e.slider,o=t?.min??null,s=t?.max??null,l=(e,t)=>c({min:e===null||e<=n?null:e,max:t===null||t>=r?null:t}),u=e=>`${e}${a}`,f=e=>Number(String(e??``).replace(a,``).trim());return(0,p.jsxs)(`div`,{className:`cc-filter-range cc-filter-range--slider`,children:[(0,p.jsx)(d.Slider,{range:!0,min:n,max:r,step:i,value:[o??n,s??r],onChange:([e,t])=>l(e,t),tooltip:{formatter:u},"aria-label":e.label}),(0,p.jsxs)(`div`,{className:`cc-filter-range__boxes`,children:[(0,p.jsx)(d.InputNumber,{size:`small`,min:n,max:r,value:o??n,formatter:u,parser:f,onChange:e=>l(typeof e==`number`?e:null,s),"aria-label":`${e.label} minimum`}),(0,p.jsx)(d.InputNumber,{size:`small`,min:n,max:r,value:s??r,formatter:u,parser:f,onChange:e=>l(o,typeof e==`number`?e:null),"aria-label":`${e.label} maximum`})]})]})}if(e.kind===oP.NUMBER_RANGE){let n=t?.min??null,r=t?.max??null;return(0,p.jsxs)(`div`,{className:`cc-filter-range`,children:[(0,p.jsx)(d.InputNumber,{size:`small`,placeholder:`Min`,value:n,onChange:e=>c({min:typeof e==`number`?e:null,max:r}),"aria-label":`${e.label} minimum`}),(0,p.jsx)(`span`,{className:`cc-filter-range__sep`,children:`–`}),(0,p.jsx)(d.InputNumber,{size:`small`,placeholder:`Max`,value:r,onChange:e=>c({min:n,max:typeof e==`number`?e:null}),"aria-label":`${e.label} maximum`})]})}return e.kind===oP.TEXT?(0,p.jsx)(d.Input,{size:`small`,allowClear:!0,prefix:e.bare?(0,p.jsx)(f.SearchOutlined,{}):void 0,placeholder:e.placeholder||`Type keyword, press Enter`,value:typeof t==`string`?t:``,onChange:e=>{let t=e.target.value;t===``?c(``,{immediate:!0}):c(t,{deferred:!0})},onPressEnter:l,onBlur:l,"aria-label":e.label}):(0,p.jsx)(MP,{field:e,value:Array.isArray(t)?t:[],options:n,loading:r,labels:i,optionLimit:a,counts:o,total:s,searchable:e.kind===oP.OPTIONS&&!Array.isArray(e.options),onChange:c,onSearch:u})}function MP({field:e,value:t,options:n,loading:r,labels:i,optionLimit:a,counts:o=null,total:s,searchable:c,onChange:l,onSearch:m}){let[h,g]=(0,u.useState)(!1),[_,v]=(0,u.useState)(``),y=new Set(t.map(String)),b=new Set(n.map(e=>String(e.value))),x=t.filter(e=>!b.has(String(e))).map(e=>({value:e,label:i[String(e)]??String(e)})),S=[...x,...n],C=h?S:S.slice(0,Math.max(a,x.length)),w=S.length-C.length,T=e=>{let n=String(e);l(y.has(n)?t.filter(e=>String(e)!==n):[...t,e])};return(0,p.jsxs)(`div`,{className:`cc-filter-options`,children:[c&&(S.length>a||_)&&(0,p.jsx)(d.Input,{size:`small`,allowClear:!0,prefix:(0,p.jsx)(f.SearchOutlined,{}),placeholder:`Search ${String(e.label).toLowerCase()}…`,value:_,onChange:e=>{v(e.target.value),m(e.target.value)},className:`cc-filter-options__search`,"aria-label":`Search ${e.label}`}),r&&S.length===0?(0,p.jsx)(`div`,{className:`cc-filter-rail__state`,children:(0,p.jsx)(d.Spin,{size:`small`})}):S.length===0?(0,p.jsx)(`div`,{className:`cc-filter-rail__state cc-filter-rail__state--muted`,children:`No values`}):(0,p.jsxs)(`ul`,{className:`cc-filter-options__list`,children:[e.all&&(0,p.jsxs)(`li`,{className:`cc-filter-options__all`,children:[(0,p.jsx)(d.Checkbox,{checked:t.length===0,onChange:()=>l([]),children:(0,p.jsx)(`span`,{className:`cc-filter-options__label`,children:e.all})}),o&&Number.isFinite(Number(s))&&(0,p.jsx)(`span`,{className:`cc-filter-options__count`,children:Number(s)})]}),C.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(d.Checkbox,{checked:y.has(String(e.value)),onChange:()=>T(e.value),children:(0,p.jsx)(`span`,{className:`cc-filter-options__label`,title:String(e.label),children:String(e.label)})}),o&&(0,p.jsx)(`span`,{className:`cc-filter-options__count`,children:Number(o[String(e.value)]??0)})]},String(e.value)))]}),w>0&&(0,p.jsxs)(d.Button,{type:`link`,size:`small`,className:`cc-filter-options__more`,onClick:()=>g(!0),children:[`+ Show `,w,` more`]}),h&&S.length>a&&(0,p.jsx)(d.Button,{type:`link`,size:`small`,className:`cc-filter-options__more`,onClick:()=>g(!1),children:`Show less`})]})}var NP=[],PP=250;function FP(e){try{return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}catch{return e}}function IP({filters:e=NP,search:t=``,refreshTick:r=0,baseFetch:i=n.$t,keepResponse:a=!1}={}){let o=`${SP(e)}|${String(t??``).trim()}`,[s]=(0,u.useState)(()=>({lastQuerySig:o,seq:0,inflight:0})),[c,l]=(0,u.useState)(null),[d,f]=(0,u.useState)(!1),[p,m]=(0,u.useState)(null);return{fetchData:(0,u.useMemo)(()=>LP({querySig:o,search:t,filters:e,baseFetch:i,store:s,setSnapshot:l,setLoading:f,setLastError:m,keepResponse:a}),[o,r,i,a]),snapshot:c,loading:d,error:p}}function LP({querySig:e,search:t,filters:r,baseFetch:i,store:a,setSnapshot:o,setLoading:s,setLastError:c,keepResponse:l=!1}){let u=e,d=l?e=>e:FP,f=String(t??``).trim(),p=Array.isArray(r)?r:NP,m=new Map,h=async(e,t,r,l)=>{a.seq+=1;let u=a.seq;a.inflight+=1,s(!0);try{let s=await i(e,t,r,{...l,search:f||l.search||``,filters:[...Array.isArray(l.filters)?l.filters:NP,...p]});if(u===a.seq){let i=n.kt(s,e);o({rows:i.rows,total:i.total,fields:i.fields,limit:t,offset:r,page:Math.floor(r/Math.max(1,t))+1}),c(null)}return s}catch(e){throw u===a.seq&&c(e),e}finally{a.inflight=Math.max(0,a.inflight-1),a.inflight===0&&s(!1)}};return async(e,t,n,r={})=>{let i=n;a.lastQuerySig!==u&&(i=0,a.lastQuerySig=u);let o=JSON.stringify([e,t,i,r.scope??``,r.sort??``,r.sortDir??``,r.search??``,SP(r.filters),r.queryParams??null]),s=m.get(o);if(s&&(s.settledAt==null||Date.now()-s.settledAt<PP))return d(await s.promise);let c={settledAt:null};return c.promise=h(e,t,i,r).then(e=>(c.settledAt=Date.now(),e),e=>{throw m.delete(o),e}),m.set(o,c),d(await c.promise)}}function RP(e){for(let t of e.keys()){let e=/^p(\d+)$/.exec(t);if(e)return Math.max(1,Number(e[1])||1)}return 1}function zP(e,t){let n=new URLSearchParams(e);return[...n.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>n.delete(e)),t>1&&n.set(`p${t}`,``),n}function BP(e,t,{enabled:n=!0,includeNewTabLinks:r=!1}={}){let i=(0,u.useRef)(t),a=(0,u.useRef)(r);(0,u.useEffect)(()=>{i.current=t,a.current=r});let o=(0,u.useCallback)(e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target?.closest?.(`a[href]`);if(!t||t.target===`_blank`&&!a.current)return;let n=t.closest(`tr[data-row-key], [data-record-id]`),r=n?.getAttribute(`data-row-key`)??n?.getAttribute(`data-record-id`);if(!r)return;let o;try{o=new URL(t.getAttribute(`href`),window.location.href)}catch{return}o.origin===window.location.origin&&decodeURIComponent(`${o.pathname}${o.search}`).includes(r)&&(e.preventDefault(),i.current?.(r))},[]);(0,u.useEffect)(()=>{let t=e.current;if(!(!t||!n))return t.addEventListener(`click`,o,!0),()=>t.removeEventListener(`click`,o,!0)},[e,n,o])}function VP({onOpenRecord:e,selectedRecordId:t,loading:r=!1,listProps:i={},component:a=n.rt,recordLinks:o=`inPlace`}){let s=(0,u.useRef)(null);return BP(s,e,{enabled:typeof e==`function`&&o!==`navigate`,includeNewTabLinks:!0}),(0,p.jsxs)(`div`,{ref:s,className:`cc-list-host`,"data-in-place-record-links":typeof e==`function`&&o!==`navigate`?``:void 0,children:[r&&(0,p.jsx)(`div`,{className:`cc-progress`,role:`progressbar`,"aria-label":`Loading`}),(0,p.jsx)(a,{...i,selectedRecordId:t,onRecordClick:typeof e==`function`?(t,n)=>e(String(n),t):void 0})]})}function HP({open:e=!1,onClose:t,width:n=380,ariaLabel:r=`Quick view`,placement:i=`right`,className:a=``,children:o}){let s=i===`left`;return(0,u.useEffect)(()=>{if(!e||typeof document>`u`)return;let n=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`.ant-modal-wrap:not([style*="display: none"]) .ant-modal`)||t?.()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),(0,p.jsx)(d.Drawer,{open:e,onClose:t,placement:s?`left`:`right`,size:n,mask:!1,keyboard:!1,closable:!1,rootClassName:`cc-quick-popover${s?` cc-quick-popover--left`:``} ${a}`.trim(),styles:{header:{display:`none`},body:{padding:0}},"aria-label":r,children:o})}function UP({open:e=!1,quickView:t=null,width:n=340,mode:r=`docked`,onClose:i,children:a,className:o=``}){return r===`overlay`?(0,p.jsxs)(`div`,{className:`cc-with-quick ${o}`.trim(),children:[(0,p.jsx)(`div`,{className:`cc-with-quick__list`,children:a}),(0,p.jsx)(HP,{open:e&&!!t,onClose:i,width:n,children:e?t:null})]}):(0,p.jsxs)(`div`,{className:`cc-with-quick${e?` cc-with-quick--open`:``} ${o}`.trim(),style:{"--cc-inline-quick-w":`${n}px`},children:[(0,p.jsx)(`div`,{className:`cc-with-quick__list`,children:a}),e&&t&&(0,p.jsx)(`div`,{className:`cc-with-quick__side`,children:t})]})}var WP=new Set([`file`,`files`,`upload`,`document`,`image`,`password`,`hidden`,`linkedrecordfile`]),GP=new Set([`date`,`datepicker`]),KP=140,qP=e=>e===!0||e===1||e===`1`||String(e).toLowerCase()===`true`;function JP(e){return e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0||e.every(JP):typeof e==`object`&&Object.keys(e).length===0}function YP(e){let t=String(e).replace(/<style[\s\S]*?<\/style>|<script[\s\S]*?<\/script>/gi,` `).replace(/<[^>]+>/g,` `).replace(/ /g,` `).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/\s+/g,` `).trim();return t.length>KP?`${t.slice(0,139)}…`:t}function XP(e,t){if(JP(e))return``;if(Array.isArray(e))return YP(e.map(e=>XP(e,t)).filter(Boolean).join(`, `));if(typeof e==`object`)return XP(e.label??e.value??e.name??e.title??e.displayValue??``,t);if(typeof e==`boolean`)return e?`Yes`:`No`;if(GP.has(String(t??``).toLowerCase())){let t=String(e);if(/^0001-01-01/.test(t))return``;let n=/^(\d{4}-\d{2}-\d{2})/.exec(t);if(n){let e=(0,m.default)(n[1]);if(e.isValid())return e.format(`DD MMM YYYY`)}}return YP(e)}function ZP(e,t=10){let n=[],r=new Set;for(let i of Array.isArray(e)?e:[])if(!(!i||qP(i.hideGroup)||qP(i.hideGroupInDetail))&&!(qP(i.addRow)||Array.isArray(i.rows)))for(let e of Array.isArray(i.fields)?i.fields:[]){if(n.length>=t)return n;let i=e?.field;if(!i||r.has(i)||e.show===0||e.show===`0`||e.show===!1||WP.has(String(e.type??``).toLowerCase()))continue;let a=XP(e.displayValue??e.value,e.type);a&&(r.add(i),n.push({key:i,label:e.label??i,text:a}))}return n}var QP={location:(0,p.jsx)(f.EnvironmentOutlined,{}),experience:(0,p.jsx)(f.ClockCircleOutlined,{}),employment:(0,p.jsx)(f.LaptopOutlined,{})};function $P(e){let t=String(e??``).replace(/\([^)]*\)/g,` `).split(/\s+/).filter(e=>/^[\p{L}\p{N}]/u.test(e));return t.length?`${t[0].charAt(0)}${t.length>1?t.at(-1).charAt(0):``}`.toUpperCase():``}function eF({moduleName:e,id:t,configName:r,title:i=`Quick View`,onOpenFull:a,onClose:o,extra:s=null,footerExtra:c=null,maxFields:l=10,refreshKey:m=0,openFullLabel:h=`Open full view`,showAvatar:g=!1,headOpenFull:_=!0,footerOpenFullLabel:v=`View full details`,fieldsTitle:y=`Key details`}){let[b,x]=(0,u.useState)({key:``,groups:null,error:null}),[S,C]=(0,u.useState)(0),w=`${e}|${t}|${m}|${S}`;(0,u.useEffect)(()=>{if(!e||!t)return;let r=!1;return n.Yt({module:e,id:t,view:`detail`}).then(e=>{r||x({key:w,groups:Array.isArray(e)?e:[],error:null})}).catch(e=>{r||x({key:w,groups:null,error:e})}),()=>{r=!0}},[e,t,w]);let T=b.key!==w,E=b.groups,D=(0,u.useMemo)(()=>E&&E.length?Aa(r||e,E):null,[E,r,e]),O=(0,u.useMemo)(()=>ZP(E,l),[E,l]),k=D?.status,A=[...D?.titleIds??[],...D?.ids??[]];return(0,p.jsxs)(`aside`,{className:`cc-quick`,"aria-label":i,"aria-busy":T||void 0,children:[(0,p.jsxs)(`header`,{className:`cc-quick__head`,children:[(0,p.jsx)(`span`,{className:`cc-quick__panel-title`,children:i}),(0,p.jsxs)(`span`,{className:`cc-quick__head-actions`,children:[a&&_&&(0,p.jsx)(d.Button,{type:`primary`,ghost:!0,size:`small`,icon:(0,p.jsx)(f.ExpandOutlined,{}),onClick:a,children:h}),o&&(0,p.jsx)(d.Tooltip,{title:`Close (Esc)`,children:(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.CloseOutlined,{}),"aria-label":`Close quick view`,onClick:o})})]})]}),(0,p.jsx)(`div`,{className:`cc-quick__body`,children:b.error&&!E?(0,p.jsx)(d.Alert,{type:b.error.status===403||b.error.status===404?`warning`:`error`,showIcon:!0,message:b.error.status===403||b.error.status===404?`This record is not available to you.`:`The record could not be loaded.`,action:(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:()=>C(e=>e+1),children:`Retry`})}):E?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`cc-quick__identity${g?` cc-quick__identity--avatar`:``}`,children:[g&&$P(D?.title)&&(0,p.jsx)(d.Avatar,{size:56,className:`cc-quick__avatar`,children:$P(D?.title)}),(0,p.jsxs)(`div`,{className:`cc-quick__identity-text`,children:[D?.eyebrow&&(0,p.jsx)(`div`,{className:`cc-quick__eyebrow`,children:D.eyebrow}),(0,p.jsxs)(`div`,{className:`cc-quick__title-row`,children:[(0,p.jsx)(`h3`,{className:`cc-quick__title`,children:D?.title??`-`}),k?.label&&(0,p.jsx)(d.Tag,{className:`cc-quick__status`,color:k.color,style:k.backgroundColor?{backgroundColor:k.backgroundColor,borderColor:k.backgroundColor,color:k.textColor}:void 0,children:k.label})]}),A.length>0&&(0,p.jsx)(`div`,{className:`cc-quick__ids`,children:A.map(e=>(0,p.jsxs)(`span`,{children:[(0,p.jsxs)(`span`,{className:`cc-quick__muted`,children:[e.label,`:`]}),` `,e.value]},e.label))}),(D?.meta??[]).length>0&&(0,p.jsx)(`ul`,{className:`cc-quick__meta`,children:D.meta.map((e,t)=>(0,p.jsxs)(`li`,{children:[QP[e.icon]?(0,p.jsx)(`span`,{className:`cc-quick__meta-icon`,"aria-hidden":!0,children:QP[e.icon]}):null,e.text??[e.label,e.value].filter(Boolean).join(`: `)]},t))})]})]}),s&&(0,p.jsx)(`div`,{className:`cc-quick__extra`,children:s}),O.length>0&&(0,p.jsxs)(`section`,{className:`cc-quick__section`,children:[(0,p.jsx)(`h4`,{className:`cc-quick__section-title`,children:y}),(0,p.jsx)(`dl`,{className:`cc-quick__fields`,children:O.map(e=>(0,p.jsxs)(`div`,{className:`cc-quick__field`,children:[(0,p.jsx)(`dt`,{children:e.label}),(0,p.jsx)(`dd`,{title:e.text,children:e.text})]},e.key))})]}),D?.timestamp?.value&&(0,p.jsxs)(`div`,{className:`cc-quick__muted cc-quick__stamp`,children:[D.timestamp.label,`: `,D.timestamp.value]})]}):(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:6}})}),(a||c)&&(0,p.jsxs)(`footer`,{className:`cc-quick__foot`,children:[c,a&&(0,p.jsx)(d.Button,{block:!0,size:`large`,onClick:a,children:v})]})]})}var tF=Object.freeze([{field:`_id`,op:`none`,operator:`and`}]),nF=e=>String(e??``).trim();function rF(e){return(Array.isArray(e)?e:[]).filter(e=>e&&nF(e.field)).map(e=>({...e,operator:`and`}))}function iF(e,t){let n=nF(e?.field);if(!n)return null;if(e.via){let r=nF(e.via.module),i=(Array.isArray(e.via.fields)?e.via.fields:[e.via.field]).map(nF).filter(Boolean);if(!r||i.length===0)return null;let a=i.length===1?{field:i[0],op:`eq`,value:t,operator:`and`}:{field:`anyOf`,op:`anyOf`,operator:`and`,conditions:i.map(e=>({field:e,op:`eq`,value:t}))};return{field:n,op:`inFrom`,operator:`and`,source:{module:r,field:nF(e.via.select)||`_id`,filters:[a,...rF(e.via.filters)]}}}return nF(e.op).toLowerCase()===`in`?{field:n,op:`in`,values:[t],operator:`and`}:{field:n,op:`eq`,value:t,operator:`and`}}function aF(e,t){let n=nF(t);if(!e||!n)return tF;let r;if(Array.isArray(e.anyOf)){let t=e.anyOf.map(e=>iF(e,n)).filter(Boolean);if(t.length===0)return tF;r=t.length===1?t[0]:{field:`anyOf`,op:`anyOf`,operator:`and`,conditions:t.map(e=>{let t={...e};return delete t.operator,t})}}else if(r=iF(e,n),!r)return tF;return[r,...rF(e.filters)]}function oF(e){return rF(e?.filters)}function sF(e,t){return JSON.stringify(aF(e,t))}function cF(e,t){if(!e||typeof e!=`object`)return e;let{subTabs:n,...r}=e;if(!t)return r;let i={...r};return typeof t.scope==`string`&&(i.scope=t.scope),t.queryParams&&typeof t.queryParams==`object`&&(i.queryParams={...r.queryParams??{},...t.queryParams}),Array.isArray(t.filters)&&t.filters.length&&(i.filters=[...Array.isArray(r.filters)?r.filters:[],...t.filters]),i}function lF(e){return(Array.isArray(e?.subTabs)?e.subTabs:[]).filter(e=>e&&String(e.key??``).trim())}var uF=new Map,dF=Object.freeze({field:`anyOf`,op:`anyOf`,operator:`and`,conditions:[]});function fF(e){return(Array.isArray(e)?e:[]).some(e=>String(e?.op??``).toLowerCase()===`anyof`)}function pF(e){let t=String(e??``);return uF.has(t)||uF.set(t,n.$t(t,1,0,{scopeConditions:[dF]}).then(e=>{let r=n.kt(e,t);return Number(r?.total)===0&&(r?.rows?.length??0)===0}).catch(()=>(uF.delete(t),!1))),uF.get(t)}async function mF(e,t,n){let r=aF(e,t);if(!fF(r)||await pF(n))return r;if(e?.fallback){let n=aF(e.fallback,t);if(!fF(n))return n}return null}var hF=80,gF=new Map,_F=`authToken`,vF=null;function yF(){try{return globalThis.localStorage?.getItem(_F)??``}catch{return``}}function bF(){let e=yF();vF!==null&&e!==vF&&gF.clear(),vF=e}function xF(e,t){for(gF.delete(e),gF.set(e,{at:Date.now(),promise:t});gF.size>hF;)gF.delete(gF.keys().next().value);return t.catch(()=>{gF.get(e)?.promise===t&&gF.delete(e)}),t}var SF=e=>e==null||e===``||Array.isArray(e)&&e.length===0||typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0;function CF(e){if(!e||typeof e!=`object`)return{};let t={};return Object.keys(e).sort().forEach(n=>{let r=e[n];SF(r)||(t[n]=r&&typeof r==`object`&&!Array.isArray(r)?CF(r):r)}),t}function wF(e,[t,n,r,i]=[]){return`${e}|${JSON.stringify([t,Number(n)||0,Number(r)||0,CF(i)])}`}function TF(e,{cacheMs:t=0,ns:n=``,windowMs:r=1500}={}){if(typeof e!=`function`||!(Number(t)>0))return e;let i=Date.now();return(...a)=>{bF();let o;try{o=wF(n,a)}catch{return e(...a)}let s=Date.now(),c=s-i<=r,l=gF.get(o);return c&&l&&s-l.at<t?l.promise:xF(o,Promise.resolve().then(()=>e(...a)))}}var EF=[`include`,`view`];function DF(e){if(!e||typeof e!=`object`)return null;let t=Object.fromEntries(Object.entries(e).filter(([e])=>!EF.includes(e)));return Object.keys(t).length?t:null}function OF(e,t,r=0,{cacheMs:i=0}={}){let a=JSON.stringify([t??``,(e??[]).map(e=>[e.key,e.module,e.relation??null,!!e.unscoped])]),[o,s]=(0,u.useState)({signature:``,counts:{}});(0,u.useEffect)(()=>{let[e,t]=JSON.parse(a);if(!t.length)return;let o=!1,c=TF(n.$t,{cacheMs:i,ns:`count|${r}`,windowMs:1/0});return Promise.allSettled(t.map(async([,t,n,r])=>{let i=r?oF(n):await mF(n,e,t);if(!i)throw Error(`the server cannot apply this scope`);let a=typeof n?.scope==`string`?n.scope.trim():``,o=DF(n?.queryParams);return c(t,1,0,{scopeConditions:i,...a?{scope:a}:{},...o?{queryParams:o}:{}})})).then(e=>{if(o)return;let i={};e.forEach((e,r)=>{let a=t[r][0];if(e.status!==`fulfilled`){i[a]=null;return}let o=Number(n.kt(e.value,t[r][1])?.total);i[a]=Number.isFinite(o)?o:null}),s({signature:`${a}|${r}`,counts:i})}),()=>{o=!0}},[a,r,i]);let c=o.signature===`${a}|${r}`;return{counts:o.counts,loading:!c}}var kF=[];function AF(e,t,n){if(!Array.isArray(e)||!t)return null;let r=(e,t)=>typeof n==`function`?n(e,t):typeof n==`string`?e?.[n]:e?.id??e?._id??e?.key;return e.find((e,n)=>e&&typeof e==`object`&&String(r(e,n)??``)===String(t))??null}function jF({tabKey:e,active:t,module:r,accessModule:i=``,relation:a,parentId:o,title:s,showRail:c=!0,railMode:l=`docked`,railWidth:m=300,quickViewMode:g=`docked`,listComponent:_,listProps:v,renderQuickView:y,onOpenRecord:b,refreshKey:x=0,quickViewWidth:S=340,unscoped:C=!1,fetchData:w=null,keepFetchResponse:T=!1,recordLinks:E=`inPlace`,cacheMs:D=0,preload:O=!1,onPreloaded:k,openInPlace:A=!0,selectedParam:j=``,keepPageInUrl:M=!1}){let[N,P]=(0,h.useSearchParams)(),F=t??(!e||N.get(`tab`)===e),{canView:I}=n.zt(i||r),[L,R]=(0,u.useState)(kF),[z,B]=(0,u.useState)(null),V=j?N.get(j)||null:z,H=(0,u.useCallback)(e=>{if(!j){B(e);return}P(t=>{let n=new URLSearchParams(t);return e?n.set(j,String(e)):n.delete(j),n},{replace:!0})},[j,P]),[U,W]=(0,u.useState)({id:``,row:null}),G=(0,u.useCallback)((e,t)=>W({id:String(e??``),row:t&&typeof t==`object`?t:null}),[]),[ee,te]=(0,u.useState)(!1),ne=RP(N),[re,ie]=(0,u.useState)(!1),[ae,oe]=(0,u.useState)(M&&F);!F&&ae&&oe(!1),!F&&re&&(ie(!1),ee&&te(!1)),F&&!re&&(ne===1||ae)&&ie(!0),(0,u.useEffect)(()=>{F&&!re&&ne>1&&P(e=>zP(e,1),{replace:!0})},[F,re,ne,P]);let se=JSON.stringify(a??null),ce=N.get(`sub`)??``,{relation:K,subTabs:le,activeSubKey:ue,subRelations:de}=(0,u.useMemo)(()=>{let e=JSON.parse(se),t=lF(e),n=t.find(e=>e.key===ce)??t[0]??null;return{relation:cF(e,n),subTabs:t,activeSubKey:n?.key??``,subRelations:t.map(t=>({key:t.key,module:r,relation:cF(e,t),unscoped:C}))}},[se,ce,r,C]),{counts:fe}=OF(F&&re||O&&D>0?de:kF,o,x,{cacheMs:D}),[pe,me]=(0,u.useState)(null);pe!==null&&pe===ue&&me(null);let he=pe??ue,q=(0,u.useCallback)(e=>{me(e),B(null),P(t=>{let n=zP(t,1);return n.set(`sub`,e),j&&n.delete(j),n},{replace:!0})},[j,P]),ge=C?`unscoped:${JSON.stringify(oF(K))}`:sF(K,o),_e=K?.fallback?sF(K.fallback,o):``,ve=(0,u.useMemo)(()=>C?oF(K):aF(K,o),[ge]),ye=(0,u.useMemo)(()=>_e?aF(K.fallback,o):null,[_e]),J=fF(ve),[be,xe]=(0,u.useState)({module:``,ok:null});(0,u.useEffect)(()=>{if(!J||!F&&!O)return;let e=!1;return pF(r).then(t=>{e||xe({module:r,ok:t})}),()=>{e=!0}},[J,F,O,r]);let Se=be.module===r&&be.ok!==null,Ce=J&&Se&&be.ok===!1&&ye&&!fF(ye),we=!J||Se&&(be.ok===!0||!!Ce),Te=J&&Se&&be.ok===!1&&!Ce,Ee=Ce?ye:ve,De=typeof K?.scope==`string`?K.scope.trim():``,Oe=K?.queryParams&&typeof K.queryParams==`object`?JSON.stringify(Object.fromEntries(Object.entries(K.queryParams).map(([e,t])=>[e,typeof t==`string`&&t.includes(`{id}`)?t.split(`{id}`).join(String(o??``)):t]))):``,ke=Array.isArray(K?.filterFields)?JSON.stringify(K.filterFields):``,Ae=(0,u.useMemo)(()=>ke?JSON.parse(ke):null,[ke]),[je,Me]=(0,u.useState)(null),Ne=typeof K?.queryParams?.view==`string`?K.queryParams.view.trim():``,Pe=(0,u.useMemo)(()=>{let e=Oe?JSON.parse(Oe):null,t=typeof w==`function`?w:n.$t;return(n,r,i,a={})=>t(n,r,i,{...a,...De?{scope:De}:{},...e?{queryParams:{...a.queryParams??{},...e}}:{},scopeConditions:Ee})},[Ee,De,Oe,w]),Fe=`${De}|${Oe}|${JSON.stringify(Ee??null)}`,Ie=(0,u.useMemo)(()=>TF(Pe,{cacheMs:D,ns:`${e??``}|${r}|${C?``:o??``}|${x}|${Fe}`}),[Pe,D,e,r,C,o,x,Fe]),Le=(0,u.useMemo)(()=>Ae?async(...e)=>{let t=await Ie(...e),n=t?.data?.facets??t?.facets;return n&&typeof n==`object`&&Me(n),t}:Ie,[Ie,Ae]),Re=(0,u.useMemo)(()=>vP(L),[L]),{fetchData:ze,loading:Be}=IP({filters:Ae?Re.filters:L,...Ae&&Re.search?{search:Re.search}:{},refreshTick:x,baseFetch:Le,keepResponse:T}),Ve=Number(v?.initialPageSize)>0?Number(v.initialPageSize):10,He=Te||!I;(0,u.useEffect)(()=>{if(!O)return;if(!(D>0)||He){k?.(e);return}if(!we)return;let t=!1;return Promise.resolve().then(()=>Ie(r,Ve,0,{})).catch(()=>null).then(()=>{t||k?.(e)}),()=>{t=!0}},[O,D,He,we,Ie,r,Ve,k,e]);let Ue=c&&l===`popover`,We=xP(L),Ge=v?.toolbarExtra??null,Ke=(0,u.useMemo)(()=>Ue?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Tooltip,{title:We?`Filters (${We} active)`:`Filters`,children:(0,p.jsx)(d.Badge,{count:We,size:`small`,offset:[-4,4],children:(0,p.jsx)(d.Button,{className:`rh-filter-btn${ee||We?` is-active`:``}`,icon:(0,p.jsx)(f.FilterOutlined,{}),"aria-label":ee?`Hide filters`:`Show filters`,"aria-expanded":ee,"aria-haspopup":`dialog`,onClick:()=>te(e=>!e)})})}),Ge]}):Ge,[Ue,We,ee,Ge]),[qe,Je]=(0,u.useState)(null),Ye=v?.responseMapper,Xe=v?.rowKey,Ze=!!j,Qe=(0,u.useRef)(V);(0,u.useEffect)(()=>{Qe.current=V},[V]);let $e=(0,u.useMemo)(()=>{if(!Ze)return Ye;let e=typeof Ye==`function`?Ye:n.kt;return(t,n)=>{let r=e(t,n);if(Array.isArray(r?.rows)){let e=r.rows;Je(e),W(t=>{let n=Qe.current;if(!n||t.id===String(n))return t;let r=AF(e,n,Xe);return r?{id:String(n),row:r}:t})}return r}},[Ze,Ye,Xe]),et=(0,u.useMemo)(()=>V?U.id===String(V)?U.row:AF(qe,V,Xe):null,[V,U,qe,Xe]),tt=(0,u.useMemo)(()=>({moduleName:r,fetchData:ze,showAdd:!1,showFilterButton:!c,showViewToggle:!1,autoCardForExternalRows:!1,showSummaryButton:!1,deferFieldConfig:!0,hideFilterButton:c,...v??{},toolbarExtra:Ke,dataKey:`${e??``}|${Fe}`,dataPending:pe!==null,redirectOnViewDenied:!1,...Ze?{responseMapper:$e}:{}}),[r,ze,c,v,Ke,e,Fe,pe,Ze,$e]),nt=(0,u.useCallback)(()=>H(null),[H]),rt=(0,u.useCallback)(()=>te(!1),[]),it=(0,u.useCallback)(()=>{V&&b?.(r,V,et)},[V,et,b,r]);if(O)return null;if(!F||!re)return(0,p.jsx)(`div`,{className:`rh-related rh-related--idle`});if(Te)return(0,p.jsx)(`div`,{className:`rh-related rh-related--no-rail`,"data-module":r,children:(0,p.jsxs)(`div`,{className:`rh-related__denied`,role:`alert`,children:[s??r,` cannot be listed: the running server does not support this tab's filter ("anyOf"). Update the server.`]})});if(!we)return(0,p.jsx)(`div`,{className:`rh-related rh-related--idle`});if(!I)return(0,p.jsx)(`div`,{className:`rh-related rh-related--no-rail`,"data-module":r,children:(0,p.jsxs)(`div`,{className:`rh-related__denied`,role:`status`,children:[`You do not have permission to view `,s??r,`. An administrator can grant view access to this module in Admin (menu permissions for your role).`]})});let at=V?y?.({module:r,id:V,record:et,onClose:nt,onOpenFull:b?it:void 0})??(0,p.jsx)(eF,{moduleName:r,id:V,onClose:nt,onOpenFull:b?it:void 0,refreshKey:x},V):null;return(0,p.jsxs)(`div`,{className:`rh-related${!c||Ue?` rh-related--no-rail`:``}`,"data-module":r,children:[c&&!Ue&&(0,p.jsx)(`aside`,{className:`rh-related__rail`,children:(0,p.jsx)(kP,{moduleName:r,view:Ne,scopeConditions:Ee,value:L,onChange:R,...Ae?{fields:Ae,optionCounts:je}:{}})}),Ue&&(0,p.jsx)(HP,{open:ee,onClose:rt,placement:`left`,width:m,ariaLabel:`Filters`,className:`rh-filter-popover`,children:(0,p.jsx)(kP,{moduleName:r,view:Ne,scopeConditions:Ee,value:L,onChange:R,onCollapse:rt,...Ae?{fields:Ae,optionCounts:je}:{}})}),(0,p.jsxs)(`section`,{className:`rh-related__main`,"aria-label":s??r,children:[le.length>0&&(0,p.jsx)(d.Segmented,{className:`rh-subtabs`,"aria-label":`${s??r} sections`,value:he,onChange:e=>{e!==he&&q(String(e))},style:{marginBottom:12},options:le.map(e=>{let t=fe[e.key];return{value:e.key,label:(0,p.jsxs)(d.Flex,{gap:6,align:`center`,children:[(0,p.jsx)(`span`,{children:e.label??e.key}),typeof t==`number`&&(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:t.toLocaleString()})]})}})}),(0,p.jsx)(UP,{open:!!V,quickView:at,width:S,mode:g===`overlay`?`overlay`:`docked`,onClose:nt,children:(0,p.jsx)(VP,{recordLinks:E,component:_,listProps:tt,loading:Be,selectedRecordId:V||void 0,onOpenRecord:A?(e,t)=>{H(String(e)),G(e,t)}:void 0})})]})]})}var MF=1,NF=50,PF=1e3,FF=3e4,IF=15e3,LF=45e3,RF=75e3,zF=300,BF=4401,VF=Object.freeze({IDLE:`idle`,CONNECTING:`connecting`,OPEN:`open`,RECONNECTING:`reconnecting`,UNAUTHORIZED:`unauthorized`,DISABLED:`disabled`,CLOSED:`closed`});function HF(e){let t=String(e??``).trim().toLowerCase();return t.length>3&&t.endsWith(`s`)&&!t.endsWith(`ss`)&&(t=t.slice(0,-1)),t}function UF(e){let t=HF(e);return t?`module:${t}`:``}function WF(e,t){let n=HF(e),r=String(t??``).trim();return n&&r?`record:${n}:${r}`:``}function GF(e){let t=String(e??``).trim();if(t===`tenant`)return t;if(t.startsWith(`module:`))return UF(t.slice(7));if(t.startsWith(`record:`)){let e=t.slice(7),n=e.indexOf(`:`);return n<=0?``:WF(e.slice(0,n),e.slice(n+1))}return``}function KF(e){let t=[`tenant`],n=HF(e?.module);return n&&(t.push(`module:${n}`),e?.id&&t.push(`record:${n}:${e.id}`)),t}function qF(e,t){let n=String(e??``).replace(/\/+$/,``),r;return r=/^https?:\/\//i.test(n)?n.replace(/^http/i,`ws`):typeof window<`u`&&window.location?`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${n.startsWith(`/`)?``:`/`}${n}`:n,`${r}/realtime/ws?ticket=${encodeURIComponent(t)}`}function JF(e={}){let{getBaseUrl:t,getToken:n,fetchImpl:r=typeof fetch==`function`?(...e)=>fetch(...e):null,WebSocketImpl:i=typeof WebSocket==`function`?WebSocket:null,setTimeoutImpl:a=(e,t)=>setTimeout(e,t),clearTimeoutImpl:o=e=>clearTimeout(e),setIntervalImpl:s=(e,t)=>setInterval(e,t),clearIntervalImpl:c=e=>clearInterval(e),now:l=()=>Date.now(),random:u=Math.random}=e,d=new Map,f=new Set,p=new Set,m=new Set,h=[],g=i&&r?VF.IDLE:VF.DISABLED,_=null,v=0,y=0,b=null,x=null,S=0,C=0,w=!1,T=!1;function E(e){g!==e&&(g=e,f.forEach(t=>{try{t(e)}catch{}}))}function D(e){if(!_||_.readyState!==1)return!1;try{return _.send(JSON.stringify({v:MF,...e})),!0}catch{return!1}}function O(e,t){for(let n=0;n<t.length;n+=NF)D({op:e,topics:t.slice(n,n+NF)})}function k(e){return!e||!m.has(e)&&(m.add(e),h.push(e),h.length>zF&&m.delete(h.shift()),!0)}function A(e){if(!k(e.eventId))return;let t=new Set;KF(e).forEach(n=>{let r=d.get(n);r&&r.forEach(n=>{if(!t.has(n)){t.add(n);try{n(e)}catch(e){console.error(`[realtime] subscriber failed`,e)}}})})}function j(e){S=l();let t;try{t=JSON.parse(e)}catch{return}if(!(!t||typeof t!=`object`))switch(t.type){case`hello`:y=0,E(VF.OPEN),O(`subscribe`,[...d.keys()]),w&&p.forEach(e=>{try{e()}catch{}}),w=!0;return;case`ack`:case`pong`:case`error`:return;default:t.eventId&&t.type&&A(t)}}function M(){b!=null&&(o(b),b=null),x!=null&&(c(x),x=null)}function N(){let e=_;if(_=null,e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null;try{e.close(1e3,`client closing`)}catch{}}}function P({immediate:e=!1}={}){if(T||d.size===0||g===VF.DISABLED||b!=null)return;let t=Math.min(FF,PF*2**Math.min(y,10)),n=Math.round(t*(.7+u()*.6)),r=e?0:n;y+=1,g!==VF.UNAUTHORIZED&&E(VF.RECONNECTING),b=a(()=>{b=null,I()},r)}async function F(){let e=await n?.();if(!e){let e=Error(`not signed in`);throw e.status=401,e}let i=await r(`${String(t())}/realtime/ticket`,{method:`POST`,headers:{Authorization:`Bearer ${e}`}});if(!i.ok){let e=Error(`ticket request failed: ${i.status}`);throw e.status=i.status,e}let a=await i.json(),o=a?.data?.ticket??a?.ticket;if(!o)throw Error(`ticket missing from response`);return o}async function I(){if(T||g===VF.DISABLED||d.size===0||_&&(_.readyState===0||_.readyState===1))return;let e=++v;E(w?VF.RECONNECTING:VF.CONNECTING);let n;try{n=await F()}catch(t){if(e!==v||T)return;(t?.status===401||t?.status===403)&&E(VF.UNAUTHORIZED),P();return}if(e!==v||T||d.size===0)return;let r;try{r=new i(qF(t(),n))}catch{P();return}_=r,S=l(),r.onmessage=e=>j(e.data),r.onerror=()=>{},r.onclose=e=>{_===r&&(_=null,x!=null&&(c(x),x=null),!T&&P({immediate:e?.code===BF&&y<2}))},x!=null&&c(x),x=s(()=>{if(_!==r)return;let e=l()-S;if(e>RF){N(),P({immediate:!0});return}e>LF&&l()-C>LF&&(C=l(),D({op:`ping`}))},IF)}function L(){T||g===VF.DISABLED||_||b!=null||I()}return{subscribe(e,t){let n=GF(e);if(!n||typeof t!=`function`)return()=>{};let r=d.get(n),i=!r;return r||(r=new Set,d.set(n,r)),r.add(t),i&&D({op:`subscribe`,topics:[n]}),L(),()=>{let e=d.get(n);e&&(e.delete(t),e.size===0&&(d.delete(n),D({op:`unsubscribe`,topics:[n]})),d.size===0&&(v+=1,M(),N(),g!==VF.DISABLED&&E(VF.IDLE)))}},onReconnect(e){return p.add(e),()=>p.delete(e)},onStatus(e){return f.add(e),()=>f.delete(e)},getStatus:()=>g,nudge(){T||g===VF.DISABLED||d.size===0||_&&_.readyState===1||(b!=null&&(o(b),b=null),y=0,I())},close(){T=!0,M(),N(),d.clear(),E(VF.CLOSED)},_debug:()=>({topics:[...d.keys()],attempts:y,hasSocket:!!_})}}var YF=(0,u.createContext)(null),XF=null,ZF=0,QF=null,$F=1500;function eI(e){return XF||=JF({getBaseUrl:()=>String(t.S),getToken:()=>t.a().catch(()=>null),...e}),XF}function tI(){ZF+=1,QF!=null&&(clearTimeout(QF),QF=null)}function nI(){ZF=Math.max(0,ZF-1),!(ZF>0||QF!=null)&&(QF=setTimeout(()=>{QF=null,ZF===0&&XF&&(XF.close(),XF=null)},$F))}var rI=[],iI=2e3,aI=()=>()=>{},oI=()=>VF.DISABLED;function sI(){return(0,u.useContext)(YF)}function cI(){let e=(0,u.useContext)(YF);return(0,u.useSyncExternalStore)(e?e.onStatus:aI,e?e.getStatus:oI,oI)}function lI(e){return[...new Set((Array.isArray(e)?e:[e]).map(GF).filter(Boolean))].sort().join(`|`)}function uI(e,t,{enabled:n=!0}={}){let r=(0,u.useContext)(YF),i=(0,u.useRef)(t);(0,u.useEffect)(()=>{i.current=t});let a=lI(e??rI);(0,u.useEffect)(()=>{if(!r||!n||!a)return;let e=a.split(`|`).map(e=>r.subscribe(e,e=>i.current?.(e)));return()=>e.forEach(e=>e())},[r,n,a])}function dI(e,{enabled:t=!0}={}){let n=(0,u.useContext)(YF),r=(0,u.useRef)(e);(0,u.useEffect)(()=>{r.current=e}),(0,u.useEffect)(()=>{if(!(!n||!t))return n.onReconnect(()=>r.current?.())},[n,t])}function fI({topics:e=rI,enabled:n=!0,debounceMs:r=400,filter:i}={}){let[a,s]=(0,u.useState)({tick:0,lastEvent:null}),c=(0,u.useRef)(null),l=(0,u.useRef)(null),d=(0,u.useRef)(0),f=(0,u.useRef)(i);(0,u.useEffect)(()=>{f.current=i});let p=(0,u.useCallback)(()=>{c.current=null;let e=l.current;e&&(typeof document<`u`&&document.visibilityState===`hidden`||(l.current=null,t.p(),o.r(),s(t=>({tick:t.tick+1,lastEvent:e.event??t.lastEvent}))))},[]),m=(0,u.useCallback)(e=>{l.current||(d.current=Date.now()),l.current=e,c.current!=null&&clearTimeout(c.current);let t=Date.now()-d.current;c.current=setTimeout(p,Math.max(0,Math.min(r,iI-t)))},[r,p]);return uI(e,e=>{typeof f.current==`function`&&!f.current(e)||m({event:e})},{enabled:n}),dI(()=>m({reconnect:!0}),{enabled:n}),(0,u.useEffect)(()=>{if(!n||typeof document>`u`)return;let e=()=>{document.visibilityState===`visible`&&l.current&&p()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[n,p]),(0,u.useEffect)(()=>()=>{c.current!=null&&clearTimeout(c.current)},[]),(0,u.useMemo)(()=>({tick:a.tick,lastEvent:a.lastEvent}),[a])}var pI={aim:f.AimOutlined,bank:f.BankOutlined,book:f.BookOutlined,calendar:f.CalendarOutlined,check:f.CheckCircleOutlined,clock:f.ClockCircleOutlined,close:f.CloseOutlined,delete:f.DeleteOutlined,download:f.DownloadOutlined,edit:f.EditOutlined,location:f.EnvironmentOutlined,export:f.ExportOutlined,view:f.EyeOutlined,file:f.FileTextOutlined,filter:f.FilterOutlined,id:f.IdcardOutlined,link:f.LinkOutlined,mail:f.MailOutlined,sms:f.MessageOutlined,message:f.MessageOutlined,more:f.MoreOutlined,phone:f.PhoneOutlined,call:f.PhoneOutlined,plus:f.PlusOutlined,refresh:f.ReloadOutlined,send:f.SendOutlined,team:f.TeamOutlined,user:f.UserOutlined,whatsapp:f.WhatsAppOutlined};function mI(e){if(!e)return;if(typeof e!=`string`)return e;let t=pI[e.trim().toLowerCase()];return t?(0,u.createElement)(t):void 0}var $=e=>e!=null&&String(e).trim()!==``;function hI(e){return Array.isArray(e)?e:e==null?[]:[e]}function gI(e,t){if(!(!e||typeof e!=`object`||!$(t)))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:String(t).split(`.`).reduce((e,t)=>e?.[t],e)}function _I(e,t,n){if(typeof e==`function`)try{return e(t,n)}catch(e){console.warn(`[COMBAINED pages] config value failed:`,e);return}if(typeof e==`string`){let n=gI(t?.record,e);return n===void 0?gI(t,e):n}return e}function vI(e,t,n){return typeof e==`function`?_I(e,t,n):e}function yI(e){return e==null?``:Array.isArray(e)?e.map(yI).filter($).join(`, `):String(typeof e==`object`?e.label??e.value??e.name??e.title??``:e)}function bI(e,t,n){if(!e)return!1;let r=typeof e.permission==`string`?e.permission.trim().toLowerCase():``;return r&&n?.can&&n.can[r]===!1||e.adminAction!==void 0&&!Bc(e.adminAction,n?.module)?!1:e.visible===void 0||!!_I(e.visible,t,n)}function xI(e,t,n){return hI(e).filter(e=>e&&$(e.key)&&bI(e,t,n)).map(e=>{let r=!!_I(e.disabled,t,n),i=e.menu?xI(e.menu,t,n):null;return{key:String(e.key),label:yI(vI(e.label,t,n)),icon:mI(e.icon),type:e.type,className:typeof e.className==`string`?e.className:void 0,danger:!!e.danger,disabled:r,tooltip:yI(vI(e.tooltip,t,n)),note:yI(vI(e.note,t,n)),onClick:r||typeof e.onClick!=`function`?void 0:()=>e.onClick(t,n),menu:i&&i.length?i:null}})}function SI(e){let t=[`popover`,`docked`,`none`].includes(e?.filter)?e.filter:`popover`,n=[`popover`,`docked`].includes(e?.quickView)?e.quickView:`popover`;return{filter:t,quickView:n,railMode:t===`docked`?`docked`:`popover`,showRail:t!==`none`,quickViewMode:n===`docked`?`docked`:`overlay`,quickViewWidth:Number(e?.quickViewWidth)>0?Number(e.quickViewWidth):380,filterWidth:Number(e?.filterWidth)>0?Number(e.filterWidth):300}}function CI(e,t){return!e||typeof e!=`object`?null:e[t]&&typeof e[t]==`object`?e[t]:Array.isArray(e.sections)||e.identity?e:null}var wI=e=>e&&$(e.key)&&$(e.label);function TI(e){let t=[];return hI(e).forEach(e=>{if(!wI(e)){console.warn(`[DetailViewPage] tab skipped — it needs a key and a label:`,e);return}if(e.component||e.type===`overview`||e.type===`details`){t.push(e);return}if($(e.module)&&e.relation&&typeof e.relation==`object`){let{list:n,...r}=e;t.push(n?{...r,listComponent:n}:r);return}console.warn(`[DetailViewPage] tab "${e.key}" skipped — it needs { module, relation }, a component or type 'overview'.`)}),t}function EI(e){let t=String(e??``).split(/\s+/).filter(Boolean);return t.length?`${t[0][0]}${t.length>1?t.at(-1)[0]:``}`.toUpperCase():`?`}function DI(e){let t=[e?.value,e?.field,e?.fieldName,e?.name,e?.label].find(e=>e!=null&&String(e).trim()!==``);return t===void 0?``:String(t)}function OI(e,t=n.kt){if(!e||typeof e!=`object`)return null;let r=hI(e.show).map(String).filter($),i=e.fields&&typeof e.fields==`object`?e.fields:{},a=hI(e.add).filter(e=>e&&$(e.key));return!r.length&&!Object.keys(i).length&&!a.length?null:{responseMapper:(e,n)=>{let o=t(e,n)??{},s=hI(o.rows).map(e=>{if(!a.length||!e||typeof e!=`object`)return e;let t={...e};return a.forEach(n=>{t[n.key]=typeof n.value==`function`?_I(n.value,e,{row:e}):gI(e,n.value??n.key)}),t}),c=a.map(e=>{let{value:t,after:n,...r}=e;return{...r,field:e.key,label:e.label??e.key,isVisible:!0,isVirtual:!0}}),l=e=>{let t=DI(e);return i[t]?{...e,...i[t]}:e},u;if(r.length){let e=new Map([...hI(o.fields),...c].map(e=>[DI(e),e]));u=r.map(t=>e.get(t)??(i[t]?{field:t,label:i[t].label??t}:null)).filter(Boolean).map((e,t)=>({...l(e),isVisible:!0,order:t}))}else u=hI(o.fields).map(l),c.forEach((e,t)=>{let n=$(a[t].after)?u.findIndex(e=>DI(e)===a[t].after):-1;n>=0?u.splice(n+1,0,e):u.push(e)}),u.some(e=>e.order!==void 0&&e.order!==null&&e.order!==``)&&(u=u.map((e,t)=>({...e,order:t})));return{...o,rows:s,fields:u}},...r.length?{defaultVisibleColumnCount:r.length}:{}}}function kI(e){let t=e=>String(e??``).trim().toLowerCase(),n=hI(e?.include).map(t).filter(Boolean),r=hI(e?.exclude).map(t).filter(Boolean);return!n.length&&!r.length?null:e=>{let i=[e?.name,e?.groupName,e?.label,e?.title].map(t).filter(Boolean);return!(n.length&&!i.some(e=>n.includes(e))||r.length&&i.some(e=>r.includes(e)))}}function AI(e){return!e||e.access===!1?``:e.access&&typeof e.access==`object`&&$(e.access.module)?String(e.access.module):$(e.module)&&e.relation&&typeof e.relation==`object`?String(e.module):``}function jI(e,t){return hI(e).filter(e=>{let n=AI(e);return!n||t(n)!==!1})}function MI(e){return!e||e.access===!1?``:e.access&&typeof e.access==`object`&&$(e.access.module)?String(e.access.module):$(e.module)?String(e.module):``}function NI(e,t,n){let r=new Set(hI(t).map(e=>e?.key));return hI(e).filter(e=>{let t=MI(e);return!t||n(t)!==!1}).map(e=>e?.tab&&!r.has(e.tab)?{...e,tab:void 0}:e)}var PI=4e3;function FI(e){if(typeof e?.clickFeedback==`boolean`)return e.clickFeedback;try{return window.__CORE_THEME_CONFIG__?.quickViewClickFeedback===!0}catch{return!1}}function II(e){let t=(0,h.useLocation)(),n=`${t.key}|${t.pathname}|${t.search}`,[r,i]=(0,u.useState)(null),a=(0,u.useRef)(null);(0,u.useEffect)(()=>()=>clearTimeout(a.current),[]);let o=r&&r.at===n?r.key:null,s=()=>{clearTimeout(a.current),i(null)};return{wrap:(t,r)=>!e||typeof r!=`function`?r:(...e)=>{if(o)return;i({key:t,at:n}),clearTimeout(a.current),a.current=setTimeout(s,PI);let c;try{c=r(...e)}catch(e){throw s(),e}return c&&typeof c.then==`function`&&Promise.resolve(c).finally(s),c},busyKey:o,isBusy:e=>o===e,anyBusy:!!o,done:s}}var LI=n.At.quickView;function RI(e,t){return String(t||``).split(`.`).reduce((e,t)=>e?.[t],e)}function zI(e,{record:t,scope:r,module:i}){return!(!e||!e.key||e.showInQuickView!==!0||e.actionType===`group`||e.children?.length||!n.hn(e.permission,i)||e.permissionKey&&!n.mn(RI(t,`actionPermission.${e.permissionKey}`))||e.allowedTabs?.length&&r&&!e.allowedTabs.some(e=>String(e).toLowerCase()===String(r).toLowerCase()))}function BI(e,{record:t,rules:r,scope:i}){let a=n.jt(e,t,i),o=n.Pt(e.key,t,r,i,LI);return{key:String(e.key),label:a?a.label:e.label||String(e.key),action:e,disabled:!!(a||o),reason:a?a.label:o||``}}function VI({actions:e,actionRules:t,record:r,scope:i,module:a}={}){let o=Array.isArray(t)?t:[],s={record:r,scope:i,module:a,rules:o},c=(Array.isArray(e)?e:[]).filter(e=>zI(e,s)),l=[],u=n.It(r,o,i,LI),d=null;if(u){let t=c.find(e=>String(e.key)===u);t?d=BI(t,s):(Array.isArray(e)?e:[]).some(e=>String(e?.key)===u)||l.push(`Quick View rule names primary action "${u}", which is not in the action library.`)}let f=c.filter(e=>!n.Nt(e.key,r,o,i,LI)).map(e=>({...BI(e,s),selected:!!(d&&String(e.key)===d.key)}));return{primary:d,menu:f,warnings:l}}function HI({prompt:e,title:t,onSubmit:n,onCancel:r,busy:i=!1,danger:a=!1}){let o=Jb(e)??Jb({label:`Value`,required:!0}),[s,c]=(0,u.useState)(``),[l,f]=(0,u.useState)(!1),m=Xb(o,s),h=!i&&!m&&(!o.required||s.trim()!==``),g=()=>{f(!0),h&&n?.(s.trim())},_=e=>{if(e.key===`Escape`){e.stopPropagation(),r?.();return}e.key===`Enter`&&(!o.multiline||e.ctrlKey||e.metaKey)&&(e.preventDefault(),g())},v=`cc-action-input-${o.key}`,y=o.multiline?d.Input.TextArea:d.Input;return(0,p.jsxs)(`div`,{className:a?`cc-action-input cc-action-input--danger`:`cc-action-input`,"data-ct-part":`qv-action-input`,role:`group`,"aria-label":t||void 0,style:{padding:12,marginBottom:10,border:`1px solid ${a?`var(--ant-color-error-border, #ffccc7)`:`var(--ant-color-border, #d9d9d9)`}`,borderRadius:8},children:[t?(0,p.jsx)(d.Typography.Text,{strong:!0,type:a?`danger`:void 0,className:`cc-action-input__title`,style:{display:`block`,marginBottom:6},children:t}):null,(0,p.jsxs)(`label`,{htmlFor:v,style:{display:`block`,marginBottom:4},children:[o.label,o.required?(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{color:`var(--ant-color-error, #ff4d4f)`},children:` *`}):null]}),(0,p.jsx)(y,{id:v,autoFocus:!0,value:s,placeholder:o.placeholder||void 0,maxLength:o.maxLength||void 0,showCount:!!o.maxLength,autoSize:o.multiline?{minRows:2,maxRows:5}:void 0,disabled:i,"aria-required":o.required,"aria-invalid":!!(l&&m),onChange:e=>c(e.target.value),onBlur:()=>f(!0),onKeyDown:_}),l&&m?(0,p.jsx)(d.Typography.Text,{type:`danger`,className:`cc-action-input__error`,role:`alert`,style:{display:`block`,marginTop:4,fontSize:12},children:m}):null,(0,p.jsxs)(d.Flex,{gap:8,justify:`flex-end`,className:`cc-action-input__actions`,style:{marginTop:10},children:[(0,p.jsx)(d.Button,{onClick:()=>r?.(),disabled:i,children:`Cancel`}),(0,p.jsx)(d.Button,{type:`primary`,danger:a,onClick:g,disabled:!h,loading:i,children:o.submitLabel})]})]})}function UI({prompt:e,action:t,record:r,tab:i,onSubmit:a,onCancel:o,busy:s=!1}){let c=Jb(e,t)??Jb({label:`Value`,required:!0},t),[l,f]=(0,u.useState)(void 0),[m,h]=(0,u.useState)(``),[g,_]=(0,u.useState)(!1),v=Xb(c,l),y=!s&&!v,b=e=>n.ht(e,r,{action:t,tab:i}),x=b(c.title)||String(t?.label??``).trim()||c.label,S=!!t?.danger;return(0,p.jsxs)(d.Modal,{open:!0,centered:!0,width:480,className:`cc-action-input-modal cc-action-confirm--hero`,maskClosable:!1,onCancel:()=>o?.(),title:null,footer:[(0,p.jsx)(d.Button,{className:`cc-action-input-modal__cancel`,onClick:()=>o?.(),disabled:s,children:c.cancelLabel},`cancel`),(0,p.jsx)(d.Button,{type:`primary`,danger:S,loading:s,disabled:s,onClick:()=>{_(!0),y&&a?.(String(l??``).trim(),m.trim())},icon:c.icon?n.vt(c.icon,`cc-confirm-hero__btn-icon`):void 0,children:c.submitLabel},`ok`)],children:[(0,p.jsxs)(`div`,{className:`cc-confirm-hero__head`,children:[c.icon?n.vt(c.icon):null,(0,p.jsx)(d.Typography.Title,{level:4,className:`cc-confirm-hero__title`,children:x})]}),n._t(b(c.message),b(c.note)),(0,p.jsxs)(d.Form,{layout:`vertical`,className:`cc-action-input-modal__form`,requiredMark:!0,children:[(0,p.jsx)(d.Form.Item,{label:c.label,required:c.required,validateStatus:g&&v?`error`:void 0,help:g&&v?v:void 0,children:c.options.length?(0,p.jsx)(d.Select,{value:l,placeholder:c.placeholder||`Select`,options:c.options.map(e=>({value:e,label:e})),onChange:e=>{f(e),_(!0)},disabled:s,classNames:{popup:{root:`cc-action-input-modal__options`}},placement:`bottomLeft`,listHeight:320}):(0,p.jsx)(d.Input.TextArea,{value:l,placeholder:c.placeholder||void 0,maxLength:c.maxLength||void 0,autoSize:{minRows:2,maxRows:5},disabled:s,onChange:e=>f(e.target.value),onBlur:()=>_(!0)})}),c.comment?(0,p.jsx)(d.Form.Item,{label:c.comment.label,children:(0,p.jsx)(d.Input.TextArea,{value:m,placeholder:c.comment.placeholder||void 0,maxLength:c.comment.maxLength||void 0,showCount:!!c.comment.maxLength,autoSize:{minRows:3,maxRows:6},disabled:s,onChange:e=>h(e.target.value)})}):null]})]})}function WI({spec:e,data:t,ctx:r,style:i,feedback:a=!1}){let o=II(a),[s,c]=(0,u.useState)(null),l=(0,u.useRef)(null),[m,h]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{if(!s)return;let e=l.current?.closest?.(`.cc-qv-footer`)??l.current?.parentElement;h(e?.getBoundingClientRect?.().width||0)},[s]);let g=String(vI(e?.module,t,r)||r?.module||``),{actions:_,actionRules:v}=gc(g),y=typeof e?.scope==`function`?e.scope(t,r):vI(e?.scope,t,r),b=(typeof e?.record==`function`?e.record(t,r):null)??t?.record??null,x=typeof e?.facts==`function`?e.facts(t,r):null,{primary:S,menu:C,warnings:w}=VI({actions:_,actionRules:v,record:{...b??{},...x??{}},scope:y===null||y===``?void 0:String(y),module:g}),T=w.join(`
|
|
54
54
|
`);(0,u.useEffect)(()=>{T&&console.warn(`[QuickViewModuleActions] ${T}`)},[T]);let E=e?.layout===`buttons`;if(!S&&!(E&&C.length))return null;let D=String(b?._id?.$oid??b?._id??b?.id??``),O=(e,t=null)=>(D&&n.lt(g,D),bc(e.action,b,{navigate:r?.navigate,location:r?.location,module:g,onDone:()=>r?.refresh?.(),input:t})),k=e=>{if(!e||e.disabled)return;let t=()=>{if(Jb(e.action?.inputPrompt)){o.done?.(),c(e);return}return O(e)};return n.yt(e.action)?n.pt(e.action,b,{tab:r?.tabLabel??r?.tab?.label??``}).then(e=>e?t():void 0):t()},A=(s?Jb(s.action.inputPrompt,s.action):null)?.display===`modal`?(0,p.jsx)(UI,{prompt:s.action.inputPrompt,action:s.action,record:b,tab:r?.tabLabel??r?.tab?.label??``,onCancel:()=>c(null),onSubmit:(e,t)=>{let n=s;c(null),O(n,Zb(n.action.inputPrompt,e,t))}},s.key):null,j=s&&!A?(0,p.jsx)(`div`,{className:`cc-qv-action-input-layer`,style:{position:`absolute`,right:0,bottom:`100%`,width:m||`100%`,maxWidth:`none`,marginBottom:8,zIndex:3,background:`var(--ant-color-bg-container, #fff)`,borderRadius:8,boxShadow:`0 6px 16px rgba(0, 0, 0, 0.12)`},children:(0,p.jsx)(HI,{prompt:Jb(s.action.inputPrompt,s.action),title:s.label,danger:!!s.action?.danger,onCancel:()=>c(null),onSubmit:e=>{let t=s;c(null),O(t,Zb(t.action.inputPrompt,e))}},s.key)}):null,M=j?{...i??{},position:`relative`}:i;if(E){let t=S?.key??(e?.primary?String(e.primary):``),n=(C.length?C:[S]).map((e,t)=>({item:e,i:t})).sort((e,n)=>(e.item.key===t)-(n.item.key===t)||e.i-n.i).map(({item:e})=>e);return(0,p.jsxs)(`div`,{ref:l,style:M,children:[j,A,(0,p.jsx)(d.Space,{className:`cc-qv-action-buttons`,style:{display:`flex`,width:`100%`},children:n.map(e=>{let n=(0,p.jsx)(d.Button,{type:e.key===t?`primary`:`default`,danger:!!e.action?.danger,disabled:e.disabled,loading:o.isBusy(e.key)||void 0,onClick:o.wrap(e.key,()=>k(e)),block:!0,children:e.label},e.key);return e.reason?(0,p.jsx)(d.Tooltip,{title:e.reason,children:n},e.key):n})})]})}let N=(0,p.jsx)(d.Button,{type:`primary`,danger:!!S.action?.danger,disabled:S.disabled,loading:o.anyBusy||void 0,"aria-busy":o.anyBusy||void 0,onClick:o.wrap(S.key,()=>k(S)),block:!0,children:S.label}),P=S.reason?(0,p.jsx)(d.Tooltip,{title:S.reason,children:N}):N;return C.length?(0,p.jsxs)(`div`,{ref:l,style:M,children:[j,A,(0,p.jsxs)(d.Space.Compact,{block:!0,children:[P,(0,p.jsx)(d.Dropdown,{trigger:[`click`],rootClassName:`cc-qv-action-menu`,menu:{items:C.map(e=>({key:e.key,label:e.label,disabled:e.disabled,title:e.reason||void 0,danger:!!e.action?.danger||void 0,className:[e.selected?`cc-qv-action--selected`:``,e.action?.danger?`cc-qv-action--danger`:``].filter(Boolean).join(` `)||void 0,extra:e.selected?(0,p.jsx)(f.CheckOutlined,{className:`cc-qv-action-check`,"aria-label":`current`}):void 0})),onClick:({key:e,domEvent:t})=>{t?.stopPropagation?.();let n=C.find(t=>t.key===e);n&&!n.disabled&&o.wrap(e,()=>k(n))()}},children:(0,p.jsx)(d.Button,{type:`primary`,danger:!!S.action?.danger,icon:(0,p.jsx)(f.DownOutlined,{}),"aria-label":`${S.label} options`})})]})]}):(0,p.jsxs)(`div`,{ref:l,style:M,children:[j,A,P]})}var{Text:GI,Title:KI}=d.Typography;function qI(e,t){return!(0,u.isValidElement)(e)||e.type!==`img`?e:(0,u.cloneElement)(e,{style:{maxWidth:t,maxHeight:t,objectFit:`contain`,verticalAlign:`middle`,flex:`0 0 auto`,...e.props.style??{}}})}var JI={action:22,callout:26,line:16,button:18},YI=new Set([`callout`,`steps`,`fields`,`timeline`,`custom`,`chips`,`list`,`metrics`,`tabs`]),XI={wrap:(e,t)=>t,isBusy:()=>!1,anyBusy:!1};function ZI({button:e,block:t=!1,fb:n=XI}){let r=n.isBusy(e.key),i=(0,p.jsx)(d.Button,{className:e.className,type:e.type??`default`,danger:e.danger,icon:qI(e.icon,JI.button),disabled:e.disabled||!e.onClick,loading:r||void 0,"aria-busy":r||void 0,onClick:n.wrap(e.key,e.onClick),block:t,children:e.label});return e.menu?(0,p.jsxs)(d.Space.Compact,{block:t,children:[i,(0,p.jsx)(d.Dropdown,{trigger:[`click`],menu:{items:e.menu.map(e=>({key:e.key,label:e.label,icon:qI(e.icon,JI.button),danger:e.danger,disabled:e.disabled||!e.onClick})),onClick:({key:t})=>{let r=e.menu.find(e=>e.key===t);return r?.onClick?n.wrap(e.key,r.onClick)():void 0}},children:(0,p.jsx)(d.Button,{type:e.type??`default`,icon:(0,p.jsx)(f.DownOutlined,{}),"aria-label":`${e.label} options`})})]}):i}var QI={display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`0 0 auto`,width:48,height:48,borderRadius:8,fontSize:22,color:`var(--ant-color-primary)`,background:`var(--ant-color-primary-bg)`};function $I({spec:e,data:t,ctx:n}){let r=yI(_I(e.name,t,n)),i=e.avatar!==!1,a=i?_I(e.avatar,t,n):null,o=i&&e.icon?mI(typeof e.icon==`function`?e.icon(t,n):e.icon):null,s=_I(e.badge,t,n),c=yI(s?.label??s),l=hI(_I(e.tags,t,n)).map((e,t)=>({key:t,label:yI(e?.label??e),color:e?.color})).filter(e=>$(e.label)),u=hI(e.lines).filter(e=>bI(e,t,n)).map((e,r)=>({key:r,icon:qI(mI(e.icon),JI.line),text:yI(_I(e.value??e,t,n))})).filter(e=>$(e.text)),m=hI(e.meta).map(e=>({label:vI(e.label,t,n),text:yI(_I(e.value,t,n))})).filter(e=>$(e.text));return(0,p.jsxs)(d.Flex,{gap:12,align:`flex-start`,className:`cc-qv-identity`,children:[o?(0,p.jsx)(`span`,{className:`cc-qv-identity__tile`,"aria-hidden":`true`,style:QI,children:o}):i&&(0,p.jsx)(d.Avatar,{size:64,src:$(a)?a:void 0,children:EI(r)}),(0,p.jsxs)(d.Flex,{vertical:!0,gap:2,flex:1,style:{minWidth:0},children:[l.length>0&&(0,p.jsx)(d.Flex,{gap:4,wrap:!0,className:`cc-qv-identity__tags`,children:l.map(e=>(0,p.jsx)(d.Tag,{color:e.color,style:{marginInlineEnd:0},children:e.label},e.key))}),(0,p.jsxs)(d.Flex,{justify:`space-between`,align:`flex-start`,gap:8,children:[(0,p.jsxs)(GI,{strong:!0,ellipsis:!0,children:[r||`—`,n.openFull&&(0,p.jsx)(d.Button,{type:`link`,size:`small`,icon:(0,p.jsx)(f.ExportOutlined,{}),onClick:n.openFull,"aria-label":`Open full record`})]}),$(c)&&(0,p.jsx)(d.Tag,{color:s?.color,children:c})]}),u.map(e=>(0,p.jsxs)(GI,{type:`secondary`,children:[e.icon,` `,e.text]},e.key)),m.length>0&&(0,p.jsx)(GI,{type:`secondary`,children:m.map(e=>e.label?`${e.label}: ${e.text}`:e.text).join(` `)})]})]})}function eL({buttons:e,fb:t=XI}){return e.length?(0,p.jsx)(d.Flex,{justify:`space-around`,wrap:!0,gap:8,children:e.map(e=>(0,p.jsxs)(d.Flex,{vertical:!0,align:`center`,gap:2,children:[(0,p.jsx)(d.Tooltip,{title:e.tooltip||e.label,children:(0,p.jsx)(d.Button,{shape:`circle`,size:`large`,icon:qI(e.icon,JI.action),danger:e.danger,disabled:e.disabled||!e.onClick,loading:t.isBusy(e.key)||void 0,"aria-busy":t.isBusy(e.key)||void 0,onClick:t.wrap(e.key,e.onClick),"aria-label":e.label})}),$(e.note)&&(0,p.jsx)(GI,{type:`secondary`,style:{fontSize:12},children:e.note})]},e.key))}):null}function tL({section:e,data:t,ctx:n,fb:r=XI}){let i=yI(vI(e.title,t,n)),a=String(e.type??``).trim(),o;if(!YI.has(a))o=(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`Quick View config: unknown section type "${a||`(none)`}".`});else if(a===`callout`){let r=_I(e.value,t,n),i=yI(r?.title??r),a=yI(r?.text),[s]=xI(e.button?[{key:`action`,type:`primary`,...e.button}]:[],t,n);o=(0,p.jsxs)(d.Flex,{vertical:!0,gap:10,children:[$(i)?(0,p.jsxs)(d.Flex,{gap:10,align:`flex-start`,children:[qI(mI(e.icon),JI.callout),(0,p.jsxs)(d.Flex,{vertical:!0,children:[(0,p.jsx)(GI,{strong:!0,children:i}),$(a)&&(0,p.jsx)(GI,{type:`secondary`,children:a})]})]}):(0,p.jsx)(GI,{type:`secondary`,children:vI(e.empty,t,n)??`Nothing yet.`}),s&&(0,p.jsx)(ZI,{button:s,block:!0})]})}else if(a===`steps`){let r=hI(vI(e.steps,t,n)).map(e=>({title:(0,p.jsx)(GI,{style:{fontSize:12,whiteSpace:`nowrap`},children:yI(e)})})),i=Number(_I(e.current,t,n));o=(0,p.jsx)(d.Steps,{progressDot:!0,size:`small`,current:Number.isFinite(i)&&i>=0?i:-1,items:r})}else if(a===`fields`){let r=hI(e.fields).filter(e=>e&&bI(e,t,n)).map((r,i)=>{let a=yI(_I(r.value,t,n)),o=$(a)?a:e.empty??`—`,s=vI(r.label,t,n),c=r.icon?qI(mI(r.icon),JI.line):null;return{key:r.key??String(i),label:c?(0,p.jsxs)(`span`,{className:`cc-qv-field-label`,children:[c,(0,p.jsx)(`span`,{children:s})]}):s,children:r.tag&&$(a)?(0,p.jsx)(d.Tag,{color:_I(r.color,t,n),children:o}):o}});o=(0,p.jsx)(d.Descriptions,{column:1,size:`small`,items:r})}else if(a===`timeline`){let r=Number(e.limit)>0?Number(e.limit):3,i=hI(_I(e.items,t,n)).slice(0,r);o=i.length?(0,p.jsx)(d.Timeline,{items:i.map((e,t)=>({key:e?.key??String(t),...e?.icon?{dot:(0,p.jsx)(`span`,{className:`cc-qv-timeline-icon`,children:qI(mI(e.icon),JI.line)})}:{},children:(0,p.jsxs)(d.Flex,{vertical:!0,children:[(0,p.jsx)(GI,{strong:!0,children:yI(e?.title)}),$(yI(e?.time))&&(0,p.jsx)(GI,{type:`secondary`,children:yI(e.time)}),$(yI(e?.text))&&(0,p.jsx)(GI,{children:yI(e.text)})]})}))}):(0,p.jsx)(GI,{type:`secondary`,children:vI(e.empty,t,n)??`No activity yet.`})}else if(a===`chips`){let r=hI(_I(e.items,t,n)).map((e,t)=>({key:t,label:yI(e?.label??e),color:e?.color})).filter(e=>$(e.label));o=r.length?(0,p.jsx)(d.Flex,{gap:6,wrap:!0,className:`cc-qv-chips`,children:r.map(e=>(0,p.jsx)(d.Tag,{color:e.color,style:{marginInlineEnd:0},children:e.label},e.key))}):(0,p.jsx)(GI,{type:`secondary`,children:vI(e.empty,t,n)??`—`})}else if(a===`list`){let r=hI(_I(e.items,t,n)).filter(e=>e&&$(yI(e.title))),i=Number(e.limit)>0?Number(e.limit):r.length,a=r.slice(0,i),[s]=e.more?xI([{key:`more`,type:`link`,...e.more}],t,n):[];o=a.length?(0,p.jsxs)(d.Flex,{vertical:!0,gap:10,className:`cc-qv-list`,children:[a.map((t,n)=>{let r=t.tag&&typeof t.tag==`object`?t.tag:$(t.tag)?{label:t.tag}:null,i=yI(t.title);return(0,p.jsxs)(d.Flex,{gap:10,align:`center`,className:`cc-qv-list__item`,children:[e.avatars!==!1&&t.avatar!==!1&&(0,p.jsx)(d.Avatar,{size:32,children:EI($(t.avatar)?t.avatar:i)}),(0,p.jsxs)(d.Flex,{vertical:!0,flex:1,style:{minWidth:0},children:[(0,p.jsx)(GI,{strong:!0,ellipsis:!0,children:i}),$(yI(t.text))&&(0,p.jsx)(GI,{type:`secondary`,ellipsis:!0,children:yI(t.text)})]}),r&&$(yI(r.label))&&(0,p.jsx)(d.Tag,{color:r.color,style:{marginInlineEnd:0},children:yI(r.label)})]},t.key??n)}),s&&(0,p.jsx)(ZI,{button:s})]}):(0,p.jsx)(GI,{type:`secondary`,children:vI(e.empty,t,n)??`Nothing yet.`})}else if(a===`metrics`){let r=hI(e.items).filter(e=>e&&bI(e,t,n)).map((e,r)=>({key:e.key??String(r),label:vI(e.label,t,n),value:yI(_I(e.value,t,n)),percent:Number(_I(e.percent,t,n)),note:yI(_I(e.note,t,n))})).filter(e=>$(e.value));o=r.length?(0,p.jsx)(d.Flex,{gap:12,wrap:!0,className:`cc-qv-metrics`,children:r.map(e=>(0,p.jsxs)(d.Flex,{vertical:!0,gap:2,className:`cc-qv-metric`,style:{flex:`1 1 120px`,minWidth:0},children:[(0,p.jsx)(GI,{type:`secondary`,style:{fontSize:12},children:e.label}),(0,p.jsx)(GI,{strong:!0,children:e.value}),Number.isFinite(e.percent)&&(0,p.jsx)(d.Progress,{percent:Math.max(0,Math.min(100,Math.round(e.percent))),showInfo:!1,size:`small`}),$(e.note)&&(0,p.jsx)(GI,{type:`secondary`,style:{fontSize:12},children:e.note})]},e.key))}):(0,p.jsx)(GI,{type:`secondary`,children:vI(e.empty,t,n)??`—`})}else o=a===`tabs`?(0,p.jsx)(nL,{section:e,data:t,ctx:n}):typeof e.render==`function`?e.render(t,n):null;let[s]=e.action?xI([{key:`section-action`,...e.action}],t,n):[],c=!!s&&e.actionPlacement===`header`,l=e.titleIcon?qI(mI(e.titleIcon),JI.line):null,u=$(i)?(0,p.jsx)(KI,{level:5,style:{margin:0},children:i}):null;return(0,p.jsxs)(d.Flex,{vertical:!0,gap:8,"data-qv-section":$(e.key)?String(e.key):a,children:[(l||c)&&(u||c)?(0,p.jsxs)(d.Flex,{align:`center`,gap:8,className:`cc-qv-section-head`,children:[l&&(0,p.jsx)(`span`,{className:`cc-qv-section-icon`,"data-tone":e.tone||void 0,"aria-hidden":`true`,children:l}),u,c&&(0,p.jsx)(d.Button,{type:`link`,size:`small`,className:[`cc-qv-section-action`,`cc-qv-section-action--header`,s.className].filter(Boolean).join(` `),disabled:s.disabled||!s.onClick,loading:r.isBusy(`section:${e.key??a}`)||void 0,onClick:r.wrap(`section:${e.key??a}`,s.onClick),style:{marginLeft:`auto`,paddingInline:0},children:s.label})]}):u,o,s&&!c&&(0,p.jsx)(d.Button,{block:!0,type:s.type,icon:qI(s.icon,JI.button),className:[`cc-qv-section-action`,s.className].filter(Boolean).join(` `),disabled:s.disabled||!s.onClick,loading:r.isBusy(`section:${e.key??a}`)||void 0,"aria-busy":r.isBusy(`section:${e.key??a}`)||void 0,onClick:r.wrap(`section:${e.key??a}`,s.onClick),children:s.label})]})}function nL({section:e,data:t,ctx:n}){let r=hI(e.items).filter(e=>e&&$(e.key)&&bI(e,t,n)).map(e=>({...e,sections:hI(e.sections).filter(e=>e&&bI(e,t,n))})).filter(e=>e.sections.length>0),[i,a]=(0,u.useState)(``);if(!r.length)return null;let o=r.find(e=>e.key===i)??r[0];return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,className:`cc-qv-tabs`,children:[(0,p.jsx)(d.Segmented,{className:`cc-qv-tabs__bar`,block:!0,value:o.key,onChange:e=>a(String(e)),options:r.map(e=>({value:e.key,label:vI(e.label,t,n)??e.key}))}),o.sections.map((e,r)=>(0,p.jsxs)(`div`,{children:[r>0&&(0,p.jsx)(d.Divider,{style:{margin:`0 0 12px`}}),(0,p.jsx)(tL,{section:e,data:t,ctx:n})]},e.key??r))]})}function rL({config:e,module:t,id:n,record:r=null,onClose:i,onOpenFull:a,refreshKey:o=0,extraCtx:s=null}){let c=(0,h.useNavigate)(),l=(0,h.useLocation)(),[m,g]=(0,u.useState)({key:``,data:null,error:null}),[_,v]=(0,u.useState)(0),y=`${t}|${n}`,b=!!(r&&typeof r==`object`),[x,S]=(0,u.useState)(b?y:``);b&&x!==y&&S(y);let C=b||x===y,w=e?.reloadOnRow===!1?``:C?`|row`:`|-`,T=`${t}|${n}|${o}|${_}`,E=`${T}${w}`,D=typeof e?.load==`function`?e.load:null,O=e?.keepOnRefresh===!0;(0,u.useEffect)(()=>{if(!D||!n)return;let e=!1;return Promise.resolve().then(()=>D(n,{record:r,module:t,parentId:s?.parentId,parentModule:s?.parentModule})).then(t=>{e||g({key:E,ident:y,data:t??{},error:null})}).catch(t=>{e||g(O?e=>({key:E,ident:y,data:e.ident===y?e.data:null,error:t}):{key:E,ident:y,data:null,error:t})}),()=>{e=!0}},[D,n,t,E]);let k=!D||m.key===E,A=O&&!!D&&!k&&m.ident===y&&m.data!=null,j=!!D&&!k&&w===`|row`&&m.key===`${T}|-`&&m.data!=null,M=k||A||j,N=(0,u.useMemo)(()=>{let e=M&&D?m.data:null,t=r&&typeof r==`object`?r:null,n=e?.record&&typeof e.record==`object`?e.record:null;return{...e??{},record:t||n?{...t??{},...n??{}}:null}},[M,D,m.data,r]),P=Vc(),F=II(FI(e)),I=(0,u.useMemo)(()=>({...s??{},id:n,module:t,record:r,navigate:c,location:l,close:i,openFull:a,refresh:()=>v(e=>e+1),adminActionsVersion:P}),[s,n,t,r,c,l,i,a,P]),L=O?hI(e?.footer).filter(e=>e&&$(e.key)&&e.moduleActions&&typeof e.moduleActions==`object`&&bI(e,N,I)).map(e=>String(vI(e.moduleActions.module,N,I)||t||``)).filter(Boolean).join(`
|
|
55
55
|
`):``,[R,z]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!L)return;let e=!1;return Promise.all(L.split(`
|
|
56
|
-
`).map(e=>mc(e))).then(()=>{e||z(L)}),()=>{e=!0}},[L]);let B=L!==``&&R!==L,V=A?(0,p.jsx)(`div`,{className:`cc-progress`,role:`progressbar`,"aria-label":`Refreshing`,style:{position:`absolute`,top:0,left:0,right:0}}):null,H=yI(vI(e?.title,N,I))||`Quick View`,U=e?.header===!1?null:(0,p.jsxs)(d.Flex,{justify:`space-between`,align:`center`,children:[(0,p.jsx)(KI,{level:5,style:{margin:0},children:H}),(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),onClick:i,"aria-label":`Close quick view`})]});if(!e)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,style:{padding:16},children:[U,(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`No Quick View is configured for "${t}".`})]});if(!N.record&&!M)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,style:{padding:16},children:[U,(0,p.jsx)(d.Skeleton,{active:!0,avatar:!0,paragraph:{rows:8}})]});if(!N.record)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,style:{padding:16},children:[U,(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:`This record could not be loaded.`})]});if(typeof e.render==`function`)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:14,style:O?{padding:16,position:`relative`}:{padding:16},"aria-label":H,"aria-busy":A||void 0,role:`region`,children:[V,U,M?e.render(N,I):(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:6}})]});let W=xI(e.quickActions,N,I),G=hI(e.sections).filter(e=>e&&bI(e,N,I)),ee=hI(e.footer??(a?[{key:`full`,label:`Open full details`,onClick:()=>a()}]:[])).filter(e=>e&&$(e.key)).map(e=>e.moduleActions&&typeof e.moduleActions==`object`?bI(e,N,I)?{key:String(e.key),moduleActions:e.moduleActions}:null:xI([e],N,I)[0]??null).filter(Boolean),te=e.stickyFooter===!0,ne=te?{padding:`16px 16px 0`,minHeight:`100%`,boxSizing:`border-box`}:{padding:16},re=te?{position:`sticky`,bottom:0,zIndex:2,marginTop:`auto`,padding:`12px 0 16px`,background:`var(--ant-color-bg-container, #fff)`,borderTop:`1px solid var(--ant-color-split, rgba(5, 5, 5, 0.06))`}:void 0;return(0,p.jsxs)(d.Flex,{vertical:!0,gap:14,style:O?{...ne,position:`relative`}:ne,"aria-label":H,"aria-busy":A||void 0,role:`region`,children:[V,U,e.identity&&(0,p.jsx)($I,{spec:e.identity,data:N,ctx:I}),(0,p.jsx)(eL,{buttons:W,fb:F}),m.error&&M&&(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`Some details could not be loaded.`}),!M&&(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:4},title:!1}),M&&G.map((e,t)=>(0,p.jsxs)(`div`,{children:[t>0&&(0,p.jsx)(d.Divider,{style:{margin:`0 0 12px`}}),(0,p.jsx)(tL,{section:e,data:N,ctx:I,fb:F})]},e.key??t)),ee.length>0&&(0,p.jsx)(d.Flex,{gap:8,className:te?`cc-qv-footer cc-qv-footer--sticky`:`cc-qv-footer`,style:B?{...re??{},minHeight:`var(--ant-control-height, 32px)`,boxSizing:`content-box`}:re,children:ee.map(t=>t.moduleActions?(0,p.jsx)(WI,{spec:t.moduleActions,data:N,ctx:I,style:{flex:1},feedback:FI(e)},t.key):(0,p.jsx)(`div`,{style:{flex:1},children:(0,p.jsx)(ZI,{button:t,block:!0,fb:F})},t.key))})]})}function iL({config:e,refreshKey:t=0}){let r=(0,h.useNavigate)(),i=(0,h.useLocation)(),a=e??{},o=a.module,s=SI(a.layout),c=a.strictPermissions===!0?{strict:!0,aliases:a.permissionAliases}:void 0,{canView:l,canAdd:f,canEdit:m,canDelete:g}=n.zt(o,c),_=Vc(),[v,y]=(0,u.useState)(0),b=()=>y(e=>e+1),x=a.realtime?typeof a.realtime==`object`?a.realtime:{}:null,S=fI({topics:x?(typeof x.topics==`function`?hI(x.topics({module:o})):[$(o)?UF(o):``]).filter($):[],enabled:!!x,debounceMs:x?.debounceMs??600}),C=t+v+S.tick,w=hI(a.refreshEvents).filter($).join(`|`);(0,u.useEffect)(()=>{if(!w||typeof window>`u`)return;let e=w.split(`|`),t=()=>y(e=>e+1);return e.forEach(e=>window.addEventListener(e,t)),()=>e.forEach(e=>window.removeEventListener(e,t))},[w]);let T={module:o,navigate:r,location:i,refresh:b,can:{view:l,add:f,edit:m,delete:g},adminActionsVersion:_},E=xI(a.buttons,{record:null},T),D=typeof a.fullView==`function`?a.fullView:null,O=(e,t)=>{D&&r(D(t))},k=CI(a.quickView,o),A=({module:e,id:t,record:n,onClose:r,onOpenFull:i})=>k?(0,p.jsx)(rL,{config:k,module:e,id:t,record:n,onClose:r,onOpenFull:D?i:void 0,refreshKey:C,extraCtx:{can:T.can,...a.context??{}}},`${e}:${t}`):null;if(!$(o))return null;let j={presentation:{title:a.title},...OI(a.columns)??{},...a.seenDots===!0?{seenDots:!0}:{},...a.listProps??{}},M=$(a.title)||hI(a.breadcrumb).length||E.length;return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,children:[M?(0,p.jsxs)(d.Flex,{justify:`space-between`,align:`center`,gap:12,wrap:!0,children:[(0,p.jsxs)(d.Flex,{vertical:!0,gap:4,children:[hI(a.breadcrumb).length>0&&(0,p.jsx)(n.Dt,{items:a.breadcrumb}),$(a.title)&&(0,p.jsx)(d.Typography.Title,{level:4,style:{margin:0},children:a.title})]}),E.length>0&&(0,p.jsx)(d.Flex,{gap:8,wrap:!0,children:E.map(e=>{let t=(0,p.jsx)(d.Button,{type:e.type??`primary`,className:e.className,icon:e.icon,danger:e.danger,disabled:e.disabled||!e.onClick,onClick:e.onClick,children:e.label},e.key);return e.tooltip?(0,p.jsx)(d.Tooltip,{title:e.tooltip,children:t},e.key):t})})]}):null,typeof a.top==`function`?a.top(T):a.top??null,(0,p.jsx)(jF,{active:!0,unscoped:!0,fetchData:typeof a.fetch==`function`?a.fetch:null,keepFetchResponse:a.fetchKeepsRows===!0,recordLinks:a.recordLinks===`navigate`||a.quickView===!1?`navigate`:`inPlace`,openInPlace:a.quickView!==!1,module:o,relation:a.scope??{},title:a.title,showRail:s.showRail,railMode:s.railMode,railWidth:s.filterWidth,quickViewMode:s.quickViewMode,quickViewWidth:s.quickViewWidth,listComponent:a.list,listProps:j,renderQuickView:A,onOpenRecord:D?O:void 0,refreshKey:C,keepPageInUrl:a.keepPageInUrl===!0})]})}function aL({tabs:e=[],parentId:t,title:n=`Overview`,refreshKey:r=0}){let[i,a]=(0,h.useSearchParams)(),{counts:o,loading:s}=OF(e,t,r),c=e=>{let t=new URLSearchParams(i);t.set(`tab`,e),t.delete(`sub`),a(t,{replace:!0})};return(0,p.jsx)(`section`,{className:`rh-overview`,"aria-label":n,children:e.map(e=>{let t=o[e.key];return(0,p.jsxs)(`button`,{type:`button`,className:`rh-overview__card`,onClick:()=>c(e.key),children:[(0,p.jsx)(`span`,{className:`rh-overview__label`,children:e.label}),(0,p.jsx)(`strong`,{className:`rh-overview__value`,children:s&&t===void 0?`…`:t==null?`–`:t.toLocaleString()}),(0,p.jsx)(`span`,{className:`rh-overview__open`,children:`Open`})]},e.key)})})}var oL=(e,t,n)=>`tab:${e}:${t}:${n}`.replace(/[^A-Za-z0-9:_\-.|]/g,`_`).slice(0,160),sL=1500;function cL(e,{pageModule:t,parentId:r,refreshKey:i=0,enabled:a=!1}={}){let o=a?JSON.stringify([t??``,r??``,(e??[]).map(e=>[e.key,e.module,e.relation??null])]):``,[s,c]=(0,u.useState)({});(0,u.useEffect)(()=>{if(!o)return;let[e,t,r]=JSON.parse(o);if(!t||!r.length)return;let i=!1;return new Promise(e=>{setTimeout(e,sL)}).then(()=>i?[]:Promise.allSettled(r.map(async([r,i,a])=>{let o=await mF(a,t,i);if(!o)throw Error(`scope not supported`);let s=typeof a?.scope==`string`?a.scope.trim():``,c={...DF(a?.queryParams)??{},include:`seenCount`,seenKey:oL(e,t,r)},l=await n.$t(i,1,0,{scopeConditions:o,...s?{scope:s}:{},queryParams:c});return Number(l?.data?.newCount??l?.newCount??0)>0}))).then(e=>{if(i)return;let t={};e.forEach((e,n)=>{t[r[n][0]]=e.status===`fulfilled`&&e.value===!0}),c(t)}),()=>{i=!0}},[o,i]);let l=Object.fromEntries((e??[]).map(e=>[e.key,e.module])),d=(0,u.useCallback)(e=>{c(t=>t[e]?{...t,[e]:!1}:t),a&&r&&l[e]&&n.Ot(l[e],{key:oL(t,r,e)})},[a,t,r,l]);return{dots:a?s:{},open:d}}var lL=(0,u.createContext)(null);function uL(){return(0,u.useContext)(lL)}var dL=[];function fL({moduleName:e,id:t,header:n,breadcrumb:r=null,headerActions:i=null,headerEndSlot:a=null,banner:o=null,onClose:s,tabs:l=dL,stats:m=dL,defaultTab:g,maxVisibleTabs:_=12,alwaysShowMore:v=!1,moreEmptyLabel:y=`No more sections`,listComponent:b,listPropsFor:x,renderQuickView:S,onOpenRecord:C,refreshKey:w=0,railMode:T,quickViewMode:E,railWidth:D,quickViewWidth:O,className:k=``,selectedParam:A=``,listCacheMs:j=0,preloadTabs:M=!1,preloadDelayMs:N=1200,tabDots:P=!1}){let[F,I]=(0,h.useSearchParams)(),L=i??a,R=l.map(e=>e.key),z=F.get(`tab`),B=g&&R.includes(g)?g:R[0],V=z&&R.includes(z)?z:B,H=e=>{if(!e||e===V)return;let t=new URLSearchParams(F);t.set(`tab`,e),[...t.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>t.delete(e)),t.delete(`sub`),A&&t.delete(A),I(t,{replace:!0})},U=(0,u.useMemo)(()=>l.filter(e=>e.module&&e.relation),[l]),{counts:W,loading:G}=OF(m,t,w),ee=cL(U,{pageModule:e,parentId:t,refreshKey:w,enabled:P}),te=e=>!!ee.dots[e]&&e!==V;(0,u.useEffect)(()=>{P&&ee.dots[V]&&ee.open(V)},[P,V,ee]);let ne=(e,t)=>te(e)?(0,p.jsxs)(p.Fragment,{children:[t,(0,p.jsx)(`span`,{className:`rh-tabs__dot`,"aria-label":`new updates`})]}):t,re=m.map(e=>({key:e.key,label:e.label,value:W[e.key],active:!!e.tab&&V===e.tab,onClick:e.tab?()=>H(e.tab):void 0})),ie=l.slice(0,_),ae=l.slice(_),oe=ae.some(e=>e.key===V),se=ae.length?ae.map(e=>({key:e.key,label:ne(e.key,e.label)})):[{key:`__none`,label:y,disabled:!0}],ce=(0,u.useMemo)(()=>({listComponent:b,listPropsFor:x,renderQuickView:S,onOpenRecord:C,refreshKey:w,relatedTabs:U,railMode:T,quickViewMode:E,activeTab:V}),[b,x,S,C,w,U,T,E,V]),K=e=>({tabKey:e.key,module:e.module,relation:e.relation,parentId:t,title:e.label,showRail:e.rail!==!1,railMode:e.railMode??T,quickViewMode:e.quickViewMode??E,...e.railWidth??D?{railWidth:e.railWidth??D}:{},...e.quickViewWidth??O?{quickViewWidth:e.quickViewWidth??O}:{},listComponent:e.listComponent??b,listProps:x?.(e.module,e)??e.listProps,renderQuickView:S,onOpenRecord:C,refreshKey:w,cacheMs:e.cacheMs??j,...typeof e.fetch==`function`?{fetchData:e.fetch}:{},...e.recordLinks?{recordLinks:e.recordLinks}:{},...e.access&&typeof e.access==`object`&&e.access.module?{accessModule:String(e.access.module)}:{}}),le=(0,u.useMemo)(()=>M?U.filter(e=>!e.component&&typeof e.render!=`function`&&(e.cacheMs??j)>0):[],[M,U,j]),[ue,de]=(0,u.useState)({id:t,ready:!1,done:[]});ue.id!==t&&de({id:t,ready:!1,done:[]}),(0,u.useEffect)(()=>{if(!le.length)return;let e=null,n=()=>de(e=>e.id===t?{...e,ready:!0}:e),r=setTimeout(()=>{typeof window<`u`&&typeof window.requestIdleCallback==`function`?e=window.requestIdleCallback(n,{timeout:1500}):n()},N);return()=>{clearTimeout(r),e!==null&&typeof window<`u`&&window.cancelIdleCallback?.(e)}},[le.length,N,t]);let fe=(0,u.useCallback)(e=>{de(t=>t.done.includes(e)?t:{...t,done:[...t.done,e]})},[]),pe=ue.ready&&ue.id===t?le.find(e=>e.key!==V&&!ue.done.includes(e.key))??null:null,me=l.find(e=>e.key===V)??null,he=null,q=typeof me?.view==`function`?me.view({id:t,moduleName:e,refreshKey:w,searchParams:F}):null;if(q!=null&&q!==!1)he=q;else if(typeof me?.render==`function`)he=me.render({id:t,moduleName:e,refreshKey:w});else if(me?.component){let n=me.component;he=(0,p.jsx)(n,{id:t,moduleName:e,refreshKey:w})}else me?.type===`overview`?he=(0,p.jsx)(aL,{tabs:U,parentId:t,title:me.label,refreshKey:w}):me?.module&&(he=(0,p.jsx)(jF,{active:!0,...K(me),...A?{selectedParam:A}:{}},me.key));return(0,p.jsx)(lL.Provider,{value:ce,children:(0,p.jsxs)(`div`,{className:`rh-hub ${k}`.trim(),"data-module":e,children:[(r||s)&&(0,p.jsxs)(`div`,{className:`rh-hub__crumbs`,children:[(0,p.jsx)(`div`,{className:`rh-hub__crumbs-trail`,children:r}),s&&(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),onClick:s,"aria-label":`Close`})]}),o,(0,p.jsxs)(`div`,{className:`rh-hub__head`,children:[(0,p.jsx)(`div`,{className:`rh-hub__title`,children:n??(0,p.jsx)(ns,{moduleName:e,id:t,refreshKey:w,hideActions:!0})}),(m.length>0||L)&&(0,p.jsxs)(`div`,{className:`rh-hub__aside`,children:[m.length>0&&(0,p.jsx)(c.i,{items:re,loading:G,ariaLabel:`Summary`,className:`rh-hub__stats`}),L&&(0,p.jsx)(`div`,{className:`rh-hub__actions`,children:L})]})]}),(0,p.jsxs)(`nav`,{className:`rh-tabs`,role:`tablist`,"aria-label":`Sections`,children:[ie.map(e=>(0,p.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===V,className:`rh-tabs__item${e.key===V?` is-active`:``}`,onClick:()=>H(e.key),children:ne(e.key,e.label)},e.key)),(ae.length>0||v)&&(0,p.jsx)(d.Dropdown,{trigger:[`click`],menu:{items:se,onClick:({key:e})=>H(e)},children:(0,p.jsxs)(`button`,{type:`button`,className:`rh-tabs__item rh-tabs__more${oe?` is-active`:``}`,children:[oe?l.find(e=>e.key===V)?.label:`More`,` `,(0,p.jsx)(f.DownOutlined,{})]})})]}),(0,p.jsxs)(`section`,{className:`rh-hub__body`,role:`tabpanel`,"aria-label":me?.label,children:[he,pe&&(0,p.jsx)(jF,{preload:!0,onPreloaded:fe,...K(pe)},`preload:${pe.key}`)]})]})})}var pL=[];function mL({tab:e,moduleName:t,id:n,refreshKey:r,onOpenTab:i=null}){let a=(0,u.useRef)(null),o=JSON.stringify(e.groups??null),[s]=(0,u.useState)(()=>kI(JSON.parse(o))),c=typeof e.decorate==`function`?e.decorate:null;(0,u.useEffect)(()=>{let e=a.current;if(!e||!c)return;let r=!1,i=()=>{if(!r){r=!0;try{c(e,{id:n,moduleName:t})}finally{r=!1}}};i();let o=new MutationObserver(()=>{o.disconnect(),i(),o.observe(e,{childList:!0,subtree:!0})});return o.observe(e,{childList:!0,subtree:!0}),()=>o.disconnect()},[c,n,t]);let l=null;return typeof e.empty==`function`?l=e.empty({id:n,moduleName:t}):typeof e.empty==`string`?l=(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:e.empty}):e.empty&&(l=e.empty),(0,p.jsx)(`div`,{ref:a,className:`rh-details`,"data-tab":e.key,children:(0,p.jsx)(Xi,{moduleName:t,id:n,refreshKey:r,groupFilter:s,emptyContent:l,onOpenTab:i})})}var hL=15e3,gL=4e3;function _L(e){let t={};return[`closeQuickView`,`highlight`,`ownWithinMs`].forEach(n=>{e&&e[n]!==void 0&&(t[n]=e[n])}),t}function vL({config:e,id:t,refreshKey:r=0}){let i=(0,h.useNavigate)(),a=(0,h.useLocation)(),[o,s]=(0,h.useSearchParams)(),c=e=>{e&&s(t=>{let n=new URLSearchParams(t);return n.set(`tab`,e),n.delete(`sub`),n.delete(`qv`),[...n.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>n.delete(e)),n},{replace:!0})},l=e??{},f=l.module,m=SI(l.layout),g=l.strictPermissions===!0?{strict:!0,aliases:l.permissionAliases}:void 0,{canView:_,canAdd:v,canEdit:y,canDelete:b}=n.zt(f,g),x=Vc(),S=l.tabAccess===`view`,C=n.Bt(g),[w,T]=(0,u.useState)(0),[E,D]=(0,u.useState)(null),O=()=>T(e=>e+1),k=hI(l.refreshEvents).filter($).join(`|`);(0,u.useEffect)(()=>{if(!k||typeof window>`u`)return;let e=k.split(`|`),t=()=>T(e=>e+1);return e.forEach(e=>window.addEventListener(e,t)),()=>e.forEach(e=>window.removeEventListener(e,t))},[k]);let A={id:t,module:f,navigate:i,location:a,refresh:O,can:{view:_,add:v,edit:y,delete:b},adminActionsVersion:x},j={record:E},M=l.header?.onHeaderData,N=e=>{D(e??null),M?.(e)},P=xI(l.header?.moreActions,j,A).map(e=>({key:e.key,label:e.label,danger:e.danger,disabled:e.disabled,onClick:e.onClick})),F=xI(l.header?.buttons,j,A),I=F.length?(0,p.jsx)(p.Fragment,{children:F.map(e=>{let t=(0,p.jsx)(d.Button,{type:e.type??`primary`,className:e.className,icon:e.icon,danger:e.danger,disabled:e.disabled||!e.onClick,onClick:e.onClick,children:e.label},e.key);return e.tooltip?(0,p.jsx)(d.Tooltip,{title:e.tooltip,children:t},e.key):t})}):null,L=(S?jI(TI(l.tabs),C):TI(l.tabs)).map(e=>e.type===`details`?{...e,render:t=>(0,p.jsx)(mL,{tab:e,moduleName:t.moduleName,id:t.id,refreshKey:t.refreshKey,onOpenTab:c},e.key)}:Number(e.quickView?.width)>0?{...e,quickViewWidth:Number(e.quickView.width)}:e),R=l.fullView??null,z=l.quickView??null,B=o.get(`tab`),V=L.find(e=>e.key===B)??L.find(e=>e.key===l.defaultTab)??L[0]??null,H=typeof l.follow==`function`?l.follow:null,U=H?`qv`:``,W=U&&o.get(U)||``,G=l.realtime?typeof l.realtime==`object`?l.realtime:{}:null,ee=G?(typeof G.topics==`function`?hI(G.topics({id:t,module:f,tab:V?.key??``,openRecordId:W})):[WF(f,t),V?.module?UF(V.module):``,V?.module&&W?WF(V.module,W):``]).filter($):[],te=fI({topics:ee,enabled:!!G,debounceMs:G?.debounceMs??600}),ne=!!G?.highlight;uI(ee,e=>{let t=e?.id??e?.recordId;if(!t||!e?.module||/deleted/i.test(String(e?.type??``)))return;let r=L.find(t=>t.module&&HF(t.module)===HF(e.module));n.st(r?.module??e.module,t)},{enabled:!!G&&ne});let re=r+w+te.tick,ie=(e,t,n)=>{let r=R?.[e],a=typeof r==`function`?r(t,n??null):null;a&&i(a)},ae=H&&l.followThen&&typeof l.followThen==`object`?l.followThen:null,oe=(e,t)=>({presentation:{title:t.label},actionContext:{tab:t.label??``},...ae?.highlight?{highlightNew:!0}:{},...ne?{highlightUpdates:!0}:{},...l.seenDots===!0?{seenDots:!0}:{},...OI(t.columns??l.columns?.[e])??{},...(typeof t.listProps==`function`?t.listProps({...A,tab:t,tabModule:e}):t.listProps)??{}}),se=({module:e,id:n,record:r,onClose:i,onOpenFull:a})=>{let o=(V?.module===e&&V?.quickView&&typeof V.quickView==`object`?V.quickView:null)??CI(z,e);return o?(0,p.jsx)(rL,{config:o,module:e,id:n,record:r,onClose:i,onOpenFull:typeof R?.[e]==`function`?a:void 0,refreshKey:re,extraCtx:{parentId:t,parentModule:f,parent:E,tab:V?.key,tabLabel:V?.label??``,can:A.can}},`${V?.key??``}:${e}:${n}`):null},ce=ae?.highlight&&$(W)&&$(V?.module)?`${V.module}|${W}`:``;(0,u.useEffect)(()=>{if(!ce)return;let e=ce.indexOf(`|`);n.at(ce.slice(0,e),ce.slice(e+1))},[ce]);let K=`${w}|${te.tick}`,le=(0,u.useRef)(K),ue=(0,u.useRef)(null);(0,u.useEffect)(()=>{ue.current={follow:H,followThen:ae,openRecordId:W,activeTab:V,tabs:L,searchParams:o,setSearchParams:s,ctx:A}});let de=(0,u.useRef)(null),fe=(0,u.useRef)({sig:``,at:0}),pe=(0,u.useRef)(!0);(0,u.useEffect)(()=>(pe.current=!0,()=>{pe.current=!1}),[]);let me=()=>{try{return!!window.history.state?.usr?.background}catch{return!1}};if((0,u.useEffect)(()=>{le.current!==K&&(le.current=K,de.current={at:Date.now(),covered:me()});let e=de.current;if(!e)return;if(Date.now()-e.at>hL){de.current=null;return}if(me()){e.covered=!0;return}let t=ue.current;if(e.covered&&!t.openRecordId||(de.current=null,!t.follow||!t.openRecordId||!t.activeTab?.module))return;let r=t.searchParams.get(`sub`)||t.activeTab.relation?.subTabs?.[0]?.key||``;Promise.resolve(t.follow({module:t.activeTab.module,id:t.openRecordId,tab:t.activeTab.key,sub:r},t.ctx)).then(e=>{if(!pe.current||!e||!$(e.tab))return;let i=t.tabs.find(t=>t.key===e.tab);if(!i)return;let a=$(e.sub)?e.sub:``,o=`${t.openRecordId}|${i.key}|${a}`;if(fe.current.sig===o&&Date.now()-fe.current.at<gL)return;fe.current={sig:o,at:Date.now()};let s=i.relation?.subTabs?.[0]?.key||``;if(i.key===t.activeTab.key&&(a||s)===r)return;let c={...t.followThen??{},..._L(e)},l=!!t.followThen&&n.it(t.openRecordId,Number(c.ownWithinMs)>0?Number(c.ownWithinMs):void 0),u=l&&c.closeQuickView===!0;l&&c.highlight===!0&&n.ot(i.module??t.activeTab.module,$(e.id)?e.id:t.openRecordId),t.setSearchParams(e=>{let n=new URLSearchParams(e);return n.set(`tab`,i.key),a?n.set(`sub`,a):n.delete(`sub`),[...n.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>n.delete(e)),u?n.delete(`qv`):n.set(`qv`,t.openRecordId),n},{replace:!0});let f=a?i.relation?.subTabs?.find(e=>e.key===a)?.label:``;d.message.info({key:`cc-detail-follow-moved`,content:$(e.notice)?e.notice:`Moved to ${i.label}${f?` › ${f}`:``}`})}).catch(()=>{})},[K,a]),!$(f)||!$(t))return null;let he=hI(l.breadcrumb).length?(0,p.jsx)(n.Dt,{items:l.breadcrumb}):null;return(0,p.jsx)(fL,{moduleName:f,id:t,breadcrumb:he,header:(0,p.jsx)(ns,{moduleName:f,id:t,onHeaderData:N,refreshKey:re,actionsInMore:l.header?.actionsInMore!==!1,moreActionsExtra:P.length?P:pL,actionsExtra:I}),tabs:L,stats:S?NI(l.stats??pL,L,C):l.stats??pL,defaultTab:l.defaultTab,maxVisibleTabs:l.maxVisibleTabs??12,alwaysShowMore:l.alwaysShowMore??!0,railMode:m.railMode,quickViewMode:m.quickViewMode,railWidth:m.filterWidth,quickViewWidth:m.quickViewWidth,listPropsFor:oe,renderQuickView:se,onOpenRecord:ie,refreshKey:re,listCacheMs:Number(l.listCacheMs)>0?Number(l.listCacheMs):0,preloadTabs:l.preloadTabs===!0,tabDots:l.tabDots===!0,className:l.className??``,...U?{selectedParam:U}:{}})}function yL(e,t=new Date){let n=new Date(t);n.setHours(0,0,0,0),e===`week`&&n.setDate(n.getDate()-(n.getDay()+6)%7),e===`month`&&n.setDate(1);let r=new Date(t);return r.setHours(23,59,59,999),{key:e||`today`,from:n,to:r,fromIso:n.toISOString(),toIso:r.toISOString()}}var bL=new Intl.NumberFormat,xL=e=>e==null||!Number.isFinite(Number(e))?`–`:bL.format(Number(e));function SL(e,t,n,r=3){return hI(e).filter(e=>e?.attention&&Number.isFinite(t?.[e.key])).map(e=>({kpi:e,n:t[e.key]})).filter(({kpi:e,n:t})=>typeof e.attention.when==`function`?e.attention.when(t):t>0).sort((e,t)=>t.n-e.n).slice(0,r).map(({kpi:e,n:t})=>({key:e.key,n:t,text:typeof e.attention.text==`function`?e.attention.text(t,n):yI(vI(e.attention.text,{},n))||yI(vI(e.label,{},n)),to:typeof e.to==`function`?e.to(n):e.to}))}var CL=e=>String(e).padStart(2,`0`),wL=e=>`${e.getFullYear()}-${CL(e.getMonth()+1)}-${CL(e.getDate())}`;function TL(e,t=new Date){let n={today:14,week:28,month:90}[e]??14,r=new Date(t);r.setHours(0,0,0,0),r.setDate(r.getDate()-(n-1));let i=new Date(t);return i.setHours(23,59,59,999),{key:`last${n}`,days:n,from:r,to:i,fromIso:r.toISOString(),toIso:i.toISOString()}}function EL(e,t,n=e=>e.count){let r=new Map(hI(e).map(e=>[String(e.key),Number(n(e))||0])),i=[],a=new Date(t.from);for(let e=0;e<t.days;e+=1){let e=wL(a);i.push({key:e,value:r.get(e)??0,label:a.toLocaleDateString([],{day:`numeric`,month:`short`}),short:a.toLocaleDateString([],{day:`numeric`,month:`short`})}),a.setDate(a.getDate()+1)}return i}function DL(e,{labels:t,pick:n=e=>e.count,order:r}={}){let i=e=>e===`__other`?`Other`:e===``?`Not set`:typeof t==`function`?t(e)??e:t?.[e]??e,a=hI(e).map(e=>({key:String(e.key),label:String(i(String(e.key))),value:Number(n(e))||0}));if(Array.isArray(r)){let e=e=>{let t=r.indexOf(e);return t<0?r.length:t};a=a.sort((t,n)=>e(t.key)-e(n.key))}return a}function OL(e){let t=hI(e).map(Number).filter(Number.isFinite);if(t.length<2)return null;let n=Math.floor(t.length/2),r=t.slice(0,n).reduce((e,t)=>e+t,0),i=t.slice(t.length-n).reduce((e,t)=>e+t,0);return r===0?i===0?0:null:Math.round((i-r)/r*100)}var kL=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}),AL=e=>e==null||!Number.isFinite(Number(e))?`–`:kL.format(Number(e)),jL=[`#4f6bed`,`#13a8a8`,`#f59f00`,`#e8590c`,`#7048e8`,`#2b8a3e`,`#d6336c`,`#868e96`],ML=e=>`var(--cc-dash-c${e%8+1}, ${jL[e%8]})`,NL=e=>e.reduce((e,t)=>e+(Number(t.value)||0),0);function PL({items:e,onSelect:t,format:n=xL,centerLabel:r=`Total`}){let[i,a]=(0,u.useState)(-1),o=NL(e),s=2*Math.PI*52,c=0,l=i>=0?e[i]:null;return(0,p.jsxs)(`div`,{className:`cc-chart cc-chart--donut`,style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:20},children:[(0,p.jsxs)(`svg`,{viewBox:`0 0 140 140`,width:`148`,height:`148`,role:`img`,"aria-label":e.map(e=>`${e.label} ${n(e.value)}`).join(`, `),style:{flex:`none`},children:[(0,p.jsx)(`circle`,{cx:`70`,cy:`70`,r:52,fill:`none`,stroke:`var(--cc-dash-track, #eef1f5)`,strokeWidth:`18`}),o>0&&e.map((e,r)=>{let l=Math.max(Number(e.value)||0,0)/o*s,u=(0,p.jsx)(`circle`,{cx:`70`,cy:`70`,r:52,fill:`none`,stroke:ML(r),strokeWidth:i===r?22:18,strokeDasharray:`${Math.max(l-1.5,0)} ${s}`,strokeDashoffset:-c,transform:`rotate(-90 70 70)`,style:{cursor:t?`pointer`:`default`,transition:`stroke-width 150ms ease`},onMouseEnter:()=>a(r),onMouseLeave:()=>a(-1),onClick:()=>t?.(e),children:(0,p.jsx)(`title`,{children:`${e.label}: ${n(e.value)}`})},e.key);return c+=l,u}),(0,p.jsx)(`text`,{x:`70`,y:`68`,textAnchor:`middle`,className:`cc-chart__center-value`,style:{fontSize:20,fontWeight:700,fill:`currentColor`},children:n(l?l.value:o)}),(0,p.jsx)(`text`,{x:`70`,y:`86`,textAnchor:`middle`,className:`cc-chart__center-label`,style:{fontSize:10,fill:`currentColor`,opacity:.65},children:(l?l.label:r).slice(0,18)})]}),(0,p.jsx)(`ul`,{className:`cc-chart__legend`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:6,flex:`1 1 160px`,minWidth:0},children:e.map((e,r)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-chart__legend-item`,disabled:!t,onClick:()=>t?.(e),onMouseEnter:()=>a(r),onMouseLeave:()=>a(-1),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`2px 0`,font:`inherit`,background:`none`,border:0,textAlign:`start`,cursor:t?`pointer`:`default`,color:`inherit`},children:[(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{width:10,height:10,borderRadius:3,background:ML(r),flex:`none`}}),(0,p.jsx)(`span`,{className:`cc-chart__legend-label`,style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.label}),(0,p.jsx)(`span`,{className:`cc-chart__legend-value`,style:{fontVariantNumeric:`tabular-nums`,fontWeight:600},children:n(e.value)}),(0,p.jsx)(`span`,{className:`cc-chart__legend-share`,style:{width:40,textAlign:`end`,opacity:.6,fontVariantNumeric:`tabular-nums`},children:o>0?`${Math.round(e.value/o*100)}%`:``})]})},e.key))})]})}function FL({items:e,onSelect:t,format:n=xL}){let r=Math.max(1,...e.map(e=>Number(e.value)||0));return(0,p.jsx)(`ul`,{className:`cc-chart cc-chart--bar`,role:`list`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:10},children:e.map((e,i)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-chart__bar-row`,disabled:!t,onClick:()=>t?.(e),"aria-label":`${e.label}: ${n(e.value)}`,style:{display:`grid`,gridTemplateColumns:`minmax(80px, 34%) 1fr auto`,alignItems:`center`,gap:10,width:`100%`,padding:0,font:`inherit`,background:`none`,border:0,textAlign:`start`,cursor:t?`pointer`:`default`,color:`inherit`},children:[(0,p.jsx)(`span`,{className:`cc-chart__bar-label`,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.label}),(0,p.jsx)(`span`,{className:`cc-chart__bar-track`,style:{height:10,borderRadius:5,background:`var(--cc-dash-track, #eef1f5)`,overflow:`hidden`},children:(0,p.jsx)(`span`,{className:`cc-chart__bar-fill`,style:{display:`block`,height:`100%`,width:`${(Number(e.value)||0)/r*100}%`,minWidth:e.value>0?4:0,borderRadius:5,background:ML(i),transition:`width 400ms ease`}})}),(0,p.jsx)(`span`,{className:`cc-chart__bar-value`,style:{fontVariantNumeric:`tabular-nums`,fontWeight:600},children:n(e.value)})]})},e.key))})}var IL=e=>e.map(([e,t],n)=>`${n?`L`:`M`}${e.toFixed(1)},${t.toFixed(1)}`).join(` `);function LL({items:e,height:t=180,format:n=xL,color:r=ML(0)}){let[i,a]=(0,u.useState)(-1),o=(0,u.useRef)(null),[s,c]=(0,u.useState)(600);(0,u.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{let t=Math.round(e.contentRect.width);t>0&&c(t)});return t.observe(e),()=>t.disconnect()},[]);let l=t,d={l:36,r:8,t:12,b:22},f=Math.max(1,...e.map(e=>Number(e.value)||0)),m=f<=4?f:Math.ceil(f/4)*4,h=t=>d.l+(e.length>1?t/(e.length-1)*(s-d.l-d.r):(s-d.l-d.r)/2),g=e=>d.t+(1-(Number(e)||0)/m)*(l-d.t-d.b),_=e.map((e,t)=>[h(t),g(e.value)]),v=_.length?`${IL(_)} L${h(e.length-1)},${l-d.b} L${h(0)},${l-d.b} Z`:``,y=[0,.5,1].map(e=>Math.round(m*e)),b=Math.max(1,Math.ceil(e.length/Math.max(2,Math.floor(s/80)))),x=NL(e),S=i>=0?e[i]:null,C=`cc-area-${String(e[0]?.key??`x`).replace(/[^\w-]/g,``)}-${e.length}`;return(0,p.jsxs)(`div`,{ref:o,className:`cc-chart cc-chart--area`,style:{position:`relative`},children:[(0,p.jsxs)(`svg`,{viewBox:`0 0 ${s} ${l}`,width:`100%`,height:l,role:`img`,"aria-label":`Trend, ${e.length} points, total ${n(x)}, peak ${n(f)}`,onMouseLeave:()=>a(-1),onMouseMove:t=>{let n=t.currentTarget.getBoundingClientRect(),r=(t.clientX-n.left)/n.width*s,i=Math.round((r-d.l)/(s-d.l-d.r)*(e.length-1));a(Math.min(e.length-1,Math.max(0,i)))},children:[(0,p.jsx)(`defs`,{children:(0,p.jsxs)(`linearGradient`,{id:C,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,p.jsx)(`stop`,{offset:`0%`,stopColor:r,stopOpacity:`0.28`}),(0,p.jsx)(`stop`,{offset:`100%`,stopColor:r,stopOpacity:`0.02`})]})}),y.map(e=>(0,p.jsxs)(`g`,{children:[(0,p.jsx)(`line`,{x1:d.l,x2:s-d.r,y1:g(e),y2:g(e),stroke:`var(--cc-dash-grid, #e9edf2)`,strokeDasharray:e?`3 4`:``,vectorEffect:`non-scaling-stroke`}),(0,p.jsx)(`text`,{x:d.l-6,y:g(e)+3,textAnchor:`end`,style:{fontSize:10,fill:`currentColor`,opacity:.55},children:n(e)})]},e)),v?(0,p.jsx)(`path`,{d:v,fill:`url(#${C})`}):null,_.length?(0,p.jsx)(`path`,{d:IL(_),fill:`none`,stroke:r,strokeWidth:`2.25`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`}):null,e.map((t,n)=>(n%b===0&&e.length-1-n>=b/2||n===e.length-1)&&(0,p.jsx)(`text`,{x:h(n),y:l-6,textAnchor:n===0?`start`:n===e.length-1?`end`:`middle`,style:{fontSize:10,fill:`currentColor`,opacity:.55},children:t.short??t.label},t.key)),S?(0,p.jsxs)(`g`,{children:[(0,p.jsx)(`line`,{x1:h(i),x2:h(i),y1:d.t,y2:l-d.b,stroke:r,strokeOpacity:`0.35`,vectorEffect:`non-scaling-stroke`}),(0,p.jsx)(`circle`,{cx:h(i),cy:g(S.value),r:`4`,fill:`var(--cc-dash-surface, #fff)`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`})]}):null]}),S?(0,p.jsxs)(`div`,{className:`cc-chart__tip`,role:`status`,style:{position:`absolute`,top:0,left:`${h(i)/s*100}%`,transform:`translateX(${i>e.length/2?`-105%`:`5%`})`,pointerEvents:`none`,padding:`4px 8px`,borderRadius:6,fontSize:12,whiteSpace:`nowrap`,background:`var(--cc-dash-tip, rgba(23,32,44,.92))`,color:`#fff`},children:[S.label,`: `,(0,p.jsx)(`strong`,{children:n(S.value)})]}):null]})}function RL({items:e,height:t=180,format:n=xL,onSelect:r}){let i=Math.max(1,...e.map(e=>Number(e.value)||0));return(0,p.jsx)(`div`,{className:`cc-chart cc-chart--column`,role:`list`,style:{display:`flex`,alignItems:`flex-end`,gap:8,height:t,paddingTop:18},children:e.map((e,t)=>(0,p.jsxs)(`button`,{type:`button`,role:`listitem`,disabled:!r,onClick:()=>r?.(e),"aria-label":`${e.label}: ${n(e.value)}`,style:{flex:1,minWidth:0,height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`flex-end`,alignItems:`center`,gap:4,padding:0,font:`inherit`,background:`none`,border:0,cursor:r?`pointer`:`default`,color:`inherit`},children:[(0,p.jsx)(`span`,{className:`cc-chart__col-value`,style:{fontSize:12,fontWeight:600,fontVariantNumeric:`tabular-nums`},children:n(e.value)}),(0,p.jsx)(`span`,{className:`cc-chart__col`,style:{width:`70%`,maxWidth:44,height:`${(Number(e.value)||0)/i*100}%`,minHeight:e.value>0?3:1,borderRadius:`6px 6px 2px 2px`,background:ML(t),transition:`height 400ms ease`}}),(0,p.jsx)(`span`,{className:`cc-chart__col-label`,style:{fontSize:11,opacity:.7,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.label})]},e.key))})}function zL({items:e,onSelect:t,format:n=xL}){let r=Math.max(1,...e.map(e=>Number(e.value)||0));return(0,p.jsx)(`ol`,{className:`cc-chart cc-chart--funnel`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:14},children:e.map((i,a)=>{let o=Number(i.value),s=a>0?Number(e[a-1].value):null,c=s>0&&Number.isFinite(o)?Math.round(o/s*100):null,l=c!==null&&c<=100?c:null,u=Number.isFinite(o)&&o>0?Math.max(2,o/r*100):0;return(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-chart__funnel-row`,disabled:!t,onClick:()=>t?.(i),"aria-label":`${i.label}: ${n(i.value)}${l===null?``:`, ${l}% of ${e[a-1].label}`}`,style:{display:`grid`,gap:6,width:`100%`,padding:0,font:`inherit`,textAlign:`start`,background:`none`,border:0,cursor:t?`pointer`:`default`,color:`inherit`},children:[(0,p.jsxs)(`span`,{className:`cc-chart__funnel-head`,style:{display:`flex`,alignItems:`baseline`,gap:8,minWidth:0},children:[(0,p.jsx)(`span`,{className:`cc-chart__funnel-dot`,"aria-hidden":`true`,style:{flex:`none`,width:8,height:8,borderRadius:`50%`,background:ML(a),alignSelf:`center`}}),(0,p.jsx)(`span`,{className:`cc-chart__funnel-label`,style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontWeight:500},children:i.label}),l===null?null:(0,p.jsxs)(`span`,{className:`cc-chart__funnel-conv`,style:{fontSize:12,opacity:.65,whiteSpace:`nowrap`,fontVariantNumeric:`tabular-nums`},children:[l,`% of `,e[a-1].label]}),(0,p.jsx)(`strong`,{className:`cc-chart__funnel-value`,style:{fontVariantNumeric:`tabular-nums`,minWidth:48,textAlign:`end`},children:n(i.value)})]}),(0,p.jsx)(`span`,{className:`cc-chart__funnel-track`,"aria-hidden":`true`,style:{display:`block`,height:10,borderRadius:999,background:`rgba(127,127,127,0.14)`,overflow:`hidden`},children:(0,p.jsx)(`span`,{className:`cc-chart__funnel-bar`,style:{display:`block`,width:`${u}%`,height:`100%`,borderRadius:999,background:ML(a),transition:`width 400ms cubic-bezier(0.2, 0, 0, 1)`}})})]})},i.key)})})}function BL({values:e,color:t=ML(0),width:n=72,height:r=26}){if(!e?.length)return null;let i=Math.max(1,...e),a=e.map((t,a)=>[e.length>1?a/(e.length-1)*n:n/2,r-2-t/i*(r-4)]);return(0,p.jsxs)(`svg`,{className:`cc-chart cc-chart--spark`,width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":`true`,style:{display:`block`,overflow:`visible`},children:[(0,p.jsx)(`path`,{d:`${IL(a)} L${n},${r} L0,${r} Z`,fill:t,fillOpacity:`0.12`}),(0,p.jsx)(`path`,{d:IL(a),fill:`none`,stroke:t,strokeWidth:`1.75`,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var VL=[{key:`today`,label:`Today`},{key:`week`,label:`Week`,title:`This week (from Monday)`},{key:`month`,label:`Month`,title:`This month`}],HL={today:`Today`,week:`This week`,month:`This month`},UL=(e,t)=>(typeof e==`function`?e(t):e)??{},WL=(e,t,n)=>typeof e==`function`?e(n??t,t):e,GL=(()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||``}catch{return``}})();function KL(e,t){let r=e?JSON.stringify([e,t]):``,[i,a]=(0,u.useState)({signature:``,groups:null,error:``}),[o,s]=(0,u.useState)(0);return(0,u.useEffect)(()=>{if(!e)return;let t=!0,{module:i,relation:o={},groupBy:s,groupDate:c,sum:l}=e,u=typeof o.scope==`string`?o.scope:``;return n.$t(i,1,0,{scopeConditions:oF(o),...u?{scope:u}:{},queryParams:{...o.queryParams??{},groupBy:s,groupDate:c||``,groupTz:c?GL:``,groupSum:l||``}}).then(e=>{if(!t)return;let n=e?.data?.groups??e?.groups;a({signature:r,groups:n?.applied?hI(n.items):null,error:n?``:`unsupported`})}).catch(e=>{t&&a({signature:r,groups:null,error:e?.status===403?`forbidden`:`error`})}),()=>{t=!1}},[r,o]),{...i,loading:!!e&&i.signature!==r,retry:()=>s(e=>e+1)}}var qL=e=>typeof e==`function`?e:e===`compact`?AL:xL;function JL({panel:e,counts:t,kpis:n,loading:r,ctx:i,refreshKey:a}){let o=Array.isArray(e.stages),s=e.chart===`area`,c=TL(i.range.key),l=s?{...i,range:c}:i,u=o||!$(e.module)||!$(e.groupBy)?null:{module:e.module,relation:UL(e.relation,l),groupBy:e.groupBy,groupDate:s?`day`:e.groupDate,sum:e.sum,range:l.range.key},f=KL(u,a),m=qL(e.format),h=e.sum?e=>e.sum:e=>e.count,g=typeof e.to==`function`?t=>i.navigate(e.to(t,i)):$(e.to)?()=>i.navigate(e.to):void 0;if(o){if(r)return(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:3}});let a=hI(e.stages).map(e=>{let r=n.find(t=>t.key===e.kpi);return r?{key:e.kpi,label:yI(vI(e.label??r.label,{},i)),value:t[e.kpi],to:WL(r.to,i)}:null}).filter(Boolean),o=e=>i.navigate(e.to);return e.chart===`donut`?(0,p.jsx)(PL,{items:a,format:m,onSelect:o}):e.chart===`column`?(0,p.jsx)(RL,{items:a,format:m,onSelect:o}):e.chart===`bar`?(0,p.jsx)(FL,{items:a,format:m,onSelect:o}):(0,p.jsx)(zL,{items:a,format:m,onSelect:o})}if(!u)return(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,message:`This chart needs a module and a groupBy field.`});if(f.loading)return(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:4}});if(f.error===`forbidden`)return(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:`You don't have access to this data.`});if(f.error===`error`)return(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`This chart could not be loaded.`,action:(0,p.jsx)(d.Button,{size:`small`,onClick:f.retry,children:`Retry`})});if(!f.groups)return(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:f.error===`unsupported`?`Chart data is not available from the server yet.`:`This field cannot be charted for your list.`});if(s){let e=EL(f.groups,c,h),t=e.reduce((e,t)=>e+t.value,0);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`cc-dash-chart__summary`,style:{display:`flex`,alignItems:`baseline`,gap:8,marginBottom:8},children:[(0,p.jsx)(`span`,{className:`cc-dash-chart__total`,style:{fontSize:22,fontWeight:700},children:m(t)}),(0,p.jsxs)(`span`,{className:`cc-dash-chart__window`,style:{opacity:.65},children:[`in the last `,c.days,` days`]})]}),(0,p.jsx)(LL,{items:e,format:m})]})}let _=DL(f.groups,{labels:e.labels,pick:h,order:e.order});return!_.length||_.every(e=>!e.value)?(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:yI(vI(e.empty,{},i))||`No data for this period.`}):e.chart===`donut`?(0,p.jsx)(PL,{items:_,format:m,onSelect:g}):e.chart===`column`?(0,p.jsx)(RL,{items:_,format:m,onSelect:g}):(0,p.jsx)(FL,{items:_.slice(0,Number(e.max)||8),format:m,onSelect:g})}function YL({kpi:e,ctx:t,refreshKey:n}){let r=TL(`week`),i={...t,range:r},a=KL({module:e.module,relation:UL(e.relation,i),groupBy:e.trend.field||`createdAt`,groupDate:`day`,range:`trend`},n);if(a.loading||!a.groups)return null;let o=EL(a.groups,r).map(e=>e.value),s=OL(o),c=s>0,l=s===null||s===0?`flat`:(e.trend.goodWhen===`down`?!c:c)?`good`:`bad`;return(0,p.jsxs)(`span`,{className:`cc-dash-kpi__trend`,style:{display:`flex`,flexWrap:`wrap`,alignItems:`flex-end`,justifyContent:`space-between`,gap:4,width:`100%`,minWidth:0},children:[(0,p.jsxs)(`span`,{className:`cc-dash-kpi__delta is-${l}`,style:{fontSize:12,fontWeight:600,whiteSpace:`nowrap`},children:[s===null?`New`:(0,p.jsxs)(p.Fragment,{children:[c?(0,p.jsx)(f.ArrowUpOutlined,{}):s<0?(0,p.jsx)(f.ArrowDownOutlined,{}):null,` `,Math.abs(s),`%`]}),(0,p.jsx)(`span`,{className:`cc-dash-kpi__delta-note`,style:{fontWeight:400,opacity:.65},children:` vs prior 2 wks`})]}),(0,p.jsx)(BL,{values:o})]})}function XL(){return(0,p.jsxs)(`svg`,{className:`cc-dash-hero__art`,viewBox:`0 0 320 160`,"aria-hidden":`true`,focusable:`false`,style:{position:`absolute`,right:0,bottom:0,width:320,height:160,pointerEvents:`none`},children:[(0,p.jsx)(`circle`,{cx:`270`,cy:`30`,r:`90`,fill:`currentColor`,opacity:`0.06`}),(0,p.jsx)(`circle`,{cx:`300`,cy:`150`,r:`60`,fill:`currentColor`,opacity:`0.06`}),[[150,100],[180,76],[210,88],[240,52],[270,64],[300,30]].map(([e,t])=>(0,p.jsx)(`rect`,{x:e,y:t,width:`18`,height:160-t,rx:`5`,fill:`currentColor`,opacity:`0.1`},e)),(0,p.jsx)(`path`,{d:`M140 108 L189 80 L219 92 L249 56 L279 68 L309 34`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:`0.35`}),(0,p.jsx)(`circle`,{cx:`309`,cy:`34`,r:`5`,fill:`currentColor`,opacity:`0.5`})]})}function ZL(e,t,n){let r=e.filter(e=>typeof e.count==`function`),i=JSON.stringify([r.map(e=>e.key),t.range.key,n]),[a,o]=(0,u.useState)({signature:``,counts:{}});return(0,u.useEffect)(()=>{if(!r.length)return;let e=!0;return Promise.allSettled(r.map(e=>e.count(t))).then(t=>{if(!e)return;let n={};t.forEach((e,t)=>{let i=e.status===`fulfilled`?Number(e.value):NaN;n[r[t].key]=Number.isFinite(i)?i:null}),o({signature:i,counts:n})}),()=>{e=!1}},[i]),{counts:a.counts,loading:r.length>0&&a.signature!==i}}function QL({kpi:e,value:t,loading:n,ctx:r,refreshKey:i}){let a=yI(vI(e.label,{},r)),o=yI(vI(e.help,{},r)),s=WL(e.to,r),c=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{className:`cc-dash-kpi__label`,children:[a,o?(0,p.jsx)(d.Tooltip,{title:o,children:(0,p.jsx)(f.InfoCircleOutlined,{className:`cc-dash-kpi__help`,"aria-label":`About ${a}`,onClick:e=>e.stopPropagation()})}):null]}),n?(0,p.jsx)(d.Skeleton.Button,{active:!0,size:`small`,style:{width:56}}):(0,p.jsx)(`span`,{className:`cc-dash-kpi__value`,children:xL(t)}),r.rangeLabel?(0,p.jsx)(`span`,{className:`cc-dash-kpi__period`,style:{fontSize:12,opacity:.65},children:(e.period?e.period===`range`:typeof e.relation==`function`)?r.rangeLabel:`Right now`}):null,e.trend&&$(e.module)?(0,p.jsx)(YL,{kpi:e,ctx:r,refreshKey:i}):null]}),l={display:`flex`,flexDirection:`column`,gap:8,alignItems:`flex-start`,textAlign:`start`,minWidth:0,width:`100%`};return $(s)?(0,p.jsx)(`button`,{type:`button`,className:`cc-dash-kpi is-link`,style:{...l,cursor:`pointer`,font:`inherit`,background:`none`,border:0,padding:0},onClick:()=>r.navigate(s),"aria-label":`${a}: ${xL(t)}. Open the list`,children:c}):(0,p.jsx)(`div`,{className:`cc-dash-kpi`,style:l,children:c})}function $L({panel:e,counts:t,kpis:n,loading:r,ctx:i}){let a=hI(e.stages).map(e=>({...e,kpiDef:n.find(t=>t.key===e.kpi)})).filter(e=>e.kpiDef),o=a.map(e=>t[e.kpi]).filter(e=>Number.isFinite(e)).reduce((e,t)=>e+t,0);return r?(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:2}}):(0,p.jsxs)(`div`,{className:`cc-dash-stages`,children:[(0,p.jsx)(`div`,{className:`cc-dash-stages__bar`,role:`img`,"aria-label":a.map(e=>`${yI(vI(e.label??e.kpiDef.label,{},i))} ${xL(t[e.kpi])}`).join(`, `),style:{display:`flex`,height:10,borderRadius:5,overflow:`hidden`,gap:2},children:a.map((e,n)=>{let r=t[e.kpi];return(0,p.jsx)(`span`,{className:`cc-dash-stages__seg`,"data-i":n,style:{flex:o>0&&Number.isFinite(r)?Math.max(r,0):1,minWidth:Number.isFinite(r)&&r>0?6:2}},e.kpi)})}),(0,p.jsx)(`ol`,{className:`cc-dash-stages__list`,style:{listStyle:`none`,margin:`16px 0 0`,padding:0,display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(120px, 1fr))`,gap:12},children:a.map((e,n)=>{let r=yI(vI(e.label??e.kpiDef.label,{},i)),a=WL(e.kpiDef.to,i);return(0,p.jsx)(`li`,{className:`cc-dash-stages__item`,"data-i":n,children:(0,p.jsxs)(d.Button,{type:`text`,className:`cc-dash-stages__btn`,disabled:!$(a),onClick:()=>i.navigate(a),style:{height:`auto`,padding:4,display:`flex`,flexDirection:`column`,alignItems:`flex-start`},children:[(0,p.jsx)(`span`,{className:`cc-dash-stages__value`,children:xL(t[e.kpi])}),(0,p.jsx)(`span`,{className:`cc-dash-stages__label`,children:r})]})},e.kpi)})})]})}function eR({panel:e,ctx:t,refreshKey:r}){let i=UL(e.relation,t),a=JSON.stringify([e.module,i,e.limit,t.range.key,r]),[o,s]=(0,u.useState)({signature:``,rows:[],total:0,error:``}),[c,l]=(0,u.useState)(0);if((0,u.useEffect)(()=>{let t=!0,r=typeof i.scope==`string`?i.scope:``;return n.$t(e.module,Number(e.limit)||5,0,{scopeConditions:oF(i),...r?{scope:r}:{},...i.queryParams?{queryParams:i.queryParams}:{},...i.sort?{sort:i.sort,sortDir:i.sortDir||`desc`}:{}}).then(r=>{if(!t)return;let i=n.kt(r,e.module);s({signature:a,rows:hI(i?.rows),total:Number(i?.total)||0,error:``})}).catch(e=>{t&&s({signature:a,rows:[],total:0,error:e?.status===403?`forbidden`:e?.message||`error`})}),()=>{t=!1}},[a,c]),o.signature!==a)return(0,p.jsx)(d.Skeleton,{active:!0,title:!1,paragraph:{rows:4}});if(o.error===`forbidden`)return(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:`You don't have access to this list.`});if(o.error)return(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`This list could not be loaded.`,action:(0,p.jsx)(d.Button,{size:`small`,onClick:()=>l(e=>e+1),children:`Retry`})});if(!o.rows.length)return(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:yI(vI(e.empty,{},t))||`Nothing here right now.`});let m=WL(e.viewAll,t);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`ul`,{className:`cc-dash-list`,style:{listStyle:`none`,margin:0,padding:0},children:o.rows.map((n,r)=>{let i=yI(_I(e.row?.title,n,t))||`—`,a=yI(_I(e.row?.meta,n,t)),o=yI(_I(e.row?.status,n,t)),s=WL(e.to,t,n);return(0,p.jsx)(`li`,{className:`cc-dash-list__row`,children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-dash-list__btn`,disabled:!$(s),onClick:()=>t.navigate(s),style:{display:`flex`,width:`100%`,alignItems:`center`,justifyContent:`space-between`,gap:12,minHeight:44,padding:`8px 0`,font:`inherit`,textAlign:`start`,background:`none`,border:0,cursor:$(s)?`pointer`:`default`},children:[(0,p.jsxs)(`span`,{style:{minWidth:0,display:`flex`,flexDirection:`column`},children:[(0,p.jsx)(`span`,{className:`cc-dash-list__title`,children:i}),a?(0,p.jsx)(`span`,{className:`cc-dash-list__meta`,children:a}):null]}),o?(0,p.jsx)(d.Tag,{className:`cc-dash-list__status`,style:{marginInlineEnd:0},children:o}):null]})},n?._id??n?.id??r)})}),$(m)?(0,p.jsxs)(d.Button,{type:`link`,className:`cc-dash-viewall`,onClick:()=>t.navigate(m),style:{paddingInline:0},children:[`View all `,o.total>o.rows.length?`(${xL(o.total)})`:``,` `,(0,p.jsx)(f.ArrowRightOutlined,{})]}):null]})}function tR({panel:e,ctx:t}){let n=hI(e.items).filter(e=>e&&$(e.key)&&bI(e,{},t));return(0,p.jsx)(`div`,{className:`cc-dash-links`,style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(140px, 1fr))`,gap:8},children:n.map(e=>{let n=mI(e.icon),r=WL(e.to,t);return(0,p.jsx)(d.Button,{className:`cc-dash-link`,onClick:()=>t.navigate(r),disabled:!$(r),style:{height:`auto`,minHeight:44,justifyContent:`flex-start`,whiteSpace:`normal`,textAlign:`start`},icon:n,children:(0,p.jsxs)(`span`,{children:[yI(vI(e.label,{},t)),e.note?(0,p.jsx)(`small`,{className:`cc-dash-link__note`,style:{display:`block`},children:yI(vI(e.note,{},t))}):null]})},e.key)})})}function nR({panel:e,...t}){let n=yI(vI(e.title,{},t.ctx)),r;switch(e.type){case`stages`:r=(0,p.jsx)($L,{panel:e,...t});break;case`list`:r=(0,p.jsx)(eR,{panel:e,ctx:t.ctx,refreshKey:t.refreshKey});break;case`links`:r=(0,p.jsx)(tR,{panel:e,ctx:t.ctx});break;case`chart`:r=(0,p.jsx)(JL,{panel:e,...t});break;case`custom`:r=typeof e.render==`function`?e.render(t.ctx):null;break;default:r=(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,message:`Unknown panel type "${String(e.type)}"`})}return(0,p.jsxs)(`section`,{className:`cc-dash-panel${e.span===2?` is-wide`:``}`,"data-panel":e.key,"data-chart":e.chart,"aria-label":n||void 0,style:{minWidth:0},children:[n?(0,p.jsx)(d.Typography.Title,{level:5,className:`cc-dash-panel__title`,style:{marginTop:0},children:n}):null,r]})}function rR({config:e,refreshKey:t=0}){let n=(0,h.useNavigate)(),r=(0,h.useLocation)();Vc();let i=hI(e?.ranges).length?hI(e.ranges):VL,[a,o]=(0,u.useState)(e?.defaultRange||i[0].key),[s,c]=(0,u.useState)(0),[l,m]=(0,u.useState)(()=>new Date),g=`${t}|${s}`,_={...e?.context??{},navigate:e=>$(e)&&n(e),location:r,range:yL(a),rangeLabel:i.length>1?HL[a]??yI(vI(i.find(e=>e.key===a)?.label,{},{})):``,refresh:()=>{c(e=>e+1),m(new Date)}},v=hI(e?.kpis).filter(e=>e&&$(e.key)&&bI(e,{},_)),y=OF(v.filter(e=>typeof e.count!=`function`&&$(e.module)).map(e=>({key:e.key,module:e.module,relation:UL(e.relation,_),unscoped:!0})),``,g,{cacheMs:3e4}),b=ZL(v,_,g),x={...y.counts,...b.counts},S=y.loading||b.loading,C=S?[]:SL(v,x,_),w=hI(e?.panels).filter(e=>e&&$(e.key)&&bI(e,{},_)),T=w.filter(e=>e.area===`grid`),E=w.filter(e=>e.area!==`side`&&e.area!==`grid`),D=w.filter(e=>e.area===`side`),O=xI(e?.buttons,{},_),k=yI(vI(e?.title,{},_))||`Dashboard`,A=yI(vI(e?.greeting,{},_)),j=yI(vI(e?.subtitle,{},_)),M={counts:x,kpis:v,loading:S,ctx:_,refreshKey:g},N=yI(vI(e?.user?.name,{},_)).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``),P=yI(vI(e?.user?.role,{},_)),F=new Date().toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),I=hI(e?.links).filter(e=>e&&$(e.key)&&bI(e,{},_));return(0,p.jsxs)(`div`,{className:`cc-dash`,"data-profile":e?.key,children:[(0,p.jsxs)(`header`,{className:`cc-dash-hero`,style:{position:`relative`,overflow:`hidden`,display:`grid`,gap:16},children:[(0,p.jsx)(XL,{}),(0,p.jsxs)(`div`,{className:`cc-dash-hero__top`,style:{position:`relative`,display:`flex`,flexWrap:`wrap`,alignItems:`flex-start`,justifyContent:`space-between`,gap:16},children:[(0,p.jsxs)(`div`,{className:`cc-dash-hero__who`,style:{display:`flex`,alignItems:`center`,gap:16,minWidth:0,flex:`1 1 320px`},children:[N?(0,p.jsx)(`span`,{className:`cc-dash-hero__avatar`,"aria-hidden":`true`,style:{flex:`none`,display:`grid`,placeItems:`center`,width:56,height:56,borderRadius:`50%`,fontWeight:700,fontSize:20},children:N}):null,(0,p.jsxs)(`div`,{style:{minWidth:0},children:[(0,p.jsx)(`div`,{className:`cc-dash-hero__eyebrow`,children:[F,P].filter(Boolean).join(` · `)}),(0,p.jsx)(d.Typography.Title,{level:2,className:`cc-dash-hero__title`,style:{margin:0},children:A||k}),j?(0,p.jsx)(`div`,{className:`cc-dash-hero__sub`,children:j}):null]})]}),(0,p.jsxs)(`div`,{className:`cc-dash-hero__tools`,style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[i.length>1?(0,p.jsx)(d.Segmented,{className:`cc-dash-range`,value:a,onChange:e=>{o(e),m(new Date)},options:i.map(e=>({value:e.key,label:e.label,title:e.title??e.label}))}):null,(0,p.jsx)(d.Tooltip,{title:`Refresh the numbers`,children:(0,p.jsx)(d.Button,{className:`cc-dash-refresh`,icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:_.refresh,"aria-label":`Refresh`})}),O.map(e=>(0,p.jsx)(d.Button,{type:e.type,className:e.className,danger:e.danger,disabled:e.disabled,icon:e.icon,onClick:e.onClick,children:e.label},e.key))]})]}),(0,p.jsxs)(`div`,{className:`cc-dash-hero__bottom`,style:{position:`relative`,display:`flex`,flexWrap:`wrap`,alignItems:`center`,justifyContent:`space-between`,gap:12},children:[(0,p.jsxs)(`div`,{className:`cc-dash-hero__chips`,style:{display:`flex`,flexWrap:`wrap`,gap:8},"aria-live":`polite`,children:[v.some(e=>e.attention)&&!S?(0,p.jsxs)(`span`,{className:`cc-dash-hero__chip ${C.length?`is-warn`:`is-ok`}`,children:[C.length?(0,p.jsx)(f.WarningOutlined,{"aria-hidden":`true`}):(0,p.jsx)(f.CheckCircleOutlined,{"aria-hidden":`true`}),C.length?` ${C.length} ${C.length===1?`thing needs`:`things need`} your attention`:` All caught up`]}):null,(0,p.jsxs)(`span`,{className:`cc-dash-hero__chip`,title:`When these numbers were last loaded. Press refresh to load them again.`,children:[(0,p.jsx)(f.ClockCircleOutlined,{"aria-hidden":`true`}),` Updated `,l.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]})]}),I.length?(0,p.jsx)(`nav`,{className:`cc-dash-hero__links`,"aria-label":`Quick links`,style:{display:`flex`,flexWrap:`wrap`,gap:8},children:I.map(e=>(0,p.jsx)(d.Button,{className:`cc-dash-hero__link`,icon:mI(e.icon),onClick:()=>_.navigate(WL(e.to,_)),children:yI(vI(e.label,{},_))},e.key))}):null]})]}),v.some(e=>e.attention)&&(S||C.length>0)?(0,p.jsx)(`section`,{className:`cc-dash-attention${C.length?``:` is-clear`}`,"aria-label":`Needs attention`,"aria-live":`polite`,children:S?(0,p.jsx)(d.Skeleton.Input,{active:!0,size:`small`,style:{width:240}}):C.length?(0,p.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:8,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 260px), 1fr))`},children:C.map(e=>(0,p.jsxs)(`li`,{className:`cc-dash-attention__item`,style:{display:`flex`,alignItems:`center`,gap:12,minWidth:0},children:[(0,p.jsx)(f.WarningOutlined,{className:`cc-dash-attention__icon`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`cc-dash-attention__count`,children:xL(e.n)}),(0,p.jsx)(`span`,{className:`cc-dash-attention__text`,style:{flex:1,minWidth:0},children:e.text}),$(e.to)?(0,p.jsx)(d.Button,{size:`small`,className:`cc-dash-attention__review`,onClick:()=>_.navigate(e.to),children:`Review`}):null]},e.key))}):(0,p.jsxs)(`span`,{className:`cc-dash-attention__clear`,children:[(0,p.jsx)(f.CheckCircleOutlined,{"aria-hidden":`true`}),` All caught up. Nothing needs attention right now.`]})}):null,v.some(e=>e.show!==!1)?(0,p.jsx)(`section`,{className:`cc-dash-kpis`,"aria-label":`Key numbers`,style:{display:`grid`,gap:12,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 150px), 1fr))`},children:v.filter(e=>e.show!==!1).map(e=>(0,p.jsx)(QL,{kpi:e,value:x[e.key],loading:S&&x[e.key]===void 0,ctx:_,refreshKey:g},e.key))}):null,T.length?(0,p.jsx)(`div`,{className:`cc-dash-charts`,style:{display:`grid`,gap:16,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 320px), 1fr))`,alignItems:`stretch`},children:T.map(e=>(0,p.jsx)(nR,{panel:e,...M},e.key))}):null,E.length||D.length?(0,p.jsxs)(`div`,{className:`cc-dash-grid${D.length?` has-side`:``}`,style:{display:`grid`,gap:16,gridTemplateColumns:D.length?`repeat(auto-fit, minmax(min(100%, 340px), 1fr))`:`1fr`,alignItems:`start`},children:[(0,p.jsx)(`div`,{className:`cc-dash-main`,style:{display:`grid`,gap:16,minWidth:0},children:E.map(e=>(0,p.jsx)(nR,{panel:e,...M},e.key))}),D.length?(0,p.jsx)(`div`,{className:`cc-dash-side`,style:{display:`grid`,gap:16,minWidth:0},children:D.map(e=>(0,p.jsx)(nR,{panel:e,...M},e.key))}):null]}):null]})}var iR={...pI,assessment:f.FormOutlined,audit:f.AuditOutlined,book:f.BookOutlined,calendar:f.CalendarOutlined,check:f.CheckCircleOutlined,clipboard:f.SnippetsOutlined,clock:f.ClockCircleOutlined,done:f.FileDoneOutlined,file:f.FileTextOutlined,pdf:f.FilePdfOutlined,read:f.ReadOutlined,team:f.TeamOutlined,users:f.UsergroupAddOutlined,video:f.VideoCameraOutlined,wallet:f.WalletOutlined};function aR(e){if(!e)return null;if(typeof e!=`string`)return e;let t=iR[e.trim().toLowerCase()];return t?(0,u.createElement)(t):null}var oR=e=>`calc(${e} * var(--cc-ds-u, 1.5px))`,sR=(e,t)=>`max(${t}px, ${oR(e)})`,cR={neutral:[`#5b6475`,`#f1f3f7`],brand:[`var(--ant-color-primary, #1677ff)`,`var(--ant-color-primary-bg, #e6f4ff)`],green:[`#00c26b`,`#e6f9f0`],blue:[`#3b7cf6`,`#eaf1fe`],purple:[`#ab16f4`,`#f7e8fe`],orange:[`#f39a3d`,`#fff2e5`],teal:[`#12b5cb`,`#e6f8fb`],pink:[`#d6338a`,`#fde8f2`],red:[`#e5484d`,`#fdecec`]};Object.keys(cR);function lR(e){let t=cR[e]?e:`neutral`,[n,r]=cR[t];return{fg:`var(--cc-ds-tone-${t}-fg, ${n})`,bg:`var(--cc-ds-tone-${t}-bg, ${r})`}}var uR={ink:`var(--cc-ds-ink, #252744)`,value:`var(--cc-ds-value, #17202c)`,muted:`var(--cc-ds-muted, #8590aa)`,border:`var(--cc-ds-border, #ecedf7)`,surface:`var(--cc-ds-surface, #ffffff)`,link:`var(--cc-ds-link, var(--ant-color-primary, #1677ff))`,track:`var(--cc-ds-track, #eef0f6)`};function dR(e,t){if(typeof e==`number`&&Number.isFinite(e))try{return new Intl.NumberFormat(t).format(e)}catch{return String(e)}return typeof e==`boolean`?e?`Yes`:`No`:yI(e)}function fR(e,t,n,{locale:r,placeholder:i=`–`}={}){let a=dR(_I(e,t,n),r);return $(a)?a:i}function pR(e,t,n){let r=_I(e.items,t,n),i=Array.isArray(r)?r:[],a=e.map&&typeof e.map==`object`?e.map:null,o=Number.isFinite(e.limit)&&e.limit>=0?i.slice(0,e.limit):i;return a?o.map(e=>{if(!e||typeof e!=`object`)return e;let t={...e};return Object.entries(a).forEach(([n,r])=>{t[n]=gI(e,r)}),t}):o}var mR=(e,t)=>dR(e&&typeof e==`object`?e.text??e.label??e.title:e,t),hR=e=>(t,n,r,i)=>!pR(t,n,r).some(t=>t&&typeof t==`object`&&$(dR(t[e],i))),gR=(e,t,n)=>(Array.isArray(e.items)?e.items:[]).filter(e=>e&&bI(e,t,n)),_R={text:(e,t,n,r)=>!$(fR(e.value,t,n,{locale:r,placeholder:``})),fields:(e,t,n)=>gR(e,t,n).length===0,stats:(e,t,n)=>gR(e,t,n).length===0,list:(e,t,n,r)=>!pR(e,t,n).some(e=>$(mR(e,r))),tags:(e,t,n,r)=>!pR(e,t,n).some(e=>$(dR(e&&typeof e==`object`?e.label:e,r))),callout:(e,t,n,r)=>!$(vI(e.title,t,n))&&!$(fR(e.text,t,n,{locale:r,placeholder:``})),timeline:hR(`title`),people:hR(`name`),files:hR(`name`),progress:(e,t,n)=>!Number.isFinite(Number(_I(e.percent,t,n)))};function vR(e,t,n,r){return _R[e?.type]?.(e,t,n,r)??!1}var yR=e=>({display:`flex`,flexDirection:`column`,gap:oR(e),minWidth:0}),bR={body:{fontSize:sR(7.16,11),fontWeight:600,lineHeight:1.5,color:uR.muted},label:{fontSize:sR(6.6,11),fontWeight:600,lineHeight:1.5,color:uR.muted},value:{fontSize:sR(6.6,11),fontWeight:400,lineHeight:1.5,color:uR.value},small:{fontSize:sR(5.5,10),fontWeight:600,lineHeight:1.5,color:uR.muted},strong:{fontSize:sR(7.16,11),fontWeight:700,lineHeight:1.5,color:uR.ink},stat:{fontSize:sR(9.36,13),fontWeight:600,lineHeight:1.5,color:uR.ink},sub:{fontSize:sR(6.6,11),fontWeight:600,lineHeight:1.5,color:uR.ink,margin:0}};function xR({icon:e,tone:t,size:n=13}){let r=aR(e);if(!r)return null;let i=lR(t);return(0,p.jsx)(`span`,{className:`cc-details__badge`,"data-tone":t||`neutral`,"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`none`,width:oR(n),height:oR(n),borderRadius:oR(n*.28),background:i.bg,color:i.fg,fontSize:oR(n*.58)},children:r})}function SR({block:e,data:t,ctx:n,locale:r}){let i=fR(e.value,t,n,{locale:r,placeholder:``}),a=Number.isFinite(e.lines)&&e.lines>0?e.lines:0,[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(!1),d=(0,u.useRef)(null);if((0,u.useLayoutEffect)(()=>{let e=d.current;!e||!a||o||l(e.scrollHeight-e.clientHeight>1)},[i,a,o]),!$(i))return null;let m=a&&!o?{display:`-webkit-box`,WebkitLineClamp:a,WebkitBoxOrient:`vertical`,overflow:`hidden`}:{},h=vI(e.more??`Show More`,t,n),g=vI(e.less??`Show Less`,t,n);return(0,p.jsxs)(`div`,{style:yR(3),children:[(0,p.jsx)(`p`,{ref:d,className:`cc-details__text`,style:{...bR.body,margin:0,whiteSpace:`pre-line`,...m},children:i}),a>0&&(c||o)&&$(h)&&(0,p.jsxs)(`button`,{type:`button`,className:`cc-details__more`,"aria-expanded":o,onClick:()=>s(e=>!e),style:{alignSelf:`flex-start`,padding:0,border:0,background:`none`,cursor:`pointer`,color:uR.link,fontSize:sR(6.05,11),fontWeight:600,display:`inline-flex`,alignItems:`center`,gap:oR(2)},children:[o?g:h,o?(0,p.jsx)(f.UpOutlined,{style:{fontSize:oR(4.5)}}):(0,p.jsx)(f.DownOutlined,{style:{fontSize:oR(4.5)}})]})]})}function CR({block:e,data:t,ctx:n,locale:r}){let i=(Array.isArray(e.items)?e.items:[]).filter(e=>e&&bI(e,t,n));if(!i.length)return null;let a=Number.isFinite(e.columns)&&e.columns>0?e.columns:1,o=6.6,s=Number.isFinite(e.minPairWidth)?e.minPairWidth:130,c=`calc((100% - ${a-1} * ${oR(o)}) / ${a})`,l=Number.isFinite(e.labelWidth)?oR(e.labelWidth):`minmax(0, 1fr)`;return(0,p.jsx)(`dl`,{className:`cc-details__fields`,style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(max(${oR(s)}, ${c}), 1fr))`,columnGap:oR(o),rowGap:oR(2.2),margin:0},children:i.map(e=>(0,p.jsxs)(`div`,{className:`cc-details__field`,style:{display:`grid`,gridTemplateColumns:`${l} minmax(0, 1fr)`,columnGap:oR(4),minWidth:0},children:[(0,p.jsx)(`dt`,{style:{...bR.label,margin:0},children:vI(e.label,t,n)}),(0,p.jsx)(`dd`,{style:{...bR.value,margin:0,overflowWrap:`anywhere`},children:fR(e.value,t,n,{locale:r})})]},e.key??vI(e.label,t,n)))})}function wR({block:e,data:t,ctx:n,locale:r}){let i=pR(e,t,n).map(e=>e&&typeof e==`object`?e:{text:e}),a=e.variant||`bullet`,o=lR(e.tone||(a===`check`?`green`:`neutral`)),s=i.filter(e=>$(dR(e.text??e.label??e.title,r)));return s.length?(0,p.jsx)(`ul`,{className:`cc-details__list cc-details__list--${a}`,style:{...yR(a===`check`?3.3:1.6),listStyle:`none`,margin:0,padding:0},children:s.map((e,t)=>{let n=dR(e.text??e.label??e.title,r),i=dR(e.meta,r);return(0,p.jsxs)(`li`,{style:{display:`flex`,alignItems:`flex-start`,gap:oR(a===`check`?3.3:2.4),...a===`plain`?bR.value:bR.label,color:uR.muted},children:[a===`bullet`&&(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{flex:`none`,width:oR(1.8),height:oR(1.8),marginTop:oR(3.2),borderRadius:`50%`,background:uR.muted}}),a===`check`&&(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{flex:`none`,color:o.fg,fontSize:oR(7),lineHeight:1,marginTop:oR(1.2)},children:aR(`check`)}),(0,p.jsxs)(`span`,{style:{minWidth:0},children:[(0,p.jsx)(`span`,{className:`cc-details__item-text`,children:n}),$(i)&&(0,p.jsx)(`span`,{className:`cc-details__item-sep`,style:{margin:`0 ${oR(4)}`},"aria-hidden":`true`,children:`•`}),$(i)&&(0,p.jsx)(`span`,{className:`cc-details__item-meta`,children:i})]})]},`${t}-${n}`)})}):null}function TR({block:e,data:t,ctx:n,locale:r}){let i=vI(e.title,t,n),a=fR(e.text,t,n,{locale:r,placeholder:``});return!$(i)&&!$(a)?null:(0,p.jsxs)(`div`,{className:`cc-details__callout`,style:{display:`flex`,gap:oR(6.6),alignItems:`flex-start`},children:[(0,p.jsx)(xR,{icon:e.icon,tone:e.tone,size:15.4}),(0,p.jsxs)(`div`,{style:yR(1.1),children:[$(i)&&(0,p.jsx)(`span`,{style:bR.strong,children:i}),$(a)&&(0,p.jsx)(`span`,{style:bR.small,children:a})]})]})}function ER({block:e,data:t,ctx:n,locale:r}){let i=pR(e,t,n).filter(e=>e&&typeof e==`object`);return i.length?(0,p.jsx)(`ol`,{className:`cc-details__timeline`,style:{listStyle:`none`,margin:0,padding:0,display:`flex`,flexDirection:`column`},children:i.map((e,t)=>(0,p.jsxs)(`li`,{style:{display:`flex`,gap:oR(6.6),minHeight:oR(e===i[i.length-1]?13:34.6)},children:[(0,p.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,flex:`none`},children:[(0,p.jsx)(xR,{icon:e.icon,tone:e.tone,size:13.2}),t<i.length-1&&(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{flex:1,width:oR(.55),background:uR.border,margin:`${oR(2)} 0`}})]}),(0,p.jsxs)(`span`,{style:{...yR(.5),paddingTop:oR(.6)},children:[(0,p.jsx)(`span`,{style:bR.strong,children:dR(e.title,r)}),$(dR(e.text,r))&&(0,p.jsx)(`span`,{style:bR.small,children:dR(e.text,r)})]})]},`${t}-${dR(e.title,r)}`))}):null}function DR({block:e,data:t,ctx:n,locale:r}){let i=(Array.isArray(e.items)?e.items:[]).filter(e=>e&&bI(e,t,n));if(!i.length)return null;let a=e.variant===`tiles`;return(0,p.jsx)(`div`,{className:`cc-details__stats cc-details__stats--${a?`tiles`:`plain`}`,style:{display:`flex`,flexWrap:`wrap`,columnGap:oR(a?13:8.8),rowGap:oR(6.6),justifyContent:`space-between`},children:i.map(e=>{let i=fR(e.value,t,n,{locale:r}),o=e.valueTone?lR(e.valueTone).fg:uR.ink;return(0,p.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:oR(6.6),flex:a?`0 1 auto`:`1 0 auto`},children:[a&&(0,p.jsx)(xR,{icon:e.icon,tone:e.tone,size:17.6}),(0,p.jsxs)(`span`,{style:yR(0),children:[(0,p.jsx)(`span`,{style:{...bR.stat,color:o,whiteSpace:`nowrap`},children:i}),(0,p.jsx)(`span`,{style:bR.small,children:vI(e.label,t,n)})]})]},e.key??vI(e.label,t,n))})})}function OR({block:e,data:t,ctx:n,locale:r}){let i=pR(e,t,n).filter(e=>e&&typeof e==`object`&&$(dR(e.name,r)));return i.length?(0,p.jsx)(`ul`,{className:`cc-details__people`,style:{...yR(2.2),listStyle:`none`,margin:0,padding:0},children:i.map((e,t)=>{let n=dR(e.name,r);return(0,p.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:oR(4.4)},children:[(0,p.jsx)(d.Avatar,{src:$(e.avatar)?e.avatar:void 0,alt:``,style:{width:oR(15.4),height:oR(15.4),lineHeight:oR(15.4),fontSize:oR(6),flex:`none`},children:EI(n)}),(0,p.jsxs)(`span`,{style:yR(0),children:[(0,p.jsx)(`span`,{style:{...bR.strong,fontSize:sR(6.6,11)},children:n}),$(dR(e.subtitle,r))&&(0,p.jsx)(`span`,{style:bR.small,children:dR(e.subtitle,r)})]})]},`${t}-${n}`)})}):null}function kR({block:e,data:t,ctx:n,locale:r}){let i=Number(_I(e.percent,t,n));if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(100,i)),o=fR(e.caption,t,n,{locale:r,placeholder:``}),s=lR(e.tone||`brand`);return(0,p.jsxs)(`div`,{className:`cc-details__progress`,style:yR(3.3),children:[(0,p.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,style:{height:oR(2.2),borderRadius:oR(2),background:uR.track,overflow:`hidden`},children:(0,p.jsx)(`div`,{style:{width:`${a}%`,height:`100%`,borderRadius:`inherit`,background:s.fg}})}),$(o)&&(0,p.jsx)(`span`,{style:bR.small,children:o})]})}function AR({block:e,data:t,ctx:n,locale:r}){let i=pR(e,t,n).map(e=>e&&typeof e==`object`?e:{label:e}).filter(e=>$(dR(e.label,r)));return i.length?(0,p.jsx)(`div`,{className:`cc-details__tags`,style:{display:`flex`,flexWrap:`wrap`,gap:oR(3.3)},children:i.map((t,n)=>{let i=lR(t.tone||e.tone||`neutral`);return(0,p.jsx)(`span`,{"data-tone":t.tone||e.tone||`neutral`,style:{display:`inline-flex`,alignItems:`center`,padding:`${oR(1.6)} ${oR(4.4)}`,borderRadius:oR(3),background:i.bg,color:e.tone||t.tone?i.fg:uR.muted,fontSize:sR(5.5,10),fontWeight:400,lineHeight:1.5},children:dR(t.label,r)},`${n}-${dR(t.label,r)}`)})}):null}function jR({block:e,data:t,ctx:n,locale:r}){let i=pR(e,t,n).filter(e=>e&&typeof e==`object`&&$(dR(e.name,r)));return i.length?(0,p.jsx)(`ul`,{className:`cc-details__files`,style:{...yR(5.5),listStyle:`none`,margin:0,padding:0},children:i.map((t,n)=>{let i=dR(t.name,r),a=$(t.href)&&/^(https?:|\/|blob:)/i.test(String(t.href))?String(t.href):``;return(0,p.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:oR(5.5)},children:[(0,p.jsx)(xR,{icon:t.icon||`pdf`,tone:t.tone||e.tone||`pink`,size:13.2}),(0,p.jsxs)(`span`,{style:yR(0),children:[a?(0,p.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,style:{...bR.strong,fontSize:sR(6.6,11)},children:i}):(0,p.jsx)(`span`,{style:{...bR.strong,fontSize:sR(6.6,11)},children:i}),$(dR(t.meta,r))&&(0,p.jsx)(`span`,{style:bR.small,children:dR(t.meta,r)})]})]},`${n}-${i}`)})}):null}function MR(){return(0,p.jsx)(`hr`,{"aria-hidden":`true`,style:{border:0,borderTop:`0.55px solid ${uR.border}`,margin:`${oR(2)} 0`,width:`100%`}})}function NR({block:e,data:t,ctx:n}){if(typeof e.render!=`function`)return null;try{return e.render(t,n)??null}catch(e){return console.warn(`[DETAILSSECTION] custom block failed:`,e),null}}function PR({block:e,data:t,ctx:n,locale:r,registry:i}){if(!e||!bI(e,t,n))return null;let a=i[e.type];if(!a)return console.warn(`[DETAILSSECTION] unknown block type "${e.type}"`),(0,p.jsxs)(`div`,{role:`alert`,className:`cc-details__unknown`,style:{...bR.small,color:lR(`red`).fg},children:[`Unknown block type “`,String(e.type),`”`]});let o=e.type===`callout`?``:vI(e.title,t,n),s=vR(e,t,n,r),c=vI(e.empty,t,n);return s&&!$(c)?null:(0,p.jsxs)(`div`,{className:`cc-details__block cc-details__block--${e.type}`,style:yR(3.3),children:[$(o)&&(0,p.jsx)(`h4`,{className:`cc-details__subtitle`,style:bR.sub,children:o}),s?(0,p.jsx)(`span`,{className:`cc-details__empty`,style:bR.small,children:c}):(0,p.jsx)(a,{block:e,data:t,ctx:n,locale:r})]})}var FR={text:SR,fields:CR,list:wR,callout:TR,timeline:ER,stats:DR,people:OR,progress:kR,tags:AR,files:jR,divider:MR,custom:NR};function IR(e,t,n,r,i=FR){return!e||!bI(e,t,n)?!1:!i[e.type]||!vR(e,t,n,r)||$(vI(e.empty,t,n))}var LR={gap:6,asideWidth:154,stackBelow:900,wrapBelow:640};function RR(e){let[t,n]=(0,u.useState)(0);return(0,u.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(t.getBoundingClientRect().width||0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function zR(e,t,n){if(typeof e.onClick==`function`)return e.onClick(t,n);if($(e.tab)&&typeof n?.openTab==`function`)return n.openTab(String(e.tab));if($(e.href)){let t=String(e.href);if(/^https?:/i.test(t))return window.open(t,`_blank`,`noopener,noreferrer`);if(typeof n?.navigate==`function`)return n.navigate(t)}}function BR({card:e,data:t,ctx:n,locale:r,registry:i,style:a}){let o=vI(e.title,t,n),s=e.action&&bI(e.action,t,n)?e.action:null,c=s?vI(s.label,t,n):``,l=`cc-details-${e.key}`;return(0,p.jsxs)(`section`,{className:`cc-details__card ${e.className??``}`.trim(),"data-card":e.key,"aria-labelledby":$(o)?l:void 0,style:{display:`flex`,flexDirection:`column`,gap:oR(6.6),minWidth:0,boxSizing:`border-box`,padding:oR(8.81),borderRadius:oR(5.5),border:`0.55px solid ${uR.border}`,background:uR.surface,...a},children:[($(o)||$(c))&&(0,p.jsxs)(`header`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:oR(4)},children:[$(o)&&(0,p.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:oR(5.5),minWidth:0},children:[e.icon?(0,p.jsx)(xR,{icon:e.icon,tone:e.tone,size:Number(e.iconSize)>0?Number(e.iconSize):17.6}):null,(0,p.jsx)(`h3`,{id:l,className:`cc-details__title`,style:{margin:0,fontSize:sR(8.81,12),fontWeight:600,lineHeight:1.5,color:uR.ink},children:o})]}),$(c)&&(0,p.jsxs)(`button`,{type:`button`,className:`cc-details__action`,onClick:()=>zR(s,t,n),style:{marginLeft:`auto`,padding:0,border:0,background:`none`,cursor:`pointer`,color:uR.link,fontSize:sR(6.05,11),fontWeight:400,lineHeight:1.5,whiteSpace:`nowrap`,display:`inline-flex`,alignItems:`center`,gap:oR(3)},children:[s.icon?(0,p.jsx)(`span`,{className:`cc-details__action-icon`,"aria-hidden":`true`,style:{display:`inline-flex`},children:aR(s.icon)}):null,c]})]}),(Array.isArray(e.blocks)?e.blocks:[]).map((e,a)=>(0,p.jsx)(PR,{block:e,data:t,ctx:n,locale:r,registry:i},e?.key??`${e?.type}-${a}`))]})}var VR=(e,t,n,r,i)=>!!e?.key&&bI(e,t,n)&&(Array.isArray(e.blocks)?e.blocks:[]).some(e=>IR(e,t,n,r,i));function HR({config:e,data:t={},ctx:n={},className:r=``}){Vc();let i=(0,u.useRef)(null),a=RR(i),o=e&&typeof e==`object`?e:{},s={...LR,...o.layout??{}},c=o.locale,l={...FR,...o.blocks&&typeof o.blocks==`object`?o.blocks:{}},d=oR(s.gap),f=a>0,m=f&&a<s.stackBelow,h=f&&a<s.wrapBelow,g=(Array.isArray(o.main)?o.main:[]).map(e=>(Array.isArray(e)?e:[e]).filter(e=>VR(e,t,n,c,l))).filter(e=>e.length>0),_=(Array.isArray(o.aside)?o.aside:[]).filter(e=>VR(e,t,n,c,l));if(!g.length&&!_.length)return null;let v=e=>Number.isFinite(e.width)&&e.width>0?e.width:1;return(0,p.jsxs)(`div`,{ref:i,className:`cc-details ${r}`.trim(),role:`region`,"aria-label":vI(o.label,t,n)||void 0,"data-layout":h?`single`:m?`stacked`:`wide`,style:{display:`flex`,flexDirection:m?`column`:`row`,alignItems:`flex-start`,gap:d,width:`100%`,boxSizing:`border-box`,fontFamily:`var(--cc-ds-font, inherit)`},children:[g.length>0&&(0,p.jsx)(`div`,{className:`cc-details__main`,style:{display:`flex`,flexDirection:`column`,gap:d,flex:`1 1 0`,minWidth:0,width:m?`100%`:void 0},children:g.map(e=>(0,p.jsx)(`div`,{className:`cc-details__row`,style:{display:`flex`,flexDirection:h?`column`:`row`,alignItems:`stretch`,gap:d},children:e.map(e=>(0,p.jsx)(BR,{card:e,data:t,ctx:n,locale:c,registry:l,style:{flex:h?`1 1 auto`:`${v(e)} 1 0`}},e.key))},e.map(e=>e.key).join(`|`)))}),_.length>0&&(0,p.jsx)(`aside`,{className:`cc-details__aside`,style:{display:m&&!h?`grid`:`flex`,flexDirection:`column`,gap:d,minWidth:0,gridTemplateColumns:m&&!h?`repeat(${Math.min(_.length,3)}, minmax(0, 1fr))`:void 0,width:m?`100%`:oR(s.asideWidth),flex:`none`,alignItems:m&&!h?`start`:`stretch`},children:_.map(e=>(0,p.jsx)(BR,{card:e,data:t,ctx:n,locale:c,registry:l},e.key))})]})}var UR=`.ant-modal-wrap:not([style*="display: none"]), .ant-drawer-open, .ant-picker-dropdown:not(.ant-picker-dropdown-hidden), .ant-select-dropdown:not(.ant-select-dropdown-hidden), .ant-dropdown:not(.ant-dropdown-hidden)`,WR=`cc-mdw-detail-window-width`,GR=32;function KR(e){try{let t=Number(localStorage.getItem(e));return Number.isFinite(t)&&t>0?t:null}catch{return null}}function qR(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}function JR({topBar:e=null,rail:t=null,list:n=null,compactList:r=null,detail:i=null,detailOpen:a=!1,detailExpanded:o=!1,detailMode:s=`split`,detailWidth:c,onDetailWidthChange:l,defaultDetailWidth:d=720,minDetailWidth:f=480,maxDetailWidthRatio:m=.75,widthStorageKey:h=WR,railCollapsed:g=!1,railOverlay:_=!1,onCloseRailOverlay:v,onCloseDetail:y,railWidth:b=264,collapsedRailWidth:x=52,compactListWidth:S=340,className:C=``,ariaLabel:w=`Workspace`}){let T=s===`window`,E=(0,u.useRef)(null),D=(0,u.useRef)(null),O=(0,u.useRef)(null),[k,A]=(0,u.useState)(()=>KR(h)??d),j=c??k;(0,u.useEffect)(()=>{if(a){!O.current&&typeof document<`u`&&(O.current=document.activeElement),D.current?.focus({preventScroll:!0});return}let e=O.current;O.current=null,e&&typeof e.focus==`function`&&document.contains(e)&&e.focus({preventScroll:!0})},[a]),(0,u.useEffect)(()=>{if(!a||typeof document>`u`)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(UR)||y?.()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,y]);let M=(0,u.useCallback)(e=>{let t=E.current?.getBoundingClientRect().width||0,n=t>0?Math.max(f,t*m):1/0;return Math.round(Math.min(Math.max(e,f),n))},[f,m]),N=(0,u.useCallback)(e=>{let t=M(e);return l&&l(t),c??(A(t),qR(h,t)),t},[M,c,l,h]),P=e=>{if(e.button!==0)return;e.preventDefault();let t=E.current,n=t?.querySelector(`.cc-mdw__body`);if(!t||!n)return;let r=n.getBoundingClientRect().right,i=j,a=e=>{i=M(r-e.clientX-12),t.style.setProperty(`--cc-detail-window-w`,`${i}px`)},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),t.classList.remove(`cc-mdw--resizing`),N(i)};t.classList.add(`cc-mdw--resizing`),window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},F=e=>{e.key===`ArrowLeft`?(e.preventDefault(),N(j+GR)):e.key===`ArrowRight`&&(e.preventDefault(),N(j-GR))},I=a?o?`expanded`:`open`:`closed`,L=T?g:a||g,R=!T&&a&&_,z=!T&&a&&!!r,B={"--cc-rail-w":`${b}px`,"--cc-rail-collapsed-w":`${x}px`,"--cc-compact-list-w":`${S}px`,"--cc-detail-window-w":`${j}px`};return(0,p.jsxs)(`div`,{ref:E,className:[`cc-mdw`,`cc-mdw--${I}`,T?`cc-mdw--window`:`cc-mdw--split`,L?`cc-mdw--rail-collapsed`:``,R?`cc-mdw--rail-overlay`:``,t==null?`cc-mdw--no-rail`:``,C].filter(Boolean).join(` `),style:B,"aria-label":w,children:[e&&(0,p.jsx)(`div`,{className:`cc-mdw__top`,children:e}),(0,p.jsxs)(`div`,{className:`cc-mdw__body`,children:[t!=null&&(0,p.jsx)(`div`,{className:`cc-mdw__rail`,children:t}),R&&(0,p.jsx)(`button`,{type:`button`,className:`cc-mdw__rail-backdrop`,"aria-label":`Close filters`,onClick:v}),(0,p.jsxs)(`div`,{className:`cc-mdw__list`,"aria-hidden":I===`expanded`||void 0,children:[(0,p.jsx)(`div`,{className:`cc-mdw__list-full${z?` is-hidden`:``}`,children:n}),z&&(0,p.jsx)(`div`,{className:`cc-mdw__list-compact`,children:r})]}),(0,p.jsxs)(`section`,{ref:D,className:`cc-mdw__detail`,tabIndex:-1,"aria-hidden":!a||void 0,"aria-label":`Details`,children:[T&&a&&!o&&(0,p.jsx)(`div`,{className:`cc-mdw__resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize details`,"aria-valuenow":j,"aria-valuemin":f,tabIndex:0,onPointerDown:P,onKeyDown:F}),a?i:null]})]})]})}function YR({primaryAction:e,menuActions:t=[],onAction:n,size:r=`large`,className:i=``}){if(!e)return null;let a=t.map(e=>({key:e.key,label:e.label,icon:e.icon,disabled:!!e.disabled})),o=(0,p.jsx)(d.Button,{type:`primary`,size:r,icon:e.icon??(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>n?.(e.key),children:e.label});return a.length?(0,p.jsxs)(d.Space.Compact,{className:`cc-create-btn ${i}`.trim(),children:[o,(0,p.jsx)(d.Dropdown,{trigger:[`click`],placement:`bottomRight`,menu:{items:a,onClick:({key:e})=>n?.(e)},children:(0,p.jsx)(d.Button,{type:`primary`,size:r,icon:(0,p.jsx)(f.DownOutlined,{}),"aria-label":`More create options`})})]}):(0,p.jsx)(`span`,{className:`cc-create-btn ${i}`.trim(),children:o})}function XR({title:e=null,searchValue:t=``,onSearch:n,searchPlaceholder:r=`Search…`,minChars:i=3,debounceMs:a=350,primaryAction:o=null,menuActions:s=[],onAction:c,extra:l=null,className:m=``,showSearch:h=!0}){let[g,_]=(0,u.useState)(t??``),[v,y]=(0,u.useState)(t??``),b=(0,u.useRef)(t??``),x=(0,u.useRef)(null);(t??``)!==v&&(y(t??``),_(t??``)),(0,u.useEffect)(()=>{b.current=t??``},[t]),(0,u.useEffect)(()=>()=>clearTimeout(x.current),[]);let S=e=>{clearTimeout(x.current),x.current=null;let t=String(e??``).trim(),r=t.length>=i?t:``;t.length>0&&t.length<i||r!==b.current&&(b.current=r,n?.(r))},C=e=>{let t=e.target.value;if(_(t),clearTimeout(x.current),t.trim()===``){S(``);return}x.current=setTimeout(()=>S(t),a)},w=g.trim(),T=w.length>0&&w.length<i;return(0,p.jsxs)(`div`,{className:`cc-topbar ${m}`.trim(),children:[e&&(0,p.jsx)(`div`,{className:`cc-topbar__title`,children:e}),h&&(0,p.jsxs)(`div`,{className:`cc-topbar__search`,children:[(0,p.jsx)(d.Input,{allowClear:!0,size:`large`,prefix:(0,p.jsx)(f.SearchOutlined,{"aria-hidden":!0}),placeholder:r,value:g,onChange:C,onPressEnter:()=>S(g),"aria-label":r,"aria-describedby":T?`cc-topbar-hint`:void 0}),T&&(0,p.jsxs)(`span`,{id:`cc-topbar-hint`,className:`cc-topbar__hint`,children:[`Type at least `,i,` characters`]})]}),(0,p.jsxs)(`div`,{className:`cc-topbar__actions`,children:[l,(0,p.jsx)(YR,{primaryAction:o,menuActions:s,onAction:c})]})]})}function ZR(e){return e===!0||e===1||e===`1`||String(e).toLowerCase()===`true`}function QR(e,t){if(!(!e||!t))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:String(t).split(`.`).reduce((e,t)=>e?.[t],e)}function $R(e){return e==null||e===``?``:Array.isArray(e)?e.map($R).filter(Boolean).join(`, `):typeof e==`object`?$R(e.label??e.value??e.name??e.title??``):String(e)}function ez(e){return e?.field??e?.value??e?.fieldName??e?.key??``}function tz(e){return(Array.isArray(e)?e:[]).filter(e=>ez(e)&&e.isVisible!==!1&&e.isVisible!==0&&e.isVisible!==`0`).slice().sort((e,t)=>Number(e.order??0)-Number(t.order??0))}function nz(e){let t=tz(e),n=t.find(e=>ZR(e.isLink))??t[0]??null,r=t.find(e=>String(e.renderType??``).toLowerCase()===`badge`&&e!==n)??null;return{title:n,status:r,meta:t.filter(e=>e!==n&&e!==r).slice(0,2)}}function rz(e){let t=e?._id??e?.id;return t&&typeof t==`object`?String(t.$oid??``):t==null?``:String(t)}function iz({snapshot:e,loading:t=!1,selectedId:n,onSelect:r,onPage:i,ariaLabel:a=`Records`,emptyText:o=`No records`}){let s=(0,u.useRef)(null),c=e?.rows??[],{title:l,status:m,meta:h}=(0,u.useMemo)(()=>nz(e?.fields),[e?.fields]),g=e?.page??1,_=e?.limit??10,v=e?.total??0,y=Math.max(1,Math.ceil(v/Math.max(1,_)));return(0,p.jsxs)(`div`,{className:`cc-compact-list`,children:[(0,p.jsxs)(`div`,{className:`cc-compact-list__head`,children:[(0,p.jsxs)(`span`,{children:[v.toLocaleString(),` `,v===1?`result`:`results`]}),t&&(0,p.jsx)(d.Spin,{size:`small`})]}),c.length===0?(0,p.jsx)(`div`,{className:`cc-compact-list__empty`,children:t?(0,p.jsx)(d.Spin,{}):(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:o})}):(0,p.jsx)(`ul`,{ref:s,className:`cc-compact-list__items`,role:`listbox`,"aria-label":a,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`].includes(e.key))return;let t=[...s.current?.querySelectorAll(`[data-record-id]`)??[]],n=t.indexOf(document.activeElement),r=e.key===`ArrowDown`?Math.min(t.length-1,n+1):Math.max(0,n-1);t[r]&&(e.preventDefault(),t[r].focus())},children:c.map((e,t)=>{let i=rz(e),a=$R(QR(e,ez(l)))||`—`,o=m?$R(QR(e,ez(m))):``,s=h.map(t=>$R(QR(e,ez(t)))).filter(Boolean).join(` · `),c=i&&String(i)===String(n??``);return(0,p.jsxs)(`li`,{"data-record-id":i,role:`option`,"aria-selected":c,tabIndex:0,className:`cc-compact-item${c?` is-selected`:``}`,onClick:()=>i&&r?.(i,e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&i&&(t.preventDefault(),r?.(i,e))},children:[(0,p.jsxs)(`div`,{className:`cc-compact-item__row`,children:[(0,p.jsx)(d.Tooltip,{title:a,mouseEnterDelay:.6,children:(0,p.jsx)(`span`,{className:`cc-compact-item__title`,children:a})}),o&&(0,p.jsx)(d.Tag,{className:`cc-compact-item__status`,children:o})]}),s&&(0,p.jsx)(`div`,{className:`cc-compact-item__meta`,children:s})]},i||t)})}),y>1&&(0,p.jsxs)(`div`,{className:`cc-compact-list__pager`,children:[(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.LeftOutlined,{}),disabled:g<=1||t,onClick:()=>i?.(g-1),"aria-label":`Previous page`}),(0,p.jsxs)(`span`,{children:[g,` / `,y]}),(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.RightOutlined,{}),disabled:g>=y||t,onClick:()=>i?.(g+1),"aria-label":`Next page`})]})]})}var az=[];function oz({component:e,id:t,moduleName:n,onDescriptionSaved:r,record:i}){return e?(0,p.jsx)(e,{id:t,moduleName:n,onDescriptionSaved:r,record:i}):null}function sz({tabs:e=[],activeKey:t,onChange:n,max:r=11,alwaysShowMore:i=!1,moreEmptyLabel:a=`Nothing more`}){let o=e.length>r?e.slice(0,r):e,s=e.length>r?e.slice(r):az,c=s.some(e=>e.key===t);return(0,p.jsxs)(`div`,{className:`cc-detail__tabs`,role:`tablist`,"aria-label":`Record sections`,children:[o.map(e=>(0,p.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===t,className:`cc-detail__tab-btn${e.key===t?` is-active`:``}`,onClick:()=>n(e.key),children:e.label??e.key},e.key)),(s.length>0||i)&&(0,p.jsx)(d.Dropdown,{trigger:[`click`],placement:`bottomRight`,menu:{items:s.length?s.map(e=>({key:e.key,label:e.label??e.key})):[{key:`__empty`,label:a,disabled:!0}],selectable:!0,selectedKeys:c?[t]:[],onClick:({key:e})=>n(e)},children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-detail__tab-btn cc-detail__tab-more${c?` is-active`:``}`,"aria-haspopup":`menu`,children:[c?s.find(e=>e.key===t)?.label:`More`,` `,(0,p.jsx)(f.DownOutlined,{})]})})]})}function cz({moduleName:e,id:t,customConfigName:n,breadcrumb:r=null,stats:i=null,toolbarExtra:a=null,banner:o=null,expanded:s=!1,onToggleExpand:c,onClose:l,refreshKey:m=0,showActivity:g=!0,showNotes:v=!0,users:y=[],onHeaderData:b,onRecordLoaded:x,onHeaderAction:S,onTabChange:C,layout:w=`auto`,stackBelow:T=900,headerSlot:E=null,headerEndSlot:D=null,collapseLabel:O=`Show list`,tabsPlacement:k=`header`,maxVisibleTabs:A=11,alwaysShowMore:j=!1,moreEmptyLabel:M,extraTabs:N=az,defaultTab:P=`details`}){let F=(0,u.useRef)(null),I=E!=null||D!=null,[L,R]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=F.current;if(!e||!I)return;let t=()=>{let t=e.querySelector(`.znx-dh-actions-col`);R(e=>e===t?e:t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0}),()=>n.disconnect()},[I]);let[z,B]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=F.current;if(!e||w!==`auto`||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width??0;t>0&&B(t<T)});return t.observe(e),()=>t.disconnect()},[w,T]);let V=w===`stacked`||w===`auto`&&z===!0,[H,U]=(0,h.useSearchParams)(),W=H.get(`tab`)||P,G=os(),[ee,te]=(0,u.useState)(0),[ne,re]=(0,u.useState)(null),[ie,ae]=(0,u.useState)(()=>new Set([W]));ie.has(W)||ae(new Set([...ie,W]));let oe=(0,u.useMemo)(()=>Oa(e)?.tabs??az,[e]),se=(0,u.useMemo)(()=>N.length?[...oe,...N]:oe,[oe,N]),ce=Fn(se,{id:t,moduleName:e,record:ne}),K=e=>e===`details`||!se.some(t=>t.key===e&&typeof t.visibleWhen==`function`)||ce.some(t=>t.key===e),le=t=>N.find(e=>e.key===t)?.component??as(e,t),ue=(e,t)=>{let n=new URLSearchParams(H);n.set(`tab`,e),U(n,{replace:!0}),C?.(e,t)},de=e=>{re(e),x?.(e)},fe=m+G,pe=()=>te(e=>e+1),me=W===`details`||!K(W)||!le(W),he=k===`below`;return(0,p.jsxs)(`div`,{ref:F,className:`cc-detail${V?` cc-detail--stacked`:``}${he?` cc-detail--tabs-below`:``}`,children:[(0,p.jsxs)(`div`,{className:`cc-detail__toolbar`,children:[(0,p.jsx)(`nav`,{className:`cc-detail__crumbs`,"aria-label":`Breadcrumb`,children:r}),(0,p.jsxs)(`div`,{className:`cc-detail__toolbar-right`,children:[i,E&&!L?E:null,D&&!L?D:null,a,c&&(0,p.jsx)(d.Tooltip,{title:s?O:`Expand`,children:(0,p.jsx)(d.Button,{type:`text`,icon:s?(0,p.jsx)(f.CompressOutlined,{}):(0,p.jsx)(f.ExpandOutlined,{}),"aria-label":s?O:`Expand details`,onClick:c})}),l&&(0,p.jsx)(d.Tooltip,{title:`Close (Esc)`,children:(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),"aria-label":`Close details`,onClick:l})})]})]}),(0,p.jsxs)(`div`,{className:`cc-detail__scroll`,children:[(0,p.jsx)(ns,{moduleName:e,customConfigName:n,id:t,defaultTab:W,onAction:S,onTabChange:ue,onHeaderData:b,onRecordLoaded:de,refreshKey:fe}),E&&L?(0,_.createPortal)((0,p.jsx)(`div`,{className:`cc-detail__header-slot`,children:E}),L):null,D&&L?(0,_.createPortal)((0,p.jsx)(`div`,{className:`cc-detail__header-end`,children:D}),L):null,he&&ce.length>0&&(0,p.jsx)(sz,{tabs:ce,activeKey:me?`details`:W,onChange:e=>ue(e),max:A,alwaysShowMore:j,moreEmptyLabel:M}),o,(0,p.jsx)(`div`,{className:`cc-detail__tab cc-detail__details v1-detail-page`,hidden:!me,children:(me||ie.has(`details`))&&(0,p.jsxs)(d.Row,{gutter:[16,16],align:`stretch`,className:`v1-detail-row`,children:[(0,p.jsx)(d.Col,{xs:24,xl:V?24:16,className:`v1-detail-col-main`,children:(0,p.jsx)(Xi,{moduleName:e,id:t,refreshKey:ee+fe,onDescriptionSaved:pe})}),(0,p.jsx)(d.Col,{xs:24,xl:V?24:8,className:`v1-detail-col-rail`,children:(0,p.jsx)(ln,{moduleName:e,id:t,users:y,showActivity:g,showNotes:v,refreshKey:fe})})]})}),[...ie].filter(e=>e!==`details`).map(n=>{let r=K(n)?le(n):null;return r?(0,p.jsx)(`div`,{className:`cc-detail__tab`,hidden:n!==W,children:(0,p.jsx)(oz,{component:r,id:t,moduleName:e,onDescriptionSaved:pe,record:ne})},n):null})]})]})}function lz({items:e=[]}){return(0,p.jsx)(`ol`,{className:`cc-crumbs`,children:e.map((t,n)=>(0,p.jsxs)(`li`,{className:`cc-crumbs__item`,children:[n>0&&(0,p.jsx)(f.RightOutlined,{className:`cc-crumbs__sep`,"aria-hidden":!0}),t.onClick?(0,p.jsx)(`button`,{type:`button`,className:`cc-crumbs__link`,onClick:t.onClick,children:t.label}):(0,p.jsx)(`span`,{"aria-current":n===e.length-1?`page`:void 0,children:t.label})]},`${t.label}-${n}`))})}function uz(e,t,{max:r=12,refreshKey:i=0}={}){let a=`${e}|${t}|${i}`,[o,s]=(0,u.useState)({key:``,groups:null,error:null});return(0,u.useEffect)(()=>{if(!e||!t)return;let r=!1;return n.Yt({module:e,id:t,view:`detail`}).then(e=>{r||s({key:a,groups:Array.isArray(e)?e:[],error:null})}).catch(e=>{r||s({key:a,groups:null,error:e})}),()=>{r=!0}},[e,t,a]),{fields:(0,u.useMemo)(()=>ZP(o.groups,r),[o.groups,r]),loading:o.key!==a,error:o.error}}function dz({open:e,title:t,extra:n=null,footer:r=null,onClose:i,width:a=320,className:o=``,children:s}){let c=(0,u.useRef)(null);return(0,u.useEffect)(()=>{e&&c.current?.focus({preventScroll:!0})},[e]),e?(0,p.jsxs)(`aside`,{ref:c,className:`cc-side-panel ${o}`.trim(),style:{"--cc-side-panel-w":`${a}px`},"aria-label":typeof t==`string`?t:`Quick view`,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.stopPropagation(),i?.())},children:[(0,p.jsxs)(`header`,{className:`cc-side-panel__head`,children:[(0,p.jsx)(`span`,{className:`cc-side-panel__title`,children:t}),(0,p.jsxs)(`span`,{className:`cc-side-panel__extra`,children:[n,(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.CloseOutlined,{}),"aria-label":`Close quick view`,onClick:i})]})]}),(0,p.jsx)(`div`,{className:`cc-side-panel__body`,children:s}),r&&(0,p.jsx)(`footer`,{className:`cc-side-panel__foot`,children:r})]}):null}function fz({open:e,moduleName:t,title:n,width:r=760,onClose:a,onCreated:o,formProps:s={}}){return(0,p.jsx)(d.Drawer,{open:e,title:n??`Add`,size:r,placement:`right`,onClose:a,mask:{closable:!1},keyboard:!1,destroyOnHidden:!0,className:`cc-add-drawer`,styles:{body:{paddingTop:8}},children:e&&t&&(0,p.jsx)(i.t,{...s,moduleName:t,embedded:!0,onCancel:a,onSuccess:(e,t)=>{o?.(e,t),a?.()}})})}var pz=`q`,mz=`f`,hz=`view`,gz=`lp`,_z=`full`,vz=[];function yz(e){if(e.get(hz)===_z)return;let t=RP(e);t>1&&e.set(gz,String(t)),[...e.keys()].filter(e=>/^p\d+$/.test(e)).forEach(t=>e.delete(t))}var bz={open:`Live`,connecting:`Connecting…`,reconnecting:`Reconnecting…`,unauthorized:`Live updates paused`,idle:`Live`};function xz(e){return e===`open`?`is-open`:e===`reconnecting`||e===`connecting`?`is-reconnecting`:``}function Sz(){try{return Number(localStorage.getItem(`userId`))||0}catch{return 0}}function Cz({listModule:e,detailModule:t,detailConfigName:n,title:r,basePath:i,listTabs:a,recordParam:o=`id`,searchPlaceholder:s=`Search…`,searchFields:c,createActions:l,relatedTopics:f=vz,quickViewTitle:m=`Quick View`,quickViewWidth:g=420,renderQuickViewExtra:_,renderQuickView:v,renderFullView:y,renderFullViewStats:b,fullViewBreadcrumbLabel:x=`Details`,listProps:S,topBarInFullView:C=!0,showTopBarSearch:w=!0,openRecordIn:T=`quick`,quickViewMode:E=`docked`,defaultRailCollapsed:D=!1,showRail:O=!0,listComponent:k,actionsInListToolbar:A=!1}){let{tab:j}=(0,h.useParams)(),M=(0,h.useNavigate)(),[N,P]=(0,h.useSearchParams)(),F=Array.isArray(a)&&a.length>0,I=F?a.find(e=>e.toLowerCase()===String(j??``).toLowerCase()):void 0,L=N.get(o)||``,R=T===`full`,z=!!L&&(R||N.get(hz)===_z),B=E===`overlay`,[V,H]=(0,u.useState)(D),U=N.get(pz)||``,W=N.get(mz)||``,G=(0,u.useMemo)(()=>EP(W),[W]),[ee,te]=(0,u.useState)(null),[ne,re]=(0,u.useState)(0),ie=os(),ae=fI({topics:[UF(e)]}),oe=fI({topics:L?[WF(e,L)]:vz,enabled:!!L}),se=fI({topics:L?[...f,WF(e,L)]:vz,enabled:!!L}),ce=cI(),{fetchData:K,loading:le}=IP({filters:G,search:U,refreshTick:ae.tick+ne}),ue=Sz(),de=oe.lastEvent,fe=de&&de.actorId&&de.actorId!==ue?de.eventId:null,[pe,me]=(0,u.useState)(null),he=fe&&fe!==pe?fe:null;(0,u.useEffect)(()=>{if(!he)return;let e=setTimeout(()=>me(he),6e3);return()=>clearTimeout(e)},[he]);let q=(0,u.useCallback)((e,{replace:t=!1,resetPage:n=!1}={})=>{let r=new URLSearchParams(N);e(r),n&&(r=zP(r,1)),r.toString()!==N.toString()&&P(r,{replace:t})},[N,P]),ge=(0,u.useCallback)(e=>{e&&q(t=>{t.get(o)!==e&&(t.set(o,e),t.delete(`tab`),t.delete(`subTab`)),R?(yz(t),t.set(hz,_z)):t.delete(hz)})},[R,o,q]),_e=(0,u.useCallback)(e=>{let t=e&&typeof e==`object`&&typeof e.tab==`string`?e.tab:``;q(e=>{yz(e),e.set(hz,_z),t&&(e.set(`tab`,t),e.delete(`subTab`))})},[q]),ve=e=>{if(e.get(hz)!==_z&&!e.has(gz))return;let t=Number(e.get(gz))||1;[...e.keys()].filter(e=>/^p\d+$/.test(e)).forEach(t=>e.delete(t)),e.delete(gz),t>1&&e.set(`p${t}`,``)},ye=(0,u.useCallback)(()=>{q(e=>{ve(e),e.delete(hz),e.delete(`tab`),e.delete(`subTab`)})},[q]),J=(0,u.useCallback)(()=>{q(e=>{ve(e),e.delete(o),e.delete(hz),e.delete(`tab`),e.delete(`subTab`)})},[o,q]),be=(0,u.useCallback)(e=>{q(t=>{e?t.set(pz,e):t.delete(pz)},{replace:!0,resetPage:!0})},[q]),xe=(0,u.useCallback)(e=>{SP(e)!==SP(G)&&q(t=>{let n=TP(e);n?t.set(mz,n):t.delete(mz)},{resetPage:!0})},[G,q]),Se=(0,u.useCallback)(e=>{if(!F)return;let t=a.find(t=>t.toLowerCase()===String(e??``).trim().toLowerCase());if(!t||t===I)return;let n=zP(N,1).toString();M({pathname:`${i}/${t}`,search:n?`?${n}`:``})},[i,F,I,a,M,N]),Ce=(0,u.useMemo)(()=>l?.primary?[l.primary,...l.menu??[]]:[],[l]),we=(0,u.useCallback)(e=>{let t=Ce.find(t=>t.key===e);if(!t)return;let n=typeof t.formProps==`function`?t.formProps({recordId:L}):t.formProps;te({...t,resolvedFormProps:n??void 0})},[Ce,te,L]),Te=(0,u.useCallback)(e=>{d.message.success(`${String(ee?.label??`Record`).replace(/^Add\s+/i,``)} created`),re(e=>e+1),ee?.openCreatedRecord&&e&&ge(String(e))},[ee,ge,re]),Ee=(0,u.useMemo)(()=>({moduleName:e,...F?{selectedSource:I,onTabChange:Se}:{},fetchData:K,searchFields:c,showSearch:!1,showFilterButton:!1,showAdd:!1,showViewToggle:!1,autoCardForExternalRows:!1,showSummaryButton:!0,...S??{}}),[e,F,I,Se,K,c,S]),De=(0,u.useMemo)(()=>A?(0,p.jsxs)(`span`,{className:`cc-list-toolbar-actions`,children:[ce!==`disabled`&&(0,p.jsxs)(`span`,{className:`cc-live-pill`,"aria-live":`polite`,children:[(0,p.jsx)(`span`,{className:`cc-live-dot ${xz(ce)}`}),bz[ce]??`Offline`]}),(0,p.jsx)(YR,{primaryAction:l?.primary??null,menuActions:l?.menu??[],onAction:we,size:`middle`})]}):null,[A,ce,l,we]),Oe=(0,u.useMemo)(()=>De?{...Ee,toolbarExtra:De}:Ee,[Ee,De]);if(F&&!I){let e=N.toString();return(0,p.jsx)(h.Navigate,{to:{pathname:`${i}/${a[0]}`,search:e?`?${e}`:``},replace:!0})}let ke=he?(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,message:`This record was just updated by someone else — the view has been refreshed.`,style:{margin:`0 0 12px`}}):null,Ae={id:L,listTab:I,isFull:z,recordTick:oe.tick+ne+ie,relatedTick:se.tick+ne+ie,onOpenFull:_e,onBackToQuick:R?null:ye,onClose:J,updatedBanner:ke,renderCreateButton:(e={})=>(0,p.jsx)(YR,{primaryAction:l?.primary??null,menuActions:l?.menu??[],onAction:we,...e})},je=null;L&&!z?je=v?v(Ae):(0,p.jsx)(eF,{moduleName:t,configName:n,id:L,title:m,refreshKey:Ae.recordTick,onOpenFull:_e,onClose:J,extra:_?_(Ae):null},L):L&&z&&(je=y?y(Ae):(0,p.jsx)(cz,{moduleName:t,customConfigName:n,id:L,expanded:!0,onToggleExpand:R?void 0:ye,collapseLabel:`Back to quick view`,onClose:J,refreshKey:Ae.recordTick,banner:ke,headerEndSlot:C?null:Ae.renderCreateButton({size:`middle`}),stats:b?b(Ae):null,breadcrumb:(0,p.jsx)(lz,{items:[{label:r,onClick:J},{label:x}]})},L));let Me=xz(ce);return(0,p.jsxs)(`div`,{className:`cc-module-workspace${k?` cc-module-workspace--host-list`:``}`,children:[(0,p.jsx)(JR,{ariaLabel:r,detailMode:`window`,defaultDetailWidth:g,minDetailWidth:340,maxDetailWidthRatio:.6,widthStorageKey:`cc-quickview-width:${e}`,detailOpen:B?z:!!L,detailExpanded:z,onCloseDetail:z&&!R?ye:J,railCollapsed:V,topBar:z&&!C||!z&&A?null:(0,p.jsx)(XR,{title:r,searchValue:U,onSearch:be,searchPlaceholder:s,showSearch:w,primaryAction:l?.primary??null,menuActions:l?.menu??[],onAction:we,extra:ce!==`disabled`&&(0,p.jsx)(d.Tooltip,{title:`Changes made by others appear here automatically`,children:(0,p.jsxs)(`span`,{className:`cc-live-pill`,"aria-live":`polite`,children:[(0,p.jsx)(`span`,{className:`cc-live-dot ${Me}`}),bz[ce]??`Offline`]})})}),rail:O?(0,p.jsx)(kP,{moduleName:e,scope:I??``,value:G,onChange:xe,collapsed:V,onExpand:()=>H(!1),onCollapse:()=>H(!0)}):null,list:z?null:(0,p.jsx)(VP,{component:k,listProps:Oe,loading:le,selectedRecordId:L||void 0,onOpenRecord:ge}),detail:B&&!z?null:je}),B&&(0,p.jsx)(HP,{open:!!L&&!z,onClose:J,width:g,ariaLabel:m,children:z?null:je}),(0,p.jsx)(fz,{open:!!ee,moduleName:ee?.moduleName,title:ee?.title,onClose:()=>te(null),onCreated:Te,formProps:ee?.resolvedFormProps})]})}var wz=[];function Tz(e){let t=[e,e?.data,e?.data?.data],n=t.map(e=>e?.total??e?.pagination?.total).find(e=>Number.isFinite(Number(e))&&e!==null&&e!==``),r=t.map(e=>e?.tabs).find(Array.isArray)??wz;return{total:n===void 0?null:Number(n),tabs:r}}var Ez=[`module:candidates`,`module:submissions`];function Dz({listProps:e,moduleName:t,filterModule:n,renderQuickView:r,quickViewWidth:i=340,railWidth:a=240,liveTopics:o=Ez,renderHeader:s,resultsTitle:c,fallbackView:l,preferredView:d,viewSource:f=`default`,fill:m=!1,quickViewMode:g=`docked`,defaultRailCollapsed:_=!1,collapsedRailWidth:v=44,showRail:y=!0}){let[b,x]=(0,u.useState)(_),[S,C]=(0,u.useState)(wz),[w,T]=(0,u.useState)(``),[E,D]=(0,u.useState)(null),[O,k]=(0,u.useState)({total:null,tabs:wz,durationMs:null}),A=fI({topics:o,enabled:!!e?.fetchData,debounceMs:800}),j=e?.fetchData,{fetchData:M,loading:N}=IP({filters:S,baseFetch:(0,u.useMemo)(()=>typeof j==`function`?async(...e)=>{let t=typeof performance<`u`?performance.now():Date.now(),n=await j(...e),r=typeof performance<`u`?performance.now():Date.now();return k({...Tz(n),durationMs:Math.max(0,r-t)}),n}:j,[j]),refreshTick:A.tick}),[P,F]=(0,h.useSearchParams)(),I=(0,u.useCallback)(e=>{if(SP(S)===SP(e))return;C(e),D(null);let t=zP(P,1);t.toString()!==P.toString()&&F(t,{replace:!0})},[S,P,F]),L=(0,u.useMemo)(()=>({...e??{},fetchData:M,showFilterButton:!1,...l&&f==="default"?{activeView:l}:{},...d&&f!==`user`?{activeView:d}:{},onTabChange:t=>{T(String(t??``)),D(null),e?.onTabChange?.(t)}}),[e,M,l,d,f]),R=E&&typeof r==`function`?r({id:E.id,record:E.record,onClose:()=>D(null)}):null;if(!e?.fetchData)return null;let z=g===`overlay`,B=!!R&&!z,V=typeof s==`function`?s({total:O.total,tabs:O.tabs,durationMs:O.durationMs,loading:N}):null;return(0,p.jsxs)(`div`,{className:`cc-search-ws${B?` cc-search-ws--quick`:``}${b?` cc-search-ws--rail-collapsed`:``}${y?``:` cc-search-ws--no-rail`}${V?` cc-search-ws--head`:``}${m?` cc-search-ws--fill`:``}`,style:{"--cc-search-rail-w":`${b?v:a}px`,"--cc-search-quick-w":`${i}px`},children:[V&&(0,p.jsx)(`div`,{className:`cc-search-ws__head`,children:V}),y&&(0,p.jsx)(`div`,{className:`cc-search-ws__rail`,children:(0,p.jsx)(kP,{moduleName:n||t,scope:w,value:S,onChange:I,title:`Filters`,collapsed:b,onExpand:()=>x(!1),onCollapse:()=>x(!0)})}),(0,p.jsxs)(`div`,{className:`cc-search-ws__results`,children:[typeof c==`function`&&O.total!==null&&(0,p.jsx)(`div`,{className:`cc-search-ws__results-title`,children:c(O.total)}),(0,p.jsx)(VP,{listProps:L,loading:N,selectedRecordId:E?.id,onOpenRecord:(e,t)=>D({id:String(e),record:t??null})})]}),B&&(0,p.jsx)(`div`,{className:`cc-search-ws__quick`,children:R}),z&&(0,p.jsx)(HP,{open:!!R,onClose:()=>D(null),width:i,children:R})]})}function Oz(e){return(e??[]).filter(e=>e!=null&&String(e).trim()!==``)}function kz({icon:e=(0,p.jsx)(f.SearchOutlined,{}),title:t=`Search`,criteria:n=[],details:r=[],badge:i=null,onEdit:a,editLabel:o=`Edit Search`,expanded:s=!1,onToggle:c,className:l=``}){let u=Oz(n),m=Oz(r);return(0,p.jsxs)(`section`,{className:`cc-search-summary ${l}`.trim(),"aria-label":`${t} summary`,children:[(0,p.jsx)(`span`,{className:`cc-search-summary__icon`,"aria-hidden":!0,children:e}),(0,p.jsxs)(`div`,{className:`cc-search-summary__text`,children:[(0,p.jsxs)(`div`,{className:`cc-search-summary__title`,children:[(0,p.jsxs)(`span`,{className:`cc-search-summary__lead`,children:[t,u.length?`:`:``]}),u.map((e,t)=>(0,p.jsx)(`span`,{className:`cc-search-summary__part`,children:e},`${e}-${t}`))]}),m.length>0&&(0,p.jsx)(`div`,{className:`cc-search-summary__details`,children:m.map((e,t)=>(0,p.jsx)(`span`,{className:`cc-search-summary__part`,children:e},`${e}-${t}`))})]}),(0,p.jsxs)(`div`,{className:`cc-search-summary__actions`,children:[i,a&&(0,p.jsx)(d.Button,{className:`cc-search-summary__edit`,onClick:a,children:o}),c&&(0,p.jsx)(d.Tooltip,{title:s?`Hide search form`:`Show search form`,children:(0,p.jsx)(d.Button,{className:`cc-search-summary__toggle`,icon:s?(0,p.jsx)(f.UpOutlined,{}):(0,p.jsx)(f.DownOutlined,{}),"aria-label":s?`Hide search form`:`Show search form`,"aria-expanded":s,onClick:c})})]})]})}function Az(...e){try{for(let t of e){let e=(localStorage.getItem(t)||``).trim();if(e)return e}}catch{}return``}function jz(e){return String(e||``).split(` `).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Mz(e){let t=String(e||``).split(` `).filter(Boolean);return t.length?`${t[0].charAt(0)}${t.length>1?t.at(-1).charAt(0):``}`.toUpperCase():`U`}function Nz(e){let t=`url("${String(e).replace(/"/g,`%22`)}")`;return{WebkitMaskImage:t,maskImage:t}}function Pz(){return(0,p.jsxs)(`span`,{className:`cc-frame__logo`,"aria-label":`Zinnext`,children:[(0,p.jsx)(`span`,{className:`cc-frame__logo-icon`,style:Nz(Tp)}),(0,p.jsx)(`span`,{className:`cc-frame__logo-text`,style:Nz(Ep)})]})}function Fz({value:e=``,placeholder:t,onSearch:n}){let[r,i]=(0,u.useState)(e),[a,o]=(0,u.useState)(e);return e!==a&&(o(e),i(e)),(0,p.jsx)(d.Input,{className:`cc-frame__search-input`,allowClear:!0,prefix:(0,p.jsx)(f.SearchOutlined,{"aria-hidden":!0}),placeholder:t,"aria-label":t,value:r,onChange:e=>{i(e.target.value),e.target.value===``&&n?.(``)},onPressEnter:()=>n?.(r.trim())})}function Iz({navItems:e=[],brand:n=null,search:r=null,headerExtra:i=null,user:a=null,userMenuItems:o=[],loginPath:s=`/login`,children:c}){let l=(0,h.useLocation)(),m=(0,h.useNavigate)(),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(l.pathname);v!==l.pathname&&(y(l.pathname),_(!1));let b=jz(a?.name||Az(`userName`,`preferred_Username`)||`User`),x=a?.subtitle??Az(`roleName`,`userRoleName`),S=[...o,...o.length?[{type:`divider`}]:[],{key:`cc-frame-logout`,icon:(0,p.jsx)(f.LogoutOutlined,{}),danger:!0,label:`Logout`,onClick:()=>{t.g(),m(s,{replace:!0})}}];return(0,p.jsxs)(`div`,{className:`cc-frame${g?` cc-frame--nav-open`:``}`,children:[(0,p.jsxs)(`header`,{className:`cc-frame__header`,children:[(0,p.jsx)(d.Button,{type:`text`,className:`cc-frame__nav-toggle`,icon:(0,p.jsx)(f.MenuOutlined,{}),"aria-label":g?`Close navigation`:`Open navigation`,"aria-expanded":g,onClick:()=>_(e=>!e)}),(0,p.jsx)(`div`,{className:`cc-frame__brand`,children:n??(0,p.jsx)(Pz,{})}),r&&(0,p.jsx)(`div`,{className:`cc-frame__search`,children:(0,p.jsx)(Fz,{value:r.value??``,placeholder:r.placeholder??`Search…`,onSearch:r.onSearch})}),(0,p.jsxs)(`div`,{className:`cc-frame__header-end`,children:[i,(0,p.jsx)(d.Dropdown,{menu:{items:S},trigger:[`click`],placement:`bottomRight`,children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-frame__user`,"aria-label":`Open user menu`,children:[(0,p.jsx)(d.Avatar,{size:40,className:`cc-frame__avatar`,children:Mz(b)}),(0,p.jsxs)(`span`,{className:`cc-frame__user-text`,children:[(0,p.jsx)(`span`,{className:`cc-frame__user-name`,children:b}),x?(0,p.jsx)(`span`,{className:`cc-frame__user-sub`,children:x}):null]}),(0,p.jsx)(f.DownOutlined,{className:`cc-frame__user-caret`,"aria-hidden":!0})]})})]})]}),(0,p.jsxs)(`nav`,{className:`cc-frame__nav`,"aria-label":`Main`,children:[(0,p.jsx)(`div`,{className:`cc-frame__nav-brand`,children:n??(0,p.jsx)(Pz,{})}),(0,p.jsx)(`ul`,{className:`cc-frame__nav-list`,children:e.map(e=>{let t=typeof e.match==`function`?e.match(l.pathname):l.pathname.startsWith(e.to);return(0,p.jsx)(`li`,{children:(0,p.jsxs)(h.Link,{to:e.to,className:`cc-frame__nav-item${t?` is-active`:``}`,"aria-current":t?`page`:void 0,children:[e.icon?(0,p.jsx)(`span`,{className:`cc-frame__nav-icon`,"aria-hidden":!0,children:e.icon}):null,(0,p.jsx)(`span`,{className:`cc-frame__nav-label`,children:e.label})]})},e.key)})})]}),g&&(0,p.jsx)(`button`,{type:`button`,className:`cc-frame__backdrop`,"aria-label":`Close navigation`,onClick:()=>_(!1)}),(0,p.jsx)(`main`,{className:`cc-frame__main`,children:(0,p.jsx)(`div`,{className:`cc-frame__content`,children:(0,p.jsx)(jm,{loginPath:s,children:(0,p.jsx)(Im,{children:c??(0,p.jsx)(h.Outlet,{})})})})})]})}var Lz=new Intl.NumberFormat;function Rz(e){return e==null||typeof e==`string`&&e.trim()===``}function zz(e,t){let n=(Array.isArray(e?.options)?e.options:[]).find(e=>String(e?.value??e)===String(t));return String(n&&typeof n==`object`?n.label??n.value??t:t)}function Bz(e,t){if(Rz(t))return``;if(typeof t==`boolean`)return t?String(e?.label??e?.field??``):``;if(typeof t==`object`){if(typeof t.format==`function`)return t.format(`DD MMM YYYY`);if(`label`in t||`value`in t)return String(t.label??t.value??``);let e=t.from??t.min??t.start,n=t.to??t.max??t.end;return!Rz(e)||!Rz(n)?[e,n].filter(e=>!Rz(e)).join(`–`):``}return zz(e,t).trim()}function Vz(e={},t=[],{skip:n=[]}={}){let r=new Set(n);return(t??[]).flatMap(t=>{let n=t?.field;if(!n||r.has(n))return[];let i=e?.[n];if(Rz(i))return[];if(El(t)){let{terms:e,expression:t}=Tl(i),n=e.map(e=>e.value).filter(Boolean);return n.length?[n.join(`, `)]:t.trim()?[t.trim()]:[]}if(Array.isArray(i)){let e=i.map(e=>Bz(t,e)).filter(Boolean);return e.length?[e.join(`, `)]:[]}let a=Bz(t,i);return a?[a]:[]})}function Hz(e){return!Number.isFinite(e)||e<0?``:e<1e4?`${(e/1e3).toFixed(1)} seconds`:`${Math.round(e/1e3)} seconds`}function Uz(e){return Number.isFinite(e)?Lz.format(e):``}function Wz({enabled:e=!0,children:t}){let[n]=(0,u.useState)(()=>e?eI():null);return(0,u.useEffect)(()=>{if(!n)return;tI();let e=()=>n.nudge(),t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`online`,e),document.removeEventListener(`visibilitychange`,t),nI()}},[n]),(0,p.jsx)(YF.Provider,{value:n,children:t})}async function Gz(e,t,n,r={}){return Kz(e,aF(t,n),r)}async function Kz(e,t,{limit:r=20,offset:i=0,sort:a=``,sortDir:o=``}={}){let s=Array.isArray(t)?t.filter(e=>e?.field):[];if(!e||s.length===0)return{rows:[],total:0};let c=await n.$t(e,r,i,{sort:a,sortDir:o,scopeConditions:s}),l=n.kt(c,e);return{rows:Array.isArray(l?.rows)?l.rows:[],total:Number(l?.total)||0}}typeof window<`u`&&(window.__CORE_THEME_BUILD__=`2026-11-11T09:54:09.835Z`);var qz=ak,Jz=hh(bM),Yz=hh(SM),Xz=hh(LM),Zz=hh(YM),Qz=hh(iN),$z=hh(sN),eB=hh(uN),tB=hh(pN),nB=hh(hN),rB=hh(ON),iB=hh(AN);exports.ACTION_RULE_SURFACES=n.At,exports.ADMIN_API_URL=t.y,exports.ADMIN_APP_ID=t.b,exports.APP_ID=t.x,exports.AUTH_URL=t.S,exports.ActionInputBox=HI,exports.ActivityNotesCard=ln,exports.ActivityTab=rn,exports.AddBatchCandidatePopup=PO,exports.AddFormV1=i.t,exports.AddRecordDrawer=fz,exports.AdminDashboard=ak,exports.AdminDashboardContent=jC,exports.AdminPage=qz,exports.AppAlert=c.a,exports.AppButton=n.Kn,exports.AppShell=Rm,exports.ApprovalActionBar=Gd,exports.AssigneeAvatars=un,exports.AuthGuard=jm,exports.BILLING_STATUS_FLOW=Qa,exports.BOOLEAN_API_KEYS=ju,exports.BOOLEAN_PARSEABLE_API_KEYS=gl,exports.BUILT_IN_WIZARD_STEP_TYPES=n.et,exports.BULK_UPLOAD_DEFAULT_ACCEPT=dn,exports.BULK_UPLOAD_DEFAULT_MAX_SIZE_MB=fn,exports.Breadcrumb=n.Dt,exports.BulkUploadPage=Xz,exports.BulkUploadPanel=bn,exports.CANDIDATES_URL=t.C,exports.CONTRACT_C2C=gf,exports.CONTRACT_W2=hf,exports.CURRENCY_SYMBOLS=Ur,exports.CalendarCard=j,exports.CombinedDashboardPage=rR,exports.DASHBOARDPAGE=rR,exports.CombinedDetailViewPage=vL,exports.DETAILVIEWPAGE=vL,exports.CombinedHomePage=iL,exports.HOMEPAGE=iL,exports.CompactRecordList=iz,exports.CoreThemeAdminApp=FC,exports.CoreThemeAdminRoutes=PC,exports.CreateActionButton=YR,exports.CustomPagination=n.ci,exports.DEFAULT_HOURS_POLICY=pd,exports.DEFAULT_RESULTS_VIEW=Du,exports.DETAILSSECTION=HR,exports.DetailsSection=HR,exports.DETAILS_BLOCKS=FR,exports.DETAILS_ICONS=iR,exports.DayLogModal=Ld,exports.DescriptionBlock=Nn,exports.DetailHeaderCard=ns,exports.DetailViewPage=ls,exports.DetailViewV1=Xi,exports.DocumentViewer=r.t,exports.DynamicCards=It,exports.DynamicPopup=nE,exports.DynamicPopupRoute=zO,exports.DynamicTabs=n.di,exports.DynamicWizard=uc,exports.EditFormV1=ic,exports.FIELD_TYPE_REGISTRY=Zl,exports.FINANCE_APPROVAL_CONFIG=sf,exports.FINANCE_TYPE_CFO=$d,exports.FINANCE_TYPE_ONBOARDING_MANAGER=Qd,exports.FINANCE_TYPE_ONBOARDING_MANAGER_REAPPROVE=nf,exports.FINANCE_TYPE_ONLY_FINANCE=ef,exports.FINANCE_TYPE_SUBMISSION_MANAGER=Zd,exports.FINANCE_TYPE_SUBMISSION_MANAGER_REAPPROVE=tf,exports.FileListCard=xp,exports.FilterRail=kP,exports.FinanceApprovalPanel=ep,exports.FinanceAvatar=Po,exports.FinanceBadge=Ro,exports.FinanceDayCell=qd,exports.FinanceDivider=Eo,exports.FinanceEmployeeCell=Fo,exports.FinanceEmptyState=Co,exports.FinanceEquation=Do,exports.FinanceHistoryTimeline=jo,exports.FinanceHoursGrid=So,exports.FinanceKpiRow=xo,exports.FinanceLine=To,exports.FinanceListToolbar=fd,exports.FinanceMarginBadge=zo,exports.FinanceMoneyCell=Lo,exports.FinanceRecordsTable=Ho,exports.FinanceRowChevron=Bo,exports.FinanceSection=wo,exports.FinanceStatusPill=bo,exports.FinanceTextCell=Io,exports.FinanceTimesheetAnalysis=Yd,exports.FinanceWorkflowSteps=Oo,exports.HOURS_MESSAGES=md,exports.Header=Xp,exports.HierarchyUserFilter=Vt,exports.HubOverview=aL,exports.JOBS_URL=t.w,exports.LegacyAdminPage=Jz,exports.ListView=n.rt,exports.ListWithQuickView=UP,exports.LmsHomePage=iB,exports.LmsTestForm=rB,exports.Login=zm,exports.MATCH_NOTHING=tF,exports.MailPopup=fw,exports.ManageModules=$z,exports.ManageSubmodules=eB,exports.MasterDetailWorkspace=JR,exports.ModuleRowActions=Tc,exports.ModuleWorkspace=Cz,exports.NotesPanel=Wd,exports.NotesTab=cn,exports.OPEN_AS_OPTIONS=vu,exports.PAGE_ICONS=pI,exports.PAYROLL_STATUS_FLOW=$a,exports.POPUP_CONFIGS=TO,exports.PanelBreadcrumb=lz,exports.PanelTabs=sz,exports.ParamCardView=Yc,exports.ParamListView=tl,exports.PaymentInvoicePopup=YO,exports.PeriodBadgeTag=Ed,exports.PreviewPopup=Uw,exports.ProjectSelect=mh,exports.ProofUploadPreview=Ud,exports.QuickLogBar=Bd,exports.QuickLogSelectionBar=Rd,exports.QuickViewCard=rL,exports.QuickViewModuleActions=WI,exports.QuickViewPopover=HP,exports.RAIL_KIND=oP,exports.REALTIME_STATUS=VF,exports.RESULTS_VIEW_OPTIONS=Eu,exports.RealtimeProvider=Wz,exports.RecordDetailPanel=cz,exports.RecordHub=fL,exports.RecordQuickView=eF,exports.RecordSidePanel=dz,exports.RejectionReasonModal=zd,exports.RelatedModuleTab=jF,exports.SUBMISSIONS_URL=t.E,exports.SearchBuilderV1=rd,exports.SearchResultsWorkspace=Dz,exports.SearchSummaryBanner=kz,exports.SettingsPage=Sj,exports.Sidebar=Dm,exports.StatStrip=c.i,exports.StatusBadge=ad,exports.StatusBadgeTag=Td,exports.StickyNotesFullPage=Yz,exports.StylishDynamicTabs=sd,exports.TemplateEditor=ld,exports.TestForm=Zz,exports.TestingHomePage=nB,exports.TimelineGroups=Yt,exports.TimesheetDayCell=Pd,exports.TipTapEditor=n.si,exports.UserForm=ik,exports.VendorShareDrawer=UO,exports.ViewSummaryWidget=n.Et,exports.WIZARD_ACTIONS_CONTRACT_VERSION=n.N,exports.WIZARD_ACTIONS_PATH=n.P,exports.WIZARD_CONTENT_TYPES=n.L,exports.WizardAccessMatrixStep=n.R,exports.WizardActionError=n.F,exports.WizardActivityStep=n.z,exports.WizardChoiceCardsStep=n.B,exports.WizardDeclarationStep=n.V,exports.WizardListStep=n.H,exports.WizardPermissionMatrixStep=n.q,exports.WizardPopup=Yw,exports.WizardPreview=n.U,exports.WizardPreviewStep=n.J,exports.WizardStepContent=n.W,exports.WizardSuccessStep=n.G,exports.WizardUnknownContentStep=n.K,exports.WorkspaceAppFrame=Iz,exports.WorkspaceListView=VP,exports.WorkspaceTopBar=XR,exports.ZinnextTableView=tB,exports.ZinnextTestForm=Qz,exports.actedRecently=n.it,exports.actionRuleConditionMatches=n.Mt,exports.adminActionAllowed=Bc,exports.appNow=n.fi,exports.applyIntegrationStatus=n.Oi,exports.approveSubmission=q,exports.attentionItems=SL,exports.buildAcceptAttr=_n,exports.buildBooleanRequest=Iu,exports.buildCsv=mo,exports.buildDailyRows=so,exports.buildDayGradient=Md,exports.buildFormWizardSteps=n.in,exports.buildRateHistoryEntries=Vf,exports.buildRelationConditions=aF,exports.buildSearchRequest=Vu,exports.buildWeeklyRollup=uo,exports.canonicalModule=HF,exports.clearNewRecord=n.at,exports.clearSelectedProject=t.i,exports.colors=n.ui,exports.computeFinance=Nf,exports.computeHoursPolicy=bd,exports.computeMarginBand=fo,exports.conditionMatches=n.r,exports.configureCoreTheme=t.D,exports.configuredFieldLabel=n.i,exports.configuredWizardSteps=sc,exports.confirmAction=n.pt,exports.countActiveRows=xP,exports.createAllWorkflowsListFetcher=rP,exports.createMergedListFetcher=ZN,exports.createModuleListFetchAdapter=WN,exports.createRealtimeClient=JF,exports.createWorkflowStageListFetcher=QN,exports.currencySymbol=Wr,exports.dashboardRange=yL,exports.defaultMergeRow=IN,exports.deleteIntegrationConfig=n.zi,exports.deriveDayStats=oo,exports.describeCapacity=Sd,exports.displayText=$R,exports.downloadCsv=vo,exports.draftToRows=yP,exports.evaluateShowIfWith=n.a,exports.fetchJsonWithAuth=t.o,exports.fetchRelatedRecords=Gz,exports.fetchScopedRecords=Kz,exports.fillConfirmText=n.ht,exports.findEmployerRow=Df,exports.flattenGroups=Tf,exports.formatAmount=Xr,exports.formatApp=n.pi,exports.formatAppDateTime=n.mi,exports.formatFileSize=gn,exports.formatFinanceMoney=Hf,exports.formatHours=Ua,exports.formatMoney=Zr,exports.formatPercent=Ga,exports.formatRate=Qr,exports.formatSearchCount=Uz,exports.formatSearchDuration=Hz,exports.getActivity=n.Xr,exports.getAllWorkflowsModuleList=iP,exports.getAppTimeZone=n.hi,exports.getApprovalDate=Ya,exports.getBgcIntegrationConfig=n.ra,exports.getBgcIntegrationSummary=n.ia,exports.getBillingActionStates=eo,exports.getBooleanEligibleTypes=ru,exports.getCurrentRoleName=t.c,exports.getFieldLabel=go,exports.getFieldType=$l,exports.getFileExtension=hn,exports.getFinanceApprovalConfig=ff,exports.getFormGroups=s.r,exports.getFormGroupsRaw=up,exports.getIntegrationConfig=n.da,exports.getIntegrationConfigs=n.fa,exports.getIntegrationSummary=n.pa,exports.getModuleConfig=Pe,exports.getModuleDataDetail=n.Qr,exports.getPayrollActionStates=to,exports.getPeriodBadgeConfig=Ie,exports.getSearchPopup=hu,exports.getSelectedProject=t.l,exports.getStoredToken=t.u,exports.getStoredUser=t.d,exports.getUserRoles=t.f,exports.getVMSApprove=ge,exports.getValueStyle=_o,exports.getWorkflowStageModuleList=aP,exports.getWorkflowSteps=no,exports.humanizeEvent=Ja,exports.indexFieldConfig=ho,exports.initialsOf=Ka,exports.inputPayload=Zb,exports.insertTokenAtCursor=bl,exports.invalidateGetCache=t.p,exports.isBooleanEligible=eu,exports.isBooleanParsable=vl,exports.isTester=t.m,exports.isWizardConfigEnabled=n.an,exports.isWizardConfigReady=n.on,exports.listPropsForColumns=OI,exports.logout=t.g,exports.makeSearchFetcher=Wu,exports.mapListResponse=n.kt,exports.marginIncludesReferral=mf,exports.markNewRecord=n.ot,exports.matchLocationTax=Mf,exports.mergeWizardSubmitValues=n.sn,exports.moduleTopic=UF,exports.moduleViewAllowed=n.Rt,Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return fs}}),exports.newRecordMarks=n.ct,exports.normalizeConfirm=n.yt,exports.normalizeContract=kf,exports.normalizeInputPrompt=Jb,exports.normalizePageLayout=SI,exports.parseRows=EP,exports.pickCompactFields=nz,exports.quickViewFields=ZP,exports.quickViewValueText=XP,Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return xn}}),exports.rateUnitLabel=Kr,exports.rateUnitShort=Jr,exports.readActionButtons=Su,exports.readPageParam=RP,exports.reconcileHours=xd,exports.recordActionRun=n.lt,exports.recordIdOf=rz,exports.recordTopic=WF,exports.registerFieldType=Ql,exports.registerSearchPopup=mu,exports.registerWizardPreview=n.tt,exports.registerWizardStepType=n.nt,exports.rejectSubmission=ve,exports.relationSignature=sF,exports.resolveActivityMeta=en,exports.resolveAndCompute=Pf,exports.resolveDayKind=vd,exports.resolveFinanceInputs=jf,exports.resolveMergeKey=PN,exports.resolveMergedListKey=PN,exports.resolveOpenAs=bu,exports.resolvePageButtons=xI,exports.resolvePageIcon=mI,exports.resolvePageValue=_I,exports.resolveQuickViewActions=VI,exports.resolveRejectionReason=pf,exports.resolveResultsSearchPlaceholder=Au,exports.resolveResultsView=ku,exports.resolveSubmissionFinance=dp,exports.rowsSignature=SP,exports.rowsToDraft=bP,exports.ruleAppliesToSurface=n.Ft,exports.rulePrimaryAction=n.It,exports.runModuleAction=bc,exports.runWizardAction=n.I,exports.safeWizardActionRoute=n.Y,exports.saveBgcIntegrationConfig=n.La,exports.saveIntegrationConfig=n.Ba,exports.scopeConditionsFor=mF,exports.searchCriteriaParts=Vz,exports.serializeRows=TP,exports.setSelectedProject=t.v,exports.showIfConditions=n.s,exports.stageCountKey=$N,exports.supportsAnyOf=pF,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Bm}}),exports.testIntegrationConnection=n.Ja,exports.toApp=n._i,exports.toNumber=Yr,exports.toRailFields=mP,exports.topicsForEvent=KF,exports.tzLabel=n.vi,exports.tzShortLabel=n.yi,exports.unregisterSearchPopup=gu,exports.unscopedConditions=oF,exports.useAdminAction=Hc,exports.useAdminActionsVersion=Vc,exports.useConfiguredWizardSteps=lc,exports.useDropdownFields=n.Ht,exports.useDropdownValues=n.Tt,exports.useEditForm=Sp,exports.useFieldConfig=n.Ut,exports.useFilterFields=n.Wt,exports.useInPlaceRecordLinks=BP,exports.useLiveRefresh=fI,exports.useMenuPermission=n.zt,exports.useModuleActions=gc,exports.useModuleViewAccess=n.Bt,exports.useNewRecordMarks=n.ut,exports.useRealtimeClient=sI,exports.useRealtimeReconnect=dI,exports.useRealtimeStatus=cI,exports.useRealtimeTopics=uI,exports.useRecordFields=uz,exports.useRecordHub=uL,exports.useRecordRefresh=os,exports.useRelatedCounts=OF,exports.useWorkspaceList=IP,exports.validateBooleanQuery=yl,exports.validateBulkFile=vn,exports.validateInputValue=Xb,exports.withAdminAppId=t.O,exports.withAppId=t.k,exports.withAuthGuard=hh,exports.withPageParam=zP,exports.withSubTab=cF;
|
|
56
|
+
`).map(e=>mc(e))).then(()=>{e||z(L)}),()=>{e=!0}},[L]);let B=L!==``&&R!==L,V=A?(0,p.jsx)(`div`,{className:`cc-progress`,role:`progressbar`,"aria-label":`Refreshing`,style:{position:`absolute`,top:0,left:0,right:0}}):null,H=yI(vI(e?.title,N,I))||`Quick View`,U=e?.header===!1?null:(0,p.jsxs)(d.Flex,{justify:`space-between`,align:`center`,children:[(0,p.jsx)(KI,{level:5,style:{margin:0},children:H}),(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),onClick:i,"aria-label":`Close quick view`})]});if(!e)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,style:{padding:16},children:[U,(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`No Quick View is configured for "${t}".`})]});if(!N.record&&!M)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,style:{padding:16},children:[U,(0,p.jsx)(d.Skeleton,{active:!0,avatar:!0,paragraph:{rows:8}})]});if(!N.record)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,style:{padding:16},children:[U,(0,p.jsx)(d.Alert,{type:`error`,showIcon:!0,message:`This record could not be loaded.`})]});if(typeof e.render==`function`)return(0,p.jsxs)(d.Flex,{vertical:!0,gap:14,style:O?{padding:16,position:`relative`}:{padding:16},"aria-label":H,"aria-busy":A||void 0,role:`region`,children:[V,U,M?e.render(N,I):(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:6}})]});let W=xI(e.quickActions,N,I),G=hI(e.sections).filter(e=>e&&bI(e,N,I)),ee=hI(e.footer??(a?[{key:`full`,label:`Open full details`,onClick:()=>a()}]:[])).filter(e=>e&&$(e.key)).map(e=>e.moduleActions&&typeof e.moduleActions==`object`?bI(e,N,I)?{key:String(e.key),moduleActions:e.moduleActions}:null:xI([e],N,I)[0]??null).filter(Boolean),te=e.stickyFooter===!0,ne=te?{padding:`16px 16px 0`,minHeight:`100%`,boxSizing:`border-box`}:{padding:16},re=te?{position:`sticky`,bottom:0,zIndex:2,marginTop:`auto`,padding:`12px 0 16px`,background:`var(--ant-color-bg-container, #fff)`,borderTop:`1px solid var(--ant-color-split, rgba(5, 5, 5, 0.06))`}:void 0;return(0,p.jsxs)(d.Flex,{vertical:!0,gap:14,style:O?{...ne,position:`relative`}:ne,"aria-label":H,"aria-busy":A||void 0,role:`region`,children:[V,U,e.identity&&(0,p.jsx)($I,{spec:e.identity,data:N,ctx:I}),(0,p.jsx)(eL,{buttons:W,fb:F}),m.error&&M&&(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`Some details could not be loaded.`}),!M&&(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:4},title:!1}),M&&G.map((e,t)=>(0,p.jsxs)(`div`,{children:[t>0&&(0,p.jsx)(d.Divider,{style:{margin:`0 0 12px`}}),(0,p.jsx)(tL,{section:e,data:N,ctx:I,fb:F})]},e.key??t)),ee.length>0&&(0,p.jsx)(d.Flex,{gap:8,className:te?`cc-qv-footer cc-qv-footer--sticky`:`cc-qv-footer`,style:B?{...re??{},minHeight:`var(--ant-control-height, 32px)`,boxSizing:`content-box`}:re,children:ee.map(t=>t.moduleActions?(0,p.jsx)(WI,{spec:t.moduleActions,data:N,ctx:I,style:{flex:1},feedback:FI(e)},t.key):(0,p.jsx)(`div`,{style:{flex:1},children:(0,p.jsx)(ZI,{button:t,block:!0,fb:F})},t.key))})]})}function iL({config:e,refreshKey:t=0}){let r=(0,h.useNavigate)(),i=(0,h.useLocation)(),a=e??{},o=a.module,s=SI(a.layout),c=a.strictPermissions===!0?{strict:!0,aliases:a.permissionAliases}:void 0,{canView:l,canAdd:f,canEdit:m,canDelete:g}=n.zt(o,c),_=Vc(),[v,y]=(0,u.useState)(0),b=()=>y(e=>e+1),x=a.realtime?typeof a.realtime==`object`?a.realtime:{}:null,S=fI({topics:x?(typeof x.topics==`function`?hI(x.topics({module:o})):[$(o)?UF(o):``]).filter($):[],enabled:!!x,debounceMs:x?.debounceMs??600}),C=t+v+S.tick,w=hI(a.refreshEvents).filter($).join(`|`);(0,u.useEffect)(()=>{if(!w||typeof window>`u`)return;let e=w.split(`|`),t=()=>y(e=>e+1);return e.forEach(e=>window.addEventListener(e,t)),()=>e.forEach(e=>window.removeEventListener(e,t))},[w]);let T={module:o,navigate:r,location:i,refresh:b,can:{view:l,add:f,edit:m,delete:g},adminActionsVersion:_},E=xI(a.buttons,{record:null},T),D=typeof a.fullView==`function`?a.fullView:null,O=(e,t)=>{D&&r(D(t))},k=CI(a.quickView,o),A=({module:e,id:t,record:n,onClose:r,onOpenFull:i})=>k?(0,p.jsx)(rL,{config:k,module:e,id:t,record:n,onClose:r,onOpenFull:D?i:void 0,refreshKey:C,extraCtx:{can:T.can,...a.context??{}}},`${e}:${t}`):null;if(!$(o))return null;let j={presentation:{title:a.title},...OI(a.columns)??{},...a.seenDots===!0?{seenDots:!0}:{},...a.listProps??{}},M=$(a.title)||hI(a.breadcrumb).length||E.length;return(0,p.jsxs)(d.Flex,{vertical:!0,gap:12,children:[M?(0,p.jsxs)(d.Flex,{justify:`space-between`,align:`center`,gap:12,wrap:!0,children:[(0,p.jsxs)(d.Flex,{vertical:!0,gap:4,children:[hI(a.breadcrumb).length>0&&(0,p.jsx)(n.Dt,{items:a.breadcrumb}),$(a.title)&&(0,p.jsx)(d.Typography.Title,{level:4,style:{margin:0},children:a.title})]}),E.length>0&&(0,p.jsx)(d.Flex,{gap:8,wrap:!0,children:E.map(e=>{let t=(0,p.jsx)(d.Button,{type:e.type??`primary`,className:e.className,icon:e.icon,danger:e.danger,disabled:e.disabled||!e.onClick,onClick:e.onClick,children:e.label},e.key);return e.tooltip?(0,p.jsx)(d.Tooltip,{title:e.tooltip,children:t},e.key):t})})]}):null,typeof a.top==`function`?a.top(T):a.top??null,(0,p.jsx)(jF,{active:!0,unscoped:!0,fetchData:typeof a.fetch==`function`?a.fetch:null,keepFetchResponse:a.fetchKeepsRows===!0,recordLinks:a.recordLinks===`navigate`||a.quickView===!1?`navigate`:`inPlace`,openInPlace:a.quickView!==!1,module:o,relation:a.scope??{},title:a.title,showRail:s.showRail,railMode:s.railMode,railWidth:s.filterWidth,quickViewMode:s.quickViewMode,quickViewWidth:s.quickViewWidth,listComponent:a.list,listProps:j,renderQuickView:A,onOpenRecord:D?O:void 0,refreshKey:C,keepPageInUrl:a.keepPageInUrl===!0})]})}function aL({tabs:e=[],parentId:t,title:n=`Overview`,refreshKey:r=0}){let[i,a]=(0,h.useSearchParams)(),{counts:o,loading:s}=OF(e,t,r),c=e=>{let t=new URLSearchParams(i);t.set(`tab`,e),t.delete(`sub`),a(t,{replace:!0})};return(0,p.jsx)(`section`,{className:`rh-overview`,"aria-label":n,children:e.map(e=>{let t=o[e.key];return(0,p.jsxs)(`button`,{type:`button`,className:`rh-overview__card`,onClick:()=>c(e.key),children:[(0,p.jsx)(`span`,{className:`rh-overview__label`,children:e.label}),(0,p.jsx)(`strong`,{className:`rh-overview__value`,children:s&&t===void 0?`…`:t==null?`–`:t.toLocaleString()}),(0,p.jsx)(`span`,{className:`rh-overview__open`,children:`Open`})]},e.key)})})}var oL=(e,t,n)=>`tab:${e}:${t}:${n}`.replace(/[^A-Za-z0-9:_\-.|]/g,`_`).slice(0,160),sL=1500;function cL(e,{pageModule:t,parentId:r,refreshKey:i=0,enabled:a=!1}={}){let o=a?JSON.stringify([t??``,r??``,(e??[]).map(e=>[e.key,e.module,e.relation??null])]):``,[s,c]=(0,u.useState)({});(0,u.useEffect)(()=>{if(!o)return;let[e,t,r]=JSON.parse(o);if(!t||!r.length)return;let i=!1;return new Promise(e=>{setTimeout(e,sL)}).then(()=>i?[]:Promise.allSettled(r.map(async([r,i,a])=>{let o=await mF(a,t,i);if(!o)throw Error(`scope not supported`);let s=typeof a?.scope==`string`?a.scope.trim():``,c={...DF(a?.queryParams)??{},include:`seenCount`,seenKey:oL(e,t,r)},l=await n.$t(i,1,0,{scopeConditions:o,...s?{scope:s}:{},queryParams:c});return Number(l?.data?.newCount??l?.newCount??0)>0}))).then(e=>{if(i)return;let t={};e.forEach((e,n)=>{t[r[n][0]]=e.status===`fulfilled`&&e.value===!0}),c(t)}),()=>{i=!0}},[o,i]);let l=Object.fromEntries((e??[]).map(e=>[e.key,e.module])),d=(0,u.useCallback)(e=>{c(t=>t[e]?{...t,[e]:!1}:t),a&&r&&l[e]&&n.Ot(l[e],{key:oL(t,r,e)})},[a,t,r,l]);return{dots:a?s:{},open:d}}var lL=(0,u.createContext)(null);function uL(){return(0,u.useContext)(lL)}var dL=[];function fL({moduleName:e,id:t,header:n,breadcrumb:r=null,headerActions:i=null,headerEndSlot:a=null,banner:o=null,onClose:s,tabs:l=dL,stats:m=dL,defaultTab:g,maxVisibleTabs:_=12,alwaysShowMore:v=!1,moreEmptyLabel:y=`No more sections`,listComponent:b,listPropsFor:x,renderQuickView:S,onOpenRecord:C,refreshKey:w=0,railMode:T,quickViewMode:E,railWidth:D,quickViewWidth:O,className:k=``,selectedParam:A=``,listCacheMs:j=0,preloadTabs:M=!1,preloadDelayMs:N=1200,tabDots:P=!1}){let[F,I]=(0,h.useSearchParams)(),L=i??a,R=l.map(e=>e.key),z=F.get(`tab`),B=g&&R.includes(g)?g:R[0],V=z&&R.includes(z)?z:B,H=e=>{if(!e||e===V)return;let t=new URLSearchParams(F);t.set(`tab`,e),[...t.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>t.delete(e)),t.delete(`sub`),A&&t.delete(A),I(t,{replace:!0})},U=(0,u.useMemo)(()=>l.filter(e=>e.module&&e.relation),[l]),{counts:W,loading:G}=OF(m,t,w),ee=cL(U,{pageModule:e,parentId:t,refreshKey:w,enabled:P}),te=e=>!!ee.dots[e]&&e!==V;(0,u.useEffect)(()=>{P&&ee.dots[V]&&ee.open(V)},[P,V,ee]);let ne=(e,t)=>te(e)?(0,p.jsxs)(p.Fragment,{children:[t,(0,p.jsx)(`span`,{className:`rh-tabs__dot`,"aria-label":`new updates`})]}):t,re=m.map(e=>({key:e.key,label:e.label,value:W[e.key],active:!!e.tab&&V===e.tab,onClick:e.tab?()=>H(e.tab):void 0})),ie=l.slice(0,_),ae=l.slice(_),oe=ae.some(e=>e.key===V),se=ae.length?ae.map(e=>({key:e.key,label:ne(e.key,e.label)})):[{key:`__none`,label:y,disabled:!0}],ce=(0,u.useMemo)(()=>({listComponent:b,listPropsFor:x,renderQuickView:S,onOpenRecord:C,refreshKey:w,relatedTabs:U,railMode:T,quickViewMode:E,activeTab:V}),[b,x,S,C,w,U,T,E,V]),K=e=>({tabKey:e.key,module:e.module,relation:e.relation,parentId:t,title:e.label,showRail:e.rail!==!1,railMode:e.railMode??T,quickViewMode:e.quickViewMode??E,...e.railWidth??D?{railWidth:e.railWidth??D}:{},...e.quickViewWidth??O?{quickViewWidth:e.quickViewWidth??O}:{},listComponent:e.listComponent??b,listProps:x?.(e.module,e)??e.listProps,renderQuickView:S,onOpenRecord:C,refreshKey:w,cacheMs:e.cacheMs??j,...typeof e.fetch==`function`?{fetchData:e.fetch}:{},...e.recordLinks?{recordLinks:e.recordLinks}:{},...e.access&&typeof e.access==`object`&&e.access.module?{accessModule:String(e.access.module)}:{}}),le=(0,u.useMemo)(()=>M?U.filter(e=>!e.component&&typeof e.render!=`function`&&(e.cacheMs??j)>0):[],[M,U,j]),[ue,de]=(0,u.useState)({id:t,ready:!1,done:[]});ue.id!==t&&de({id:t,ready:!1,done:[]}),(0,u.useEffect)(()=>{if(!le.length)return;let e=null,n=()=>de(e=>e.id===t?{...e,ready:!0}:e),r=setTimeout(()=>{typeof window<`u`&&typeof window.requestIdleCallback==`function`?e=window.requestIdleCallback(n,{timeout:1500}):n()},N);return()=>{clearTimeout(r),e!==null&&typeof window<`u`&&window.cancelIdleCallback?.(e)}},[le.length,N,t]);let fe=(0,u.useCallback)(e=>{de(t=>t.done.includes(e)?t:{...t,done:[...t.done,e]})},[]),pe=ue.ready&&ue.id===t?le.find(e=>e.key!==V&&!ue.done.includes(e.key))??null:null,me=l.find(e=>e.key===V)??null,he=null,q=typeof me?.view==`function`?me.view({id:t,moduleName:e,refreshKey:w,searchParams:F}):null;if(q!=null&&q!==!1)he=q;else if(typeof me?.render==`function`)he=me.render({id:t,moduleName:e,refreshKey:w});else if(me?.component){let n=me.component;he=(0,p.jsx)(n,{id:t,moduleName:e,refreshKey:w})}else me?.type===`overview`?he=(0,p.jsx)(aL,{tabs:U,parentId:t,title:me.label,refreshKey:w}):me?.module&&(he=(0,p.jsx)(jF,{active:!0,...K(me),...A?{selectedParam:A}:{}},me.key));return(0,p.jsx)(lL.Provider,{value:ce,children:(0,p.jsxs)(`div`,{className:`rh-hub ${k}`.trim(),"data-module":e,children:[(r||s)&&(0,p.jsxs)(`div`,{className:`rh-hub__crumbs`,children:[(0,p.jsx)(`div`,{className:`rh-hub__crumbs-trail`,children:r}),s&&(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),onClick:s,"aria-label":`Close`})]}),o,(0,p.jsxs)(`div`,{className:`rh-hub__head`,children:[(0,p.jsx)(`div`,{className:`rh-hub__title`,children:n??(0,p.jsx)(ns,{moduleName:e,id:t,refreshKey:w,hideActions:!0})}),(m.length>0||L)&&(0,p.jsxs)(`div`,{className:`rh-hub__aside`,children:[m.length>0&&(0,p.jsx)(c.i,{items:re,loading:G,ariaLabel:`Summary`,className:`rh-hub__stats`}),L&&(0,p.jsx)(`div`,{className:`rh-hub__actions`,children:L})]})]}),(0,p.jsxs)(`nav`,{className:`rh-tabs`,role:`tablist`,"aria-label":`Sections`,children:[ie.map(e=>(0,p.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===V,className:`rh-tabs__item${e.key===V?` is-active`:``}`,onClick:()=>H(e.key),children:ne(e.key,e.label)},e.key)),(ae.length>0||v)&&(0,p.jsx)(d.Dropdown,{trigger:[`click`],menu:{items:se,onClick:({key:e})=>H(e)},children:(0,p.jsxs)(`button`,{type:`button`,className:`rh-tabs__item rh-tabs__more${oe?` is-active`:``}`,children:[oe?l.find(e=>e.key===V)?.label:`More`,` `,(0,p.jsx)(f.DownOutlined,{})]})})]}),(0,p.jsxs)(`section`,{className:`rh-hub__body`,role:`tabpanel`,"aria-label":me?.label,children:[he,pe&&(0,p.jsx)(jF,{preload:!0,onPreloaded:fe,...K(pe)},`preload:${pe.key}`)]})]})})}var pL=[];function mL({tab:e,moduleName:t,id:n,refreshKey:r,onOpenTab:i=null}){let a=(0,u.useRef)(null),o=JSON.stringify(e.groups??null),[s]=(0,u.useState)(()=>kI(JSON.parse(o))),c=typeof e.decorate==`function`?e.decorate:null;(0,u.useEffect)(()=>{let e=a.current;if(!e||!c)return;let r=!1,i=()=>{if(!r){r=!0;try{c(e,{id:n,moduleName:t})}finally{r=!1}}};i();let o=new MutationObserver(()=>{o.disconnect(),i(),o.observe(e,{childList:!0,subtree:!0})});return o.observe(e,{childList:!0,subtree:!0}),()=>o.disconnect()},[c,n,t]);let l=null;return typeof e.empty==`function`?l=e.empty({id:n,moduleName:t}):typeof e.empty==`string`?l=(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:e.empty}):e.empty&&(l=e.empty),(0,p.jsx)(`div`,{ref:a,className:`rh-details`,"data-tab":e.key,children:(0,p.jsx)(Xi,{moduleName:t,id:n,refreshKey:r,groupFilter:s,emptyContent:l,onOpenTab:i})})}var hL=15e3,gL=4e3;function _L(e){let t={};return[`closeQuickView`,`highlight`,`ownWithinMs`].forEach(n=>{e&&e[n]!==void 0&&(t[n]=e[n])}),t}function vL({config:e,id:t,refreshKey:r=0}){let i=(0,h.useNavigate)(),a=(0,h.useLocation)(),[o,s]=(0,h.useSearchParams)(),c=e=>{e&&s(t=>{let n=new URLSearchParams(t);return n.set(`tab`,e),n.delete(`sub`),n.delete(`qv`),[...n.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>n.delete(e)),n},{replace:!0})},l=e??{},f=l.module,m=SI(l.layout),g=l.strictPermissions===!0?{strict:!0,aliases:l.permissionAliases}:void 0,{canView:_,canAdd:v,canEdit:y,canDelete:b}=n.zt(f,g),x=Vc(),S=l.tabAccess===`view`,C=n.Bt(g),[w,T]=(0,u.useState)(0),[E,D]=(0,u.useState)(null),O=()=>T(e=>e+1),k=hI(l.refreshEvents).filter($).join(`|`);(0,u.useEffect)(()=>{if(!k||typeof window>`u`)return;let e=k.split(`|`),t=()=>T(e=>e+1);return e.forEach(e=>window.addEventListener(e,t)),()=>e.forEach(e=>window.removeEventListener(e,t))},[k]);let A={id:t,module:f,navigate:i,location:a,refresh:O,can:{view:_,add:v,edit:y,delete:b},adminActionsVersion:x},j={record:E},M=l.header?.onHeaderData,N=e=>{D(e??null),M?.(e)},P=xI(l.header?.moreActions,j,A).map(e=>({key:e.key,label:e.label,danger:e.danger,disabled:e.disabled,onClick:e.onClick})),F=xI(l.header?.buttons,j,A),I=F.length?(0,p.jsx)(p.Fragment,{children:F.map(e=>{let t=(0,p.jsx)(d.Button,{type:e.type??`primary`,className:e.className,icon:e.icon,danger:e.danger,disabled:e.disabled||!e.onClick,onClick:e.onClick,children:e.label},e.key);return e.tooltip?(0,p.jsx)(d.Tooltip,{title:e.tooltip,children:t},e.key):t})}):null,L=(S?jI(TI(l.tabs),C):TI(l.tabs)).map(e=>e.type===`details`?{...e,render:t=>(0,p.jsx)(mL,{tab:e,moduleName:t.moduleName,id:t.id,refreshKey:t.refreshKey,onOpenTab:c},e.key)}:Number(e.quickView?.width)>0?{...e,quickViewWidth:Number(e.quickView.width)}:e),R=l.fullView??null,z=l.quickView??null,B=o.get(`tab`),V=L.find(e=>e.key===B)??L.find(e=>e.key===l.defaultTab)??L[0]??null,H=typeof l.follow==`function`?l.follow:null,U=H?`qv`:``,W=U&&o.get(U)||``,G=l.realtime?typeof l.realtime==`object`?l.realtime:{}:null,ee=G?(typeof G.topics==`function`?hI(G.topics({id:t,module:f,tab:V?.key??``,openRecordId:W})):[WF(f,t),V?.module?UF(V.module):``,V?.module&&W?WF(V.module,W):``]).filter($):[],te=fI({topics:ee,enabled:!!G,debounceMs:G?.debounceMs??600}),ne=!!G?.highlight;uI(ee,e=>{let t=e?.id??e?.recordId;if(!t||!e?.module||/deleted/i.test(String(e?.type??``)))return;let r=L.find(t=>t.module&&HF(t.module)===HF(e.module));n.st(r?.module??e.module,t)},{enabled:!!G&&ne});let re=r+w+te.tick,ie=(e,t,n)=>{let r=R?.[e],a=typeof r==`function`?r(t,n??null):null;a&&i(a)},ae=H&&l.followThen&&typeof l.followThen==`object`?l.followThen:null,oe=(e,t)=>({presentation:{title:t.label},actionContext:{tab:t.label??``},...ae?.highlight?{highlightNew:!0}:{},...ne?{highlightUpdates:!0}:{},...l.seenDots===!0?{seenDots:!0}:{},...OI(t.columns??l.columns?.[e])??{},...(typeof t.listProps==`function`?t.listProps({...A,tab:t,tabModule:e}):t.listProps)??{}}),se=({module:e,id:n,record:r,onClose:i,onOpenFull:a})=>{let o=(V?.module===e&&V?.quickView&&typeof V.quickView==`object`?V.quickView:null)??CI(z,e);return o?(0,p.jsx)(rL,{config:o,module:e,id:n,record:r,onClose:i,onOpenFull:typeof R?.[e]==`function`?a:void 0,refreshKey:re,extraCtx:{parentId:t,parentModule:f,parent:E,tab:V?.key,tabLabel:V?.label??``,can:A.can}},`${V?.key??``}:${e}:${n}`):null},ce=ae?.highlight&&$(W)&&$(V?.module)?`${V.module}|${W}`:``;(0,u.useEffect)(()=>{if(!ce)return;let e=ce.indexOf(`|`);n.at(ce.slice(0,e),ce.slice(e+1))},[ce]);let K=`${w}|${te.tick}`,le=(0,u.useRef)(K),ue=(0,u.useRef)(null);(0,u.useEffect)(()=>{ue.current={follow:H,followThen:ae,openRecordId:W,activeTab:V,tabs:L,searchParams:o,setSearchParams:s,ctx:A}});let de=(0,u.useRef)(null),fe=(0,u.useRef)({sig:``,at:0}),pe=(0,u.useRef)(!0);(0,u.useEffect)(()=>(pe.current=!0,()=>{pe.current=!1}),[]);let me=()=>{try{return!!window.history.state?.usr?.background}catch{return!1}};if((0,u.useEffect)(()=>{le.current!==K&&(le.current=K,de.current={at:Date.now(),covered:me()});let e=de.current;if(!e)return;if(Date.now()-e.at>hL){de.current=null;return}if(me()){e.covered=!0;return}let t=ue.current;if(e.covered&&!t.openRecordId||(de.current=null,!t.follow||!t.openRecordId||!t.activeTab?.module))return;let r=t.searchParams.get(`sub`)||t.activeTab.relation?.subTabs?.[0]?.key||``;Promise.resolve(t.follow({module:t.activeTab.module,id:t.openRecordId,tab:t.activeTab.key,sub:r},t.ctx)).then(e=>{if(!pe.current||!e||!$(e.tab))return;let i=t.tabs.find(t=>t.key===e.tab);if(!i)return;let a=$(e.sub)?e.sub:``,o=`${t.openRecordId}|${i.key}|${a}`;if(fe.current.sig===o&&Date.now()-fe.current.at<gL)return;fe.current={sig:o,at:Date.now()};let s=i.relation?.subTabs?.[0]?.key||``;if(i.key===t.activeTab.key&&(a||s)===r)return;let c={...t.followThen??{},..._L(e)},l=!!t.followThen&&n.it(t.openRecordId,Number(c.ownWithinMs)>0?Number(c.ownWithinMs):void 0),u=l&&c.closeQuickView===!0;l&&c.highlight===!0&&n.ot(i.module??t.activeTab.module,$(e.id)?e.id:t.openRecordId),t.setSearchParams(e=>{let n=new URLSearchParams(e);return n.set(`tab`,i.key),a?n.set(`sub`,a):n.delete(`sub`),[...n.keys()].filter(e=>/^p\d+$/.test(e)).forEach(e=>n.delete(e)),u?n.delete(`qv`):n.set(`qv`,t.openRecordId),n},{replace:!0});let f=a?i.relation?.subTabs?.find(e=>e.key===a)?.label:``;d.message.info({key:`cc-detail-follow-moved`,content:$(e.notice)?e.notice:`Moved to ${i.label}${f?` › ${f}`:``}`})}).catch(()=>{})},[K,a]),!$(f)||!$(t))return null;let he=hI(l.breadcrumb).length?(0,p.jsx)(n.Dt,{items:l.breadcrumb}):null;return(0,p.jsx)(fL,{moduleName:f,id:t,breadcrumb:he,header:(0,p.jsx)(ns,{moduleName:f,id:t,onHeaderData:N,refreshKey:re,actionsInMore:l.header?.actionsInMore!==!1,moreActionsExtra:P.length?P:pL,actionsExtra:I}),tabs:L,stats:S?NI(l.stats??pL,L,C):l.stats??pL,defaultTab:l.defaultTab,maxVisibleTabs:l.maxVisibleTabs??12,alwaysShowMore:l.alwaysShowMore??!0,railMode:m.railMode,quickViewMode:m.quickViewMode,railWidth:m.filterWidth,quickViewWidth:m.quickViewWidth,listPropsFor:oe,renderQuickView:se,onOpenRecord:ie,refreshKey:re,listCacheMs:Number(l.listCacheMs)>0?Number(l.listCacheMs):0,preloadTabs:l.preloadTabs===!0,tabDots:l.tabDots===!0,className:l.className??``,...U?{selectedParam:U}:{}})}function yL(e,t=new Date){let n=new Date(t);n.setHours(0,0,0,0),e===`week`&&n.setDate(n.getDate()-(n.getDay()+6)%7),e===`month`&&n.setDate(1);let r=new Date(t);return r.setHours(23,59,59,999),{key:e||`today`,from:n,to:r,fromIso:n.toISOString(),toIso:r.toISOString()}}var bL=new Intl.NumberFormat,xL=e=>e==null||!Number.isFinite(Number(e))?`–`:bL.format(Number(e));function SL(e,t,n,r=3){return hI(e).filter(e=>e?.attention&&Number.isFinite(t?.[e.key])).map(e=>({kpi:e,n:t[e.key]})).filter(({kpi:e,n:t})=>typeof e.attention.when==`function`?e.attention.when(t):t>0).sort((e,t)=>t.n-e.n).slice(0,r).map(({kpi:e,n:t})=>({key:e.key,n:t,text:typeof e.attention.text==`function`?e.attention.text(t,n):yI(vI(e.attention.text,{},n))||yI(vI(e.label,{},n)),to:typeof e.to==`function`?e.to(n):e.to}))}var CL=e=>String(e).padStart(2,`0`),wL=e=>`${e.getFullYear()}-${CL(e.getMonth()+1)}-${CL(e.getDate())}`;function TL(e,t=new Date){let n={today:14,week:28,month:90}[e]??14,r=new Date(t);r.setHours(0,0,0,0),r.setDate(r.getDate()-(n-1));let i=new Date(t);return i.setHours(23,59,59,999),{key:`last${n}`,days:n,from:r,to:i,fromIso:r.toISOString(),toIso:i.toISOString()}}function EL(e,t=new Date){let n=Math.max(1,Math.round(Number(e)||7)),r=new Date(t);r.setHours(0,0,0,0),r.setDate(r.getDate()-(n-1));let i=new Date(t);return i.setHours(23,59,59,999),{key:`last${n}`,days:n,from:r,to:i,fromIso:r.toISOString(),toIso:i.toISOString()}}function DL(e,t=new Date){let n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<60)return`just now`;let i=Math.round(r/60);if(i<60)return`${i} min${i===1?``:`s`} ago`;let a=Math.round(i/60);if(a<24)return`${a} hr${a===1?``:`s`} ago`;let o=Math.round(a/24);return o<7?`${o} day${o===1?``:`s`} ago`:n.toLocaleDateString([],{day:`numeric`,month:`short`})}function OL(e,t,n=e=>e.count){let r=new Map(hI(e).map(e=>[String(e.key),Number(n(e))||0])),i=[],a=new Date(t.from);for(let e=0;e<t.days;e+=1){let e=wL(a);i.push({key:e,value:r.get(e)??0,label:a.toLocaleDateString([],{day:`numeric`,month:`short`}),short:a.toLocaleDateString([],{day:`numeric`,month:`short`})}),a.setDate(a.getDate()+1)}return i}function kL(e,{labels:t,pick:n=e=>e.count,order:r}={}){let i=e=>e===`__other`?`Other`:e===``?`Not set`:typeof t==`function`?t(e)??e:t?.[e]??e,a=hI(e).map(e=>({key:String(e.key),label:String(i(String(e.key))),value:Number(n(e))||0}));if(Array.isArray(r)){let e=e=>{let t=r.indexOf(e);return t<0?r.length:t};a=a.sort((t,n)=>e(t.key)-e(n.key))}return a}function AL(e){let t=hI(e).map(Number).filter(Number.isFinite);if(t.length<2)return null;let n=Math.floor(t.length/2),r=t.slice(0,n).reduce((e,t)=>e+t,0),i=t.slice(t.length-n).reduce((e,t)=>e+t,0);return r===0?i===0?0:null:Math.round((i-r)/r*100)}var jL=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}),ML=e=>e==null||!Number.isFinite(Number(e))?`–`:jL.format(Number(e)),NL=e=>e==null?``:String(e);function PL(e,t,n){return e.map(e=>{let r=new Set(hI(e.match??e.key).map(NL)),i={};return t.forEach((t,a)=>{if(typeof t.value==`function`){i[t.key]=Number(t.value(e))||0;return}i[t.key]=hI(n[a]).reduce((e,t)=>r.has(NL(t.key))?e+(Number(t.count)||0):e,0)}),{...e,values:i}})}var FL=(e,t)=>(typeof e==`function`?e(t):e)??{},IL=(e,t,n={})=>yI(vI(e,n,t));function LL({spec:e,ctx:t,fallback:n}){if(!e||typeof e!=`object`)return(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:n});let r=e.button,[i]=r&&$(r.key)&&bI(r,{},{...t,module:r.module})?xI([{...r,onClick:r.onClick??(()=>t.navigate(typeof r.to==`function`?r.to(t):r.to))}],{},t):[];return(0,p.jsxs)(`div`,{className:`cc-dash-empty`,role:`status`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,gap:6,padding:`8px 12px`,minHeight:140},children:[(0,p.jsx)(`span`,{className:`cc-dash-empty__art`,"data-art":e.art,"aria-hidden":`true`,style:{display:`grid`,placeItems:`center`},children:mI(e.icon)}),(0,p.jsx)(`strong`,{className:`cc-dash-empty__title`,children:IL(e.title,t)||n}),$(e.text)||typeof e.text==`function`?(0,p.jsx)(`span`,{className:`cc-dash-empty__text`,style:{maxWidth:380},children:IL(e.text,t)}):null,i?(0,p.jsxs)(d.Button,{className:`cc-dash-empty__btn`,size:`small`,disabled:i.disabled,onClick:i.onClick,children:[i.label,` `,i.icon??(0,p.jsx)(f.ArrowRightOutlined,{})]}):null]})}function RL({onRetry:e,what:t=`data`}){return(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`This ${t} could not be loaded.`,action:(0,p.jsx)(d.Button,{size:`small`,onClick:e,children:`Retry`})})}function zL(e,t){let[n,r]=(0,u.useState)({signature:``,value:null,error:``}),[i,a]=(0,u.useState)(0);return(0,u.useEffect)(()=>{let n=!0;return Promise.resolve().then(t).then(t=>{n&&r({signature:e,value:t,error:``})},t=>{n&&r({signature:e,value:null,error:t?.status===403?`forbidden`:`error`})}),()=>{n=!1}},[e,i]),{...n,loading:n.signature!==e,retry:()=>a(e=>e+1)}}var BL=e=>hI((e?.data?.groups??e?.groups)?.items),VL=e=>e==null?``:String(e);function HL({panel:e,ctx:t,refreshKey:r,choice:i}){let a={...e,...i??{}},o=hI(a.columns).filter(e=>e&&$(e.key)),s=o.map(e=>typeof e.value==`function`?null:{module:e.module||a.module,groupBy:e.groupBy||a.groupBy,relation:FL(e.relation,t)}),{value:c,error:l,loading:u,retry:m}=zL(JSON.stringify([e.key,i?.key,s,t.range.key,r]),async()=>{let[e,...r]=await Promise.all([typeof a.rows==`function`?a.rows(t):hI(a.rows),...s.map(e=>e&&$(e.module)&&$(e.groupBy)?n.$t(e.module,1,0,{scopeConditions:oF(e.relation),...typeof e.relation.scope==`string`?{scope:e.relation.scope}:{},queryParams:{...e.relation.queryParams??{},groupBy:e.groupBy,groupDate:``,groupTz:``,groupSum:``}}).then(BL):[])]),i=hI(e);return i.length||(i=(r.find(e=>e.length)??[]).map(e=>({key:VL(e.key),label:VL(e.key)||`Not set`}))),PL(i,o,r)});if(u)return(0,p.jsx)(d.Skeleton,{active:!0,title:!1,paragraph:{rows:4}});if(l===`forbidden`)return(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:`You don't have access to this data.`});if(l)return(0,p.jsx)(RL,{onRetry:m,what:`table`});let h=hI(c),g=a.sortBy;if($(g)&&(h=[...h].sort((e,t)=>(t.values[g]??0)-(e.values[g]??0))),a.hideZero&&(h=h.filter(e=>o.some(t=>e.values[t.key]))),!h.length||h.every(e=>o.every(t=>!e.values[t.key])))return(0,p.jsx)(LL,{spec:e.emptyState,ctx:t,fallback:IL(e.empty,t)||`Nothing here right now.`});let _=Number(a.limit)||0,v=_?h.slice(0,_):h,y=a.action,b={};if(o.forEach(e=>{b[e.key]=h.reduce((t,n)=>t+(n.values[e.key]||0),0)}),a.rank){let e=o[0];return(0,p.jsx)(`ol`,{className:`cc-dash-rank`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:4},children:v.map((n,r)=>(0,p.jsxs)(`li`,{className:`cc-dash-rank__row`,style:{display:`grid`,gridTemplateColumns:`auto 1fr auto auto`,alignItems:`center`,gap:12,minHeight:44},children:[(0,p.jsx)(`span`,{className:`cc-dash-rank__n`,"aria-hidden":`true`,children:r+1}),(0,p.jsx)(`span`,{className:`cc-dash-rank__name`,style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.label}),(0,p.jsx)(`span`,{className:`cc-dash-rank__sub`,children:n.sub??``}),(0,p.jsx)(`strong`,{className:`cc-dash-rank__value`,"aria-label":`${IL(e?.label,t)}: ${xL(n.values[e?.key])}`,children:xL(n.values[e?.key])})]},n.key))})}return(0,p.jsx)(`div`,{className:`cc-dash-table`,style:{overflowX:`auto`},children:(0,p.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`separate`,borderSpacing:0},children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{scope:`col`,style:{textAlign:`start`},children:IL(a.rowLabel,t)||`Name`}),o.map(e=>(0,p.jsx)(`th`,{scope:`col`,children:IL(e.label,t)},e.key)),y?(0,p.jsx)(`th`,{scope:`col`,children:IL(y.title,t)||`Action`}):null]})}),(0,p.jsxs)(`tbody`,{children:[v.map(e=>{let n=y?typeof y.to==`function`?y.to(e,t):y.to:``;return(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{scope:`row`,style:{textAlign:`start`},children:(0,p.jsxs)(`span`,{className:`cc-dash-table__who`,style:{display:`flex`,alignItems:`center`,gap:10,minWidth:0},children:[a.avatar===`initials`?(0,p.jsx)(`span`,{className:`cc-dash-table__avatar`,"aria-hidden":`true`,children:String(e.label??``).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``)}):(0,p.jsx)(f.UserOutlined,{className:`cc-dash-table__icon`,"aria-hidden":`true`}),(0,p.jsxs)(`span`,{style:{minWidth:0,display:`flex`,flexDirection:`column`},children:[(0,p.jsx)(`span`,{className:`cc-dash-table__name`,children:e.label}),e.sub?(0,p.jsx)(`span`,{className:`cc-dash-table__sub`,children:e.sub}):null]})]})}),o.map(t=>(0,p.jsx)(`td`,{children:xL(e.values[t.key])},t.key)),y?(0,p.jsx)(`td`,{children:(0,p.jsx)(d.Button,{size:`small`,className:`cc-dash-table__action`,"data-tone":typeof y.tone==`function`?y.tone(e):y.tone,disabled:!$(n),onClick:()=>t.navigate(n),children:typeof y.label==`function`?y.label(e):IL(y.label,t)||`View`})}):null]},e.key)}),a.overall?(0,p.jsxs)(`tr`,{className:`cc-dash-table__overall`,children:[(0,p.jsx)(`th`,{scope:`row`,style:{textAlign:`start`},children:typeof a.overall==`string`?a.overall:`Overall`}),o.map(e=>(0,p.jsx)(`td`,{children:xL(b[e.key])},e.key)),y?(0,p.jsx)(`td`,{}):null]}):null]})]})})}function UL({panel:e,ctx:t,refreshKey:n}){let{value:r,error:i,loading:a,retry:o}=zL(JSON.stringify([e.key,t.range.key,n]),()=>typeof e.load==`function`?e.load(t):[]);if(a)return(0,p.jsx)(d.Skeleton,{active:!0,title:!1,paragraph:{rows:4}});if(i)return(0,p.jsx)(RL,{onRetry:o,what:`activity`});let s=hI(r).slice(0,Number(e.limit)||6);return s.length?(0,p.jsx)(`ul`,{className:`cc-dash-feed`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:2},children:s.map((e,t)=>(0,p.jsxs)(`li`,{className:`cc-dash-feed__row`,style:{display:`grid`,gridTemplateColumns:`auto 1fr auto`,alignItems:`center`,gap:12,minHeight:48},children:[(0,p.jsx)(`span`,{className:`cc-dash-feed__icon`,"data-tone":e.tone,"aria-hidden":`true`,children:mI(e.icon)}),(0,p.jsx)(`span`,{className:`cc-dash-feed__text`,style:{minWidth:0},children:e.text}),(0,p.jsx)(`time`,{className:`cc-dash-feed__time`,dateTime:e.time?new Date(e.time).toISOString():void 0,children:e.time?DL(e.time):``})]},e.key??t))}):(0,p.jsx)(LL,{spec:e.emptyState,ctx:t,fallback:IL(e.empty,t)||`No recent activity.`})}function WL({panel:e,ctx:t,refreshKey:n}){let{value:r,error:i,loading:a,retry:o}=zL(JSON.stringify([e.key,t.range.key,n]),()=>typeof e.load==`function`?e.load(t):[]);if(a)return(0,p.jsx)(d.Skeleton,{active:!0,title:!1,paragraph:{rows:4}});if(i)return(0,p.jsx)(RL,{onRetry:o,what:`data`});let s=hI(r);return!s.length||s.every(e=>!Number(e.value))?(0,p.jsx)(LL,{spec:e.emptyState,ctx:t,fallback:IL(e.empty,t)||`Nothing yet.`}):(0,p.jsx)(`ul`,{className:`cc-dash-metrics`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:2},children:s.map(e=>{let n=typeof e.to==`function`?e.to(t):e.to;return(0,p.jsx)(`li`,{className:`cc-dash-metrics__row`,children:(0,p.jsxs)(`button`,{type:`button`,disabled:!$(n),onClick:()=>t.navigate(n),"aria-label":`${e.label}: ${xL(e.value)}`,style:{display:`grid`,gridTemplateColumns:`auto 1fr auto`,alignItems:`center`,gap:12,width:`100%`,minHeight:44,padding:`4px 0`,font:`inherit`,textAlign:`start`,background:`none`,border:0,color:`inherit`,cursor:$(n)?`pointer`:`default`},children:[(0,p.jsx)(`span`,{className:`cc-dash-metrics__icon`,"data-tone":e.tone,"aria-hidden":`true`,children:mI(e.icon)}),(0,p.jsx)(`span`,{className:`cc-dash-metrics__label`,children:e.label}),(0,p.jsx)(`strong`,{className:`cc-dash-metrics__value`,children:xL(e.value)})]})},e.key)})})}function GL({panel:e,rows:t,ctx:n}){let r=hI(e.columns).filter(e=>e&&$(e.key));return(0,p.jsx)(`div`,{className:`cc-dash-table`,style:{overflowX:`auto`},children:(0,p.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`separate`,borderSpacing:0},children:[e.hideHeader?null:(0,p.jsx)(`thead`,{children:(0,p.jsx)(`tr`,{children:r.map(e=>(0,p.jsx)(`th`,{scope:`col`,style:{textAlign:e.align??`start`},children:IL(e.label,n)},e.key))})}),(0,p.jsx)(`tbody`,{children:t.map((e,t)=>(0,p.jsx)(`tr`,{children:r.map(t=>{let r=_I(t.value??t.key,e,n),i=yI(r),a=typeof t.tone==`function`?t.tone(r,e):void 0;if(t.kind===`action`){let r=typeof t.to==`function`?t.to(e,n):t.to,i=typeof t.actionLabel==`function`?t.actionLabel(e):IL(t.actionLabel,n)||`View`;return(0,p.jsx)(`td`,{children:(0,p.jsx)(d.Button,{size:`small`,className:`cc-dash-table__action`,"data-tone":a,disabled:!$(r),onClick:()=>n.navigate(r),children:i})},t.key)}return t.kind===`status`?(0,p.jsx)(`td`,{style:{textAlign:t.align??`start`},children:i?(0,p.jsx)(d.Tag,{className:`cc-dash-table__status`,"data-tone":a,style:{marginInlineEnd:0},children:i}):`–`},t.key):t.kind===`person`?(0,p.jsx)(`td`,{children:(0,p.jsxs)(`span`,{className:`cc-dash-table__who`,style:{display:`inline-flex`,alignItems:`center`,gap:8},children:[(0,p.jsx)(f.UserOutlined,{className:`cc-dash-table__icon`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`cc-dash-table__name`,children:i||`–`})]})},t.key):t.kind===`count`?(0,p.jsxs)(`td`,{style:{textAlign:t.align??`start`},children:[mI(t.icon),` `,xL(r)]},t.key):(0,p.jsx)(`td`,{style:{textAlign:t.align??`start`},children:i||`–`},t.key)})},e?._id??e?.id??t))})]})})}var KL=[`#4f6bed`,`#13a8a8`,`#f59f00`,`#e8590c`,`#7048e8`,`#2b8a3e`,`#d6336c`,`#868e96`],qL=e=>`var(--cc-dash-c${e%8+1}, ${KL[e%8]})`,JL=e=>e.reduce((e,t)=>e+(Number(t.value)||0),0);function YL({items:e,onSelect:t,format:n=xL,centerLabel:r=`Total`,precise:i=!1}){let[a,o]=(0,u.useState)(-1),s=JL(e),c=2*Math.PI*52,l=0,d=a>=0?e[a]:null;return(0,p.jsxs)(`div`,{className:`cc-chart cc-chart--donut`,style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:20},children:[(0,p.jsxs)(`svg`,{viewBox:`0 0 140 140`,width:`148`,height:`148`,role:`img`,"aria-label":e.map(e=>`${e.label} ${n(e.value)}`).join(`, `),style:{flex:`none`},children:[(0,p.jsx)(`circle`,{cx:`70`,cy:`70`,r:52,fill:`none`,stroke:`var(--cc-dash-track, #eef1f5)`,strokeWidth:`18`}),s>0&&e.map((e,r)=>{let i=Math.max(Number(e.value)||0,0)/s*c,u=(0,p.jsx)(`circle`,{cx:`70`,cy:`70`,r:52,fill:`none`,stroke:qL(r),strokeWidth:a===r?22:18,strokeDasharray:`${Math.max(i-1.5,0)} ${c}`,strokeDashoffset:-l,transform:`rotate(-90 70 70)`,style:{cursor:t?`pointer`:`default`,transition:`stroke-width 150ms ease`},onMouseEnter:()=>o(r),onMouseLeave:()=>o(-1),onClick:()=>t?.(e),children:(0,p.jsx)(`title`,{children:`${e.label}: ${n(e.value)}`})},e.key);return l+=i,u}),(0,p.jsx)(`text`,{x:`70`,y:`68`,textAnchor:`middle`,className:`cc-chart__center-value`,style:{fontSize:20,fontWeight:700,fill:`currentColor`},children:n(d?d.value:s)}),(0,p.jsx)(`text`,{x:`70`,y:`86`,textAnchor:`middle`,className:`cc-chart__center-label`,style:{fontSize:10,fill:`currentColor`,opacity:.65},children:(d?d.label:r).slice(0,18)})]}),(0,p.jsx)(`ul`,{className:`cc-chart__legend`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:6,flex:`1 1 160px`,minWidth:0},children:e.map((e,r)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-chart__legend-item`,disabled:!t,onClick:()=>t?.(e),onMouseEnter:()=>o(r),onMouseLeave:()=>o(-1),style:{display:`flex`,alignItems:`center`,gap:8,width:`100%`,padding:`2px 0`,font:`inherit`,background:`none`,border:0,textAlign:`start`,cursor:t?`pointer`:`default`,color:`inherit`},children:[(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{width:10,height:10,borderRadius:3,background:qL(r),flex:`none`}}),(0,p.jsx)(`span`,{className:`cc-chart__legend-label`,style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.label}),(0,p.jsx)(`span`,{className:`cc-chart__legend-value`,style:{fontVariantNumeric:`tabular-nums`,fontWeight:600},children:n(e.value)}),(0,p.jsx)(`span`,{className:`cc-chart__legend-share`,style:{width:i?48:40,textAlign:`end`,opacity:.6,fontVariantNumeric:`tabular-nums`},children:s>0?`${i?(e.value/s*100).toFixed(1):Math.round(e.value/s*100)}%`:``})]})},e.key))})]})}function XL({items:e,onSelect:t,format:n=xL}){let r=Math.max(1,...e.map(e=>Number(e.value)||0));return(0,p.jsx)(`ul`,{className:`cc-chart cc-chart--bar`,role:`list`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:10},children:e.map((e,i)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-chart__bar-row`,disabled:!t,onClick:()=>t?.(e),"aria-label":`${e.label}: ${n(e.value)}`,style:{display:`grid`,gridTemplateColumns:`minmax(80px, 34%) 1fr auto`,alignItems:`center`,gap:10,width:`100%`,padding:0,font:`inherit`,background:`none`,border:0,textAlign:`start`,cursor:t?`pointer`:`default`,color:`inherit`},children:[(0,p.jsxs)(`span`,{className:`cc-chart__bar-label`,style:{display:`flex`,alignItems:`center`,gap:8,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[e.icon?(0,p.jsx)(`span`,{className:`cc-chart__bar-icon`,"data-key":e.key,"aria-hidden":`true`,style:{flex:`none`,display:`inline-flex`},children:e.icon}):null,(0,p.jsx)(`span`,{style:{minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`},children:e.label})]}),(0,p.jsx)(`span`,{className:`cc-chart__bar-track`,style:{height:10,borderRadius:5,background:`var(--cc-dash-track, #eef1f5)`,overflow:`hidden`},children:(0,p.jsx)(`span`,{className:`cc-chart__bar-fill`,style:{display:`block`,height:`100%`,width:`${(Number(e.value)||0)/r*100}%`,minWidth:e.value>0?4:0,borderRadius:5,background:qL(i),transition:`width 400ms ease`}})}),(0,p.jsx)(`span`,{className:`cc-chart__bar-value`,style:{fontVariantNumeric:`tabular-nums`,fontWeight:600},children:n(e.value)})]})},e.key))})}var ZL=e=>e.map(([e,t],n)=>`${n?`L`:`M`}${e.toFixed(1)},${t.toFixed(1)}`).join(` `);function QL({items:e,height:t=180,format:n=xL,color:r=qL(0),pointLabels:i=!1}){let[a,o]=(0,u.useState)(-1),s=(0,u.useRef)(null),[c,l]=(0,u.useState)(600);(0,u.useEffect)(()=>{let e=s.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{let t=Math.round(e.contentRect.width);t>0&&l(t)});return t.observe(e),()=>t.disconnect()},[]);let d=t,f={l:36,r:i?16:8,t:i?26:12,b:22},m=Math.max(1,...e.map(e=>Number(e.value)||0)),h=m<=4?m:Math.ceil(m/4)*4,g=t=>f.l+(e.length>1?t/(e.length-1)*(c-f.l-f.r):(c-f.l-f.r)/2),_=e=>f.t+(1-(Number(e)||0)/h)*(d-f.t-f.b),v=e.map((e,t)=>[g(t),_(e.value)]),y=v.length?`${ZL(v)} L${g(e.length-1)},${d-f.b} L${g(0)},${d-f.b} Z`:``,b=[0,.5,1].map(e=>Math.round(h*e)),x=Math.max(1,Math.ceil(e.length/Math.max(2,Math.floor(c/80)))),S=JL(e),C=a>=0?e[a]:null,w=`cc-area-${String(e[0]?.key??`x`).replace(/[^\w-]/g,``)}-${e.length}`;return(0,p.jsxs)(`div`,{ref:s,className:`cc-chart cc-chart--area`,style:{position:`relative`},children:[(0,p.jsxs)(`svg`,{viewBox:`0 0 ${c} ${d}`,width:`100%`,height:d,role:`img`,"aria-label":`Trend, ${e.length} points, total ${n(S)}, peak ${n(m)}`,onMouseLeave:()=>o(-1),onMouseMove:t=>{let n=t.currentTarget.getBoundingClientRect(),r=(t.clientX-n.left)/n.width*c,i=Math.round((r-f.l)/(c-f.l-f.r)*(e.length-1));o(Math.min(e.length-1,Math.max(0,i)))},children:[(0,p.jsx)(`defs`,{children:(0,p.jsxs)(`linearGradient`,{id:w,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,p.jsx)(`stop`,{offset:`0%`,stopColor:r,stopOpacity:`0.28`}),(0,p.jsx)(`stop`,{offset:`100%`,stopColor:r,stopOpacity:`0.02`})]})}),b.map(e=>(0,p.jsxs)(`g`,{children:[(0,p.jsx)(`line`,{x1:f.l,x2:c-f.r,y1:_(e),y2:_(e),stroke:`var(--cc-dash-grid, #e9edf2)`,strokeDasharray:e?`3 4`:``,vectorEffect:`non-scaling-stroke`}),(0,p.jsx)(`text`,{x:f.l-6,y:_(e)+3,textAnchor:`end`,style:{fontSize:10,fill:`currentColor`,opacity:.55},children:n(e)})]},e)),y?(0,p.jsx)(`path`,{d:y,fill:`url(#${w})`}):null,v.length?(0,p.jsx)(`path`,{d:ZL(v),fill:`none`,stroke:r,strokeWidth:`2.25`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`}):null,e.map((t,n)=>(n%x===0&&e.length-1-n>=x/2||n===e.length-1)&&(0,p.jsx)(`text`,{x:g(n),y:d-6,textAnchor:n===0?`start`:n===e.length-1?`end`:`middle`,style:{fontSize:10,fill:`currentColor`,opacity:.55},children:t.short??t.label},t.key)),i?e.map((e,t)=>(0,p.jsxs)(`g`,{className:`cc-chart__point`,children:[(0,p.jsx)(`circle`,{cx:g(t),cy:_(e.value),r:`3.5`,fill:`var(--cc-dash-surface, #fff)`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),(0,p.jsx)(`text`,{x:g(t),y:_(e.value)-10,textAnchor:`middle`,className:`cc-chart__point-value`,style:{fontSize:11,fontWeight:600,fill:`currentColor`},children:n(e.value)})]},`p-${e.key}`)):null,C?(0,p.jsxs)(`g`,{children:[(0,p.jsx)(`line`,{x1:g(a),x2:g(a),y1:f.t,y2:d-f.b,stroke:r,strokeOpacity:`0.35`,vectorEffect:`non-scaling-stroke`}),(0,p.jsx)(`circle`,{cx:g(a),cy:_(C.value),r:`4`,fill:`var(--cc-dash-surface, #fff)`,stroke:r,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`})]}):null]}),C?(0,p.jsxs)(`div`,{className:`cc-chart__tip`,role:`status`,style:{position:`absolute`,top:0,left:`${g(a)/c*100}%`,transform:`translateX(${a>e.length/2?`-105%`:`5%`})`,pointerEvents:`none`,padding:`4px 8px`,borderRadius:6,fontSize:12,whiteSpace:`nowrap`,background:`var(--cc-dash-tip, rgba(23,32,44,.92))`,color:`#fff`},children:[C.label,`: `,(0,p.jsx)(`strong`,{children:n(C.value)})]}):null]})}function $L({items:e,height:t=180,format:n=xL,onSelect:r}){let i=Math.max(1,...e.map(e=>Number(e.value)||0));return(0,p.jsx)(`div`,{className:`cc-chart cc-chart--column`,role:`list`,style:{display:`flex`,alignItems:`flex-end`,gap:8,height:t,paddingTop:18},children:e.map((e,t)=>(0,p.jsxs)(`button`,{type:`button`,role:`listitem`,disabled:!r,onClick:()=>r?.(e),"aria-label":`${e.label}: ${n(e.value)}`,style:{flex:1,minWidth:0,height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`flex-end`,alignItems:`center`,gap:4,padding:0,font:`inherit`,background:`none`,border:0,cursor:r?`pointer`:`default`,color:`inherit`},children:[(0,p.jsx)(`span`,{className:`cc-chart__col-value`,style:{fontSize:12,fontWeight:600,fontVariantNumeric:`tabular-nums`},children:n(e.value)}),(0,p.jsx)(`span`,{className:`cc-chart__col`,style:{width:`70%`,maxWidth:44,height:`${(Number(e.value)||0)/i*100}%`,minHeight:e.value>0?3:1,borderRadius:`6px 6px 2px 2px`,background:qL(t),transition:`height 400ms ease`}}),(0,p.jsx)(`span`,{className:`cc-chart__col-label`,style:{fontSize:11,opacity:.7,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.label})]},e.key))})}function eR({items:e,onSelect:t,format:n=xL,precise:r=!1}){let i=Math.max(1,...e.map(e=>Number(e.value)||0));return(0,p.jsx)(`ol`,{className:`cc-chart cc-chart--funnel`,style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:14},children:e.map((a,o)=>{let s=Number(a.value),c=o>0?Number(e[o-1].value):null,l=c>0&&Number.isFinite(s)?r?Number((s/c*100).toFixed(1)):Math.round(s/c*100):null,u=l!==null&&l<=100?l:null,d=Number.isFinite(s)&&s>0?Math.max(2,s/i*100):0;return(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-chart__funnel-row`,disabled:!t,onClick:()=>t?.(a),"aria-label":`${a.label}: ${n(a.value)}${u===null?``:`, ${u}% of ${e[o-1].label}`}`,style:{display:`grid`,gap:6,width:`100%`,padding:0,font:`inherit`,textAlign:`start`,background:`none`,border:0,cursor:t?`pointer`:`default`,color:`inherit`},children:[(0,p.jsxs)(`span`,{className:`cc-chart__funnel-head`,style:{display:`flex`,alignItems:`baseline`,gap:8,minWidth:0},children:[(0,p.jsx)(`span`,{className:`cc-chart__funnel-dot`,"aria-hidden":`true`,style:{flex:`none`,width:8,height:8,borderRadius:`50%`,background:qL(o),alignSelf:`center`}}),(0,p.jsx)(`span`,{className:`cc-chart__funnel-label`,style:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontWeight:500},children:a.label}),u===null?null:(0,p.jsxs)(`span`,{className:`cc-chart__funnel-conv`,style:{fontSize:12,opacity:.65,whiteSpace:`nowrap`,fontVariantNumeric:`tabular-nums`},children:[r?u.toFixed(1):u,`% of `,e[o-1].label]}),(0,p.jsx)(`strong`,{className:`cc-chart__funnel-value`,style:{fontVariantNumeric:`tabular-nums`,minWidth:48,textAlign:`end`},children:n(a.value)})]}),(0,p.jsx)(`span`,{className:`cc-chart__funnel-track`,"aria-hidden":`true`,style:{display:`block`,height:10,borderRadius:999,background:`rgba(127,127,127,0.14)`,overflow:`hidden`},children:(0,p.jsx)(`span`,{className:`cc-chart__funnel-bar`,style:{display:`block`,width:`${d}%`,height:`100%`,borderRadius:999,background:qL(o),transition:`width 400ms cubic-bezier(0.2, 0, 0, 1)`}})})]})},a.key)})})}function tR({values:e,color:t=qL(0),width:n=72,height:r=26}){if(!e?.length)return null;let i=Math.max(1,...e),a=e.map((t,a)=>[e.length>1?a/(e.length-1)*n:n/2,r-2-t/i*(r-4)]);return(0,p.jsxs)(`svg`,{className:`cc-chart cc-chart--spark`,width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":`true`,style:{display:`block`,overflow:`visible`},children:[(0,p.jsx)(`path`,{d:`${ZL(a)} L${n},${r} L0,${r} Z`,fill:t,fillOpacity:`0.12`}),(0,p.jsx)(`path`,{d:ZL(a),fill:`none`,stroke:t,strokeWidth:`1.75`,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var nR=[{key:`today`,label:`Today`},{key:`week`,label:`Week`,title:`This week (from Monday)`},{key:`month`,label:`Month`,title:`This month`}],rR={today:`Today`,week:`This week`,month:`This month`},iR=(e,t)=>(typeof e==`function`?e(t):e)??{},aR=(e,t,n)=>typeof e==`function`?e(n??t,t):e,oR=(()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||``}catch{return``}})();function sR(e,t){let r=e?JSON.stringify([e,t]):``,[i,a]=(0,u.useState)({signature:``,groups:null,error:``}),[o,s]=(0,u.useState)(0);return(0,u.useEffect)(()=>{if(!e)return;let t=!0,{module:i,relation:o={},groupBy:s,groupDate:c,sum:l}=e,u=typeof o.scope==`string`?o.scope:``;return n.$t(i,1,0,{scopeConditions:oF(o),...u?{scope:u}:{},queryParams:{...o.queryParams??{},groupBy:s,groupDate:c||``,groupTz:c?oR:``,groupSum:l||``}}).then(e=>{if(!t)return;let n=e?.data?.groups??e?.groups;a({signature:r,groups:n?.applied?hI(n.items):null,error:n?``:`unsupported`})}).catch(e=>{t&&a({signature:r,groups:null,error:e?.status===403?`forbidden`:`error`})}),()=>{t=!1}},[r,o]),{...i,loading:!!e&&i.signature!==r,retry:()=>s(e=>e+1)}}var cR=e=>typeof e==`function`?e:e===`compact`?ML:xL;function lR({panel:e,counts:t,kpis:n,loading:r,ctx:i,refreshKey:a,choice:o}){let s=Array.isArray(e.stages),c=e.chart===`area`,l=Number(o?.days)>0?EL(o.days):TL(i.range.key),u=c?{...i,range:l}:i,f=s||!$(e.module)||!$(e.groupBy)?null:{module:e.module,relation:iR(e.relation,u),groupBy:e.groupBy,groupDate:c?`day`:e.groupDate,sum:e.sum,range:u.range.key},m=sR(f,a),h=cR(e.format),g=e.sum?e=>e.sum:e=>e.count,_=typeof e.to==`function`?t=>i.navigate(e.to(t,i)):$(e.to)?()=>i.navigate(e.to):void 0;if(s){if(r)return(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:3}});let a=hI(e.stages).map(e=>{let r=n.find(t=>t.key===e.kpi);return r?{key:e.kpi,label:yI(vI(e.label??r.label,{},i)),value:t[e.kpi],to:aR(r.to,i)}:null}).filter(Boolean),o=e=>i.navigate(e.to);return e.emptyState&&a.every(e=>!Number(e.value))?(0,p.jsx)(LL,{spec:e.emptyState,ctx:i}):e.chart===`donut`?(0,p.jsx)(YL,{items:a,format:h,onSelect:o,precise:!!e.precise,centerLabel:yI(vI(e.centerLabel,{},i))||void 0}):e.chart===`column`?(0,p.jsx)($L,{items:a,format:h,onSelect:o}):e.chart===`bar`?(0,p.jsx)(XL,{items:a,format:h,onSelect:o}):(0,p.jsx)(eR,{items:a,format:h,onSelect:o,precise:!!e.precise})}if(!f)return(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,message:`This chart needs a module and a groupBy field.`});if(m.loading)return(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:4}});if(m.error===`forbidden`)return(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:`You don't have access to this data.`});if(m.error===`error`)return(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`This chart could not be loaded.`,action:(0,p.jsx)(d.Button,{size:`small`,onClick:m.retry,children:`Retry`})});if(!m.groups)return(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:m.error===`unsupported`?`Chart data is not available from the server yet.`:`This field cannot be charted for your list.`});if(c){let t=OL(m.groups,l,g).map(e=>o?.days?{...e,short:new Date(`${e.key}T00:00:00`).toLocaleDateString([],{weekday:`short`})}:e),n=t.reduce((e,t)=>e+t.value,0);return e.emptyState&&n===0?(0,p.jsx)(LL,{spec:e.emptyState,ctx:i}):(0,p.jsxs)(p.Fragment,{children:[e.summary===!1?null:(0,p.jsxs)(`div`,{className:`cc-dash-chart__summary`,style:{display:`flex`,alignItems:`baseline`,gap:8,marginBottom:8},children:[(0,p.jsx)(`span`,{className:`cc-dash-chart__total`,style:{fontSize:22,fontWeight:700},children:h(n)}),(0,p.jsxs)(`span`,{className:`cc-dash-chart__window`,style:{opacity:.65},children:[`in the last `,l.days,` days`]})]}),(0,p.jsx)(QL,{items:t,format:h,pointLabels:!!e.pointLabels})]})}let v=kL(m.groups,{labels:e.labels,pick:g,order:e.order}).map(t=>e.icons?{...t,icon:mI(typeof e.icons==`function`?e.icons(t.key):e.icons[t.key])}:t);if(!v.length||v.every(e=>!e.value))return(0,p.jsx)(LL,{spec:e.emptyState,ctx:i,fallback:yI(vI(e.empty,{},i))||`No data for this period.`});let y=Number(e.max)>0?v.slice(0,Number(e.max)):v;return e.chart===`donut`?(0,p.jsx)(YL,{items:y,format:h,onSelect:_,precise:!!e.precise,centerLabel:yI(vI(e.centerLabel,{},i))||void 0}):e.chart===`column`?(0,p.jsx)($L,{items:y,format:h,onSelect:_}):(0,p.jsx)(XL,{items:v.slice(0,Number(e.max)||8),format:h,onSelect:_})}function uR({kpi:e,ctx:t,refreshKey:n}){let r=TL(`week`),i={...t,range:r},a=sR({module:e.module,relation:iR(e.relation,i),groupBy:e.trend.field||`createdAt`,groupDate:`day`,range:`trend`},n);if(a.loading||!a.groups)return null;let o=OL(a.groups,r).map(e=>e.value),s=AL(o),c=s>0,l=s===null||s===0?`flat`:(e.trend.goodWhen===`down`?!c:c)?`good`:`bad`;return(0,p.jsxs)(`span`,{className:`cc-dash-kpi__trend`,style:{display:`flex`,flexWrap:`wrap`,alignItems:`flex-end`,justifyContent:`space-between`,gap:4,width:`100%`,minWidth:0},children:[(0,p.jsxs)(`span`,{className:`cc-dash-kpi__delta is-${l}`,style:{fontSize:12,fontWeight:600,whiteSpace:`nowrap`},children:[s===null?`New`:(0,p.jsxs)(p.Fragment,{children:[c?(0,p.jsx)(f.ArrowUpOutlined,{}):s<0?(0,p.jsx)(f.ArrowDownOutlined,{}):null,` `,Math.abs(s),`%`]}),(0,p.jsx)(`span`,{className:`cc-dash-kpi__delta-note`,style:{fontWeight:400,opacity:.65},children:` vs prior 2 wks`})]}),(0,p.jsx)(tR,{values:o})]})}function dR(){return(0,p.jsxs)(`svg`,{className:`cc-dash-hero__art`,viewBox:`0 0 320 160`,"aria-hidden":`true`,focusable:`false`,style:{position:`absolute`,right:0,bottom:0,width:320,height:160,pointerEvents:`none`},children:[(0,p.jsx)(`circle`,{cx:`270`,cy:`30`,r:`90`,fill:`currentColor`,opacity:`0.06`}),(0,p.jsx)(`circle`,{cx:`300`,cy:`150`,r:`60`,fill:`currentColor`,opacity:`0.06`}),[[150,100],[180,76],[210,88],[240,52],[270,64],[300,30]].map(([e,t])=>(0,p.jsx)(`rect`,{x:e,y:t,width:`18`,height:160-t,rx:`5`,fill:`currentColor`,opacity:`0.1`},e)),(0,p.jsx)(`path`,{d:`M140 108 L189 80 L219 92 L249 56 L279 68 L309 34`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:`0.35`}),(0,p.jsx)(`circle`,{cx:`309`,cy:`34`,r:`5`,fill:`currentColor`,opacity:`0.5`})]})}function fR(e,t,n){let r=e.filter(e=>typeof e.count==`function`),i=JSON.stringify([r.map(e=>e.key),t.range.key,n]),[a,o]=(0,u.useState)({signature:``,counts:{}});return(0,u.useEffect)(()=>{if(!r.length)return;let e=!0;return Promise.allSettled(r.map(e=>e.count(t))).then(t=>{if(!e)return;let n={};t.forEach((e,t)=>{let i=e.status===`fulfilled`?Number(e.value):NaN;n[r[t].key]=Number.isFinite(i)?i:null}),o({signature:i,counts:n})}),()=>{e=!1}},[i]),{counts:a.counts,loading:r.length>0&&a.signature!==i}}function pR({kpi:e,value:t,loading:n,ctx:r,refreshKey:i}){let a=yI(vI(e.label,{},r)),o=yI(vI(e.help,{},r)),s=aR(e.to,r),c=(0,p.jsxs)(p.Fragment,{children:[e.icon?(0,p.jsx)(`span`,{className:`cc-dash-kpi__icon`,"aria-hidden":`true`,children:mI(e.icon)}):null,(0,p.jsxs)(`span`,{className:`cc-dash-kpi__label`,children:[a,o?(0,p.jsx)(d.Tooltip,{title:o,children:(0,p.jsx)(f.InfoCircleOutlined,{className:`cc-dash-kpi__help`,"aria-label":`About ${a}`,onClick:e=>e.stopPropagation()})}):null]}),n?(0,p.jsx)(d.Skeleton.Button,{active:!0,size:`small`,style:{width:56}}):(0,p.jsx)(`span`,{className:`cc-dash-kpi__value`,children:xL(t)}),$(e.caption)||typeof e.caption==`function`?(0,p.jsx)(`span`,{className:`cc-dash-kpi__period`,style:{fontSize:12,opacity:.65},children:yI(vI(e.caption,{},r))}):r.rangeLabel?(0,p.jsx)(`span`,{className:`cc-dash-kpi__period`,style:{fontSize:12,opacity:.65},children:(e.period?e.period===`range`:typeof e.relation==`function`)?r.rangeLabel:`Right now`}):null,e.trend&&$(e.module)?(0,p.jsx)(uR,{kpi:e,ctx:r,refreshKey:i}):null]}),l={display:`flex`,flexDirection:`column`,gap:8,alignItems:`flex-start`,textAlign:`start`,minWidth:0,width:`100%`};return $(s)?(0,p.jsx)(`button`,{type:`button`,"data-tone":e.tone,className:`cc-dash-kpi is-link`,style:{...l,cursor:`pointer`,font:`inherit`,background:`none`,border:0,padding:0},onClick:()=>r.navigate(s),"aria-label":`${a}: ${xL(t)}. Open the list`,children:c}):(0,p.jsx)(`div`,{className:`cc-dash-kpi`,"data-tone":e.tone,style:l,children:c})}function mR({panel:e,counts:t,kpis:n,loading:r,ctx:i}){let a=hI(e.stages).map(e=>({...e,kpiDef:n.find(t=>t.key===e.kpi)})).filter(e=>e.kpiDef),o=a.map(e=>t[e.kpi]).filter(e=>Number.isFinite(e)).reduce((e,t)=>e+t,0);return r?(0,p.jsx)(d.Skeleton,{active:!0,paragraph:{rows:2}}):(0,p.jsxs)(`div`,{className:`cc-dash-stages`,children:[(0,p.jsx)(`div`,{className:`cc-dash-stages__bar`,role:`img`,"aria-label":a.map(e=>`${yI(vI(e.label??e.kpiDef.label,{},i))} ${xL(t[e.kpi])}`).join(`, `),style:{display:`flex`,height:10,borderRadius:5,overflow:`hidden`,gap:2},children:a.map((e,n)=>{let r=t[e.kpi];return(0,p.jsx)(`span`,{className:`cc-dash-stages__seg`,"data-i":n,style:{flex:o>0&&Number.isFinite(r)?Math.max(r,0):1,minWidth:Number.isFinite(r)&&r>0?6:2}},e.kpi)})}),(0,p.jsx)(`ol`,{className:`cc-dash-stages__list`,style:{listStyle:`none`,margin:`16px 0 0`,padding:0,display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(120px, 1fr))`,gap:12},children:a.map((e,n)=>{let r=yI(vI(e.label??e.kpiDef.label,{},i)),a=aR(e.kpiDef.to,i);return(0,p.jsx)(`li`,{className:`cc-dash-stages__item`,"data-i":n,children:(0,p.jsxs)(d.Button,{type:`text`,className:`cc-dash-stages__btn`,disabled:!$(a),onClick:()=>i.navigate(a),style:{height:`auto`,padding:4,display:`flex`,flexDirection:`column`,alignItems:`flex-start`},children:[(0,p.jsx)(`span`,{className:`cc-dash-stages__value`,children:xL(t[e.kpi])}),(0,p.jsx)(`span`,{className:`cc-dash-stages__label`,children:r})]})},e.kpi)})})]})}function hR({panel:e,ctx:t,refreshKey:r}){let i=iR(e.relation,t),a=JSON.stringify([e.module,i,e.limit,t.range.key,r]),[o,s]=(0,u.useState)({signature:``,rows:[],total:0,error:``}),[c,l]=(0,u.useState)(0);if((0,u.useEffect)(()=>{let t=!0,r=typeof i.scope==`string`?i.scope:``;return n.$t(e.module,Number(e.limit)||5,0,{scopeConditions:oF(i),...r?{scope:r}:{},...i.queryParams?{queryParams:i.queryParams}:{},...i.sort?{sort:i.sort,sortDir:i.sortDir||`desc`}:{}}).then(r=>{if(!t)return;let i=n.kt(r,e.module);s({signature:a,rows:hI(i?.rows),total:Number(i?.total)||0,error:``})}).catch(e=>{t&&s({signature:a,rows:[],total:0,error:e?.status===403?`forbidden`:e?.message||`error`})}),()=>{t=!1}},[a,c]),o.signature!==a)return(0,p.jsx)(d.Skeleton,{active:!0,title:!1,paragraph:{rows:4}});if(o.error===`forbidden`)return(0,p.jsx)(d.Typography.Text,{type:`secondary`,children:`You don't have access to this list.`});if(o.error)return(0,p.jsx)(d.Alert,{type:`warning`,showIcon:!0,message:`This list could not be loaded.`,action:(0,p.jsx)(d.Button,{size:`small`,onClick:()=>l(e=>e+1),children:`Retry`})});if(!o.rows.length)return(0,p.jsx)(LL,{spec:e.emptyState,ctx:t,fallback:yI(vI(e.empty,{},t))||`Nothing here right now.`});let m=aR(e.viewAll,t);return(0,p.jsxs)(p.Fragment,{children:[Array.isArray(e.columns)?(0,p.jsx)(GL,{panel:e,rows:o.rows,ctx:t}):(0,p.jsx)(`ul`,{className:`cc-dash-list`,style:{listStyle:`none`,margin:0,padding:0},children:o.rows.map((n,r)=>{let i=yI(_I(e.row?.title,n,t))||`—`,a=yI(_I(e.row?.meta,n,t)),o=yI(_I(e.row?.status,n,t)),s=aR(e.to,t,n);return(0,p.jsx)(`li`,{className:`cc-dash-list__row`,children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-dash-list__btn`,disabled:!$(s),onClick:()=>t.navigate(s),style:{display:`flex`,width:`100%`,alignItems:`center`,justifyContent:`space-between`,gap:12,minHeight:44,padding:`8px 0`,font:`inherit`,textAlign:`start`,background:`none`,border:0,cursor:$(s)?`pointer`:`default`},children:[(0,p.jsxs)(`span`,{style:{minWidth:0,display:`flex`,flexDirection:`column`},children:[(0,p.jsx)(`span`,{className:`cc-dash-list__title`,children:i}),a?(0,p.jsx)(`span`,{className:`cc-dash-list__meta`,children:a}):null]}),o?(0,p.jsx)(d.Tag,{className:`cc-dash-list__status`,style:{marginInlineEnd:0},children:o}):null]})},n?._id??n?.id??r)})}),$(m)?(0,p.jsxs)(d.Button,{type:`link`,className:`cc-dash-viewall`,onClick:()=>t.navigate(m),style:{paddingInline:0},children:[`View all `,o.total>o.rows.length?`(${xL(o.total)})`:``,` `,(0,p.jsx)(f.ArrowRightOutlined,{})]}):null]})}function gR({panel:e,ctx:t}){let n=hI(e.items).filter(e=>e&&$(e.key)&&bI(e,{},t));return(0,p.jsx)(`div`,{className:`cc-dash-links`,style:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(140px, 1fr))`,gap:8},children:n.map(e=>{let n=mI(e.icon),r=aR(e.to,t);return(0,p.jsx)(d.Button,{className:`cc-dash-link`,onClick:()=>t.navigate(r),disabled:!$(r),style:{height:`auto`,minHeight:44,justifyContent:`flex-start`,whiteSpace:`normal`,textAlign:`start`},icon:n,children:(0,p.jsxs)(`span`,{children:[yI(vI(e.label,{},t)),e.note?(0,p.jsx)(`small`,{className:`cc-dash-link__note`,style:{display:`block`},children:yI(vI(e.note,{},t))}):null]})},e.key)})})}function _R({panel:e,...t}){let n=yI(vI(e.title,{},t.ctx)),r=hI(e.choices?.options).filter(e=>e&&$(e.key)),[i,a]=(0,u.useState)(e.choices?.default??r[0]?.key),o=r.find(e=>e.key===i)??r[0],s;switch(e.type){case`stages`:s=(0,p.jsx)(mR,{panel:e,...t});break;case`list`:s=(0,p.jsx)(hR,{panel:e,ctx:t.ctx,refreshKey:t.refreshKey});break;case`links`:s=(0,p.jsx)(gR,{panel:e,ctx:t.ctx});break;case`chart`:s=(0,p.jsx)(lR,{panel:e,...t,choice:o});break;case`table`:s=(0,p.jsx)(HL,{panel:e,ctx:t.ctx,refreshKey:t.refreshKey,choice:o});break;case`feed`:s=(0,p.jsx)(UL,{panel:e,ctx:t.ctx,refreshKey:t.refreshKey});break;case`metrics`:s=(0,p.jsx)(WL,{panel:e,ctx:t.ctx,refreshKey:t.refreshKey});break;case`custom`:s=typeof e.render==`function`?e.render(t.ctx):null;break;default:s=(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,message:`Unknown panel type "${String(e.type)}"`})}return(0,p.jsxs)(`section`,{className:`cc-dash-panel${e.span===2?` is-wide`:``}`,"data-panel":e.key,"data-chart":e.chart,"aria-label":n||void 0,style:{minWidth:0},children:[n||r.length?(0,p.jsxs)(`div`,{className:`cc-dash-panel__head`,style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:12,flexWrap:`wrap`},children:[n?(0,p.jsxs)(d.Typography.Title,{level:5,className:`cc-dash-panel__title`,style:{marginTop:0},children:[n,e.titleNote?(0,p.jsxs)(`span`,{className:`cc-dash-panel__note`,children:[` `,yI(vI(e.titleNote,{},t.ctx))]}):null]}):(0,p.jsx)(`span`,{}),r.length?(0,p.jsxs)(`span`,{className:`cc-dash-panel__choice`,style:{display:`inline-flex`,alignItems:`center`,gap:8},children:[e.choices.label?(0,p.jsx)(`span`,{className:`cc-dash-panel__choice-label`,children:yI(vI(e.choices.label,{},t.ctx))}):null,(0,p.jsx)(d.Select,{size:`small`,className:`cc-dash-panel__select`,value:o?.key,onChange:a,popupMatchSelectWidth:!1,"aria-label":`${n}: ${yI(vI(e.choices.label,{},t.ctx))||`view`}`,options:r.map(e=>({value:e.key,label:yI(vI(e.label,{},t.ctx))}))})]}):null]}):null,s]})}function vR({config:e,refreshKey:t=0}){let n=(0,h.useNavigate)(),r=(0,h.useLocation)();Vc();let i=hI(e?.ranges).length?hI(e.ranges):nR,[a,o]=(0,u.useState)(e?.defaultRange||i[0].key),[s,c]=(0,u.useState)(0),[l,m]=(0,u.useState)(()=>new Date),g=`${t}|${s}`,_={...e?.context??{},navigate:e=>$(e)&&n(e),location:r,range:yL(a),rangeLabel:i.length>1?rR[a]??yI(vI(i.find(e=>e.key===a)?.label,{},{})):``,refresh:()=>{c(e=>e+1),m(new Date)}},v=hI(e?.kpis).filter(e=>e&&$(e.key)&&bI(e,{},_)),y=OF(v.filter(e=>typeof e.count!=`function`&&$(e.module)).map(e=>({key:e.key,module:e.module,relation:iR(e.relation,_),unscoped:!0})),``,g,{cacheMs:3e4}),b=fR(v,_,g),x={...y.counts,...b.counts},S=y.loading||b.loading,C=S?[]:SL(v,x,_),w=hI(e?.panels).filter(e=>e&&$(e.key)&&bI(e,{},_)),T=w.filter(e=>e.area===`grid`),E=w.filter(e=>e.area!==`side`&&e.area!==`grid`),D=w.filter(e=>e.area===`side`),O=xI(e?.buttons,{},_),k=yI(vI(e?.title,{},_))||`Dashboard`,A=yI(vI(e?.greeting,{},_)),j=yI(vI(e?.subtitle,{},_)),M={counts:x,kpis:v,loading:S,ctx:_,refreshKey:g},N=yI(vI(e?.user?.name,{},_)).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0].toUpperCase()).join(``),P=yI(vI(e?.user?.role,{},_)),F=new Date().toLocaleDateString([],{weekday:`long`,day:`numeric`,month:`long`,year:`numeric`}),I=hI(e?.links).filter(e=>e&&$(e.key)&&bI(e,{},_));return(0,p.jsxs)(`div`,{className:`cc-dash`,"data-profile":e?.key,children:[(0,p.jsxs)(`header`,{className:`cc-dash-hero`,style:{position:`relative`,overflow:`hidden`,display:`grid`,gap:16},children:[(0,p.jsx)(dR,{}),(0,p.jsxs)(`div`,{className:`cc-dash-hero__top`,style:{position:`relative`,display:`flex`,flexWrap:`wrap`,alignItems:`flex-start`,justifyContent:`space-between`,gap:16},children:[(0,p.jsxs)(`div`,{className:`cc-dash-hero__who`,style:{display:`flex`,alignItems:`center`,gap:16,minWidth:0,flex:`1 1 320px`},children:[N?(0,p.jsx)(`span`,{className:`cc-dash-hero__avatar`,"aria-hidden":`true`,style:{flex:`none`,display:`grid`,placeItems:`center`,width:56,height:56,borderRadius:`50%`,fontWeight:700,fontSize:20},children:N}):null,(0,p.jsxs)(`div`,{style:{minWidth:0},children:[(0,p.jsx)(`div`,{className:`cc-dash-hero__eyebrow`,children:[F,P].filter(Boolean).join(` · `)}),(0,p.jsx)(d.Typography.Title,{level:2,className:`cc-dash-hero__title`,style:{margin:0},children:A||k}),j?(0,p.jsx)(`div`,{className:`cc-dash-hero__sub`,children:j}):null]})]}),(0,p.jsxs)(`div`,{className:`cc-dash-hero__tools`,style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[i.length>1?(0,p.jsx)(d.Segmented,{className:`cc-dash-range`,value:a,onChange:e=>{o(e),m(new Date)},options:i.map(e=>({value:e.key,label:e.label,title:e.title??e.label}))}):null,(0,p.jsx)(d.Tooltip,{title:`Refresh the numbers`,children:(0,p.jsx)(d.Button,{className:`cc-dash-refresh`,icon:(0,p.jsx)(f.ReloadOutlined,{}),onClick:_.refresh,"aria-label":`Refresh`})}),O.map(e=>(0,p.jsx)(d.Button,{type:e.type,className:e.className,danger:e.danger,disabled:e.disabled,icon:e.icon,onClick:e.onClick,children:e.label},e.key))]})]}),(0,p.jsxs)(`div`,{className:`cc-dash-hero__bottom`,style:{position:`relative`,display:`flex`,flexWrap:`wrap`,alignItems:`center`,justifyContent:`space-between`,gap:12},children:[(0,p.jsxs)(`div`,{className:`cc-dash-hero__chips`,style:{display:`flex`,flexWrap:`wrap`,gap:8},"aria-live":`polite`,children:[v.some(e=>e.attention)&&!S?(0,p.jsxs)(`span`,{className:`cc-dash-hero__chip ${C.length?`is-warn`:`is-ok`}`,children:[C.length?(0,p.jsx)(f.WarningOutlined,{"aria-hidden":`true`}):(0,p.jsx)(f.CheckCircleOutlined,{"aria-hidden":`true`}),C.length?` ${C.length} ${C.length===1?`thing needs`:`things need`} your attention`:` All caught up`]}):null,(0,p.jsxs)(`span`,{className:`cc-dash-hero__chip`,title:`When these numbers were last loaded. Press refresh to load them again.`,children:[(0,p.jsx)(f.ClockCircleOutlined,{"aria-hidden":`true`}),` Updated `,l.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]})]}),I.length?(0,p.jsx)(`nav`,{className:`cc-dash-hero__links`,"aria-label":`Quick links`,style:{display:`flex`,flexWrap:`wrap`,gap:8},children:I.map(e=>(0,p.jsx)(d.Button,{className:`cc-dash-hero__link`,icon:mI(e.icon),onClick:()=>_.navigate(aR(e.to,_)),children:yI(vI(e.label,{},_))},e.key))}):null]})]}),e?.attentionBar!==!1&&v.some(e=>e.attention)&&(S||C.length>0)?(0,p.jsx)(`section`,{className:`cc-dash-attention${C.length?``:` is-clear`}`,"aria-label":`Needs attention`,"aria-live":`polite`,children:S?(0,p.jsx)(d.Skeleton.Input,{active:!0,size:`small`,style:{width:240}}):C.length?(0,p.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:8,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 260px), 1fr))`},children:C.map(e=>(0,p.jsxs)(`li`,{className:`cc-dash-attention__item`,style:{display:`flex`,alignItems:`center`,gap:12,minWidth:0},children:[(0,p.jsx)(f.WarningOutlined,{className:`cc-dash-attention__icon`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`cc-dash-attention__count`,children:xL(e.n)}),(0,p.jsx)(`span`,{className:`cc-dash-attention__text`,style:{flex:1,minWidth:0},children:e.text}),$(e.to)?(0,p.jsx)(d.Button,{size:`small`,className:`cc-dash-attention__review`,onClick:()=>_.navigate(e.to),children:`Review`}):null]},e.key))}):(0,p.jsxs)(`span`,{className:`cc-dash-attention__clear`,children:[(0,p.jsx)(f.CheckCircleOutlined,{"aria-hidden":`true`}),` All caught up. Nothing needs attention right now.`]})}):null,v.some(e=>e.show!==!1)?(0,p.jsx)(`section`,{className:`cc-dash-kpis`,"aria-label":`Key numbers`,style:{display:`grid`,gap:12,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 150px), 1fr))`},children:v.filter(e=>e.show!==!1).map(e=>(0,p.jsx)(pR,{kpi:e,value:x[e.key],loading:S&&x[e.key]===void 0,ctx:_,refreshKey:g},e.key))}):null,T.length?(0,p.jsx)(`div`,{className:`cc-dash-charts`,style:{display:`grid`,gap:16,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 320px), 1fr))`,alignItems:`stretch`},children:T.map(e=>(0,p.jsx)(_R,{panel:e,...M},e.key))}):null,E.length||D.length?(0,p.jsxs)(`div`,{className:`cc-dash-grid${D.length?` has-side`:``}`,style:{display:`grid`,gap:16,gridTemplateColumns:D.length?`repeat(auto-fit, minmax(min(100%, 340px), 1fr))`:`1fr`,alignItems:`start`},children:[(0,p.jsx)(`div`,{className:`cc-dash-main`,style:{display:`grid`,gap:16,minWidth:0},children:E.map(e=>(0,p.jsx)(_R,{panel:e,...M},e.key))}),D.length?(0,p.jsx)(`div`,{className:`cc-dash-side`,style:{display:`grid`,gap:16,minWidth:0},children:D.map(e=>(0,p.jsx)(_R,{panel:e,...M},e.key))}):null]}):null]})}var yR={...pI,assessment:f.FormOutlined,audit:f.AuditOutlined,book:f.BookOutlined,calendar:f.CalendarOutlined,check:f.CheckCircleOutlined,clipboard:f.SnippetsOutlined,clock:f.ClockCircleOutlined,done:f.FileDoneOutlined,file:f.FileTextOutlined,pdf:f.FilePdfOutlined,read:f.ReadOutlined,team:f.TeamOutlined,users:f.UsergroupAddOutlined,video:f.VideoCameraOutlined,wallet:f.WalletOutlined};function bR(e){if(!e)return null;if(typeof e!=`string`)return e;let t=yR[e.trim().toLowerCase()];return t?(0,u.createElement)(t):null}var xR=e=>`calc(${e} * var(--cc-ds-u, 1.5px))`,SR=(e,t)=>`max(${t}px, ${xR(e)})`,CR={neutral:[`#5b6475`,`#f1f3f7`],brand:[`var(--ant-color-primary, #1677ff)`,`var(--ant-color-primary-bg, #e6f4ff)`],green:[`#00c26b`,`#e6f9f0`],blue:[`#3b7cf6`,`#eaf1fe`],purple:[`#ab16f4`,`#f7e8fe`],orange:[`#f39a3d`,`#fff2e5`],teal:[`#12b5cb`,`#e6f8fb`],pink:[`#d6338a`,`#fde8f2`],red:[`#e5484d`,`#fdecec`]};Object.keys(CR);function wR(e){let t=CR[e]?e:`neutral`,[n,r]=CR[t];return{fg:`var(--cc-ds-tone-${t}-fg, ${n})`,bg:`var(--cc-ds-tone-${t}-bg, ${r})`}}var TR={ink:`var(--cc-ds-ink, #252744)`,value:`var(--cc-ds-value, #17202c)`,muted:`var(--cc-ds-muted, #8590aa)`,border:`var(--cc-ds-border, #ecedf7)`,surface:`var(--cc-ds-surface, #ffffff)`,link:`var(--cc-ds-link, var(--ant-color-primary, #1677ff))`,track:`var(--cc-ds-track, #eef0f6)`};function ER(e,t){if(typeof e==`number`&&Number.isFinite(e))try{return new Intl.NumberFormat(t).format(e)}catch{return String(e)}return typeof e==`boolean`?e?`Yes`:`No`:yI(e)}function DR(e,t,n,{locale:r,placeholder:i=`–`}={}){let a=ER(_I(e,t,n),r);return $(a)?a:i}function OR(e,t,n){let r=_I(e.items,t,n),i=Array.isArray(r)?r:[],a=e.map&&typeof e.map==`object`?e.map:null,o=Number.isFinite(e.limit)&&e.limit>=0?i.slice(0,e.limit):i;return a?o.map(e=>{if(!e||typeof e!=`object`)return e;let t={...e};return Object.entries(a).forEach(([n,r])=>{t[n]=gI(e,r)}),t}):o}var kR=(e,t)=>ER(e&&typeof e==`object`?e.text??e.label??e.title:e,t),AR=e=>(t,n,r,i)=>!OR(t,n,r).some(t=>t&&typeof t==`object`&&$(ER(t[e],i))),jR=(e,t,n)=>(Array.isArray(e.items)?e.items:[]).filter(e=>e&&bI(e,t,n)),MR={text:(e,t,n,r)=>!$(DR(e.value,t,n,{locale:r,placeholder:``})),fields:(e,t,n)=>jR(e,t,n).length===0,stats:(e,t,n)=>jR(e,t,n).length===0,list:(e,t,n,r)=>!OR(e,t,n).some(e=>$(kR(e,r))),tags:(e,t,n,r)=>!OR(e,t,n).some(e=>$(ER(e&&typeof e==`object`?e.label:e,r))),callout:(e,t,n,r)=>!$(vI(e.title,t,n))&&!$(DR(e.text,t,n,{locale:r,placeholder:``})),timeline:AR(`title`),people:AR(`name`),files:AR(`name`),progress:(e,t,n)=>!Number.isFinite(Number(_I(e.percent,t,n)))};function NR(e,t,n,r){return MR[e?.type]?.(e,t,n,r)??!1}var PR=e=>({display:`flex`,flexDirection:`column`,gap:xR(e),minWidth:0}),FR={body:{fontSize:SR(7.16,11),fontWeight:600,lineHeight:1.5,color:TR.muted},label:{fontSize:SR(6.6,11),fontWeight:600,lineHeight:1.5,color:TR.muted},value:{fontSize:SR(6.6,11),fontWeight:400,lineHeight:1.5,color:TR.value},small:{fontSize:SR(5.5,10),fontWeight:600,lineHeight:1.5,color:TR.muted},strong:{fontSize:SR(7.16,11),fontWeight:700,lineHeight:1.5,color:TR.ink},stat:{fontSize:SR(9.36,13),fontWeight:600,lineHeight:1.5,color:TR.ink},sub:{fontSize:SR(6.6,11),fontWeight:600,lineHeight:1.5,color:TR.ink,margin:0}};function IR({icon:e,tone:t,size:n=13}){let r=bR(e);if(!r)return null;let i=wR(t);return(0,p.jsx)(`span`,{className:`cc-details__badge`,"data-tone":t||`neutral`,"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flex:`none`,width:xR(n),height:xR(n),borderRadius:xR(n*.28),background:i.bg,color:i.fg,fontSize:xR(n*.58)},children:r})}function LR({block:e,data:t,ctx:n,locale:r}){let i=DR(e.value,t,n,{locale:r,placeholder:``}),a=Number.isFinite(e.lines)&&e.lines>0?e.lines:0,[o,s]=(0,u.useState)(!1),[c,l]=(0,u.useState)(!1),d=(0,u.useRef)(null);if((0,u.useLayoutEffect)(()=>{let e=d.current;!e||!a||o||l(e.scrollHeight-e.clientHeight>1)},[i,a,o]),!$(i))return null;let m=a&&!o?{display:`-webkit-box`,WebkitLineClamp:a,WebkitBoxOrient:`vertical`,overflow:`hidden`}:{},h=vI(e.more??`Show More`,t,n),g=vI(e.less??`Show Less`,t,n);return(0,p.jsxs)(`div`,{style:PR(3),children:[(0,p.jsx)(`p`,{ref:d,className:`cc-details__text`,style:{...FR.body,margin:0,whiteSpace:`pre-line`,...m},children:i}),a>0&&(c||o)&&$(h)&&(0,p.jsxs)(`button`,{type:`button`,className:`cc-details__more`,"aria-expanded":o,onClick:()=>s(e=>!e),style:{alignSelf:`flex-start`,padding:0,border:0,background:`none`,cursor:`pointer`,color:TR.link,fontSize:SR(6.05,11),fontWeight:600,display:`inline-flex`,alignItems:`center`,gap:xR(2)},children:[o?g:h,o?(0,p.jsx)(f.UpOutlined,{style:{fontSize:xR(4.5)}}):(0,p.jsx)(f.DownOutlined,{style:{fontSize:xR(4.5)}})]})]})}function RR({block:e,data:t,ctx:n,locale:r}){let i=(Array.isArray(e.items)?e.items:[]).filter(e=>e&&bI(e,t,n));if(!i.length)return null;let a=Number.isFinite(e.columns)&&e.columns>0?e.columns:1,o=6.6,s=Number.isFinite(e.minPairWidth)?e.minPairWidth:130,c=`calc((100% - ${a-1} * ${xR(o)}) / ${a})`,l=Number.isFinite(e.labelWidth)?xR(e.labelWidth):`minmax(0, 1fr)`;return(0,p.jsx)(`dl`,{className:`cc-details__fields`,style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(max(${xR(s)}, ${c}), 1fr))`,columnGap:xR(o),rowGap:xR(2.2),margin:0},children:i.map(e=>(0,p.jsxs)(`div`,{className:`cc-details__field`,style:{display:`grid`,gridTemplateColumns:`${l} minmax(0, 1fr)`,columnGap:xR(4),minWidth:0},children:[(0,p.jsx)(`dt`,{style:{...FR.label,margin:0},children:vI(e.label,t,n)}),(0,p.jsx)(`dd`,{style:{...FR.value,margin:0,overflowWrap:`anywhere`},children:DR(e.value,t,n,{locale:r})})]},e.key??vI(e.label,t,n)))})}function zR({block:e,data:t,ctx:n,locale:r}){let i=OR(e,t,n).map(e=>e&&typeof e==`object`?e:{text:e}),a=e.variant||`bullet`,o=wR(e.tone||(a===`check`?`green`:`neutral`)),s=i.filter(e=>$(ER(e.text??e.label??e.title,r)));return s.length?(0,p.jsx)(`ul`,{className:`cc-details__list cc-details__list--${a}`,style:{...PR(a===`check`?3.3:1.6),listStyle:`none`,margin:0,padding:0},children:s.map((e,t)=>{let n=ER(e.text??e.label??e.title,r),i=ER(e.meta,r);return(0,p.jsxs)(`li`,{style:{display:`flex`,alignItems:`flex-start`,gap:xR(a===`check`?3.3:2.4),...a===`plain`?FR.value:FR.label,color:TR.muted},children:[a===`bullet`&&(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{flex:`none`,width:xR(1.8),height:xR(1.8),marginTop:xR(3.2),borderRadius:`50%`,background:TR.muted}}),a===`check`&&(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{flex:`none`,color:o.fg,fontSize:xR(7),lineHeight:1,marginTop:xR(1.2)},children:bR(`check`)}),(0,p.jsxs)(`span`,{style:{minWidth:0},children:[(0,p.jsx)(`span`,{className:`cc-details__item-text`,children:n}),$(i)&&(0,p.jsx)(`span`,{className:`cc-details__item-sep`,style:{margin:`0 ${xR(4)}`},"aria-hidden":`true`,children:`•`}),$(i)&&(0,p.jsx)(`span`,{className:`cc-details__item-meta`,children:i})]})]},`${t}-${n}`)})}):null}function BR({block:e,data:t,ctx:n,locale:r}){let i=vI(e.title,t,n),a=DR(e.text,t,n,{locale:r,placeholder:``});return!$(i)&&!$(a)?null:(0,p.jsxs)(`div`,{className:`cc-details__callout`,style:{display:`flex`,gap:xR(6.6),alignItems:`flex-start`},children:[(0,p.jsx)(IR,{icon:e.icon,tone:e.tone,size:15.4}),(0,p.jsxs)(`div`,{style:PR(1.1),children:[$(i)&&(0,p.jsx)(`span`,{style:FR.strong,children:i}),$(a)&&(0,p.jsx)(`span`,{style:FR.small,children:a})]})]})}function VR({block:e,data:t,ctx:n,locale:r}){let i=OR(e,t,n).filter(e=>e&&typeof e==`object`);return i.length?(0,p.jsx)(`ol`,{className:`cc-details__timeline`,style:{listStyle:`none`,margin:0,padding:0,display:`flex`,flexDirection:`column`},children:i.map((e,t)=>(0,p.jsxs)(`li`,{style:{display:`flex`,gap:xR(6.6),minHeight:xR(e===i[i.length-1]?13:34.6)},children:[(0,p.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,flex:`none`},children:[(0,p.jsx)(IR,{icon:e.icon,tone:e.tone,size:13.2}),t<i.length-1&&(0,p.jsx)(`span`,{"aria-hidden":`true`,style:{flex:1,width:xR(.55),background:TR.border,margin:`${xR(2)} 0`}})]}),(0,p.jsxs)(`span`,{style:{...PR(.5),paddingTop:xR(.6)},children:[(0,p.jsx)(`span`,{style:FR.strong,children:ER(e.title,r)}),$(ER(e.text,r))&&(0,p.jsx)(`span`,{style:FR.small,children:ER(e.text,r)})]})]},`${t}-${ER(e.title,r)}`))}):null}function HR({block:e,data:t,ctx:n,locale:r}){let i=(Array.isArray(e.items)?e.items:[]).filter(e=>e&&bI(e,t,n));if(!i.length)return null;let a=e.variant===`tiles`;return(0,p.jsx)(`div`,{className:`cc-details__stats cc-details__stats--${a?`tiles`:`plain`}`,style:{display:`flex`,flexWrap:`wrap`,columnGap:xR(a?13:8.8),rowGap:xR(6.6),justifyContent:`space-between`},children:i.map(e=>{let i=DR(e.value,t,n,{locale:r}),o=e.valueTone?wR(e.valueTone).fg:TR.ink;return(0,p.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:xR(6.6),flex:a?`0 1 auto`:`1 0 auto`},children:[a&&(0,p.jsx)(IR,{icon:e.icon,tone:e.tone,size:17.6}),(0,p.jsxs)(`span`,{style:PR(0),children:[(0,p.jsx)(`span`,{style:{...FR.stat,color:o,whiteSpace:`nowrap`},children:i}),(0,p.jsx)(`span`,{style:FR.small,children:vI(e.label,t,n)})]})]},e.key??vI(e.label,t,n))})})}function UR({block:e,data:t,ctx:n,locale:r}){let i=OR(e,t,n).filter(e=>e&&typeof e==`object`&&$(ER(e.name,r)));return i.length?(0,p.jsx)(`ul`,{className:`cc-details__people`,style:{...PR(2.2),listStyle:`none`,margin:0,padding:0},children:i.map((e,t)=>{let n=ER(e.name,r);return(0,p.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:xR(4.4)},children:[(0,p.jsx)(d.Avatar,{src:$(e.avatar)?e.avatar:void 0,alt:``,style:{width:xR(15.4),height:xR(15.4),lineHeight:xR(15.4),fontSize:xR(6),flex:`none`},children:EI(n)}),(0,p.jsxs)(`span`,{style:PR(0),children:[(0,p.jsx)(`span`,{style:{...FR.strong,fontSize:SR(6.6,11)},children:n}),$(ER(e.subtitle,r))&&(0,p.jsx)(`span`,{style:FR.small,children:ER(e.subtitle,r)})]})]},`${t}-${n}`)})}):null}function WR({block:e,data:t,ctx:n,locale:r}){let i=Number(_I(e.percent,t,n));if(!Number.isFinite(i))return null;let a=Math.max(0,Math.min(100,i)),o=DR(e.caption,t,n,{locale:r,placeholder:``}),s=wR(e.tone||`brand`);return(0,p.jsxs)(`div`,{className:`cc-details__progress`,style:PR(3.3),children:[(0,p.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,style:{height:xR(2.2),borderRadius:xR(2),background:TR.track,overflow:`hidden`},children:(0,p.jsx)(`div`,{style:{width:`${a}%`,height:`100%`,borderRadius:`inherit`,background:s.fg}})}),$(o)&&(0,p.jsx)(`span`,{style:FR.small,children:o})]})}function GR({block:e,data:t,ctx:n,locale:r}){let i=OR(e,t,n).map(e=>e&&typeof e==`object`?e:{label:e}).filter(e=>$(ER(e.label,r)));return i.length?(0,p.jsx)(`div`,{className:`cc-details__tags`,style:{display:`flex`,flexWrap:`wrap`,gap:xR(3.3)},children:i.map((t,n)=>{let i=wR(t.tone||e.tone||`neutral`);return(0,p.jsx)(`span`,{"data-tone":t.tone||e.tone||`neutral`,style:{display:`inline-flex`,alignItems:`center`,padding:`${xR(1.6)} ${xR(4.4)}`,borderRadius:xR(3),background:i.bg,color:e.tone||t.tone?i.fg:TR.muted,fontSize:SR(5.5,10),fontWeight:400,lineHeight:1.5},children:ER(t.label,r)},`${n}-${ER(t.label,r)}`)})}):null}function KR({block:e,data:t,ctx:n,locale:r}){let i=OR(e,t,n).filter(e=>e&&typeof e==`object`&&$(ER(e.name,r)));return i.length?(0,p.jsx)(`ul`,{className:`cc-details__files`,style:{...PR(5.5),listStyle:`none`,margin:0,padding:0},children:i.map((t,n)=>{let i=ER(t.name,r),a=$(t.href)&&/^(https?:|\/|blob:)/i.test(String(t.href))?String(t.href):``;return(0,p.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:xR(5.5)},children:[(0,p.jsx)(IR,{icon:t.icon||`pdf`,tone:t.tone||e.tone||`pink`,size:13.2}),(0,p.jsxs)(`span`,{style:PR(0),children:[a?(0,p.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,style:{...FR.strong,fontSize:SR(6.6,11)},children:i}):(0,p.jsx)(`span`,{style:{...FR.strong,fontSize:SR(6.6,11)},children:i}),$(ER(t.meta,r))&&(0,p.jsx)(`span`,{style:FR.small,children:ER(t.meta,r)})]})]},`${n}-${i}`)})}):null}function qR(){return(0,p.jsx)(`hr`,{"aria-hidden":`true`,style:{border:0,borderTop:`0.55px solid ${TR.border}`,margin:`${xR(2)} 0`,width:`100%`}})}function JR({block:e,data:t,ctx:n}){if(typeof e.render!=`function`)return null;try{return e.render(t,n)??null}catch(e){return console.warn(`[DETAILSSECTION] custom block failed:`,e),null}}function YR({block:e,data:t,ctx:n,locale:r,registry:i}){if(!e||!bI(e,t,n))return null;let a=i[e.type];if(!a)return console.warn(`[DETAILSSECTION] unknown block type "${e.type}"`),(0,p.jsxs)(`div`,{role:`alert`,className:`cc-details__unknown`,style:{...FR.small,color:wR(`red`).fg},children:[`Unknown block type “`,String(e.type),`”`]});let o=e.type===`callout`?``:vI(e.title,t,n),s=NR(e,t,n,r),c=vI(e.empty,t,n);return s&&!$(c)?null:(0,p.jsxs)(`div`,{className:`cc-details__block cc-details__block--${e.type}`,style:PR(3.3),children:[$(o)&&(0,p.jsx)(`h4`,{className:`cc-details__subtitle`,style:FR.sub,children:o}),s?(0,p.jsx)(`span`,{className:`cc-details__empty`,style:FR.small,children:c}):(0,p.jsx)(a,{block:e,data:t,ctx:n,locale:r})]})}var XR={text:LR,fields:RR,list:zR,callout:BR,timeline:VR,stats:HR,people:UR,progress:WR,tags:GR,files:KR,divider:qR,custom:JR};function ZR(e,t,n,r,i=XR){return!e||!bI(e,t,n)?!1:!i[e.type]||!NR(e,t,n,r)||$(vI(e.empty,t,n))}var QR={gap:6,asideWidth:154,stackBelow:900,wrapBelow:640};function $R(e){let[t,n]=(0,u.useState)(0);return(0,u.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(t.getBoundingClientRect().width||0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function ez(e,t,n){if(typeof e.onClick==`function`)return e.onClick(t,n);if($(e.tab)&&typeof n?.openTab==`function`)return n.openTab(String(e.tab));if($(e.href)){let t=String(e.href);if(/^https?:/i.test(t))return window.open(t,`_blank`,`noopener,noreferrer`);if(typeof n?.navigate==`function`)return n.navigate(t)}}function tz({card:e,data:t,ctx:n,locale:r,registry:i,style:a}){let o=vI(e.title,t,n),s=e.action&&bI(e.action,t,n)?e.action:null,c=s?vI(s.label,t,n):``,l=`cc-details-${e.key}`;return(0,p.jsxs)(`section`,{className:`cc-details__card ${e.className??``}`.trim(),"data-card":e.key,"aria-labelledby":$(o)?l:void 0,style:{display:`flex`,flexDirection:`column`,gap:xR(6.6),minWidth:0,boxSizing:`border-box`,padding:xR(8.81),borderRadius:xR(5.5),border:`0.55px solid ${TR.border}`,background:TR.surface,...a},children:[($(o)||$(c))&&(0,p.jsxs)(`header`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:xR(4)},children:[$(o)&&(0,p.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:xR(5.5),minWidth:0},children:[e.icon?(0,p.jsx)(IR,{icon:e.icon,tone:e.tone,size:Number(e.iconSize)>0?Number(e.iconSize):17.6}):null,(0,p.jsx)(`h3`,{id:l,className:`cc-details__title`,style:{margin:0,fontSize:SR(8.81,12),fontWeight:600,lineHeight:1.5,color:TR.ink},children:o})]}),$(c)&&(0,p.jsxs)(`button`,{type:`button`,className:`cc-details__action`,onClick:()=>ez(s,t,n),style:{marginLeft:`auto`,padding:0,border:0,background:`none`,cursor:`pointer`,color:TR.link,fontSize:SR(6.05,11),fontWeight:400,lineHeight:1.5,whiteSpace:`nowrap`,display:`inline-flex`,alignItems:`center`,gap:xR(3)},children:[s.icon?(0,p.jsx)(`span`,{className:`cc-details__action-icon`,"aria-hidden":`true`,style:{display:`inline-flex`},children:bR(s.icon)}):null,c]})]}),(Array.isArray(e.blocks)?e.blocks:[]).map((e,a)=>(0,p.jsx)(YR,{block:e,data:t,ctx:n,locale:r,registry:i},e?.key??`${e?.type}-${a}`))]})}var nz=(e,t,n,r,i)=>!!e?.key&&bI(e,t,n)&&(Array.isArray(e.blocks)?e.blocks:[]).some(e=>ZR(e,t,n,r,i));function rz({config:e,data:t={},ctx:n={},className:r=``}){Vc();let i=(0,u.useRef)(null),a=$R(i),o=e&&typeof e==`object`?e:{},s={...QR,...o.layout??{}},c=o.locale,l={...XR,...o.blocks&&typeof o.blocks==`object`?o.blocks:{}},d=xR(s.gap),f=a>0,m=f&&a<s.stackBelow,h=f&&a<s.wrapBelow,g=(Array.isArray(o.main)?o.main:[]).map(e=>(Array.isArray(e)?e:[e]).filter(e=>nz(e,t,n,c,l))).filter(e=>e.length>0),_=(Array.isArray(o.aside)?o.aside:[]).filter(e=>nz(e,t,n,c,l));if(!g.length&&!_.length)return null;let v=e=>Number.isFinite(e.width)&&e.width>0?e.width:1;return(0,p.jsxs)(`div`,{ref:i,className:`cc-details ${r}`.trim(),role:`region`,"aria-label":vI(o.label,t,n)||void 0,"data-layout":h?`single`:m?`stacked`:`wide`,style:{display:`flex`,flexDirection:m?`column`:`row`,alignItems:`flex-start`,gap:d,width:`100%`,boxSizing:`border-box`,fontFamily:`var(--cc-ds-font, inherit)`},children:[g.length>0&&(0,p.jsx)(`div`,{className:`cc-details__main`,style:{display:`flex`,flexDirection:`column`,gap:d,flex:`1 1 0`,minWidth:0,width:m?`100%`:void 0},children:g.map(e=>(0,p.jsx)(`div`,{className:`cc-details__row`,style:{display:`flex`,flexDirection:h?`column`:`row`,alignItems:`stretch`,gap:d},children:e.map(e=>(0,p.jsx)(tz,{card:e,data:t,ctx:n,locale:c,registry:l,style:{flex:h?`1 1 auto`:`${v(e)} 1 0`}},e.key))},e.map(e=>e.key).join(`|`)))}),_.length>0&&(0,p.jsx)(`aside`,{className:`cc-details__aside`,style:{display:m&&!h?`grid`:`flex`,flexDirection:`column`,gap:d,minWidth:0,gridTemplateColumns:m&&!h?`repeat(${Math.min(_.length,3)}, minmax(0, 1fr))`:void 0,width:m?`100%`:xR(s.asideWidth),flex:`none`,alignItems:m&&!h?`start`:`stretch`},children:_.map(e=>(0,p.jsx)(tz,{card:e,data:t,ctx:n,locale:c,registry:l},e.key))})]})}var iz=`.ant-modal-wrap:not([style*="display: none"]), .ant-drawer-open, .ant-picker-dropdown:not(.ant-picker-dropdown-hidden), .ant-select-dropdown:not(.ant-select-dropdown-hidden), .ant-dropdown:not(.ant-dropdown-hidden)`,az=`cc-mdw-detail-window-width`,oz=32;function sz(e){try{let t=Number(localStorage.getItem(e));return Number.isFinite(t)&&t>0?t:null}catch{return null}}function cz(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}function lz({topBar:e=null,rail:t=null,list:n=null,compactList:r=null,detail:i=null,detailOpen:a=!1,detailExpanded:o=!1,detailMode:s=`split`,detailWidth:c,onDetailWidthChange:l,defaultDetailWidth:d=720,minDetailWidth:f=480,maxDetailWidthRatio:m=.75,widthStorageKey:h=az,railCollapsed:g=!1,railOverlay:_=!1,onCloseRailOverlay:v,onCloseDetail:y,railWidth:b=264,collapsedRailWidth:x=52,compactListWidth:S=340,className:C=``,ariaLabel:w=`Workspace`}){let T=s===`window`,E=(0,u.useRef)(null),D=(0,u.useRef)(null),O=(0,u.useRef)(null),[k,A]=(0,u.useState)(()=>sz(h)??d),j=c??k;(0,u.useEffect)(()=>{if(a){!O.current&&typeof document<`u`&&(O.current=document.activeElement),D.current?.focus({preventScroll:!0});return}let e=O.current;O.current=null,e&&typeof e.focus==`function`&&document.contains(e)&&e.focus({preventScroll:!0})},[a]),(0,u.useEffect)(()=>{if(!a||typeof document>`u`)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(iz)||y?.()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a,y]);let M=(0,u.useCallback)(e=>{let t=E.current?.getBoundingClientRect().width||0,n=t>0?Math.max(f,t*m):1/0;return Math.round(Math.min(Math.max(e,f),n))},[f,m]),N=(0,u.useCallback)(e=>{let t=M(e);return l&&l(t),c??(A(t),cz(h,t)),t},[M,c,l,h]),P=e=>{if(e.button!==0)return;e.preventDefault();let t=E.current,n=t?.querySelector(`.cc-mdw__body`);if(!t||!n)return;let r=n.getBoundingClientRect().right,i=j,a=e=>{i=M(r-e.clientX-12),t.style.setProperty(`--cc-detail-window-w`,`${i}px`)},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),t.classList.remove(`cc-mdw--resizing`),N(i)};t.classList.add(`cc-mdw--resizing`),window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},F=e=>{e.key===`ArrowLeft`?(e.preventDefault(),N(j+oz)):e.key===`ArrowRight`&&(e.preventDefault(),N(j-oz))},I=a?o?`expanded`:`open`:`closed`,L=T?g:a||g,R=!T&&a&&_,z=!T&&a&&!!r,B={"--cc-rail-w":`${b}px`,"--cc-rail-collapsed-w":`${x}px`,"--cc-compact-list-w":`${S}px`,"--cc-detail-window-w":`${j}px`};return(0,p.jsxs)(`div`,{ref:E,className:[`cc-mdw`,`cc-mdw--${I}`,T?`cc-mdw--window`:`cc-mdw--split`,L?`cc-mdw--rail-collapsed`:``,R?`cc-mdw--rail-overlay`:``,t==null?`cc-mdw--no-rail`:``,C].filter(Boolean).join(` `),style:B,"aria-label":w,children:[e&&(0,p.jsx)(`div`,{className:`cc-mdw__top`,children:e}),(0,p.jsxs)(`div`,{className:`cc-mdw__body`,children:[t!=null&&(0,p.jsx)(`div`,{className:`cc-mdw__rail`,children:t}),R&&(0,p.jsx)(`button`,{type:`button`,className:`cc-mdw__rail-backdrop`,"aria-label":`Close filters`,onClick:v}),(0,p.jsxs)(`div`,{className:`cc-mdw__list`,"aria-hidden":I===`expanded`||void 0,children:[(0,p.jsx)(`div`,{className:`cc-mdw__list-full${z?` is-hidden`:``}`,children:n}),z&&(0,p.jsx)(`div`,{className:`cc-mdw__list-compact`,children:r})]}),(0,p.jsxs)(`section`,{ref:D,className:`cc-mdw__detail`,tabIndex:-1,"aria-hidden":!a||void 0,"aria-label":`Details`,children:[T&&a&&!o&&(0,p.jsx)(`div`,{className:`cc-mdw__resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize details`,"aria-valuenow":j,"aria-valuemin":f,tabIndex:0,onPointerDown:P,onKeyDown:F}),a?i:null]})]})]})}function uz({primaryAction:e,menuActions:t=[],onAction:n,size:r=`large`,className:i=``}){if(!e)return null;let a=t.map(e=>({key:e.key,label:e.label,icon:e.icon,disabled:!!e.disabled})),o=(0,p.jsx)(d.Button,{type:`primary`,size:r,icon:e.icon??(0,p.jsx)(f.PlusOutlined,{}),onClick:()=>n?.(e.key),children:e.label});return a.length?(0,p.jsxs)(d.Space.Compact,{className:`cc-create-btn ${i}`.trim(),children:[o,(0,p.jsx)(d.Dropdown,{trigger:[`click`],placement:`bottomRight`,menu:{items:a,onClick:({key:e})=>n?.(e)},children:(0,p.jsx)(d.Button,{type:`primary`,size:r,icon:(0,p.jsx)(f.DownOutlined,{}),"aria-label":`More create options`})})]}):(0,p.jsx)(`span`,{className:`cc-create-btn ${i}`.trim(),children:o})}function dz({title:e=null,searchValue:t=``,onSearch:n,searchPlaceholder:r=`Search…`,minChars:i=3,debounceMs:a=350,primaryAction:o=null,menuActions:s=[],onAction:c,extra:l=null,className:m=``,showSearch:h=!0}){let[g,_]=(0,u.useState)(t??``),[v,y]=(0,u.useState)(t??``),b=(0,u.useRef)(t??``),x=(0,u.useRef)(null);(t??``)!==v&&(y(t??``),_(t??``)),(0,u.useEffect)(()=>{b.current=t??``},[t]),(0,u.useEffect)(()=>()=>clearTimeout(x.current),[]);let S=e=>{clearTimeout(x.current),x.current=null;let t=String(e??``).trim(),r=t.length>=i?t:``;t.length>0&&t.length<i||r!==b.current&&(b.current=r,n?.(r))},C=e=>{let t=e.target.value;if(_(t),clearTimeout(x.current),t.trim()===``){S(``);return}x.current=setTimeout(()=>S(t),a)},w=g.trim(),T=w.length>0&&w.length<i;return(0,p.jsxs)(`div`,{className:`cc-topbar ${m}`.trim(),children:[e&&(0,p.jsx)(`div`,{className:`cc-topbar__title`,children:e}),h&&(0,p.jsxs)(`div`,{className:`cc-topbar__search`,children:[(0,p.jsx)(d.Input,{allowClear:!0,size:`large`,prefix:(0,p.jsx)(f.SearchOutlined,{"aria-hidden":!0}),placeholder:r,value:g,onChange:C,onPressEnter:()=>S(g),"aria-label":r,"aria-describedby":T?`cc-topbar-hint`:void 0}),T&&(0,p.jsxs)(`span`,{id:`cc-topbar-hint`,className:`cc-topbar__hint`,children:[`Type at least `,i,` characters`]})]}),(0,p.jsxs)(`div`,{className:`cc-topbar__actions`,children:[l,(0,p.jsx)(uz,{primaryAction:o,menuActions:s,onAction:c})]})]})}function fz(e){return e===!0||e===1||e===`1`||String(e).toLowerCase()===`true`}function pz(e,t){if(!(!e||!t))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:String(t).split(`.`).reduce((e,t)=>e?.[t],e)}function mz(e){return e==null||e===``?``:Array.isArray(e)?e.map(mz).filter(Boolean).join(`, `):typeof e==`object`?mz(e.label??e.value??e.name??e.title??``):String(e)}function hz(e){return e?.field??e?.value??e?.fieldName??e?.key??``}function gz(e){return(Array.isArray(e)?e:[]).filter(e=>hz(e)&&e.isVisible!==!1&&e.isVisible!==0&&e.isVisible!==`0`).slice().sort((e,t)=>Number(e.order??0)-Number(t.order??0))}function _z(e){let t=gz(e),n=t.find(e=>fz(e.isLink))??t[0]??null,r=t.find(e=>String(e.renderType??``).toLowerCase()===`badge`&&e!==n)??null;return{title:n,status:r,meta:t.filter(e=>e!==n&&e!==r).slice(0,2)}}function vz(e){let t=e?._id??e?.id;return t&&typeof t==`object`?String(t.$oid??``):t==null?``:String(t)}function yz({snapshot:e,loading:t=!1,selectedId:n,onSelect:r,onPage:i,ariaLabel:a=`Records`,emptyText:o=`No records`}){let s=(0,u.useRef)(null),c=e?.rows??[],{title:l,status:m,meta:h}=(0,u.useMemo)(()=>_z(e?.fields),[e?.fields]),g=e?.page??1,_=e?.limit??10,v=e?.total??0,y=Math.max(1,Math.ceil(v/Math.max(1,_)));return(0,p.jsxs)(`div`,{className:`cc-compact-list`,children:[(0,p.jsxs)(`div`,{className:`cc-compact-list__head`,children:[(0,p.jsxs)(`span`,{children:[v.toLocaleString(),` `,v===1?`result`:`results`]}),t&&(0,p.jsx)(d.Spin,{size:`small`})]}),c.length===0?(0,p.jsx)(`div`,{className:`cc-compact-list__empty`,children:t?(0,p.jsx)(d.Spin,{}):(0,p.jsx)(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE,description:o})}):(0,p.jsx)(`ul`,{ref:s,className:`cc-compact-list__items`,role:`listbox`,"aria-label":a,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`].includes(e.key))return;let t=[...s.current?.querySelectorAll(`[data-record-id]`)??[]],n=t.indexOf(document.activeElement),r=e.key===`ArrowDown`?Math.min(t.length-1,n+1):Math.max(0,n-1);t[r]&&(e.preventDefault(),t[r].focus())},children:c.map((e,t)=>{let i=vz(e),a=mz(pz(e,hz(l)))||`—`,o=m?mz(pz(e,hz(m))):``,s=h.map(t=>mz(pz(e,hz(t)))).filter(Boolean).join(` · `),c=i&&String(i)===String(n??``);return(0,p.jsxs)(`li`,{"data-record-id":i,role:`option`,"aria-selected":c,tabIndex:0,className:`cc-compact-item${c?` is-selected`:``}`,onClick:()=>i&&r?.(i,e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&i&&(t.preventDefault(),r?.(i,e))},children:[(0,p.jsxs)(`div`,{className:`cc-compact-item__row`,children:[(0,p.jsx)(d.Tooltip,{title:a,mouseEnterDelay:.6,children:(0,p.jsx)(`span`,{className:`cc-compact-item__title`,children:a})}),o&&(0,p.jsx)(d.Tag,{className:`cc-compact-item__status`,children:o})]}),s&&(0,p.jsx)(`div`,{className:`cc-compact-item__meta`,children:s})]},i||t)})}),y>1&&(0,p.jsxs)(`div`,{className:`cc-compact-list__pager`,children:[(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.LeftOutlined,{}),disabled:g<=1||t,onClick:()=>i?.(g-1),"aria-label":`Previous page`}),(0,p.jsxs)(`span`,{children:[g,` / `,y]}),(0,p.jsx)(d.Button,{size:`small`,icon:(0,p.jsx)(f.RightOutlined,{}),disabled:g>=y||t,onClick:()=>i?.(g+1),"aria-label":`Next page`})]})]})}var bz=[];function xz({component:e,id:t,moduleName:n,onDescriptionSaved:r,record:i}){return e?(0,p.jsx)(e,{id:t,moduleName:n,onDescriptionSaved:r,record:i}):null}function Sz({tabs:e=[],activeKey:t,onChange:n,max:r=11,alwaysShowMore:i=!1,moreEmptyLabel:a=`Nothing more`}){let o=e.length>r?e.slice(0,r):e,s=e.length>r?e.slice(r):bz,c=s.some(e=>e.key===t);return(0,p.jsxs)(`div`,{className:`cc-detail__tabs`,role:`tablist`,"aria-label":`Record sections`,children:[o.map(e=>(0,p.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===t,className:`cc-detail__tab-btn${e.key===t?` is-active`:``}`,onClick:()=>n(e.key),children:e.label??e.key},e.key)),(s.length>0||i)&&(0,p.jsx)(d.Dropdown,{trigger:[`click`],placement:`bottomRight`,menu:{items:s.length?s.map(e=>({key:e.key,label:e.label??e.key})):[{key:`__empty`,label:a,disabled:!0}],selectable:!0,selectedKeys:c?[t]:[],onClick:({key:e})=>n(e)},children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-detail__tab-btn cc-detail__tab-more${c?` is-active`:``}`,"aria-haspopup":`menu`,children:[c?s.find(e=>e.key===t)?.label:`More`,` `,(0,p.jsx)(f.DownOutlined,{})]})})]})}function Cz({moduleName:e,id:t,customConfigName:n,breadcrumb:r=null,stats:i=null,toolbarExtra:a=null,banner:o=null,expanded:s=!1,onToggleExpand:c,onClose:l,refreshKey:m=0,showActivity:g=!0,showNotes:v=!0,users:y=[],onHeaderData:b,onRecordLoaded:x,onHeaderAction:S,onTabChange:C,layout:w=`auto`,stackBelow:T=900,headerSlot:E=null,headerEndSlot:D=null,collapseLabel:O=`Show list`,tabsPlacement:k=`header`,maxVisibleTabs:A=11,alwaysShowMore:j=!1,moreEmptyLabel:M,extraTabs:N=bz,defaultTab:P=`details`}){let F=(0,u.useRef)(null),I=E!=null||D!=null,[L,R]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=F.current;if(!e||!I)return;let t=()=>{let t=e.querySelector(`.znx-dh-actions-col`);R(e=>e===t?e:t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0}),()=>n.disconnect()},[I]);let[z,B]=(0,u.useState)(null);(0,u.useEffect)(()=>{let e=F.current;if(!e||w!==`auto`||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width??0;t>0&&B(t<T)});return t.observe(e),()=>t.disconnect()},[w,T]);let V=w===`stacked`||w===`auto`&&z===!0,[H,U]=(0,h.useSearchParams)(),W=H.get(`tab`)||P,G=os(),[ee,te]=(0,u.useState)(0),[ne,re]=(0,u.useState)(null),[ie,ae]=(0,u.useState)(()=>new Set([W]));ie.has(W)||ae(new Set([...ie,W]));let oe=(0,u.useMemo)(()=>Oa(e)?.tabs??bz,[e]),se=(0,u.useMemo)(()=>N.length?[...oe,...N]:oe,[oe,N]),ce=Fn(se,{id:t,moduleName:e,record:ne}),K=e=>e===`details`||!se.some(t=>t.key===e&&typeof t.visibleWhen==`function`)||ce.some(t=>t.key===e),le=t=>N.find(e=>e.key===t)?.component??as(e,t),ue=(e,t)=>{let n=new URLSearchParams(H);n.set(`tab`,e),U(n,{replace:!0}),C?.(e,t)},de=e=>{re(e),x?.(e)},fe=m+G,pe=()=>te(e=>e+1),me=W===`details`||!K(W)||!le(W),he=k===`below`;return(0,p.jsxs)(`div`,{ref:F,className:`cc-detail${V?` cc-detail--stacked`:``}${he?` cc-detail--tabs-below`:``}`,children:[(0,p.jsxs)(`div`,{className:`cc-detail__toolbar`,children:[(0,p.jsx)(`nav`,{className:`cc-detail__crumbs`,"aria-label":`Breadcrumb`,children:r}),(0,p.jsxs)(`div`,{className:`cc-detail__toolbar-right`,children:[i,E&&!L?E:null,D&&!L?D:null,a,c&&(0,p.jsx)(d.Tooltip,{title:s?O:`Expand`,children:(0,p.jsx)(d.Button,{type:`text`,icon:s?(0,p.jsx)(f.CompressOutlined,{}):(0,p.jsx)(f.ExpandOutlined,{}),"aria-label":s?O:`Expand details`,onClick:c})}),l&&(0,p.jsx)(d.Tooltip,{title:`Close (Esc)`,children:(0,p.jsx)(d.Button,{type:`text`,icon:(0,p.jsx)(f.CloseOutlined,{}),"aria-label":`Close details`,onClick:l})})]})]}),(0,p.jsxs)(`div`,{className:`cc-detail__scroll`,children:[(0,p.jsx)(ns,{moduleName:e,customConfigName:n,id:t,defaultTab:W,onAction:S,onTabChange:ue,onHeaderData:b,onRecordLoaded:de,refreshKey:fe}),E&&L?(0,_.createPortal)((0,p.jsx)(`div`,{className:`cc-detail__header-slot`,children:E}),L):null,D&&L?(0,_.createPortal)((0,p.jsx)(`div`,{className:`cc-detail__header-end`,children:D}),L):null,he&&ce.length>0&&(0,p.jsx)(Sz,{tabs:ce,activeKey:me?`details`:W,onChange:e=>ue(e),max:A,alwaysShowMore:j,moreEmptyLabel:M}),o,(0,p.jsx)(`div`,{className:`cc-detail__tab cc-detail__details v1-detail-page`,hidden:!me,children:(me||ie.has(`details`))&&(0,p.jsxs)(d.Row,{gutter:[16,16],align:`stretch`,className:`v1-detail-row`,children:[(0,p.jsx)(d.Col,{xs:24,xl:V?24:16,className:`v1-detail-col-main`,children:(0,p.jsx)(Xi,{moduleName:e,id:t,refreshKey:ee+fe,onDescriptionSaved:pe})}),(0,p.jsx)(d.Col,{xs:24,xl:V?24:8,className:`v1-detail-col-rail`,children:(0,p.jsx)(ln,{moduleName:e,id:t,users:y,showActivity:g,showNotes:v,refreshKey:fe})})]})}),[...ie].filter(e=>e!==`details`).map(n=>{let r=K(n)?le(n):null;return r?(0,p.jsx)(`div`,{className:`cc-detail__tab`,hidden:n!==W,children:(0,p.jsx)(xz,{component:r,id:t,moduleName:e,onDescriptionSaved:pe,record:ne})},n):null})]})]})}function wz({items:e=[]}){return(0,p.jsx)(`ol`,{className:`cc-crumbs`,children:e.map((t,n)=>(0,p.jsxs)(`li`,{className:`cc-crumbs__item`,children:[n>0&&(0,p.jsx)(f.RightOutlined,{className:`cc-crumbs__sep`,"aria-hidden":!0}),t.onClick?(0,p.jsx)(`button`,{type:`button`,className:`cc-crumbs__link`,onClick:t.onClick,children:t.label}):(0,p.jsx)(`span`,{"aria-current":n===e.length-1?`page`:void 0,children:t.label})]},`${t.label}-${n}`))})}function Tz(e,t,{max:r=12,refreshKey:i=0}={}){let a=`${e}|${t}|${i}`,[o,s]=(0,u.useState)({key:``,groups:null,error:null});return(0,u.useEffect)(()=>{if(!e||!t)return;let r=!1;return n.Yt({module:e,id:t,view:`detail`}).then(e=>{r||s({key:a,groups:Array.isArray(e)?e:[],error:null})}).catch(e=>{r||s({key:a,groups:null,error:e})}),()=>{r=!0}},[e,t,a]),{fields:(0,u.useMemo)(()=>ZP(o.groups,r),[o.groups,r]),loading:o.key!==a,error:o.error}}function Ez({open:e,title:t,extra:n=null,footer:r=null,onClose:i,width:a=320,className:o=``,children:s}){let c=(0,u.useRef)(null);return(0,u.useEffect)(()=>{e&&c.current?.focus({preventScroll:!0})},[e]),e?(0,p.jsxs)(`aside`,{ref:c,className:`cc-side-panel ${o}`.trim(),style:{"--cc-side-panel-w":`${a}px`},"aria-label":typeof t==`string`?t:`Quick view`,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.stopPropagation(),i?.())},children:[(0,p.jsxs)(`header`,{className:`cc-side-panel__head`,children:[(0,p.jsx)(`span`,{className:`cc-side-panel__title`,children:t}),(0,p.jsxs)(`span`,{className:`cc-side-panel__extra`,children:[n,(0,p.jsx)(d.Button,{type:`text`,size:`small`,icon:(0,p.jsx)(f.CloseOutlined,{}),"aria-label":`Close quick view`,onClick:i})]})]}),(0,p.jsx)(`div`,{className:`cc-side-panel__body`,children:s}),r&&(0,p.jsx)(`footer`,{className:`cc-side-panel__foot`,children:r})]}):null}function Dz({open:e,moduleName:t,title:n,width:r=760,onClose:a,onCreated:o,formProps:s={}}){return(0,p.jsx)(d.Drawer,{open:e,title:n??`Add`,size:r,placement:`right`,onClose:a,mask:{closable:!1},keyboard:!1,destroyOnHidden:!0,className:`cc-add-drawer`,styles:{body:{paddingTop:8}},children:e&&t&&(0,p.jsx)(i.t,{...s,moduleName:t,embedded:!0,onCancel:a,onSuccess:(e,t)=>{o?.(e,t),a?.()}})})}var Oz=`q`,kz=`f`,Az=`view`,jz=`lp`,Mz=`full`,Nz=[];function Pz(e){if(e.get(Az)===Mz)return;let t=RP(e);t>1&&e.set(jz,String(t)),[...e.keys()].filter(e=>/^p\d+$/.test(e)).forEach(t=>e.delete(t))}var Fz={open:`Live`,connecting:`Connecting…`,reconnecting:`Reconnecting…`,unauthorized:`Live updates paused`,idle:`Live`};function Iz(e){return e===`open`?`is-open`:e===`reconnecting`||e===`connecting`?`is-reconnecting`:``}function Lz(){try{return Number(localStorage.getItem(`userId`))||0}catch{return 0}}function Rz({listModule:e,detailModule:t,detailConfigName:n,title:r,basePath:i,listTabs:a,recordParam:o=`id`,searchPlaceholder:s=`Search…`,searchFields:c,createActions:l,relatedTopics:f=Nz,quickViewTitle:m=`Quick View`,quickViewWidth:g=420,renderQuickViewExtra:_,renderQuickView:v,renderFullView:y,renderFullViewStats:b,fullViewBreadcrumbLabel:x=`Details`,listProps:S,topBarInFullView:C=!0,showTopBarSearch:w=!0,openRecordIn:T=`quick`,quickViewMode:E=`docked`,defaultRailCollapsed:D=!1,showRail:O=!0,listComponent:k,actionsInListToolbar:A=!1}){let{tab:j}=(0,h.useParams)(),M=(0,h.useNavigate)(),[N,P]=(0,h.useSearchParams)(),F=Array.isArray(a)&&a.length>0,I=F?a.find(e=>e.toLowerCase()===String(j??``).toLowerCase()):void 0,L=N.get(o)||``,R=T===`full`,z=!!L&&(R||N.get(Az)===Mz),B=E===`overlay`,[V,H]=(0,u.useState)(D),U=N.get(Oz)||``,W=N.get(kz)||``,G=(0,u.useMemo)(()=>EP(W),[W]),[ee,te]=(0,u.useState)(null),[ne,re]=(0,u.useState)(0),ie=os(),ae=fI({topics:[UF(e)]}),oe=fI({topics:L?[WF(e,L)]:Nz,enabled:!!L}),se=fI({topics:L?[...f,WF(e,L)]:Nz,enabled:!!L}),ce=cI(),{fetchData:K,loading:le}=IP({filters:G,search:U,refreshTick:ae.tick+ne}),ue=Lz(),de=oe.lastEvent,fe=de&&de.actorId&&de.actorId!==ue?de.eventId:null,[pe,me]=(0,u.useState)(null),he=fe&&fe!==pe?fe:null;(0,u.useEffect)(()=>{if(!he)return;let e=setTimeout(()=>me(he),6e3);return()=>clearTimeout(e)},[he]);let q=(0,u.useCallback)((e,{replace:t=!1,resetPage:n=!1}={})=>{let r=new URLSearchParams(N);e(r),n&&(r=zP(r,1)),r.toString()!==N.toString()&&P(r,{replace:t})},[N,P]),ge=(0,u.useCallback)(e=>{e&&q(t=>{t.get(o)!==e&&(t.set(o,e),t.delete(`tab`),t.delete(`subTab`)),R?(Pz(t),t.set(Az,Mz)):t.delete(Az)})},[R,o,q]),_e=(0,u.useCallback)(e=>{let t=e&&typeof e==`object`&&typeof e.tab==`string`?e.tab:``;q(e=>{Pz(e),e.set(Az,Mz),t&&(e.set(`tab`,t),e.delete(`subTab`))})},[q]),ve=e=>{if(e.get(Az)!==Mz&&!e.has(jz))return;let t=Number(e.get(jz))||1;[...e.keys()].filter(e=>/^p\d+$/.test(e)).forEach(t=>e.delete(t)),e.delete(jz),t>1&&e.set(`p${t}`,``)},ye=(0,u.useCallback)(()=>{q(e=>{ve(e),e.delete(Az),e.delete(`tab`),e.delete(`subTab`)})},[q]),J=(0,u.useCallback)(()=>{q(e=>{ve(e),e.delete(o),e.delete(Az),e.delete(`tab`),e.delete(`subTab`)})},[o,q]),be=(0,u.useCallback)(e=>{q(t=>{e?t.set(Oz,e):t.delete(Oz)},{replace:!0,resetPage:!0})},[q]),xe=(0,u.useCallback)(e=>{SP(e)!==SP(G)&&q(t=>{let n=TP(e);n?t.set(kz,n):t.delete(kz)},{resetPage:!0})},[G,q]),Se=(0,u.useCallback)(e=>{if(!F)return;let t=a.find(t=>t.toLowerCase()===String(e??``).trim().toLowerCase());if(!t||t===I)return;let n=zP(N,1).toString();M({pathname:`${i}/${t}`,search:n?`?${n}`:``})},[i,F,I,a,M,N]),Ce=(0,u.useMemo)(()=>l?.primary?[l.primary,...l.menu??[]]:[],[l]),we=(0,u.useCallback)(e=>{let t=Ce.find(t=>t.key===e);if(!t)return;let n=typeof t.formProps==`function`?t.formProps({recordId:L}):t.formProps;te({...t,resolvedFormProps:n??void 0})},[Ce,te,L]),Te=(0,u.useCallback)(e=>{d.message.success(`${String(ee?.label??`Record`).replace(/^Add\s+/i,``)} created`),re(e=>e+1),ee?.openCreatedRecord&&e&&ge(String(e))},[ee,ge,re]),Ee=(0,u.useMemo)(()=>({moduleName:e,...F?{selectedSource:I,onTabChange:Se}:{},fetchData:K,searchFields:c,showSearch:!1,showFilterButton:!1,showAdd:!1,showViewToggle:!1,autoCardForExternalRows:!1,showSummaryButton:!0,...S??{}}),[e,F,I,Se,K,c,S]),De=(0,u.useMemo)(()=>A?(0,p.jsxs)(`span`,{className:`cc-list-toolbar-actions`,children:[ce!==`disabled`&&(0,p.jsxs)(`span`,{className:`cc-live-pill`,"aria-live":`polite`,children:[(0,p.jsx)(`span`,{className:`cc-live-dot ${Iz(ce)}`}),Fz[ce]??`Offline`]}),(0,p.jsx)(uz,{primaryAction:l?.primary??null,menuActions:l?.menu??[],onAction:we,size:`middle`})]}):null,[A,ce,l,we]),Oe=(0,u.useMemo)(()=>De?{...Ee,toolbarExtra:De}:Ee,[Ee,De]);if(F&&!I){let e=N.toString();return(0,p.jsx)(h.Navigate,{to:{pathname:`${i}/${a[0]}`,search:e?`?${e}`:``},replace:!0})}let ke=he?(0,p.jsx)(d.Alert,{type:`info`,showIcon:!0,message:`This record was just updated by someone else — the view has been refreshed.`,style:{margin:`0 0 12px`}}):null,Ae={id:L,listTab:I,isFull:z,recordTick:oe.tick+ne+ie,relatedTick:se.tick+ne+ie,onOpenFull:_e,onBackToQuick:R?null:ye,onClose:J,updatedBanner:ke,renderCreateButton:(e={})=>(0,p.jsx)(uz,{primaryAction:l?.primary??null,menuActions:l?.menu??[],onAction:we,...e})},je=null;L&&!z?je=v?v(Ae):(0,p.jsx)(eF,{moduleName:t,configName:n,id:L,title:m,refreshKey:Ae.recordTick,onOpenFull:_e,onClose:J,extra:_?_(Ae):null},L):L&&z&&(je=y?y(Ae):(0,p.jsx)(Cz,{moduleName:t,customConfigName:n,id:L,expanded:!0,onToggleExpand:R?void 0:ye,collapseLabel:`Back to quick view`,onClose:J,refreshKey:Ae.recordTick,banner:ke,headerEndSlot:C?null:Ae.renderCreateButton({size:`middle`}),stats:b?b(Ae):null,breadcrumb:(0,p.jsx)(wz,{items:[{label:r,onClick:J},{label:x}]})},L));let Me=Iz(ce);return(0,p.jsxs)(`div`,{className:`cc-module-workspace${k?` cc-module-workspace--host-list`:``}`,children:[(0,p.jsx)(lz,{ariaLabel:r,detailMode:`window`,defaultDetailWidth:g,minDetailWidth:340,maxDetailWidthRatio:.6,widthStorageKey:`cc-quickview-width:${e}`,detailOpen:B?z:!!L,detailExpanded:z,onCloseDetail:z&&!R?ye:J,railCollapsed:V,topBar:z&&!C||!z&&A?null:(0,p.jsx)(dz,{title:r,searchValue:U,onSearch:be,searchPlaceholder:s,showSearch:w,primaryAction:l?.primary??null,menuActions:l?.menu??[],onAction:we,extra:ce!==`disabled`&&(0,p.jsx)(d.Tooltip,{title:`Changes made by others appear here automatically`,children:(0,p.jsxs)(`span`,{className:`cc-live-pill`,"aria-live":`polite`,children:[(0,p.jsx)(`span`,{className:`cc-live-dot ${Me}`}),Fz[ce]??`Offline`]})})}),rail:O?(0,p.jsx)(kP,{moduleName:e,scope:I??``,value:G,onChange:xe,collapsed:V,onExpand:()=>H(!1),onCollapse:()=>H(!0)}):null,list:z?null:(0,p.jsx)(VP,{component:k,listProps:Oe,loading:le,selectedRecordId:L||void 0,onOpenRecord:ge}),detail:B&&!z?null:je}),B&&(0,p.jsx)(HP,{open:!!L&&!z,onClose:J,width:g,ariaLabel:m,children:z?null:je}),(0,p.jsx)(Dz,{open:!!ee,moduleName:ee?.moduleName,title:ee?.title,onClose:()=>te(null),onCreated:Te,formProps:ee?.resolvedFormProps})]})}var zz=[];function Bz(e){let t=[e,e?.data,e?.data?.data],n=t.map(e=>e?.total??e?.pagination?.total).find(e=>Number.isFinite(Number(e))&&e!==null&&e!==``),r=t.map(e=>e?.tabs).find(Array.isArray)??zz;return{total:n===void 0?null:Number(n),tabs:r}}var Vz=[`module:candidates`,`module:submissions`];function Hz({listProps:e,moduleName:t,filterModule:n,renderQuickView:r,quickViewWidth:i=340,railWidth:a=240,liveTopics:o=Vz,renderHeader:s,resultsTitle:c,fallbackView:l,preferredView:d,viewSource:f=`default`,fill:m=!1,quickViewMode:g=`docked`,defaultRailCollapsed:_=!1,collapsedRailWidth:v=44,showRail:y=!0}){let[b,x]=(0,u.useState)(_),[S,C]=(0,u.useState)(zz),[w,T]=(0,u.useState)(``),[E,D]=(0,u.useState)(null),[O,k]=(0,u.useState)({total:null,tabs:zz,durationMs:null}),A=fI({topics:o,enabled:!!e?.fetchData,debounceMs:800}),j=e?.fetchData,{fetchData:M,loading:N}=IP({filters:S,baseFetch:(0,u.useMemo)(()=>typeof j==`function`?async(...e)=>{let t=typeof performance<`u`?performance.now():Date.now(),n=await j(...e),r=typeof performance<`u`?performance.now():Date.now();return k({...Bz(n),durationMs:Math.max(0,r-t)}),n}:j,[j]),refreshTick:A.tick}),[P,F]=(0,h.useSearchParams)(),I=(0,u.useCallback)(e=>{if(SP(S)===SP(e))return;C(e),D(null);let t=zP(P,1);t.toString()!==P.toString()&&F(t,{replace:!0})},[S,P,F]),L=(0,u.useMemo)(()=>({...e??{},fetchData:M,showFilterButton:!1,...l&&f==="default"?{activeView:l}:{},...d&&f!==`user`?{activeView:d}:{},onTabChange:t=>{T(String(t??``)),D(null),e?.onTabChange?.(t)}}),[e,M,l,d,f]),R=E&&typeof r==`function`?r({id:E.id,record:E.record,onClose:()=>D(null)}):null;if(!e?.fetchData)return null;let z=g===`overlay`,B=!!R&&!z,V=typeof s==`function`?s({total:O.total,tabs:O.tabs,durationMs:O.durationMs,loading:N}):null;return(0,p.jsxs)(`div`,{className:`cc-search-ws${B?` cc-search-ws--quick`:``}${b?` cc-search-ws--rail-collapsed`:``}${y?``:` cc-search-ws--no-rail`}${V?` cc-search-ws--head`:``}${m?` cc-search-ws--fill`:``}`,style:{"--cc-search-rail-w":`${b?v:a}px`,"--cc-search-quick-w":`${i}px`},children:[V&&(0,p.jsx)(`div`,{className:`cc-search-ws__head`,children:V}),y&&(0,p.jsx)(`div`,{className:`cc-search-ws__rail`,children:(0,p.jsx)(kP,{moduleName:n||t,scope:w,value:S,onChange:I,title:`Filters`,collapsed:b,onExpand:()=>x(!1),onCollapse:()=>x(!0)})}),(0,p.jsxs)(`div`,{className:`cc-search-ws__results`,children:[typeof c==`function`&&O.total!==null&&(0,p.jsx)(`div`,{className:`cc-search-ws__results-title`,children:c(O.total)}),(0,p.jsx)(VP,{listProps:L,loading:N,selectedRecordId:E?.id,onOpenRecord:(e,t)=>D({id:String(e),record:t??null})})]}),B&&(0,p.jsx)(`div`,{className:`cc-search-ws__quick`,children:R}),z&&(0,p.jsx)(HP,{open:!!R,onClose:()=>D(null),width:i,children:R})]})}function Uz(e){return(e??[]).filter(e=>e!=null&&String(e).trim()!==``)}function Wz({icon:e=(0,p.jsx)(f.SearchOutlined,{}),title:t=`Search`,criteria:n=[],details:r=[],badge:i=null,onEdit:a,editLabel:o=`Edit Search`,expanded:s=!1,onToggle:c,className:l=``}){let u=Uz(n),m=Uz(r);return(0,p.jsxs)(`section`,{className:`cc-search-summary ${l}`.trim(),"aria-label":`${t} summary`,children:[(0,p.jsx)(`span`,{className:`cc-search-summary__icon`,"aria-hidden":!0,children:e}),(0,p.jsxs)(`div`,{className:`cc-search-summary__text`,children:[(0,p.jsxs)(`div`,{className:`cc-search-summary__title`,children:[(0,p.jsxs)(`span`,{className:`cc-search-summary__lead`,children:[t,u.length?`:`:``]}),u.map((e,t)=>(0,p.jsx)(`span`,{className:`cc-search-summary__part`,children:e},`${e}-${t}`))]}),m.length>0&&(0,p.jsx)(`div`,{className:`cc-search-summary__details`,children:m.map((e,t)=>(0,p.jsx)(`span`,{className:`cc-search-summary__part`,children:e},`${e}-${t}`))})]}),(0,p.jsxs)(`div`,{className:`cc-search-summary__actions`,children:[i,a&&(0,p.jsx)(d.Button,{className:`cc-search-summary__edit`,onClick:a,children:o}),c&&(0,p.jsx)(d.Tooltip,{title:s?`Hide search form`:`Show search form`,children:(0,p.jsx)(d.Button,{className:`cc-search-summary__toggle`,icon:s?(0,p.jsx)(f.UpOutlined,{}):(0,p.jsx)(f.DownOutlined,{}),"aria-label":s?`Hide search form`:`Show search form`,"aria-expanded":s,onClick:c})})]})]})}function Gz(...e){try{for(let t of e){let e=(localStorage.getItem(t)||``).trim();if(e)return e}}catch{}return``}function Kz(e){return String(e||``).split(` `).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function qz(e){let t=String(e||``).split(` `).filter(Boolean);return t.length?`${t[0].charAt(0)}${t.length>1?t.at(-1).charAt(0):``}`.toUpperCase():`U`}function Jz(e){let t=`url("${String(e).replace(/"/g,`%22`)}")`;return{WebkitMaskImage:t,maskImage:t}}function Yz(){return(0,p.jsxs)(`span`,{className:`cc-frame__logo`,"aria-label":`Zinnext`,children:[(0,p.jsx)(`span`,{className:`cc-frame__logo-icon`,style:Jz(Tp)}),(0,p.jsx)(`span`,{className:`cc-frame__logo-text`,style:Jz(Ep)})]})}function Xz({value:e=``,placeholder:t,onSearch:n}){let[r,i]=(0,u.useState)(e),[a,o]=(0,u.useState)(e);return e!==a&&(o(e),i(e)),(0,p.jsx)(d.Input,{className:`cc-frame__search-input`,allowClear:!0,prefix:(0,p.jsx)(f.SearchOutlined,{"aria-hidden":!0}),placeholder:t,"aria-label":t,value:r,onChange:e=>{i(e.target.value),e.target.value===``&&n?.(``)},onPressEnter:()=>n?.(r.trim())})}function Zz({navItems:e=[],brand:n=null,search:r=null,headerExtra:i=null,user:a=null,userMenuItems:o=[],loginPath:s=`/login`,children:c}){let l=(0,h.useLocation)(),m=(0,h.useNavigate)(),[g,_]=(0,u.useState)(!1),[v,y]=(0,u.useState)(l.pathname);v!==l.pathname&&(y(l.pathname),_(!1));let b=Kz(a?.name||Gz(`userName`,`preferred_Username`)||`User`),x=a?.subtitle??Gz(`roleName`,`userRoleName`),S=[...o,...o.length?[{type:`divider`}]:[],{key:`cc-frame-logout`,icon:(0,p.jsx)(f.LogoutOutlined,{}),danger:!0,label:`Logout`,onClick:()=>{t.g(),m(s,{replace:!0})}}];return(0,p.jsxs)(`div`,{className:`cc-frame${g?` cc-frame--nav-open`:``}`,children:[(0,p.jsxs)(`header`,{className:`cc-frame__header`,children:[(0,p.jsx)(d.Button,{type:`text`,className:`cc-frame__nav-toggle`,icon:(0,p.jsx)(f.MenuOutlined,{}),"aria-label":g?`Close navigation`:`Open navigation`,"aria-expanded":g,onClick:()=>_(e=>!e)}),(0,p.jsx)(`div`,{className:`cc-frame__brand`,children:n??(0,p.jsx)(Yz,{})}),r&&(0,p.jsx)(`div`,{className:`cc-frame__search`,children:(0,p.jsx)(Xz,{value:r.value??``,placeholder:r.placeholder??`Search…`,onSearch:r.onSearch})}),(0,p.jsxs)(`div`,{className:`cc-frame__header-end`,children:[i,(0,p.jsx)(d.Dropdown,{menu:{items:S},trigger:[`click`],placement:`bottomRight`,children:(0,p.jsxs)(`button`,{type:`button`,className:`cc-frame__user`,"aria-label":`Open user menu`,children:[(0,p.jsx)(d.Avatar,{size:40,className:`cc-frame__avatar`,children:qz(b)}),(0,p.jsxs)(`span`,{className:`cc-frame__user-text`,children:[(0,p.jsx)(`span`,{className:`cc-frame__user-name`,children:b}),x?(0,p.jsx)(`span`,{className:`cc-frame__user-sub`,children:x}):null]}),(0,p.jsx)(f.DownOutlined,{className:`cc-frame__user-caret`,"aria-hidden":!0})]})})]})]}),(0,p.jsxs)(`nav`,{className:`cc-frame__nav`,"aria-label":`Main`,children:[(0,p.jsx)(`div`,{className:`cc-frame__nav-brand`,children:n??(0,p.jsx)(Yz,{})}),(0,p.jsx)(`ul`,{className:`cc-frame__nav-list`,children:e.map(e=>{let t=typeof e.match==`function`?e.match(l.pathname):l.pathname.startsWith(e.to);return(0,p.jsx)(`li`,{children:(0,p.jsxs)(h.Link,{to:e.to,className:`cc-frame__nav-item${t?` is-active`:``}`,"aria-current":t?`page`:void 0,children:[e.icon?(0,p.jsx)(`span`,{className:`cc-frame__nav-icon`,"aria-hidden":!0,children:e.icon}):null,(0,p.jsx)(`span`,{className:`cc-frame__nav-label`,children:e.label})]})},e.key)})})]}),g&&(0,p.jsx)(`button`,{type:`button`,className:`cc-frame__backdrop`,"aria-label":`Close navigation`,onClick:()=>_(!1)}),(0,p.jsx)(`main`,{className:`cc-frame__main`,children:(0,p.jsx)(`div`,{className:`cc-frame__content`,children:(0,p.jsx)(jm,{loginPath:s,children:(0,p.jsx)(Im,{children:c??(0,p.jsx)(h.Outlet,{})})})})})]})}var Qz=new Intl.NumberFormat;function $z(e){return e==null||typeof e==`string`&&e.trim()===``}function eB(e,t){let n=(Array.isArray(e?.options)?e.options:[]).find(e=>String(e?.value??e)===String(t));return String(n&&typeof n==`object`?n.label??n.value??t:t)}function tB(e,t){if($z(t))return``;if(typeof t==`boolean`)return t?String(e?.label??e?.field??``):``;if(typeof t==`object`){if(typeof t.format==`function`)return t.format(`DD MMM YYYY`);if(`label`in t||`value`in t)return String(t.label??t.value??``);let e=t.from??t.min??t.start,n=t.to??t.max??t.end;return!$z(e)||!$z(n)?[e,n].filter(e=>!$z(e)).join(`–`):``}return eB(e,t).trim()}function nB(e={},t=[],{skip:n=[]}={}){let r=new Set(n);return(t??[]).flatMap(t=>{let n=t?.field;if(!n||r.has(n))return[];let i=e?.[n];if($z(i))return[];if(El(t)){let{terms:e,expression:t}=Tl(i),n=e.map(e=>e.value).filter(Boolean);return n.length?[n.join(`, `)]:t.trim()?[t.trim()]:[]}if(Array.isArray(i)){let e=i.map(e=>tB(t,e)).filter(Boolean);return e.length?[e.join(`, `)]:[]}let a=tB(t,i);return a?[a]:[]})}function rB(e){return!Number.isFinite(e)||e<0?``:e<1e4?`${(e/1e3).toFixed(1)} seconds`:`${Math.round(e/1e3)} seconds`}function iB(e){return Number.isFinite(e)?Qz.format(e):``}function aB({enabled:e=!0,children:t}){let[n]=(0,u.useState)(()=>e?eI():null);return(0,u.useEffect)(()=>{if(!n)return;tI();let e=()=>n.nudge(),t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`online`,e),document.removeEventListener(`visibilitychange`,t),nI()}},[n]),(0,p.jsx)(YF.Provider,{value:n,children:t})}async function oB(e,t,n,r={}){return sB(e,aF(t,n),r)}async function sB(e,t,{limit:r=20,offset:i=0,sort:a=``,sortDir:o=``}={}){let s=Array.isArray(t)?t.filter(e=>e?.field):[];if(!e||s.length===0)return{rows:[],total:0};let c=await n.$t(e,r,i,{sort:a,sortDir:o,scopeConditions:s}),l=n.kt(c,e);return{rows:Array.isArray(l?.rows)?l.rows:[],total:Number(l?.total)||0}}typeof window<`u`&&(window.__CORE_THEME_BUILD__=`2026-11-12T12:07:14.264Z`);var cB=ak,lB=hh(bM),uB=hh(SM),dB=hh(LM),fB=hh(YM),pB=hh(iN),mB=hh(sN),hB=hh(uN),gB=hh(pN),_B=hh(hN),vB=hh(ON),yB=hh(AN);exports.ACTION_RULE_SURFACES=n.At,exports.ADMIN_API_URL=t.y,exports.ADMIN_APP_ID=t.b,exports.APP_ID=t.x,exports.AUTH_URL=t.S,exports.ActionInputBox=HI,exports.ActivityNotesCard=ln,exports.ActivityTab=rn,exports.AddBatchCandidatePopup=PO,exports.AddFormV1=i.t,exports.AddRecordDrawer=Dz,exports.AdminDashboard=ak,exports.AdminDashboardContent=jC,exports.AdminPage=cB,exports.AppAlert=c.a,exports.AppButton=n.Kn,exports.AppShell=Rm,exports.ApprovalActionBar=Gd,exports.AssigneeAvatars=un,exports.AuthGuard=jm,exports.BILLING_STATUS_FLOW=Qa,exports.BOOLEAN_API_KEYS=ju,exports.BOOLEAN_PARSEABLE_API_KEYS=gl,exports.BUILT_IN_WIZARD_STEP_TYPES=n.et,exports.BULK_UPLOAD_DEFAULT_ACCEPT=dn,exports.BULK_UPLOAD_DEFAULT_MAX_SIZE_MB=fn,exports.Breadcrumb=n.Dt,exports.BulkUploadPage=dB,exports.BulkUploadPanel=bn,exports.CANDIDATES_URL=t.C,exports.CONTRACT_C2C=gf,exports.CONTRACT_W2=hf,exports.CURRENCY_SYMBOLS=Ur,exports.CalendarCard=j,exports.CombinedDashboardPage=vR,exports.DASHBOARDPAGE=vR,exports.CombinedDetailViewPage=vL,exports.DETAILVIEWPAGE=vL,exports.CombinedHomePage=iL,exports.HOMEPAGE=iL,exports.CompactRecordList=yz,exports.CoreThemeAdminApp=FC,exports.CoreThemeAdminRoutes=PC,exports.CreateActionButton=uz,exports.CustomPagination=n.ci,exports.DEFAULT_HOURS_POLICY=pd,exports.DEFAULT_RESULTS_VIEW=Du,exports.DETAILSSECTION=rz,exports.DetailsSection=rz,exports.DETAILS_BLOCKS=XR,exports.DETAILS_ICONS=yR,exports.DayLogModal=Ld,exports.DescriptionBlock=Nn,exports.DetailHeaderCard=ns,exports.DetailViewPage=ls,exports.DetailViewV1=Xi,exports.DocumentViewer=r.t,exports.DynamicCards=It,exports.DynamicPopup=nE,exports.DynamicPopupRoute=zO,exports.DynamicTabs=n.di,exports.DynamicWizard=uc,exports.EditFormV1=ic,exports.FIELD_TYPE_REGISTRY=Zl,exports.FINANCE_APPROVAL_CONFIG=sf,exports.FINANCE_TYPE_CFO=$d,exports.FINANCE_TYPE_ONBOARDING_MANAGER=Qd,exports.FINANCE_TYPE_ONBOARDING_MANAGER_REAPPROVE=nf,exports.FINANCE_TYPE_ONLY_FINANCE=ef,exports.FINANCE_TYPE_SUBMISSION_MANAGER=Zd,exports.FINANCE_TYPE_SUBMISSION_MANAGER_REAPPROVE=tf,exports.FileListCard=xp,exports.FilterRail=kP,exports.FinanceApprovalPanel=ep,exports.FinanceAvatar=Po,exports.FinanceBadge=Ro,exports.FinanceDayCell=qd,exports.FinanceDivider=Eo,exports.FinanceEmployeeCell=Fo,exports.FinanceEmptyState=Co,exports.FinanceEquation=Do,exports.FinanceHistoryTimeline=jo,exports.FinanceHoursGrid=So,exports.FinanceKpiRow=xo,exports.FinanceLine=To,exports.FinanceListToolbar=fd,exports.FinanceMarginBadge=zo,exports.FinanceMoneyCell=Lo,exports.FinanceRecordsTable=Ho,exports.FinanceRowChevron=Bo,exports.FinanceSection=wo,exports.FinanceStatusPill=bo,exports.FinanceTextCell=Io,exports.FinanceTimesheetAnalysis=Yd,exports.FinanceWorkflowSteps=Oo,exports.HOURS_MESSAGES=md,exports.Header=Xp,exports.HierarchyUserFilter=Vt,exports.HubOverview=aL,exports.JOBS_URL=t.w,exports.LegacyAdminPage=lB,exports.ListView=n.rt,exports.ListWithQuickView=UP,exports.LmsHomePage=yB,exports.LmsTestForm=vB,exports.Login=zm,exports.MATCH_NOTHING=tF,exports.MailPopup=fw,exports.ManageModules=mB,exports.ManageSubmodules=hB,exports.MasterDetailWorkspace=lz,exports.ModuleRowActions=Tc,exports.ModuleWorkspace=Rz,exports.NotesPanel=Wd,exports.NotesTab=cn,exports.OPEN_AS_OPTIONS=vu,exports.PAGE_ICONS=pI,exports.PAYROLL_STATUS_FLOW=$a,exports.POPUP_CONFIGS=TO,exports.PanelBreadcrumb=wz,exports.PanelTabs=Sz,exports.ParamCardView=Yc,exports.ParamListView=tl,exports.PaymentInvoicePopup=YO,exports.PeriodBadgeTag=Ed,exports.PreviewPopup=Uw,exports.ProjectSelect=mh,exports.ProofUploadPreview=Ud,exports.QuickLogBar=Bd,exports.QuickLogSelectionBar=Rd,exports.QuickViewCard=rL,exports.QuickViewModuleActions=WI,exports.QuickViewPopover=HP,exports.RAIL_KIND=oP,exports.REALTIME_STATUS=VF,exports.RESULTS_VIEW_OPTIONS=Eu,exports.RealtimeProvider=aB,exports.RecordDetailPanel=Cz,exports.RecordHub=fL,exports.RecordQuickView=eF,exports.RecordSidePanel=Ez,exports.RejectionReasonModal=zd,exports.RelatedModuleTab=jF,exports.SUBMISSIONS_URL=t.E,exports.SearchBuilderV1=rd,exports.SearchResultsWorkspace=Hz,exports.SearchSummaryBanner=Wz,exports.SettingsPage=Sj,exports.Sidebar=Dm,exports.StatStrip=c.i,exports.StatusBadge=ad,exports.StatusBadgeTag=Td,exports.StickyNotesFullPage=uB,exports.StylishDynamicTabs=sd,exports.TemplateEditor=ld,exports.TestForm=fB,exports.TestingHomePage=_B,exports.TimelineGroups=Yt,exports.TimesheetDayCell=Pd,exports.TipTapEditor=n.si,exports.UserForm=ik,exports.VendorShareDrawer=UO,exports.ViewSummaryWidget=n.Et,exports.WIZARD_ACTIONS_CONTRACT_VERSION=n.N,exports.WIZARD_ACTIONS_PATH=n.P,exports.WIZARD_CONTENT_TYPES=n.L,exports.WizardAccessMatrixStep=n.R,exports.WizardActionError=n.F,exports.WizardActivityStep=n.z,exports.WizardChoiceCardsStep=n.B,exports.WizardDeclarationStep=n.V,exports.WizardListStep=n.H,exports.WizardPermissionMatrixStep=n.q,exports.WizardPopup=Yw,exports.WizardPreview=n.U,exports.WizardPreviewStep=n.J,exports.WizardStepContent=n.W,exports.WizardSuccessStep=n.G,exports.WizardUnknownContentStep=n.K,exports.WorkspaceAppFrame=Zz,exports.WorkspaceListView=VP,exports.WorkspaceTopBar=dz,exports.ZinnextTableView=gB,exports.ZinnextTestForm=pB,exports.actedRecently=n.it,exports.actionRuleConditionMatches=n.Mt,exports.adminActionAllowed=Bc,exports.appNow=n.fi,exports.applyIntegrationStatus=n.Oi,exports.approveSubmission=q,exports.attentionItems=SL,exports.buildAcceptAttr=_n,exports.buildBooleanRequest=Iu,exports.buildCsv=mo,exports.buildDailyRows=so,exports.buildDayGradient=Md,exports.buildFormWizardSteps=n.in,exports.buildRateHistoryEntries=Vf,exports.buildRelationConditions=aF,exports.buildSearchRequest=Vu,exports.buildWeeklyRollup=uo,exports.canonicalModule=HF,exports.clearNewRecord=n.at,exports.clearSelectedProject=t.i,exports.colors=n.ui,exports.computeFinance=Nf,exports.computeHoursPolicy=bd,exports.computeMarginBand=fo,exports.conditionMatches=n.r,exports.configureCoreTheme=t.D,exports.configuredFieldLabel=n.i,exports.configuredWizardSteps=sc,exports.confirmAction=n.pt,exports.countActiveRows=xP,exports.createAllWorkflowsListFetcher=rP,exports.createMergedListFetcher=ZN,exports.createModuleListFetchAdapter=WN,exports.createRealtimeClient=JF,exports.createWorkflowStageListFetcher=QN,exports.currencySymbol=Wr,exports.dashboardRange=yL,exports.defaultMergeRow=IN,exports.deleteIntegrationConfig=n.zi,exports.deriveDayStats=oo,exports.describeCapacity=Sd,exports.displayText=mz,exports.downloadCsv=vo,exports.draftToRows=yP,exports.evaluateShowIfWith=n.a,exports.fetchJsonWithAuth=t.o,exports.fetchRelatedRecords=oB,exports.fetchScopedRecords=sB,exports.fillConfirmText=n.ht,exports.findEmployerRow=Df,exports.flattenGroups=Tf,exports.formatAmount=Xr,exports.formatApp=n.pi,exports.formatAppDateTime=n.mi,exports.formatFileSize=gn,exports.formatFinanceMoney=Hf,exports.formatHours=Ua,exports.formatMoney=Zr,exports.formatPercent=Ga,exports.formatRate=Qr,exports.formatSearchCount=iB,exports.formatSearchDuration=rB,exports.getActivity=n.Xr,exports.getAllWorkflowsModuleList=iP,exports.getAppTimeZone=n.hi,exports.getApprovalDate=Ya,exports.getBgcIntegrationConfig=n.ra,exports.getBgcIntegrationSummary=n.ia,exports.getBillingActionStates=eo,exports.getBooleanEligibleTypes=ru,exports.getCurrentRoleName=t.c,exports.getFieldLabel=go,exports.getFieldType=$l,exports.getFileExtension=hn,exports.getFinanceApprovalConfig=ff,exports.getFormGroups=s.r,exports.getFormGroupsRaw=up,exports.getIntegrationConfig=n.da,exports.getIntegrationConfigs=n.fa,exports.getIntegrationSummary=n.pa,exports.getModuleConfig=Pe,exports.getModuleDataDetail=n.Qr,exports.getPayrollActionStates=to,exports.getPeriodBadgeConfig=Ie,exports.getSearchPopup=hu,exports.getSelectedProject=t.l,exports.getStoredToken=t.u,exports.getStoredUser=t.d,exports.getUserRoles=t.f,exports.getVMSApprove=ge,exports.getValueStyle=_o,exports.getWorkflowStageModuleList=aP,exports.getWorkflowSteps=no,exports.humanizeEvent=Ja,exports.indexFieldConfig=ho,exports.initialsOf=Ka,exports.inputPayload=Zb,exports.insertTokenAtCursor=bl,exports.invalidateGetCache=t.p,exports.isBooleanEligible=eu,exports.isBooleanParsable=vl,exports.isTester=t.m,exports.isWizardConfigEnabled=n.an,exports.isWizardConfigReady=n.on,exports.listPropsForColumns=OI,exports.logout=t.g,exports.makeSearchFetcher=Wu,exports.mapListResponse=n.kt,exports.marginIncludesReferral=mf,exports.markNewRecord=n.ot,exports.matchLocationTax=Mf,exports.mergeWizardSubmitValues=n.sn,exports.moduleTopic=UF,exports.moduleViewAllowed=n.Rt,Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return fs}}),exports.newRecordMarks=n.ct,exports.normalizeConfirm=n.yt,exports.normalizeContract=kf,exports.normalizeInputPrompt=Jb,exports.normalizePageLayout=SI,exports.parseRows=EP,exports.pickCompactFields=_z,exports.quickViewFields=ZP,exports.quickViewValueText=XP,Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return xn}}),exports.rateUnitLabel=Kr,exports.rateUnitShort=Jr,exports.readActionButtons=Su,exports.readPageParam=RP,exports.reconcileHours=xd,exports.recordActionRun=n.lt,exports.recordIdOf=vz,exports.recordTopic=WF,exports.registerFieldType=Ql,exports.registerSearchPopup=mu,exports.registerWizardPreview=n.tt,exports.registerWizardStepType=n.nt,exports.rejectSubmission=ve,exports.relationSignature=sF,exports.resolveActivityMeta=en,exports.resolveAndCompute=Pf,exports.resolveDayKind=vd,exports.resolveFinanceInputs=jf,exports.resolveMergeKey=PN,exports.resolveMergedListKey=PN,exports.resolveOpenAs=bu,exports.resolvePageButtons=xI,exports.resolvePageIcon=mI,exports.resolvePageValue=_I,exports.resolveQuickViewActions=VI,exports.resolveRejectionReason=pf,exports.resolveResultsSearchPlaceholder=Au,exports.resolveResultsView=ku,exports.resolveSubmissionFinance=dp,exports.rowsSignature=SP,exports.rowsToDraft=bP,exports.ruleAppliesToSurface=n.Ft,exports.rulePrimaryAction=n.It,exports.runModuleAction=bc,exports.runWizardAction=n.I,exports.safeWizardActionRoute=n.Y,exports.saveBgcIntegrationConfig=n.La,exports.saveIntegrationConfig=n.Ba,exports.scopeConditionsFor=mF,exports.searchCriteriaParts=nB,exports.serializeRows=TP,exports.setSelectedProject=t.v,exports.showIfConditions=n.s,exports.stageCountKey=$N,exports.supportsAnyOf=pF,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Bm}}),exports.testIntegrationConnection=n.Ja,exports.toApp=n._i,exports.toNumber=Yr,exports.toRailFields=mP,exports.topicsForEvent=KF,exports.tzLabel=n.vi,exports.tzShortLabel=n.yi,exports.unregisterSearchPopup=gu,exports.unscopedConditions=oF,exports.useAdminAction=Hc,exports.useAdminActionsVersion=Vc,exports.useConfiguredWizardSteps=lc,exports.useDropdownFields=n.Ht,exports.useDropdownValues=n.Tt,exports.useEditForm=Sp,exports.useFieldConfig=n.Ut,exports.useFilterFields=n.Wt,exports.useInPlaceRecordLinks=BP,exports.useLiveRefresh=fI,exports.useMenuPermission=n.zt,exports.useModuleActions=gc,exports.useModuleViewAccess=n.Bt,exports.useNewRecordMarks=n.ut,exports.useRealtimeClient=sI,exports.useRealtimeReconnect=dI,exports.useRealtimeStatus=cI,exports.useRealtimeTopics=uI,exports.useRecordFields=Tz,exports.useRecordHub=uL,exports.useRecordRefresh=os,exports.useRelatedCounts=OF,exports.useWorkspaceList=IP,exports.validateBooleanQuery=yl,exports.validateBulkFile=vn,exports.validateInputValue=Xb,exports.withAdminAppId=t.O,exports.withAppId=t.k,exports.withAuthGuard=hh,exports.withPageParam=zP,exports.withSubTab=cF;
|
|
57
57
|
//# sourceMappingURL=index.cjs.map
|