@abtnode/webapp 1.16.27-beta-43a3bbb2 → 1.16.27-beta-c450492a

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 (47) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/build/asset-manifest.json +22 -22
  4. package/build/index.html +1 -1
  5. package/build/service-worker.js +1 -1
  6. package/build/static/js/1059.294759cc.chunk.js +1 -0
  7. package/build/static/js/1575.42ff669c.chunk.js +1 -0
  8. package/build/static/js/{175.ecbbae16.chunk.js → 175.a3dd5077.chunk.js} +1 -1
  9. package/build/static/js/2019.75dc9104.chunk.js +1 -0
  10. package/build/static/js/2168.6656fd50.chunk.js +1 -0
  11. package/build/static/js/233.4648e15d.chunk.js +1 -0
  12. package/build/static/js/{2362.e2682916.chunk.js → 2362.ec251904.chunk.js} +1 -1
  13. package/build/static/js/3803.640d65da.chunk.js +1 -0
  14. package/build/static/js/3930.4a7f58db.chunk.js +1 -0
  15. package/build/static/js/4423.8e961ae3.chunk.js +1 -0
  16. package/build/static/js/4465.3eae8bc6.chunk.js +1 -0
  17. package/build/static/js/4804.e06f2f91.chunk.js +2 -0
  18. package/build/static/js/{4804.0799b676.chunk.js.LICENSE.txt → 4804.e06f2f91.chunk.js.LICENSE.txt} +7 -0
  19. package/build/static/js/{506.fe1f4c17.chunk.js → 506.66a371f9.chunk.js} +1 -1
  20. package/build/static/js/5312.dbc8d642.chunk.js +1 -0
  21. package/build/static/js/5748.8271b658.chunk.js +1 -0
  22. package/build/static/js/6906.d344fc67.chunk.js +1 -0
  23. package/build/static/js/6944.bd014565.chunk.js +1 -0
  24. package/build/static/js/8170.b9cd4dfa.chunk.js +1 -0
  25. package/build/static/js/8590.4f26e92e.chunk.js +1 -0
  26. package/build/static/js/9586.605206b2.chunk.js +1 -0
  27. package/build/static/js/main.8ea0c504.js +2 -0
  28. package/package.json +1 -1
  29. package/build/static/js/1059.35f4a575.chunk.js +0 -1
  30. package/build/static/js/1575.e3606f95.chunk.js +0 -1
  31. package/build/static/js/2019.820c27fc.chunk.js +0 -1
  32. package/build/static/js/2168.642bfc2e.chunk.js +0 -1
  33. package/build/static/js/233.a4eb89c7.chunk.js +0 -1
  34. package/build/static/js/3803.ab7edaa3.chunk.js +0 -1
  35. package/build/static/js/3930.52f47c4a.chunk.js +0 -1
  36. package/build/static/js/4423.cd5bf3f2.chunk.js +0 -1
  37. package/build/static/js/4465.d149319d.chunk.js +0 -1
  38. package/build/static/js/4804.0799b676.chunk.js +0 -2
  39. package/build/static/js/5312.fa7da622.chunk.js +0 -1
  40. package/build/static/js/5748.7d3c9c26.chunk.js +0 -1
  41. package/build/static/js/6906.f1f89f90.chunk.js +0 -1
  42. package/build/static/js/6944.7f3fe691.chunk.js +0 -1
  43. package/build/static/js/8170.29705904.chunk.js +0 -1
  44. package/build/static/js/8590.0bffbd32.chunk.js +0 -1
  45. package/build/static/js/9586.ba21307f.chunk.js +0 -1
  46. package/build/static/js/main.5d85e86a.js +0 -2
  47. /package/build/static/js/{main.5d85e86a.js.LICENSE.txt → main.8ea0c504.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[5312],{80378:(e,n,t)=>{t.d(n,{Z:()=>p});var i=t(55898),o=t.n(i),l=t(62681),a=t(72333),r=t(6352),s=t.n(r),c=t(35432),d=t(58238),u=t(46090);var m=t(96266);function p(e){let{blocklet:n,style:t,size:i,ancestors:o,...r}=e;const p=(0,d.h6)(),{logoUrl:h,inService:f}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:l}=o,a="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,u.XN)(null===t||void 0===t?void 0:t.status)?"~":"");let r=l?s()(u.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",a):s()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)r=s()(t.deployedFrom,(0,u.lk)(t.meta.bundleDid,t.meta.logo),a);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=l?n.slice(1):n;r=s()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),a)}return{logoUrl:r,inService:l}}({blocklet:n,ancestors:o}),{variant:g}=r,x=f?()=>{}:e=>{e.target.src="".concat(p.imgPrefix,"/blocklet.png")};let v=(0,m.jsx)("img",{src:h,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(v=(0,m.jsx)(a.Z,{did:n.meta.did||"",responsive:!0})),(0,m.jsx)(l.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...r,children:v})}p.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},p.defaultProps={style:{},size:40,ancestors:[]}},74286:(e,n,t)=>{t.d(n,{Z:()=>r});var i=t(55898),o=t.n(i),l=t(39948),a=t(96266);function r(e){let{depth:n,className:t}=e;return(0,a.jsx)(l.Z,{ml:Math.max(2*(n-1),0),className:t,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}r.propTypes={depth:o().number,className:o().string},r.defaultProps={depth:1,className:""}},44784:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),l=t(33518),a=t(82790),r=t(96266);function s(e){let{labelProps:n,className:t,style:i,...o}=e;const l={...n,labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"};return(0,r.jsx)(c,{className:t,style:i,children:(0,r.jsx)(a.Z,{labelProps:l,...o})})}s.propTypes=a.Z.propTypes,s.defaultProps=a.Z.defaultProps;const c=l.Z.div(i||(i=(0,o.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"])),(e=>{let{theme:n}=e;return n.breakpoints.down("sm")})),d=s},59375:(e,n,t)=>{t.d(n,{Z:()=>Z});var i,o=t(71171),l=t(5057),a=t(55898),r=t.n(a),s=t(6352),c=t.n(s),d=t(33518),u=t(92706),m=t.n(u),p=t(39948),h=t(52277),f=t.n(h),g=t(68420),x=t(96266);const v=(0,l.lazy)((()=>Promise.all([t.e(6547),t.e(5760),t.e(6743),t.e(9282),t.e(1294),t.e(4804),t.e(9132)]).then(t.bind(t,84804)).then((e=>({default:e.Uploader}))))),b="/blocklet/logo/upload";function Z(e){let{url:n,height:t,width:i,enabled:o,type:a,did:r,prefix:s,headers:d,onUploaded:u}=e;const{t:m}=(0,g.PE)(),h=(0,l.useRef)(null),Z={cursor:o?"pointer":"default","&::after":{content:'"'.concat(m("common.switch"),'"')}};return(0,x.jsxs)(j,{id:"uploader-".concat(r,"-").concat(a),children:[(0,x.jsx)(v,{ref:h,popup:!0,onUploadFinish:()=>{var e;u(),null===(e=h.current)||void 0===e||e.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:c()(s,b,a,r),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(p.Z,{className:f()("uploader-wrapper",o&&"enabled"),sx:Z,onClick:()=>{var e;null===(e=h.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(r,"-").concat(a))}Z.propTypes={url:r().string.isRequired,type:r().oneOf(["square","rect","favicon"]).isRequired,did:r().string.isRequired,prefix:r().string.isRequired,headers:r().func,onUploaded:r().func,height:r().number,width:r().any,enabled:r().bool},Z.defaultProps={height:80,width:"auto",enabled:!0,headers:()=>({}),onUploaded:m()};const j=d.Z.div(i||(i=(0,o.Z)(["\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"])))},48579:(e,n,t)=>{t.r(n),t.d(n,{default:()=>Nt});var i,o=t(71171),l=t(5057),a=t(33518),r=t(55898),s=t.n(r),c=t(96181),d=t(6352),u=t.n(d),m=t(35432),p=t(39948),h=t(55402),f=t(82275),g=t(96399),x=t(65688),v=t(37633),b=t(48037),Z=t(92273),j=t(76720),y=t(15849),k=t(68420),C=t(94464),w=t(38242),S=t(80378),E=t(1722),L=t(43681),P=t.n(L),O=t(50482),R=t.n(O),T=t(16147),A=t(29034),N=t(28726),I=t(80578),_=t(77277),B=t(86229),F=t(28641),D=t(44846),z=t(13727),U=t(56184),K=t(67680),W=t(19654),q=t(90067),G=t(39646),M=t(43897),V=t(47020),H=t(49020),Y=t(35406),J=t(11875),Q=t(95890),X=t(96266);function $(e){let{label:n,disabled:t,required:i,initialValue:o,onChange:a,style:r,onSubmit:s,triggers:c,options:d,formatterBeforeSubmit:u,helperText:m,placeholder:h,renderImage:f,renderLabel:g,filterKeys:x,noEmpty:v,...b}=e;const[Z,j]=(0,l.useState)(!1),[y,k]=(0,l.useState)(!1),[C,w]=l.useState(""),[S,E]=(0,l.useState)(o),[L,P]=(0,l.useState)(S),O=(0,l.useMemo)((()=>{if(!d)return{};const e={};return d.forEach((n=>{e[n.code]=n})),e}),[d]),R=Z?(0,X.jsx)(G.Z,{options:d,value:L,onChange:(e,n)=>{if(!Array.isArray(n))return P([]),void a([]);const t=n.filter((e=>O[e]));if(!t.length)return P([]),void a([]);P(t),a(t)},inputValue:C,onInputChange:(e,n)=>{w(n)},PopperComponent:ne,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:()=>{if(!d)return[];if(!C)return d.map((e=>e.code));const e=new RegExp(C.toLowerCase());return d.filter((n=>{for(let i=0;i<x.length;i++){var t;const o=x[i];if(e.test(null===(t=n[o])||void 0===t?void 0:t.toLowerCase()))return!0}return!1})).map((e=>e.code))},getOptionLabel:e=>{var n;return null===(n=O[e])||void 0===n?void 0:n.name},renderInput:e=>(0,X.jsx)(V.Z,{...e,label:"",placeholder:h}),renderOption:(e,n)=>{var t;const i=-1!==L.indexOf(n);return(0,l.createElement)(ee,{component:"li",...e,key:n},f(O[n]||{}),(0,X.jsx)(p.Z,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:i?"700":"normal"},children:g(n,O[n])||(null===(t=O[n])||void 0===t?void 0:t.name)}),(0,X.jsx)(p.Z,{component:z.default,sx:{opacity:.5,width:18,height:18},style:{visibility:i?"visible":"hidden"}}))},...b}):(0,X.jsx)(p.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:L.filter((e=>d.some((n=>n.code===e)))).map((e=>(0,X.jsx)(W.Z,{label:d.find((n=>n.code===e)).name,style:{marginRight:8},size:"small"},e)))});return(0,X.jsx)(J.Z,{className:"form",style:r,children:(0,X.jsxs)(p.Z,{className:"form-item",children:[(0,X.jsxs)(p.Z,{className:"form-item-label",children:[n,i&&(0,X.jsx)(Y.Z,{})]}),(0,X.jsxs)(p.Z,{className:"form-item-body",children:[(0,X.jsx)(p.Z,{className:"form-item-input",children:R}),(0,X.jsx)(p.Z,{className:"form-item-action",children:Z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-confirm",onClick:async()=>{k(!0);try{!1===await s("function"===typeof u?u(L):L)?P(S):v&&!L.length?(P(o),E(o)):(P(L),E(L))}catch(e){P(S)}finally{k(!1),j(!1)}},disabled:t||y,size:"large",children:y?(0,X.jsx)(D.Z,{size:24}):(0,X.jsx)(U.Z,{})}),(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{P(S),j(!1)},disabled:t||y,size:"large",children:(0,X.jsx)(z.default,{})})]}):(0,X.jsx)(Q.Z,{triggers:c,onEnterEdit:()=>j(!0),disabled:t})})]}),Z&&m&&(0,X.jsx)(q.Z,{children:m})]})})}$.propTypes={style:s().object,onSubmit:s().func,onChange:s().func,label:s().string,initialValue:s().string,required:s().bool,disabled:s().bool,triggers:s().array,options:s().array,helperText:s().string,formatterBeforeSubmit:s().func,placeholder:s().string,renderImage:s().func,filterKeys:s().arrayOf(s().string),noEmpty:s().bool,renderLabel:s().func},$.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:e=>e.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(e,n)=>"",noEmpty:!1};const ee=a.Z.div(i||(i=(0,o.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n font-size: 1.1em;\n"]))),ne=(0,a.Z)(H.Z)((()=>({["& .".concat(M.Z.paper)]:{boxShadow:"0px 8px 12px rgba(92, 92, 92, 0.04), 0px -10px 12px rgba(92, 92, 92, 0.04)",borderRadius:"6px",width:"100%",border:"1px solid rgba(0, 0, 0, 0.12)",color:"inherit",fontSize:13,position:"absolute",left:0,top:0},["& .".concat(M.Z.listbox)]:{padding:0}})));var te,ie=t(58238),oe=t(46090),le=t(54063),ae=t(63406),re=t(78410),se=t(31853),ce=t(88577),de=t(70461),ue=t(73545),me=t(29054);function pe(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:l}=(0,k.PE)(),{api:a}=(0,ue.T)(),{blocklet:r}=(0,me.y0)(),[s,c]=(0,se.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),u=r.structVersion===m.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,oe.An)(r.status)?B.Z.error(l("blocklet.error.isRunning")):(0,w.isInProgress)(r.status)?B.Z.error(l("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,X.jsx)(F.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:u,secure:!0}),s.newAppSk&&(0,X.jsx)(de.Z,{title:l("blocklet.config.appSkTitle"),description:(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(p.Z,{children:l("blocklet.config.appSkChangeTip")}),(0,X.jsx)(p.Z,{fontWeight:"bold",mt:2,children:l("blocklet.config.appDidChangeTip")}),(0,X.jsxs)(he,{children:[(0,X.jsx)("li",{children:l("blocklet.config.appDidChangeTipL1")}),(0,X.jsx)("li",{children:l("blocklet.config.appDidChangeTipL2")})]})]}),confirm:l("confirm"),cancel:l("cancel"),onConfirm:()=>(async e=>{try{await t(e)}finally{c({newAppSk:""})}})(s.newAppSk),onCancel:()=>c({newAppSk:""})}),(0,X.jsx)(ce.Z,{popup:!0,open:s.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:a.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:r.appDid},messages:{title:l("setup.keyPair.title"),scan:l("setup.keyPair.scan"),confirm:l("setup.keyPair.confirm"),success:l("setup.keyPair.success")},onClose:d})]}pe.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},pe.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const he=(0,a.Z)("ul")(te||(te=(0,o.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));var fe,ge=t(13128),xe=t(55372),ve=t(11750),be=t(88574),Ze=t(26174),je=t(88092),ye=t(50185),ke=t(17425);function Ce(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:o}=(0,l.useContext)(ue.B),[a,r]=(0,l.useState)(!1),{t:s,locale:c}=(0,k.PE)(),[d,u]=(0,l.useState)(""),[m,h]=(0,l.useState)(!1),[f,g]=(0,l.useState)(0),[x,v]=(0,l.useState)(""),{endpoint:b}=(0,ke.DJ)(),[Z,j]=(0,l.useState)(!1),y=e=>{u(null),r(!0);try{v(e.result),g(w.length-1)}catch(n){const e=(0,oe.Z)(n);u(e),i(n)}finally{r(!1)}},C=()=>{h(!1),g(0)},w=[{body:(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(ve.Z,{children:s("team.transferApp.transferDialog.tips.progress")}),(0,X.jsx)(ve.Z,{mt:3,mb:2,children:s("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:s("common.cancel"),confirm:s("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:()=>{h(!0),g(1)}},{body:()=>(0,X.jsx)(ce.Z,{action:"transfer-app-owner",open:m,locale:c,checkFn:o.get,onClose:C,onSuccess:y,checkTimeout:3e5,extraParams:{},messages:{title:s("team.transferApp.connectDialog.title"),scan:s("team.transferApp.connectDialog.scan"),confirm:s("team.transferApp.connectDialog.confirm"),success:s("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const e=(0,oe.VP)({transferId:x.transferId,endpoint:b});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(p.Z,{component:we,dangerouslySetInnerHTML:{__html:s("team.transferApp.transferDialog.createSuccessTip1")}}),(0,X.jsx)(p.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip3")})}),(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(p.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,oe.B2)(x.expireDate,c)})})}),(0,X.jsx)(p.Z,{my:1,children:(0,X.jsx)(ye.Z,{children:e})})]}),(0,X.jsx)("div",{children:(0,X.jsx)(Ze.Z,{value:"end",control:(0,X.jsx)(je.Z,{checked:Z,onChange:e=>j(e.target.checked)}),label:s("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:s("common.confirm"),onConfirm:t}],S=w[f];return(0,X.jsxs)(ge.ZP,{title:(0,X.jsx)(we,{className:"title",children:s("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[S.cancel&&(0,X.jsx)(N.Z,{onClick:S.onCancel,color:"inherit",children:S.cancel}),(0,X.jsxs)(N.Z,{onClick:S.onConfirm,color:"error",disabled:a||f===w.length-1&&!Z,variant:"contained",autoFocus:!0,children:[a&&(0,X.jsx)(D.Z,{size:16}),S.confirm]})]}),children:[(0,X.jsx)(xe.Z,{component:"div",children:"function"===typeof S.body?S.body():S.body}),!!d&&(0,X.jsx)(be.Z,{type:"error",variant:"icon",children:d})]})}Ce.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},Ce.defaultProps={onError:()=>{}};const we=a.Z.div(fe||(fe=(0,o.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"])));var Se,Ee=t(49522),Le=t(59375);const Pe=Object.keys(_.SUPPORTED_LANGUAGES).map((e=>({code:e,name:_.SUPPORTED_LANGUAGES[e].nativeName,enName:_.SUPPORTED_LANGUAGES[e].name}))),Oe=["name","enName","code"];function Re(e){var n;let{blocklet:t,onUpdate:i,hasPermission:o,...a}=e;const{api:r,inService:s,prefix:c,getSessionInHeader:d,ws:{useSubscription:u}}=(0,ie.h6)(),{t:h}=(0,l.useContext)(k.RD),[f,g]=(0,l.useState)(""),[x,v]=(0,l.useState)(""),[b,Z]=(0,l.useState)(!1),j=(0,w.getWhoCanAccess)(t),y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,C=x||!o,{logoUrl:S,rectLogoUrl:E,faviconUrl:L}=(0,Ee.Z)({blocklet:t}),{did:O}=t.meta,{site:D}=t,z=P()(t.meta,"capabilities.clusterMode",!1);if(u(m.EVENTS.NODE_RUNTIME_INFO,(e=>{z&&g(P()(e,"cpu.physicalCores",""))})),(0,oe.wS)(t.status))return null;const U=t.environments.find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!U||"yes"===U.value,W=t.environments.find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),G=t.environments.find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),M=t.environments.find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),V=[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:h("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:h("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:h("blocklet.config.appUrl"),value:q?q.value:""},{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:h("blocklet.config.copyrightOwner"),value:G?G.value:""},{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:h("blocklet.config.copyrightYear"),value:M?M.value:""}];if(z){const e=t.configs.find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:f;V.push({key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:h("blocklet.config.clusterSize"),value:n,cpuCores:f})}const H=async(e,n)=>{if(e===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,oe.I)({value:n,cpuCores:f});if(e)return void B.Z.error(e)}const o=[{key:e,value:n}];try{v(!0);const{blocklet:e}=await r.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(l){B.Z.error(l.message)}finally{v(!1)}};return(0,X.jsxs)(Ie,{...a,children:[V.map((e=>(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,X.jsx)(F.Z,{style:{marginTop:0},disabled:x||C,loading:x,initialValue:e.value,onSubmit:n=>H(e.key,n)})]}))),(0,X.jsx)(p.Z,{className:"config-form",component:A.Z,my:3}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:h("blocklet.config.logoSquare")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,width:80,type:"square",prefix:c,url:S,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoRect")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoRectDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,type:"rect",prefix:c,url:E,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoFavicon")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoFaviconDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:25,width:25,type:"favicon",prefix:c,url:L,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-form",children:"all"===j&&"registry"===t.source&&(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.access.publicToStore"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.access.publicInstanceTip")})]}),(0,X.jsx)(T.Z,{disabled:C,checked:y,defaultChecked:!0,onChange:async e=>{if(!x){v(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){B.Z.error(n.message)}finally{v(!1)}}}})]})}),(0,X.jsx)(p.Z,{className:"config-form",component:A.Z,my:3}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.languages")}),(0,X.jsx)($,{style:{marginTop:0},disabled:x||C,loading:x,options:Pe,noEmpty:!0,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>H("BLOCKLET_APP_LANGUAGES",e),helperText:h("blocklet.config.selectLanguagesTip"),placeholder:h("blocklet.config.languagesSearch"),filterKeys:Oe,renderLabel:(e,n)=>n.name===n.enName?"".concat(n.name," (").concat(e.toUpperCase(),")"):"".concat(n.name,", ").concat(n.enName," (").concat(e.toUpperCase(),")")})]}),(0,X.jsx)(p.Z,{className:"config-form",component:A.Z,my:3}),(0,X.jsx)(p.Z,{className:"config-form",mt:2,children:(0,X.jsx)(p.Z,{className:"config-label",mb:0,children:h("common.security")})}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("router.domainSecurity.cors.title")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,X.jsx)(F.Z,{style:{marginTop:0},disabled:x||C,loading:x,initialValue:(D.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=D.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(R()(n,i))return!1;try{v(!0);const e=i.length?i:["__none__"];await r.updateRoutingSite({input:{id:D.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),v(!1)}catch(o){return B.Z.error(o.message),v(!1),!1}return!0}})]}),(0,X.jsx)(p.Z,{className:"config-form",component:A.Z,my:3}),(0,X.jsx)(p.Z,{mb:2,className:"config-label",fontSize:20,children:h("blocklet.config.dangerZone")}),(0,X.jsxs)(p.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,X.jsx)(p.Z,{className:"config-form",mt:2,children:!s&&(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.deletable.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,X.jsx)(T.Z,{disabled:C,checked:!K,defaultChecked:!0,onChange:async e=>{if(!x){v(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:n?"no":"yes"}]}});i(o)}catch(n){B.Z.error(n.message)}finally{v(!1)}}}})]})}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.sk")}),(0,X.jsx)(pe,{disabled:x||C,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){v(!0);try{const{blocklet:n}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){B.Z.error(n.message)}finally{v(!1)}}}})]}),s&&(0,X.jsx)(ae.Z,{role:"owner",children:e=>(e||le.C)&&(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsx)(p.Z,{className:"config-label",mb:0,children:h("team.transferApp.name")}),(0,X.jsxs)(N.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:()=>Z(!0),children:[(0,X.jsx)(I.Z,{style:{fontSize:"1.3em",marginRight:4}}),h("team.transferApp.name")]})]}),b&&(0,X.jsx)(Ce,{onCancel:()=>Z(!1),onSuccess:()=>Z(!1)})]})}),(0,X.jsx)(p.Z,{className:"config-form",mt:2,children:(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.clearCache.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.clearCache.purpose")})]}),(0,X.jsx)(re.Z,{teamDid:O})]})})]})]})}const Te=(0,ae.V)(Re,"mutate_blocklets"),Ae=(0,ae.V)(Re,"",oe.Wf);function Ne(e){const{inService:n}=(0,ie.h6)();return n?(0,X.jsx)(Ae,{...e}):(0,X.jsx)(Te,{...e})}Re.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Re.defaultProps={onUpdate:()=>{},hasPermission:!1};const Ie=a.Z.div(Se||(Se=(0,o.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"])),(e=>e.theme.breakpoints.down("md")));var _e=t(25710),Be=t(93066),Fe=t(80576),De=t(8708),ze=t.n(De),Ue=t(12673),Ke=t(99360),We=t(80506),qe=t(766),Ge=t.n(qe),Me=t(24529),Ve=t.n(Me),He=t(16727),Ye=t.n(He),Je=t(92706),Qe=t.n(Je);const Xe=(0,l.forwardRef)(((e,n)=>{const{t:t}=(0,l.useContext)(k.RD),i=(0,Ue.Z)({show:!1,title:"",content:"",onConfirm:Qe(),onCancel:Qe(),loading:!1}),o=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.show=!0,i.title=e.title,i.content=e.content,i.onConfirm=e.onConfirm||Qe(),i.onCancel=e.onCancel||Qe(),i.loading=!1})),a=(0,Ke.Z)((()=>{i.title="",i.content="",i.onConfirm=Qe(),i.onCancel=Qe()})),r=(0,Ke.Z)((()=>{i.show=!1,setTimeout((()=>{a()}),300)})),s=(0,Ke.Z)((()=>{r(),null===i||void 0===i||i.onCancel()}),[]),c=(0,Ke.Z)((async()=>{i.loading=!0;try{await(null===i||void 0===i?void 0:i.onConfirm(r))}finally{i.loading=!1}}),[]);return(0,l.useImperativeHandle)(n,(()=>({open:o,close:r})),[o,r]),(0,X.jsx)(ge.I4,{open:i.show,title:i.title,onConfirm:c,onCancel:s,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:i.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:i.content instanceof Function?i.content():i.content})}));function $e(){const e=(0,l.useRef)(null),n=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.open(...i)})),t=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.close(...i)})),i={open:n,close:t};return{confirmHolder:(0,X.jsx)(Xe,{ref:e}),confirmApi:i}}const en={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};const nn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),{confirmApi:l,confirmHolder:a}=$e(),r=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,s=Object.assign({...en},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.notification)||void 0===n?void 0:n.email)||{}),{handleSubmit:c,control:d,formState:u,watch:m,reset:h}=(0,We.cI)({defaultValues:ze()(s,Object.keys(en))}),f=(0,Ue.Z)({testReceiver:"",testReceiverError:""}),g=m("enabled"),x=(0,Ke.Z)((async function(e,n){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];try{var l;const{blocklet:n}=await t.configNotification({input:{did:r,notification:JSON.stringify({email:e})}}),a=Object.assign({...en},(null===n||void 0===n||null===(l=n.settings)||void 0===l||null===(l=l.notification)||void 0===l?void 0:l.email)||{});h(a),i&&B.Z.success(o("oauth.saveSuccess"))}catch(a){if(!i)throw a;B.Z.error(a.message||o("oauth.saveFailed"))}})),v=(0,Ke.Z)((async(e,n,i)=>{try{u.isDirty&&await x(e,n,!1),await t.sendEmail({input:{did:r,receiver:i,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),B.Z.success(o("notification.email.testSuccess"))}catch(l){B.Z.error(l.message||o("notification.email.testfailed"))}})),b=(0,Ke.Z)(((e,n)=>{f.testReceiver="",f.testReceiverError="",l.open({title:o("notification.email.testSendEmail"),content:()=>(0,X.jsx)(p.Z,{sx:{width:"300px"},children:(0,X.jsx)(V.Z,{fullWidth:!0,name:"testReceiver",label:o("notification.email.inputTestReceiver"),value:f.testReceiver,onChange:e=>{f.testReceiver=e.target.value},error:!!f.testReceiverError,helperText:f.testReceiverError||"\u3000"})}),async onConfirm(t){var i;const l=null===(i=f.testReceiver)||void 0===i?void 0:i.trim();l?Ge()(l)?(f.testReceiverError="",await v(e,n,l),t()):f.testReceiverError=o("notification.email.receiverInvalid"):f.testReceiverError=o("notification.email.receiverRequired")}})})),Z=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ge()(n)||o("notification.email.fromInvalid"):o("notification.email.fromRequired")})),j=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ve()(n,{require_host:!1,protocols:[]})||o("notification.email.hostInvalid"):o("notification.email.hostRequired")})),y=(0,Ke.Z)((e=>e?!!Ye()(e)||o("notification.email.portInvalid"):o("notification.email.portRequired"))),C=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.userRequired"))),w=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.passwordRequired"))),S=(0,Ke.Z)((()=>!0));return(0,X.jsxs)(p.Z,{children:[(0,X.jsxs)("form",{onSubmit:c(x),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:d,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(T.Z,{checked:n.value,...n}),label:o("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,X.jsx)(We.Qr,{name:"from",control:d,rules:{validate:g?Z:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,label:o("notification.email.from"),error:!!u.errors[t.name],helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"host",control:d,rules:{validate:g?j:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!u.errors[t.name],label:o("notification.email.host"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"port",control:d,rules:{validate:g?y:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"number",error:!!u.errors[t.name],label:o("notification.email.port"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"user",control:d,rules:{validate:g?C:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!u.errors[t.name],label:o("notification.email.user"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"password",control:d,rules:{validate:g?w:S},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",error:!!u.errors[t.name],label:o("notification.email.password"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"secure",control:d,rules:{validate:S},render:e=>{let{field:n}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(T.Z,{checked:n.value,...n,disabled:!g}),label:o("notification.email.secure"),style:{marginBottom:16}})})}}),(0,X.jsx)(N.Z,{variant:"outlined",color:"warning",onClick:c(b),sx:{mr:2},disabled:!g,children:o("oauth.runTest")}),(0,X.jsx)(N.Z,{type:"submit",variant:"contained",disabled:!u.isDirty,children:o("oauth.save")})]}),a]})},tn=[{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const on=function(){const[e,n]=(0,l.useState)(tn[0].value),{t:t}=(0,l.useContext)(k.RD),i=(0,Be.Z)((()=>({email:(0,X.jsx)(nn,{}),more:(0,X.jsx)(p.Z,{children:(0,X.jsx)(_e.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(C.Z,{tabs:tn,current:e,onChange:n}),(0,X.jsx)(p.Z,{marginTop:"10px",children:i[e]})]})};var ln=t(96366),an=t(75239),rn=t(48342),sn=t(94552),cn=t(24558),dn=t(74286),un=t(74490),mn=t(76667),pn=t(70648),hn=t(44067),fn=t(7664),gn=t(44123),xn=t(53906);const vn=[{value:m.WHO_CAN_ACCESS.ALL,icon:xn.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:m.WHO_CAN_ACCESS.INVITED,icon:gn.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:m.WHO_CAN_ACCESS.OWNER,icon:fn.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"}}];var bn,Zn;const jn="roles",yn=[...vn,{value:jn,icon:pn.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"}}],kn=(e,n)=>{if(e&&e.startsWith(m.WHO_CAN_ACCESS_PREFIX_ROLES)){const t=(0,w.getRolesFromAuthConfig)({whoCanAccess:e}),i=n.filter((e=>t.includes(e.name)));return{access:jn,roles:i}}return{access:e,roles:[]}},Cn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return kn(i.value,t);if(n&&P()(n,"settings.whoCanAccess")&&P()(n,"settings.whoCanAccess")!==m.WHO_CAN_ACCESS.ALL)return kn(P()(n,"settings.whoCanAccess"),t);const o=(0,w.findServiceFromMeta)(e.meta,m.NODE_SERVICES.AUTH);return P()(o,"config.whoCanAccess")?kn(o.config.whoCanAccess,t):{access:m.WHO_CAN_ACCESS.ALL,roles:[]}};function wn(e){let{blocklet:n,ancestors:t,children:i}=e;const o=(0,ln.Z)(),[a,r]=(0,l.useState)(""),{t:s,locale:c}=(0,k.PE)(),{api:d}=(0,ie.h6)(),{roles:u}=(0,ke.DJ)(),[h,f]=(0,l.useState)(""),g=t[0]||n,{access:x,roles:v}=Cn(n,g,{roles:u}),[b,Z]=(0,l.useState)(x),[j,y]=(0,l.useState)(v),C=[...t.map((e=>e.meta.did)),n.meta.did],S={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:o.palette.text.secondary},E=t.concat(n).map((e=>(0,w.getDisplayName)(e,!0))).join(" / ");if((0,oe.wS)(n.status))return null;if("unknown"===n.status&&(0,oe.wS)(n.status))return null;const L=()=>{r(!1)},P=e=>{e.stopPropagation(),r(!0)},O=h||b===jn&&!j.length;return["function"===typeof i?i({open:P}):(0,X.jsx)(K.Z,{onClick:P,"data-cy":"action-config-component",children:(0,X.jsx)(mn.default,{})}),a&&(0,X.jsxs)(Sn,{open:!0,fullWidth:!0,title:E,onClose:L,PaperProps:{style:{minHeight:"auto"}},actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N.Z,{onClick:L,color:"inherit","data-cy":"config-access-cancel",children:s("common.cancel")}),(0,X.jsxs)(N.Z,{onClick:async()=>{if(!h){f(!0);try{let e=b;e===jn&&(e="".concat(m.WHO_CAN_ACCESS_PREFIX_ROLES).concat(j.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:C,whoCanAccess:e}}),B.Z.success(s("blocklet.config.access.updatedTip")),L(),f(!1)}catch(e){f(!1),B.Z.error((0,oe.Z)(e))}}},color:"primary",disabled:O,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[h&&(0,X.jsx)(D.Z,{size:16}),s("common.confirm")]})]}),children:[(0,X.jsx)(p.Z,{mt:4,mb:3,children:(0,X.jsx)(V.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:b,onChange:e=>{const{value:n}=e.target;Z(n)},"data-cy":"config-access-select",SelectProps:{renderValue:e=>{const n=yn.find((n=>n.value===e));return n?(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(n.icon,{style:S}),n.title[c]]}):null}},children:yn.map((e=>(0,X.jsxs)(En,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center",children:[(0,X.jsx)(e.icon,{style:S}),(0,X.jsx)(p.Z,{children:e.title[c]})]}),(0,X.jsx)(p.Z,{children:(0,X.jsx)(p.Z,{className:"tip",children:e.description[c]})})]})))})}),b===jn&&(0,X.jsx)(p.Z,{mt:4,mb:3,children:(0,X.jsx)(V.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:j.map((e=>e.name)),onChange:e=>{y(u.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,X.jsx)(p.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=u.find((n=>n.name===e));return(0,X.jsx)(W.Z,{label:n.title},n.text)}))})},children:u.map((e=>{let{name:n,title:t}=e;return(0,X.jsxs)(un.Z,{value:n,children:[(0,X.jsx)(je.Z,{checked:j.some((e=>e.name===n))}),(0,X.jsx)(hn.Z,{primary:t})]},n)}))})})]})]}wn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},wn.defaultProps={ancestors:[],children:null};const Sn=(0,a.Z)(ge.ZP)(bn||(bn=(0,o.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"]))),En=(0,a.Z)(un.Z)(Zn||(Zn=(0,o.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(e=>e.theme.palette.text.secondary));var Ln;function Pn(e){var n;let{blocklet:t,ancestors:i,depth:o}=e;const a=(0,ln.Z)(),{t:r,locale:s}=(0,k.PE)(),{roles:c}=(0,ke.DJ)(),[d,u]=(0,l.useState)(!0),{recommendedDomain:m}=(0,me.y0)(),h=i[0]||t,f="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,oe.vH)({blocklet:h,domain:{value:m},mountPoint:f,params:(0,oe.f0)(h,s)}),x={fill:a.palette.text.secondary},v=o>0&&t.children.length>0,b=(0,X.jsx)(K.Z,{size:"small",children:d?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),{access:y,roles:C}=Cn(t,h,{roles:c});let E;if("roles"!==y)E=vn.find((e=>e.value===y))||vn[2];else{const e=C.map((e=>e.title)).join("/");E={title:{zh:"\u53ea\u6709 ".concat(e," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(e," can access")}}}return[(o>0||"gateway"!==t.meta.group)&&(0,X.jsxs)(p.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,X.jsxs)(p.Z,{pl:Math.max(2*(o-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:v?"pointer":"cursor"},onClick:()=>v&&u(!d),children:[v?b:(0,X.jsx)(p.Z,{width:28}),(0,X.jsx)(S.Z,{blocklet:t,ancestors:i}),(0,X.jsxs)(p.Z,{ml:"16px",children:[(0,X.jsx)(p.Z,{style:{color:"#222",fontSize:18},children:(0,w.getDisplayName)(t,!0)}),(0,X.jsx)(p.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(p.Z,{color:"text.secondary",children:E.title[s]})})]})]},t),(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(an.Z,{title:r("common.visit"),children:(0,X.jsx)("a",{target:"_blank",href:g,rel:"noopener noreferrer",title:g,children:(0,X.jsx)(K.Z,{children:(0,X.jsx)(sn.Z,{})})})}),(0,X.jsx)(wn,{blocklet:t,ancestors:i,children:e=>{let{open:n}=e;return(0,X.jsx)(an.Z,{title:r("common.edit"),children:(0,X.jsx)(K.Z,{onClick:n,"data-cy":"btn-edit-".concat(t.meta.did),children:(0,X.jsx)(cn.Z,{style:x})})})}})]},"actions")]},"group-not-gateway-box"),(0,X.jsx)(dn.Z,{depth:o},"line"),null!==(n=t.children)&&void 0!==n&&n.length?(0,X.jsx)(rn.Z,{in:d,children:t.children.map((e=>(0,X.jsx)(Pn,{blocklet:e,ancestors:[...i,t],depth:o+1},"".concat(o+1,"-").concat(e.meta.did))))},"blocklet-collapse"):null]}function On(){const{t:e}=(0,k.PE)(),{blocklet:n}=(0,me.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,X.jsx)(Rn,{component:"div",children:t&&t.length?[(0,X.jsx)(p.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,X.jsx)(Pn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,X.jsx)(p.Z,{mt:8,children:(0,X.jsx)(_e.Z,{children:e("blocklet.component.noComponent")})})})}Pn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},Pn.defaultProps={ancestors:[],depth:0},On.propTypes={};const Rn=(0,a.Z)(p.Z)(Ln||(Ln=(0,o.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"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)));var Tn=t(36095),An=t(20877),Nn=t(55498),In=t(21764),_n=t(25125),Bn=t(13573),Fn=t(69210),Dn=t(56556),zn=t(44784);const Un={enabled:!1,domain:"",clientId:"",clientSecret:""};const Kn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Un},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Un))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:e})}}),a=Object.assign({...Un},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.domainDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientIdDescription"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientSecretDescription"))),v=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"domain",control:s,rules:{validate:m?f:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,label:o("oauth.auth0.domain"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?g:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.auth0.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?x:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",error:!!c.errors[t.name],label:o("oauth.auth0.clientSecret"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Dn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Wn={enabled:!1,clientId:"",clientSecret:""};const qn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Wn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.github)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Wn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({github:e})}}),a=Object.assign({...Wn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.github)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.github.clientIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.github.clientSecretDescription"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.github.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?f:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.github.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",label:o("oauth.github.clientSecret"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Dn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Gn={enabled:!1,clientId:"",clientSecret:""};const Mn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Gn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.google)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Gn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({google:e})}}),a=Object.assign({...Gn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.google)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.google.clientIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.google.clientSecretDescription"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.google.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?f:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.google.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",label:o("oauth.google.clientSecret"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Dn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Vn={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};const Hn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Vn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.apple)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Vn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({apple:e})}}),a=Object.assign({...Vn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.apple)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.teamIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.serviceIdDescription"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.keyIdDescription"))),v=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.authKeyDescription"))),b=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.bundleIdDescription"))),Z=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.apple.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"teamId",control:s,rules:{validate:m?f:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.teamId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"bundleId",control:s,rules:{validate:m?b:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.bundleId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"serviceId",control:s,rules:{validate:m?g:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.serviceId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"keyId",control:s,rules:{validate:m?x:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.keyId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"authKey",control:s,rules:{validate:m?v:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",multiline:!0,rows:4,label:o("oauth.apple.authKey"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Dn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})};var Yn=t(46711),Jn=t(2266),Qn=t(76223),Xn=t(34435),$n=t(6837);function et(e){let{title:n,id:t,children:i,index:o,onMove:a,defaultExpand:r,onEnd:s}=e;const[c,d]=(0,l.useState)(r),u=(0,l.useRef)(null),m=(0,l.useRef)(null),[{handlerId:h},f]=(0,Yn.L)({accept:"dragItem",collect:e=>({handlerId:e.getHandlerId()}),hover(e,n){var t,i;if(!u.current)return;const l=e.index,r=o;if(l===r)return;const s=null===(t=u.current)||void 0===t?void 0:t.getBoundingClientRect(),c=null===(i=m.current)||void 0===i?void 0:i.getBoundingClientRect(),d=(c.bottom-c.top)/2,p=n.getClientOffset().y-s.top;l<r&&p<d||l>r&&p>d||(a(l,r),e.index=r)}}),[{isDragging:g},x]=(0,Jn.c)({item:{index:o,type:"dragItem"},collect:e=>({isDragging:e.isDragging()}),end:s});x(m),f(u);const v=g?.5:1,b=(0,Ke.Z)((e=>{e.preventDefault(),e.stopPropagation(),d(!c)}));return(0,X.jsxs)(p.Z,{ref:u,sx:{borderBottom:"1px solid ".concat(Qn.E.lineBorderStrong)},children:[(0,X.jsx)(p.Z,{sx:{cursor:"pointer","&:hover":{backgroundColor:Qn.E.backgroundsBgSubtileHover},borderRadius:2},ref:m,"data-handler-id":h,children:(0,X.jsxs)(p.Z,{sx:{py:1.5,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[(0,X.jsx)(p.Z,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:Qn.E.textMuted,"&:hover":{color:Qn.E.textSubtitle}},children:(0,X.jsx)(Nn.JO,{fontSize:20,icon:Xn.Z})}),(0,X.jsx)(ve.Z,{sx:{flex:1},children:n}),(0,X.jsx)(K.Z,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:(0,X.jsx)(Nn.JO,{icon:$n.Z,style:{transform:"scale(1.5)"}})})]})}),(0,X.jsx)(p.Z,{sx:{pl:4,py:1,display:c?"block":"none"},children:i})]})}et.propTypes={title:s().string.isRequired,id:s().string.isRequired,children:s().node.isRequired,index:s().number.isRequired,onMove:s().func.isRequired,onEnd:s().func.isRequired,defaultExpand:s().bool},et.defaultProps={defaultExpand:!0};const nt=[{name:"github",title:"GitHub",icon:(0,X.jsx)(Nn.JO,{icon:_n.Z}),component:(0,X.jsx)(qn,{})},{name:"google",title:"Google",icon:(0,X.jsx)(Nn.JO,{icon:Bn.Z}),component:(0,X.jsx)(Mn,{})},{name:"apple",title:"Apple",icon:(0,X.jsx)(Nn.JO,{icon:In.Z}),component:(0,X.jsx)(Hn,{})},{name:"auth0",title:"Auth0",icon:(0,X.jsx)(Nn.JO,{icon:Fn.Z}),component:(0,X.jsx)(Kn,{})}],tt=["github","google","apple","auth0"];function it(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.oauth)||{},a=Object.keys(l).sort(((e,n)=>{var t,i,o;return void 0!==(null===(t=l[e])||void 0===t?void 0:t.order)&&void 0!==(null===(i=l[n])||void 0===i?void 0:i.order)?l[e].order-l[n].order:void 0!==(null===(o=l[e])||void 0===o?void 0:o.order)?-1:1}));for(const p of tt)a.includes(p)||a.push(p);const r=(0,Ue.Z)(a.reduce(((e,n,t)=>Object.assign(e,{[n]:t})),{})),s=(0,Be.Z)((()=>{const e=[...nt];return e.sort(((e,n)=>r[e.name]-r[n.name])),e}),[r.auth0,r.github,r.google]),c={};"undefined"!==typeof window&&(c.context=window);const d=(0,Ke.Z)((async e=>{const n={};Object.keys(e).forEach((t=>{n[t]={order:e[t]}})),await t.configOAuth({input:{did:o,oauth:JSON.stringify(n)}})})),u=(0,Ke.Z)(((e,n)=>{const t=s[e],i=s[n];r[t.name]=n,r[i.name]=e})),m=(0,Ke.Z)((async()=>{await d(r)}));return(0,X.jsx)(p.Z,{children:(0,X.jsx)(Tn.W,{backend:An.HTML5Backend,...c,children:s.map(((e,n)=>(0,X.jsx)(et,{index:n,id:e.name,title:e.title,icon:e.icon,onMove:u,onEnd:m,defaultExpand:e.enabled,children:e.component},e.name)))})})}var ot=t(62362),lt=t(24103);const at={ttl:m.SESSION_TTL};function rt(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function st(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=Object.assign({},at,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:a,control:r,formState:s,reset:c}=(0,We.cI)({defaultValues:ze()(rt(l),["ttl"])}),{t:d}=(0,k.PE)(),u=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:rt(e,!0)}}),l=Object.assign({},at,ze()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(rt(l)),B.Z.success(d("common.configSuccess"))}catch(i){B.Z.error(i.message)}}));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:a(u),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"ttl",control:r,render:e=>{let{field:n}=e;return(0,X.jsx)(Fe.Z,{fullWidth:!0,sx:{mb:2},children:(0,X.jsxs)(lt.Z,{px:3,children:[(0,X.jsx)(p.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,X.jsx)(ot.ZP,{...n,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})}}),(0,X.jsx)(Dn.Z,{type:"submit",variant:"contained",onSubmit:a(u),disabled:!s.isDirty,children:d("oauth.save")})]})})}var ct=t(82555),dt=t(30333),ut=t(75760),mt=t(97038),pt=t(64886),ht=t(42080),ft=t.n(ht),gt=t(75506),xt=t.n(gt),vt=t(47685),bt=t(13260),Zt=t(82434),jt=t.n(Zt);const yt=(0,l.forwardRef)(((e,n)=>{var t;const{t:i}=(0,l.useContext)(k.RD),{blocklet:o}=(0,me.y0)(),{api:a}=(0,ie.h6)(),r=(0,Ue.Z)({mode:"view",show:!1,data:{},callback:Qe()}),s=(0,vt.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ke.Z)((()=>{r.mode="view",r.data={},r.callback=Qe()}),[]),m=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{d()}),c)}),[]),h=(0,Ke.Z)((e=>{r.mode="view",r.show=!0,r.data=e}),[]),f=(0,Ke.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe();r.mode="approve",r.show=!0,r.data=e,r.callback=n}),[]);(0,l.useImperativeHandle)(n,(()=>({open:h,close:m,approve:f})),[h,m,f]);const g=(0,Be.Z)((()=>{if(!r.show)return[];r.data.migratedFrom=[r.data.appId,r.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==r.data.isMaster&&ft()(e,"appliedAt","status"),e.map((e=>{const n=i("federated.info.".concat(e));let t=r.data[e];if("appName"===e&&r.data.isMaster&&(t=(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(ct.Z,{component:dt.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,X.jsx)(bt.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,X.jsx)(p.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=jt()(t)?t:u()(r.data.appUrl||"",t||"");try{const n=new URL(e);n.searchParams.set("imageFilter","resize"),n.searchParams.set("w","80"),n.searchParams.set("h","80"),t=(0,X.jsx)("img",{src:n.href,width:"60",height:"60",alt:r.data.appName})}catch{t=(0,X.jsx)("img",{src:e,width:"60",height:"60",alt:r.data.appName})}}if("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e){t=(r.data.migratedFrom||[]).filter((e=>![r.data.appId,r.data.appPid].includes(e))).map((e=>(0,X.jsx)(bt.kL,{children:e})))}return xt()(t)&&(t="-"),{name:n,value:t}}))}),[r.data]),x="approve"===r.mode,v=(0,Ke.Z)((async()=>{await a.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"rejected"}}),m(),null===r||void 0===r||r.callback(!1)})),b=(0,Ke.Z)((async()=>{await a.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"approved"}}),m(),null===r||void 0===r||r.callback(!0)}));return(0,X.jsx)(ge.ZP,{open:r.show,title:i(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:m,actions:x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Dn.Z,{color:"error",variant:"contained",onClick:v,children:i("common.reject")}),(0,X.jsx)(Dn.Z,{variant:"contained",onClick:b,children:i("common.approve")})]}):(0,X.jsx)(Dn.Z,{variant:"outlined",onClick:m,children:i("common.close")}),children:g.map((e=>(0,X.jsx)(pt.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var kt=t(79842),Ct=t(85408),wt=t.n(Ct);const St=(0,l.forwardRef)(((e,n)=>{var t;const i=(0,vt.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,{t:a}=(0,l.useContext)(k.RD),r=(0,Ue.Z)({show:!1,data:{link:""}}),s=(0,Ke.Z)((()=>{r.data.link=""}),[]),c=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{s()}),o)}),[]),d=(0,Ke.Z)((e=>{let{link:n}=e;r.show=!0,r.data.link=n}),[]);(0,l.useImperativeHandle)(n,(()=>({open:d,close:c})),[d,c]);const u=(0,Ke.Z)((()=>{wt()(r.data.link),c()}),[c]);return(0,X.jsxs)(ge.ZP,{open:r.show,title:a("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:u,children:a("common.copyAndClose")}),children:[(0,X.jsx)(p.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,X.jsx)(p.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,X.jsx)(kt.Z,{language:"shell",style:{marginBottom:0},children:r.data.link})})]})}));function Et(e){var n,t,i;let{mode:o}=e;const a=(0,l.useRef)(null),r=(0,l.useRef)(null),{t:s,locale:c}=(0,l.useContext)(k.RD),{blocklet:d,actions:{refreshBlocklet:u}}=(0,me.y0)(),{confirmApi:m,confirmHolder:h}=$e(),{api:f}=(0,ie.h6)(),g=(null===(n=d.settings.federated)||void 0===n?void 0:n.sites)||[],x=(null===(t=d.settings.federated)||void 0===t?void 0:t.config)||{},v=!1!==x.isMaster,b=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.open(e)})),Z=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.approve(e,u)})),j=(0,Ke.Z)((e=>{m.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),async onConfirm(n){await f.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"revoked"}}),n()}})})),y=(0,Ke.Z)((e=>{m.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),async onConfirm(n){await f.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"approved"}}),n()}})})),C=(0,Be.Z)((()=>{const e=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{display:"inline-block",children:(0,X.jsxs)(p.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,X.jsx)(ct.Z,{component:dt.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=g[e];return(0,X.jsx)(mt.Z,{children:n.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{children:t?"-":s("federated.status.".concat(n.status))})}}}];return v&&e.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{display:"flex",gap:1,children:t?(0,X.jsxs)(X.Fragment,{children:["rejected"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.rejected")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.revoked")})]}):(0,X.jsxs)(X.Fragment,{children:["pending"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"primary",size:"small",onClick:e=>{e.stopPropagation(),Z(n)},children:s("federated.status.pending")}),"approved"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),j(n)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),y(n)},style:{whiteSpace:"nowrap"},children:s("federated.approve")})]})})}}}),e}),[x.appId,g,v,s]),w=(0,Be.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=g[t];b(i)}})),[]),S=(0,Ke.Z)((()=>{const e=d.environments.find((e=>e.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=a.current)||void 0===n||n.open({link:e.value}):B.Z.error(s("federated.failedToGetFederatedLoginLink"))}),[null===(i=d.site)||void 0===i||null===(i=i.domainAliases)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.href]),E=(0,Ke.Z)((()=>{m.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),async onConfirm(e){await f.quitFederatedLogin({input:{did:d.appPid}}),e()}})})),L=(0,Ke.Z)((()=>{m.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),async onConfirm(e){await f.disbandFederatedLogin({input:{did:d.appPid}}),e()}})})),P=[];return"master"!==o?P.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",color:"error",onClick:E,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")):(P.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",onClick:S,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),P.push((0,X.jsx)(N.Z,{color:"error",size:"small",variant:"contained",onClick:L,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ut.Z,{className:"main-table",locale:c,data:g,columns:C,customButtons:P,title:(0,X.jsx)(p.Z,{className:"table-toolbar-left",children:s("oauth.federated")}),options:w}),h,(0,X.jsx)(St,{ref:a}),(0,X.jsx)(yt,{ref:r})]})}Et.propTypes={mode:s().oneOf(["member","master"])},Et.defaultProps={mode:"member"};const Lt=Et,Pt=(0,l.forwardRef)(((e,n)=>{var t;const{t:i}=(0,l.useContext)(k.RD),{api:o}=(0,ie.h6)(),{blocklet:a}=(0,me.y0)(),r=null===a||void 0===a?void 0:a.appPid,s=(0,vt.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ue.Z)({show:!1,appUrl:"",appUrlError:"",callback:Qe()}),u=(0,Ke.Z)((()=>{d.appUrl="",d.appUrlError="",d.callback=Qe()}),[]),m=(0,Ke.Z)((()=>{d.show=!1,setTimeout((()=>{u()}),c)}),[]),h=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe();d.show=!0,d.callback=e}),[]);(0,l.useImperativeHandle)(n,(()=>({open:h,close:m})),[h,m]);const f=(0,Ke.Z)((e=>{if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!jt()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),g=(0,Ke.Z)((async()=>{try{f(d.appUrl);const e=await o.joinFederatedLogin({input:{did:r,appUrl:d.appUrl}});d.show=!1,m(),null===d||void 0===d||d.callback(e)}catch(e){d.appUrlError=e.message}}),[m,r]);return(0,X.jsxs)(ge.ZP,{open:d.show,title:i("federated.joinFederatedLogin"),onClose:m,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:g,children:i("common.confirm")}),children:[(0,X.jsx)(p.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,X.jsx)(V.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:d.appUrl,error:!!d.appUrlError,helperText:d.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{d.appUrl=e.target.value}})]})}));function Ot(){var e,n;const t=(0,l.useRef)(null),i=(0,l.useRef)(null),{t:o}=(0,l.useContext)(k.RD),{blocklet:a,actions:{refreshBlocklet:r}}=(0,me.y0)(),s=(0,Ke.Z)((()=>{var e;const n=null===(e=a.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href;if(n)try{var i;const e=new URL(n);null===(i=t.current)||void 0===i||i.open({link:e.origin})}catch{B.Z.error(o("federated.failedToGetFederatedLoginLink"))}}),[null===(e=a.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href]),c=(0,Ke.Z)((()=>{var e;null===(e=i.current)||void 0===e||e.open((()=>{r()}))}),[r]);if((null===(n=a.settings.federated)||void 0===n?void 0:n.sites.length)>0){var d;const e=!1!==(null===(d=a.settings.federated)||void 0===d?void 0:d.config.isMaster);return(0,X.jsx)(Lt,{mode:e?"master":"member"})}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(p.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,X.jsx)(N.Z,{variant:"contained",onClick:s,children:o("federated.inviteJoinFederatedLogin")}),(0,X.jsx)(A.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,X.jsx)(N.Z,{variant:"outlined",onClick:c,children:o("federated.joinFederatedLogin")})]}),(0,X.jsx)(St,{ref:t}),(0,X.jsx)(Pt,{ref:i})]})}const Rt=function(){const{t:e}=(0,l.useContext)(k.RD),n=[{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.oauth")}),value:"oauth"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,l.useState)(n[0].value),o=(0,Be.Z)((()=>({oauth:(0,X.jsx)(it,{}),federated:(0,X.jsx)(Ot,{}),more:(0,X.jsx)(p.Z,{children:(0,X.jsx)(_e.Z,{children:e("oauth.comingSoon")})}),settings:(0,X.jsx)(p.Z,{children:(0,X.jsx)(st,{})})})),[e]);return(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(C.Z,{tabs:n,current:t,onChange:i}),(0,X.jsx)(p.Z,{marginTop:"10px",children:o[t]})]})};var Tt;const At=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:l}=e;const a=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),r=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,X.jsxs)(p.Z,{pl:2*Math.max(1,o-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[r?(0,X.jsx)(E.Z,{size:24,blocklet:t}):(0,X.jsx)(S.Z,{size:24,blocklet:t,ancestors:i}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:r?l("blocklet.component.container"):(0,w.getDisplayName)(t,!0)})})]},a),value:a}),t.children.length>0&&t.children.forEach((e=>{At({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:l})}))};function Nt(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:o}=(0,l.useContext)(k.RD),{info:a,inService:r}=(0,ie.h6)(),[s,d]=(0,l.useState)(!0),[w,S]=(0,y.useSearchParams)(),E=w.get("tab")||"general",L=[{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,X.jsx)(f.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.general")})})]},"general"),value:"general"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,X.jsx)(g.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.access")})})]},"access"),value:"access"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-authentication",children:[(0,X.jsx)(x.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.login")})})]},"authentication"),value:"authentication"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,X.jsx)(v.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.notification")})})]},"notification"),value:"notification"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,X.jsx)(p.Z,{ml:-2,style:{transform:"translateY(2px)"},children:s?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),(0,X.jsx)(b.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.preferences")})})]},"preference"),value:"preference"}];s&&At({tabs:L,blocklet:n,t:o});let P=null;if("general"===E)P=(0,X.jsx)(Ne,{blocklet:n,onUpdate:t});else if("access"===E)P=(0,X.jsx)(On,{});else if("authentication"===E)P=(0,X.jsx)(Rt,{});else if("notification"===E)P=(0,X.jsx)(on,{});else{const e=r?m.WELLKNOWN_SERVICE_PATH_PREFIX:a.routing.adminPath,n=new URLSearchParams;r||n.set("authKey","__sst"),n.set("schemaKey",u()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(E)))),P=(0,X.jsx)(c.Z,{url:"".concat(u()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,X.jsx)(It,{...i,children:(0,X.jsxs)(h.ZP,{container:!0,spacing:4,columns:24,children:[(0,X.jsx)(h.ZP,{item:!0,sm:7,md:5,children:(0,X.jsx)(C.Z,{tabs:L,current:E,orientation:"vertical",onChange:e=>{"preference"===e?d(!s):S((n=>("general"===e?n.delete("tab"):n.set("tab",e),n)))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,X.jsx)(h.ZP,{item:!0,sm:17,md:19,children:(0,X.jsx)(p.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}Nt.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},Nt.defaultProps={onUpdate:()=>{}};const It=a.Z.div(Tt||(Tt=(0,o.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"])))},78410:(e,n,t)=>{t.d(n,{Z:()=>m});var i=t(5057),o=t(86229),l=t(28726),a=t(44846),r=t(68420),s=t(46090),c=t(58238),d=t(70461),u=t(96266);function m(e){let{teamDid:n,size:t="small",...m}=e;const{t:p}=(0,r.PE)(),{api:h}=(0,c.h6)(),[f,g]=(0,i.useState)(!1),[x,v]=(0,i.useState)(null),b={title:p("blocklet.config.clearCache.title"),description:p("blocklet.config.clearCache.description"),confirm:p("common.confirm"),cancel:p("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await h.clearCache({input:{teamDid:n}});o.Z.success(p("blocklet.config.clearCache.success",{count:(null===(e=t.removed)||void 0===e?void 0:e.length)||0}))}catch(t){o.Z.error((0,s.Z)(t))}finally{g(!1),v(null)}},onCancel:()=>{g(!1),v(null)}};return(0,u.jsxs)("div",{...m,children:[(0,u.jsxs)(l.Z,{onClick:()=>v(b),color:"error",variant:"outlined",size:t,children:[f?(0,u.jsx)(a.Z,{size:16,style:{marginRight:5}}):null,p("blocklet.config.clearCache.action")]}),x&&(0,u.jsx)(d.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}},50185:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(5057),o=t(55898),l=t.n(o),a=t(12937),r=t(68420),s=t(96266);function c(e){let{children:n,...t}=e;const{t:o}=(0,i.useContext)(r.RD);return(0,s.jsx)(a.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:l().any.isRequired}},28641:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),l=t.n(o),a=t(39948),r=t(47020),s=t(44846),c=t(13727),d=t(56184),u=t(67680),m=t(35406),p=t(11875),h=t(95890),f=t(96266);const g=(e,n,t)=>null===e&&n&&t?"******":e?n?"******":e:"";function x(e){let{label:n,disabled:t,required:o,initialValue:l,onChange:x,placeholder:v,style:b,onSubmit:Z,secure:j,triggers:y,formatterBeforeSubmit:k,...C}=e;const[w,S]=(0,i.useState)(!1),[E,L]=(0,i.useState)(!1),[P,O]=(0,i.useState)(j&&"__encrypted__"===l?null:l),[R,T]=(0,i.useState)(P),A=async()=>{L(!0);try{if(!1===await Z(R))T(P);else{let e=R;"function"===typeof k&&(e=k(R)),T(e),O(e)}}catch(e){T(P)}finally{L(!1),S(!1)}},N=w?(0,f.jsx)(r.Z,{style:{flex:1},fullWidth:!0,value:R,onChange:e=>{var n;n=e.target.value,T(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:v,onKeyDown:e=>{"Enter"===e.key&&A()},disabled:t,type:j?"password":"text",...C}):(0,f.jsx)(a.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(R,j,l)});return(0,f.jsx)(p.Z,{className:"form",style:b,children:(0,f.jsxs)(a.Z,{className:"form-item",children:[(0,f.jsxs)(a.Z,{className:"form-item-label",children:[n,o&&(0,f.jsx)(m.Z,{})]}),(0,f.jsxs)(a.Z,{className:"form-item-body",children:[(0,f.jsx)(a.Z,{className:"form-item-input",children:N}),(0,f.jsx)(a.Z,{className:"form-item-action",children:w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Z,{"data-cy":"schema-form-item-confirm",onClick:A,disabled:t||E,size:"large",children:E?(0,f.jsx)(s.Z,{size:24}):(0,f.jsx)(d.Z,{})}),(0,f.jsx)(u.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{T(P),S(!1)},disabled:t||E,size:"large",children:(0,f.jsx)(c.default,{})})]}):(0,f.jsx)(h.Z,{triggers:y,onEnterEdit:()=>S(!0),disabled:t})})]})]})})}x.propTypes={style:l().object,onSubmit:l().func,onChange:l().func,label:l().string,initialValue:l().string,placeholder:l().string,required:l().bool,disabled:l().bool,secure:l().bool,triggers:l().array,formatterBeforeSubmit:l().func},x.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null}},11875:(e,n,t)=>{t.d(n,{Z:()=>r});var i,o=t(71171),l=t(33518),a=t(39948);const r=(0,l.Z)(a.Z)(i||(i=(0,o.Z)(["\n width: 100%;\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 /* max-height: 60vh; */\n }\n\n .form-item {\n width: 100%;\n margin-bottom: 24px;\n position: relative;\n "," {\n flex-wrap: wrap;\n justify-content: space-between;\n width: 100%;\n flex-shrink: 0;\n }\n }\n\n .form-item-body {\n display: flex;\n align-items: center;\n width: 100%;\n margin-top: 4px;\n }\n\n .form-item-label {\n line-height: 1.2;\n font-size: 14px;\n color: #888;\n font-weight: bold;\n\n "," {\n text-align: left;\n width: auto;\n flex-grow: 1;\n }\n }\n\n .form-item-input {\n flex-grow: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &.slot {\n height: 40px;\n line-height: 40px;\n background: #f8f8f8;\n font-size: 16px;\n\n .MuiChip-root {\n margin-top: -4px;\n }\n }\n\n .MuiSelect-select {\n padding: 8px;\n }\n }\n\n .form-item-action {\n // width: 100px;\n text-align: left;\n margin-left: 12px;\n flex-shrink: 0;\n "," {\n width: auto;\n margin-left: 0px;\n }\n .MuiIconButton-root {\n padding: 8px;\n svg {\n fill: #888;\n }\n &.Mui-disabled {\n opacity: 0.4;\n }\n }\n }\n"])),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")))},95890:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),l=t.n(o),a=t(24558),r=t(67680),s=t(56556),c=t(80633),d=t(49390),u=t(72113),m=t(25228),p=t(49020),h=t(74490),f=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const l=i.useRef(null),[x,v]=i.useState(!1);return 0===n.length?(0,g.jsx)(r.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(a.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:l,"aria-label":"split button",children:[(0,g.jsx)(s.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(a.Z,{})}),(0,g.jsx)(s.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{v((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(p.Z,{sx:{zIndex:9999},open:x,anchorEl:l.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(m.Z,{children:(0,g.jsx)(u.d,{onClickAway:e=>{l.current&&l.current.contains(e.target)||v(!1)},children:(0,g.jsx)(f.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(h.Z,{onClick:()=>{return n=e.handler,v(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:l().arrayOf(l().shape({key:l().string.isRequired,title:l().string.isRequired,handler:l().func.isRequired})),onEnterEdit:l().func.isRequired,disabled:l().bool.isRequired},x.defaultProps={triggers:[]}},35406:(e,n,t)=>{t.d(n,{Z:()=>l});var i,o=t(71171);const l=t(33518).Z.span(i||(i=(0,o.Z)(["\n color: ",";\n &::before {\n content: '*';\n }\n"])),(e=>e.theme.palette.error.main))},54063:(e,n,t)=>{t.d(n,{C:()=>i});const i="true"===localStorage.getItem("enableDebug")}}]);