@abtnode/blocklet-services 1.16.17-beta-3232a7af → 1.16.17-beta-703fb879

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 (81) hide show
  1. package/api/index.js +2 -0
  2. package/api/libs/connect/session.js +17 -2
  3. package/api/libs/open-graph/emoji.js +80 -0
  4. package/api/libs/open-graph/index.js +14 -1
  5. package/api/routes/federated.js +108 -2
  6. package/api/routes/oauth.js +46 -9
  7. package/api/routes/user-session.js +165 -0
  8. package/api/routes/user.js +21 -0
  9. package/api/services/auth/connect/login.js +13 -2
  10. package/api/services/auth/index.js +17 -8
  11. package/api/services/image/index.js +5 -0
  12. package/api/util/index.js +8 -1
  13. package/api/util/user-session.js +47 -0
  14. package/build/asset-manifest.json +79 -75
  15. package/build/index.html +1 -1
  16. package/build/service-worker.js +1 -1
  17. package/build/service-worker.js.map +1 -1
  18. package/build/static/css/{5982.ac464505.chunk.css → 8702.3ffd8486.chunk.css} +1 -1
  19. package/build/static/js/1148.e5dc907a.chunk.js +2 -0
  20. package/build/static/js/{6711.fa6dfc37.chunk.js → 1359.add26d23.chunk.js} +2 -2
  21. package/build/static/js/{2093.e2fce549.chunk.js → 2093.3192d241.chunk.js} +3 -3
  22. package/build/static/js/{2653.1307684f.chunk.js → 2653.6a6c1c6c.chunk.js} +2 -2
  23. package/build/static/js/2972.2d5268c3.chunk.js +2 -0
  24. package/build/static/js/3025.e2b1dac4.chunk.js +2 -0
  25. package/build/static/js/{9409.7d4a802c.chunk.js → 3033.1bbcc14e.chunk.js} +2 -2
  26. package/build/static/js/{1462.a4d2a902.chunk.js → 3131.f75fa792.chunk.js} +2 -2
  27. package/build/static/js/{3688.6edc63ba.chunk.js → 3688.2cea0226.chunk.js} +2 -2
  28. package/build/static/js/{4023.8cfc3ec6.chunk.js → 4023.a79b0858.chunk.js} +2 -2
  29. package/build/static/js/4076.e73cb63a.chunk.js +2 -0
  30. package/build/static/js/{6737.53cccea9.chunk.js → 4587.5b31e02e.chunk.js} +2 -2
  31. package/build/static/js/4716.1ecc2bb6.chunk.js +2 -0
  32. package/build/static/js/{4802.b2e38d47.chunk.js → 4802.d185b9f1.chunk.js} +2 -2
  33. package/build/static/js/5012.551dbbc3.chunk.js +2 -0
  34. package/build/static/js/5547.5a341867.chunk.js +3 -0
  35. package/build/static/js/5569.a7e151fc.chunk.js +2 -0
  36. package/build/static/js/{1565.f3579441.chunk.js → 5662.919cc4a2.chunk.js} +2 -2
  37. package/build/static/js/{9102.6dab0f45.chunk.js → 5982.d9eb7e90.chunk.js} +2 -2
  38. package/build/static/js/{6139.f7ca5bd6.chunk.js → 6139.cf6eb9b1.chunk.js} +2 -2
  39. package/build/static/js/6473.d89e783e.chunk.js +2 -0
  40. package/build/static/js/{8437.13d39ce4.chunk.js → 6637.b2e35031.chunk.js} +2 -2
  41. package/build/static/js/6658.0a27e04e.chunk.js +2 -0
  42. package/build/static/js/7050.3281ad5f.chunk.js +2 -0
  43. package/build/static/js/{716.cf9ba82c.chunk.js → 716.438b9c22.chunk.js} +3 -3
  44. package/build/static/js/779.99b3f0d2.chunk.js +2 -0
  45. package/build/static/js/7858.bac05f8f.chunk.js +2 -0
  46. package/build/static/js/8622.8478c900.chunk.js +2 -0
  47. package/build/static/js/8641.f2bb0ffc.chunk.js +2 -0
  48. package/build/static/js/{5982.0abe67c3.chunk.js → 8702.957f131a.chunk.js} +2 -2
  49. package/build/static/js/873.d6d31b32.chunk.js +3 -0
  50. package/build/static/js/{8792.fa2c5f5e.chunk.js → 8792.eff43237.chunk.js} +2 -2
  51. package/build/static/js/8944.09a1c53a.chunk.js +2 -0
  52. package/build/static/js/9403.b72e020c.chunk.js +2 -0
  53. package/build/static/js/9596.0e51cd6e.chunk.js +2 -0
  54. package/build/static/js/9900.b66896e6.chunk.js +2 -0
  55. package/build/static/js/{4682.f90d26fd.chunk.js → 9982.4f1ebb7f.chunk.js} +2 -2
  56. package/build/static/js/main.3cf7fedb.js +3 -0
  57. package/package.json +22 -22
  58. package/build/static/js/1480.88c590c2.chunk.js +0 -2
  59. package/build/static/js/1760.374a6e01.chunk.js +0 -2
  60. package/build/static/js/2393.528e5343.chunk.js +0 -2
  61. package/build/static/js/2836.f3dbcb77.chunk.js +0 -2
  62. package/build/static/js/3025.7dc2fe04.chunk.js +0 -2
  63. package/build/static/js/4164.5adbbbba.chunk.js +0 -2
  64. package/build/static/js/4420.05d9cb43.chunk.js +0 -2
  65. package/build/static/js/4716.bd8bed1b.chunk.js +0 -2
  66. package/build/static/js/5176.1963ce79.chunk.js +0 -2
  67. package/build/static/js/5547.e35129c6.chunk.js +0 -3
  68. package/build/static/js/6186.67c279db.chunk.js +0 -2
  69. package/build/static/js/6378.29466d9e.chunk.js +0 -2
  70. package/build/static/js/6576.02f6c898.chunk.js +0 -2
  71. package/build/static/js/6856.2eb98754.chunk.js +0 -2
  72. package/build/static/js/7226.4eca7c02.chunk.js +0 -3
  73. package/build/static/js/941.7757135a.chunk.js +0 -2
  74. package/build/static/js/9620.301493bc.chunk.js +0 -2
  75. package/build/static/js/9899.277d673f.chunk.js +0 -2
  76. package/build/static/js/main.f1e55cd8.js +0 -3
  77. /package/build/static/js/{2093.e2fce549.chunk.js.LICENSE.txt → 2093.3192d241.chunk.js.LICENSE.txt} +0 -0
  78. /package/build/static/js/{5547.e35129c6.chunk.js.LICENSE.txt → 5547.5a341867.chunk.js.LICENSE.txt} +0 -0
  79. /package/build/static/js/{716.cf9ba82c.chunk.js.LICENSE.txt → 716.438b9c22.chunk.js.LICENSE.txt} +0 -0
  80. /package/build/static/js/{7226.4eca7c02.chunk.js.LICENSE.txt → 873.d6d31b32.chunk.js.LICENSE.txt} +0 -0
  81. /package/build/static/js/{main.f1e55cd8.js.LICENSE.txt → main.3cf7fedb.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[4802],{92746:function(e,n,t){var r,i=t(71171),o=t(33028),a=t(59740),l=t(16380),s=t(50442),c=t(37574),d=["labelProps","className","style"];function u(e){var n=e.labelProps,t=e.className,r=e.style,i=(0,a.Z)(e,d),l=(0,o.Z)((0,o.Z)({},n),{},{labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"});return(0,c.jsx)(f,{className:t,style:r,children:(0,c.jsx)(s.Z,(0,o.Z)({labelProps:l},i))})}u.propTypes=s.Z.propTypes,u.defaultProps=s.Z.defaultProps;var f=l.Z.div(r||(r=(0,i.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(function(e){return e.theme.breakpoints.down("sm")}));n.Z=u},121:function(e,n,t){t.r(n),t.d(n,{default:function(){return bt}});var r=t(71171),i=t(33028),o=t(96234),a=t(59740),l=t(68079),s=t(30969),c=t(16380),d=t(24974),u=t.n(d),f=t(95973),p=t(19611),m=t.n(p),h=t(20244),x=t(38361),g=t(3994),Z=t(79823),v=t(64689),b=t(99254),j=t(76527),k=t(85385),y=t(52838),C=t(23038),w=t(86822),L=t(26022),S=t(19865),P=t(7017),E=t(70998),A=t(84802),_=t(32723),T=t(34795),N=t(46292),O=t.n(N),R=t(15888),F=t.n(R),I=t(65667),B=t.n(I),D=t(34159),U=t(75295),z=t(29996),K=t(13134),W=t(59467),G=t(59505),H=t(1986),V=t(67019),M=t(94308),Y=t(88581),q=t(27724),J=t(94551),Q=t(2689),X=t(39130),$=t(7173),ee=t(94702),ne=t(98123),te=t(14458),re=t(28412),ie=t(76934),oe=t(37574),ae=["label","disabled","required","initialValue","onChange","style","onSubmit","triggers","options","formatterBeforeSubmit","helperText"],le={PaperProps:{style:{maxHeight:224,width:250}}},se=function(e,n,t){return{fontWeight:-1===n.indexOf(e)?t.typography.fontWeightRegular:t.typography.fontWeightMedium}};function ce(e){var n=e.label,t=e.disabled,r=e.required,l=e.initialValue,c=e.onChange,d=e.style,u=e.onSubmit,f=e.triggers,p=e.options,m=e.formatterBeforeSubmit,h=e.helperText,g=(0,a.Z)(e,ae),Z=(0,ee.Z)(),v=(0,s.useState)(!1),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=(0,s.useState)(!1),C=(0,o.Z)(y,2),w=C[0],L=C[1],S=(0,s.useState)(l),P=(0,o.Z)(S,2),E=P[0],A=P[1],N=(0,s.useState)(E),O=(0,o.Z)(N,2),R=O[0],F=O[1],I=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return L(!0),e.prev=1,e.next=4,u("function"===typeof m?m(R):R);case 4:!1===e.sent?F(E):(F(R),A(R)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F(E);case 11:return e.prev=11,L(!1),k(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),B=j?(0,oe.jsx)(X.Z,(0,i.Z)((0,i.Z)({value:R,onChange:function(e){var n=e.target.value;n="string"===typeof n?n.split(","):n,F(n),c(n)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap"},children:e.filter((function(e){return p.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)($.Z,{label:p.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))})},MenuProps:le},g),{},{children:p.map((function(e){return(0,oe.jsx)(Q.Z,{value:e.code,style:se(e.code,R,Z),children:e.name},e.code)}))})):(0,oe.jsx)(x.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:R.filter((function(e){return p.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)($.Z,{label:p.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))});return(0,oe.jsx)(re.Z,{className:"form",style:d,children:(0,oe.jsxs)(x.Z,{className:"form-item",children:[(0,oe.jsxs)(x.Z,{className:"form-item-label",children:[n,r&&(0,oe.jsx)(te.Z,{})]}),(0,oe.jsxs)(x.Z,{className:"form-item-body",children:[(0,oe.jsx)(x.Z,{className:"form-item-input",children:B}),(0,oe.jsx)(x.Z,{className:"form-item-action",children:j?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(J.Z,{"data-cy":"schema-form-item-confirm",onClick:I,disabled:t||w,size:"large",children:w?(0,oe.jsx)(M.Z,{size:24}):(0,oe.jsx)(q.Z,{})}),(0,oe.jsx)(J.Z,{"data-cy":"schema-form-item-cancel",onClick:function(){F(E),k(!1)},disabled:t||w,size:"large",children:(0,oe.jsx)(Y.default,{})})]}):(0,oe.jsx)(ie.Z,{triggers:f,onEnterEdit:function(){return k(!0)},disabled:t})})]}),j&&h&&(0,oe.jsx)(ne.Z,{children:h})]})})}ce.propTypes={style:u().object,onSubmit:u().func,onChange:u().func,label:u().string,initialValue:u().string,required:u().bool,disabled:u().bool,triggers:u().array,options:u().array,helperText:u().string,formatterBeforeSubmit:u().func},ce.defaultProps={style:{},onSubmit:function(){},onChange:function(){},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:function(e){return e.join(",")}};var de=t(41395),ue=t(24891),fe=t(19066),pe=t(22572),me=t(85710),he=t(8479),xe=["teamDid","size"];function ge(e){var n=e.teamDid,t=e.size,r=void 0===t?"small":t,l=(0,a.Z)(e,xe),c=(0,L.PE)().t,d=(0,de.h6)().api,u=(0,s.useState)(!1),f=(0,o.Z)(u,2),p=f[0],m=f[1],h=(0,s.useState)(null),x=(0,o.Z)(h,2),g=x[0],Z=x[1],v=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){var t,r;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,m(!0),e.next=4,d.clearCache({input:{teamDid:n}});case 4:r=e.sent,H.Z.success(c("blocklet.config.clearCache.success",{count:(null===(t=r.removed)||void 0===t?void 0:t.length)||0})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),H.Z.error((0,me.Z)(e.t0));case 11:return e.prev=11,m(!1),Z(null),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[0,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),b={title:c("blocklet.config.clearCache.title"),description:c("blocklet.config.clearCache.description"),confirm:c("common.confirm"),cancel:c("common.cancel"),onConfirm:v,onCancel:function(){m(!1),Z(null)}};return(0,oe.jsxs)("div",(0,i.Z)((0,i.Z)({},l),{},{children:[(0,oe.jsxs)(z.Z,{onClick:function(){return Z(b)},color:"error",variant:"outlined",size:r,children:[p?(0,oe.jsx)(M.Z,{size:16,style:{marginRight:5}}):null,c("blocklet.config.clearCache.action")]}),g&&(0,oe.jsx)(he.Z,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,onConfirm:g.onConfirm,onCancel:g.onCancel})]}))}var Ze,ve=t(43178),be=t(72836),je=t(77370),ke=t(45008);function ye(e){var n=e.initialValue,t=e.onChange,r=e.disabled,i=e.loading,a=(0,L.PE)().t,l=(0,je.T)().api,s=(0,ke.y0)().blocklet,c=(0,ve.Z)({newAppSk:"",isConnectOpen:!1}),d=(0,o.Z)(c,2),u=d[0],f=d[1],p=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(n);case 3:return e.prev=3,f({newAppSk:""}),e.finish(3);case 6:case"end":return e.stop()}}),e,null,[[0,,3,6]])})));return function(n){return e.apply(this,arguments)}}(),m=function(){return f({isConnectOpen:!1})},g=s.structVersion===h.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:function(){(0,ue.An)(s.status)?H.Z.error(a("blocklet.error.isRunning")):(0,P.isInProgress)(s.status)?H.Z.error(a("blocklet.error.isInProgress")):f({isConnectOpen:!0})}}]:[];return[(0,oe.jsx)(V.Z,{disabled:r,loading:i,initialValue:n,onSubmit:function(e){return f({newAppSk:e}),!1},triggers:g,secure:!0}),u.newAppSk&&(0,oe.jsx)(he.Z,{title:a("blocklet.config.appSkTitle"),description:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,oe.jsx)(x.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,oe.jsxs)(we,{children:[(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:function(){return p(u.newAppSk)},onCancel:function(){return f({newAppSk:""})}}),(0,oe.jsx)(be.default,{popup:!0,open:u.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:l.get,checkTimeout:3e5,onSuccess:m,extraParams:{appDid:s.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:m})]}ye.propTypes={initialValue:u().string,onChange:u().func,disabled:u().bool,loading:u().bool},ye.defaultProps={initialValue:"default",onChange:function(){},disabled:!1,loading:!1};var Ce,we=(0,c.Z)("ul")(Ze||(Ze=(0,r.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"]))),Le=t(50496),Se=t(43207),Pe=t(33359),Ee=t(23299),Ae=t(49884),_e=t(88876),Te=t(73820),Ne=t(80670);function Oe(e){var n=e.onCancel,t=e.onSuccess,r=e.onError,i=(0,s.useContext)(je.B).api,a=(0,s.useState)(!1),l=(0,o.Z)(a,2),c=l[0],d=l[1],u=(0,L.PE)(),f=u.t,p=u.locale,m=(0,s.useState)(""),h=(0,o.Z)(m,2),g=h[0],Z=h[1],v=(0,s.useState)(!1),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=(0,s.useState)(0),C=(0,o.Z)(y,2),w=C[0],S=C[1],P=(0,s.useState)(""),E=(0,o.Z)(P,2),A=E[0],_=E[1],T=(0,Ne.DJ)().endpoint,N=(0,s.useState)(!1),O=(0,o.Z)(N,2),R=O[0],F=O[1],I=function(e){Z(null),d(!0);try{_(e.result),S(D.length-1)}catch(t){var n=(0,ue.Z)(t);Z(n),r(t)}finally{d(!1)}},B=function(){k(!1),S(0)},D=[{body:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(Pe.Z,{children:f("team.transferApp.transferDialog.tips.progress")}),(0,oe.jsx)(Pe.Z,{mt:3,mb:2,children:f("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:f("common.cancel"),confirm:f("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:function(){k(!0),S(1)}},{body:function(){return(0,oe.jsx)(be.default,{action:"transfer-app-owner",open:j,locale:p,checkFn:i.get,onClose:B,onSuccess:I,checkTimeout:3e5,extraParams:{},messages:{title:f("team.transferApp.connectDialog.title"),scan:f("team.transferApp.connectDialog.scan"),confirm:f("team.transferApp.connectDialog.confirm"),success:f("team.transferApp.connectDialog.success")},popup:!0})}},{body:function(){var e=(0,ue.VP)({transferId:A.transferId,endpoint:T});return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(x.Z,{component:Fe,dangerouslySetInnerHTML:{__html:f("team.transferApp.transferDialog.createSuccessTip1")}}),(0,oe.jsx)(x.Z,{component:Fe,mt:2,children:(0,oe.jsx)(Fe,{children:f("team.transferApp.transferDialog.createSuccessTip3")})}),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{component:Fe,mt:2,children:(0,oe.jsx)(Fe,{children:f("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,ue.B2)(A.expireDate,p)})})}),(0,oe.jsx)(x.Z,{my:1,children:(0,oe.jsx)(Te.Z,{children:e})})]}),(0,oe.jsx)("div",{children:(0,oe.jsx)(Ae.Z,{value:"end",control:(0,oe.jsx)(_e.Z,{checked:R,onChange:function(e){return F(e.target.checked)}}),label:f("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:f("common.confirm"),onConfirm:t}],U=D[w];return(0,oe.jsxs)(Le.ZP,{title:(0,oe.jsx)(Fe,{className:"title",children:f("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,oe.jsxs)(oe.Fragment,{children:[U.cancel&&(0,oe.jsx)(z.Z,{onClick:U.onCancel,color:"inherit",children:U.cancel}),(0,oe.jsxs)(z.Z,{onClick:U.onConfirm,color:"error",disabled:c||w===D.length-1&&!R,variant:"contained",autoFocus:!0,children:[c&&(0,oe.jsx)(M.Z,{size:16}),U.confirm]})]}),children:[(0,oe.jsx)(Se.Z,{component:"div",children:"function"===typeof U.body?U.body():U.body}),!!g&&(0,oe.jsx)(Ee.Z,{type:"error",variant:"icon",children:g})]})}Oe.propTypes={onCancel:u().func.isRequired,onSuccess:u().func.isRequired,onError:u().func},Oe.defaultProps={onError:function(){}};var Re,Fe=c.Z.div(Ce||(Ce=(0,r.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"]))),Ie=t(15300),Be=["blocklet","onUpdate","hasPermission"],De=Object.keys(G.SUPPORTED_LANGUAGES).map((function(e){return{code:e,name:G.SUPPORTED_LANGUAGES[e].nativeName}})),Ue=(0,s.lazy)((function(){return Promise.all([t.e(4917),t.e(5547)]).then(t.bind(t,25547)).then((function(e){return{default:e.Uploader}}))})),ze="/blocklet/logo/upload";function Ke(e){var n,t=e.blocklet,r=e.onUpdate,l=e.hasPermission,c=(0,a.Z)(e,Be),d=(0,de.h6)(),u=d.api,f=d.inService,p=d.prefix,g=d.getSessionInHeader,Z=d.ws.useSubscription,v=(0,s.useContext)(L.RD).t,b=(0,s.useState)(""),j=(0,o.Z)(b,2),k=j[0],y=j[1],C=(0,s.useState)(""),w=(0,o.Z)(C,2),S=w[0],E=w[1],A=(0,s.useState)(!1),N=(0,o.Z)(A,2),R=N[0],I=N[1],M=(0,P.getWhoCanAccess)(t),Y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,q=S||!l,J=(0,s.useRef)(null),Q=(0,Ie.Z)({blocklet:t}),X=Q.logoUrl,$=Q.rectLogoUrl,ee=Q.faviconUrl,ne=(0,s.useState)(),te=(0,o.Z)(ne,2),re=te[0],ie=te[1],ae=m()(p,ze,"square",t.meta.did),le=m()(p,ze,"rect",t.meta.did),se=m()(p,ze,"favicon",t.meta.did),me=function(e){l&&(ie({uploader:e,disableMediaKitPrefix:!0}),J.current.open())},he=t.meta.did,xe=t.site,Ze=O()(t.meta,"capabilities.clusterMode",!1);if(Z(h.EVENTS.NODE_RUNTIME_INFO,(function(e){Ze&&y(O()(e,"cpu.physicalCores",""))})),(0,ue.wS)(t.status))return null;var ve=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE})),be=!ve||"yes"===ve.value,je=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES})),ke=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL})),Ce=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER})),we=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR})),Le=[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:v("blocklet.config.name"),value:t.environments.find((function(e){return"BLOCKLET_APP_NAME"===e.key})).value},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:v("blocklet.config.description"),value:t.environments.find((function(e){return"BLOCKLET_APP_DESCRIPTION"===e.key})).value},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:v("blocklet.config.appUrl"),value:ke?ke.value:""},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:v("blocklet.config.copyrightOwner"),value:Ce?Ce.value:""},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:v("blocklet.config.copyrightYear"),value:we?we.value:""}];if(Ze){var Se=t.configs.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE})),Pe=Se?Se.value:k;Le.push({key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:v("blocklet.config.clusterSize"),value:Pe,cpuCores:k})}var Ee=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var i,o,a;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return E(!0),e.prev=3,i=n.target.checked,e.next=7,u.configPublicToStore({input:{did:t.meta.did,publicToStore:i}});case 7:o=e.sent,a=o.blocklet,r(a),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),H.Z.error(e.t0.message);case 15:return e.prev=15,E(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[3,12,15,18]])})));return function(n){return e.apply(this,arguments)}}(),Ae=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n,i){var o,a,l,s;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n!==G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){e.next=5;break}if(!(o=(0,ue.I)({value:i,cpuCores:k}))){e.next=5;break}return H.Z.error(o),e.abrupt("return");case 5:return a=[{key:n,value:i}],e.prev=6,E(!0),e.next=10,u.configBlocklet({input:{did:t.meta.did,configs:a}});case 10:l=e.sent,s=l.blocklet,r(s),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(6),H.Z.error(e.t0.message);case 18:return e.prev=18,E(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[6,15,18,21]])})));return function(n,t){return e.apply(this,arguments)}}(),_e=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var i,o,a;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return E(!0),e.prev=3,i=n.target.checked,e.next=7,u.configBlocklet({input:{did:t.meta.did,configs:[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:i?"no":"yes"}]}});case 7:o=e.sent,a=o.blocklet,r(a),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),H.Z.error(e.t0.message);case 15:return e.prev=15,E(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[3,12,15,18]])})));return function(n){return e.apply(this,arguments)}}(),Te=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var r,i,o;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=xe.corsAllowedOrigins||[],i=n.split(",").map((function(e){return e.trim()})).filter(Boolean),!F()(r,i)){e.next=4;break}return e.abrupt("return",!1);case 4:return e.prev=4,E(!0),o=i.length?i:["__none__"],e.next=9,u.updateRoutingSite({input:{id:xe.id,corsAllowedOrigins:o,teamDid:t.meta.did}});case 9:E(!1),e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(4),H.Z.error(e.t0.message),E(!1),e.abrupt("return",!1);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,null,[[4,12]])})));return function(n){return e.apply(this,arguments)}}(),Ne=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var i,o;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return E(!0),e.prev=3,e.next=6,u.configBlocklet({input:{did:t.meta.did,configs:[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:n}]}});case 6:i=e.sent,o=i.blocklet,r(o),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),H.Z.error(e.t0.message);case 14:return e.prev=14,E(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,11,14,17]])})));return function(n){return e.apply(this,arguments)}}(),Re={"&::after":{content:'"'.concat(v("common.switch"),'"')}};return(0,oe.jsxs)(Ve,(0,i.Z)((0,i.Z)({},c),{},{children:[Le.map((function(e){return(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,oe.jsx)(V.Z,{style:{marginTop:0},disabled:S||q,loading:S,initialValue:e.value,onSubmit:function(n){return Ae(e.key,n)}})]})})),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:v("blocklet.config.logoSquare")}),(0,oe.jsx)(x.Z,{className:B()("uploader-wrapper",l&&"enabled"),sx:Re,onClick:function(){return me(ae)},children:(0,oe.jsx)(W.Z,{sx:{height:80,width:80},variant:"square",alt:"Blocklet Logo",src:X})}),(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mt:4,children:v("blocklet.config.logoRect")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("blocklet.config.logoRectDesc")}),(0,oe.jsx)(x.Z,{className:B()("uploader-wrapper",l&&"enabled"),sx:Re,onClick:function(){return me(le)},children:(0,oe.jsx)("img",{alt:"Blocklet Rect Logo",src:$,style:{height:"80px"}})}),(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mt:4,children:v("blocklet.config.logoFavicon")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("blocklet.config.logoFaviconDesc")}),(0,oe.jsx)(x.Z,{sx:{display:"inline-flex",cursor:l?"pointer":"default"},onClick:function(){return me(se)},children:(0,oe.jsx)(W.Z,{variant:"square",sx:{width:20,height:20},alt:"Blocklet Favicon Logo",src:ee})}),(0,oe.jsx)(Ue,{id:"\u200buploader-logo",ref:J,popup:!0,onUploadFinish:function(){J.current.close()},plugins:[],apiPathProps:re,coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:g}},"uploader-logo"),(0,oe.jsx)(x.Z,{className:"config-form",children:"all"===M&&"registry"===t.source&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.access.publicToStore"),(0,oe.jsx)(x.Z,{className:"config-desc",children:v("blocklet.config.access.publicInstanceTip")})]}),(0,oe.jsx)(D.Z,{disabled:q,checked:Y,defaultChecked:!0,onChange:Ee})]})}),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("blocklet.config.languages")}),(0,oe.jsx)(ce,{style:{marginTop:0},disabled:S||q,loading:S,options:De,initialValue:je?je.value.split(","):["en","zh"],onSubmit:function(e){return Ae("BLOCKLET_APP_LANGUAGES",e)},helperText:v("blocklet.config.selectLanguagesTip")})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:v("common.security")})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("router.domainSecurity.cors.title")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,oe.jsx)(V.Z,{style:{marginTop:0},disabled:S||q,loading:S,initialValue:(xe.corsAllowedOrigins||[]).join(", "),onSubmit:Te})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsx)(x.Z,{mb:2,className:"config-label",fontSize:20,children:v("blocklet.config.dangerZone")}),(0,oe.jsxs)(x.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:!f&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.deletable.name"),(0,oe.jsx)(x.Z,{className:"config-desc",children:v(be?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,oe.jsx)(D.Z,{disabled:q,checked:!be,defaultChecked:!0,onChange:_e})]})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("blocklet.config.sk")}),(0,oe.jsx)(ye,{disabled:S||q,loading:S,initialValue:t.environments.find((function(e){return"BLOCKLET_APP_SK"===e.key})).value,onChange:Ne})]}),f&&(0,oe.jsx)(pe.Z,{role:"owner",children:function(e){return(e||fe.C)&&(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:v("team.transferApp.name")}),(0,oe.jsxs)(z.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:function(){return I(!0)},children:[(0,oe.jsx)(K.Z,{style:{fontSize:"1.3em",marginRight:4}}),v("team.transferApp.name")]})]}),R&&(0,oe.jsx)(Oe,{onCancel:function(){return I(!1)},onSuccess:function(){return I(!1)}})]})}}),(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.clearCache.name"),(0,oe.jsx)(x.Z,{className:"config-desc",children:v("blocklet.config.clearCache.purpose")})]}),(0,oe.jsx)(ge,{teamDid:he})]})})]})]}))}var We=(0,pe.V)(Ke,"mutate_blocklets"),Ge=(0,pe.V)(Ke,"",ue.Wf);function He(e){return(0,de.h6)().inService?(0,oe.jsx)(Ge,(0,i.Z)({},e)):(0,oe.jsx)(We,(0,i.Z)({},e))}Ke.propTypes={blocklet:u().object.isRequired,onUpdate:u().func,hasPermission:u().bool},Ke.defaultProps={onUpdate:function(){},hasPermission:!1};var Ve=c.Z.div(Re||(Re=(0,r.Z)(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])),(function(e){return e.theme.breakpoints.down("md")})),Me=t(78789),Ye=t(46121),qe=t(87535),Je=t(87006),Qe=t(72097),Xe=t(49735),$e=t.n(Xe),en=t(35147),nn=t(14764),tn=t(52553),rn=t.n(tn),on=t(27021),an=t.n(on),ln=t(44632),sn=t.n(ln),cn={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};var dn=function(){var e,n,t,r=(0,de.h6)().api,o=(0,ke.y0)().blocklet,a=(0,L.PE)().t,l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign((0,i.Z)({},cn),(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.notification)||void 0===t?void 0:t.email)||{}),c=(0,nn.cI)({defaultValues:$e()(s,Object.keys(cn))}),d=c.handleSubmit,u=c.control,f=c.formState,p=c.watch,m=c.reset,h=p("enabled"),g=(0,en.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,o,s,c,d;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.configNotification({input:{did:l,notification:JSON.stringify({email:n})}});case 3:s=e.sent,c=s.blocklet,d=Object.assign((0,i.Z)({},cn),(null===c||void 0===c||null===(t=c.settings)||void 0===t||null===(o=t.notification)||void 0===o?void 0:o.email)||{}),m(d),H.Z.success(a("oauth.saveSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message||a("oauth.saveFailed"));case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}()),Z=(0,en.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!rn()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),v=(0,en.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!an()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),b=(0,en.Z)((function(e){return e?!!sn()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired")})),j=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired")})),k=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired")})),y=(0,en.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(g),disabled:!0,children:[(0,oe.jsx)(nn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(Ae.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)({checked:n.value},n)),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,oe.jsx)(nn.Qr,{name:"from",control:u,rules:{validate:h?Z:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("notification.email.from"),error:!!f.errors[t.name],helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"host",control:u,rules:{validate:h?v:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"port",control:u,rules:{validate:h?b:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"number",error:!!f.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"user",control:u,rules:{validate:h?j:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"password",control:u,rules:{validate:h?k:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"password",error:!!f.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"secure",control:u,rules:{validate:y},render:function(e){var n=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Ae.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)((0,i.Z)({checked:n.value},n),{},{disabled:!h})),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,oe.jsx)(Qe.Z,{type:"submit",variant:"contained",onSubmit:d(g),disabled:!f.isDirty,children:a("oauth.save")})]})})},un=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];var fn,pn,mn=function(){var e=(0,s.useState)(un[0].value),n=(0,o.Z)(e,2),t=n[0],r=n[1],i=(0,s.useContext)(L.RD).t,a=(0,Ye.Z)((function(){return{email:(0,oe.jsx)(dn,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(Me.Z,{children:i("notification.comingSoon")})})}}),[i]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(S.Z,{tabs:un,current:t,onChange:r}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:a[t]})]})},hn=t(6779),xn=t(6698),gn=t(11909),Zn=t(1484),vn=t(2569),bn=t(88356),jn=t(98127),kn=t(86008),yn=t(70115),Cn="roles",wn=[].concat((0,l.Z)(yn.Z),[{value:Cn,icon:jn.Z,title:{zh:"\u6307\u5b9a\u901a\u884c\u8bc1\u53ef\u8bbf\u95ee",en:"Accessible to selected passports"},description:{zh:"\u53ea\u6709\u6307\u5b9a\u7684\u901a\u884c\u8bc1\u53ef\u4ee5\u8bbf\u95ee",en:"Only specified passports can access"}}]),Ln=function(e,n){if(e&&e.startsWith(h.WHO_CAN_ACCESS_PREFIX_ROLES)){var t=(0,P.getRolesFromAuthConfig)({whoCanAccess:e}),r=n.filter((function(e){return t.includes(e.name)}));return{access:Cn,roles:r}}return{access:e,roles:[]}},Sn=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).roles,r=void 0===t?[]:t,i=(e.configs||[]).find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO}));if(i)return Ln(i.value,r);if(n&&O()(n,"settings.whoCanAccess")&&O()(n,"settings.whoCanAccess")!==h.WHO_CAN_ACCESS.ALL)return Ln(O()(n,"settings.whoCanAccess"),r);var o=(0,P.findServiceFromMeta)(e.meta,h.NODE_SERVICES.AUTH);return O()(o,"config.whoCanAccess")?Ln(o.config.whoCanAccess,r):{access:h.WHO_CAN_ACCESS.ALL,roles:[]}};function Pn(e){var n=e.blocklet,t=e.ancestors,r=e.children,i=(0,ee.Z)(),a=(0,s.useState)(""),c=(0,o.Z)(a,2),d=c[0],u=c[1],f=(0,L.PE)(),p=f.t,m=f.locale,g=(0,de.h6)().api,Z=(0,Ne.DJ)().roles,v=(0,s.useState)(""),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=t[0]||n,C=Sn(n,y,{roles:Z}),w=C.access,S=C.roles,E=(0,s.useState)(w),A=(0,o.Z)(E,2),N=A[0],O=A[1],R=(0,s.useState)(S),F=(0,o.Z)(R,2),I=F[0],B=F[1],D=[].concat((0,l.Z)(t.map((function(e){return e.meta.did}))),[n.meta.did]),U={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:i.palette.text.secondary},K=t.concat(n).map((function(e){return(0,P.getDisplayName)(e,!0)})).join(" / ");if((0,ue.wS)(n.status))return null;if("unknown"===n.status&&(0,ue.wS)(n.status))return null;var W=function(){u(!1)},G=function(e){e.stopPropagation(),u(!0)},V=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!j){e.next=2;break}return e.abrupt("return");case 2:return k(!0),e.prev=3,(n=N)===Cn&&(n="".concat(h.WHO_CAN_ACCESS_PREFIX_ROLES).concat(I.map((function(e){return e.name})).join(","))),e.next=8,g.updateWhoCanAccess({input:{did:D,whoCanAccess:n}});case 8:H.Z.success(p("blocklet.config.access.updatedTip")),W(),k(!1),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(3),k(!1),H.Z.error((0,ue.Z)(e.t0));case 17:case"end":return e.stop()}}),e,null,[[3,13]])})));return function(){return e.apply(this,arguments)}}(),Y=j||N===Cn&&!I.length;return["function"===typeof r?r({open:G}):(0,oe.jsx)(J.Z,{onClick:G,"data-cy":"action-config-component",children:(0,oe.jsx)(bn.default,{})}),d&&(0,oe.jsxs)(An,{open:!0,fullWidth:!0,title:K,onClose:W,PaperProps:{style:{minHeight:"auto"}},actions:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(z.Z,{onClick:W,color:"inherit","data-cy":"config-access-cancel",children:p("common.cancel")}),(0,oe.jsxs)(z.Z,{onClick:V,color:"primary",disabled:Y,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[j&&(0,oe.jsx)(M.Z,{size:16}),p("common.confirm")]})]}),children:[(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(Je.Z,{label:p("blocklet.config.access.description"),select:!0,fullWidth:!0,value:N,onChange:function(e){var n=e.target.value;O(n)},"data-cy":"config-access-select",SelectProps:{renderValue:function(e){var n=wn.find((function(n){return n.value===e}));return n?(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(n.icon,{style:U}),n.title[m]]}):null}},children:wn.map((function(e){return(0,oe.jsxs)(_n,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",children:[(0,oe.jsx)(e.icon,{style:U}),(0,oe.jsx)(x.Z,{children:e.title[m]})]}),(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(x.Z,{className:"tip",children:e.description[m]})})]})}))})}),N===Cn&&(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(Je.Z,{label:p("blocklet.config.access.description"),select:!0,fullWidth:!0,value:I.map((function(e){return e.name})),onChange:function(e){B(Z.filter((function(n){return(e.target.value||[]).includes(n.name)})))},SelectProps:{multiple:!0,renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((function(e){var n=Z.find((function(n){return n.name===e}));return(0,oe.jsx)($.Z,{label:n.title},n.text)}))})}},children:Z.map((function(e){var n=e.name,t=e.title;return(0,oe.jsxs)(Q.Z,{value:n,children:[(0,oe.jsx)(_e.Z,{checked:I.some((function(e){return e.name===n}))}),(0,oe.jsx)(kn.Z,{primary:t})]},n)}))})})]})]}Pn.propTypes={blocklet:u().object.isRequired,ancestors:u().array,children:u().any},Pn.defaultProps={ancestors:[],children:null};var En,An=(0,c.Z)(Le.ZP)(fn||(fn=(0,r.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),_n=(0,c.Z)(Q.Z)(pn||(pn=(0,r.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(function(e){return e.theme.palette.text.secondary}));function Tn(e){var n,t,r=e.blocklet,i=e.ancestors,a=e.depth,c=(0,ee.Z)(),d=(0,L.PE)(),u=d.t,f=d.locale,p=(0,Ne.DJ)().roles,m=(0,s.useState)(!0),h=(0,o.Z)(m,2),g=h[0],Z=h[1],v=(0,ke.y0)().recommendedDomain,b=i[0]||r,j="/".concat(i.map((function(e){return e.mountPoint||"/"})).join("/"),"/").concat(r.mountPoint||"/").replace(/\/+/g,"/"),k=(0,ue.vH)({blocklet:b,domain:{value:v},mountPoint:j,params:(0,ue.f0)(b,f)}),w={fill:c.palette.text.secondary},S=a>0&&r.children.length>0,A=(0,oe.jsx)(J.Z,{size:"small",children:g?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(y.default,{fontSize:"inherit"})}),_=Sn(r,b,{roles:p}),T=_.access,N=_.roles;if("roles"!==T)t=yn.Z.find((function(e){return e.value===T}))||yn.Z[2];else{var O=N.map((function(e){return e.title})).join("/");t={title:{zh:"\u53ea\u6709 ".concat(O," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(O," can access")}}}return[(a>0||"gateway"!==r.meta.group)&&(0,oe.jsxs)(x.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,oe.jsxs)(x.Z,{pl:Math.max(2*(a-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:S?"pointer":"cursor"},onClick:function(){return S&&Z(!g)},children:[S?A:(0,oe.jsx)(x.Z,{width:28}),(0,oe.jsx)(E.Z,{blocklet:r,ancestors:i}),(0,oe.jsxs)(x.Z,{ml:"16px",children:[(0,oe.jsx)(x.Z,{style:{color:"#222",fontSize:18},children:(0,P.getDisplayName)(r,!0)}),(0,oe.jsx)(x.Z,{display:"flex",alignItems:"center",children:(0,oe.jsx)(x.Z,{color:"text.secondary",children:t.title[f]})})]})]},r),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(hn.Z,{title:u("common.visit"),children:(0,oe.jsx)("a",{target:"_blank",href:k,rel:"noopener noreferrer",title:k,children:(0,oe.jsx)(J.Z,{children:(0,oe.jsx)(gn.Z,{})})})}),(0,oe.jsx)(Pn,{blocklet:r,ancestors:i,children:function(e){var n=e.open;return(0,oe.jsx)(hn.Z,{title:u("common.edit"),children:(0,oe.jsx)(J.Z,{onClick:n,"data-cy":"btn-edit-".concat(r.meta.did),children:(0,oe.jsx)(Zn.Z,{style:w})})})}})]},"actions")]},"group-not-gateway-box"),(0,oe.jsx)(vn.Z,{depth:a}),null!==(n=r.children)&&void 0!==n&&n.length?(0,oe.jsx)(xn.Z,{in:g,children:r.children.map((function(e){return(0,oe.jsx)(Tn,{blocklet:e,ancestors:[].concat((0,l.Z)(i),[r]),depth:a+1},"".concat(a+1,"-").concat(e.meta.did))}))},"blocklet-collapse"):null]}function Nn(){var e=(0,L.PE)().t,n=(0,ke.y0)().blocklet,t=(0,l.Z)(n.children)||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,oe.jsx)(On,{component:"div",children:t&&t.length?[(0,oe.jsx)(x.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,oe.jsx)(Tn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,oe.jsx)(x.Z,{mt:8,children:(0,oe.jsx)(Me.Z,{children:e("blocklet.component.noComponent")})})})}Tn.propTypes={blocklet:u().object.isRequired,ancestors:u().array,depth:u().number},Tn.defaultProps={ancestors:[],depth:0},Nn.propTypes={};var On=(0,c.Z)(x.Z)(En||(En=(0,r.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n &.first {\n margin-top: 0;\n }\n }\n"])),(function(e){return e.theme.spacing(5)}),(function(e){return e.theme.spacing(3)})),Rn=t(92746);var Fn=function(){var e,n,t,r=(0,de.h6)().api,o=(0,ke.y0)().blocklet,a=(0,L.PE)().t,l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign({enabled:!1,domain:"",clientId:""},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.oauth)||void 0===t?void 0:t.auth0)||{}),c=(0,nn.cI)({defaultValues:$e()(s,["domain","clientId","enabled"])}),d=c.handleSubmit,u=c.control,f=c.formState,p=c.watch,m=c.reset,h=p("enabled"),g=(0,en.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,i,o,s,c;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:n})}});case 3:o=e.sent,s=o.blocklet,c=Object.assign({enabled:!1,domain:"",clientId:""},(null===s||void 0===s||null===(t=s.settings)||void 0===t||null===(i=t.oauth)||void 0===i?void 0:i.auth0)||{}),m(c),H.Z.success(a("oauth.saveSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message||a("oauth.saveFailed"));case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}()),Z=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe")})),v=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe")})),b=(0,en.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(g),disabled:!0,children:[(0,oe.jsx)(nn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(Ae.Z,{control:(0,oe.jsx)(Rn.Z,(0,i.Z)({checked:n.value,style:{marginRight:"6px"}},n)),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,oe.jsx)(nn.Qr,{name:"domain",control:u,rules:{validate:h?Z:b},render:function(e){var n,t=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("oauth.auth0.domain"),error:!!f.errors[t.name],helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"clientId",control:u,rules:{validate:h?v:b},render:function(e){var n,t=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(Qe.Z,{type:"submit",variant:"contained",onSubmit:d(g),disabled:!f.isDirty,children:a("oauth.save")})]})})},In=t(29529),Bn=t(25139),Dn={ttl:604800};function Un(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return(0,i.Z)((0,i.Z)({},e),{},{ttl:n})}function zn(){var e,n,t=(0,de.h6)().api,r=(0,ke.y0)().blocklet,o=null===r||void 0===r||null===(e=r.meta)||void 0===e?void 0:e.did,a=Object.assign({},Dn,(null===r||void 0===r||null===(n=r.settings)||void 0===n?void 0:n.session)||{}),l=(0,nn.cI)({defaultValues:$e()(Un(a),["ttl"])}),s=l.handleSubmit,c=l.control,d=l.formState,u=l.reset,f=(0,L.PE)().t,p=(0,en.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var r,i,a,l;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.updateAppSessionConfig({input:{did:o,config:Un(n,!0)}});case 3:i=e.sent,a=i.blocklet,l=Object.assign({},Dn,$e()((null===a||void 0===a||null===(r=a.settings)||void 0===r?void 0:r.session)||{},["ttl"])),u(Un(l)),H.Z.success(f("common.configSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}());return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:s(p),disabled:!0,children:[(0,oe.jsx)(nn.Qr,{name:"ttl",control:c,render:function(e){var n=e.field;return(0,oe.jsx)(qe.Z,{fullWidth:!0,sx:{mb:2},children:(0,oe.jsxs)(Bn.Z,{px:3,children:[(0,oe.jsx)(x.Z,{mx:-3,my:.5,children:f("blocklet.config.session.ttl",{day:n.value})}),(0,oe.jsx)(In.ZP,(0,i.Z)((0,i.Z)({},n),{},{defaultValue:7,step:1,marks:[{value:1,label:f("blocklet.config.session.day",{day:1})},{value:7,label:f("blocklet.config.session.days",{day:7})},{value:14,label:f("blocklet.config.session.days",{day:14})},{value:21,label:f("blocklet.config.session.days",{day:21})},{value:30,label:f("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}}))]})})}}),(0,oe.jsx)(Qe.Z,{type:"submit",variant:"contained",onSubmit:s(p),disabled:!d.isDirty,children:f("oauth.save")})]})})}var Kn=t(48537),Wn=t(95002),Gn=t(2291),Hn=t(75260),Vn=t(28595),Mn=t(61398),Yn=t.n(Mn),qn=(0,s.forwardRef)((function(e,n){var t=(0,s.useContext)(L.RD).t,r=(0,Vn.Z)({show:!1,title:"",content:"",onConfirm:Yn(),onCancel:Yn(),loading:!1}),i=(0,en.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.show=!0,r.title=e.title,r.content=e.content,r.onConfirm=e.onConfirm||Yn(),r.onCancel=e.onCancel||Yn(),r.loading=!1})),o=(0,en.Z)((function(){r.title="",r.content="",r.onConfirm=Yn(),r.onCancel=Yn()})),a=(0,en.Z)((function(){r.show=!1,setTimeout((function(){o()}),300)})),l=(0,en.Z)((function(){a(),null===r||void 0===r||r.onCancel()}),[]),c=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.loading=!0,e.prev=1,e.next=4,null===r||void 0===r?void 0:r.onConfirm(a);case 4:return e.prev=4,r.loading=!1,e.finish(4);case 7:case"end":return e.stop()}}),e,null,[[1,,4,7]])}))),[]);return(0,s.useImperativeHandle)(n,(function(){return{open:i,close:a}}),[i,a]),(0,oe.jsx)(Le.I4,{open:r.show,title:r.title,onConfirm:c,onCancel:l,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:r.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:r.content})}));var Jn=t(70177),Qn=t(59182),Xn=t.n(Qn),$n=t(76032),et=t.n($n),nt=t(55581),tt=t(63531),rt=t(92522),it=t.n(rt),ot=(0,s.forwardRef)((function(e,n){var t,r,i=(0,s.useContext)(L.RD).t,o=(0,ke.y0)().blocklet,a=(0,de.h6)().api,l=(0,Vn.Z)({mode:"view",show:!1,data:{},callback:Yn()}),c=(0,nt.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,u=(0,en.Z)((function(){l.mode="view",l.data={},l.callback=Yn()}),[]),f=(0,en.Z)((function(){l.show=!1,setTimeout((function(){u()}),d)}),[]),p=(0,en.Z)((function(e){l.mode="view",l.show=!0,l.data=e}),[]),h=(0,en.Z)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Yn();l.mode="approve",l.show=!0,l.data=e,l.callback=n}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:p,close:f,approve:h}}),[p,f,h]);var g=(0,Ye.Z)((function(){if(!l.show)return[];l.data.migratedFrom=[l.data.appId,l.data.appPid];var e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==l.data.isMaster&&Xn()(e,"appliedAt","status"),e.map((function(e){var n=i("federated.info.".concat(e)),t=l.data[e];if("appName"===e&&l.data.isMaster&&(t=(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(Kn.Z,{component:Wn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,oe.jsx)(tt.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,oe.jsx)(x.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){var r=it()(t)?t:m()(l.data.appUrl||"",t||"");try{var o=new URL(r);o.searchParams.set("imageFilter","resize"),o.searchParams.set("w","80"),o.searchParams.set("h","80"),t=(0,oe.jsx)("img",{src:o.href,width:"60",height:"60",alt:l.data.appName})}catch(a){t=(0,oe.jsx)("img",{src:r,width:"60",height:"60",alt:l.data.appName})}}("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e)&&(t=(l.data.migratedFrom||[]).filter((function(e){return![l.data.appId,l.data.appPid].includes(e)})).map((function(e){return(0,oe.jsx)(tt.kL,{children:e})})));return et()(t)&&(t="-"),{name:n,value:t}}))}),[l.data]),Z="approve"===l.mode,v=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.auditFederatedLogin({input:{memberPid:l.data.appPid,did:o.appPid,status:"rejected"}});case 2:f(),null===l||void 0===l||l.callback(!1);case 4:case"end":return e.stop()}}),e)})))),b=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.auditFederatedLogin({input:{memberPid:l.data.appPid,did:o.appPid,status:"approved"}});case 2:f(),null===l||void 0===l||l.callback(!0);case 4:case"end":return e.stop()}}),e)}))));return(0,oe.jsx)(Le.ZP,{open:l.show,title:i(Z?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:f,actions:Z?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Qe.Z,{color:"error",variant:"contained",onClick:v,children:i("common.reject")}),(0,oe.jsx)(Qe.Z,{variant:"contained",onClick:b,children:i("common.approve")})]}):(0,oe.jsx)(Qe.Z,{variant:"outlined",onClick:f,children:i("common.close")}),children:g.map((function(e){return(0,oe.jsx)(Jn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)}))})})),at=ot,lt=t(29951),st=t(34760),ct=t.n(st),dt=(0,s.forwardRef)((function(e,n){var t,r,i=(0,nt.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,a=(0,s.useContext)(L.RD).t,l=(0,Vn.Z)({show:!1,data:{link:""}}),c=(0,en.Z)((function(){l.data.link=""}),[]),d=(0,en.Z)((function(){l.show=!1,setTimeout((function(){c()}),o)}),[]),u=(0,en.Z)((function(e){var n=e.link;l.show=!0,l.data.link=n}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:u,close:d}}),[u,d]);var f=(0,en.Z)((function(){ct()(l.data.link),d()}),[d]);return(0,oe.jsxs)(Le.ZP,{open:l.show,title:a("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(z.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:f,children:a("common.copyAndClose")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,oe.jsx)(x.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,oe.jsx)(lt.Z,{language:"shell",style:{marginBottom:0},children:l.data.link})})]})}));function ut(e){var n,t,r,i,a,l=e.mode,c=(0,s.useRef)(null),d=(0,s.useRef)(null),u=(0,s.useContext)(L.RD),f=u.t,p=u.locale,m=(0,ke.y0)(),h=m.blocklet,g=m.actions.refreshBlocklet,Z=function(){var e=(0,s.useRef)(null),n=(0,en.Z)((function(){for(var n,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];null===(n=e.current)||void 0===n||n.open.apply(n,r)})),t=(0,en.Z)((function(){for(var n,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];null===(n=e.current)||void 0===n||n.close.apply(n,r)})),r={open:n,close:t};return{confirmHolder:(0,oe.jsx)(qn,{ref:e}),confirmApi:r}}(),v=Z.confirmApi,b=Z.confirmHolder,j=(0,de.h6)().api,k=(null===(n=h.settings.federated)||void 0===n?void 0:n.sites)||[],y=(null===(t=h.settings.federated)||void 0===t?void 0:t.config)||{autoLogin:!1},C=!1!==y.isMaster,w=(0,en.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.open(e)})),S=(0,en.Z)((function(e){var n;null===(n=d.current)||void 0===n||n.approve(e,g)})),P=(0,en.Z)((function(e){v.open({title:f("federated.disableFederatedLogin"),content:f("federated.disableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,j.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"revoked"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),E=(0,en.Z)((function(e){v.open({title:f("federated.enableFederatedLogin"),content:f("federated.enableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,j.auditFederatedLogin({input:{memberPid:e.appPid,did:h.appPid,status:"approved"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),A=(0,Ye.Z)((function(){var e=[{label:f("common.name"),name:"appName",options:{customBodyRenderLite:function(e){var n=k[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"inline-block",children:(0,oe.jsxs)(x.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:function(e){e.stopPropagation()},children:[t&&(0,oe.jsx)(Kn.Z,{component:Wn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:f("common.did"),name:"appId",options:{customBodyRenderLite:function(e){var n=k[e];return(0,oe.jsx)(Hn.Z,{children:n.appId})}}},{label:f("common.status"),name:"status",options:{customBodyRenderLite:function(e){var n=k[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{children:t?"-":f("federated.status.".concat(n.status))})}}}];return C&&e.push({label:f("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var n=k[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"flex",gap:1,children:t?(0,oe.jsxs)(oe.Fragment,{children:["rejected"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation()},children:f("federated.status.rejected")}),"revoked"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"secondary",size:"small",onClick:function(e){e.stopPropagation()},children:f("federated.status.revoked")})]}):(0,oe.jsxs)(oe.Fragment,{children:["pending"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"primary",size:"small",onClick:function(e){e.stopPropagation(),S(n)},children:f("federated.status.pending")}),"approved"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation(),P(n)},style:{whiteSpace:"nowrap"},children:f("federated.revoke")}),"revoked"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"warning",size:"small",onClick:function(e){e.stopPropagation(),E(n)},style:{whiteSpace:"nowrap"},children:f("federated.approve")})]})})}}}),e}),[y.appId,k,C]),N=(0,Ye.Z)((function(){return{sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick:function(e,n){var t=n.dataIndex,r=k[t];w(r)}}}),[]),O=(0,en.Z)((function(){var e,n=h.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL}));null!==n&&void 0!==n&&n.value?null===(e=c.current)||void 0===e||e.open({link:n.value}):H.Z.error(f("federated.failedToGetFederatedLoginLink"))}),[null===(r=h.site)||void 0===r||null===(i=r.domainAliases)||void 0===i||null===(a=i[0])||void 0===a?void 0:a.href]),R=(0,s.useState)(y.autoLogin||!1),F=(0,o.Z)(R,2),I=F[0],B=F[1],D=(0,en.Z)((function(){v.open({title:f(I?"federated.disableFederatedAutoLogin":"federated.enableFederatedAutoLogin"),content:f(I?"federated.disableFederatedAutoLoginDescription":"federated.enableFederatedAutoLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,j.configFederated({input:{did:h.appPid,autoLogin:!I}});case 2:B((function(e){return!e})),e();case 4:case"end":return n.stop()}}),n)})))()}})}),[B,I]),U=(0,en.Z)((function(){v.open({title:f("federated.quitFederatedLogin"),content:f("federated.quitFederatedLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,j.quitFederatedLogin({input:{did:h.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),K=(0,en.Z)((function(){v.open({title:f("federated.disbandFederatedLogin"),content:f("federated.disbandFederatedLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,j.disbandFederatedLogin({input:{did:h.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),W=[];return"master"!==l?W.push((0,oe.jsx)(z.Z,{size:"small",variant:"contained",color:"error",onClick:U,sx:{ml:1},children:f("federated.quitFederatedLogin")},"quitFederatedLogin")):(W.push((0,oe.jsx)(z.Z,{size:"small",variant:"contained",onClick:O,sx:{ml:1},children:f("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),W.push((0,oe.jsx)(z.Z,{color:"error",size:"small",variant:"contained",onClick:K,sx:{ml:1},children:f("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Gn.Z,{className:"main-table",locale:p,data:k,columns:A,customButtons:W,title:(0,oe.jsx)(x.Z,{className:"table-toolbar-left",children:"master"===l?f("oauth.federated"):(0,oe.jsx)(Ae.Z,{sx:{ml:0,"& span.MuiSwitch-switchBase":{display:"flex"},"& span.MuiSwitch-track":{display:"block"}},control:(0,oe.jsx)(Rn.Z,{checked:I,style:{marginRight:"6px"},onChange:D}),label:f("federated.enableFederatedAutoLogin")})}),options:N}),b,(0,oe.jsx)(dt,{ref:c}),(0,oe.jsx)(at,{ref:d})]})}ut.propTypes={mode:u().oneOf(["member","master"])},ut.defaultProps={mode:"member"};var ft=ut,pt=(0,s.forwardRef)((function(e,n){var t,r,i=(0,s.useContext)(L.RD).t,o=(0,de.h6)().api,a=(0,ke.y0)().blocklet,l=null===a||void 0===a?void 0:a.appPid,c=(0,nt.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,u=(0,Vn.Z)({show:!1,appUrl:"",appUrlError:"",callback:Yn()}),f=(0,en.Z)((function(){u.appUrl="",u.appUrlError="",u.callback=Yn()}),[]),p=(0,en.Z)((function(){u.show=!1,setTimeout((function(){f()}),d)}),[]),m=(0,en.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Yn();u.show=!0,u.callback=e}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:m,close:p}}),[m,p]);var h=(0,en.Z)((function(e){if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!it()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),g=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,h(u.appUrl),e.next=4,o.joinFederatedLogin({input:{did:l,appUrl:u.appUrl}});case 4:n=e.sent,u.show=!1,p(),null===u||void 0===u||u.callback(n),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),u.appUrlError=e.t0.message;case 13:case"end":return e.stop()}}),e,null,[[0,10]])}))),[p,l]);return(0,oe.jsxs)(Le.ZP,{open:u.show,title:i("federated.joinFederatedLogin"),onClose:p,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(z.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:g,children:i("common.confirm")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,oe.jsx)(Je.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:u.appUrl,error:!!u.appUrlError,helperText:u.appUrlError||"eg: https://www.arcblock.io",onChange:function(e){u.appUrl=e.target.value}})]})})),mt=pt;function ht(){var e,n,t,r,i=(0,s.useRef)(null),o=(0,s.useRef)(null),a=(0,s.useContext)(L.RD).t,l=(0,ke.y0)(),c=l.blocklet,d=l.actions.refreshBlocklet,u=(0,en.Z)((function(){var e,n,t,r=null===(e=c.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href;if(r)try{var o,l=new URL(r);null===(o=i.current)||void 0===o||o.open({link:l.origin})}catch(s){H.Z.error(a("federated.failedToGetFederatedLoginLink"))}}),[null===(e=c.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href]),f=(0,en.Z)((function(){var e;null===(e=o.current)||void 0===e||e.open((function(){d()}))}),[d]);if((null===(r=c.settings.federated)||void 0===r?void 0:r.sites.length)>0){var p,m=!1!==(null===(p=c.settings.federated)||void 0===p?void 0:p.config.isMaster);return(0,oe.jsx)(ft,{mode:m?"master":"member"})}return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(x.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,oe.jsx)(z.Z,{variant:"contained",onClick:u,children:a("federated.inviteJoinFederatedLogin")}),(0,oe.jsx)(U.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,oe.jsx)(z.Z,{variant:"outlined",onClick:f,children:a("federated.joinFederatedLogin")})]}),(0,oe.jsx)(dt,{ref:i}),(0,oe.jsx)(mt,{ref:o})]})}var xt,gt=function(){var e=(0,s.useContext)(L.RD).t,n=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],t=(0,s.useState)(n[0].value),r=(0,o.Z)(t,2),i=r[0],a=r[1],l=(0,Ye.Z)((function(){return{auth0:(0,oe.jsx)(Fn,{}),federated:(0,oe.jsx)(ht,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(Me.Z,{children:e("oauth.comingSoon")})}),settings:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(zn,{})})}}),[e]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(S.Z,{tabs:n,current:i,onChange:a}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:l[i]})]})},Zt=["blocklet","onUpdate"],vt=function e(n){var t=n.tabs,r=n.blocklet,i=n.ancestors,o=void 0===i?[]:i,a=n.depth,s=void 0===a?1:a,c=n.t,d=[].concat((0,l.Z)(o.map((function(e){return e.meta.did}))),[r.meta.did]).join("/"),u=!(null!==o&&void 0!==o&&o.length);t.push({label:(0,oe.jsxs)(x.Z,{pl:2*Math.max(1,s-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[u?(0,oe.jsx)(A.Z,{size:24,blocklet:r}):(0,oe.jsx)(E.Z,{size:24,blocklet:r,ancestors:o}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:u?c("blocklet.component.container"):(0,P.getDisplayName)(r,!0)})})]},d),value:d}),r.children.length>0&&r.children.forEach((function(n){e({tabs:t,blocklet:n,ancestors:[].concat((0,l.Z)(o),[r]),depth:s+1,t:c})}))};function bt(e){var n=e.blocklet,t=e.onUpdate,r=(0,a.Z)(e,Zt),l=(0,s.useContext)(L.RD).t,c=(0,de.h6)(),d=c.info,u=c.inService,p=(0,s.useState)(!0),P=(0,o.Z)(p,2),E=P[0],A=P[1],_=(0,w.lr)(),T=(0,o.Z)(_,2),N=T[0],O=T[1],R=N.get("tab")||"general",F=[{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,oe.jsx)(Z.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.general")})})]},"general"),value:"general"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,oe.jsx)(v.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.access")})})]},"access"),value:"access"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,oe.jsx)(b.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.login")})})]},"oauth"),value:"oauth"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,oe.jsx)(j.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.notification")})})]},"notification"),value:"notification"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,oe.jsx)(x.Z,{ml:-2,style:{transform:"translateY(2px)"},children:E?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(y.default,{fontSize:"inherit"})}),(0,oe.jsx)(k.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.preferences")})})]},"preference"),value:"preference"}];E&&vt({tabs:F,blocklet:n,t:l});var I=null;if("general"===R)I=(0,oe.jsx)(He,{blocklet:n,onUpdate:t});else if("access"===R)I=(0,oe.jsx)(Nn,{});else if("oauth"===R)I=(0,oe.jsx)(gt,{});else if("notification"===R)I=(0,oe.jsx)(mn,{});else{var B=u?h.WELLKNOWN_SERVICE_PATH_PREFIX:d.routing.adminPath,D=new URLSearchParams;u||D.set("authKey","__sst"),D.set("schemaKey",m()(window.location.origin,B,"/api/preferences?id=".concat(encodeURIComponent(R)))),I=(0,oe.jsx)(f.Z,{url:"".concat(m()(window.location.origin,B,"/hosted/form-collector/"),"?").concat(D.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,oe.jsx)(jt,(0,i.Z)((0,i.Z)({},r),{},{children:(0,oe.jsxs)(g.ZP,{container:!0,spacing:4,columns:24,children:[(0,oe.jsx)(g.ZP,{item:!0,sm:7,md:5,children:(0,oe.jsx)(S.Z,{tabs:F,current:R,orientation:"vertical",onChange:function(e){"preference"===e?A(!E):O((function(n){return"general"===e?n.delete("tab"):n.set("tab",e),n}))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,oe.jsx)(g.ZP,{item:!0,sm:17,md:19,children:(0,oe.jsx)(x.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:I})})]})}))}bt.propTypes={blocklet:u().object.isRequired,onUpdate:u().func},bt.defaultProps={onUpdate:function(){}};var jt=c.Z.div(xt||(xt=(0,r.Z)(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])))},19066:function(e,n,t){t.d(n,{C:function(){return r}});var r="true"===localStorage.getItem("enableDebug")},70115:function(e,n,t){var r=t(39517),i=t(87642),o=t(64076),a=t(20244);n.Z=[{value:a.WHO_CAN_ACCESS.ALL,icon:o.Z,title:{zh:"\u6240\u6709\u4eba\u53ef\u8bbf\u95ee",en:"Accessible to all"},description:{zh:"\u5411\u6240\u6709\u4eba\u5f00\u653e\uff0c\u65e0\u9700\u901a\u884c\u8bc1\u5373\u53ef\u8bbf\u95ee\u5e94\u7528",en:"Open to the world anyone can access without passport"}},{value:a.WHO_CAN_ACCESS.INVITED,icon:i.Z,title:{zh:"\u53ea\u6709\u88ab\u9080\u8bf7\u7684\u4eba\u53ef\u4ee5\u8bbf\u95ee",en:"Only invited people can access"},description:{zh:"\u7a0d\u540e\u60a8\u53ef\u4ee5\u5728\u7ba1\u7406\u9875\u9762\u4e2d\u9080\u8bf7\u6210\u5458",en:"You can invite members later in the admin page"}},{value:a.WHO_CAN_ACCESS.OWNER,icon:r.Z,title:{zh:"\u53ea\u6709\u5e94\u7528\u6240\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee",en:"Only Owner of the blocklet can access"},description:{zh:"\u5fc5\u987b\u63d0\u4f9b\u6240\u6709\u8005\u901a\u884c\u8bc1\u624d\u80fd\u8bbf\u95ee\u5e94\u7528",en:"You must provide owner passport to access this application"}}]}}]);
2
- //# sourceMappingURL=4802.b2e38d47.chunk.js.map
1
+ "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[4802],{92746:function(e,n,t){var r,i=t(71171),o=t(33028),a=t(59740),l=t(16380),s=t(50442),c=t(37574),d=["labelProps","className","style"];function u(e){var n=e.labelProps,t=e.className,r=e.style,i=(0,a.Z)(e,d),l=(0,o.Z)((0,o.Z)({},n),{},{labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"});return(0,c.jsx)(f,{className:t,style:r,children:(0,c.jsx)(s.Z,(0,o.Z)({labelProps:l},i))})}u.propTypes=s.Z.propTypes,u.defaultProps=s.Z.defaultProps;var f=l.Z.div(r||(r=(0,i.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(function(e){return e.theme.breakpoints.down("sm")}));n.Z=u},121:function(e,n,t){t.r(n),t.d(n,{default:function(){return bt}});var r=t(71171),i=t(33028),o=t(96234),a=t(59740),l=t(68079),s=t(30969),c=t(16380),d=t(24974),u=t.n(d),f=t(95973),p=t(19611),m=t.n(p),h=t(20244),x=t(38361),Z=t(3994),g=t(79823),v=t(64689),b=t(99254),j=t(76527),k=t(85385),y=t(52838),C=t(23038),w=t(86822),L=t(26022),S=t(19865),E=t(7017),P=t(70998),A=t(84802),_=t(32723),T=t(34795),N=t(46292),O=t.n(N),R=t(15888),I=t.n(R),B=t(65667),F=t.n(B),D=t(34159),U=t(75295),z=t(29996),K=t(13134),W=t(59467),G=t(59505),H=t(1986),V=t(67019),Y=t(94308),q=t(88581),M=t(27724),J=t(94551),Q=t(2689),X=t(39130),$=t(7173),ee=t(94702),ne=t(98123),te=t(14458),re=t(28412),ie=t(76934),oe=t(37574),ae=["label","disabled","required","initialValue","onChange","style","onSubmit","triggers","options","formatterBeforeSubmit","helperText"],le={PaperProps:{style:{maxHeight:224,width:250}}},se=function(e,n,t){return{fontWeight:-1===n.indexOf(e)?t.typography.fontWeightRegular:t.typography.fontWeightMedium}};function ce(e){var n=e.label,t=e.disabled,r=e.required,l=e.initialValue,c=e.onChange,d=e.style,u=e.onSubmit,f=e.triggers,p=e.options,m=e.formatterBeforeSubmit,h=e.helperText,Z=(0,a.Z)(e,ae),g=(0,ee.Z)(),v=(0,s.useState)(!1),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=(0,s.useState)(!1),C=(0,o.Z)(y,2),w=C[0],L=C[1],S=(0,s.useState)(l),E=(0,o.Z)(S,2),P=E[0],A=E[1],N=(0,s.useState)(P),O=(0,o.Z)(N,2),R=O[0],I=O[1],B=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return L(!0),e.prev=1,e.next=4,u("function"===typeof m?m(R):R);case 4:!1===e.sent?I(P):(I(R),A(R)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),I(P);case 11:return e.prev=11,L(!1),k(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),F=j?(0,oe.jsx)(X.Z,(0,i.Z)((0,i.Z)({value:R,onChange:function(e){var n=e.target.value;n="string"===typeof n?n.split(","):n,I(n),c(n)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap"},children:e.filter((function(e){return p.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)($.Z,{label:p.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))})},MenuProps:le},Z),{},{children:p.map((function(e){return(0,oe.jsx)(Q.Z,{value:e.code,style:se(e.code,R,g),children:e.name},e.code)}))})):(0,oe.jsx)(x.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:R.filter((function(e){return p.some((function(n){return n.code===e}))})).map((function(e){return(0,oe.jsx)($.Z,{label:p.find((function(n){return n.code===e})).name,style:{marginRight:8},size:"small"},e)}))});return(0,oe.jsx)(re.Z,{className:"form",style:d,children:(0,oe.jsxs)(x.Z,{className:"form-item",children:[(0,oe.jsxs)(x.Z,{className:"form-item-label",children:[n,r&&(0,oe.jsx)(te.Z,{})]}),(0,oe.jsxs)(x.Z,{className:"form-item-body",children:[(0,oe.jsx)(x.Z,{className:"form-item-input",children:F}),(0,oe.jsx)(x.Z,{className:"form-item-action",children:j?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(J.Z,{"data-cy":"schema-form-item-confirm",onClick:B,disabled:t||w,size:"large",children:w?(0,oe.jsx)(Y.Z,{size:24}):(0,oe.jsx)(M.Z,{})}),(0,oe.jsx)(J.Z,{"data-cy":"schema-form-item-cancel",onClick:function(){I(P),k(!1)},disabled:t||w,size:"large",children:(0,oe.jsx)(q.default,{})})]}):(0,oe.jsx)(ie.Z,{triggers:f,onEnterEdit:function(){return k(!0)},disabled:t})})]}),j&&h&&(0,oe.jsx)(ne.Z,{children:h})]})})}ce.propTypes={style:u().object,onSubmit:u().func,onChange:u().func,label:u().string,initialValue:u().string,required:u().bool,disabled:u().bool,triggers:u().array,options:u().array,helperText:u().string,formatterBeforeSubmit:u().func},ce.defaultProps={style:{},onSubmit:function(){},onChange:function(){},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:function(e){return e.join(",")}};var de=t(41395),ue=t(24891),fe=t(19066),pe=t(22572),me=t(85710),he=t(8479),xe=["teamDid","size"];function Ze(e){var n=e.teamDid,t=e.size,r=void 0===t?"small":t,l=(0,a.Z)(e,xe),c=(0,L.PE)().t,d=(0,de.h6)().api,u=(0,s.useState)(!1),f=(0,o.Z)(u,2),p=f[0],m=f[1],h=(0,s.useState)(null),x=(0,o.Z)(h,2),Z=x[0],g=x[1],v=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){var t,r;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,m(!0),e.next=4,d.clearCache({input:{teamDid:n}});case 4:r=e.sent,H.Z.success(c("blocklet.config.clearCache.success",{count:(null===(t=r.removed)||void 0===t?void 0:t.length)||0})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),H.Z.error((0,me.Z)(e.t0));case 11:return e.prev=11,m(!1),g(null),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[0,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),b={title:c("blocklet.config.clearCache.title"),description:c("blocklet.config.clearCache.description"),confirm:c("common.confirm"),cancel:c("common.cancel"),onConfirm:v,onCancel:function(){m(!1),g(null)}};return(0,oe.jsxs)("div",(0,i.Z)((0,i.Z)({},l),{},{children:[(0,oe.jsxs)(z.Z,{onClick:function(){return g(b)},color:"error",variant:"outlined",size:r,children:[p?(0,oe.jsx)(Y.Z,{size:16,style:{marginRight:5}}):null,c("blocklet.config.clearCache.action")]}),Z&&(0,oe.jsx)(he.Z,{title:Z.title,description:Z.description,confirm:Z.confirm,cancel:Z.cancel,onConfirm:Z.onConfirm,onCancel:Z.onCancel})]}))}var ge,ve=t(43178),be=t(86473),je=t(77370),ke=t(45008);function ye(e){var n=e.initialValue,t=e.onChange,r=e.disabled,i=e.loading,a=(0,L.PE)().t,l=(0,je.T)().api,s=(0,ke.y0)().blocklet,c=(0,ve.Z)({newAppSk:"",isConnectOpen:!1}),d=(0,o.Z)(c,2),u=d[0],f=d[1],p=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(n);case 3:return e.prev=3,f({newAppSk:""}),e.finish(3);case 6:case"end":return e.stop()}}),e,null,[[0,,3,6]])})));return function(n){return e.apply(this,arguments)}}(),m=function(){return f({isConnectOpen:!1})},Z=s.structVersion===h.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:function(){(0,ue.An)(s.status)?H.Z.error(a("blocklet.error.isRunning")):(0,E.isInProgress)(s.status)?H.Z.error(a("blocklet.error.isInProgress")):f({isConnectOpen:!0})}}]:[];return[(0,oe.jsx)(V.Z,{disabled:r,loading:i,initialValue:n,onSubmit:function(e){return f({newAppSk:e}),!1},triggers:Z,secure:!0}),u.newAppSk&&(0,oe.jsx)(he.Z,{title:a("blocklet.config.appSkTitle"),description:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,oe.jsx)(x.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,oe.jsxs)(we,{children:[(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,oe.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("cancel"),onConfirm:function(){return p(u.newAppSk)},onCancel:function(){return f({newAppSk:""})}}),(0,oe.jsx)(be.default,{popup:!0,open:u.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:l.get,checkTimeout:3e5,onSuccess:m,extraParams:{appDid:s.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:m})]}ye.propTypes={initialValue:u().string,onChange:u().func,disabled:u().bool,loading:u().bool},ye.defaultProps={initialValue:"default",onChange:function(){},disabled:!1,loading:!1};var Ce,we=(0,c.Z)("ul")(ge||(ge=(0,r.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"]))),Le=t(50496),Se=t(43207),Ee=t(33359),Pe=t(23299),Ae=t(49884),_e=t(88876),Te=t(73820),Ne=t(80670);function Oe(e){var n=e.onCancel,t=e.onSuccess,r=e.onError,i=(0,s.useContext)(je.B).api,a=(0,s.useState)(!1),l=(0,o.Z)(a,2),c=l[0],d=l[1],u=(0,L.PE)(),f=u.t,p=u.locale,m=(0,s.useState)(""),h=(0,o.Z)(m,2),Z=h[0],g=h[1],v=(0,s.useState)(!1),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=(0,s.useState)(0),C=(0,o.Z)(y,2),w=C[0],S=C[1],E=(0,s.useState)(""),P=(0,o.Z)(E,2),A=P[0],_=P[1],T=(0,Ne.DJ)().endpoint,N=(0,s.useState)(!1),O=(0,o.Z)(N,2),R=O[0],I=O[1],B=function(e){g(null),d(!0);try{_(e.result),S(D.length-1)}catch(t){var n=(0,ue.Z)(t);g(n),r(t)}finally{d(!1)}},F=function(){k(!1),S(0)},D=[{body:(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(Ee.Z,{children:f("team.transferApp.transferDialog.tips.progress")}),(0,oe.jsx)(Ee.Z,{mt:3,mb:2,children:f("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:f("common.cancel"),confirm:f("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:function(){k(!0),S(1)}},{body:function(){return(0,oe.jsx)(be.default,{action:"transfer-app-owner",open:j,locale:p,checkFn:i.get,onClose:F,onSuccess:B,checkTimeout:3e5,extraParams:{},messages:{title:f("team.transferApp.connectDialog.title"),scan:f("team.transferApp.connectDialog.scan"),confirm:f("team.transferApp.connectDialog.confirm"),success:f("team.transferApp.connectDialog.success")},popup:!0})}},{body:function(){var e=(0,ue.VP)({transferId:A.transferId,endpoint:T});return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(x.Z,{component:Ie,dangerouslySetInnerHTML:{__html:f("team.transferApp.transferDialog.createSuccessTip1")}}),(0,oe.jsx)(x.Z,{component:Ie,mt:2,children:(0,oe.jsx)(Ie,{children:f("team.transferApp.transferDialog.createSuccessTip3")})}),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(x.Z,{component:Ie,mt:2,children:(0,oe.jsx)(Ie,{children:f("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,ue.B2)(A.expireDate,p)})})}),(0,oe.jsx)(x.Z,{my:1,children:(0,oe.jsx)(Te.Z,{children:e})})]}),(0,oe.jsx)("div",{children:(0,oe.jsx)(Ae.Z,{value:"end",control:(0,oe.jsx)(_e.Z,{checked:R,onChange:function(e){return I(e.target.checked)}}),label:f("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:f("common.confirm"),onConfirm:t}],U=D[w];return(0,oe.jsxs)(Le.ZP,{title:(0,oe.jsx)(Ie,{className:"title",children:f("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,oe.jsxs)(oe.Fragment,{children:[U.cancel&&(0,oe.jsx)(z.Z,{onClick:U.onCancel,color:"inherit",children:U.cancel}),(0,oe.jsxs)(z.Z,{onClick:U.onConfirm,color:"error",disabled:c||w===D.length-1&&!R,variant:"contained",autoFocus:!0,children:[c&&(0,oe.jsx)(Y.Z,{size:16}),U.confirm]})]}),children:[(0,oe.jsx)(Se.Z,{component:"div",children:"function"===typeof U.body?U.body():U.body}),!!Z&&(0,oe.jsx)(Pe.Z,{type:"error",variant:"icon",children:Z})]})}Oe.propTypes={onCancel:u().func.isRequired,onSuccess:u().func.isRequired,onError:u().func},Oe.defaultProps={onError:function(){}};var Re,Ie=c.Z.div(Ce||(Ce=(0,r.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"]))),Be=t(15300),Fe=["blocklet","onUpdate","hasPermission"],De=Object.keys(G.SUPPORTED_LANGUAGES).map((function(e){return{code:e,name:G.SUPPORTED_LANGUAGES[e].nativeName}})),Ue=(0,s.lazy)((function(){return Promise.all([t.e(4917),t.e(5547)]).then(t.bind(t,25547)).then((function(e){return{default:e.Uploader}}))})),ze="/blocklet/logo/upload";function Ke(e){var n,t=e.blocklet,r=e.onUpdate,l=e.hasPermission,c=(0,a.Z)(e,Fe),d=(0,de.h6)(),u=d.api,f=d.inService,p=d.prefix,Z=d.getSessionInHeader,g=d.ws.useSubscription,v=(0,s.useContext)(L.RD).t,b=(0,s.useState)(""),j=(0,o.Z)(b,2),k=j[0],y=j[1],C=(0,s.useState)(""),w=(0,o.Z)(C,2),S=w[0],P=w[1],A=(0,s.useState)(!1),N=(0,o.Z)(A,2),R=N[0],B=N[1],Y=(0,E.getWhoCanAccess)(t),q=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,M=S||!l,J=(0,s.useRef)(null),Q=(0,Be.Z)({blocklet:t}),X=Q.logoUrl,$=Q.rectLogoUrl,ee=Q.faviconUrl,ne=(0,s.useState)(),te=(0,o.Z)(ne,2),re=te[0],ie=te[1],ae=m()(p,ze,"square",t.meta.did),le=m()(p,ze,"rect",t.meta.did),se=m()(p,ze,"favicon",t.meta.did),me=function(e){l&&(ie({uploader:e,disableMediaKitPrefix:!0}),J.current.open())},he=t.meta.did,xe=t.site,ge=O()(t.meta,"capabilities.clusterMode",!1);if(g(h.EVENTS.NODE_RUNTIME_INFO,(function(e){ge&&y(O()(e,"cpu.physicalCores",""))})),(0,ue.wS)(t.status))return null;var ve=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE})),be=!ve||"yes"===ve.value,je=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES})),ke=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL})),Ce=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER})),we=t.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR})),Le=[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:v("blocklet.config.name"),value:t.environments.find((function(e){return"BLOCKLET_APP_NAME"===e.key})).value},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:v("blocklet.config.description"),value:t.environments.find((function(e){return"BLOCKLET_APP_DESCRIPTION"===e.key})).value},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:v("blocklet.config.appUrl"),value:ke?ke.value:""},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:v("blocklet.config.copyrightOwner"),value:Ce?Ce.value:""},{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:v("blocklet.config.copyrightYear"),value:we?we.value:""}];if(ge){var Se=t.configs.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE})),Ee=Se?Se.value:k;Le.push({key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:v("blocklet.config.clusterSize"),value:Ee,cpuCores:k})}var Pe=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var i,o,a;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return P(!0),e.prev=3,i=n.target.checked,e.next=7,u.configPublicToStore({input:{did:t.meta.did,publicToStore:i}});case 7:o=e.sent,a=o.blocklet,r(a),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),H.Z.error(e.t0.message);case 15:return e.prev=15,P(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[3,12,15,18]])})));return function(n){return e.apply(this,arguments)}}(),Ae=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n,i){var o,a,l,s;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n!==G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){e.next=5;break}if(!(o=(0,ue.I)({value:i,cpuCores:k}))){e.next=5;break}return H.Z.error(o),e.abrupt("return");case 5:return a=[{key:n,value:i}],e.prev=6,P(!0),e.next=10,u.configBlocklet({input:{did:t.meta.did,configs:a}});case 10:l=e.sent,s=l.blocklet,r(s),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(6),H.Z.error(e.t0.message);case 18:return e.prev=18,P(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[6,15,18,21]])})));return function(n,t){return e.apply(this,arguments)}}(),_e=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var i,o,a;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return P(!0),e.prev=3,i=n.target.checked,e.next=7,u.configBlocklet({input:{did:t.meta.did,configs:[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:i?"no":"yes"}]}});case 7:o=e.sent,a=o.blocklet,r(a),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(3),H.Z.error(e.t0.message);case 15:return e.prev=15,P(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[3,12,15,18]])})));return function(n){return e.apply(this,arguments)}}(),Te=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var r,i,o;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=xe.corsAllowedOrigins||[],i=n.split(",").map((function(e){return e.trim()})).filter(Boolean),!I()(r,i)){e.next=4;break}return e.abrupt("return",!1);case 4:return e.prev=4,P(!0),o=i.length?i:["__none__"],e.next=9,u.updateRoutingSite({input:{id:xe.id,corsAllowedOrigins:o,teamDid:t.meta.did}});case 9:P(!1),e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(4),H.Z.error(e.t0.message),P(!1),e.abrupt("return",!1);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,null,[[4,12]])})));return function(n){return e.apply(this,arguments)}}(),Ne=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var i,o;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S){e.next=2;break}return e.abrupt("return");case 2:return P(!0),e.prev=3,e.next=6,u.configBlocklet({input:{did:t.meta.did,configs:[{key:G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:n}]}});case 6:i=e.sent,o=i.blocklet,r(o),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),H.Z.error(e.t0.message);case 14:return e.prev=14,P(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,11,14,17]])})));return function(n){return e.apply(this,arguments)}}(),Re={"&::after":{content:'"'.concat(v("common.switch"),'"')}};return(0,oe.jsxs)(Ve,(0,i.Z)((0,i.Z)({},c),{},{children:[Le.map((function(e){return(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,oe.jsx)(V.Z,{style:{marginTop:0},disabled:S||M,loading:S,initialValue:e.value,onSubmit:function(n){return Ae(e.key,n)}})]})})),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:v("blocklet.config.logoSquare")}),(0,oe.jsx)(x.Z,{className:F()("uploader-wrapper",l&&"enabled"),sx:Re,onClick:function(){return me(ae)},children:(0,oe.jsx)(W.Z,{sx:{height:80,width:80},variant:"square",alt:"Blocklet Logo",src:X})}),(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mt:4,children:v("blocklet.config.logoRect")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("blocklet.config.logoRectDesc")}),(0,oe.jsx)(x.Z,{className:F()("uploader-wrapper",l&&"enabled"),sx:Re,onClick:function(){return me(le)},children:(0,oe.jsx)("img",{alt:"Blocklet Rect Logo",src:$,style:{height:"80px"}})}),(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mt:4,children:v("blocklet.config.logoFavicon")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("blocklet.config.logoFaviconDesc")}),(0,oe.jsx)(x.Z,{sx:{display:"inline-flex",cursor:l?"pointer":"default"},onClick:function(){return me(se)},children:(0,oe.jsx)(W.Z,{variant:"square",sx:{width:20,height:20},alt:"Blocklet Favicon Logo",src:ee})}),(0,oe.jsx)(Ue,{id:"\u200buploader-logo",ref:J,popup:!0,onUploadFinish:function(){J.current.close()},plugins:[],apiPathProps:re,coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:Z}},"uploader-logo"),(0,oe.jsx)(x.Z,{className:"config-form",children:"all"===Y&&"registry"===t.source&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.access.publicToStore"),(0,oe.jsx)(x.Z,{className:"config-desc",children:v("blocklet.config.access.publicInstanceTip")})]}),(0,oe.jsx)(D.Z,{disabled:M,checked:q,defaultChecked:!0,onChange:Pe})]})}),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("blocklet.config.languages")}),(0,oe.jsx)(ce,{style:{marginTop:0},disabled:S||M,loading:S,options:De,initialValue:je?je.value.split(","):["en","zh"],onSubmit:function(e){return Ae("BLOCKLET_APP_LANGUAGES",e)},helperText:v("blocklet.config.selectLanguagesTip")})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:v("common.security")})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("router.domainSecurity.cors.title")}),(0,oe.jsx)(x.Z,{mb:1.5,className:"config-desc",children:v("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,oe.jsx)(V.Z,{style:{marginTop:0},disabled:S||M,loading:S,initialValue:(xe.corsAllowedOrigins||[]).join(", "),onSubmit:Te})]}),(0,oe.jsx)(x.Z,{className:"config-form",component:U.Z,my:3}),(0,oe.jsx)(x.Z,{mb:2,className:"config-label",fontSize:20,children:v("blocklet.config.dangerZone")}),(0,oe.jsxs)(x.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:!f&&(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.deletable.name"),(0,oe.jsx)(x.Z,{className:"config-desc",children:v(be?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,oe.jsx)(D.Z,{disabled:M,checked:!be,defaultChecked:!0,onChange:_e})]})}),(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsx)(x.Z,{className:"config-label",fontSize:14,mb:0,children:v("blocklet.config.sk")}),(0,oe.jsx)(ye,{disabled:S||M,loading:S,initialValue:t.environments.find((function(e){return"BLOCKLET_APP_SK"===e.key})).value,onChange:Ne})]}),f&&(0,oe.jsx)(pe.Z,{role:"owner",children:function(e){return(e||fe.C)&&(0,oe.jsxs)(x.Z,{className:"config-form",mt:2,children:[(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsx)(x.Z,{className:"config-label",mb:0,children:v("team.transferApp.name")}),(0,oe.jsxs)(z.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:function(){return B(!0)},children:[(0,oe.jsx)(K.Z,{style:{fontSize:"1.3em",marginRight:4}}),v("team.transferApp.name")]})]}),R&&(0,oe.jsx)(Oe,{onCancel:function(){return B(!1)},onSuccess:function(){return B(!1)}})]})}}),(0,oe.jsx)(x.Z,{className:"config-form",mt:2,children:(0,oe.jsxs)(x.Z,{className:"config-item",children:[(0,oe.jsxs)(x.Z,{className:"config-label",children:[v("blocklet.config.clearCache.name"),(0,oe.jsx)(x.Z,{className:"config-desc",children:v("blocklet.config.clearCache.purpose")})]}),(0,oe.jsx)(Ze,{teamDid:he})]})})]})]}))}var We=(0,pe.V)(Ke,"mutate_blocklets"),Ge=(0,pe.V)(Ke,"",ue.Wf);function He(e){return(0,de.h6)().inService?(0,oe.jsx)(Ge,(0,i.Z)({},e)):(0,oe.jsx)(We,(0,i.Z)({},e))}Ke.propTypes={blocklet:u().object.isRequired,onUpdate:u().func,hasPermission:u().bool},Ke.defaultProps={onUpdate:function(){},hasPermission:!1};var Ve=c.Z.div(Re||(Re=(0,r.Z)(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])),(function(e){return e.theme.breakpoints.down("md")})),Ye=t(78789),qe=t(46121),Me=t(87535),Je=t(87006),Qe=t(72097),Xe=t(49735),$e=t.n(Xe),en=t(35147),nn=t(14764),tn=t(52553),rn=t.n(tn),on=t(27021),an=t.n(on),ln=t(44632),sn=t.n(ln),cn={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};var dn=function(){var e,n,t,r=(0,de.h6)().api,o=(0,ke.y0)().blocklet,a=(0,L.PE)().t,l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign((0,i.Z)({},cn),(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.notification)||void 0===t?void 0:t.email)||{}),c=(0,nn.cI)({defaultValues:$e()(s,Object.keys(cn))}),d=c.handleSubmit,u=c.control,f=c.formState,p=c.watch,m=c.reset,h=p("enabled"),Z=(0,en.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,o,s,c,d;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.configNotification({input:{did:l,notification:JSON.stringify({email:n})}});case 3:s=e.sent,c=s.blocklet,d=Object.assign((0,i.Z)({},cn),(null===c||void 0===c||null===(t=c.settings)||void 0===t||null===(o=t.notification)||void 0===o?void 0:o.email)||{}),m(d),H.Z.success(a("oauth.saveSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message||a("oauth.saveFailed"));case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}()),g=(0,en.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!rn()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),v=(0,en.Z)((function(e){var n=null===e||void 0===e?void 0:e.trim();return n?!!an()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),b=(0,en.Z)((function(e){return e?!!sn()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired")})),j=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired")})),k=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired")})),y=(0,en.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(Z),disabled:!0,children:[(0,oe.jsx)(nn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(Ae.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)({checked:n.value},n)),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,oe.jsx)(nn.Qr,{name:"from",control:u,rules:{validate:h?g:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("notification.email.from"),error:!!f.errors[t.name],helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"host",control:u,rules:{validate:h?v:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"port",control:u,rules:{validate:h?b:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"number",error:!!f.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"user",control:u,rules:{validate:h?j:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"password",control:u,rules:{validate:h?k:y},render:function(e){var n,t=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{type:"password",error:!!f.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"secure",control:u,rules:{validate:y},render:function(e){var n=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Ae.Z,{control:(0,oe.jsx)(D.Z,(0,i.Z)((0,i.Z)({checked:n.value},n),{},{disabled:!h})),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,oe.jsx)(Qe.Z,{type:"submit",variant:"contained",onSubmit:d(Z),disabled:!f.isDirty,children:a("oauth.save")})]})})},un=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];var fn,pn,mn=function(){var e=(0,s.useState)(un[0].value),n=(0,o.Z)(e,2),t=n[0],r=n[1],i=(0,s.useContext)(L.RD).t,a=(0,qe.Z)((function(){return{email:(0,oe.jsx)(dn,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(Ye.Z,{children:i("notification.comingSoon")})})}}),[i]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(S.Z,{tabs:un,current:t,onChange:r}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:a[t]})]})},hn=t(6779),xn=t(6698),Zn=t(11909),gn=t(1484),vn=t(2569),bn=t(88356),jn=t(98127),kn=t(86008),yn=t(70115),Cn="roles",wn=[].concat((0,l.Z)(yn.Z),[{value:Cn,icon:jn.Z,title:{zh:"\u6307\u5b9a\u901a\u884c\u8bc1\u53ef\u8bbf\u95ee",en:"Accessible to selected passports"},description:{zh:"\u53ea\u6709\u6307\u5b9a\u7684\u901a\u884c\u8bc1\u53ef\u4ee5\u8bbf\u95ee",en:"Only specified passports can access"}}]),Ln=function(e,n){if(e&&e.startsWith(h.WHO_CAN_ACCESS_PREFIX_ROLES)){var t=(0,E.getRolesFromAuthConfig)({whoCanAccess:e}),r=n.filter((function(e){return t.includes(e.name)}));return{access:Cn,roles:r}}return{access:e,roles:[]}},Sn=function(e,n){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).roles,r=void 0===t?[]:t,i=(e.configs||[]).find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO}));if(i)return Ln(i.value,r);if(n&&O()(n,"settings.whoCanAccess")&&O()(n,"settings.whoCanAccess")!==h.WHO_CAN_ACCESS.ALL)return Ln(O()(n,"settings.whoCanAccess"),r);var o=(0,E.findServiceFromMeta)(e.meta,h.NODE_SERVICES.AUTH);return O()(o,"config.whoCanAccess")?Ln(o.config.whoCanAccess,r):{access:h.WHO_CAN_ACCESS.ALL,roles:[]}};function En(e){var n=e.blocklet,t=e.ancestors,r=e.children,i=(0,ee.Z)(),a=(0,s.useState)(""),c=(0,o.Z)(a,2),d=c[0],u=c[1],f=(0,L.PE)(),p=f.t,m=f.locale,Z=(0,de.h6)().api,g=(0,Ne.DJ)().roles,v=(0,s.useState)(""),b=(0,o.Z)(v,2),j=b[0],k=b[1],y=t[0]||n,C=Sn(n,y,{roles:g}),w=C.access,S=C.roles,P=(0,s.useState)(w),A=(0,o.Z)(P,2),N=A[0],O=A[1],R=(0,s.useState)(S),I=(0,o.Z)(R,2),B=I[0],F=I[1],D=[].concat((0,l.Z)(t.map((function(e){return e.meta.did}))),[n.meta.did]),U={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:i.palette.text.secondary},K=t.concat(n).map((function(e){return(0,E.getDisplayName)(e,!0)})).join(" / ");if((0,ue.wS)(n.status))return null;if("unknown"===n.status&&(0,ue.wS)(n.status))return null;var W=function(){u(!1)},G=function(e){e.stopPropagation(),u(!0)},V=function(){var e=(0,T.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!j){e.next=2;break}return e.abrupt("return");case 2:return k(!0),e.prev=3,(n=N)===Cn&&(n="".concat(h.WHO_CAN_ACCESS_PREFIX_ROLES).concat(B.map((function(e){return e.name})).join(","))),e.next=8,Z.updateWhoCanAccess({input:{did:D,whoCanAccess:n}});case 8:H.Z.success(p("blocklet.config.access.updatedTip")),W(),k(!1),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(3),k(!1),H.Z.error((0,ue.Z)(e.t0));case 17:case"end":return e.stop()}}),e,null,[[3,13]])})));return function(){return e.apply(this,arguments)}}(),q=j||N===Cn&&!B.length;return["function"===typeof r?r({open:G}):(0,oe.jsx)(J.Z,{onClick:G,"data-cy":"action-config-component",children:(0,oe.jsx)(bn.default,{})}),d&&(0,oe.jsxs)(An,{open:!0,fullWidth:!0,title:K,onClose:W,PaperProps:{style:{minHeight:"auto"}},actions:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(z.Z,{onClick:W,color:"inherit","data-cy":"config-access-cancel",children:p("common.cancel")}),(0,oe.jsxs)(z.Z,{onClick:V,color:"primary",disabled:q,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[j&&(0,oe.jsx)(Y.Z,{size:16}),p("common.confirm")]})]}),children:[(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(Je.Z,{label:p("blocklet.config.access.description"),select:!0,fullWidth:!0,value:N,onChange:function(e){var n=e.target.value;O(n)},"data-cy":"config-access-select",SelectProps:{renderValue:function(e){var n=wn.find((function(n){return n.value===e}));return n?(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(n.icon,{style:U}),n.title[m]]}):null}},children:wn.map((function(e){return(0,oe.jsxs)(_n,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center",children:[(0,oe.jsx)(e.icon,{style:U}),(0,oe.jsx)(x.Z,{children:e.title[m]})]}),(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(x.Z,{className:"tip",children:e.description[m]})})]})}))})}),N===Cn&&(0,oe.jsx)(x.Z,{mt:4,mb:3,children:(0,oe.jsx)(Je.Z,{label:p("blocklet.config.access.description"),select:!0,fullWidth:!0,value:B.map((function(e){return e.name})),onChange:function(e){F(g.filter((function(n){return(e.target.value||[]).includes(n.name)})))},SelectProps:{multiple:!0,renderValue:function(e){return(0,oe.jsx)(x.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((function(e){var n=g.find((function(n){return n.name===e}));return(0,oe.jsx)($.Z,{label:n.title},n.text)}))})}},children:g.map((function(e){var n=e.name,t=e.title;return(0,oe.jsxs)(Q.Z,{value:n,children:[(0,oe.jsx)(_e.Z,{checked:B.some((function(e){return e.name===n}))}),(0,oe.jsx)(kn.Z,{primary:t})]},n)}))})})]})]}En.propTypes={blocklet:u().object.isRequired,ancestors:u().array,children:u().any},En.defaultProps={ancestors:[],children:null};var Pn,An=(0,c.Z)(Le.ZP)(fn||(fn=(0,r.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),_n=(0,c.Z)(Q.Z)(pn||(pn=(0,r.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(function(e){return e.theme.palette.text.secondary}));function Tn(e){var n,t,r=e.blocklet,i=e.ancestors,a=e.depth,c=(0,ee.Z)(),d=(0,L.PE)(),u=d.t,f=d.locale,p=(0,Ne.DJ)().roles,m=(0,s.useState)(!0),h=(0,o.Z)(m,2),Z=h[0],g=h[1],v=(0,ke.y0)().recommendedDomain,b=i[0]||r,j="/".concat(i.map((function(e){return e.mountPoint||"/"})).join("/"),"/").concat(r.mountPoint||"/").replace(/\/+/g,"/"),k=(0,ue.vH)({blocklet:b,domain:{value:v},mountPoint:j,params:(0,ue.f0)(b,f)}),w={fill:c.palette.text.secondary},S=a>0&&r.children.length>0,A=(0,oe.jsx)(J.Z,{size:"small",children:Z?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(y.default,{fontSize:"inherit"})}),_=Sn(r,b,{roles:p}),T=_.access,N=_.roles;if("roles"!==T)t=yn.Z.find((function(e){return e.value===T}))||yn.Z[2];else{var O=N.map((function(e){return e.title})).join("/");t={title:{zh:"\u53ea\u6709 ".concat(O," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(O," can access")}}}return[(a>0||"gateway"!==r.meta.group)&&(0,oe.jsxs)(x.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,oe.jsxs)(x.Z,{pl:Math.max(2*(a-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:S?"pointer":"cursor"},onClick:function(){return S&&g(!Z)},children:[S?A:(0,oe.jsx)(x.Z,{width:28}),(0,oe.jsx)(P.Z,{blocklet:r,ancestors:i}),(0,oe.jsxs)(x.Z,{ml:"16px",children:[(0,oe.jsx)(x.Z,{style:{color:"#222",fontSize:18},children:(0,E.getDisplayName)(r,!0)}),(0,oe.jsx)(x.Z,{display:"flex",alignItems:"center",children:(0,oe.jsx)(x.Z,{color:"text.secondary",children:t.title[f]})})]})]},r),(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(hn.Z,{title:u("common.visit"),children:(0,oe.jsx)("a",{target:"_blank",href:k,rel:"noopener noreferrer",title:k,children:(0,oe.jsx)(J.Z,{children:(0,oe.jsx)(Zn.Z,{})})})}),(0,oe.jsx)(En,{blocklet:r,ancestors:i,children:function(e){var n=e.open;return(0,oe.jsx)(hn.Z,{title:u("common.edit"),children:(0,oe.jsx)(J.Z,{onClick:n,"data-cy":"btn-edit-".concat(r.meta.did),children:(0,oe.jsx)(gn.Z,{style:w})})})}})]},"actions")]},"group-not-gateway-box"),(0,oe.jsx)(vn.Z,{depth:a}),null!==(n=r.children)&&void 0!==n&&n.length?(0,oe.jsx)(xn.Z,{in:Z,children:r.children.map((function(e){return(0,oe.jsx)(Tn,{blocklet:e,ancestors:[].concat((0,l.Z)(i),[r]),depth:a+1},"".concat(a+1,"-").concat(e.meta.did))}))},"blocklet-collapse"):null]}function Nn(){var e=(0,L.PE)().t,n=(0,ke.y0)().blocklet,t=(0,l.Z)(n.children)||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,oe.jsx)(On,{component:"div",children:t&&t.length?[(0,oe.jsx)(x.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,oe.jsx)(Tn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,oe.jsx)(x.Z,{mt:8,children:(0,oe.jsx)(Ye.Z,{children:e("blocklet.component.noComponent")})})})}Tn.propTypes={blocklet:u().object.isRequired,ancestors:u().array,depth:u().number},Tn.defaultProps={ancestors:[],depth:0},Nn.propTypes={};var On=(0,c.Z)(x.Z)(Pn||(Pn=(0,r.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n &.first {\n margin-top: 0;\n }\n }\n"])),(function(e){return e.theme.spacing(5)}),(function(e){return e.theme.spacing(3)})),Rn=t(92746);var In=function(){var e,n,t,r=(0,de.h6)().api,o=(0,ke.y0)().blocklet,a=(0,L.PE)().t,l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,s=Object.assign({enabled:!1,domain:"",clientId:""},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.oauth)||void 0===t?void 0:t.auth0)||{}),c=(0,nn.cI)({defaultValues:$e()(s,["domain","clientId","enabled"])}),d=c.handleSubmit,u=c.control,f=c.formState,p=c.watch,m=c.reset,h=p("enabled"),Z=(0,en.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var t,i,o,s,c;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:n})}});case 3:o=e.sent,s=o.blocklet,c=Object.assign({enabled:!1,domain:"",clientId:""},(null===s||void 0===s||null===(t=s.settings)||void 0===t||null===(i=t.oauth)||void 0===i?void 0:i.auth0)||{}),m(c),H.Z.success(a("oauth.saveSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message||a("oauth.saveFailed"));case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}()),g=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe")})),v=(0,en.Z)((function(e){return!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe")})),b=(0,en.Z)((function(){return!0}));return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:d(Z),disabled:!0,children:[(0,oe.jsx)(nn.Qr,{name:"enabled",control:u,render:function(e){var n=e.field;return(0,oe.jsx)(Ae.Z,{control:(0,oe.jsx)(Rn.Z,(0,i.Z)({checked:n.value,style:{marginRight:"6px"}},n)),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,oe.jsx)(nn.Qr,{name:"domain",control:u,rules:{validate:h?g:b},render:function(e){var n,t=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{label:a("oauth.auth0.domain"),error:!!f.errors[t.name],helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(nn.Qr,{name:"clientId",control:u,rules:{validate:h?v:b},render:function(e){var n,t=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,children:(0,oe.jsx)(Je.Z,(0,i.Z)((0,i.Z)({},t),{},{error:!!f.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=f.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!h}))})}}),(0,oe.jsx)(Qe.Z,{type:"submit",variant:"contained",onSubmit:d(Z),disabled:!f.isDirty,children:a("oauth.save")})]})})},Bn=t(29529),Fn=t(25139),Dn={ttl:604800};function Un(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return(0,i.Z)((0,i.Z)({},e),{},{ttl:n})}function zn(){var e,n,t=(0,de.h6)().api,r=(0,ke.y0)().blocklet,o=null===r||void 0===r||null===(e=r.meta)||void 0===e?void 0:e.did,a=Object.assign({},Dn,(null===r||void 0===r||null===(n=r.settings)||void 0===n?void 0:n.session)||{}),l=(0,nn.cI)({defaultValues:$e()(Un(a),["ttl"])}),s=l.handleSubmit,c=l.control,d=l.formState,u=l.reset,f=(0,L.PE)().t,p=(0,en.Z)(function(){var e=(0,T.Z)((0,_.Z)().mark((function e(n){var r,i,a,l;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.updateAppSessionConfig({input:{did:o,config:Un(n,!0)}});case 3:i=e.sent,a=i.blocklet,l=Object.assign({},Dn,$e()((null===a||void 0===a||null===(r=a.settings)||void 0===r?void 0:r.session)||{},["ttl"])),u(Un(l)),H.Z.success(f("common.configSuccess")),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),H.Z.error(e.t0.message);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(n){return e.apply(this,arguments)}}());return(0,oe.jsx)(x.Z,{children:(0,oe.jsxs)("form",{onSubmit:s(p),disabled:!0,children:[(0,oe.jsx)(nn.Qr,{name:"ttl",control:c,render:function(e){var n=e.field;return(0,oe.jsx)(Me.Z,{fullWidth:!0,sx:{mb:2},children:(0,oe.jsxs)(Fn.Z,{px:3,children:[(0,oe.jsx)(x.Z,{mx:-3,my:.5,children:f("blocklet.config.session.ttl",{day:n.value})}),(0,oe.jsx)(Bn.ZP,(0,i.Z)((0,i.Z)({},n),{},{defaultValue:7,step:1,marks:[{value:1,label:f("blocklet.config.session.day",{day:1})},{value:7,label:f("blocklet.config.session.days",{day:7})},{value:14,label:f("blocklet.config.session.days",{day:14})},{value:21,label:f("blocklet.config.session.days",{day:21})},{value:30,label:f("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}}))]})})}}),(0,oe.jsx)(Qe.Z,{type:"submit",variant:"contained",onSubmit:s(p),disabled:!d.isDirty,children:f("oauth.save")})]})})}var Kn=t(48537),Wn=t(95002),Gn=t(2291),Hn=t(75260),Vn=t(28595),Yn=t(61398),qn=t.n(Yn),Mn=(0,s.forwardRef)((function(e,n){var t=(0,s.useContext)(L.RD).t,r=(0,Vn.Z)({show:!1,title:"",content:"",onConfirm:qn(),onCancel:qn(),loading:!1}),i=(0,en.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.show=!0,r.title=e.title,r.content=e.content,r.onConfirm=e.onConfirm||qn(),r.onCancel=e.onCancel||qn(),r.loading=!1})),o=(0,en.Z)((function(){r.title="",r.content="",r.onConfirm=qn(),r.onCancel=qn()})),a=(0,en.Z)((function(){r.show=!1,setTimeout((function(){o()}),300)})),l=(0,en.Z)((function(){a(),null===r||void 0===r||r.onCancel()}),[]),c=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r.loading=!0,e.prev=1,e.next=4,null===r||void 0===r?void 0:r.onConfirm(a);case 4:return e.prev=4,r.loading=!1,e.finish(4);case 7:case"end":return e.stop()}}),e,null,[[1,,4,7]])}))),[]);return(0,s.useImperativeHandle)(n,(function(){return{open:i,close:a}}),[i,a]),(0,oe.jsx)(Le.I4,{open:r.show,title:r.title,onConfirm:c,onCancel:l,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:r.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:r.content})}));var Jn=t(70177),Qn=t(59182),Xn=t.n(Qn),$n=t(76032),et=t.n($n),nt=t(55581),tt=t(63531),rt=t(92522),it=t.n(rt),ot=(0,s.forwardRef)((function(e,n){var t,r,i=(0,s.useContext)(L.RD).t,o=(0,ke.y0)().blocklet,a=(0,de.h6)().api,l=(0,Vn.Z)({mode:"view",show:!1,data:{},callback:qn()}),c=(0,nt.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,u=(0,en.Z)((function(){l.mode="view",l.data={},l.callback=qn()}),[]),f=(0,en.Z)((function(){l.show=!1,setTimeout((function(){u()}),d)}),[]),p=(0,en.Z)((function(e){l.mode="view",l.show=!0,l.data=e}),[]),h=(0,en.Z)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qn();l.mode="approve",l.show=!0,l.data=e,l.callback=n}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:p,close:f,approve:h}}),[p,f,h]);var Z=(0,qe.Z)((function(){if(!l.show)return[];l.data.migratedFrom=[l.data.appId,l.data.appPid];var e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==l.data.isMaster&&Xn()(e,"appliedAt","status"),e.map((function(e){var n=i("federated.info.".concat(e)),t=l.data[e];if("appName"===e&&l.data.isMaster&&(t=(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(Kn.Z,{component:Wn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,oe.jsx)(tt.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,oe.jsx)(x.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){var r=it()(t)?t:m()(l.data.appUrl||"",t||"");try{var o=new URL(r);o.searchParams.set("imageFilter","resize"),o.searchParams.set("w","80"),o.searchParams.set("h","80"),t=(0,oe.jsx)("img",{src:o.href,width:"60",height:"60",alt:l.data.appName})}catch(a){t=(0,oe.jsx)("img",{src:r,width:"60",height:"60",alt:l.data.appName})}}("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e)&&(t=(l.data.migratedFrom||[]).filter((function(e){return![l.data.appId,l.data.appPid].includes(e)})).map((function(e){return(0,oe.jsx)(tt.kL,{children:e})})));return et()(t)&&(t="-"),{name:n,value:t}}))}),[l.data]),g="approve"===l.mode,v=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.auditFederatedLogin({input:{memberPid:l.data.appPid,did:o.appPid,status:"rejected"}});case 2:f(),null===l||void 0===l||l.callback(!1);case 4:case"end":return e.stop()}}),e)})))),b=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.auditFederatedLogin({input:{memberPid:l.data.appPid,did:o.appPid,status:"approved"}});case 2:f(),null===l||void 0===l||l.callback(!0);case 4:case"end":return e.stop()}}),e)}))));return(0,oe.jsx)(Le.ZP,{open:l.show,title:i(g?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:f,actions:g?(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Qe.Z,{color:"error",variant:"contained",onClick:v,children:i("common.reject")}),(0,oe.jsx)(Qe.Z,{variant:"contained",onClick:b,children:i("common.approve")})]}):(0,oe.jsx)(Qe.Z,{variant:"outlined",onClick:f,children:i("common.close")}),children:Z.map((function(e){return(0,oe.jsx)(Jn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)}))})})),at=ot,lt=t(29951),st=t(34760),ct=t.n(st),dt=(0,s.forwardRef)((function(e,n){var t,r,i=(0,nt.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,a=(0,s.useContext)(L.RD).t,l=(0,Vn.Z)({show:!1,data:{link:""}}),c=(0,en.Z)((function(){l.data.link=""}),[]),d=(0,en.Z)((function(){l.show=!1,setTimeout((function(){c()}),o)}),[]),u=(0,en.Z)((function(e){var n=e.link;l.show=!0,l.data.link=n}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:u,close:d}}),[u,d]);var f=(0,en.Z)((function(){ct()(l.data.link),d()}),[d]);return(0,oe.jsxs)(Le.ZP,{open:l.show,title:a("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(z.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:f,children:a("common.copyAndClose")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,oe.jsx)(x.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,oe.jsx)(lt.Z,{language:"shell",style:{marginBottom:0},children:l.data.link})})]})}));function ut(e){var n,t,r,i,o,a=e.mode,l=(0,s.useRef)(null),c=(0,s.useRef)(null),d=(0,s.useContext)(L.RD),u=d.t,f=d.locale,p=(0,ke.y0)(),m=p.blocklet,h=p.actions.refreshBlocklet,Z=function(){var e=(0,s.useRef)(null),n=(0,en.Z)((function(){for(var n,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];null===(n=e.current)||void 0===n||n.open.apply(n,r)})),t=(0,en.Z)((function(){for(var n,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];null===(n=e.current)||void 0===n||n.close.apply(n,r)})),r={open:n,close:t};return{confirmHolder:(0,oe.jsx)(Mn,{ref:e}),confirmApi:r}}(),g=Z.confirmApi,v=Z.confirmHolder,b=(0,de.h6)().api,j=(null===(n=m.settings.federated)||void 0===n?void 0:n.sites)||[],k=(null===(t=m.settings.federated)||void 0===t?void 0:t.config)||{},y=!1!==k.isMaster,C=(0,en.Z)((function(e){var n;null===(n=c.current)||void 0===n||n.open(e)})),w=(0,en.Z)((function(e){var n;null===(n=c.current)||void 0===n||n.approve(e,h)})),S=(0,en.Z)((function(e){g.open({title:u("federated.disableFederatedLogin"),content:u("federated.disableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b.auditFederatedLogin({input:{memberPid:e.appPid,did:m.appPid,status:"revoked"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),E=(0,en.Z)((function(e){g.open({title:u("federated.enableFederatedLogin"),content:u("federated.enableFederatedLoginDescription"),onConfirm:function(n){return(0,T.Z)((0,_.Z)().mark((function t(){return(0,_.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b.auditFederatedLogin({input:{memberPid:e.appPid,did:m.appPid,status:"approved"}});case 2:n();case 3:case"end":return t.stop()}}),t)})))()}})})),P=(0,qe.Z)((function(){var e=[{label:u("common.name"),name:"appName",options:{customBodyRenderLite:function(e){var n=j[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"inline-block",children:(0,oe.jsxs)(x.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:function(e){e.stopPropagation()},children:[t&&(0,oe.jsx)(Kn.Z,{component:Wn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:u("common.did"),name:"appId",options:{customBodyRenderLite:function(e){var n=j[e];return(0,oe.jsx)(Hn.Z,{children:n.appId})}}},{label:u("common.status"),name:"status",options:{customBodyRenderLite:function(e){var n=j[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{children:t?"-":u("federated.status.".concat(n.status))})}}}];return y&&e.push({label:u("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var n=j[e],t=!1!==n.isMaster;return(0,oe.jsx)(x.Z,{display:"flex",gap:1,children:t?(0,oe.jsxs)(oe.Fragment,{children:["rejected"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation()},children:u("federated.status.rejected")}),"revoked"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"secondary",size:"small",onClick:function(e){e.stopPropagation()},children:u("federated.status.revoked")})]}):(0,oe.jsxs)(oe.Fragment,{children:["pending"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"primary",size:"small",onClick:function(e){e.stopPropagation(),w(n)},children:u("federated.status.pending")}),"approved"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"error",size:"small",onClick:function(e){e.stopPropagation(),S(n)},style:{whiteSpace:"nowrap"},children:u("federated.revoke")}),"revoked"===n.status&&(0,oe.jsx)(z.Z,{variant:"contained",color:"warning",size:"small",onClick:function(e){e.stopPropagation(),E(n)},style:{whiteSpace:"nowrap"},children:u("federated.approve")})]})})}}}),e}),[k.appId,j,y]),A=(0,qe.Z)((function(){return{sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick:function(e,n){var t=n.dataIndex,r=j[t];C(r)}}}),[]),N=(0,en.Z)((function(){var e,n=m.environments.find((function(e){return e.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL}));null!==n&&void 0!==n&&n.value?null===(e=l.current)||void 0===e||e.open({link:n.value}):H.Z.error(u("federated.failedToGetFederatedLoginLink"))}),[null===(r=m.site)||void 0===r||null===(i=r.domainAliases)||void 0===i||null===(o=i[0])||void 0===o?void 0:o.href]),O=(0,en.Z)((function(){g.open({title:u("federated.quitFederatedLogin"),content:u("federated.quitFederatedLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,b.quitFederatedLogin({input:{did:m.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),R=(0,en.Z)((function(){g.open({title:u("federated.disbandFederatedLogin"),content:u("federated.disbandFederatedLoginDescription"),onConfirm:function(e){return(0,T.Z)((0,_.Z)().mark((function n(){return(0,_.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,b.disbandFederatedLogin({input:{did:m.appPid}});case 2:e();case 3:case"end":return n.stop()}}),n)})))()}})})),I=[];return"master"!==a?I.push((0,oe.jsx)(z.Z,{size:"small",variant:"contained",color:"error",onClick:O,sx:{ml:1},children:u("federated.quitFederatedLogin")},"quitFederatedLogin")):(I.push((0,oe.jsx)(z.Z,{size:"small",variant:"contained",onClick:N,sx:{ml:1},children:u("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),I.push((0,oe.jsx)(z.Z,{color:"error",size:"small",variant:"contained",onClick:R,sx:{ml:1},children:u("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Gn.Z,{className:"main-table",locale:f,data:j,columns:P,customButtons:I,title:(0,oe.jsx)(x.Z,{className:"table-toolbar-left",children:u("oauth.federated")}),options:A}),v,(0,oe.jsx)(dt,{ref:l}),(0,oe.jsx)(at,{ref:c})]})}ut.propTypes={mode:u().oneOf(["member","master"])},ut.defaultProps={mode:"member"};var ft=ut,pt=(0,s.forwardRef)((function(e,n){var t,r,i=(0,s.useContext)(L.RD).t,o=(0,de.h6)().api,a=(0,ke.y0)().blocklet,l=null===a||void 0===a?void 0:a.appPid,c=(0,nt.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(r=t.duration)||void 0===r?void 0:r.leavingScreen)||300,u=(0,Vn.Z)({show:!1,appUrl:"",appUrlError:"",callback:qn()}),f=(0,en.Z)((function(){u.appUrl="",u.appUrlError="",u.callback=qn()}),[]),p=(0,en.Z)((function(){u.show=!1,setTimeout((function(){f()}),d)}),[]),m=(0,en.Z)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qn();u.show=!0,u.callback=e}),[]);(0,s.useImperativeHandle)(n,(function(){return{open:m,close:p}}),[m,p]);var h=(0,en.Z)((function(e){if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!it()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),Z=(0,en.Z)((0,T.Z)((0,_.Z)().mark((function e(){var n;return(0,_.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,h(u.appUrl),e.next=4,o.joinFederatedLogin({input:{did:l,appUrl:u.appUrl}});case 4:n=e.sent,u.show=!1,p(),null===u||void 0===u||u.callback(n),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),u.appUrlError=e.t0.message;case 13:case"end":return e.stop()}}),e,null,[[0,10]])}))),[p,l]);return(0,oe.jsxs)(Le.ZP,{open:u.show,title:i("federated.joinFederatedLogin"),onClose:p,PaperProps:{style:{minHeight:"unset"}},actions:(0,oe.jsx)(z.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:Z,children:i("common.confirm")}),children:[(0,oe.jsx)(x.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,oe.jsx)(Je.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:u.appUrl,error:!!u.appUrlError,helperText:u.appUrlError||"eg: https://www.arcblock.io",onChange:function(e){u.appUrl=e.target.value}})]})})),mt=pt;function ht(){var e,n,t,r,i=(0,s.useRef)(null),o=(0,s.useRef)(null),a=(0,s.useContext)(L.RD).t,l=(0,ke.y0)(),c=l.blocklet,d=l.actions.refreshBlocklet,u=(0,en.Z)((function(){var e,n,t,r=null===(e=c.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href;if(r)try{var o,l=new URL(r);null===(o=i.current)||void 0===o||o.open({link:l.origin})}catch(s){H.Z.error(a("federated.failedToGetFederatedLoginLink"))}}),[null===(e=c.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href]),f=(0,en.Z)((function(){var e;null===(e=o.current)||void 0===e||e.open((function(){d()}))}),[d]);if((null===(r=c.settings.federated)||void 0===r?void 0:r.sites.length)>0){var p,m=!1!==(null===(p=c.settings.federated)||void 0===p?void 0:p.config.isMaster);return(0,oe.jsx)(ft,{mode:m?"master":"member"})}return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsxs)(x.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,oe.jsx)(z.Z,{variant:"contained",onClick:u,children:a("federated.inviteJoinFederatedLogin")}),(0,oe.jsx)(U.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,oe.jsx)(z.Z,{variant:"outlined",onClick:f,children:a("federated.joinFederatedLogin")})]}),(0,oe.jsx)(dt,{ref:i}),(0,oe.jsx)(mt,{ref:o})]})}var xt,Zt=function(){var e=(0,s.useContext)(L.RD).t,n=[{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,oe.jsx)(x.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],t=(0,s.useState)(n[0].value),r=(0,o.Z)(t,2),i=r[0],a=r[1],l=(0,qe.Z)((function(){return{auth0:(0,oe.jsx)(In,{}),federated:(0,oe.jsx)(ht,{}),more:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(Ye.Z,{children:e("oauth.comingSoon")})}),settings:(0,oe.jsx)(x.Z,{children:(0,oe.jsx)(zn,{})})}}),[e]);return(0,oe.jsxs)(x.Z,{children:[(0,oe.jsx)(S.Z,{tabs:n,current:i,onChange:a}),(0,oe.jsx)(x.Z,{marginTop:"10px",children:l[i]})]})},gt=["blocklet","onUpdate"],vt=function e(n){var t=n.tabs,r=n.blocklet,i=n.ancestors,o=void 0===i?[]:i,a=n.depth,s=void 0===a?1:a,c=n.t,d=[].concat((0,l.Z)(o.map((function(e){return e.meta.did}))),[r.meta.did]).join("/"),u=!(null!==o&&void 0!==o&&o.length);t.push({label:(0,oe.jsxs)(x.Z,{pl:2*Math.max(1,s-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[u?(0,oe.jsx)(A.Z,{size:24,blocklet:r}):(0,oe.jsx)(P.Z,{size:24,blocklet:r,ancestors:o}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:u?c("blocklet.component.container"):(0,E.getDisplayName)(r,!0)})})]},d),value:d}),r.children.length>0&&r.children.forEach((function(n){e({tabs:t,blocklet:n,ancestors:[].concat((0,l.Z)(o),[r]),depth:s+1,t:c})}))};function bt(e){var n=e.blocklet,t=e.onUpdate,r=(0,a.Z)(e,gt),l=(0,s.useContext)(L.RD).t,c=(0,de.h6)(),d=c.info,u=c.inService,p=(0,s.useState)(!0),E=(0,o.Z)(p,2),P=E[0],A=E[1],_=(0,w.lr)(),T=(0,o.Z)(_,2),N=T[0],O=T[1],R=N.get("tab")||"general",I=[{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,oe.jsx)(g.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.general")})})]},"general"),value:"general"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,oe.jsx)(v.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.access")})})]},"access"),value:"access"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,oe.jsx)(b.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.login")})})]},"oauth"),value:"oauth"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,oe.jsx)(j.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.notification")})})]},"notification"),value:"notification"},{label:(0,oe.jsxs)(x.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,oe.jsx)(x.Z,{ml:-2,style:{transform:"translateY(2px)"},children:P?(0,oe.jsx)(C.Z,{fontSize:"inherit"}):(0,oe.jsx)(y.default,{fontSize:"inherit"})}),(0,oe.jsx)(k.Z,{sx:{fontSize:24}}),(0,oe.jsx)(x.Z,{ml:"16px",children:(0,oe.jsx)(x.Z,{style:{color:"#222"},children:l("common.preferences")})})]},"preference"),value:"preference"}];P&&vt({tabs:I,blocklet:n,t:l});var B=null;if("general"===R)B=(0,oe.jsx)(He,{blocklet:n,onUpdate:t});else if("access"===R)B=(0,oe.jsx)(Nn,{});else if("oauth"===R)B=(0,oe.jsx)(Zt,{});else if("notification"===R)B=(0,oe.jsx)(mn,{});else{var F=u?h.WELLKNOWN_SERVICE_PATH_PREFIX:d.routing.adminPath,D=new URLSearchParams;u||D.set("authKey","__sst"),D.set("schemaKey",m()(window.location.origin,F,"/api/preferences?id=".concat(encodeURIComponent(R)))),B=(0,oe.jsx)(f.Z,{url:"".concat(m()(window.location.origin,F,"/hosted/form-collector/"),"?").concat(D.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,oe.jsx)(jt,(0,i.Z)((0,i.Z)({},r),{},{children:(0,oe.jsxs)(Z.ZP,{container:!0,spacing:4,columns:24,children:[(0,oe.jsx)(Z.ZP,{item:!0,sm:7,md:5,children:(0,oe.jsx)(S.Z,{tabs:I,current:R,orientation:"vertical",onChange:function(e){"preference"===e?A(!P):O((function(n){return"general"===e?n.delete("tab"):n.set("tab",e),n}))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,oe.jsx)(Z.ZP,{item:!0,sm:17,md:19,children:(0,oe.jsx)(x.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:B})})]})}))}bt.propTypes={blocklet:u().object.isRequired,onUpdate:u().func},bt.defaultProps={onUpdate:function(){}};var jt=c.Z.div(xt||(xt=(0,r.Z)(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])))},19066:function(e,n,t){t.d(n,{C:function(){return r}});var r="true"===localStorage.getItem("enableDebug")},70115:function(e,n,t){var r=t(39517),i=t(87642),o=t(64076),a=t(20244);n.Z=[{value:a.WHO_CAN_ACCESS.ALL,icon:o.Z,title:{zh:"\u6240\u6709\u4eba\u53ef\u8bbf\u95ee",en:"Accessible to all"},description:{zh:"\u5411\u6240\u6709\u4eba\u5f00\u653e\uff0c\u65e0\u9700\u901a\u884c\u8bc1\u5373\u53ef\u8bbf\u95ee\u5e94\u7528",en:"Open to the world anyone can access without passport"}},{value:a.WHO_CAN_ACCESS.INVITED,icon:i.Z,title:{zh:"\u53ea\u6709\u88ab\u9080\u8bf7\u7684\u4eba\u53ef\u4ee5\u8bbf\u95ee",en:"Only invited people can access"},description:{zh:"\u7a0d\u540e\u60a8\u53ef\u4ee5\u5728\u7ba1\u7406\u9875\u9762\u4e2d\u9080\u8bf7\u6210\u5458",en:"You can invite members later in the admin page"}},{value:a.WHO_CAN_ACCESS.OWNER,icon:r.Z,title:{zh:"\u53ea\u6709\u5e94\u7528\u6240\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee",en:"Only Owner of the blocklet can access"},description:{zh:"\u5fc5\u987b\u63d0\u4f9b\u6240\u6709\u8005\u901a\u884c\u8bc1\u624d\u80fd\u8bbf\u95ee\u5e94\u7528",en:"You must provide owner passport to access this application"}}]}}]);
2
+ //# sourceMappingURL=4802.d185b9f1.chunk.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[5012],{48082:function(o,n,r){var e=r(7896),t=r(31461),i=r(30969),a=(r(9479),r(87023)),l=r(26540),s=r(82108),u=r(23484),c=r(83176),p=r(45971),f=r(94702),v=r(17363),d=r(17591),h=r(37574),P=["onEntering"],m=["autoFocus","children","className","disableAutoFocusItem","MenuListProps","onClose","open","PaperProps","PopoverClasses","transitionDuration","TransitionProps","variant","slots","slotProps"],Z={vertical:"top",horizontal:"right"},g={vertical:"top",horizontal:"left"},b=(0,p.ZP)(c.ZP,{shouldForwardProp:function(o){return(0,p.FO)(o)||"classes"===o},name:"MuiMenu",slot:"Root",overridesResolver:function(o,n){return n.root}})({}),y=(0,p.ZP)(c.XS,{name:"MuiMenu",slot:"Paper",overridesResolver:function(o,n){return n.paper}})({maxHeight:"calc(100% - 96px)",WebkitOverflowScrolling:"touch"}),w=(0,p.ZP)(u.Z,{name:"MuiMenu",slot:"List",overridesResolver:function(o,n){return n.list}})({outline:0}),M=i.forwardRef((function(o,n){var r,u,c=(0,v.Z)({props:o,name:"MuiMenu"}),p=c.autoFocus,M=void 0===p||p,T=c.children,x=c.className,E=c.disableAutoFocusItem,S=void 0!==E&&E,C=c.MenuListProps,k=void 0===C?{}:C,z=c.onClose,R=c.open,O=c.PaperProps,F=void 0===O?{}:O,L=c.PopoverClasses,N=c.transitionDuration,D=void 0===N?"auto":N,j=c.TransitionProps,H=(void 0===j?{}:j).onEntering,_=c.variant,I=void 0===_?"selectedMenu":_,W=c.slots,A=void 0===W?{}:W,X=c.slotProps,B=void 0===X?{}:X,K=(0,t.Z)(c.TransitionProps,P),Q=(0,t.Z)(c,m),J=(0,f.Z)(),V="rtl"===J.direction,Y=(0,e.Z)({},c,{autoFocus:M,disableAutoFocusItem:S,MenuListProps:k,onEntering:H,PaperProps:F,transitionDuration:D,TransitionProps:K,variant:I}),q=function(o){var n=o.classes;return(0,l.Z)({root:["root"],paper:["paper"],list:["list"]},d.Q,n)}(Y),G=M&&!S&&R,U=i.useRef(null),$=-1;i.Children.map(T,(function(o,n){i.isValidElement(o)&&(o.props.disabled||("selectedMenu"===I&&o.props.selected||-1===$)&&($=n))}));var oo=null!=(r=A.paper)?r:y,no=null!=(u=B.paper)?u:F,ro=(0,s.y)({elementType:A.root,externalSlotProps:B.root,ownerState:Y,className:[q.root,x]}),eo=(0,s.y)({elementType:oo,externalSlotProps:no,ownerState:Y,className:q.paper});return(0,h.jsx)(b,(0,e.Z)({onClose:z,anchorOrigin:{vertical:"bottom",horizontal:V?"right":"left"},transformOrigin:V?Z:g,slots:{paper:oo,root:A.root},slotProps:{root:ro,paper:eo},open:R,ref:n,transitionDuration:D,TransitionProps:(0,e.Z)({onEntering:function(o,n){U.current&&U.current.adjustStyleForScrollbar(o,J),H&&H(o,n)}},K),ownerState:Y},Q,{classes:L,children:(0,h.jsx)(w,(0,e.Z)({onKeyDown:function(o){"Tab"===o.key&&(o.preventDefault(),z&&z(o,"tabKeyDown"))},actions:U,autoFocus:M&&(-1===$||S),autoFocusItem:G,variant:I},k,{className:(0,a.Z)(q.list,k.className),children:T}))}))}));n.Z=M},17591:function(o,n,r){r.d(n,{Q:function(){return i}});var e=r(62746),t=r(2975);function i(o){return(0,t.Z)("MuiMenu",o)}var a=(0,e.Z)("MuiMenu",["root","paper","list"]);n.Z=a},83176:function(o,n,r){r.d(n,{Pg:function(){return k},XS:function(){return z},oJ:function(){return x},pB:function(){return E}});var e=r(96234),t=r(7896),i=r(31461),a=r(30969),l=r(87023),s=r(26540),u=r(82108),c=r(15346),p=r(45971),f=r(17363),v=r(12357),d=r(23317),h=r(87406),P=r(87352),m=r(12642),Z=r(93778),g=r(46672),b=r(77664),y=r(37574),w=["onEntering"],M=["action","anchorEl","anchorOrigin","anchorPosition","anchorReference","children","className","container","elevation","marginThreshold","open","PaperProps","slots","slotProps","transformOrigin","TransitionComponent","transitionDuration","TransitionProps","disableScrollLock"],T=["slotProps"];function x(o,n){var r=0;return"number"===typeof n?r=n:"center"===n?r=o.height/2:"bottom"===n&&(r=o.height),r}function E(o,n){var r=0;return"number"===typeof n?r=n:"center"===n?r=o.width/2:"right"===n&&(r=o.width),r}function S(o){return[o.horizontal,o.vertical].map((function(o){return"number"===typeof o?"".concat(o,"px"):o})).join(" ")}function C(o){return"function"===typeof o?o():o}var k=(0,p.ZP)(Z.Z,{name:"MuiPopover",slot:"Root",overridesResolver:function(o,n){return n.root}})({}),z=(0,p.ZP)(g.Z,{name:"MuiPopover",slot:"Paper",overridesResolver:function(o,n){return n.paper}})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0}),R=a.forwardRef((function(o,n){var r,p,Z,g=(0,f.Z)({props:o,name:"MuiPopover"}),R=g.action,O=g.anchorEl,F=g.anchorOrigin,L=void 0===F?{vertical:"top",horizontal:"left"}:F,N=g.anchorPosition,D=g.anchorReference,j=void 0===D?"anchorEl":D,H=g.children,_=g.className,I=g.container,W=g.elevation,A=void 0===W?8:W,X=g.marginThreshold,B=void 0===X?16:X,K=g.open,Q=g.PaperProps,J=void 0===Q?{}:Q,V=g.slots,Y=g.slotProps,q=g.transformOrigin,G=void 0===q?{vertical:"top",horizontal:"left"}:q,U=g.TransitionComponent,$=void 0===U?m.Z:U,oo=g.transitionDuration,no=void 0===oo?"auto":oo,ro=g.TransitionProps,eo=(void 0===ro?{}:ro).onEntering,to=g.disableScrollLock,io=void 0!==to&&to,ao=(0,i.Z)(g.TransitionProps,w),lo=(0,i.Z)(g,M),so=null!=(r=null==Y?void 0:Y.paper)?r:J,uo=a.useRef(),co=(0,P.Z)(uo,so.ref),po=(0,t.Z)({},g,{anchorOrigin:L,anchorReference:j,elevation:A,marginThreshold:B,externalPaperSlotProps:so,transformOrigin:G,TransitionComponent:$,transitionDuration:no,TransitionProps:ao}),fo=function(o){var n=o.classes;return(0,s.Z)({root:["root"],paper:["paper"]},b.s,n)}(po),vo=a.useCallback((function(){if("anchorPosition"===j)return N;var o=C(O),n=(o&&1===o.nodeType?o:(0,d.Z)(uo.current).body).getBoundingClientRect();return{top:n.top+x(n,L.vertical),left:n.left+E(n,L.horizontal)}}),[O,L.horizontal,L.vertical,N,j]),ho=a.useCallback((function(o){return{vertical:x(o,G.vertical),horizontal:E(o,G.horizontal)}}),[G.horizontal,G.vertical]),Po=a.useCallback((function(o){var n={width:o.offsetWidth,height:o.offsetHeight},r=ho(n);if("none"===j)return{top:null,left:null,transformOrigin:S(r)};var e=vo(),t=e.top-r.vertical,i=e.left-r.horizontal,a=t+n.height,l=i+n.width,s=(0,h.Z)(C(O)),u=s.innerHeight-B,c=s.innerWidth-B;if(null!==B&&t<B){var p=t-B;t-=p,r.vertical+=p}else if(null!==B&&a>u){var f=a-u;t-=f,r.vertical+=f}if(null!==B&&i<B){var v=i-B;i-=v,r.horizontal+=v}else if(l>c){var d=l-c;i-=d,r.horizontal+=d}return{top:"".concat(Math.round(t),"px"),left:"".concat(Math.round(i),"px"),transformOrigin:S(r)}}),[O,j,vo,ho,B]),mo=a.useState(K),Zo=(0,e.Z)(mo,2),go=Zo[0],bo=Zo[1],yo=a.useCallback((function(){var o=uo.current;if(o){var n=Po(o);null!==n.top&&(o.style.top=n.top),null!==n.left&&(o.style.left=n.left),o.style.transformOrigin=n.transformOrigin,bo(!0)}}),[Po]);a.useEffect((function(){return io&&window.addEventListener("scroll",yo),function(){return window.removeEventListener("scroll",yo)}}),[O,io,yo]);a.useEffect((function(){K&&yo()})),a.useImperativeHandle(R,(function(){return K?{updatePosition:function(){yo()}}:null}),[K,yo]),a.useEffect((function(){if(K){var o=(0,v.Z)((function(){yo()})),n=(0,h.Z)(O);return n.addEventListener("resize",o),function(){o.clear(),n.removeEventListener("resize",o)}}}),[O,K,yo]);var wo=no;"auto"!==no||$.muiSupportAuto||(wo=void 0);var Mo=I||(O?(0,d.Z)(C(O)).body:void 0),To=null!=(p=null==V?void 0:V.root)?p:k,xo=null!=(Z=null==V?void 0:V.paper)?Z:z,Eo=(0,u.y)({elementType:xo,externalSlotProps:(0,t.Z)({},so,{style:go?so.style:(0,t.Z)({},so.style,{opacity:0})}),additionalProps:{elevation:A,ref:co},ownerState:po,className:(0,l.Z)(fo.paper,null==so?void 0:so.className)}),So=(0,u.y)({elementType:To,externalSlotProps:(null==Y?void 0:Y.root)||{},externalForwardedProps:lo,additionalProps:{ref:n,slotProps:{backdrop:{invisible:!0}},container:Mo,open:K},ownerState:po,className:(0,l.Z)(fo.root,_)}),Co=So.slotProps,ko=(0,i.Z)(So,T);return(0,y.jsx)(To,(0,t.Z)({},ko,!(0,c.X)(To)&&{slotProps:Co,disableScrollLock:io},{children:(0,y.jsx)($,(0,t.Z)({appear:!0,in:K,onEntering:function(o,n){eo&&eo(o,n),yo()},onExited:function(){bo(!1)},timeout:wo},ao,{children:(0,y.jsx)(xo,(0,t.Z)({},Eo,{children:H}))}))}))}));n.ZP=R},77664:function(o,n,r){r.d(n,{s:function(){return i}});var e=r(62746),t=r(2975);function i(o){return(0,t.Z)("MuiPopover",o)}var a=(0,e.Z)("MuiPopover",["root","paper"]);n.Z=a},33665:function(o,n,r){function e(o){if(null==o)throw new TypeError("Cannot destructure "+o)}r.d(n,{Z:function(){return e}})}}]);
2
+ //# sourceMappingURL=5012.551dbbc3.chunk.js.map