@abtnode/webapp 1.16.22-beta-079a9053 → 1.16.22-beta-5bf86cd3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/build/asset-manifest.json +48 -48
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/{1371.08ecc84e.chunk.js → 1371.4f86888b.chunk.js} +1 -1
- package/build/static/js/1524.3b0ec35f.chunk.js +1 -0
- package/build/static/js/{1685.c6f7a83f.chunk.js → 1685.24d88e27.chunk.js} +2 -2
- package/build/static/js/2168.62300f53.chunk.js +1 -0
- package/build/static/js/{2183.e57ce8a2.chunk.js → 2183.ddd3936e.chunk.js} +1 -1
- package/build/static/js/{2334.6c96ef7e.chunk.js → 2334.84a8e434.chunk.js} +1 -1
- package/build/static/js/2365.16f3dbc1.chunk.js +1 -0
- package/build/static/js/{2537.a919ce43.chunk.js → 2537.10cf10fb.chunk.js} +1 -1
- package/build/static/js/271.ebf7defb.chunk.js +1 -0
- package/build/static/js/2743.7ccb1ce1.chunk.js +1 -0
- package/build/static/js/2746.fd77f428.chunk.js +1 -0
- package/build/static/js/{2960.e4c10af0.chunk.js → 2960.dc7a03a7.chunk.js} +1 -1
- package/build/static/js/3058.7f0e2deb.chunk.js +1 -0
- package/build/static/js/{3135.f99a1aa8.chunk.js → 3135.06e7d03e.chunk.js} +1 -1
- package/build/static/js/{3216.4aabeb78.chunk.js → 3216.5aaf107a.chunk.js} +1 -1
- package/build/static/js/3883.0112051a.chunk.js +1 -0
- package/build/static/js/406.c80917a9.chunk.js +1 -0
- package/build/static/js/436.f127179d.chunk.js +1 -0
- package/build/static/js/4382.a5f73253.chunk.js +2 -0
- package/build/static/js/{2365.a3571172.chunk.js → 4494.765058da.chunk.js} +1 -1
- package/build/static/js/{4509.04d35bd4.chunk.js → 4509.3cdaa94a.chunk.js} +2 -2
- package/build/static/js/4549.eb1a0008.chunk.js +1 -0
- package/build/static/js/{4775.124a71e4.chunk.js → 4775.b81d9965.chunk.js} +1 -1
- package/build/static/js/4901.ea8e5819.chunk.js +1 -0
- package/build/static/js/5015.bfc1ea50.chunk.js +1 -0
- package/build/static/js/{5074.5643e827.chunk.js → 5074.217389e9.chunk.js} +1 -1
- package/build/static/js/5374.31d70f69.chunk.js +1 -0
- package/build/static/js/{5526.7f392e7e.chunk.js → 5526.9376db8c.chunk.js} +2 -2
- package/build/static/js/5760.a3d6922a.chunk.js +1 -0
- package/build/static/js/{5887.530ce24e.chunk.js → 5887.6dc2a410.chunk.js} +2 -2
- package/build/static/js/5914.67e3aeec.chunk.js +2 -0
- package/build/static/js/592.88e3bf00.chunk.js +2 -0
- package/build/static/js/{5979.4e4ebbf1.chunk.js → 5979.75079fe1.chunk.js} +1 -1
- package/build/static/js/6016.d86b229d.chunk.js +1 -0
- package/build/static/js/{6230.467a9016.chunk.js → 6230.3bb084aa.chunk.js} +1 -1
- package/build/static/js/6511.ee040676.chunk.js +1 -0
- package/build/static/js/{6931.4d7ae323.chunk.js → 6931.d2496fd4.chunk.js} +1 -1
- package/build/static/js/6950.e6d42b1a.chunk.js +1 -0
- package/build/static/js/{7657.60faa231.chunk.js → 7657.3acd5e07.chunk.js} +2 -2
- package/build/static/js/7687.5f2226d4.chunk.js +1 -0
- package/build/static/js/{7875.a04872ec.chunk.js → 7875.904b3a92.chunk.js} +2 -2
- package/build/static/js/{8219.33f29652.chunk.js → 8219.07ee6bf9.chunk.js} +1 -1
- package/build/static/js/{9249.96584fcc.chunk.js → 9249.7f9c1c36.chunk.js} +1 -1
- package/build/static/js/9327.4c7b52f8.chunk.js +1 -0
- package/build/static/js/95.c12b33e8.chunk.js +1 -0
- package/build/static/js/{9552.29d817f2.chunk.js → 9552.87dae9a5.chunk.js} +1 -1
- package/build/static/js/main.3831c581.js +2 -0
- package/build/static/js/{main.f7eb1485.js.LICENSE.txt → main.3831c581.js.LICENSE.txt} +1 -1
- package/package.json +1 -1
- package/build/static/js/1185.4672e754.chunk.js +0 -2
- package/build/static/js/1524.dd0af8c0.chunk.js +0 -1
- package/build/static/js/2168.0e7f9ae7.chunk.js +0 -1
- package/build/static/js/2529.061c5064.chunk.js +0 -1
- package/build/static/js/271.f7901bf2.chunk.js +0 -1
- package/build/static/js/2743.99b9b3be.chunk.js +0 -1
- package/build/static/js/3058.cea35b61.chunk.js +0 -1
- package/build/static/js/3137.93dab4d8.chunk.js +0 -1
- package/build/static/js/3883.062d06a9.chunk.js +0 -1
- package/build/static/js/406.37ef18fa.chunk.js +0 -1
- package/build/static/js/4382.f8edadf8.chunk.js +0 -2
- package/build/static/js/4549.295531bf.chunk.js +0 -1
- package/build/static/js/4901.7dab9c36.chunk.js +0 -1
- package/build/static/js/5015.c33215f2.chunk.js +0 -1
- package/build/static/js/5509.2e6eb7fd.chunk.js +0 -1
- package/build/static/js/5760.02d5f257.chunk.js +0 -1
- package/build/static/js/5914.fbf45688.chunk.js +0 -2
- package/build/static/js/6016.036a6045.chunk.js +0 -1
- package/build/static/js/6511.44e20630.chunk.js +0 -1
- package/build/static/js/6580.fc3c74eb.chunk.js +0 -1
- package/build/static/js/6950.9da8ac88.chunk.js +0 -1
- package/build/static/js/7687.c54b6889.chunk.js +0 -1
- package/build/static/js/9327.cefafd96.chunk.js +0 -1
- package/build/static/js/95.08f81beb.chunk.js +0 -1
- package/build/static/js/main.f7eb1485.js +0 -2
- /package/build/static/js/{1685.c6f7a83f.chunk.js.LICENSE.txt → 1685.24d88e27.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4382.f8edadf8.chunk.js.LICENSE.txt → 4382.a5f73253.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{4509.04d35bd4.chunk.js.LICENSE.txt → 4509.3cdaa94a.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{5526.7f392e7e.chunk.js.LICENSE.txt → 5526.9376db8c.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{5887.530ce24e.chunk.js.LICENSE.txt → 5887.6dc2a410.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{5914.fbf45688.chunk.js.LICENSE.txt → 5914.67e3aeec.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{1185.4672e754.chunk.js.LICENSE.txt → 592.88e3bf00.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{7657.60faa231.chunk.js.LICENSE.txt → 7657.3acd5e07.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{7875.a04872ec.chunk.js.LICENSE.txt → 7875.904b3a92.chunk.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6230],{80378:(e,n,t)=>{t.d(n,{Z:()=>u});var i=t(55898),o=t.n(i),a=t(62681),l=t(72333),r=t(6352),s=t.n(r),c=t(35432),d=t(58238),p=t(14491);var m=t(96266);function u(e){let{blocklet:n,style:t,size:i,ancestors:o,...r}=e;const u=(0,d.h6)(),{logoUrl:f,inService:h}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:a}=o,l="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,p.XN)(null===t||void 0===t?void 0:t.status)?"~":"");let r=a?s()(p.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",l):s()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)r=s()(t.deployedFrom,(0,p.lk)(t.meta.bundleDid,t.meta.logo),l);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=a?n.slice(1):n;r=s()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),l)}return{logoUrl:r,inService:a}}({blocklet:n,ancestors:o}),{variant:g}=r,x=h?()=>{}:e=>{e.target.src="".concat(u.imgPrefix,"/blocklet.png")};let b=(0,m.jsx)("img",{src:f,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(b=(0,m.jsx)(l.Z,{did:n.meta.did||"",responsive:!0})),(0,m.jsx)(a.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...r,children:b})}u.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},u.defaultProps={style:{},size:40,ancestors:[]}},74286:(e,n,t)=>{t.d(n,{Z:()=>r});var i=t(55898),o=t.n(i),a=t(39948),l=t(96266);function r(e){let{depth:n}=e;return(0,l.jsx)(a.Z,{ml:Math.max(2*(n-1),0),sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}r.propTypes={depth:o().number},r.defaultProps={depth:1}},44784:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),a=t(33518),l=t(82790),r=t(96266);function s(e){let{labelProps:n,className:t,style:i,...o}=e;const a={...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)(l.Z,{labelProps:a,...o})})}s.propTypes=l.Z.propTypes,s.defaultProps=l.Z.defaultProps;const c=a.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),a=t(5057),l=t(55898),r=t.n(l),s=t(6352),c=t.n(s),d=t(33518),p=t(92706),m=t.n(p),u=t(39948),f=t(52277),h=t.n(f),g=t(68420),x=t(96266);const b=(0,a.lazy)((()=>Promise.all([t.e(1294),t.e(4382)]).then(t.bind(t,23826)).then((e=>({default:e.Uploader}))))),v="/blocklet/logo/upload";function Z(e){let{url:n,height:t,width:i,enabled:o,type:l,did:r,prefix:s,headers:d,onUploaded:p}=e;const{t:m}=(0,g.PE)(),f=(0,a.useRef)(null),Z={cursor:o?"pointer":"default","&::after":{content:'"'.concat(m("common.switch"),'"')}};return(0,x.jsxs)(j,{id:"uploader-".concat(r,"-").concat(l),children:[(0,x.jsx)(b,{ref:f,popup:!0,onUploadFinish:()=>{var e;p(),null===(e=f.current)||void 0===e||e.close()},plugins:["ImageEditor"],apiPathProps:{uploader:c()(s,v,l,r),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(u.Z,{className:h()("uploader-wrapper",o&&"enabled"),sx:Z,onClick:()=>{var e;null===(e=f.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(r,"-").concat(l))}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"])))},64558:(e,n,t)=>{t.r(n),t.d(n,{default:()=>pt});var i,o=t(71171),a=t(5057),l=t(33518),r=t(55898),s=t.n(r),c=t(96181),d=t(6352),p=t.n(d),m=t(35432),u=t(39948),f=t(55402),h=t(82275),g=t(96399),x=t(65688),b=t(37633),v=t(48037),Z=t(92273),j=t(76720),y=t(15849),C=t(68420),k=t(94464),w=t(38242),S=t(80378),E=t(1722),L=t(43681),P=t.n(L),R=t(50482),A=t.n(R),T=t(16147),_=t(29034),N=t(28726),O=t(80578),I=t(77277),F=t(86229),B=t(28641),z=t(44846),U=t(13727),D=t(56184),K=t(67680),W=t(19654),q=t(90067),G=t(63769),V=t(43897),H=t(47020),M=t(24202),Y=t(35406),J=t(11875),Q=t(95890),X=t(96266);function $(e){let{label:n,disabled:t,required:i,initialValue:o,onChange:l,style:r,onSubmit:s,triggers:c,options:d,formatterBeforeSubmit:p,helperText:m,placeholder:f,renderImage:h,renderLabel:g,filterKeys:x,noEmpty:b,...v}=e;const[Z,j]=(0,a.useState)(!1),[y,C]=(0,a.useState)(!1),[k,w]=a.useState(""),[S,E]=(0,a.useState)(o),[L,P]=(0,a.useState)(S),R=(0,a.useMemo)((()=>{if(!d)return{};const e={};return d.forEach((n=>{e[n.code]=n})),e}),[d]),A=Z?(0,X.jsx)(G.Z,{options:d,value:L,onChange:(e,n)=>{if(!Array.isArray(n))return P([]),void l([]);const t=n.filter((e=>R[e]));if(!t.length)return P([]),void l([]);P(t),l(t)},inputValue:k,onInputChange:(e,n)=>{w(n)},PopperComponent:ne,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:()=>{if(!d)return[];if(!k)return d.map((e=>e.code));const e=new RegExp(k.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=R[e])||void 0===n?void 0:n.name},renderInput:e=>(0,X.jsx)(H.Z,{...e,label:"",placeholder:f}),renderOption:(e,n)=>{var t;const i=-1!==L.indexOf(n);return(0,a.createElement)(ee,{component:"li",...e,key:n},h(R[n]||{}),(0,X.jsx)(u.Z,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:i?"700":"normal"},children:g(n,R[n])||(null===(t=R[n])||void 0===t?void 0:t.name)}),(0,X.jsx)(u.Z,{component:U.default,sx:{opacity:.5,width:18,height:18},style:{visibility:i?"visible":"hidden"}}))},...v}):(0,X.jsx)(u.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)(u.Z,{className:"form-item",children:[(0,X.jsxs)(u.Z,{className:"form-item-label",children:[n,i&&(0,X.jsx)(Y.Z,{})]}),(0,X.jsxs)(u.Z,{className:"form-item-body",children:[(0,X.jsx)(u.Z,{className:"form-item-input",children:A}),(0,X.jsx)(u.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()=>{C(!0);try{!1===await s("function"===typeof p?p(L):L)?P(S):b&&!L.length?(P(o),E(o)):(P(L),E(L))}catch(e){P(S)}finally{C(!1),j(!1)}},disabled:t||y,size:"large",children:y?(0,X.jsx)(z.Z,{size:24}):(0,X.jsx)(D.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)(U.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=l.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,l.Z)(M.Z)((()=>({["& .".concat(V.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(V.Z.listbox)]:{padding:0}})));var te,ie=t(58238),oe=t(14491),ae=t(54063),le=t(63406),re=t(78410),se=t(31853),ce=t(43316),de=t(70461),pe=t(73545),me=t(29054);function ue(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:a}=(0,C.PE)(),{api:l}=(0,pe.T)(),{blocklet:r}=(0,me.y0)(),[s,c]=(0,se.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),p=r.structVersion===m.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,oe.An)(r.status)?F.Z.error(a("blocklet.error.isRunning")):(0,w.isInProgress)(r.status)?F.Z.error(a("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,X.jsx)(B.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:p,secure:!0}),s.newAppSk&&(0,X.jsx)(de.Z,{title:a("blocklet.config.appSkTitle"),description:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,X.jsx)(u.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,X.jsxs)(fe,{children:[(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("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:l.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:r.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:d})]}ue.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},ue.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const fe=(0,l.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 he,ge=t(13128),xe=t(55372),be=t(11750),ve=t(88574),Ze=t(26174),je=t(88092),ye=t(50185),Ce=t(17425);function ke(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:o}=(0,a.useContext)(pe.B),[l,r]=(0,a.useState)(!1),{t:s,locale:c}=(0,C.PE)(),[d,p]=(0,a.useState)(""),[m,f]=(0,a.useState)(!1),[h,g]=(0,a.useState)(0),[x,b]=(0,a.useState)(""),{endpoint:v}=(0,Ce.DJ)(),[Z,j]=(0,a.useState)(!1),y=e=>{p(null),r(!0);try{b(e.result),g(w.length-1)}catch(n){const e=(0,oe.Z)(n);p(e),i(n)}finally{r(!1)}},k=()=>{f(!1),g(0)},w=[{body:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(be.Z,{children:s("team.transferApp.transferDialog.tips.progress")}),(0,X.jsx)(be.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:()=>{f(!0),g(1)}},{body:()=>(0,X.jsx)(ce.Z,{action:"transfer-app-owner",open:m,locale:c,checkFn:o.get,onClose:k,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:v});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(u.Z,{component:we,dangerouslySetInnerHTML:{__html:s("team.transferApp.transferDialog.createSuccessTip1")}}),(0,X.jsx)(u.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip3")})}),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.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)(u.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[h];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:l||h===w.length-1&&!Z,variant:"contained",autoFocus:!0,children:[l&&(0,X.jsx)(z.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)(ve.Z,{type:"error",variant:"icon",children:d})]})}ke.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},ke.defaultProps={onError:()=>{}};const we=l.Z.div(he||(he=(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(I.SUPPORTED_LANGUAGES).map((e=>({code:e,name:I.SUPPORTED_LANGUAGES[e].nativeName,enName:I.SUPPORTED_LANGUAGES[e].name}))),Re=["name","enName","code"];function Ae(e){var n;let{blocklet:t,onUpdate:i,hasPermission:o,...l}=e;const{api:r,inService:s,prefix:c,getSessionInHeader:d,ws:{useSubscription:p}}=(0,ie.h6)(),{t:f}=(0,a.useContext)(C.RD),[h,g]=(0,a.useState)(""),[x,b]=(0,a.useState)(""),[v,Z]=(0,a.useState)(!1),j=(0,w.getWhoCanAccess)(t),y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,k=x||!o,{logoUrl:S,rectLogoUrl:E,faviconUrl:L}=(0,Ee.Z)({blocklet:t}),{did:R}=t.meta,{site:z}=t,U=P()(t.meta,"capabilities.clusterMode",!1);if(p(m.EVENTS.NODE_RUNTIME_INFO,(e=>{U&&g(P()(e,"cpu.physicalCores",""))})),(0,oe.wS)(t.status))return null;const D=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!D||"yes"===D.value,W=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),G=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),V=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),H=[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:f("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:f("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:f("blocklet.config.appUrl"),value:q?q.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:f("blocklet.config.copyrightOwner"),value:G?G.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:f("blocklet.config.copyrightYear"),value:V?V.value:""}];if(U){const e=t.configs.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:h;H.push({key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:f("blocklet.config.clusterSize"),value:n,cpuCores:h})}const M=async(e,n)=>{if(e===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,oe.I)({value:n,cpuCores:h});if(e)return void F.Z.error(e)}const o=[{key:e,value:n}];try{b(!0);const{blocklet:e}=await r.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(a){F.Z.error(a.message)}finally{b(!1)}};return(0,X.jsxs)(Oe,{...l,children:[H.map((e=>(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:e.value,onSubmit:n=>M(e.key,n)})]}))),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:f("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)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoRect")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("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)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoFavicon")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("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)(u.Z,{className:"config-form",children:"all"===j&&"registry"===t.source&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.access.publicToStore"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.access.publicInstanceTip")})]}),(0,X.jsx)(T.Z,{disabled:k,checked:y,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.languages")}),(0,X.jsx)($,{style:{marginTop:0},disabled:x||k,loading:x,options:Pe,noEmpty:!0,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>M("BLOCKLET_APP_LANGUAGES",e),helperText:f("blocklet.config.selectLanguagesTip"),placeholder:f("blocklet.config.languagesSearch"),filterKeys:Re,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)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("common.security")})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("router.domainSecurity.cors.title")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:(z.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=z.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(A()(n,i))return!1;try{b(!0);const e=i.length?i:["__none__"];await r.updateRoutingSite({input:{id:z.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),b(!1)}catch(o){return F.Z.error(o.message),b(!1),!1}return!0}})]}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{mb:2,className:"config-label",fontSize:20,children:f("blocklet.config.dangerZone")}),(0,X.jsxs)(u.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:!s&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.deletable.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,X.jsx)(T.Z,{disabled:k,checked:!K,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:n?"no":"yes"}]}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.sk")}),(0,X.jsx)(ue,{disabled:x||k,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){b(!0);try{const{blocklet:n}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]}),s&&(0,X.jsx)(le.Z,{role:"owner",children:e=>(e||ae.C)&&(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("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)(O.Z,{style:{fontSize:"1.3em",marginRight:4}}),f("team.transferApp.name")]})]}),v&&(0,X.jsx)(ke,{onCancel:()=>Z(!1),onSuccess:()=>Z(!1)})]})}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.clearCache.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.clearCache.purpose")})]}),(0,X.jsx)(re.Z,{teamDid:R})]})})]})]})}const Te=(0,le.V)(Ae,"mutate_blocklets"),_e=(0,le.V)(Ae,"",oe.Wf);function Ne(e){const{inService:n}=(0,ie.h6)();return n?(0,X.jsx)(_e,{...e}):(0,X.jsx)(Te,{...e})}Ae.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Ae.defaultProps={onUpdate:()=>{},hasPermission:!1};const Oe=l.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 Ie=t(25710),Fe=t(93066),Be=t(80576),ze=t(8708),Ue=t.n(ze),De=t(12673),Ke=t(99360),We=t(80506),qe=t(766),Ge=t.n(qe),Ve=t(24529),He=t.n(Ve),Me=t(16727),Ye=t.n(Me),Je=t(92706),Qe=t.n(Je);const Xe=(0,a.forwardRef)(((e,n)=>{const{t:t}=(0,a.useContext)(C.RD),i=(0,De.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})),l=(0,Ke.Z)((()=>{i.title="",i.content="",i.onConfirm=Qe(),i.onCancel=Qe()})),r=(0,Ke.Z)((()=>{i.show=!1,setTimeout((()=>{l()}),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,a.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,a.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,t;const{api:i}=(0,ie.h6)(),{blocklet:o}=(0,me.y0)(),{t:a}=(0,C.PE)(),{confirmApi:l,confirmHolder:r}=$e(),s=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,c=Object.assign({...en},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.notification)||void 0===t?void 0:t.email)||{}),{handleSubmit:d,control:p,formState:m,watch:f,reset:h}=(0,We.cI)({defaultValues:Ue()(c,Object.keys(en))}),g=(0,De.Z)({testReceiver:"",testReceiverError:""}),x=f("enabled"),b=(0,Ke.Z)((async function(e,n){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];try{var o,l;const{blocklet:n}=await i.configNotification({input:{did:s,notification:JSON.stringify({email:e})}}),r=Object.assign({...en},(null===n||void 0===n||null===(o=n.settings)||void 0===o||null===(l=o.notification)||void 0===l?void 0:l.email)||{});h(r),t&&F.Z.success(a("oauth.saveSuccess"))}catch(r){if(!t)throw r;F.Z.error(r.message||a("oauth.saveFailed"))}})),v=(0,Ke.Z)((async(e,n,t)=>{try{m.isDirty&&await b(e,n,!1),await i.sendEmail({input:{did:s,receiver:t,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),F.Z.success(a("notification.email.testSuccess"))}catch(o){F.Z.error(o.message||a("notification.email.testfailed"))}})),Z=(0,Ke.Z)(((e,n)=>{g.testReceiver="",g.testReceiverError="",l.open({title:a("notification.email.testSendEmail"),content:()=>(0,X.jsx)(u.Z,{sx:{width:"300px"},children:(0,X.jsx)(H.Z,{fullWidth:!0,name:"testReceiver",label:a("notification.email.inputTestReceiver"),value:g.testReceiver,onChange:e=>{g.testReceiver=e.target.value},error:!!g.testReceiverError,helperText:g.testReceiverError||"\u3000"})}),async onConfirm(t){var i;const o=null===(i=g.testReceiver)||void 0===i?void 0:i.trim();o?Ge()(o)?(g.testReceiverError="",await v(e,n,o),t()):g.testReceiverError=a("notification.email.receiverInvalid"):g.testReceiverError=a("notification.email.receiverRequired")}})})),j=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ge()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),y=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!He()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),k=(0,Ke.Z)((e=>e?!!Ye()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired"))),w=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired"))),S=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired"))),E=(0,Ke.Z)((()=>!0));return(0,X.jsxs)(u.Z,{children:[(0,X.jsxs)("form",{onSubmit:d(b),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:p,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(T.Z,{checked:n.value,...n}),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,X.jsx)(We.Qr,{name:"from",control:p,rules:{validate:x?j:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:a("notification.email.from"),error:!!m.errors[t.name],helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"host",control:p,rules:{validate:x?y:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"port",control:p,rules:{validate:x?k:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"number",error:!!m.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"user",control:p,rules:{validate:x?w:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"password",control:p,rules:{validate:x?S:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"password",error:!!m.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"secure",control:p,rules:{validate:E},render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(T.Z,{checked:n.value,...n,disabled:!x}),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,X.jsx)(N.Z,{variant:"outlined",color:"warning",onClick:d(Z),sx:{mr:2},disabled:!x,children:a("oauth.runTest")}),(0,X.jsx)(N.Z,{type:"submit",variant:"contained",disabled:!m.isDirty,children:a("oauth.save")})]}),r]})},tn=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const on=function(){const[e,n]=(0,a.useState)(tn[0].value),{t:t}=(0,a.useContext)(C.RD),i=(0,Fe.Z)((()=>({email:(0,X.jsx)(nn,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:tn,current:e,onChange:n}),(0,X.jsx)(u.Z,{marginTop:"10px",children:i[e]})]})};var an=t(96366),ln=t(75239),rn=t(48342),sn=t(94552),cn=t(24558),dn=t(74286),pn=t(74490),mn=t(76667),un=t(70648),fn=t(44067),hn=t(7664),gn=t(44123),xn=t(53906);const bn=[{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:hn.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 vn,Zn;const jn="roles",yn=[...bn,{value:jn,icon:un.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"}}],Cn=(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:[]}},kn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return Cn(i.value,t);if(n&&P()(n,"settings.whoCanAccess")&&P()(n,"settings.whoCanAccess")!==m.WHO_CAN_ACCESS.ALL)return Cn(P()(n,"settings.whoCanAccess"),t);const o=(0,w.findServiceFromMeta)(e.meta,m.NODE_SERVICES.AUTH);return P()(o,"config.whoCanAccess")?Cn(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,an.Z)(),[l,r]=(0,a.useState)(""),{t:s,locale:c}=(0,C.PE)(),{api:d}=(0,ie.h6)(),{roles:p}=(0,Ce.DJ)(),[f,h]=(0,a.useState)(""),g=t[0]||n,{access:x,roles:b}=kn(n,g,{roles:p}),[v,Z]=(0,a.useState)(x),[j,y]=(0,a.useState)(b),k=[...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)},R=f||v===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,{})}),l&&(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(!f){h(!0);try{let e=v;e===jn&&(e="".concat(m.WHO_CAN_ACCESS_PREFIX_ROLES).concat(j.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:k,whoCanAccess:e}}),F.Z.success(s("blocklet.config.access.updatedTip")),L(),h(!1)}catch(e){h(!1),F.Z.error((0,oe.Z)(e))}}},color:"primary",disabled:R,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[f&&(0,X.jsx)(z.Z,{size:16}),s("common.confirm")]})]}),children:[(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:v,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)(u.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)(u.Z,{display:"flex",alignItems:"center",children:[(0,X.jsx)(e.icon,{style:S}),(0,X.jsx)(u.Z,{children:e.title[c]})]}),(0,X.jsx)(u.Z,{children:(0,X.jsx)(u.Z,{className:"tip",children:e.description[c]})})]})))})}),v===jn&&(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:j.map((e=>e.name)),onChange:e=>{y(p.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,X.jsx)(u.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=p.find((n=>n.name===e));return(0,X.jsx)(W.Z,{label:n.title},n.text)}))})},children:p.map((e=>{let{name:n,title:t}=e;return(0,X.jsxs)(pn.Z,{value:n,children:[(0,X.jsx)(je.Z,{checked:j.some((e=>e.name===n))}),(0,X.jsx)(fn.Z,{primary:t})]},n)}))})})]})]}wn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},wn.defaultProps={ancestors:[],children:null};const Sn=(0,l.Z)(ge.ZP)(vn||(vn=(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,l.Z)(pn.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 l=(0,an.Z)(),{t:r,locale:s}=(0,C.PE)(),{roles:c}=(0,Ce.DJ)(),[d,p]=(0,a.useState)(!0),{recommendedDomain:m}=(0,me.y0)(),f=i[0]||t,h="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,oe.vH)({blocklet:f,domain:{value:m},mountPoint:h,params:(0,oe.f0)(f,s)}),x={fill:l.palette.text.secondary},b=o>0&&t.children.length>0,v=(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:k}=kn(t,f,{roles:c});let E;if("roles"!==y)E=bn.find((e=>e.value===y))||bn[2];else{const e=k.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)(u.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,X.jsxs)(u.Z,{pl:Math.max(2*(o-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:b?"pointer":"cursor"},onClick:()=>b&&p(!d),children:[b?v:(0,X.jsx)(u.Z,{width:28}),(0,X.jsx)(S.Z,{blocklet:t,ancestors:i}),(0,X.jsxs)(u.Z,{ml:"16px",children:[(0,X.jsx)(u.Z,{style:{color:"#222",fontSize:18},children:(0,w.getDisplayName)(t,!0)}),(0,X.jsx)(u.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(u.Z,{color:"text.secondary",children:E.title[s]})})]})]},t),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(ln.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)(ln.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 Rn(){const{t:e}=(0,C.PE)(),{blocklet:n}=(0,me.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,X.jsx)(An,{component:"div",children:t&&t.length?[(0,X.jsx)(u.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)(u.Z,{mt:8,children:(0,X.jsx)(Ie.Z,{children:e("blocklet.component.noComponent")})})})}Pn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},Pn.defaultProps={ancestors:[],depth:0},Rn.propTypes={};const An=(0,l.Z)(u.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(56556),_n=t(44784);const Nn=function(){var e,n,t;const{api:i}=(0,ie.h6)(),{blocklet:o}=(0,me.y0)(),{t:a}=(0,C.PE)(),l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,r=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)||{}),{handleSubmit:s,control:c,formState:d,watch:p,reset:m}=(0,We.cI)({defaultValues:Ue()(r,["domain","clientId","enabled"])}),f=p("enabled"),h=(0,Ke.Z)((async e=>{try{var n,t;const{blocklet:o}=await i.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:e})}}),r=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)||{});m(r),F.Z.success(a("oauth.saveSuccess"))}catch(o){F.Z.error(o.message||a("oauth.saveFailed"))}})),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe"))),b=(0,Ke.Z)((()=>!0));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:s(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:c,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(_n.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"domain",control:c,rules:{validate:f?g:b},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:a("oauth.auth0.domain"),error:!!d.errors[t.name],helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!f})})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:c,rules:{validate:f?x:b},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!d.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!f})})}}),(0,X.jsx)(Tn.Z,{type:"submit",variant:"contained",onSubmit:s(h),disabled:!d.isDirty,children:a("oauth.save")})]})})};var On=t(77150),In=t(24103);const Fn={ttl:604800};function Bn(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function zn(){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,a=Object.assign({},Fn,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:l,control:r,formState:s,reset:c}=(0,We.cI)({defaultValues:Ue()(Bn(a),["ttl"])}),{t:d}=(0,C.PE)(),p=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:Bn(e,!0)}}),a=Object.assign({},Fn,Ue()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(Bn(a)),F.Z.success(d("common.configSuccess"))}catch(i){F.Z.error(i.message)}}));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:l(p),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"ttl",control:r,render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,sx:{mb:2},children:(0,X.jsxs)(In.Z,{px:3,children:[(0,X.jsx)(u.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,X.jsx)(On.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)(Tn.Z,{type:"submit",variant:"contained",onSubmit:l(p),disabled:!s.isDirty,children:d("oauth.save")})]})})}var Un=t(82555),Dn=t(30333),Kn=t(75760),Wn=t(97038),qn=t(64886),Gn=t(42080),Vn=t.n(Gn),Hn=t(75506),Mn=t.n(Hn),Yn=t(47685),Jn=t(13260),Qn=t(82434),Xn=t.n(Qn);const $n=(0,a.forwardRef)(((e,n)=>{var t,i;const{t:o}=(0,a.useContext)(C.RD),{blocklet:l}=(0,me.y0)(),{api:r}=(0,ie.h6)(),s=(0,De.Z)({mode:"view",show:!1,data:{},callback:Qe()}),c=(0,Yn.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,m=(0,Ke.Z)((()=>{s.mode="view",s.data={},s.callback=Qe()}),[]),f=(0,Ke.Z)((()=>{s.show=!1,setTimeout((()=>{m()}),d)}),[]),h=(0,Ke.Z)((e=>{s.mode="view",s.show=!0,s.data=e}),[]),g=(0,Ke.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe();s.mode="approve",s.show=!0,s.data=e,s.callback=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:h,close:f,approve:g})),[h,f,g]);const x=(0,Fe.Z)((()=>{if(!s.show)return[];s.data.migratedFrom=[s.data.appId,s.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==s.data.isMaster&&Vn()(e,"appliedAt","status"),e.map((e=>{const n=o("federated.info.".concat(e));let t=s.data[e];if("appName"===e&&s.data.isMaster&&(t=(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(Un.Z,{component:Dn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,X.jsx)(Jn.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,X.jsx)(u.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=Xn()(t)?t:p()(s.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:s.data.appName})}catch{t=(0,X.jsx)("img",{src:e,width:"60",height:"60",alt:s.data.appName})}}if("status"===e&&(t=t&&o("federated.status.".concat(t))),"migratedFrom"===e){t=(s.data.migratedFrom||[]).filter((e=>![s.data.appId,s.data.appPid].includes(e))).map((e=>(0,X.jsx)(Jn.kL,{children:e})))}return Mn()(t)&&(t="-"),{name:n,value:t}}))}),[s.data]),b="approve"===s.mode,v=(0,Ke.Z)((async()=>{await r.auditFederatedLogin({input:{memberPid:s.data.appPid,did:l.appPid,status:"rejected"}}),f(),null===s||void 0===s||s.callback(!1)})),Z=(0,Ke.Z)((async()=>{await r.auditFederatedLogin({input:{memberPid:s.data.appPid,did:l.appPid,status:"approved"}}),f(),null===s||void 0===s||s.callback(!0)}));return(0,X.jsx)(ge.ZP,{open:s.show,title:o(b?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:f,actions:b?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tn.Z,{color:"error",variant:"contained",onClick:v,children:o("common.reject")}),(0,X.jsx)(Tn.Z,{variant:"contained",onClick:Z,children:o("common.approve")})]}):(0,X.jsx)(Tn.Z,{variant:"outlined",onClick:f,children:o("common.close")}),children:x.map((e=>(0,X.jsx)(qn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var et=t(79842),nt=t(85408),tt=t.n(nt);const it=(0,a.forwardRef)(((e,n)=>{var t,i;const o=(0,Yn.Fg)(),l=(null===o||void 0===o||null===(t=o.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,{t:r}=(0,a.useContext)(C.RD),s=(0,De.Z)({show:!1,data:{link:""}}),c=(0,Ke.Z)((()=>{s.data.link=""}),[]),d=(0,Ke.Z)((()=>{s.show=!1,setTimeout((()=>{c()}),l)}),[]),p=(0,Ke.Z)((e=>{let{link:n}=e;s.show=!0,s.data.link=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:p,close:d})),[p,d]);const m=(0,Ke.Z)((()=>{tt()(s.data.link),d()}),[d]);return(0,X.jsxs)(ge.ZP,{open:s.show,title:r("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:m,children:r("common.copyAndClose")}),children:[(0,X.jsx)(u.Z,{mb:1,children:r("federated.inviteJoinFederatedLoginDescription")}),(0,X.jsx)(u.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,X.jsx)(et.Z,{language:"shell",style:{marginBottom:0},children:s.data.link})})]})}));function ot(e){var n,t,i,o,l;let{mode:r}=e;const s=(0,a.useRef)(null),c=(0,a.useRef)(null),{t:d,locale:p}=(0,a.useContext)(C.RD),{blocklet:m,actions:{refreshBlocklet:f}}=(0,me.y0)(),{confirmApi:h,confirmHolder:g}=$e(),{api:x}=(0,ie.h6)(),b=(null===(n=m.settings.federated)||void 0===n?void 0:n.sites)||[],v=(null===(t=m.settings.federated)||void 0===t?void 0:t.config)||{},Z=!1!==v.isMaster,j=(0,Ke.Z)((e=>{var n;null===(n=c.current)||void 0===n||n.open(e)})),y=(0,Ke.Z)((e=>{var n;null===(n=c.current)||void 0===n||n.approve(e,f)})),k=(0,Ke.Z)((e=>{h.open({title:d("federated.disableFederatedLogin"),content:d("federated.disableFederatedLoginDescription"),async onConfirm(n){await x.auditFederatedLogin({input:{memberPid:e.appPid,did:m.appPid,status:"revoked"}}),n()}})})),w=(0,Ke.Z)((e=>{h.open({title:d("federated.enableFederatedLogin"),content:d("federated.enableFederatedLoginDescription"),async onConfirm(n){await x.auditFederatedLogin({input:{memberPid:e.appPid,did:m.appPid,status:"approved"}}),n()}})})),S=(0,Fe.Z)((()=>{const e=[{label:d("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{display:"inline-block",children:(0,X.jsxs)(u.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,X.jsx)(Un.Z,{component:Dn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:d("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=b[e];return(0,X.jsx)(Wn.Z,{children:n.appId})}}},{label:d("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{children:t?"-":d("federated.status.".concat(n.status))})}}}];return Z&&e.push({label:d("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,X.jsx)(u.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:d("federated.status.rejected")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:d("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(),y(n)},children:d("federated.status.pending")}),"approved"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),k(n)},style:{whiteSpace:"nowrap"},children:d("federated.revoke")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),w(n)},style:{whiteSpace:"nowrap"},children:d("federated.approve")})]})})}}}),e}),[v.appId,b,Z,d]),E=(0,Fe.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=b[t];j(i)}})),[]),L=(0,Ke.Z)((()=>{const e=m.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=s.current)||void 0===n||n.open({link:e.value}):F.Z.error(d("federated.failedToGetFederatedLoginLink"))}),[null===(i=m.site)||void 0===i||null===(o=i.domainAliases)||void 0===o||null===(l=o[0])||void 0===l?void 0:l.href]),P=(0,Ke.Z)((()=>{h.open({title:d("federated.quitFederatedLogin"),content:d("federated.quitFederatedLoginDescription"),async onConfirm(e){await x.quitFederatedLogin({input:{did:m.appPid}}),e()}})})),R=(0,Ke.Z)((()=>{h.open({title:d("federated.disbandFederatedLogin"),content:d("federated.disbandFederatedLoginDescription"),async onConfirm(e){await x.disbandFederatedLogin({input:{did:m.appPid}}),e()}})})),A=[];return"master"!==r?A.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",color:"error",onClick:P,sx:{ml:1},children:d("federated.quitFederatedLogin")},"quitFederatedLogin")):(A.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",onClick:L,sx:{ml:1},children:d("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),A.push((0,X.jsx)(N.Z,{color:"error",size:"small",variant:"contained",onClick:R,sx:{ml:1},children:d("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Kn.Z,{className:"main-table",locale:p,data:b,columns:S,customButtons:A,title:(0,X.jsx)(u.Z,{className:"table-toolbar-left",children:d("oauth.federated")}),options:E}),g,(0,X.jsx)(it,{ref:s}),(0,X.jsx)($n,{ref:c})]})}ot.propTypes={mode:s().oneOf(["member","master"])},ot.defaultProps={mode:"member"};const at=ot,lt=(0,a.forwardRef)(((e,n)=>{var t,i;const{t:o}=(0,a.useContext)(C.RD),{api:l}=(0,ie.h6)(),{blocklet:r}=(0,me.y0)(),s=null===r||void 0===r?void 0:r.appPid,c=(0,Yn.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,p=(0,De.Z)({show:!1,appUrl:"",appUrlError:"",callback:Qe()}),m=(0,Ke.Z)((()=>{p.appUrl="",p.appUrlError="",p.callback=Qe()}),[]),f=(0,Ke.Z)((()=>{p.show=!1,setTimeout((()=>{m()}),d)}),[]),h=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe();p.show=!0,p.callback=e}),[]);(0,a.useImperativeHandle)(n,(()=>({open:h,close:f})),[h,f]);const g=(0,Ke.Z)((e=>{if(!e)throw new Error(o("federated.federatedJoinAppUrlRequired"));if(!Xn()(e))throw new Error(o("federated.federatedJoinAppUrlInvalid"))})),x=(0,Ke.Z)((async()=>{try{g(p.appUrl);const e=await l.joinFederatedLogin({input:{did:s,appUrl:p.appUrl}});p.show=!1,f(),null===p||void 0===p||p.callback(e)}catch(e){p.appUrlError=e.message}}),[f,s]);return(0,X.jsxs)(ge.ZP,{open:p.show,title:o("federated.joinFederatedLogin"),onClose:f,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,children:o("common.confirm")}),children:[(0,X.jsx)(u.Z,{mb:1,children:o("federated.joinFederatedLoginDescription")}),(0,X.jsx)(H.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:o("federated.federatedJoinAppUrl"),label:o("federated.federatedJoinAppUrl"),value:p.appUrl,error:!!p.appUrlError,helperText:p.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{p.appUrl=e.target.value}})]})}));function rt(){var e,n,t,i;const o=(0,a.useRef)(null),l=(0,a.useRef)(null),{t:r}=(0,a.useContext)(C.RD),{blocklet:s,actions:{refreshBlocklet:c}}=(0,me.y0)(),d=(0,Ke.Z)((()=>{var e,n,t;const i=null===(e=s.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href;if(i)try{var a;const e=new URL(i);null===(a=o.current)||void 0===a||a.open({link:e.origin})}catch{F.Z.error(r("federated.failedToGetFederatedLoginLink"))}}),[null===(e=s.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href]),p=(0,Ke.Z)((()=>{var e;null===(e=l.current)||void 0===e||e.open((()=>{c()}))}),[c]);if((null===(i=s.settings.federated)||void 0===i?void 0:i.sites.length)>0){var m;const e=!1!==(null===(m=s.settings.federated)||void 0===m?void 0:m.config.isMaster);return(0,X.jsx)(at,{mode:e?"master":"member"})}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,X.jsx)(N.Z,{variant:"contained",onClick:d,children:r("federated.inviteJoinFederatedLogin")}),(0,X.jsx)(_.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,X.jsx)(N.Z,{variant:"outlined",onClick:p,children:r("federated.joinFederatedLogin")})]}),(0,X.jsx)(it,{ref:o}),(0,X.jsx)(lt,{ref:l})]})}const st=function(){const{t:e}=(0,a.useContext)(C.RD),n=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,a.useState)(n[0].value),o=(0,Fe.Z)((()=>({auth0:(0,X.jsx)(Nn,{}),federated:(0,X.jsx)(rt,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:e("oauth.comingSoon")})}),settings:(0,X.jsx)(u.Z,{children:(0,X.jsx)(zn,{})})})),[e]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:n,current:t,onChange:i}),(0,X.jsx)(u.Z,{marginTop:"10px",children:o[t]})]})};var ct;const dt=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:a}=e;const l=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),r=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,X.jsxs)(u.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)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:r?a("blocklet.component.container"):(0,w.getDisplayName)(t,!0)})})]},l),value:l}),t.children.length>0&&t.children.forEach((e=>{dt({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:a})}))};function pt(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:o}=(0,a.useContext)(C.RD),{info:l,inService:r}=(0,ie.h6)(),[s,d]=(0,a.useState)(!0),[w,S]=(0,y.useSearchParams)(),E=w.get("tab")||"general",L=[{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,X.jsx)(h.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.general")})})]},"general"),value:"general"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,X.jsx)(g.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.access")})})]},"access"),value:"access"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,X.jsx)(x.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.login")})})]},"oauth"),value:"oauth"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,X.jsx)(b.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.notification")})})]},"notification"),value:"notification"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,X.jsx)(u.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)(v.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.preferences")})})]},"preference"),value:"preference"}];s&&dt({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)(Rn,{});else if("oauth"===E)P=(0,X.jsx)(st,{});else if("notification"===E)P=(0,X.jsx)(on,{});else{const e=r?m.WELLKNOWN_SERVICE_PATH_PREFIX:l.routing.adminPath,n=new URLSearchParams;r||n.set("authKey","__sst"),n.set("schemaKey",p()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(E)))),P=(0,X.jsx)(c.Z,{url:"".concat(p()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,X.jsx)(mt,{...i,children:(0,X.jsxs)(f.ZP,{container:!0,spacing:4,columns:24,children:[(0,X.jsx)(f.ZP,{item:!0,sm:7,md:5,children:(0,X.jsx)(k.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)(f.ZP,{item:!0,sm:17,md:19,children:(0,X.jsx)(u.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}pt.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},pt.defaultProps={onUpdate:()=>{}};const mt=l.Z.div(ct||(ct=(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),a=t(28726),l=t(44846),r=t(68420),s=t(14491),c=t(58238),d=t(70461),p=t(96266);function m(e){let{teamDid:n,size:t="small",...m}=e;const{t:u}=(0,r.PE)(),{api:f}=(0,c.h6)(),[h,g]=(0,i.useState)(!1),[x,b]=(0,i.useState)(null),v={title:u("blocklet.config.clearCache.title"),description:u("blocklet.config.clearCache.description"),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await f.clearCache({input:{teamDid:n}});o.Z.success(u("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),b(null)}},onCancel:()=>{g(!1),b(null)}};return(0,p.jsxs)("div",{...m,children:[(0,p.jsxs)(a.Z,{onClick:()=>b(v),color:"error",variant:"outlined",size:t,children:[h?(0,p.jsx)(l.Z,{size:16,style:{marginRight:5}}):null,u("blocklet.config.clearCache.action")]}),x&&(0,p.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),a=t.n(o),l=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)(l.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:a().any.isRequired}},28641:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(39948),r=t(47020),s=t(44846),c=t(13727),d=t(56184),p=t(67680),m=t(35406),u=t(11875),f=t(95890),h=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:a,onChange:x,placeholder:b,style:v,onSubmit:Z,secure:j,triggers:y,formatterBeforeSubmit:C,...k}=e;const[w,S]=(0,i.useState)(!1),[E,L]=(0,i.useState)(!1),[P,R]=(0,i.useState)(j&&"__encrypted__"===a?null:a),[A,T]=(0,i.useState)(P),_=async()=>{L(!0);try{if(!1===await Z(A))T(P);else{let e=A;"function"===typeof C&&(e=C(A)),T(e),R(e)}}catch(e){T(P)}finally{L(!1),S(!1)}},N=w?(0,h.jsx)(r.Z,{style:{flex:1},fullWidth:!0,value:A,onChange:e=>{var n;n=e.target.value,T(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:b,onKeyDown:e=>{"Enter"===e.key&&_()},disabled:t,type:j?"password":"text",...k}):(0,h.jsx)(l.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(A,j,a)});return(0,h.jsx)(u.Z,{className:"form",style:v,children:(0,h.jsxs)(l.Z,{className:"form-item",children:[(0,h.jsxs)(l.Z,{className:"form-item-label",children:[n,o&&(0,h.jsx)(m.Z,{})]}),(0,h.jsxs)(l.Z,{className:"form-item-body",children:[(0,h.jsx)(l.Z,{className:"form-item-input",children:N}),(0,h.jsx)(l.Z,{className:"form-item-action",children:w?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p.Z,{"data-cy":"schema-form-item-confirm",onClick:_,disabled:t||E,size:"large",children:E?(0,h.jsx)(s.Z,{size:24}):(0,h.jsx)(d.Z,{})}),(0,h.jsx)(p.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{T(P),S(!1)},disabled:t||E,size:"large",children:(0,h.jsx)(c.default,{})})]}):(0,h.jsx)(f.Z,{triggers:y,onEnterEdit:()=>S(!0),disabled:t})})]})]})})}x.propTypes={style:a().object,onSubmit:a().func,onChange:a().func,label:a().string,initialValue:a().string,placeholder:a().string,required:a().bool,disabled:a().bool,secure:a().bool,triggers:a().array,formatterBeforeSubmit:a().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),a=t(33518),l=t(39948);const r=(0,a.Z)(l.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),a=t.n(o),l=t(24558),r=t(67680),s=t(56556),c=t(49127),d=t(49390),p=t(37200),m=t(25228),u=t(24202),f=t(74490),h=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const a=i.useRef(null),[x,b]=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)(l.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:a,"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)(l.Z,{})}),(0,g.jsx)(s.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{b((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(u.Z,{sx:{zIndex:9999},open:x,anchorEl:a.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(m.Z,{children:(0,g.jsx)(p.d,{onClickAway:e=>{a.current&&a.current.contains(e.target)||b(!1)},children:(0,g.jsx)(h.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(f.Z,{onClick:()=>{return n=e.handler,b(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:a().arrayOf(a().shape({key:a().string.isRequired,title:a().string.isRequired,handler:a().func.isRequired})),onEnterEdit:a().func.isRequired,disabled:a().bool.isRequired},x.defaultProps={triggers:[]}},35406:(e,n,t)=>{t.d(n,{Z:()=>a});var i,o=t(71171);const a=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")}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6230],{80378:(e,n,t)=>{t.d(n,{Z:()=>u});var i=t(55898),o=t.n(i),a=t(62681),l=t(72333),r=t(6352),s=t.n(r),c=t(35432),d=t(58238),p=t(14491);var m=t(96266);function u(e){let{blocklet:n,style:t,size:i,ancestors:o,...r}=e;const u=(0,d.h6)(),{logoUrl:f,inService:h}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:a}=o,l="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,p.XN)(null===t||void 0===t?void 0:t.status)?"~":"");let r=a?s()(p.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",l):s()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)r=s()(t.deployedFrom,(0,p.lk)(t.meta.bundleDid,t.meta.logo),l);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=a?n.slice(1):n;r=s()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),l)}return{logoUrl:r,inService:a}}({blocklet:n,ancestors:o}),{variant:g}=r,x=h?()=>{}:e=>{e.target.src="".concat(u.imgPrefix,"/blocklet.png")};let b=(0,m.jsx)("img",{src:f,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(b=(0,m.jsx)(l.Z,{did:n.meta.did||"",responsive:!0})),(0,m.jsx)(a.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...r,children:b})}u.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},u.defaultProps={style:{},size:40,ancestors:[]}},74286:(e,n,t)=>{t.d(n,{Z:()=>r});var i=t(55898),o=t.n(i),a=t(39948),l=t(96266);function r(e){let{depth:n}=e;return(0,l.jsx)(a.Z,{ml:Math.max(2*(n-1),0),sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}r.propTypes={depth:o().number},r.defaultProps={depth:1}},44784:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),a=t(33518),l=t(82790),r=t(96266);function s(e){let{labelProps:n,className:t,style:i,...o}=e;const a={...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)(l.Z,{labelProps:a,...o})})}s.propTypes=l.Z.propTypes,s.defaultProps=l.Z.defaultProps;const c=a.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),a=t(5057),l=t(55898),r=t.n(l),s=t(6352),c=t.n(s),d=t(33518),p=t(92706),m=t.n(p),u=t(39948),f=t(52277),h=t.n(f),g=t(68420),x=t(96266);const b=(0,a.lazy)((()=>Promise.all([t.e(1294),t.e(4382)]).then(t.bind(t,23826)).then((e=>({default:e.Uploader}))))),v="/blocklet/logo/upload";function Z(e){let{url:n,height:t,width:i,enabled:o,type:l,did:r,prefix:s,headers:d,onUploaded:p}=e;const{t:m}=(0,g.PE)(),f=(0,a.useRef)(null),Z={cursor:o?"pointer":"default","&::after":{content:'"'.concat(m("common.switch"),'"')}};return(0,x.jsxs)(j,{id:"uploader-".concat(r,"-").concat(l),children:[(0,x.jsx)(b,{ref:f,popup:!0,onUploadFinish:()=>{var e;p(),null===(e=f.current)||void 0===e||e.close()},plugins:["ImageEditor"],apiPathProps:{uploader:c()(s,v,l,r),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(u.Z,{className:h()("uploader-wrapper",o&&"enabled"),sx:Z,onClick:()=>{var e;null===(e=f.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(r,"-").concat(l))}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"])))},64558:(e,n,t)=>{t.r(n),t.d(n,{default:()=>pt});var i,o=t(71171),a=t(5057),l=t(33518),r=t(55898),s=t.n(r),c=t(96181),d=t(6352),p=t.n(d),m=t(35432),u=t(39948),f=t(55402),h=t(82275),g=t(96399),x=t(65688),b=t(37633),v=t(48037),Z=t(92273),j=t(76720),y=t(15849),C=t(68420),k=t(94464),w=t(38242),S=t(80378),E=t(1722),L=t(43681),P=t.n(L),R=t(50482),A=t.n(R),T=t(16147),_=t(29034),N=t(28726),O=t(80578),I=t(77277),F=t(86229),B=t(28641),z=t(44846),U=t(13727),D=t(56184),K=t(67680),W=t(19654),q=t(90067),G=t(63769),V=t(43897),H=t(47020),M=t(24202),Y=t(35406),J=t(11875),Q=t(95890),X=t(96266);function $(e){let{label:n,disabled:t,required:i,initialValue:o,onChange:l,style:r,onSubmit:s,triggers:c,options:d,formatterBeforeSubmit:p,helperText:m,placeholder:f,renderImage:h,renderLabel:g,filterKeys:x,noEmpty:b,...v}=e;const[Z,j]=(0,a.useState)(!1),[y,C]=(0,a.useState)(!1),[k,w]=a.useState(""),[S,E]=(0,a.useState)(o),[L,P]=(0,a.useState)(S),R=(0,a.useMemo)((()=>{if(!d)return{};const e={};return d.forEach((n=>{e[n.code]=n})),e}),[d]),A=Z?(0,X.jsx)(G.Z,{options:d,value:L,onChange:(e,n)=>{if(!Array.isArray(n))return P([]),void l([]);const t=n.filter((e=>R[e]));if(!t.length)return P([]),void l([]);P(t),l(t)},inputValue:k,onInputChange:(e,n)=>{w(n)},PopperComponent:ne,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:()=>{if(!d)return[];if(!k)return d.map((e=>e.code));const e=new RegExp(k.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=R[e])||void 0===n?void 0:n.name},renderInput:e=>(0,X.jsx)(H.Z,{...e,label:"",placeholder:f}),renderOption:(e,n)=>{var t;const i=-1!==L.indexOf(n);return(0,a.createElement)(ee,{component:"li",...e,key:n},h(R[n]||{}),(0,X.jsx)(u.Z,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:i?"700":"normal"},children:g(n,R[n])||(null===(t=R[n])||void 0===t?void 0:t.name)}),(0,X.jsx)(u.Z,{component:U.default,sx:{opacity:.5,width:18,height:18},style:{visibility:i?"visible":"hidden"}}))},...v}):(0,X.jsx)(u.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)(u.Z,{className:"form-item",children:[(0,X.jsxs)(u.Z,{className:"form-item-label",children:[n,i&&(0,X.jsx)(Y.Z,{})]}),(0,X.jsxs)(u.Z,{className:"form-item-body",children:[(0,X.jsx)(u.Z,{className:"form-item-input",children:A}),(0,X.jsx)(u.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()=>{C(!0);try{!1===await s("function"===typeof p?p(L):L)?P(S):b&&!L.length?(P(o),E(o)):(P(L),E(L))}catch(e){P(S)}finally{C(!1),j(!1)}},disabled:t||y,size:"large",children:y?(0,X.jsx)(z.Z,{size:24}):(0,X.jsx)(D.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)(U.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=l.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,l.Z)(M.Z)((()=>({["& .".concat(V.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(V.Z.listbox)]:{padding:0}})));var te,ie=t(58238),oe=t(14491),ae=t(54063),le=t(63406),re=t(78410),se=t(31853),ce=t(43316),de=t(70461),pe=t(73545),me=t(29054);function ue(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:a}=(0,C.PE)(),{api:l}=(0,pe.T)(),{blocklet:r}=(0,me.y0)(),[s,c]=(0,se.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),p=r.structVersion===m.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,oe.An)(r.status)?F.Z.error(a("blocklet.error.isRunning")):(0,w.isInProgress)(r.status)?F.Z.error(a("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,X.jsx)(B.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:p,secure:!0}),s.newAppSk&&(0,X.jsx)(de.Z,{title:a("blocklet.config.appSkTitle"),description:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.Z,{children:a("blocklet.config.appSkChangeTip")}),(0,X.jsx)(u.Z,{fontWeight:"bold",mt:2,children:a("blocklet.config.appDidChangeTip")}),(0,X.jsxs)(fe,{children:[(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL1")}),(0,X.jsx)("li",{children:a("blocklet.config.appDidChangeTipL2")})]})]}),confirm:a("confirm"),cancel:a("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:l.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:r.appDid},messages:{title:a("setup.keyPair.title"),scan:a("setup.keyPair.scan"),confirm:a("setup.keyPair.confirm"),success:a("setup.keyPair.success")},onClose:d})]}ue.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},ue.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const fe=(0,l.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 he,ge=t(13128),xe=t(55372),be=t(11750),ve=t(88574),Ze=t(26174),je=t(88092),ye=t(50185),Ce=t(17425);function ke(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:o}=(0,a.useContext)(pe.B),[l,r]=(0,a.useState)(!1),{t:s,locale:c}=(0,C.PE)(),[d,p]=(0,a.useState)(""),[m,f]=(0,a.useState)(!1),[h,g]=(0,a.useState)(0),[x,b]=(0,a.useState)(""),{endpoint:v}=(0,Ce.DJ)(),[Z,j]=(0,a.useState)(!1),y=e=>{p(null),r(!0);try{b(e.result),g(w.length-1)}catch(n){const e=(0,oe.Z)(n);p(e),i(n)}finally{r(!1)}},k=()=>{f(!1),g(0)},w=[{body:(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(be.Z,{children:s("team.transferApp.transferDialog.tips.progress")}),(0,X.jsx)(be.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:()=>{f(!0),g(1)}},{body:()=>(0,X.jsx)(ce.Z,{action:"transfer-app-owner",open:m,locale:c,checkFn:o.get,onClose:k,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:v});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(u.Z,{component:we,dangerouslySetInnerHTML:{__html:s("team.transferApp.transferDialog.createSuccessTip1")}}),(0,X.jsx)(u.Z,{component:we,mt:2,children:(0,X.jsx)(we,{children:s("team.transferApp.transferDialog.createSuccessTip3")})}),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(u.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)(u.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[h];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:l||h===w.length-1&&!Z,variant:"contained",autoFocus:!0,children:[l&&(0,X.jsx)(z.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)(ve.Z,{type:"error",variant:"icon",children:d})]})}ke.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},ke.defaultProps={onError:()=>{}};const we=l.Z.div(he||(he=(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(I.SUPPORTED_LANGUAGES).map((e=>({code:e,name:I.SUPPORTED_LANGUAGES[e].nativeName,enName:I.SUPPORTED_LANGUAGES[e].name}))),Re=["name","enName","code"];function Ae(e){var n;let{blocklet:t,onUpdate:i,hasPermission:o,...l}=e;const{api:r,inService:s,prefix:c,getSessionInHeader:d,ws:{useSubscription:p}}=(0,ie.h6)(),{t:f}=(0,a.useContext)(C.RD),[h,g]=(0,a.useState)(""),[x,b]=(0,a.useState)(""),[v,Z]=(0,a.useState)(!1),j=(0,w.getWhoCanAccess)(t),y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,k=x||!o,{logoUrl:S,rectLogoUrl:E,faviconUrl:L}=(0,Ee.Z)({blocklet:t}),{did:R}=t.meta,{site:z}=t,U=P()(t.meta,"capabilities.clusterMode",!1);if(p(m.EVENTS.NODE_RUNTIME_INFO,(e=>{U&&g(P()(e,"cpu.physicalCores",""))})),(0,oe.wS)(t.status))return null;const D=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!D||"yes"===D.value,W=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),G=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),V=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),H=[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:f("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:f("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:f("blocklet.config.appUrl"),value:q?q.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:f("blocklet.config.copyrightOwner"),value:G?G.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:f("blocklet.config.copyrightYear"),value:V?V.value:""}];if(U){const e=t.configs.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:h;H.push({key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:f("blocklet.config.clusterSize"),value:n,cpuCores:h})}const M=async(e,n)=>{if(e===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,oe.I)({value:n,cpuCores:h});if(e)return void F.Z.error(e)}const o=[{key:e,value:n}];try{b(!0);const{blocklet:e}=await r.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(a){F.Z.error(a.message)}finally{b(!1)}};return(0,X.jsxs)(Oe,{...l,children:[H.map((e=>(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:e.value,onSubmit:n=>M(e.key,n)})]}))),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:f("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)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoRect")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("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)(u.Z,{className:"config-label",fontSize:14,mt:4,children:f("blocklet.config.logoFavicon")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("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)(u.Z,{className:"config-form",children:"all"===j&&"registry"===t.source&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.access.publicToStore"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.access.publicInstanceTip")})]}),(0,X.jsx)(T.Z,{disabled:k,checked:y,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.languages")}),(0,X.jsx)($,{style:{marginTop:0},disabled:x||k,loading:x,options:Pe,noEmpty:!0,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>M("BLOCKLET_APP_LANGUAGES",e),helperText:f("blocklet.config.selectLanguagesTip"),placeholder:f("blocklet.config.languagesSearch"),filterKeys:Re,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)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("common.security")})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("router.domainSecurity.cors.title")}),(0,X.jsx)(u.Z,{mb:1.5,className:"config-desc",children:f("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,X.jsx)(B.Z,{style:{marginTop:0},disabled:x||k,loading:x,initialValue:(z.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=z.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(A()(n,i))return!1;try{b(!0);const e=i.length?i:["__none__"];await r.updateRoutingSite({input:{id:z.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),b(!1)}catch(o){return F.Z.error(o.message),b(!1),!1}return!0}})]}),(0,X.jsx)(u.Z,{className:"config-form",component:_.Z,my:3}),(0,X.jsx)(u.Z,{mb:2,className:"config-label",fontSize:20,children:f("blocklet.config.dangerZone")}),(0,X.jsxs)(u.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:!s&&(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.deletable.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,X.jsx)(T.Z,{disabled:k,checked:!K,defaultChecked:!0,onChange:async e=>{if(!x){b(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,value:n?"no":"yes"}]}});i(o)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]})}),(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(u.Z,{className:"config-label",fontSize:14,mb:0,children:f("blocklet.config.sk")}),(0,X.jsx)(ue,{disabled:x||k,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){b(!0);try{const{blocklet:n}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){F.Z.error(n.message)}finally{b(!1)}}}})]}),s&&(0,X.jsx)(le.Z,{role:"owner",children:e=>(e||ae.C)&&(0,X.jsxs)(u.Z,{className:"config-form",mt:2,children:[(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsx)(u.Z,{className:"config-label",mb:0,children:f("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)(O.Z,{style:{fontSize:"1.3em",marginRight:4}}),f("team.transferApp.name")]})]}),v&&(0,X.jsx)(ke,{onCancel:()=>Z(!1),onSuccess:()=>Z(!1)})]})}),(0,X.jsx)(u.Z,{className:"config-form",mt:2,children:(0,X.jsxs)(u.Z,{className:"config-item",children:[(0,X.jsxs)(u.Z,{className:"config-label",children:[f("blocklet.config.clearCache.name"),(0,X.jsx)(u.Z,{className:"config-desc",children:f("blocklet.config.clearCache.purpose")})]}),(0,X.jsx)(re.Z,{teamDid:R})]})})]})]})}const Te=(0,le.V)(Ae,"mutate_blocklets"),_e=(0,le.V)(Ae,"",oe.Wf);function Ne(e){const{inService:n}=(0,ie.h6)();return n?(0,X.jsx)(_e,{...e}):(0,X.jsx)(Te,{...e})}Ae.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Ae.defaultProps={onUpdate:()=>{},hasPermission:!1};const Oe=l.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 Ie=t(25710),Fe=t(93066),Be=t(80576),ze=t(8708),Ue=t.n(ze),De=t(12673),Ke=t(99360),We=t(80506),qe=t(766),Ge=t.n(qe),Ve=t(24529),He=t.n(Ve),Me=t(16727),Ye=t.n(Me),Je=t(92706),Qe=t.n(Je);const Xe=(0,a.forwardRef)(((e,n)=>{const{t:t}=(0,a.useContext)(C.RD),i=(0,De.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})),l=(0,Ke.Z)((()=>{i.title="",i.content="",i.onConfirm=Qe(),i.onCancel=Qe()})),r=(0,Ke.Z)((()=>{i.show=!1,setTimeout((()=>{l()}),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,a.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,a.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,t;const{api:i}=(0,ie.h6)(),{blocklet:o}=(0,me.y0)(),{t:a}=(0,C.PE)(),{confirmApi:l,confirmHolder:r}=$e(),s=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,c=Object.assign({...en},(null===o||void 0===o||null===(n=o.settings)||void 0===n||null===(t=n.notification)||void 0===t?void 0:t.email)||{}),{handleSubmit:d,control:p,formState:m,watch:f,reset:h}=(0,We.cI)({defaultValues:Ue()(c,Object.keys(en))}),g=(0,De.Z)({testReceiver:"",testReceiverError:""}),x=f("enabled"),b=(0,Ke.Z)((async function(e,n){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];try{var o,l;const{blocklet:n}=await i.configNotification({input:{did:s,notification:JSON.stringify({email:e})}}),r=Object.assign({...en},(null===n||void 0===n||null===(o=n.settings)||void 0===o||null===(l=o.notification)||void 0===l?void 0:l.email)||{});h(r),t&&F.Z.success(a("oauth.saveSuccess"))}catch(r){if(!t)throw r;F.Z.error(r.message||a("oauth.saveFailed"))}})),v=(0,Ke.Z)((async(e,n,t)=>{try{m.isDirty&&await b(e,n,!1),await i.sendEmail({input:{did:s,receiver:t,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),F.Z.success(a("notification.email.testSuccess"))}catch(o){F.Z.error(o.message||a("notification.email.testfailed"))}})),Z=(0,Ke.Z)(((e,n)=>{g.testReceiver="",g.testReceiverError="",l.open({title:a("notification.email.testSendEmail"),content:()=>(0,X.jsx)(u.Z,{sx:{width:"300px"},children:(0,X.jsx)(H.Z,{fullWidth:!0,name:"testReceiver",label:a("notification.email.inputTestReceiver"),value:g.testReceiver,onChange:e=>{g.testReceiver=e.target.value},error:!!g.testReceiverError,helperText:g.testReceiverError||"\u3000"})}),async onConfirm(t){var i;const o=null===(i=g.testReceiver)||void 0===i?void 0:i.trim();o?Ge()(o)?(g.testReceiverError="",await v(e,n,o),t()):g.testReceiverError=a("notification.email.receiverInvalid"):g.testReceiverError=a("notification.email.receiverRequired")}})})),j=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ge()(n)||a("notification.email.fromInvalid"):a("notification.email.fromRequired")})),y=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!He()(n,{require_host:!1,protocols:[]})||a("notification.email.hostInvalid"):a("notification.email.hostRequired")})),k=(0,Ke.Z)((e=>e?!!Ye()(e)||a("notification.email.portInvalid"):a("notification.email.portRequired"))),w=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("notification.email.userRequired"))),S=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("notification.email.passwordRequired"))),E=(0,Ke.Z)((()=>!0));return(0,X.jsxs)(u.Z,{children:[(0,X.jsxs)("form",{onSubmit:d(b),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:p,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(T.Z,{checked:n.value,...n}),label:a("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,X.jsx)(We.Qr,{name:"from",control:p,rules:{validate:x?j:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:a("notification.email.from"),error:!!m.errors[t.name],helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"host",control:p,rules:{validate:x?y:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:a("notification.email.host"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"port",control:p,rules:{validate:x?k:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"number",error:!!m.errors[t.name],label:a("notification.email.port"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"user",control:p,rules:{validate:x?w:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!m.errors[t.name],label:a("notification.email.user"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"password",control:p,rules:{validate:x?S:E},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,type:"password",error:!!m.errors[t.name],label:a("notification.email.password"),helperText:(null===(n=m.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!x})})}}),(0,X.jsx)(We.Qr,{name:"secure",control:p,rules:{validate:E},render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(T.Z,{checked:n.value,...n,disabled:!x}),label:a("notification.email.secure"),style:{marginBottom:16}})})}}),(0,X.jsx)(N.Z,{variant:"outlined",color:"warning",onClick:d(Z),sx:{mr:2},disabled:!x,children:a("oauth.runTest")}),(0,X.jsx)(N.Z,{type:"submit",variant:"contained",disabled:!m.isDirty,children:a("oauth.save")})]}),r]})},tn=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const on=function(){const[e,n]=(0,a.useState)(tn[0].value),{t:t}=(0,a.useContext)(C.RD),i=(0,Fe.Z)((()=>({email:(0,X.jsx)(nn,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:tn,current:e,onChange:n}),(0,X.jsx)(u.Z,{marginTop:"10px",children:i[e]})]})};var an=t(96366),ln=t(75239),rn=t(48342),sn=t(94552),cn=t(24558),dn=t(74286),pn=t(74490),mn=t(76667),un=t(70648),fn=t(44067),hn=t(7664),gn=t(44123),xn=t(53906);const bn=[{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:hn.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 vn,Zn;const jn="roles",yn=[...bn,{value:jn,icon:un.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"}}],Cn=(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:[]}},kn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return Cn(i.value,t);if(n&&P()(n,"settings.whoCanAccess")&&P()(n,"settings.whoCanAccess")!==m.WHO_CAN_ACCESS.ALL)return Cn(P()(n,"settings.whoCanAccess"),t);const o=(0,w.findServiceFromMeta)(e.meta,m.NODE_SERVICES.AUTH);return P()(o,"config.whoCanAccess")?Cn(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,an.Z)(),[l,r]=(0,a.useState)(""),{t:s,locale:c}=(0,C.PE)(),{api:d}=(0,ie.h6)(),{roles:p}=(0,Ce.DJ)(),[f,h]=(0,a.useState)(""),g=t[0]||n,{access:x,roles:b}=kn(n,g,{roles:p}),[v,Z]=(0,a.useState)(x),[j,y]=(0,a.useState)(b),k=[...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)},R=f||v===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,{})}),l&&(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(!f){h(!0);try{let e=v;e===jn&&(e="".concat(m.WHO_CAN_ACCESS_PREFIX_ROLES).concat(j.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:k,whoCanAccess:e}}),F.Z.success(s("blocklet.config.access.updatedTip")),L(),h(!1)}catch(e){h(!1),F.Z.error((0,oe.Z)(e))}}},color:"primary",disabled:R,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[f&&(0,X.jsx)(z.Z,{size:16}),s("common.confirm")]})]}),children:[(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:v,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)(u.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)(u.Z,{display:"flex",alignItems:"center",children:[(0,X.jsx)(e.icon,{style:S}),(0,X.jsx)(u.Z,{children:e.title[c]})]}),(0,X.jsx)(u.Z,{children:(0,X.jsx)(u.Z,{className:"tip",children:e.description[c]})})]})))})}),v===jn&&(0,X.jsx)(u.Z,{mt:4,mb:3,children:(0,X.jsx)(H.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:j.map((e=>e.name)),onChange:e=>{y(p.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,X.jsx)(u.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=p.find((n=>n.name===e));return(0,X.jsx)(W.Z,{label:n.title},n.text)}))})},children:p.map((e=>{let{name:n,title:t}=e;return(0,X.jsxs)(pn.Z,{value:n,children:[(0,X.jsx)(je.Z,{checked:j.some((e=>e.name===n))}),(0,X.jsx)(fn.Z,{primary:t})]},n)}))})})]})]}wn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},wn.defaultProps={ancestors:[],children:null};const Sn=(0,l.Z)(ge.ZP)(vn||(vn=(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,l.Z)(pn.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 l=(0,an.Z)(),{t:r,locale:s}=(0,C.PE)(),{roles:c}=(0,Ce.DJ)(),[d,p]=(0,a.useState)(!0),{recommendedDomain:m}=(0,me.y0)(),f=i[0]||t,h="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,oe.vH)({blocklet:f,domain:{value:m},mountPoint:h,params:(0,oe.f0)(f,s)}),x={fill:l.palette.text.secondary},b=o>0&&t.children.length>0,v=(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:k}=kn(t,f,{roles:c});let E;if("roles"!==y)E=bn.find((e=>e.value===y))||bn[2];else{const e=k.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)(u.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,X.jsxs)(u.Z,{pl:Math.max(2*(o-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:b?"pointer":"cursor"},onClick:()=>b&&p(!d),children:[b?v:(0,X.jsx)(u.Z,{width:28}),(0,X.jsx)(S.Z,{blocklet:t,ancestors:i}),(0,X.jsxs)(u.Z,{ml:"16px",children:[(0,X.jsx)(u.Z,{style:{color:"#222",fontSize:18},children:(0,w.getDisplayName)(t,!0)}),(0,X.jsx)(u.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(u.Z,{color:"text.secondary",children:E.title[s]})})]})]},t),(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(ln.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)(ln.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 Rn(){const{t:e}=(0,C.PE)(),{blocklet:n}=(0,me.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,X.jsx)(An,{component:"div",children:t&&t.length?[(0,X.jsx)(u.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)(u.Z,{mt:8,children:(0,X.jsx)(Ie.Z,{children:e("blocklet.component.noComponent")})})})}Pn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},Pn.defaultProps={ancestors:[],depth:0},Rn.propTypes={};const An=(0,l.Z)(u.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(56556),_n=t(44784);const Nn=function(){var e,n,t;const{api:i}=(0,ie.h6)(),{blocklet:o}=(0,me.y0)(),{t:a}=(0,C.PE)(),l=null===o||void 0===o||null===(e=o.meta)||void 0===e?void 0:e.did,r=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)||{}),{handleSubmit:s,control:c,formState:d,watch:p,reset:m}=(0,We.cI)({defaultValues:Ue()(r,["domain","clientId","enabled"])}),f=p("enabled"),h=(0,Ke.Z)((async e=>{try{var n,t;const{blocklet:o}=await i.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:e})}}),r=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)||{});m(r),F.Z.success(a("oauth.saveSuccess"))}catch(o){F.Z.error(o.message||a("oauth.saveFailed"))}})),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("oauth.auth0.domainDescribe"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||a("oauth.auth0.clientIdDescribe"))),b=(0,Ke.Z)((()=>!0));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:s(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:c,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(_n.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:a("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"domain",control:c,rules:{validate:f?g:b},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,label:a("oauth.auth0.domain"),error:!!d.errors[t.name],helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!f})})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:c,rules:{validate:f?x:b},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,children:(0,X.jsx)(H.Z,{...t,error:!!d.errors[t.name],label:a("oauth.auth0.clientId"),helperText:(null===(n=d.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!f})})}}),(0,X.jsx)(Tn.Z,{type:"submit",variant:"contained",onSubmit:s(h),disabled:!d.isDirty,children:a("oauth.save")})]})})};var On=t(77150),In=t(24103);const Fn={ttl:604800};function Bn(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function zn(){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,a=Object.assign({},Fn,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:l,control:r,formState:s,reset:c}=(0,We.cI)({defaultValues:Ue()(Bn(a),["ttl"])}),{t:d}=(0,C.PE)(),p=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:Bn(e,!0)}}),a=Object.assign({},Fn,Ue()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(Bn(a)),F.Z.success(d("common.configSuccess"))}catch(i){F.Z.error(i.message)}}));return(0,X.jsx)(u.Z,{children:(0,X.jsxs)("form",{onSubmit:l(p),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"ttl",control:r,render:e=>{let{field:n}=e;return(0,X.jsx)(Be.Z,{fullWidth:!0,sx:{mb:2},children:(0,X.jsxs)(In.Z,{px:3,children:[(0,X.jsx)(u.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,X.jsx)(On.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)(Tn.Z,{type:"submit",variant:"contained",onSubmit:l(p),disabled:!s.isDirty,children:d("oauth.save")})]})})}var Un=t(82555),Dn=t(30333),Kn=t(75760),Wn=t(97038),qn=t(64886),Gn=t(42080),Vn=t.n(Gn),Hn=t(75506),Mn=t.n(Hn),Yn=t(47685),Jn=t(13260),Qn=t(82434),Xn=t.n(Qn);const $n=(0,a.forwardRef)(((e,n)=>{var t,i;const{t:o}=(0,a.useContext)(C.RD),{blocklet:l}=(0,me.y0)(),{api:r}=(0,ie.h6)(),s=(0,De.Z)({mode:"view",show:!1,data:{},callback:Qe()}),c=(0,Yn.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,m=(0,Ke.Z)((()=>{s.mode="view",s.data={},s.callback=Qe()}),[]),f=(0,Ke.Z)((()=>{s.show=!1,setTimeout((()=>{m()}),d)}),[]),h=(0,Ke.Z)((e=>{s.mode="view",s.show=!0,s.data=e}),[]),g=(0,Ke.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe();s.mode="approve",s.show=!0,s.data=e,s.callback=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:h,close:f,approve:g})),[h,f,g]);const x=(0,Fe.Z)((()=>{if(!s.show)return[];s.data.migratedFrom=[s.data.appId,s.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==s.data.isMaster&&Vn()(e,"appliedAt","status"),e.map((e=>{const n=o("federated.info.".concat(e));let t=s.data[e];if("appName"===e&&s.data.isMaster&&(t=(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(Un.Z,{component:Dn.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,X.jsx)(Jn.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,X.jsx)(u.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=Xn()(t)?t:p()(s.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:s.data.appName})}catch{t=(0,X.jsx)("img",{src:e,width:"60",height:"60",alt:s.data.appName})}}if("status"===e&&(t=t&&o("federated.status.".concat(t))),"migratedFrom"===e){t=(s.data.migratedFrom||[]).filter((e=>![s.data.appId,s.data.appPid].includes(e))).map((e=>(0,X.jsx)(Jn.kL,{children:e})))}return Mn()(t)&&(t="-"),{name:n,value:t}}))}),[s.data]),b="approve"===s.mode,v=(0,Ke.Z)((async()=>{await r.auditFederatedLogin({input:{memberPid:s.data.appPid,did:l.appPid,status:"rejected"}}),f(),null===s||void 0===s||s.callback(!1)})),Z=(0,Ke.Z)((async()=>{await r.auditFederatedLogin({input:{memberPid:s.data.appPid,did:l.appPid,status:"approved"}}),f(),null===s||void 0===s||s.callback(!0)}));return(0,X.jsx)(ge.ZP,{open:s.show,title:o(b?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:f,actions:b?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Tn.Z,{color:"error",variant:"contained",onClick:v,children:o("common.reject")}),(0,X.jsx)(Tn.Z,{variant:"contained",onClick:Z,children:o("common.approve")})]}):(0,X.jsx)(Tn.Z,{variant:"outlined",onClick:f,children:o("common.close")}),children:x.map((e=>(0,X.jsx)(qn.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var et=t(79842),nt=t(85408),tt=t.n(nt);const it=(0,a.forwardRef)(((e,n)=>{var t,i;const o=(0,Yn.Fg)(),l=(null===o||void 0===o||null===(t=o.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,{t:r}=(0,a.useContext)(C.RD),s=(0,De.Z)({show:!1,data:{link:""}}),c=(0,Ke.Z)((()=>{s.data.link=""}),[]),d=(0,Ke.Z)((()=>{s.show=!1,setTimeout((()=>{c()}),l)}),[]),p=(0,Ke.Z)((e=>{let{link:n}=e;s.show=!0,s.data.link=n}),[]);(0,a.useImperativeHandle)(n,(()=>({open:p,close:d})),[p,d]);const m=(0,Ke.Z)((()=>{tt()(s.data.link),d()}),[d]);return(0,X.jsxs)(ge.ZP,{open:s.show,title:r("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:m,children:r("common.copyAndClose")}),children:[(0,X.jsx)(u.Z,{mb:1,children:r("federated.inviteJoinFederatedLoginDescription")}),(0,X.jsx)(u.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,X.jsx)(et.Z,{language:"shell",style:{marginBottom:0},children:s.data.link})})]})}));function ot(e){var n,t,i,o,l;let{mode:r}=e;const s=(0,a.useRef)(null),c=(0,a.useRef)(null),{t:d,locale:p}=(0,a.useContext)(C.RD),{blocklet:m,actions:{refreshBlocklet:f}}=(0,me.y0)(),{confirmApi:h,confirmHolder:g}=$e(),{api:x}=(0,ie.h6)(),b=(null===(n=m.settings.federated)||void 0===n?void 0:n.sites)||[],v=(null===(t=m.settings.federated)||void 0===t?void 0:t.config)||{},Z=!1!==v.isMaster,j=(0,Ke.Z)((e=>{var n;null===(n=c.current)||void 0===n||n.open(e)})),y=(0,Ke.Z)((e=>{var n;null===(n=c.current)||void 0===n||n.approve(e,f)})),k=(0,Ke.Z)((e=>{h.open({title:d("federated.disableFederatedLogin"),content:d("federated.disableFederatedLoginDescription"),async onConfirm(n){await x.auditFederatedLogin({input:{memberPid:e.appPid,did:m.appPid,status:"revoked"}}),n()}})})),w=(0,Ke.Z)((e=>{h.open({title:d("federated.enableFederatedLogin"),content:d("federated.enableFederatedLoginDescription"),async onConfirm(n){await x.auditFederatedLogin({input:{memberPid:e.appPid,did:m.appPid,status:"approved"}}),n()}})})),S=(0,Fe.Z)((()=>{const e=[{label:d("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{display:"inline-block",children:(0,X.jsxs)(u.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,X.jsx)(Un.Z,{component:Dn.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:d("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=b[e];return(0,X.jsx)(Wn.Z,{children:n.appId})}}},{label:d("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,X.jsx)(u.Z,{children:t?"-":d("federated.status.".concat(n.status))})}}}];return Z&&e.push({label:d("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=b[e],t=!1!==n.isMaster;return(0,X.jsx)(u.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:d("federated.status.rejected")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:d("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(),y(n)},children:d("federated.status.pending")}),"approved"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),k(n)},style:{whiteSpace:"nowrap"},children:d("federated.revoke")}),"revoked"===n.status&&(0,X.jsx)(N.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),w(n)},style:{whiteSpace:"nowrap"},children:d("federated.approve")})]})})}}}),e}),[v.appId,b,Z,d]),E=(0,Fe.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=b[t];j(i)}})),[]),L=(0,Ke.Z)((()=>{const e=m.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=s.current)||void 0===n||n.open({link:e.value}):F.Z.error(d("federated.failedToGetFederatedLoginLink"))}),[null===(i=m.site)||void 0===i||null===(o=i.domainAliases)||void 0===o||null===(l=o[0])||void 0===l?void 0:l.href]),P=(0,Ke.Z)((()=>{h.open({title:d("federated.quitFederatedLogin"),content:d("federated.quitFederatedLoginDescription"),async onConfirm(e){await x.quitFederatedLogin({input:{did:m.appPid}}),e()}})})),R=(0,Ke.Z)((()=>{h.open({title:d("federated.disbandFederatedLogin"),content:d("federated.disbandFederatedLoginDescription"),async onConfirm(e){await x.disbandFederatedLogin({input:{did:m.appPid}}),e()}})})),A=[];return"master"!==r?A.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",color:"error",onClick:P,sx:{ml:1},children:d("federated.quitFederatedLogin")},"quitFederatedLogin")):(A.push((0,X.jsx)(N.Z,{size:"small",variant:"contained",onClick:L,sx:{ml:1},children:d("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),A.push((0,X.jsx)(N.Z,{color:"error",size:"small",variant:"contained",onClick:R,sx:{ml:1},children:d("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Kn.Z,{className:"main-table",locale:p,data:b,columns:S,customButtons:A,title:(0,X.jsx)(u.Z,{className:"table-toolbar-left",children:d("oauth.federated")}),options:E}),g,(0,X.jsx)(it,{ref:s}),(0,X.jsx)($n,{ref:c})]})}ot.propTypes={mode:s().oneOf(["member","master"])},ot.defaultProps={mode:"member"};const at=ot,lt=(0,a.forwardRef)(((e,n)=>{var t,i;const{t:o}=(0,a.useContext)(C.RD),{api:l}=(0,ie.h6)(),{blocklet:r}=(0,me.y0)(),s=null===r||void 0===r?void 0:r.appPid,c=(0,Yn.Fg)(),d=(null===c||void 0===c||null===(t=c.transitions)||void 0===t||null===(i=t.duration)||void 0===i?void 0:i.leavingScreen)||300,p=(0,De.Z)({show:!1,appUrl:"",appUrlError:"",callback:Qe()}),m=(0,Ke.Z)((()=>{p.appUrl="",p.appUrlError="",p.callback=Qe()}),[]),f=(0,Ke.Z)((()=>{p.show=!1,setTimeout((()=>{m()}),d)}),[]),h=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe();p.show=!0,p.callback=e}),[]);(0,a.useImperativeHandle)(n,(()=>({open:h,close:f})),[h,f]);const g=(0,Ke.Z)((e=>{if(!e)throw new Error(o("federated.federatedJoinAppUrlRequired"));if(!Xn()(e))throw new Error(o("federated.federatedJoinAppUrlInvalid"))})),x=(0,Ke.Z)((async()=>{try{g(p.appUrl);const e=await l.joinFederatedLogin({input:{did:s,appUrl:p.appUrl}});p.show=!1,f(),null===p||void 0===p||p.callback(e)}catch(e){p.appUrlError=e.message}}),[f,s]);return(0,X.jsxs)(ge.ZP,{open:p.show,title:o("federated.joinFederatedLogin"),onClose:f,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(N.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,children:o("common.confirm")}),children:[(0,X.jsx)(u.Z,{mb:1,children:o("federated.joinFederatedLoginDescription")}),(0,X.jsx)(H.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:o("federated.federatedJoinAppUrl"),label:o("federated.federatedJoinAppUrl"),value:p.appUrl,error:!!p.appUrlError,helperText:p.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{p.appUrl=e.target.value}})]})}));function rt(){var e,n,t,i;const o=(0,a.useRef)(null),l=(0,a.useRef)(null),{t:r}=(0,a.useContext)(C.RD),{blocklet:s,actions:{refreshBlocklet:c}}=(0,me.y0)(),d=(0,Ke.Z)((()=>{var e,n,t;const i=null===(e=s.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href;if(i)try{var a;const e=new URL(i);null===(a=o.current)||void 0===a||a.open({link:e.origin})}catch{F.Z.error(r("federated.failedToGetFederatedLoginLink"))}}),[null===(e=s.site)||void 0===e||null===(n=e.domainAliases)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.href]),p=(0,Ke.Z)((()=>{var e;null===(e=l.current)||void 0===e||e.open((()=>{c()}))}),[c]);if((null===(i=s.settings.federated)||void 0===i?void 0:i.sites.length)>0){var m;const e=!1!==(null===(m=s.settings.federated)||void 0===m?void 0:m.config.isMaster);return(0,X.jsx)(at,{mode:e?"master":"member"})}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,X.jsx)(N.Z,{variant:"contained",onClick:d,children:r("federated.inviteJoinFederatedLogin")}),(0,X.jsx)(_.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,X.jsx)(N.Z,{variant:"outlined",onClick:p,children:r("federated.joinFederatedLogin")})]}),(0,X.jsx)(it,{ref:o}),(0,X.jsx)(lt,{ref:l})]})}const st=function(){const{t:e}=(0,a.useContext)(C.RD),n=[{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:"Auth0"}),value:"auth0"},{label:(0,X.jsx)(u.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,a.useState)(n[0].value),o=(0,Fe.Z)((()=>({auth0:(0,X.jsx)(Nn,{}),federated:(0,X.jsx)(rt,{}),more:(0,X.jsx)(u.Z,{children:(0,X.jsx)(Ie.Z,{children:e("oauth.comingSoon")})}),settings:(0,X.jsx)(u.Z,{children:(0,X.jsx)(zn,{})})})),[e]);return(0,X.jsxs)(u.Z,{children:[(0,X.jsx)(k.Z,{tabs:n,current:t,onChange:i}),(0,X.jsx)(u.Z,{marginTop:"10px",children:o[t]})]})};var ct;const dt=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:a}=e;const l=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),r=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,X.jsxs)(u.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)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:r?a("blocklet.component.container"):(0,w.getDisplayName)(t,!0)})})]},l),value:l}),t.children.length>0&&t.children.forEach((e=>{dt({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:a})}))};function pt(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:o}=(0,a.useContext)(C.RD),{info:l,inService:r}=(0,ie.h6)(),[s,d]=(0,a.useState)(!0),[w,S]=(0,y.useSearchParams)(),E=w.get("tab")||"general",L=[{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,X.jsx)(h.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.general")})})]},"general"),value:"general"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,X.jsx)(g.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.access")})})]},"access"),value:"access"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-oauth",children:[(0,X.jsx)(x.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.login")})})]},"oauth"),value:"oauth"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,X.jsx)(b.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.notification")})})]},"notification"),value:"notification"},{label:(0,X.jsxs)(u.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,X.jsx)(u.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)(v.Z,{sx:{fontSize:24}}),(0,X.jsx)(u.Z,{ml:"16px",children:(0,X.jsx)(u.Z,{style:{color:"#222"},children:o("common.preferences")})})]},"preference"),value:"preference"}];s&&dt({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)(Rn,{});else if("oauth"===E)P=(0,X.jsx)(st,{});else if("notification"===E)P=(0,X.jsx)(on,{});else{const e=r?m.WELLKNOWN_SERVICE_PATH_PREFIX:l.routing.adminPath,n=new URLSearchParams;r||n.set("authKey","__sst"),n.set("schemaKey",p()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(E)))),P=(0,X.jsx)(c.Z,{url:"".concat(p()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,X.jsx)(mt,{...i,children:(0,X.jsxs)(f.ZP,{container:!0,spacing:4,columns:24,children:[(0,X.jsx)(f.ZP,{item:!0,sm:7,md:5,children:(0,X.jsx)(k.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)(f.ZP,{item:!0,sm:17,md:19,children:(0,X.jsx)(u.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}pt.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},pt.defaultProps={onUpdate:()=>{}};const mt=l.Z.div(ct||(ct=(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),a=t(28726),l=t(44846),r=t(68420),s=t(14491),c=t(58238),d=t(70461),p=t(96266);function m(e){let{teamDid:n,size:t="small",...m}=e;const{t:u}=(0,r.PE)(),{api:f}=(0,c.h6)(),[h,g]=(0,i.useState)(!1),[x,b]=(0,i.useState)(null),v={title:u("blocklet.config.clearCache.title"),description:u("blocklet.config.clearCache.description"),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await f.clearCache({input:{teamDid:n}});o.Z.success(u("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),b(null)}},onCancel:()=>{g(!1),b(null)}};return(0,p.jsxs)("div",{...m,children:[(0,p.jsxs)(a.Z,{onClick:()=>b(v),color:"error",variant:"outlined",size:t,children:[h?(0,p.jsx)(l.Z,{size:16,style:{marginRight:5}}):null,u("blocklet.config.clearCache.action")]}),x&&(0,p.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),a=t.n(o),l=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)(l.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:a().any.isRequired}},28641:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),a=t.n(o),l=t(39948),r=t(47020),s=t(44846),c=t(13727),d=t(56184),p=t(67680),m=t(35406),u=t(11875),f=t(95890),h=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:a,onChange:x,placeholder:b,style:v,onSubmit:Z,secure:j,triggers:y,formatterBeforeSubmit:C,...k}=e;const[w,S]=(0,i.useState)(!1),[E,L]=(0,i.useState)(!1),[P,R]=(0,i.useState)(j&&"__encrypted__"===a?null:a),[A,T]=(0,i.useState)(P),_=async()=>{L(!0);try{if(!1===await Z(A))T(P);else{let e=A;"function"===typeof C&&(e=C(A)),T(e),R(e)}}catch(e){T(P)}finally{L(!1),S(!1)}},N=w?(0,h.jsx)(r.Z,{style:{flex:1},fullWidth:!0,value:A,onChange:e=>{var n;n=e.target.value,T(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:b,onKeyDown:e=>{"Enter"===e.key&&_()},disabled:t,type:j?"password":"text",...k}):(0,h.jsx)(l.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(A,j,a)});return(0,h.jsx)(u.Z,{className:"form",style:v,children:(0,h.jsxs)(l.Z,{className:"form-item",children:[(0,h.jsxs)(l.Z,{className:"form-item-label",children:[n,o&&(0,h.jsx)(m.Z,{})]}),(0,h.jsxs)(l.Z,{className:"form-item-body",children:[(0,h.jsx)(l.Z,{className:"form-item-input",children:N}),(0,h.jsx)(l.Z,{className:"form-item-action",children:w?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p.Z,{"data-cy":"schema-form-item-confirm",onClick:_,disabled:t||E,size:"large",children:E?(0,h.jsx)(s.Z,{size:24}):(0,h.jsx)(d.Z,{})}),(0,h.jsx)(p.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{T(P),S(!1)},disabled:t||E,size:"large",children:(0,h.jsx)(c.default,{})})]}):(0,h.jsx)(f.Z,{triggers:y,onEnterEdit:()=>S(!0),disabled:t})})]})]})})}x.propTypes={style:a().object,onSubmit:a().func,onChange:a().func,label:a().string,initialValue:a().string,placeholder:a().string,required:a().bool,disabled:a().bool,secure:a().bool,triggers:a().array,formatterBeforeSubmit:a().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),a=t(33518),l=t(39948);const r=(0,a.Z)(l.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),a=t.n(o),l=t(24558),r=t(67680),s=t(56556),c=t(80633),d=t(49390),p=t(37200),m=t(25228),u=t(24202),f=t(74490),h=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const a=i.useRef(null),[x,b]=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)(l.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:a,"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)(l.Z,{})}),(0,g.jsx)(s.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{b((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(u.Z,{sx:{zIndex:9999},open:x,anchorEl:a.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(m.Z,{children:(0,g.jsx)(p.d,{onClickAway:e=>{a.current&&a.current.contains(e.target)||b(!1)},children:(0,g.jsx)(h.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(f.Z,{onClick:()=>{return n=e.handler,b(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:a().arrayOf(a().shape({key:a().string.isRequired,title:a().string.isRequired,handler:a().func.isRequired})),onEnterEdit:a().func.isRequired,disabled:a().bool.isRequired},x.defaultProps={triggers:[]}},35406:(e,n,t)=>{t.d(n,{Z:()=>a});var i,o=t(71171);const a=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")}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6511],{86511:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ne});var a=n(71171),i=n(5057),o=n(33518),l=n(85493),s=n(15849),c=n(68420),r=n(11750),d=n(39434),u=n(39948),p=n(10697),m=n(94464),v=n(88574),h=n(28726),g=n(38242),b=n(81010),f=n(87363),y=(n(68534),n(86229)),k=n(1722),x=n(35432),w=n(43316),P=n(58238),j=n(29054),S=n(73545),B=n(14491),Z=n(4651),C=n(96266);const E=e=>{const t={};let n=null;return(0,g.forEachBlockletSync)(e,(e=>{t[e.meta.bundleDid]?n=(0,g.getDisplayName)(e,!0):e.meta.bundleDid&&(t[e.meta.bundleDid]=!0)})),n},L=(e,t,n)=>{const{hostname:a,href:i}=e;if(!t)return i;if(n){var o;const e=/\d+[-.]\d+[-.]\d+[-.]\d+/.exec(a);if(!e)return i;const n=e[0],l=(((null===(o=t.site)||void 0===o?void 0:o.domainAliases)||[]).map((e=>e.value)).filter(Boolean).find((e=>e.endsWith(x.DEFAULT_DID_DOMAIN)))||"").replace(".".concat(x.DEFAULT_DID_DOMAIN),"");return l?i.replace(a,"".concat(l,"-").concat(n,".").concat(x.DEFAULT_IP_DOMAIN_SUFFIX)):i}return i.replace(t.meta.bundleDid,t.appPid)};function _(){const{t:e}=(0,c.PE)(),{api:t}=(0,S.T)(),{blocklet:n}=(0,j.y0)(),{inService:a}=(0,P.h6)(),[o,l]=(0,i.useState)(!1),[s,r]=(0,i.useState)(5),d=n&&n.structVersion!==x.APP_STRUCT_VERSION;return[d&&(0,C.jsxs)(v.Z,{type:"warning",style:{margin:"12px 0"},children:[(0,C.jsxs)(u.Z,{display:"flex",alignItems:"center",children:[(0,C.jsx)(h.Z,{variant:"contained",size:"small",color:"primary",onClick:()=>(()=>{try{if("running"===n.status)return void y.Z.error(e("blocklet.migrate.tip.running"));const t=E(n);if(t)return void y.Z.error(e("blocklet.migrate.tip.duplicate",{name:t}));l(!0)}catch(t){y.Z.error((0,B.Z)(t))}})(),style:{marginRight:8},children:e("blocklet.migrate.intro.l1")}),(0,C.jsx)("span",{children:e("blocklet.migrate.intro.l2")})]}),["l3","l4","l5","l6"].map((t=>(0,C.jsx)(u.Z,{display:"flex",alignItems:"center",children:e("blocklet.migrate.intro.".concat(t))},t)))]},"alert"),n&&(0,C.jsx)(w.Z,{popup:!0,open:o,saveConnect:!1,forceConnected:!1,action:"migrate-app-to-struct-v2",checkFn:t.get,checkTimeout:3e5,onSuccess:()=>{const e=L(window.location,n,a);setTimeout((()=>{window.location.href=e}),5e3),r(5),setInterval((()=>{r((e=>e-1))}),1e3)},extraParams:{appDid:n.appDid,did:n.meta.did,wt:(0,Z.iK)(n,!0),title:(0,g.getDisplayName)(n)},messages:{title:e("blocklet.migrate.title"),scan:e("blocklet.migrate.scan"),confirm:e("blocklet.migrate.confirm"),success:s>=0?e("blocklet.migrate.success",{sec:s}):"Redirecting..."},onClose:()=>l(!1)},"connect")]}_.propTypes={};var D,A=n(35966),N=n(85531),G=n(44846),U=n(78123),T=n(75793),I=n(17022),O=n(93677),K=n(74094),z=n(7199);const R=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(3058),n.e(4549)]).then(n.bind(n,64549)))),F=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(95),n.e(6547),n.e(5760),n.e(506),n.e(7150),n.e(2443),n.e(4509),n.e(6230)]).then(n.bind(n,64558)))),M=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(4631),n.e(6547),n.e(506),n.e(2443),n.e(1294),n.e(5914),n.e(4775)]).then(n.bind(n,14775)))),V=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(442),n.e(9662),n.e(7676),n.e(8986)]).then(n.bind(n,13239)))),Y=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(7687),n.e(5374),n.e(592),n.e(5979),n.e(2537)]).then(n.bind(n,75979)))),$=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(95),n.e(6547),n.e(5760),n.e(5887),n.e(5672),n.e(3216)]).then(n.bind(n,75672)))),W=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(95),n.e(4901),n.e(1685),n.e(5015)]).then(n.bind(n,85555)))),X=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(95),n.e(2911),n.e(4901),n.e(442),n.e(5526),n.e(7687),n.e(7638),n.e(1685),n.e(7657),n.e(3135),n.e(406),n.e(1846),n.e(7875)]).then(n.bind(n,77875)))),J=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(9327),n.e(8219)]).then(n.bind(n,92379)))),Q=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(95),n.e(6547),n.e(5760),n.e(7534)]).then(n.bind(n,87534)))),q=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(4901),n.e(2743),n.e(2611)]).then(n.bind(n,42611)))),H=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(8537),n.e(4631),n.e(2294),n.e(95),n.e(6547),n.e(5760),n.e(406),n.e(1846),n.e(9552)]).then(n.bind(n,39552)))),ee=e=>{let{children:t}=e;return t};function te(){var e;const t=(0,l.useNavigate)(),{tab:n="overview"}=(0,l.useParams)(),{did:a,blocklet:o,error:w,client:P,actions:{setBlocklet:j,refreshBlocklet:S}}=(0,O.y0)(),{refresh:B}=(0,T.h6)(),{t:Z}=(0,c.PE)(),E=(0,i.useCallback)((()=>(0,C.jsx)(V,{scope:a})),[a]),L=(null===o||void 0===o||null===(e=o.environments.find((e=>"BLOCKLET_APP_URL"===e.key)))||void 0===e?void 0:e.value)||window.location.origin,D=e=>(0,K.bV)(e,L),N=e=>{t("/blocklets/".concat(a,"/").concat(e))},te=e=>{e&&j(e),S()},ne=!o||(0,K.wS)(o.status)?[]:(0,g.getAppMissingConfigs)(o);let ie=null;const oe=[{label:Z("common.overview"),value:"overview"},{breadcrumbsLabel:Z("common.components"),label:(0,C.jsx)(p.Z,{color:"error",variant:"dot",invisible:!ne.length,children:Z("common.components")}),value:"components"}];if(w)ie=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(v.Z,{type:"error",variant:"icon",children:(0,K.Z)(w)}),(0,C.jsx)(h.Z,{onClick:()=>S(),children:(0,C.jsx)("span",{style:{textDecoration:"underline"},children:Z("common.retry")})})]});else if(o){var le;const e={overview:(0,C.jsx)(R,{}),configuration:F,navigation:M,services:W,members:(0,C.jsx)($,{type:"blocklet",createPassportSvg:D}),passports:Y,components:X,"audit-logs":E,logs:J,runtime:(0,C.jsx)(Q,{}),traffic:(0,C.jsx)(q,{client:P,did:a}),storage:(0,C.jsx)(H,{})};"configuration"===n&&(0,K.wS)(o.status)&&N("overview"),(0,K.wS)(o.status)||(oe.push({label:Z("common.members"),value:"members"}),oe.push({label:Z("common.passport"),value:"passports"}),oe.push({label:Z("common.configuration"),value:"configuration"})),oe.push({label:Z("common.auditLogs"),value:"audit-logs"}),o&&null!==(le=o.children)&&void 0!==le&&le.length&&o.structVersion===x.APP_STRUCT_VERSION&&oe.push({label:Z("common.logs"),value:"logs"}),oe.push({label:Z("common.configNavigation"),value:"navigation"}),oe.push({label:Z("common.runtime"),value:"runtime"}),oe.push({label:Z("common.traffic"),value:"traffic"}),oe.push({label:Z("common.storage"),value:"storage"});(0,g.getBlockletServices)(o).length&&oe.splice(2,0,{label:Z("blocklet.services"),value:"services"});const t=e[n]||e.overview;ie=(0,C.jsxs)(f.g,{type:"components",children:[!(0,g.isExternalBlocklet)(o)&&(0,C.jsx)(m.Z,{tabs:oe,current:n,onChange:N,scrollButtons:"auto"}),(0,C.jsx)("div",{className:"page-content",children:(0,C.jsx)(i.Suspense,{fallback:(0,C.jsx)(A.Z,{relative:"parent",children:(0,C.jsx)(G.Z,{})}),children:(0,i.isValidElement)(t)?t:(0,C.jsx)(t,{blocklet:o,onUpdate:te,createPassportSvg:D})})})]})}else ie=(0,C.jsx)(A.Z,{relative:"parent",children:(0,C.jsx)(G.Z,{})});const se=oe.find((e=>e.value===n)),ce=o?I.G6:ee;return(0,C.jsx)(ce,{teamDid:a,children:(0,C.jsxs)(ae,{children:[(0,C.jsxs)(d.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,C.jsx)(s.Link,{color:"textSecondary",to:"/blocklets",children:Z("common.blocklets")}),(0,C.jsx)(s.NavLink,{to:"/blocklets/".concat(a,"/overview"),style:e=>e?{color:"inherit"}:{},children:Z("common.detail")}),(0,C.jsx)(r.Z,{color:"textSecondary",children:se?se.breadcrumbsLabel||se.label:""})]}),(0,C.jsxs)(r.Z,{component:"div",className:"page-header",children:[(0,C.jsxs)(r.Z,{component:"h2",variant:"h4",className:"page-title",color:"textPrimary",children:[o?(0,C.jsx)(k.Z,{blocklet:o,style:{marginRight:16}}):null,o?(0,C.jsxs)(u.Z,{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,children:[(0,C.jsx)(u.Z,{children:(0,g.getDisplayName)(o)}),"unknown"!==(null===o||void 0===o?void 0:o.status)&&(0,C.jsx)(b.Z,{size:"12px",status:o.status,source:o.source,progress:o.progress})]}):"".concat(Z("common.blocklet")," ").concat(Z("common.detail"))]}),(0,C.jsx)(z.Z,{permission:"mutate_blocklets",children:!!o&&!(0,g.isExternalBlocklet)(o)&&(0,C.jsx)(U.Z,{className:"page-actions",blocklet:o,onStart:()=>{},onComplete:e=>{let{action:n,error:a}=e;a?y.Z.error(a.message):"remove"===n?(B(),t("/blocklets")):S()},variant:"group"})})]}),(0,C.jsx)(_,{}),ie]})})}function ne(){const{did:e}=(0,l.useParams)();return e?(0,C.jsx)(O.$8,{did:e,children:(0,C.jsx)(N.wV,{children:(0,C.jsx)(te,{})})}):null}const ae=o.Z.main(D||(D=(0,a.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n gap: 16px;\n }\n\n .page-title {\n display: flex;\n align-items: center;\n\n .page-link {\n font-size: 15px;\n margin-top: 8px;\n margin-left: 8px;\n }\n }\n\n .page-content {\n margin-top: 16px;\n }\n\n @media (max-width: ","px) {\n .page-header {\n flex-direction: column;\n align-items: flex-start;\n .page-actions,\n .MuiButtonGroup-root {\n width: 100%;\n }\n .MuiButtonGroup-root {\n .MuiButtonBase-root {\n flex: 1;\n }\n .blocklet-action-text {\n display: none;\n }\n }\n }\n\n .page-title {\n margin-bottom: 15px;\n }\n }\n"])),(e=>e.theme.breakpoints.values.md))},85531:(e,t,n)=>{n.d(t,{wV:()=>w,XN:()=>P});var a=n(5057),i=n(55898),o=n.n(i),l=n(86229),s=n(68420),c=n(77277),r=n(29054),d=n(84584),u=n(41899),p=n(58238),m=n(65873);var v=n(14491);function h(){var e;let{setLoading:t,refresh:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{blocklet:i,actions:{refreshBlocklet:o}}=(0,r.y0)(),s=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,[c,h]=(0,a.useState)([]),{api:g}=(0,p.h6)();return(0,u.Z)((async()=>{try{if(!s)return void h([]);null===t||void 0===t||t(!0);const{spaceGateways:e}=await g.getBlockletSpaceGateways({input:{did:s}}),n=await async function(e){let{blockletDid:t,nodeApi:n,spaceGateways:a}=e,i=!1;const o=await Promise.all(a.map((async e=>{let{name:t}=e;const n=await(0,d.nU)(e.endpoint);return(0,m.isEmpty)(n)||n===t||(t=n,i=!0),{...e,name:t}})));return i&&await Promise.all(o.filter((e=>e.did)).map((e=>n.updateBlockletSpaceGateway({input:{did:t,where:{did:e.did},spaceGateway:{...e}}})))),o}({blockletDid:s,nodeApi:g,spaceGateways:e});h(null!==n&&void 0!==n?n:[])}catch(e){console.error(e),l.Z.error((0,v.Z)(e))}finally{null===t||void 0===t||t(!1)}}),[s,o,n]),{spaceGateways:c}}function g(){var e;let{deps:t,setLoading:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[],setLoading:()=>{}};const{blocklet:i}=(0,r.y0)(),[o,s]=(0,a.useState)([]),{api:c}=(0,p.h6)(),d=(0,m.debounce)((async()=>{try{if(n(!0),!i)return void s([]);const{backups:e}=await c.getBlockletBackups({input:{did:i.meta.did}});s(null!==e&&void 0!==e?e:[])}catch(e){console.error(e),l.Z.error((0,v.Z)(e))}finally{n(!1)}}),2e3);return(0,u.Z)((async()=>{d()}),[null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did].concat(t)),{backups:o}}const b=function(e){let{appDid:t}=e;const{backups:n}=g(),[i,o]=(0,a.useState)({message:"",progress:0,completed:!1}),l=(0,p.h6)(),{ws:{useSubscription:s}}=l;return s(c.BlockletEvents.backupProgress,(e=>{t===(null===e||void 0===e?void 0:e.appDid)&&o((()=>({...e})))}),[t]),(0,a.useEffect)((()=>{var e;if(null!==n&&void 0!==n&&n.length&&(0,m.isNull)(null===(e=n[0])||void 0===e?void 0:e.status)){const[e]=n;o((()=>({message:e.message,progress:e.progress,completed:Boolean(e.progress>=100)})))}}),[n]),i};var f=n(96266);const y=(0,a.createContext)({}),{Provider:k,Consumer:x}=y;function w(e){let{children:t}=e;const{t:n}=(0,s.PE)(),{api:i}=(0,p.h6)(),{blocklet:o}=(0,r.y0)(),[m,v]=(0,a.useState)(!1),[y,x]=(0,a.useState)(!1),{spaceGateways:w}=h({refresh:y,setLoading:v}),P=b({appDid:null===o||void 0===o?void 0:o.appDid}),[j,S]=(0,a.useState)(!1),B=(0,a.useMemo)((()=>(0,d.mo)(null===o||void 0===o?void 0:o.environments)),[o,y,j]),[Z,C]=(0,a.useState)(!1),{backups:E}=g({deps:[P],setLoading:C}),[L,_]=(0,a.useState)(null===w||void 0===w?void 0:w.find((e=>e.endpoint===B))),[D,A]=(0,a.useState)(!1),N=function(){var e;let{deps:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[]};const{blocklet:n}=(0,r.y0)(),{api:i}=(0,p.h6)(),[o,l]=(0,a.useState)(null);return(0,u.Z)((async()=>{var e;if(null!==n&&void 0!==n&&null!==(e=n.meta)&&void 0!==e&&e.did){const{autoBackup:e}=await i.getAutoBackup({input:{did:n.meta.did}});l(e)}}),[null===n||void 0===n||null===(e=n.meta)||void 0===e?void 0:e.did].concat(t)),o}({deps:[D]}),[G,U]=(0,a.useState)(!1),T=function(){var e;let{deps:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[]};const{blocklet:n}=(0,r.y0)(),{api:i}=(0,p.h6)(),[o,l]=(0,a.useState)(null);return(0,u.Z)((async()=>{var e;if(null!==n&&void 0!==n&&null!==(e=n.meta)&&void 0!==e&&e.did){const{autoCheckUpdate:e}=await i.getAutoCheckUpdate({input:{did:n.meta.did}});l(e)}}),[null===n||void 0===n||null===(e=n.meta)||void 0===e?void 0:e.did].concat(t)),o}({deps:[G]}),I=()=>{x((e=>!e))};return(0,f.jsx)(k,{value:{spaceGateways:w,selectedSpaceGateway:L,addSpaceGateway:async(e,t)=>{w.push({...e,loading:!0}),await i.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:e}}),B!==t&&await i.configBlocklet({input:{did:[o.meta.did],configs:[{key:c.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t}]}}),I(),_(e)},deleteSpaceGateway:async e=>{e&&(e.endpoint!==B?(await i.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:null===e||void 0===e?void 0:e.did}}),I(),_(e)):l.Z.warning(n("storage.spaces.gateway.delete.failedForConnected")))},updateSpaceGateway:async e=>{var t;await i.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:e.did},spaceGateway:e}}),B!==e.endpoint&&await i.configBlocklet({input:{did:[o.meta.did],configs:[{key:c.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:e.endpoint}]}}),l.Z.success(n("storage.spaces.connectedWithName",{name:null!==(t=null===e||void 0===e?void 0:e.name)&&void 0!==t?t:"DID Spaces"})),I()},refreshSpaceGateways:I,spaceGatewaysLoading:m,spaceGatewayIsSelected:e=>(null===e||void 0===e?void 0:e.endpoint)===B,updateAutoBackup:async e=>{await i.updateAutoBackup({input:{did:o.meta.did,autoBackup:e}}),A((e=>!e))},updateAutoCheckUpdate:async e=>{await i.updateAutoCheckUpdate({input:{did:o.meta.did,autoCheckUpdate:e}}),U((e=>!e))},autoCheckUpdate:T,backupEndpoint:B,backupProgress:P,backups:E,backupsLoading:Z,refreshBackupEndpoint:()=>{S((e=>!e))},autoBackup:N},children:t})}function P(){return(0,a.useContext)(y)}w.propTypes={children:o().any.isRequired},w.defaultProps={}},60344:(e,t,n)=>{n.d(t,{hi:()=>o,od:()=>i.a});var a=n(10458),i=n.n(a);i().defaults.timeout=1e4;const o=i().create()},84584:(e,t,n)=>{n.d(t,{EJ:()=>f,Jf:()=>b,LQ:()=>u,Nb:()=>p,UV:()=>y,Xv:()=>r,Z3:()=>k,ag:()=>v,mo:()=>m,nD:()=>d,nU:()=>g,w2:()=>h});var a=n(82434),i=n.n(a),o=n(77277),l=n(65873),s=n(2842),c=n(60344);function r(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/"),a=n.at(-4),i=n.at(-2);return(0,s.xn)(t,"space",a,"apps",i,"explorer?key=/apps/".concat(i,"/.did-objects/").concat(i,"/"))}function d(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(t,"space",n)}function u(e){return e.replace(/\/$/,"").split("/").at(-4)}async function p(e){try{if(!i()(e))return!1;const{headers:t}=await c.hi.head(e,{timeout:5e3});return"true"===t["x-listable"]&&"true"===t["x-readable"]&&"true"===t["x-writeable"]}catch(t){return console.error(t),!1}}function m(e){var t;return(null===e||void 0===e||null===(t=e.find((e=>e.key===o.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT)))||void 0===t?void 0:t.value)||""}function v(e){const t=new URL(e);return(0,s.xn)(t.origin,t.pathname)}async function h(e){try{if(!i()(e))return!1;const t=v(e),n=(0,s.xn)(t,"space/api/did/one-click-authorization/token"),{status:a,data:o}=await c.hi.get(n,{timeout:5e3});return 200===a&&(0,l.isObject)(o)}catch(t){return console.error(t),!1}}async function g(e){let{timeout:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e3};try{if(!i()(e))return"";const{headers:n}=await c.hi.head(e,{timeout:t}),a=n["x-space-name"];return a?decodeURIComponent(a):""}catch(n){return console.error(n),""}}function b(e){const t=e.replace(/\/api\/space\/.+/,""),n=e.replace(/\/$/,"").split("/").at(-4);return(0,s.xn)(t,"/api/space/nft/display?spaceDid=".concat(n))}const f=e=>{var t,n;return(null===e||void 0===e||null===(t=e.configs)||void 0===t||null===(n=t.find((e=>e.key===o.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)))||void 0===n?void 0:n.value)||null};async function y(e){const t={};return t.did=u(e),t.name=await g(e),t.url=function(e){return null===e||void 0===e?void 0:e.replace(/\/api\/space\/.+/,"")}(e),t.endpoint=e,t}async function k(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e4,withSearchParams:!0};if(!(0,l.isString)(e))throw new Error("url(".concat(e,") must be a string"));const a=e.startsWith("http")?e:"https://".concat(e),i=new URL(a),{data:o}=await c.hi.get((0,s.xn)(i.origin,"/__blocklet__.js?type=json"),{timeout:n.timeout}),r=null===(t=o.componentMountPoints.findLast((e=>"z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf"===e.did)))||void 0===t?void 0:t.mountPoint;if(!r)throw new Error("MountPoint(".concat(r,") not found"));const d=(0,s.xn)(i.origin,r);return n.withSearchParams&&i.searchParams.get("spaceDid")?(0,s.xn)(d,"?spaceDid=".concat(i.searchParams.get("spaceDid"))):d}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6931],{78123:(e,n,t)=>{t.d(n,{Z:()=>z});var o,l=t(71171),i=t(5057),a=t(55898),r=t.n(a),c=t(33518),s=t(85493),d=t(15849),u=t(67654),m=t(67680),p=t(61533),v=t(29034),g=t(49127),f=t(44846),b=t(74490),h=t(83294),k=t(46954),y=t(44067),x=t(11750),Z=t(65140),w=t(87916),C=t(26174),E=t(93938),L=t(28726),j=t(38242),R=t(68420),B=t(77277),D=t(86229),O=t(14491),S=t(4651),P=t(58238),U=t(70461),_=t(55419),T=t(29054),A=t(96266);function N(e){var n,t,o,l;let{blocklet:a,onStart:r,onComplete:c,variant:N,hasPermission:I,useBlockletUrlEvaluation:M,...z}=e;const G=(0,s.useNavigate)(),F=(0,P.h6)(),[q,X]=(0,i.useState)(null),[V,W]=(0,i.useState)(null),[Y,Q]=(0,i.useState)(!1),[H,J]=(0,i.useState)(null),{t:$}=(0,i.useContext)(R.RD),[ee]=(0,u.Z)("skip-blocklet-setup",!1),{loading:ne,recommendedUrl:te}=M(a),{nftState:oe}=(0,T.y0)(),le=(0,j.isInProgress)(a.status);let ie=(null===a||void 0===a||null===(n=a.controller)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.value)===B.BLOCKLET_CONTROLLER_STATUS.suspended;null!==oe&&void 0!==oe&&oe.expired||(null===a||void 0===a||null===(o=a.controller)||void 0===o||null===(l=o.status)||void 0===l?void 0:l.reason)!==B.SUSPENDED_REASON.expired||(ie=!1);const{inService:ae}=F,re=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return async()=>{const o=async t=>{r({action:e,blocklet:a}),Q(!0),W(e);let o=!1;try{if("remove"===e)await n(t);else if("start"===e){var l;if(!(0,j.hasRunnableComponent)(a))return void D.Z.error($("blocklet.noComponent"));if(!ae&&!ee&&(null===(l=a.settings)||void 0===l||!l.initialized)&&a.mode!==B.BLOCKLET_MODES.DEVELOPMENT){const n=(0,S.RU)(F.info),t=new URL(te);return t.searchParams.set("serverUrl",n),window.open(t.href),void c({action:e,blocklet:a})}const t=a.children.filter((e=>!(0,j.isInProgress)(e.status)&&"running"!==e.status)).map((e=>e.meta.did)),o={did:a.meta.did,componentDids:t};await n({input:o})}else if(["stop","restart","reload"].includes(e)){const e=a.children.filter((e=>"running"===e.status)).map((e=>e.meta.did)),t={did:a.meta.did,componentDids:e};await n({input:t})}else{const e={did:a.meta.did};await n({input:e})}"remove"===e?o=!0:await(0,O._v)(1e3),"reload"===e&&D.Z.success($("blocklet.reloadSuccess")),J(null),c({action:e,blocklet:a})}catch(i){const n="Blocklet ".concat(e," failed: ").concat((0,O.Z)(i));throw c({action:e,blocklet:a,error:new Error(n)}),new Error(n)}finally{o||Q(!1)}},l=()=>{Q(!1),J(null)},i=(0,j.getDisplayName)(a,!0),s=a.mode===B.BLOCKLET_MODES.DEVELOPMENT?{description:()=>(0,A.jsx)(x.Z,{component:"div",children:(0,A.jsx)(x.Z,{gutterBottom:!0,children:$("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(e,n)=>(0,A.jsxs)(x.Z,{component:"div",children:[(0,A.jsx)(x.Z,{gutterBottom:!0,children:$("blocklet.action.removeApplicationDescription")}),(0,A.jsxs)(w.Z,{name:"removeType",value:e.removeType,onChange:t=>n({...e,removeType:t.target.value}),children:[(0,A.jsx)(C.Z,{value:"backup",control:(0,A.jsx)(Z.Z,{}),label:$("blocklet.action.removeApplicationAfterBackup")}),(0,A.jsx)(C.Z,{value:"complete",control:(0,A.jsx)(Z.Z,{}),label:$("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},d={stop:{title:"".concat($("common.stop")," ").concat(i),description:$("blocklet.action.stopDescription"),confirm:$("blocklet.action.confirmStop"),cancel:$("common.cancel"),onConfirm:o,onCancel:l},restart:{title:"".concat($("common.restart")," ").concat(i),description:$("blocklet.action.restartDescription"),confirm:$("blocklet.action.confirmRestart"),cancel:$("common.cancel"),onConfirm:o,onCancel:l},remove:{title:"".concat($("common.remove")," ").concat(i),confirm:$("blocklet.action.confirmRemove"),cancel:$("common.cancel"),onConfirm:o,onCancel:l,...s},cancelDownload:{title:"".concat($("common.cancel")),description:$("blocklet.action.cancelDownloadDescription",{name:i}),confirm:$("common.confirm"),cancel:$("common.cancel"),onConfirm:o,onCancel:l}};t?J(d[e]):await o()}},ce=Boolean(q),se=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}X(e.currentTarget)},de=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}X(null)},ue=async(e,n)=>{try{n.stopPropagation(),n.preventDefault()}catch{}if("function"===typeof e.handler)try{Q(!0),W(e.action),await e.handler()}catch(t){console.error("Blocklet ".concat(e.name," failed: "),t)}finally{Q(!1),X(null)}else X(null)},me=!ae&&(0,j.isDeletableBlocklet)(a)?{action:"remove",icon:_.Z.Remove,name:$("common.remove"),handler:re("remove",(async e=>{let{removeType:n}=e;"backup"===n&&await F.api.backupBlocklet({input:{appDid:a.appDid,to:"disk"}}),await F.api.deleteBlocklet({input:{did:a.meta.did,keepData:!1}})}),!0),disabled:le}:null,pe={action:"remove",icon:_.Z.Remove,name:$("common.cancel"),handler:re("cancelDownload",F.api.cancelDownloadBlocklet,!0)},ve=(0,j.getAppMissingConfigs)(a),ge=[{action:"start",icon:_.Z.Start,name:$("common.start"),handler:re("start",F.api.startBlocklet),disabled:ie||a.children.every((e=>"running"===e.status))||(0,O.XN)(a.status)||ne||le},{action:"stop",icon:_.Z.Stop,name:$("common.stop"),handler:re("stop",F.api.stopBlocklet,!0),disabled:!["running","starting"].includes(a.status)},{action:"restart",icon:_.Z.Restart,name:$("common.restart"),handler:re("restart",F.api.restartBlocklet,!0),disabled:ie||"running"!==a.status},{action:"reload",icon:_.Z.Reload,name:$("common.reload"),handler:re("reload",F.api.reloadBlocklet),disabled:ie||"running"!==a.status},(0,O.XN)(a.status)?pe:me,{separator:!0},{onlyInMenu:!0,action:"config",icon:_.Z.Config,name:$("common.config"),handler:()=>{G("/blocklets/".concat(a.meta.did,"/configuration"))},disabled:(0,O.XN)(a.status)},{onlyInMenu:!0,action:"team",icon:_.Z.Group,name:$("common.manageTeam"),handler:()=>{G("/blocklets/".concat(a.meta.did,"/members"))},disabled:(0,O.XN)(a.status)},{onlyInMenu:!0,action:"log",icon:_.Z.Log,name:$("common.log"),handler:()=>{G("/logs/blocklet-".concat(a.meta.did))},disabled:(0,O.XN)(a.status)}].filter(Boolean);return"menu"===N?(0,A.jsxs)(K,{"data-cy":"blocklet-actions",children:[(0,A.jsx)(m.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":a.meta.did,onClick:se,size:"small",disabled:!I||!(0,O.XN)(a.status)&&Y,children:(0,A.jsx)(h.Z,{})}),(0,A.jsxs)(p.Z,{id:"actions-menu",anchorEl:q,keepMounted:!0,open:ce,onClose:de,PaperProps:{},children:[ve.length>0&&(0,A.jsxs)(E.Z,{style:{maxWidth:"400px"},severity:"error",children:[$("blocklet.config.missingRequired"),(0,A.jsx)("br",{}),(0,A.jsx)(d.Link,{to:"/blocklets/".concat(a.meta.did,"/components"),children:$("blocklet.config.gotoFix")})]}),ge.map(((e,n)=>e.separator?(0,A.jsx)(v.Z,{},"separator-".concat(n)):(0,A.jsxs)(b.Z,{dense:!0,onClick:n=>ue(e,n),disabled:Y||e.disabled,"data-cy":"".concat(e.action,"-blocklet"),children:[(0,A.jsx)(k.Z,{style:{minWidth:24},children:V===e.action&&Y?(0,A.jsx)(f.Z,{size:16,sx:{marginRight:1}}):(0,A.jsx)(e.icon,{fontSize:"small"})}),(0,A.jsx)(y.Z,{primary:e.name})]},e.name)))]}),H&&(0,A.jsx)(U.Z,{title:H.title,description:H.description,confirm:H.confirm,cancel:H.cancel,params:H.params,onConfirm:H.onConfirm,onCancel:H.onCancel})]}):(0,A.jsxs)(K,{"data-cy":"blocklet-actions",...z,children:[(0,A.jsx)(g.Z,{children:ge.filter((e=>!e.separator&&!e.onlyInMenu)).map((e=>(0,A.jsxs)(L.Z,{title:e.name,"data-cy":"".concat(e.action,"-blocklet"),onClick:()=>ue(e),disabled:Boolean(e.disabled)||Y,children:[V===e.action&&Y?(0,A.jsx)(f.Z,{size:16,sx:{marginRight:1}}):(0,A.jsx)(e.icon,{}),(0,A.jsx)("span",{className:"blocklet-action-text",children:e.name})]},e.name)))}),H&&(0,A.jsx)(U.Z,{title:H.title,description:H.description,confirm:H.confirm,cancel:H.cancel,params:H.params,onConfirm:H.onConfirm,onCancel:H.onCancel})]})}N.propTypes={blocklet:r().object.isRequired,onStart:r().func.isRequired,onComplete:r().func.isRequired,variant:r().oneOf(["menu","group"]),hasPermission:r().bool,useBlockletUrlEvaluation:r().func},N.defaultProps={variant:"menu",hasPermission:!1,useBlockletUrlEvaluation:()=>{var e,n;return{loading:!1,recommendedUrl:null===(e=window)||void 0===e||null===(n=e.location)||void 0===n?void 0:n.href}}};const K=c.Z.div(o||(o=(0,l.Z)(["\n display: flex;\n align-items: center;\n\n @media (max-width: ","px) {\n .MuiButton-root {\n padding: 4px;\n font-size: 10px;\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm));var I=t(7199),M=t(24138);function z(e){let{...n}=e;const t=(0,I.V)(N,"mutate_blocklets");return(0,A.jsx)(t,{...n,useBlockletUrlEvaluation:M.BZ})}},7199:(e,n,t)=>{t.d(n,{V:()=>o.V,Z:()=>o.Z});var o=t(63406)},24138:(e,n,t)=>{t.d(n,{BZ:()=>b,ZN:()=>h});var o=t(5057),l=t(6352),i=t.n(l),a=t(35432),r=t(49714),c=t(41365),s=t.n(c),d=t(32243),u=t.n(d),m=t(68420),p=t(14491);const v=u()((e=>s()(i()(new URL(e).origin,a.WELLKNOWN_PING_PREFIX)))),g={};function f(e){let{urls:n,checkAccessible:t=s(),disableCache:l=!1}=e;const i=(0,o.useRef)(n.filter((e=>g[e])).map((e=>g[e]))),a=i.current.length===n.length,[c,d]=(0,o.useState)(a?i.current:[]),[u,m]=(0,o.useState)(!a),p=(0,o.useMemo)((()=>!u&&c.length?c[0]:null),[c,u]);return(0,o.useEffect)((()=>{if((null===n||void 0===n?void 0:n.length)>0&&!a){(async()=>{let e;if(m(!0),l)e=await(0,r.evaluateURLs)(n,{checkAccessible:t}),e.forEach((e=>{g[e.url]=e}));else{(await(0,r.evaluateURLs)(n.filter((e=>!g[e])),{checkAccessible:t})).forEach((e=>{g[e.url]=e})),e=n.map((e=>g[e])).sort(((e,n)=>n.score-e.score))}d(e),m(!1)})()}}),[n,l,a]),{urlsState:c,loading:u,recommendedUrlState:p,recommendedUrl:null===p||void 0===p?void 0:p.url}}function b(e){const{locale:n}=(0,o.useContext)(m.RD),t=(0,o.useMemo)((()=>e?(0,p.A6)({blocklet:e,params:(0,p.f0)(e,n)}):[]),[e,n]),{loading:l,recommendedUrlState:i,recommendedUrl:a}=f({urls:t,checkAccessible:v});return{urls:t,loading:l,recommendedUrlState:i,recommendedUrl:a}}function h(e){const n=(0,o.useMemo)((()=>e.map((e=>(0,p.Sk)(e)))),[e]),{urlsState:t,loading:l,recommendedUrl:i}=f({urls:n,checkAccessible:v});let a;if(l)a={domainsAccessibility:e.reduce(((e,n)=>({...e,[n]:{loading:!0}})),{}),recommendedDomain:null};else{var r;const e=t.reduce(((e,n)=>{const t=new URL(n.url).hostname;return e[t]={...n,domain:t},e}),{}),n=(null===(r=t.find((e=>e.accessible)))||void 0===r?void 0:r.url)||i;a={domainsAccessibility:e,recommendedDomain:n?new URL(n).hostname:null}}return a}},1722:(e,n,t)=>{t.d(n,{Z:()=>d});var o=t(55898),l=t.n(o),i=t(62681),a=t(72333),r=t(77277),c=t(49522),s=t(96266);function d(e){let{blocklet:n,style:t,size:o,...l}=e;const{logoUrl:d}=(0,c.Z)({blocklet:n}),{variant:u}=l;let m=(0,s.jsx)("img",{src:d,alt:"",style:{width:o}});if(!n.meta.logo){var p;(null===(p=(n.configs||[]).find((e=>e.key===r.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===p?void 0:p.value)||(m=(0,s.jsx)(a.Z,{did:n.meta.did||"",responsive:!0}))}return(0,s.jsx)(i.Z,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:o,height:o,borderRadius:10},t),...l,children:m})}d.propTypes={blocklet:l().object.isRequired,style:l().object,size:l().oneOfType([l().number,l().string])},d.defaultProps={style:{},size:40}},55419:(e,n,t)=>{t.d(n,{Z:()=>u});var o=t(27773),l=t(22754),i=t(98451),a=t(32207),r=t(35258),c=t(17545),s=t(49647),d=t(70648);const u={Start:l.Z,Stop:i.Z,Restart:a.default,Reload:r.Z,Remove:o.default,Config:c.Z,Log:s.Z,Group:d.Z}},81010:(e,n,t)=>{t.d(n,{Z:()=>v});var o=t(5057),l=t(55898),i=t.n(l),a=t(44846),r=t(75239),c=t(68420),s=t(38242),d=t(69569),u=t(22228),m=t(96266);const p={yellow:"#FFCF71",grey:"#888888"};function v(e){let{status:n,variant:t,source:l,progress:i,...v}=e;const{t:g}=(0,o.useContext)(c.RD),f={added:p.grey,waiting:p.yellow,downloading:p.yellow,extracting:p.yellow,downloaded:p.grey,installing:p.yellow,installed:p.grey,starting:p.yellow,running:"success",stopping:p.yellow,stopped:p.grey,error:"error",upgrading:p.yellow,restarting:p.yellow,corrupted:"error",deleting:p.yellow},b=(0,s.isInProgress)(n),h=g("blocklet.status.".concat(n));return"dot"===t?(0,m.jsx)(r.Z,{title:g("blocklet.statusTip",{status:h}),children:(0,m.jsx)(d.Z,{color:f[n],...v})}):(0,m.jsxs)(u.Z,{type:{added:"primary",waiting:"warning",downloading:"warning",extracting:"warning",downloaded:"primary",installing:"warning",installed:"primary",starting:"warning",running:"success",stopping:"warning",stopped:"reverse",error:"error",upgrading:"warning",restarting:"warning",corrupted:"error",deleting:"warning"}[n],...v,children:[b&&(0,m.jsx)(a.Z,{size:12,color:"inherit",style:{marginRight:5}}),h,"downloading"===n&&i?(0,m.jsx)("div",{style:{marginLeft:5},children:"".concat(i," %")}):null]})}v.propTypes={status:i().string.isRequired,variant:i().oneOf(["dot","tag"]),source:i().string,progress:i().number},v.defaultProps={variant:"tag",source:"",progress:0}},29054:(e,n,t)=>{t.d(n,{BlockletContext:()=>l,y0:()=>r});var o=t(5057);const l=(0,o.createContext)({}),{Provider:i,Consumer:a}=l;function r(){return(0,o.useContext)(l)}},87363:(e,n,t)=>{t.d(n,{K:()=>u,g:()=>d});var o=t(5057),l=t(55898),i=t.n(l),a=t(69163),r=t.n(a),c=t(96266);const s=(0,o.createContext)({});function d(e){let{children:n,type:t}=e;const[l,i]=(0,o.useState)([]),a=(0,o.useRef)([]),d=e=>{if(a.current.includes(e)){const n=a.current.filter((n=>n!==e));i(n),a.current=n}};return(0,c.jsx)(s.Provider,{value:{type:t,deletingBlocklets:l,addDeletingDid:e=>{if(!a.current.includes(e)){const n=[...a.current,e];i(n),a.current=n}},removeDeletingDid:d,matchDeletingDid:e=>{const n=l.filter((n=>e.find((e=>e===n))));r()(n,l).forEach((e=>d(e)))}},children:n})}function u(){return(0,o.useContext)(s)}d.propTypes={type:i().string,children:i().node.isRequired},d.defaultProps={type:"blocklets"}},69569:(e,n,t)=>{t.d(n,{Z:()=>c});var o,l=t(71171),i=t(33518);const a={success:"#3ab39d",error:"#D0021B"},r="10px",c=i.Z.div(o||(o=(0,l.Z)(["\n display: inline-block;\n min-width: ",";\n min-height: ",";\n background: ",";\n border-radius: 100%;\n"])),(e=>e.size||r),(e=>e.size||r),(e=>a[e.color]||e.color||a.success))},49522:(e,n,t)=>{t.d(n,{Z:()=>s});var o=t(6352),l=t.n(o),i=t(77277),a=t(58238),r=t(14491);const c=(e,n)=>{let t="?v=";var o;n?t+=(0,r.Qi)(n):t+="".concat(null===e||void 0===e||null===(o=e.meta)||void 0===o?void 0:o.version).concat((0,r.wS)(null===e||void 0===e?void 0:e.status)?"~":"");return t};function s(e){var n,t,o,r;let{blocklet:s}=e;const{inService:d}=(0,a.h6)(),u=null===(n=((null===s||void 0===s?void 0:s.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===n?void 0:n.value,m=null===(t=((null===s||void 0===s?void 0:s.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)))||void 0===t?void 0:t.value,p=null===(o=((null===s||void 0===s?void 0:s.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)))||void 0===o?void 0:o.value,v=(null===(r=window.env)||void 0===r?void 0:r.apiPrefix)||"/";return{logoUrl:l()(v,"/blocklet/logo/".concat(d?"":s.meta.did),c(s,u)),rectLogoUrl:l()(v,"/blocklet/logo-rect/".concat(d?"":s.meta.did),c(s,m)),faviconUrl:l()(v,"/blocklet/logo-favicon/".concat(d?"":s.meta.did),c(s,p))}}},22228:(e,n,t)=>{t.d(n,{Z:()=>r});var o=t(55898),l=t.n(o),i=t(19778),a=t(96266);function r(e){let{children:n,style:t,...o}=e;return(0,a.jsx)(i.Z,{style:t,...o,children:n})}r.propTypes={children:l().any.isRequired,style:l().object},r.defaultProps={style:{}}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6931],{78123:(e,n,t)=>{t.d(n,{Z:()=>z});var o,l=t(71171),i=t(5057),a=t(55898),r=t.n(a),c=t(33518),s=t(85493),d=t(15849),u=t(67654),m=t(67680),p=t(61533),v=t(29034),g=t(80633),f=t(44846),b=t(74490),h=t(83294),k=t(46954),y=t(44067),x=t(11750),Z=t(65140),w=t(87916),C=t(26174),E=t(93938),L=t(28726),j=t(38242),R=t(68420),B=t(77277),D=t(86229),O=t(14491),S=t(4651),P=t(58238),U=t(70461),_=t(55419),T=t(29054),A=t(96266);function N(e){var n,t,o,l;let{blocklet:a,onStart:r,onComplete:c,variant:N,hasPermission:I,useBlockletUrlEvaluation:M,...z}=e;const G=(0,s.useNavigate)(),F=(0,P.h6)(),[q,X]=(0,i.useState)(null),[V,W]=(0,i.useState)(null),[Y,Q]=(0,i.useState)(!1),[H,J]=(0,i.useState)(null),{t:$}=(0,i.useContext)(R.RD),[ee]=(0,u.Z)("skip-blocklet-setup",!1),{loading:ne,recommendedUrl:te}=M(a),{nftState:oe}=(0,T.y0)(),le=(0,j.isInProgress)(a.status);let ie=(null===a||void 0===a||null===(n=a.controller)||void 0===n||null===(t=n.status)||void 0===t?void 0:t.value)===B.BLOCKLET_CONTROLLER_STATUS.suspended;null!==oe&&void 0!==oe&&oe.expired||(null===a||void 0===a||null===(o=a.controller)||void 0===o||null===(l=o.status)||void 0===l?void 0:l.reason)!==B.SUSPENDED_REASON.expired||(ie=!1);const{inService:ae}=F,re=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return async()=>{const o=async t=>{r({action:e,blocklet:a}),Q(!0),W(e);let o=!1;try{if("remove"===e)await n(t);else if("start"===e){var l;if(!(0,j.hasRunnableComponent)(a))return void D.Z.error($("blocklet.noComponent"));if(!ae&&!ee&&(null===(l=a.settings)||void 0===l||!l.initialized)&&a.mode!==B.BLOCKLET_MODES.DEVELOPMENT){const n=(0,S.RU)(F.info),t=new URL(te);return t.searchParams.set("serverUrl",n),window.open(t.href),void c({action:e,blocklet:a})}const t=a.children.filter((e=>!(0,j.isInProgress)(e.status)&&"running"!==e.status)).map((e=>e.meta.did)),o={did:a.meta.did,componentDids:t};await n({input:o})}else if(["stop","restart","reload"].includes(e)){const e=a.children.filter((e=>"running"===e.status)).map((e=>e.meta.did)),t={did:a.meta.did,componentDids:e};await n({input:t})}else{const e={did:a.meta.did};await n({input:e})}"remove"===e?o=!0:await(0,O._v)(1e3),"reload"===e&&D.Z.success($("blocklet.reloadSuccess")),J(null),c({action:e,blocklet:a})}catch(i){const n="Blocklet ".concat(e," failed: ").concat((0,O.Z)(i));throw c({action:e,blocklet:a,error:new Error(n)}),new Error(n)}finally{o||Q(!1)}},l=()=>{Q(!1),J(null)},i=(0,j.getDisplayName)(a,!0),s=a.mode===B.BLOCKLET_MODES.DEVELOPMENT?{description:()=>(0,A.jsx)(x.Z,{component:"div",children:(0,A.jsx)(x.Z,{gutterBottom:!0,children:$("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(e,n)=>(0,A.jsxs)(x.Z,{component:"div",children:[(0,A.jsx)(x.Z,{gutterBottom:!0,children:$("blocklet.action.removeApplicationDescription")}),(0,A.jsxs)(w.Z,{name:"removeType",value:e.removeType,onChange:t=>n({...e,removeType:t.target.value}),children:[(0,A.jsx)(C.Z,{value:"backup",control:(0,A.jsx)(Z.Z,{}),label:$("blocklet.action.removeApplicationAfterBackup")}),(0,A.jsx)(C.Z,{value:"complete",control:(0,A.jsx)(Z.Z,{}),label:$("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},d={stop:{title:"".concat($("common.stop")," ").concat(i),description:$("blocklet.action.stopDescription"),confirm:$("blocklet.action.confirmStop"),cancel:$("common.cancel"),onConfirm:o,onCancel:l},restart:{title:"".concat($("common.restart")," ").concat(i),description:$("blocklet.action.restartDescription"),confirm:$("blocklet.action.confirmRestart"),cancel:$("common.cancel"),onConfirm:o,onCancel:l},remove:{title:"".concat($("common.remove")," ").concat(i),confirm:$("blocklet.action.confirmRemove"),cancel:$("common.cancel"),onConfirm:o,onCancel:l,...s},cancelDownload:{title:"".concat($("common.cancel")),description:$("blocklet.action.cancelDownloadDescription",{name:i}),confirm:$("common.confirm"),cancel:$("common.cancel"),onConfirm:o,onCancel:l}};t?J(d[e]):await o()}},ce=Boolean(q),se=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}X(e.currentTarget)},de=e=>{try{e.stopPropagation(),e.preventDefault()}catch{}X(null)},ue=async(e,n)=>{try{n.stopPropagation(),n.preventDefault()}catch{}if("function"===typeof e.handler)try{Q(!0),W(e.action),await e.handler()}catch(t){console.error("Blocklet ".concat(e.name," failed: "),t)}finally{Q(!1),X(null)}else X(null)},me=!ae&&(0,j.isDeletableBlocklet)(a)?{action:"remove",icon:_.Z.Remove,name:$("common.remove"),handler:re("remove",(async e=>{let{removeType:n}=e;"backup"===n&&await F.api.backupBlocklet({input:{appDid:a.appDid,to:"disk"}}),await F.api.deleteBlocklet({input:{did:a.meta.did,keepData:!1}})}),!0),disabled:le}:null,pe={action:"remove",icon:_.Z.Remove,name:$("common.cancel"),handler:re("cancelDownload",F.api.cancelDownloadBlocklet,!0)},ve=(0,j.getAppMissingConfigs)(a),ge=[{action:"start",icon:_.Z.Start,name:$("common.start"),handler:re("start",F.api.startBlocklet),disabled:ie||a.children.every((e=>"running"===e.status))||(0,O.XN)(a.status)||ne||le},{action:"stop",icon:_.Z.Stop,name:$("common.stop"),handler:re("stop",F.api.stopBlocklet,!0),disabled:!["running","starting"].includes(a.status)},{action:"restart",icon:_.Z.Restart,name:$("common.restart"),handler:re("restart",F.api.restartBlocklet,!0),disabled:ie||"running"!==a.status},{action:"reload",icon:_.Z.Reload,name:$("common.reload"),handler:re("reload",F.api.reloadBlocklet),disabled:ie||"running"!==a.status},(0,O.XN)(a.status)?pe:me,{separator:!0},{onlyInMenu:!0,action:"config",icon:_.Z.Config,name:$("common.config"),handler:()=>{G("/blocklets/".concat(a.meta.did,"/configuration"))},disabled:(0,O.XN)(a.status)},{onlyInMenu:!0,action:"team",icon:_.Z.Group,name:$("common.manageTeam"),handler:()=>{G("/blocklets/".concat(a.meta.did,"/members"))},disabled:(0,O.XN)(a.status)},{onlyInMenu:!0,action:"log",icon:_.Z.Log,name:$("common.log"),handler:()=>{G("/logs/blocklet-".concat(a.meta.did))},disabled:(0,O.XN)(a.status)}].filter(Boolean);return"menu"===N?(0,A.jsxs)(K,{"data-cy":"blocklet-actions",children:[(0,A.jsx)(m.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":a.meta.did,onClick:se,size:"small",disabled:!I||!(0,O.XN)(a.status)&&Y,children:(0,A.jsx)(h.Z,{})}),(0,A.jsxs)(p.Z,{id:"actions-menu",anchorEl:q,keepMounted:!0,open:ce,onClose:de,PaperProps:{},children:[ve.length>0&&(0,A.jsxs)(E.Z,{style:{maxWidth:"400px"},severity:"error",children:[$("blocklet.config.missingRequired"),(0,A.jsx)("br",{}),(0,A.jsx)(d.Link,{to:"/blocklets/".concat(a.meta.did,"/components"),children:$("blocklet.config.gotoFix")})]}),ge.map(((e,n)=>e.separator?(0,A.jsx)(v.Z,{},"separator-".concat(n)):(0,A.jsxs)(b.Z,{dense:!0,onClick:n=>ue(e,n),disabled:Y||e.disabled,"data-cy":"".concat(e.action,"-blocklet"),children:[(0,A.jsx)(k.Z,{style:{minWidth:24},children:V===e.action&&Y?(0,A.jsx)(f.Z,{size:16,sx:{marginRight:1}}):(0,A.jsx)(e.icon,{fontSize:"small"})}),(0,A.jsx)(y.Z,{primary:e.name})]},e.name)))]}),H&&(0,A.jsx)(U.Z,{title:H.title,description:H.description,confirm:H.confirm,cancel:H.cancel,params:H.params,onConfirm:H.onConfirm,onCancel:H.onCancel})]}):(0,A.jsxs)(K,{"data-cy":"blocklet-actions",...z,children:[(0,A.jsx)(g.Z,{children:ge.filter((e=>!e.separator&&!e.onlyInMenu)).map((e=>(0,A.jsxs)(L.Z,{title:e.name,"data-cy":"".concat(e.action,"-blocklet"),onClick:()=>ue(e),disabled:Boolean(e.disabled)||Y,children:[V===e.action&&Y?(0,A.jsx)(f.Z,{size:16,sx:{marginRight:1}}):(0,A.jsx)(e.icon,{}),(0,A.jsx)("span",{className:"blocklet-action-text",children:e.name})]},e.name)))}),H&&(0,A.jsx)(U.Z,{title:H.title,description:H.description,confirm:H.confirm,cancel:H.cancel,params:H.params,onConfirm:H.onConfirm,onCancel:H.onCancel})]})}N.propTypes={blocklet:r().object.isRequired,onStart:r().func.isRequired,onComplete:r().func.isRequired,variant:r().oneOf(["menu","group"]),hasPermission:r().bool,useBlockletUrlEvaluation:r().func},N.defaultProps={variant:"menu",hasPermission:!1,useBlockletUrlEvaluation:()=>{var e,n;return{loading:!1,recommendedUrl:null===(e=window)||void 0===e||null===(n=e.location)||void 0===n?void 0:n.href}}};const K=c.Z.div(o||(o=(0,l.Z)(["\n display: flex;\n align-items: center;\n\n @media (max-width: ","px) {\n .MuiButton-root {\n padding: 4px;\n font-size: 10px;\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm));var I=t(7199),M=t(24138);function z(e){let{...n}=e;const t=(0,I.V)(N,"mutate_blocklets");return(0,A.jsx)(t,{...n,useBlockletUrlEvaluation:M.BZ})}},7199:(e,n,t)=>{t.d(n,{V:()=>o.V,Z:()=>o.Z});var o=t(63406)},24138:(e,n,t)=>{t.d(n,{BZ:()=>b,ZN:()=>h});var o=t(5057),l=t(6352),i=t.n(l),a=t(35432),r=t(49714),c=t(41365),s=t.n(c),d=t(32243),u=t.n(d),m=t(68420),p=t(14491);const v=u()((e=>s()(i()(new URL(e).origin,a.WELLKNOWN_PING_PREFIX)))),g={};function f(e){let{urls:n,checkAccessible:t=s(),disableCache:l=!1}=e;const i=(0,o.useRef)(n.filter((e=>g[e])).map((e=>g[e]))),a=i.current.length===n.length,[c,d]=(0,o.useState)(a?i.current:[]),[u,m]=(0,o.useState)(!a),p=(0,o.useMemo)((()=>!u&&c.length?c[0]:null),[c,u]);return(0,o.useEffect)((()=>{if((null===n||void 0===n?void 0:n.length)>0&&!a){(async()=>{let e;if(m(!0),l)e=await(0,r.evaluateURLs)(n,{checkAccessible:t}),e.forEach((e=>{g[e.url]=e}));else{(await(0,r.evaluateURLs)(n.filter((e=>!g[e])),{checkAccessible:t})).forEach((e=>{g[e.url]=e})),e=n.map((e=>g[e])).sort(((e,n)=>n.score-e.score))}d(e),m(!1)})()}}),[n,l,a]),{urlsState:c,loading:u,recommendedUrlState:p,recommendedUrl:null===p||void 0===p?void 0:p.url}}function b(e){const{locale:n}=(0,o.useContext)(m.RD),t=(0,o.useMemo)((()=>e?(0,p.A6)({blocklet:e,params:(0,p.f0)(e,n)}):[]),[e,n]),{loading:l,recommendedUrlState:i,recommendedUrl:a}=f({urls:t,checkAccessible:v});return{urls:t,loading:l,recommendedUrlState:i,recommendedUrl:a}}function h(e){const n=(0,o.useMemo)((()=>e.map((e=>(0,p.Sk)(e)))),[e]),{urlsState:t,loading:l,recommendedUrl:i}=f({urls:n,checkAccessible:v});let a;if(l)a={domainsAccessibility:e.reduce(((e,n)=>({...e,[n]:{loading:!0}})),{}),recommendedDomain:null};else{var r;const e=t.reduce(((e,n)=>{const t=new URL(n.url).hostname;return e[t]={...n,domain:t},e}),{}),n=(null===(r=t.find((e=>e.accessible)))||void 0===r?void 0:r.url)||i;a={domainsAccessibility:e,recommendedDomain:n?new URL(n).hostname:null}}return a}},1722:(e,n,t)=>{t.d(n,{Z:()=>d});var o=t(55898),l=t.n(o),i=t(62681),a=t(72333),r=t(77277),c=t(49522),s=t(96266);function d(e){let{blocklet:n,style:t,size:o,...l}=e;const{logoUrl:d}=(0,c.Z)({blocklet:n}),{variant:u}=l;let m=(0,s.jsx)("img",{src:d,alt:"",style:{width:o}});if(!n.meta.logo){var p;(null===(p=(n.configs||[]).find((e=>e.key===r.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===p?void 0:p.value)||(m=(0,s.jsx)(a.Z,{did:n.meta.did||"",responsive:!0}))}return(0,s.jsx)(i.Z,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:o,height:o,borderRadius:10},t),...l,children:m})}d.propTypes={blocklet:l().object.isRequired,style:l().object,size:l().oneOfType([l().number,l().string])},d.defaultProps={style:{},size:40}},55419:(e,n,t)=>{t.d(n,{Z:()=>u});var o=t(27773),l=t(22754),i=t(98451),a=t(32207),r=t(35258),c=t(17545),s=t(49647),d=t(70648);const u={Start:l.Z,Stop:i.Z,Restart:a.default,Reload:r.Z,Remove:o.default,Config:c.Z,Log:s.Z,Group:d.Z}},81010:(e,n,t)=>{t.d(n,{Z:()=>v});var o=t(5057),l=t(55898),i=t.n(l),a=t(44846),r=t(75239),c=t(68420),s=t(38242),d=t(69569),u=t(22228),m=t(96266);const p={yellow:"#FFCF71",grey:"#888888"};function v(e){let{status:n,variant:t,source:l,progress:i,...v}=e;const{t:g}=(0,o.useContext)(c.RD),f={added:p.grey,waiting:p.yellow,downloading:p.yellow,extracting:p.yellow,downloaded:p.grey,installing:p.yellow,installed:p.grey,starting:p.yellow,running:"success",stopping:p.yellow,stopped:p.grey,error:"error",upgrading:p.yellow,restarting:p.yellow,corrupted:"error",deleting:p.yellow},b=(0,s.isInProgress)(n),h=g("blocklet.status.".concat(n));return"dot"===t?(0,m.jsx)(r.Z,{title:g("blocklet.statusTip",{status:h}),children:(0,m.jsx)(d.Z,{color:f[n],...v})}):(0,m.jsxs)(u.Z,{type:{added:"primary",waiting:"warning",downloading:"warning",extracting:"warning",downloaded:"primary",installing:"warning",installed:"primary",starting:"warning",running:"success",stopping:"warning",stopped:"reverse",error:"error",upgrading:"warning",restarting:"warning",corrupted:"error",deleting:"warning"}[n],...v,children:[b&&(0,m.jsx)(a.Z,{size:12,color:"inherit",style:{marginRight:5}}),h,"downloading"===n&&i?(0,m.jsx)("div",{style:{marginLeft:5},children:"".concat(i," %")}):null]})}v.propTypes={status:i().string.isRequired,variant:i().oneOf(["dot","tag"]),source:i().string,progress:i().number},v.defaultProps={variant:"tag",source:"",progress:0}},29054:(e,n,t)=>{t.d(n,{BlockletContext:()=>l,y0:()=>r});var o=t(5057);const l=(0,o.createContext)({}),{Provider:i,Consumer:a}=l;function r(){return(0,o.useContext)(l)}},87363:(e,n,t)=>{t.d(n,{K:()=>u,g:()=>d});var o=t(5057),l=t(55898),i=t.n(l),a=t(69163),r=t.n(a),c=t(96266);const s=(0,o.createContext)({});function d(e){let{children:n,type:t}=e;const[l,i]=(0,o.useState)([]),a=(0,o.useRef)([]),d=e=>{if(a.current.includes(e)){const n=a.current.filter((n=>n!==e));i(n),a.current=n}};return(0,c.jsx)(s.Provider,{value:{type:t,deletingBlocklets:l,addDeletingDid:e=>{if(!a.current.includes(e)){const n=[...a.current,e];i(n),a.current=n}},removeDeletingDid:d,matchDeletingDid:e=>{const n=l.filter((n=>e.find((e=>e===n))));r()(n,l).forEach((e=>d(e)))}},children:n})}function u(){return(0,o.useContext)(s)}d.propTypes={type:i().string,children:i().node.isRequired},d.defaultProps={type:"blocklets"}},69569:(e,n,t)=>{t.d(n,{Z:()=>c});var o,l=t(71171),i=t(33518);const a={success:"#3ab39d",error:"#D0021B"},r="10px",c=i.Z.div(o||(o=(0,l.Z)(["\n display: inline-block;\n min-width: ",";\n min-height: ",";\n background: ",";\n border-radius: 100%;\n"])),(e=>e.size||r),(e=>e.size||r),(e=>a[e.color]||e.color||a.success))},49522:(e,n,t)=>{t.d(n,{Z:()=>s});var o=t(6352),l=t.n(o),i=t(77277),a=t(58238),r=t(14491);const c=(e,n)=>{let t="?v=";var o;n?t+=(0,r.Qi)(n):t+="".concat(null===e||void 0===e||null===(o=e.meta)||void 0===o?void 0:o.version).concat((0,r.wS)(null===e||void 0===e?void 0:e.status)?"~":"");return t};function s(e){var n,t,o,r;let{blocklet:s}=e;const{inService:d}=(0,a.h6)(),u=null===(n=((null===s||void 0===s?void 0:s.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)))||void 0===n?void 0:n.value,m=null===(t=((null===s||void 0===s?void 0:s.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT)))||void 0===t?void 0:t.value,p=null===(o=((null===s||void 0===s?void 0:s.environments)||[]).find((e=>e.key===i.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON)))||void 0===o?void 0:o.value,v=(null===(r=window.env)||void 0===r?void 0:r.apiPrefix)||"/";return{logoUrl:l()(v,"/blocklet/logo/".concat(d?"":s.meta.did),c(s,u)),rectLogoUrl:l()(v,"/blocklet/logo-rect/".concat(d?"":s.meta.did),c(s,m)),faviconUrl:l()(v,"/blocklet/logo-favicon/".concat(d?"":s.meta.did),c(s,p))}}},22228:(e,n,t)=>{t.d(n,{Z:()=>r});var o=t(55898),l=t.n(o),i=t(19778),a=t(96266);function r(e){let{children:n,style:t,...o}=e;return(0,a.jsx)(i.Z,{style:t,...o,children:n})}r.propTypes={children:l().any.isRequired,style:l().object},r.defaultProps={style:{}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[6950],{16950:(e,n,i)=>{i.r(n),i.d(n,{default:()=>fe});var t=i(71171),r=i(5057),o=i(33518),s=i(85493),a=i(10458),c=i.n(a),l=i(6352),d=i.n(l),p=i(43681),u=i.n(p),v=i(26796),f=i(55898),h=i.n(f),m=i(79366),x=i(44846),g=i(35474),_=i(68420),w=i(13128),j=i(57471),y=i(96266);const b=(0,j.Z)((0,y.jsx)("path",{d:"M19 3H4.99c-1.11 0-1.98.89-1.98 2L3 19c0 1.1.88 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.11-.9-2-2-2m0 12h-4c0 1.66-1.35 3-3 3s-3-1.34-3-3H4.99V5H19z"}),"Inbox");var k;function Z(e){let{invitation:n,createPassportSvg:i,passportColor:t}=e;const[o,s]=(0,r.useState)(!1),{t:a}=(0,r.useContext)(_.RD),c=(0,r.useMemo)((()=>(n.role.title||n.role.name).toUpperCase()),[n.role.title,n.role.name]),l=(0,r.useMemo)((()=>i({title:c,issuer:n.info.name,issuerDid:n.info.appDid,ownerName:"Your Name",ownerDid:n.info.appDid,preferredColor:n.info.passportColor||t})),[n,c]),d=(0,r.useCallback)((()=>{s(!0)}),[]),p=(0,r.useCallback)((()=>{s(!1)}),[]);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(S,{children:(0,y.jsx)("div",{className:"invite-passport__card",onClick:d,children:(0,y.jsx)("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:l}})})}),(0,y.jsx)(w.ZP,{open:o,title:a("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:p,children:n.role.permissions&&n.role.permissions.length>0?(0,y.jsx)("ul",{style:{listStyle:"circle",padding:"0 20px"},children:n.role.permissions.map((e=>(0,y.jsx)("li",{style:{listStyle:"circle"},children:e.description},e.name)))}):(0,y.jsxs)("div",{style:{color:"#999",textAlign:"center"},children:[(0,y.jsx)(b,{style:{width:"30px",height:"30px"}}),(0,y.jsx)("div",{children:a("invite.emptyPermission")})]})})]})}Z.propTypes={invitation:h().object.isRequired,createPassportSvg:h().func.isRequired,passportColor:h().string},Z.defaultProps={passportColor:"auto"};const S=o.Z.div(k||(k=(0,t.Z)(["\n display: flex;\n max-width: 350px;\n margin: 30px auto;\n .invite-passport__card {\n margin: 0 auto;\n width: 228px;\n height: 258px;\n flex-shrink: 0;\n .invite-passport__cover {\n cursor: pointer;\n width: 100%;\n height: 100%;\n }\n }\n .invite-passport__content {\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n .invite-passport__title {\n font-weight: 700;\n font-size: 16px;\n }\n .invite-passport__description {\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n height: 3em;\n color: #999;\n font-size: 14px;\n }\n .invite-passport__view-permission {\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n line-height: 18px;\n color: ",";\n }\n"])),(e=>{let{theme:n}=e;return n.palette.primary.main})),C=Z;var P,N=i(92459),z=i(74958),R=i(14491),T=i(70284),L=i(73545);function F(e){let{invitation:n,onLogin:i,onReceive:t,inService:o}=e;const{t:s,locale:a}=(0,_.PE)(),{connectApi:c}=(0,L.T)(),{getPassportId:l}=(0,T.Z)();let p;var u,v;"undefined"!==typeof window&&(p=null===(u=window)||void 0===u||null===(v=u.blocklet)||void 0===v?void 0:v.componentId);const f={passportId:l(),inviteId:n.inviteId,baseUrl:window.location.origin,componentId:p},h=(0,r.useCallback)((()=>{c.close()}),[c]),m=(0,r.useCallback)((function(){c.close(),i(...arguments)}),[i,c]),x=(0,r.useCallback)((()=>{"function"!==typeof t?o?c.openPopup({action:"invite",className:"connect",forceConnected:!1,autoConnect:!1,locale:a,extraParams:{provider:"wallet",...f},baseUrl:window.location.origin,prefix:d()(window.location.origin,z.Bu,z.nC),messages:{title:s("receive.dialog.title"),scan:s("receive.dialog.scan"),confirm:s("receive.dialog.confirm"),success:s("receive.dialog.success")},onSuccess:m,onClose:h},{locale:a}):c.open({action:"invite",className:"connect",forceConnected:!1,autoConnect:!1,locale:a,extraParams:f,messages:{title:s("receive.dialog.title"),scan:s("receive.dialog.scan"),confirm:s("receive.dialog.confirm"),success:s("receive.dialog.success")},onSuccess:m,onClose:h}):t()}),[c.openPopup]);return(0,y.jsxs)(I,{children:[(0,y.jsx)(N.Z,{size:"large",variant:"contained",className:"invite-receive__button","data-cy":"invite-receive-passport",color:"primary",onClick:x,children:s("invite.receive")}),(0,y.jsxs)("div",{className:"invite-receive__until",children:[s("invite.validUntil"),(0,R.o0)(n.expireDate,a)]})]})}F.propTypes={invitation:h().object.isRequired,onLogin:h().func,onReceive:h().func,inService:h().bool},F.defaultProps={onLogin:()=>{},onReceive:null,inService:!1};const I=o.Z.div(P||(P=(0,t.Z)(["\n text-align: center;\n .invite-receive__logo-wrapper {\n display: inline-flex;\n align-items: center;\n color: #9397a1;\n font-size: 14px;\n }\n .invite-receive__logo {\n height: 16px;\n margin-left: 8px;\n }\n .invite-receive__button {\n width: 100%;\n margin: 16px 0;\n white-space: nowrap;\n }\n .invite-receive__until {\n text-align: center;\n font-size: 14px;\n }\n .invite-receive__description {\n color: #999;\n text-align: left;\n list-style: decimal;\n padding: 0;\n padding-left: 1.2em;\n margin: 40px 0;\n }\n .invite-receive__description-item {\n list-style: decimal;\n }\n .invite-receive__link {\n color: ",";\n }\n"])),(e=>{let{theme:n}=e;return n.palette.primary.main})),E=F;var D;function U(e){let{onLogin:n}=e;const{t:i}=(0,_.PE)();return(0,y.jsx)(M,{children:(0,y.jsx)(N.Z,{size:"large",variant:"contained",className:"invite-receive__button","data-cy":"invite-receive-passport",color:"primary",onClick:()=>n(),children:i("common.connect")})})}U.propTypes={onLogin:h().func},U.defaultProps={onLogin:()=>{}};const M=o.Z.div(D||(D=(0,t.Z)(["\n text-align: center;\n .invite-receive__logo-wrapper {\n display: inline-flex;\n align-items: center;\n color: #9397a1;\n font-size: 14px;\n }\n .invite-receive__logo {\n height: 16px;\n margin-left: 8px;\n }\n .invite-receive__button {\n width: 100%;\n margin: 16px 0;\n white-space: nowrap;\n }\n .invite-receive__until {\n text-align: center;\n font-size: 14px;\n }\n .invite-receive__description {\n color: #999;\n text-align: left;\n list-style: decimal;\n padding: 0;\n padding-left: 1.2em;\n margin: 40px 0;\n }\n .invite-receive__description-item {\n list-style: decimal;\n }\n .invite-receive__link {\n color: ",";\n }\n"])),(e=>{let{theme:n}=e;return n.palette.primary.main})),q=U;var W,H=i(72333);function O(e){let{invitation:n}=e;const{t:i}=(0,_.PE)(),t=(0,r.useMemo)((()=>(n.role.title||n.role.name).toUpperCase()),[n.role.title,n.role.name]),o=(0,r.useMemo)((()=>i("invite.message",{name:"{{name}}",role:t,dapp:"{{dapp}}"})),[i,t]),s=(0,R.E8)(n.info.chainHost,n.inviter.did,"account"),a=(0,R.Zp)(o,{name:()=>s?(0,y.jsx)("a",{target:"_blank",href:s,className:"invite-user__link",rel:"noreferrer",children:n.inviter.fullName},"name"):n.inviter.fullName,dapp:()=>(0,y.jsx)("a",{target:"_blank",href:n.info.url,className:"invite-user__link",rel:"noreferrer",children:n.info.name},"dapp")});return(0,y.jsxs)(A,{children:[(0,y.jsx)(H.Z,{did:n.inviter.did,src:encodeURI(n.inviter.avatar),size:80,shape:"circle",variant:"circle"}),(0,y.jsx)("div",{className:"invite-user__message",children:a})]})}O.propTypes={invitation:h().object.isRequired};const A=o.Z.div(W||(W=(0,t.Z)(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n .invite-user__name {\n font-weight: 700;\n font-size: 16px;\n margin: 8px 0 2px 0;\n }\n .invite-user__address {\n font-size: 12px;\n }\n .invite-user__message {\n margin-top: 20px;\n font-weight: 700;\n /* width: 90%; */\n text-align: center;\n font-size: 18px;\n }\n .invite-user__link {\n color: ",";\n }\n"])),(e=>{let{theme:n}=e;return n.palette.primary.main})),B=O;var V,Y=i(39948),J=i(76005);function K(e){let{invitation:n,type:i}=e;const{t:t}=(0,_.PE)(),o=(0,r.useMemo)((()=>t("invite.success",{dapp:"{{dapp}}"})),[t]),s=(0,R.E8)(n.info.chainHost,n.inviter.did,"account"),a="receiver"===i?n.receiver:n.inviter,c=(0,R.Zp)(o,{name:()=>s?(0,y.jsx)("a",{target:"_blank",href:s,className:"invite-user__link",rel:"noreferrer",children:a.fullName},"name"):a.fullName,dapp:()=>(0,y.jsx)("a",{target:"_blank",href:n.info.url,className:"invite-user__link",rel:"noreferrer",children:n.info.name},"dapp")});return(0,y.jsxs)(G,{children:[(0,y.jsx)(Y.Z,{pt:1,color:"success.main",children:(0,y.jsx)(J.Z,{style:{fontSize:80}})}),(0,y.jsx)("div",{className:"invite-user__message",children:c})]})}K.propTypes={invitation:h().object.isRequired,type:h().oneOf("inviter","receiver")},K.defaultProps={type:"inviter"};const G=o.Z.div(V||(V=(0,t.Z)(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n .invite-user__name {\n font-weight: 700;\n font-size: 16px;\n margin: 8px 0 2px 0;\n }\n .invite-user__address {\n font-size: 12px;\n }\n .invite-user__message {\n margin-top: 20px;\n font-weight: 700;\n /* width: 90%; */\n text-align: center;\n font-size: 18px;\n }\n .invite-user__link {\n color: ",";\n }\n"])),(e=>{let{theme:n}=e;return n.palette.primary.main})),Q=K;var X;function $(e){let{invitation:n,...i}=e;return(0,y.jsxs)(ee,{...i,children:[(0,y.jsx)(H.Z,{did:n.info.did,src:n.info.logo,style:{flexShrink:0}}),(0,y.jsxs)("div",{className:"invite-app__content",children:[(0,y.jsx)("div",{className:"invite-app__title",children:n.info.name}),(0,y.jsx)("div",{className:"invite-app__description",children:n.info.description})]})]})}$.propTypes={invitation:h().object.isRequired};const ee=o.Z.div(X||(X=(0,t.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n .invite-app__content {\n flex: 1;\n margin: 0 12px;\n font-weight: 700;\n overflow: hidden;\n }\n .invite-app__title {\n line-height: 1;\n margin-bottom: 2px;\n overflow: hidden;\n }\n .invite-app__description {\n font-size: 12px;\n white-space: nowrap;\n text-overflow: ellipsis;\n height: 1.3em;\n color: #999;\n overflow: hidden;\n }\n"]))),ne=$;var ie,te=i(5766);function re(e){let{getDataFn:n,passportColor:i,createPassportSvg:t,onLoginSuccess:r,checkFn:o,onReceive:s,inService:a}=e;const c=(0,m.Z)(n);if(c.loading)return(0,y.jsx)(x.Z,{});var l,d;if(c.error)return(0,y.jsx)(g.Z,{status:"404",title:null===(l=c.error)||void 0===l||null===(d=l.response)||void 0===d?void 0:d.data,description:""});const p="success"===c.data.status,u=p?Q:B,v=p?q:E;return(0,y.jsxs)(oe,{className:"page-invite__wrapper",children:[(0,y.jsx)(ne,{invitation:c.data}),(0,y.jsxs)("div",{className:"page-invite__card",children:[(0,y.jsx)(u,{invitation:c.data}),(0,y.jsx)(C,{invitation:c.data,createPassportSvg:t,passportColor:i}),(0,y.jsx)(v,{invitation:c.data,onLogin:r,checkFn:o,onReceive:s,inService:a})]})]})}re.propTypes={getDataFn:h().func.isRequired,checkFn:h().func.isRequired,createPassportSvg:h().func.isRequired,onLoginSuccess:h().func,onReceive:h().func,passportColor:h().string,inService:h().bool},re.defaultProps={onLoginSuccess:()=>{},passportColor:"auto",onReceive:null,inService:!1};const oe=o.Z.div(ie||(ie=(0,t.Z)(["\n max-width: 460px;\n max-height: 650px;\n min-height: 450px;\n width: 90%;\n height: 80%;\n display: flex;\n flex-direction: column;\n .page-invite__card {\n background-color: #fff;\n border-radius: 4px;\n flex: 1;\n padding: 20px 30px;\n margin-top: 10px;\n }\n .page-invite__app {\n margin-top: 20px;\n }\n"]))),se=(0,te.Z)(re);var ae,ce=i(43316),le=i(25339),de=i(75793),pe=i(74094);function ue(e){const{api:n,session:i}=(0,le.Tt)(),{info:t}=(0,de.h6)(),o=(0,s.useLocation)(),a=(0,s.useNavigate)(),{t:l,locale:p}=(0,_.PE)(),{encryptKey:f,decrypt:h}=(0,ce.R)(),[m,g]=(0,r.useState)(!1),w=(0,r.useMemo)((()=>new URLSearchParams(o.search).get("inviteId")),[o]),j=(0,v.default)((async()=>{if(!w)return null;let e;const{data:i}=await n.get("/api/invitation",{params:{inviteId:w}}),r=!!u()(t,"ownerNft.did")&&"owner"===i.role.name;if(r){const i=new URL(window.location.href);i.pathname=d()((0,pe.Y5)(),"/api/did/invite/token"),i.searchParams.set("_ek_",f),i.searchParams.set("inviteId",w);const{data:t}=await n.get(i.href);e=t}return{invitation:i,nextWorkflow:e,needReceiveNFT:r}})),b=(0,r.useCallback)((()=>{g(!0)}),[]),k=(0,r.useCallback)((()=>{if(j.error)throw j.error;return j.value.invitation}),[j]),Z=(0,r.useCallback)((async e=>{e&&(0,pe.ZB)(h(e.sessionToken));const n=new URLSearchParams(o.search);n.delete("inviteId");const t=n.toString();await i.refresh(),a("/".concat(t?"?".concat(t):t),{replace:!0})}),[o,a,i]);if(j.loading)return(0,y.jsx)(x.Z,{});return(0,y.jsxs)(ve,{className:"page-invite",children:[u()(j,"value.needReceiveNFT")&&(0,y.jsx)(ce.Z,{action:"login",popup:!0,className:"connect",open:m,locale:p,baseUrl:t.launcher.url,checkFn:c().create({baseURL:t.launcher.url}).get,onSuccess:()=>{const e=new URL(window.location.href);e.pathname=d()((0,pe.Y5)(),"/api/did/invite/status"),e.searchParams.set("_t_",j.value.nextWorkflow.token),e.searchParams.set("locale",p);const t=setInterval((async()=>{const{data:r}=await n.get(e.href);"succeed"===r.status&&(clearInterval(t),i.updateConnectedInfo(r),Z(r))}),2e3)},onClose:()=>{g(!1)},checkTimeout:3e5,webWalletUrl:(0,pe.yP)(t),extraParams:{nw:u()(j,"value.nextWorkflow.url")},messages:{title:l("invite.transferNFTDialog.title",{name:t.name}),scan:l("invite.transferNFTDialog.scan"),confirm:l("invite.transferNFTDialog.confirm"),success:l("invite.transferNFTDialog.success")},prefix:"/.well-known/service/api/did"}),(0,y.jsx)(se,{...e,getDataFn:k,createPassportSvg:e=>(0,pe.Ju)(e,t),checkFn:n.get,onLoginSuccess:Z,passportColor:"default",onReceive:u()(j,"value.needReceiveNFT")?b:null})]})}const ve=o.Z.div(ae||(ae=(0,t.Z)(["\n width: 100vw;\n height: 100%;\n min-height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: #f6f8fa;\n overflow: auto;\n padding: 20px;\n"])));function fe(){return(0,de.h6)().loading?(0,y.jsx)(x.Z,{}):(0,y.jsx)(ue,{})}},5766:(e,n,i)=>{i.d(n,{Z:()=>l});var t=i(68420),r=i(77668),o=i.n(r),s=i(2586);const a={en:o()(s.Z),ar:()=>i.e(4465).then(i.bind(i,4465)).then((e=>o()(e.default))),de:()=>i.e(3803).then(i.bind(i,43803)).then((e=>o()(e.default))),es:()=>i.e(3930).then(i.bind(i,23930)).then((e=>o()(e.default))),fr:()=>i.e(2019).then(i.bind(i,82019)).then((e=>o()(e.default))),hi:()=>i.e(8590).then(i.bind(i,78768)).then((e=>o()(e.default))),id:()=>i.e(1575).then(i.bind(i,61575)).then((e=>o()(e.default))),ja:()=>i.e(233).then(i.bind(i,90233)).then((e=>o()(e.default))),ko:()=>i.e(8170).then(i.bind(i,48170)).then((e=>o()(e.default))),pt:()=>i.e(9586).then(i.bind(i,69586)).then((e=>o()(e.default))),ru:()=>i.e(1059).then(i.bind(i,81059)).then((e=>o()(e.default))),th:()=>i.e(5748).then(i.bind(i,55748)).then((e=>o()(e.default))),vi:()=>i.e(6906).then(i.bind(i,56906)).then((e=>o()(e.default))),"zh-TW":()=>i.e(4423).then(i.bind(i,64423)).then((e=>o()(e.default))),zh:()=>i.e(6944).then(i.bind(i,56944)).then((e=>o()(e.default)))};var c=i(96266);function l(e){return function(n){return(0,c.jsx)(t.Iw,{translations:a,children:(0,c.jsx)(e,{...n})})}}},92459:(e,n,i)=>{i.d(n,{Z:()=>c});var t=i(55898),r=i.n(t),o=i(28726),s=i(81089),a=i(96266);function c(e){let{children:n,...i}=e;return(0,a.jsxs)(o.Z,{color:"did",variant:"contained",...i,children:[(0,a.jsx)("span",{style:{fontWeight:400},children:n||"Continue With"}),(0,a.jsx)(s.Z,{style:{width:"auto",height:"1.2em",margin:"0 4px 0 8px"}})]})}c.propTypes={children:r().any},c.defaultProps={children:""}},35474:(e,n,i)=>{i.d(n,{Z:()=>z});var t={};i.r(t),i.d(t,{ComingSoon:()=>k,Error:()=>y,Forbidden:()=>w,Info:()=>Z,InternalServerError:()=>j,Maintenance:()=>b,PageNotFound:()=>_});var r,o=i(55898),s=i.n(o),a=i(71171),c=i(39948),l=i(47685),d=i(96266);function p(e){let{icon:n,title:i,description:t,extra:r,...o}=e;return(0,d.jsxs)(u,{...o,children:[n,"string"===typeof i?(0,d.jsx)(c.Z,{mt:3,fontSize:22,fontWeight:400,color:"#47494E",textAlign:"center",children:i}):i,"string"===typeof t?(0,d.jsx)(c.Z,{mt:1,fontSize:14,color:"#7F828B",textAlign:"center",children:t}):t,(0,d.jsx)(c.Z,{mt:3,children:r})]})}p.propTypes={icon:s().element,title:s().oneOfType([s().string,s().element]),description:s().oneOfType([s().string,s().element]),actions:s().any,extra:s().element},p.defaultProps={icon:void 0,title:"",description:"",actions:null,extra:void 0};const u=(0,l.zo)("div")(r||(r=(0,a.Z)(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n height: 100%;\n padding: 16px;\n\n background-color: #f7f8fb;\n"]))),v=p;var f=i(36134),h=i(11532);const m={en:{404:{title:"404 - Page Not Found",description:"Sorry about that, the page you are looking for does not exist or has been moved."},403:{title:"403 \u2013 Forbidden",description:"Sorry, you are not authorized to access this page."},500:{title:"500 - Internal Server Error",description:"An internal server error has occurred. Please try again later."},error:{title:"Application Error",description:"Something went wrong. Please try again later."},maintenance:{title:"Offline for maintenance",description:"This app is undergoing maintenance right now. Please check back later."},comingSoon:{title:"Coming Soon",description:"Our website is under construction. We'll be here soon with our new website."}},zh:{404:{title:"404 - \u9875\u9762\u672a\u627e\u5230",description:"\u5f88\u62b1\u6b49\uff0c\u60a8\u6b63\u5728\u5bfb\u627e\u7684\u9875\u9762\u4e0d\u5b58\u5728\u6216\u5df2\u88ab\u79fb\u52a8\u3002"},403:{title:"403 \u2013 \u7981\u6b62\u8bbf\u95ee",description:"\u5f88\u62b1\u6b49\uff0c\u60a8\u6ca1\u6709\u6743\u9650\u8bbf\u95ee\u6b64\u9875\u9762\u3002"},500:{title:"500 - \u5185\u90e8\u670d\u52a1\u5668\u9519\u8bef",description:"\u53d1\u751f\u4e86\u4e00\u4e2a\u5185\u90e8\u670d\u52a1\u5668\u9519\u8bef\u3002\u8bf7\u7a0d\u540e\u518d\u8bd5\u3002"},error:{title:"Application Error",description:"\u51fa\u9519\u4e86, \u8bf7\u7a0d\u540e\u518d\u8bd5\u3002"},maintenance:{title:"\u7ef4\u62a4\u4e2d",description:"\u5e94\u7528\u7a0b\u5e8f\u6b63\u5728\u8fdb\u884c\u7ef4\u62a4\u3002\u8bf7\u7a0d\u540e\u518d\u67e5\u770b\u3002"},comingSoon:{title:"\u5373\u5c06\u4e0a\u7ebf",description:"\u6211\u4eec\u7684\u7f51\u7ad9\u6b63\u5728\u5efa\u8bbe\u4e2d\u3002\u6211\u4eec\u5f88\u5feb\u5c31\u4f1a\u5728\u8fd9\u91cc\u63a8\u51fa\u6211\u4eec\u7684\u65b0\u7f51\u7ad9\u3002"}}};var x=i(68420);const g=e=>{e=["zh","en"].includes(e)?e:"";const{locale:n}=(0,x.PE)()||{locale:"en"},i=e||n;return m[i]?i:"en"};function _(e){let{locale:n,...i}=e;return n=g(n),(0,d.jsx)(v,{icon:(0,d.jsx)(S,{}),title:m[n][404].title,description:m[n][404].description,...i})}function w(e){let{locale:n,...i}=e;return n=g(n),(0,d.jsx)(v,{icon:(0,d.jsx)(S,{}),title:m[n][403].title,description:m[n][403].description,...i})}function j(e){let{locale:n,...i}=e;return n=g(n),(0,d.jsx)(v,{icon:(0,d.jsx)(S,{}),title:m[n][500].title,description:m[n][500].description,...i})}function y(e){let{locale:n,...i}=e;return n=g(n),(0,d.jsx)(v,{icon:(0,d.jsx)(S,{}),title:m[n].error.title,description:m[n].error.description,...i})}function b(e){let{locale:n,...i}=e;return n=g(n),(0,d.jsx)(v,{icon:(0,d.jsx)(C,{}),title:m[n].maintenance.title,description:m[n].maintenance.description,...i})}function k(e){let{locale:n,...i}=e;return n=g(n),(0,d.jsx)(v,{icon:(0,d.jsx)(C,{}),title:m[n].comingSoon.title,description:m[n].comingSoon.description,...i})}function Z(e){return(0,d.jsx)(v,{icon:(0,d.jsx)(C,{}),...e})}function S(e){const n=(0,l.Fg)();return(0,d.jsx)(h.Z,{style:{color:n.palette.error.main,fontSize:72},...e})}function C(e){const n=(0,l.Fg)();return(0,d.jsx)(f.Z,{style:{color:n.palette.info.main,fontSize:72},...e})}_.status="404",w.status="403",j.status="500",y.status="error",b.status="maintenance",k.status="comingSoon",Z.status="info";const P=Object.keys(t).reduce(((e,n)=>({...e,[t[n].status||n]:t[n]})),{});function N(e){let{status:n,...i}=e;if(n){if(P[n]){const e=P[n];return(0,d.jsx)(e,{...i})}throw new Error("Please provide a valid status for Result.status. Valid values are: ".concat(Object.keys(P).join(", ")))}return(0,d.jsx)(v,{...i})}N.propTypes={status:s().oneOfType([s().string,s().number]),...v.propTypes},N.defaultProps={status:""};const z=N},11532:(e,n,i)=>{var t=i(71600);n.Z=void 0;var r=t(i(56930)),o=i(96266);n.Z=(0,r.default)((0,o.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.9959.9959 0 0 1 0-1.41L10.59 12 7.7 9.11a.9959.9959 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41"}),"CancelRounded")},76005:(e,n,i)=>{var t=i(71600);n.Z=void 0;var r=t(i(56930)),o=i(96266);n.Z=(0,r.default)((0,o.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle")},36134:(e,n,i)=>{var t=i(71600);n.Z=void 0;var r=t(i(56930)),o=i(96266);n.Z=(0,r.default)((0,o.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info")}}]);
|