@abtnode/blocklet-services 1.16.19-beta-710018ca → 1.16.19-beta-7d3ef675

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/api/index.js +3 -2
  2. package/build/asset-manifest.json +37 -35
  3. package/build/index.html +1 -1
  4. package/build/service-worker.js +1 -1
  5. package/build/service-worker.js.map +1 -1
  6. package/build/static/js/{1148.67f53e43.chunk.js → 1148.d3c53aea.chunk.js} +2 -2
  7. package/build/static/js/{6084.30821f2c.chunk.js → 1249.ce085f29.chunk.js} +3 -3
  8. package/build/static/js/{2291.37b0ad3a.chunk.js → 2291.7ffdc7df.chunk.js} +2 -2
  9. package/build/static/js/2506.dd9284b6.chunk.js +2 -0
  10. package/build/static/js/{3025.7c99c058.chunk.js → 3025.76882d0f.chunk.js} +2 -2
  11. package/build/static/js/3557.bfa0e436.chunk.js +2 -0
  12. package/build/static/js/371.5ff795df.chunk.js +2 -0
  13. package/build/static/js/{4319.9f120992.chunk.js → 4319.8d9e189e.chunk.js} +2 -2
  14. package/build/static/js/6139.4c62883c.chunk.js +2 -0
  15. package/build/static/js/6271.0a698298.chunk.js +2 -0
  16. package/build/static/js/6311.d6addc15.chunk.js +2 -0
  17. package/build/static/js/{7858.b08b86e5.chunk.js → 7858.7726a169.chunk.js} +2 -2
  18. package/build/static/js/7892.46f78f2c.chunk.js +2 -0
  19. package/build/static/js/{8622.c87f0f5b.chunk.js → 8622.03f917b3.chunk.js} +2 -2
  20. package/build/static/js/8944.7444f668.chunk.js +2 -0
  21. package/build/static/js/main.81fbc388.js +3 -0
  22. package/package.json +18 -18
  23. package/build/static/js/3076.28658ffc.chunk.js +0 -2
  24. package/build/static/js/6032.406db269.chunk.js +0 -2
  25. package/build/static/js/6139.161b2e7f.chunk.js +0 -2
  26. package/build/static/js/7419.4eabaec0.chunk.js +0 -2
  27. package/build/static/js/8181.bc510ea3.chunk.js +0 -2
  28. package/build/static/js/8944.d3a98445.chunk.js +0 -2
  29. package/build/static/js/9314.2073578f.chunk.js +0 -2
  30. package/build/static/js/main.43cea647.js +0 -3
  31. /package/build/static/js/{6084.30821f2c.chunk.js.LICENSE.txt → 1249.ce085f29.chunk.js.LICENSE.txt} +0 -0
  32. /package/build/static/js/{main.43cea647.js.LICENSE.txt → main.81fbc388.js.LICENSE.txt} +0 -0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.19-beta-710018ca",
6
+ "version": "1.16.19-beta-7d3ef675",
7
7
  "description": "Provide unified services for every blocklet",
8
8
  "main": "api/index.js",
9
9
  "files": [
@@ -33,17 +33,17 @@
33
33
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
34
34
  "license": "Apache-2.0",
35
35
  "dependencies": {
36
- "@abtnode/analytics": "1.16.19-beta-710018ca",
37
- "@abtnode/auth": "1.16.19-beta-710018ca",
38
- "@abtnode/client": "1.16.19-beta-710018ca",
39
- "@abtnode/connect-storage": "1.16.19-beta-710018ca",
40
- "@abtnode/constant": "1.16.19-beta-710018ca",
41
- "@abtnode/core": "1.16.19-beta-710018ca",
42
- "@abtnode/cron": "1.16.19-beta-710018ca",
43
- "@abtnode/logger": "1.16.19-beta-710018ca",
44
- "@abtnode/models": "1.16.19-beta-710018ca",
45
- "@abtnode/router-templates": "1.16.19-beta-710018ca",
46
- "@abtnode/util": "1.16.19-beta-710018ca",
36
+ "@abtnode/analytics": "1.16.19-beta-7d3ef675",
37
+ "@abtnode/auth": "1.16.19-beta-7d3ef675",
38
+ "@abtnode/client": "1.16.19-beta-7d3ef675",
39
+ "@abtnode/connect-storage": "1.16.19-beta-7d3ef675",
40
+ "@abtnode/constant": "1.16.19-beta-7d3ef675",
41
+ "@abtnode/core": "1.16.19-beta-7d3ef675",
42
+ "@abtnode/cron": "1.16.19-beta-7d3ef675",
43
+ "@abtnode/logger": "1.16.19-beta-7d3ef675",
44
+ "@abtnode/models": "1.16.19-beta-7d3ef675",
45
+ "@abtnode/router-templates": "1.16.19-beta-7d3ef675",
46
+ "@abtnode/util": "1.16.19-beta-7d3ef675",
47
47
  "@arcblock/did": "^1.18.95",
48
48
  "@arcblock/did-auth": "1.18.95",
49
49
  "@arcblock/did-ext": "^1.18.95",
@@ -52,11 +52,11 @@
52
52
  "@arcblock/jwt": "1.18.95",
53
53
  "@arcblock/validator": "^1.18.95",
54
54
  "@arcblock/ws": "1.18.95",
55
- "@blocklet/constant": "1.16.19-beta-710018ca",
55
+ "@blocklet/constant": "1.16.19-beta-7d3ef675",
56
56
  "@blocklet/form-builder": "^0.1.11",
57
57
  "@blocklet/form-collector": "^0.1.6",
58
- "@blocklet/meta": "1.16.19-beta-710018ca",
59
- "@blocklet/sdk": "1.16.19-beta-710018ca",
58
+ "@blocklet/meta": "1.16.19-beta-7d3ef675",
59
+ "@blocklet/sdk": "1.16.19-beta-7d3ef675",
60
60
  "@did-connect/authenticator": "^2.2.1",
61
61
  "@did-connect/relay-adapter-express": "^2.2.1",
62
62
  "@ocap/client": "1.18.95",
@@ -96,12 +96,12 @@
96
96
  },
97
97
  "resolutions": {},
98
98
  "devDependencies": {
99
- "@abtnode/ux": "1.16.19-beta-710018ca",
99
+ "@abtnode/ux": "1.16.19-beta-7d3ef675",
100
100
  "@arcblock/did-connect": "^2.8.16",
101
101
  "@arcblock/icons": "^2.8.16",
102
102
  "@arcblock/ux": "^2.8.16",
103
103
  "@blocklet/launcher-layout": "2.2.40",
104
- "@blocklet/tracker": "1.16.19-beta-710018ca",
104
+ "@blocklet/tracker": "1.16.19-beta-7d3ef675",
105
105
  "@blocklet/ui-react": "^2.8.16",
106
106
  "@emotion/react": "^11.10.4",
107
107
  "@emotion/styled": "^11.10.4",
@@ -172,5 +172,5 @@
172
172
  "url": "https://github.com/ArcBlock/blocklet-server/issues",
173
173
  "email": "shijun@arcblock.io"
174
174
  },
175
- "gitHead": "23518dd7a84664e2a015284d5867cc31540fbdb0"
175
+ "gitHead": "af968e7bab22e67bd42d3dc93ff3ce827b9a91fe"
176
176
  }
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[3076],{13076:function(e,n,t){t.r(n),t.d(n,{default:function(){return ut}});var r=t(33028),o=t(59740),a=t(19611),i=t.n(a),l=t(68079),c=t(71171),s=t(32723),u=t(34795),d=t(96234),p=t(30969),m=t(16380),f=t(24974),h=t.n(f),x=t(84636),Z=t(38361),v=t(87130),g=t(38357),b=t(91862),y=t(46973),k=t(94551),j=t(3715),C=t(51711),E=t(85385),R=t(55829),P=t(11909),T=t(3994),S=t(6779),_=t(88412),w=t(88876),I=t(13875),N=t(57256),U=t(10814),O=t(49884),L=t(34159),D=t(96628),G=t(20244),B=t(94308),z=t(70177),W=t(26022),q=t(29996),A=t(78789),M=t(7017),Y=t(6399),F=t.n(Y),V=t(1986),K=t(43820),H=t(36558),X=t(61472),J=t(2878),$=t.n(J),Q=t(9715),ee=t(19638),ne=t(37574);function te(e){var n,t=e.sourceInfo,r=e.blocklet,o=(0,p.useContext)(W.RD).t;return(0,ne.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)(Q.Z,{type:"success",children:$()(t.source)},"source"),"registry"===t.source&&(0,ne.jsx)(ee.Z,{href:i()(t.deployedFrom,"blocklets",(null===r||void 0===r||null===(n=r.meta)||void 0===n?void 0:n.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:o("blocklet.overview.viewInStore")})]})}te.propTypes={sourceInfo:h().shape({source:h().string,deployedFrom:h().string}),blocklet:h().object},te.defaultProps={sourceInfo:{},blocklet:{}};var re=t(94282),oe=t(88397),ae=t(59505),ie=t(8479),le=t(41395),ce=t(24891),se=t(22572),ue=["blocklet","checkUpgrade","hasPermission"];function de(e){var n=e.blocklet,t=e.checkUpgrade,a=e.hasPermission,i=(0,o.Z)(e,ue),l=(0,le.h6)().api,c=(0,p.useContext)(W.RD).t,m=(0,p.useState)(!1),f=(0,d.Z)(m,2),h=f[0],x=f[1],Z=(0,p.useState)(""),v=(0,d.Z)(Z,2),g=v[0],b=v[1],y=(0,p.useState)(null),j=(0,d.Z)(y,2),C=j[0],E=j[1],R=(0,p.useState)(null),P=(0,d.Z)(R,2),T=P[0],_=P[1];(0,p.useEffect)((function(){E(null),t&&(n.mode,ae.BLOCKLET_MODES.DEVELOPMENT)}),[n,t]);var w=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!0),e.prev=1,t={did:n.meta.did,version:C.version,storeUrl:C.registryUrl||""},e.next=5,(0,ce._v)(2e3);case 5:return e.next=7,l.upgradeBlocklet({input:t});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),V.Z.error("Blocklet upgrade failed: ".concat((0,ce.Z)(e.t0)));case 12:return e.prev=12,x(!1),_(null),e.finish(12);case 16:case"end":return e.stop()}}),e,null,[[1,9,12,16]])})));return function(){return e.apply(this,arguments)}}(),I={title:"".concat(c("common.upgrade")," ").concat(c("common.blocklet")," ").concat((0,M.getDisplayName)(n)),description:c("blocklet.action.upgradeDescription"),confirm:c("blocklet.action.confirmUpgrade"),cancel:c("common.cancel"),onConfirm:w,onCancel:function(){x(!1),_(null)}};return a&&C&&!(0,M.isInProgress)(n.status)?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({},i),{},{children:n.meta.version})),(0,ne.jsx)(S.Z,{title:c("common.updateAvailable",{version:C.version}),children:(0,ne.jsx)(k.Z,{size:"small",style:{marginLeft:8},disabled:h,onClick:function(){return _(I)},children:h?(0,ne.jsx)(B.Z,{size:16}):(0,ne.jsx)(oe.Z,{style:{fontSize:16,color:"red"}})})}),!!g&&(0,ne.jsx)(V.Z,{variant:"error",message:g,onClose:function(){return b("")}}),T&&(0,ne.jsx)(ie.Z,{title:T.title,description:T.description,confirm:T.confirm,cancel:T.cancel,params:T.params,onConfirm:T.onConfirm,onCancel:T.onCancel})]}):(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({},i),{},{children:n.meta.version}))}de.propTypes={blocklet:h().object.isRequired,checkUpgrade:h().bool,hasPermission:h().bool},de.defaultProps={checkUpgrade:!1,hasPermission:!1};var pe=(0,se.V)(de,"mutate_blocklets"),me=(0,se.V)(de,"",ce.Wf);function fe(e){return(0,le.h6)().inService?(0,ne.jsx)(me,(0,r.Z)({},e)):(0,ne.jsx)(pe,(0,r.Z)({},e))}var he=t(70998),xe=["mode"];function Ze(e){var n=e.mode,t=(0,o.Z)(e,xe);return"development"===n?(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({type:"primary"},t),{},{children:"DEV"})):null}Ze.propTypes={mode:h().string.isRequired};var ve,ge,be,ye=t(88356),ke=t(50496),je=t(19865),Ce=t(32666),Ee=t(87006),Re=t(18877),Pe=t(73820),Te=t(38996),Se=t(44181),_e=t(60306),we=t(56567),Ie=t(81172),Ne=t(75296),Ue=t(52838),Oe=t(81779),Le=t(90713),De=t(97475),Ge=t(65481),Be=t(83153),ze={Add:j.Z,Check:Te.default,Delete:U.default,Edit:ye.default,Clear:Se.default,DetailPanel:Ue.default,Filter:we.Z,FirstPage:Ie.default,LastPage:Ne.default,NextPage:Ue.default,PreviousPage:Oe.default,Search:Le.default,ResetSearch:Se.default,SortArrow:De.Z,Export:_e.default,ThirdStateCheck:Ge.default,ViewColumn:Be.default},We=m.Z.div(ve||(ve=(0,c.Z)(["\n .MuiPaper-root {\n box-shadow: none !important;\n border: none !important;\n border-radius: 0 !important;\n background: transparent;\n }\n .MuiToolbar-root {\n background: transparent;\n padding-left: 0;\n display: none;\n }\n\n &.show-pagination {\n .MuiTablePagination-toolbar {\n display: flex;\n }\n }\n\n .MuiTableHead-root th {\n min-width: 100px;\n background: transparent;\n }\n\n .MuiTable-root {\n overflow-y: hidden;\n }\n .MuiTableRow-root {\n border: none !important;\n }\n\n .MuiTableCell-root {\n padding-right: 16px;\n &:last-of-type {\n padding-right: 0;\n }\n }\n\n /* @material-table/core@next \u517c\u5bb9 mui v5, \u4f46 pagination \u6837\u5f0f\u4f3c\u4e4e\u6709\u4e9b\u95ee\u9898, \u6682\u5730\u5b9a\u5236\u4e0b\u9762\u7684\u6837\u5f0f\u4fee\u590d, \u540e\u9762\u8003\u8651\u5f03\u7528 material-table */\n .MuiTablePagination-selectLabel,\n .MuiTablePagination-displayedRows {\n display: none;\n }\n .MuiTypography-caption {\n display: inline-block;\n }\n .MuiTablePagination-selectLabel + .MuiInputBase-root {\n margin-right: 8px;\n }\n"]))),qe=t(55008),Ae=function(e,n){var t=e.description;return(Object.values(ae.CHAIN_PROP_MAP).includes(e.key)||(0,M.isEnvShareable)(e))&&(t=t?"".concat(t," (").concat(n("blocklet.config.sharedToAllComponents"),")"):n("blocklet.config.sharedToAllComponents")),t&&(0,ne.jsx)("div",{style:{marginLeft:12},children:t})},Me=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return!(null!==t&&void 0!==t&&t.length||e.custom||["CHAIN_ID","CHAIN_HOST"].includes(e.key)||n.meta.environments.find((function(n){return n.name===e.key}))||!n.children.every((function(n){return!n.meta.environments.find((function(n){return n.name===e.key}))})))||e.custom};function Ye(e){var n=e.blocklet,t=e.ancestors,o=(0,le.h6)(),a=o.inService,i=(0,p.useContext)(W.RD).t,c=[].concat((0,l.Z)(t.map((function(e){return e.meta.did}))),[n.meta.did]),d=function(){return V.Z.success(i("blocklet.config.changedTip"))},m=function(e){return Me(e,n,t)};if((0,ce.wS)(n.status))return null;if("unknown"===n.status&&(0,ce.wS)(n.status))return null;var f=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.key.trim()&&n.value.trim()){e.next=3;break}return V.Z.error(i("blocklet.config.environment.keyValueRequired")),e.abrupt("return");case 3:if(!n.key.startsWith("BLOCKLET_")&&!n.key.startsWith("COMPONENT_")){e.next=6;break}return V.Z.error(i("blocklet.config.environment.invalidKey")),e.abrupt("return");case 6:return n.custom=!0,e.next=9,o.api.configBlocklet({input:{did:c,configs:[n]}});case 9:"ok"===(t=e.sent).code&&d(t.blocklet);case 11:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),h=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(r,a){var l,u,p;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.required||r.key.trim()&&r.value.trim()){e.next=3;break}return V.Z.error(i("blocklet.config.environment.keyValueRequired")),e.abrupt("return");case 3:if(!r.key.startsWith("BLOCKLET_")||ae.BLOCKLET_CONFIGURABLE_KEY[r.key]){e.next=6;break}return V.Z.error(i("blocklet.config.environment.invalidKey")),e.abrupt("return");case 6:if(r.key!==ae.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){e.next=11;break}if(!(l=(0,ce.I)(r))){e.next=11;break}return V.Z.error(l),e.abrupt("return");case 11:if(u=[r],r.key===a.key){e.next=17;break}if(Me(r,n,t)){e.next=16;break}return V.Z.error("Only key of custom env can be changed"),e.abrupt("return");case 16:u.push({key:a.key,custom:!0});case 17:return e.prev=17,e.next=20,o.api.configBlocklet({input:{did:c,configs:u}});case 20:"ok"===(p=e.sent).code&&d(p.blocklet),e.next=27;break;case 24:e.prev=24,e.t0=e.catch(17),V.Z.error((0,ce.Z)(e.t0));case 27:case"end":return e.stop()}}),e,null,[[17,24]])})));return function(n,t){return e.apply(this,arguments)}}(),x=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(r){var a;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.required){e.next=3;break}return V.Z.error(i("blocklet.config.environment.deleteForbidden")),e.abrupt("return");case 3:if(Me(r,n,t)){e.next=6;break}return V.Z.error("Only key of custom env can be changed"),e.abrupt("return");case 6:return e.next=8,o.api.configBlocklet({input:{did:c,configs:[{key:r.key,custom:!0}]}});case 8:"ok"===(a=e.sent).code&&d(a.blocklet);case 10:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),Z=(n.configs||[]).filter((function(e){return!ae.BLOCKLET_CONFIGURABLE_KEY[e.key]})),v=(0,M.getSharedConfigObj)(t[0],n),g=(0,M.getComponentMissingConfigs)(n,t[0]),b=Z.map((function(e){return(0,r.Z)((0,r.Z)({},e),{},{value:Object.values(ae.CHAIN_PROP_MAP).includes(e.key)&&Object.keys(v).includes(e.key)?v[e.key]:v[e.key]||e.value})})),y=b.some((function(e){return e.key&&e.key.startsWith("BWA_")})),k={onRowAdd:f,onRowUpdate:h,onRowDelete:x,isDeletable:m};return(0,ne.jsxs)(Ve,{children:[!!g.length&&(0,ne.jsx)(Re.Z,{severity:"error",style:{marginTop:24},children:i("blocklet.config.missingRequired")}),y&&(0,ne.jsx)(Re.Z,{severity:"info",children:i("blocklet.config.environment.tip")}),(0,ne.jsx)(se.Z,{permission:a?"":"mutate_blocklets",role:a?ce.Wf:[],children:function(e){return(0,ne.jsx)(We,{className:"config-table",children:(0,ne.jsx)(Ce.ZP,{title:(0,ne.jsx)("h4",{children:i("common.environment")}),columns:[{title:i("common.key"),field:"key",initialEditValue:"Key",width:"30%",render:function(e){return(0,ne.jsx)(Pe.Z,{value:e.value,style:{color:e.required&&!e.value?"#ff4436":"#222222",fontWeight:e.required?"bold":"normal"},children:e.key})},editComponent:function(e){var n=e.value,t=e.rowData,r=e.onChange;return(0,ne.jsx)(Ke,{children:(0,ne.jsx)(Ee.Z,{fullWidth:!0,size:"small",disabled:!1===m(t),value:n,onChange:function(e){return r(e.target.value)},variant:"outlined",label:"Key",placeholder:i("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:i("common.value"),field:"value",initialEditValue:"Value",width:"calc((100% - (96px + 30%)) / 1)",render:function(e){return e.value?e.secure?"******":(0,ne.jsx)(Pe.Z,{unstyled:!0,value:e.value,style:{wordBreak:"break-all"},children:e.value}):null},editComponent:function(e){var n=e.value,t=e.rowData,r=e.onChange;return(0,ne.jsxs)(Ke,{children:[(0,ne.jsx)(Ee.Z,{fullWidth:!0,size:"small",value:"__encrypted__"===n?"":n,onChange:function(e){return r(e.target.value)},variant:"outlined",label:i("common.value"),placeholder:i("blocklet.config.environment.value"),margin:"dense",autoFocus:!0}),Ae(t,i)]})}}],icons:(0,r.Z)((0,r.Z)({},qe.Z),ze),options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1},localization:{header:{actions:i("common.actions")},body:{emptyDataSourceMessage:i("common.noData")}},data:b,editable:e?k:{}})})}})]})}Ye.propTypes={blocklet:h().object.isRequired,ancestors:h().array},Ye.defaultProps={ancestors:[]};var Fe,Ve=m.Z.div(ge||(ge=(0,c.Z)(["\n .config-table {\n margin-bottom: 24px;\n position: relative;\n .hide-control {\n position: absolute;\n top: 10px;\n left: 200px;\n @media (max-width: ","px) {\n left: 160px;\n }\n }\n\n .MuiToolbar-root {\n display: flex;\n }\n\n .MuiTableRow-head {\n display: none;\n }\n\n &.hide-header {\n .MuiToolbar-root {\n display: none;\n }\n }\n }\n\n .accordion {\n margin-bottom: 16px;\n &:last-of-type {\n margin-bottom: 0;\n }\n padding: 8px 0 8px 0px;\n &.MuiAccordion-root {\n background: transparent;\n box-shadow: none;\n border: 1px solid #ddd;\n border-radius: 4px;\n &::before,\n &::after {\n height: 0;\n }\n .MuiAccordionSummary-root {\n padding-left: 0;\n }\n .accordion-title {\n font-weight: bold;\n padding-left: 16px;\n }\n }\n }\n"])),(function(e){return e.theme.breakpoints.values.sm})),Ke=m.Z.div(be||(be=(0,c.Z)(["\n height: 60px;\n"]))),He=t(88617),Xe=t.n(He),Je=t(67019),$e=["blocklet","ancestors","hasPermission"];function Qe(e){var n=e.blocklet,t=e.ancestors,a=e.hasPermission,i=(0,o.Z)(e,$e),l=(0,W.PE)().t,c=(0,le.h6)().api,m=!t.length,f=m?n.meta.did:t.map((function(e){return e.meta.did}))[0],h=(0,p.useState)(""),x=(0,d.Z)(h,2),v=x[0],g=x[1],b=(0,p.useState)(""),y=(0,d.Z)(b,2),k=y[0],j=y[1],C=v||!a;if(!f)return null;if("unknown"===n.status&&(0,ce.wS)(n.status))return null;var E=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){var r;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g(!0),e.prev=1,r={rootDid:f,mountPoint:Xe()(t)},m||(r.did=n.meta.did),e.next=6,c.updateComponentMountPoint({input:r});case 6:return g(!1),e.abrupt("return",!0);case 10:throw e.prev=10,e.t0=e.catch(1),g(!1),e.t0.message=(0,ce.Z)(e.t0),V.Z.error(e.t0.message),e.t0;case 16:case"end":return e.stop()}}),e,null,[[1,10]])})));return function(n){return e.apply(this,arguments)}}();return(0,ne.jsx)(on,(0,r.Z)((0,r.Z)({component:"div"},i),{},{children:(0,ne.jsx)(Z.Z,{mt:3,children:(0,ne.jsx)(Je.Z,{label:l("blocklet.component.mountPoint"),style:{marginTop:-24},disabled:v||C,loading:v,required:!0,initialValue:n.mountPoint,onSubmit:E,onChange:function(e){j(l("common.slugifyHint",{value:(0,ce.LN)(e)}))},helperText:k,formatterBeforeSubmit:function(e){return Xe()(e)}})})}))}var en=(0,se.V)(Qe,"mutate_blocklets"),nn=(0,se.V)(Qe,"",ce.Wf);function tn(e){return(0,le.h6)().inService?(0,ne.jsx)(nn,(0,r.Z)({},e)):(0,ne.jsx)(en,(0,r.Z)({},e))}Qe.propTypes={blocklet:h().object.isRequired,ancestors:h().array,hasPermission:h().bool},Qe.defaultProps={ancestors:[],hasPermission:!1};var rn,on=m.Z.div(Fe||(Fe=(0,c.Z)([""])));function an(e){var n=e.blocklet,t=e.ancestors,r=e.children,o=(0,p.useState)(""),a=(0,d.Z)(o,2),i=a[0],l=a[1],c=(0,W.PE)().t,s=!!t.length,u=(0,p.useState)("settings"),m=(0,d.Z)(u,2),f=m[0],h=m[1],x=s?(0,M.getDisplayName)(n,!0):c("blocklet.component.container");if((0,ce.wS)(n.status))return null;if("unknown"===n.status&&(0,ce.wS)(n.status))return null;var v=function(e){e.stopPropagation(),l(!0)},g={settings:{label:c("blocklet.component.setting"),value:"settings",component:(0,ne.jsx)(tn,{blocklet:n,ancestors:t})},environments:{label:c("common.environment"),value:"environments",component:(0,ne.jsx)(Ye,{blocklet:n,ancestors:t})}},b=Object.values(g).map((function(e){return{label:e.label,value:e.value}})),y=g[f]||g.settings;return["function"===typeof r?r({open:v}):(0,ne.jsx)(k.Z,{onClick:v,"data-cy":"action-config-component",children:(0,ne.jsx)(ye.default,{})}),i&&(0,ne.jsx)(cn,{open:!0,fullWidth:!0,maxWidth:"md",title:x,onClose:function(){l(!1)},PaperProps:{style:{minHeight:"auto"}},children:s?(0,ne.jsxs)(Z.Z,{mt:1,children:[(0,ne.jsx)(je.Z,{tabs:b,current:f,onChange:function(e){h(e)},scrollButtons:"auto"}),y.component]}):(0,ne.jsx)(Ye,{blocklet:n,ancestors:t})})]}an.propTypes={blocklet:h().object.isRequired,ancestors:h().array,children:h().any},an.defaultProps={ancestors:[],children:null};var ln,cn=(0,m.Z)(ke.ZP)(rn||(rn=(0,c.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),sn=t(33359),un=t(76492),dn=t(97517);function pn(e){var n=e.component,t=e.remove,o=e.disabled,a=e.tip,i=e.showConfirm,l=e.hideBtn,c=e.onCancel,m=(0,p.useContext)(W.RD).t,f=(0,p.useState)(!1),h=(0,d.Z)(f,2),x=h[0],Z=h[1],v=(0,p.useState)(null),g=(0,d.Z)(v,2),b=g[0],y=g[1],k=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Z(!0),e.next=3,t(n.component,n.removeType);case 3:Z(!1),y(null);case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),j=o||x,C=function(){y({title:"".concat(m("common.delete")," ").concat(n.meta.title||n.meta.name),description:function(e,n){return(0,ne.jsxs)(sn.Z,{component:"div",children:[(0,ne.jsx)(sn.Z,{gutterBottom:!0,children:m("blocklet.action.removeComponentDescription")}),(0,ne.jsxs)(dn.Z,{name:"removeType",value:e.removeType,onChange:function(t){return n((0,r.Z)((0,r.Z)({},e),{},{removeType:t.target.value}))},children:[(0,ne.jsx)(O.Z,{value:"keepData",control:(0,ne.jsx)(un.Z,{}),label:m("blocklet.action.removeComponentKeepData")}),(0,ne.jsx)(O.Z,{value:"complete",control:(0,ne.jsx)(un.Z,{}),label:m("blocklet.action.removeComponentComplete")})]})]})},confirm:m("common.confirm"),cancel:m("common.cancel"),params:{component:n,removeType:"keepData"},onConfirm:k,onCancel:function(){y(null),c()}})};(0,p.useEffect)((function(){i?C():(Z(!1),y(null))}),[i]);var E=(0,ne.jsx)(fn,{size:"small",disabled:j,onClick:function(){return C},"data-cy":"delete-component-btn",children:(0,ne.jsx)(U.default,{disabled:j})}),R=(0,ne.jsx)(S.Z,{title:a||m("common.delete"),children:(0,ne.jsx)("span",{children:E})});return(0,ne.jsxs)(ne.Fragment,{children:[!l&&R,b&&(0,ne.jsx)(ie.Z,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]})}pn.propTypes={component:h().object.isRequired,remove:h().func,onCancel:h().func,disabled:h().bool,showConfirm:h().bool,hideBtn:h().bool,tip:h().string},pn.defaultProps={remove:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),disabled:!1,showConfirm:!1,hideBtn:!1,onCancel:function(){},tip:""};var mn,fn=(0,m.Z)(k.Z)(ln||(ln=(0,c.Z)(["\n &.Mui-disabled {\n opacity: 0.5;\n }\n"]))),hn=t(8825),xn=t(60003);function Zn(e){var n=e.component,t=e.onStart,r=e.onStop,o=e.disabled,a=e.tip,i=(0,p.useContext)(W.RD).t,l=(0,p.useState)(!1),c=(0,d.Z)(l,2),m=c[0],f=c[1],h=(0,p.useState)(),x=(0,d.Z)(h,2),Z=x[0],v=x[1],g=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,t(n);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),V.Z.error(e.t0.message);case 9:f(!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(n);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),V.Z.error(e.t0.message);case 9:f(!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),y=o||m,k=["starting","running","stopping"].includes(n.status),j=k?xn.Z:hn.Z,C=(0,ne.jsx)(gn,{disabled:y,onClick:function(){var e;k?v({title:"".concat(i("common.stop")," ").concat(null===n||void 0===n||null===(e=n.meta)||void 0===e?void 0:e.title),description:i("blocklet.action.stopComponentDescription"),confirm:i("blocklet.action.confirmStop"),cancel:i("common.cancel"),onConfirm:function(){return v(null),b()},onCancel:function(){return v(null)}}):g()},"data-cy":"".concat(k?"stop":"start","-component-btn"),children:(0,ne.jsx)(j,{disabled:y})});return[(0,ne.jsx)(S.Z,{title:a||i("common.".concat(k?"stop":"start")),children:(0,ne.jsx)("span",{children:C})},"btn"),Z&&(0,ne.jsx)(ie.Z,{title:Z.title,description:Z.description,confirm:Z.confirm,cancel:Z.cancel,params:Z.params,onConfirm:Z.onConfirm,onCancel:Z.onCancel},"connect")]}Zn.propTypes={component:h().object.isRequired,onStart:h().func,onStop:h().func,disabled:h().bool,tip:h().string},Zn.defaultProps={onStart:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onStop:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),disabled:!1,tip:""};var vn,gn=(0,m.Z)(k.Z)(mn||(mn=(0,c.Z)(["\n &.Mui-disabled {\n opacity: 0.5;\n }\n"]))),bn=t(2569),yn=t(2689),kn=t(1437),jn=t(75255),Cn="blocklet-add-component-registry",En="server-add-registry",Rn=t(78181);function Pn(e){var n=e.blocklet,t=e.children,r=(0,W.PE)().t,o=(0,p.useState)(!1),a=(0,d.Z)(o,2),i=a[0],l=a[1],c=(0,jn.Z)((function(e){return e.breakpoints.down("md")})),s=(0,le.h6)().inService,u=function(){l(!1)},m=function(e){e.stopPropagation(),l(!0)};return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof t?t({open:m}):(0,ne.jsxs)(yn.Z,{onClick:m,className:"component-action","data-cy":"action-add-component",children:[(0,ne.jsx)(kn.Z,{style:{fontSize:18,marginRight:5}}),r("blocklet.component.add")]}),i&&(0,ne.jsx)(Tn,{title:r("blocklet.component.addWithName",{name:(0,M.getDisplayName)(n)}),maxWidth:!1,fullWidth:!1,PaperProps:{style:c?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:function(e,n){"backdropClick"!==n&&u()},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:(0,ne.jsx)(Rn.default,{onClose:u,storageKey:s?Cn:En})})]})}Pn.propTypes={children:h().any,blocklet:h().object.isRequired},Pn.defaultProps={children:null};var Tn=(0,m.Z)(ke.ZP)(vn||(vn=(0,c.Z)(["\n .MuiDialogContent-root {\n }\n"]))),Sn=t(45008),_n=t(52654),wn=function(e){return e.children.filter((function(e){return e.meta.interfaces.find((function(e){return e.type===ae.BLOCKLET_INTERFACE_TYPE_WEB}))}))};function In(e){var n=e.params,t=e.setParams,o=e.setError,a=e.serviceTypes,i=(0,W.PE)().t,l=(0,Sn.y0)().blocklet,c=l.meta.did,s=wn(l),u=(0,p.useState)([]),m=(0,d.Z)(u,2),f=m[0],h=m[1],x={301:i("common.redirectPermanently"),302:i("common.redirectTemporary"),307:i("common.redirectTemporary"),308:i("common.redirectPermanently")};return(0,p.useEffect)((function(){if(n.type===G.ROUTING_RULE_TYPES.COMPONENT&&n.componentId){var e=s.find((function(e){return e.meta.did===n.componentId})),o=(0,M.findWebInterface)(e.meta),a=(Array.isArray(null===o||void 0===o?void 0:o.pageGroups)?o.pageGroups:[]).map((function(e){return{value:e,label:"".concat(e," pages")}}));a.length&&a.unshift({value:"",label:"All pages"}),h(a),n.pageGroup&&!1===a.find((function(e){return e.value===n.pageGroup}))&&t((0,r.Z)((0,r.Z)({},n),{},{pageGroups:""}))}}),[n.componentId,n.type]),(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(Ee.Z,{select:!0,label:i("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:n.type,onChange:function(e){o(""),t((0,r.Z)((0,r.Z)({},n),{},{type:e.target.value,did:e.target.value===G.ROUTING_RULE_TYPES.BLOCKLET?c:"",__disableConfirm:!1}))},style:{marginBottom:32},SelectProps:{},children:a.map((function(e){var n=e.name,t=e.value;return(0,ne.jsx)(yn.Z,{value:t,children:n},t)}))}),n.type===G.ROUTING_RULE_TYPES.REDIRECT&&[(0,ne.jsx)(Ee.Z,{select:!0,label:i("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:n.redirectCode,onChange:function(e){return t((0,r.Z)((0,r.Z)({},n),{},{redirectCode:e.target.value}))},style:{marginBottom:32},SelectProps:{},children:Object.keys(x).map((function(e){return(0,ne.jsx)(yn.Z,{value:e,children:"".concat(x[e]," - ").concat(e)},e)}))},"redirectCode"),(0,ne.jsx)(Ee.Z,{label:i("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"redirect-url-input",fullWidth:!0,value:n.url,helperText:i("router.urlHelperText"),style:{marginBottom:32},onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{url:e.target.value,__disableConfirm:!e.target.value.trim()})),e.target.value.trim()?o(""):o(i("router.validation.redirectUrlRequired"))}},"redirectUrl")],n.type===G.ROUTING_RULE_TYPES.COMPONENT&&[(0,ne.jsx)(Ee.Z,{select:!0,label:i("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:n.componentId,onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{componentId:e.target.value}))},style:{marginBottom:32},SelectProps:{},children:s.map((function(e){return(0,ne.jsx)(yn.Z,{value:e.meta.did,selected:e.meta.did===n.componentId,children:(0,M.getDisplayName)(e,!0)},e.meta.did)}))},"componentId"),f.length?(0,ne.jsx)(Ee.Z,{select:!0,label:i("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:n.pageGroup,helperText:i("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{pageGroup:e.target.value}))},SelectProps:{},children:f.map((function(e){return(0,ne.jsx)(yn.Z,{value:e.value,selected:e.value===n.pageGroup,children:e.label},e.label)}))},"pageGroup"):null].filter(Boolean),n.type===G.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(0,ne.jsx)(Ee.Z,{label:i("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:n.url,helperText:i("router.urlHelperText"),style:{marginBottom:32},onChange:function(e){t((0,r.Z)((0,r.Z)({},n),{},{url:e.target.value,__disableConfirm:!e.target.value.trim()})),e.target.value.trim()?o(""):o(i("router.validation.rewriteUrlRequired"))}},"url")]})}function Nn(e){var n=e.children,t=(0,W.PE)().t,o=(0,le.h6)().api,a=(0,Sn.y0)().blocklet,i=(0,p.useState)(!1),l=(0,d.Z)(i,2),c=l[0],m=l[1],f=(0,p.useState)(null),h=(0,d.Z)(f,2),x=h[0],Z=h[1],v=a.meta.did,g=a.site.id,b=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(n){var r,a;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,_n.fX)(n,t);case 3:if(!(r=e.sent)){e.next=6;break}throw r;case 6:return m(!0),a={from:{pathPrefix:Xe()(n.pathPrefix)},to:{type:n.type}},n.type===G.ROUTING_RULE_TYPES.REDIRECT&&(a.to.url=n.url.trim(),a.to.redirectCode=n.redirectCode),n.type===G.ROUTING_RULE_TYPES.COMPONENT&&(a.to.did=v,a.to.componentId=n.componentId,a.to.pageGroup=n.pageGroup),n.type===G.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(a.to.url=Xe()(n.url)),e.next=13,o.addRoutingRule({input:{id:g,rule:a,teamDid:v}});case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),V.Z.error(e.t0.message);case 18:return e.prev=18,m(!1),Z(null),e.finish(18);case 22:case"end":return e.stop()}}),e,null,[[0,15,18,22]])})));return function(n){return e.apply(this,arguments)}}(),y={title:t("router.rule.add.title"),description:function(e,n,o){return(0,ne.jsxs)(sn.Z,{component:"div",children:[(0,ne.jsx)(Ee.Z,{label:t("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix","data-cy":"path-prefix-input",fullWidth:!0,autoFocus:!0,helperText:e.pathPrefixHint||t("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:e.pathPrefix,onChange:function(i){var l=!1,c=(0,_n.Rw)({params:(0,r.Z)((0,r.Z)({},e),{},{pathPrefix:i.target.value}),blocklets:[a]});o(c),e.type===G.ROUTING_RULE_TYPES.BLOCKLET&&c&&(l=!0),e.type!==G.ROUTING_RULE_TYPES.REDIRECT||e.url||(l=!0),e.type!==G.ROUTING_RULE_TYPES.GENERAL_REWRITE||e.url||(l=!0),i.target.value.trim()||(l=!0,o(t("router.validation.pathPrefixRequired"))),l||o("");var s=t("common.slugifyHint",{value:(0,ce.LN)(i.target.value)});n((0,r.Z)((0,r.Z)({},e),{},{pathPrefix:i.target.value,pathPrefixHint:s,__disableConfirm:l}))}}),(0,ne.jsx)(In,{params:e,setParams:function(e){o(null),(0,_n.fX)(e,t)?n((0,r.Z)((0,r.Z)({},e),{},{__disableConfirm:!0})):n((0,r.Z)({},e))},setError:o})]})},confirm:t("router.rule.add.confirm"),cancel:t("common.cancel"),params:{did:"",pathPrefix:"",type:G.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,__disableConfirm:!0},onConfirm:b,onCancel:function(){m(!1),Z(null)}},k=function(e){e.stopPropagation(),Z(y)};return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof n?n({loading:c,open:k}):(0,ne.jsxs)(yn.Z,{onClick:k,className:"rule-action","data-cy":"action-add-rule",children:[c?(0,ne.jsx)(B.Z,{size:16}):(0,ne.jsx)(kn.Z,{style:{fontSize:18,marginRight:5}}),t("router.rule.add.title")]}),x&&(0,ne.jsx)(ie.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel,color:"primary"})]})}In.propTypes={params:h().object,serviceTypes:h().array,setParams:h().func,setError:h().func},In.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:G.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:G.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:G.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Component - Pass traffic to blocklet component",value:G.ROUTING_RULE_TYPES.COMPONENT}],setParams:function(){},setError:function(){}},Nn.propTypes={children:h().any},Nn.defaultProps={children:null};var Un=t(92522),On=t.n(Un),Ln=t(94702),Dn=t(59467),Gn=t(87862),Bn=t(25371);function zn(e){var n=e.id,t=e.from,r=e.children,o=(0,W.PE)().t,a=(0,le.h6)().api,i=(0,Sn.y0)().blocklet,l=(0,p.useState)(!1),c=(0,d.Z)(l,2),m=c[0],f=c[1],h=(0,p.useState)(null),x=(0,d.Z)(h,2),Z=x[0],v=x[1],g=i.meta.did,b=i.site.id,y=t.pathPrefix,k=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,a.deleteRoutingRule({input:{id:b,ruleId:n,teamDid:g}});case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),V.Z.error(e.t0.message);case 9:return e.prev=9,v(null),f(!1),e.finish(9);case 13:case"end":return e.stop()}}),e,null,[[1,6,9,13]])})));return function(){return e.apply(this,arguments)}}(),j={keyName:y,title:o("router.rule.delete.title"),description:o("router.rule.delete.description",{name:"<b>".concat(y,"</b>")}),confirmPlaceholder:o("router.rule.delete.confirm_desc",{name:y}),confirm:o("common.delConfirm"),cancel:o("router.rule.delete.cancel"),onConfirm:k,onCancel:function(){f(!1),v(null)}},C=function(e){e.stopPropagation(),v(j)};return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof r?r({loading:m,open:C}):(0,ne.jsxs)(yn.Z,{onClick:C,className:"rule-action","data-cy":"action-delete-rule",children:[m?(0,ne.jsx)(B.Z,{size:16}):(0,ne.jsx)(U.default,{style:{fontSize:18,marginRight:5}}),o("router.rule.delete.title")]}),Z&&(0,ne.jsx)(Bn.Z,{keyName:Z.keyName,title:Z.title,description:Z.description,confirmPlaceholder:Z.confirmPlaceholder,confirm:Z.confirm,cancel:Z.cancel,params:Z.params,onConfirm:Z.onConfirm,onCancel:Z.onCancel})]})}function Wn(e){var n=e.id,t=e.from,o=e.to,a=e.children,i=(0,W.PE)().t,l=(0,le.h6)().api,c=(0,Sn.y0)().blocklet,m=(0,p.useState)(!1),f=(0,d.Z)(m,2),h=f[0],x=f[1],Z=(0,p.useState)(null),v=(0,d.Z)(Z,2),g=v[0],b=v[1],y=c.meta.did,k=c.site.id,j=t.pathPrefix,C=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){var r,o;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,_n.fX)(t,i);case 3:if(!(r=e.sent)){e.next=6;break}throw r;case 6:return x(!0),o={id:n,from:{pathPrefix:Xe()(t.pathPrefix)},to:{type:t.type}},t.type===G.ROUTING_RULE_TYPES.REDIRECT&&(o.to.url=t.url,o.to.redirectCode=t.redirectCode),t.type===G.ROUTING_RULE_TYPES.COMPONENT&&(o.to.did=y,o.to.componentId=t.componentId,o.to.pageGroup=t.pageGroup),t.type===G.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(o.to.url=Xe()(t.url)),e.next=13,l.updateRoutingRule({input:{id:k,rule:o,teamDid:y}});case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),V.Z.error(e.t0.message);case 18:return e.prev=18,x(!1),b(null),e.finish(18);case 22:case"end":return e.stop()}}),e,null,[[0,15,18,22]])})));return function(n){return e.apply(this,arguments)}}(),E={title:i("router.rule.update.title"),description:function(e,n,t){return(0,ne.jsxs)(sn.Z,{component:"div",children:[(0,ne.jsx)(Ee.Z,{label:i("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix","data-cy":"path-prefix-input",fullWidth:!0,autoFocus:!0,helperText:e.helperText||i("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:e.pathPrefix,onChange:function(o){var a=!1;e.type!==G.ROUTING_RULE_TYPES.REDIRECT||e.url||(a=!0),e.type!==G.ROUTING_RULE_TYPES.GENERAL_REWRITE||e.url||(a=!0),o.target.value.trim()||(a=!0,t(i("router.validation.pathPrefixRequired"))),a||t("");var l=i("common.slugifyHint",{value:(0,ce.LN)(o.target.value)});n((0,r.Z)((0,r.Z)({},e),{},{pathPrefix:o.target.value,helperText:l,__disableConfirm:a}))}}),(0,ne.jsx)(In,{params:e,setParams:function(e){(0,_n.fX)(e,i)?n((0,r.Z)((0,r.Z)({},e),{},{__disableConfirm:!0})):n((0,r.Z)({},e))},setError:t})]})},confirm:i("router.rule.update.confirm"),cancel:i("router.rule.update.cancel"),color:"primary",params:{did:o.did||"",pathPrefix:"/"===j?j:j.replace(/^\/+/,"").replace(/\/+$/,""),type:o.type||G.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:o.redirectCode||302,componentId:o.componentId||"",pageGroup:o.pageGroup||"",url:o.url||"",__disableConfirm:!1},onConfirm:C,onCancel:function(){x(!1),b(null)}},R=function(e){e.stopPropagation(),b(E)};return(0,ne.jsxs)(ne.Fragment,{children:["function"===typeof a?a({loading:h,open:R}):(0,ne.jsxs)(yn.Z,{onClick:R,className:"rule-action","data-cy":"action-update-rule",children:[h?(0,ne.jsx)(B.Z,{size:16}):(0,ne.jsx)(ye.default,{style:{fontSize:18,marginRight:5}}),i("router.rule.update.title")]}),g&&(0,ne.jsx)(ie.Z,{title:g.title,description:g.description,confirm:g.confirm,color:g.color,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}function qn(e){var n=(0,W.PE)().locale,t=(0,Sn.y0)(),o=t.blocklet,a=t.recommendedDomain,i=(0,ce.Sk)(a,e.from.pathPrefix,(0,ce.f0)(o,n));return(0,ne.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)("a",{target:"_blank",href:i,rel:"noopener noreferrer",title:i,children:(0,ne.jsx)(k.Z,{size:"small",children:(0,ne.jsx)(P.Z,{})})}),(0,ne.jsx)(Wn,(0,r.Z)((0,r.Z)({},e),{},{children:function(n){var t=n.open;return(0,ne.jsx)(k.Z,{size:"small",onClick:t,disabled:e.isProtected,"data-cy":"action-update-rule",children:(0,ne.jsx)(E.Z,{})})}})),(0,ne.jsx)(zn,(0,r.Z)((0,r.Z)({},e),{},{children:function(n){var t=n.open;return(0,ne.jsx)(k.Z,{size:"small",onClick:t,disabled:e.isProtected,"data-cy":"action-delete-rule",children:(0,ne.jsx)(U.default,{})})}}))]})}zn.propTypes={id:h().string.isRequired,from:h().object.isRequired,children:h().any},zn.defaultProps={children:null},Wn.propTypes={id:h().string.isRequired,from:h().object.isRequired,to:h().object.isRequired,children:h().any},Wn.defaultProps={children:null},qn.propTypes={isProtected:h().bool},qn.defaultProps={isProtected:!1};var An=["group"];function Mn(e){var n=e.group,t=(0,o.Z)(e,An);return n?(0,ne.jsx)(X.Z,(0,r.Z)((0,r.Z)({type:"reverse"},t),{},{children:n})):null}function Yn(e){var n=e.domain,t=e.isHttps,r=e.toUrl,o=t?"https":"http",a=r;return On()(a)||(a="".concat(o,"://").concat(n).concat(r)),(0,ne.jsx)(ee.Z,{href:a,target:"_blank",style:{fontSize:14},underline:"hover",children:r},a)}function Fn(e){var n=e.hasPermission,t=(0,W.PE)(),o=t.t,a=t.locale,i=(0,Ln.Z)(),l=(0,Sn.y0)(),c=l.blocklet,s=l.recommendedDomain;return c.site.rules.filter((function(e){return e.to.type!==G.ROUTING_RULE_TYPES.BLOCKLET})).map((function(e){var t=null,l=null;e.to.type===G.ROUTING_RULE_TYPES.NONE?t="404":e.to.type===G.ROUTING_RULE_TYPES.REDIRECT?t=e.to.redirectCode:e.to.type===G.ROUTING_RULE_TYPES.GENERAL_REWRITE?t="R":e.to.type===G.ROUTING_RULE_TYPES.COMPONENT&&(l=c.children.find((function(n){return n.meta.did===e.to.componentId})),t="C");var u=e.isProtected?(0,ne.jsx)(S.Z,{title:o("blocklet.router.urlLockTooltip"),placement:"top",children:(0,ne.jsx)("span",{children:(0,ne.jsx)(k.Z,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:(0,ne.jsx)(Gn.Z,{style:{fill:i.palette.text.disabled}})})})}):(0,ne.jsx)(qn,(0,r.Z)({},e));return[(0,ne.jsxs)(Z.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,ne.jsxs)(Z.Z,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[(0,ne.jsx)(Z.Z,{width:28}),"object"===typeof t?t:(0,ne.jsx)(Dn.Z,{children:t}),(0,ne.jsxs)(Z.Z,{ml:2,children:[(0,ne.jsxs)(Z.Z,{style:{color:"#222",fontSize:16},children:[e.to.type===G.ROUTING_RULE_TYPES.NONE&&o("common.page404"),e.to.type===G.ROUTING_RULE_TYPES.REDIRECT&&o("common.redirect"),e.to.type===G.ROUTING_RULE_TYPES.GENERAL_REWRITE&&o("common.rewrite"),e.to.type===G.ROUTING_RULE_TYPES.COMPONENT&&(0,M.getDisplayName)(l,!0)]}),(0,ne.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[e.to.type===G.ROUTING_RULE_TYPES.REDIRECT&&(0,ne.jsx)(Yn,{domain:s,toUrl:e.to.url}),e.to.type===G.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(0,ne.jsx)(Yn,{domain:s,toUrl:e.to.url}),e.to.type===G.ROUTING_RULE_TYPES.COMPONENT&&(0,ne.jsx)(Mn,{group:e.to.pageGroup})]})]})]}),(0,ne.jsx)(Z.Z,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:(0,ne.jsx)(ee.Z,{href:(0,ce.Sk)(s,e.from.pathPrefix,(0,ce.f0)(c,a)),target:"_blank",style:{fontSize:16},underline:"hover",children:e.from.pathPrefix})},e.from.pathPrefix),(0,ne.jsx)(Z.Z,{children:n&&(0,ne.jsx)("div",{style:{textAlign:"right"},children:u})},"actions")]},"rule"),(0,ne.jsx)(bn.Z,{},"divider")]}))}Mn.propTypes={group:h().string.isRequired},Yn.propTypes={domain:h().string.isRequired,toUrl:h().string.isRequired,isHttps:h().bool},Yn.defaultProps={isHttps:!1},Fn.propTypes={hasPermission:h().bool},Fn.defaultProps={hasPermission:!1};var Vn=(0,se.V)(Fn,"mutate_blocklets"),Kn=(0,se.V)(Fn,"",ce.Wf);function Hn(e){return(0,le.h6)().inService?(0,ne.jsx)(Kn,(0,r.Z)({},e)):(0,ne.jsx)(Vn,(0,r.Z)({},e))}var Xn,Jn,$n,Qn=t(80714),et=["blocklet","onUpdate","getComponentUrl"],nt=function(e,n){return e?[{name:n("common.name"),value:e.displayName},{name:n("common.description"),value:e.description},{name:n("common.version"),value:(0,ne.jsx)(X.Z,{children:e.version})}]:[]},tt=function(e){var n=e.source,t=e.deployedFrom,r=e.bundleSource;return n?{source:n,deployedFrom:t}:r?r.url?{source:"url",deployedFrom:t||Array.isArray(r.url)?r.url[0]:r.url}:r.store?{source:"registry",deployedFrom:t||Array.isArray(r.store)?r.store[0]:r.store}:{}:{source:"upload",deployedFrom:t}},rt=function(e,n){for(var t=e.split("/").slice(1),r=n,o=0,a=[];r&&o<t.length;){var i=r.children.find((function(e){return e.meta.did===t[o]}));r=i,o++,i&&a.push(i.meta.title)}return a.join(" / ")};function ot(e){var n,t,r,o,a=e.blocklet,i=e.ancestors,l=e.depth,c=e.onRemove,m=e.onStart,f=e.onStop,h=e.onRestart,b=e.onReload,y=e.getComponentUrl,j=e.app,C=(0,p.useContext)(W.RD),T=C.t,_=C.locale,w=(0,p.useState)(),O=(0,d.Z)(w,2),L=O[0],G=O[1],B=(0,p.useState)(!1),q=(0,d.Z)(B,2),A=q[0],Y=q[1],V=(0,p.useState)(!1),J=(0,d.Z)(V,2),$=J[0],Q=J[1],ee=(0,p.useState)(null),oe=(0,d.Z)(ee,2),ae=oe[0],le=oe[1],se=(0,K.K)().deletingBlocklets,ue=a.status;1===l&&se.includes(a.meta.did)&&(ue="deleting");var de,pe="/".concat(a.mountPoint||"/").replace(/\/+/g,"/"),me=y(pe),xe=L?tt(L):{},ve=L?[{name:T("common.name"),value:(0,M.getDisplayName)(L,!0)},{name:T("common.version"),value:(0,ne.jsx)(fe,{blocklet:L,checkUpgrade:!1})},{name:T("common.status"),value:(0,ne.jsx)(re.Z,{status:ue,source:L.source})},"running"===a.status?{name:T("blocklet.startedAt"),value:(0,ce.B2)(a.startedAt,_)}:null,"running"!==a.status?{name:T("blocklet.stoppedAt"),value:(0,ce.B2)(a.stoppedAt,_)}:null,a.installedAt?{name:T("blocklet.installedAt"),value:(0,ce.B2)(a.installedAt,_)}:null,(0,M.hasStartEngine)(a.meta)?{name:T("common.mountPoint"),value:pe}:null,L.meta.group?{name:T("common.group"),value:(0,ne.jsx)(X.Z,{type:"success",children:L.meta.group})}:null,{name:T("blocklet.overview.source"),value:(0,ne.jsx)(te,{sourceInfo:xe,blocklet:a})},{name:T("blocklet.overview.deployedFrom"),value:xe.deployedFrom||"-"},{name:T("common.did"),value:(0,ne.jsx)(H.Z,{did:L.meta.did})},{name:T("common.author"),value:(0,ce.rq)(L.meta.author)},{name:T("common.engine"),value:nt(L.engine,T).map((function(e){var n=e.name,t=e.value;return(0,ne.jsx)(z.Z,{style:{marginBottom:4},nameWidth:120,name:n,children:t},n)}))},null!==(n=a.dependents)&&void 0!==n&&n.length?{name:T("common.dependents"),value:(0,ne.jsx)(Z.Z,{children:a.dependents.map((function(e){return(0,ne.jsx)(Z.Z,{children:"".concat(rt(e.id,j)," ").concat(e.required?"(".concat(T("common.required"),")"):"")})}))})}:null,null!==(t=a.meta.resources)&&void 0!==t&&t.length?{name:T("common.resource"),value:a.meta.resources.join(", ")}:null].filter(Boolean):[],ge=(0,M.isInProgress)(j.status),be=(0,M.isInProgress)(a.status),ye="";if(ge||be||1===l&&se.includes(a.meta.did))ye=T("blocklet.component.tip.stopBlocklet");else if(null!==(r=a.dependents)&&void 0!==r&&r.length){var ke=a.dependents.filter((function(e){return e.required}));if(ke.length){var je=ke.map((function(e){return rt(e.id,j)}));ye=T("blocklet.component.tip.requiredBy",{name:je.join(", ")})}}return[(0,ne.jsxs)(it,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,ne.jsxs)(Z.Z,{pl:2,width:{xs:300,md:400},display:"flex",alignItems:"center",children:[(0,ne.jsx)(he.Z,{blocklet:a,ancestors:i}),(0,ne.jsxs)(Z.Z,{ml:"16px",children:[(0,ne.jsx)(Z.Z,{className:"component-name",onClick:function(){return G(a)},children:(0,M.getDisplayName)(a,!0)}),(0,ne.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)(fe,{blocklet:a,checkUpgrade:!1}),(0,ne.jsx)(Ze,{style:{marginLeft:4},mode:a.mode||""}),"unknown"!==ue&&(0,ne.jsx)(re.Z,{style:{marginLeft:4},status:ue,source:a.source}),!(null===(o=a.dependents)||void 0===o||!o.length)&&(0,ne.jsx)(S.Z,{title:["".concat(T("common.dependents"),": "),a.dependents.map((function(e){return(0,ne.jsx)(Z.Z,{pl:1,children:"".concat(rt(e.id,j)," ").concat(e.required?"(".concat(T("common.required"),")"):"")})}))],children:(0,ne.jsx)(Z.Z,{display:"flex",color:"primary.main",ml:1,children:(0,ne.jsx)(D.JO,{icon:"octicon:package-dependents-16"})})})]})]})]},a),(0,M.hasStartEngine)(a.meta)&&(0,ne.jsx)(Z.Z,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:(0,ne.jsx)("a",{target:"_blank",href:me,rel:"noopener noreferrer",title:me,children:(0,ne.jsx)(Z.Z,{maxWidth:400,sx:{color:"secondary.main",fontSize:18,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:F()(pe)})})},pe),(0,ne.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[(0,M.hasStartEngine)(a.meta)&&(0,ne.jsx)(S.Z,{title:T("common.visit"),children:(0,ne.jsx)("a",{target:"_blank",href:me,rel:"noopener noreferrer",children:(0,ne.jsx)(k.Z,{size:"small",children:(0,ne.jsx)(P.Z,{})})})}),(0,M.hasStartEngine)(a.meta)&&(0,ne.jsx)(an,{blocklet:a,ancestors:i,children:function(e){var n=e.open;return(0,ne.jsx)(S.Z,{title:T("common.config"),children:(0,ne.jsx)(at,{color:"error",badgeContent:"",variant:"dot",invisible:!(0,M.getComponentMissingConfigs)(a,i[0]).length,children:(0,ne.jsx)(k.Z,{onClick:n,size:"small",children:(0,ne.jsx)(E.Z,{})})})},"config")}}),(0,ne.jsx)(Zn,{blocklet:j,component:a,onStart:m,onStop:f,disabled:!["starting","stopping"].includes(j.status)&&(0,M.isInProgress)(j.status)}),(0,ne.jsx)(Qn.Z,{"data-cy":"component-actions",actions:[(0,M.hasStartEngine)(a.meta)?{icon:(0,ne.jsx)(R.Z,{}),text:T("common.detail"),onClick:function(){G(a)}}:null,{icon:(0,ne.jsx)(I.default,{}),text:T("common.restart"),onClick:function(){le({title:"".concat(T("common.restart")," ").concat(a.meta.title),description:T("blocklet.action.restartDescription"),confirm:T("blocklet.action.confirmRestart"),cancel:T("common.cancel"),onConfirm:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Q(!0),e.next=3,h(a);case 3:Q(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onCancel:function(){return le(null)}})},disabled:ge||be||"running"!==a.status},{icon:(0,ne.jsx)(N.Z,{}),text:T("common.reload"),onClick:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Q(!0),e.next=3,b(a);case 3:Q(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),disabled:$||ge||be||"running"!==a.status},{icon:(0,ne.jsx)(U.default,{}),text:T("common.delete"),onClick:function(){Y(!0)},disabled:ge||be||!!ye,tip:ye}].filter(Boolean)})]},"actions")]},"group-not-gateway-box"),(0,ne.jsx)(bn.Z,{depth:2}),!!L&&(0,ne.jsx)(x.Z,{open:!0,fullWidth:!0,maxWidth:"md",onClose:function(){G(null)},children:(0,ne.jsxs)(Z.Z,{paddingY:1.5,children:[(0,ne.jsx)(g.Z,{children:T("common.componentBasicInfo")}),(0,ne.jsx)(v.Z,{children:(de=ve,de.map((function(e){return e.name===T("common.did")||e.name===T("blocklet.appId")?(0,ne.jsx)(z.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:function(){return e.name},children:e.value},e.name):(0,ne.jsx)(z.Z,{valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)})))})]},"dialog-wrapper")},"base-info-dialog"),(0,ne.jsx)(pn,{blocklet:j,component:a,remove:function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var n=arguments;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Q(!0),e.prev=1,e.next=4,c.apply(void 0,n);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:Q(!1),Y(!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),onCancel:function(){return Y(!1)},hideBtn:!0,showConfirm:A}),ae&&(0,ne.jsx)(ie.Z,{title:ae.title,description:ae.description,confirm:ae.confirm,cancel:ae.cancel,params:ae.params,onConfirm:ae.onConfirm,onCancel:ae.onCancel})]}ot.propTypes={blocklet:h().object.isRequired,ancestors:h().array,depth:h().number,onRemove:h().func,onStart:h().func,onStop:h().func,onRestart:h().func,onReload:h().func,getComponentUrl:h().func,app:h().object},ot.defaultProps={ancestors:[],depth:0,onRemove:function(){},onStart:function(){},onStop:function(){},onRestart:function(){},onReload:function(){},getComponentUrl:function(){return window.location.origin},app:null};var at=(0,m.Z)(C.Z)(Xn||(Xn=(0,c.Z)(["\n .BaseBadge-badge {\n top: ","px;\n right: ","px;\n }\n"])),(function(e){return 8*e.top||6}),(function(e){return 8*e.right||6})),it=(0,m.Z)(Z.Z)(Jn||(Jn=(0,c.Z)(["\n .component-name {\n color: #222;\n font-size: 16px;\n cursor: pointer;\n }\n"])));function lt(e){var n=e.blocklet,t=(e.onUpdate,e.getComponentUrl),a=(0,o.Z)(e,et),i=(0,p.useContext)(W.RD).t,c=(0,le.h6)(),m=c.api,f=c.inService,h=c.info,C=(0,K.K)(),R=C.addDeletingDid,P=C.removeDeletingDid,I=C.matchDeletingDid,N=(0,p.useState)(!1),U=(0,d.Z)(N,2),D=U[0],z=U[1],Y=(0,p.useState)(null),F=(0,d.Z)(Y,2),H=F[0],X=F[1],J=(0,p.useState)(null),$=(0,d.Z)(J,2),Q=$[0],ee=$[1],te=(0,p.useState)(!1),re=(0,d.Z)(te,2),oe=re[0],ae=re[1],ie=n&&n.structVersion!==G.APP_STRUCT_VERSION,ue=(0,p.useState)(!1),de=(0,d.Z)(ue,2),pe=de[0],me=de[1],fe=(0,l.Z)(n.children)||[];"gateway"!==n.meta.group&&fe.unshift(n),I(fe.map((function(e){return e.meta.did})));var he=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var t,r,o,a,l;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!D){e.next=2;break}return e.abrupt("return");case 2:return z(!0),e.prev=3,e.next=6,m.checkComponentsForUpdates({input:{did:n.meta.did}});case 6:if(e.t0=e.sent.preUpdateInfo,e.t0){e.next=9;break}e.t0={};case 9:if(t=e.t0,r=t.updateId,o=t.updateList,z(!1),r){e.next=16;break}return V.Z.info(i("blocklet.component.noUpdate")),e.abrupt("return");case 16:a=[],(0,M.forEachChildSync)(n,(function(e,n){var t=n.id,r=n.ancestors,i=o.find((function(e){return e.id===t}));if(i){var l=r.slice(1).concat(e).map((function(e){return e.meta.title||e.meta.name})).join(" / "),c=(r[1]||e).meta.did;a.push({groupId:c,name:l,version:e.meta.version,newVersion:i.meta.version})}})),l={},a.forEach((function(e){l[e.groupId]?e.disabled=!0:l[e.groupId]=!0})),X({params:{updateId:r},list:a,checks:l,hasChecks:!0}),e.next=27;break;case 23:e.prev=23,e.t1=e.catch(3),z(!1),V.Z.error((0,ce.Z)(e.t1));case 27:case"end":return e.stop()}}),e,null,[[3,23]])})));return function(){return e.apply(this,arguments)}}(),xe=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(){var t,r;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!D){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,z(!0),t=Object.keys(H.checks).filter((function(e){return H.checks[e]})),r={updateId:H.params.updateId,rootDid:n.meta.did,selectedComponents:t},e.next=8,m.upgradeComponents({input:r});case 8:z(!1),X(null),me(null),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(2),z(!1),V.Z.error((0,ce.Z)(e.t0));case 17:case"end":return e.stop()}}),e,null,[[2,13]])})));return function(){return e.apply(this,arguments)}}(),Ze=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t,r){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R(t.meta.did),e.prev=1,e.next=4,m.deleteComponent({input:{did:t.meta.did,keepData:"keepData"===r,rootDid:n.meta.did}});case 4:return e.next=6,(0,ce._v)(800);case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),V.Z.error((0,ce.Z)(e.t0)),P(t.meta.did);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(n,t){return e.apply(this,arguments)}}(),ve=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.startBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(n){return e.apply(this,arguments)}}(),ge=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.stopBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(n){return e.apply(this,arguments)}}(),be=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.restartBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(n){return e.apply(this,arguments)}}(),ye=function(){var e=(0,u.Z)((0,s.Z)().mark((function e(t){return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,m.reloadBlocklet({input:{did:n.meta.did,componentDids:[t.meta.did]}});case 3:return e.next=5,(0,ce._v)(800);case 5:V.Z.success(i("blocklet.reloadSuccess")),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),V.Z.error((0,ce.Z)(e.t0));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(n){return e.apply(this,arguments)}}();return(0,ne.jsxs)(ct,(0,r.Z)((0,r.Z)({component:"div"},a),{},{children:[(0,ne.jsxs)(Z.Z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,ne.jsxs)("div",{className:"title",children:[i("common.components"),!ie&&(0,ne.jsx)(se.Z,{permission:f?"":"mutate_blocklets",role:f?ce.Wf:[],children:(0,ne.jsx)(at,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!pe,children:(0,ne.jsxs)(q.Z,{disabled:D||(0,M.isInProgress)(n.status),color:"secondary",onClick:function(){he()},"data-cy":"check-for-updates",children:[(0,ne.jsx)(Z.Z,{mr:.5,display:"flex",children:D?(0,ne.jsx)(B.Z,{size:16}):(0,ne.jsx)(y.Z,{style:{fontSize:"1em"}})}),i("blocklet.component.checkUpdateTitle")]})})})]}),(0,ne.jsx)(se.Z,{permission:f?"":"mutate_blocklets",role:f?ce.Wf:[],children:(0,ne.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)(Nn,{children:function(e){var t=e.open;return(0,ne.jsxs)(q.Z,{disabled:D||(0,M.isInProgress)(n.status),variant:"text",color:"primary","data-cy":"add-rule",onClick:t,children:[(0,ne.jsx)(j.Z,{style:{fontSize:"1.3em",marginRight:4}}),i("router.rule.add.title")]})}}),!ie&&(0,ne.jsx)(Pn,{blocklet:n,serverVersion:h.version,children:function(e){var t=e.open;return(0,ne.jsxs)(q.Z,{disabled:D||(0,M.isInProgress)(n.status),variant:"text",color:"primary","data-cy":"add-component",onClick:t,children:[(0,ne.jsx)(j.Z,{style:{fontSize:"1.3em",marginRight:4}}),i("blocklet.component.add")]})}}),!ie&&(0,ne.jsx)(an,{blocklet:n,ancestors:[],children:function(e){var n=e.open;return(0,ne.jsx)(S.Z,{title:"".concat(i("blocklet.component.container")).concat(i("common.config")),children:(0,ne.jsx)(k.Z,{onClick:n,size:"small",color:"primary",children:(0,ne.jsx)(E.Z,{style:{fontSize:18}})})},"config")}})]})})]}),fe&&fe.length?(0,ne.jsxs)(Z.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},children:["gateway"!==n.meta.group&&(0,ne.jsx)(ot,{blocklet:n,app:n,onRemove:Ze,onStart:ve,onStop:ge,onReload:ye,onRestart:be,getComponentUrl:t},"0-".concat(n.meta.did)),n.children.map((function(e){return(0,ne.jsx)(ot,{depth:1,blocklet:e,ancestors:[n],app:n,onRemove:Ze,onStart:ve,onStop:ge,onReload:ye,onRestart:be,getComponentUrl:t},"1-".concat(e.meta.did))}))]},"top-blocklet-".concat(n.meta.did)):(0,ne.jsx)(Z.Z,{mt:8,children:(0,ne.jsx)(A.Z,{children:i("blocklet.component.noComponent")})}),!!n.site.rules.length&&(0,ne.jsx)(Z.Z,{mt:0,ml:{xs:"-16px",md:"-28px"},children:(0,ne.jsx)(Hn,{})}),!!H&&(0,ne.jsx)(x.Z,{open:!0,fullWidth:!0,children:(0,ne.jsxs)(Z.Z,{paddingY:1.5,children:[(0,ne.jsx)(g.Z,{children:i("blocklet.component.updateTitle")}),(0,ne.jsx)(Z.Z,{component:v.Z,py:4,children:H.list.map((function(e){return(0,ne.jsxs)(Z.Z,{display:"flex",alignItems:"center",children:[(0,ne.jsx)(w.Z,{checked:H.checks[e.groupId],onChange:function(n){return function(e,n){var t=e.target.checked;X((function(e){var o=Object.entries(e.checks).reduce((function(e,r){var o=(0,d.Z)(r,2),a=o[0],i=o[1];return e[a]=n===a?t:i,e}),{}),a=Object.values(o).includes(!0);return(0,r.Z)((0,r.Z)({},e),{},{checks:o,hasChecks:a})}))}(n,e.groupId)},style:{marginLeft:e.disabled?16:0},defaultChecked:!0,disabled:e.disabled}),(0,ne.jsxs)(Z.Z,{flexGrow:1,mt:3,children:[(0,ne.jsx)(Z.Z,{item:!0,xs:8,children:e.name}),e.version&&(0,ne.jsxs)(T.ZP,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[(0,ne.jsx)(T.ZP,{item:!0,xs:3,children:e.version}),(0,ne.jsx)(T.ZP,{item:!0,xs:1,children:(0,ne.jsx)(_.Z,{style:{fontSize:"0.9em"}})}),(0,ne.jsx)(T.ZP,{item:!0,xs:3,children:(0,ne.jsx)(Z.Z,{color:"secondary.main",children:e.newVersion})})]})]},"".concat(e.name,"-").concat(e.newVersion))]})}))}),(0,ne.jsxs)(b.Z,{style:{padding:"8px 24px 24px"},children:[(0,ne.jsx)(q.Z,{onClick:function(){X(null)},children:i("common.cancel")}),(0,ne.jsxs)(q.Z,{onClick:function(e){e.stopPropagation(),xe()},color:"primary",disabled:D||!H.hasChecks,variant:"contained",autoFocus:!0,children:[D&&(0,ne.jsx)(B.Z,{size:16}),i("common.update")]})]})]})}),!!Q&&(0,ne.jsx)(x.Z,{open:!0,fullWidth:!0,onClose:function(){return ee(!1)},children:(0,ne.jsxs)(Z.Z,{paddingY:1.5,children:[(0,ne.jsx)(g.Z,{children:i("common.configuration")}),(0,ne.jsx)(v.Z,{children:(0,ne.jsx)(Z.Z,{py:2,children:(0,ne.jsx)(O.Z,{control:(0,ne.jsx)(L.Z,{checked:oe,onChange:function(e){return ae(!!e.target.checked)}}),label:i("blocklet.component.showContainer")})})})]})})]}))}lt.propTypes={blocklet:h().object.isRequired,onUpdate:h().func,getComponentUrl:h().func},lt.defaultProps={onUpdate:function(){},getComponentUrl:function(){return window.location.origin}};var ct=m.Z.div($n||($n=(0,c.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n }\n\n @keyframes showDelay {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n .component-item {\n animation: showDelay 0.75s ease 1;\n }\n"]))),st=["blocklet"];function ut(e){var n=e.blocklet,t=(0,o.Z)(e,st);return(0,ne.jsx)(lt,(0,r.Z)({blocklet:n,getComponentUrl:function(e){return"".concat(i()(window.location.origin,e))}},t))}ut.defaultProps={}},80714:function(e,n,t){t.d(n,{Z:function(){return j}});var r,o=t(71171),a=t(32723),i=t(34795),l=t(33028),c=t(96234),s=t(59740),u=t(30969),d=t(24974),p=t.n(d),m=t(16380),f=t(94551),h=t(48082),x=t(2689),Z=t(28722),v=t(93310),g=t(86008),b=t(37574),y=["actions","size"],k=["icon","text","onClick","disabled"];function j(e){var n=e.actions,t=e.size,r=(0,s.Z)(e,y),o=(0,u.useState)(null),d=(0,c.Z)(o,2),p=d[0],m=d[1],j=Boolean(p),E=function(e){try{e.stopPropagation(),e.preventDefault()}catch(n){}m(null)};return(0,b.jsxs)(C,(0,l.Z)((0,l.Z)({},r),{},{children:[(0,b.jsx)(f.Z,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:function(e){try{e.stopPropagation(),e.preventDefault()}catch(n){}m(e.currentTarget)},size:t,children:(0,b.jsx)(Z.Z,{})}),(0,b.jsx)(h.Z,{id:"actions-menu","data-cy":"actions-menu",anchorEl:p,keepMounted:!0,open:j,onClose:E,PaperProps:{},children:n.map((function(e,n){if("function"===typeof e)return e({close:E});var t=e.icon,r=e.text,o=e.onClick,c=e.disabled,d=void 0!==c&&c,p=(0,s.Z)(e,k);return(0,u.createElement)(x.Z,(0,l.Z)((0,l.Z)({},p),{},{disabled:d,dense:!0,onClick:function(){var e=(0,i.Z)((0,a.Z)().mark((function e(n){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o(n);case 2:E();case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),key:n,"data-cy":"actions-menu-".concat(n)}),(0,b.jsx)(v.Z,{style:{minWidth:24,marginRight:8},children:t}),(0,b.jsx)(g.Z,{primary:r}))}))})]}))}j.propTypes={actions:p().array,size:p().oneOf(["small","medium","large"])},j.defaultProps={actions:[],size:"small"};var C=m.Z.div(r||(r=(0,o.Z)([""])))},70998:function(e,n,t){t.d(n,{Z:function(){return x}});var r=t(33028),o=t(59740),a=t(24974),i=t.n(a),l=t(59467),c=t(62399),s=t(19611),u=t.n(s),d=t(20244),p=t(41395),m=t(24891);var f=t(37574),h=["blocklet","style","size","ancestors"];function x(e){var n=e.blocklet,t=e.style,a=e.size,i=e.ancestors,s=(0,o.Z)(e,h),x=(0,p.h6)(),Z=function(e){var n,t=e.blocklet,r=e.ancestors,o=void 0===r?[]:r,a=(0,p.h6)(),i=a.inService,l="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,m.XN)(null===t||void 0===t?void 0:t.status)?"~":""),c=i?u()(m.zn,d.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",l):u()(a.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)c=u()(t.deployedFrom,(0,m.lk)(t.meta.bundleDid,t.meta.logo),l);else{var s=window.env.apiPrefix||"/",f=o.concat(t),h=i?f.slice(1):f;c=u()(s,"/blocklet/logo-bundle".concat(h.map((function(e){return"/".concat(e.meta.did)})).join("")),l)}return{logoUrl:c,inService:i}}({blocklet:n,ancestors:i}),v=Z.logoUrl,g=Z.inService,b=s.variant,y=g?function(){}:function(e){e.target.src="".concat(x.imgPrefix,"/blocklet.png")},k=(0,f.jsx)("img",{src:v,onError:y,alt:n.meta.name,style:{width:a}});return n.meta.logo||(k=(0,f.jsx)(c.Z,{did:n.meta.did||"",responsive:!0})),(0,f.jsx)(l.Z,(0,r.Z)((0,r.Z)({variant:b||"square",style:Object.assign({backgroundColor:"transparent",width:a,height:a,borderRadius:10},t)},s),{},{children:k}))}x.propTypes={blocklet:i().object.isRequired,style:i().object,size:i().oneOfType([i().number,i().string]),ancestors:i().array},x.defaultProps={style:{},size:40,ancestors:[]}},2569:function(e,n,t){t.d(n,{Z:function(){return l}});var r=t(24974),o=t.n(r),a=t(38361),i=t(37574);function l(e){var n=e.depth;return(0,i.jsx)(a.Z,{ml:Math.max(2*(n-1),0),sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}l.propTypes={depth:o().number},l.defaultProps={depth:1}},67019:function(e,n,t){t.d(n,{Z:function(){return j}});var r=t(33028),o=t(32723),a=t(34795),i=t(96234),l=t(59740),c=t(30969),s=t(24974),u=t.n(s),d=t(38361),p=t(87006),m=t(94308),f=t(88581),h=t(27724),x=t(94551),Z=t(14458),v=t(28412),g=t(76934),b=t(37574),y=["label","disabled","required","initialValue","onChange","placeholder","style","onSubmit","secure","triggers","formatterBeforeSubmit"],k=function(e,n,t){return null===e&&n&&t?"******":e?n?"******":e:""};function j(e){var n=e.label,t=e.disabled,s=e.required,u=e.initialValue,j=e.onChange,C=e.placeholder,E=e.style,R=e.onSubmit,P=e.secure,T=e.triggers,S=e.formatterBeforeSubmit,_=(0,l.Z)(e,y),w=(0,c.useState)(!1),I=(0,i.Z)(w,2),N=I[0],U=I[1],O=(0,c.useState)(!1),L=(0,i.Z)(O,2),D=L[0],G=L[1],B=(0,c.useState)(P&&"__encrypted__"===u?null:u),z=(0,i.Z)(B,2),W=z[0],q=z[1],A=(0,c.useState)(W),M=(0,i.Z)(A,2),Y=M[0],F=M[1],V=function(){var e=(0,a.Z)((0,o.Z)().mark((function e(){var n;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return G(!0),e.prev=1,e.next=4,R(Y);case 4:!1===e.sent?F(W):(n=Y,"function"===typeof S&&(n=S(Y)),F(n),q(n)),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F(W);case 11:return e.prev=11,G(!1),U(!1),e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[1,8,11,15]])})));return function(){return e.apply(this,arguments)}}(),K=function(e){F(e),j(e)},H=N?(0,b.jsx)(p.Z,(0,r.Z)({style:{flex:1},fullWidth:!0,value:Y,onChange:function(e){K(e.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:C,onKeyDown:function(e){"Enter"===e.key&&V()},disabled:t,type:P?"password":"text"},_)):(0,b.jsx)(d.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:k(Y,P,u)});return(0,b.jsx)(v.Z,{className:"form",style:E,children:(0,b.jsxs)(d.Z,{className:"form-item",children:[(0,b.jsxs)(d.Z,{className:"form-item-label",children:[n,s&&(0,b.jsx)(Z.Z,{})]}),(0,b.jsxs)(d.Z,{className:"form-item-body",children:[(0,b.jsx)(d.Z,{className:"form-item-input",children:H}),(0,b.jsx)(d.Z,{className:"form-item-action",children:N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(x.Z,{"data-cy":"schema-form-item-confirm",onClick:V,disabled:t||D,size:"large",children:D?(0,b.jsx)(m.Z,{size:24}):(0,b.jsx)(h.Z,{})}),(0,b.jsx)(x.Z,{"data-cy":"schema-form-item-cancel",onClick:function(){F(W),U(!1)},disabled:t||D,size:"large",children:(0,b.jsx)(f.default,{})})]}):(0,b.jsx)(g.Z,{triggers:T,onEnterEdit:function(){return U(!0)},disabled:t})})]})]})})}j.propTypes={style:u().object,onSubmit:u().func,onChange:u().func,label:u().string,initialValue:u().string,placeholder:u().string,required:u().bool,disabled:u().bool,secure:u().bool,triggers:u().array,formatterBeforeSubmit:u().func},j.defaultProps={style:{},onSubmit:function(){},onChange:function(){},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null}},76934:function(e,n,t){t.d(n,{Z:function(){return v}});var r=t(96234),o=t(30969),a=t(24974),i=t.n(a),l=t(1484),c=t(94551),s=t(72097),u=t(27265),d=t(97475),p=t(38589),m=t(46672),f=t(45761),h=t(2689),x=t(23484),Z=t(37574);function v(e){var n=e.triggers,t=e.onEnterEdit,a=e.disabled,i=o.useRef(null),v=o.useState(!1),g=(0,r.Z)(v,2),b=g[0],y=g[1];return 0===n.length?(0,Z.jsx)(c.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:a,size:"large",children:(0,Z.jsx)(l.Z,{})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(u.Z,{variant:"outlined",ref:i,"aria-label":"split button",children:[(0,Z.jsx)(s.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:a,size:"large",children:(0,Z.jsx)(l.Z,{})}),(0,Z.jsx)(s.Z,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,onClick:function(){y((function(e){return!e}))},children:(0,Z.jsx)(d.Z,{})})]}),(0,Z.jsx)(f.Z,{sx:{zIndex:9999},open:b,anchorEl:i.current,role:void 0,placement:"bottom-end",children:(0,Z.jsx)(m.Z,{children:(0,Z.jsx)(p.d,{onClickAway:function(e){i.current&&i.current.contains(e.target)||y(!1)},children:(0,Z.jsx)(x.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((function(e){return(0,Z.jsx)(h.Z,{onClick:function(){return n=e.handler,y(!1),void n();var n},children:e.title},e.key)}))})})})})]})}v.propTypes={triggers:i().arrayOf(i().shape({key:i().string.isRequired,title:i().string.isRequired,handler:i().func.isRequired})),onEnterEdit:i().func.isRequired,disabled:i().bool.isRequired},v.defaultProps={triggers:[]}},22572:function(e,n,t){t.d(n,{V:function(){return s},Z:function(){return c}});var r=t(33028),o=t(24974),a=t.n(o),i=t(77370),l=t(37574);function c(e){var n=e.permission,t=e.role,r=e.component,o=e.children,a=(0,i.T)().session,l=!0,c=[].concat(n).filter(Boolean),s=[].concat(t).filter(Boolean);if(c.length){var u=a.user&&a.user.permissions||[];l=c.some((function(e){return u.includes(e)}))}return l&&s.length&&(l=s.includes(a.user.role)),"function"===typeof r?r(l):"function"===typeof o?o(l):l&&(r||o)||null}function s(e,n,t){return function(o){return(0,l.jsx)(c,{permission:n,role:t,children:function(n){return(0,l.jsx)(e,(0,r.Z)((0,r.Z)({},o),{},{hasPermission:n}))}})}}c.propTypes={permission:a().oneOfType([a().string,a().arrayOf(a().string)]),role:a().oneOfType([a().string,a().arrayOf(a().string)]),component:a().oneOfType([a().func,a().node]),children:a().oneOfType([a().func,a().node])},c.defaultProps={permission:"",role:"",component:null,children:null}}}]);
2
- //# sourceMappingURL=3076.28658ffc.chunk.js.map
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[6032],{6032:function(e,n,t){t.r(n),t.d(n,{default:function(){return m}});var r=t(32723),a=t(34795),c=t(96234),o=t(30969),s=t(19611),u=t.n(s),i=t(95803),l=t.n(i),f=t(90781),p=t(23938),d=t(37574),h=(0,o.lazy)((function(){return Promise.all([t.e(5683),t.e(7006),t.e(3994),t.e(9582),t.e(4319),t.e(1905),t.e(6629),t.e(9997),t.e(2838),t.e(7606),t.e(476),t.e(9996),t.e(1233),t.e(9033),t.e(8016),t.e(8181),t.e(7419)]).then(t.bind(t,78181))}));function m(){var e,n=(0,p.y0)().blocklet,t=null===n||void 0===n||null===(e=n.meta)||void 0===e?void 0:e.did,s=new URL(window.location.href),i=(s.searchParams.get("store")||"").split(",").filter(Boolean).map((function(e){try{return new URL(e.startsWith("http")?e:"https://".concat(e)).origin}catch(n){return console.error(n),null}})).filter(Boolean),m=(0,o.useState)(i.map((function(e){return{url:e,name:e.replace("https://","")}}))),v=(0,c.Z)(m,2),b=v[0],k=v[1],w=s.searchParams.get("resourceType")||"";return(0,o.useEffect)((function(){(0,a.Z)((0,r.Z)().mark((function e(){var n;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Promise.all(i.map(function(){var e=(0,a.Z)((0,r.Z)().mark((function e(n){var t,a,c;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u()(n,"/api/store.json"),e.next=3,l().get(t);case 3:return a=e.sent,c=a.data,e.abrupt("return",{url:n,name:c.name});case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()));case 3:n=e.sent,k(n||[]),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))()}),[i.join(",")]),(0,o.useEffect)((function(){var e=(0,f.ZP)();return t&&e.connect(),function(){t&&e.isConnected()&&e.disconnect()}}),[t]),(0,d.jsx)(h,{stores:b,resourceType:w,mode:"embed"})}}}]);
2
- //# sourceMappingURL=6032.406db269.chunk.js.map
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[6139],{70998:function(e,n,t){t.d(n,{Z:function(){return b}});var o=t(33028),l=t(59740),r=t(24974),i=t.n(r),c=t(59467),a=t(62399),s=t(19611),d=t.n(s),u=t(20244),p=t(41395),m=t(24891);var h=t(37574),f=["blocklet","style","size","ancestors"];function b(e){var n=e.blocklet,t=e.style,r=e.size,i=e.ancestors,s=(0,l.Z)(e,f),b=(0,p.h6)(),x=function(e){var n,t=e.blocklet,o=e.ancestors,l=void 0===o?[]:o,r=(0,p.h6)(),i=r.inService,c="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,m.XN)(null===t||void 0===t?void 0:t.status)?"~":""),a=i?d()(m.zn,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",c):d()(r.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)a=d()(t.deployedFrom,(0,m.lk)(t.meta.bundleDid,t.meta.logo),c);else{var s=window.env.apiPrefix||"/",h=l.concat(t),f=i?h.slice(1):h;a=d()(s,"/blocklet/logo-bundle".concat(f.map((function(e){return"/".concat(e.meta.did)})).join("")),c)}return{logoUrl:a,inService:i}}({blocklet:n,ancestors:i}),v=x.logoUrl,Z=x.inService,j=s.variant,k=Z?function(){}:function(e){e.target.src="".concat(b.imgPrefix,"/blocklet.png")},g=(0,h.jsx)("img",{src:v,onError:k,alt:n.meta.name,style:{width:r}});return n.meta.logo||(g=(0,h.jsx)(a.Z,{did:n.meta.did||"",responsive:!0})),(0,h.jsx)(c.Z,(0,o.Z)((0,o.Z)({variant:j||"square",style:Object.assign({backgroundColor:"transparent",width:r,height:r,borderRadius:10},t)},s),{},{children:g}))}b.propTypes={blocklet:i().object.isRequired,style:i().object,size:i().oneOfType([i().number,i().string]),ancestors:i().array},b.defaultProps={style:{},size:40,ancestors:[]}},16139:function(e,n,t){t.r(n),t.d(n,{default:function(){return Qe}});var o=t(71171),l=t(30969),r=t(30734),i=t(16380),c=t(38361),a=t(45008),s=t(96234),d=t(86822),u=t(26022),p=t(94551),m=t(10814),h=t(2291),f=t(29996),b=t(1986),x=t(9715),v=t(16438),Z=t(41395),j=t(33028),k=t(59740),g=t(24974),y=t.n(g),T=t(94308),I=t(37574),E=["size"];function P(e){var n=e.size,t=(0,k.Z)(e,E);return(0,I.jsx)(c.Z,(0,j.Z)((0,j.Z)({display:"flex",mt:4},t),{},{children:(0,I.jsx)(T.Z,{size:n})}))}P.propTypes={size:y().number},P.defaultProps={size:24};var R,S=t(36558),C=t(8479);function N(){var e=(0,u.PE)(),n=e.t,t=e.locale,o=(0,Z.h6)().api,i=(0,l.useState)(!0),j=(0,s.Z)(i,2),k=j[0],g=j[1],y=(0,a.y0)().blocklet,T=(0,l.useState)(null),E=(0,s.Z)(T,2),R=E[0],N=E[1],w=(0,r.useParams)().componentDid,_=void 0===w?"":w,z=(0,l.useState)(null),V=(0,s.Z)(z,2),L=V[0],A=V[1],D=function(){o.getProjects({input:{did:y.meta.did,componentDid:_}}).then((function(e){var n=(null===e||void 0===e?void 0:e.projects)||[];g(!1),A(n)})).catch((function(e){g(!1),b.Z.error(e.message)}))};if((0,l.useEffect)((function(){D()}),[]),!L&&k)return(0,I.jsx)(P,{});if(!L)return null;if(!L.length)return(0,I.jsxs)(c.Z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[(0,I.jsx)(c.Z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:n("blocklet.publish.blockletEmptyTip")}),(0,I.jsx)(c.Z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:n("blocklet.publish.createBlockletTip")}),(0,I.jsx)(d.rU,{to:"create",children:(0,I.jsx)(f.Z,{variant:"contained",children:n("blocklet.publish.createBlocklet")})})]});var O=[{label:"Blocklet",name:"blockletTitle",options:{customBodyRenderLite:function(e){var n=L[e];return(0,I.jsx)(d.rU,{to:"".concat(n.id),children:n.blockletTitle||"/"})}}},{label:"DID",name:"blockletDid",options:{customBodyRender:function(e){return(0,I.jsx)(S.Z,{size:14,responsive:!0,did:e})}}},{label:"Version",name:"blockletVersion",options:{customBodyRender:function(e){return e?(0,I.jsx)(x.Z,{type:"success",children:e}):""}}},{label:n("common.updatedAt"),name:"updatedAt",options:{customBodyRender:function(e){return(0,I.jsx)(v.Z,{value:Number(e),locale:t})}}},{label:n("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var n=L[e];return(0,I.jsx)(c.Z,{display:"flex",children:(0,I.jsx)(p.Z,{color:"error","aria-label":"delete",onClick:function(){return function(e){N(e)}(n)},children:(0,I.jsx)(m.default,{sx:{fontSize:18}})})})}}}];return(0,I.jsxs)(B,{children:[(0,I.jsx)(c.Z,{sx:{textAlign:"right"},children:(0,I.jsx)(d.rU,{to:"create",children:(0,I.jsx)(f.Z,{variant:"contained",children:n("blocklet.publish.createBlocklet")})})}),(0,I.jsx)(h.Z,{className:"main-table",locale:t,data:L,columns:O,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),R&&(0,I.jsx)(C.Z,{title:"".concat(n("common.delete")," ").concat(R.blockletTitle),description:n("blocklet.publish.deleteBlockletTip"),confirm:n("common.confirm"),onConfirm:function(){g(!1);var e=R.id;o.deleteProject({input:{did:y.meta.did,projectId:e}}).then((function(){g(!1),D(),b.Z.success(n("common.removeSuccess"))})).catch((function(e){g(!1),b.Z.error(e.message)}))},onCancel:function(){return N(null)}})]})}N.propTypes={};var w,B=(0,i.Z)(c.Z)(R||(R=(0,o.Z)(["\n .main-table > div:first-child {\n display: none;\n }\n"]))),_=t(33665),z=t(2689),V=t(87006),L=t(33359),A=t(15012),D=t(4953),O=t(26328),W=t(77370),M=[{label:{en:"Resource",zh:"\u8d44\u6e90"},value:"resource"},{label:{en:"Application",zh:"\u5e94\u7528"},value:"pack",disabled:!0}];function U(e){var n=Object.assign({},((0,_.Z)(e),e)),t=(0,r.useNavigate)(),o=(0,u.PE)(),i=o.t,p=o.locale,m=(0,a.y0)().blocklet,h=(0,l.useState)(""),x=(0,s.Z)(h,2),v=x[0],k=x[1],g=(0,l.useState)(!1),y=(0,s.Z)(g,2),T=y[0],E=y[1],P=(0,l.useState)("resource"),R=(0,s.Z)(P,2),S=R[0],C=R[1],N=(0,W.T)().api,w=(0,Z.h6)().api,B=(0,l.useState)(),U=(0,s.Z)(B,2),F=U[0],X=U[1],H=(0,l.useState)(!1),J=(0,s.Z)(H,2),K=J[0],G=J[1],Q=(0,r.useParams)().componentDid;return(0,I.jsxs)(q,(0,j.Z)((0,j.Z)({},n),{},{children:[(0,I.jsxs)(A.Z,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,I.jsx)(d.rU,{to:"..",children:i("common.publish")}),(0,I.jsxs)(L.Z,{color:"text.primary",children:[i("common.create")," Blocklet"]})]}),(0,I.jsxs)(c.Z,{style:{maxWidth:500},children:[(0,I.jsx)(V.Z,{required:!0,sx:{mb:4},label:"Blocklet DID",fullWidth:!0,readonly:!0,autoComplete:"off",variant:"outlined",onClick:function(){return!F&&G(!0)},InputProps:{"data-cy":"export-blocklet-did",endAdornment:(0,I.jsx)(D.Z,{position:"end",children:(0,I.jsx)(f.Z,{onClick:function(){return G(!0)},children:i(F?"common.update":"common.create")})})},helperText:"",value:F||""}),K&&(0,I.jsx)(O.Z,{open:!0,popup:!0,onClose:function(){return G(!1)},action:"gen-blocklet-key-pair",locale:p,checkFn:N.get,saveConnect:!1,forceConnected:!1,checkTimeout:3e5,onSuccess:function(e){var n,t=null===e||void 0===e||null===(n=e.blockletWallet)||void 0===n?void 0:n.address;t?X(t):b.Z.error("Empty Blocklet DID"),G(!1)},onError:function(e){b.Z.error(e.message),G(!1)},extraParams:{did:m.meta.did},messages:{title:i("blocklet.publish.connect.title"),scan:i("blocklet.publish.connect.scan"),confirm:i("blocklet.publish.connect.confirm"),success:i("blocklet.publish.connect.success")}}),(0,I.jsx)(V.Z,{required:!0,label:"Blocklet ".concat(i("common.title")),autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-title"},fullWidth:!0,helperText:"",value:v||"",onChange:function(e){k(e.target.value)}}),(0,I.jsx)(V.Z,{sx:{my:4},id:"blocklet-type",select:!0,label:"Blocklet ".concat(i("common.type")),helperText:"",fullWidth:!0,value:S,onChange:function(e){return C(e.target.value)},children:M.map((function(e){return(0,I.jsx)(z.Z,{value:e.value,disabled:e.disabled,children:e.label[p]||e.label.en},e.value)}))})]}),(0,I.jsx)(f.Z,{variant:"contained",disabled:T,onClick:function(){F?v?(E(!0),w.createProject({input:{did:m.meta.did,blockletTitle:v||"",blockletDid:F,type:S,componentDid:Q}}).then((function(){E(!1),t("../",{replace:!0})})).catch((function(e){E(!1),b.Z.error(e.message)}))):b.Z.error(i("blocklet.publish.errorTip.noTitle")):b.Z.error(i("blocklet.publish.errorTip.noDid"))},children:i("common.create")})]}))}U.propTypes={},U.defaultProps={};var F,q=i.Z.div(w||(w=(0,o.Z)(["\n .breadcrumbs {\n margin-bottom: 24px;\n }\n"]))),X=t(19611),H=t.n(X),J=t(70093),K=t.n(J),G=t(32677),Q=t(20244),Y=t(59505);function $(){var e=(0,u.PE)(),n=e.t,t=e.locale,o=(0,r.useParams)().projectId,i=(0,Z.h6)().api,j=(0,l.useState)(!0),k=(0,s.Z)(j,2),g=k[0],y=k[1],T=(0,a.y0)().blocklet,E=(0,l.useState)(null),R=(0,s.Z)(E,2),S=R[0],N=R[1],w=(0,l.useState)(null),B=(0,s.Z)(w,2),_=B[0],z=B[1],V=(0,l.useState)(null),D=(0,s.Z)(V,2),O=D[0],W=D[1];(0,l.useEffect)((function(){i.doBatchQuery({getProject:{input:{did:T.meta.did,projectId:o}},getReleases:{input:{did:T.meta.did,projectId:o}}}).then((function(e){z(e.getProject.project||{}),N(e.getReleases.releases||[]),y(!1)})).catch((function(e){y(!1),b.Z.error(e.message)}))}),[]);if(!S&&g)return(0,I.jsx)(P,{});if(!S)return null;var M=(0,I.jsxs)(A.Z,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,I.jsx)(d.rU,{to:"..",children:n("common.publish")}),(0,I.jsx)(L.Z,{color:"text.primary",children:_.blockletTitle})]});if(!S.length)return(0,I.jsxs)(I.Fragment,{children:[M,(0,I.jsxs)(c.Z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[(0,I.jsx)(c.Z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:n("blocklet.publish.releaseEmptyTip")}),(0,I.jsx)(c.Z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:n("blocklet.publish.createReleaseTip")}),(0,I.jsx)(d.rU,{to:"create",children:(0,I.jsx)(f.Z,{variant:"contained",children:n("blocklet.publish.createRelease")})})]})]});var U=[{label:n("common.version"),name:"blockletVersion",options:{customBodyRenderLite:function(e){var n=S[e];return(0,I.jsx)(d.rU,{to:"".concat(n.id),children:n.blockletVersion||"/"})}}},{label:n("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:function(e){var n=S[e];return(0,I.jsx)(L.Z,{className:"note",children:n.note||""})}}},{label:n("common.status"),name:"status",options:{customBodyRender:function(e){return(0,I.jsx)(x.Z,{type:"published"===e?"success":"warning",children:K()(e)})}}},{label:n("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:function(e){var n=S[e];return n.status!==Y.PROJECT.RELEASE_STATUS.published?"":(0,I.jsx)(v.Z,{value:Number(n.updatedAt),locale:t})}}},{label:n("common.actions"),name:"actions",options:{customBodyRenderLite:function(e){var n=S[e];return(0,I.jsxs)(c.Z,{display:"flex",alignItems:"center",children:[(0,I.jsx)(p.Z,{color:"primary","aria-label":"download",disabled:"published"!==n.status,children:"published"===n.status?(0,I.jsx)("a",{style:{display:"flex"},href:H()("".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(T.meta.did,"/").concat(_.id,"/").concat(n.id,"/download/").concat((n.files||[])[0])),children:(0,I.jsx)(G.Z,{sx:{fontSize:18}})}):(0,I.jsx)(G.Z,{sx:{fontSize:18}})}),(0,I.jsx)(p.Z,{color:"error","aria-label":"delete",onClick:function(){return function(e){W(e)}(n)},children:(0,I.jsx)(m.default,{sx:{fontSize:18}})})]})}}}];return(0,I.jsxs)(ne,{children:[(0,I.jsxs)(c.Z,{className:"header",children:[M,(0,I.jsx)(d.rU,{to:"create",children:(0,I.jsx)(f.Z,{variant:"contained",children:n("blocklet.publish.createRelease")})})]}),(0,I.jsx)(h.Z,{className:"main-table",verticalKeyWidth:100,locale:t,data:S,columns:U,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),O&&(0,I.jsx)(C.Z,{title:n("".concat(n("common.delete")," ").concat(O.blockletVersion)),description:n("blocklet.publish.deleteReleaseTip"),confirm:n("common.confirm"),onConfirm:function(){y(!1);var e=O.id;i.deleteRelease({input:{did:T.meta.did,projectId:o,releaseId:e}}).then((function(){y(!1),i.getReleases({input:{did:T.meta.did,projectId:o}}).then((function(e){var n=(null===e||void 0===e?void 0:e.releases)||[];y(!1),N(n)})).catch((function(e){y(!1),b.Z.error(e.message)})),b.Z.success(n("common.removeSuccess"))})).catch((function(e){y(!1),b.Z.error(e.message)}))},onCancel:function(){return W(null)}})]})}$.propTypes={};var ee,ne=(0,i.Z)(c.Z)(F||(F=(0,o.Z)(["\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .main-table > div:first-child {\n display: none;\n }\n .note {\n word-break: break-all;\n white-space: pre-line;\n }\n"]))),te=t(68079),oe=t(56666),le=t(43178),re=t(49735),ie=t.n(re),ce=t(60451),ae=t.n(ce),se=t(59467),de=t(30291),ue=t(78789),pe=t(19865),me=t(70998),he=t(24891),fe=t(32723),be=t(34795),xe=t(63146),ve=t.n(xe),Ze=t(65667),je=t.n(Ze),ke=t(92522),ge=t.n(ke),ye=t(49884),Te=t(24837),Ie=t(7418),Ee=t(88876),Pe=t(23038),Re=t(52838),Se=t(16374),Ce=t(96628),Ne=function(e,n){for(var t=(0,te.Z)(e);t.length>0;){var o=t.shift();if(o.id===n)return o;o.children&&t.push.apply(t,(0,te.Z)(o.children))}return[]};function we(e){var n=e.icon;return n?ge()(n)?(0,I.jsx)("img",{className:"resource-icon",src:n,alt:"icon"}):(0,I.jsx)(Ce.JO,{className:"resource-icon",icon:n}):null}function Be(e){var n=e.disabled,t=e.data,o=e.onChange,l=e.value;function r(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return n.push(e.id),e.children&&e.children.forEach((function(e){return r(e,n)})),n}var i=function(e){return r(Ne(t,e))},a=function e(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=Ne(t,n);return l.parent?(o.push(l.parent),e(l.parent,o)):o};function s(e,n){var t=i(e.id),o=t.indexOf(e.id);return t.splice(o,1),t.every((function(e){return l.concat(n).includes(e)}))}var d=function(e,n){e.stopPropagation();var r=i(n),c=a(n);if(l.includes(n)){var d=l.filter((function(e){return!r.concat(c).includes(e)}));o(d)}else{for(var u=r,p=0;p<c.length;++p)s(Ne(t,c[p]),u)&&u.push(c[p]);o((0,te.Z)(l).concat(u))}},u=function(e){e.stopPropagation()},p=t.some((function(e){var n;return(null===(n=e.children)||void 0===n?void 0:n.length)>0})),m=function e(t){return(0,I.jsx)(Ie.Z,{nodeId:t.id,label:(0,I.jsx)(ye.Z,{onClick:u,control:(0,I.jsx)(Ee.Z,{size:"small",checked:-1!==l.indexOf(t.id),tabIndex:-1,disableRipple:!0,onClick:function(e){return d(e,t.id)},disabled:n}),label:(0,I.jsxs)(c.Z,{className:"content",children:[(0,I.jsxs)(c.Z,{display:"flex",alignItems:"center",children:[t.icon&&(0,I.jsx)(we,{icon:t.icon}),(0,I.jsx)(c.Z,{className:"name",children:t.name}),t.url&&(0,I.jsx)("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"link",children:(0,I.jsx)(Se.Z,{className:"link-icon"})})]}),!!t.description&&(0,I.jsx)(c.Z,{className:"description",children:t.description})]})}),children:Array.isArray(t.children)?t.children.map(e):null},t.id)};return(0,I.jsx)(ze,{className:je()(!p&&"no-children"),multiSelect:!0,defaultCollapseIcon:(0,I.jsx)(Pe.Z,{}),defaultExpandIcon:(0,I.jsx)(Re.default,{}),selected:l,children:t.map((function(e){return m(e)}))})}we.propTypes={icon:y().string},we.defaultProps={icon:""},Be.propTypes={data:y().array,value:y().array,onChange:y().func,disabled:y().bool},Be.defaultProps={data:[],value:[],onChange:function(){},disabled:!1};var _e,ze=(0,i.Z)(Te.Z)(ee||(ee=(0,o.Z)(["\n &.no-children {\n .MuiTreeItem-content {\n padding: 0;\n .MuiTreeItem-iconContainer {\n display: none;\n }\n .MuiTreeItem-label {\n padding-left: 0;\n }\n }\n }\n .MuiTreeItem-content {\n align-items: flex-start;\n .MuiTreeItem-iconContainer {\n transform: translateY(10px);\n }\n &.Mui-selected {\n background-color: transparent;\n }\n }\n .MuiTreeItem-label {\n cursor: default;\n }\n .MuiFormControlLabel-root {\n align-items: flex-start;\n }\n .content {\n padding-top: 6px;\n }\n .name {\n font-size: 16px;\n font-weight: 700;\n }\n .resource-icon {\n margin-right: 2px;\n font-size: 16px;\n }\n img.resource-icon {\n width: 1rem;\n height: 1rem;\n }\n .link {\n margin-left: 8px;\n font-size: 16px;\n color: ",";\n display: flex;\n }\n .link-icon {\n font-size: inherit;\n }\n .description {\n font-size: 14px;\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main}),(function(e){return e.theme.palette.text.secondary})),Ve=t(54559),Le=function e(n,t){return n.forEach((function(n){t&&(n.parent=t),(n.children||[]).forEach((function(t){t.parent=n.id,e(t.children||[],t.id)}))})),n},Ae=function(e,n){return e.length!==n.length||!!ve()(e,n||[]).length};function De(e){var n=e.app,t=e.component,o=e.projectId,r=e.release,i=(0,u.PE)(),a=i.t,d=i.locale,p=(0,Z.h6)().api,m=(0,l.useState)([]),h=(0,s.Z)(m,2),x=h[0],v=h[1],j=(0,l.useState)([]),k=(0,s.Z)(j,2),g=k[0],y=k[1],T=(0,l.useState)([]),E=(0,s.Z)(T,2),P=E[0],R=E[1],S=(0,l.useState)(!1),C=(0,s.Z)(S,2),N=C[0],w=C[1],B=r.id,_="published"===r.status,z=((null===t||void 0===t?void 0:t.meta.capabilities)||{}).resourceExportApi,V=void 0===z?"/":z,L=(0,l.useMemo)((function(){return Ae(P,g)}),[P,g]),A=new URL(H()("http://127.0.0.1",t.mountPoint,V||"/").replace(/\/+/g,"/"));A.searchParams.set("projectId",o),A.searchParams.set("releaseId",B),A.searchParams.set("local",d);var D="".concat(A.pathname).concat(A.search),O=function(){var e=(0,be.Z)((0,fe.Z)().mark((function e(l){return(0,fe.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p.updateSelectedResources({input:{did:n.meta.did,projectId:o,releaseId:B,componentDid:t.meta.did,resources:l}});case 3:R(l),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),b.Z.error(e.t0.message);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(n){return e.apply(this,arguments)}}(),W=function(){var e=(0,be.Z)((0,fe.Z)().mark((function e(){var n;return(0,fe.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=g,e.prev=1,w(!0),e.next=5,Ve.od.post(D,{resources:n,projectId:o,releaseId:B,locale:d});case 5:b.Z.success(a("common.saveSuccess")),w(!1),O(g),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(1),w(!1),b.Z.error(e.t0.message);case 14:case"end":return e.stop()}}),e,null,[[1,10]])})));return function(){return e.apply(this,arguments)}}();return(0,l.useEffect)((function(){Ve.od.get(D).then((function(e){var n,t=Le((null===(n=e.data)||void 0===n?void 0:n.resources)||[]);v(t)})).catch((function(e){b.Z.error(e.message)})),p.getSelectedResources({input:{did:n.meta.did,projectId:o,releaseId:B,componentDid:t.meta.did}}).then((function(e){var n=(null===e||void 0===e?void 0:e.resources)||[];y(n),R(n)})).catch((function(e){b.Z.error(e.message)}))}),[D]),"running"!==t.status?(0,I.jsx)(We,{children:(0,I.jsx)(c.Z,{pt:6,children:a("blocklet.publish.componentNotRunning",{name:t.meta.title})})}):(0,I.jsx)(We,{children:(0,I.jsxs)(c.Z,{children:[(0,I.jsx)(Be,{data:x,value:g,onChange:function(e){y(e)},disabled:N||_}),!_&&(0,I.jsx)(c.Z,{className:"footer",children:(0,I.jsx)(f.Z,{variant:"contained",disabled:N||!L,onClick:function(){return W()},children:a("common.save")})})]})})}De.propTypes={component:y().object.isRequired,app:y().object.isRequired,projectId:y().string.isRequired,release:y().shape({id:y().string.isRequired,status:y().string})},De.defaultProps={release:{id:""}};var Oe,We=(0,i.Z)(c.Z)(_e||(_e=(0,o.Z)(["\n border: 1px solid #ccc;\n border-radius: 4px;\n padding: 16px;\n padding-bottom: 0px;\n max-height: 600px;\n overflow-y: auto;\n .footer {\n border-top: 1px solid #ddd;\n display: flex;\n padding: 12px 0;\n margin-top: 12px;\n position: sticky;\n bottom: 0;\n background: #fff;\n }\n"]))),Me=["image/*",".jpg",".jpeg",".png",".gif",".svg"],Ue=10485760,Fe=(0,l.lazy)((function(){return Promise.all([t.e(4917),t.e(5547)]).then(t.bind(t,25547)).then((function(e){return{default:e.Uploader}}))})),qe=function(e,n,t){var o=[];return e.blockletTitle||o.push({param:"blockletTitle",message:t("blocklet.publish.errorTip.noTitle")}),e.blockletVersion?ae().valid(e.blockletVersion)||o.push({param:"blockletVersion",message:"Invalid Blocklet Version"}):o.push({param:"blockletVersion",message:t("blocklet.publish.errorTip.noVersion")}),n===Y.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||o.push({param:"blockletDescription",message:t("blocklet.publish.errorTip.noDescription")}),e.note||o.push({param:"note",message:t("blocklet.publish.errorTip.noNote")})),o.length?o:null},Xe=function(e){var n=e.tabs,t=e.blocklet,o=e.ancestors,l=void 0===o?[]:o,r=t.meta.did;n.push({label:(0,I.jsxs)(c.Z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[(0,I.jsx)(me.Z,{size:24,blocklet:t,ancestors:l}),(0,I.jsx)(c.Z,{ml:"4px",className:"text",children:(0,I.jsx)(c.Z,{children:t.meta.title})})]},r),value:r})},He=function(e){var n=ie()(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","note"]);return n.blockletScreenshots||(n.blockletScreenshots=[]),n};function Je(e){var n,t,o,i=Object.assign({},((0,_.Z)(e),e)),m=(0,r.useNavigate)(),h=(0,r.useParams)(),x=h.projectId,v=h.releaseId,k=h.componentDid,g=(0,u.PE)().t,y=(0,a.y0)().blocklet,T=(0,le.Z)(null),E=(0,s.Z)(T,2),R=E[0],S=E[1],C=(0,l.useState)({}),N=(0,s.Z)(C,2),w=N[0],B=N[1],z=(0,l.useState)(!1),O=(0,s.Z)(z,2),W=O[0],M=O[1],U=(0,l.useState)(null),F=(0,s.Z)(U,2),q=F[0],X=F[1],J=(0,Z.h6)().api,K=(0,l.useRef)(null),G=(0,l.useRef)(null),$="create"===v?"":v,ee="create"===v?"create":"edit",ne=[],re=((null===y||void 0===y?void 0:y.children)||[]).filter((function(e){return e.meta.capabilities.resourceExportApi})).filter((function(e){return!k||e.meta.did===k}));re.forEach((function(e){Xe({tabs:ne,blocklet:e,t:g,ancestors:[y]})}));var ie=(0,l.useState)(null===(n=ne[0])||void 0===n?void 0:n.value),ce=(0,s.Z)(ie,2),me=ce[0],fe=ce[1],be="published"===(null===q||void 0===q?void 0:q.status),xe=be,ve=function(){if("edit"===ee){if(!$)return void b.Z.error("Empty release id");J.getRelease({input:{did:y.meta.did,projectId:x,releaseId:$}}).then((function(e){M(!1),S(He(null===e||void 0===e?void 0:e.release)),X(null===e||void 0===e?void 0:e.release)})).catch((function(e){M(!1),b.Z.error((0,he.Z)(e))}))}"create"===ee&&J.getProject({input:{did:y.meta.did,projectId:x}}).then((function(e){M(!1);var n=e.project||{};n.blockletVersion?ae().valid(n.blockletVersion)&&(n.blockletVersion=ae().inc(n.blockletVersion,"patch")):n.blockletVersion="1.0.0",S(He(n))})).catch((function(e){M(!1),b.Z.error((0,he.Z)(e))}))};(0,l.useEffect)((function(){ve()}),[]);var Ze=function(e){var n=qe(R,e,g);if(n)return b.Z.error(n.map((function(e){return e.message})).join("; ")),void B(n.reduce((function(e,n){return(0,j.Z)((0,j.Z)({},e),{},(0,oe.Z)({},n.param,n.message))}),{}));var t=(0,j.Z)({},R);if(t.blockletVersion=ae().valid(t.blockletVersion),!t.blockletVersion)return b.Z.error("Invalid Blocklet Version"),void B({blockletVersion:"Invalid Blocklet Version"});t.blockletTitle=(t.blockletTitle||"").trim(),t.blockletDescription=(t.blockletDescription||"").trim(),t.blockletIntroduction=(t.blockletIntroduction||"").trim(),t.note=(t.note||"").trim(),J.createRelease({input:(0,j.Z)((0,j.Z)({},t),{},{did:y.meta.did,projectId:x,releaseId:$,status:e})}).then((function(){"draft"===e?(b.Z.success("Save draft success"),"create"===ee&&m("../".concat(x),{replace:!0})):(b.Z.success("Create Release success"),m("../".concat(x),{replace:!0}))})).catch((function(e){b.Z.error((0,he.Z)(e))}))};if(!R&&W)return(0,I.jsx)(P,{});if(!R)return null;var je="".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(y.meta.did,"/").concat(x,"/logo/upload"),ke="".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(y.meta.did,"/").concat(x,"/screenshot/upload"),ge=null!==R&&void 0!==R&&R.blockletLogo?"".concat(je,"/").concat(R.blockletLogo):"".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/static/images/logo.png"),ye=((null===R||void 0===R?void 0:R.blockletScreenshots)||[]).filter(Boolean).map((function(e){return"".concat(ke,"/").concat(e)})),Te=re.find((function(e){return e.meta.did===me})),Ie=Te?(0,I.jsx)(c.Z,{children:(0,I.jsx)(De,{app:y,component:Te,projectId:x,release:(0,j.Z)((0,j.Z)({},q),{},{id:$})})}):(0,I.jsx)(c.Z,{display:"flex",mt:-3,children:(0,I.jsx)(ue.Z,{children:g("common.empty")})});return(0,I.jsxs)(Ge,(0,j.Z)((0,j.Z)({},i),{},{children:[(0,I.jsxs)(c.Z,{className:"sticky-header",children:[(0,I.jsxs)(A.Z,{className:"breadcrumbs","aria-label":"breadcrumb",children:[(0,I.jsx)(d.rU,{to:"../",children:g("common.publish")}),(0,I.jsx)(d.rU,{to:"../".concat(x),children:(null===R||void 0===R?void 0:R.blockletTitle)||"Blocklet"}),(0,I.jsx)(L.Z,{color:"text.primary",children:"create"===ee?g("common.create"):(null===R||void 0===R?void 0:R.blockletVersion)||g("common.edit")})]}),(0,I.jsxs)(c.Z,{display:"flex",children:[!be&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(f.Z,{variant:"outlined",disabled:W,onClick:function(){return Ze(Y.PROJECT.RELEASE_STATUS.draft)},style:{marginRight:12},children:g("blocklet.publish.saveDraft")}),(0,I.jsx)(f.Z,{variant:"contained",disabled:W,onClick:function(){return Ze(Y.PROJECT.RELEASE_STATUS.published)},children:g("common.release")})]}),be&&(0,I.jsx)(f.Z,{variant:"contained",children:(0,I.jsx)("a",{href:H()("".concat(Q.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project/").concat(y.meta.did,"/").concat(x,"/").concat($,"/download/").concat((q.files||[])[0])),children:g("common.download")})})]})]}),(0,I.jsxs)(c.Z,{pt:3,children:[(0,I.jsxs)(c.Z,{display:"flex",className:"section",children:[(0,I.jsx)(L.Z,{variant:"h3",className:"left",children:g("blocklet.publish.productTitle")}),(0,I.jsxs)(c.Z,{sx:{flex:1},children:[(0,I.jsx)(V.Z,{label:"Blocklet ".concat(g("common.title")),placeholder:"Blocklet ".concat(g("common.title")),InputProps:{"data-cy":"blocklet-title",readOnly:xe},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:R.blockletTitle||"",onChange:function(e){B({blockletTitle:""}),S({blockletTitle:e.target.value})},error:!!w.blockletTitle,helperText:w.blockletTitle||""}),(0,I.jsx)(V.Z,{label:"Blocklet ".concat(g("common.description")),placeholder:"Blocklet ".concat(g("common.description")),InputProps:{"data-cy":"blocklet-description",readOnly:xe},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:R.blockletDescription||"",onChange:function(e){B({blockletDescription:""}),S({blockletDescription:e.target.value})},error:!!w.blockletDescription,helperText:w.blockletDescription||"",sx:{mt:3}}),(0,I.jsx)(V.Z,{label:"Blocklet ".concat(g("common.introduction")),placeholder:"Blocklet ".concat(g("common.introduction")),InputProps:{"data-cy":"export-blocklet-introduction",readOnly:xe,endAdornment:(0,I.jsxs)(D.Z,{position:"end",children:[(null===R||void 0===R||null===(t=R.blockletIntroduction)||void 0===t?void 0:t.length)||0," / ",Y.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:R.blockletIntroduction||"",onChange:function(e){B({blockletIntroduction:""}),S({blockletIntroduction:e.target.value.slice(0,Y.PROJECT.MAX_INTRO_LENGTH)})},error:!!w.blockletIntroduction,helperText:w.blockletIntroduction||"",sx:{mt:3}})]})]}),(0,I.jsxs)(c.Z,{display:"flex",mt:3,className:"section",children:[(0,I.jsx)(L.Z,{variant:"h3",className:"left",children:g("blocklet.publish.versionTitle")}),(0,I.jsxs)(c.Z,{sx:{flex:1},children:[(0,I.jsx)(V.Z,{required:!0,label:"Blocklet ".concat(g("common.version")),placeholder:"Blocklet ".concat(g("common.version")),InputProps:{"data-cy":"blocklet-version",readOnly:xe},autoComplete:"off",variant:"outlined",fullWidth:!0,value:R.blockletVersion,onChange:function(e){B({blockletVersion:""}),S({blockletVersion:e.target.value})},error:!!w.blockletVersion,helperText:w.blockletVersion||""}),(0,I.jsx)(V.Z,{label:g("blocklet.publish.releaseNote"),autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:xe,endAdornment:(0,I.jsxs)(D.Z,{position:"end",children:[(null===R||void 0===R||null===(o=R.note)||void 0===o?void 0:o.length)||0," / ",Y.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:R.note,onChange:function(e){B({note:""}),S({note:e.target.value.slice(0,Y.PROJECT.MAX_NOTE_LENGTH)})},error:!!w.note,helperText:w.note||"",sx:{mt:3}})]})]}),(0,I.jsxs)(c.Z,{display:"flex",mt:3,className:"section full-width",children:[(0,I.jsx)(L.Z,{variant:"h3",className:"left",children:g("blocklet.publish.imgTitle")}),(0,I.jsxs)(c.Z,{sx:{flex:1},children:[(0,I.jsxs)(c.Z,{display:"flex",children:[(0,I.jsx)(L.Z,{variant:"subtitle1",sx:{mr:2},children:g("common.logo")}),(0,I.jsx)(c.Z,{sx:{flex:1,cursor:xe?"default":"pointer"},children:(0,I.jsx)(se.Z,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:ge,onClick:function(){return!xe&&K.current.open()}})})]}),(0,I.jsxs)(c.Z,{display:"flex",mt:3,children:[(0,I.jsx)(L.Z,{variant:"subtitle1",sx:{mr:2},children:g("common.screenshot")}),(0,I.jsxs)(c.Z,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap"},children:[ye.map((function(e,n){return(0,I.jsxs)(c.Z,{className:"screenshot",children:[(0,I.jsx)("img",{alt:"screenshot",src:e}),!xe&&(0,I.jsx)(p.Z,{className:"action",onClick:function(){var e=(0,te.Z)(R.blockletScreenshots);e.splice(n,1),S({blockletScreenshots:e})},children:(0,I.jsx)(de.default,{})})]})})),ye.length<5&&(0,I.jsx)(c.Z,{sx:{width:200,height:140,background:"#eee",cursor:xe?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:function(){return!xe&&G.current.open()},children:"+"})]})]})]}),(0,I.jsx)(Fe,{id:"\u200buploader-logo",ref:K,popup:!0,onUploadFinish:function(e){S({blockletLogo:e.data.filename}),K.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:je,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:Me,maxFileSize:Ue,maxNumberOfFiles:1}}},"uploader-logo"),(0,I.jsx)(Fe,{id:"\u200buploader-screenshot",ref:G,popup:!0,onUploadFinish:function(e){var n,t=R.blockletScreenshots||[];t.push(null===(n=e.data)||void 0===n?void 0:n.filename),S({blockletScreenshots:t}),G.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:ke,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:Me,maxFileSize:Ue,maxNumberOfFiles:5-ye.length}}},"uploader-screenshot")]}),(0,I.jsxs)(c.Z,{display:"flex",mt:3,className:"section full-width",children:[(0,I.jsx)(c.Z,{className:"left",children:(0,I.jsx)(L.Z,{variant:"h3",children:g("blocklet.publish.resourceTitle")})}),(0,I.jsxs)(c.Z,{sx:{flex:1},children:[(0,I.jsx)(pe.Z,{tabs:ne,current:me,onChange:function(e){fe(e)},sx:{ml:-2,mt:-1.5}}),(0,I.jsx)(c.Z,{children:Ie})]})]})]})]}))}Je.propTypes={},Je.defaultProps={};var Ke,Ge=i.Z.div(Oe||(Oe=(0,o.Z)(["\n .sticky-header {\n margin-top: -12px;\n padding: 12px 0;\n position: sticky;\n top: 0;\n z-index: 99;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background-color: #fff;\n padding-bottom: 12px;\n border-bottom: ",";\n }\n .screenshot {\n margin-bottom: 16px;\n max-width: 200px;\n max-height: 140px;\n width: 200px;\n height: 140px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #eee;\n margin-right: 16px;\n position: relative;\n .action {\n visibility: hidden;\n position: absolute;\n top: 0px;\n right: 0px;\n background-color: rgba(0, 0, 0, 0.2);\n color: rgba(255, 255, 255, 0.8);\n }\n &:hover .action {\n visibility: visible;\n }\n }\n .screenshot img {\n width: 100%; /* \u56fe\u50cf\u5bbd\u5ea6\u586b\u5145\u5bb9\u5668 */\n height: auto; /* \u56fe\u50cf\u9ad8\u5ea6\u81ea\u9002\u5e94 */\n }\n .section {\n max-width: 800px;\n &.full-width {\n max-width: 100%;\n }\n .MuiTypography-h3 {\n font-size: 1.1rem;\n font-weight: 700;\n }\n .left {\n flex-shrink: 0;\n width: 140px;\n }\n .MuiTabs-indicator {\n display: none;\n }\n .MuiTypography-subtitle1 {\n width: 120px;\n font-weight: 700;\n font-size: 1rem;\n "," {\n width: 80px;\n }\n }\n }\n .MuiButtonBase-root {\n a {\n color: inherit;\n }\n }\n .MuiInputBase-multiline .MuiInputAdornment-positionEnd {\n align-self: flex-end;\n .MuiTypography-root {\n font-size: 0.8rem;\n }\n font-size: 0.8rem;\n }\n"])),(function(e){var n=e.theme;return"1px solid ".concat(n.palette.divider)}),(function(e){return e.theme.breakpoints.down("sm")}));function Qe(){var e=(0,a.y0)().blocklet,n=(0,r.useLocation)(),t=(0,r.useParams)().componentDid;return(0,l.useEffect)((function(){if(t&&window.parent){var e="".concat(n.pathname).concat(n.search);window.parent.postMessage({event:"popstate",page:"publish",componentDid:t,path:e},"*")}}),[t,n]),e?(0,I.jsx)(Ye,{children:(0,I.jsxs)(r.Routes,{children:[(0,I.jsx)(r.Route,{path:"/",element:(0,I.jsx)(N,{})}),(0,I.jsx)(r.Route,{path:"/create",element:(0,I.jsx)(U,{})}),(0,I.jsx)(r.Route,{path:"/:projectId",element:(0,I.jsx)($,{})}),(0,I.jsx)(r.Route,{path:"/:projectId/:releaseId",element:(0,I.jsx)(Je,{})})]})}):null}Qe.propTypes={};var Ye=(0,i.Z)(c.Z)(Ke||(Ke=(0,o.Z)(["\n a {\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main}))},36558:function(e,n,t){var o=t(33028),l=t(59740),r=t(24974),i=t.n(r),c=t(86822),a=t(19638),s=t(23586),d=t(37574),u=["did","href","external","avatarProps"];function p(e){var n=e.did,t=e.href,r=e.external,i=(e.avatarProps,(0,l.Z)(e,u)),p=(0,d.jsx)(s.Z,(0,o.Z)({did:n},i));return t?r?(0,d.jsx)(a.Z,{target:"_blank",href:t,underline:"hover",children:p}):(0,d.jsx)(c.rU,{to:t,children:p}):p}p.propTypes={did:i().string.isRequired,to:i().string,href:i().string,avatarProps:i().object,external:i().bool},p.defaultProps={to:"",href:"",avatarProps:{},external:!1},n.Z=p}}]);
2
- //# sourceMappingURL=6139.161b2e7f.chunk.js.map
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[7419],{8479:function(n,r,e){e.d(r,{Z:function(){return P}});var o=e(71171),t=e(33028),i=e(32723),a=e(34795),s=e(96234),c=e(59740),l=e(30969),d=e(24974),u=e.n(d),p=e(16380),f=e(84636),m=e(94308),v=e(91862),h=e(87130),x=e(43207),Z=e(38357),w=e(18877),b=e(94702),g=e(75255),k=e(26022),y=e(29996),D=e(24891),U=e(45555);var j,C=function(){var n=(0,U.Z)();return{minWidth:(0,g.Z)(n.breakpoints.down("md"))?300:n.breakpoints.values.sm}},S=e(37574),O=["title","description","showCancel","cancel","confirm","color","params","onCancel","onConfirm","loading"];function P(n){var r=n.title,e=n.description,o=n.showCancel,d=n.cancel,u=n.confirm,p=n.color,f=n.params,U=n.onCancel,j=n.onConfirm,P=n.loading,W=(0,c.Z)(n,O),_=(0,l.useState)(f),q=(0,s.Z)(_,2),T=q[0],z=q[1],E=(0,l.useState)(!0),F=(0,s.Z)(E,2),A=F[0],H=F[1],N=(0,l.useState)(!1),B=(0,s.Z)(N,2),M=B[0],X=B[1],L=(0,l.useState)(""),G=(0,s.Z)(L,2),I=G[0],J=G[1],K=(0,k.PE)().t,Q=(0,b.Z)(),V=function(){var n=(0,a.Z)((0,i.Z)().mark((function n(r){return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("function"!==typeof r){n.next=17;break}return X(!0),n.prev=2,n.next=5,r(T);case 5:H(!1),n.next=12;break;case 8:n.prev=8,n.t0=n.catch(2),J((0,D.Z)(n.t0)),console.error(n.t0);case 12:return n.prev=12,X(!1),n.finish(12);case 15:n.next=18;break;case 17:H(!1);case 18:case"end":return n.stop()}}),n,null,[[2,8,12,15]])})));return function(r){return n.apply(this,arguments)}}(),Y="function"===typeof r?r():r,$="function"===typeof e?e(T,z,J):e,nn=(0,g.Z)(Q.breakpoints.down("md")),rn=C().minWidth;return(0,S.jsxs)(R,(0,t.Z)((0,t.Z)({onClick:function(n){n.stopPropagation()},fullScreen:nn,open:A,style:{minWidth:rn}},W),{},{children:[(0,S.jsx)(Z.Z,{children:Y}),(0,S.jsxs)(h.Z,{style:{minWidth:rn},children:[(0,S.jsx)(x.Z,{component:"div",children:$}),!!I&&(0,S.jsx)(w.Z,{severity:"error",style:{width:"100%",marginTop:8},children:I})]}),(0,S.jsxs)(v.Z,{className:"delete-actions",style:{padding:"8px 24px 24px"},children:[o&&(0,S.jsx)(y.Z,{onClick:function(n){n.stopPropagation(),V(U)},color:"inherit","data-cy":"cancel-confirm-dialog",children:d||K("common.cancel")}),(0,S.jsxs)(y.Z,{onClick:function(n){n.stopPropagation(),V(j)},color:p,disabled:T.__disableConfirm||M||P,variant:"contained","data-cy":"submit-confirm-dialog",autoFocus:!0,children:[(M||P)&&(0,S.jsx)(m.Z,{size:16,sx:{mr:1}}),u]})]})]}))}P.propTypes={title:u().any.isRequired,description:u().any.isRequired,showCancel:u().bool,cancel:u().string,color:u().string,confirm:u().string,params:u().object,onCancel:u().func,onConfirm:u().func.isRequired,loading:u().bool},P.defaultProps={onCancel:function(){},showCancel:!0,cancel:"",confirm:"Confirm",color:"error",params:{},loading:!1};var R=(0,p.Z)(f.Z)(j||(j=(0,o.Z)(["\n .delete-actions .Mui-disabled {\n color: rgba(0, 0, 0, 0.26) !important;\n box-shadow: none;\n background-color: rgba(0, 0, 0, 0.12) !important;\n }\n"])))},77370:function(n,r,e){e.d(r,{B:function(){return t.B3},T:function(){return i}});var o=e(30969),t=e(41333);function i(){return(0,o.useContext)(t.B3)}},54559:function(n,r,e){e.d(r,{hi:function(){return i},od:function(){return t.a}});var o=e(95803),t=e.n(o);t().defaults.timeout=1e4;var i=t().create()},37433:function(n,r,e){e.d(r,{H:function(){return p}});var o,t=e(71171),i=e(24974),a=e.n(i),s=e(20705),c=e(29996),l=e(55581),d=e(37574);function u(n){var r=n.title,e=n.desc,o=n.retryFunc;return(0,d.jsxs)(f,{role:"alert",children:[(0,d.jsx)("h3",{children:r}),(0,d.jsx)("pre",{children:e}),o&&(0,d.jsx)(c.Z,{variant:"contained",color:"error",size:"small",onClick:o,children:"Try again"})]})}function p(n){var r=n.error;return(0,d.jsx)(u,{desc:r.message})}u.propTypes={title:a().string,desc:a().string.isRequired,retryFunc:a().func},u.defaultProps={title:"Something went wrong...",retryFunc:null},p.propTypes={error:a().instanceOf(Error).isRequired},a().instanceOf(Error).isRequired,a().func.isRequired;var f=(0,l.zo)("div")(o||(o=(0,t.Z)(["\n padding: 16px;\n border: 2px solid ",";\n border-radius: 4px;\n color: ",";\n background-color: ",";\n font-size: 14px;\n h3 {\n margin: 0;\n font-size: 16px;\n }\n pre {\n white-space: normal;\n }\n"])),(function(n){return n.theme.palette.error.main}),(function(n){return n.theme.palette.error.main}),s.Z[50])},20146:function(n,r,e){e.d(r,{Z:function(){return R}});var o=e(7896),t=e(31461),i=e(30969),a=e(96234),s=e(86769),c=e(94702),l=e(32468),d=e(75255),u=e(37574),p=["initialWidth","width"],f=["xs","sm","md","lg","xl"],m=function(n,r){return!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?f.indexOf(n)<=f.indexOf(r):f.indexOf(n)<f.indexOf(r)},v=function(n,r){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?f.indexOf(r)<=f.indexOf(n):f.indexOf(r)<f.indexOf(n)},h=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var e=n.withTheme,f=void 0!==e&&e,m=n.noSSR,v=void 0!==m&&m,h=n.initialWidth;return function(n){var e=(0,c.Z)(),m=n.theme||e,x=(0,s.Z)({theme:m,name:"MuiWithWidth",props:n}),Z=x.initialWidth,w=x.width,b=(0,t.Z)(x,p),g=i.useState(!1),k=(0,a.Z)(g,2),y=k[0],D=k[1];(0,l.Z)((function(){D(!0)}),[]);var U=m.breakpoints.keys.slice().reverse().reduce((function(n,r){var e=(0,d.Z)(m.breakpoints.up(r));return!n&&e?r:n}),null),j=(0,o.Z)({width:w||(y||v?U:void 0)||Z||h},f?{theme:m}:{},b);return void 0===j.width?null:(0,u.jsx)(r,(0,o.Z)({},j))}}};var x=h()((function(n){var r=n.children,e=n.only,o=n.width,t=(0,c.Z)(),a=!0;if(e)if(Array.isArray(e))for(var s=0;s<e.length;s+=1){if(o===e[s]){a=!1;break}}else e&&o===e&&(a=!1);if(a)for(var l=0;l<t.breakpoints.keys.length;l+=1){var d=t.breakpoints.keys[l],p=n["".concat(d,"Up")],f=n["".concat(d,"Down")];if(p&&m(d,o)||f&&v(d,o)){a=!1;break}}return a?(0,u.jsx)(i.Fragment,{children:r}):null})),Z=e(56666),w=e(68079),b=e(87023),g=e(26540),k=e(24099),y=e(45971),D=e(62746),U=e(2975);function j(n){return(0,U.Z)("PrivateHiddenCss",n)}(0,D.Z)("PrivateHiddenCss",["root","xlDown","xlUp","onlyXl","lgDown","lgUp","onlyLg","mdDown","mdUp","onlyMd","smDown","smUp","onlySm","xsDown","xsUp","onlyXs"]);var C=["children","className","only"],S=(0,y.ZP)("div",{name:"PrivateHiddenCss",slot:"Root"})((function(n){var r=n.theme,e=n.ownerState,t={display:"none"};return(0,o.Z)({},e.breakpoints.map((function(n){var e=n.breakpoint,o=n.dir;return"only"===o?(0,Z.Z)({},r.breakpoints.only(e),t):"up"===o?(0,Z.Z)({},r.breakpoints.up(e),t):(0,Z.Z)({},r.breakpoints.down(e),t)})).reduce((function(n,r){return Object.keys(r).forEach((function(e){n[e]=r[e]})),n}),{}))}));var O=function(n){for(var r=n.children,e=n.className,i=n.only,a=(0,t.Z)(n,C),s=(0,c.Z)(),l=[],d=0;d<s.breakpoints.keys.length;d+=1){var p=s.breakpoints.keys[d],f=a["".concat(p,"Up")],m=a["".concat(p,"Down")];f&&l.push({breakpoint:p,dir:"up"}),m&&l.push({breakpoint:p,dir:"down"})}i&&(Array.isArray(i)?i:[i]).forEach((function(n){l.push({breakpoint:n,dir:"only"})}));var v=(0,o.Z)({},n,{breakpoints:l}),h=function(n){var r=n.classes,e=n.breakpoints,o={root:["root"].concat((0,w.Z)(e.map((function(n){var r=n.breakpoint,e=n.dir;return"only"===e?"".concat(e).concat((0,k.Z)(r)):"".concat(r).concat((0,k.Z)(e))}))))};return(0,g.Z)(o,j,r)}(v);return(0,u.jsx)(S,{className:(0,b.Z)(h.root,e),ownerState:v,children:r})},P=["implementation","lgDown","lgUp","mdDown","mdUp","smDown","smUp","xlDown","xlUp","xsDown","xsUp"];var R=function(n){var r=n.implementation,e=void 0===r?"js":r,i=n.lgDown,a=void 0!==i&&i,s=n.lgUp,c=void 0!==s&&s,l=n.mdDown,d=void 0!==l&&l,p=n.mdUp,f=void 0!==p&&p,m=n.smDown,v=void 0!==m&&m,h=n.smUp,Z=void 0!==h&&h,w=n.xlDown,b=void 0!==w&&w,g=n.xlUp,k=void 0!==g&&g,y=n.xsDown,D=void 0!==y&&y,U=n.xsUp,j=void 0!==U&&U,C=(0,t.Z)(n,P);return"js"===e?(0,u.jsx)(x,(0,o.Z)({lgDown:a,lgUp:c,mdDown:d,mdUp:f,smDown:v,smUp:Z,xlDown:b,xlUp:k,xsDown:D,xsUp:j},C)):(0,u.jsx)(O,(0,o.Z)({lgDown:a,lgUp:c,mdDown:d,mdUp:f,smDown:v,smUp:Z,xlDown:b,xlUp:k,xsDown:D,xsUp:j},C))}}}]);
2
- //# sourceMappingURL=7419.4eabaec0.chunk.js.map
@@ -1,2 +0,0 @@
1
- (self.webpackChunk_abtnode_blocklet_services=self.webpackChunk_abtnode_blocklet_services||[]).push([[8181],{60966:function(e,n,t){var o=t(6399);e.exports=function(e,n){return o(e)===o(n)}},78181:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Yn}});var o=t(71171),r=t(68079),i=t(59740),a=t(32723),l=t(34795),c=t(96234),s=t(33028),u=t(30969),d=t(24974),p=t.n(d),m=t(30734),f=t(12700),h=t.n(f),v=t(43260),x=t.n(v),g=t(76032),y=t.n(g),b=t(60523),Z=t.n(b),k=t(99398),C=t(94308),j=t(33359),w=t(87006),P=t(1437),S=t(38996),R=t(75255),T=t(16380),E=t(26022),D=t(59505),U=t(66629),L=t(43001),N=t(38361),B=t(20244),_=t(29996),F=t(23299),q=t(78598),I=t(65248),O=t(7017),A=t(88617),K=t.n(A),z=t(1986),M=t(41395),V=t(45008),W=t(24891),H=t(8016),G=t(14458),Y=t(19611),X=t.n(Y),Q=t(26328),J=t(59485),$=t.n(J),ee=t(54559),ne=t(74743),te=t(67888),oe=t(9943),re=t(86008),ie=t(93310),ae=t(64698),le=t(36508),ce=t(6200),se=t(37574),ue={meta:p().object.isRequired,onCancel:p().func.isRequired},de=(0,ne.Z)((function(){return{dialogAuth:{padding:"0 0 24px !important","& .auth-title":{textAlign:"center !important",marginBottom:"4px !important"},"& .auth-tip--scan":{textAlign:"center !important"}},iconRoot:{minWidth:48}}}));function pe(e){var n=e.action,t=e.onSelect,o=e.onNext,r=de(),i=(0,E.PE)().t,a=[{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,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(te.Z,{className:r.tabPanel,children:a.map((function(e){return(0,se.jsxs)(oe.ZP,{button:!0,selected:n===e.action,onClick:function(){return t(e.action)},children:[(0,se.jsx)(ie.Z,{className:r.iconRoot,children:"purchase"===e.action?(0,se.jsx)(ae.Z,{style:{color:"purchase"===n?ce.Z.primary.main:"#AAA",fontSize:32}}):(0,se.jsx)(le.Z,{style:{color:"verify"===n?ce.Z.primary.main:"#AAA",fontSize:32}})}),(0,se.jsx)(re.Z,{primary:e.title,secondary:e.description})]},e.action)}))}),o&&(0,se.jsx)(_.Z,{fullWidth:!0,disabled:!n,variant:"contained",color:"primary",style:{marginTop:16},onClick:o,children:i("common.next")})]})}pe.propTypes={action:p().oneOf(["both","purchase","verify"]).isRequired,onSelect:p().func.isRequired,onNext:p().func.isRequired};var me=["mode"];function fe(e){var n=e.meta,t=e.onCancel,o=e.mode,r=e.handlePaySuccess,i=(0,E.PE)(),d=i.t,p=i.locale,m=(0,M.h6)().info,f=(0,W.yP)(m),h=(0,u.useState)(null),v=(0,c.Z)(h,2),x=v[0],g=v[1],y=new URL(null===n||void 0===n?void 0:n.registryUrl).origin,b=(0,O.getDisplayName)({meta:n}),Z=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n,i){var c,s,u,p,m;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=function(e){return $()((function(){return ee.hi.get(e).then(function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n){var t,o;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.data,o=null===t||void 0===t?void 0:t.downloadTokenList,"succeed"!==t.status){e.next=12;break}if(!o||!o.length){e.next=8;break}return e.next=6,c({downloadTokenList:o});case 6:e.next=11;break;case 8:return e.next=10,s(d("blocklet.component.missDownloadTokenTip"));case 10:case 11:case 16:return e.abrupt("return",!0);case 12:if("error"!==t.status){e.next=17;break}return console.error("vc error: ",t),e.next=16,s(null===t||void 0===t?void 0:t.error);case 17:return e.abrupt("return",!1);case 18:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}())}),{interval:1e3})},c=function(e){var n=e.downloadTokenList;r({downloadTokenList:n})},s=function(e){z.Z.error(e),t(e)},"purchase"!==o||!x){e.next=9;break}return p=(0,W.Pi)(x),m=p.statusUrl,e.next=7,u(m);case 7:e.next=11;break;case 9:return e.next=11,c({downloadTokenList:n.downloadTokenList&&i(n.downloadTokenList)});case 11:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}();if((0,u.useEffect)((function(){if("purchase"===o){var e=new URL(y);e.pathname="/api/did/verify-purchase-blocklet/token",e.searchParams.set("serverDid",m.did),e.searchParams.set("blockletDid",null===n||void 0===n?void 0:n.did);try{ee.hi.get(e.href).then((function(e){var n=e.data,t="".concat(n.url);g(t)}))}catch(t){console.error("get next workflow url error: ",t)}}return function(){g(null)}}),[o]),"purchase"===o&&!x)return"";var k={verify:{action:"verify-purchase-blocklet",checkFn:ee.od.create({baseURL:y}).get,extraParams:{serverDid:m.did,blockletDid:null===n||void 0===n?void 0:n.did},messages:{title:d("store.purchase.verify.auth.title",{name:b}),scan:d("store.purchase.verify.auth.scan"),confirm:d("store.purchase.verify.auth.confirm"),success:d("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:ee.od.create({baseURL:X()(y,"/store")}).get,extraParams:{factory:n.nftFactory,nw:x},messages:{title:d("store.purchase.auth.title",{name:b}),scan:d("store.purchase.auth.scan"),confirm:d("store.purchase.auth.confirm"),success:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)("p",{children:d("store.purchase.auth.success")}),(0,se.jsx)("p",{children:d("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return(0,se.jsx)(Q.Z,(0,s.Z)({open:!0,locale:p,popup:!1,saveConnect:!1,className:"connect",baseUrl:y,onSuccess:Z,cancelWhenScanned:t,onClose:t,checkTimeout:3e5,webWalletUrl:f,disableClose:!0,showDownload:!1},k[o]))}fe.propTypes=(0,s.Z)((0,s.Z)({},ue),{},{handlePaySuccess:p().func,mode:p().oneOf(["verify","purchase"]).isRequired}),fe.defaultProps={handlePaySuccess:function(){}};var he=(0,u.forwardRef)((function(e,n){var t=e.mode,o=(0,i.Z)(e,me),r=(0,u.useState)("both"!==t?t:"verify"),a=(0,c.Z)(r,2),l=a[0],d=a[1],p=(0,u.useState)("both"!==t?2:1),m=(0,c.Z)(p,2),f=m[0],h=m[1],v=function(){l&&2!==f&&h(2)};return(0,u.useImperativeHandle)(n,(function(){return{onNext:v,getCurrentStep:function(){return f}}})),1===f?(0,se.jsx)("div",{style:{maxWidth:520},children:(0,se.jsx)(pe,{action:l,onNext:null,onSelect:function(e){e!==l&&d(e)}})}):(0,se.jsx)(fe,(0,s.Z)((0,s.Z)({},o),{},{mode:l}))}));he.propTypes={mode:p().oneOf(["both","verify","purchase"]).isRequired,ref:p().any},he.defaultProps={ref:{}};var ve,xe=he,ge=t(52654),ye=t(94486),be=t(30250),Ze=t(33665);function ke(e){var n=Object.assign({},((0,Ze.Z)(e),e));return(0,se.jsxs)("div",(0,s.Z)((0,s.Z)({},n),{},{style:{width:"100%"},children:[(0,se.jsx)("h3",{children:"End User License Agreement for Application"}),(0,se.jsxs)("p",{children:["Blocklet Server License Agreement ",B.COPYRIGHT_OWNER," version 2020-08-28"]}),(0,se.jsx)("p",{children:"BLOCKLET SERVER LICENSE AGREEMENT"}),(0,se.jsx)("p",{children:"\u6682\u65e0"})]}))}function Ce(e){var n=e.meta,t=e.onClickNext,o=e.handleDescEle,r=(0,m.useNavigate)(),i=(0,E.PE)(),a=i.t,l=i.locale,c=t||function(){r("/launch-blocklet/install".concat(window.location.search))};return(0,se.jsxs)(je,{children:[(0,se.jsx)("div",{className:"app-content",children:(0,se.jsx)("div",{className:"agreement",children:(0,se.jsx)("div",{className:"agreement-content",children:(0,se.jsx)(be.Z,{blockletMeta:{data:n},locale:l,handleDescEle:o})})})}),(0,se.jsx)("div",{className:"button-container","data-cy":"agree-all",children:(0,se.jsx)(ye.Z,{onContinue:c,description:(0,se.jsx)(ke,{}),texts:{listenName:a("launchBlocklet.license"),buttonNext:a("launchBlocklet.next")}})})]})}Ce.propTypes={meta:p().object.isRequired,onClickNext:p().func,handleDescEle:p().node},Ce.defaultProps={onClickNext:null,handleDescEle:""};var je=T.Z.div(ve||(ve=(0,o.Z)(["\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n height: 100%;\n flex: 1;\n .app-content {\n padding: 2px 24px 24px;\n "," {\n padding-top: 10px;\n }\n width: 100%;\n flex: 1;\n letter-spacing: normal;\n }\n .agreement {\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n border: 1px solid ",";\n border-radius: 12px;\n "," {\n margin-top: 24px;\n }\n "," {\n margin-top: 16px;\n }\n .agreement-content {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n font-size: 14px;\n overflow-y: auto;\n "," {\n padding: 0 24px;\n }\n "," {\n padding: 0 16px;\n }\n &:after {\n display: block;\n content: '';\n height: 24px;\n }\n }\n }\n .button-container {\n padding-top: 24px;\n padding-bottom: 34px;\n "," {\n padding-right: 24px;\n margin-left: auto;\n }\n "," {\n padding-top: 0;\n padding-bottom: 16px;\n }\n }\n"])),(function(e){return e.theme.breakpoints.down("md")}),(function(e){return e.theme.palette.grey[100]}),(function(e){return e.theme.breakpoints.up("md")}),(function(e){return e.theme.breakpoints.down("md")}),(function(e){return e.theme.breakpoints.up("md")}),(function(e){return e.theme.breakpoints.down("md")}),(function(e){return e.theme.breakpoints.up("md")}),(function(e){return e.theme.breakpoints.down("md")})),we=t(50496),Pe=t(43207),Se=t(38219),Re=t(70576),Te=t(50624),Ee=t(70177),De=t(77370),Ue=t(90617),Le=t(36558);function Ne(e){var n=e.defaultUrl,t=e.onCancel,o=e.onSuccess,r=e.onError,i=e.mode,d=e.handleText,p=(0,M.h6)().api,m=(0,De.T)().api,f=(0,u.useState)(!1),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,u.useState)(""),y=(0,c.Z)(g,2),b=y[0],Z=y[1],k=(0,E.PE)().t,P={dist:{}},S=(0,u.useState)(n),R=(0,c.Z)(S,2),T=R[0],D=R[1],U=(0,u.useState)(n?1:0),L=(0,c.Z)(U,2),N=L[0],B=L[1],q=(0,u.useState)(P),I=(0,c.Z)(q,2),A=I[0],K=I[1],z=(0,u.useState)(!1),V=(0,c.Z)(z,2),H=V[0],G=V[1],Y=(0,u.useState)({}),X=(0,c.Z)(Y,2),J=X[0],$=X[1],ee="component"===i,ne=!!ee||!n,te=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){var n,t,o,i,l,c;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:K(P),Z(null),x(!0),e.prev=3,n=decodeURIComponent(T.trim()),e.prev=5,new URL(n),e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(5),new Error("Invalid URL");case 12:return e.next=14,p.getBlockletMetaFromUrl({input:{url:n}});case 14:t=e.sent,o=t.meta,i=t.inStore,l=t.registryUrl,K(o),$({inStore:i,registryUrl:l,inputUrl:T.trim()}),e.next=28;break;case 22:e.prev=22,e.t1=e.catch(3),console.error(e.t1),c="Blocklet Install failed: ".concat((0,W.Z)(e.t1)),Z(c),r(e.t1);case 28:return e.prev=28,x(!1),e.finish(28);case 31:case"end":return e.stop()}}),e,null,[[3,22,28,31],[5,9]])})));return function(){return e.apply(this,arguments)}}();(0,u.useEffect)((function(){n&&te()}),[n]);var oe=[{name:k("common.name"),value:(0,O.getDisplayName)({meta:A},!0)},{name:k("common.version"),value:A.version},{name:k("common.did"),value:(0,se.jsx)(Le.Z,{did:A.did})},{name:k("common.author"),value:(0,W.rq)(A.author)},{name:k("blocklet.dist.downloadLink"),value:A.dist.tarball}],re=[{label:k("blocklet.fromUrl.step0"),body:(0,se.jsx)(j.Z,{component:"div",children:(0,se.jsx)(w.Z,{label:k("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,style:{marginBottom:32},margin:"dense",helperText:k("blocklet.fromUrl.description"),value:T,onChange:function(e){Z(null),D(e.target.value)},disabled:v,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),te(),B(1))}})}),cancel:k("common.cancel"),confirm:k("common.next"),onCancel:t,onConfirm:function(){te(),B(1)}},{label:k("blocklet.fromUrl.step1"),body:v?(0,se.jsx)("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:(0,se.jsx)(C.Z,{})}):A.did?(0,se.jsx)("div",{style:{paddingLeft:"10%"},children:oe.map((function(e){return e.name===k("common.did")?(0,se.jsx)(Ee.Z,{valueComponent:"div",nameWidth:120,name:e.name,nameFormatter:function(){return k("common.did")},children:e.value},e.name):(0,se.jsx)(Ee.Z,{valueComponent:"div",nameWidth:120,name:e.name,children:e.value},e.name)}))}):null,cancel:k(ne?"common.pre":"common.cancel"),confirm:(null===d||void 0===d?void 0:d.confirm)||k("blocklet.fromUrl.confirm"),onCancel:function(){ne?B((function(e){return e-1})):t()},onConfirm:function(){!function(){if(ee)return o((0,s.Z)({meta:A},J)),void t();x(!0),G(!0)}()}}],ie=re[N];return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(we.ZP,{title:(null===d||void 0===d?void 0:d.title)||k("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:function(){return ie.onCancel()},showCloseButton:0===N,disableEscapeKeyDown:!0,open:!0,actions:(0,se.jsxs)(se.Fragment,{children:[ie.cancel&&(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),Z(null),ie.onCancel()},color:"inherit",children:ie.cancel||k("common.cancel")}),(0,se.jsxs)(_.Z,{onClick:function(e){e.stopPropagation(),ie.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:v||!T||b,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[v&&0===N&&(0,se.jsx)(C.Z,{size:16}),ie.confirm]})]}),children:[ne&&(0,se.jsx)(Se.Z,{alternativeLabel:!0,activeStep:N,children:re.map((function(e){var n=e.label;return(0,se.jsx)(Re.Z,{children:(0,se.jsx)(Te.Z,{children:n})},n)}))}),(0,se.jsx)(Pe.Z,{component:"div",style:{marginTop:24},children:ie.body}),!!b&&(0,se.jsx)(F.Z,{type:"error",style:{width:"100%",marginTop:8},children:b})]}),A&&H&&(0,se.jsx)(Q.Z,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:m.get,checkTimeout:3e5,onSuccess:function(){x(!1),G(!1),o((0,s.Z)({meta:A},J)),t()},extraParams:{title:A.title,wt:(0,Ue.iK)(A),blockletMetaUrl:decodeURIComponent(T.trim())},messages:{title:k("setup.keyPair.title"),scan:k("setup.keyPair.scan"),confirm:k("setup.keyPair.confirm"),success:k("setup.keyPair.success")},onClose:function(){x(!1),G(!1)}})]})}Ne.propTypes={defaultUrl:p().string,onCancel:p().func.isRequired,onSuccess:p().func.isRequired,onError:p().func,mode:p().oneOf(["install","component"]),handleText:p().object},Ne.defaultProps={onError:function(){},defaultUrl:"",mode:"install",handleText:{}};var Be=t(2689),_e=t(97475),Fe=t(17708),qe=t(3715),Ie=(0,ne.Z)((function(e){return{addMenuItemRoot:{justifyContent:"center",color:e.palette.primary.main,lineHeight:"3.2"}}}));function Oe(e){var n=e.disabled,t=e.storeList,o=e.teamDid,r=e.onAdd,i=(0,M.h6)().api,s=(0,u.useState)(!1),d=(0,c.Z)(s,2),p=d[0],m=d[1],f=(0,u.useState)(!0),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,u.useState)(!1),y=(0,c.Z)(g,2),b=y[0],Z=y[1],k=(0,u.useState)(""),P=(0,c.Z)(k,2),S=P[0],R=P[1],T=(0,u.useState)(""),D=(0,c.Z)(T,2),U=D[0],L=D[1],N=(0,E.PE)().t,B=Ie(),q=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){var n,l,c,s;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m(!0),e.prev=1,n=(0,W.bQ)(S,t),l=n.isNew,c=n.decoded,l){e.next=5;break}throw new Error(N("store.blockletRegistry.haveSameRegistry"));case 5:return e.next=7,i.addBlockletStore({input:{teamDid:o,url:c}});case 7:r(c),Z(!1),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(1),s="".concat(N("store.blockletRegistry.addFailed")," ").concat((0,W.Z)(e.t0)),L(s);case 15:return e.prev=15,m(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[1,11,15,18]])})));return function(){return e.apply(this,arguments)}}();return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)(oe.ZP,{button:!0,disabled:n,className:B.addMenuItemRoot,onClick:function(){Z(!0)},children:[(0,se.jsx)(qe.Z,{font:!0}),(0,se.jsx)(j.Z,{variant:"inherit",children:N("store.blockletRegistry.addRegistry")})]}),(0,se.jsxs)(we.ZP,{title:N("store.blockletRegistry.addRegistry"),fullWidth:!0,maxWidth:"md",open:b,onClose:function(){return Z(!1)},PaperProps:{style:{minHeight:"auto"}},actions:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),Z(!1)},color:"inherit",children:N("common.cancel")}),(0,se.jsxs)(_.Z,{onClick:function(e){e.stopPropagation(),q()},color:"primary","data-cy":"install-blocklet-next-step",disabled:p||!S||v,variant:"contained",autoFocus:!0,children:[p&&(0,se.jsx)(C.Z,{size:16}),N("common.confirm")]})]}),children:[(0,se.jsx)("div",{style:{paddingTop:12,overflowY:"hidden"},children:(0,se.jsx)(Pe.Z,{component:"div",children:(0,se.jsx)(j.Z,{component:"div",children:(0,se.jsx)(w.Z,{label:N("store.blockletRegistry.registryUrl"),autoComplete:"off",variant:"outlined",name:"url",fullWidth:!0,value:S,onChange:function(e){L(null);var n=!1;e.target.value.trim()||(n=!0),e.target.value.trim()||L(N("store.blockletRegistry.registryUrlEmpty")),R(e.target.value),x(n)},disabled:p,onKeyPress:function(e){"Enter"===e.key&&(e.preventDefault(),e.target.value.trim()?q():L(N("store.blockletRegistry.registryUrlEmpty")))}})})})}),!!U&&(0,se.jsx)(F.Z,{type:"error",style:{width:"100%"},children:U})]})]})}Oe.propTypes={teamDid:p().string.isRequired,disabled:p().bool,storeList:p().array,onAdd:p().func},Oe.defaultProps={disabled:!1,storeList:[],onAdd:function(){}};var Ae=t(50714),Ke=t(11909),ze=t(94551),Me=t(94702),Ve=t(30291),We=t(25371);function He(e){var n=e.store,t=e.teamDid,o=e.onDelete,r=(0,M.h6)().api,i=(0,E.PE)().t,s=(0,u.useState)(!1),d=(0,c.Z)(s,2),p=d[0],m=d[1],f=(0,u.useState)(null),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,Me.Z)(),y=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,m(!0),e.next=4,r.deleteBlockletStore({input:{teamDid:t,url:n.url}});case 4:o&&"function"===typeof o&&o(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),z.Z.error("Remove Blocklet Store Error: ".concat((0,W.Z)(e.t0)));case 10:return e.prev=10,m(!1),x(null),e.finish(10);case 14:case"end":return e.stop()}}),e,null,[[0,7,10,14]])})));return function(){return e.apply(this,arguments)}}(),b={keyName:n.url,title:i("store.blockletRegistry.deleteRegistry"),description:i("store.blockletRegistry.deleteDesc",{name:"<b>".concat(n.url,"</b>"),color:g.palette.error.main}),confirmPlaceholder:i("store.blockletRegistry.confirmDesc",{name:n.url}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:y,onCancel:function(){m(!1),x(null)}};return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(ze.Z,{disabled:p,onClick:function(e){e.stopPropagation(),x(b)},size:"large",children:(0,se.jsx)(Ve.default,{})}),v&&(0,se.jsx)(We.Z,{keyName:v.keyName,title:v.title,description:v.description,confirmPlaceholder:v.confirmPlaceholder,confirm:v.confirm,cancel:v.cancel,params:v.params,onConfirm:v.onConfirm,onCancel:v.onCancel})]})}He.propTypes={teamDid:p().string.isRequired,store:p().object.isRequired,onDelete:p().func},He.defaultProps={onDelete:function(){}};var Ge,Ye=(0,ne.Z)((function(){return{buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}}));function Xe(e){var n=e.teamDid,t=e.store,o=e.onDelete,r=Ye();return(0,se.jsxs)("div",{className:r.menuName,children:[(0,se.jsx)(j.Z,{component:"span",variant:"subtitle1",style:{fontWeight:"400"},children:t.name}),(0,se.jsx)(j.Z,{className:"url",component:"span",variant:"inherit",children:"".concat(t.url)}),(0,se.jsxs)(Ae.Z,{children:[(0,se.jsx)(ze.Z,{onClick:function(e){e.stopPropagation(),window.open(t.url)},size:"large",children:(0,se.jsx)(Ke.Z,{})}),!t.protected&&(0,se.jsx)(He,{store:t,onDelete:o,teamDid:n})]})]})}function Qe(e){var n=e.onChange,t=e.loading,o=e.children,i=e.extra,a=e.stores,l=e.storageKey,d=(0,E.PE)().t,p=(0,M.h6)(),m=p.info,f=p.inService,v=(0,V.y0)().blocklet,x=(0,u.useState)(!1),g=(0,c.Z)(x,2),y=g[0],b=g[1],Z=(0,u.useRef)(null),k=(0,u.useState)(),C=(0,c.Z)(k,2),P=C[0],S=C[1],R=(0,Fe.Z)(l||"tmp"),T=(0,c.Z)(R,2),D=T[0],U=T[1],L=l?[D,U]:[P,S],N=(0,c.Z)(L,2),F=N[0],q=N[1],I=(0,W.dX)({fromBlocklet:f,blocklet:v,nodeInfo:m}),O=I.storeList,A=I.teamDid,K=h()([].concat((0,r.Z)(a.map((function(e){return(0,s.Z)((0,s.Z)({},e),{},{protected:!0})}))),(0,r.Z)(O)),"url"),z=F&&K.find((function(e){return F===e.url}))||K[0],H=m.mode===B.NODE_MODES.SERVERLESS;return(0,se.jsxs)(se.Fragment,{children:[(0,se.jsxs)($e,{children:[(0,se.jsx)(_.Z,{ref:Z,color:"secondary","data-cy":"add-component-select-store",endIcon:(0,se.jsx)(_e.Z,{color:"secondary"}),onClick:function(){b(!0)},style:{padding:"0 2px"},children:(0,se.jsx)(j.Z,{color:"secondary",children:z.name})}),(0,se.jsx)(j.Z,{color:"secondary",children:i})]}),(0,se.jsxs)(w.Z,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:d("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:z,autoFocus:!0,onChange:function(e){var t=e.target.value;q(t.url),n(t)},SelectProps:{open:y,MenuProps:{anchorEl:Z.current},renderValue:function(e){return null===e||void 0===e?void 0:e.name},onClose:function(){b(!1)}},style:{display:"none"},margin:"normal",children:[null===K||void 0===K?void 0:K.map((function(e){return(0,se.jsx)(Be.Z,{value:e,"data-cy":e.url,children:(0,se.jsx)(Xe,{teamDid:A,store:e,onDelete:function(){var n;F===e.url&&q(null===(n=K[0])||void 0===n?void 0:n.url)}})},e.url)})),!H&&(0,se.jsx)(Oe,{disabled:t,storeList:K,teamDid:A,onAdd:function(e){q(e)}})]}),o({currentRegistry:z})]})}Xe.propTypes={teamDid:p().string.isRequired,store:p().shape({name:p().string.isRequired,url:p().string.isRequired,protected:p().bool}).isRequired,onDelete:p().func},Xe.defaultProps={onDelete:function(){}},Qe.propTypes={onChange:p().func,loading:p().bool,children:p().any.isRequired,extra:p().node,storageKey:p().string,stores:p().arrayOf(p().shape({name:p().string.isRequired,url:p().string.isRequired}))},Qe.defaultProps={onChange:function(){},loading:!1,extra:"",stores:[],storageKey:""};var Je,$e=T.Z.div(Ge||(Ge=(0,o.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 16px;\n\n span {\n font-size: 16px;\n color: ",";\n // font-weight: bold;\n }\n"])),(function(e){return e.theme.palette.common.black})),en=t(19638),nn=t(37433),tn=t(51921),on=t(95612),rn=t(49956),an=["handleButtonClick","handleSearchSelect","storeUrl","handleBlockletRender","extraFilter","serverVersion","resourceType"],ln=function(e,n){return X()(n,"/blocklets/".concat(e.did))},cn=function(e){var n=e.blocklet,t=e.attribute,o=e.value;return n._formatted?n._formatted[t]:o},sn=function(e){return e.inStore&&!1===(0,O.isFreeBlocklet)(e)};function un(e){var n=e.blocklet,t=e.blocklets,o=e.handleButtonClick,r=e.endpoint,i=(0,E.PE)().t,s=X()(r,(0,W.lk)(n.did,n.logo||"")),d=(0,u.useState)(!1),p=(0,c.Z)(d,2),m=p[0],f=p[1],h=sn(n)?i("common.purchase"):i("blocklet.component.choose"),v=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(i){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.preventDefault(),i.stopPropagation(),e.prev=2,f(!0),e.next=6,o({meta:n,registryUrl:r,blocklets:t});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),z.Z.error(e.t0.message);case 11:return e.prev=11,f(!1),e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[2,8,11,14]])})));return function(n){return e.apply(this,arguments)}}();return(0,se.jsx)(en.Z,{href:ln(n,r),style:{color:"initial",textDecoration:"none"},onClick:function(e){return!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1)},target:"_blank",children:(0,se.jsx)(mn,{title:cn({blocklet:n,attribute:"title",value:n.title||n.name}),did:n.did,description:cn({blocklet:n,attribute:"description",value:n.description}),cover:n.logo?s:"",version:n.version,button:(0,se.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,se.jsx)(rn.Kk,{children:(0,se.jsx)(_.Z,{onClick:v,size:"small",disabled:m,variant:"outlined",color:"primary","data-cy":"install-blocklet",children:m?(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(C.Z,{size:16,style:{marginRight:3}}),h]}):h},n.did)})})})})}function dn(e){var n=e.handleButtonClick,t=e.handleSearchSelect,o=e.storeUrl,r=e.handleBlockletRender,a=e.extraFilter,l=e.serverVersion,d=e.resourceType,p=(0,i.Z)(e,an),m=(0,E.PE)().locale,f=(0,u.useState)(!1),h=(0,c.Z)(f,2),v=h[0],x=h[1],g=(0,u.useState)({}),y=(0,c.Z)(g,2),b=y[0],Z=y[1],k=o;return(0,u.useEffect)((function(){Z({resourceType:d})}),[k,d]),(0,u.useEffect)((function(){x(!0),Z({resourceType:d})}),[]),(0,se.jsx)(tn.ErrorBoundary,{FallbackComponent:nn.H,resetKeys:[k],children:(0,se.jsx)("div",(0,s.Z)((0,s.Z)({},p),{},{children:v&&(0,se.jsx)(on.Z,{blockletRender:function(e){var t=(0,s.Z)((0,s.Z)({},e),{},{handleButtonClick:n,endpoint:k});return r((0,s.Z)((0,s.Z)({},e),{},{defaultRender:(0,se.jsx)(un,(0,s.Z)({},t))}))},baseSearch:!0,endpoint:k,locale:m,onFilterChange:function(e){Z(e)},onSearchSelect:t,filters:b,extraFilter:a,serverVersion:l,fetchCategoryDelay:500})}))})}un.propTypes={blocklet:p().object.isRequired,blocklets:p().array,handleButtonClick:p().func,endpoint:p().string},un.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[]},dn.propTypes={storeUrl:p().string.isRequired,handleButtonClick:p().func,handleSearchSelect:p().func,handleBlockletRender:p().func,extraFilter:p().func,serverVersion:p().string,resourceType:p().string},dn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:""};var pn,mn=(0,T.Z)(rn.ZP)(Je||(Je=(0,o.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main})),fn=t(95803),hn=t.n(fn),vn=t(50576),xn=t(92522),gn=t.n(xn),yn=t(25599),bn=t(59467),Zn=t(28126),kn=t(74202),Cn=["onSelect","endpoint","gatewayUrl","loading","size","helperText"],jn=[{value:"https://www.didspaces.com/app",label:"Prod DID Spaces",avatar:"P"},{value:"https://storage.staging.abtnet.io/app",label:"Staging DID Spaces",avatar:"S"}],wn=(0,Zn.D)();function Pn(e){var n=e.onSelect,t=e.endpoint,o=e.gatewayUrl,a=e.loading,l=e.size,d=e.helperText,p=(0,i.Z)(e,Cn),m=(0,Fe.Z)("did-space-gateway-list",jn),f=(0,c.Z)(m,2),h=f[0],v=f[1],x=(0,u.useState)(o||jn[0].value),g=(0,c.Z)(x,2),y=g[0],b=g[1],Z=(0,E.PE)().t,k=(0,De.T)().api;return(0,u.useEffect)((function(){y&&!h.find((function(e){return e.value===y}))&&k.get(X()(y,"/__blocklet__.js?type=json")).then((function(e){v([].concat((0,r.Z)(h),[{value:y,label:e.data.appName}]))})).catch((function(e){console.error(e),z.Z.error("Can not add this gateway, please check the url and try again")}))}),[y]),(0,se.jsx)(Sn,(0,s.Z)((0,s.Z)({},p),{},{freeSolo:!0,selectOnFocus:!0,clearOnBlur:!0,handleHomeEndKeys:!0,value:y,options:h,onChange:function(e,n){if(n)if("string"===typeof n){var t=h.find((function(e){return e.label===n}));t&&b(t.value)}else n.inputValue?b(n.inputValue):n.value&&b(n.value)},getOptionLabel:function(e){return"string"===typeof e?e:e.inputValue?e.inputValue:e.label},renderOption:function(e,n){return(0,se.jsxs)(oe.ZP,(0,s.Z)((0,s.Z)({},e),{},{children:[(0,se.jsx)(yn.Z,{children:(0,se.jsx)(bn.Z,{children:n.avatar})}),(0,se.jsx)(re.Z,{primary:n.label,secondary:n.value})]}),n.value)},filterOptions:function(e,n){var t=wn(e,n);n.inputValue&&gn()(n.inputValue)&&(e.some((function(e){return n.inputValue===e.value}))||t.push({value:n.inputValue,label:"Add new gateway"}));return t},renderInput:function(e){return(0,se.jsx)(w.Z,(0,s.Z)((0,s.Z)({},e),{},{helperText:d,label:Z("storage.spaces.label"),size:l,InputProps:(0,s.Z)((0,s.Z)({},e.InputProps),{},{type:"search",endAdornment:(0,se.jsx)(_.Z,{variant:"contained",onClick:function(){return n(y)},size:"small",loading:a,disable:a,sx:{position:"absolute",right:0,display:"flex",justifyContent:"center",alignItems:"center",width:"100px",height:"100%"},children:Z(t?"storage.spaces.reconnect":"storage.spaces.connect.now")})})}))}}))}var Sn=(0,T.Z)(kn.Z)(pn||(pn=(0,o.Z)(["\n height: 40px;\n width: 100%;\n max-width: 720px;\n "," {\n width: 75%;\n }\n input.MuiInputBase-input {\n max-width: calc(100% - 80px);\n }\n"])),(function(e){return e.theme.breakpoints.down("md")}));Pn.propTypes={onSelect:p().func.isRequired,endpoint:p().string,loading:p().bool,size:p().string,helperText:p().string,gatewayUrl:p().string},Pn.defaultProps={endpoint:void 0,loading:!1,size:"small",helperText:"",gatewayUrl:""};var Rn=Pn,Tn=["onConnect"];var En=(0,u.forwardRef)((function(e,n){var t=e.onConnect,o=(0,i.Z)(e,Tn),r=(0,M.h6)(),d=r.api,p=r.info.did,m=(0,u.useContext)(E.RD),f=m.t,h=m.locale,v=(0,V.y0)(),x=v.blocklet,g=v.actions.refreshBlocklet,y=(0,u.useState)(""),b=(0,c.Z)(y,2),Z=b[0],k=b[1],C=(0,u.useMemo)((function(){var e,n,t,o;return{endpoint:(null===x||void 0===x||null===(e=x.environments)||void 0===e||null===(n=e.find((function(e){return e.key===D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT})))||void 0===n?void 0:n.value)||"",gatewayUrl:(null===x||void 0===x||null===(t=x.environments)||void 0===t||null===(o=t.find((function(e){return e.key===D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL})))||void 0===o?void 0:o.value)||""}}),[x]),w=(0,O.getAppName)(x),P=(0,O.getAppDescription)(x),S=function(e){var n,t,o,r=null===e||void 0===e||null===(n=e.site)||void 0===n||null===(t=n.domainAliases)||void 0===t||null===(o=t.sort((function(e,n){return e.accessibility.accessible&&n.accessibility.accessible?+e.isProtected-+n.isProtected:+n.accessibility.accessible-+e.accessibility.accessible})))||void 0===o?void 0:o.map((function(e){var n,t=null!==e&&void 0!==e&&null!==(n=e.domainStatus)&&void 0!==n&&n.isHttps?"https://":"http://",o=null===e||void 0===e?void 0:e.value;return"".concat(t).concat(o)})).filter(Boolean),i=null===r||void 0===r?void 0:r[0];return{appUrl:i,isReady:Boolean(i)}}(x),R=S.appUrl,T=S.isReady;function U(e,n){return L.apply(this,arguments)}function L(){return(L=(0,l.Z)((0,a.Z)().mark((function e(n,t){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.configBlocklet({input:{did:[n],configs:[{key:D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,value:Z},{key:D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,value:t}]}}).then((function(){z.Z.success(f("storage.spaces.connect.succeeded",h))})).catch((function(e){console.error(e),z.Z.error(e.message)}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var N=(0,u.useState)({open:!1}),B=(0,c.Z)(N,2),_=B[0],F=B[1],q=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n,o){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,U(x.meta.did,o(n.endpoint));case 2:setTimeout((function(){F((function(e){return(0,s.Z)((0,s.Z)({},e),{},{open:!1})})),null===t||void 0===t||t(),g()}),3e3);case 3:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}();return(0,u.useEffect)((function(){F((function(e){return(0,s.Z)((0,s.Z)({},e),{},{messages:{title:f("storage.spaces.authorize.title",{appName:w}),scan:f("storage.spaces.authorize.scan",{appName:w}),confirm:"",success:(0,se.jsx)(j.Z,{gutterBottom:!0,children:f("storage.spaces.authorize.success")})}})}))}),[w,h,f]),(0,u.useImperativeHandle)(n,(function(){return{getEndpoint:function(){return C.endpoint},getGatewayUrl:function(){return C.gatewayUrl}}})),(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(Rn,(0,s.Z)((0,s.Z)((0,s.Z)({},o),C),{},{onSelect:function(e){(0,vn.isEmpty)(e)?z.Z.error(f("storage.spaces.addressCannotEmpty",h)):(k(e),F((function(n){return(0,s.Z)((0,s.Z)({},n),{},{action:"one-click-authorization",checkTimeout:3e5,prefix:X()(e,"space/api/did"),baseUrl:new URL(e).origin,checkFn:hn().create({baseURL:X()(e,"space")}).get,extraParams:{appDid:x.appDid,appName:w,appDescription:P,scopes:"list:object read:object write:object",appUrl:R,referrer:window.location.href,nodeDid:p},onClose:function(){F((function(e){return(0,s.Z)((0,s.Z)({},e),{},{open:!1})}))},open:!0})})))},loading:!T})),(0,se.jsx)(Q.Z,{forceConnected:!1,saveConnect:!1,prefix:_.prefix,open:_.open,popup:!0,action:_.action,baseUrl:_.baseUrl,checkFn:_.checkFn,onSuccess:q,onClose:_.onClose,checkTimeout:_.checkTimeout,extraParams:_.extraParams,messages:_.messages,locale:h})]})}));En.propTypes={onConnect:p().func},En.defaultProps={onConnect:function(){}};var Dn,Un,Ln,Nn,Bn,_n,Fn,qn=En,In=["name","validation"],On=["default","key"],An=function(e){return e.inStore&&!1===(0,O.isFreeBlocklet)(e)},Kn=function(e){var n;return null===e||void 0===e||null===(n=e.capabilities)||void 0===n?void 0:n.didSpace},zn=function(e){var n,t;return(null===e||void 0===e||null===(n=e.configs)||void 0===n||null===(t=n.find((function(e){return e.key===D.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT})))||void 0===t?void 0:t.value)||null},Mn=function(e){return(e.environments||[]).some((function(e){return e.required}))},Vn=function(e,n){return null===e||void 0===e?void 0:e.some((function(e){return e.required&&!n[e.key]}))},Wn=function(e){var n=e.params,t=e.blocklet,o=e.t,r=n.title||n.name;return r?o(((null===t||void 0===t?void 0:t.children)||[]).find((function(e){return e.meta.bundleDid===n.bundleDid}))?"blocklet.component.upgradeNext":"blocklet.component.addNext",{name:r}):o("common.next")},Hn=(0,u.forwardRef)((function(e,n){var t=e.meta,o=e.isMobile,r=e.onStepChange,i=(0,L.s)(),a=i.steps,l=i.activeStep,c=i.setActiveStepByKey,d=i.setActiveStepByIndex,p=(0,E.PE)(),m=p.t,f=p.locale,h=a[l];return(0,u.useEffect)((function(){r(l)}),[r,l]),(0,u.useImperativeHandle)(n,(function(){return{setActiveStepByKey:c,setActiveStepByIndex:d}})),(0,se.jsx)(et,{component:"div",className:o?"mobileStyle":"",sx:{height:"100%"},children:(0,se.jsx)(U.Z,{locale:f,blockletMeta:(0,s.Z)({title:" "},t),pcWidth:"100%",pcHeight:"100%",logoUrl:t&&t.logo&&t.registryUrl?(0,W.aZ)({did:t.did,baseUrl:t.registryUrl,logoPath:t.logo}):null,stepTip:m("blocklet.component.add"),children:(0,se.jsx)(Jn,{children:null!==h&&void 0!==h&&h.body&&"function"===typeof h.body?h.body():h.body})})})}));Hn.propTypes={meta:p().any,onStepChange:p().func.isRequired,isMobile:p().bool.isRequired},Hn.defaultProps={meta:null};var Gn=function(e){window.parent.postMessage({event:"component.installed",componentDid:e},"*")};function Yn(e){var n,t,o,d,p,f,v,g=e.onClose,b=e.mode,j=e.stores,T=e.resourceType,U=e.storageKey,A=(0,E.PE)(),Y=A.t,X=A.locale,Q=(0,u.useState)(!1),J=(0,c.Z)(Q,2),$=J[0],ee=J[1],ne=(0,u.useState)(null),te=(0,c.Z)(ne,2),oe=te[0],re=te[1],ie=(0,u.useState)(""),ae=(0,c.Z)(ie,2),le=ae[0],ce=ae[1],ue=(0,u.useState)(""),de=(0,c.Z)(ue,2),pe=de[0],me=de[1],fe=(0,M.h6)(),he=fe.api,ve=fe.ws.useSubscription,ye=fe.inService,be=fe.info,Ze=(0,V.y0)(),ke=Ze.blocklet,je=Ze.actions.refreshBlocklet,we=(0,u.useState)(null),Pe=(0,c.Z)(we,2),Se=Pe[0],Re=Pe[1],Te=(0,u.useState)(!1),Ee=(0,c.Z)(Te,2),De=Ee[0],Ue=Ee[1],Le={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceCapability:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},Be=(0,u.useState)(Le),_e=(0,c.Z)(Be,2),Fe=_e[0],qe=_e[1],Ie=(0,u.useState)(0),Oe=(0,c.Z)(Ie,2),Ae=Oe[0],Ke=Oe[1],ze=(0,u.useRef)({}),Me=(0,u.useRef)({}),Ve=(0,u.useRef)({}),We=(0,R.Z)((function(e){return e.breakpoints.down("md")})),He=(0,m.useParams)(),Ge=ze.current.meta,Ye=(Me.current||{}).setActiveStepByIndex,Xe=be.mode===B.NODE_MODES.SERVERLESS,Je=function(e){return qe((function(n){return(0,s.Z)((0,s.Z)({},n),e)}))};(0,u.useEffect)((function(){if(Fe.pathPrefix){var e=rn((0,s.Z)((0,s.Z)({},Fe),{},{pathPrefix:Fe.pathPrefix,locale:X})).errMsg;ce(e)}}),[Fe.pathPrefix]),(0,u.useEffect)((function(){0===Ae&&qe(Le)}),[Ae]);var $e=function(){var e;return null!==ze&&void 0!==ze&&null!==(e=ze.current)&&void 0!==e&&e.meta?(0,O.getDisplayName)(ze.current):""},en=function(e){!function n(t){Je({installResultProps:{variant:"error",title:$e(),subTitle:e,footer:(0,se.jsx)(_.Z,{className:"bottom-button",disabled:t,"data-cy":"retry-install-component",onClick:function(){var e=(0,l.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.next=3,on(ze.current.installInput);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),children:(0,se.jsxs)(N.Z,{display:"flex",alignItems:"center",children:[t&&(0,se.jsx)(C.Z,{size:16,style:{marginRight:8}}),Y("common.retry")]})})}})}()},nn=function(e){return function(n){var t,o;((null===n||void 0===n||null===(t=n.meta)||void 0===t?void 0:t.did)||(null===n||void 0===n?void 0:n.meta))===(null===ke||void 0===ke||null===(o=ke.meta)||void 0===o?void 0:o.did)&&e(n)}};ve(D.BlockletEvents.statusChange,nn((function(e){if(e.status===D.BlockletStatus.upgrading)Je({installResultProps:{variant:"success",title:$e(),subTitle:Y("blocklet.component.installSuccessTip")}}),Gn(He.componentDid)})),[null===ke||void 0===ke||null===(n=ke.meta)||void 0===n?void 0:n.did]),ve(D.BlockletEvents.downloadFailed,nn((function(){en(Y("blocklet.component.installComponentError"))})),[null===ke||void 0===ke||null===(t=ke.meta)||void 0===t?void 0:t.did]),ve(D.BlockletEvents.installFailed,nn((function(){en(Y("blocklet.component.installComponentError"))})),[null===ke||void 0===ke||null===(o=ke.meta)||void 0===o?void 0:o.did]);var tn=function(){ee(!1),qe({}),ze.current={},g()},on=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n){var t,o,r,i,l,c,u,d,p,m,f,h,v,x,g,y,b,Z,k,C,j,w,P,S,R;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Fe.pathPrefix,i=Fe.bundleDid,l=Fe.title,c=Fe.componentName,u=void 0===c?"":c,d=Fe.componentDid,p=void 0===d?"":d,m=(null===(t=ze.current)||void 0===t?void 0:t.meta)||{},f=m.configs,h=void 0===f?[]:f,v=m.registryUrl,x=m.inStore,g=m.inputUrl,y=null===(o=ze.current)||void 0===o?void 0:o.downloadTokenList,b=x?(0,W.Rn)(v,i):g,ee(!0),Z=(0,s.Z)((0,s.Z)((0,s.Z)({rootDid:ke.meta.did,url:b,mountPoint:K()(r),title:l,name:u,did:p},Fe.hasEnvironmentsStep&&h.length>0?{configs:h.map((function(e){return(0,s.Z)((0,s.Z)({},e),{},{value:Fe.configsValue[e.key]||""})}))}:{}),y?{downloadTokenList:y}:{}),n),e.prev=6,e.next=9,he.installComponent({input:Z});case 9:if(!v){e.next=15;break}if(k=(0,W.dX)({fromBlocklet:ye,nodeInfo:be,blocklet:ke}),C=k.teamDid,j=k.storeList,w=(0,W.bQ)(v,j),P=w.isNew,S=w.decoded,!P){e.next=15;break}return e.next=15,he.addBlockletStore({input:{teamDid:C,url:S}});case 15:Je({installResultProps:{}}),je({showError:!1,attachRuntimeInfo:!1}),e.next=25;break;case 19:e.prev=19,e.t0=e.catch(6),R=(0,W.Z)(e.t0),z.Z.error(R),console.error("installComponent error: ",e.t0),en(R);case 25:return e.prev=25,ee(!1),ze.current.installInput=Z,e.finish(25);case 29:case"end":return e.stop()}}),e,null,[[6,19,25,29]])})));return function(n){return e.apply(this,arguments)}}(),rn=function(e){return{errMsg:(0,ge.Rw)({params:(0,s.Z)((0,s.Z)({},e),{},{did:e.bundleDid}),blocklets:[ke],blocklet:ke,locale:X})}},an=function(){var e=(0,l.Z)((0,a.Z)().mark((function e(n){var t,o;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=rn((0,s.Z)((0,s.Z)({},Fe),{},{locale:X})),o=t.errMsg,ce(o),Ae!==sn.length-2){e.next=5;break}return e.next=5,on(n);case 5:Ye((function(e){return e+1}));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),ln=function(){Ye((function(e){return e-1}))},cn=function(e){var n,t,o=e.chooseParams,a=void 0===o?ze.current:o,l=e.componentDid,c=e.isInit,u=void 0!==c&&c,d=a.meta,p=a.registryUrl,m=a.inStore,f=a.inputUrl,v=d.did,g=d.title,y=d.name,b=((null===(n=ke.settings)||void 0===n?void 0:n.children)||[]).filter((function(e){return"deleted"===e.status&&e.meta.bundleDid===v})),k=l||"",C=null===(t=d.environments)||void 0===t?void 0:t.map((function(e){var n=e.name,t=e.validation,o=(0,i.Z)(e,In),r={validation:Z()(t)?"":t};return(0,s.Z)((0,s.Z)({},o),{},{key:n},r)}));ze.current=(0,s.Z)((0,s.Z)({},a),{},{meta:(0,s.Z)((0,s.Z)({},d),{},{configs:C,registryUrl:p,inStore:m,inputUrl:f})});var j={};if(u){var w=[ke],P=C||[],S=h()(x()([].concat((0,r.Z)(P),[])),"key").filter((function(e){return!!e.key})).sort((function(e,n){return e.required&&!n.required?-1:n.required&&!e.required?1:0})),R=(0,O.getSharedConfigObj)(w[0],{configs:S}),T={},E=S.map((function(e){var n=e.default,t=e.key,o=(0,i.Z)(e,On);return T[t]=R[t]||n,(0,s.Z)((0,s.Z)({},o),{},{key:t,hidden:!!D.BLOCKLET_CONFIGURABLE_KEY[t]})}));j=(0,s.Z)((0,s.Z)({},j),{},{configsList:E,configsValue:T,hasMissRequiredConfigs:Vn(E,T)})}var U,L,N=ke.children.some((function(e){return"/"===e.mountPoint})),B=b.find((function(e){return e.meta.bundleDid===v}));B?j=(0,s.Z)((0,s.Z)({},j),{},{pathPrefix:B.mountPoint||"",title:g||"",componentName:B.meta.name,hasEnvironmentsStep:!1}):j=(0,s.Z)((0,s.Z)({},j),{},{pathPrefix:N?"/".concat(K()(g)||K()(y)):"/",title:g||"",componentName:"",hasEnvironmentsStep:(null===(U=ze.current.meta)||void 0===U||null===(L=U.environments)||void 0===L?void 0:L.length)>0});var _=An(ze.current.meta),F=Kn(ze.current.meta),q=zn(ke);Je((0,s.Z)((0,s.Z)({bundleDid:v,componentDid:k},j),{},{hasRequiredEnvironments:Mn(ze.current.meta),requirePurchase:_,didSpaceCapability:F,didSpaceEndpoint:q})),u&&_&&function(){var e=Fe.pathPrefix,n=Fe.bundleDid,t=Fe.title,o=Fe.componentName,r=void 0===o?"":o,i=Fe.componentDid,a=void 0===i?"":i,l=(ze.current||{}).meta,c=void 0===l?{}:l,s=c.registryUrl,u=c.inStore,d=c.inputUrl,p=u?(0,W.Rn)(s,n):d;Re({meta:c,installOpts:{type:"component",rootDid:ke.meta.did,mountPoint:e,url:p,title:t,name:r,did:a}})}()},sn=[{key:"selectComponent",name:Y("blocklet.component.selectComponent"),body:(0,se.jsxs)(Qn,{component:"div",children:[Fe.showFromUrlDialog&&(0,se.jsx)(Ne,{mode:"component",onCancel:function(){Je({showFromUrlDialog:!1})},onSuccess:function(e){var n=e.meta,t=e.inputUrl,o=e.inStore,r=e.registryUrl;cn({chooseParams:{meta:n,inputUrl:t,inStore:o,registryUrl:r},isInit:!0}),Je({showFromUrlDialog:!1}),an()},handleText:{title:Y("blocklet.component.addComponentTip.fromUrl"),confirm:Y("blocklet.component.choose")}}),(0,se.jsx)(Qe,{stores:j,extra:Xe?null:(0,se.jsxs)(_.Z,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:function(){Je({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[(0,se.jsx)(P.Z,{style:{fontSize:20,marginRight:4}})," ",Y("blocklet.component.addComponentTip.fromUrl")," "]}),loading:$,onChange:function(){qe({}),ze.current={}},storageKey:U,children:function(e){var n=e.currentRegistry;return(0,se.jsx)(dn,{serverVersion:null===be||void 0===be?void 0:be.version,style:We?{height:"calc(100vh - 56px - 80px - 32px - 40px )"}:{height:"calc(100% - 40px)"},storeUrl:n.url,resourceType:T,handleButtonClick:function(e){cn({chooseParams:(0,s.Z)((0,s.Z)({},e),{},{inStore:!0}),isInit:!0})},handleBlockletRender:function(e){var n=e.blocklet,t=e.defaultRender,o=(null===Fe||void 0===Fe?void 0:Fe.bundleDid)&&(null===Fe||void 0===Fe?void 0:Fe.bundleDid)===(null===n||void 0===n?void 0:n.did);return(0,se.jsxs)(tt,{children:[o&&(0,se.jsx)("div",{className:"check-container",children:(0,se.jsx)(S.default,{className:"check-icon"})}),(0,se.jsx)("div",{className:o?"choose-blocklet":"",style:{marginLeft:16},children:t})]})}})}})]}),cancel:"embed"===b?void 0:Y("common.cancel"),confirm:Wn({params:Fe,blocklet:ke,t:Y}),onCancel:tn,onConfirm:function(){an()}},{key:"agreement",name:Y("launchBlocklet.introduction"),body:(0,se.jsxs)(Qn,{component:"div",className:"agreement-wrapper",children:[(0,se.jsx)(k.Z,{title:Y("launchBlocklet.introduction"),subTitle:Y("blocklet.component.addComponentTip.introduction")}),(0,se.jsx)(Ce,{meta:Ge,onClickNext:an,handleDescEle:(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)("p",{children:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:Y("blocklet.component.addComponentTip.".concat(Fe.requirePurchase?"isPurchase":"isFree"),{name:$e()})}})}),(0,se.jsx)("p",{children:Y("blocklet.component.addComponentTip.belowInformation")})]})})]}),cancel:Y("common.pre"),confirm:Y("launchBlocklet.next"),onCancel:ln,onConfirm:function(){Ue(!1),an()}},Ge&&Fe.requirePurchase&&{key:"purchase",name:(0,se.jsxs)(se.Fragment,{children:[Y("common.verifyNFT"),(0,se.jsx)(G.Z,{})]}),body:(0,se.jsxs)(Qn,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(2===(null===(d=Ve.current)||void 0===d||null===(p=d.getCurrentStep)||void 0===p?void 0:p.call(d))||De)&&(0,se.jsx)(nt,{title:Y("common.verifyNFT"),subTitle:Y("blocklet.component.addComponentTip.verifyNFT")}),y()(Fe.purchaseResultProps)?Se&&(0,se.jsx)(xe,{ref:Ve,meta:Se.meta,mode:Fe.componentDid?"verify":"both",onCancel:function(e){Ue(!1),Je({purchaseResultProps:{variant:"error",title:$e(),subTitle:e,style:{paddingTop:120},footer:(0,se.jsx)(_.Z,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:function(){Je({purchaseResultProps:{}})},children:Y("common.retry")})}})},installOpts:Se.installOpts,handlePaySuccess:function(e){var n=e.downloadTokenList;ze.current.downloadTokenList=n,Ue(!1),an()}}):(0,se.jsx)("div",{className:"flex-align-center flex-justify-center",children:(0,se.jsx)(I.Z,(0,s.Z)({},Fe.purchaseResultProps))})]}),disabled:2===(null===(f=Ve.current)||void 0===f||null===(v=f.getCurrentStep)||void 0===v?void 0:v.call(f))||De,cancel:Y("common.pre"),confirm:Y("common.next"),onConfirm:function(){"function"===typeof Ve.current.onNext&&(Ve.current.onNext(),Ue(!0))},onCancel:function(){ln()}},(0,O.hasStartEngine)(Ge)&&{key:"config",name:Y("common.config"),error:le,body:(0,se.jsxs)(Qn,{component:"div",children:[(0,se.jsx)(nt,{title:Y("common.config"),subTitle:Y("blocklet.component.addComponentTip.config")}),(0,se.jsx)(w.Z,{label:Y("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:pe||Y("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:Fe.pathPrefix,onChange:function(e){var n=e.target.value;Je({pathPrefix:n}),me(Y("common.slugifyHint",{value:(0,W.LN)(n)}))}}),!!le&&(0,se.jsx)(F.Z,{type:"error",style:{width:"100%",marginTop:8},children:le})]}),cancel:Y("common.pre"),confirm:Y("common.next"),onCancel:ln,onConfirm:function(){an()}},Ge&&(null===Fe||void 0===Fe?void 0:Fe.hasEnvironmentsStep)&&{key:"environment",name:(0,se.jsxs)(se.Fragment,{children:[Y("common.environment")," ",Fe.hasRequiredEnvironments&&(0,se.jsx)(G.Z,{})]}),disabled:!!oe||(null===Fe||void 0===Fe?void 0:Fe.hasMissRequiredConfigs),body:function(){return(0,se.jsxs)(Qn,{component:"div",children:[(0,se.jsx)(nt,{title:Y("common.environment"),subTitle:Y("blocklet.component.addComponentTip.environment")}),(0,se.jsx)(H.Z,{style:{marginTop:-12,width:"100%"},schema:Fe.configsList,defaultValue:Fe.configsValue,onChange:function(e,n){var t=n.action,o=n.currentItem,r=n.allValues;"confirm"===t&&Je({hasMissRequiredConfigs:Vn(Fe.configsList,r),configsValue:r}),"edit"===t?re(o):["cancel","confirm"].includes(t)&&re(null)}})]})},cancel:Y("common.pre"),confirm:Y("common.next"),onCancel:ln,onConfirm:an},Ge&&(null===Fe||void 0===Fe?void 0:Fe.didSpaceCapability)&&{key:"didSpace",name:(0,se.jsxs)(se.Fragment,{children:[Y("blocklet.component.didSpaceConfig")," ","required"===Fe.didSpaceCapability&&(0,se.jsx)(G.Z,{})]}),disabled:"required"===Fe.didSpaceCapability&&!Fe.didSpaceEndpoint,body:function(){return(0,se.jsxs)(Qn,{component:"div",children:[(0,se.jsx)(nt,{title:Y("blocklet.component.didSpaceConfig"),subTitle:Y("blocklet.component.didSpaceConfigTip")}),(0,se.jsx)(N.Z,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:(0,se.jsx)(qn,{sx:{"& .MuiFormHelperText-root":{wordBreak:"break-all"}},helperText:Fe.didSpaceEndpoint&&Y("blocklet.component.didSpaceConnected",{endpoint:Fe.didSpaceEndpoint}),onConnect:function(){an()}})})]})},cancel:Y("common.pre"),confirm:Y("common.next"),onCancel:ln,onConfirm:an},{key:"install",name:Y("common.install"),disabled:!1,loading:!1,body:(0,se.jsx)(Qn,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:y()(Fe.installResultProps)?(0,se.jsx)(q.Z,{message:(0,se.jsx)(ot,{children:Y("blocklet.component.installingCanCloseWindowTip")}),increaseSpeed:.3,messageLoop:!1}):(0,se.jsx)("div",{style:{marginTop:120},children:(0,se.jsx)(I.Z,(0,s.Z)({},Fe.installResultProps))})}),confirm:Y("common.complete"),onConfirm:function(){Gn(He.componentDid),tn(),setTimeout((function(){var e=document.getElementsByClassName("dashboard-main")[0];e&&(e.scrollTop=e.scrollHeight)}),200)}}].filter((function(e){return e})),un=sn[Ae]||{};return ke?(0,se.jsxs)(Xn,{sx:We?{width:"100%",height:window.innerHeight}:{width:"100%",height:"embed"===b?"100vh":"72vh"},children:[(0,se.jsx)(L.W,{steps:sn,mode:"memory",children:(0,se.jsx)(Hn,{ref:Me,meta:Ge,isMobile:We,onStepChange:function(e){Ke(e)}})}),(0,se.jsxs)(N.Z,{className:"action-bar",children:[un.cancel&&(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),un.onCancel()},disabled:Ae===sn.length-2&&$,color:"inherit",children:un.cancel||Y("common.cancel")}),un.confirm&&(0,se.jsx)(_.Z,{onClick:function(e){e.stopPropagation(),un.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:$||("boolean"===typeof un.disabled?un.disabled:!(!$&&!un.error&&Fe.bundleDid)||Ae>1&&!Fe.pathPrefix),variant:"contained",autoFocus:!0,title:un.confirm,style:{marginLeft:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:(0,se.jsxs)(N.Z,{display:"flex",alignItems:"center",children:[("boolean"===typeof un.loading?un.loading:$)&&(0,se.jsx)(C.Z,{style:{marginRight:8},size:16}),un.confirm]})})]})]}):null}Yn.propTypes={onClose:p().func,mode:p().oneOf(["normal","embed"]),stores:p().arrayOf(p().string),resourceType:p().string,storageKey:p().string},Yn.defaultProps={onClose:function(){},mode:"normal",stores:[],resourceType:"",storageKey:""};var Xn=(0,T.Z)(N.Z)(Dn||(Dn=(0,o.Z)(["\n .action-bar {\n display: flex;\n justify-content: flex-end;\n position: sticky;\n bottom: 0;\n padding-top: 16px;\n z-index: 100;\n width: 100%;\n background: #fff;\n border-top: 1px solid #eee;\n }\n"]))),Qn=(0,T.Z)(j.Z)(Un||(Un=(0,o.Z)(["\n width: 100%;\n height: 100%;\n"]))),Jn=T.Z.div(Ln||(Ln=(0,o.Z)(["\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n\n .bottom-button {\n min-width: 200px;\n }\n\n // blocklet-select-side\n aside {\n width: 140px;\n }\n"]))),$n=function(e){return e.isMobile?"\n height: calc(100vh - 56px - 64px - 48px);\n ":""},et=(0,T.Z)(N.Z)(Nn||(Nn=(0,o.Z)(["\n ","\n\n & .flex-justify-center {\n display: flex;\n justify-content: center;\n }\n\n & .flex-align-center {\n display: flex;\n height: 100%;\n align-items: center;\n ","\n }\n\n & .agreement-wrapper {\n ","\n max-height: 60vh;\n .eula-trigger {\n padding-right: 0;\n }\n .next-button {\n display: none;\n }\n }\n\n & .connect {\n background: white;\n }\n"])),(function(e){return"mobileStyle"===e.className?"\n & > div{\n height: 100%;\n }\n .root-header {\n .app-name-content {\n display: none;\n }\n }\n\n\n\n // content-panel\n .root-header + div{\n padding-top: 0;\n position: relative;\n & > div {\n padding-top: 0;\n }\n }\n\n header + div {\n padding-top: 0;\n }\n\n header {\n .header-title {\n margin-left: 0;\n }\n\n .header-title-name {\n max-width: 100% !important;\n }\n }\n ":"\n position: relative;\n .root-header {\n z-index: auto !important;\n position: fixed !important;\n }\n & > div {\n height: 100%;\n width: 100%;\n max-width: 100%;\n & > div {\n max-height: unset !important;\n max-width: 100%;\n & > div {\n // left-panel\n &:first-child {\n padding: 0;\n width: 25%;\n min-width: 240px;\n & > div:first-child {\n display: none;\n }\n // step\n & > div:last-child {\n // margin-top: 32px;\n margin-top: 0;\n }\n }\n // right-panel\n &:last-child {\n padding-top: 0;\n padding-right: 0px;\n overflow-y: auto;\n .app-content {\n padding: 0 0 24px 0;\n }\n .button-container {\n padding-right: 0;\n }\n }\n }\n }\n }\n\n "}),(function(e){return $n(e)}),(function(e){return $n(e)})),nt=(0,T.Z)(k.Z)(Bn||(Bn=(0,o.Z)(["\n margin-bottom: 24px;\n"]))),tt=T.Z.div(_n||(_n=(0,o.Z)(["\n position: relative;\n\n .choose-blocklet {\n background-color: rgb(236, 251, 253);\n border-color: rgb(236, 251, 253);\n border-radius: 8px;\n }\n\n .check-container {\n position: absolute;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: flex-end;\n align-items: flex-end;\n width: 30px;\n height: 30px;\n border-radius: 0 0 8px 0;\n color: ",";\n overflow: hidden;\n transition: all ease 0.3s;\n &:after {\n position: absolute;\n z-index: 0;\n display: block;\n width: 0;\n height: 0;\n border-top: transparent solid 15px;\n border-left: transparent solid 15px;\n border-bottom: "," solid 15px;\n border-right: "," solid 15px;\n transition: all ease 0.1s;\n content: '';\n }\n\n .check-icon {\n position: relative;\n z-index: 2;\n margin: 0 1px 1px 0;\n font-size: 16px;\n transition: all ease 0.2s;\n }\n }\n"])),(function(e){return e.theme.palette.common.white}),(function(e){return e.theme.palette.primary.main}),(function(e){return e.theme.palette.primary.main})),ot=T.Z.div(Fn||(Fn=(0,o.Z)(["\n color: ",";\n .msg-before {\n display: inline-block;\n color: #aaa;\n font-size: 14px;\n margin-right: 6px;\n }\n"])),(function(e){return e.theme.palette.primary.main}))},52654:function(e,n,t){"use strict";t.d(n,{Rw:function(){return u},fX:function(){return s},sf:function(){return d}});var o=t(20244),r=t(60966),i=t.n(r),a=t(59505),l=t(22351),c=function(e,n){if(e.type===o.ROUTING_RULE_TYPES.REDIRECT){if(!e.url)return new Error("".concat(n("router.validation.redirectUrlRequired")));if(!e.redirectCode)return new Error("redirect ".concat(n("router.validation.redirectCodeRequired")))}else if(e.type===o.ROUTING_RULE_TYPES.BLOCKLET&&!e.did)return new Error(n("router.validation.didRequired"));return null},s=function(e,n){var t=c(e,n);return t||(e.pathPrefix.length?e.pathPrefix.length>150?new Error(n("router.validation.pathPrefixTooLong",{length:150})):null:new Error(n("router.validation.pathPrefixCannotBeEmpty")))},u=function(e){var n=e.params,t=e.blocklets,o=e.blocklet,r=e.locale,c=void 0===r?"en":r;if(o){var s=(o.children||[]).find((function(e){return(0,l.default)(e.meta)&&i()(e.mountPoint,n.pathPrefix)}));if("gateway"!==o.meta.group&&"/"===n.pathPrefix&&(s="/"),s)return{zh:"\u6302\u8f7d\u70b9 ".concat(n.pathPrefix," \u5df2\u5b58\u5728\uff0c\u8bf7\u4f7f\u7528\u5176\u4ed6\u6302\u8f7d\u70b9"),en:"The mount point ".concat(n.pathPrefix," already exist, please use another mount point")}[c]}var u=t.find((function(e){return e.meta.did===n.did}));if(!u)return"";var d=u.meta.interfaces.find((function(e){return"web"===e.type}));return d&&d.prefix!==a.BLOCKLET_DYNAMIC_PATH_PREFIX&&n.pathPrefix!==d.prefix?{zh:"\u8be5 blocklet \u53ea\u80fd\u6302\u8f7d\u5728 ".concat(d.prefix),en:"This blocklet can only be mounted on ".concat(d.prefix)}[c]:""},d=function(e){if(!e||"string"!==typeof e)return e;var n=e.trim();try{return(n=n.toLowerCase()).startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n}catch(t){return console.error("format domain failed",t),n}}},73820:function(e,n,t){"use strict";t.d(n,{Z:function(){return p}});var o=t(33028),r=t(59740),i=t(30969),a=t(24974),l=t.n(a),c=t(99631),s=t(26022),u=t(37574),d=["children"];function p(e){var n=e.children,t=(0,r.Z)(e,d),a=(0,i.useContext)(s.RD).t;return(0,u.jsx)(c.Z,(0,o.Z)((0,o.Z)({tip:a("common.copyTip"),copiedTip:a("common.copiedTip")},t),{},{children:n}))}p.propTypes={children:l().any.isRequired}},25371:function(e,n,t){"use strict";t.d(n,{Z:function(){return m}});var o=t(33028),r=t(24974),i=t.n(r),a=t(33359),l=t(87006),c=t(18877),s=t(26022),u=t(73820),d=t(8479),p=t(37574);function m(e){var n=e.title,t=e.description,r=e.confirmPlaceholder,i=e.cancel,m=e.confirm,f=e.params,h=e.onCancel,v=e.onConfirm,x=e.keyName,g=(0,s.PE)().t,y={title:function(){return(0,p.jsxs)("div",{children:[n," (".concat(x,")")]})},description:function(e,n){return(0,p.jsxs)("div",{children:[(0,p.jsx)(c.Z,{severity:"warning",style:{width:"100%"},children:g("common.notice")}),(0,p.jsx)("div",{style:{marginTop:24,marginBottom:24},dangerouslySetInnerHTML:{__html:t}}),(0,p.jsxs)("div",{style:{marginBottom:24},children:[g("common.click"),"\uff1a",(0,p.jsx)(u.Z,{"data-cy":"click-copy",children:x})]}),(0,p.jsx)(a.Z,{component:"div",children:(0,p.jsx)(l.Z,{label:r,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:e.inputVal,onChange:function(t){var r;r=(0,o.Z)((0,o.Z)({},e),{},{inputVal:t.target.value,__disableConfirm:x!==t.target.value}),n((0,o.Z)((0,o.Z)({},r),{},{__disableConfirm:r.__disableConfirm}))}})})]})},confirm:m,cancel:i,onConfirm:v,onCancel:h,params:(0,o.Z)({inputVal:"",__disableConfirm:!0},f)};return(0,p.jsx)(d.Z,{title:y.title,description:y.description,confirm:y.confirm,cancel:y.cancel,params:y.params,onConfirm:y.onConfirm,onCancel:y.onCancel})}m.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},m.defaultProps={onCancel:function(){},cancel:"",confirm:"Confirm",params:{}}},36558:function(e,n,t){"use strict";var o=t(33028),r=t(59740),i=t(24974),a=t.n(i),l=t(86822),c=t(19638),s=t(23586),u=t(37574),d=["did","href","external","avatarProps"];function p(e){var n=e.did,t=e.href,i=e.external,a=(e.avatarProps,(0,r.Z)(e,d)),p=(0,u.jsx)(s.Z,(0,o.Z)({did:n},a));return t?i?(0,u.jsx)(c.Z,{target:"_blank",href:t,underline:"hover",children:p}):(0,u.jsx)(l.rU,{to:t,children:p}):p}p.propTypes={did:a().string.isRequired,to:a().string,href:a().string,avatarProps:a().object,external:a().bool},p.defaultProps={to:"",href:"",avatarProps:{},external:!1},n.Z=p}}]);
2
- //# sourceMappingURL=8181.bc510ea3.chunk.js.map