@abtnode/blocklet-services 1.16.42-beta-20250408-050422-92c8eef3 → 1.16.42-beta-20250408-072924-4b6a877a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/assets/{access-control-Bp6fLweq.js → access-control-BCncVk0F.js} +1 -1
  2. package/dist/assets/{add-component-core-e0A2r7mm.js → add-component-core-DmGxO5Gt.js} +15 -14
  3. package/dist/assets/{add-resource-tZ8OPVzc.js → add-resource-CJU0s3QQ.js} +1 -1
  4. package/dist/assets/{advanced-vuRNp9gZ.js → advanced-0AsHuHlx.js} +1 -1
  5. package/dist/assets/{appearance-CFcde0Qw.js → appearance-Bw3QRuyJ.js} +1 -1
  6. package/dist/assets/{audit-logs-C51Acdy3.js → audit-logs-7qd9PUxe.js} +1 -1
  7. package/dist/assets/{branding-PF95Dp3j.js → branding-BZ7cTCXC.js} +2 -2
  8. package/dist/assets/{branding-B4OmIbxT.js → branding-NhPjoLxG.js} +1 -1
  9. package/dist/assets/{bundle-avatar-xyEwd0kl.js → bundle-avatar-Ue_TyBqv.js} +1 -1
  10. package/dist/assets/{complete-BnqT6D6R.js → complete-Tyckm-4M.js} +1 -1
  11. package/dist/assets/{component-BbpzttYw.js → component-D1Fsjeuf.js} +1 -1
  12. package/dist/assets/{config-BRGxJ2eh.js → config-DoKTS37s.js} +1 -1
  13. package/dist/assets/{config-navigation-Bp_tpZTf.js → config-navigation-DO0UJG5K.js} +3 -3
  14. package/dist/assets/{config-space-DLpGXOv3.js → config-space-BNW8EpAm.js} +1 -1
  15. package/dist/assets/{confirm-DMfA-cen.js → confirm-C-7TGRgW.js} +1 -1
  16. package/dist/assets/{connect-DrhKSeJG.js → connect-BLlTMxXk.js} +1 -1
  17. package/dist/assets/{connect-BbnPPMBE.js → connect-ZYp_tU0D.js} +1 -1
  18. package/dist/assets/{connect-to-BWtx4RxY.js → connect-to-h4a_nz1y.js} +1 -1
  19. package/dist/assets/{dashboard-D1IAu0pg.js → dashboard-B9esZ0M-.js} +3 -3
  20. package/dist/assets/{delete-confirm-BOPmqCDE.js → delete-confirm-C_4zg33B.js} +1 -1
  21. package/dist/assets/{domain-C058D5cL.js → domain-3zeLA-KU.js} +1 -1
  22. package/dist/assets/{domain-action-card-hJylsZDf.js → domain-action-card-BQASO--e.js} +1 -1
  23. package/dist/assets/{domains-CHSNHTzm.js → domains-DTccX50O.js} +1 -1
  24. package/dist/assets/{email-DTd5dLMw.js → email-hHeKrz9y.js} +1 -1
  25. package/dist/assets/{exchange-passport-CUoEzJAn.js → exchange-passport-Bt6kGDIV.js} +1 -1
  26. package/dist/assets/{fuel-D1-QzTfA.js → fuel-CDRdGVHi.js} +1 -1
  27. package/dist/assets/{index-Bn6qMcz9.js → index-BKSHPTts.js} +1 -1
  28. package/dist/assets/{index-DUqEJSX8.js → index-BnqjZUkY.js} +1 -1
  29. package/dist/assets/{index-Bcipz7Xh.js → index-Br2EGTW4.js} +1 -1
  30. package/dist/assets/{index-Bgbz960f.js → index-BvyKTiWe.js} +1 -1
  31. package/dist/assets/{index-Dja0MgHa.js → index-BvyQFiS_.js} +3 -3
  32. package/dist/assets/{index-DvX6CH9d.js → index-C07T63uR.js} +1 -1
  33. package/dist/assets/{index-Tc7h84RU.js → index-C7X4Y3ad.js} +1 -1
  34. package/dist/assets/{index-DOTrxWIb.js → index-Cc1EUVvj.js} +1 -1
  35. package/dist/assets/{index-r4W5xGua.js → index-CfxqxAZd.js} +1 -1
  36. package/dist/assets/{index-DY7FozBP.js → index-CgA3yF4z.js} +1 -1
  37. package/dist/assets/{index-BQddb9SV.js → index-D1iI5v2e.js} +4 -4
  38. package/dist/assets/{index-BmIHv0Ao.js → index-IaaNyqXG.js} +1 -1
  39. package/dist/assets/{index-Biod65HH.js → index-IqOEMaG7.js} +1 -1
  40. package/dist/assets/{index--QvOAcHK.js → index-_IytyGrM.js} +22 -20
  41. package/dist/assets/{index-COXsk6dn.js → index-njqCeZqY.js} +1 -1
  42. package/dist/assets/{invitation-CLrDi0w3.js → invitation-CXLQmmNG.js} +1 -1
  43. package/dist/assets/{invite-BlqLHSHA.js → invite-BZt83O3H.js} +1 -1
  44. package/dist/assets/{issue-passport-0xgFeiRm.js → issue-passport-CrCyp4XY.js} +1 -1
  45. package/dist/assets/{item-DFeRxihy.js → item-BMOFJ72c.js} +1 -1
  46. package/dist/assets/{layout-BQ9Qhixa.js → layout-DdaOYlXg.js} +1 -1
  47. package/dist/assets/{list-BO1EU3G2.js → list-Df4vHNiY.js} +1 -1
  48. package/dist/assets/{log-Qir3lxDV.js → log-B1ojA9lx.js} +1 -1
  49. package/dist/assets/{login-C780ZUv4.js → login-BkqQC8IM.js} +1 -1
  50. package/dist/assets/{logo-uploader-gCM0_9lk.js → logo-uploader-D6hawLMA.js} +2 -2
  51. package/dist/assets/{lost-passport-ieF1z1Fq.js → lost-passport-CnWrxxcj.js} +1 -1
  52. package/dist/assets/{overview-CqE5Qd7t.js → overview-vOO_cwfO.js} +1 -1
  53. package/dist/assets/{publish-resource-BFGnGhHk.js → publish-resource-OeE_Sv8p.js} +1 -1
  54. package/dist/assets/{relative-time-BUHtgSDe.js → relative-time-BnXa0sIK.js} +1 -1
  55. package/dist/assets/{runtime-B5YY9Qgr.js → runtime-DmT1MY2S.js} +1 -1
  56. package/dist/assets/{security-Dad28Y4W.js → security-CQrJSvNH.js} +1 -1
  57. package/dist/assets/{setup-DEJbIHrj.js → setup-CH6etNsI.js} +3 -3
  58. package/dist/assets/{spaces-CcqmBId2.js → spaces-BBAv0vs3.js} +1 -1
  59. package/dist/assets/{start-9UMY8DNC.js → start-BC37Pmt4.js} +1 -1
  60. package/dist/assets/{status-BFrUchan.js → status-Dz-0ViGp.js} +1 -1
  61. package/dist/assets/{step-actions-DZ9FTtHm.js → step-actions-BIyonirh.js} +1 -1
  62. package/dist/assets/{traffic-DPZuINtB.js → traffic-D72BUoUS.js} +1 -1
  63. package/dist/assets/{transfer-PY0D3H2H.js → transfer-DCQoefO3.js} +1 -1
  64. package/dist/assets/{unsubscribe-B3uFNG06.js → unsubscribe-DiXKNJyN.js} +1 -1
  65. package/dist/assets/{user-center-C2i8ji9Q.js → user-center-BjZ6YsoY.js} +1 -1
  66. package/dist/assets/{util-BL-qFiRh.js → util-CllYCEyt.js} +1 -1
  67. package/dist/assets/{wrap-locale-BFOSjPWa.js → wrap-locale-Bn6cqCkC.js} +1 -1
  68. package/dist/index.html +1 -1
  69. package/dist/service-worker.js +1 -1
  70. package/package.json +33 -33
@@ -1,4 +1,4 @@
1
- import{r as j}from"./vendor-react-DoD83n6N.js";import{j as e,E as d,a2 as Pe,R as vt,a5 as jt,T as Y,a4 as w,A as Fe,bl as ke,cc as et,bL as Re,bp as Te,bM as Ie,x as je,b2 as De,a3 as tt,aa as oe,W as st,bf as Xe,bo as yt,bk as St,ak as Je,bT as Ct}from"./vendor-mui-core-C-PhacC8.js";import{c as ne,au as le,A as Nt}from"./vendor-utils-CRBr0QUY.js";import{V as G,m as F,b1 as wt,r as _e,u as X,bJ as Rt,U as nt,B as Ee,a2 as at,bh as xe,aj as Tt,ap as It,bG as Dt}from"./vendor-ux-did-connect-BQ3cvv_1.js";import{A as Et,v as $,m as At,I as Qe}from"./index--QvOAcHK.js";import{f as ee,a as Ae}from"./vendor-hooks-DtYI0-rF.js";import{S as pe}from"./shorten-label-C642GTxb.js";import{I as it}from"./index-CqRb1YIC.js";import{A as Lt,S as Ot,a as Pt,b as Ft}from"./list-BO1EU3G2.js";import{R as Be}from"./relative-time-BUHtgSDe.js";import{b as ze}from"./dashboard-D1IAu0pg.js";import{W as kt}from"./did-address-_2BUka_2.js";import{p as ot}from"./util-CORzDFgw.js";import{D as _t,g as Bt}from"./traffic-DPZuINtB.js";import{i as zt,B as Wt}from"./index-Tc7h84RU.js";import{B as rt}from"./bundle-avatar-xyEwd0kl.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-D8eCUoJY.js";import"./index-BYC998Xz.js";import"./InfoOutlined-DFTm-vVr.js";import"./CheckCircle-D7CrWlJ6.js";import"./useLocalStorage-C1_Fkr6_.js";import"./confirm-DMfA-cen.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-BEUAi9Bt.js";import"./get-safe-url-M62JolcK.js";import"./session-Clq9kJzg.js";import"./useAsyncRetry-CwtLImQi.js";import"./useAsync-BmuLIImU.js";import"./useSetState-BL3ktMon.js";import"./use-mobile-DudfIz3d.js";import"./base32-CEWQZb_G.js";import"./iframe-BGb_KeKZ.js";import"./LaunchOutlined-DttrDnYo.js";import"./ChevronLeft-DeulnkX8.js";import"./ChevronRight-CACHNf5Y.js";import"./index-CDJctLrv.js";import"./vendor-mui-x-BiTj3AZC.js";const lt=j.createContext({}),{Provider:Mt,Consumer:an}=lt;function qt({children:t,blocklet:s=""}){const{api:n,inService:o}=Et(),[i,r]=j.useState([]),[x,u]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),b=ee(()=>{var D;return(D=s.meta)==null?void 0:D.did},[s]),[S,C]=j.useState([]),N=async({page:D=1,pageSize:O=20,...m}={})=>{if(!b)return[];try{const g={paging:{page:D,pageSize:O},...m,teamDid:b,dateRange:m.dateRange?[$(m.dateRange[0]).toISOString(),$(m.dateRange[1]).toISOString()]:void 0},{dids:L,...Q}=g;let K="";L.includes("system")&&(K="system");const J=L.filter(Z=>Z!=="system"),_=await n.getNotificationSendLog({input:{...Q,source:K,componentDids:J}});return r(_.list),u(_.paging),_.list}catch(g){return G.error(g.message),[]}},E=async()=>{const D=await n.getNotificationComponents({input:{teamDid:b}});C(D.componentDids)},z=j.useCallback(D=>{const O=s.children.find(m=>{var g;return((g=m.meta)==null?void 0:g.did)===D});if(O)return O.ancestors=[s],O},[s]),A=async({notificationId:D,receivers:O,channels:m,...g})=>{await n.resendNotification({input:{teamDid:b,notificationId:D,receivers:O,channels:m.map(L=>L==="wallet"?F.NOTIFICATION_SEND_CHANNEL.WALLET:L==="pushKit"?F.NOTIFICATION_SEND_CHANNEL.PUSH:L),...g}})},P=j.useCallback(async D=>(await n.getUser({input:{teamDid:b,user:{did:D}}})).user,[n,b]),I=j.useCallback(async({page:D=1,pageSize:O=20,...m}={})=>{try{const g={paging:{page:D,pageSize:O},...m,userName:m.searchText||"",teamDid:b,dateRange:m.dateRange?[$(m.dateRange[0]).toISOString(),$(m.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:g})}catch(g){throw G.error(g.message),g}},[n,b]);j.useEffect(()=>{b&&E()},[b]);const W={fetch:N,data:i,paging:x,blocklet:s,getComponent:z,resendNotification:A,getUser:P,componentDids:S,getReceivers:I,inService:o,teamDid:b};return e.jsx(Mt,{value:{notificationRecords:W},children:t})}function We(){const{notificationRecords:t}=j.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Kt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(wt,{type:Kt[t],children:t})}var Me={},Ht=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var ct=Me.default=void 0,$t=Ht(_e()),Ut=e;ct=Me.default=(0,$t.default)((0,Ut.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},Vt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var dt=qe.default=void 0,Gt=Vt(_e()),Yt=e;dt=qe.default=(0,Gt.default)((0,Yt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var Ke={},Xt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Jt=Xt(_e()),Qt=e;ut=Ke.default=(0,Jt.default)((0,Qt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Zt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case F.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case F.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case F.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case F.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:o,updatedAt:i,reason:r="",channel:x="wallet"}=n,u=i?t("notification.sendStatus.sentTime",{date:At(i,s)}):"",b=Zt(t,x,r);return o===F.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:b}:o===F.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:b,sentTime:u}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Oe=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:o.enabled},mt=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:o.enabled},es=(t,s)=>{const n=ne(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ts=(t,s)=>{const n=ne(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},ss=t=>({enabled:ne(t,"extra.notifications.wallet",!0)}),ns=t=>({enabled:ne(t,"extra.webhooks",[]).length>0}),he=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),as=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],ge=(t=[])=>{const s=$().startOf("day");return t.filter(n=>$(n.sendAt).isSame(s,"day")).length},is=(t,s="")=>{if(s&&Oe.includes(s)){const r=`${s}SendRecord`,x=ne(t,r,[]);return ge(x)}const n=ne(t,"webhook",{}),o=Object.keys(n??{})??[];if(s&&o.includes(s)){const r=n[s]??[];return ge(r)}const i={};return Oe.forEach(r=>{const x=`${r}SendRecord`,u=ne(t,x,[]),b=ge(u);i[r]=b}),o.length>0&&o.forEach(r=>{const x=n[r]??[],u=ge(x);i[r]=u}),i},be=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},os=t=>{switch(t){case F.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case F.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case F.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case F.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>vt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"},divider:"#F4F4F5"},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:o}){const{status:i,title:r="",sentTime:x="",reason:u=""}=t,b=[r,u].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:b}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(w,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(w,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(w,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[i],style:{opacity:.15}}),e.jsx(w,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[i]})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?r:o})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};te.defaultProps={enableTooltip:!0,showTitle:!1,children:null};ce.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};ce.defaultProps={onDelete:()=>{}};function ce({list:t,label:s,onDelete:n}){const{t:o,locale:i}=X();return e.jsxs(w,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(Y,{children:[s,": "]}),t.map(r=>{const x=pt(o,i,{status:r});return e.jsx(Fe,{size:"small",label:e.jsx(w,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(te,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,r)},r)})]})}He.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function He({filterList:t,onChange:s,index:n,column:o,filterValues:i,label:r,renderLabel:x}){return e.jsxs(ke,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:r}),e.jsx(Re,{row:!0,children:i.map(u=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:b=>{const S=[...t];b.target.checked?S[n]=[...S[n],u.value??u]:S[n]=S[n].filter(C=>C!==(u.value??u)),s(S[n],n,o)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx(He,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}re.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function re({status:t,updatedAt:s,reason:n="",channel:o="wallet",onResend:i}){const{t:r,locale:x}=X(),u=pt(r,x,{status:t,updatedAt:s,reason:n,channel:o});return e.jsxs(w,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(te,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(je,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:r("notification.resend")})]})}$e.propTypes={value:d.array.isRequired,onChange:d.func};function $e({value:t,onChange:s}){const{locale:n}=X(),o=$().toDate(),[i,r]=j.useState(null),x=j.useCallback(S=>{r(i?null:S.currentTarget)},[i]),u=!!i,b=j.useCallback(S=>{if(!S.startDate||!S.endDate){G.error("Please select a date range");return}if($(S.startDate).isAfter(S.endDate)||!$(S.startDate).isValid()||!$(S.endDate).isValid()){G.error("Invalid date range");return}s([S.startDate,S.endDate]),r(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(je,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],n)," - ",Qe(t[1],n)]})}),e.jsx(De,{open:u,anchorEl:i,onClose:()=>{r(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(_t,{open:!0,maxDate:o,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Bt(o),onChange:b})})]})}Ue.propTypes={itemComponent:d.elementType.isRequired};function Ue({itemComponent:t,...s}){var i;const{t:n}=X();return!((i=s==null?void 0:s.filterList)!=null&&i.filter(r=>r.length).length)?null:e.jsxs(w,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Rt.TableFilterList,{...s,ItemComponent:t})})]})}function ye({label:t,onDelete:s,canDelete:n=()=>!0,...o}){const i=s&&typeof s=="function"?s:void 0;let r=!0;return n&&typeof n=="function"&&(r=n({label:t,...o})),e.jsx(Fe,{label:t,variant:"outlined",...i&&r?{onDelete:i}:{}})}ye.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};ye.defaultProps={canDelete:()=>!0};const rs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:o}=X(),[i,r]=j.useState(rs),[x,u]=j.useState(!0),b=(C,N)=>{N.checked=C.target.checked;const E=i.map(z=>({...z,checked:z.value===N.value?N.checked:z.checked}));r(E)},S=C=>{C.stopPropagation(),n({channels:i.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:x})};return e.jsxs(w,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:o("notification.config")}),e.jsx(w,{className:"choose-channel",children:e.jsxs(ke,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:o("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(C=>e.jsx(Te,{control:e.jsx(Ie,{checked:C.checked,onChange:N=>b(N,C),name:C.value}),label:C.label},C.value))})]})}),e.jsx(w,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:x,onChange:C=>u(C.target.checked)}),label:o("notification.resendFailedOnly")})})}),e.jsxs(w,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(je,{onClick:C=>{C.stopPropagation(),s()},color:"inherit",children:o("common.cancel")}),e.jsxs(je,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),o("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:o,locale:i}=X(),{getReceivers:r,inService:x,teamDid:u,getUser:b,blocklet:S}=We(),[C,N]=j.useState(!1),[E,z]=j.useState([]),A=Ae({anchorEl:null,position:null}),P=Ae({anchorEl:null,position:null}),[I,W]=j.useState(null),[D,O]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[m,g]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[L,Q]=j.useState([]),K=[{label:o("notification.sendStatus.pending"),value:0,status:"pending"},{label:o("notification.sendStatus.success"),value:1,status:"success"},{label:o("notification.sendStatus.failed"),value:2,status:"failed"}],J=async()=>{if(!C&&t)try{N(!0);const a=await r({notificationId:t,...m}),l=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));z(l),O(a.paging),N(!1)}catch(a){G.error(a.message),N(!1)}};j.useEffect(()=>{J()},[m]);const _=a=>{a.stopPropagation();const l=a.currentTarget;P.anchorEl=l;const c=l.getBoundingClientRect();P.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},Z=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ee,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:o("notification.resend")})}):null,M={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:o("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:D.page-1,rowsPerPage:D.pageSize,count:D.total,searchText:m.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:L,onRowSelectionChange:(a,l)=>{Q(l.map(c=>c.dataIndex))},customToolbarSelect:Z},Ce=({page:a,rowsPerPage:l,searchText:c,filterList:y})=>{const[,k=[],H=[],q=[]]=y;m.pageSize!==l?g(B=>({...B,pageSize:l,page:1})):m.page!==a+1?g(B=>({...B,page:a+1})):m.searchText!==c?g(B=>({...B,searchText:c,page:1})):le(k,m.walletSendStatus)?le(H,m.pushKitSendStatus)?le(q,m.emailSendStatus)||g(B=>({...B,emailSendStatus:q,page:1})):g(B=>({...B,pushKitSendStatus:H,page:1})):g(B=>({...B,walletSendStatus:k,page:1}))},Ne=j.useCallback(async(a,l)=>{if(!l)return!1;const c=await b(l);return c?a==="wallet"?ss(c):a==="email"?es(S,c):a==="pushKit"?ts(S,c):a==="webhook"?ns(c):!0:!1},[b,S]),me=j.useCallback(a=>as(o,a),[o]),f=()=>{A.anchorEl=null,A.position=null,W(null)},p=()=>{P.anchorEl=null,P.position=null},h=async(a,l,c=!0,y="")=>{if(!(!l.length||!a.length))try{s(a,l,c,y),P.anchorEl||(await he(.5),f())}catch(k){console.error("handleResend error",{error:k})}},v=async({channels:a,isResendFailedOnly:l})=>{const c=L.map(y=>E[y].receiver);await h(a,c,l),await he(.5),p(),Q([])},T=async(a,l=[],c=!0)=>{try{await h(["webhook"],[a.receiver],c,l)}catch(y){G.error(y.response?y.response.statusText:y.message)}},R=async(a,l,c,y=[],k=!0)=>{if(a.stopPropagation(),is(l,c)>=4){G.warning(o("notification.resendLimit"));return}if(!Oe.includes(c)){await T(l,y,k);return}if(a){const q=a.currentTarget,B=q.getBoundingClientRect();A.anchorEl=q,A.position={top:B.top+window.scrollY,left:B.left+window.scrollX}}W({channel:c});try{const q=await Ne(c,l.receiver);await he(1),W({channel:c,result:q}),(typeof q=="boolean"&&q||Nt(q)&&Object.values(q).every(B=>!!B))&&(await s([c],[l.receiver],k),P.anchorEl||(await he(.5),f()))}catch(q){G.error(q.message)}},U=a=>{g(l=>({...l,dateRange:a,page:1}))},V=(a,l,c,y)=>{a.stopPropagation();const k=c.filter(H=>H!==l);g(H=>({...H,[y]:k,page:1}))},se=ee(()=>[{label:o("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:l,receiver:c}=E[a];return l?e.jsxs(w,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(pe,{children:l.fullName})]},c):e.jsx(kt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:m.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(ce,{list:a,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),V(l,c,se[1].options.filterList,"walletSendStatus")}}),update:be},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(a,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:l,index:c,column:y,filterValues:K})},customBodyRenderLite:a=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=E[a];return e.jsx(re,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:k=>R(k,E[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=E[a];return e.jsx(re,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:k=>R(k,E[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:m.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(ce,{list:a,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),V(l,c,se[2].options.filterList,"pushKitSendStatus")}}),update:be},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(a,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:l,index:c,column:y,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=E[a];return e.jsx(re,{status:l,updatedAt:c,reason:y,channel:"email",onResend:k=>R(k,E[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:m.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(ce,{list:a,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),V(l,c,se[3].options.filterList,"emailSendStatus")}}),update:be},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(a,l,c,y)=>e.jsx(we,{label:"Email",filterList:a,onChange:l,index:c,column:y,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:l}=E[a];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,k]=c,H=k[0];return e.jsx(w,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(w,{className:"webhook-item",fontSize:12,children:[e.jsx(pe,{maxLength:30,children:y},y),e.jsx(re,{status:H.status,updatedAt:H.sendAt,reason:H.failedReason,channel:"webhook",onResend:q=>R(q,E[a],"webhook",[y],!1)})]},y)})}}},{label:o("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:l}=E[a];return e.jsx(Be,{value:l,locale:i,shouldUpdate:!0})}}}],[E,i,m,o]),Ye=[e.jsx($e,{value:m.dateRange,onChange:U},"date-picker"),e.jsx(Ee,{variant:"contained",size:"small",color:"primary",loading:C,startIcon:e.jsx(ut,{}),onClick:()=>J(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:o("common.refresh")},"refresh")];return e.jsx(w,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(cs,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:i,loading:C,columns:se,data:E,onChange:Ce,options:M,customButtons:Ye,components:{TableFilterList:a=>e.jsx(Ue,{...a,itemComponent:l=>e.jsx(ye,{...l,canDelete:()=>!1})})}}),A.anchorEl&&e.jsx(De,{open:!!A.anchorEl,anchorReference:"anchorPosition",anchorPosition:A.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ds,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(w,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:me(I==null?void 0:I.channel).map(a=>{var k,H;const{type:l,pass:c,fail:y}=a;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[l]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(H=I==null?void 0:I.result)!=null&&H[l]?xe.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:xe.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(Y,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:xe.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:y})]},l)})})]})}),P.anchorEl&&e.jsx(De,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:v})})]})})})}const ls=j.memo(gt),cs=oe.div`
1
+ import{r as j}from"./vendor-react-DoD83n6N.js";import{j as e,E as d,a2 as Pe,R as vt,a5 as jt,T as Y,a4 as w,A as Fe,bl as ke,cc as et,bL as Re,bp as Te,bM as Ie,x as je,b2 as De,a3 as tt,aa as oe,W as st,bf as Xe,bo as yt,bk as St,ak as Je,bT as Ct}from"./vendor-mui-core-C-PhacC8.js";import{c as ne,au as le,A as Nt}from"./vendor-utils-CRBr0QUY.js";import{V as G,m as F,b1 as wt,r as _e,u as X,bJ as Rt,U as nt,B as Ee,a2 as at,bh as xe,aj as Tt,ap as It,bG as Dt}from"./vendor-ux-did-connect-BQ3cvv_1.js";import{A as Et,v as $,m as At,I as Qe}from"./index-_IytyGrM.js";import{f as ee,a as Ae}from"./vendor-hooks-DtYI0-rF.js";import{S as pe}from"./shorten-label-C642GTxb.js";import{I as it}from"./index-CqRb1YIC.js";import{A as Lt,S as Ot,a as Pt,b as Ft}from"./list-Df4vHNiY.js";import{R as Be}from"./relative-time-BnXa0sIK.js";import{b as ze}from"./dashboard-B9esZ0M-.js";import{W as kt}from"./did-address-_2BUka_2.js";import{p as ot}from"./util-CORzDFgw.js";import{D as _t,g as Bt}from"./traffic-D72BUoUS.js";import{i as zt,B as Wt}from"./index-C7X4Y3ad.js";import{B as rt}from"./bundle-avatar-Ue_TyBqv.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-D8eCUoJY.js";import"./index-BYC998Xz.js";import"./InfoOutlined-DFTm-vVr.js";import"./CheckCircle-D7CrWlJ6.js";import"./useLocalStorage-C1_Fkr6_.js";import"./confirm-C-7TGRgW.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-BEUAi9Bt.js";import"./get-safe-url-M62JolcK.js";import"./session-Clq9kJzg.js";import"./useAsyncRetry-CwtLImQi.js";import"./useAsync-BmuLIImU.js";import"./useSetState-BL3ktMon.js";import"./use-mobile-B_Gqv6b6.js";import"./base32-CEWQZb_G.js";import"./iframe-BGb_KeKZ.js";import"./LaunchOutlined-DttrDnYo.js";import"./ChevronLeft-DeulnkX8.js";import"./ChevronRight-CACHNf5Y.js";import"./index-CDJctLrv.js";import"./vendor-mui-x-BiTj3AZC.js";const lt=j.createContext({}),{Provider:Mt,Consumer:an}=lt;function qt({children:t,blocklet:s=""}){const{api:n,inService:o}=Et(),[i,r]=j.useState([]),[x,u]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),b=ee(()=>{var D;return(D=s.meta)==null?void 0:D.did},[s]),[S,C]=j.useState([]),N=async({page:D=1,pageSize:O=20,...m}={})=>{if(!b)return[];try{const g={paging:{page:D,pageSize:O},...m,teamDid:b,dateRange:m.dateRange?[$(m.dateRange[0]).toISOString(),$(m.dateRange[1]).toISOString()]:void 0},{dids:L,...Q}=g;let K="";L.includes("system")&&(K="system");const J=L.filter(Z=>Z!=="system"),_=await n.getNotificationSendLog({input:{...Q,source:K,componentDids:J}});return r(_.list),u(_.paging),_.list}catch(g){return G.error(g.message),[]}},E=async()=>{const D=await n.getNotificationComponents({input:{teamDid:b}});C(D.componentDids)},z=j.useCallback(D=>{const O=s.children.find(m=>{var g;return((g=m.meta)==null?void 0:g.did)===D});if(O)return O.ancestors=[s],O},[s]),A=async({notificationId:D,receivers:O,channels:m,...g})=>{await n.resendNotification({input:{teamDid:b,notificationId:D,receivers:O,channels:m.map(L=>L==="wallet"?F.NOTIFICATION_SEND_CHANNEL.WALLET:L==="pushKit"?F.NOTIFICATION_SEND_CHANNEL.PUSH:L),...g}})},P=j.useCallback(async D=>(await n.getUser({input:{teamDid:b,user:{did:D}}})).user,[n,b]),I=j.useCallback(async({page:D=1,pageSize:O=20,...m}={})=>{try{const g={paging:{page:D,pageSize:O},...m,userName:m.searchText||"",teamDid:b,dateRange:m.dateRange?[$(m.dateRange[0]).toISOString(),$(m.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:g})}catch(g){throw G.error(g.message),g}},[n,b]);j.useEffect(()=>{b&&E()},[b]);const W={fetch:N,data:i,paging:x,blocklet:s,getComponent:z,resendNotification:A,getUser:P,componentDids:S,getReceivers:I,inService:o,teamDid:b};return e.jsx(Mt,{value:{notificationRecords:W},children:t})}function We(){const{notificationRecords:t}=j.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Kt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(wt,{type:Kt[t],children:t})}var Me={},Ht=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var ct=Me.default=void 0,$t=Ht(_e()),Ut=e;ct=Me.default=(0,$t.default)((0,Ut.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},Vt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var dt=qe.default=void 0,Gt=Vt(_e()),Yt=e;dt=qe.default=(0,Gt.default)((0,Yt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var Ke={},Xt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Jt=Xt(_e()),Qt=e;ut=Ke.default=(0,Jt.default)((0,Qt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Zt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case F.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case F.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case F.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case F.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:o,updatedAt:i,reason:r="",channel:x="wallet"}=n,u=i?t("notification.sendStatus.sentTime",{date:At(i,s)}):"",b=Zt(t,x,r);return o===F.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:b}:o===F.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:b,sentTime:u}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Oe=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:o.enabled},mt=t=>{var n,o;const{settings:s}=t;return(o=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:o.enabled},es=(t,s)=>{const n=ne(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ts=(t,s)=>{const n=ne(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},ss=t=>({enabled:ne(t,"extra.notifications.wallet",!0)}),ns=t=>({enabled:ne(t,"extra.webhooks",[]).length>0}),he=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),as=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],ge=(t=[])=>{const s=$().startOf("day");return t.filter(n=>$(n.sendAt).isSame(s,"day")).length},is=(t,s="")=>{if(s&&Oe.includes(s)){const r=`${s}SendRecord`,x=ne(t,r,[]);return ge(x)}const n=ne(t,"webhook",{}),o=Object.keys(n??{})??[];if(s&&o.includes(s)){const r=n[s]??[];return ge(r)}const i={};return Oe.forEach(r=>{const x=`${r}SendRecord`,u=ne(t,x,[]),b=ge(u);i[r]=b}),o.length>0&&o.forEach(r=>{const x=n[r]??[],u=ge(x);i[r]=u}),i},be=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},os=t=>{switch(t){case F.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case F.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case F.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case F.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>vt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"},divider:"#F4F4F5"},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:o}){const{status:i,title:r="",sentTime:x="",reason:u=""}=t,b=[r,u].filter(Boolean).join(", ");return e.jsx(jt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:b}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(w,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(w,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(w,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[i],style:{opacity:.15}}),e.jsx(w,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[i]})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?r:o})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};te.defaultProps={enableTooltip:!0,showTitle:!1,children:null};ce.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};ce.defaultProps={onDelete:()=>{}};function ce({list:t,label:s,onDelete:n}){const{t:o,locale:i}=X();return e.jsxs(w,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(Y,{children:[s,": "]}),t.map(r=>{const x=pt(o,i,{status:r});return e.jsx(Fe,{size:"small",label:e.jsx(w,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(te,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,r)},r)})]})}He.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function He({filterList:t,onChange:s,index:n,column:o,filterValues:i,label:r,renderLabel:x}){return e.jsxs(ke,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:r}),e.jsx(Re,{row:!0,children:i.map(u=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:b=>{const S=[...t];b.target.checked?S[n]=[...S[n],u.value??u]:S[n]=S[n].filter(C=>C!==(u.value??u)),s(S[n],n,o)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx(He,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}re.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function re({status:t,updatedAt:s,reason:n="",channel:o="wallet",onResend:i}){const{t:r,locale:x}=X(),u=pt(r,x,{status:t,updatedAt:s,reason:n,channel:o});return e.jsxs(w,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(te,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(je,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:r("notification.resend")})]})}$e.propTypes={value:d.array.isRequired,onChange:d.func};function $e({value:t,onChange:s}){const{locale:n}=X(),o=$().toDate(),[i,r]=j.useState(null),x=j.useCallback(S=>{r(i?null:S.currentTarget)},[i]),u=!!i,b=j.useCallback(S=>{if(!S.startDate||!S.endDate){G.error("Please select a date range");return}if($(S.startDate).isAfter(S.endDate)||!$(S.startDate).isValid()||!$(S.endDate).isValid()){G.error("Invalid date range");return}s([S.startDate,S.endDate]),r(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(je,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],n)," - ",Qe(t[1],n)]})}),e.jsx(De,{open:u,anchorEl:i,onClose:()=>{r(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(_t,{open:!0,maxDate:o,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Bt(o),onChange:b})})]})}Ue.propTypes={itemComponent:d.elementType.isRequired};function Ue({itemComponent:t,...s}){var i;const{t:n}=X();return!((i=s==null?void 0:s.filterList)!=null&&i.filter(r=>r.length).length)?null:e.jsxs(w,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Rt.TableFilterList,{...s,ItemComponent:t})})]})}function ye({label:t,onDelete:s,canDelete:n=()=>!0,...o}){const i=s&&typeof s=="function"?s:void 0;let r=!0;return n&&typeof n=="function"&&(r=n({label:t,...o})),e.jsx(Fe,{label:t,variant:"outlined",...i&&r?{onDelete:i}:{}})}ye.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};ye.defaultProps={canDelete:()=>!0};const rs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:o}=X(),[i,r]=j.useState(rs),[x,u]=j.useState(!0),b=(C,N)=>{N.checked=C.target.checked;const E=i.map(z=>({...z,checked:z.value===N.value?N.checked:z.checked}));r(E)},S=C=>{C.stopPropagation(),n({channels:i.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:x})};return e.jsxs(w,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:o("notification.config")}),e.jsx(w,{className:"choose-channel",children:e.jsxs(ke,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:o("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(C=>e.jsx(Te,{control:e.jsx(Ie,{checked:C.checked,onChange:N=>b(N,C),name:C.value}),label:C.label},C.value))})]})}),e.jsx(w,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:x,onChange:C=>u(C.target.checked)}),label:o("notification.resendFailedOnly")})})}),e.jsxs(w,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(je,{onClick:C=>{C.stopPropagation(),s()},color:"inherit",children:o("common.cancel")}),e.jsxs(je,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),o("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:o,locale:i}=X(),{getReceivers:r,inService:x,teamDid:u,getUser:b,blocklet:S}=We(),[C,N]=j.useState(!1),[E,z]=j.useState([]),A=Ae({anchorEl:null,position:null}),P=Ae({anchorEl:null,position:null}),[I,W]=j.useState(null),[D,O]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[m,g]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[L,Q]=j.useState([]),K=[{label:o("notification.sendStatus.pending"),value:0,status:"pending"},{label:o("notification.sendStatus.success"),value:1,status:"success"},{label:o("notification.sendStatus.failed"),value:2,status:"failed"}],J=async()=>{if(!C&&t)try{N(!0);const a=await r({notificationId:t,...m}),l=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));z(l),O(a.paging),N(!1)}catch(a){G.error(a.message),N(!1)}};j.useEffect(()=>{J()},[m]);const _=a=>{a.stopPropagation();const l=a.currentTarget;P.anchorEl=l;const c=l.getBoundingClientRect();P.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},Z=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ee,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:o("notification.resend")})}):null,M={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:o("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:D.page-1,rowsPerPage:D.pageSize,count:D.total,searchText:m.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:L,onRowSelectionChange:(a,l)=>{Q(l.map(c=>c.dataIndex))},customToolbarSelect:Z},Ce=({page:a,rowsPerPage:l,searchText:c,filterList:y})=>{const[,k=[],H=[],q=[]]=y;m.pageSize!==l?g(B=>({...B,pageSize:l,page:1})):m.page!==a+1?g(B=>({...B,page:a+1})):m.searchText!==c?g(B=>({...B,searchText:c,page:1})):le(k,m.walletSendStatus)?le(H,m.pushKitSendStatus)?le(q,m.emailSendStatus)||g(B=>({...B,emailSendStatus:q,page:1})):g(B=>({...B,pushKitSendStatus:H,page:1})):g(B=>({...B,walletSendStatus:k,page:1}))},Ne=j.useCallback(async(a,l)=>{if(!l)return!1;const c=await b(l);return c?a==="wallet"?ss(c):a==="email"?es(S,c):a==="pushKit"?ts(S,c):a==="webhook"?ns(c):!0:!1},[b,S]),me=j.useCallback(a=>as(o,a),[o]),f=()=>{A.anchorEl=null,A.position=null,W(null)},p=()=>{P.anchorEl=null,P.position=null},h=async(a,l,c=!0,y="")=>{if(!(!l.length||!a.length))try{s(a,l,c,y),P.anchorEl||(await he(.5),f())}catch(k){console.error("handleResend error",{error:k})}},v=async({channels:a,isResendFailedOnly:l})=>{const c=L.map(y=>E[y].receiver);await h(a,c,l),await he(.5),p(),Q([])},T=async(a,l=[],c=!0)=>{try{await h(["webhook"],[a.receiver],c,l)}catch(y){G.error(y.response?y.response.statusText:y.message)}},R=async(a,l,c,y=[],k=!0)=>{if(a.stopPropagation(),is(l,c)>=4){G.warning(o("notification.resendLimit"));return}if(!Oe.includes(c)){await T(l,y,k);return}if(a){const q=a.currentTarget,B=q.getBoundingClientRect();A.anchorEl=q,A.position={top:B.top+window.scrollY,left:B.left+window.scrollX}}W({channel:c});try{const q=await Ne(c,l.receiver);await he(1),W({channel:c,result:q}),(typeof q=="boolean"&&q||Nt(q)&&Object.values(q).every(B=>!!B))&&(await s([c],[l.receiver],k),P.anchorEl||(await he(.5),f()))}catch(q){G.error(q.message)}},U=a=>{g(l=>({...l,dateRange:a,page:1}))},V=(a,l,c,y)=>{a.stopPropagation();const k=c.filter(H=>H!==l);g(H=>({...H,[y]:k,page:1}))},se=ee(()=>[{label:o("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:l,receiver:c}=E[a];return l?e.jsxs(w,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(pe,{children:l.fullName})]},c):e.jsx(kt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:m.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(ce,{list:a,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),V(l,c,se[1].options.filterList,"walletSendStatus")}}),update:be},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(a,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:l,index:c,column:y,filterValues:K})},customBodyRenderLite:a=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=E[a];return e.jsx(re,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:k=>R(k,E[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=E[a];return e.jsx(re,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:k=>R(k,E[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:m.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(ce,{list:a,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),V(l,c,se[2].options.filterList,"pushKitSendStatus")}}),update:be},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(a,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:l,index:c,column:y,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=E[a];return e.jsx(re,{status:l,updatedAt:c,reason:y,channel:"email",onResend:k=>R(k,E[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:m.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(ce,{list:a,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),V(l,c,se[3].options.filterList,"emailSendStatus")}}),update:be},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(a,l,c,y)=>e.jsx(we,{label:"Email",filterList:a,onChange:l,index:c,column:y,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:l}=E[a];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,k]=c,H=k[0];return e.jsx(w,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(w,{className:"webhook-item",fontSize:12,children:[e.jsx(pe,{maxLength:30,children:y},y),e.jsx(re,{status:H.status,updatedAt:H.sendAt,reason:H.failedReason,channel:"webhook",onResend:q=>R(q,E[a],"webhook",[y],!1)})]},y)})}}},{label:o("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:l}=E[a];return e.jsx(Be,{value:l,locale:i,shouldUpdate:!0})}}}],[E,i,m,o]),Ye=[e.jsx($e,{value:m.dateRange,onChange:U},"date-picker"),e.jsx(Ee,{variant:"contained",size:"small",color:"primary",loading:C,startIcon:e.jsx(ut,{}),onClick:()=>J(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:o("common.refresh")},"refresh")];return e.jsx(w,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(cs,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:i,loading:C,columns:se,data:E,onChange:Ce,options:M,customButtons:Ye,components:{TableFilterList:a=>e.jsx(Ue,{...a,itemComponent:l=>e.jsx(ye,{...l,canDelete:()=>!1})})}}),A.anchorEl&&e.jsx(De,{open:!!A.anchorEl,anchorReference:"anchorPosition",anchorPosition:A.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ds,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(w,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:me(I==null?void 0:I.channel).map(a=>{var k,H;const{type:l,pass:c,fail:y}=a;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[l]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(H=I==null?void 0:I.result)!=null&&H[l]?xe.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:xe.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(Y,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:xe.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:y})]},l)})})]})}),P.anchorEl&&e.jsx(De,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:v})})]})})})}const ls=j.memo(gt),cs=oe.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1 +1 @@
1
- import{j as o,a4 as r,E as i,T as n}from"./vendor-mui-core-C-PhacC8.js";import{L as f,r as g}from"./vendor-react-DoD83n6N.js";import"./index--QvOAcHK.js";import"./vendor-arcblock-D8eCUoJY.js";import"./vendor-ux-did-connect-BQ3cvv_1.js";import"./vendor-utils-CRBr0QUY.js";import"./vendor-hooks-DtYI0-rF.js";import"./lottie-web-B6s7dDoL.js";const l=(e,t)=>[e,...Array.isArray(t)?t:[t]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function c({sx:e,...t}){const s=l({display:"flex",flexWrap:"wrap",mx:-1},e);return o.jsx(r,{sx:s,...t})}c.propTypes={sx:i.object};c.defaultProps={sx:{}};function p({icon:e}){const[t,s]=g.useState(!1);return!e||t?null:typeof e=="string"?o.jsx(r,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>s(!0)}):e}p.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function w({title:e,desc:t,extra:s,cover:b,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return o.jsx(r,{sx:m,children:o.jsx(r,{component:f,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:o.jsxs(r,{children:[o.jsxs(r,{sx:{position:"relative"},children:[b,d&&o.jsx(r,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:o.jsx(p,{icon:d})})]}),o.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),t&&o.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:t}),s]})})})}w.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const k="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function u({board:e,sx:t,...s}){return o.jsx(w,{date:e.createdAt,sx:t,to:e.link,title:e.title,desc:e.desc,cover:o.jsx(r,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:o.jsx(r,{component:"img",src:k,alt:"",sx:{position:"absolute",top:0,left:0,width:1}})}),icon:e.icon,...s})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function C(){const e=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:"https://www.arcblock.io/docs/blocklet-developer/en/getting-started"},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:"https://www.arcblock.io/docs/createblocklet/en/quick-start"},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:"https://www.arcblock.io/docs/launcher/en/launcher-welcome"},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:"https://www.arcblock.io/docs/did-spaces/en/did-spaces-getting-started"},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:"https://www.arcblock.io/docs/did-wallet/en/get-started"},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:"https://www.arcblock.io/docs/did-domain/en/did-domain-faq"},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:"https://www.arcblock.io/docs/blockchain/en/blockchain-how-to-guides"},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:"https://www.arcblock.io/docs/did-connect/en/developer-guides"}];return o.jsx(c,{children:e.map(t=>o.jsx(u,{board:t},t.id))})}export{C as default};
1
+ import{j as o,a4 as r,E as i,T as n}from"./vendor-mui-core-C-PhacC8.js";import{L as f,r as g}from"./vendor-react-DoD83n6N.js";import"./index-_IytyGrM.js";import"./vendor-arcblock-D8eCUoJY.js";import"./vendor-ux-did-connect-BQ3cvv_1.js";import"./vendor-utils-CRBr0QUY.js";import"./vendor-hooks-DtYI0-rF.js";import"./lottie-web-B6s7dDoL.js";const l=(e,t)=>[e,...Array.isArray(t)?t:[t]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function c({sx:e,...t}){const s=l({display:"flex",flexWrap:"wrap",mx:-1},e);return o.jsx(r,{sx:s,...t})}c.propTypes={sx:i.object};c.defaultProps={sx:{}};function p({icon:e}){const[t,s]=g.useState(!1);return!e||t?null:typeof e=="string"?o.jsx(r,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>s(!0)}):e}p.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function w({title:e,desc:t,extra:s,cover:b,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return o.jsx(r,{sx:m,children:o.jsx(r,{component:f,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:o.jsxs(r,{children:[o.jsxs(r,{sx:{position:"relative"},children:[b,d&&o.jsx(r,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:o.jsx(p,{icon:d})})]}),o.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),t&&o.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:t}),s]})})})}w.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const k="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function u({board:e,sx:t,...s}){return o.jsx(w,{date:e.createdAt,sx:t,to:e.link,title:e.title,desc:e.desc,cover:o.jsx(r,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:o.jsx(r,{component:"img",src:k,alt:"",sx:{position:"absolute",top:0,left:0,width:1}})}),icon:e.icon,...s})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function C(){const e=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:"https://www.arcblock.io/docs/blocklet-developer/en/getting-started"},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:"https://www.arcblock.io/docs/createblocklet/en/quick-start"},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:"https://www.arcblock.io/docs/launcher/en/launcher-welcome"},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:"https://www.arcblock.io/docs/did-spaces/en/did-spaces-getting-started"},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:"https://www.arcblock.io/docs/did-wallet/en/get-started"},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:"https://www.arcblock.io/docs/did-domain/en/did-domain-faq"},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:"https://www.arcblock.io/docs/blockchain/en/blockchain-how-to-guides"},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:"https://www.arcblock.io/docs/did-connect/en/developer-guides"}];return o.jsx(c,{children:e.map(t=>o.jsx(u,{board:t},t.id))})}export{C as default};
@@ -1,4 +1,4 @@
1
- import{u as te,V as W,bU as Ae,bV as Oe,h as ae,g as J,bQ as Ee,bR as Ue,a7 as We,a8 as Me,a6 as _e,bW as ze,a$ as Ie,m as me,r as Ve,aZ as Y,bX as pe,aj as ge,B as E,bH as $e,a1 as Ne,bY as He,a2 as Je,_ as Ke,X as Ze,ap as Le}from"./vendor-ux-did-connect-BQ3cvv_1.js";import{u as m,a as ne,f as ee,c as Ge}from"./vendor-hooks-DtYI0-rF.js";import{r as R}from"./vendor-react-DoD83n6N.js";import{j as e,a4 as v,bp as P,bl as U,M as A,x as z,E as N,T as he,I as re,ae as $,cv as Ye,a2 as Xe,e as xe,a3 as fe,$ as Fe,a5 as Qe,al as et,aa as tt}from"./vendor-mui-core-C-PhacC8.js";import{H as G,a0 as nt,b as Ce,C as ot,n as Z,aD as at,y as rt,z as st}from"./vendor-utils-CRBr0QUY.js";import{a as oe,C as L,e as De}from"./dashboard-D1IAu0pg.js";import{A as H,D as V,h as it}from"./index--QvOAcHK.js";import{S as se}from"./switch-control-DjMziEFc.js";import{K as lt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{t as qe,y as ct}from"./vendor-arcblock-D8eCUoJY.js";import{I as dt}from"./index-CqRb1YIC.js";import{b as ut}from"./base32-CEWQZb_G.js";import{u as mt}from"./use-mobile-B_Gqv6b6.js";import"./lottie-web-B6s7dDoL.js";import"./useLocalStorage-C1_Fkr6_.js";import"./confirm-DMfA-cen.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-BEUAi9Bt.js";import"./get-safe-url-M62JolcK.js";import"./index-Tc7h84RU.js";import"./session-Clq9kJzg.js";import"./useAsyncRetry-CwtLImQi.js";import"./useAsync-BmuLIImU.js";import"./InfoOutlined-DFTm-vVr.js";import"./useSetState-BL3ktMon.js";import"./use-mobile-DudfIz3d.js";const ie={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(b=s==null?void 0:s.meta)==null?void 0:b.did,S=Object.assign({...ie},((i=(y=s==null?void 0:s.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(ie))}),d=p("enabled"),T=m(async r=>{var w,o;try{const{blocklet:x}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({auth0:r})}}),u=Object.assign({...ie},((o=(w=x==null?void 0:x.settings)==null?void 0:w.oauth)==null?void 0:o.auth0)||{});l(u),W.success(a("oauth.saveSuccess"))}catch(x){W.error(x.message||a("oauth.saveFailed"))}}),I=m(r=>r!=null&&r.trim()?!0:a("oauth.auth0.domainDescription")),h=m(r=>r!=null&&r.trim()?!0:a("oauth.auth0.clientIdDescription")),g=m(r=>r!=null&&r.trim()?!0:a("oauth.auth0.clientSecretDescription")),j=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(P,{control:e.jsx(se,{checked:r.value,style:{marginRight:"6px"},...r}),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"domain",control:f,rules:{validate:d?I:j},render:({field:r})=>{var w;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...r,label:a("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((w=c.errors[r.name])==null?void 0:w.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientId",control:f,rules:{validate:d?h:j},render:({field:r})=>{var w;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...r,error:!!c.errors[r.name],label:a("oauth.auth0.clientId"),helperText:((w=c.errors[r.name])==null?void 0:w.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?g:j},render:({field:r})=>{var w;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...r,type:"password",error:!!c.errors[r.name],label:a("oauth.auth0.clientSecret"),helperText:((w=c.errors[r.name])==null?void 0:w.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const le={enabled:!1,clientId:"",clientSecret:""};function ht(){var j,b,y;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(j=s==null?void 0:s.meta)==null?void 0:j.did,S=Object.assign({...le},((y=(b=s==null?void 0:s.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(le))}),d=p("enabled"),T=m(async i=>{var r,w;try{const{blocklet:o}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({github:i})}}),x=Object.assign({...le},((w=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:w.github)||{});l(x),W.success(a("oauth.saveSuccess"))}catch(o){W.error(o.message||a("oauth.saveFailed"))}}),I=m(i=>i!=null&&i.trim()?!0:a("oauth.github.clientIdDescription")),h=m(i=>i!=null&&i.trim()?!0:a("oauth.github.clientSecretDescription")),g=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(P,{control:e.jsx(se,{checked:i.value,style:{marginRight:"6px"},...i}),label:a("oauth.github.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,error:!!c.errors[i.name],label:a("oauth.github.clientId"),helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?h:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,type:"password",label:a("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ft(){var j,b,y;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(j=s==null?void 0:s.meta)==null?void 0:j.did,S=Object.assign({...ce},((y=(b=s==null?void 0:s.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(ce))}),d=p("enabled"),T=m(async i=>{var r,w;try{const{blocklet:o}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({google:i})}}),x=Object.assign({...ce},((w=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:w.google)||{});l(x),W.success(a("oauth.saveSuccess"))}catch(o){W.error(o.message||a("oauth.saveFailed"))}}),I=m(i=>i!=null&&i.trim()?!0:a("oauth.google.clientIdDescription")),h=m(i=>i!=null&&i.trim()?!0:a("oauth.google.clientSecretDescription")),g=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(P,{control:e.jsx(se,{checked:i.value,style:{marginRight:"6px"},...i}),label:a("oauth.google.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,error:!!c.errors[i.name],label:a("oauth.google.clientId"),helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?h:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,type:"password",label:a("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const de={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function gt(){var i,r,w;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(i=s==null?void 0:s.meta)==null?void 0:i.did,S=Object.assign({...de},((w=(r=s==null?void 0:s.settings)==null?void 0:r.oauth)==null?void 0:w.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(de))}),d=p("enabled"),T=m(async o=>{var x,u;try{const{blocklet:F}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({apple:o})}}),B=Object.assign({...de},((u=(x=F==null?void 0:F.settings)==null?void 0:x.oauth)==null?void 0:u.apple)||{});l(B),W.success(a("oauth.saveSuccess"))}catch(F){W.error(F.message||a("oauth.saveFailed"))}}),I=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.teamIdDescription")),h=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.serviceIdDescription")),g=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.keyIdDescription")),j=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.authKeyDescription")),b=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.bundleIdDescription")),y=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:o})=>e.jsx(P,{control:e.jsx(se,{checked:o.value,style:{marginRight:"6px"},...o}),label:a("oauth.apple.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"teamId",control:f,rules:{validate:d?I:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.teamId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.bundleId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"serviceId",control:f,rules:{validate:d?h:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.serviceId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.keyId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"authKey",control:f,rules:{validate:d?j:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,type:"password",multiline:!0,rows:4,label:a("oauth.apple.authKey"),error:!!c.errors[o.name],helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const xt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:k,id:s,children:a,index:n,onMove:S,defaultExpand:t,onEnd:f}){const[c,p]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:T},I]=Ae({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,X;if(!l.current)return;const r=y.index,w=n;if(r===w)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),x=(X=d.current)==null?void 0:X.getBoundingClientRect(),u=(x.bottom-x.top)/2,B=i.getClientOffset().y-o.top;r<w&&B<u||r>w&&B>u||(S(r,w),y.index=w)}}),[{isDragging:h},g]=Oe({item:{index:n,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),I(l);const j=h?.5:1,b=m(y=>{y.preventDefault(),y.stopPropagation(),p(!c)});return e.jsxs(v,{ref:l,sx:{borderBottom:`1px solid ${ae.lineBorderStrong}`},children:[e.jsx(v,{sx:{cursor:"pointer","&:hover":{backgroundColor:ae.backgroundsBgSubtileHover},borderRadius:2},ref:d,"data-handler-id":T,children:e.jsxs(v,{sx:{py:1.5,px:1,opacity:j,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(v,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:ae.textMuted,"&:hover":{color:ae.textSubtitle}},children:e.jsx(J,{fontSize:20,icon:xt})}),e.jsx(he,{sx:{flex:1},children:k}),e.jsx(re,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(J,{icon:lt,style:{transform:"scale(1.5)"}})})]})}),e.jsx(v,{sx:{pl:4,py:1,display:c?"block":"none"},children:a})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!0};const bt=[{name:"github",title:"GitHub",icon:e.jsx(J,{icon:We}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(J,{icon:Me}),component:e.jsx(ft,{})},{name:"apple",title:"Apple",icon:e.jsx(J,{icon:_e}),component:e.jsx(gt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(J,{icon:ze}),component:e.jsx(pt,{})}],jt=["github","google","apple","auth0"];function vt(){var T,I;const{api:k}=H(),{blocklet:s}=V(),a=(T=s==null?void 0:s.meta)==null?void 0:T.did,n=((I=s==null?void 0:s.settings)==null?void 0:I.oauth)||{},S=Object.keys(n).sort((h,g)=>{var j,b,y;return((j=n[h])==null?void 0:j.order)!==void 0&&((b=n[g])==null?void 0:b.order)!==void 0?n[h].order-n[g].order:((y=n[h])==null?void 0:y.order)!==void 0?-1:1});for(const h of jt)S.includes(h)||S.push(h);const t=ne(S.reduce((h,g,j)=>Object.assign(h,{[g]:j}),{})),f=ee(()=>{const h=[...bt];return h.sort((g,j)=>t[g.name]-t[j.name]),h},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const p=m(async h=>{const g={};Object.keys(h).forEach(j=>{g[j]={order:h[j]}}),await k.configOAuth({input:{did:a,oauth:JSON.stringify(g)}})}),l=m((h,g)=>{const j=f[h],b=f[g];t[j.name]=g,t[b.name]=h}),d=m(async()=>{await p(t)});return e.jsx(v,{children:e.jsx(Ee,{backend:Ue,...c,children:f.map((h,g)=>e.jsx(be,{index:g,id:h.name,title:h.title,icon:h.icon,onMove:l,onEnd:d,defaultExpand:h.enabled,children:h.component},h.name))})})}const K={ttl:me.SESSION_TTL,cacheTtl:me.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(k){return e.jsx(ct,{...k,sx:{marginLeft:1,marginRight:.5,transform:"scale(0.75)"}})}function ue(k,s=!1){const a=s?k.ttl*86400:k.ttl/86400;return{...k,ttl:a}}function yt(){var o,x;const{api:k}=H(),{blocklet:s}=V(),a=(o=s==null?void 0:s.meta)==null?void 0:o.did,n=nt({},K,((x=s==null?void 0:s.settings)==null?void 0:x.session)||{});Ce(n.ttl)&&(n.ttl=K.ttl),Ce(n.cacheTtl)&&(n.cacheTtl=K.cacheTtl),n.phone||(n.phone=K.phone),n.email||(n.email=K.email);const{handleSubmit:S,control:t,formState:f,reset:c,watch:p}=oe({defaultValues:G(ue(n),["ttl","cacheTtl","email","phone"])}),{t:l}=te(),d=p("email.enabled"),T=p("phone.enabled"),I=p("email.enableDomainBlackList"),h=p("email.enableDomainWhiteList"),{fields:g,append:j,remove:b}=De({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:r}=De({control:t,name:"email.domainWhiteList"}),w=m(async u=>{var F;try{const{blocklet:B}=await k.updateAppSessionConfig({input:{did:a,config:ot(ue(u,!0),["phone"])}}),_=Object.assign({},K,G(((F=B==null?void 0:B.settings)==null?void 0:F.session)||{},["ttl","cacheTtl","email","phone"]));c(ue(_)),W.success(l("common.configSuccess"))}catch(B){W.error(B.message)}});return e.jsx("form",{onSubmit:S(w),children:e.jsxs($,{direction:"column",spacing:4,children:[e.jsxs($,{direction:"column",children:[e.jsx(he,{variant:"body1",mb:1,children:l("blocklet.config.session.profile")}),e.jsx(P,{disabled:!0,control:e.jsx(M,{size:"small",checked:!0}),label:l("blocklet.config.session.fullNameEnabled")}),e.jsx(P,{disabled:!0,control:e.jsx(M,{checked:!0}),label:l("blocklet.config.session.avatarEnabled")}),e.jsx(L,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailEnabled")})}),d&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(L,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailRequireVerified")})}),e.jsx(L,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailRequireUnique")})}),e.jsx(L,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailTrustOauthProviders")})}),e.jsx(L,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.enableDomainBlackList")})}),I&&e.jsxs(v,{ml:2,children:[g.map((u,F)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${F}`,control:t,render:B=>e.jsx(A,{...B.field,size:"small",fullWidth:!0})}),e.jsx(re,{onClick:()=>b(F),children:e.jsx(Ie,{})})]},u.id)),e.jsx(z,{startIcon:e.jsx(qe,{}),onClick:()=>j(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(L,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.enableDomainWhiteList")})}),h&&e.jsxs(v,{ml:2,children:[y.map((u,F)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${F}`,control:t,render:B=>e.jsx(A,{...B.field,size:"small",fullWidth:!0})}),e.jsx(re,{onClick:()=>r(F),children:e.jsx(Ie,{})})]},u.id)),e.jsx(z,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(v,{sx:{display:"none"},children:[e.jsx(L,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.phoneEnabled")})}),T&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(L,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.phoneRequireVerified")})}),e.jsx(L,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.phoneRequireUnique")})})]})]})]}),e.jsxs($,{direction:"column",spacing:2,children:[e.jsx(he,{variant:"body1",children:l("blocklet.config.session.period")}),e.jsx(L,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(U,{fullWidth:!0,sx:{mb:2},children:e.jsxs($,{px:3,children:[e.jsx(v,{mx:-3,children:l("blocklet.config.session.ttl",{day:u.value})}),e.jsx(Ye,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})})]}),e.jsx(v,{children:e.jsx(z,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}var je={},St=Xe;Object.defineProperty(je,"__esModule",{value:!0});var ve=je.default=void 0,kt=St(Ve()),Tt=e;ve=je.default=(0,kt.default)((0,Tt.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const wt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:It,SLOT_FOR_IP_DNS_SITE:Lt,DEFAULT_DID_DOMAIN:Ct}=me,{encode:Re}=ut,Dt=k=>`${Re(k.meta.did)}-${Lt}.${It}`,qt=({did:k,didDomain:s=Ct})=>`${Re(k)}.${s}`;var Ft={getIpDnsDomainForBlocklet:Dt,getDidDomainForBlocklet:qt};const Rt=R.forwardRef((k,s)=>{var b,y;const{t:a}=R.useContext(Y),{blocklet:n}=V(),{api:S}=H(),t=ne({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Z}),f=xe(),c=((y=(b=f==null?void 0:f.transitions)==null?void 0:b.duration)==null?void 0:y.leavingScreen)||300,p=m(()=>{t.mode="view",t.data={},t.callback=Z}),l=m(()=>{t.show=!1,setTimeout(()=>{p()},c)}),d=m(i=>{t.mode="view",t.show=!0,t.data=i}),T=m((i,r=Z)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=r});R.useImperativeHandle(s,()=>({open:d,close:l,approve:T}),[d,l,T]);const I=ee(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&at(i,"appliedAt","status"),i.map(r=>{const w=a(`federated.info.${r}`);let o=t.data[r];if(r==="appName"&&t.data.isMaster&&(o=e.jsxs(v,{children:[e.jsx(Fe,{component:ve}),o]})),["appId","appPid","serverId"].includes(r)&&(o=e.jsx(pe,{children:o})),["appUrl"].includes(r)&&(o=e.jsx(v,{component:"a",href:o,target:"_blank",children:o})),["appLogo"].includes(r)){const x=rt(`https://${Ft.getDidDomainForBlocklet({did:t.data.appPid})}`,"/.well-known/service/blocklet/logo");try{const u=new URL(x);u.searchParams.set("imageFilter","resize"),u.searchParams.set("w","80"),u.searchParams.set("h","80"),o=e.jsx("img",{src:u.href,width:"60",height:"60",alt:t.data.appName})}catch{o=e.jsx("img",{src:x,width:"60",height:"60",alt:t.data.appName})}}return r==="status"&&(o=o&&a(`federated.status.${o}`)),r==="migratedFrom"&&(o=(t.data.migratedFrom||[]).filter(F=>![t.data.appId,t.data.appPid].includes(F)).map(F=>e.jsx(pe,{children:F}))),st(o)&&(o="-"),{name:w,value:o}})},[t.data]),h=t.mode==="approve",g=m(async()=>{try{t.loadingReject=!0,await S.auditFederatedLogin({input:{memberPid:t.data.appPid,did:n.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),j=m(async()=>{try{t.loadingApprove=!0,await S.auditFederatedLogin({input:{memberPid:t.data.appPid,did:n.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(ge,{open:t.show,title:a(h?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:h?e.jsxs(e.Fragment,{children:[e.jsxs(z,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(fe,{size:16,color:"grey"}):null,a("common.reject")]}),e.jsxs(z,{variant:"contained",onClick:j,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(fe,{size:16,color:"grey"}):null,a("common.approve")]})]}):e.jsx(z,{variant:"outlined",onClick:l,children:a("common.close")}),children:I.map(i=>e.jsx(dt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),Be=R.forwardRef((k,s)=>{var d,T;const a=xe(),n=((T=(d=a==null?void 0:a.transitions)==null?void 0:d.duration)==null?void 0:T.leavingScreen)||300,{t:S}=R.useContext(Y),t=ne({show:!1,data:{link:""}}),f=m(()=>{t.data.link=""}),c=m(()=>{t.show=!1,setTimeout(()=>{f()},n)}),p=m(({link:I})=>{t.show=!0,t.data.link=I});R.useImperativeHandle(s,()=>({open:p,close:c}),[p,c]);const l=m(()=>{Ge(t.data.link),c()});return e.jsxs(ge,{open:t.show,title:S("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(E,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:S("common.copyAndClose")}),children:[e.jsx(v,{mb:1,children:S("federated.inviteJoinFederatedLoginDescription")}),e.jsx(v,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx($e,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function ye({mode:k}){var X,Se,ke,Te,we;const s=R.useRef(null),a=R.useRef(null),{t:n,locale:S}=R.useContext(Y),{blocklet:t,actions:{refreshBlocklet:f}}=V(),{confirmApi:c,confirmHolder:p}=Ne(),{api:l}=H(),d=((X=t.settings.federated)==null?void 0:X.sites)||[],T=((Se=t.settings.federated)==null?void 0:Se.config)||{},I=T.isMaster!==!1,h=d.find(C=>C.appPid===t.appPid),g=ne({loadingSync:!1}),j=m(C=>{var D;(D=a.current)==null||D.open(C)}),b=m(C=>{var D;(D=a.current)==null||D.approve(C,f)}),y=m(C=>{c.open({title:n("federated.removeFederatedLogin"),content:n("federated.removeFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:C.appPid}}),D()}})}),i=m(C=>{c.open({title:n("federated.disableFederatedLogin"),content:n("federated.disableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"revoked"}}),D()}})}),r=m(C=>{c.open({title:n("federated.enableFederatedLogin"),content:n("federated.enableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(D){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"approved"}}),D()}})}),w=ee(()=>{const C=[{label:n("common.name"),name:"appName",options:{customBodyRenderLite:D=>{const q=d[D],Q=q.isMaster!==!1;return e.jsx(v,{display:"inline-block",children:e.jsxs(v,{component:"a",display:"flex",alignItems:"center",href:q.appUrl,target:"_blank",onClick:O=>{O.stopPropagation()},children:[Q&&e.jsx(Fe,{component:ve,style:{marginRight:"4px"}}),q.appName]})})}}},{label:n("common.did"),name:"appId",options:{customBodyRenderLite:D=>{const q=d[D];return e.jsx(pe,{children:q.appId})}}},{label:n("common.status"),name:"status",options:{customBodyRenderLite:D=>{const q=d[D],Q=q.isMaster!==!1;return e.jsx(v,{children:Q?"-":n(`federated.status.${q.status}`)})}}}];return I&&C.push({label:n("common.actions"),name:"actions",options:{customBodyRenderLite:D=>{const q=d[D],Q=q.isMaster!==!1;return e.jsx(v,{display:"flex",gap:1,children:Q?e.jsxs(e.Fragment,{children:[q.status==="rejected"&&e.jsx(E,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation()},children:n("federated.status.rejected")}),q.status==="revoked"&&e.jsx(E,{variant:"contained",color:"secondary",size:"small",onClick:O=>{O.stopPropagation()},children:n("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation(),y(q)},children:n("federated.quitMember")},"quiteSite"),q.status==="pending"&&e.jsx(E,{variant:"contained",color:"primary",size:"small",onClick:O=>{O.stopPropagation(),b(q)},children:n("federated.status.pending")},"auditSite"),q.status==="approved"&&e.jsx(E,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation(),i(q)},style:{whiteSpace:"nowrap"},children:n("federated.revoke")},"revokeSite"),q.status==="revoked"&&e.jsx(E,{variant:"contained",color:"warning",size:"small",onClick:O=>{O.stopPropagation(),r(q)},style:{whiteSpace:"nowrap"},children:n("federated.approve")},"approveSite")]})})}}}),C},[T.appId,d,I,n]),o=ee(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(C,{dataIndex:D}){const q=d[D];j(q)}}),[]),x=m(()=>{var D;const C=t.environments.find(q=>q.key===it.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);C!=null&&C.value?(D=s.current)==null||D.open({link:C.value}):W.error(n("federated.failedToGetFederatedLoginLink"))},[(we=(Te=(ke=t.site)==null?void 0:ke.domainAliases)==null?void 0:Te[0])==null?void 0:we.href]),u=m(()=>{c.open({title:n("federated.quitFederatedLogin"),content:n("federated.quitFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.quitFederatedLogin({input:{did:t.appPid}}),C()}})}),F=m(()=>{c.open({title:n("federated.disbandFederatedLogin"),content:n("federated.disbandFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.disbandFederatedLogin({input:{did:t.appPid}}),C()}})}),B=m(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),He(500)]),W.success(n("common.succeeded"))}finally{g.loadingSync=!1}}),_=[];return h.status!=="pending"&&_.push(e.jsx(Qe,{title:n("federated.syncConfig"),children:e.jsx(re,{size:"small",onClick:B,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(J,{icon:wt,style:{fontSize:24}})},"syncConfig")})),k==="master"?(_.push(e.jsx(E,{size:"small",variant:"contained",onClick:x,sx:{ml:1},children:n("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),_.push(e.jsx(E,{color:"error",size:"small",variant:"contained",onClick:F,sx:{ml:1},children:n("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):_.push(e.jsx(E,{size:"small",variant:"contained",color:"error",onClick:u,sx:{ml:1},children:n("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"main-table",locale:S,data:d,columns:w,customButtons:_,title:e.jsx(v,{className:"table-toolbar-left",children:n("oauth.federated")}),options:o}),p,e.jsx(Be,{ref:s}),e.jsx(Rt,{ref:a})]})}ye.propTypes={mode:N.oneOf(["member","master"])};ye.defaultProps={mode:"member"};const Bt=R.forwardRef((k,s)=>{var g,j;const{t:a}=R.useContext(Y),{api:n}=H(),{blocklet:S}=V(),t=S==null?void 0:S.appPid,f=xe(),c=((j=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:j.leavingScreen)||300,p=ne({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Z}),l=m(()=>{p.appUrl="",p.appUrlError="",p.callback=Z}),d=m(()=>{p.show=!1,setTimeout(()=>{l()},c)}),T=m((b=Z)=>{p.show=!0,p.callback=b});R.useImperativeHandle(s,()=>({open:T,close:d}),[T,d]);const I=m(b=>{if(!b)throw new Error(a("federated.federatedJoinAppUrlRequired"));if(!Ke(b))throw new Error(a("federated.federatedJoinAppUrlInvalid"))}),h=m(async()=>{try{I(p.appUrl),p.loading=!0;const b=await n.joinFederatedLogin({input:{did:t,appUrl:p.appUrl}});p.show=!1,d(),p==null||p.callback(b)}catch(b){p.appUrlError=b.message}finally{p.loading=!1}});return e.jsxs(ge,{open:p.show,title:a("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(E,{color:"primary",autoFocus:!0,variant:"contained",onClick:h,disabled:p.loading,children:[p.loading?e.jsx(fe,{size:16,sx:{mr:1},color:"grey"}):null,a("common.confirm")]}),children:[e.jsx(v,{mb:1,children:a("federated.joinFederatedLoginDescription")}),e.jsx(A,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:a("federated.federatedJoinAppUrl"),label:a("federated.federatedJoinAppUrl"),value:p.appUrl,error:!!p.appUrlError,helperText:p.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{p.appUrl=b.target.value}})]})});function Pt(){var c,p,l,d,T;const k=R.useRef(null),s=R.useRef(null),{t:a}=R.useContext(Y),{blocklet:n,actions:{refreshBlocklet:S}}=V(),t=m(()=>{var h,g,j,b;const I=(j=(g=(h=n.site)==null?void 0:h.domainAliases)==null?void 0:g[0])==null?void 0:j.href;if(I)try{const y=new URL(I);(b=k.current)==null||b.open({link:y.origin})}catch{W.error(a("federated.failedToGetFederatedLoginLink"))}},[(l=(p=(c=n.site)==null?void 0:c.domainAliases)==null?void 0:p[0])==null?void 0:l.href]),f=m(()=>{var I;(I=s.current)==null||I.open(()=>{S()})});if(((d=n.settings.federated)==null?void 0:d.sites.length)>0){const I=((T=n.settings.federated)==null?void 0:T.config.isMaster)!==!1;return e.jsx(ye,{mode:I?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsxs(v,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[e.jsx(E,{variant:"contained",onClick:t,children:a("federated.inviteJoinFederatedLogin")}),e.jsx(et,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),e.jsx(E,{variant:"outlined",onClick:f,children:a("federated.joinFederatedLogin")})]}),e.jsx(Be,{ref:k}),e.jsx(Bt,{ref:s})]})}function Pe({orientation:k="horizontal"}){const{t:s}=R.useContext(Y),a=mt({key:"lg"}),n=[{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.commonSettings")}),value:"settings"},{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.federated")}),value:"federated"},{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.oauth")}),value:"oauth"},{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.moreLogin")}),value:"more"}],[S,t]=R.useState(n[0].value),f=ee(()=>({oauth:e.jsx(vt,{}),federated:e.jsx(Pt,{}),more:e.jsx(v,{children:e.jsx(Ze,{children:s("oauth.comingSoon")})}),settings:e.jsx(v,{children:e.jsx(yt,{})})}),[s]);return k==="vertical"?e.jsx(At,{children:e.jsxs($,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(v,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Le,{tabs:n,current:S,orientation:a?"horizontal":"vertical",onChange:t,sx:{borderRight:a?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(v,{sx:{flexGrow:1,minWidth:0},children:e.jsx(v,{children:f[S]})})]})}):e.jsxs(v,{children:[e.jsx(Le,{tabs:n,current:S,onChange:t}),e.jsx(v,{marginTop:"10px",children:f[S]})]})}Pe.propTypes={orientation:N.oneOf(["horizontal","vertical"])};Pe.defaultProps={orientation:"horizontal"};const At=tt.div`
1
+ import{u as te,V as W,bU as Ae,bV as Oe,h as ae,g as J,bQ as Ee,bR as Ue,a7 as We,a8 as Me,a6 as _e,bW as ze,a$ as Ie,m as me,r as Ve,aZ as Y,bX as pe,aj as ge,B as E,bH as $e,a1 as Ne,bY as He,a2 as Je,_ as Ke,X as Ze,ap as Le}from"./vendor-ux-did-connect-BQ3cvv_1.js";import{u as m,a as ne,f as ee,c as Ge}from"./vendor-hooks-DtYI0-rF.js";import{r as R}from"./vendor-react-DoD83n6N.js";import{j as e,a4 as v,bp as P,bl as U,M as A,x as z,E as N,T as he,I as re,ae as $,cv as Ye,a2 as Xe,e as xe,a3 as fe,$ as Fe,a5 as Qe,al as et,aa as tt}from"./vendor-mui-core-C-PhacC8.js";import{H as G,a0 as nt,b as Ce,C as ot,n as Z,aD as at,y as rt,z as st}from"./vendor-utils-CRBr0QUY.js";import{a as oe,C as L,e as De}from"./dashboard-B9esZ0M-.js";import{A as H,D as V,h as it}from"./index-_IytyGrM.js";import{S as se}from"./switch-control-DjMziEFc.js";import{K as lt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{t as qe,y as ct}from"./vendor-arcblock-D8eCUoJY.js";import{I as dt}from"./index-CqRb1YIC.js";import{b as ut}from"./base32-CEWQZb_G.js";import{u as mt}from"./use-mobile-DudfIz3d.js";import"./lottie-web-B6s7dDoL.js";import"./useLocalStorage-C1_Fkr6_.js";import"./confirm-C-7TGRgW.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-BEUAi9Bt.js";import"./get-safe-url-M62JolcK.js";import"./index-C7X4Y3ad.js";import"./session-Clq9kJzg.js";import"./useAsyncRetry-CwtLImQi.js";import"./useAsync-BmuLIImU.js";import"./InfoOutlined-DFTm-vVr.js";import"./useSetState-BL3ktMon.js";import"./use-mobile-B_Gqv6b6.js";const ie={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(b=s==null?void 0:s.meta)==null?void 0:b.did,S=Object.assign({...ie},((i=(y=s==null?void 0:s.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(ie))}),d=p("enabled"),T=m(async r=>{var w,o;try{const{blocklet:x}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({auth0:r})}}),u=Object.assign({...ie},((o=(w=x==null?void 0:x.settings)==null?void 0:w.oauth)==null?void 0:o.auth0)||{});l(u),W.success(a("oauth.saveSuccess"))}catch(x){W.error(x.message||a("oauth.saveFailed"))}}),I=m(r=>r!=null&&r.trim()?!0:a("oauth.auth0.domainDescription")),h=m(r=>r!=null&&r.trim()?!0:a("oauth.auth0.clientIdDescription")),g=m(r=>r!=null&&r.trim()?!0:a("oauth.auth0.clientSecretDescription")),j=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(P,{control:e.jsx(se,{checked:r.value,style:{marginRight:"6px"},...r}),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"domain",control:f,rules:{validate:d?I:j},render:({field:r})=>{var w;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...r,label:a("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((w=c.errors[r.name])==null?void 0:w.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientId",control:f,rules:{validate:d?h:j},render:({field:r})=>{var w;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...r,error:!!c.errors[r.name],label:a("oauth.auth0.clientId"),helperText:((w=c.errors[r.name])==null?void 0:w.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?g:j},render:({field:r})=>{var w;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...r,type:"password",error:!!c.errors[r.name],label:a("oauth.auth0.clientSecret"),helperText:((w=c.errors[r.name])==null?void 0:w.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const le={enabled:!1,clientId:"",clientSecret:""};function ht(){var j,b,y;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(j=s==null?void 0:s.meta)==null?void 0:j.did,S=Object.assign({...le},((y=(b=s==null?void 0:s.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(le))}),d=p("enabled"),T=m(async i=>{var r,w;try{const{blocklet:o}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({github:i})}}),x=Object.assign({...le},((w=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:w.github)||{});l(x),W.success(a("oauth.saveSuccess"))}catch(o){W.error(o.message||a("oauth.saveFailed"))}}),I=m(i=>i!=null&&i.trim()?!0:a("oauth.github.clientIdDescription")),h=m(i=>i!=null&&i.trim()?!0:a("oauth.github.clientSecretDescription")),g=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(P,{control:e.jsx(se,{checked:i.value,style:{marginRight:"6px"},...i}),label:a("oauth.github.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,error:!!c.errors[i.name],label:a("oauth.github.clientId"),helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?h:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,type:"password",label:a("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ft(){var j,b,y;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(j=s==null?void 0:s.meta)==null?void 0:j.did,S=Object.assign({...ce},((y=(b=s==null?void 0:s.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(ce))}),d=p("enabled"),T=m(async i=>{var r,w;try{const{blocklet:o}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({google:i})}}),x=Object.assign({...ce},((w=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:w.google)||{});l(x),W.success(a("oauth.saveSuccess"))}catch(o){W.error(o.message||a("oauth.saveFailed"))}}),I=m(i=>i!=null&&i.trim()?!0:a("oauth.google.clientIdDescription")),h=m(i=>i!=null&&i.trim()?!0:a("oauth.google.clientSecretDescription")),g=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(P,{control:e.jsx(se,{checked:i.value,style:{marginRight:"6px"},...i}),label:a("oauth.google.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,error:!!c.errors[i.name],label:a("oauth.google.clientId"),helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?h:g},render:({field:i})=>{var r;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...i,type:"password",label:a("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const de={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function gt(){var i,r,w;const{api:k}=H(),{blocklet:s}=V(),{t:a}=te(),n=(i=s==null?void 0:s.meta)==null?void 0:i.did,S=Object.assign({...de},((w=(r=s==null?void 0:s.settings)==null?void 0:r.oauth)==null?void 0:w.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:p,reset:l}=oe({defaultValues:G(S,Object.keys(de))}),d=p("enabled"),T=m(async o=>{var x,u;try{const{blocklet:F}=await k.configOAuth({input:{did:n,oauth:JSON.stringify({apple:o})}}),B=Object.assign({...de},((u=(x=F==null?void 0:F.settings)==null?void 0:x.oauth)==null?void 0:u.apple)||{});l(B),W.success(a("oauth.saveSuccess"))}catch(F){W.error(F.message||a("oauth.saveFailed"))}}),I=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.teamIdDescription")),h=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.serviceIdDescription")),g=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.keyIdDescription")),j=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.authKeyDescription")),b=m(o=>o!=null&&o.trim()?!0:a("oauth.apple.bundleIdDescription")),y=m(()=>!0);return e.jsx(v,{children:e.jsxs("form",{onSubmit:t(T),disabled:!0,children:[e.jsx(L,{name:"enabled",control:f,render:({field:o})=>e.jsx(P,{control:e.jsx(se,{checked:o.value,style:{marginRight:"6px"},...o}),label:a("oauth.apple.enable"),sx:{marginBottom:2,ml:1}})}),e.jsx(L,{name:"teamId",control:f,rules:{validate:d?I:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.teamId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.bundleId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"serviceId",control:f,rules:{validate:d?h:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.serviceId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,error:!!c.errors[o.name],label:a("oauth.apple.keyId"),helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(L,{name:"authKey",control:f,rules:{validate:d?j:y},render:({field:o})=>{var x;return e.jsx(U,{fullWidth:!0,children:e.jsx(A,{...o,type:"password",multiline:!0,rows:4,label:a("oauth.apple.authKey"),error:!!c.errors[o.name],helperText:((x=c.errors[o.name])==null?void 0:x.message)||" ",disabled:!d})})}}),e.jsx(z,{type:"submit",variant:"contained",onSubmit:t(T),disabled:!c.isDirty,children:a("oauth.save")})]})})}const xt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:k,id:s,children:a,index:n,onMove:S,defaultExpand:t,onEnd:f}){const[c,p]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:T},I]=Ae({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,X;if(!l.current)return;const r=y.index,w=n;if(r===w)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),x=(X=d.current)==null?void 0:X.getBoundingClientRect(),u=(x.bottom-x.top)/2,B=i.getClientOffset().y-o.top;r<w&&B<u||r>w&&B>u||(S(r,w),y.index=w)}}),[{isDragging:h},g]=Oe({item:{index:n,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),I(l);const j=h?.5:1,b=m(y=>{y.preventDefault(),y.stopPropagation(),p(!c)});return e.jsxs(v,{ref:l,sx:{borderBottom:`1px solid ${ae.lineBorderStrong}`},children:[e.jsx(v,{sx:{cursor:"pointer","&:hover":{backgroundColor:ae.backgroundsBgSubtileHover},borderRadius:2},ref:d,"data-handler-id":T,children:e.jsxs(v,{sx:{py:1.5,px:1,opacity:j,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(v,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:ae.textMuted,"&:hover":{color:ae.textSubtitle}},children:e.jsx(J,{fontSize:20,icon:xt})}),e.jsx(he,{sx:{flex:1},children:k}),e.jsx(re,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(J,{icon:lt,style:{transform:"scale(1.5)"}})})]})}),e.jsx(v,{sx:{pl:4,py:1,display:c?"block":"none"},children:a})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!0};const bt=[{name:"github",title:"GitHub",icon:e.jsx(J,{icon:We}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(J,{icon:Me}),component:e.jsx(ft,{})},{name:"apple",title:"Apple",icon:e.jsx(J,{icon:_e}),component:e.jsx(gt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(J,{icon:ze}),component:e.jsx(pt,{})}],jt=["github","google","apple","auth0"];function vt(){var T,I;const{api:k}=H(),{blocklet:s}=V(),a=(T=s==null?void 0:s.meta)==null?void 0:T.did,n=((I=s==null?void 0:s.settings)==null?void 0:I.oauth)||{},S=Object.keys(n).sort((h,g)=>{var j,b,y;return((j=n[h])==null?void 0:j.order)!==void 0&&((b=n[g])==null?void 0:b.order)!==void 0?n[h].order-n[g].order:((y=n[h])==null?void 0:y.order)!==void 0?-1:1});for(const h of jt)S.includes(h)||S.push(h);const t=ne(S.reduce((h,g,j)=>Object.assign(h,{[g]:j}),{})),f=ee(()=>{const h=[...bt];return h.sort((g,j)=>t[g.name]-t[j.name]),h},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const p=m(async h=>{const g={};Object.keys(h).forEach(j=>{g[j]={order:h[j]}}),await k.configOAuth({input:{did:a,oauth:JSON.stringify(g)}})}),l=m((h,g)=>{const j=f[h],b=f[g];t[j.name]=g,t[b.name]=h}),d=m(async()=>{await p(t)});return e.jsx(v,{children:e.jsx(Ee,{backend:Ue,...c,children:f.map((h,g)=>e.jsx(be,{index:g,id:h.name,title:h.title,icon:h.icon,onMove:l,onEnd:d,defaultExpand:h.enabled,children:h.component},h.name))})})}const K={ttl:me.SESSION_TTL,cacheTtl:me.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(k){return e.jsx(ct,{...k,sx:{marginLeft:1,marginRight:.5,transform:"scale(0.75)"}})}function ue(k,s=!1){const a=s?k.ttl*86400:k.ttl/86400;return{...k,ttl:a}}function yt(){var o,x;const{api:k}=H(),{blocklet:s}=V(),a=(o=s==null?void 0:s.meta)==null?void 0:o.did,n=nt({},K,((x=s==null?void 0:s.settings)==null?void 0:x.session)||{});Ce(n.ttl)&&(n.ttl=K.ttl),Ce(n.cacheTtl)&&(n.cacheTtl=K.cacheTtl),n.phone||(n.phone=K.phone),n.email||(n.email=K.email);const{handleSubmit:S,control:t,formState:f,reset:c,watch:p}=oe({defaultValues:G(ue(n),["ttl","cacheTtl","email","phone"])}),{t:l}=te(),d=p("email.enabled"),T=p("phone.enabled"),I=p("email.enableDomainBlackList"),h=p("email.enableDomainWhiteList"),{fields:g,append:j,remove:b}=De({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:r}=De({control:t,name:"email.domainWhiteList"}),w=m(async u=>{var F;try{const{blocklet:B}=await k.updateAppSessionConfig({input:{did:a,config:ot(ue(u,!0),["phone"])}}),_=Object.assign({},K,G(((F=B==null?void 0:B.settings)==null?void 0:F.session)||{},["ttl","cacheTtl","email","phone"]));c(ue(_)),W.success(l("common.configSuccess"))}catch(B){W.error(B.message)}});return e.jsx("form",{onSubmit:S(w),children:e.jsxs($,{direction:"column",spacing:4,children:[e.jsxs($,{direction:"column",children:[e.jsx(he,{variant:"body1",mb:1,children:l("blocklet.config.session.profile")}),e.jsx(P,{disabled:!0,control:e.jsx(M,{size:"small",checked:!0}),label:l("blocklet.config.session.fullNameEnabled")}),e.jsx(P,{disabled:!0,control:e.jsx(M,{checked:!0}),label:l("blocklet.config.session.avatarEnabled")}),e.jsx(L,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailEnabled")})}),d&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(L,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailRequireVerified")})}),e.jsx(L,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailRequireUnique")})}),e.jsx(L,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.emailTrustOauthProviders")})}),e.jsx(L,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.enableDomainBlackList")})}),I&&e.jsxs(v,{ml:2,children:[g.map((u,F)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${F}`,control:t,render:B=>e.jsx(A,{...B.field,size:"small",fullWidth:!0})}),e.jsx(re,{onClick:()=>b(F),children:e.jsx(Ie,{})})]},u.id)),e.jsx(z,{startIcon:e.jsx(qe,{}),onClick:()=>j(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(L,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.enableDomainWhiteList")})}),h&&e.jsxs(v,{ml:2,children:[y.map((u,F)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${F}`,control:t,render:B=>e.jsx(A,{...B.field,size:"small",fullWidth:!0})}),e.jsx(re,{onClick:()=>r(F),children:e.jsx(Ie,{})})]},u.id)),e.jsx(z,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(v,{sx:{display:"none"},children:[e.jsx(L,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.phoneEnabled")})}),T&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(L,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.phoneRequireVerified")})}),e.jsx(L,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(P,{control:e.jsx(M,{...u,checked:u.value}),label:l("blocklet.config.session.phoneRequireUnique")})})]})]})]}),e.jsxs($,{direction:"column",spacing:2,children:[e.jsx(he,{variant:"body1",children:l("blocklet.config.session.period")}),e.jsx(L,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(U,{fullWidth:!0,sx:{mb:2},children:e.jsxs($,{px:3,children:[e.jsx(v,{mx:-3,children:l("blocklet.config.session.ttl",{day:u.value})}),e.jsx(Ye,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})})]}),e.jsx(v,{children:e.jsx(z,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}var je={},St=Xe;Object.defineProperty(je,"__esModule",{value:!0});var ve=je.default=void 0,kt=St(Ve()),Tt=e;ve=je.default=(0,kt.default)((0,Tt.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const wt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:It,SLOT_FOR_IP_DNS_SITE:Lt,DEFAULT_DID_DOMAIN:Ct}=me,{encode:Re}=ut,Dt=k=>`${Re(k.meta.did)}-${Lt}.${It}`,qt=({did:k,didDomain:s=Ct})=>`${Re(k)}.${s}`;var Ft={getIpDnsDomainForBlocklet:Dt,getDidDomainForBlocklet:qt};const Rt=R.forwardRef((k,s)=>{var b,y;const{t:a}=R.useContext(Y),{blocklet:n}=V(),{api:S}=H(),t=ne({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Z}),f=xe(),c=((y=(b=f==null?void 0:f.transitions)==null?void 0:b.duration)==null?void 0:y.leavingScreen)||300,p=m(()=>{t.mode="view",t.data={},t.callback=Z}),l=m(()=>{t.show=!1,setTimeout(()=>{p()},c)}),d=m(i=>{t.mode="view",t.show=!0,t.data=i}),T=m((i,r=Z)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=r});R.useImperativeHandle(s,()=>({open:d,close:l,approve:T}),[d,l,T]);const I=ee(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&at(i,"appliedAt","status"),i.map(r=>{const w=a(`federated.info.${r}`);let o=t.data[r];if(r==="appName"&&t.data.isMaster&&(o=e.jsxs(v,{children:[e.jsx(Fe,{component:ve}),o]})),["appId","appPid","serverId"].includes(r)&&(o=e.jsx(pe,{children:o})),["appUrl"].includes(r)&&(o=e.jsx(v,{component:"a",href:o,target:"_blank",children:o})),["appLogo"].includes(r)){const x=rt(`https://${Ft.getDidDomainForBlocklet({did:t.data.appPid})}`,"/.well-known/service/blocklet/logo");try{const u=new URL(x);u.searchParams.set("imageFilter","resize"),u.searchParams.set("w","80"),u.searchParams.set("h","80"),o=e.jsx("img",{src:u.href,width:"60",height:"60",alt:t.data.appName})}catch{o=e.jsx("img",{src:x,width:"60",height:"60",alt:t.data.appName})}}return r==="status"&&(o=o&&a(`federated.status.${o}`)),r==="migratedFrom"&&(o=(t.data.migratedFrom||[]).filter(F=>![t.data.appId,t.data.appPid].includes(F)).map(F=>e.jsx(pe,{children:F}))),st(o)&&(o="-"),{name:w,value:o}})},[t.data]),h=t.mode==="approve",g=m(async()=>{try{t.loadingReject=!0,await S.auditFederatedLogin({input:{memberPid:t.data.appPid,did:n.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),j=m(async()=>{try{t.loadingApprove=!0,await S.auditFederatedLogin({input:{memberPid:t.data.appPid,did:n.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(ge,{open:t.show,title:a(h?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:h?e.jsxs(e.Fragment,{children:[e.jsxs(z,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(fe,{size:16,color:"grey"}):null,a("common.reject")]}),e.jsxs(z,{variant:"contained",onClick:j,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(fe,{size:16,color:"grey"}):null,a("common.approve")]})]}):e.jsx(z,{variant:"outlined",onClick:l,children:a("common.close")}),children:I.map(i=>e.jsx(dt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),Be=R.forwardRef((k,s)=>{var d,T;const a=xe(),n=((T=(d=a==null?void 0:a.transitions)==null?void 0:d.duration)==null?void 0:T.leavingScreen)||300,{t:S}=R.useContext(Y),t=ne({show:!1,data:{link:""}}),f=m(()=>{t.data.link=""}),c=m(()=>{t.show=!1,setTimeout(()=>{f()},n)}),p=m(({link:I})=>{t.show=!0,t.data.link=I});R.useImperativeHandle(s,()=>({open:p,close:c}),[p,c]);const l=m(()=>{Ge(t.data.link),c()});return e.jsxs(ge,{open:t.show,title:S("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(E,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:S("common.copyAndClose")}),children:[e.jsx(v,{mb:1,children:S("federated.inviteJoinFederatedLoginDescription")}),e.jsx(v,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx($e,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function ye({mode:k}){var X,Se,ke,Te,we;const s=R.useRef(null),a=R.useRef(null),{t:n,locale:S}=R.useContext(Y),{blocklet:t,actions:{refreshBlocklet:f}}=V(),{confirmApi:c,confirmHolder:p}=Ne(),{api:l}=H(),d=((X=t.settings.federated)==null?void 0:X.sites)||[],T=((Se=t.settings.federated)==null?void 0:Se.config)||{},I=T.isMaster!==!1,h=d.find(C=>C.appPid===t.appPid),g=ne({loadingSync:!1}),j=m(C=>{var D;(D=a.current)==null||D.open(C)}),b=m(C=>{var D;(D=a.current)==null||D.approve(C,f)}),y=m(C=>{c.open({title:n("federated.removeFederatedLogin"),content:n("federated.removeFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:C.appPid}}),D()}})}),i=m(C=>{c.open({title:n("federated.disableFederatedLogin"),content:n("federated.disableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"revoked"}}),D()}})}),r=m(C=>{c.open({title:n("federated.enableFederatedLogin"),content:n("federated.enableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(D){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"approved"}}),D()}})}),w=ee(()=>{const C=[{label:n("common.name"),name:"appName",options:{customBodyRenderLite:D=>{const q=d[D],Q=q.isMaster!==!1;return e.jsx(v,{display:"inline-block",children:e.jsxs(v,{component:"a",display:"flex",alignItems:"center",href:q.appUrl,target:"_blank",onClick:O=>{O.stopPropagation()},children:[Q&&e.jsx(Fe,{component:ve,style:{marginRight:"4px"}}),q.appName]})})}}},{label:n("common.did"),name:"appId",options:{customBodyRenderLite:D=>{const q=d[D];return e.jsx(pe,{children:q.appId})}}},{label:n("common.status"),name:"status",options:{customBodyRenderLite:D=>{const q=d[D],Q=q.isMaster!==!1;return e.jsx(v,{children:Q?"-":n(`federated.status.${q.status}`)})}}}];return I&&C.push({label:n("common.actions"),name:"actions",options:{customBodyRenderLite:D=>{const q=d[D],Q=q.isMaster!==!1;return e.jsx(v,{display:"flex",gap:1,children:Q?e.jsxs(e.Fragment,{children:[q.status==="rejected"&&e.jsx(E,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation()},children:n("federated.status.rejected")}),q.status==="revoked"&&e.jsx(E,{variant:"contained",color:"secondary",size:"small",onClick:O=>{O.stopPropagation()},children:n("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation(),y(q)},children:n("federated.quitMember")},"quiteSite"),q.status==="pending"&&e.jsx(E,{variant:"contained",color:"primary",size:"small",onClick:O=>{O.stopPropagation(),b(q)},children:n("federated.status.pending")},"auditSite"),q.status==="approved"&&e.jsx(E,{variant:"contained",color:"error",size:"small",onClick:O=>{O.stopPropagation(),i(q)},style:{whiteSpace:"nowrap"},children:n("federated.revoke")},"revokeSite"),q.status==="revoked"&&e.jsx(E,{variant:"contained",color:"warning",size:"small",onClick:O=>{O.stopPropagation(),r(q)},style:{whiteSpace:"nowrap"},children:n("federated.approve")},"approveSite")]})})}}}),C},[T.appId,d,I,n]),o=ee(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(C,{dataIndex:D}){const q=d[D];j(q)}}),[]),x=m(()=>{var D;const C=t.environments.find(q=>q.key===it.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);C!=null&&C.value?(D=s.current)==null||D.open({link:C.value}):W.error(n("federated.failedToGetFederatedLoginLink"))},[(we=(Te=(ke=t.site)==null?void 0:ke.domainAliases)==null?void 0:Te[0])==null?void 0:we.href]),u=m(()=>{c.open({title:n("federated.quitFederatedLogin"),content:n("federated.quitFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.quitFederatedLogin({input:{did:t.appPid}}),C()}})}),F=m(()=>{c.open({title:n("federated.disbandFederatedLogin"),content:n("federated.disbandFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.disbandFederatedLogin({input:{did:t.appPid}}),C()}})}),B=m(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),He(500)]),W.success(n("common.succeeded"))}finally{g.loadingSync=!1}}),_=[];return h.status!=="pending"&&_.push(e.jsx(Qe,{title:n("federated.syncConfig"),children:e.jsx(re,{size:"small",onClick:B,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(J,{icon:wt,style:{fontSize:24}})},"syncConfig")})),k==="master"?(_.push(e.jsx(E,{size:"small",variant:"contained",onClick:x,sx:{ml:1},children:n("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),_.push(e.jsx(E,{color:"error",size:"small",variant:"contained",onClick:F,sx:{ml:1},children:n("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):_.push(e.jsx(E,{size:"small",variant:"contained",color:"error",onClick:u,sx:{ml:1},children:n("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"main-table",locale:S,data:d,columns:w,customButtons:_,title:e.jsx(v,{className:"table-toolbar-left",children:n("oauth.federated")}),options:o}),p,e.jsx(Be,{ref:s}),e.jsx(Rt,{ref:a})]})}ye.propTypes={mode:N.oneOf(["member","master"])};ye.defaultProps={mode:"member"};const Bt=R.forwardRef((k,s)=>{var g,j;const{t:a}=R.useContext(Y),{api:n}=H(),{blocklet:S}=V(),t=S==null?void 0:S.appPid,f=xe(),c=((j=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:j.leavingScreen)||300,p=ne({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Z}),l=m(()=>{p.appUrl="",p.appUrlError="",p.callback=Z}),d=m(()=>{p.show=!1,setTimeout(()=>{l()},c)}),T=m((b=Z)=>{p.show=!0,p.callback=b});R.useImperativeHandle(s,()=>({open:T,close:d}),[T,d]);const I=m(b=>{if(!b)throw new Error(a("federated.federatedJoinAppUrlRequired"));if(!Ke(b))throw new Error(a("federated.federatedJoinAppUrlInvalid"))}),h=m(async()=>{try{I(p.appUrl),p.loading=!0;const b=await n.joinFederatedLogin({input:{did:t,appUrl:p.appUrl}});p.show=!1,d(),p==null||p.callback(b)}catch(b){p.appUrlError=b.message}finally{p.loading=!1}});return e.jsxs(ge,{open:p.show,title:a("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(E,{color:"primary",autoFocus:!0,variant:"contained",onClick:h,disabled:p.loading,children:[p.loading?e.jsx(fe,{size:16,sx:{mr:1},color:"grey"}):null,a("common.confirm")]}),children:[e.jsx(v,{mb:1,children:a("federated.joinFederatedLoginDescription")}),e.jsx(A,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:a("federated.federatedJoinAppUrl"),label:a("federated.federatedJoinAppUrl"),value:p.appUrl,error:!!p.appUrlError,helperText:p.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{p.appUrl=b.target.value}})]})});function Pt(){var c,p,l,d,T;const k=R.useRef(null),s=R.useRef(null),{t:a}=R.useContext(Y),{blocklet:n,actions:{refreshBlocklet:S}}=V(),t=m(()=>{var h,g,j,b;const I=(j=(g=(h=n.site)==null?void 0:h.domainAliases)==null?void 0:g[0])==null?void 0:j.href;if(I)try{const y=new URL(I);(b=k.current)==null||b.open({link:y.origin})}catch{W.error(a("federated.failedToGetFederatedLoginLink"))}},[(l=(p=(c=n.site)==null?void 0:c.domainAliases)==null?void 0:p[0])==null?void 0:l.href]),f=m(()=>{var I;(I=s.current)==null||I.open(()=>{S()})});if(((d=n.settings.federated)==null?void 0:d.sites.length)>0){const I=((T=n.settings.federated)==null?void 0:T.config.isMaster)!==!1;return e.jsx(ye,{mode:I?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsxs(v,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[e.jsx(E,{variant:"contained",onClick:t,children:a("federated.inviteJoinFederatedLogin")}),e.jsx(et,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),e.jsx(E,{variant:"outlined",onClick:f,children:a("federated.joinFederatedLogin")})]}),e.jsx(Be,{ref:k}),e.jsx(Bt,{ref:s})]})}function Pe({orientation:k="horizontal"}){const{t:s}=R.useContext(Y),a=mt({key:"lg"}),n=[{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.commonSettings")}),value:"settings"},{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.federated")}),value:"federated"},{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.oauth")}),value:"oauth"},{label:e.jsx(v,{textAlign:"center",width:"100%",children:s("oauth.moreLogin")}),value:"more"}],[S,t]=R.useState(n[0].value),f=ee(()=>({oauth:e.jsx(vt,{}),federated:e.jsx(Pt,{}),more:e.jsx(v,{children:e.jsx(Ze,{children:s("oauth.comingSoon")})}),settings:e.jsx(v,{children:e.jsx(yt,{})})}),[s]);return k==="vertical"?e.jsx(At,{children:e.jsxs($,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(v,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Le,{tabs:n,current:S,orientation:a?"horizontal":"vertical",onChange:t,sx:{borderRight:a?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(v,{sx:{flexGrow:1,minWidth:0},children:e.jsx(v,{children:f[S]})})]})}):e.jsxs(v,{children:[e.jsx(Le,{tabs:n,current:S,onChange:t}),e.jsx(v,{marginTop:"10px",children:f[S]})]})}Pe.propTypes={orientation:N.oneOf(["horizontal","vertical"])};Pe.defaultProps={orientation:"horizontal"};const At=tt.div`
2
2
  .MuiTab-root {
3
3
  text-align: left;
4
4
  align-items: flex-start;