@abtnode/webapp 1.16.16-beta-e038cde7 → 1.16.16-beta-d6c5ed65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/build/asset-manifest.json +25 -25
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/{2334.2277b9a2.chunk.js → 2334.80922946.chunk.js} +1 -1
- package/build/static/js/{3389.bbd62a76.chunk.js → 3389.e8ffb928.chunk.js} +1 -1
- package/build/static/js/{373.1bcf03f8.chunk.js → 373.ebfccf8c.chunk.js} +1 -1
- package/build/static/js/4718.5dedb2bb.chunk.js +2 -0
- package/build/static/js/4775.ae60d291.chunk.js +1 -0
- package/build/static/js/{4906.c2c01c10.chunk.js → 4906.0feba7a6.chunk.js} +1 -1
- package/build/static/js/{5526.d759de88.chunk.js → 5526.ca427968.chunk.js} +2 -2
- package/build/static/js/5555.46ed37f5.chunk.js +1 -0
- package/build/static/js/{5808.c81d46a7.chunk.js → 5808.76c78a42.chunk.js} +1 -1
- package/build/static/js/{5904.afb2521a.chunk.js → 5904.41f0cec6.chunk.js} +1 -1
- package/build/static/js/{6412.e559c8f4.chunk.js → 6412.ae4af2c3.chunk.js} +1 -1
- package/build/static/js/{6511.20b2bda0.chunk.js → 6511.d2aa1c44.chunk.js} +1 -1
- package/build/static/js/6651.b79345ec.chunk.js +2 -0
- package/build/static/js/{6950.39b50c6e.chunk.js → 6950.d0f37362.chunk.js} +1 -1
- package/build/static/js/{6960.ed78ea9f.chunk.js → 6960.12044cf7.chunk.js} +1 -1
- package/build/static/js/7020.5aaf930e.chunk.js +1 -0
- package/build/static/js/7126.1acd7749.chunk.js +1 -0
- package/build/static/js/{7327.523610c0.chunk.js → 7327.2495f350.chunk.js} +1 -1
- package/build/static/js/7718.68cb259e.chunk.js +1 -0
- package/build/static/js/{7913.df3492dc.chunk.js → 7913.510dab4d.chunk.js} +1 -1
- package/build/static/js/{8973.b052330c.chunk.js → 8973.395a342c.chunk.js} +1 -1
- package/build/static/js/{8986.09896e72.chunk.js → 8986.0d4999c0.chunk.js} +1 -1
- package/build/static/js/{9249.c3058bf3.chunk.js → 9249.4df85d2d.chunk.js} +1 -1
- package/build/static/js/main.035c3bc5.js +2 -0
- package/build/static/js/{main.168167e0.js.LICENSE.txt → main.035c3bc5.js.LICENSE.txt} +1 -1
- package/package.json +1 -1
- package/build/static/js/4718.cb2b5d99.chunk.js +0 -2
- package/build/static/js/4775.dde53f2e.chunk.js +0 -1
- package/build/static/js/5015.4b2a6f82.chunk.js +0 -1
- package/build/static/js/7020.995924d8.chunk.js +0 -1
- package/build/static/js/7126.6c873294.chunk.js +0 -1
- package/build/static/js/7718.e4a5899b.chunk.js +0 -1
- package/build/static/js/9272.1db6e724.chunk.js +0 -2
- package/build/static/js/main.168167e0.js +0 -2
- /package/build/static/js/{4718.cb2b5d99.chunk.js.LICENSE.txt → 4718.5dedb2bb.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{5526.d759de88.chunk.js.LICENSE.txt → 5526.ca427968.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{9272.1db6e724.chunk.js.LICENSE.txt → 6651.b79345ec.chunk.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4775],{19371:function(n,e,t){var i=t(38636).default,o=t(73408).default,r=t(814).default,a=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(e,"__esModule",{value:!0}),e.splitNavigationBySection=e.flattenNavigation=e.checkLink=e.joinLink=e.cleanOrphanNavigation=e.filterNavigation=e.nestNavigationList=e.isMatchSection=e.deepWalk=e.parseNavigation=void 0;var l=a(t(10905)),c=a(t(50482)),s=a(t(8708)),u=a(t(3785)),d=a(t(24914)),f=a(t(25842)),v=a(t(6352)),m=a(t(56977)),p=a(t(6018)),h=t(65873),g="header",x="/",k="/",b="/",j=function(n){return!(!(0,p.default)(n)&&!function(n){return/^\/(?:[^/]+\/)*$/.test(n)||/^\/(?:[^/]+\/)*[^/]+$/.test(n)}(n))};function Z(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.key,o=void 0===i?"children":i,r=t.order,a=void 0===r?"first":r;!function n(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.index,l=void 0===r?0:r,c=i.parent,s=void 0===c?null:c,u=i.level,d=void 0===u?0:u;Array.isArray(t)?t.forEach((function(e,t){n(e,{index:t,parent:s,level:d+1})})):t&&("first"===a&&e(t,s,{index:l,level:d}),n(t[o],{parent:t,level:d}),"last"===a&&e(t,s,{index:l,level:d}))}(n)}function y(n,e){return!(e!==g||!(0,u.default)(n))||(Array.isArray(n)?n.includes(e):n===e)}function N(n){try{return JSON.parse(n)}catch(e){return n}}function S(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,p.default)(e||""))return e;var t=m.default.join(n,e||k);return t.length>1&&t.endsWith("/")?t.slice(0,t.length-1):t}function L(n,e){var t=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).strict,i=n,r=e;return void 0===t||t||(i=i||"/",r=r||"/"),(0,h.isObject)(i)&&(0,h.isString)(r)&&j(r)?Object.keys(i).reduce((function(n,e){return n[e]=S(i[e],r),n}),{}):(0,h.isString)(i)&&j(i)&&(0,h.isObject)(r)?Object.keys(r).reduce((function(n,e){return n[e]=S(i,r[e]),n}),{}):(0,h.isString)(i)&&(0,h.isString)(r)?j(i)||j(r)?S(i,r):r:(0,h.isObject)(i)&&(0,h.isObject)(r)?o(new Set([].concat(o(Object.keys(i)),o(Object.keys(r))))).reduce((function(n,e){return n[e]=S(i[e],r[e]),n}),{}):r}function w(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.depth,i=void 0===t?1:t,r=e.transform,a=void 0===r?function(n){return n}:r,l=(0,f.default)(n),c=[];return Z(l,(function(n,e,t){var r=t.level;if(r>=i){var l=n.items,s=void 0===l?[]:l;if(s&&Array.isArray(s)&&s.length>0){delete n.items;var u=s.map((function(e){return a(e,n)}));if(e){var f;(f=e.items).push.apply(f,o(u))}else{var v=a((0,d.default)(n,["items"]),e);c.push.apply(c,[v].concat(o(u)))}}else if(1===r){var m=a((0,d.default)(n,["items"]),e);c.push(m)}}else 1===r&&c.push(n)}),{key:"items",order:"last"}),c}function P(n){var e,t=(0,f.default)(n),a=[],l=i(t);try{var c=function(){var n=e.value,t=(0,f.default)((0,d.default)(n,["items"])),l=[];function c(n,e){var i=function(n,e){return e&&Array.isArray(n.items)?n.items.filter((function(t){return(0,u.default)(t.section)?y(n.section,e):!!y(t.section,e)})).map((function(n){return r(r({},n),{},{section:e})})):[]}(n,e);l.push(r(r({},t),{},{section:e,items:i}))}if(Array.isArray(n.section)){var s,v=i(n.section);try{for(v.s();!(s=v.n()).done;){c(n,s.value)}}catch(k){v.e(k)}finally{v.f()}}else if(n.section){c(n,n.section)}else if(n.items&&n.items.length>0){var m,p=n.items.reduce((function(n,e){var t=(e||{}).section,i=void 0===t?[g]:t;return n.push.apply(n,o(i)),n}),[]),h=o(new Set(p)),x=i(h);try{for(x.s();!(m=x.n()).done;){c(n,m.value)}}catch(k){x.e(k)}finally{x.f()}}else l.push(r(r({},n),{},{section:g}));a.push.apply(a,l)};for(l.s();!(e=l.n()).done;)c()}catch(s){l.e(s)}finally{l.f()}return a}function C(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=(0,f.default)(n);return e.reduceRight((function(n,t,i){if(t.parent){var r=e.find((function(n){return t.section&&n.section?n.section===t.section&&n.id===t.parent:n.id===t.parent}));r&&(r.items||(r.items=[]),r.items=[t].concat(o(r.items))),e.splice(i,1)}return null}),null),e}e.checkLink=j,e.deepWalk=Z,e.isMatchSection=y,e.joinLink=function(n,e){var t=(0,f.default)(n);return Z(t,(function(n,t){var i=n.component||n.child;if(i){var o=e.find((function(n){return n.name===i}));o&&(n.link=L(o.link,n.link,{strict:!1}))}else t&&(n.link=L(t.link,n.link))}),{key:"items"}),t},e.flattenNavigation=w,e.splitNavigationBySection=P,e.nestNavigationList=C,e.filterNavigation=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=C(n);return Z(t,(function(n){if(null!==n&&void 0!==n&&n.component&&(e.some((function(e){return e.name===n.component}))||(n.visible=!1)),n.items&&n.items.length)for(var t=n.items.length-1;t>=0;t--)!1===n.items[t].visible&&n.items.splice(t,1)}),{key:"items"}),t.filter((function(n){var e;return!1!==n.visible&&!(n.items&&Array.isArray(n.items)&&n.items.length>0&&null!==(e=n.items)&&void 0!==e&&e.every((function(n){return!1===n.visible})))}))},e.cleanOrphanNavigation=function(n){return n.map((function(n){return n.items&&Array.isArray(n.items)&&1===n.items.length&&["header","footer","",void 0,null].includes(n.section)?n.items[0]:n}))},e.parseNavigation=function(){var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).beforeProcess,a=void 0===t?function(n){return n}:t,u=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],t=function t(a){var l,c,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=[],d=a.children,m=void 0===d?[]:d,p=a.meta,h=void 0===p?{}:p,b=(0,f.default)((null===h||void 0===h?void 0:h.navigation)||[]);!1!==(null===(l=a.meta)||void 0===l||null===(c=l.capabilities)||void 0===c?void 0:c.navigation)&&u.push.apply(u,o(b));var j,Z=s.name||"",y=s.mountPoint||x,N=a===n?"":h.name||"",S=a===n?"":a.mountPoint||x,L=i(m);try{var w=function(){var n,i,a,l,c=j.value,s=c.meta.name,d=c.mountPoint,f=[Z,N,s].filter(Boolean).join("."),m=c.meta.navigation||[],p=(0,v.default)(y,S,d);!1!==(null===(n=c.meta)||void 0===n||null===(i=n.capabilities)||void 0===i?void 0:i.navigation)&&e.push({did:c.meta.did,name:f,link:p,title:c.meta.title||"",navigation:m.map((function(n){return r({section:g},n)}))});var h=b.find((function(n){return!!n.component&&n.component===s}));if(h){if(!h.link)if(c.meta.navigation&&c.meta.navigation.length>0){var x,L,w=t(c,{mountPoint:S,name:N});w.length>0&&(h.items=null!==(x=h.items)&&void 0!==x?x:[],(L=h.items).push.apply(L,o(w)))}else h.link=k}else if(!1!==(null===(a=c.meta)||void 0===a||null===(l=a.capabilities)||void 0===l?void 0:l.navigation)){var P=t(c,{mountPoint:S,name:N}),C={title:c.meta.title,component:s,id:c.meta.did};P.length>0?(C.items=P,C.link=void 0):C.link=k,u.push(C)}};for(L.s();!(j=L.n()).done;)w()}catch(P){L.e(P)}finally{L.f()}return u}(n);return{navigationList:t,components:e}}(e),d=u.navigationList,m=u.components,p=(null===e||void 0===e||null===(n=e.settings)||void 0===n?void 0:n.navigations)||[],h=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=w((0,f.default)(n),{depth:e,transform:function(n,e){var t;return e&&(n._parent||(n._parent=e.id,e.component||(n.link=L(e.link,n.link))),n.section=n.section||e.section||[g],n.visible=null!==(t=n.visible)&&void 0!==t?t:e.visible),n.component=[e.component,n.component].filter(Boolean).join("."),n}});return Z(t,(function(n){n.items&&n.items.length>0&&n.items.reduceRight((function(e,t){if(t._parent){var i=n.items.findIndex((function(n){return n.id===t._parent}));i>=0&&n.items.splice(i,1),delete t._parent}return null}),null)}),{key:"items"}),t}(a(d)),j=w(P(function(n){var e=(0,f.default)(n).filter((function(n){return n.id}));return Z(e,(function(n,e){var t;if(n.items&&n.items.length){for(var i=n.items.length-1;i>=0;i--)n.items[i].id||n.items.splice(i,1);0===n.items.length&&n.component&&(n.link=n.link||k)}e&&(n.parent=e.id,n.id=[e.id,n.id].join(b)),n.from=n.from||"yaml",n.visible=null===(t=n.visible)||void 0===t||t}),{key:"items"}),e}(h)).reduce((function(n,e){var t=["bottom","social","sessionManager"].includes(e.section),i=!1,a=m.find((function(n){return"/"===n.link}));if(a&&e.id===a.did&&(i=!0),t||i){if(e.items&&e.items.length>0)return n.push.apply(n,o(e.items.map((function(n){var t=e.section,i=L(e.link,n.link),o=[e.component,n.component].filter(Boolean).join(".");return r(r({},n),{},{section:t,link:i,component:o,parent:""})})))),n;if(i)return n}return n.push(e),n}),[]),{transform:function(n,e){var t=n.component;return null!==e&&void 0!==e&&e.component&&(t=[e.component,n.component].filter(Boolean).join(".")),r(r({},n),{},{component:t})}});return{navigationList:(0,l.default)(p.map((function(n){var e=r({},n);return e.role&&(e.role=N(e.role)),e.section&&(e.section=N(e.section)),e.title&&(e.title=N(e.title)),e.link&&(e.link=N(e.link)),e})),j,(function(n,e){var t=["id","section"];return(0,c.default)((0,s.default)(n,t),(0,s.default)(e,t))})),components:m,builtinList:j}}},14775:function(n,e,t){t.r(e),t.d(e,{default:function(){return ge}});var i=t(33028),o=t(32723),r=t(34795),a=t(5057),l=t(39948),c=t(56556),s=t(80633),u=t(80576),d=t(6041),f=t(74490),v=t(25228),m=t(51177),p=t(95301),h=t(11750),g=t(39067),x=t(86229),k=t(55498),b=t(12673),j=t(13128),Z=t(68420),y=t(74639),N=t(92706),S=t.n(N),L=t(55898),w=t.n(L),P=t(37660),C=t(86272),O=t.n(C),A=t(26271),E=t.n(A),R=t(50482),T=t.n(R),M=t(20877),_=t(36095),D=t(96266);function I(n){var e=n.prevPath,t=n.nextPath,i=e.length,o=t.length;return!(i!==o||!T()(e.slice(0,i-1),t.slice(0,o-1)))}function W(n){var e=n.treeNode,t=(0,Z.PE)().locale;return(0,D.jsxs)(D.Fragment,{children:[e.icon&&(0,D.jsx)(k.JO,{style:{marginRight:4},icon:e.icon}),function(){var n=e.title,i=e.subtitle,o=n,r=i;return E()(n)&&(o=n[t]),!(0,a.isValidElement)(i)&&E()(i)&&(r=i[t]),(0,D.jsxs)(l.Z,{display:"flex",alignItems:"center",children:[(0,D.jsx)(h.Z,{variant:"subtitle1",fontSize:16,children:o}),i&&(0,D.jsx)(h.Z,{variant:"body2",color:"gray",ml:1.5,lineHeight:1,children:r})]})}()]})}function z(n){var e=n.treeData,t=n.setTreeData,o=n.renderActions,r=e.map((function(n){return(0,i.Z)((0,i.Z)({},n),{},{expanded:!0})})),a={};return"undefined"!==typeof window&&(a.context=window),(0,D.jsx)(_.W,(0,i.Z)((0,i.Z)({backend:M.HTML5Backend},a),{},{children:(0,D.jsx)(P.oP,{generateNodeProps:function(n){return{buttons:o({data:n.node,className:"list-item-actions"}),icons:(0,D.jsx)(k.JO,{icon:"ic:round-drag-indicator"}),title:(0,D.jsx)(W,{treeNode:n.node})}},maxDepth:2,isVirtualized:!1,treeData:r,onChange:t,canDrop:I,theme:O()})}))}W.propTypes={treeNode:w().object.isRequired},z.propTypes={treeData:w().object.isRequired,setTreeData:w().func,renderActions:w().func},z.defaultProps={setTreeData:function(){},renderActions:function(){}};var J=z,F=t(96234),q=t(56666),V=t(28726),B=t(75953),G=t(67680),H=t(53070),U=t(47020),Q=t(41899),K=t(11251),X=t(24914),$=t.n(X),Y=t(8708),nn=t.n(Y),en=t(82488),tn=t.n(en),on=t(78164),rn=t.n(on),an=t(75506),ln=t.n(an),cn=t(2765),sn=t.n(cn),un=t(25842),dn=t.n(un),fn=t(95550),vn=t(19371),mn=t(6352),pn=t.n(mn),hn=t(2842),gn=t(6018),xn=t.n(gn),kn=t(76811),bn=t(68079),jn=t(63838),Zn=t(65873),yn=t(27156),Nn=t(23985),Sn=t(11819),Ln=t(59740),wn=t(19654),Pn=t(90067),Cn=t(44067),On=t(12594),An=["fullWidth","multiple","required","label","placeholer","options","helperText","error","margin"];function En(n){var e=n.fullWidth,t=n.multiple,o=n.required,r=n.label,a=n.placeholer,c=n.options,s=n.helperText,v=n.error,p=n.margin,g=(0,Ln.Z)(n,An),x=c.find((function(n){return n.value===g.value})),k=null===x||void 0===x?void 0:x.title;return(0,D.jsxs)(u.Z,{margin:p,fullWidth:e,error:v,children:[(0,D.jsx)(d.Z,{children:"".concat(r).concat(o?"*":"")}),(0,D.jsxs)(m.Z,(0,i.Z)((0,i.Z)({multiple:t,input:(0,D.jsx)(On.Z,{defaultValue:k,sx:{flex:1},required:o,label:r,inputProps:{margin:p}}),renderValue:function(n){if(t)return(0,D.jsx)(l.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:n.map((function(n){var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsx)(wn.Z,{size:"small",label:e.title},n)}))});var e=c.find((function(e){return e.value===n}));return e&&e.title&&(0,D.jsxs)(l.Z,{children:[(0,D.jsx)(h.Z,{component:"span",children:e.title}),(0,D.jsx)(h.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.description})]})}},g),{},{children:[(0,D.jsx)(f.Z,{disabled:!0,children:(0,D.jsx)("em",{children:a})}),!t&&(0,D.jsx)(f.Z,{value:"",children:"None"}),c.map((function(n){return n&&n.value&&(0,D.jsxs)(f.Z,{value:n.value,children:[(0,D.jsx)(Cn.Z,{children:n.title}),n.description&&(0,D.jsx)(h.Z,{variant:"body2",color:"text.secondary",children:n.description})]},n.value)}))]})),(0,D.jsx)(Pn.Z,{children:s})]})}En.propTypes={error:w().bool,required:w().bool,multiple:w().bool,fullWidth:w().bool,label:w().string,placeholer:w().string,options:w().array,helperText:w().string,margin:w().string},En.defaultProps={error:!1,required:!1,multiple:!1,fullWidth:!1,label:"",placeholer:"",options:[],helperText:"",margin:""};var Rn=En,Tn="en";function Mn(n){var e=n.sx,t=n.onAdd,i=n.onChange,o=n.locales,r=n.localeMap,s=n.onRemoveLocale,u=(0,Z.PE)().t,d=(0,a.useRef)(),f=(0,a.useState)(null),v=(0,F.Z)(f,2),m=v[0],p=v[1],g=(0,b.Z)({currentLocale:Tn,localeList:[],inputLocale:"",localeError:""}),x=(0,a.useMemo)((function(){return!!m}),[m]),j=(0,a.useMemo)((function(){return o.includes(g.currentLocale)?g.currentLocale:Tn}),[o,g.currentLocale]),y=(0,a.useMemo)((function(){return Object.keys((0,Zn.omit)(r,[].concat((0,bn.Z)(g.localeList),[Tn]))).map((function(n){return{title:r[n],value:n}}))}),[g.localeList]);function N(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=function(n){return n?"en"!==n&&!g.localeList.includes(n)||u("navigation.form.localeExists",{value:n}):u("common.requiredErrorText",{name:"Locale"})}(null===n||void 0===n?void 0:n.trim());return g.localeError=!0!==e?e:"",e}function S(){var n,e=null===(n=g.inputLocale)||void 0===n?void 0:n.trim();!0===N(e)&&(L(),g.localeList.push(e),g.currentLocale=e,t(e))}function L(){p(null),g.inputLocale="",g.localeError=""}return(0,a.useEffect)((function(){g.localeList=(0,bn.Z)(o)}),[o,g]),(0,jn.Z)("enter",(function(){setTimeout((function(){S()}))}),{target:d}),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(yn.Z,{sx:e,value:j,onChange:function(n,e){g.currentLocale=e,i(e)},children:[(0,D.jsx)(Nn.Z,{label:"Default (".concat(r[Tn],")"),value:"en"}),g.localeList.map((function(n){return(0,D.jsx)(Nn.Z,{sx:{position:"relative"},label:(0,D.jsxs)(D.Fragment,{children:[r[n],(0,D.jsx)(G.Z,{size:"small",color:"inherit",sx:{position:"absolute",top:0,right:0},onClick:function(e){!function(n,e){n.preventDefault(),n.stopPropagation(),g.localeList=(0,Zn.without)(g.localeList,e),s(e),e===g.currentLocale&&(g.currentLocale=Tn)}(e,n)},children:(0,D.jsx)(k.JO,{icon:"mdi:close",height:14})})]}),value:n},n)})),(0,D.jsx)(G.Z,{color:"primary",disableFocusRipple:!0,sx:{width:"48px"},onClick:function(n){p(n.currentTarget)},children:(0,D.jsx)(k.JO,{icon:"mdi:plus"})})]}),(0,D.jsx)(Sn.ZP,{open:x,anchorEl:m,onClose:L,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:(0,D.jsxs)(l.Z,{sx:{p:2,width:"270px"},children:[(0,D.jsx)(h.Z,{variant:"subtitle2",children:u("navigation.form.localePlaceholder")}),(0,D.jsx)(l.Z,{mt:1,children:(0,D.jsx)(Rn,{required:!0,fullWidth:!0,label:"Locale",value:g.inputLocale,options:y,onChange:function(n){var e=n.target.value;N(e),g.inputLocale=e},error:!!g.localeError,helperText:g.localeError||" "})}),(0,D.jsx)(l.Z,{display:"flex",justifyContent:"flex-end",children:(0,D.jsx)(c.Z,{size:"small",variant:"contained",onClick:S,children:u("common.confirm")})})]})})]})}Mn.propTypes={sx:w().any,onAdd:w().func,onChange:w().func,onRemoveLocale:w().func,localeMap:w().object,locales:w().array},Mn.defaultProps={sx:null,onAdd:function(){},onChange:function(){},onRemoveLocale:function(){},localeMap:{},locales:[]};var _n=Mn,Dn=t(17425),In=t(29054),Wn="en",zn={title:(0,q.Z)({},Wn,""),link:(0,q.Z)({},Wn,"")};function Jn(n){var e=n.icon,t=(0,a.useState)(!1),i=(0,F.Z)(t,2),l=i[0],c=i[1];return(0,Q.Z)((0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return c(!1),n.next=3,(0,k.GL)(e);case 3:c(!0);case 4:case"end":return n.stop()}}),n)}))),[e]),e?l?(0,D.jsx)(k.JO,{icon:e}):(0,D.jsx)(k.JO,{color:"#f06f6e",icon:"ic:baseline-error"}):(0,D.jsx)(k.JO,{icon:"codicon:blank"})}Jn.propTypes={icon:w().string.isRequired};var Fn=(0,a.forwardRef)((function(n,e){var t=n.section,c=n.components,s=n.rawNavigations,d=(0,Dn.DJ)().roles,f=(0,Z.PE)(),v=f.t,m=f.locale,p=(0,In.y0)().blocklet.environments.find((function(n){return"BLOCKLET_APP_LANGUAGES"===n.key})),g=(p?p.value.split(","):["en","zh"]).filter((function(n){return kn.SUPPORTED_LANGUAGES[n]})).reduce((function(n,e){return n[e]=kn.SUPPORTED_LANGUAGES[e].nativeName,n}),{}),y=(0,a.useRef)((function(){})),N=(0,K.Z)(!1),S=(0,F.Z)(N,2),L=S[0],w=S[1],P=w.setFalse,C=w.setTrue,O=(0,b.Z)({isRoot:!0,type:"add",linkDisabled:!1,locale:Wn,formState:dn()(zn),get localeList(){return rn()(Object.keys(this.formState.title),Wn)}}),A=(0,fn.cI)({mode:"onChange",defaultValues:{id:void 0,title:void 0,icon:void 0,link:void 0,component:void 0,parent:void 0,role:[]}}),R=A.handleSubmit,T=A.control,M=A.watch,_=A.setValue,I=A.clearErrors,W=A.formState.errors;(0,a.useEffect)((function(){_("title",O.formState.title[O.locale]),_("link",O.formState.link[O.locale])}),[_,O.locale,L]);var z=M("component"),J=M("title"),Q=M("link"),X=M("icon"),Y=M("parent");(0,a.useEffect)((function(){O.formState.title[O.locale]=J}),[J]),(0,a.useEffect)((function(){O.formState.link[O.locale]=Q}),[Q]);var en=(0,a.useMemo)((function(){return s.find((function(n){return z?c.find((function(n){return n.name===z})).did===n.id:n.id===Y}))}),[c,s,z,Y]),on=(0,a.useMemo)((function(){if(null!==en&&void 0!==en&&en.component){var n=(c.find((function(n){return n.name===en.component}))||{}).link,e=E()(n)?n[O.locale]:n;if(z)return(0,hn.QT)(e);var t=E()(en.link)?en.link[O.locale]:en.link;return(0,hn.QT)(pn()(e,t||"/"))}return null}),[c,O.locale,en,z]),an=(0,a.useMemo)((function(){var n=(en||{}).component,e=(c.find((function(e){return e.name===n}))||{}).navigation,i=void 0===e?[]:e;return(0,vn.flattenNavigation)(i,{transform:function(n,e){return null!==e&&void 0!==e&&e.section&&(n.section=n.section||e.section),n}}).filter((function(n){return n.link})).filter((function(n){return(0,vn.isMatchSection)(n.section,t)})).map((function(n){return{label:n.link,title:n.title[m]||n.title}}))}),[en,c,t,m]),cn=(0,a.useMemo)((function(){var n={add:v("common.create"),edit:v("common.edit")}[O.type];return n?"".concat(n," ").concat(v("navigation.navigation")):"--"}),[O.type,v]),un=(0,a.useCallback)((function(){O.isRoot=!0,O.locale=Wn,O.type="add",O.linkDisabled=!1,y.current=function(){},_("id",void 0),_("icon",void 0),_("title",void 0),_("link",void 0),_("component",void 0),_("parent",void 0),_("role",[]),O.formState=dn()(zn),I()}),[I,_,O]),mn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return O.localeList.length>0&&(new Set(tn()(O.formState.title)).size>1&&(n.title=O.formState.title),new Set(tn()(O.formState.link)).size>1&&(n.link=O.formState.link)),ln()(n.role)&&(n.role=void 0),n}),[O.formState.link,O.formState.title,O.localeList]),gn=(0,a.useCallback)((function(){P(),setTimeout((function(){un()}))}),[un,P]),bn=(0,a.useCallback)((function(){var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).parent,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};O.type="add",O.isRoot=!n,_("parent",null===n||void 0===n?void 0:n.id),y.current=function(n){e(gn,n)},C()}),[gn,C,_,O]),jn=(0,a.useCallback)((function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=n.id,i=n.title,o=n.icon,r=n.link,a=n.parent,l=n.component,c=n.role,s=void 0===c?[]:c;_("id",t),_("icon",o),"tmpl"===n.from&&(O.linkDisabled=!0),sn()(i)?O.formState.title=O.localeList.reduce((function(n,e){return n[e]=i,n}),(0,q.Z)({},Wn,i)):E()(i)?O.formState.title=dn()(i):O.formState.title={},sn()(r)?O.formState.link=O.localeList.reduce((function(n,e){return n[e]=r,n}),(0,q.Z)({},Wn,r)):E()(r)?O.formState.link=dn()(r):O.formState.link={},_("component",l),_("parent",a),_("role",s||[]),C(),O.type="edit",O.isRoot=!a,y.current=function(n){var t=nn()(n,["id","title","icon","link","role"]);e(gn,t)}}),[gn,C,_,O]);function Zn(n){var e=null===n||void 0===n?void 0:n.trim();return e?!(e.length>24)||v("navigation.form.titleTooLong",{len:24}):v("common.requiredErrorText",{name:v("navigation.form.title")})}function yn(){return(yn=(0,r.Z)((0,o.Z)().mark((function n(e){var t;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(t=null===e||void 0===e?void 0:e.trim())){n.next=10;break}return n.prev=2,n.next=5,(0,k.GL)(t);case 5:n.next=10;break;case 7:return n.prev=7,n.t0=n.catch(2),n.abrupt("return",v("navigation.form.invalidIcon"));case 10:return n.abrupt("return",!0);case 11:case"end":return n.stop()}}),n,null,[[2,7]])})))).apply(this,arguments)}function Nn(n){var e=null===n||void 0===n?void 0:n.trim();return e?!!(0,vn.checkLink)(e)||v("navigation.form.invalidLink"):!!O.isRoot||v("common.requiredErrorText",{name:v("navigation.form.link")})}(0,a.useImperativeHandle)(e,(function(){return{add:bn,edit:jn,close:gn}}),[bn,gn,jn]);var Sn=(0,a.useCallback)((function(n){O.locale=n,O.formState.title[n]||(O.formState.title[n]=""),O.formState.link[n]||(O.formState.link[n]=""),setTimeout((function(){I()}))}),[I,O]),Ln=(0,a.useCallback)((function(){for(var n=O.formState,e=n.title,t=n.link,i=0,o=Object.keys(e);i<o.length;i++){var r=Zn(e[o[i]]);if(!0!==r)return r}for(var a=0,l=Object.keys(t);a<l.length;a++){var c=Nn(t[l[a]]);if(!0!==c)return c}return!0}),[O.formState]),wn=(0,a.useCallback)((function(n){var e=Ln();!0===e?y.current(mn(n)):x.Z.error(e)}),[Ln,mn]),Pn=(0,a.useCallback)((function(n){O.formState.title=$()(O.formState.title,n),O.formState.link=$()(O.formState.link,n)}),[O.formState]),Cn=(0,a.useCallback)((function(n){var e,t;O.locale=n,O.formState.title[n]=null===(e=O.formState.title)||void 0===e?void 0:e[Wn],O.formState.link[n]=null===(t=O.formState.link)||void 0===t?void 0:t[Wn],setTimeout((function(){I()}))}),[I,O]);return(0,D.jsxs)(j.ZP,{open:L,title:cn,onClose:gn,actions:(0,D.jsx)(V.Z,{onClick:R(wn),color:"primary",autoFocus:!0,variant:"contained",children:v("common.confirm")}),children:[(0,D.jsx)(_n,{sx:{mb:1},onAdd:Cn,onChange:Sn,onRemoveLocale:Pn,localeMap:g,locales:O.localeList}),(0,D.jsxs)("form",{noValidate:!0,autoComplete:"off",children:[(0,D.jsx)(fn.Qr,{name:"title",control:T,rules:{validate:Zn},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",required:!0,placeholder:v("navigation.form.titlePlaceholder"),label:v("navigation.form.title"),disabled:O.isEdit,error:!(null===W||void 0===W||null===(e=W.title)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.title)||void 0===t?void 0:t.message)||" "},o))}}),(0,D.jsx)(fn.Qr,{name:"icon",control:T,rules:{validate:function(n){return yn.apply(this,arguments)}},render:function(n){var e,t,o=n.field;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({fullWidth:!0,variant:"outlined",margin:"dense",placeholder:v("navigation.form.iconPlaceholder"),label:v("navigation.form.icon"),error:!(null===W||void 0===W||null===(e=W.icon)||void 0===e||!e.message),disabled:O.locale!==Wn,helperText:(null===W||void 0===W||null===(t=W.icon)||void 0===t?void 0:t.message)||(0,D.jsx)(l.Z,{display:"flex",children:(0,D.jsxs)(l.Z,{component:"a",href:"https://icones.js.org",target:"_blank",display:"flex",alignItems:"center",children:[v("navigation.form.findMoreIcon")," ",(0,D.jsx)(k.JO,{style:{marginLeft:4},icon:"radix-icons:external-link"})]})})},o),{},{InputProps:{endAdornment:(0,D.jsx)(H.Z,{position:"end",children:(0,D.jsx)(G.Z,{sx:{cursor:"default"},disableFocusRipple:!0,disableRipple:!0,children:X&&(0,D.jsx)(Jn,{icon:X})})})}}))}}),O.isRoot&&(0,D.jsx)(fn.Qr,{name:"component",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Rn,(0,i.Z)({fullWidth:!0,margin:"dense",disabled:"edit"===O.type||O.locale!==Wn,label:v("navigation.form.component"),placeholer:v("navigation.form.componentPlaceholder"),options:c.map((function(n){return{title:n.title,value:n.name,description:n.link}})),error:!(null===W||void 0===W||null===(e=W.component)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.component)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}}),(0,D.jsx)(fn.Qr,{name:"link",control:T,rules:{validate:Nn},render:function(n){var e=n.field;return(0,D.jsx)(u.Z,{fullWidth:!0,margin:"dense",children:(0,D.jsx)(B.Z,(0,i.Z)((0,i.Z)({disablePortal:!0,freeSolo:!0,blurOnSelect:!0,autoSelect:!0,fullWidth:!0,disabled:O.linkDisabled,isOptionEqualToValue:function(n){return n.label},options:an,renderInput:function(n){var e,t;return(0,D.jsx)(U.Z,(0,i.Z)((0,i.Z)({},n),{},{placeholder:v("navigation.form.linkPlaceholder"),label:v("navigation.form.link"),error:!(null===W||void 0===W||null===(e=W.link)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.link)||void 0===t?void 0:t.message)||"/abc/bcd or /abc or https://arcblock.io",InputProps:{startAdornment:on?(0,D.jsx)(H.Z,{position:"start",sx:{textDecoration:xn()(Q||"")?"line-through":""},children:on}):null}}))},renderOption:function(n,e){return(0,D.jsxs)(l.Z,(0,i.Z)((0,i.Z)({component:"li"},n),{},{children:[e.label,(0,D.jsx)(h.Z,{marginLeft:1,component:"span",variant:"body2",color:"text.secondary",children:e.title})]}))},margin:"dense"},e),{},{onChange:function(){},onInputChange:function(n,t){e.onChange(t)}}))})}}),["dashboard","sessionManager"].includes(t)&&(0,D.jsx)(fn.Qr,{name:"role",control:T,render:function(n){var e,t,o=n.field;return(0,D.jsx)(Rn,(0,i.Z)({fullWidth:!0,multiple:!0,margin:"dense",label:v("navigation.form.role"),placeholer:v("navigation.form.rolePlaceholder"),options:d.map((function(n){return{title:n.title,value:n.name}})),error:!(null===W||void 0===W||null===(e=W.role)||void 0===e||!e.message),helperText:(null===W||void 0===W||null===(t=W.role)||void 0===t?void 0:t.message)||" "},$()(o,"ref")))}})]})]})}));Fn.propTypes={section:w().string,components:w().array,rawNavigations:w().array},Fn.defaultProps={section:"",components:[],rawNavigations:[]};var qn=Fn;function Vn(n){var e=n.className,t=n.add,i=n.edit,o=n.toggle,r=n.del,l=n.data,c=n.section,s=(0,Z.PE)().t,u=["yaml","tmpl"].includes(l.from),d=(0,a.isValidElement)(l.subtitle);function f(n){n.preventDefault(),n.stopPropagation()}var v=(0,a.useCallback)((function(n){f(n),t(l)}),[t,l]),m=(0,a.useCallback)((function(n){f(n),i(l)}),[i,l]),p=(0,a.useCallback)((function(n){f(n),o(l)}),[o,l]),h=(0,a.useCallback)((function(n){f(n),r(l)}),[r,l]);return(0,D.jsxs)("div",{className:e,children:[!l.parent&&["header","footer","dashboard"].includes(c)&&(0,D.jsx)("span",{title:s(d?"navigation.action.noAddSub":"navigation.action.addSub"),children:(0,D.jsx)(G.Z,{size:"small",color:"success",onClick:v,disabled:d,children:(0,D.jsx)(k.JO,{icon:"mdi:plus-box-outline"})})}),(0,D.jsx)("span",{title:s(d?"navigation.action.noEdit":"navigation.action.edit"),children:(0,D.jsx)(G.Z,{size:"small",color:"primary",onClick:m,disabled:d,children:(0,D.jsx)(k.JO,{icon:"mdi:pencil"})})}),(0,D.jsx)("span",{title:d?s("navigation.action.noEdit"):l.visible?s("navigation.action.hide"):s("navigation.action.show"),children:(0,D.jsx)(G.Z,{size:"small",color:"warning",onClick:p,disabled:d,children:!1===l.visible?(0,D.jsx)(k.JO,{icon:"mdi:eye-off-outline"}):(0,D.jsx)(k.JO,{icon:"mdi:eye-outline"})})}),(0,D.jsx)("span",{title:s(u&&!d?"navigation.action.noDel":"navigation.action.del"),children:(0,D.jsx)(G.Z,{disabled:u&&!d,size:"small",color:"error",onClick:h,children:(0,D.jsx)(k.JO,{icon:"mdi:delete"})})})]})}Vn.propTypes={data:w().object.isRequired,className:w().string,add:w().func,edit:w().func,toggle:w().func,del:w().func,section:w().string},Vn.defaultProps={className:"",add:function(){},edit:function(){},toggle:function(){},del:function(){},section:""};var Bn=Vn,Gn=t(3785),Hn=t.n(Gn),Un=t(79683),Qn=t.n(Un),Kn=t(35432),Xn=t(14491),$n="/",Yn="header",ne={sessionManager:[{id:"/sessionManager",title:{en:"Manage",zh:"\u7ba1\u7406"},section:["sessionManager"],icon:"ion:settings-outline",link:"".concat(Kn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),role:["owner","admin"],from:"tmpl"}],dashboard:[{id:"/access",title:{en:"Access",zh:"\u8bbf\u95ee\u63a7\u5236"},role:["owner","admin","member"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"member",title:{en:"Members",zh:"\u6210\u5458"},icon:"ant-design:user-outlined",link:"".concat(Kn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/members"),from:"tmpl"},{id:"passport",title:{en:"Passport",zh:"\u901a\u884c\u8bc1"},icon:"icon-park-outline:passport",link:"".concat(Kn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/passports"),from:"tmpl"}]},{id:"/dashboard",title:"Blocklet",role:["owner","admin"],section:["dashboard"],link:"",from:"tmpl",items:[{id:"dashboard",title:{en:"Dashboard",zh:"\u4eea\u8868\u76d8"},icon:"ant-design:dashboard-outlined",link:"".concat(Kn.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin"),from:"tmpl"}]}]};function ee(n,e){return n.section&&e.section?n.section===e.section&&n.id===e.id:n.id===e.id}function te(){var n=(0,In.y0)(),e=n.blocklet,t=n.actions,l=(0,vn.parseNavigation)(e,{beforeProcess:function(n){var e=dn()(n);return ne.dashboard.forEach((function(n){e.some((function(e){return e.id===n.id}))||e.push(n)})),e.some((function(n){return n.id&&(n.section||[]).includes("sessionManager")}))||e.push.apply(e,(0,bn.Z)(ne.sessionManager)),e}}),c=l.navigationList,s=l.components,u=l.builtinList,d=(0,b.Z)({rawNavigation:dn()(c),activeSection:Yn,components:s}),f=(0,a.useMemo)((function(){return(0,vn.nestNavigationList)(d.rawNavigation)}),[d.rawNavigation]),v=(0,a.useMemo)((function(){var n=(0,vn.filterNavigation)(d.rawNavigation,s),e=(0,vn.joinLink)(n,s);return(0,vn.cleanOrphanNavigation)(e)}),[s,d.rawNavigation]);function m(n){if(!n.id)return"";var e=(0,vn.flattenNavigation)((0,vn.joinLink)(f,s)),t=e.find((function(e){return e.id===n.id}));function i(n){var e=n.name;return(0,D.jsx)(wn.Z,{label:"Uninstalled: ".concat(e),color:"error",size:"small",variant:"outlined",sx:{fontSize:10,height:20}})}if(null!==t&&void 0!==t&&t.component){if(!s.some((function(n){return n.name===t.component})))return(0,D.jsx)(i,{name:t.component})}else if(t.parent){var o=e.find((function(n){return n.id===t.parent}));if(null!==o&&void 0!==o&&o.component&&!s.some((function(n){return n.name===o.component})))return(0,D.jsx)(i,{name:o.component})}return null===t||void 0===t?void 0:t.link}function p(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$n;return n.map((function(n){var t=s.find((function(e){return e.name===n.component})),i=(null===t||void 0===t?void 0:t.link)||e,o=n.items||[],r=n.link;return{title:n.title,subtitle:m(n),link:r,icon:n.icon,children:p(o,r||$n),section:n.section,visible:n.visible,parent:n.parent,component:n.component,id:n.id,role:n.role,from:n.from,__base:i}}))}function h(n){return g.apply(this,arguments)}function g(){return(g=(0,r.Z)((0,o.Z)().mark((function n(e){var r,a;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.map((function(n){return Qn()(n,Hn())})),a=r.map((function(n){var e=(0,i.Z)({},n);return e.role&&Array.isArray(e.role)&&(e.role=JSON.stringify(e.role)),e.section&&Array.isArray(e.section)&&(e.section=JSON.stringify(e.section)),e.title&&e.title instanceof Object&&(e.title=JSON.stringify(e.title)),e.link&&e.link instanceof Object&&(e.link=JSON.stringify(e.link)),e})),n.next=4,t.configNavigations(a);case 4:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function x(){return(x=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,h([]);case 2:d.rawNavigation=dn()(u);case 3:case"end":return n.stop()}}),n)})))).apply(this,arguments)}return{state:d,navigation:v,components:s,getNavigationFullLink:m,updateActiveSection:function(n){d.activeSection=n},updateNavigationItem:function(n){!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=d.rawNavigation.map((function(e){var t=n.find((function(n){return ee((0,i.Z)((0,i.Z)({},n),{},{section:d.activeSection}),e)}));return t?(0,i.Z)((0,i.Z)({},e),t):e}));d.rawNavigation=e}([n])},delNavigationItem:function(n){var e=d.rawNavigation.filter((function(e){return e.id===n||e.parent===n})).map((function(n){return n.id}));d.rawNavigation=d.rawNavigation.filter((function(n){return!e.includes(n.id)}))},addNavigationItem:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,i.Z)((0,i.Z)({},n),{},{id:(0,Xn.x0)(),section:d.activeSection,visible:!0});d.rawNavigation=[].concat((0,bn.Z)(d.rawNavigation),[e])},updateNavigationTree:function(n){var e=[];(0,vn.deepWalk)(n,(function(n,t){var o=(0,i.Z)((0,i.Z)({},$()(n,["children","expand"])),{},{parent:null===t||void 0===t?void 0:t.id});e.push(o)}));var t=d.rawNavigation.filter((function(n){if(!d.activeSection)return!1;var t=e.find((function(e){return ee(e,n)}));return!t||!(0,vn.isMatchSection)(t.section,d.activeSection)}));d.rawNavigation=[].concat((0,bn.Z)(t),e)},getNavigation:function(n){return p(dn()(f).filter((function(e){return(0,vn.isMatchSection)(e.section,n)})))},saveNavigationList:h,resetNavigation:function(){return x.apply(this,arguments)}}}var ie,oe=t(71171),re=t(1192),ae=t(2484),le=t(5873),ce=t(88764),se=t(55402),ue=t(5939),de=t(33518),fe=t(49522);function ve(n){var e=n.className,t=n.navigation,i=(0,In.y0)().blocklet,o=(0,fe.Z)({blocklet:i}).logoUrl,r={appId:i.appDid,appLogo:o,appName:i.meta.title,enableConnect:!0,enableLocale:!1,navigation:t};return(0,D.jsx)(ce.Z,{children:(0,D.jsxs)(l.Z,{className:e,children:[(0,D.jsx)(re.Z,{meta:r}),(0,D.jsx)(l.Z,{children:(0,D.jsx)(le.Z,{meta:r,invalidPathFallback:function(){},headerProps:{style:{display:"none"}},children:(0,D.jsx)(se.ZP,{container:!0,spacing:2,children:new Array(6).fill().map((function(n,e){return(0,D.jsxs)(se.ZP,{item:!0,xs:4,children:[(0,D.jsx)(ue.Z,{animation:!1,variant:"rectangular",width:"100%",height:120}),(0,D.jsxs)(l.Z,{sx:{pt:.5},children:[(0,D.jsx)(ue.Z,{animation:!1}),(0,D.jsx)(ue.Z,{width:"60%",animation:!1})]})]},e)}))})})}),(0,D.jsx)(ae.Z,{meta:r})]})})}ve.propTypes={className:w().string,navigation:w().array},ve.defaultProps={className:"",navigation:[]};var me=(0,de.Z)(ve)(ie||(ie=(0,oe.Z)(["\n .dashboard {\n height: auto !important;\n }\n .dashboard-content + div {\n display: none;\n }\n"]))),pe={login:S(),logout:S(),switch:S(),switchDid:S(),switchProfile:S(),switchPassport:S(),useDid:function(){return{walletDid:"abcdefghijklmnopqrstuvwxyz"}},useOAuth:function(){return{logoutOAuth:S(),bindOAuth:S(),configs:{},switchOAuthPassport:S()}}},he={header:"Header",footer:"Footer",bottom:"Footer Link",social:"Footer Social",dashboard:"Dashboard",sessionManager:"SessionManager"};var ge=function(){var n=(0,Z.PE)().t,e=(0,In.y0)().blocklet,t=(0,a.useRef)(null),N=(0,Dn.DJ)().roles,S=(0,b.Z)({saveLoading:!1,resetLoading:!1,showResetConfirm:!1,mockRole:"owner"}),L=te(),w=L.state,P=L.navigation,C=L.getNavigation,O=L.saveNavigationList,A=L.resetNavigation,E=L.updateActiveSection,R=L.updateNavigationTree,T=L.updateNavigationItem,M=L.delNavigationItem,_=L.addNavigationItem,I=(0,a.useCallback)((function(n){t.current.add({parent:n},(function(n,e){_(e),n()}))}),[_]),W=(0,a.useCallback)((function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(n){case"edit":t.current.edit(e,(function(n,e){T(e),n()}));break;case"toggle":T({id:e.id,visible:!e.visible});break;case"del":M(e.id)}}),[M,T]),z=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,S.saveLoading=!0,e.next=4,O(w.rawNavigation);case 4:x.Z.success(n("common.succeeded")),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),x.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(h.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(h.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,S.saveLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[w.rawNavigation,S,O,n]),F=(0,a.useCallback)((0,r.Z)((0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,S.resetLoading=!0,e.next=4,A();case 4:x.Z.success("\u91cd\u7f6e\u6210\u529f",{variant:"success"}),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),x.Z.error((0,D.jsxs)(l.Z,{children:[(0,D.jsx)(h.Z,{variant:"subtitle2",children:n("navigation.actionFailed")}),(0,D.jsx)(h.Z,{variant:"body1",children:(0,Xn.Z)(e.t0)||e.t0.error})]}));case 10:return e.prev=10,S.resetLoading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])}))),[S,A,n]),q=(0,a.useMemo)((function(){return{session:(0,i.Z)((0,i.Z)({},pe),{},{user:{did:e.appDid,fullName:"Preview User",role:S.mockRole}})}}),[e.appDid,S.mockRole]);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(s.Z,{variant:"outlined",children:Object.keys(he).map((function(n){return(0,D.jsxs)(c.Z,{variant:w.activeSection===n?"contained":void 0,onClick:function(){return E(n)},children:[he[n]," (".concat(C(n).length,")")]},n)}))}),(0,D.jsxs)(p.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:2},children:[(0,D.jsx)(h.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:"Config"}),(0,D.jsx)(s.Z,{variant:"outlined",children:(0,D.jsx)(g.Z,{size:"small",variant:"outlined",color:"error",startIcon:(0,D.jsx)(k.JO,{icon:"system-uicons:reset"}),sx:{mr:2},loading:S.resetLoading,loadingPosition:"start",onClick:function(){S.showResetConfirm=!0},children:"\u91cd\u7f6e"})}),(0,D.jsxs)(s.Z,{variant:"outlined",children:[(0,D.jsx)(c.Z,{size:"small",variant:"outlined",startIcon:(0,D.jsx)(k.JO,{icon:"mdi:plus"}),onClick:function(){return I()},children:"\u65b0\u5efa"}),(0,D.jsx)(g.Z,{size:"small",variant:"contained",startIcon:(0,D.jsx)(k.JO,{icon:"mdi:content-save"}),loading:S.saveLoading,loadingPosition:"start",onClick:z,children:"\u4fdd\u5b58"})]})]}),(0,D.jsx)(v.Z,{variant:"outlined",sx:{display:"flex",height:280,overflow:"hidden"},children:(0,D.jsx)(v.Z,{elevation:0,sx:{flex:1,overflow:"auto"},children:(0,D.jsx)(J,{treeData:C(w.activeSection),setTreeData:R,renderActions:function(n){var e=n.data,t=n.className;return(0,D.jsx)(Bn,{data:e,className:t,section:w.activeSection,add:function(){return I.apply(void 0,arguments)},del:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return W.apply(void 0,["del"].concat(e))},edit:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return W.apply(void 0,["edit"].concat(e))},toggle:function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return W.apply(void 0,["toggle"].concat(e))}})}})})}),(0,D.jsxs)(p.Z,{variant:"dense",sx:{paddingLeft:"0px !important",paddingRight:"0px !important",mt:3},children:[(0,D.jsx)(h.Z,{variant:"h6",component:"div",sx:{flexGrow:1},children:"Preview"}),(0,D.jsxs)(u.Z,{sx:{m:1,minWidth:120},size:"small",children:[(0,D.jsx)(d.Z,{children:"Role"}),(0,D.jsx)(m.Z,{value:S.mockRole,label:"Role",onChange:function(n){S.mockRole=n.target.value},children:N.map((function(n){return(0,D.jsx)(f.Z,{value:n.name,children:n.title},n.name)}))})]})]}),(0,D.jsx)(v.Z,{variant:"outlined",children:(0,D.jsx)(y.B3.Provider,{value:q,children:(0,D.jsx)(me,{navigation:P})})}),(0,D.jsx)(qn,{ref:t,section:w.activeSection,components:w.components,rawNavigations:w.rawNavigation}),(0,D.jsx)(j.I4,{open:S.showResetConfirm,title:"\u662f\u5426\u6e05\u7a7a\u6240\u6709\u81ea\u5b9a\u4e49\u5bfc\u822a",onConfirm:function(){var n=(0,r.Z)((0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,F();case 2:S.showResetConfirm=!1;case 3:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}(),onCancel:function(){S.showResetConfirm=!1},children:(0,D.jsx)("p",{children:"\u6e05\u7a7a\u540e\uff0c\u5bfc\u822a\u4f1a\u6062\u590d\u5230 Blocklet \u539f\u6709\u9ed8\u8ba4\u7684\u914d\u7f6e"})})]})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4906],{44906:function(e,t,n){n.r(t),n.d(t,{default:function(){return ue}});var r=n(71171),o=n(96234),a=n(5057),i=n(6352),s=n.n(i),l=n(33518),c=n(67654),u=n(11750),d=n(39948),h=n(39434),f=n(68420),m=n(5952),p=n(75793),x=n(59740),b=n(33028),v=n(38898),g=n(52439),Z=n(71569),k=n(61951),y=n(35432),j=n(44727),w=n(4651),P=n(74094),S=n(85493),R=n(38242),C=n(44846),D=n(28726),E=n(86386),F=n(86229),U=n(76811),L=n(23484),N=n(34937);var T=n(7199),_=n(10458),B=n.n(_),M=n(13128),W=n(73170),I=n(96266);function A(e){var t=e.meta,n=e.onCancel,r=e.handlePaySuccess,i=e.storeUrl,l=(0,f.PE)().t,c=(0,p.h6)().info,d=(0,a.useState)("both"),h=(0,o.Z)(d,2),m=h[0],x=h[1],b=(0,a.useState)(1),v=(0,o.Z)(b,2),g=v[0],Z=v[1],k=(0,P.yP)(c),y=(0,w.FM)(t,c,i),j=(0,R.getDisplayName)({meta:t});if("purchase"===m&&2===g)return(0,I.jsx)(E.default,{open:!0,popup:!0,baseUrl:i,action:"acquire-asset",checkFn:B().create({baseURL:s()(i,"/store")}).get,onSuccess:function(){r(y)},onClose:n,checkTimeout:3e5,extraParams:{factory:t.nftFactory},webWalletUrl:k,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:l("store.purchase.auth.title",{name:j}),scan:l("store.purchase.auth.scan"),confirm:l("store.purchase.auth.confirm"),success:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.Z,{gutterBottom:!0,children:l("store.purchase.auth.success")}),(0,I.jsxs)(u.Z,{variant:"subtitle2",children:[" ",l("store.purchase.autoLaunch",{name:j})]})]})}});var S=M.ZP;return(0,I.jsx)(S,{title:l("store.purchase.title",{name:j}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:function(e,t){"backdropClick"!==t&&n()},children:(0,I.jsx)("div",{style:{marginBottom:16},children:(0,I.jsx)(W.AP,{action:m,onNext:function(){m&&(Z(2),"verify"===m&&(window.location.href=y))},onSelect:function(e){e!==m&&x(e)}})})})}A.defaultProps={handlePaySuccess:function(e){setTimeout((function(){window.location.href=e}),1e3)}};var K,O=A,z=n(25339);function H(e){var t=e.meta,n=e.buttonText,r=e.storeUrl,i=(0,f.PE)().t,s=(0,S.useNavigate)(),l=(0,p.h6)().info,u=(0,z.Tt)().api,d=!1===(0,R.isFreeBlocklet)(t),h=(0,a.useState)(!1),m=(0,o.Z)(h,2),x=m[0],b=m[1],v=function(e){var t=(0,L.Z)(),n=(0,S.useNavigate)(),r=(0,c.Z)("sid:blocklet:purchase:".concat(e)),i=(0,o.Z)(r,2),s=i[0],l=i[1],u=(0,a.useState)(!1),d=(0,o.Z)(u,2),h=d[0],f=d[1],m=(0,a.useState)(null),p=(0,o.Z)(m,2),x=p[0],b=p[1],v=function(){var e=new URL(window.location.href),t=e.pathname,r=e.searchParams,o=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";r.get("sid")&&(l(""),n(t.replace(o,"/"),{replace:!0}))},g=!(!t.get("assetDid")||!s||t.get("sid")!==s);return(0,N.mU)(U.BlockletEvents.purchaseChange,(function(t){t.did===e&&(b(t.session),["declined","confirmed","error"].includes(t.session.status)&&(f(!0),setTimeout(v,2e3)))})),(0,a.useEffect)((function(){x&&x.id!==s&&l(x.id)}),[x]),{hasCompleted:h,hasPurchased:g,session:x,setSession:b,doRedirect:v}}(t.did),g=v.hasPurchased,Z=(0,a.useState)(!1),k=(0,o.Z)(Z,2),y=k[0],_=k[1],B=(0,c.Z)("instant-blocklet-install",!1),M=(0,o.Z)(B,1)[0],W=(0,a.useState)(!1),A=(0,o.Z)(W,2),K=A[0],H=A[1],V=(0,a.useMemo)((function(){return x?i(d?"blocklet.status.purchasing":"blocklet.status.waiting"):""}),[x,i,d]),q=(0,a.useMemo)((function(){return d?n.purchase:n.launch}),[d,n]),$=function(e){e.preventDefault(),e.stopPropagation();try{if(b(!0),d)return void _(!0);if(M)return void H(!0);if(!d){var n=(0,w.FM)(t,l,r);return void(window.location.href=n)}}catch(o){F.Z.error((0,P.Z)(o),{autoHideDuration:5e3}),console.error("Blocklet installed failed",o)}finally{b(!1)}};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j.Kk,{children:(0,I.jsx)(T.Z,{permission:"mutate_blocklets",children:function(e){return(0,I.jsx)(D.Z,{onClick:$,size:"small",disabled:Boolean(V||!e),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:V?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(C.Z,{size:16,style:{marginRight:3}}),V]}):q},t.did)}})}),(g||y)&&(0,I.jsx)(O,{method:"launch",meta:t,mode:"both",onCancel:function(){b(!1),_(!1)},storeUrl:r}),K&&(0,I.jsx)(E.default,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:u.get,checkTimeout:3e5,onSuccess:function(e){b(!1),H(!1),s("/blocklets/".concat(e.appDid,"/components"))},extraParams:{title:t.title,blockletMetaUrl:decodeURIComponent((0,P.Rn)(r,t.did).trim())},messages:{title:i("setup.keyPair.title"),scan:i("setup.keyPair.scan"),confirm:i("setup.keyPair.confirm"),success:i("setup.keyPair.success")},onClose:function(){b(!1),H(!1)}})]})}H.defaultProps={};var V=["storeUrl","handleSearchSelect","extraFilter"],q=function(e,t,n){var r=(0,w.RU)(t);return s()(n,"/blocklets/".concat(e.did,"/?server-url=").concat(r))},$=function(e){var t=e.meta,n=e.attribute,r=e.value;return t._formatted?t._formatted[n]:r};function G(e){var t=e.blocklet,n=e.endpoint,r=(0,f.PE)().t,o=(0,p.h6)(),a=s()(o.imgPrefix,"blocklet.png"),i=n;if(i.startsWith("http")&&t.logo)a=s()(i,(0,P.lk)(t.did,t.logo));else{var l=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");l&&(l="/".concat(l)),a=s()(l,"/blocklet/logo/".concat(t.did))}var c=(null===o||void 0===o?void 0:o.info.mode)!==y.NODE_MODES.SERVERLESS,u={meta:t,buttonText:{purchase:r("common.purchase"),launch:r("common.launch")},storeUrl:i};return(0,I.jsx)(v.Z,{href:q(t,o.info,n),style:{color:"initial",textDecoration:"none"},onClick:function(e){return!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1)},target:"_blank",children:(0,I.jsx)(Q,{title:$({meta:t,attribute:"title",value:t.title||t.name}),did:t.did,description:$({meta:t,attribute:"description",value:t.description}),cover:t.logo?a:"",version:t.version,button:c?(0,I.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,I.jsx)(H,(0,b.Z)({},u))}):null})})}function J(e){var t,n=e.storeUrl,r=e.handleSearchSelect,i=e.extraFilter,s=(0,x.Z)(e,V),l=(0,f.PE)().locale,c=(0,p.h6)(),u=(0,a.useState)({}),d=(0,o.Z)(u,2),h=d[0],m=d[1],v=n,y=null===c||void 0===c||null===(t=c.info)||void 0===t?void 0:t.version;return(0,a.useEffect)((function(){m({})}),[v]),(0,I.jsx)(g.ErrorBoundary,{FallbackComponent:Z.H,resetKeys:[v],children:(0,I.jsx)("div",(0,b.Z)((0,b.Z)({},s),{},{children:(0,I.jsx)(k.Z,{blockletRender:function(e){var t=(0,b.Z)((0,b.Z)({},e),{},{endpoint:v});return(0,I.jsx)(G,(0,b.Z)({},t))},baseSearch:!0,endpoint:v,locale:l,onFilterChange:function(e){m(e)},onSearchSelect:r,filters:h,extraFilter:i,serverVersion:y})}))})}G.defaultProps={endpoint:""},J.defaultProps={handleSearchSelect:null,extraFilter:void 0};var Q=(0,l.Z)(j.ZP)(K||(K=(0,r.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main})),X=n(92877),Y=n(19577),ee=n(2478),te=n(44067),ne=n(46954),re=n(49390),oe=n(22714),ae=n(45170),ie=(0,X.Z)((function(){return{buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}})),se=(0,a.forwardRef)((function(e,t){var n=e.onChange,r=e.onDelete,i=(0,p.h6)().info,s=(0,f.PE)().t,l=(0,a.useState)(!1),d=(0,o.Z)(l,2),h=d[0],x=d[1],b=(0,a.useState)(!1),v=(0,o.Z)(b,2),g=v[0],Z=v[1],k=(0,a.useState)(-1),y=(0,o.Z)(k,2),j=y[0],w=y[1],S=ie(),R=(0,c.Z)(m.W),E=(0,o.Z)(R,2),U=E[0],L=E[1],N=Math.max(i.blockletRegistryList.findIndex((function(e){return e.url===U})),0);return(0,a.useImperativeHandle)(t,(function(){return{setOpen:Z}})),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T.Z,{permission:"mutate_node",children:function(e){return(0,I.jsx)(D.Z,{disabled:!e,classes:{text:S.buttonText},color:"secondary","data-cy":"store-toggle",onClick:function(){Z(!0)},endIcon:(0,I.jsx)(re.Z,{}),children:(0,I.jsx)(u.Z,{color:"secondary",children:i.blockletRegistryList[N].name})})}}),(0,I.jsx)(M.ZP,{title:s("store.blockletRegistry.switchRegistry"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:g,onClose:function(){return Z(!1)},children:(0,I.jsxs)(Y.Z,{className:S.tabPanel,children:[i.blockletRegistryList.map((function(e,t){return(0,I.jsxs)(ee.ZP,{button:!0,disabled:h,selected:N===t,"data-cy":"store-switch",onClick:function(){h||(t!==N?function(e){try{x(!0),w(e);var t=i.blockletRegistryList[e];L(t.url),n(t.url),Z(!1)}catch(r){console.error(r),F.Z.error("".concat(s("store.blockletRegistry.changeFailed")," ").concat((0,P.Z)(r)))}finally{x(!1)}}(t):Z(!1))},children:[(0,I.jsx)(ne.Z,{className:S.iconRoot,children:j===t&&h&&(0,I.jsx)(C.Z,{size:16})}),(0,I.jsx)(te.Z,{children:(0,I.jsx)(ae.Z,{teamDid:i.did,store:e,onDelete:function(){return r(e.url)}})})]},e.url)})),(0,I.jsx)(oe.Z,{disabled:h,onAdd:n,teamDid:i.did,blockletRegistryList:i.blockletRegistryList})]})})]})}));se.defaultProps={onChange:function(){},onDelete:function(){}};var le,ce=se;function ue(){var e=(0,f.PE)().t,t=(0,p.h6)().info,n=(0,c.Z)(m.W),r=(0,o.Z)(n,1)[0],i=t.blockletRegistryList,l=i.find((function(e){return r===e.url}))||i[0],x=(0,a.useState)(l.url),b=(0,o.Z)(x,2),v=b[0],g=b[1],Z=t.routing.adminPath,k=s()(window.location.origin,Z),y=(0,a.useRef)(null);return(0,I.jsxs)(de,{children:[(0,I.jsxs)(h.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,I.jsx)(u.Z,{color:"textPrimary",children:e("common.store")}),(0,I.jsx)(ce,{ref:y,onChange:function(e){return g(e)},onDelete:function(e){var n;v===e&&g(null===(n=t.blockletRegistryList[0])||void 0===n?void 0:n.url)}})]}),(0,I.jsx)(d.Z,{className:"store-header",display:"flex",justifyContent:"space-between",p:0,m:0,children:(0,I.jsx)(u.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:e("store.headerDescription")})}),(0,I.jsx)(J,{className:"blocklet-list",handleSearchSelect:function(e){var t=e.detailUrl,n=new URL(t);n.searchParams.set("server-url",k);var r=document.createElement("a");r.setAttribute("target","_blank"),r.setAttribute("href",n.href),r.click()},storeUrl:v})]})}var de=l.Z.main(le||(le=(0,r.Z)(["\n @media (max-width: ","px) {\n .store-header {\n flex-direction: column;\n margin-bottom: 32px !important;\n }\n\n .page-header {\n margin-bottom: 16px !important;\n }\n }\n .blocklet-list {\n aside:hover {\n height: calc(100vh - 235px);\n }\n }\n"])),(function(e){return e.theme.breakpoints.values.sm}))}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[4906],{44906:function(e,t,n){n.r(t),n.d(t,{default:function(){return ue}});var r=n(71171),o=n(96234),a=n(5057),i=n(6352),s=n.n(i),l=n(33518),c=n(67654),u=n(11750),d=n(39948),h=n(39434),f=n(68420),m=n(5952),p=n(75793),x=n(59740),b=n(33028),v=n(38898),g=n(52439),Z=n(71569),k=n(61951),y=n(35432),j=n(44727),w=n(4651),P=n(74094),S=n(85493),R=n(38242),C=n(44846),D=n(28726),E=n(55916),F=n(86229),U=n(76811),L=n(23484),N=n(34937);var T=n(7199),_=n(10458),B=n.n(_),M=n(13128),W=n(73170),I=n(96266);function A(e){var t=e.meta,n=e.onCancel,r=e.handlePaySuccess,i=e.storeUrl,l=(0,f.PE)().t,c=(0,p.h6)().info,d=(0,a.useState)("both"),h=(0,o.Z)(d,2),m=h[0],x=h[1],b=(0,a.useState)(1),v=(0,o.Z)(b,2),g=v[0],Z=v[1],k=(0,P.yP)(c),y=(0,w.FM)(t,c,i),j=(0,R.getDisplayName)({meta:t});if("purchase"===m&&2===g)return(0,I.jsx)(E.default,{open:!0,popup:!0,baseUrl:i,action:"acquire-asset",checkFn:B().create({baseURL:s()(i,"/store")}).get,onSuccess:function(){r(y)},onClose:n,checkTimeout:3e5,extraParams:{factory:t.nftFactory},webWalletUrl:k,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:l("store.purchase.auth.title",{name:j}),scan:l("store.purchase.auth.scan"),confirm:l("store.purchase.auth.confirm"),success:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.Z,{gutterBottom:!0,children:l("store.purchase.auth.success")}),(0,I.jsxs)(u.Z,{variant:"subtitle2",children:[" ",l("store.purchase.autoLaunch",{name:j})]})]})}});var S=M.ZP;return(0,I.jsx)(S,{title:l("store.purchase.title",{name:j}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:function(e,t){"backdropClick"!==t&&n()},children:(0,I.jsx)("div",{style:{marginBottom:16},children:(0,I.jsx)(W.AP,{action:m,onNext:function(){m&&(Z(2),"verify"===m&&(window.location.href=y))},onSelect:function(e){e!==m&&x(e)}})})})}A.defaultProps={handlePaySuccess:function(e){setTimeout((function(){window.location.href=e}),1e3)}};var K,O=A,z=n(25339);function H(e){var t=e.meta,n=e.buttonText,r=e.storeUrl,i=(0,f.PE)().t,s=(0,S.useNavigate)(),l=(0,p.h6)().info,u=(0,z.Tt)().api,d=!1===(0,R.isFreeBlocklet)(t),h=(0,a.useState)(!1),m=(0,o.Z)(h,2),x=m[0],b=m[1],v=function(e){var t=(0,L.Z)(),n=(0,S.useNavigate)(),r=(0,c.Z)("sid:blocklet:purchase:".concat(e)),i=(0,o.Z)(r,2),s=i[0],l=i[1],u=(0,a.useState)(!1),d=(0,o.Z)(u,2),h=d[0],f=d[1],m=(0,a.useState)(null),p=(0,o.Z)(m,2),x=p[0],b=p[1],v=function(){var e=new URL(window.location.href),t=e.pathname,r=e.searchParams,o=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";r.get("sid")&&(l(""),n(t.replace(o,"/"),{replace:!0}))},g=!(!t.get("assetDid")||!s||t.get("sid")!==s);return(0,N.mU)(U.BlockletEvents.purchaseChange,(function(t){t.did===e&&(b(t.session),["declined","confirmed","error"].includes(t.session.status)&&(f(!0),setTimeout(v,2e3)))})),(0,a.useEffect)((function(){x&&x.id!==s&&l(x.id)}),[x]),{hasCompleted:h,hasPurchased:g,session:x,setSession:b,doRedirect:v}}(t.did),g=v.hasPurchased,Z=(0,a.useState)(!1),k=(0,o.Z)(Z,2),y=k[0],_=k[1],B=(0,c.Z)("instant-blocklet-install",!1),M=(0,o.Z)(B,1)[0],W=(0,a.useState)(!1),A=(0,o.Z)(W,2),K=A[0],H=A[1],V=(0,a.useMemo)((function(){return x?i(d?"blocklet.status.purchasing":"blocklet.status.waiting"):""}),[x,i,d]),q=(0,a.useMemo)((function(){return d?n.purchase:n.launch}),[d,n]),$=function(e){e.preventDefault(),e.stopPropagation();try{if(b(!0),d)return void _(!0);if(M)return void H(!0);if(!d){var n=(0,w.FM)(t,l,r);return void(window.location.href=n)}}catch(o){F.Z.error((0,P.Z)(o),{autoHideDuration:5e3}),console.error("Blocklet installed failed",o)}finally{b(!1)}};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j.Kk,{children:(0,I.jsx)(T.Z,{permission:"mutate_blocklets",children:function(e){return(0,I.jsx)(D.Z,{onClick:$,size:"small",disabled:Boolean(V||!e),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:V?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(C.Z,{size:16,style:{marginRight:3}}),V]}):q},t.did)}})}),(g||y)&&(0,I.jsx)(O,{method:"launch",meta:t,mode:"both",onCancel:function(){b(!1),_(!1)},storeUrl:r}),K&&(0,I.jsx)(E.default,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:u.get,checkTimeout:3e5,onSuccess:function(e){b(!1),H(!1),s("/blocklets/".concat(e.appDid,"/components"))},extraParams:{title:t.title,blockletMetaUrl:decodeURIComponent((0,P.Rn)(r,t.did).trim())},messages:{title:i("setup.keyPair.title"),scan:i("setup.keyPair.scan"),confirm:i("setup.keyPair.confirm"),success:i("setup.keyPair.success")},onClose:function(){b(!1),H(!1)}})]})}H.defaultProps={};var V=["storeUrl","handleSearchSelect","extraFilter"],q=function(e,t,n){var r=(0,w.RU)(t);return s()(n,"/blocklets/".concat(e.did,"/?server-url=").concat(r))},$=function(e){var t=e.meta,n=e.attribute,r=e.value;return t._formatted?t._formatted[n]:r};function G(e){var t=e.blocklet,n=e.endpoint,r=(0,f.PE)().t,o=(0,p.h6)(),a=s()(o.imgPrefix,"blocklet.png"),i=n;if(i.startsWith("http")&&t.logo)a=s()(i,(0,P.lk)(t.did,t.logo));else{var l=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");l&&(l="/".concat(l)),a=s()(l,"/blocklet/logo/".concat(t.did))}var c=(null===o||void 0===o?void 0:o.info.mode)!==y.NODE_MODES.SERVERLESS,u={meta:t,buttonText:{purchase:r("common.purchase"),launch:r("common.launch")},storeUrl:i};return(0,I.jsx)(v.Z,{href:q(t,o.info,n),style:{color:"initial",textDecoration:"none"},onClick:function(e){return!!e.currentTarget.contains(e.target)||(e.preventDefault(),!1)},target:"_blank",children:(0,I.jsx)(Q,{title:$({meta:t,attribute:"title",value:t.title||t.name}),did:t.did,description:$({meta:t,attribute:"description",value:t.description}),cover:t.logo?a:"",version:t.version,button:c?(0,I.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,I.jsx)(H,(0,b.Z)({},u))}):null})})}function J(e){var t,n=e.storeUrl,r=e.handleSearchSelect,i=e.extraFilter,s=(0,x.Z)(e,V),l=(0,f.PE)().locale,c=(0,p.h6)(),u=(0,a.useState)({}),d=(0,o.Z)(u,2),h=d[0],m=d[1],v=n,y=null===c||void 0===c||null===(t=c.info)||void 0===t?void 0:t.version;return(0,a.useEffect)((function(){m({})}),[v]),(0,I.jsx)(g.ErrorBoundary,{FallbackComponent:Z.H,resetKeys:[v],children:(0,I.jsx)("div",(0,b.Z)((0,b.Z)({},s),{},{children:(0,I.jsx)(k.Z,{blockletRender:function(e){var t=(0,b.Z)((0,b.Z)({},e),{},{endpoint:v});return(0,I.jsx)(G,(0,b.Z)({},t))},baseSearch:!0,endpoint:v,locale:l,onFilterChange:function(e){m(e)},onSearchSelect:r,filters:h,extraFilter:i,serverVersion:y})}))})}G.defaultProps={endpoint:""},J.defaultProps={handleSearchSelect:null,extraFilter:void 0};var Q=(0,l.Z)(j.ZP)(K||(K=(0,r.Z)(["\n .ms-highlight {\n color: ",";\n }\n"])),(function(e){return e.theme.palette.primary.main})),X=n(92877),Y=n(19577),ee=n(2478),te=n(44067),ne=n(46954),re=n(49390),oe=n(22714),ae=n(45170),ie=(0,X.Z)((function(){return{buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},menuName:{display:"flex",flexDirection:"column",marginRight:"100px","& span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}})),se=(0,a.forwardRef)((function(e,t){var n=e.onChange,r=e.onDelete,i=(0,p.h6)().info,s=(0,f.PE)().t,l=(0,a.useState)(!1),d=(0,o.Z)(l,2),h=d[0],x=d[1],b=(0,a.useState)(!1),v=(0,o.Z)(b,2),g=v[0],Z=v[1],k=(0,a.useState)(-1),y=(0,o.Z)(k,2),j=y[0],w=y[1],S=ie(),R=(0,c.Z)(m.W),E=(0,o.Z)(R,2),U=E[0],L=E[1],N=Math.max(i.blockletRegistryList.findIndex((function(e){return e.url===U})),0);return(0,a.useImperativeHandle)(t,(function(){return{setOpen:Z}})),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(T.Z,{permission:"mutate_node",children:function(e){return(0,I.jsx)(D.Z,{disabled:!e,classes:{text:S.buttonText},color:"secondary","data-cy":"store-toggle",onClick:function(){Z(!0)},endIcon:(0,I.jsx)(re.Z,{}),children:(0,I.jsx)(u.Z,{color:"secondary",children:i.blockletRegistryList[N].name})})}}),(0,I.jsx)(M.ZP,{title:s("store.blockletRegistry.switchRegistry"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:g,onClose:function(){return Z(!1)},children:(0,I.jsxs)(Y.Z,{className:S.tabPanel,children:[i.blockletRegistryList.map((function(e,t){return(0,I.jsxs)(ee.ZP,{button:!0,disabled:h,selected:N===t,"data-cy":"store-switch",onClick:function(){h||(t!==N?function(e){try{x(!0),w(e);var t=i.blockletRegistryList[e];L(t.url),n(t.url),Z(!1)}catch(r){console.error(r),F.Z.error("".concat(s("store.blockletRegistry.changeFailed")," ").concat((0,P.Z)(r)))}finally{x(!1)}}(t):Z(!1))},children:[(0,I.jsx)(ne.Z,{className:S.iconRoot,children:j===t&&h&&(0,I.jsx)(C.Z,{size:16})}),(0,I.jsx)(te.Z,{children:(0,I.jsx)(ae.Z,{teamDid:i.did,store:e,onDelete:function(){return r(e.url)}})})]},e.url)})),(0,I.jsx)(oe.Z,{disabled:h,onAdd:n,teamDid:i.did,blockletRegistryList:i.blockletRegistryList})]})})]})}));se.defaultProps={onChange:function(){},onDelete:function(){}};var le,ce=se;function ue(){var e=(0,f.PE)().t,t=(0,p.h6)().info,n=(0,c.Z)(m.W),r=(0,o.Z)(n,1)[0],i=t.blockletRegistryList,l=i.find((function(e){return r===e.url}))||i[0],x=(0,a.useState)(l.url),b=(0,o.Z)(x,2),v=b[0],g=b[1],Z=t.routing.adminPath,k=s()(window.location.origin,Z),y=(0,a.useRef)(null);return(0,I.jsxs)(de,{children:[(0,I.jsxs)(h.Z,{separator:"\u203a","aria-label":"breadcrumb",className:"page-breadcrumb",children:[(0,I.jsx)(u.Z,{color:"textPrimary",children:e("common.store")}),(0,I.jsx)(ce,{ref:y,onChange:function(e){return g(e)},onDelete:function(e){var n;v===e&&g(null===(n=t.blockletRegistryList[0])||void 0===n?void 0:n.url)}})]}),(0,I.jsx)(d.Z,{className:"store-header",display:"flex",justifyContent:"space-between",p:0,m:0,children:(0,I.jsx)(u.Z,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:e("store.headerDescription")})}),(0,I.jsx)(J,{className:"blocklet-list",handleSearchSelect:function(e){var t=e.detailUrl,n=new URL(t);n.searchParams.set("server-url",k);var r=document.createElement("a");r.setAttribute("target","_blank"),r.setAttribute("href",n.href),r.click()},storeUrl:v})]})}var de=l.Z.main(le||(le=(0,r.Z)(["\n @media (max-width: ","px) {\n .store-header {\n flex-direction: column;\n margin-bottom: 32px !important;\n }\n\n .page-header {\n margin-bottom: 16px !important;\n }\n }\n .blocklet-list {\n aside:hover {\n height: calc(100vh - 235px);\n }\n }\n"])),(function(e){return e.theme.breakpoints.values.sm}))}}]);
|