@abtnode/blocklet-services 1.16.45-beta-20250627-075343-5af3ad9a → 1.16.45-beta-20250630-024910-24ef8c24

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 (91) hide show
  1. package/api/routes/user.js +27 -20
  2. package/api/services/kyc/index.js +8 -1
  3. package/dist/assets/{access-control-BH4SKMry.js → access-control-BI8hR4m6.js} +1 -1
  4. package/dist/assets/{add-component-core-DsuA1aKD.js → add-component-core-DJ6wP3Fb.js} +1 -1
  5. package/dist/assets/{add-resource-BHpNuRRT.js → add-resource-Xzrl9J9E.js} +1 -1
  6. package/dist/assets/{advanced-Dv4hgvDN.js → advanced-DAKR9vq6.js} +1 -1
  7. package/dist/assets/{appearance-D25Cy4CD.js → appearance-CLcBa2If.js} +1 -1
  8. package/dist/assets/{ar-BN95HEFs.js → ar-muZ8yq-3.js} +1 -1
  9. package/dist/assets/{audit-logs-DxpLWxIb.js → audit-logs-BpxjWxH9.js} +1 -1
  10. package/dist/assets/{authorize-BYosyezE.js → authorize-CJAHvI6f.js} +1 -1
  11. package/dist/assets/{branding-0f-nlnTd.js → branding-BqmpdYqw.js} +1 -1
  12. package/dist/assets/{branding-qHr23kxy.js → branding-Ds5vrS60.js} +2 -2
  13. package/dist/assets/{bundle-avatar-o4aWU1WK.js → bundle-avatar-DAWssS61.js} +1 -1
  14. package/dist/assets/{complete-DZkXZTgu.js → complete-CoItwYYG.js} +1 -1
  15. package/dist/assets/{component-ufgkgw5l.js → component-D4dOU94T.js} +3 -3
  16. package/dist/assets/{config-4oY1pbez.js → config-CrGTIwll.js} +1 -1
  17. package/dist/assets/{config-navigation-Bc7wRQPN.js → config-navigation-Ba_9bXNB.js} +3 -3
  18. package/dist/assets/{config-space-CDOLSL71.js → config-space-C_-wUm8x.js} +1 -1
  19. package/dist/assets/{confirm-CYOuqhW9.js → confirm-Cr4yXaP3.js} +1 -1
  20. package/dist/assets/{connect-BLeEbq2b.js → connect-CT4V0Shw.js} +1 -1
  21. package/dist/assets/{connect-B0psb3-s.js → connect-LANmhgqd.js} +1 -1
  22. package/dist/assets/{connect-to-BNRP7uKc.js → connect-to-CcDyzDBC.js} +1 -1
  23. package/dist/assets/{dashboard-Cvfy6NEE.js → dashboard-BrJfe1tK.js} +3 -3
  24. package/dist/assets/{de-BmXl3Jnb.js → de-C7PyfZoI.js} +1 -1
  25. package/dist/assets/{delete-confirm-DkwIz2kG.js → delete-confirm-BTxOYOoY.js} +1 -1
  26. package/dist/assets/{domain-action-card-BePK3J5E.js → domain-action-card-C9RDnMzS.js} +1 -1
  27. package/dist/assets/{domain-syiX0-xT.js → domain-q-cSvLb-.js} +1 -1
  28. package/dist/assets/{domains-nIh9pvJN.js → domains-DzDEWZRA.js} +1 -1
  29. package/dist/assets/{email-D1fetol9.js → email-CslWHpNP.js} +1 -1
  30. package/dist/assets/{es-C0fHeuzj.js → es-DLm4lJg0.js} +1 -1
  31. package/dist/assets/{exchange-passport-6gauQ6xB.js → exchange-passport-CkSkVesx.js} +1 -1
  32. package/dist/assets/{fr-CO0NFjy0.js → fr-CKdoTmsi.js} +1 -1
  33. package/dist/assets/{fuel-C0n-khQ9.js → fuel-BWsBctX0.js} +1 -1
  34. package/dist/assets/{gen-access-key-CTcU_k3z.js → gen-access-key-jpSB31VW.js} +1 -1
  35. package/dist/assets/{hi-Cms3dwY-.js → hi-C_IKh6W5.js} +1 -1
  36. package/dist/assets/{id-Bo8dj7EE.js → id-DG7dMeJq.js} +1 -1
  37. package/dist/assets/{index-YTd3fqJi.js → index-B6novXpp.js} +1 -1
  38. package/dist/assets/{index-CssP44F_.js → index-B8h7EuKB.js} +1 -1
  39. package/dist/assets/{index-7mvFZreO.js → index-Br-eR92d.js} +1 -1
  40. package/dist/assets/{index-CW1Uu8tM.js → index-Bv_IEtVv.js} +1 -1
  41. package/dist/assets/{index-Cd0lzxjI.js → index-C0WYw-jd.js} +1 -1
  42. package/dist/assets/{index-CMYHZyLG.js → index-C0kIXw5r.js} +4 -4
  43. package/dist/assets/{index-avNWKuLM.js → index-CCuD6_Rj.js} +1 -1
  44. package/dist/assets/{index-DC-aJClV.js → index-CYp1xoZ4.js} +1 -1
  45. package/dist/assets/{index-DmckOkn6.js → index-D-vHTvCV.js} +1 -1
  46. package/dist/assets/{index-z4rrXifq.js → index-D4KLEWFm.js} +1 -1
  47. package/dist/assets/{index-DOM4CWCV.js → index-DUGQ4cKm.js} +1 -1
  48. package/dist/assets/{index-B2m3FSsr.js → index-DzRGp0If.js} +3 -3
  49. package/dist/assets/{index-C4yBWU5s.js → index-GAl9W53I.js} +4 -4
  50. package/dist/assets/{index-ZnxES9EB.js → index-YO79r625.js} +1 -1
  51. package/dist/assets/{index-D0mjW5YA.js → index-ha4GQCBu.js} +1 -1
  52. package/dist/assets/{index-Cza1eXOB.js → index-l5blEEs7.js} +1 -1
  53. package/dist/assets/{invitation-jsh1K30w.js → invitation-49Fgeotv.js} +1 -1
  54. package/dist/assets/{invite-DB6Gc2ZO.js → invite-DLJIQmdJ.js} +1 -1
  55. package/dist/assets/{issue-passport-BElK-FIZ.js → issue-passport-DDCqVv1N.js} +1 -1
  56. package/dist/assets/{item-D95t-at-.js → item-fK0vcLaQ.js} +1 -1
  57. package/dist/assets/{ja-zaAhH8mE.js → ja-DePe5vMS.js} +1 -1
  58. package/dist/assets/{ko-CoZQ7a7T.js → ko-BKnl7Jtq.js} +1 -1
  59. package/dist/assets/{layout-CCLJBPEI.js → layout-feohUWg7.js} +1 -1
  60. package/dist/assets/{list-Dk6LlvZw.js → list-C8TeMgEe.js} +1 -1
  61. package/dist/assets/{list-q5d_hBMT.js → list-DeTNTY_6.js} +2 -2
  62. package/dist/assets/{log-CYFcudFD.js → log-BiuahUh0.js} +1 -1
  63. package/dist/assets/{login-Bs3IhQdt.js → login-5jPX--4W.js} +1 -1
  64. package/dist/assets/{logo-uploader-BSR27hpo.js → logo-uploader-DC4SpQmr.js} +2 -2
  65. package/dist/assets/{lost-passport-CHgCTW2X.js → lost-passport-BNyxQig9.js} +1 -1
  66. package/dist/assets/{overview-BlZSVHbX.js → overview-DtickflS.js} +1 -1
  67. package/dist/assets/{passport-item-C1Pxlerj.js → passport-item-BTBWvJCh.js} +1 -1
  68. package/dist/assets/{pt-D4wJ-rZD.js → pt-BoWjQJrr.js} +1 -1
  69. package/dist/assets/{publish-resource-CjbA8eXl.js → publish-resource-DyUoB0-C.js} +1 -1
  70. package/dist/assets/{ru-CmWrzb7M.js → ru-C8y980Xl.js} +1 -1
  71. package/dist/assets/{runtime-BAC7Yn-4.js → runtime-Bta2wOnU.js} +1 -1
  72. package/dist/assets/{security-BdzQGoAm.js → security-Bs24V5aw.js} +1 -1
  73. package/dist/assets/{setup-mVNNI9iB.js → setup-DLQmZAqt.js} +3 -3
  74. package/dist/assets/{start-CGuvKy2s.js → start-CxjnQYOx.js} +1 -1
  75. package/dist/assets/{status-C6AnHonq.js → status-Cht9_8hC.js} +1 -1
  76. package/dist/assets/{step-actions-Bps0yIu_.js → step-actions-BaBVLHSP.js} +1 -1
  77. package/dist/assets/{th-DkqBkRH_.js → th-DfDBrUtW.js} +1 -1
  78. package/dist/assets/{traffic-BXZ-j7u7.js → traffic-BdpKUL58.js} +1 -1
  79. package/dist/assets/{transfer-DR2kNsMH.js → transfer-CyBsVivd.js} +1 -1
  80. package/dist/assets/{unsubscribe-CC4RgAWa.js → unsubscribe-DUaYCo9A.js} +1 -1
  81. package/dist/assets/{use-blocklet-logo-CWdlYyrq.js → use-blocklet-logo-fumCZVth.js} +1 -1
  82. package/dist/assets/{user-center-Cjgf_nB9.js → user-center-DxImDlwk.js} +1 -1
  83. package/dist/assets/{util-BeBq6bKh.js → util-BMWW9F7x.js} +1 -1
  84. package/dist/assets/{vi-D4Y0EZ10.js → vi-oQ5RKDUh.js} +1 -1
  85. package/dist/assets/wrap-locale-BQFJOrpH.js +1 -0
  86. package/dist/assets/{zh-CXbCDXZ8.js → zh-APHGpH_q.js} +1 -1
  87. package/dist/assets/{zh-tw-DaTNZcVC.js → zh-tw-BHBaATnw.js} +1 -1
  88. package/dist/index.html +1 -1
  89. package/dist/service-worker.js +1 -1
  90. package/package.json +23 -23
  91. package/dist/assets/wrap-locale-CIsMM5oS.js +0 -1
@@ -1 +1 @@
1
- import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-Bq8gXTan.js";import{a as f}from"./vendor-ux-did-connect-pzpsrvqx.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-CMYHZyLG.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({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 t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.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 j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}b.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/developer-guides`}];return t.jsx(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
1
+ import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-Bq8gXTan.js";import{a as f}from"./vendor-ux-did-connect-pzpsrvqx.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-C0kIXw5r.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({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 t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.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 j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}b.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/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/${e}/developer-guides`}];return t.jsx(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
@@ -1,4 +1,4 @@
1
- import{a as _,a3 as q,k as ve,r as se,br as Ee,bs as Ce,bt as Se,I as U,b_ as Q,b$ as X,a5 as Me,ac as Le,bI as _e}from"./vendor-ux-did-connect-pzpsrvqx.js";import{t as Be,l as Te,j as Fe}from"./vendor-hooks-DqdmWCmo.js";import{r as C,b as ie}from"./vendor-react-DEoibe3W.js";import{d as re}from"./InfoOutlined-BVWbftGI.js";import{i as He,v as Ne}from"./vendor-arcblock-CwufDgLV.js";import{D as V,aC as Ue,aD as Z,G as Ie,y as Ke}from"./index-CMYHZyLG.js";import{u as Y}from"./dashboard-Cvfy6NEE.js";import{u as Ve}from"./use-mobile-CtTQsfXN.js";import{H as o,j as e,D as Ye,aj as Je,t as Ge,aa as d,O as je,T as S,ab as H,ak as le,z as Qe,y as N,bs as ye,bR as ee,ad as A,L as te,A as oe,aq as Xe,E as M,I as F,C as Ze,bq as et,al as D,cg as tt,X as Re,a9 as ae,s as de,as as ne,bp as ot,b7 as nt,b8 as st,an as it,b$ as rt,v as lt,ch as at,ci as dt,cj as ct,ck as ut}from"./vendor-mui-core-Bq8gXTan.js";import{d as pt}from"./ExpandLess-CcLTbsdW.js";import{b as De,z as ht,A as xt}from"./vendor-utils-BfZ4tlod.js";import{C as mt}from"./confirm-CYOuqhW9.js";import{A as ft}from"./actions-DnTVXQ_Z.js";import{T as we}from"./table-tips-BzPqsKYQ.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CaPDqrQ7.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-B0-S5PGZ.js";import"./session-BGdAM8zS.js";import"./use-blocklet-logo-CWdlYyrq.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";import"./MoreHoriz-ChJ3K52h.js";const gt=s=>{var b,T;const[c,p]=C.useState(null),[v,l]=C.useState(!s),[k,u]=C.useState(null),{blocklet:f}=Ie(),i=(T=(b=f==null?void 0:f.site)==null?void 0:b.domainAliases[0])==null?void 0:T.value,y=C.useMemo(()=>{const j={};return c&&(c.sources.forEach(n=>{j[n.did]={source:n,events:[],count:0}}),c.events.forEach(n=>{j[n.source]&&(j[n.source].events.push(n),j[n.source].count+=1)})),j},[c]),w=async()=>{try{if(l(!0),!i)return;const n=await(await fetch(`https://${i}${ve.WELLKNOWN_SERVICE_PATH_PREFIX}/openevent.json`)).json();p(n),u(null)}catch(j){u(j instanceof Error?j:new Error(String(j)))}finally{l(!1)}};return C.useEffect(()=>{w()},[i]),{openEvent:c,setOpenEvent:p,eventsBySource:y,loading:v,error:k,loadData:w}};function ce({eventsBySource:s,selectedEvents:c,setSelectedEvents:p,error:v}){const{t:l}=_(),[k,u]=C.useState({}),f=C.useMemo(()=>{const n={};return Object.entries(s).forEach(([h,{events:x}])=>{const E=x.filter(I=>c[`${I.type}-${I.source}`]).length;n[h]=E}),n},[s,c]),i=C.useMemo(()=>Object.values(f).reduce((n,h)=>n+h,0),[f]),y=C.useMemo(()=>Object.values(s).reduce((n,{events:h})=>n+h.length,0),[s]),w=(n,h)=>{h.stopPropagation(),u({...k,[n]:!k[n]})},b=n=>{const h=`${n.type}-${n.source}`;p(x=>({...x,[h]:!x[h]}))},T=(n,h)=>{const x={};n.forEach(E=>{const I=`${E.type}-${E.source}`;x[I]=!h}),p(E=>({...E,...x}))},j=n=>{const h={};Object.values(s).forEach(({events:x})=>{x.forEach(E=>{const I=`${E.type}-${E.source}`;h[I]=n.target.checked})}),p(h)};return e.jsxs(d,{sx:{width:"100%"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ye,{control:e.jsx(ee,{onChange:j,checked:i>0&&i===y}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[l("webhookEndpoint.selectAllEvents"),e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:l("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(re,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),i>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:l("webhookEndpoint.selectedEventsCount",{count:i})})]}),e.jsx(d,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(te,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(s).map(([n,{source:h,events:x,count:E}],I)=>{const O=f[n]>0,R=f[n]===x.length&&x.length>0,$=k[n];return e.jsxs(ie.Fragment,{children:[e.jsx(oe,{sx:{borderBottom:({palette:r})=>I<Object.keys(s).length-1?`1px solid ${r.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(d,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:r=>{r.target.closest(".MuiFormControlLabel-root")||w(n,r)},children:[e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:x.length>0&&e.jsx(ye,{control:e.jsx(ee,{checked:R,indeterminate:O&&!R,onChange:r=>{r.stopPropagation(),T(x,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.logo&&e.jsx(Xe,{src:h.logo,sx:{width:24,height:24}}),e.jsx(d,{children:h.title||n}),O&&e.jsx(M,{label:l("webhookEndpoint.selectedCount",{count:f[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:r=>`${r.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(d,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:l("webhookEndpoint.eventsCount",{count:E})}),x.length>0&&e.jsx(F,{size:"small",edge:"end",children:$?e.jsx(pt,{}):e.jsx(He,{})})]})]})}),x.length>0&&e.jsx(Ze,{in:$,timeout:"auto",unmountOnExit:!0,children:e.jsx(te,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:x.map(r=>{const a=`${r.type}-${r.source}`,t=!!c[a];return e.jsx(oe,{dense:!0,sx:{py:.75},onClick:()=>b(r),children:e.jsxs(d,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(ee,{checked:t,sx:{mr:1}}),e.jsxs(d,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:r.type}),e.jsx(S,{variant:"caption",color:"text.secondary",sx:{display:"block",cursor:"pointer"},children:r.description})]})]})},a)})})})]},n)})})}),v&&e.jsx(et,{error:!0,sx:{mt:1},children:v})]})}ce.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};ce.defaultProps={error:null};function ue({id:s,url:c,description:p,enabledEvents:v,onSubmit:l,onClose:k}){var r;const{t:u}=_(),[f,i]=C.useState({}),{teamDid:y}=Y(),{api:w}=V(),{loading:b,error:T,eventsBySource:j}=gt(),{control:n,handleSubmit:h,formState:{errors:x},reset:E,setValue:I,trigger:O}=Ue({defaultValues:{url:"",description:""}});C.useEffect(()=>{const a=Object.values(f).some(t=>t);I("selectedEvents",a?"valid":""),O("selectedEvents")},[f,I,O]);const R=()=>{i({}),E(),k()},$=async a=>{const t=Object.keys(f).filter(m=>f[m]),g={url:a.url,description:a.description,enabledEvents:t.map(m=>{const[P,z]=m.split("-");return!P||!z?null:{type:P,source:z}}).filter(Boolean)};try{if(s){const m=await w.updateWebhookEndpoint({input:{teamDid:y,id:s,data:g}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),l(m)}else{const m=await w.createWebhookEndpoint({input:{teamDid:y,input:g}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),l(m)}}catch(m){q.error(m==null?void 0:m.message)}R()};return C.useEffect(()=>{E({url:c,description:p}),i(v.reduce((a,t)=>(a[`${t.type}-${t.source}`]=!0,a),{}))},[E,i,c,p,v]),e.jsx(Ye,{open:!0,onClose:R,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:h($),children:[e.jsx(Je,{children:u(s?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ge,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Z,{name:"url",control:n,rules:{required:u("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:u("webhookEndpoint.validation.urlInvalid")}},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.url.label"),fullWidth:!0,error:!!x.url,helperText:(t=x.url)==null?void 0:t.message})}}),e.jsx(Z,{name:"description",control:n,rules:{required:u("webhookEndpoint.validation.descriptionRequired")},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!x.description,helperText:(t=x.description)==null?void 0:t.message})}}),e.jsx(Z,{name:"selectedEvents",control:n,rules:{required:u("webhookEndpoint.validation.eventRequired")},render:({field:a})=>e.jsx("input",{type:"hidden",...a})}),!b&&j&&Object.keys(j).length>0&&e.jsx(ce,{eventsBySource:j,selectedEvents:f,setSelectedEvents:i,error:(r=x.selectedEvents)==null?void 0:r.message}),!b&&(!j||Object.keys(j).length===0)&&e.jsx(S,{color:"text.secondary",children:u("webhookEndpoint.noAvailableEvents")}),b&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(H,{size:20})}),T&&e.jsx(le,{severity:"error",children:u("webhookEndpoint.loadingError",{message:T==null?void 0:T.message})})]})}),e.jsxs(Qe,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:R,children:u("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:u(s?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ue.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ue.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function Pe(s){switch(s){case"enabled":return"success";case"disabled":default:return"default"}}const bt=(s="en")=>s==="tw"?"zh":s;function K(s,c="YYYY-MM-DD HH:mm:ss",p="en"){return s?Ke(s).locale(bt(p)).format(c):"-"}function jt(s){return typeof s=="number"?!1:De(s)}function yt(s){return s>=200&&s<300}function W(s){const c=jt(s.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[s.label,!!s.tip&&e.jsx(A,{title:s.tip,children:e.jsx(tt,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:c?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:c?"-":s.value})]}),s.divider&&e.jsx(Re,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};W.defaultProps={tip:"",divider:!1};function pe(s){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:s.mb,mt:s.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:s.title}),s.children]})}pe.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};pe.defaultProps={children:null,mb:1.5,mt:1.5};var he={},wt=ae;Object.defineProperty(he,"__esModule",{value:!0});var ze=he.default=void 0,kt=wt(se()),vt=e;ze=he.default=(0,kt.default)((0,vt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5"}),"Pending");var xe={},Et=ae;Object.defineProperty(xe,"__esModule",{value:!0});var Oe=xe.default=void 0,Ct=Et(se()),St=e;Oe=xe.default=(0,Ct.default)((0,St.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined");var me={},Tt=ae;Object.defineProperty(me,"__esModule",{value:!0});var We=me.default=void 0,It=Tt(se()),Rt=e;We=me.default=(0,It.default)((0,Rt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined");const Dt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},Pt=s=>{const c={};return s.forEach(p=>{var l;const v=new Date(p.createdAt).toLocaleDateString();c[v]||(c[v]=[]),(l=c[v])==null||l.push(p)}),c};function fe({eventId:s,webhookEndpointId:c,event:p}){const{api:v,ws:{useSubscription:l}}=V(),{t:k}=_(),{teamDid:u}=Y(),{blocklet:f}=Ie(),{data:i,loadMore:y,loadingMore:w,loading:b,mutate:T}=Be(t=>{const m=t?Math.ceil(t.list.length/15)+1:1;return v.getWebhookAttempts({input:{teamDid:u,input:{eventId:s,webhookId:c},paging:{page:m,pageSize:15}}})},{reloadDeps:[s,c]}),j=(i==null?void 0:i.list)||[],[n,h]=C.useState(null),[x,E]=C.useState(!1),I=Pt(j);if(C.useEffect(()=>{!n&&(i!=null&&i.list.length)&&h(i.list[0])},[i==null?void 0:i.list.length,n]),l(ve.EVENTS.WEBHOOK_ATTEMPT,t=>{T(g=>{var P,z;if(g.list.find(L=>L.id===t.id)){const L=g.list.map(B=>B.id===t.id?{...B,...t}:B);return{...g,list:L}}return t.endpoint=(P=g.list[0])==null?void 0:P.endpoint,t.event=(z=g.list[0])==null?void 0:z.event,{...g,list:[t,...g.list]}})},[]),b)return e.jsx(H,{});const O=i&&i.list.length<i.paging.total,R=async()=>{n&&(E(!0),await v.retryWebhookAttempt({input:{teamDid:u,eventId:n.event.id,webhookId:c,attemptId:n.id}}).finally(()=>{setTimeout(()=>{E(!1)},1e3)}))},$=t=>{var g,m,P,z,L;if(t.responseBody&&((g=t.responseBody)!=null&&g.sessionId)&&((m=t.responseBody)!=null&&m.projectId)&&((P=t.responseBody)!=null&&P.agentId)){const B=(L=(z=f==null?void 0:f.site)==null?void 0:z.domainAliases[0])==null?void 0:L.value,J=(f.children||[]).find(G=>{var be;return((be=G==null?void 0:G.meta)==null?void 0:be.name)==="ai-studio"}),qe=ht(xt(`https://${B}`,(J==null?void 0:J.mountPoint)||"","projects",t.responseBody.projectId,"logs/main"),{sessionId:t.responseBody.sessionId,agentId:t.responseBody.agentId});return e.jsx(F,{sx:{fontSize:20},onClick:()=>window.open(qe,"_blank"),children:e.jsx(d,{component:U,icon:Q})})}return null},r=t=>t.status==="pending"?e.jsx(ze,{color:"warning"}):yt(t.responseStatus)?e.jsx(Oe,{color:"success"}):e.jsx(We,{color:"error"}),a=(n==null?void 0:n.triggeredFrom)&&((i==null?void 0:i.list)||[]).find(t=>t.id===n.triggeredFrom);return e.jsxs(zt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ne,{item:!0,xs:12,md:4,height:1,children:De(Object.keys(I))?e.jsx(S,{color:"text.secondary",children:k("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(te,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(I).map(([t,g])=>e.jsxs(ie.Fragment,{children:[e.jsx(ot,{sx:{p:0},children:t}),g.map(m=>e.jsxs(oe,{sx:{cursor:"pointer",px:1},onClick:()=>h(m),selected:n&&(n==null?void 0:n.id)===(m==null?void 0:m.id),secondaryAction:e.jsx(S,{color:"text.secondary",children:K(m.createdAt,"HH:mm:ss")}),children:[e.jsx(nt,{sx:{minWidth:0,mr:1.5},children:r(m)}),e.jsx(st,{primary:e.jsx(S,{color:"text.primary",children:m.event.type})})]},m.id))]},t))}),O&&e.jsx(d,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:y,disabled:w,sx:{color:t=>t.palette.text.disabled},children:k(w?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ne,{item:!0,xs:12,md:8,height:1,children:[n&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h4",children:k(`common.${n.status}`)}),e.jsx(d,{children:$(n)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[a&&e.jsx(A,{componentsProps:{tooltip:{sx:{maxWidth:400}}},placement:"left",title:e.jsxs(D,{gap:1,sx:{cursor:"pointer",".did-address-text":{color:"common.white"}},onClick:()=>h(a),children:[e.jsx(Ee,{showDid:!0,did:n.triggeredBy,cardType:Ce.Detailed,infoType:Se.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(Re,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"body2",sx:{color:"primary.main"},children:k("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"body2",children:n.id}),e.jsx(F,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),children:e.jsx(F,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16}})})}),e.jsxs(N,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:x,children:[e.jsx(d,{component:U,icon:Dt,sx:{fontSize:16,animation:x?"spin 1s linear infinite":"none",mr:.5}}),k("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(S,{variant:"h6",children:[k("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(X,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.request")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),(i==null?void 0:i.list.length)===0&&p&&e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.eventData")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(p.data,null,2)})]})]})]})}fe.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};fe.defaultProps={eventId:"",webhookEndpointId:"",event:null};const zt=de(ne)`
1
+ import{a as _,a3 as q,k as ve,r as se,br as Ee,bs as Ce,bt as Se,I as U,b_ as Q,b$ as X,a5 as Me,ac as Le,bI as _e}from"./vendor-ux-did-connect-pzpsrvqx.js";import{t as Be,l as Te,j as Fe}from"./vendor-hooks-DqdmWCmo.js";import{r as C,b as ie}from"./vendor-react-DEoibe3W.js";import{d as re}from"./InfoOutlined-BVWbftGI.js";import{i as He,v as Ne}from"./vendor-arcblock-CwufDgLV.js";import{D as V,aC as Ue,aD as Z,G as Ie,y as Ke}from"./index-C0kIXw5r.js";import{u as Y}from"./dashboard-BrJfe1tK.js";import{u as Ve}from"./use-mobile-CtTQsfXN.js";import{H as o,j as e,D as Ye,aj as Je,t as Ge,aa as d,O as je,T as S,ab as H,ak as le,z as Qe,y as N,bs as ye,bR as ee,ad as A,L as te,A as oe,aq as Xe,E as M,I as F,C as Ze,bq as et,al as D,cg as tt,X as Re,a9 as ae,s as de,as as ne,bp as ot,b7 as nt,b8 as st,an as it,b$ as rt,v as lt,ch as at,ci as dt,cj as ct,ck as ut}from"./vendor-mui-core-Bq8gXTan.js";import{d as pt}from"./ExpandLess-CcLTbsdW.js";import{b as De,z as ht,A as xt}from"./vendor-utils-BfZ4tlod.js";import{C as mt}from"./confirm-Cr4yXaP3.js";import{A as ft}from"./actions-DnTVXQ_Z.js";import{T as we}from"./table-tips-BzPqsKYQ.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CaPDqrQ7.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-B0-S5PGZ.js";import"./session-BGdAM8zS.js";import"./use-blocklet-logo-fumCZVth.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";import"./MoreHoriz-ChJ3K52h.js";const gt=s=>{var b,T;const[c,p]=C.useState(null),[v,l]=C.useState(!s),[k,u]=C.useState(null),{blocklet:f}=Ie(),i=(T=(b=f==null?void 0:f.site)==null?void 0:b.domainAliases[0])==null?void 0:T.value,y=C.useMemo(()=>{const j={};return c&&(c.sources.forEach(n=>{j[n.did]={source:n,events:[],count:0}}),c.events.forEach(n=>{j[n.source]&&(j[n.source].events.push(n),j[n.source].count+=1)})),j},[c]),w=async()=>{try{if(l(!0),!i)return;const n=await(await fetch(`https://${i}${ve.WELLKNOWN_SERVICE_PATH_PREFIX}/openevent.json`)).json();p(n),u(null)}catch(j){u(j instanceof Error?j:new Error(String(j)))}finally{l(!1)}};return C.useEffect(()=>{w()},[i]),{openEvent:c,setOpenEvent:p,eventsBySource:y,loading:v,error:k,loadData:w}};function ce({eventsBySource:s,selectedEvents:c,setSelectedEvents:p,error:v}){const{t:l}=_(),[k,u]=C.useState({}),f=C.useMemo(()=>{const n={};return Object.entries(s).forEach(([h,{events:x}])=>{const E=x.filter(I=>c[`${I.type}-${I.source}`]).length;n[h]=E}),n},[s,c]),i=C.useMemo(()=>Object.values(f).reduce((n,h)=>n+h,0),[f]),y=C.useMemo(()=>Object.values(s).reduce((n,{events:h})=>n+h.length,0),[s]),w=(n,h)=>{h.stopPropagation(),u({...k,[n]:!k[n]})},b=n=>{const h=`${n.type}-${n.source}`;p(x=>({...x,[h]:!x[h]}))},T=(n,h)=>{const x={};n.forEach(E=>{const I=`${E.type}-${E.source}`;x[I]=!h}),p(E=>({...E,...x}))},j=n=>{const h={};Object.values(s).forEach(({events:x})=>{x.forEach(E=>{const I=`${E.type}-${E.source}`;h[I]=n.target.checked})}),p(h)};return e.jsxs(d,{sx:{width:"100%"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ye,{control:e.jsx(ee,{onChange:j,checked:i>0&&i===y}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[l("webhookEndpoint.selectAllEvents"),e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:l("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(re,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),i>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:l("webhookEndpoint.selectedEventsCount",{count:i})})]}),e.jsx(d,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(te,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(s).map(([n,{source:h,events:x,count:E}],I)=>{const O=f[n]>0,R=f[n]===x.length&&x.length>0,$=k[n];return e.jsxs(ie.Fragment,{children:[e.jsx(oe,{sx:{borderBottom:({palette:r})=>I<Object.keys(s).length-1?`1px solid ${r.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(d,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:r=>{r.target.closest(".MuiFormControlLabel-root")||w(n,r)},children:[e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:x.length>0&&e.jsx(ye,{control:e.jsx(ee,{checked:R,indeterminate:O&&!R,onChange:r=>{r.stopPropagation(),T(x,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.logo&&e.jsx(Xe,{src:h.logo,sx:{width:24,height:24}}),e.jsx(d,{children:h.title||n}),O&&e.jsx(M,{label:l("webhookEndpoint.selectedCount",{count:f[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:r=>`${r.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(d,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:l("webhookEndpoint.eventsCount",{count:E})}),x.length>0&&e.jsx(F,{size:"small",edge:"end",children:$?e.jsx(pt,{}):e.jsx(He,{})})]})]})}),x.length>0&&e.jsx(Ze,{in:$,timeout:"auto",unmountOnExit:!0,children:e.jsx(te,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:x.map(r=>{const a=`${r.type}-${r.source}`,t=!!c[a];return e.jsx(oe,{dense:!0,sx:{py:.75},onClick:()=>b(r),children:e.jsxs(d,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(ee,{checked:t,sx:{mr:1}}),e.jsxs(d,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:r.type}),e.jsx(S,{variant:"caption",color:"text.secondary",sx:{display:"block",cursor:"pointer"},children:r.description})]})]})},a)})})})]},n)})})}),v&&e.jsx(et,{error:!0,sx:{mt:1},children:v})]})}ce.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};ce.defaultProps={error:null};function ue({id:s,url:c,description:p,enabledEvents:v,onSubmit:l,onClose:k}){var r;const{t:u}=_(),[f,i]=C.useState({}),{teamDid:y}=Y(),{api:w}=V(),{loading:b,error:T,eventsBySource:j}=gt(),{control:n,handleSubmit:h,formState:{errors:x},reset:E,setValue:I,trigger:O}=Ue({defaultValues:{url:"",description:""}});C.useEffect(()=>{const a=Object.values(f).some(t=>t);I("selectedEvents",a?"valid":""),O("selectedEvents")},[f,I,O]);const R=()=>{i({}),E(),k()},$=async a=>{const t=Object.keys(f).filter(m=>f[m]),g={url:a.url,description:a.description,enabledEvents:t.map(m=>{const[P,z]=m.split("-");return!P||!z?null:{type:P,source:z}}).filter(Boolean)};try{if(s){const m=await w.updateWebhookEndpoint({input:{teamDid:y,id:s,data:g}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),l(m)}else{const m=await w.createWebhookEndpoint({input:{teamDid:y,input:g}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),l(m)}}catch(m){q.error(m==null?void 0:m.message)}R()};return C.useEffect(()=>{E({url:c,description:p}),i(v.reduce((a,t)=>(a[`${t.type}-${t.source}`]=!0,a),{}))},[E,i,c,p,v]),e.jsx(Ye,{open:!0,onClose:R,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:h($),children:[e.jsx(Je,{children:u(s?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ge,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Z,{name:"url",control:n,rules:{required:u("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:u("webhookEndpoint.validation.urlInvalid")}},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.url.label"),fullWidth:!0,error:!!x.url,helperText:(t=x.url)==null?void 0:t.message})}}),e.jsx(Z,{name:"description",control:n,rules:{required:u("webhookEndpoint.validation.descriptionRequired")},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!x.description,helperText:(t=x.description)==null?void 0:t.message})}}),e.jsx(Z,{name:"selectedEvents",control:n,rules:{required:u("webhookEndpoint.validation.eventRequired")},render:({field:a})=>e.jsx("input",{type:"hidden",...a})}),!b&&j&&Object.keys(j).length>0&&e.jsx(ce,{eventsBySource:j,selectedEvents:f,setSelectedEvents:i,error:(r=x.selectedEvents)==null?void 0:r.message}),!b&&(!j||Object.keys(j).length===0)&&e.jsx(S,{color:"text.secondary",children:u("webhookEndpoint.noAvailableEvents")}),b&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(H,{size:20})}),T&&e.jsx(le,{severity:"error",children:u("webhookEndpoint.loadingError",{message:T==null?void 0:T.message})})]})}),e.jsxs(Qe,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:R,children:u("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:u(s?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ue.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ue.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function Pe(s){switch(s){case"enabled":return"success";case"disabled":default:return"default"}}const bt=(s="en")=>s==="tw"?"zh":s;function K(s,c="YYYY-MM-DD HH:mm:ss",p="en"){return s?Ke(s).locale(bt(p)).format(c):"-"}function jt(s){return typeof s=="number"?!1:De(s)}function yt(s){return s>=200&&s<300}function W(s){const c=jt(s.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[s.label,!!s.tip&&e.jsx(A,{title:s.tip,children:e.jsx(tt,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:c?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:c?"-":s.value})]}),s.divider&&e.jsx(Re,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};W.defaultProps={tip:"",divider:!1};function pe(s){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:s.mb,mt:s.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:s.title}),s.children]})}pe.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};pe.defaultProps={children:null,mb:1.5,mt:1.5};var he={},wt=ae;Object.defineProperty(he,"__esModule",{value:!0});var ze=he.default=void 0,kt=wt(se()),vt=e;ze=he.default=(0,kt.default)((0,vt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5"}),"Pending");var xe={},Et=ae;Object.defineProperty(xe,"__esModule",{value:!0});var Oe=xe.default=void 0,Ct=Et(se()),St=e;Oe=xe.default=(0,Ct.default)((0,St.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined");var me={},Tt=ae;Object.defineProperty(me,"__esModule",{value:!0});var We=me.default=void 0,It=Tt(se()),Rt=e;We=me.default=(0,It.default)((0,Rt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined");const Dt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},Pt=s=>{const c={};return s.forEach(p=>{var l;const v=new Date(p.createdAt).toLocaleDateString();c[v]||(c[v]=[]),(l=c[v])==null||l.push(p)}),c};function fe({eventId:s,webhookEndpointId:c,event:p}){const{api:v,ws:{useSubscription:l}}=V(),{t:k}=_(),{teamDid:u}=Y(),{blocklet:f}=Ie(),{data:i,loadMore:y,loadingMore:w,loading:b,mutate:T}=Be(t=>{const m=t?Math.ceil(t.list.length/15)+1:1;return v.getWebhookAttempts({input:{teamDid:u,input:{eventId:s,webhookId:c},paging:{page:m,pageSize:15}}})},{reloadDeps:[s,c]}),j=(i==null?void 0:i.list)||[],[n,h]=C.useState(null),[x,E]=C.useState(!1),I=Pt(j);if(C.useEffect(()=>{!n&&(i!=null&&i.list.length)&&h(i.list[0])},[i==null?void 0:i.list.length,n]),l(ve.EVENTS.WEBHOOK_ATTEMPT,t=>{T(g=>{var P,z;if(g.list.find(L=>L.id===t.id)){const L=g.list.map(B=>B.id===t.id?{...B,...t}:B);return{...g,list:L}}return t.endpoint=(P=g.list[0])==null?void 0:P.endpoint,t.event=(z=g.list[0])==null?void 0:z.event,{...g,list:[t,...g.list]}})},[]),b)return e.jsx(H,{});const O=i&&i.list.length<i.paging.total,R=async()=>{n&&(E(!0),await v.retryWebhookAttempt({input:{teamDid:u,eventId:n.event.id,webhookId:c,attemptId:n.id}}).finally(()=>{setTimeout(()=>{E(!1)},1e3)}))},$=t=>{var g,m,P,z,L;if(t.responseBody&&((g=t.responseBody)!=null&&g.sessionId)&&((m=t.responseBody)!=null&&m.projectId)&&((P=t.responseBody)!=null&&P.agentId)){const B=(L=(z=f==null?void 0:f.site)==null?void 0:z.domainAliases[0])==null?void 0:L.value,J=(f.children||[]).find(G=>{var be;return((be=G==null?void 0:G.meta)==null?void 0:be.name)==="ai-studio"}),qe=ht(xt(`https://${B}`,(J==null?void 0:J.mountPoint)||"","projects",t.responseBody.projectId,"logs/main"),{sessionId:t.responseBody.sessionId,agentId:t.responseBody.agentId});return e.jsx(F,{sx:{fontSize:20},onClick:()=>window.open(qe,"_blank"),children:e.jsx(d,{component:U,icon:Q})})}return null},r=t=>t.status==="pending"?e.jsx(ze,{color:"warning"}):yt(t.responseStatus)?e.jsx(Oe,{color:"success"}):e.jsx(We,{color:"error"}),a=(n==null?void 0:n.triggeredFrom)&&((i==null?void 0:i.list)||[]).find(t=>t.id===n.triggeredFrom);return e.jsxs(zt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ne,{item:!0,xs:12,md:4,height:1,children:De(Object.keys(I))?e.jsx(S,{color:"text.secondary",children:k("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(te,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(I).map(([t,g])=>e.jsxs(ie.Fragment,{children:[e.jsx(ot,{sx:{p:0},children:t}),g.map(m=>e.jsxs(oe,{sx:{cursor:"pointer",px:1},onClick:()=>h(m),selected:n&&(n==null?void 0:n.id)===(m==null?void 0:m.id),secondaryAction:e.jsx(S,{color:"text.secondary",children:K(m.createdAt,"HH:mm:ss")}),children:[e.jsx(nt,{sx:{minWidth:0,mr:1.5},children:r(m)}),e.jsx(st,{primary:e.jsx(S,{color:"text.primary",children:m.event.type})})]},m.id))]},t))}),O&&e.jsx(d,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:y,disabled:w,sx:{color:t=>t.palette.text.disabled},children:k(w?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ne,{item:!0,xs:12,md:8,height:1,children:[n&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h4",children:k(`common.${n.status}`)}),e.jsx(d,{children:$(n)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[a&&e.jsx(A,{componentsProps:{tooltip:{sx:{maxWidth:400}}},placement:"left",title:e.jsxs(D,{gap:1,sx:{cursor:"pointer",".did-address-text":{color:"common.white"}},onClick:()=>h(a),children:[e.jsx(Ee,{showDid:!0,did:n.triggeredBy,cardType:Ce.Detailed,infoType:Se.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(Re,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"body2",sx:{color:"primary.main"},children:k("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"body2",children:n.id}),e.jsx(F,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),children:e.jsx(F,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16}})})}),e.jsxs(N,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:x,children:[e.jsx(d,{component:U,icon:Dt,sx:{fontSize:16,animation:x?"spin 1s linear infinite":"none",mr:.5}}),k("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(S,{variant:"h6",children:[k("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(X,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.request")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),(i==null?void 0:i.list.length)===0&&p&&e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.eventData")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(p.data,null,2)})]})]})]})}fe.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};fe.defaultProps={eventId:"",webhookEndpointId:"",event:null};const zt=de(ne)`
2
2
  @keyframes spin {
3
3
  to {
4
4
  transform: rotate(360deg);
@@ -1,4 +1,4 @@
1
- import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b6 as A,O as K,c0 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-Bq8gXTan.js";import{bb as X,aV as $,d as H}from"./vendor-ux-did-connect-pzpsrvqx.js";import{d as G}from"./Done-ASNftAOL.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-DAaiuAEY.js";import{C as Z}from"./Google-C28yeMZW.js";import{ad as v,f as ee}from"./index-CMYHZyLG.js";import{R as ne,F as te,L as re}from"./logo-uploader-BSR27hpo.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
1
+ import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b6 as A,O as K,c0 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-Bq8gXTan.js";import{bb as X,aV as $,d as H}from"./vendor-ux-did-connect-pzpsrvqx.js";import{d as G}from"./Done-ASNftAOL.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-DAaiuAEY.js";import{C as Z}from"./Google-C28yeMZW.js";import{ad as v,f as ee}from"./index-C0kIXw5r.js";import{R as ne,F as te,L as re}from"./logo-uploader-DC4SpQmr.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }
@@ -1 +1 @@
1
- import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bo as Y,bq as w,O as S,q as j,aa as v}from"./vendor-mui-core-Bq8gXTan.js";import{y as s}from"./index-CMYHZyLG.js";import{a as H}from"./vendor-ux-did-connect-pzpsrvqx.js";import{A as M}from"./vendor-arcblock-CwufDgLV.js";import{b as _}from"./vendor-hooks-DqdmWCmo.js";import{L as A,D as y}from"./vendor-mui-x-1nqAyytV.js";import{A as C}from"./AdapterDayjs-BRnJ9bMs.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const d=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:d,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,d]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(d(o),o==="custom"){const f=s().toDate();D(f),m(f)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(f=>s(f.value).isSame(i))||(d("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
1
+ import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bo as Y,bq as w,O as S,q as j,aa as v}from"./vendor-mui-core-Bq8gXTan.js";import{y as s}from"./index-C0kIXw5r.js";import{a as H}from"./vendor-ux-did-connect-pzpsrvqx.js";import{A as M}from"./vendor-arcblock-CwufDgLV.js";import{b as _}from"./vendor-hooks-DqdmWCmo.js";import{L as A,D as y}from"./vendor-mui-x-1nqAyytV.js";import{A as C}from"./AdapterDayjs-BRnJ9bMs.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const d=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:d,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,d]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(d(o),o==="custom"){const f=s().toDate();D(f),m(f)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(f=>s(f.value).isSame(i))||(d("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
@@ -1,4 +1,4 @@
1
- import{a as se,a3 as U,cd as Me,ce as Ve,I as K,cb as $e,cc as Ne,ai as He,ah as Je,cf as Ke,bd as Ce,k as oe,r as Ae,bb as G,cg as xe,ar as ge,B as z,b$ as Ge,ab as Ze,ch as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-pzpsrvqx.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-DqdmWCmo.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as _,bo as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-Bq8gXTan.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-CwufDgLV.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-BfZ4tlod.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-CMYHZyLG.js";import{S as ce}from"./switch-control-Brwb8ptk.js";import{S as C}from"./section-BDMQAX_r.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-DPIWnhb5.js";import{b as xt}from"./base32-DUSifB4M.js";import{u as ft}from"./use-mobile-CtTQsfXN.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),U.success(n("oauth.saveSuccess"))}catch(b){U.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(R){U.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={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:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.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 W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,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"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
1
+ import{a as se,a3 as U,cd as Me,ce as Ve,I as K,cb as $e,cc as Ne,ai as He,ah as Je,cf as Ke,bd as Ce,k as oe,r as Ae,bb as G,cg as xe,ar as ge,B as z,b$ as Ge,ab as Ze,ch as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-pzpsrvqx.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-DqdmWCmo.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as _,bo as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-Bq8gXTan.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-CwufDgLV.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-BfZ4tlod.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-C0kIXw5r.js";import{S as ce}from"./switch-control-Brwb8ptk.js";import{S as C}from"./section-BDMQAX_r.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-DPIWnhb5.js";import{b as xt}from"./base32-DUSifB4M.js";import{u as ft}from"./use-mobile-CtTQsfXN.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),U.success(n("oauth.saveSuccess"))}catch(b){U.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(R){U.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={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:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.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 W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,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"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
2
2
  max-width: 1536px;
3
3
 
4
4
  .advanced-config {