@abtnode/webapp 1.16.20 → 1.16.21-beta-edf184e1
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 +27 -26
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/1294.5b08d5e3.chunk.js +1 -0
- package/build/static/js/{1667.3001639f.chunk.js → 1667.488a600b.chunk.js} +1 -1
- package/build/static/js/2183.e57ce8a2.chunk.js +1 -0
- package/build/static/js/2435.88762f30.chunk.js +1 -0
- package/build/static/js/2443.00426c01.chunk.js +1 -0
- package/build/static/js/{3389.72b7e591.chunk.js → 3389.282a0683.chunk.js} +1 -1
- package/build/static/js/4382.bd7f7f72.chunk.js +2 -0
- package/build/static/js/4471.a41284d9.chunk.js +1 -0
- package/build/static/js/{6490.8f3553c2.chunk.js → 4509.231da63f.chunk.js} +2 -2
- package/build/static/js/4549.5fda7728.chunk.js +1 -0
- package/build/static/js/{4775.b0cede7b.chunk.js → 4775.19ec4c25.chunk.js} +1 -1
- package/build/static/js/4906.aced1b76.chunk.js +1 -0
- package/build/static/js/5059.b85795c1.chunk.js +1 -0
- package/build/static/js/{5672.b32c024f.chunk.js → 5672.19e3e3e6.chunk.js} +1 -1
- package/build/static/js/{5804.996e83bb.chunk.js → 5804.c02bc104.chunk.js} +2 -2
- package/build/static/js/{5979.bd3d3c0f.chunk.js → 5979.4e4ebbf1.chunk.js} +1 -1
- package/build/static/js/6230.b1753197.chunk.js +1 -0
- package/build/static/js/6511.623f368a.chunk.js +1 -0
- package/build/static/js/{6580.8cdb4aa4.chunk.js → 6580.fc3c74eb.chunk.js} +1 -1
- package/build/static/js/{6931.e9297d29.chunk.js → 6931.a2586ea5.chunk.js} +1 -1
- package/build/static/js/{7022.02d74e90.chunk.js → 7022.9d96c66f.chunk.js} +1 -1
- package/build/static/js/7706.74e51876.chunk.js +2 -0
- package/build/static/js/{9552.82c09530.chunk.js → 9552.3effa95b.chunk.js} +1 -1
- package/build/static/js/main.e3082f6b.js +2 -0
- package/package.json +1 -1
- package/build/static/js/1294.8ccea539.chunk.js +0 -1
- package/build/static/js/1633.5c43bf43.chunk.js +0 -2
- package/build/static/js/3826.d40f6fa7.chunk.js +0 -2
- package/build/static/js/4435.5212440d.chunk.js +0 -1
- package/build/static/js/4448.d67840f3.chunk.js +0 -1
- package/build/static/js/4471.c2380391.chunk.js +0 -1
- package/build/static/js/4906.b8af826c.chunk.js +0 -1
- package/build/static/js/6511.978080d1.chunk.js +0 -1
- package/build/static/js/8382.e1c429ed.chunk.js +0 -1
- package/build/static/js/8973.639c0cf3.chunk.js +0 -1
- package/build/static/js/9277.babc5673.chunk.js +0 -1
- package/build/static/js/main.c88b220e.js +0 -2
- /package/build/static/css/{3826.a5e3e6d6.chunk.css → 4382.a5e3e6d6.chunk.css} +0 -0
- /package/build/static/css/{8973.9cab926a.chunk.css → 6230.9cab926a.chunk.css} +0 -0
- /package/build/static/js/{3826.d40f6fa7.chunk.js.LICENSE.txt → 4382.bd7f7f72.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{5804.996e83bb.chunk.js.LICENSE.txt → 4509.231da63f.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{6490.8f3553c2.chunk.js.LICENSE.txt → 5804.c02bc104.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{1633.5c43bf43.chunk.js.LICENSE.txt → 7706.74e51876.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.c88b220e.js.LICENSE.txt → main.e3082f6b.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4435],{18067:(e,t,r)=>{"use strict";t.Z=void 0;(n=r(5057))&&n.__esModule;var n,o=r(96266);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(e){return(0,o.jsx)("svg",i(i({},e),{},{children:(0,o.jsx)("path",{d:"M11.78 2.25c-2.767 0-5.019 2.271-5.019 5.063v3.037H5.758a2.018 2.018 0 0 0-2.008 2.025v8.1c0 1.117.9 2.025 2.008 2.025h12.045a2.018 2.018 0 0 0 2.007-2.025v-8.1c0-1.117-.9-2.025-2.007-2.025h-1.004V7.313c0-2.792-2.251-5.063-5.019-5.063zm6.023 10.125l.002 8.1H5.758v-8.1h12.045zM8.769 10.35V7.313c0-1.675 1.35-3.038 3.011-3.038 1.66 0 3.011 1.363 3.011 3.037v3.038H8.77z"})}))};c.defaultProps={width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},c.displayName="lock";var d=c;t.Z=d},64886:(e,t,r)=>{"use strict";r.d(t,{Z:()=>v});var n,o=r(71171),a=r(55898),i=r.n(a),s=r(51540),c=r.n(s),d=r(26538),p=r.n(d),l=r(11750),h=r(47685),u=r(96266);function f(e){let{name:t,nameFormatter:r,layout:n,children:o,valueComponent:a,nameWidth:i,...s}=e;return(0,u.jsxs)(m,{layout:n,width:i,...s,children:[(0,u.jsx)(l.Z,{color:"textSecondary",className:"info-row__name",children:r(t)}),o&&(0,u.jsx)(l.Z,{color:"textPrimary",component:a,className:"info-row__value",children:o})]})}f.propTypes={name:i().any.isRequired,layout:i().oneOf(["horizontal","vertical"]),children:i().any,nameFormatter:i().func,valueComponent:i().string,nameWidth:i().number},f.defaultProps={children:null,nameWidth:90,nameFormatter:e=>{const t=e.split(" ").map((e=>p()(c()(e)))).join(" ");return"string"===typeof e?t:e},valueComponent:"div",layout:"horizontal"};const m=(0,h.zo)("div")(n||(n=(0,o.Z)(["\n display: flex;\n flex-direction: ",";\n justify-content: flex-start;\n align-items: ",";\n margin-bottom: 16px;\n\n .info-row__name {\n width: ","px;\n margin-right: ",";\n margin-bottom: ",";\n text-transform: capitalize;\n }\n\n .info-row__value {\n flex: 1;\n overflow: auto;\n word-wrap: break-word;\n font-weight: 500;\n }\n\n @media (max-width: ","px) {\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n .info-row__name {\n font-weight: bold;\n }\n\n .info-row__value {\n width: 100%;\n font-size: 12px;\n margin-top: 8px;\n }\n }\n"])),(e=>"vertical"===e.layout?"column":"row"),(e=>"vertical"===e.layout?"flex-start":"center"),(e=>e.width),(e=>"vertical"===e.layout?"0":"8px"),(e=>"vertical"===e.layout?"8px":"0"),(e=>e.theme.breakpoints.values.md)),v=f},44919:(e,t,r)=>{"use strict";var n=r(71600);t.Z=void 0;var o=n(r(56930)),a=r(96266),i=(0,o.default)((0,a.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");t.Z=i},11593:(e,t,r)=>{"use strict";var n=r(71600);t.Z=void 0;var o=n(r(56930)),a=r(96266),i=(0,o.default)((0,a.jsx)("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17 17 20.41zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5 7.5 8z"}),"CallMerge");t.Z=i},76416:(e,t,r)=>{"use strict";var n=r(71600);t.Z=void 0;var o=n(r(56930)),a=r(96266),i=(0,o.default)((0,a.jsx)("path",{d:"M12.16 3h-.32L9.21 8.25h5.58zm4.3 5.25h5.16L19 3h-5.16zm4.92 1.5h-8.63V20.1zM11.25 20.1V9.75H2.62zM7.54 8.25 10.16 3H5L2.38 8.25z"}),"Diamond");t.Z=i},17655:(e,t,r)=>{"use strict";var n=r(71600);t.Z=void 0;var o=n(r(56930)),a=r(96266),i=(0,o.default)((0,a.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");t.Z=i},31942:(e,t,r)=>{"use strict";var n=r(71600);t.Z=void 0;var o=n(r(56930)),a=r(96266),i=(0,o.default)((0,a.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"}),"Https");t.Z=i},45267:(e,t,r)=>{"use strict";var n=r(71600);t.Z=void 0;var o=n(r(56930)),a=r(96266),i=(0,o.default)((0,a.jsx)("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");t.Z=i},96538:(e,t,r)=>{"use strict";var n=r(71600);t.Z=void 0;var o=n(r(56930)),a=r(96266),i=(0,o.default)((0,a.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}),"OpenInNew");t.Z=i},75392:(e,t,r)=>{"use strict";r.d(t,{Z:()=>v});var n=r(7896),o=r(31461),a=r(5057),i=r(9978),s=r(91213),c=r(62773),d=r(42908),p=r(31821),l=r(18561);function h(e){return(0,l.Z)("MuiCardContent",e)}(0,p.Z)("MuiCardContent",["root"]);var u=r(96266);const f=["className","component"],m=(0,c.ZP)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})((()=>({padding:16,"&:last-child":{paddingBottom:24}}))),v=a.forwardRef((function(e,t){const r=(0,d.Z)({props:e,name:"MuiCardContent"}),{className:a,component:c="div"}=r,p=(0,o.Z)(r,f),l=(0,n.Z)({},r,{component:c}),v=(e=>{const{classes:t}=e;return(0,s.Z)({root:["root"]},h,t)})(l);return(0,u.jsx)(m,(0,n.Z)({as:c,className:(0,i.Z)(v.root,a),ownerState:l,ref:t},p))}))},48191:(e,t,r)=>{var n=r(54305);e.exports=function(e,t){for(var r=-1,o=e.length;++r<o&&n(t,e[r],0)>-1;);return r}},11854:(e,t,r)=>{var n=r(57333),o=r(39594),a=r(69123),i=r(38828),s=r(48191),c=r(38554),d=r(26849);e.exports=function(e,t,r){if((e=d(e))&&(r||void 0===t))return o(e);if(!e||!(t=n(t)))return e;var p=c(e),l=c(t),h=s(p,l),u=i(p,l)+1;return a(p,h,u).join("")}},46422:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base32:()=>p,base32hex:()=>f,base32hexpad:()=>v,base32hexpadupper:()=>b,base32hexupper:()=>m,base32pad:()=>h,base32padupper:()=>u,base32upper:()=>l,base32z:()=>x});new Uint8Array(0);class n{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class o{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return i(this,e)}}class a{constructor(e){this.decoders=e}or(e){return i(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const i=(e,t)=>new a({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class s{constructor(e,t,r,a){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=a,this.encoder=new n(e,t,r),this.decoder=new o(e,t,a)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const c=e=>{let{name:t,prefix:r,encode:n,decode:o}=e;return new s(t,r,n,o)},d=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:o}=e;return c({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let a="",i=0,s=0;for(let c=0;c<e.length;++c)for(s=s<<8|e[c],i+=8;i>r;)i-=r,a+=t[o&s>>i];if(i&&(a+=t[o&s<<r-i]),n)for(;a.length*r&7;)a+="=";return a})(e,o,n),decode:e=>((e,t,r,n)=>{const o={};for(let p=0;p<t.length;++p)o[t[p]]=p;let a=e.length;for(;"="===e[a-1];)--a;const i=new Uint8Array(a*r/8|0);let s=0,c=0,d=0;for(let p=0;p<a;++p){const t=o[e[p]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,s+=r,s>=8&&(s-=8,i[d++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return i})(e,o,n,t)})},p=d({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),l=d({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),h=d({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),u=d({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),f=d({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),m=d({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),v=d({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),b=d({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),x=d({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4448],{46158:(e,t,n)=>{n.r(t),n.d(t,{default:()=>D});var a,i=n(71171),s=n(5057),r=n(33518),l=n(15849),o=n(5609),c=n(19577),d=n(2478),p=n(44067),x=n(44846),m=n(42761),h=n(75239),f=n(62681),u=n(29034),g=n(11750),j=n(88092),Z=n(26174),y=n(83580),b=n(67680),v=n(39529),w=n(39948),k=n(59662),N=n(28726),C=n(68420),z=n(27690),M=n(85104),L=n(74094),_=n(7199),A=n(96266);function D(){const{api:e,data:t,paging:n,refresh:a,loading:i}=(0,z.nw)(),[r,D]=(0,s.useState)(!0),[R,F]=(0,s.useState)(!1),{t:I,locale:P}=(0,s.useContext)(C.RD),S=async t=>{await e.readNotifications({input:{id:t}}),a()},$=r?t:t.filter((e=>!1===e.read)),T=t.filter((e=>!1===e.read)).length>0,W=e=>(0,A.jsxs)("div",{className:"title",children:[e.title," ",(0,A.jsx)("span",{className:"time-ago",title:(0,L.B2)(e.createdAt,P),children:(0,o.WU)(new Date(e.createdAt),(0,L.FF)(P))})]});return(0,A.jsxs)(U,{children:[(0,A.jsxs)(g.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:[I("notification.title"),(0,A.jsxs)(g.Z,{component:"span",className:"notification-actions",children:[(0,A.jsx)(Z.Z,{control:(0,A.jsx)(j.Z,{checked:r,onChange:()=>D(!r),name:"showRead",color:"primary"}),label:I("notification.showRead")}),(0,A.jsx)(_.Z,{permission:"mutate_notification",children:T&&(0,A.jsxs)(N.Z,{disabled:R,onClick:async()=>{F(!0);const n=t.filter((e=>!1===e.read)).map((e=>e.id)).join(",");await e.readNotifications({input:{id:n}}),a(),F(!1)},className:"",children:[R&&(0,A.jsx)(x.Z,{size:16}),I("notification.markAllAsRead")]})})]})]}),(0,A.jsx)(u.Z,{}),(0,A.jsxs)(c.Z,{className:"notification-list",children:[i&&(0,A.jsx)(x.Z,{size:[32,20],style:{opacity:"0.8",zIndex:1e4,position:"fixed",top:30,left:"50%",marginLeft:-16}}),0===$.length&&(0,A.jsx)(g.Z,{component:"p",variant:"body1",className:"notification-tip",children:I("notification.empty")}),$.length>0&&$.map((e=>e.action?(0,A.jsxs)(d.ZP,{component:l.Link,to:e.action,alignItems:"flex-start",disabled:e.read,children:[(0,A.jsx)(m.Z,{className:"list-item-avatar",children:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(f.Z,{children:e.entityType.substr(0,1).toUpperCase()}),(0,A.jsx)(M.Z,{className:"notification-tag",status:e.severity})]})}),(0,A.jsx)(p.Z,{className:"list-item-text",classes:{secondary:"list-item-secondary-text"},primary:W(e),secondary:e.description}),!1===e.read&&(0,A.jsx)(y.Z,{children:(0,A.jsx)(h.Z,{title:I("notification.markAsRead"),children:(0,A.jsx)(b.Z,{edge:"end","aria-label":"delete",onClick:()=>S(e.id),size:"large",children:(0,A.jsx)(v.Z,{})})})})]},e.id):(0,A.jsxs)(d.ZP,{alignItems:"flex-start",disabled:e.read,children:[(0,A.jsx)(m.Z,{className:"list-item-avatar",children:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(f.Z,{children:e.entityType.substr(0,1).toUpperCase()}),(0,A.jsx)(M.Z,{className:"notification-tag",status:e.severity})]})}),(0,A.jsx)(p.Z,{className:"list-item-text",classes:{secondary:"list-item-secondary-text"},primary:W(e),secondary:e.description}),!1===e.read&&(0,A.jsx)(y.Z,{children:(0,A.jsx)(h.Z,{title:I("notification.markAsRead"),children:(0,A.jsx)(b.Z,{edge:"end","aria-label":"delete",onClick:()=>S(e.id),size:"large",children:(0,A.jsx)(v.Z,{})})})})]},e.id)))]}),!!$.length&&n.pageCount>1&&(0,A.jsx)(w.Z,{mt:2,display:"flex",justifyContent:"flex-end",children:(0,A.jsx)(k.Z,{disabled:i,count:n.pageCount,page:n.page,onChange:(e,t)=>{a({page:t})}})})]})}const U=r.Z.div(a||(a=(0,i.Z)(["\n min-height: 60vh;\n\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n .notification-actions {\n width: auto;\n display: flex;\n justify-content: space-between;\n }\n }\n\n .page-content {\n margin-top: 16px;\n }\n\n .list-item-avatar {\n display: flex;\n flex-direction: column;\n align-items: center;\n min-width: 80px;\n\n .notification-tag {\n margin-top: 4px;\n }\n }\n\n .MuiListItem-root:not(.Mui-disabled) {\n .MuiAvatar-root {\n background: ",";\n }\n }\n\n .list-item-text {\n .title {\n display: flex;\n align-items: center;\n .time-ago {\n background: #bdbdbd;\n font-size: 11px;\n margin-left: 8px;\n color: #f7f8f8;\n border-radius: 3px;\n padding: 1px 4px;\n }\n }\n }\n .Mui-disabled .list-item-text .title .time-ago {\n background: #666;\n }\n\n .list-item-secondary-text {\n word-break: break-word;\n }\n"])),(e=>e.theme.palette.primary.light))},39529:(e,t,n)=>{var a=n(71600);t.Z=void 0;var i=a(n(56930)),s=n(96266),r=(0,i.default)((0,s.jsx)("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"}),"VisibilityOff");t.Z=r},96646:(e,t,n)=>{n.d(t,{Z:()=>s});n(5057);var a=n(57471),i=n(96266);const s=(0,a.Z)((0,i.jsx)("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"}),"FirstPage")},54665:(e,t,n)=>{n.d(t,{Z:()=>s});n(5057);var a=n(57471),i=n(96266);const s=(0,a.Z)((0,i.jsx)("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"}),"LastPage")},5609:(e,t,n)=>{n.d(t,{WU:()=>c});var a=["second","minute","hour","day","week","month","year"];var i=["\u79d2","\u5206\u949f","\u5c0f\u65f6","\u5929","\u5468","\u4e2a\u6708","\u5e74"];var s={},r=function(e,t){s[e]=t},l=[60,60,24,7,365/7/12,12];function o(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}var c=function(e,t,n){var a=function(e,t){return(+(t?o(t):new Date)-+o(e))/1e3}(e,n&&n.relativeDate);return function(e,t){for(var n=e<0?1:0,a=e=Math.abs(e),i=0;e>=l[i]&&i<l.length;i++)e/=l[i];return(e=Math.floor(e))>(0===(i*=2)?9:1)&&(i+=1),t(e,i,a)[n].replace("%s",e.toString())}(a,function(e){return s[e]||s.en_US}(t))};r("en_US",(function(e,t){if(0===t)return["just now","right now"];var n=a[Math.floor(t/2)];return e>1&&(n+="s"),[e+" "+n+" ago","in "+e+" "+n]})),r("zh_CN",(function(e,t){if(0===t)return["\u521a\u521a","\u7247\u523b\u540e"];var n=i[~~(t/2)];return[e+" "+n+"\u524d",e+" "+n+"\u540e"]}))}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4471],{43120:(e,n,t)=>{t.d(n,{Z:()=>a.Z});var a=t(70461)},30756:(e,n,t)=>{t.d(n,{Z:()=>a.Z});var a=t(71363)},43776:(e,n,t)=>{t.r(n),t.d(n,{default:()=>ce});var a=t(71171),s=t(5057),c=t(33518),o=t(85493),r=t(11750),i=t(94464),l=t(68420),d=t(13239),m=t(75672),p=t(75979),u=t(75793),g=t(52926),x=t(17022),h=t(74094),y=t(81256),f=t(99065),j=t(93938),v=t(39948),b=t(44846),Z=t(25710),C=t(97038),k=t(35432),w=t(9729),_=t(44919),S=t(47020),K=t(74490),N=t(51177),P=t(6041),A=t(80576),I=t(28726),B=t(43120),F=t(10155),z=t(96266);function R(e){const{remark:n,onCreate:t}=e,{t:a}=(0,l.PE)(),[c,o]=(0,s.useState)(!1),[i,d]=(0,s.useState)(null),m=(0,F.Z)(),p=k.RBAC_CONFIG.roles.filter((e=>e.passport&&e.name!==k.ROLES.OWNER)),u={title:"".concat(a("common.create")," ").concat(a("common.accessKey")),description:(e,n,t)=>(0,z.jsxs)(r.Z,{component:"div",children:[(0,z.jsx)(S.Z,{label:a("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark","data-cy":"remark-input",fullWidth:!0,autoFocus:!0,style:{marginBottom:32},margin:"dense",value:e.remark,onChange:s=>{n({...e,remark:s.target.value,__disableConfirm:!e.passport||!s.target.value.trim()}),s.target.value.trim()?t(""):t(a("setting.accessKey.remarkInvalid"))}}),(0,z.jsxs)(A.Z,{style:{width:"100%"},variant:"outlined",children:[(0,z.jsx)(P.Z,{children:a("common.passport")}),(0,z.jsx)(N.Z,{"data-cy":"create-access-key-select-passport",value:e.passport,onChange:a=>{const s=a.target.value;t(null),n({...e,passport:s,__disableConfirm:!e.remark||!s})},fullWidth:!0,label:a("common.passport"),disabled:c,children:p.map((e=>(0,z.jsx)(K.Z,{value:e.name,"data-cy":"create-access-key-passport-option-".concat(e.name),children:(0,z.jsxs)(v.Z,{children:[(0,z.jsx)("span",{children:e.title||e.name}),(0,z.jsx)(v.Z,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:e.description})]})},e.name)))})]})]}),confirm:a("common.confirm"),cancel:a("common.cancel"),color:"primary",params:{remark:n,__disableConfirm:!n.trim()},onConfirm:async e=>{const{remark:n,passport:a}=e;o(!0);const s=await m.createAccessKey({input:{remark:n.trim(),passport:a}}),{data:c}=s;t(c),d(null),o(!1)},onCancel:()=>{o(!1),d(null)}};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(I.Z,{edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>d(u),className:"rule-action",children:[c?(0,z.jsx)(b.Z,{size:16}):(0,z.jsx)(_.Z,{style:{fontSize:16}}),a("common.create")]}),i&&(0,z.jsx)(B.Z,{title:i.title,description:i.description,confirm:i.confirm,color:i.color,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}R.defaultProps={onCreate:()=>{},remark:""};var W,E,L,T=t(13128),D=t(26174),O=t(88092),U=t(50185);function M(e){const{onConfirm:n,accessKeyId:t,accessKeySecret:a}=e,{t:c}=(0,s.useContext)(l.RD),[o,r]=(0,s.useState)(!1),[i,d]=(0,s.useState)(!0);return(0,z.jsxs)(T.ZP,{title:c("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:n,showCloseButton:!1,actions:(0,z.jsx)("div",{children:(0,z.jsx)(I.Z,{disabled:!o,onClick:n,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:c("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[(0,z.jsx)("div",{children:(0,z.jsx)(V,{children:c("setting.accessKey.saveSecretTip")})}),(0,z.jsx)("div",{style:{marginTop:"20px"}}),(0,z.jsxs)(G,{children:[(0,z.jsx)(q,{children:"Access Key"}),(0,z.jsx)(U.Z,{children:t})]}),(0,z.jsxs)(G,{children:[(0,z.jsx)(q,{children:"Access Secret"}),i?(0,z.jsx)(I.Z,{"data-cy":"show-secret-btn",color:"primary",onClick:()=>{d(!i)},children:c("setting.accessKey.showSecret")}):(0,z.jsx)(U.Z,{children:a})]}),(0,z.jsx)("div",{children:(0,z.jsx)(D.Z,{value:"end",disabled:i,control:(0,z.jsx)(O.Z,{checked:o,onChange:e=>{r(e.target.checked)}}),label:c("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}M.defaultProps={onConfirm:()=>{}};const q=c.Z.div(W||(W=(0,a.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 16px;\n margin-bottom: 8px;\n"]))),G=c.Z.div(E||(E=(0,a.Z)(["\n margin-bottom: 24px;\n"]))),V=c.Z.div(L||(L=(0,a.Z)(["\n font-size: 16px;\n font-weight: bold;\n"])));var H=t(5609),J=t(27773),Q=t(30756);function X(e){const{t:n,locale:t}=(0,l.PE)(),[a,c]=(0,s.useState)(!1),[o,r]=(0,s.useState)(null),{accessKeyId:i,time:d,remark:m,onDelete:p=(()=>{})}=e,u=(0,F.Z)(),g={keyName:m,title:n("setting.accessKey.title"),description:"".concat(d?n("setting.accessKey.description",(x=d,{key:"<b>".concat(i,"</b>"),name:"<b>".concat(m,"</b>"),time:(0,h.B2)(x,t),timeAge:(0,H.WU)(new Date(x),(0,h.FF)(t))})):n("setting.accessKey.descriptionNoTime",{key:"<b>".concat(i,"</b>"),name:"<b>".concat(m,"</b>")})),confirmPlaceholder:n("setting.accessKey.confirm_desc",{name:m}),confirm:n("common.delConfirm"),cancel:n("common.cancel"),onConfirm:async()=>{c(!0);try{await u.deleteAccessKey({input:{accessKeyId:i}}),p()}catch(e){console.error(e)}finally{c(!1),r(null)}},onCancel:()=>{c(!1),r(null)}};var x;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(I.Z,{edge:"end",onClick:()=>r(g),size:"small",className:"rule-action",color:"error",children:[a?(0,z.jsx)(b.Z,{size:16}):(0,z.jsx)(J.default,{style:{fontSize:16}}),n("common.delete")]}),o&&(0,z.jsx)(Q.Z,{keyName:o.keyName,title:o.title,description:o.description,confirmPlaceholder:o.confirmPlaceholder,confirm:o.confirm,cancel:o.cancel,params:o.params,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}X.defaultProps={onDelete:()=>{}};var Y=t(76667);function $(e){const{accessKeyId:n,remark:t,onUpdate:a,passport:c}=e,{t:o}=(0,l.PE)(),[i,d]=(0,s.useState)(!1),[m,p]=(0,s.useState)(null),u=(0,F.Z)(),g=k.RBAC_CONFIG.roles.filter((e=>e.passport&&e.name!==k.ROLES.OWNER)),x={title:"".concat(o("common.update")," ").concat(o("common.accessKey")),description:(e,n,t)=>(0,z.jsxs)(r.Z,{component:"div",children:[(0,z.jsx)(S.Z,{label:o("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,style:{marginBottom:32},margin:"dense",value:e.accessKeyId,disabled:!0}),(0,z.jsx)(S.Z,{label:o("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,style:{marginBottom:32},value:e.remark,onChange:a=>{n({...e,remark:a.target.value,__disableConfirm:!a.target.value.trim()}),a.target.value.trim()?t(""):t(o("setting.accessKey.remarkInvalid"))}}),(0,z.jsxs)(A.Z,{style:{width:"100%"},variant:"outlined",children:[(0,z.jsx)(P.Z,{children:o("common.passport")}),(0,z.jsx)(N.Z,{"data-cy":"update-access-key-select-passport",value:e.passport,onChange:a=>{const s=a.target.value;t(null),n({...e,passport:s,__disableConfirm:!e.remark||!s})},fullWidth:!0,label:o("common.passport"),disabled:i,children:g.map((e=>(0,z.jsx)(K.Z,{value:e.name,"data-cy":"update-access-key-passport-option-".concat(e.name),children:(0,z.jsx)("span",{children:e.title||e.name})},e.name)))})]})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{accessKeyId:n,remark:t,passport:c},onConfirm:async e=>{const{accessKeyId:n,remark:t,passport:s}=e;d(!0),await u.updateAccessKey({input:{accessKeyId:n,remark:t.trim(),passport:s}}),a(),p(null),d(!1)},onCancel:()=>{d(!1),p(null)}};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(I.Z,{edge:"end",onClick:()=>p(x),size:"small",className:"rule-action",color:"primary",children:[i?(0,z.jsx)(b.Z,{size:16}):(0,z.jsx)(Y.default,{style:{fontSize:16}}),o("common.update")]}),m&&(0,z.jsx)(B.Z,{title:m.title,description:m.description,confirm:m.confirm,color:m.color,cancel:m.cancel,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}$.defaultProps={onUpdate:()=>{},remark:"",passport:""};var ee,ne=t(7199);function te(){const{t:e,locale:n}=(0,s.useContext)(l.RD),{api:t}=(0,u.h6)(),[a,c]=(0,s.useState)({}),o=(0,y.Z)((async()=>{const e=await t.getAccessKeys(),{list:n}=e;return n})),r=o.value||[],{loading:i,error:d}=o;return!r.length&&i?(0,z.jsx)("div",{style:{textAlign:"center",marginTop:"50px"},children:(0,z.jsx)(b.Z,{})}):!r.length&&d?(0,z.jsx)(j.Z,{severity:"error",children:(0,h.Z)(d)}):(0,z.jsxs)("div",{children:[(0,z.jsxs)(v.Z,{mb:1,textAlign:"right",children:[(0,z.jsx)(ne.Z,{permission:"mutate_node",children:(0,z.jsx)(R,{onCreate:e=>{const{accessKeyId:n,accessKeySecret:t}=e;c({show:!0,accessKeyId:n,accessKeySecret:t})}})}),a.show&&(0,z.jsx)(M,{onConfirm:()=>{o.retry(),c({show:!1})},...a})]}),!r.length&&(0,z.jsx)(v.Z,{mt:8,children:(0,z.jsx)(Z.Z,{children:e("common.noData")})}),!!r.length&&(0,z.jsx)(ae,{children:r.map((e=>{const t=e.remark||"N/A",a=k.RBAC_CONFIG.roles.find((n=>n.name===e.passport));return(0,z.jsxs)("div",{className:"access-key-item",children:[(0,z.jsxs)("div",{className:"access-key-item_info-warpper",children:[(0,z.jsx)("div",{className:"access-key-item_icon",children:(0,z.jsx)(f.Z,{})}),(0,z.jsxs)("div",{className:"access-key-item_info",children:[(0,z.jsx)(v.Z,{fontWeight:700,children:t}),(0,z.jsx)(v.Z,{minWidth:0,children:(0,z.jsx)(C.Z,{showDidLogo:!1,children:e.accessKeyId})}),(0,z.jsxs)("div",{children:["Created at ",(0,h.B2)(e.createdAt,n)]}),(0,z.jsxs)("div",{children:["Created by ",e.createdBy]}),e.updatedBy&&(0,z.jsxs)("div",{children:["Updated by ",e.updatedBy]}),e.lastUsedAt&&(0,z.jsxs)("div",{children:["Last used at ",(0,h.B2)(e.lastUsedAt,n)]}),(0,z.jsx)("div",{className:"access-key-item_passport",children:(0,z.jsx)(w.Z,{passport:{title:a?a.title:e.passport}})})]})]}),(0,z.jsxs)("div",{className:"access-key-item_actions",children:[(0,z.jsx)($,{...e,onUpdate:o.retry}),(0,z.jsx)(X,{accessKeyId:e.accessKeyId,time:e.lastUsedAt,remark:e.remark||"N/A",onDelete:o.retry})]})]})}))})]})}const ae=c.Z.div(ee||(ee=(0,a.Z)(["\n border: 1px solid\n ",";\n border-radius: 8px;\n\n .access-key-item {\n display: flex;\n justify-content: space-between;\n padding: 16px 32px;\n .access-key-item_info-warpper {\n display: flex;\n flex-grow: 1;\n .access-key-item_icon {\n display: flex;\n align-items: center;\n color: ",";\n svg {\n font-size: 44px;\n }\n }\n .access-key-item_info {\n flex: 1;\n max-width: 400px;\n padding-left: 44px;\n }\n }\n .access-key-item_actions {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n }\n\n .access-key-item_passport span {\n margin-top: 4px;\n padding: 2px 12px;\n font-size: 12px;\n }\n }\n .access-key-item + .access-key-item {\n border-top: 1px solid\n ","};\n }\n "," {\n .access-key-item {\n padding: 16px;\n .access-key-item_info-warpper {\n min-width: 0;\n .access-key-item_icon {\n svg {\n font-size: 24px;\n }\n }\n .access-key-item_info {\n max-width: 100%;\n padding-left: 16px;\n }\n }\n .access-key-item_actions {\n flex-direction: column;\n justify-content: center;\n }\n }\n }\n"])),(e=>{let{theme:n}=e;return n.palette.grey[300]}),(e=>{let{theme:n}=e;return n.palette.grey[400]}),(e=>{let{theme:n}=e;return n.palette.grey[300]}),(e=>{let{theme:n}=e;return n.breakpoints.down("md")}));var se;function ce(){const e=(0,o.useNavigate)(),{t:n}=(0,l.PE)(),{info:t}=(0,u.h6)(),{tab:a="members"}=(0,o.useParams)(),c=e=>(0,h.Ju)(e,t),{data:y}=(0,g.RJ)(),f=(0,s.useCallback)((e=>{const n=y.find((n=>[n.meta.did,n.appDid,n.appPid].includes(e)));return n?n.meta.title:"Server"}),[y]),j=(0,s.useCallback)((()=>(0,z.jsx)(d.default,{showScope:!0,scopeFormatter:f})),[f]),v=(0,s.useCallback)((()=>(0,z.jsx)(m.default,{type:"server",createPassportSvg:c})),[]),b=t.did,Z={members:{label:n("common.members"),value:"members",component:v},passports:{label:n("common.passport"),value:"passports",component:p.default},"access-keys":{label:n("common.accessKey"),value:"access-keys",component:te},"audit-logs":{label:n("common.auditLogs"),value:"audit-logs",component:j}},C=Object.values(Z).map((e=>{let{label:n,value:t}=e;return{label:n,value:t}})),k=Z[a]||Z.member;return(0,z.jsx)(x.G6,{teamDid:b,children:(0,z.jsxs)(oe,{children:[(0,z.jsx)(r.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:n("common.team")}),(0,z.jsx)(i.Z,{tabs:C,current:a,onChange:n=>{e("/team/".concat(n))},scrollButtons:"auto"}),(0,z.jsx)("div",{className:"page-content",children:(0,z.jsx)(k.component,{createPassportSvg:c})})]})})}const oe=c.Z.main(se||(se=(0,a.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .page-content {\n margin-top: 24px;\n }\n"])))},13239:(e,n,t)=>{t.r(n),t.d(n,{default:()=>z});var a=t(71171),s=t(33518),c=t(15849),o=t(37676),r=t(72333),i=t(44846),l=t(25710),d=t(68420),m=t(35432),p=t(39948),u=t(11750),g=t(59662),x=t(74490),h=t(51177),y=t(6041),f=t(80576),j=t(19778),v=t(5057),b=t(67654),Z=t(86229),C=t(58238),k=t(96266);const w=(0,v.createContext)({}),{Provider:_,Consumer:S}=w;function K(e){let{children:n,scope:t="",categories:a=[],showScope:s,scopeFormatter:c}=e;const{api:o,info:r}=(0,C.h6)(),[i,l]=(0,v.useState)([]),[d,m]=(0,v.useState)({total:0,pageSize:20,pageCount:0,page:1}),[p,u]=(0,v.useState)(!1),[g,x]=(0,b.Z)("audit-log-category-".concat(t),"all"),h=[{value:"all",label:"All",description:""},{value:"blocklet",label:"Blocklet Management",description:""},{value:"server",label:"Server Management",description:""},{value:"team",label:"Team Management",description:""},{value:"security",label:"Security",description:""},{value:"certificates",label:"Certificate Management",description:""},{value:"integrations",label:"Integration Management",description:""},{value:"gateway",label:"Gateway",description:""}].filter((e=>!a.length||("all"===e.value||a.includes(e.value)))),y=async function(){let{page:e=1,silent:n=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!p){n||u(!0);try{const n=await o.getAuditLogs({input:{paging:{page:e},category:"all"===g?"":g,scope:t}});s&&(n.list||[]).forEach((e=>{e.scope!==r.did&&(e.link="/blocklets/".concat(e.scope,"/components"))})),l(n.list),m(n.paging),u(!1)}catch(a){Z.Z.error(a.message),u(!1)}}};(0,v.useEffect)((()=>{y({page:1,silent:!1})}),[]),(0,v.useEffect)((()=>{y({page:1,silent:!1})}),[g]);const f={loading:p,fetch:y,filter:{category:g,scope:t},categories:h,setCategory:x,data:i,paging:d,showScope:s,scopeFormatter:c};return(0,k.jsx)(_,{value:{auditLogs:f},children:n})}function N(){const{auditLogs:e}=(0,v.useContext)(w);return e}var P,A=t(65402);const I=e=>{let{log:n,info:t,inService:a}=e;return a?"".concat(m.WELLKNOWN_BLOCKLET_ADMIN_PATH,"/members?did=").concat(n.actor.did):n.scope===t.did?"/team/members?did=".concat(n.actor.did):"/blocklets/".concat(n.scope,"/members?did=").concat(n.actor.did)};function B(e){var n,t;let{log:a}=e;const{inService:s,info:i}=(0,C.h6)(),{showScope:l,scopeFormatter:d=(e=>e)}=N();if(!a.actor.did)return null;const m=!["blocklet",""].includes(a.actor.role);return(0,k.jsxs)(p.Z,{className:"log-entry","data-cy":"log-entry",children:[(0,k.jsx)("div",{className:"log-author",children:m?(0,k.jsx)(r.Z,{did:a.actor.did,size:36,shape:"circle"}):(0,k.jsx)(r.Z,{did:a.actor.did,size:36})}),(0,k.jsxs)("div",{className:"log-body",children:[(0,k.jsxs)(u.Z,{className:"log-header",color:"textSecondary",component:"p",gutterBottom:!0,display:"flex",alignItems:"center",children:[l&&(0,k.jsx)(c.Link,{to:a.link,children:(0,k.jsx)(j.Z,{style:{marginRight:8},children:d(a.scope)})}),m?(0,k.jsxs)(c.Link,{to:I({log:a,inService:s,info:i}),target:"_blank",children:[a.actor.fullName,a.actor.role?"(".concat(a.actor.role,")"):""]}):(0,k.jsxs)("span",{children:[a.actor.fullName,a.actor.role?"(".concat(a.actor.role,")"):""]})," ",(0,k.jsx)("span",{style:{margin:"0 4px"},children:"-"})," ",a.action]}),(0,k.jsx)(u.Z,{className:"log-content",maxWidth:"lg",color:"textPrimary",component:"div","data-color-mode":"light",gutterBottom:!0,children:(0,k.jsx)(o.Z,{source:a.content,linkTarget:"_blank"})}),(0,k.jsxs)(p.Z,{className:"log-meta",variant:"body2",children:[!!a.ip&&(0,k.jsx)(u.Z,{component:"span",color:"textSecondary",children:"IP: ".concat(a.ip)}),!(null===(n=a.env.os)||void 0===n||!n.name)&&(0,k.jsxs)(u.Z,{component:"span",color:"textSecondary",children:[a.env.os.name,"(",a.env.os.version,")"]}),!(null===(t=a.env.browser)||void 0===t||!t.name)&&(0,k.jsxs)(u.Z,{component:"span",color:"textSecondary",children:[a.env.browser.name,"(",a.env.browser.version,")"]}),(0,k.jsx)(u.Z,{component:"span",color:"textSecondary",children:(0,k.jsx)(A.Z,{value:a.createdAt})})]})]})]})}function F(){const{t:e}=(0,d.PE)(),{data:n,loading:t,paging:a,filter:s,categories:c,setCategory:o,fetch:r}=N();return t?(0,k.jsx)("div",{style:{textAlign:"center",marginTop:"50px"},children:(0,k.jsx)(i.Z,{})}):(0,k.jsxs)(R,{"data-cy":"audit-logs",children:[(0,k.jsx)(p.Z,{className:"log-controls",children:(0,k.jsxs)(f.Z,{style:{width:"240px"},variant:"outlined",children:[(0,k.jsx)(y.Z,{children:e("common.filter")}),(0,k.jsx)(h.Z,{"data-cy":"filter-by-category-trigger",value:s.category,onChange:e=>o(e.target.value),fullWidth:!0,label:e("common.category"),disabled:t,children:c.map((e=>(0,k.jsx)(x.Z,{value:e.value,"data-cy":"filter-by-category-".concat(e.value),children:(0,k.jsx)(p.Z,{children:(0,k.jsx)("span",{children:e.label})})},e.label)))})]})}),0===n.length&&(0,k.jsx)(l.Z,{children:e("common.empty")}),n.length>0&&n.map((e=>(0,k.jsx)(B,{log:e},e.id))),a.pageCount>1&&(0,k.jsx)(g.Z,{page:a.page,count:a.pageCount,onChange:(e,n)=>r({page:n}),showFirstButton:!0,showLastButton:!0})]})}function z(e){let{scope:n,categories:t,showScope:a,scopeFormatter:s}=e;return(0,k.jsx)(K,{scope:n,categories:t,showScope:a,scopeFormatter:s,children:(0,k.jsx)(F,{})})}const R=s.Z.div(P||(P=(0,a.Z)(["\n .log-controls {\n display: flex;\n justify-content: space-between;\n }\n .log-entry {\n display: flex;\n margin: 16px 0;\n\n .log-author {\n margin-right: 8px;\n }\n\n .log-body {\n flex: 1;\n\n a {\n color: ",";\n }\n\n .log-header {\n }\n\n .log-content {\n p {\n margin-bottom: 4px;\n }\n ul,\n ol {\n padding-left: 2rem;\n }\n li {\n list-style-type: disc;\n }\n code.code-highlight {\n max-height: 300px;\n overflow: auto;\n }\n }\n\n .log-meta {\n margin-top: 4px;\n\n span {\n font-size: 0.8rem;\n display: inline-block;\n margin-right: 8px;\n padding-right: 8px;\n border-right: 1px solid #ccc;\n\n &:last-of-type {\n border-right: none;\n }\n }\n }\n }\n }\n"])),(e=>{let{theme:n}=e;return n.palette.primary.main}))},29054:(e,n,t)=>{t.d(n,{BlockletContext:()=>s,y0:()=>r});var a=t(5057);const s=(0,a.createContext)({}),{Provider:c,Consumer:o}=s;function r(){return(0,a.useContext)(s)}},71363:(e,n,t)=>{t.d(n,{Z:()=>p});var a=t(55898),s=t.n(a),c=t(11750),o=t(47020),r=t(93938),i=t(68420),l=t(50185),d=t(70461),m=t(96266);function p(e){let{title:n,description:t,confirmPlaceholder:a,cancel:s,confirm:p,params:u,onCancel:g,onConfirm:x,keyName:h}=e;const{t:y}=(0,i.PE)(),f={title:()=>(0,m.jsxs)("div",{children:[n," (".concat(h,")")]}),description:(e,n)=>(0,m.jsxs)("div",{children:[(0,m.jsx)(r.Z,{severity:"warning",style:{width:"100%"},children:y("common.notice")}),(0,m.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:t}}),(0,m.jsxs)("div",{style:{marginBottom:24},children:[y("common.click"),"\uff1a",(0,m.jsx)(l.Z,{"data-cy":"click-copy",children:h})]}),(0,m.jsx)(c.Z,{component:"div",children:(0,m.jsx)(o.Z,{label:a,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:t=>{var a;a={...e,inputVal:t.target.value,__disableConfirm:h!==t.target.value},n({...a,__disableConfirm:a.__disableConfirm})}})})]}),confirm:p,cancel:s,onConfirm:x,onCancel:g,params:{inputVal:"",__disableConfirm:!0,...u}};return(0,m.jsx)(d.Z,{title:f.title,description:f.description,confirm:f.confirm,cancel:f.cancel,params:f.params,onConfirm:f.onConfirm,onCancel:f.onCancel})}p.propTypes={title:s().any.isRequired,keyName:s().any.isRequired,description:s().any.isRequired,confirmPlaceholder:s().any.isRequired,cancel:s().string,confirm:s().string,params:s().object,onCancel:s().func,onConfirm:s().func.isRequired},p.defaultProps={onCancel:()=>{},cancel:"",confirm:"Confirm",params:{}}},22228:(e,n,t)=>{t.d(n,{Z:()=>r});var a=t(55898),s=t.n(a),c=t(19778),o=t(96266);function r(e){let{children:n,style:t,...a}=e;return(0,o.jsx)(c.Z,{style:t,...a,children:n})}r.propTypes={children:s().any.isRequired,style:s().object},r.defaultProps={style:{}}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4906],{44906:(e,t,n)=>{n.r(t),n.d(t,{default:()=>se});var o=n(71171),r=n(5057),i=n(6352),s=n.n(i),a=n(33518),l=n(67654),c=n(11750),d=n(39948),u=n(39434),m=n(68420),p=n(5952),h=n(75793),f=n(38898),x=n(52439),y=n(71569),g=n(77121),b=n(35432),v=n(44727),j=n(4651),Z=n(74094),k=n(85493),R=n(38242),C=n(44846),P=n(28726),w=n(49983),S=n(86229),D=n(76811),N=n(23484),E=n(34937);var T=n(7199),F=n(10458),_=n.n(F),q=n(13128),U=n(73170),A=n(96266);function L(e){let{meta:t,onCancel:n,handlePaySuccess:o,storeUrl:i}=e;const{t:a}=(0,m.PE)(),{info:l}=(0,h.h6)(),[d,u]=(0,r.useState)("both"),[p,f]=(0,r.useState)(1),x=(0,Z.yP)(l),y=(0,j.FM)(t,l,i),g=()=>{o(y)},b=(0,R.getDisplayName)({meta:t});if("purchase"===d&&2===p)return(0,A.jsx)(w.Z,{open:!0,popup:!0,baseUrl:i,action:"acquire-asset",checkFn:_().create({baseURL:s()(i,"/store")}).get,onSuccess:g,onClose:n,checkTimeout:3e5,extraParams:{factory:t.nftFactory},webWalletUrl:x,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:a("store.purchase.auth.title",{name:b}),scan:a("store.purchase.auth.scan"),confirm:a("store.purchase.auth.confirm"),success:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(c.Z,{gutterBottom:!0,children:a("store.purchase.auth.success")}),(0,A.jsxs)(c.Z,{variant:"subtitle2",children:[" ",a("store.purchase.autoLaunch",{name:b})]})]})}});const v=q.ZP;return(0,A.jsx)(v,{title:a("store.purchase.title",{name:b}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:(e,t)=>{"backdropClick"!==t&&n()},children:(0,A.jsx)("div",{style:{marginBottom:16},children:(0,A.jsx)(U.AP,{action:d,onNext:()=>{d&&(f(2),"verify"===d&&(window.location.href=y))},onSelect:e=>{e!==d&&u(e)}})})})}L.defaultProps={handlePaySuccess:e=>{setTimeout((()=>{window.location.href=e}),1e3)}};const W=L;var B,M=n(25339);function z(e){let{meta:t,buttonText:n,storeUrl:o}=e;const{t:i}=(0,m.PE)(),s=(0,k.useNavigate)(),{info:a}=(0,h.h6)(),{api:c}=(0,M.Tt)(),d=!1===(0,R.isFreeBlocklet)(t),[u,p]=(0,r.useState)(!1),{hasPurchased:f}=function(e){const t=(0,N.Z)(),n=(0,k.useNavigate)(),[o,i]=(0,l.Z)("sid:blocklet:purchase:".concat(e)),[s,a]=(0,r.useState)(!1),[c,d]=(0,r.useState)(null),u=()=>{const{pathname:e,searchParams:t}=new URL(window.location.href),o=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";t.get("sid")&&(i(""),n(e.replace(o,"/"),{replace:!0}))},m=!(!t.get("assetDid")||!o||t.get("sid")!==o);return(0,E.mU)(D.BlockletEvents.purchaseChange,(t=>{t.did===e&&(d(t.session),["declined","confirmed","error"].includes(t.session.status)&&(a(!0),setTimeout(u,2e3)))})),(0,r.useEffect)((()=>{c&&c.id!==o&&i(c.id)}),[c]),{hasCompleted:s,hasPurchased:m,session:c,setSession:d,doRedirect:u}}(t.did),[x,y]=(0,r.useState)(!1),[g]=(0,l.Z)("instant-blocklet-install",!1),[b,F]=(0,r.useState)(!1),_=(0,r.useMemo)((()=>u?i(d?"blocklet.status.purchasing":"blocklet.status.waiting"):""),[u,i,d]),q=(0,r.useMemo)((()=>d?n.purchase:n.launch),[d,n]),U=e=>{e.preventDefault(),e.stopPropagation();try{if(p(!0),d)return void y(!0);if(g)return void F(!0);if(!d){const e=(0,j.FM)(t,a,o);return void(window.location.href=e)}}catch(n){S.Z.error((0,Z.Z)(n),{autoHideDuration:5e3}),console.error("Blocklet installed failed",n)}finally{p(!1)}};return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(v.Kk,{children:(0,A.jsx)(T.Z,{permission:"mutate_blocklets",children:e=>(0,A.jsx)(P.Z,{onClick:U,size:"small",disabled:Boolean(_||!e),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(C.Z,{size:16,style:{marginRight:3}}),_]}):q},t.did)})}),(f||x)&&(0,A.jsx)(W,{method:"launch",meta:t,mode:"both",onCancel:()=>{p(!1),y(!1)},storeUrl:o}),b&&(0,A.jsx)(w.Z,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:c.get,checkTimeout:3e5,onSuccess:e=>{p(!1),F(!1),s("/blocklets/".concat(e.appDid,"/components"))},extraParams:{title:t.title,blockletMetaUrl:decodeURIComponent((0,Z.Rn)(o,t.did).trim())},messages:{title:i("setup.keyPair.title"),scan:i("setup.keyPair.scan"),confirm:i("setup.keyPair.confirm"),success:i("setup.keyPair.success")},onClose:()=>{p(!1),F(!1)}})]})}z.defaultProps={};const I=(e,t,n)=>{const o=(0,j.RU)(t);return s()(n,"/blocklets/".concat(e.did,"/?server-url=").concat(o))},H=e=>{let{meta:t,attribute:n,value:o}=e;return t._formatted?t._formatted[n]:o};function K(e){let{blocklet:t,endpoint:n}=e;const{t:o}=(0,m.PE)(),r=(0,h.h6)();let i=s()(r.imgPrefix,"blocklet.png");const a=n;if(a.startsWith("http")&&t.logo)i=s()(a,(0,Z.lk)(t.did,t.logo));else{let e=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");e&&(e="/".concat(e)),i=s()(e,"/blocklet/logo/".concat(t.did))}const l=(null===r||void 0===r?void 0:r.info.mode)!==b.NODE_MODES.SERVERLESS,c={meta:t,buttonText:{purchase:o("common.purchase"),launch:o("common.launch")},storeUrl:a};return(0,A.jsx)(f.Z,{href:I(t,r.info,n),style:{color:"initial",textDecoration:"none"},onClick:e=>!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1),target:"_blank",children:(0,A.jsx)(V,{title:H({meta:t,attribute:"title",value:t.title||t.name}),did:t.did,description:H({meta:t,attribute:"description",value:t.description}),cover:t.logo?i:"",version:t.version,button:l?(0,A.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,A.jsx)(z,{...c})}):null})})}function O(e){var t;let{storeUrl:n,handleSearchSelect:o,extraFilter:i,...s}=e;const{locale:a}=(0,m.PE)(),l=(0,h.h6)(),[c,d]=(0,r.useState)({}),u=n,p=null===l||void 0===l||null===(t=l.info)||void 0===t?void 0:t.version;return(0,r.useEffect)((()=>{d({})}),[u]),(0,A.jsx)(x.ErrorBoundary,{FallbackComponent:y.H,resetKeys:[u],children:(0,A.jsx)("div",{...s,children:(0,A.jsx)(g.Z,{blockletRender:e=>{const t={...e,endpoint:u};return(0,A.jsx)(K,{...t})},baseSearch:!0,endpoint:u,locale:a,onFilterChange:e=>{d(e)},onSearchSelect:o,filters:c,extraFilter:i,serverVersion:p})})})}K.defaultProps={endpoint:""},O.defaultProps={handleSearchSelect:null,extraFilter:void 0};const V=(0,a.Z)(v.ZP)(B||(B=(0,o.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(e=>e.theme.palette.primary.main));var $=n(92877),Q=n(19577),Y=n(2478),G=n(44067),J=n(46954),X=n(49390),ee=n(22714),te=n(45170);const ne=(0,$.Z)((()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}))),oe=(0,r.forwardRef)(((e,t)=>{let{onChange:n,onDelete:o}=e;const{info:i}=(0,h.h6)(),{t:s}=(0,m.PE)(),[a,d]=(0,r.useState)(!1),[u,f]=(0,r.useState)(!1),[x,y]=(0,r.useState)(-1),g=ne(),[b,v]=(0,l.Z)(p.WC),j=Math.max(i.blockletRegistryList.findIndex((e=>e.url===b)),0);return(0,r.useImperativeHandle)(t,(()=>({setOpen:f}))),(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(T.Z,{permission:"mutate_node",children:e=>(0,A.jsx)(P.Z,{disabled:!e,classes:{text:g.buttonText},color:"secondary","data-cy":"store-toggle",onClick:()=>{f(!0)},endIcon:(0,A.jsx)(X.Z,{}),children:(0,A.jsx)(c.Z,{color:"secondary",children:i.blockletRegistryList[j].name})})}),(0,A.jsx)(q.ZP,{title:s("store.blockletRegistry.switchRegistry"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:u,onClose:()=>f(!1),children:(0,A.jsxs)(Q.Z,{className:g.tabPanel,children:[i.blockletRegistryList.map(((e,t)=>(0,A.jsxs)(Y.ZP,{button:!0,disabled:a,selected:j===t,"data-cy":"store-switch",onClick:()=>{a||(t!==j?(e=>{try{d(!0),y(e);const t=i.blockletRegistryList[e];v(t.url),n(t.url),f(!1)}catch(t){console.error(t),S.Z.error("".concat(s("store.blockletRegistry.changeFailed")," ").concat((0,Z.Z)(t)))}finally{d(!1)}})(t):f(!1))},children:[(0,A.jsx)(J.Z,{className:g.iconRoot,children:x===t&&a&&(0,A.jsx)(C.Z,{size:16})}),(0,A.jsx)(G.Z,{children:(0,A.jsx)(te.Z,{teamDid:i.did,store:e,onDelete:()=>o(e.url)})})]},e.url))),(0,A.jsx)(ee.Z,{disabled:a,onAdd:n,teamDid:i.did,blockletRegistryList:i.blockletRegistryList})]})})]})}));oe.defaultProps={onChange:()=>{},onDelete:()=>{}};const re=oe;var ie;function se(){const{t:e}=(0,m.PE)(),{info:t}=(0,h.h6)(),[n]=(0,l.Z)(p.WC),{blockletRegistryList:o}=t,i=o.find((e=>n===e.url))||o[0],[a,f]=(0,r.useState)(i.url),x=t.routing.adminPath,y=s()(window.location.origin,x),g=(0,r.useRef)(null);return(0,A.jsxs)(ae,{children:[(0,A.jsxs)(u.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,A.jsx)(c.Z,{color:"textPrimary",children:e("common.store")}),(0,A.jsx)(re,{ref:g,onChange:e=>f(e),onDelete:e=>{var n;a===e&&f(null===(n=t.blockletRegistryList[0])||void 0===n?void 0:n.url)}})]}),(0,A.jsx)(d.Z,{className:"store-header",display:"flex",justifyContent:"space-between",p:0,m:0,children:(0,A.jsx)(c.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:e("store.headerDescription")})}),(0,A.jsx)(O,{className:"blocklet-list",handleSearchSelect:e=>{let{detailUrl:t}=e;const n=new URL(t);n.searchParams.set("server-url",y);const o=document.createElement("a");o.setAttribute("target","_blank"),o.setAttribute("href",n.href),o.click()},storeUrl:a})]})}const ae=a.Z.main(ie||(ie=(0,o.Z)(["\n @media (max-width: ","px) {\n .store-header {\n flex-direction: column;\n margin-bottom: 32px !important;\n }\n\n .page-header {\n margin-bottom: 16px !important;\n }\n }\n .blocklet-list {\n aside:hover {\n height: calc(100vh - 235px);\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm))},73170:(e,t,n)=>{n.d(t,{$7:()=>x,AP:()=>g});var o=n(92877),r=n(55898),i=n.n(r),s=n(19577),a=n(2478),l=n(44067),c=n(46954),d=n(42507),u=n(40184),m=n(28726),p=n(76223),h=n(68420),f=n(96266);const x={meta:i().object.isRequired,onCancel:i().func.isRequired},y=(0,o.Z)((()=>({dialogAuth:{padding:"0 0 24px !important","& .auth-title":{textAlign:"center !important",marginBottom:"4px !important"},"& .auth-tip--scan":{textAlign:"center !important"}},iconRoot:{minWidth:48}})));function g(e){let{action:t,onSelect:n,onNext:o}=e;const r=y(),{t:i}=(0,h.PE)(),x=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s.Z,{className:r.tabPanel,children:x.map((e=>(0,f.jsxs)(a.ZP,{button:!0,selected:t===e.action,onClick:()=>n(e.action),children:[(0,f.jsx)(c.Z,{className:r.iconRoot,children:"purchase"===e.action?(0,f.jsx)(d.Z,{style:{color:"purchase"===t?p.Z.primary.main:"#AAA",fontSize:32}}):(0,f.jsx)(u.Z,{style:{color:"verify"===t?p.Z.primary.main:"#AAA",fontSize:32}})}),(0,f.jsx)(l.Z,{primary:e.title,secondary:e.description})]},e.action)))}),o&&(0,f.jsx)(m.Z,{fullWidth:!0,disabled:!t,variant:"contained",color:"primary",style:{marginTop:16},onClick:o,children:i("common.next")})]})}g.propTypes={action:i().oneOf(["both","purchase","verify"]).isRequired,onSelect:i().func.isRequired,onNext:i().func.isRequired}},50185:(e,t,n)=>{n.d(t,{Z:()=>c});var o=n(5057),r=n(55898),i=n.n(r),s=n(12937),a=n(68420),l=n(96266);function c(e){let{children:t,...n}=e;const{t:r}=(0,o.useContext)(a.RD);return(0,l.jsx)(s.Z,{tip:r("common.copyTip"),copiedTip:r("common.copiedTip"),...n,children:t})}c.propTypes={children:i().any.isRequired}},71363:(e,t,n)=>{n.d(t,{Z:()=>m});var o=n(55898),r=n.n(o),i=n(11750),s=n(47020),a=n(93938),l=n(68420),c=n(50185),d=n(70461),u=n(96266);function m(e){let{title:t,description:n,confirmPlaceholder:o,cancel:r,confirm:m,params:p,onCancel:h,onConfirm:f,keyName:x}=e;const{t:y}=(0,l.PE)(),g={title:()=>(0,u.jsxs)("div",{children:[t," (".concat(x,")")]}),description:(e,t)=>(0,u.jsxs)("div",{children:[(0,u.jsx)(a.Z,{severity:"warning",style:{width:"100%"},children:y("common.notice")}),(0,u.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:n}}),(0,u.jsxs)("div",{style:{marginBottom:24},children:[y("common.click"),"\uff1a",(0,u.jsx)(c.Z,{"data-cy":"click-copy",children:x})]}),(0,u.jsx)(i.Z,{component:"div",children:(0,u.jsx)(s.Z,{label:o,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:n=>{var o;o={...e,inputVal:n.target.value,__disableConfirm:x!==n.target.value},t({...o,__disableConfirm:o.__disableConfirm})}})})]}),confirm:m,cancel:r,onConfirm:f,onCancel:h,params:{inputVal:"",__disableConfirm:!0,...p}};return(0,u.jsx)(d.Z,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}m.propTypes={title:r().any.isRequired,keyName:r().any.isRequired,description:r().any.isRequired,confirmPlaceholder:r().any.isRequired,cancel:r().string,confirm:r().string,params:r().object,onCancel:r().func,onConfirm:r().func.isRequired},m.defaultProps={onCancel:()=>{},cancel:"",confirm:"Confirm",params:{}}},22714:(e,t,n)=>{n.d(t,{Z:()=>j});var o=n(5057),r=n(55898),i=n.n(r),s=n(92877),a=n(44846),l=n(13128),c=n(55372),d=n(11750),u=n(47020),m=n(2478),p=n(44919),h=n(68420),f=n(28726),x=n(88574),y=n(58238),g=n(14491),b=n(96266);const v=(0,s.Z)((e=>({addMenuItemRoot:{justifyContent:"center",color:e.palette.primary.main,lineHeight:"3.2"}})));function j(e){let{disabled:t,storeList:n,teamDid:r,onAdd:i}=e;const{api:s}=(0,y.h6)(),[j,Z]=(0,o.useState)(!1),[k,R]=(0,o.useState)(!0),[C,P]=(0,o.useState)(!1),[w,S]=(0,o.useState)(""),[D,N]=(0,o.useState)(""),{t:E}=(0,h.PE)(),T=v(),F=async()=>{Z(!0);try{const{isNew:e,decoded:t}=(0,g.bQ)(w,n);if(!e)throw new Error(E("store.blockletRegistry.haveSameRegistry"));await s.addBlockletStore({input:{teamDid:r,url:t}}),i(t),P(!1)}catch(e){const t="".concat(E("store.blockletRegistry.addFailed")," ").concat((0,g.Z)(e));N(t)}finally{Z(!1)}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(m.ZP,{button:!0,disabled:t,className:T.addMenuItemRoot,onClick:()=>{P(!0)},children:[(0,b.jsx)(p.Z,{font:!0}),(0,b.jsx)(d.Z,{variant:"inherit",children:E("store.blockletRegistry.addRegistry")})]}),(0,b.jsxs)(l.ZP,{title:E("store.blockletRegistry.addRegistry"),fullWidth:!0,maxWidth:"md",open:C,onClose:()=>P(!1),PaperProps:{style:{minHeight:"auto"}},actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.Z,{onClick:e=>{e.stopPropagation(),P(!1)},color:"inherit",children:E("common.cancel")}),(0,b.jsxs)(f.Z,{onClick:e=>{e.stopPropagation(),F()},color:"primary","data-cy":"install-blocklet-next-step",disabled:j||!w||k,variant:"contained",autoFocus:!0,children:[j&&(0,b.jsx)(a.Z,{size:16}),E("common.confirm")]})]}),children:[(0,b.jsx)("div",{style:{paddingTop:12,overflowY:"hidden"},children:(0,b.jsx)(c.Z,{component:"div",children:(0,b.jsx)(d.Z,{component:"div",children:(0,b.jsx)(u.Z,{label:E("store.blockletRegistry.registryUrl"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:w,onChange:e=>{N(null);let t=!1;e.target.value.trim()||(t=!0),e.target.value.trim()||N(E("store.blockletRegistry.registryUrlEmpty")),S(e.target.value),R(t)},disabled:j,onKeyPress:e=>{"Enter"===e.key&&(e.preventDefault(),e.target.value.trim()?F():N(E("store.blockletRegistry.registryUrlEmpty")))}})})})}),!!D&&(0,b.jsx)(x.Z,{type:"error",style:{width:"100%"},children:D})]})]})}j.propTypes={teamDid:i().string.isRequired,disabled:i().bool,storeList:i().array,onAdd:i().func},j.defaultProps={disabled:!1,storeList:[],onAdd:()=>{}}},45170:(e,t,n)=>{n.d(t,{Z:()=>j});var o=n(92877),r=n(11750),i=n(83580),s=n(94552),a=n(67680),l=n(55898),c=n.n(l),d=n(5057),u=n(96366),m=n(68420),p=n(47595),h=n(86229),f=n(58238),x=n(71363),y=n(14491),g=n(96266);function b(e){let{store:t,teamDid:n,onDelete:o}=e;const{api:r}=(0,f.h6)(),{t:i}=(0,m.PE)(),[s,l]=(0,d.useState)(!1),[c,b]=(0,d.useState)(null),v=(0,u.Z)(),j={keyName:t.url,title:i("store.blockletRegistry.deleteRegistry"),description:i("store.blockletRegistry.deleteDesc",{name:"<b>".concat(t.url,"</b>"),color:v.palette.error.main}),confirmPlaceholder:i("store.blockletRegistry.confirmDesc",{name:t.url}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:async()=>{try{l(!0),await r.deleteBlockletStore({input:{teamDid:n,url:t.url}}),o&&"function"===typeof o&&o()}catch(e){h.Z.error("Remove Blocklet Store Error: ".concat((0,y.Z)(e)))}finally{l(!1),b(null)}},onCancel:()=>{l(!1),b(null)}};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a.Z,{disabled:s,onClick:e=>{e.stopPropagation(),b(j)},size:"large",children:(0,g.jsx)(p.default,{})}),c&&(0,g.jsx)(x.Z,{keyName:c.keyName,title:c.title,description:c.description,confirmPlaceholder:c.confirmPlaceholder,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}b.propTypes={teamDid:c().string.isRequired,store:c().object.isRequired,onDelete:c().func},b.defaultProps={onDelete:()=>{}};const v=(0,o.Z)((()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})));function j(e){let{teamDid:t,store:n,onDelete:o}=e;const l=v();return(0,g.jsxs)("div",{className:l.menuName,children:[(0,g.jsx)(r.Z,{component:"span",variant:"subtitle1",style:{fontWeight:"400"},children:n.name}),(0,g.jsx)(r.Z,{className:"url",component:"span",variant:"inherit",children:"".concat(n.url)}),(0,g.jsxs)(i.Z,{children:[(0,g.jsx)(a.Z,{onClick:e=>{e.stopPropagation(),window.open(n.url)},size:"large",children:(0,g.jsx)(s.Z,{})}),!n.protected&&(0,g.jsx)(b,{store:n,onDelete:o,teamDid:t})]})]})}j.propTypes={teamDid:c().string.isRequired,store:c().shape({name:c().string.isRequired,url:c().string.isRequired,protected:c().bool}).isRequired,onDelete:c().func},j.defaultProps={onDelete:()=>{}}},5952:(e,t,n)=>{n.d(t,{K_:()=>o,WC:()=>r});const o="blocklet-add-component-registry",r="server-add-registry"}}]);
|
|
@@ -1 +0,0 @@
|
|
|
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),r=n(68420),c=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)),x=n(1722),k=n(35432),w=n(49983),P=n(58238),j=n(29054),B=n(73545),S=n(14491),E=n(4651),L=n(96266);const Z=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},_=(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(k.DEFAULT_DID_DOMAIN)))||"").replace(".".concat(k.DEFAULT_DID_DOMAIN),"");return l?i.replace(a,"".concat(l,"-").concat(n,".").concat(k.DEFAULT_IP_DOMAIN_SUFFIX)):i}return i.replace(t.meta.bundleDid,t.appPid)};function D(){const{t:e}=(0,r.PE)(),{api:t}=(0,B.T)(),{blocklet:n}=(0,j.y0)(),{inService:a}=(0,P.h6)(),[o,l]=(0,i.useState)(!1),[s,c]=(0,i.useState)(5),d=n&&n.structVersion!==k.APP_STRUCT_VERSION;return[d&&(0,L.jsxs)(v.Z,{type:"warning",style:{margin:"12px 0"},children:[(0,L.jsxs)(u.Z,{display:"flex",alignItems:"center",children:[(0,L.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=Z(n);if(t)return void y.Z.error(e("blocklet.migrate.tip.duplicate",{name:t}));l(!0)}catch(t){y.Z.error((0,S.Z)(t))}})(),style:{marginRight:8},children:e("blocklet.migrate.intro.l1")}),(0,L.jsx)("span",{children:e("blocklet.migrate.intro.l2")})]}),["l3","l4","l5","l6"].map((t=>(0,L.jsx)(u.Z,{display:"flex",alignItems:"center",children:e("blocklet.migrate.intro.".concat(t))},t)))]},"alert"),n&&(0,L.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=_(window.location,n,a);setTimeout((()=>{window.location.href=e}),5e3),c(5),setInterval((()=>{c((e=>e-1))}),1e3)},extraParams:{appDid:n.appDid,did:n.meta.did,wt:(0,E.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")]}D.propTypes={};var C,N=n(35966),A=n(43019),G=n(44846),T=n(78123),I=n(75793),O=n(17022),U=n(13671),K=n(74094),z=n(7199);const R=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(4435),n.e(9277)]).then(n.bind(n,99277)))),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(6490),n.e(8973)]).then(n.bind(n,5119)))),M=(0,i.lazy)((()=>Promise.all([n.e(7718),n.e(7020),n.e(4631),n.e(6547),n.e(506),n.e(1294),n.e(1633),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(1185),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(1494),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(5555)]).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(4240),n.e(5396),n.e(5804)]).then(n.bind(n,35804)))),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(3896),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(4240),n.e(5396),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:B}}=(0,U.y0)(),{refresh:S}=(0,I.h6)(),{t:E}=(0,r.PE)(),Z=(0,i.useCallback)((()=>(0,L.jsx)(V,{scope:a})),[a]),_=(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,C=e=>(0,K.bV)(e,_),A=e=>{t("/blocklets/".concat(a,"/").concat(e))},te=e=>{e&&j(e),B()},ne=!o||(0,K.wS)(o.status)?[]:(0,g.getAppMissingConfigs)(o);let ie=null;const oe=[{label:E("common.overview"),value:"overview"},{breadcrumbsLabel:E("common.components"),label:(0,L.jsx)(p.Z,{color:"error",variant:"dot",invisible:!ne.length,children:E("common.components")}),value:"components"}];if(w)ie=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(v.Z,{type:"error",variant:"icon",children:(0,K.Z)(w)}),(0,L.jsx)(h.Z,{onClick:()=>B(),children:(0,L.jsx)("span",{style:{textDecoration:"underline"},children:E("common.retry")})})]});else if(o){var le;const e={overview:(0,L.jsx)(R,{}),configuration:F,navigation:M,services:W,members:(0,L.jsx)($,{type:"blocklet",createPassportSvg:C}),passports:Y,components:X,"audit-logs":Z,logs:J,runtime:(0,L.jsx)(Q,{}),traffic:(0,L.jsx)(q,{client:P,did:a}),storage:(0,L.jsx)(H,{})};"configuration"===n&&(0,K.wS)(o.status)&&A("overview"),(0,K.wS)(o.status)||(oe.push({label:E("common.members"),value:"members"}),oe.push({label:E("common.passport"),value:"passports"}),oe.push({label:E("common.configuration"),value:"configuration"})),oe.push({label:E("common.auditLogs"),value:"audit-logs"}),o&&null!==(le=o.children)&&void 0!==le&&le.length&&o.structVersion===k.APP_STRUCT_VERSION&&oe.push({label:E("common.logs"),value:"logs"}),oe.push({label:E("common.configNavigation"),value:"navigation"}),oe.push({label:E("common.runtime"),value:"runtime"}),oe.push({label:E("common.traffic"),value:"traffic"}),oe.push({label:E("common.storage"),value:"storage"});(0,g.getBlockletServices)(o).length&&oe.splice(2,0,{label:E("blocklet.services"),value:"services"});const t=e[n]||e.overview;ie=(0,L.jsxs)(f.g,{type:"components",children:[!(0,g.isExternalBlocklet)(o)&&(0,L.jsx)(m.Z,{tabs:oe,current:n,onChange:A,scrollButtons:"auto"}),(0,L.jsx)("div",{className:"page-content",children:(0,L.jsx)(i.Suspense,{fallback:(0,L.jsx)(N.Z,{relative:"parent",children:(0,L.jsx)(G.Z,{})}),children:(0,i.isValidElement)(t)?t:(0,L.jsx)(t,{blocklet:o,onUpdate:te,createPassportSvg:C})})})]})}else ie=(0,L.jsx)(N.Z,{relative:"parent",children:(0,L.jsx)(G.Z,{})});const se=oe.find((e=>e.value===n)),re=o?O.G6:ee;return(0,L.jsx)(re,{teamDid:a,children:(0,L.jsxs)(ae,{children:[(0,L.jsxs)(d.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,L.jsx)(s.Link,{color:"textSecondary",to:"/blocklets",children:E("common.blocklets")}),(0,L.jsx)(s.NavLink,{to:"/blocklets/".concat(a,"/overview"),style:e=>e?{color:"inherit"}:{},children:E("common.detail")}),(0,L.jsx)(c.Z,{color:"textSecondary",children:se?se.breadcrumbsLabel||se.label:""})]}),(0,L.jsxs)(c.Z,{component:"div",className:"page-header",children:[(0,L.jsxs)(c.Z,{component:"h2",variant:"h4",className:"page-title",color:"textPrimary",children:[o?(0,L.jsx)(x.Z,{blocklet:o,style:{marginRight:16}}):null,o?(0,L.jsxs)(u.Z,{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1,children:[(0,L.jsx)(u.Z,{children:(0,g.getDisplayName)(o)}),"unknown"!==(null===o||void 0===o?void 0:o.status)&&(0,L.jsx)(b.Z,{size:"12px",status:o.status,source:o.source})]}):"".concat(E("common.blocklet")," ").concat(E("common.detail"))]}),(0,L.jsx)(z.Z,{permission:"mutate_blocklets",children:!!o&&!(0,g.isExternalBlocklet)(o)&&(0,L.jsx)(T.Z,{className:"page-actions",blocklet:o,onStart:()=>{},onComplete:e=>{let{action:n,error:a}=e;a?y.Z.error(a.message):"remove"===n?(S(),t("/blocklets")):B()},variant:"group"})})]}),(0,L.jsx)(D,{}),ie]})})}function ne(){const{did:e}=(0,l.useParams)();return e?(0,L.jsx)(U.$8,{did:e,children:(0,L.jsx)(A.wV,{children:(0,L.jsx)(te,{})})}):null}const ae=o.Z.main(C||(C=(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))},43019:(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),r=n(76811),c=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,c.y0)(),s=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,[r,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:r}}function g(){var e;let{deps:t,setLoading:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[],setLoading:()=>{}};const{blocklet:i}=(0,c.y0)(),[o,s]=(0,a.useState)([]),{api:r}=(0,p.h6)(),d=(0,m.debounce)((async()=>{try{if(n(!0),!i)return void s([]);const{backups:e}=await r.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(r.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:x,Consumer:k}=y;function w(e){let{children:t}=e;const{t:n}=(0,s.PE)(),{api:i}=(0,p.h6)(),{blocklet:o}=(0,c.y0)(),[m,v]=(0,a.useState)(!1),[y,k]=(0,a.useState)(!1),{spaceGateways:w}=h({refresh:y,setLoading:v}),P=b({appDid:null===o||void 0===o?void 0:o.appDid}),[j,B]=(0,a.useState)(!1),S=(0,a.useMemo)((()=>(0,d.mo)(null===o||void 0===o?void 0:o.environments)),[o,y,j]),[E,L]=(0,a.useState)(!1),{backups:Z}=g({deps:[P],setLoading:L}),[_,D]=(0,a.useState)(null===w||void 0===w?void 0:w.find((e=>e.endpoint===S))),[C,N]=(0,a.useState)(!1),A=function(){var e;let{deps:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{deps:[]};const{blocklet:n}=(0,c.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:[C]}),G=()=>{k((e=>!e))};return(0,f.jsx)(x,{value:{spaceGateways:w,selectedSpaceGateway:_,addSpaceGateway:async(e,t)=>{w.push({...e,loading:!0}),await i.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:e}}),S!==t&&await i.configBlocklet({input:{did:[o.meta.did],configs:[{key:r.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t}]}}),G(),D(e)},deleteSpaceGateway:async e=>{e&&(e.endpoint!==S?(await i.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:null===e||void 0===e?void 0:e.did}}),G(),D(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}}),S!==e.endpoint&&await i.configBlocklet({input:{did:[o.meta.did],configs:[{key:r.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"})),G()},refreshSpaceGateways:G,spaceGatewaysLoading:m,spaceGatewayIsSelected:e=>(null===e||void 0===e?void 0:e.endpoint)===S,updateAutoBackup:async e=>{await i.updateAutoBackup({input:{did:o.meta.did,autoBackup:e}}),N((e=>!e))},backupEndpoint:S,backupProgress:P,backups:Z,backupsLoading:E,refreshBackupEndpoint:()=>{B((e=>!e))},autoBackup:A},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:()=>c,Z3:()=>x,ag:()=>v,mo:()=>m,nD:()=>d,nU:()=>g,w2:()=>h});var a=n(82434),i=n.n(a),o=n(76811),l=n(65873),s=n(2842),r=n(60344);function c(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 r.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 r.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 r.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 x(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 r.hi.get((0,s.xn)(i.origin,"/__blocklet__.js?type=json"),{timeout:n.timeout}),c=null===(t=o.componentMountPoints.findLast((e=>"z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf"===e.did)))||void 0===t?void 0:t.mountPoint;if(!c)throw new Error("MountPoint(".concat(c,") not found"));const d=(0,s.xn)(i.origin,c);return n.withSearchParams&&i.searchParams.get("spaceDid")?(0,s.xn)(d,"?spaceDid=".concat(i.searchParams.get("spaceDid"))):d}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[8382],{43120:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r.Z});var r=n(70461)},30756:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r.Z});var r=n(71363)},24138:(e,t,n)=>{"use strict";n.d(t,{BZ:()=>g,ZN:()=>y});var r=n(5057),i=n(6352),a=n.n(i),o=n(35432),l=n(49714),s=n(41365),c=n.n(s),d=n(32243),m=n.n(d),u=n(68420),p=n(14491);const f=m()((e=>c()(a()(new URL(e).origin,o.WELLKNOWN_PING_PREFIX)))),h={};function x(e){let{urls:t,checkAccessible:n=c(),disableCache:i=!1}=e;const a=(0,r.useRef)(t.filter((e=>h[e])).map((e=>h[e]))),o=a.current.length===t.length,[s,d]=(0,r.useState)(o?a.current:[]),[m,u]=(0,r.useState)(!o),p=(0,r.useMemo)((()=>!m&&s.length?s[0]:null),[s,m]);return(0,r.useEffect)((()=>{if((null===t||void 0===t?void 0:t.length)>0&&!o){(async()=>{let e;if(u(!0),i)e=await(0,l.evaluateURLs)(t,{checkAccessible:n}),e.forEach((e=>{h[e.url]=e}));else{(await(0,l.evaluateURLs)(t.filter((e=>!h[e])),{checkAccessible:n})).forEach((e=>{h[e.url]=e})),e=t.map((e=>h[e])).sort(((e,t)=>t.score-e.score))}d(e),u(!1)})()}}),[t,i,o]),{urlsState:s,loading:m,recommendedUrlState:p,recommendedUrl:null===p||void 0===p?void 0:p.url}}function g(e){const{locale:t}=(0,r.useContext)(u.RD),n=(0,r.useMemo)((()=>e?(0,p.A6)({blocklet:e,params:(0,p.f0)(e,t)}):[]),[e,t]),{loading:i,recommendedUrlState:a,recommendedUrl:o}=x({urls:n,checkAccessible:f});return{urls:n,loading:i,recommendedUrlState:a,recommendedUrl:o}}function y(e){const t=(0,r.useMemo)((()=>e.map((e=>(0,p.Sk)(e)))),[e]),{urlsState:n,loading:i,recommendedUrl:a}=x({urls:t,checkAccessible:f});let o;if(i)o={domainsAccessibility:e.reduce(((e,t)=>({...e,[t]:{loading:!0}})),{}),recommendedDomain:null};else{var l;const e=n.reduce(((e,t)=>{const n=new URL(t.url).hostname;return e[n]={...t,domain:n},e}),{}),t=(null===(l=n.find((e=>e.accessible)))||void 0===l?void 0:l.url)||a;o={domainsAccessibility:e,recommendedDomain:t?new URL(t).hostname:null}}return o}},88382:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>ur});var r=n(71171),i=n(5057),a=n(33518),o=n(85493),l=n(11750),s=n(94464),c=n(68420),d=n(62219),m=n.n(d),u=n(74511),p=n(57156),f=n.n(p),h=n(35432),x=n(14491),g=n(4651),y=n(33234),j=n(75793),v=n(10155),b=n(74094),Z=n(96266);const C="Dashboard",w=(0,i.createContext)({}),{Provider:E,Consumer:P}=w,S=[C,h.DOMAIN_FOR_IP_SITE,h.DOMAIN_FOR_IP_SITE_REGEXP],_=(e,t)=>{if(e.name===h.DOMAIN_FOR_DEFAULT_SITE)return-1;if(t.name===h.DOMAIN_FOR_DEFAULT_SITE)return 1;const n=S.includes(e.name),r=S.includes(t.name);return n&&r?(0,b.W8)(e.name,t.name):n?-1:r?1:(0,b.W8)(e.name,t.name)},T=e=>{let{sites:t,nodePort:n}=e;const r=window.location.host,i=(t||[]).map((e=>{const{id:t,rules:i=[],corsAllowedOrigins:a=[]}=e;let{domain:o,domainAliases:l}=e;l=l||[],[h.DOMAIN_FOR_IP_SITE,h.DOMAIN_FOR_IP_SITE_REGEXP].includes(o)&&(o=C,l.find((e=>e.value===r))||l.unshift({protected:!1,value:r}));const s={id:t,name:o,type:"domain",items:[],domainAliases:l,isProtected:e.isProtected,corsAllowedOrigins:a};return(i||[]).forEach((e=>{const{id:t,isProtected:r,from:{pathPrefix:i},to:a}=e;if(a.type===h.ROUTING_RULE_TYPES.BLOCKLET){let e="";Number.parseInt(a.port,10)===Number.parseInt(n,10)?(e="Blocklet Server Dashboard",a.type=h.ROUTING_RULE_TYPES.DAEMON):e=a.did,s.items.push({id:t,name:f()(i||"/"),title:e,type:"rule",isProtected:r,pathPrefix:i,to:a})}else s.items.push({id:t,pathPrefix:i,name:f()(i||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:r,to:a})})),s.items=m()(s.items,(e=>e.name)),s})).sort(_),a=i.reduce(((e,t)=>{let{name:n}=t;return n.endsWith(h.BLOCKLET_SITE_GROUP_SUFFIX)&&([n]=n.split(".")),e[n]={...t,rules:t.items},e}),{});return{sites:i,siteMap:a}},R=function(){let{did:e,domain:t,mountPoint:n,siteMap:r,params:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!r)return null;const a=r[e];if(!a)return null;const o=t||(a.domainAliases||[])[0];if(!o)return null;let l=n;if(!l){const e=a.rules.filter((e=>!e.name.startsWith(h.WELLKNOWN_PATH_PREFIX)))[0];l=e?e.name:"/"}return(0,x.Sk)(o.value,l,i)},k=function(){let{did:e,mountPoint:t,siteMap:n,params:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!n)return[];const i=n[e];if(!i)return[];const a=i.domainAliases||[];if(!a.length)return[];let o=t;if(!o){const e=i.rules.filter((e=>!e.name.startsWith(h.WELLKNOWN_PATH_PREFIX)))[0];o=e?e.name:"/"}return a.map((e=>(0,x.Sk)(e.value,o,r)))},N=e=>{const t=e.map((e=>e.domain)).filter((e=>![h.DOMAIN_FOR_IP_SITE_REGEXP,h.DOMAIN_FOR_DEFAULT_SITE].includes(e)));let n=[];return e.forEach((e=>n.push(...e.domainAliases||[]))),n=n.map((e=>"string"===typeof e?{value:e,isProtected:!1}:e)),{domains:t,domainsAliases:n}};function A(e){let{children:t}=e;const n=(0,v.Z)(),{info:r}=(0,j.h6)(),[a,o]=(0,i.useState)([]),[l,s]=(0,i.useState)([]),[c,d]=(0,i.useState)([]),m=(0,u.Z)((async()=>{const{sites:e}=await n.getRoutingSites({input:{snapshotHash:""}}),t=e||[];await Promise.all(t.map((async e=>(e.domainAliases=await(0,g.Q6)(e.domainAliases,{getIP:y.Z}),e))));const r=N(t);o(t),s(r.domains),d([window.location.hostname,...r.domains,...r.domainsAliases.map((e=>e.value))])}),[r]),p=(e,t)=>{o((n=>n.map((n=>n.id===e?t.domain?t:{...t,domain:n.domain}:n))))},f={loading:m.loading,error:m.error,refresh:m.retry,api:n,actions:{addSite:async e=>{const t=await n.addRoutingSite({input:e});o(a.concat(t.site))},updateSite:async(e,t)=>{const r=await n.updateRoutingSite({input:{id:e,...t}});if(r.site&&r.site.id){const e=a.findIndex((e=>e.id===r.site.id));-1!==e&&(a.splice(e,1,r.site),o([].concat(a)))}},deleteSite:async e=>{await n.deleteRoutingSite({input:{id:e}}),o(a.filter((t=>t.id!==e)))},addDomainAlias:async(e,t,r)=>{const i=await n.addDomainAlias({input:{id:e,domainAlias:t,force:r}});p(e,i.site)},deleteDomainAlias:async(e,t)=>{const r=await n.deleteDomainAlias({input:{id:e,domainAlias:t}});p(e,r.site)},takeSnapshot:e=>n.takeRoutingSnapshot({input:{dryRun:!1,message:encodeURIComponent(e)}}),addRule:async(e,t)=>{const{site:r}=await n.addRoutingRule({input:{id:e,rule:t}});p(e,r)},updateRule:async(e,t)=>{const{site:r}=await n.updateRoutingRule({input:{id:e,rule:t}});p(e,r)},deleteRule:async(e,t)=>{const{site:r}=await n.deleteRoutingRule({input:{id:e,ruleId:t}});p(e,r)}}},{sites:h,siteMap:x}=T({sites:a,nodePort:r.port});return f.sites=h,f.siteMap=x,f.domains=l,f.allDomains=c,f.getBlockletUrl=e=>{let{did:t,domain:n,mountPoint:r,params:i}=e;return R({did:t,domain:n,mountPoint:r,siteMap:f.siteMap,params:i})},f.getBlockletUrls=e=>{let{did:t,mountPoint:n,params:r}=e;return k({did:t,mountPoint:n,siteMap:f.siteMap,params:r})},(0,Z.jsx)(E,{value:{routing:f},children:t})}function L(){const{routing:e}=(0,i.useContext)(w);return e}function U(e){const t=[h.DOMAIN_FOR_IP_SITE_REGEXP,h.DOMAIN_FOR_DEFAULT_SITE,h.DOMAIN_FOR_IP_SITE];return"undefined"!==typeof window&&"undefined"!==typeof window.location&&t.push(window.location.hostname),t.includes(e)}var I,D=n(39948),O=n(55673),F=n(49390),z=n(86229),B=n(28726),M=n(80506),W=n(47020),G=n(88574),q=n(44846),Y=n(44784),K=n(24065),H=n(43120);function V(){return null}function Q(e){let{confirm:t}=e;const[n,r]=(0,i.useState)(null),{t:a}=(0,c.PE)();return(0,Z.jsxs)(X,{children:[(0,Z.jsx)(V,{message:function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];let l="function"===typeof t?t(e,...i):t;return!l||("string"===typeof l&&(l={description:l}),r({title:a("common.noticeTitle"),description:a("common.leavePageTip"),confirm:a("common.confirm"),cancel:a("common.cancel"),onConfirm:()=>(e=>{if(e){let t=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";"/"===t?K.Z.push("".concat(e.pathname)):(t.endsWith("/")&&(t=t.substring(0,t.length-1)),K.Z.push("".concat(t).concat(e.pathname))),window.location.reload()}})(e),onCancel:()=>{r(null)},...l}),!1)}}),n&&(0,Z.jsx)(H.Z,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})]})}Q.defaultProps={confirm:null};const X=a.Z.div(I||(I=(0,r.Z)(["\n margin-bottom: 24px;\n .top-btns-alert {\n @media (max-width: ","px) {\n flex-direction: column;\n padding-bottom: 15px;\n padding-right: 20px;\n }\n }\n .top-btns-action {\n @media (max-width: ","px) {\n margin-right: 0px;\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm),(e=>e.theme.breakpoints.values.sm));var J,$=n(7199);function ee(e){let{children:t,...n}=e;return(0,Z.jsx)(te,{children:(0,Z.jsx)("form",{...n,children:t})})}const te=a.Z.div(J||(J=(0,r.Z)(["\n width: 100%;\n\n form {\n width: 100%;\n flex: 1;\n display: flex;\n flex-direction: column;\n\n .form-submit {\n margin-top: 32px;\n margin-right: 32px;\n width: 180px;\n }\n\n .form-actions {\n display: flex;\n @media (max-width: ","px) {\n flex-direction: column;\n width: 100%;\n button {\n width: 100%;\n margin-right: 0;\n }\n }\n }\n\n .form-item {\n margin-top: 16px;\n margin-right: 0;\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm));var ne;const re=e=>({name:e.name,description:e.description,registerUrl:e.registerUrl,webWalletUrl:e.webWalletUrl,nftDomainUrl:e.nftDomainUrl,diskAlertThreshold:e.diskAlertThreshold,enableWelcomePage:!1,enableBetaRelease:!1});function ie(e){let{onSaved:t,title:n,submit:r,disabled:a,...o}=e;const s=(0,j.h6)(),{t:d}=(0,c.PE)(),{control:m,handleSubmit:u,formState:p,reset:f}=(0,M.cI)({defaultValues:re(s.info)}),[x,g]=(0,i.useState)(""),[y,C]=(0,i.useState)(""),[w,E]=(0,i.useState)(!1),[P,S]=(0,i.useState)(s.info.autoUpgrade),[_,T]=(0,i.useState)(!!s.info.enableWelcomePage),[R,k]=(0,i.useState)(!!s.info.enableBetaRelease);(0,i.useEffect)((()=>{let e="";(p.isDirty||P!==s.info.autoUpgrade||_!==!!s.info.enableWelcomePage)&&(e=d("setting.unSavedTip")),C(e)}),[d,s,P,_,p]);const N=async e=>{g(""),E(!0);try{const n=await(0,v.Z)().updateNodeInfo({input:{...e,name:e.name.trim(),description:e.description.trim(),registerUrl:e.registerUrl.trim(),webWalletUrl:e.webWalletUrl.trim(),diskAlertThreshold:e.diskAlertThreshold,autoUpgrade:P,enableWelcomePage:_,enableBetaRelease:R}});await(0,b._v)(1e3),f(re(n.info)),"function"===typeof t&&t(n)}catch(n){g((0,b.Z)(n))}finally{E(!1)}},{errors:A}=p;return(0,Z.jsxs)(ae,{...o,children:[(0,Z.jsxs)(ee,{noValidate:!0,autoComplete:"off",onSubmit:u(N),children:[!!n&&(0,Z.jsx)(l.Z,{component:"h2",variant:"h5",className:"stepper-tip",children:n}),(0,Z.jsx)($.Z,{permission:"mutate_node",children:e=>{var t;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M.Qr,{name:"name",control:m,rules:{validate:e=>!!e.trim()||d("setting.form.nameRequired")},render:t=>{let{field:n}=t;return(0,Z.jsx)(W.Z,{variant:"outlined",label:d("setting.form.name"),placeholder:d("setting.form.namePlaceholder"),disabled:w||!e,"data-cy":"node-name-input",error:A.name&&!!A.name.message,helperText:A.name?A.name.message:"",margin:"normal",...n})}}),(0,Z.jsx)(M.Qr,{name:"description",control:m,rules:{validate:e=>!!e.trim()||d("setting.form.descriptionRequired")},render:t=>{let{field:n}=t;return(0,Z.jsx)(W.Z,{variant:"outlined",label:d("setting.form.description"),placeholder:d("setting.form.descriptionHolder"),disabled:w||!e,"data-cy":"node-description-input",error:A.description&&!!A.description.message,helperText:A.description?A.description.message:"",margin:"normal",...n})}}),(0,Z.jsx)(M.Qr,{name:"registerUrl",control:m,rules:{},render:t=>{let{field:n}=t;return(0,Z.jsx)(W.Z,{variant:"outlined",label:d("setting.form.registerUrl"),placeholder:d("setting.form.registerUrlPlaceholder"),disabled:w||!e,error:A.registerUrl&&!!A.registerUrl.message,helperText:A.registerUrl?A.registerUrl.message:"",margin:"normal",...n})}}),(0,Z.jsx)(M.Qr,{name:"nftDomainUrl",control:m,rules:{},render:t=>{let{field:n}=t;return(0,Z.jsx)(W.Z,{variant:"outlined",label:d("setting.form.nftDomainUrl"),placeholder:d("setting.form.nftDomainUrlPlaceholder"),disabled:w||!e,error:A.nftDomainUrl&&!!A.nftDomainUrl.message,helperText:A.nftDomainUrl?A.nftDomainUrl.message:"",margin:"normal",...n})}}),(0,Z.jsx)(M.Qr,{name:"webWalletUrl",control:m,rules:{},render:t=>{let{field:n}=t;return(0,Z.jsx)(W.Z,{variant:"outlined",label:d("setting.form.webWalletUrl"),placeholder:d("setting.form.webWalletUrlPlaceholder"),disabled:w||!e,error:A.webWalletUrl&&!!A.webWalletUrl.message,helperText:A.webWalletUrl?A.webWalletUrl.message:"",margin:"normal",...n})}}),(0,Z.jsx)(M.Qr,{name:"diskAlertThreshold",control:m,rules:{},render:t=>{let{field:n}=t;return(0,Z.jsx)(W.Z,{type:"number",variant:"outlined",label:d("setting.form.monitor.diskThreshold"),placeholder:d("setting.form.monitor.diskThresholdPlaceholder"),disabled:w||!e,error:A.diskAlertThreshold&&!!A.diskAlertThreshold.message,inputProps:{min:1,max:99},helperText:A.diskAlertThreshold?A.diskAlertThreshold.message:"",margin:"normal",...n})}}),(0,Z.jsx)(Y.Z,{checked:P,onChange:()=>S(!P),name:"autoUpgrade",disabled:!e,labelProps:{label:(0,Z.jsx)(l.Z,{children:(0,Z.jsx)("span",{children:d("setting.form.upgrade.switchLabel")})})},style:{marginTop:20}}),P&&(0,Z.jsx)(Y.Z,{checked:R,onChange:()=>k(!R),name:"enableBetaRelease",disabled:!e,labelProps:{label:(0,Z.jsx)(l.Z,{children:(0,Z.jsx)("span",{children:d("setting.form.upgrade.enableBetaRelease")})})},style:{marginTop:20}}),(null===(t=s.info)||void 0===t?void 0:t.mode)!==h.NODE_MODES.SERVERLESS&&(0,Z.jsx)(Y.Z,{checked:_,onChange:()=>T(!_),name:"enableWelcomePage",disabled:!e,labelProps:{label:(0,Z.jsx)(l.Z,{children:(0,Z.jsx)("span",{children:d("setting.form.welcome.switchLabel")})})},style:{marginTop:16}})]})}}),!!y&&(0,Z.jsx)(G.Z,{type:"warning",variant:"icon",children:y}),(0,Z.jsx)("div",{className:"form-actions",children:(0,Z.jsx)($.Z,{permission:"mutate_node",children:(0,Z.jsxs)(B.Z,{onClick:u(N),disabled:a||w,color:"primary",variant:"contained","data-cy":"submit-btn",className:"form-submit",children:[r," ",w?(0,Z.jsx)(q.Z,{size:16}):null]})})}),!!x&&(0,Z.jsx)(G.Z,{type:"error",variant:"icon",error:x,children:x})]}),y&&(0,Z.jsx)(Q,{confirm:d("setting.unSavedLeaveTip")})]})}ie.defaultProps={disabled:!1};const ae=a.Z.div(ne||(ne=(0,r.Z)(["\n display: flex;\n align-items: flex-start;\n width: 100%;\n max-width: 720px;\n"])));var oe;function le(){const{refresh:e,info:t}=(0,j.h6)(),{t:n}=(0,c.PE)(),[r,a]=(0,i.useState)(!1);(0,i.useEffect)((()=>{e({silent:!0})}),[]);return(0,Z.jsx)(se,{children:(0,Z.jsxs)(D.Z,{mb:4,children:[(0,Z.jsx)(ie,{onSaved:()=>{e({silent:!0}),z.Z.success(n("setting.saveSuccess"))},submit:n("common.saveChanges"),title:""}),(0,Z.jsx)(D.Z,{mt:6,style:{marginLeft:-8},children:(0,Z.jsxs)(B.Z,{onClick:()=>{a((e=>!e))},children:[n("common.readMore"),r?(0,Z.jsx)(O.Z,{}):(0,Z.jsx)(F.Z,{})]})}),r&&(0,Z.jsxs)(D.Z,{fontSize:12,color:"text.secondary",children:[(0,Z.jsxs)(D.Z,{children:[n("dashboard.runtimeConfig.blockletMaxMemoryLimit"),": ",t.runtimeConfig.blockletMaxMemoryLimit," MB"]}),(0,Z.jsxs)(D.Z,{children:[n("dashboard.runtimeConfig.daemonMaxMemoryLimit"),": ",t.runtimeConfig.daemonMaxMemoryLimit," MB"]}),(0,Z.jsxs)(D.Z,{children:[n("dashboard.runtimeConfig.proxyMaxMemoryLimit"),": ",t.runtimeConfig.proxyMaxMemoryLimit," MB"]})]})]})})}const se=a.Z.div(oe||(oe=(0,r.Z)(["\n .eula-btn {\n text-decoration-line: underline;\n margin-top: 32px;\n margin-bottom: 32px;\n }\n\n .danger-zone {\n margin-top: 1vw;\n width: 100%;\n max-width: 720px;\n }\n"])));var ce,de,me,ue=n(93938),pe=n(49384),fe=n(75760),he=n(33271),xe=n(84639),ge=n(27773),ye=n(30756);function je(e){const{t:t}=(0,c.PE)(),[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(null),{item:l,onDelete:s=(()=>{})}=e,{id:d,title:m}=l,u=(0,v.Z)(),p={keyName:d,title:t("setting.webhook.delTitle"),description:"".concat(t("setting.webhook.description",{name:"<b>".concat(m,"</b>"),id:"<b>".concat(d,"</b>")})),confirmPlaceholder:t("setting.webhook.confirm_desc",{name:d}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:async()=>{r(!0);try{await u.deleteWebHook({input:{id:d}}),s()}catch(e){console.error(e)}finally{r(!1),o(null)}},onCancel:()=>{r(!1),o(null)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(B.Z,{edge:"end",onClick:()=>o(p),size:"small",className:"rule-action",color:"error",children:[n?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(ge.default,{style:{fontSize:16}}),t("common.delete")]}),a&&(0,Z.jsx)(ye.Z,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}function ve(){const{api:e,imgPrefix:t}=(0,j.h6)(),{t:n,locale:r}=(0,i.useContext)(c.RD),[a,o]=(0,i.useState)([]),[l,s]=(0,i.useState)(null),d=(0,u.Z)((async()=>{const[{webhooks:t},{senders:n}]=await Promise.all([e.getWebHooks(),e.getWebhookSenders()]);return o(n),t})),m=d.value||[],{loading:p,error:f}=d,h=()=>{s(null)},x=t=>{const r={title:t.title,description:(e,t,r)=>{const i=e.list||[];return(0,Z.jsx)(be,{children:i.map(((e,a)=>(0,Z.jsx)(Ze,{children:(0,Z.jsx)(W.Z,{label:e.description,autoComplete:"off",variant:"outlined","data-cy":"webhook-input",fullWidth:!0,autoFocus:!0,style:{marginBottom:16},margin:"dense",value:e.value||e.defaultValue,onChange:o=>{e.required&&(e.disable=!0);const l=o.target.value.trim();var s;e.value=l,i[a]=e,l?(0,b.rg)(e.type,l)?(e.disable=!1,r("")):(e.disable=!0,r(n("setting.webhook.requiredError",{type:e.type}))):(e.required&&(e.disable=!0),r("")),s=[...i],t({list:s,__disableConfirm:s.some((e=>e.disable))})}})},e.name)))})},params:{list:t.params,__disableConfirm:!0},confirm:n("setting.webhook.add"),cancel:n("common.cancel"),onConfirm:n=>{t.params=n.list,(async t=>{try{await e.createWebHook({input:t}),d.retry()}catch(n){z.Z.error((0,b.Z)(n),{autoHideDuration:4e3}),console.error("create webhook error",n)}s(null)})(t)},onCancel:h};s(r)},g=e=>"slack"===e.type?(0,Z.jsx)("img",{src:"".concat(t,"/").concat(e.type,".png"),alt:"icon",style:{width:20,height:20}}):(0,Z.jsx)(he.Z,{}),y=[{label:n("setting.webhook.columns.description"),name:"id",verticalKeyAlign:"center",options:{sort:!1,customBodyRenderLite:e=>{const t=m[e],n=a.find((e=>e.name===t.name));return(0,Z.jsxs)("div",{style:{display:"flex",alignItems:"center",whiteSpace:"nowrap"},children:[g(t),(0,Z.jsxs)("div",{style:{marginLeft:10},children:[(0,Z.jsxs)("b",{children:["ID: ",t.id]}),(0,Z.jsx)("div",{children:n?n.description:null})]})]})}}},{label:n("setting.webhook.columns.params"),name:"params",options:{sort:!1,customBodyRenderLite:e=>{const t=m[e].params.map((e=>(0,Z.jsx)("div",{children:e.value})));return(0,Z.jsx)("div",{style:{display:"flex",alignItems:"center",whiteSpace:"nowrap"},children:t})}}},{label:n("setting.webhook.columns.createdAt"),name:"createdAt",options:{customBodyRenderLite:e=>{const t=m[e];return(0,Z.jsx)(pe.Z,{value:Number(t.createdAt),locale:r})}}},{label:n("common.actions"),align:"center",verticalKeyAlign:"center",options:{sort:!1,customBodyRenderLite:t=>{const r=m[t],i=a.find((e=>e.name===r.name))||{};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{item:{...r,title:i.title},onDelete:()=>{d.retry()}}),(0,Z.jsxs)(B.Z,{size:"small",color:"secondary",onClick:()=>{(async t=>{const n={webhookId:t.id,message:"This is a test notification in order to test the integration"};await e.sendTestMessage({input:n})})(r)},children:[(0,Z.jsx)(Ce,{}),n("setting.webhook.test")]})]})}}}];if(!m.length&&p)return(0,Z.jsx)("div",{style:{textAlign:"center",marginTop:"50px"},children:(0,Z.jsx)(q.Z,{})});if(!m.length&&f)return(0,Z.jsx)(ue.Z,{severity:"error",children:(0,b.Z)(f)});const v=a.map((e=>({icon:g(e),title:"".concat(n("common.add")," ").concat(e.title),onClick:()=>{x(e)}})));return(0,Z.jsxs)(be,{children:[l&&(0,Z.jsx)(H.Z,{color:"primary",title:l.title,description:l.description,confirm:l.confirm,params:l.params,onConfirm:l.onConfirm,onCancel:l.onCancel}),(0,Z.jsx)(fe.Z,{columns:y,data:m,locale:r,customButtons:v,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1}})]})}je.defaultProps={onDelete:()=>{}};const be=a.Z.div(ce||(ce=(0,r.Z)(["\n .button-addon {\n text-align: right;\n }\n\n .add-list {\n width: 420px;\n max-width: calc(100vw - 10px);\n text-align: left;\n background: #fff;\n border-radius: 5px;\n }\n"]))),Ze=a.Z.div(de||(de=(0,r.Z)(["\n display: flex;\n"]))),Ce=(0,a.Z)(xe.Z)(me||(me=(0,r.Z)(["\n font-size: 16px !important;\n margin-right: 3px;\n"])));var we,Ee,Pe=n(43681),Se=n.n(Pe),_e=n(64886),Te=n(19778),Re=n(17450),ke=n(52581);function Ne(e){let{title:t,description:n,children:r}=e;return(0,Z.jsxs)(Ae,{children:[(0,Z.jsxs)(l.Z,{component:"div",className:"danger-item-info",children:[(0,Z.jsx)(l.Z,{className:"title",component:"h3",variant:"h6",color:"textPrimary",gutterBottom:!0,children:t}),(0,Z.jsx)(l.Z,{className:"desc",component:"p",variant:"body1",color:"textSecondary",children:n})]}),(0,Z.jsx)(l.Z,{component:"div",className:"danger-item-action",children:r})]})}const Ae=a.Z.div(we||(we=(0,r.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n .danger-item-info {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n .title {\n word-break: break-word;\n }\n .desc {\n word-break: break-word;\n }\n }\n\n .danger-item-action {\n width: 160px;\n flex-shrink: 0;\n text-align: right;\n cursor: pointer;\n @media (max-width: ","px) {\n width: auto;\n margin-left: 10px;\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm));function Le(e){let{children:t,...n}=e;return(0,Z.jsx)(Ue,{...n,children:t})}const Ue=a.Z.div(Ee||(Ee=(0,r.Z)(["\n border: 1px solid #dedede;\n padding: 16px;\n"])));function Ie(e){let{action:t}=e;const{t:n}=(0,c.PE)(),{info:r,api:a}=(0,j.h6)(),[o,l]=(0,i.useState)(!1),[s,d]=(0,i.useState)(null);if("upgrade"===t&&!r.nextVersion)return null;const m={title:n("setting.form.".concat(t,".title"),{version:r.nextVersion}),description:n("setting.form.".concat(t,".dialog")),confirm:n("common.confirm"),cancel:n("common.cancel"),onConfirm:async()=>{try{l(!0),"upgrade"===t&&await a.upgradeNodeVersion(),"restart"===t&&await a.restartServer()}catch(e){z.Z.error((0,b.Z)(e))}finally{l(!1),d(null)}},onCancel:()=>{l(!1),d(null)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Le,{className:"danger-zone",children:(0,Z.jsx)(Ne,{title:n("setting.form.".concat(t,".title"),{version:r.nextVersion}),description:n("setting.form.".concat(t,".description")),children:(0,Z.jsxs)(B.Z,{onClick:()=>d(m),color:"error",variant:"outlined",size:"large",children:[o?(0,Z.jsx)(q.Z,{size:16,style:{marginRight:3}}):null,n("setting.form.".concat(t,".confirm"))]})})}),s&&(0,Z.jsx)(H.Z,{title:s.title,description:s.description,confirm:s.confirm,cancel:s.cancel,onConfirm:s.onConfirm,onCancel:s.onCancel})]})}var De=n(67654),Oe=n(74976),Fe=n(39067),ze=n(24103);function Be(){const{t:e}=(0,c.PE)(),{api:t}=(0,j.h6)(),[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(null),[s,d]=(0,De.Z)("last-check-server-version-time"),m=()=>{r(!1),o(null)},u={title:e("setting.form.upgrade.check"),description:e("setting.form.upgrade.latest"),confirm:e("common.confirm"),showCancel:!1,color:"primary",onConfirm:m,onCancel:m},p=async e=>{try{r(!0);const{version:n}=await t.checkNodeVersion();!n&&e&&o(u),d(Date.now())}catch(n){console.error("Failed to check new version: ".concat(n.message))}finally{r(!1)}};return(0,i.useEffect)((()=>{(!s||Date.now()-Number(s)>6e4)&&p(!1)}),[]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fe.Z,{sx:{ml:2},color:"primary",variant:"outlined",onClick:p,size:"small",loadingPosition:"end",loading:n,children:(0,Z.jsxs)(ze.Z,{direction:"row",alignItems:"center",spacing:.5,children:[(0,Z.jsx)(Oe.Z,{fontSize:"small"}),(0,Z.jsx)(l.Z,{component:"span",children:e("server.checkUpgrade")})]})}),a&&(0,Z.jsx)(H.Z,{title:a.title,description:a.description,confirm:a.confirm,showCancel:a.showCancel,color:a.color,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}var Me=n(78410);function We(){const{t:e}=(0,c.PE)(),{info:t}=(0,j.h6)();return(0,Z.jsx)(Le,{className:"danger-zone",children:(0,Z.jsx)(Ne,{title:e("blocklet.config.clearCache.name"),description:e("blocklet.config.clearCache.purpose"),children:(0,Z.jsx)(Me.Z,{teamDid:t.did,size:"large"})})})}var Ge,qe=n(26796),Ye=n(94874),Ke=n.n(Ye);const He="z8iZkFBbrVQxZHvcWWB3Sa2TrfGmSeFz9MSU7";function Ve(){const{t:e,locale:t}=(0,c.PE)(),{info:n}=(0,j.h6)(),r=(0,i.useRef)(null),a=(0,g.RU)(n),[o,l]=(0,i.useState)(!1),s=(0,i.useRef)(null),[d,m]=(0,i.useState)({}),{createdAt:u,did:p,description:f,name:h}=n,x=(0,i.useMemo)((()=>(0,b.i7)()),[]),y=(0,qe.default)((async()=>{var e;let{registerUrl:t}=n;localStorage.getItem("__registerUrl")&&(t=localStorage.getItem("__registerUrl"));const r=new URL(t);r.pathname="__blocklet__.js",r.searchParams.set("type","json");const{data:i}=await Ke().get(r.toString()),a=null===i||void 0===i||null===(e=i.componentMountPoints)||void 0===e?void 0:e.find((e=>e.did===He)),o=new URL(t);return o.pathname=(null===a||void 0===a?void 0:a.mountPoint)||"",o.toString()})),v={did:p,name:h,createdAt:u,description:f,url:a},C=(0,i.useMemo)((()=>d.type&&"notAdded"!==d.type),[d]),w=(0,i.useMemo)((()=>o?e("setting.form.register.detecting"):"update"===d.type?e("setting.form.register.update"):e(C?"setting.form.register.added":"setting.form.register.btn")),[o,d,t]),E=(0,i.useMemo)((()=>"update"!==d.type&&!!C),[d]),P=()=>{clearTimeout(s.current),l(!1),x&&r.current.contentWindow.postMessage({...v,action:"queryRegisterInfo"},"*")};if((0,i.useEffect)((()=>{let t;return window.addEventListener("message",t=t=>{const{data:n}=t;"launcher init"===n?P():"registerNode"===(null===n||void 0===n?void 0:n.action)&&(m(n),"addSucceed"===n.type&&z.Z.success(e("setting.form.register.addSucceed")),"updateSucceed"===n.type&&z.Z.success(e("setting.form.register.updateSucceed")))}),x&&(l(!0),s.current=setTimeout((()=>{z.Z.error(e("setting.form.register.timeout")),l(!1)}),6e3)),()=>{window.removeEventListener("message",t),clearTimeout(s.current)}}),[]),y.loading)return"";const S=y.value,_=x?(0,Z.jsx)(B.Z,{disabled:E,loading:o,onClick:()=>{r.current.contentWindow.postMessage({...v,action:"registerNode"},"*")},color:"primary",variant:"contained",size:"large",children:w}):(0,Z.jsx)(B.Z,{color:"primary",loading:o,component:"a",href:"".concat(S,"?register-server=").concat(encodeURIComponent(JSON.stringify(v))),target:"_blank",variant:"contained",size:"large",children:e("setting.form.register.btn")});return(0,Z.jsxs)(Qe,{children:[(0,Z.jsx)(Le,{className:"danger-zone",children:(0,Z.jsx)(Ne,{title:e(C?"setting.form.register.titleAdded":"setting.form.register.title"),description:e(C?"setting.form.register.descriptionOnAdded":"setting.form.register.description",{url:S}),children:_})}),x&&(0,Z.jsx)("iframe",{ref:r,src:"".concat(S,"?register-detect=1"),title:"register",style:{display:"none"}})]})}const Qe=a.Z.div(Ge||(Ge=(0,r.Z)(["\n .danger-zone {\n margin-top: 1vw;\n width: 100%;\n }\n"])));var Xe;function Je(){const e=(0,o.useNavigate)(),{api:t,info:n}=(0,j.h6)(),{t:r}=(0,c.PE)(),i=(0,u.Z)((async()=>{const e=await t.getNodeEnv();return Object.assign({},e.info||{})})),a=[];return a.push({name:r("dashboard.nodeDid"),value:(0,Z.jsx)(Re.Z,{did:n.did})},n.nodeOwner?{name:r("dashboard.ownerDid"),value:(0,Z.jsx)(Re.Z,{did:n.nodeOwner.did})}:null,{name:r("dashboard.routingEngine"),value:n.routing.provider}),i.value&&a.push({name:"".concat(r("common.os")),value:i.value.os},i.value.docker?{name:"".concat(r("common.docker")),value:(0,Z.jsx)(Te.Z,{type:"success",children:"Yes"})}:null,i.value.gitpod?{name:"".concat(r("common.gitpod")),value:(0,Z.jsx)(Te.Z,{type:"success",children:"Yes"})}:null),Array.isArray(Se()(i,"value.blockletEngines",null))&&i.value.blockletEngines.filter((e=>e.visible&&e.available)).forEach((e=>{a.push({name:e.displayName,value:e.version})})),(0,Z.jsxs)($e,{children:[(0,Z.jsx)($.Z,{permission:"mutate_node",children:e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(D.Z,{display:"flex",alignItems:"center",style:{marginBottom:24},children:[(0,Z.jsx)(D.Z,{width:50,height:50,children:(0,Z.jsx)("img",{src:ke.Z,height:50,alt:""})}),(0,Z.jsxs)(D.Z,{ml:2,children:[(0,Z.jsx)("h2",{style:{margin:0},children:n.name}),(0,Z.jsx)("p",{style:{margin:0,color:"#888"},children:n.description})]})]}),(0,Z.jsxs)(_e.Z,{style:{marginBottom:4},valueComponent:"div",nameWidth:150,name:r("common.version"),children:[n.version,e&&(0,Z.jsx)(Be,{})]},"version"),a.filter(Boolean).map((e=>(0,Z.jsx)(_e.Z,{valueComponent:"div",nameWidth:150,name:e.name,children:e.value},e.name))),e&&(0,Z.jsx)("div",{style:{maxWidth:720,marginBottom:"1vw"},children:(0,Z.jsx)(Ie,{action:"upgrade"})})]})}),(0,Z.jsx)($.Z,{permission:"mutate_node",children:e=>e&&(0,Z.jsx)("div",{style:{maxWidth:720,marginBottom:"1vw"},children:(0,Z.jsx)(Ie,{action:"restart"})})}),(0,Z.jsx)($.Z,{permission:"mutate_router",children:e=>e&&(0,Z.jsx)("div",{style:{maxWidth:720,marginBottom:"1vw"},children:(0,Z.jsx)(We,{})})}),(0,Z.jsx)($.Z,{permission:"mutate_blocklets",children:!!n.registerUrl&&(0,Z.jsx)("div",{style:{maxWidth:720,marginTop:"-1vw"},children:(0,Z.jsx)(Ve,{})})}),(0,Z.jsx)(D.Z,{mt:10,style:{marginLeft:-8},children:(0,Z.jsx)(B.Z,{className:"eula-btn",onClick:()=>{e("/eula")},children:r("common.goEULA")})})]})}const $e=a.Z.div(Xe||(Xe=(0,r.Z)(["\n display: flex;\n flex-direction: column;\n margin-top: 32px;\n"])));var et=n(19577),tt=n(44919),nt=n(52926),rt=n(34937),it=n(24138);const at=(0,i.createContext)({}),{Provider:ot,Consumer:lt}=at;function st(e){let{children:t,domains:n}=e;const r=(0,v.Z)(),a=JSON.stringify(n),[o,l]=(0,i.useState)({}),s=(0,i.useMemo)((()=>n.filter((e=>(0,b.rM)(e)))),[a]);(0,rt.mU)(h.EVENTS.DOMAIN_STATUS,(e=>{e&&l((t=>({...t,[e.domain]:{...t[e.domain],...e}})))}));const{domainsAccessibility:c,recommendedDomain:d}=(0,it.ZN)(s),m=(0,i.useMemo)((()=>{const e={...o};return Object.keys(c).forEach((t=>{const n=e[t]||{};e[t]={...n,...c[t]}})),e}),[o,c]),u=()=>{s.length>0&&r.checkDomains({input:{domains:s}})};(0,i.useEffect)((()=>{u()}),[s]);const p={refresh:u,updateStatus:e=>{e&&r.checkDomains({input:{domains:[e]}})},api:r,status:m,recommendedDomain:d,recommendedDomainStatus:m[d]};return(0,Z.jsx)(ot,{value:p,children:t})}function ct(){const{status:e,recommendedDomainStatus:t,recommendedDomain:n,updateStatus:r}=(0,i.useContext)(at);return{status:e,recommendedDomainStatus:t,recommendedDomain:n,updateStatus:r}}var dt=n(53906),mt=n(74490),ut=n(76811),pt=n(81010);const ft=e=>(Se()(e,"meta.interfaces")||[]).find((e=>e.type===ut.BLOCKLET_INTERFACE_TYPE_WEB));function ht(e){let{params:t,blocklets:n,setParams:r,setError:a,serviceTypes:o}=e;const{t:l}=(0,c.PE)(),s={301:l("common.redirectPermanently"),302:l("common.redirectTemporary"),307:l("common.redirectTemporary"),308:l("common.redirectPermanently")},d=m()(n,(e=>e.meta.name)),u=(e,n)=>{if(!n)return{};let{port:r}=e;n&&e.ports&&n.port&&(e.ports[n.port]&&(r=e.ports[n.port]),e.ports[n.port.internal]&&(r=e.ports[n.port.internal]));let{pathPrefix:i}=t;return n&&n.prefix!==ut.BLOCKLET_DYNAMIC_PATH_PREFIX&&(i=n.prefix),{port:r,pathPrefix:i}},p=e=>{const t=d.find((t=>t.meta.did===e)),n=ft(t);return{...u(t,n),interfaceName:n?n.name:""}};return(0,i.useEffect)((()=>{t.interfaceName||t.type!==h.ROUTING_RULE_TYPES.BLOCKLET||r({...t,...p(t.did),__disableConfirm:!1})}),[]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W.Z,{select:!0,label:l("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:t.type,onChange:e=>{a(""),r({...t,type:e.target.value,__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:o.map((e=>{let{name:t,value:n}=e;return(0,Z.jsx)(mt.Z,{value:n,children:t},n)}))}),t.type===h.ROUTING_RULE_TYPES.BLOCKLET&&(0,Z.jsxs)(W.Z,{select:!0,label:l("router.domain.add.blocklet"),autoComplete:"off",variant:"outlined",name:"did","data-cy":"domain-blocklet-select",fullWidth:!0,value:t.did,onChange:e=>{r({...t,...p(e.target.value),did:e.target.value,__disableConfirm:!1})},style:{marginBottom:32},children:[d.map((e=>(0,Z.jsxs)(mt.Z,{value:e.meta.did,children:["".concat(e.meta.name," v").concat(e.meta.version),(0,Z.jsx)("span",{style:{marginLeft:8},children:(0,Z.jsx)(pt.Z,{status:e.status})})]},e.meta.did))),0===n.length&&(0,Z.jsx)(mt.Z,{value:"",children:l("common.empty")},"empty")]}),t.type===h.ROUTING_RULE_TYPES.REDIRECT&&[(0,Z.jsx)(W.Z,{select:!0,label:l("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:t.redirectCode,onChange:e=>r({...t,redirectCode:e.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(s).map((e=>(0,Z.jsx)(mt.Z,{value:e,children:"".concat(s[e]," - ").concat(e)},e)))}),(0,Z.jsx)(W.Z,{label:l("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"redirect-url-input",fullWidth:!0,autoFocus:!0,value:t.url,helperText:l("router.urlHelperText"),style:{marginBottom:32},onChange:e=>{r({...t,url:e.target.value,__disableConfirm:!e.target.value.trim()}),e.target.value.trim()?a(""):a(l("router.validation.redirectUrlRequired"))}})]]})}ht.defaultProps={params:{},blocklets:[],serviceTypes:[{name:"Blocklet",value:h.ROUTING_RULE_TYPES.BLOCKLET},{name:"Redirect",value:h.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:h.ROUTING_RULE_TYPES.NONE}],setParams:()=>{},setError:()=>{}};var xt=n(44543),gt=n.n(xt);const yt=(e,t)=>{if(e.type===h.ROUTING_RULE_TYPES.REDIRECT){if(!e.url)return new Error("".concat(t("router.validation.redirectUrlRequired")));if(!e.redirectCode)return new Error("redirect ".concat(t("router.validation.redirectCodeRequired")))}else if(e.type===h.ROUTING_RULE_TYPES.BLOCKLET&&!e.did)return new Error(t("router.validation.didRequired"));return null},jt=(e,t)=>e?e.endsWith(h.DEFAULT_IP_DOMAIN_SUFFIX)?t("router.domain.validate.suffixTip",{suffix:h.DEFAULT_IP_DOMAIN_SUFFIX}):null:t("router.domain.validate.emptyTip"),vt=(e,t)=>{const n=yt(e,t);if(n)return n;const r=jt(e.domain,t);return r?new Error(r):null},bt=(e,t)=>{const n=yt(e,t);return n||(e.pathPrefix.length?e.pathPrefix.length>150?new Error(t("router.validation.pathPrefixTooLong",{length:150})):null:new Error(t("router.validation.pathPrefixCannotBeEmpty")))},Zt=e=>{let{params:t,blocklets:n,blocklet:r,locale:i="en"}=e;if(r){let e=(r.children||[]).find((e=>gt()(e.mountPoint,t.pathPrefix)));if("gateway"!==r.meta.group&&"/"===t.pathPrefix&&(e="/"),e)return{zh:"\u6302\u8f7d\u70b9 ".concat(t.pathPrefix," \u5df2\u5b58\u5728\uff0c\u8bf7\u4f7f\u7528\u5176\u4ed6\u6302\u8f7d\u70b9"),en:"The mount point ".concat(t.pathPrefix," already exist, please use another mount point")}[i]}const a=n.find((e=>e.meta.did===t.did));if(!a)return"";const o=a.meta.interfaces.find((e=>"web"===e.type));return o&&o.prefix!==ut.BLOCKLET_DYNAMIC_PATH_PREFIX&&t.pathPrefix!==o.prefix?{zh:"\u8be5 blocklet \u53ea\u80fd\u6302\u8f7d\u5728 ".concat(o.prefix),en:"This blocklet can only be mounted on ".concat(o.prefix)}[i]:""},Ct=e=>{if(0===e.length)return"";const{searchParams:t}=new URL(window.location.href),n=t.get("fromDid");if(n){const t=e.find((e=>e.meta.did===n));if(t)return t.meta.did}return e[0].meta.did};function wt(e){let{blocklets:t,onActivate:n=(()=>{}),children:r}=e;const{t:a}=(0,c.PE)(),{actions:o}=L(),{info:s}=(0,j.h6)(),[d,m]=(0,i.useState)(!1),[u,p]=(0,i.useState)(null),f={title:a("router.domain.addSite"),description:(e,n,r)=>{const i=e=>{const t=e.__disableConfirm||!!vt(e,a);n({...e,__disableConfirm:t})};return(0,Z.jsxs)(l.Z,{component:"div",children:[(0,Z.jsx)(W.Z,{label:a("router.domain.add.description"),autoComplete:"off",variant:"outlined",name:"domain",fullWidth:!0,autoFocus:!0,value:e.domain,style:{marginTop:16,marginBottom:32},inputProps:{"data-cy":"domain-name-input"},onChange:t=>{const n=t.target.value.trim(),o=jt(n,a);i({...e,domain:t.target.value,__disableConfirm:!!o}),r(o||"")}}),(0,Z.jsx)(ht,{blocklets:t,params:e,setParams:i,setError:r})]})},confirm:a("router.domain.add.confirm"),cancel:a("router.domain.add.cancel"),params:{domain:"",did:Ct(t),port:"",interfaceName:"",type:h.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:302,__disableConfirm:!0},onConfirm:async e=>{m(!0);const n={from:{pathPrefix:"/"},to:{type:e.type}},r={domain:e.domain.trim()===s.ip?"":e.domain.trim()};if(e.type===h.ROUTING_RULE_TYPES.BLOCKLET){const i=t.find((t=>t.meta.did===e.did)),a=Se()(i,"meta.interfaces",[]).find((t=>t.name===e.interfaceName));a&&a.prefix!==ut.BLOCKLET_DYNAMIC_PATH_PREFIX&&(n.from.pathPrefix=a.prefix),n.to.port=e.port,n.to.did=e.did,n.to.interfaceName=e.interfaceName,r.rules=[n]}else e.type===h.ROUTING_RULE_TYPES.REDIRECT&&(n.to.url=e.url,n.to.redirectCode=e.redirectCode,r.rules=[n]);await o.addSite(r),m(!1),p(null)},onCancel:()=>{m(!1),p(null)}},x=e=>{e.stopPropagation(),p(f)||n()};return(0,i.useEffect)((()=>{const{searchParams:e}=new URL(window.location.href);e.get("fromDid")&&p(f)}),[]),(0,Z.jsxs)(Z.Fragment,{children:["function"===typeof r?r({loading:d,open:x}):(0,Z.jsxs)(mt.Z,{onClick:x,className:"rule-action","data-cy":"action-add-domain",children:[d?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(dt.Z,{style:{fontSize:18,marginRight:5}}),a("router.domain.add.title")]}),u&&(0,Z.jsx)(H.Z,{title:u.title,description:u.description,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel,color:"primary"})]})}wt.defaultProps={onActivate:()=>{},children:null,blocklets:[]};var Et=n(15849),Pt=n(82434),St=n.n(Pt),_t=n(76005),Tt=n(8732),Rt=n(21017),kt=n(50725),Nt=n(75239),At=n(2478),Lt=n(46954),Ut=n(44067),It=n(38898),Dt=n(83580),Ot=n(48342),Ft=n(76720),zt=n(92273),Bt=n(38242),Mt=n(61533),Wt=n(83294),Gt=n(67680);function qt(e){const{t:t}=(0,c.PE)(),{actions:n}=L(),[r,a]=(0,i.useState)(!1),[o,l]=(0,i.useState)(null),{id:s,name:d}=e;if(U(d))return null;const m={title:t("router.domain.delete.title"),description:t("router.domain.delete.description",{name:"<b>".concat(d,"</b>")}),confirmPlaceholder:t("router.domain.delete.confirm_desc",{name:d}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:async()=>{a(!0),await n.deleteSite(s),a(!1),l(null)},onCancel:()=>{a(!1),l(null)},keyName:d};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(mt.Z,{onClick:t=>{t.stopPropagation(),l(m)||e.onActivate()},className:"rule-action","data-cy":"action-delete-domain",children:[r?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(ge.default,{style:{fontSize:18,marginRight:5}}),t("router.domain.delete.title")]}),o&&(0,Z.jsx)(ye.Z,{keyName:o.keyName,title:o.title,description:o.description,confirmPlaceholder:o.confirmPlaceholder,confirm:o.confirm,cancel:o.cancel,params:o.params,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}var Yt=n(45239),Kt=n.n(Yt);function Ht(e){let{id:t,blocklets:n,onActivate:r=(()=>{}),onRuleAdded:a=(()=>{}),children:o,teamDid:s}=e;const{t:d}=(0,c.PE)(),{actions:m}=L(),[u,p]=(0,i.useState)(!1),[f,g]=(0,i.useState)(null),y={title:d("router.rule.add.title"),description:(e,t,r)=>(0,Z.jsxs)(l.Z,{component:"div",children:[(0,Z.jsx)(W.Z,{label:d("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix","data-cy":"path-prefix-input",fullWidth:!0,autoFocus:!0,helperText:e.helperText||d("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:e.pathPrefix,onChange:i=>{let a=!1;const o=Zt({params:{...e,pathPrefix:i.target.value},blocklets:n});r(o),e.type===h.ROUTING_RULE_TYPES.BLOCKLET&&o&&(a=!0),e.type!==h.ROUTING_RULE_TYPES.REDIRECT||e.url||(a=!0),i.target.value.trim()||(a=!0,r(d("router.validation.pathPrefixRequired"))),a||r("");const l=d("common.slugifyHint",{value:(0,x.LN)(i.target.value)});t({...e,pathPrefix:i.target.value,helperText:l,__disableConfirm:a})}}),(0,Z.jsx)(ht,{blocklets:n,params:e,setParams:e=>{r(null);bt(e,d)?t({...e,__disableConfirm:!0}):t({...e})},setError:r})]}),confirm:d("router.rule.add.confirm"),cancel:d("common.cancel"),params:{pathPrefix:"",type:h.ROUTING_RULE_TYPES.BLOCKLET,did:Ct(n),port:"",interfaceName:"",redirectCode:302,__disableConfirm:!0},onConfirm:async e=>{const n=await bt(e,d);if(n)throw n;p(!0);const r={from:{pathPrefix:Kt()(e.pathPrefix)},to:{type:e.type}};e.type===h.ROUTING_RULE_TYPES.BLOCKLET?(r.to.port=e.port,r.to.did=e.did,r.to.interfaceName=e.interfaceName):e.type===h.ROUTING_RULE_TYPES.REDIRECT&&(r.to.url=e.url.trim(),r.to.redirectCode=e.redirectCode),await m.addRule(t,r,s),g(null),p(!1),a()},onCancel:()=>{p(!1),g(null)}},j=e=>{e.stopPropagation(),g(y)||r()};return(0,Z.jsxs)(Z.Fragment,{children:["function"===typeof o?o({loading:u,open:j}):(0,Z.jsxs)(mt.Z,{onClick:j,className:"rule-action","data-cy":"action-add-rule",children:[u?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(he.Z,{style:{fontSize:18,marginRight:5}}),d("router.rule.add.title")]}),f&&(0,Z.jsx)(H.Z,{title:f.title,description:f.description,confirm:f.confirm,cancel:f.cancel,params:f.params,onConfirm:f.onConfirm,onCancel:f.onCancel,color:"primary"})]})}function Vt(e){const{t:t}=(0,c.PE)(),{actions:n}=L(),[r,a]=(0,i.useState)(!1),[o,l]=(0,i.useState)(null),{id:s,parent:{id:d},name:m,children:u,onActivate:p,teamDid:f}=e,h={keyName:m,title:t("router.rule.delete.title"),description:t("router.rule.delete.description",{name:"<b>".concat(m,"</b>")}),confirmPlaceholder:t("router.rule.delete.confirm_desc",{name:m}),confirm:t("common.delConfirm"),cancel:t("router.rule.delete.cancel"),onConfirm:async()=>{a(!0),await n.deleteRule(d,s,f),a(!1),l(null)},onCancel:()=>{a(!1),l(null)}},x=e=>{e.stopPropagation(),l(h)||p()};return(0,Z.jsxs)(Z.Fragment,{children:["function"===typeof u?u({loading:r,open:x}):(0,Z.jsxs)(mt.Z,{onClick:x,className:"rule-action","data-cy":"action-delete-rule",children:[r?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(ge.default,{style:{fontSize:18,marginRight:5}}),t("router.rule.delete.title")]}),o&&(0,Z.jsx)(ye.Z,{keyName:o.keyName,title:o.title,description:o.description,confirmPlaceholder:o.confirmPlaceholder,confirm:o.confirm,cancel:o.cancel,params:o.params,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}Ht.defaultProps={onActivate:()=>{},onRuleAdded:()=>{},children:null,blocklets:[],teamDid:""},Vt.defaultProps={onActivate:()=>{},children:null,teamDid:""};var Qt=n(76667);function Xt(e){const{id:t,name:n,did:r,parent:a,blocklets:o,to:s,children:d,onActivate:m,teamDid:u}=e,{t:p}=(0,c.PE)(),{actions:f}=L(),[g,y]=(0,i.useState)(!1),[j,v]=(0,i.useState)(null),b={title:p("router.rule.update.title"),description:(e,t,n)=>(0,Z.jsxs)(l.Z,{component:"div",children:[(0,Z.jsx)(W.Z,{label:p("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix","data-cy":"path-prefix-input",fullWidth:!0,autoFocus:!0,helperText:e.helperText||p("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:e.pathPrefix,onChange:r=>{let i=!1;const a=Zt({params:{...e,pathPrefix:r.target.value},blocklets:o});e.type===h.ROUTING_RULE_TYPES.BLOCKLET&&a&&(i=!0,n(a)),e.type!==h.ROUTING_RULE_TYPES.REDIRECT||e.url||(i=!0),r.target.value.trim()||(i=!0,n(p("router.validation.pathPrefixRequired"))),i||n("");const l=p("common.slugifyHint",{value:(0,x.LN)(r.target.value)});t({...e,pathPrefix:r.target.value,helperText:l,__disableConfirm:i})}}),(0,Z.jsx)(ht,{blocklets:o,params:e,setParams:e=>{bt(e,p)?t({...e,__disableConfirm:!0}):t({...e})},setError:n})]}),confirm:p("router.rule.update.confirm"),cancel:p("router.rule.update.cancel"),color:"primary",params:{pathPrefix:"/"===n?n:n.replace(/^\/+/,"").replace(/\/+$/,""),type:s.type||h.ROUTING_RULE_TYPES.BLOCKLET,did:r||Ct(o),port:s.port||"",interfaceName:s.interfaceName||"",redirectCode:s.redirectCode||302,url:s.url||"",__disableConfirm:!1},onConfirm:async e=>{const n=await bt(e,p);if(n)throw n;y(!0);const r={id:t,from:{pathPrefix:Kt()(e.pathPrefix)},to:{type:e.type}};e.type===h.ROUTING_RULE_TYPES.BLOCKLET?(r.to.port=e.port,r.to.did=e.did,r.to.interfaceName=e.interfaceName):e.type===h.ROUTING_RULE_TYPES.REDIRECT&&(r.to.url=e.url,r.to.redirectCode=e.redirectCode),await f.updateRule(a.id,r,u),v(null),y(!1)},onCancel:()=>{y(!1),v(null)}},C=e=>{e.stopPropagation(),v(b)||m()};return(0,Z.jsxs)(Z.Fragment,{children:["function"===typeof d?d({loading:g,open:C}):(0,Z.jsxs)(mt.Z,{onClick:C,className:"rule-action","data-cy":"action-update-rule",children:[g?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(Qt.default,{style:{fontSize:18,marginRight:5}}),p("router.rule.update.title")]}),j&&(0,Z.jsx)(H.Z,{title:j.title,description:j.description,confirm:j.confirm,color:j.color,cancel:j.cancel,params:j.params,onConfirm:j.onConfirm,onCancel:j.onCancel})]})}Xt.defaultProps={onActivate:()=>{},children:null,did:"",blocklets:[],teamDid:""};var Jt=n(11593),$t=n(26174),en=n(88092);function tn(e){let{id:t,name:n,onActivate:r,children:a,title:o,teamDid:s}=e;const{t:d}=(0,c.PE)(),{actions:m}=L(),[u,p]=(0,i.useState)(!1),[f,x]=(0,i.useState)(null);if(h.DOMAIN_FOR_DEFAULT_SITE===n)return null;const g=async e=>{p(!0),await m.addDomainAlias(t,e.domain.trim(),!!e.force,s),p(!1),x(null)},y={title:o||d("router.domainAlias.add.title"),description:(e,t,n)=>(0,Z.jsxs)(l.Z,{component:"div",children:[(0,Z.jsx)(W.Z,{label:d("router.domainAlias.add.domainDescription"),autoComplete:"off",variant:"outlined",name:"domain","data-cy":"add-domain",fullWidth:!0,autoFocus:!0,inputProps:{"data-cy":"domain-name-input"},value:e.domain,style:{marginBottom:8},margin:"dense",onChange:r=>{const i=r.target.value.trim(),a=jt(i,d);t({...e,domain:i,__disableConfirm:!!a}),n(a||"")},onKeyPress:t=>{if("Enter"===t.key){t.preventDefault();const r=t.target.value.trim(),i=jt(r,d);i?n(i):(async(e,t,n)=>{try{await t(e)}catch(r){n((0,b.Z)(r))}finally{p(!1)}})(e,g,n)}}}),(0,Z.jsx)($t.Z,{control:(0,Z.jsx)(en.Z,{checked:e.force,onChange:n=>{t({...e,force:n.target.checked})},name:"checkedB",color:"primary"}),label:d("router.domainAlias.add.forceTip")})]}),confirm:d("common.confirm"),cancel:d("common.cancel"),params:{domain:"",__disableConfirm:!0},onConfirm:g,onCancel:()=>{p(!1),x(null)}},j=e=>{e.stopPropagation(),x(y)||r()};return(0,Z.jsxs)(Z.Fragment,{children:["function"===typeof a?a({loading:u,open:j}):(0,Z.jsxs)(mt.Z,{onClick:j,className:"rule-action","data-cy":"action-add-domain-alias",children:[u?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(Jt.Z,{style:{fontSize:18,marginRight:5}}),d("router.domainAlias.add.title")]}),f&&(0,Z.jsx)(H.Z,{title:f.title,description:f.description,confirm:f.confirm,cancel:f.cancel,params:f.params,onConfirm:f.onConfirm,onCancel:f.onCancel,color:"primary"})]})}function nn(e){let{id:t,name:n,corsAllowedOrigins:r,onActivate:a,children:o,teamDid:s}=e;const{t:d}=(0,c.PE)(),{actions:m}=L(),[u,p]=(0,i.useState)(!1),[f,x]=(0,i.useState)(null);if(U(n))return null;let g=n;n.endsWith(h.BLOCKLET_SITE_GROUP_SUFFIX)&&(g="".concat(d("common.the")," Blocklet"));const y={title:d("router.domainSecurity.title"),description:(e,t,n)=>(0,Z.jsx)(l.Z,{component:"div",children:(0,Z.jsx)(W.Z,{label:d("router.domainSecurity.cors.title",{name:g}),autoComplete:"off",variant:"outlined",name:"corsAllowedOrigins",fullWidth:!0,autoFocus:!0,value:e.corsAllowedOrigins,style:{marginBottom:32},margin:"dense",helperText:d("router.domainSecurity.cors.description",{name:g}),onChange:r=>{t({...e,corsAllowedOrigins:r.target.value,__disableConfirm:!r.target.value.trim()}),r.target.value.trim()?n(""):n(d("router.domainSecurity.cors.domainInvalid"))}})}),confirm:d("common.confirm"),cancel:d("common.cancel"),params:{corsAllowedOrigins:Array.isArray(r)?r.join(", "):n,__disableConfirm:!0},onConfirm:async e=>{p(!0),await m.updateSite(t,{corsAllowedOrigins:e.corsAllowedOrigins.split(",").map((e=>e.trim()))},s),p(!1),x(null)},onCancel:()=>{p(!1),x(null)}},j=e=>{e.stopPropagation(),x(y)||a()};return(0,Z.jsxs)(Z.Fragment,{children:["function"===typeof o?o({loading:u,open:j}):(0,Z.jsxs)(mt.Z,{onClick:j,className:"rule-action","data-cy":"action-update-domain",children:[u?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(tt.Z,{style:{fontSize:18,marginRight:5}}),d("router.domainSecurity.title")]}),f&&(0,Z.jsx)(H.Z,{title:f.title,description:f.description,confirm:f.confirm,cancel:f.cancel,params:f.params,onConfirm:f.onConfirm,onCancel:f.onCancel,color:"primary"})]})}function rn(e){let{id:t,name:n,onActivate:r}=e;const{t:a}=(0,c.PE)(),{actions:o}=L(),[s,d]=(0,i.useState)(!1),[m,u]=(0,i.useState)(null);if(U(n))return null;const p={title:a("router.domain.update.title"),description:(e,t,n)=>(0,Z.jsx)(l.Z,{component:"div",children:(0,Z.jsx)(W.Z,{label:a("router.domain.update.label"),autoComplete:"off",variant:"outlined",name:"domain",fullWidth:!0,autoFocus:!0,value:e.domain,style:{marginBottom:32},margin:"dense",helperText:a("router.domain.update.description"),onChange:r=>{const i=r.target.value.trim(),o=jt(i,a);t({...e,domain:r.target.value,__disableConfirm:!!o}),n(o||"")}})}),confirm:a("common.confirm"),cancel:a("common.cancel"),params:{domain:n,__disableConfirm:!0},onConfirm:async e=>{d(!0),await o.updateSite(t,{domain:e.domain.trim()}),d(!1),u(null)},onCancel:()=>{d(!1),u(null)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(mt.Z,{onClick:e=>{e.stopPropagation(),u(p)||r()},className:"rule-action",children:[s?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(Qt.default,{style:{fontSize:18,marginRight:5}}),a("router.domain.update.title")]}),m&&(0,Z.jsx)(H.Z,{title:m.title,description:m.description,confirm:m.confirm,cancel:m.cancel,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel,color:"primary"})]})}function an(e){const[t,n]=(0,i.useState)(null),r=e=>{e&&e.stopPropagation(),n(null)},a=[];if("root"===e.type&&a.push((0,Z.jsx)(wt,{...e,onActivate:r},"add-domain")),"domain"===e.type&&a.push((0,Z.jsx)(rn,{...e,onActivate:r},"update-domain"),(0,Z.jsx)(Ht,{...e,onActivate:r,onRuleAdded:e.onRuleAdded},"add-rule"),(0,Z.jsx)(tn,{...e,onActivate:r},"add-domain-alias"),(0,Z.jsx)(nn,{...e,onActivate:r},"update-domain-security"),(0,Z.jsx)(qt,{...e,onActivate:r},"delete-domain")),"rule"===e.type&&a.push((0,Z.jsx)(Xt,{...e,onActivate:r},"update-rule"),(0,Z.jsx)(Vt,{...e,onActivate:r},"delete-rule")),e.type===h.ROUTING_RULE_TYPES.REDIRECT&&a.push((0,Z.jsx)(qt,{...e,onActivate:r},"delete-domain")),"dashboard_domain"!==e.type&&"blocklet_domain"!==e.type||a.push((0,Z.jsx)(Ht,{...e,onActivate:r},"add-rule"),(0,Z.jsx)(nn,{...e,onActivate:r},"update-domain-security"),(0,Z.jsx)(tn,{...e,onActivate:r},"add-domain-alias")),0===a.length)return null;const o=e=>{e.stopPropagation()};return(0,Z.jsxs)("div",{children:[(0,Z.jsx)(Gt.Z,{onMouseDown:o,onClick:e=>{e.stopPropagation(),n(e.currentTarget)},"data-cy":"action-trigger",size:"large",children:(0,Z.jsx)(Wt.Z,{})}),(0,Z.jsx)(Mt.Z,{keepMounted:!0,onMouseDown:o,open:!!t,onClose:r,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:a})]})}tn.defaultProps={onActivate:()=>{},children:null,title:"",teamDid:""},nn.defaultProps={onActivate:()=>{},children:null,corsAllowedOrigins:"",teamDid:""},an.defaultProps={onRuleAdded:()=>{},blocklet:{}};var on=n(55898),ln=n.n(on),sn=n(31942),cn=n(11819),dn=n(38763),mn=n(75392),un=n(69569);function pn(e){let{certificate:t}=e;const[n,r]=(0,i.useState)(null),a=(0,j.h6)(),{t:o,locale:s}=(0,c.PE)(),d=()=>{r(null)},m=Boolean(n);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sn.Z,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:e=>{r(e.currentTarget)},onMouseLeave:d,style:{color:"#44cdc6",fontSize:20,marginLeft:8,cursor:"pointer"}}),(0,Z.jsx)(cn.ZP,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:n,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:d,disableRestoreFocus:!0,children:(0,Z.jsx)(dn.Z,{children:(0,Z.jsxs)(mn.Z,{style:{display:"flex"},children:[(0,Z.jsx)("div",{children:(0,Z.jsx)("img",{src:"".concat(a.imgPrefix,"/https-certificate-icon.png"),alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),(0,Z.jsxs)(l.Z,{component:"div",style:{marginLeft:"16px"},children:[(0,Z.jsx)(l.Z,{component:"div",style:{fontWeight:"bold"},children:t.domain}),(0,Z.jsx)(l.Z,{component:"div",children:"".concat(o("common.issuer"),": ").concat(Se()(t,"issuer.commonName",""))}),(0,Z.jsx)(l.Z,{component:"div",children:"".concat(o("router.cert.issuedOn"),": ").concat((0,b.pz)(t.validFrom,s))}),(0,Z.jsx)(l.Z,{component:"div",children:"".concat(o("router.cert.expiryOn"),": ").concat((0,b.pz)(t.validTo,s))})]})]})})})]})}function fn(e){const{name:t,type:n,filters:r}=e,{t:a}=(0,c.PE)(),{status:o}=ct();if("domain"!==n)return null;if(!(0,b.rM)(t))return null;let l=null,s=null;const{isHttps:d,matchedCert:m}=o[t]||{};if(!(0,b.ao)(t)){const{dns:{resolved:e,ip:n}={}}=o[t]||{};l=e||"127.0.0.1"===n?(0,Z.jsx)(Nt.Z,{title:a("router.domain.verify.ok"),children:(0,Z.jsx)(un.Z,{color:"success"})}):(0,Z.jsx)(Nt.Z,{title:a("router.domain.verify.notResolved"),children:(0,Z.jsx)(un.Z,{color:"error"})})}s=d?(0,Z.jsx)(pn,{certificate:m}):(0,Z.jsx)(Nt.Z,{title:a("router.domain.https.bad"),children:(0,Z.jsx)(sn.Z,{style:{color:"#D0021B",fontSize:20,marginLeft:8,cursor:"pointer"}})});const u=r.map((e=>"domain"===e?l:"http"===e?s:null));return(0,i.createElement)(i.Fragment,null,...u)}pn.defaultProps={certificate:{}},fn.propTypes={type:ln().string.isRequired,name:ln().string.isRequired,filters:ln().array},fn.defaultProps={filters:["domain","http"]};const hn=e=>["waiting","creating","renewaling"].includes(e);function xn(e){var t;const{t:n}=(0,c.PE)(),[r,a]=(0,i.useState)(!1),[o,l]=(0,i.useState)(null),{domain:s,onAdd:d,children:m,siteId:p}=e,{api:f}=(0,j.h6)(),[x,g]=(0,i.useState)(!1),{updateStatus:y}=ct(),b=(0,v.Z)(),C=(0,u.Z)((async()=>{const{cert:e}=await b.findCertificateByDomain({input:{domain:s}});return e})),w=e=>{e.domain===s&&g(!1)};if((0,i.useEffect)((()=>{var e;!C.loading&&hn(null===(e=C.value)||void 0===e?void 0:e.status)&&g(!0)}),[C]),(0,rt.mU)(h.EVENTS.CERT_ERROR,w),(0,rt.mU)(h.EVENTS.CERT_ISSUED,(e=>{C.retry(),y(e.domain),w(e)})),C.loading)return"";if("normal"===(null===(t=C.value)||void 0===t?void 0:t.status))return"";const E={title:n("router.cert.genLetsEncryptCert.title"),description:(0,Z.jsxs)("div",{children:[(0,Z.jsx)(G.Z,{type:"success",children:n("router.cert.genLetsEncryptCert.dnsTip")}),n("router.cert.genLetsEncryptCert.description")]}),confirm:n("common.confirm"),onConfirm:async()=>{a(!0);try{await f.issueLetsEncryptCert({input:{domain:s,siteId:p}}),d(),g(!0)}catch(e){console.error(e),g(!1)}finally{a(!1),l(null)}},onCancel:()=>{a(!1),l(null)}};return(0,Z.jsxs)(Z.Fragment,{children:[x?(0,Z.jsx)(Nt.Z,{title:n("router.cert.issuing"),children:(0,Z.jsx)(q.Z,{size:12})}):m({loading:r,open:e=>{e.stopPropagation(),l(E)}}),o&&(0,Z.jsx)(H.Z,{color:"primary",title:o.title,description:o.description,confirm:o.confirm,params:o.params,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}function gn(e){var t;const{status:n}=ct(),{domain:r}=e;return!(0,b.rM)(r)||null!==(t=n[r])&&void 0!==t&&t.isHttps?"":(0,Z.jsx)(xn,{...e})}function yn(e){const{t:t}=(0,c.PE)(),[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(null),{id:l,domain:s,onDelete:d,children:m,teamDid:u}=e,{actions:p}=L();if(s===window.location.hostname)return"";const f={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:async()=>{r(!0);try{await p.deleteDomainAlias(l,s,u),d()}catch(e){console.error(e)}finally{r(!1),o(null)}},onCancel:()=>{r(!1),o(null)}},h=e=>{e.stopPropagation(),o(f)};return(0,Z.jsxs)(Z.Fragment,{children:["function"===typeof m?m({loading:n,open:h}):(0,Z.jsxs)(B.Z,{edge:"end",onClick:h,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[n?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(ge.default,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&(0,Z.jsx)(H.Z,{title:a.title,description:a.description,confirm:a.confirm,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}var jn,vn;function bn(e){let{domain:t,isHttps:n,toUrl:r}=e;const i=n?"https":"http",{t:a}=(0,c.PE)();let o=r;return St()(o)||(o="".concat(i,"://").concat(t).concat(r)),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l.Z,{className:"arrow-name-middle",children:a("common.redirect")}),(0,Z.jsx)("span",{className:"arrow-name-arrow",children:"\u27f6"}),(0,Z.jsx)(It.Z,{href:o,target:"_blank",underline:"hover",children:r},o)]})}function Zn(){const{t:e}=(0,c.PE)();return(0,Z.jsx)(l.Z,{className:"arrow-name-middle",children:e("common.page404")})}function Cn(e){const{t:t}=(0,c.PE)(),{data:n}=(0,nt.RJ)(),{info:r}=(0,j.h6)(),{status:a}=ct(),o=n.map((e=>({meta:{did:e.meta.did,name:(0,Bt.getDisplayName)(e,!0),version:e.meta.version,interfaces:e.meta.interfaces},port:e.port,ports:e.ports,status:e.status}))),{id:s,type:d,name:m,title:u,items:p=[],depth:f,to:g,expand:y,isProtected:v,pathPrefix:b,parent:w,domainAliases:E}=e;let P=m;const S=m.endsWith(h.BLOCKLET_SITE_GROUP_SUFFIX);let _=d;m===C&&(_="dashboard_domain"),S&&(_="blocklet_domain");const[T,R]=(0,i.useState)(y),k={root:Rt.Z,domain:dt.Z,rule:kt.Z}[d];if("domain"===d){if(v&&!S)return null;if(S){const W=m.replace(h.BLOCKLET_SITE_GROUP_SUFFIX,""),G=o.find((e=>e.meta.did===W));if(!G)return null;if(G.controller)return null;P=G.meta.title||G.meta.name}function F(e){let{domain:t,primaryDomain:n,rules:i}=e,a="http://".concat(t);return n===C?a="".concat(a,"/").concat(r.routing.adminPath.replace(/^\/+/,"")):i&&i.length&&i[0].pathPrefix&&(a="".concat(a,"/").concat(i[0].pathPrefix.replace(/^\/+/,""))),t!==C?(0,Z.jsx)(En,{href:a,target:"_blank",rel:"noreferrer",onClick:e=>e.stopPropagation(),children:t}):t}const z=()=>{R(!0)};let M=(E||[]).filter((e=>e.value!==m));return M=(0,x.oE)(M),[(0,Z.jsxs)(wn,{alignItems:"flex-start",button:!0,disableGutters:!0,"data-cy":"rule-domain",children:[(0,Z.jsxs)(Lt.Z,{onClick:()=>R((e=>!e)),children:[p.length>0&&(T?(0,Z.jsx)(Ft.Z,{}):(0,Z.jsx)(zt.default,{})),(0,Z.jsx)(k,{style:{fontSize:22}})]}),(0,Z.jsx)(Ut.Z,{onClick:()=>R((e=>!e)),className:"rule-name rule-name--depth".concat(f),style:{flex:1},secondary:p.length<=0?(0,Z.jsx)("span",{className:"site-secondary",children:t("router.empty")}):"",primary:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("div",{className:"site-header",children:[m===h.DOMAIN_FOR_DEFAULT_SITE&&t("router.defaultSite"),m!==h.DOMAIN_FOR_DEFAULT_SITE&&!S&&(0,Z.jsx)(F,{domain:m,primaryDomain:m,rules:p}),S&&P,p.length&&!T?(0,Z.jsx)("span",{style:{marginLeft:5},children:"(".concat(p.length," URL)")}):null,(0,Z.jsx)("span",{style:{marginLeft:12}}),"domain"===d&&m!==h.DOMAIN_FOR_DEFAULT_SITE&&m!==C&&!S&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fn,{type:d,name:m},m),(0,Z.jsx)("span",{style:{marginLeft:12}}),(0,Z.jsx)(gn,{siteId:s,domain:m,children:e=>{let{open:n}=e;return(0,Z.jsx)(B.Z,{size:"small",onClick:e=>n(e),children:t("router.cert.genLetsEncryptCert.title")})}})]})]}),M.map((n=>{const r="string"!==typeof n?n.value:n;return(0,Z.jsxs)("div",{className:"site-alias",children:[(0,Z.jsx)(F,{domain:r,primaryDomain:m,rules:p}),(0,Z.jsx)("span",{style:{marginLeft:12}}),(0,Z.jsx)(fn,{type:d,name:r},"domain-status-".concat(m)),(0,Z.jsx)(gn,{siteId:s,domain:r,children:e=>{let{open:n}=e;return(0,Z.jsx)(B.Z,{size:"small",onClick:e=>n(e),children:t("router.cert.genLetsEncryptCert.title")})}}),!n.isProtected&&(0,Z.jsx)(yn,{id:e.id,domain:r},"delete-domain-alias"),r!==C&&r!==window.location.hostname&&(0,Z.jsx)(an,{...e,domain:r,type:"domainAlias",onRuleAdded:z},"action-".concat(m))]},r)}))]})}),(0,Z.jsx)($.Z,{permission:"mutate_router",children:(0,Z.jsx)(Dt.Z,{children:(0,Z.jsx)(an,{blocklets:o,...e,onRuleAdded:z,type:_},m)})})]},"parent"),(0,Z.jsx)(Ot.Z,{in:T,children:p.length>0&&(0,Z.jsx)(et.Z,{component:"div",className:"rule-list rule-list--depth".concat(f),disablePadding:!0,children:p.map((t=>(0,Z.jsx)(Cn,{...t,parent:e,depth:f+1},t.id)))},"children")},"rules")]}if("root"===d)return[(0,Z.jsxs)(wn,{disableGutters:!0,"data-cy":"rule-root",children:[(0,Z.jsx)(Lt.Z,{children:(0,Z.jsx)(k,{style:{fontSize:22}})}),(0,Z.jsx)(Ut.Z,{primary:m}),(0,Z.jsx)($.Z,{permission:"mutate_router",children:(0,Z.jsx)(Dt.Z,{children:(0,Z.jsx)(an,{blocklets:o,...e})})})]},"root"),p.length>0&&(0,Z.jsx)(et.Z,{component:"div",className:"rule-list rule-list--depth".concat(f),disablePadding:!0,children:p.map((t=>(0,Z.jsx)(Cn,{expand:!v,...t,parent:e,depth:f+1},t.id)))},"children")];let N="/blocklets/".concat(g.did,"/overview");g.type===h.ROUTING_RULE_TYPES.DAEMON&&(N="/");const A={meta:{did:r.did,name:"Blocklet Server Dashboard",version:r.version},status:"running",port:r.port},L=g.did===r.did?A:o.find((e=>e.meta.did===g.did)),U=L&&"running"===L.status||g.type===h.ROUTING_RULE_TYPES.DAEMON,I=t(U?"router.healthy.ok":"router.healthy.error"),O=a[w.name]||{};return(0,Z.jsxs)(wn,{className:"hover-item",divider:!0,disableGutters:!0,style:{paddingBottom:8,paddingLeft:8},"data-cy":"rule-item",children:[(0,Z.jsx)(Lt.Z,{className:"arrow-icon",children:(0,Z.jsx)(k,{style:{fontSize:22}})}),(0,Z.jsx)(Ut.Z,{primary:(0,Z.jsxs)(l.Z,{component:"div",className:"arrow-name",children:[(0,Z.jsx)(l.Z,{style:{wordBreak:"break-all"},className:"arrow-name-left",children:m}),(0,Z.jsx)("span",{className:"arrow-name-arrow",children:"\u27f6"}),(g.type===h.ROUTING_RULE_TYPES.DAEMON||g.type===h.ROUTING_RULE_TYPES.BLOCKLET)&&(0,Z.jsxs)(Z.Fragment,{children:[w.name!==h.DOMAIN_FOR_DEFAULT_SITE&&U&&(0,Z.jsx)(D.Z,{className:"arrow-name-middle",children:(0,Z.jsx)(It.Z,{href:(0,x.Sk)(w.name,b),target:"_blank",underline:"hover",children:t("common.open")})}),w.name===h.DOMAIN_FOR_DEFAULT_SITE&&(0,Z.jsx)(l.Z,{component:"span",className:"arrow-name-middle",children:"Blocklet"}),!U&&(0,Z.jsx)("span",{className:"arrow-name-middle",children:t("common.unavailable")}),(0,Z.jsx)("span",{className:"arrow-name-arrow",children:"\u27f6"}),(0,Z.jsxs)(Et.Link,{to:N,className:"arrow-name-right",children:[(0,Z.jsx)(Nt.Z,{title:I,children:U?(0,Z.jsx)(_t.Z,{style:{color:"#44cdc6",fontSize:20}}):(0,Z.jsx)(Tt.Z,{style:{color:"red",fontSize:20}})}),(0,Z.jsx)("span",{children:L?L.meta.name:u}),L&&(0,Z.jsx)("span",{style:{marginLeft:8},children:(0,Z.jsx)(pt.Z,{status:L.status})})]})]}),g.type===h.ROUTING_RULE_TYPES.REDIRECT&&(0,Z.jsx)(bn,{prefix:b,domain:w.name,toUrl:g.url,isHttps:O.isHttps}),g.type===h.ROUTING_RULE_TYPES.NONE&&(0,Z.jsx)(Zn,{})]})}),(0,Z.jsx)($.Z,{permission:"mutate_router",children:(0,Z.jsx)(Dt.Z,{children:(0,Z.jsx)(an,{blocklets:o,...e,did:g.did})})})]},m)}xn.defaultProps={onAdd:()=>{},children:null},gn.defaultProps={onAdd:()=>{},children:null},yn.defaultProps={onDelete:()=>{},children:null,teamDid:""},bn.defaultProps={isHttps:!1},Zn.defaultProps={},Cn.defaultProps={id:"",to:{},title:"",items:[],depth:0,parent:{},expand:!0,isProtected:!1,pathPrefix:"",domainAliases:[]};const wn=(0,a.Z)(At.ZP)(jn||(jn=(0,r.Z)(["\n .MuiListItemText-root {\n padding-right: 48px;\n }\n .MuiListItemSecondaryAction-root {\n right: 0;\n }\n .site-header {\n display: unset !important;\n vertical-align: middle;\n .MuiSvgIcon-root {\n vertical-align: middle;\n }\n }\n"]))),En=(0,a.Z)("a")(vn||(vn=(0,r.Z)(["\n color: #000;\n white-space: normal;\n word-break: break-all;\n :hover {\n color: rgba(0, 0, 0, 0.6);\n }\n"])));var Pn;function Sn(){const{sites:e,allDomains:t}=L(),{data:n}=(0,nt.RJ)(),{t:r}=(0,c.PE)(),a=e.map((e=>{const t=e.items.filter((e=>!e.isProtected));return{...e,items:t}}));return(0,Z.jsx)(st,{domains:t,children:(0,Z.jsxs)(_n,{children:[(0,Z.jsx)($.Z,{permission:"mutate_router",children:(0,Z.jsx)(D.Z,{textAlign:"right",mb:1,children:(0,Z.jsx)(wt,{blocklets:n,children:e=>{let{open:t}=e;return(0,Z.jsxs)(B.Z,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:t,children:[(0,Z.jsx)(tt.Z,{style:{fontSize:"1.3em",marginRight:4}}),r("router.domain.addSite")]})}})})}),(0,Z.jsx)(et.Z,{component:"div",disablePadding:!0,children:a.map((e=>(0,i.createElement)(Cn,{...e,depth:1,key:e.id})))})]})})}const _n=a.Z.main(Pn||(Pn=(0,r.Z)(["\n margin-top: ",";\n min-height: 60vh;\n\n .MuiListItemIcon-root {\n min-width: ",";\n }\n\n .site-header {\n display: flex;\n align-items: center;\n margin-left: ",";\n font-size: 1.2rem;\n }\n\n .site-alias {\n display: flex;\n align-items: center;\n margin-left: ",";\n }\n\n .site-secondary {\n margin-left: ",";\n }\n\n .rule-list--depth1 {\n padding-left: ",";\n }\n\n .rule-list--depth2 {\n padding-left: ",";\n }\n\n .rule-action {\n margin-left: ",";\n }\n\n .rule-name--depth2 span {\n font-weight: bold;\n }\n\n .arrow-name {\n display: flex;\n align-items: center;\n .arrow-name-left {\n width: 400px;\n flex-shrink: 0;\n text-align: left;\n }\n .arrow-name-middle {\n width: 150px;\n flex-shrink: 0;\n text-align: left;\n }\n .arrow-name-arrow {\n width: 40px;\n flex-shrink: 0;\n margin: auto 16px;\n font-size: 24px;\n color: #0000008a;\n }\n .arrow-name-right {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n\n span {\n margin: 0 8px;\n }\n }\n }\n\n @media (max-width: ","px) {\n .rule-list--depth1,\n .rule-list--depth2 {\n padding-left: 0;\n }\n\n .MuiListItem-secondaryAction {\n padding-right: 0;\n }\n }\n\n @media (max-width: ","px) {\n .arrow-icon {\n margin-top: 4px;\n align-self: flex-start;\n }\n\n .arrow-name {\n flex-direction: column;\n align-items: flex-start;\n .arrow-name-left {\n width: auto;\n }\n .arrow-name-middle {\n margin: 5px 0;\n }\n .arrow-name-arrow {\n display: none;\n }\n }\n }\n"])),(e=>e.theme.spacing(2)),(e=>e.theme.spacing(4)),(e=>e.theme.spacing(1)),(e=>e.theme.spacing(1)),(e=>e.theme.spacing(1)),(e=>e.theme.spacing(4)),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(2)),(e=>e.theme.breakpoints.values.md),(e=>e.theme.breakpoints.values.lg));var Tn=n(34966),Rn=n(22228),kn=n(23484),Nn=n(49525),An=n(65140),Ln=n(87916),Un=n(13128),In=n(55372);const Dn=51200,On=e=>new Promise(((t,n)=>{const r=new FileReader;r.readAsText(e),r.onload=()=>{t(r.result)},r.onerror=e=>n(e)}));function Fn(e){let{certificate:t={},onRefresh:n,mode:r,...a}=e;const{t:o}=(0,c.PE)(),{api:s}=(0,j.h6)(),[d,m]=(0,i.useState)(!1),[u,p]=(0,i.useState)(),[f,h]=(0,i.useState)(),[x,g]=(0,i.useState)(!1),[y,v]=(0,i.useState)(""),[C,w]=(0,i.useState)("upload"),{handleSubmit:E,formState:P,control:S}=(0,M.cI)({defaultValues:{name:t.name||t.domain}}),_=(0,M.qo)({control:S,name:"name"}),T=(0,M.qo)({control:S,name:"domain"}),R=()=>{m(!1),g(!1)},k={upload:{name:o("router.cert.nginx.sourceTypes.upload"),value:"upload",onSubmit:async e=>{if("add"===r){const t=(await On(f)).replace(/\r\n/g,"\n"),n=(await On(u)).replace(/\r\n/g,"\n");await s.addCertificate({input:{name:e.name.trim(),certificate:t.split("\n").join("|"),privateKey:n.split("\n").join("|")}})}else await s.updateCertificate({input:{id:t.id,name:e.name.trim()}})}},lets_encrypt:{name:o("router.cert.nginx.sourceTypes.lets_encrypt"),value:"lets_encrypt",onSubmit:e=>s.issueLetsEncryptCert({input:{domain:e.domain}})}},N=async e=>{m(!0);try{const t=k[C];if(!t)throw new Error("Invaid certificate source");await t.onSubmit(e),n(),g(!1)}catch(t){v((0,b.Z)(t)||"unknown error, may be you can check file permission")}finally{m(!1)}},A=e=>{e.length>0&&v(Se()(e[0],"errors[0].message",o("router.cert.add.invalidFile")))},{getRootProps:L,getInputProps:U}=(0,Nn.uI)({accept:[".pem",".crt"],multiple:!1,maxSize:Dn,onDropRejected:A,onDrop:e=>{h(e[0])}}),{getRootProps:I,getInputProps:O}=(0,Nn.uI)({accept:[".pem",".key"],multiple:!1,maxSize:Dn,onDropRejected:A,onDrop:e=>{p(e[0])}}),{errors:F}=P;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(B.Z,{edge:"end",onClick:()=>{p(null),h(null),g(!0),v("")},className:"rule-action",color:"primary","data-cy":"add-cert",...a,children:[d?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(tt.Z,{style:{fontSize:16}}),o("add"===r?"common.add":"common.update")]}),x&&(0,Z.jsx)(Un.ZP,{title:o("add"===r?"router.cert.nginx.titleAdd":"router.cert.nginx.title"),open:!0,onClose:R,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B.Z,{onClick:R,color:"inherit","data-cy":"cert-cancel",children:o("router.cert.nginx.cancel")}),(0,Z.jsxs)(B.Z,{onClick:E(N),color:"secondary",disabled:!!d||("upload"===C&&"update"===r?!_:"upload"===C&&"add"===r?!_||!u||!f:"lets_encrypt"===C&&!T),variant:"contained",autoFocus:!0,"data-cy":"save-cert",children:[o("router.cert.nginx.confirm"),d&&(0,Z.jsx)(q.Z,{size:16})]})]}),children:(0,Z.jsx)("form",{className:"form","data-cy":"cert-form",noValidate:!0,autoComplete:"off",onSubmit:E(N),children:(0,Z.jsxs)(D.Z,{minWidth:{sm:480},children:[(0,Z.jsxs)(In.Z,{component:"div",children:["add"===r&&(0,Z.jsxs)("section",{className:"form-item",children:[(0,Z.jsx)("div",{className:"form-item-label",children:o("router.cert.source")}),(0,Z.jsx)(Ln.Z,{"aria-label":"cert-source",name:"certSource",value:C,onChange:e=>{w(e.target.value)},children:Object.values(k).map((e=>(0,Z.jsx)($t.Z,{value:e.value,control:(0,Z.jsx)(An.Z,{}),label:e.name},e.value)))})]}),"upload"===C&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("section",{className:"form-item",children:[(0,Z.jsx)("div",{className:"form-item-label",children:o("router.cert.name")}),(0,Z.jsx)(M.Qr,{name:"name",control:S,rules:{validate:e=>!!e.trim()||o("common.requiredErrorText",{name:o("router.cert.name")})},render:e=>{let{field:{value:t,onChange:n}}=e;return(0,Z.jsx)(W.Z,{fullWidth:!0,autoFocus:!0,defaultValue:t,onChange:n,error:!!F.name,autoComplete:"off",variant:"outlined",name:"name",className:"form-item-value","data-cy":"certificate-name-textfield",helperText:F.name&&F.name.message})}})]}),"add"===r&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("section",{className:"form-item",children:[(0,Z.jsx)("div",{className:"form-item-label",children:o("router.cert.nginx.pem")}),(0,Z.jsx)("div",{className:"form-item-value",children:(0,Z.jsxs)("div",{...L({className:"dropzone"}),children:[(0,Z.jsx)("input",{...U(),"data-cy":"pem-input"}),f&&(0,Z.jsx)(l.Z,{color:"secondary",children:f.name}),!f&&(0,Z.jsx)(l.Z,{color:"secondary",children:o("router.cert.nginx.empty")}),(0,Z.jsx)(l.Z,{component:"small",variant:"body2",color:"textSecondary",children:o("router.cert.nginx.pemTip")})]})})]}),(0,Z.jsxs)("section",{className:"form-item",children:[(0,Z.jsx)("div",{className:"form-item-label",children:o("router.cert.nginx.key")}),(0,Z.jsx)("div",{className:"form-item-value",children:(0,Z.jsxs)("div",{...I({className:"dropzone"}),children:[(0,Z.jsx)("input",{...O(),"data-cy":"key-input"}),u&&(0,Z.jsx)(l.Z,{color:"secondary",children:u.name}),!u&&(0,Z.jsx)(l.Z,{color:"secondary",children:o("router.cert.nginx.empty")}),(0,Z.jsx)(l.Z,{component:"small",variant:"body2",color:"textSecondary",children:o("router.cert.nginx.keyTip")})]})})]})]})]}),"lets_encrypt"===C&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("section",{className:"form-item",children:(0,Z.jsx)(G.Z,{type:"success",children:o("router.cert.genLetsEncryptCert.dnsTip")})}),(0,Z.jsxs)("section",{className:"form-item",children:[(0,Z.jsx)("div",{className:"form-item-label",children:o("common.domain")}),(0,Z.jsx)(M.Qr,{name:"domain",control:S,rules:{validate:e=>!!e.trim()||o("common.requiredErrorText",{name:o("common.domain")})},render:e=>{let{field:{value:t,onChange:n}}=e;return(0,Z.jsx)(W.Z,{fullWidth:!0,autoFocus:!0,defaultValue:t,error:!!F.domain,autoComplete:"off",variant:"outlined",className:"form-item-value",helperText:F.domain&&F.domain.message,onChange:n})}})]})]})]}),!!y&&(0,Z.jsx)(G.Z,{type:"error",style:{marginTop:8},children:y})]})})})]})}var zn=n(96366);function Bn(e){const t=(0,zn.Z)(),{t:n}=(0,c.PE)(),[r,a]=(0,i.useState)(!1),[o,l]=(0,i.useState)(null),{id:s,onDelete:d=(()=>{}),...m}=e,{refresh:u}=L(),p=(0,v.Z)(),f={title:n("router.cert.delete.title"),description:n("router.cert.delete.description"),confirm:n("common.delConfirm"),cancel:n("common.cancel"),onConfirm:async()=>{a(!0);try{await p.deleteCertificate({input:{id:s}}),u(),d()}catch(e){console.error(e)}finally{a(!1),l(null)}},onCancel:()=>{a(!1),l(null)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(B.Z,{edge:"end",onClick:()=>l(f),size:"small",className:"rule-action",variant:"text","data-cy":"action-delete-cert",style:{color:t.palette.error.main},...m,children:[r?(0,Z.jsx)(q.Z,{size:16}):(0,Z.jsx)(ge.default,{style:{fontSize:16}}),n("common.delete")]}),o&&(0,Z.jsx)(H.Z,{title:o.title,description:o.description,confirm:o.confirm,cancel:o.cancel,params:o.params,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}var Mn,Wn,Gn=n(1577),qn=n.n(Gn),Yn=n(95335),Kn=n(45568),Hn=n(29034);function Vn(e){const{certificate:t={},...n}=e,{t:r,locale:a}=(0,c.PE)(),[o,s]=(0,i.useState)(!1),d=(0,Yn.Z)(),m=[{id:"matchedSites",name:r("router.cert.matchedSites"),value:(t.matchedSites||[]).map((e=>(0,Z.jsx)(l.Z,{component:"div",style:{fontWeight:"inherit",fontSize:"1.1rem"},children:e.domain},e.id)))},{id:"updatedAt",name:r("common.updatedAt"),value:(0,b.B2)(t.updatedAt,a)},{id:"createdAt",name:r("common.createdAt"),value:(0,b.B2)(t.createdAt,a)}],u=[{id:"boundDomains",name:r("router.cert.boundDomains"),value:(0,Z.jsx)(l.Z,{component:"span",style:{fontSize:"1.1rem"},children:(Se()(t,"sans")||[]).join(", ")})},{id:"issuer",name:r("common.issuer"),value:Se()(t,"meta.issuer.commonName","")},{id:"fingerprint",name:r("common.fingerprint"),value:Se()(t,"meta.fingerprint")},{id:"fingerprintAlg",name:r("router.cert.fingerprintAlg"),value:Se()(t,"meta.fingerprintAlg")},{id:"validityPeriod",name:r("router.cert.validityPeriod"),value:qn().duration(Se()(t,"meta.validityPeriod"),"ms").humanize()},{id:"issuedOn",name:r("router.cert.issuedOn"),value:(0,b.pz)(Se()(t,"meta.validFrom"),a)},{id:"expiryOn",name:r("router.cert.expiryOn"),value:(0,b.pz)(Se()(t,"meta.validTo"),a)}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(B.Z,{edge:"end",onClick:()=>s(!0),size:"small",className:"rule-action",variant:"text",color:"secondary","data-cy":"action-view-cert",...n,children:[(0,Z.jsx)(Kn.Z,{style:{fontSize:16}}),r("common.detail")]}),(0,Z.jsxs)(Un.ZP,{title:r("router.cert.detail.title"),"aria-labelledby":"certificate details",fullWidth:!0,open:o,showCloseButton:!1,actions:(0,Z.jsx)(B.Z,{autoFocus:!0,variant:"contained",onClick:()=>{s(!1)},color:"secondary",children:r("common.close")}),children:[(0,Z.jsx)(In.Z,{component:"div",style:{margin:d.spacing(2)},children:m.map((e=>(0,Z.jsx)(_e.Z,{nameWidth:200,valueComponent:"div",name:e.name,children:e.value},e.id)))},"cert-basic"),(0,Z.jsx)(Hn.Z,{}),(0,Z.jsx)(In.Z,{component:"div",style:{margin:d.spacing(2)},children:u.map((e=>(0,Z.jsx)(_e.Z,{nameWidth:200,valueComponent:"div",name:e.name,children:e.value},e.id)))},"cer-info"),(0,Z.jsx)(Hn.Z,{})]})]})}function Qn(e){const{certificate:t,style:n,...r}=e,{t:a}=(0,c.PE)(),[o,s]=(0,i.useState)(!1),d=t.matchedSites||[];return(0,Z.jsxs)(l.Z,{component:"ul",...r,style:{...n,listStyle:"none"},children:[(o?d:d.slice(0,4)).map((e=>(0,Z.jsx)(l.Z,{component:"li",style:{fontSize:"1.1rem",margin:"4px 0"},children:e.domain},e.id))),d.length>4&&(0,Z.jsx)(B.Z,{style:{border:"none",padding:"5px 0"},variant:"outlined",color:"primary",className:"button",onClick:()=>{s(!o)},children:a(o?"common.collapseAll":"common.expandAll")})]})}Qn.defaultProps={style:{}};const Xn=e=>{if(!e)return!1;return e-+new Date<=0},Jn="ssl-certificates-table";function $n(e){let{name:t,value:n,style:r={},icon:i,...a}=e;return(0,Z.jsxs)(er,{style:{display:"flex",alignItems:"center",...r},...a,children:[(0,Z.jsxs)("span",{children:[t,":"]}),(0,Z.jsx)("span",{children:n}),i&&i]})}const er=a.Z.div(Mn||(Mn=(0,r.Z)(["\n & > span {\n margin: 5px;\n }\n"])));function tr(e){let{status:t,source:n,expiresTime:r}=e;const{t:i}=(0,c.PE)();return Xn(r)?(0,Z.jsx)(Rn.Z,{type:"error",children:i("router.cert.expired")}):"upload"===n?(0,Z.jsx)(Rn.Z,{type:"success",children:i("common.normal")}):"error"===t?(0,Z.jsx)(Rn.Z,{type:"error",children:i("common.error")}):"generated"===t?(0,Z.jsx)(Rn.Z,{type:"success",children:i("common.normal")}):""}tr.defaultProps={status:"",source:""};const nr=(e,t)=>{if(!t)return e;const n=(t.site.domainAliases||[]).map((e=>e.value));return e.filter((e=>(0,x.kO)(n,e.matchedSites)))};function rr(){var e;const{t:t,locale:n}=(0,i.useContext)(c.RD),r=(0,v.Z)(),{api:a}=(0,j.h6)(),o=(0,kn.Z)().get("did"),s=(0,u.Z)((async()=>{const{certificates:e}=await r.getCertificates();let t=null;if(o){const{blocklet:e}=await a.getBlocklet({input:{did:o,attachRuntimeInfo:!0}});t=e}return{certificates:nr(e,t)}})),d=()=>{s.retry()},m=null===(e=s.value)||void 0===e?void 0:e.certificates,p=[{label:t("common.certificate"),name:"",verticalKeyAlign:"center",options:{sort:!1,filter:!1,customBodyRenderLite:e=>{const n=m[e];return(0,Z.jsxs)(Z.Fragment,{children:[n.name&&(0,Z.jsx)($n,{nowrap:!0,style:{fontSize:"16px",whiteSpace:"nowrap"},name:t("common.name"),value:n.name}),(0,Z.jsx)($n,{style:{fontSize:"16px",whiteSpace:"nowrap"},name:t("common.issuer"),value:Se()(n,"meta.issuer.commonName","")}),(0,Z.jsx)($n,{style:{fontSize:"16px",whiteSpace:"nowrap"},icon:(0,Z.jsx)(Nt.Z,{title:n.isProtected?t("router.cert.protectedCertHelperText"):t("router.cert.unprotectedCertHelperText"),children:(0,Z.jsx)(Tn.Z,{style:{fontSize:"18px"},color:"secondary"})}),name:t("common.protected"),value:n.isProtected?t("common.yes"):t("common.no")})]})}}},{label:t("router.cert.boundDomains"),name:"",options:{sort:!1,filter:!1,customBodyRenderLite:e=>{const t=m[e];return(0,Z.jsx)(l.Z,{noWrap:!0,component:"ul",style:{listStyle:"none"},children:[...new Set([...Se()(t,"meta.sans")||[],t.domain])].map((e=>(0,Z.jsx)(l.Z,{component:"li",title:e,style:{fontSize:"1.1rem",minWidth:200,whiteSpace:"initial",wordBreak:"break-all"},children:e},e)))})}}},{label:t("router.cert.source"),name:"",options:{sort:!1,filter:!1,customBodyRenderLite:e=>{const n=m[e];return t("router.cert.sourceTypes.".concat(n.source))}}},{label:t("common.status"),name:"",width:100,options:{sort:!1,filter:!1,customBodyRenderLite:e=>{const t=m[e];return(0,Z.jsx)(tr,{status:t.status,source:t.source,expiresTime:Se()(t,"meta.validTo")})}}},{label:t("common.expires"),name:"",options:{sort:!1,filter:!1,customBodyRenderLite:e=>{const t=m[e];return(0,Z.jsx)(pe.Z,{value:Se()(t,"meta.validTo"),locale:n})}}},{label:t("router.cert.matchedSites"),name:"",options:{sort:!1,filter:!1,customBodyRenderLite:e=>{const t=m[e];return(0,Z.jsx)(Qn,{id:t.id,certificate:t,style:{minWidth:200,whiteSpace:"initial",wordBreak:"break-all"}})}}},{label:t("router.cert.action"),name:"",align:"center",options:{sort:!1,filter:!1,customBodyRenderLite:e=>{const t=m[e];return(0,Z.jsx)($.Z,{permission:"mutate_router",children:(0,Z.jsxs)(Z.Fragment,{children:[!t.isProtected&&(0,Z.jsxs)(Z.Fragment,{children:["upload"===t.source&&(0,Z.jsx)("div",{children:(0,Z.jsx)(Fn,{mode:"update",certificate:t,onRefresh:d})}),(0,Z.jsx)("div",{children:(0,Z.jsx)(Bn,{id:t.id,onDelete:d})})]}),(0,Z.jsx)("div",{children:(0,Z.jsx)(Vn,{id:t.id,certificate:t})})]})})}}}];if(s.error)return(0,Z.jsx)(G.Z,{type:"error",children:(0,x.Z)(s.error)});if(s.loading)return(0,Z.jsx)(q.Z,{});const f=(0,fe.$)(Jn);return(0,Z.jsx)(ir,{children:(0,Z.jsx)(fe.Z,{title:(0,Z.jsx)($.Z,{permission:"mutate_router",children:(0,Z.jsx)(Fn,{mode:"add",onRefresh:d,variant:"contained"})}),locale:n,data:s.value.certificates,columns:p,verticalKeyWidth:100,durable:Jn,options:{search:!1,download:!1,filter:!1,print:!1,...f}})})}const ir=a.Z.div(Wn||(Wn=(0,r.Z)(["\n .header {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n margin-top: 20px;\n }\n\n margin-bottom: 24px;\n .table-cell {\n span {\n font-size: 18px;\n }\n @media (max-width: ","px) {\n span {\n font-size: 15px;\n }\n }\n }\n .match-sites-cell,\n .expires-cell {\n min-width: 100px;\n }\n .actions {\n text-align: center;\n @media (max-width: ","px) {\n .MuiButton-root {\n padding: 6px;\n }\n }\n }\n"])),(e=>e.theme.breakpoints.values.sm),(e=>e.theme.breakpoints.values.sm));var ar,or=n(77150),lr=n(90067);const sr=(0,n(50844).Z)((e=>({root:{color:e.palette.primary.main,height:8},thumb:{height:24,width:24,backgroundColor:"#fff",border:"2px solid currentColor","&:focus, &:hover, &$active":{boxShadow:"inherit"}},valueLabel:{left:"calc(-50% + 4px)"},track:{height:8,borderRadius:4},rail:{height:8,borderRadius:4}})))(or.ZP);function cr(){const{info:{routing:e}}=(0,j.h6)(),{t:t}=(0,c.PE)(),[n,r]=(0,i.useState)(!1),a=e.requestLimit||{};"boolean"!==typeof a.enabled&&(a.enabled=!1),"number"!==typeof a.rate&&(a.rate=h.GATEWAY_REQ_LIMIT.min),a.ipHeader||(a.ipHeader="");const{handleSubmit:o,control:s,watch:d}=(0,M.cI)({defaultValues:{requestLimit:a,cacheEnabled:"boolean"!==typeof e.cacheEnabled||e.cacheEnabled}}),m=d("requestLimit.enabled"),u=d("requestLimit.rate"),p=async e=>{try{r(!0),await(0,v.Z)().updateGateway({input:e}),await(0,b._v)(1e3),z.Z.success(t("common.saveSuccess"))}catch(n){z.Z.error((0,b.Z)(n))}finally{r(!1)}};return(0,Z.jsx)(dr,{children:(0,Z.jsx)($.Z,{permission:"mutate_node",children:e=>(0,Z.jsxs)(ee,{className:"form",noValidate:!0,autoComplete:"off",onSubmit:o(p),children:[(0,Z.jsx)(M.Qr,{name:"cacheEnabled",control:s,render:n=>{let{field:{value:r,onChange:i}}=n;return(0,Z.jsx)(Y.Z,{checked:r,disabled:!e,onChange:e=>i(e.target.checked),labelProps:{label:(0,Z.jsx)(l.Z,{children:(0,Z.jsx)("span",{children:t("router.gateway.cacheEnabled.switchLabel")})})},style:{marginTop:16}})}}),(0,Z.jsx)(M.Qr,{name:"requestLimit.enabled",control:s,render:n=>{let{field:{value:r,onChange:i}}=n;return(0,Z.jsx)(Y.Z,{checked:r,disabled:!e,onChange:e=>i(e.target.checked),labelProps:{label:(0,Z.jsx)(l.Z,{children:(0,Z.jsx)("span",{children:t("router.gateway.reqLimit.switchLabel")})})},style:{marginTop:16}})}}),m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)("div",{className:"form-item",children:[(0,Z.jsx)(l.Z,{id:"request-limit-rate-label",gutterBottom:!0,children:t("router.gateway.reqLimit.rate",{rate:u})}),(0,Z.jsx)(M.Qr,{name:"requestLimit.rate",control:s,render:t=>{let{field:{value:n,onChange:r}}=t;return(0,Z.jsx)(sr,{disabled:!e,onChange:(e,t)=>r(t),defaultValue:n,valueLabelDisplay:"auto",step:1,min:h.GATEWAY_REQ_LIMIT.min,max:h.GATEWAY_REQ_LIMIT.max})}})]}),(0,Z.jsx)(M.Qr,{name:"requestLimit.ipHeader",control:s,render:r=>{let{field:{value:i,onChange:a}}=r;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W.Z,{variant:"outlined",disabled:n||!e,className:"form-item",label:t("router.gateway.reqLimit.ipHeaderLabel"),margin:"normal",value:i,onChange:a}),(0,Z.jsx)(lr.Z,{id:"req-limit-ip_header-desc",children:t("router.gateway.reqLimit.ipHeaderDesc")})]})}})]}),(0,Z.jsx)("div",{className:"form-actions",children:e&&(0,Z.jsxs)(B.Z,{disabled:n,onClick:o(p),color:"primary",variant:"contained","data-cy":"submit-btn",className:"form-submit",children:[t("common.save")," ",n&&(0,Z.jsx)(q.Z,{size:16})]})})]})})})}const dr=a.Z.div(ar||(ar=(0,r.Z)(["\n display: flex;\n align-items: flex-start;\n width: 100%;\n max-width: 720px;\n"])));var mr;function ur(){const e=(0,o.useNavigate)(),{node:t}=(0,i.useContext)(j.sy),{t:n}=(0,i.useContext)(c.RD),{tab:r="basic"}=(0,o.useParams)(),a=[{label:n("common.basic"),value:"basic"},{label:n("router.routerSetting"),value:"router"},{label:n("router.certSetting"),value:"cert"},{label:n("common.gateway"),value:"gateway"},{label:n("common.webhook"),value:"integration"},{label:n("common.about"),value:"about"}],d={basic:le,integration:ve,about:Je,router:(0,Z.jsx)(A,{children:(0,Z.jsx)(Sn,{})}),gateway:cr,cert:(0,Z.jsx)(A,{children:(0,Z.jsx)(rr,{})})},m=d[r]||d.basic;return(0,Z.jsxs)(pr,{children:[(0,Z.jsx)(l.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:n("common.setting")}),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s.Z,{tabs:a,current:r,onChange:t=>{e("/settings/".concat(t))},scrollButtons:"auto"}),(0,Z.jsx)("div",{className:"page-content",children:(0,i.isValidElement)(m)?m:(0,Z.jsx)(m,{node:t})})]})]})}const pr=a.Z.main(mr||(mr=(0,r.Z)(["\n .page-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .page-content {\n margin-top: 16px;\n }\n"])))},44543:(e,t,n)=>{const r=n(57156);e.exports=(e,t)=>r(e)===r(t)},44784:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r,i=n(71171),a=n(33518),o=n(82790),l=n(96266);function s(e){let{labelProps:t,className:n,style:r,...i}=e;const a={...t,labelPlacement:(null===t||void 0===t?void 0:t.labelPlacement)||"start"};return(0,l.jsx)(c,{className:n,style:r,children:(0,l.jsx)(o.Z,{labelProps:a,...i})})}s.propTypes=o.Z.propTypes,s.defaultProps=o.Z.defaultProps;const c=a.Z.div(r||(r=(0,i.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(e=>{let{theme:t}=e;return t.breakpoints.down("sm")})),d=s},81010:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(5057),i=n(55898),a=n.n(i),o=n(44846),l=n(75239),s=n(68420),c=n(38242),d=n(69569),m=n(22228),u=n(96266);const p={yellow:"#FFCF71",grey:"#888888"};function f(e){let{status:t,variant:n,source:i,...a}=e;const{t:f}=(0,r.useContext)(s.RD),h={added:p.grey,waiting:p.yellow,downloading: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},x=(0,c.isInProgress)(t),g=f("blocklet.status.".concat(t));return"dot"===n?(0,u.jsx)(l.Z,{title:f("blocklet.statusTip",{status:g}),children:(0,u.jsx)(d.Z,{color:h[t],...a})}):(0,u.jsxs)(m.Z,{type:{added:"primary",waiting:"warning",downloading:"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"}[t],...a,children:[x&&(0,u.jsx)(o.Z,{size:12,color:"inherit",style:{marginRight:5}}),g]})}f.propTypes={status:a().string.isRequired,variant:a().oneOf(["dot","tag"]),source:a().string},f.defaultProps={variant:"tag",source:""}},78410:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(5057),i=n(86229),a=n(28726),o=n(44846),l=n(68420),s=n(14491),c=n(58238),d=n(70461),m=n(96266);function u(e){let{teamDid:t,size:n="small",...u}=e;const{t:p}=(0,l.PE)(),{api:f}=(0,c.h6)(),[h,x]=(0,r.useState)(!1),[g,y]=(0,r.useState)(null),j={title:p("blocklet.config.clearCache.title"),description:p("blocklet.config.clearCache.description"),confirm:p("common.confirm"),cancel:p("common.cancel"),onConfirm:async()=>{try{var e;x(!0);const n=await f.clearCache({input:{teamDid:t}});i.Z.success(p("blocklet.config.clearCache.success",{count:(null===(e=n.removed)||void 0===e?void 0:e.length)||0}))}catch(n){i.Z.error((0,s.Z)(n))}finally{x(!1),y(null)}},onCancel:()=>{x(!1),y(null)}};return(0,m.jsxs)("div",{...u,children:[(0,m.jsxs)(a.Z,{onClick:()=>y(j),color:"error",variant:"outlined",size:n,children:[h?(0,m.jsx)(o.Z,{size:16,style:{marginRight:5}}):null,p("blocklet.config.clearCache.action")]}),g&&(0,m.jsx)(d.Z,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}},50185:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(5057),i=n(55898),a=n.n(i),o=n(12937),l=n(68420),s=n(96266);function c(e){let{children:t,...n}=e;const{t:i}=(0,r.useContext)(l.RD);return(0,s.jsx)(o.Z,{tip:i("common.copyTip"),copiedTip:i("common.copiedTip"),...n,children:t})}c.propTypes={children:a().any.isRequired}},71363:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(55898),i=n.n(r),a=n(11750),o=n(47020),l=n(93938),s=n(68420),c=n(50185),d=n(70461),m=n(96266);function u(e){let{title:t,description:n,confirmPlaceholder:r,cancel:i,confirm:u,params:p,onCancel:f,onConfirm:h,keyName:x}=e;const{t:g}=(0,s.PE)(),y={title:()=>(0,m.jsxs)("div",{children:[t," (".concat(x,")")]}),description:(e,t)=>(0,m.jsxs)("div",{children:[(0,m.jsx)(l.Z,{severity:"warning",style:{width:"100%"},children:g("common.notice")}),(0,m.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:n}}),(0,m.jsxs)("div",{style:{marginBottom:24},children:[g("common.click"),"\uff1a",(0,m.jsx)(c.Z,{"data-cy":"click-copy",children:x})]}),(0,m.jsx)(a.Z,{component:"div",children:(0,m.jsx)(o.Z,{label:r,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:n=>{var r;r={...e,inputVal:n.target.value,__disableConfirm:x!==n.target.value},t({...r,__disableConfirm:r.__disableConfirm})}})})]}),confirm:u,cancel:i,onConfirm:h,onCancel:f,params:{inputVal:"",__disableConfirm:!0,...p}};return(0,m.jsx)(d.Z,{title:y.title,description:y.description,confirm:y.confirm,cancel:y.cancel,params:y.params,onConfirm:y.onConfirm,onCancel:y.onCancel})}u.propTypes={title:i().any.isRequired,keyName:i().any.isRequired,description:i().any.isRequired,confirmPlaceholder:i().any.isRequired,cancel:i().string,confirm:i().string,params:i().object,onCancel:i().func,onConfirm:i().func.isRequired},u.defaultProps={onCancel:()=>{},cancel:"",confirm:"Confirm",params:{}}},69569:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r,i=n(71171),a=n(33518);const o={success:"#3ab39d",error:"#D0021B"},l="10px",s=a.Z.div(r||(r=(0,i.Z)(["\n display: inline-block;\n min-width: ",";\n min-height: ",";\n background: ",";\n border-radius: 100%;\n"])),(e=>e.size||l),(e=>e.size||l),(e=>o[e.color]||e.color||o.success))},22228:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(55898),i=n.n(r),a=n(19778),o=n(96266);function l(e){let{children:t,style:n,...r}=e;return(0,o.jsx)(a.Z,{style:n,...r,children:t})}l.propTypes={children:i().any.isRequired,style:i().object},l.defaultProps={style:{}}}}]);
|