@abtnode/blocklet-services 1.16.43-beta-20250510-043647-0f042010 → 1.16.43
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/dist/assets/access-control-RJu7xYI3.js +1 -1
- package/dist/assets/add-component-core-DRAzXCeg.js +1 -1
- package/dist/assets/add-resource-BDJuVU8K.js +1 -1
- package/dist/assets/advanced-CFME3Vrl.js +1 -1
- package/dist/assets/audit-logs-CtFZQHby.js +1 -1
- package/dist/assets/branding-CS-f1gMT.js +1 -1
- package/dist/assets/component-C7g4FGFm.js +1 -1
- package/dist/assets/config-C8AXD1JH.js +1 -1
- package/dist/assets/config-navigation-B7r4dV5S.js +1 -1
- package/dist/assets/dashboard-C124DXmc.js +2 -2
- package/dist/assets/domain-DTrwCkop.js +1 -1
- package/dist/assets/fuel-DzWcrU-I.js +1 -1
- package/dist/assets/index--HbH1n1_.js +1 -1
- package/dist/assets/index-9ixwCOkw.js +1 -1
- package/dist/assets/index-BMPpz8ni.js +1 -1
- package/dist/assets/index-B_fwtN9z.js +1 -1
- package/dist/assets/index-CyUXddLG.js +1 -1
- package/dist/assets/index-D64RNKdt.js +1 -1
- package/dist/assets/index-DsT9i24r.js +1 -1
- package/dist/assets/index-g0L_1foA.js +1 -1
- package/dist/assets/index-u-w3iMC9.js +1 -1
- package/dist/assets/list-D1dIr8Je.js +1 -1
- package/dist/assets/overview-UIMGVO1S.js +1 -1
- package/dist/assets/runtime-BVDdcpyT.js +1 -1
- package/dist/assets/security-BQbSLSOe.js +1 -1
- package/dist/assets/setup-CifjXQIf.js +1 -1
- package/dist/assets/step-actions-Bu3Q5M4V.js +1 -1
- package/package.json +21 -21
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BVU8_1Ed.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-CN2B_oTr.js","assets/index-Bs1kxR8_.js","assets/index-u-w3iMC9.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as U,b as fe}from"./vendor-react-DEoibe3W.js";import{u as E,d as V,j as H,_ as $,Z as re,X as B,b4 as Ue,a7 as be}from"./vendor-ux-did-connect-TEE6cGq6.js";import{H as n,j as e,D as K,aj as G,I as X,t as Z,al as N,T as k,aa as u,O as T,br as C,bL as ve,bR as le,bt as ne,bS as se,X as J,ak as oe,z as ae,y as L,ab as Q,ad as Ce}from"./vendor-mui-core-UZpb7wT7.js";import{M as ce,_ as ye}from"./vendor-arcblock-CN2B_oTr.js";import{d as we}from"./Edit-BLsIdIOp.js";import{_ as Te}from"./dot-C05enzim.js";import{l as de}from"./index-CHDiquXf.js";import{z as F,E as ue,F as S,C as Se}from"./index-u-w3iMC9.js";import{u as _}from"./dashboard-C124DXmc.js";import{o as ke,c as Ie,A as ie}from"./vendor-utils-rHXShPKm.js";import{E as Re}from"./empty-spinner-BZlBh4vA.js";import{C as v}from"./click-to-copy-BxhgzyYL.js";import{D as qe}from"./delete-confirm-BBaXcAXg.js";import{b as Ae}from"./passport-item-BxfGrDcE.js";import{A as Oe}from"./actions-BCWb2ez1.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-DV3NyLhI.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAjFH6d8.js";import"./index-Ce2NSVmU.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./did-address-BKBBjFqv.js";import"./util-Bg0WSJ-t.js";import"./base32-BbrXtXL6.js";import"./MoreHoriz-BxJelL2A.js";const Pe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function pe({onCreated:r,onClose:d}){const[i,j]=U.useState(!1),{t:l}=E(),{api:s}=F(),{teamDid:b}=_(),{control:p,handleSubmit:R,formState:{errors:h},watch:x,setValue:y}=ue({defaultValues:Pe,mode:"onChange"}),m=x("scope"),I=a=>{a!=="profile:read"&&y("scope",m.includes(a)?m.filter(c=>c!==a):[...m,a])},q=async a=>{j(!0);try{const c={...a,redirectUris:a.redirectUris,contacts:a.contacts?a.contacts.split(",").map(A=>A.trim()):[],scope:a.scope.join(" ")};await s.createOAuthClient({input:{teamDid:b,input:ke(c,Ie)}}),r(c)}catch(c){$.error(c.message||"Failed to create OAuth App")}finally{j(!1)}};return e.jsxs(K,{open:!0,onClose:d,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(V,{})})]}),e.jsx(Z,{children:e.jsxs(N,{spacing:4,sx:{mt:2},children:[e.jsx(k,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(u,{children:e.jsx(S,{name:"clientName",control:p,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!h.clientName,helperText:(c=h.clientName)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.clientName")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"clientUri",control:p,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!h.clientUri,helperText:(c=h.clientUri)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.clientUri")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"redirectUris",control:p,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!h.redirectUris,helperText:(c=h.redirectUris)==null?void 0:c.message}),e.jsxs(u,{sx:{display:"flex",gap:"2px"},children:[e.jsx(C,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(C,{children:l("oauth.client.helperText.read")}),e.jsx(C,{sx:{color:"info.main"},component:"a",href:"https://www.arcblock.io/docs/blocklet-developer/en/oauth-service",target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(C,{children:l("oauth.client.helperText.more")})]})]})}})}),e.jsxs(ve,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(k,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(u,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(H.OAUTH_SCOPES).map(([a,c])=>e.jsx(ne,{control:e.jsx(se,{checked:m.includes(a),onChange:()=>I(a),disabled:a==="profile:read",color:"primary"}),label:e.jsx(u,{children:e.jsx(k,{variant:"body2",sx:{fontWeight:500},children:c})})},a))})})]}),e.jsx(J,{}),e.jsx(k,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(N,{children:e.jsx(S,{name:"contacts",control:p,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!h.contacts,helperText:(c=h.contacts)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.contacts")})]})}})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:a})=>{var c;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!h.tosUri,helperText:(c=h.tosUri)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:a})=>{var c;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!h.policyUri,helperText:(c=h.policyUri)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.policyUri")})]})}})]}),h.error&&e.jsx(oe,{severity:"error",children:h.error.message})]})}),e.jsxs(ae,{children:[e.jsx(L,{onClick:d,children:l("common.cancel")}),e.jsxs(L,{onClick:R(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Q,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}pe.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function M({scope:r,...d}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(N,{direction:"row",flexWrap:"wrap",gap:1,...d,children:i.map(j=>e.jsx(fe.Fragment,{children:e.jsx(Ce,{title:H.OAUTH_SCOPES[j],children:e.jsx(v,{children:j})})},j))})}M.propTypes={scope:n.string};M.defaultProps={scope:""};const Y=r=>{const{prefix:d}=F(),{blocklet:i}=Se(),j=ie(d,"/api/media/upload",i.appPid),l=U.useCallback(b=>b?b.startsWith("http")?b:`${ie(d,"/api/media/upload",i.appPid)}/${b}`:"",[d,i.appPid]);return{clientLogoUrl:U.useMemo(()=>l(r),[r,l]),apiPath:j,getClientLogoUrl:l}},Ne=U.lazy(()=>ye(()=>import("./index-BVU8_1Ed.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function he({client:r,onUpdate:d,onClose:i}){const[j,l]=U.useState(!1),{t:s,locale:b}=E(),p=U.useRef(null),{api:R}=F(),{teamDid:h}=_(),{control:x,handleSubmit:y,formState:{errors:m},watch:I,setValue:q,getValues:a}=ue({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||""},mode:"onChange"}),c=I("scope"),A=I("logoUri"),{clientLogoUrl:w,apiPath:z}=Y(A),D=t=>{t!=="profile:read"&&q("scope",c.includes(t)?c.filter(o=>o!==t):[...c,t])},P=async t=>{const o={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(g=>g.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(g=>g.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri};await R.updateOAuthClient({input:{teamDid:h,input:o}})},f=async t=>{l(!0);try{await P(t),d(),i()}catch(o){$.error(o.message||s("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(K,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(V,{})})]}),e.jsx(Z,{children:e.jsxs(N,{spacing:3,sx:{mt:2},children:[e.jsxs(u,{sx:{mb:3},children:[e.jsx(k,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(u,{children:[e.jsx(u,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:w?e.jsx(u,{children:e.jsx("img",{src:w,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(u,{onClick:()=>{var t;(t=p.current)==null||t.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ce,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(L,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var t;(t=p.current)==null||t.open()},children:s(w?"common.change":"common.upload")})]}),e.jsx(u,{sx:{display:"flex",alignItems:"center"},children:e.jsx(U.Suspense,{fallback:e.jsx(Re,{}),children:e.jsx(Ne,{ref:p,locale:b,popup:!0,onUploadFinish:t=>{q("logoUri",t.data.filename),P(a()).then(()=>{d()}).catch(o=>{$.error(o.message||s("oauth.client.updateFailed"))}).finally(()=>{var o;(o=p.current)==null||o.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:z,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(k,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(T,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(u,{children:e.jsx(S,{name:"clientName",control:x,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:(o=m.clientName)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"clientUri",control:x,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:(o=m.clientUri)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"redirectUris",control:x,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:(o=m.redirectUris)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(k,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(u,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(H.OAUTH_SCOPES).map(([t,o])=>e.jsx(ne,{control:e.jsx(se,{checked:c.includes(t),onChange:()=>D(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(u,{children:e.jsx(k,{variant:"body2",sx:{fontWeight:500},children:o})})},t))})})]}),e.jsx(J,{}),e.jsx(k,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(u,{children:e.jsx(S,{name:"contacts",control:x,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:(o=m.contacts)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:x,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>{var o;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{...t,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:(o=m.tosUri)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:x,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>{var o;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{...t,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:(o=m.policyUri)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.policyUri")})]})}})]}),m.error&&e.jsx(oe,{severity:"error",children:m.error.message})]})}),e.jsxs(ae,{children:[e.jsx(L,{onClick:i,children:s("common.cancel")}),e.jsx(L,{onClick:y(f),disabled:j,variant:"contained",color:"primary",children:j?e.jsx(Q,{size:16}):s("common.update")})]})]})}he.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function me({client:r,onUpdate:d,onClose:i}){return e.jsx(he,{client:r,onUpdate:j=>d(j),onClose:i})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function ee(r){const{t:d}=E(),{api:i}=F(),{teamDid:j}=_(),{clientId:l,clientName:s,onDelete:b=()=>{},onClose:p=()=>{}}=r,R=()=>{p()},h=async()=>{try{await i.deleteOAuthClient({input:{teamDid:j,clientId:l}}),b()}catch(y){$.error(y==null?void 0:y.message)}finally{R()}},x={keyName:s,title:d("oauth.client.delete.title"),description:d("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:d("oauth.client.delete.description",{name:s}),confirm:d("common.delConfirm"),cancel:d("common.cancel"),onConfirm:h,onCancel:R};return e.jsx(qe,{keyName:x.keyName,title:x.title,description:x.description,confirmPlaceholder:x.confirmPlaceholder,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})}ee.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};ee.defaultProps={onDelete:()=>{},onClose:()=>{}};function xe({title:r,items:d}){return e.jsxs(u,{mb:3,children:[e.jsx(k,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(N,{spacing:1.5,children:d.map(({label:i,value:j})=>e.jsxs(u,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(k,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(k,{sx:{wordBreak:"break-all"},children:j||"-"})]},i))})]})}xe.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function je({client:r,onClose:d}){const{t:i}=E(),{teamDid:j}=_(),{clientName:l,clientId:s,clientSecret:b,redirectUris:p,scope:R,clientUri:h,logoUri:x,contacts:y,tosUri:m,policyUri:I,jwksUri:q,jwks:a,softwareId:c,softwareVersion:A,clientIdIssuedAt:w,clientSecretExpiresAt:z,updatedAt:D,createUser:P}=r,{clientLogoUrl:f}=Y(x),t=O=>{try{const W=new URL(window.blocklet.appUrl);return W.pathname=O,W.toString()}catch{return"-"}},o=de.fromAppDid(s,j),g=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:l},{label:i("oauth.client.logoUri"),value:e.jsx(re,{variant:"rounded",shape:"square",src:f,did:o.address,size:64})},{label:i("oauth.client.clientUri"),value:h?e.jsx(v,{children:h}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(v,{children:s})},{label:i("oauth.client.clientSecret"),value:e.jsx(v,{children:b})},{label:i("oauth.client.redirectUris"),value:e.jsx(v,{children:(p||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:R})},{label:i("oauth.client.createUser"),value:P?Ae(P,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(v,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/authorize")})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/token")})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/userinfo")})},{label:i("oauth.client.jwksUri"),value:e.jsx(v,{children:t("/.well-known/service/oauth/jwks")})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/register")})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/logout")})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:y.length?e.jsx(v,{children:(y||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:m?e.jsx(v,{children:m}):"-"},{label:i("oauth.client.policyUri"),value:I?e.jsx(v,{children:I}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:a},{label:i("oauth.client.softwareId"),value:c},{label:i("oauth.client.softwareVersion"),value:A}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:w?e.jsx(B,{value:w*1e3}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:z?e.jsx(B,{value:z*1e3}):"-"},{label:i("common.updatedAt"),value:D?e.jsx(B,{value:D}):"-"}]}].filter(Boolean);return e.jsxs(K,{open:!0,onClose:d,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(V,{})})]}),e.jsx(Z,{children:e.jsx(u,{mt:1,children:g.map((O,W)=>e.jsxs(u,{children:[e.jsx(xe,{title:O.title,items:O.items}),W!==g.length-1&&e.jsx(J,{sx:{my:2}})]},O.title))})})]})}je.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function We(r){return e.jsx(B,{value:r*1e3})}function te({selected:r,onClose:d}){return r?e.jsx(je,{client:r,onClose:d}):null}te.propTypes={selected:n.object,onClose:n.func.isRequired};te.defaultProps={selected:null};function ge({open:r,onCreated:d,onClose:i}){return r?e.jsx(pe,{onCreated:d,onClose:i}):null}ge.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function bt(){var P;const[r,d]=U.useState({searchText:"",pageSize:10,page:1}),[i,j]=U.useState(null),[l,s]=U.useState(!1),b=U.useRef(null),{t:p}=E(),{api:R}=F(),{teamDid:h}=_(),[x,y]=U.useState(null),[m,I]=U.useState(null),{getClientLogoUrl:q}=Y(),a=Te(async()=>await R.getOAuthClients({input:{teamDid:h,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:c}=a,A=U.useMemo(()=>{var f;return((f=a.value)==null?void 0:f.list)||[]},[(P=a.value)==null?void 0:P.list]),w=U.useMemo(()=>r.searchText?A.filter(f=>f.clientName.toLowerCase().includes(r.searchText.toLowerCase())||f.clientId.toLowerCase().includes(r.searchText.toLowerCase())||f.scope.toLowerCase().includes(r.searchText.toLowerCase())):A,[r.searchText,A]),z=U.useMemo(()=>[{label:p("oauth.client.name"),name:"clientName",options:{customBodyRender:(f,{rowIndex:t})=>{const o=w[t],g=q(o.logoUri),O=de.fromAppDid(o.clientId,h);return e.jsx(u,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(u,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},onClick:W=>{W.stopPropagation(),window.open(o.clientUri,"_blank")},children:[e.jsx(re,{variant:"rounded",shape:"square",did:O.address,src:g,size:48}),e.jsxs(N,{gap:.5,children:[e.jsx(u,{sx:{color:"text.primary"},children:o.clientName}),e.jsx(u,{sx:{color:"text.secondary"},children:o.clientUri})]})]})})}}},{label:p("oauth.client.clientId"),name:"clientId"},{label:p("oauth.client.scope"),name:"scope",options:{customBodyRender:f=>e.jsx(M,{scope:f})}},{label:p("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:We}},{label:p("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(f,{rowIndex:t})=>{const o=w[t];return e.jsx(Oe,{actions:[{icon:e.jsx(we,{}),text:p("common.edit"),onClick:g=>{g.stopPropagation(),y(o)}},{icon:e.jsx(Ue,{}),text:p("common.delete"),onClick:g=>{g.stopPropagation(),I(o)}}]})}}}],[w,p,q,h,y,I]),D=({page:f,rowsPerPage:t,searchText:o})=>{r.pageSize!==t?d(g=>({...g,searchText:"",pageSize:t,page:1})):r.page!==f+1?d(g=>({...g,searchText:"",page:f+1})):r.searchText!==o&&d(g=>({...g,searchText:o,page:1}))};return e.jsxs(u,{ref:b,sx:{".custom-toobar-btns":{gap:"8px"}},children:[e.jsx(be,{data:w,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:w.length,searchDebounceTime:400,onRowClick(f,{dataIndex:t},o){var g;if((g=b.current)!=null&&g.contains(o.target)){const O=w[t];j(O)}}},onChange:D,customButtons:[e.jsxs(L,{variant:"contained",size:"small",onClick:()=>s(!0),children:[c?e.jsx(Q,{size:16}):e.jsx(ce,{style:{fontSize:16}}),p("common.create")]},"add")],loading:!1}),e.jsx(te,{selected:i,onClose:()=>j(null)}),e.jsx(ge,{open:l,onCreated:()=>{s(!1),a.retry()},onClose:()=>s(!1)}),x&&e.jsx(me,{client:x,onUpdate:a.retry,onClose:()=>y(null)}),m&&e.jsx(ee,{...m,onDelete:a.retry,onClose:()=>I(null)})]})}export{bt as default};
|
|
2
|
+
import{r as U,b as fe}from"./vendor-react-DEoibe3W.js";import{u as E,d as V,j as H,_ as $,Z as re,X as B,b4 as Ue,a7 as be}from"./vendor-ux-did-connect-TEE6cGq6.js";import{H as n,j as e,D as K,aj as G,I as X,t as Z,al as N,T as k,aa as u,O as T,br as C,bL as ve,bR as le,bt as ne,bS as se,X as J,ak as oe,z as ae,y as L,ab as Q,ad as Ce}from"./vendor-mui-core-UZpb7wT7.js";import{M as ce,_ as ye}from"./vendor-arcblock-CN2B_oTr.js";import{d as we}from"./Edit-BLsIdIOp.js";import{_ as Te}from"./dot-C05enzim.js";import{l as de}from"./index-CHDiquXf.js";import{z as F,E as ue,F as S,C as Se}from"./index-u-w3iMC9.js";import{u as _}from"./dashboard-C124DXmc.js";import{o as ke,c as Ie,A as ie}from"./vendor-utils-rHXShPKm.js";import{E as Re}from"./empty-spinner-BZlBh4vA.js";import{C as v}from"./click-to-copy-BxhgzyYL.js";import{D as qe}from"./delete-confirm-BBaXcAXg.js";import{b as Ae}from"./passport-item-BxfGrDcE.js";import{A as Oe}from"./actions-BCWb2ez1.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-DV3NyLhI.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./index-Ce2NSVmU.js";import"./Phone-CoX1qzAs.js";import"./Location-C__VfR4D.js";import"./Email-DOy8vL0N.js";import"./Timezone-CCdgxxpv.js";import"./did-address-BKBBjFqv.js";import"./util-Bg0WSJ-t.js";import"./base32-BbrXtXL6.js";import"./MoreHoriz-BxJelL2A.js";const Pe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function pe({onCreated:r,onClose:d}){const[i,j]=U.useState(!1),{t:l}=E(),{api:s}=F(),{teamDid:b}=_(),{control:p,handleSubmit:R,formState:{errors:h},watch:x,setValue:y}=ue({defaultValues:Pe,mode:"onChange"}),m=x("scope"),I=a=>{a!=="profile:read"&&y("scope",m.includes(a)?m.filter(c=>c!==a):[...m,a])},q=async a=>{j(!0);try{const c={...a,redirectUris:a.redirectUris,contacts:a.contacts?a.contacts.split(",").map(A=>A.trim()):[],scope:a.scope.join(" ")};await s.createOAuthClient({input:{teamDid:b,input:ke(c,Ie)}}),r(c)}catch(c){$.error(c.message||"Failed to create OAuth App")}finally{j(!1)}};return e.jsxs(K,{open:!0,onClose:d,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(V,{})})]}),e.jsx(Z,{children:e.jsxs(N,{spacing:4,sx:{mt:2},children:[e.jsx(k,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(u,{children:e.jsx(S,{name:"clientName",control:p,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!h.clientName,helperText:(c=h.clientName)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.clientName")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"clientUri",control:p,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!h.clientUri,helperText:(c=h.clientUri)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.clientUri")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"redirectUris",control:p,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!h.redirectUris,helperText:(c=h.redirectUris)==null?void 0:c.message}),e.jsxs(u,{sx:{display:"flex",gap:"2px"},children:[e.jsx(C,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(C,{children:l("oauth.client.helperText.read")}),e.jsx(C,{sx:{color:"info.main"},component:"a",href:"https://www.arcblock.io/docs/blocklet-developer/en/oauth-service",target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(C,{children:l("oauth.client.helperText.more")})]})]})}})}),e.jsxs(ve,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(k,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(u,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(H.OAUTH_SCOPES).map(([a,c])=>e.jsx(ne,{control:e.jsx(se,{checked:m.includes(a),onChange:()=>I(a),disabled:a==="profile:read",color:"primary"}),label:e.jsx(u,{children:e.jsx(k,{variant:"body2",sx:{fontWeight:500},children:c})})},a))})})]}),e.jsx(J,{}),e.jsx(k,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(N,{children:e.jsx(S,{name:"contacts",control:p,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:a})=>{var c;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!h.contacts,helperText:(c=h.contacts)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.contacts")})]})}})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:a})=>{var c;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!h.tosUri,helperText:(c=h.tosUri)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:a})=>{var c;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...a,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!h.policyUri,helperText:(c=h.policyUri)==null?void 0:c.message}),e.jsx(C,{children:l("oauth.client.helperText.policyUri")})]})}})]}),h.error&&e.jsx(oe,{severity:"error",children:h.error.message})]})}),e.jsxs(ae,{children:[e.jsx(L,{onClick:d,children:l("common.cancel")}),e.jsxs(L,{onClick:R(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Q,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}pe.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function M({scope:r,...d}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(N,{direction:"row",flexWrap:"wrap",gap:1,...d,children:i.map(j=>e.jsx(fe.Fragment,{children:e.jsx(Ce,{title:H.OAUTH_SCOPES[j],children:e.jsx(v,{children:j})})},j))})}M.propTypes={scope:n.string};M.defaultProps={scope:""};const Y=r=>{const{prefix:d}=F(),{blocklet:i}=Se(),j=ie(d,"/api/media/upload",i.appPid),l=U.useCallback(b=>b?b.startsWith("http")?b:`${ie(d,"/api/media/upload",i.appPid)}/${b}`:"",[d,i.appPid]);return{clientLogoUrl:U.useMemo(()=>l(r),[r,l]),apiPath:j,getClientLogoUrl:l}},Ne=U.lazy(()=>ye(()=>import("./index-BVU8_1Ed.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function he({client:r,onUpdate:d,onClose:i}){const[j,l]=U.useState(!1),{t:s,locale:b}=E(),p=U.useRef(null),{api:R}=F(),{teamDid:h}=_(),{control:x,handleSubmit:y,formState:{errors:m},watch:I,setValue:q,getValues:a}=ue({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||""},mode:"onChange"}),c=I("scope"),A=I("logoUri"),{clientLogoUrl:w,apiPath:z}=Y(A),D=t=>{t!=="profile:read"&&q("scope",c.includes(t)?c.filter(o=>o!==t):[...c,t])},P=async t=>{const o={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(g=>g.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(g=>g.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri};await R.updateOAuthClient({input:{teamDid:h,input:o}})},f=async t=>{l(!0);try{await P(t),d(),i()}catch(o){$.error(o.message||s("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(K,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(V,{})})]}),e.jsx(Z,{children:e.jsxs(N,{spacing:3,sx:{mt:2},children:[e.jsxs(u,{sx:{mb:3},children:[e.jsx(k,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(u,{children:[e.jsx(u,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:w?e.jsx(u,{children:e.jsx("img",{src:w,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(u,{onClick:()=>{var t;(t=p.current)==null||t.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ce,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(L,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var t;(t=p.current)==null||t.open()},children:s(w?"common.change":"common.upload")})]}),e.jsx(u,{sx:{display:"flex",alignItems:"center"},children:e.jsx(U.Suspense,{fallback:e.jsx(Re,{}),children:e.jsx(Ne,{ref:p,locale:b,popup:!0,onUploadFinish:t=>{q("logoUri",t.data.filename),P(a()).then(()=>{d()}).catch(o=>{$.error(o.message||s("oauth.client.updateFailed"))}).finally(()=>{var o;(o=p.current)==null||o.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:z,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(k,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(T,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(u,{children:e.jsx(S,{name:"clientName",control:x,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:(o=m.clientName)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"clientUri",control:x,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:(o=m.clientUri)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(u,{children:e.jsx(S,{name:"redirectUris",control:x,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:(o=m.redirectUris)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(k,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(u,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(H.OAUTH_SCOPES).map(([t,o])=>e.jsx(ne,{control:e.jsx(se,{checked:c.includes(t),onChange:()=>D(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(u,{children:e.jsx(k,{variant:"body2",sx:{fontWeight:500},children:o})})},t))})})]}),e.jsx(J,{}),e.jsx(k,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(u,{children:e.jsx(S,{name:"contacts",control:x,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:t})=>{var o;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...t,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:(o=m.contacts)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(N,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:x,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>{var o;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{...t,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:(o=m.tosUri)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:x,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>{var o;return e.jsxs(u,{sx:{width:"50%"},children:[e.jsx(T,{...t,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:(o=m.policyUri)==null?void 0:o.message}),e.jsx(C,{children:s("oauth.client.helperText.policyUri")})]})}})]}),m.error&&e.jsx(oe,{severity:"error",children:m.error.message})]})}),e.jsxs(ae,{children:[e.jsx(L,{onClick:i,children:s("common.cancel")}),e.jsx(L,{onClick:y(f),disabled:j,variant:"contained",color:"primary",children:j?e.jsx(Q,{size:16}):s("common.update")})]})]})}he.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function me({client:r,onUpdate:d,onClose:i}){return e.jsx(he,{client:r,onUpdate:j=>d(j),onClose:i})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function ee(r){const{t:d}=E(),{api:i}=F(),{teamDid:j}=_(),{clientId:l,clientName:s,onDelete:b=()=>{},onClose:p=()=>{}}=r,R=()=>{p()},h=async()=>{try{await i.deleteOAuthClient({input:{teamDid:j,clientId:l}}),b()}catch(y){$.error(y==null?void 0:y.message)}finally{R()}},x={keyName:s,title:d("oauth.client.delete.title"),description:d("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:d("oauth.client.delete.description",{name:s}),confirm:d("common.delConfirm"),cancel:d("common.cancel"),onConfirm:h,onCancel:R};return e.jsx(qe,{keyName:x.keyName,title:x.title,description:x.description,confirmPlaceholder:x.confirmPlaceholder,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})}ee.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};ee.defaultProps={onDelete:()=>{},onClose:()=>{}};function xe({title:r,items:d}){return e.jsxs(u,{mb:3,children:[e.jsx(k,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(N,{spacing:1.5,children:d.map(({label:i,value:j})=>e.jsxs(u,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(k,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(k,{sx:{wordBreak:"break-all"},children:j||"-"})]},i))})]})}xe.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function je({client:r,onClose:d}){const{t:i}=E(),{teamDid:j}=_(),{clientName:l,clientId:s,clientSecret:b,redirectUris:p,scope:R,clientUri:h,logoUri:x,contacts:y,tosUri:m,policyUri:I,jwksUri:q,jwks:a,softwareId:c,softwareVersion:A,clientIdIssuedAt:w,clientSecretExpiresAt:z,updatedAt:D,createUser:P}=r,{clientLogoUrl:f}=Y(x),t=O=>{try{const W=new URL(window.blocklet.appUrl);return W.pathname=O,W.toString()}catch{return"-"}},o=de.fromAppDid(s,j),g=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:l},{label:i("oauth.client.logoUri"),value:e.jsx(re,{variant:"rounded",shape:"square",src:f,did:o.address,size:64})},{label:i("oauth.client.clientUri"),value:h?e.jsx(v,{children:h}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(v,{children:s})},{label:i("oauth.client.clientSecret"),value:e.jsx(v,{children:b})},{label:i("oauth.client.redirectUris"),value:e.jsx(v,{children:(p||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:R})},{label:i("oauth.client.createUser"),value:P?Ae(P,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(v,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/authorize")})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/token")})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/userinfo")})},{label:i("oauth.client.jwksUri"),value:e.jsx(v,{children:t("/.well-known/service/oauth/jwks")})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/register")})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(v,{children:t("/.well-known/service/oauth/logout")})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:y.length?e.jsx(v,{children:(y||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:m?e.jsx(v,{children:m}):"-"},{label:i("oauth.client.policyUri"),value:I?e.jsx(v,{children:I}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:a},{label:i("oauth.client.softwareId"),value:c},{label:i("oauth.client.softwareVersion"),value:A}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:w?e.jsx(B,{value:w*1e3}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:z?e.jsx(B,{value:z*1e3}):"-"},{label:i("common.updatedAt"),value:D?e.jsx(B,{value:D}):"-"}]}].filter(Boolean);return e.jsxs(K,{open:!0,onClose:d,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:d,sx:{position:"absolute",right:8,top:8},children:e.jsx(V,{})})]}),e.jsx(Z,{children:e.jsx(u,{mt:1,children:g.map((O,W)=>e.jsxs(u,{children:[e.jsx(xe,{title:O.title,items:O.items}),W!==g.length-1&&e.jsx(J,{sx:{my:2}})]},O.title))})})]})}je.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function We(r){return e.jsx(B,{value:r*1e3})}function te({selected:r,onClose:d}){return r?e.jsx(je,{client:r,onClose:d}):null}te.propTypes={selected:n.object,onClose:n.func.isRequired};te.defaultProps={selected:null};function ge({open:r,onCreated:d,onClose:i}){return r?e.jsx(pe,{onCreated:d,onClose:i}):null}ge.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function bt(){var P;const[r,d]=U.useState({searchText:"",pageSize:10,page:1}),[i,j]=U.useState(null),[l,s]=U.useState(!1),b=U.useRef(null),{t:p}=E(),{api:R}=F(),{teamDid:h}=_(),[x,y]=U.useState(null),[m,I]=U.useState(null),{getClientLogoUrl:q}=Y(),a=Te(async()=>await R.getOAuthClients({input:{teamDid:h,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:c}=a,A=U.useMemo(()=>{var f;return((f=a.value)==null?void 0:f.list)||[]},[(P=a.value)==null?void 0:P.list]),w=U.useMemo(()=>r.searchText?A.filter(f=>f.clientName.toLowerCase().includes(r.searchText.toLowerCase())||f.clientId.toLowerCase().includes(r.searchText.toLowerCase())||f.scope.toLowerCase().includes(r.searchText.toLowerCase())):A,[r.searchText,A]),z=U.useMemo(()=>[{label:p("oauth.client.name"),name:"clientName",options:{customBodyRender:(f,{rowIndex:t})=>{const o=w[t],g=q(o.logoUri),O=de.fromAppDid(o.clientId,h);return e.jsx(u,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(u,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},onClick:W=>{W.stopPropagation(),window.open(o.clientUri,"_blank")},children:[e.jsx(re,{variant:"rounded",shape:"square",did:O.address,src:g,size:48}),e.jsxs(N,{gap:.5,children:[e.jsx(u,{sx:{color:"text.primary"},children:o.clientName}),e.jsx(u,{sx:{color:"text.secondary"},children:o.clientUri})]})]})})}}},{label:p("oauth.client.clientId"),name:"clientId"},{label:p("oauth.client.scope"),name:"scope",options:{customBodyRender:f=>e.jsx(M,{scope:f})}},{label:p("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:We}},{label:p("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(f,{rowIndex:t})=>{const o=w[t];return e.jsx(Oe,{actions:[{icon:e.jsx(we,{}),text:p("common.edit"),onClick:g=>{g.stopPropagation(),y(o)}},{icon:e.jsx(Ue,{}),text:p("common.delete"),onClick:g=>{g.stopPropagation(),I(o)}}]})}}}],[w,p,q,h,y,I]),D=({page:f,rowsPerPage:t,searchText:o})=>{r.pageSize!==t?d(g=>({...g,searchText:"",pageSize:t,page:1})):r.page!==f+1?d(g=>({...g,searchText:"",page:f+1})):r.searchText!==o&&d(g=>({...g,searchText:o,page:1}))};return e.jsxs(u,{ref:b,sx:{".custom-toobar-btns":{gap:"8px"}},children:[e.jsx(be,{data:w,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:w.length,searchDebounceTime:400,onRowClick(f,{dataIndex:t},o){var g;if((g=b.current)!=null&&g.contains(o.target)){const O=w[t];j(O)}}},onChange:D,customButtons:[e.jsxs(L,{variant:"contained",size:"small",onClick:()=>s(!0),children:[c?e.jsx(Q,{size:16}):e.jsx(ce,{style:{fontSize:16}}),p("common.create")]},"add")],loading:!1}),e.jsx(te,{selected:i,onClose:()=>j(null)}),e.jsx(ge,{open:l,onCreated:()=>{s(!1),a.retry()},onClose:()=>s(!1)}),x&&e.jsx(me,{client:x,onUpdate:a.retry,onClose:()=>y(null)}),m&&e.jsx(ee,{...m,onDelete:a.retry,onClose:()=>I(null)})]})}export{bt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,ap as re,aa as i,H as h,ah as le,ad as k,T as A,bc as ae}from"./vendor-mui-core-UZpb7wT7.js";import{r as p,b as ve}from"./vendor-react-DEoibe3W.js";import{I as u,u as _,B as je,b8 as ye,j as I}from"./vendor-ux-did-connect-TEE6cGq6.js";import{Y as be,Z as z}from"./vendor-arcblock-CN2B_oTr.js";import{d as $}from"./InfoOutlined-Dy7jTc7H.js";import{K as we}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{p as ke}from"./use-blocklet-logo-sEJnYyNL.js";import{z as Se,C as Te,K as Ie,w as Ae,l as _e,ai as Ce,t as q}from"./index-u-w3iMC9.js";import{I as Me}from"./index-C0SLCehH.js";import{_ as Re}from"./dot-C05enzim.js";import{A as $e}from"./vendor-utils-rHXShPKm.js";import{u as Be}from"./dashboard-C124DXmc.js";import{W as g}from"./did-address-BKBBjFqv.js";import{V as De}from"./status-46dMQnxA.js";import{c as ze}from"./spaces-Cp7TgoZP.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./session-6XaVDQaE.js";import"./useAsync-DV3NyLhI.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./collapse-Bn_BDlF9.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-
|
|
1
|
+
import{j as t,ap as re,aa as i,H as h,ah as le,ad as k,T as A,bc as ae}from"./vendor-mui-core-UZpb7wT7.js";import{r as p,b as ve}from"./vendor-react-DEoibe3W.js";import{I as u,u as _,B as je,b8 as ye,j as I}from"./vendor-ux-did-connect-TEE6cGq6.js";import{Y as be,Z as z}from"./vendor-arcblock-CN2B_oTr.js";import{d as $}from"./InfoOutlined-Dy7jTc7H.js";import{K as we}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{p as ke}from"./use-blocklet-logo-sEJnYyNL.js";import{z as Se,C as Te,K as Ie,w as Ae,l as _e,ai as Ce,t as q}from"./index-u-w3iMC9.js";import{I as Me}from"./index-C0SLCehH.js";import{_ as Re}from"./dot-C05enzim.js";import{A as $e}from"./vendor-utils-rHXShPKm.js";import{u as Be}from"./dashboard-C124DXmc.js";import{W as g}from"./did-address-BKBBjFqv.js";import{V as De}from"./status-46dMQnxA.js";import{c as ze}from"./spaces-Cp7TgoZP.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./session-6XaVDQaE.js";import"./useAsync-DV3NyLhI.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./collapse-Bn_BDlF9.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";import"./omit-D2k92RIF.js";import"./api-BjteVZFg.js";const qe={width:24,height:24,body:'<path fill="currentColor" d="m12 10.8l-3.9 3.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L12 10.8Z"/>'},Ee=qe,Ne={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 17a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm12 0a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2zM9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2zM6 15v-1a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v1m-6-6v3"/>'},Pe=Ne,Ue={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7a4 4 0 1 0 8 0a4 4 0 1 0-8 0M3 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2m1-17.87a4 4 0 0 1 0 7.75M21 21v-2a4 4 0 0 0-3-3.85"/>'},He=Ue,Le={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M7 12h3v4H7z"/><path d="M10 6H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-6"/><path d="M10 4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1zm4 12h2m-2-4h4"/></g>'},Ke=Le,Ve={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M19.5 7A9 9 0 0 0 12 3a8.991 8.991 0 0 0-7.484 4"/><path d="M11.5 3a16.989 16.989 0 0 0-1.826 4M12.5 3a16.989 16.989 0 0 1 1.828 4M19.5 17a9 9 0 0 1-7.5 4a8.991 8.991 0 0 1-7.484-4"/><path d="M11.5 21a16.989 16.989 0 0 1-1.826-4m2.826 4a16.989 16.989 0 0 0 1.828-4M2 10l1 4l1.5-4L6 14l1-4m10 0l1 4l1.5-4l1.5 4l1-4M9.5 10l1 4l1.5-4l1.5 4l1-4"/></g>'},Oe=Ve,Qe={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0"/><path d="M12 7v5l3 3"/></g>'},ie=Qe,We={width:24,height:24,body:'<path fill="currentColor" d="M12 14q-.825 0-1.413-.588T10 12q0-.825.588-1.413T12 10q.825 0 1.413.588T14 12q0 .825-.588 1.413T12 14Zm0 7q-3.475 0-6.025-2.288T3.05 13H5.1q.35 2.6 2.313 4.3T12 19q2.925 0 4.963-2.038T19 12q0-2.925-2.038-4.963T12 5q-1.725 0-3.225.8T6.25 8H9v2H3V4h2v2.35q1.275-1.6 3.113-2.475T12 3q1.875 0 3.513.713t2.85 1.924q1.212 1.213 1.925 2.85T21 12q0 1.875-.713 3.513t-1.924 2.85q-1.213 1.212-2.85 1.925T12 21Z"/>'},Fe=We;function E({icon:e,value:a,name:o,url:l="",animated:c=!1,LinkComponent:d=re}){const y=()=>ve.isValidElement(e)?e:t.jsx(i,{component:u,icon:e,alt:typeof o=="string"?o:"",sx:{fontSize:30}}),m=t.jsxs(t.Fragment,{children:[t.jsx(i,{className:"metric__image",children:y()}),t.jsxs(i,{children:[p.isValidElement(a)?t.jsx(i,{className:`metric__number ${c?"metric__number--animated":""}`,children:a}):t.jsx(i,{className:`metric__number ${c?"metric__number--animated":""}`,dangerouslySetInnerHTML:{__html:a}}),t.jsx(i,{className:"metric__name",children:o})]})]});return t.jsx(Ge,{children:l?t.jsx(d,{href:l,sx:{textDecoration:"none"},children:m}):m})}E.propTypes={icon:h.string.isRequired,value:h.string.isRequired,name:h.string.isRequired,url:h.string,animated:h.bool,LinkComponent:h.elementType};E.defaultProps={url:"",animated:!1,LinkComponent:re};const Ge=le("div")`
|
|
2
2
|
border-left: 1px solid ${e=>e.theme.palette.divider};
|
|
3
3
|
padding: 10px 0 10px 16px;
|
|
4
4
|
@media (max-width: ${e=>e.theme.breakpoints.values.sm}px) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h}from"./vendor-react-DEoibe3W.js";import{e as G,m as $,j as s,bL as F,T as L,aa as w,H as l,bc as C,ah as O,ad as S,co as Z,cp as v}from"./vendor-mui-core-UZpb7wT7.js";import{p as H}from"./use-blocklet-logo-sEJnYyNL.js";import{u as P,a0 as ee,I as te,a7 as ae}from"./vendor-ux-did-connect-TEE6cGq6.js";import{as as q,ax as _,z as se,C as J,f as U,aF as ne}from"./index-u-w3iMC9.js";import{b as A,aM as re}from"./vendor-utils-rHXShPKm.js";import{a5 as R}from"./vendor-arcblock-CN2B_oTr.js";import{R as K}from"./index-ftkgQlGr.js";import{B as ie}from"./bundle-avatar-Db5l8MQ4.js";import{B as oe}from"./dashboard-C124DXmc.js";import"./vendor-hooks-rDgu5KV9.js";import"./session-6XaVDQaE.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAjFH6d8.js";const Q=n=>{const g=new Date(Math.min(...n)),i=(new Date(Math.max(...n))-g)/(1e3*60);return p=>{if(i<=10){const t=(n.length-n.length%i)/i;return p%t===0}const o=(n.length-n.length%6)/6;return p%o===0}},B=n=>`${n}%`;function N({title:n,cpus:g,currentLoad:c,history:d,empty:i,onHover:p,hoverIndex:r}){const{t:o,locale:b}=P(),t=G(),e=h.useRef(null),a=A(d)?[]:d.map(u=>q(u.date,"HH:mm",b)),j=`${n||o("common.cpu")} (${Math.floor(c||0)}%)`,k=h.useCallback(()=>{p==null||p(null)},[p]);if(h.useEffect(()=>{if(!e.current||(r==null?void 0:r.ref)===e)return;const u=e.current.getEchartsInstance(),E=r==null?void 0:r.seriesIndex,T=a.findIndex(y=>y===(r==null?void 0:r.dataValue));r&&T!==-1?u.dispatchAction({type:"showTip",seriesIndex:E,dataIndex:T}):(u.dispatchAction({type:"hideTip"}),u.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[r]),!A(d)){const T={tooltip:{trigger:"axis",formatter(y){const D=y[0].data,{seriesIndex:f,dataIndex:x}=y[0];return p==null||p({seriesIndex:f,dataIndex:x,dataValue:a[x],ref:(r==null?void 0:r.ref)||e}),`${y[0].name}: <b>${B(D)}</b>`},backgroundColor:t.palette.background.paper,borderColor:t.palette.divider,textStyle:{color:t.palette.text.primary},extraCssText:`box-shadow: ${t.shadows[2]}; border-radius: 4px;`},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:a,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:Q(d.map(y=>new Date(y.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:100,interval:Math.ceil(50),axisLabel:{formatter:B}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:[{max:80,color:$(t.palette.primary.main,t.palette.mode==="dark"?.15:.08)},{min:80,max:100,color:$(t.palette.warning.main,t.palette.mode==="dark"?.18:.12)},{min:100,color:$(t.palette.error.main,t.palette.mode==="dark"?.25:.18)}]},series:[{name:"CPU Usage",type:"line",smooth:!0,symbol:"none",lineStyle:{color:t.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:d.map(y=>y.value),markLine:{silent:!0,symbol:["none","none"],lineStyle:{color:t.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${B(100)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2},data:[{yAxis:100},{yAxis:80,lineStyle:{color:t.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${B(80)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2}}]}}]};return s.jsxs(F,{sx:{p:1,position:"relative"},onMouseLeave:k,children:[s.jsx(L,{sx:{position:"absolute",top:8,left:16,zIndex:10},fontSize:"16px",fontWeight:"bold",color:"text.secondary",children:j}),s.jsx(K,{ref:e,option:T,style:{width:"100%",height:"200px"},onEvents:{globalout:k}}),s.jsxs(w,{sx:{ml:2,mt:1,fontSize:12},color:"text.secondary",children:[`${o("system.cores")}: ${(g==null?void 0:g.length)||0}`," "]})]})}return i}N.propTypes={title:l.string,cpus:l.array,currentLoad:l.number,history:l.array,empty:l.node,onHover:l.func,hoverIndex:l.number};N.defaultProps={title:"",cpus:[],currentLoad:0,history:[],empty:null,onHover:()=>{},hoverIndex:null};function V({instanceCount:n,title:g,total:c,used:d,history:i,empty:p,onHover:r,hoverIndex:o}){const{t:b,locale:t}=P(),e=G(),a=!!c,j=c-d,k=a?`(${_(d)}, ${Math.floor(d/c*100)}%)`:"",u=h.useRef(null),E=`${g||b("common.memory")} ${k}`,T=A(i)?[]:i.map(f=>q(f.date,"HH:mm",t));h.useEffect(()=>{if(!u.current||(o==null?void 0:o.ref)===u)return;const f=u.current.getEchartsInstance(),x=o==null?void 0:o.seriesIndex,M=T.findIndex(m=>m===(o==null?void 0:o.dataValue));o&&M!==-1?f.dispatchAction({type:"showTip",seriesIndex:x,dataIndex:M}):(f.dispatchAction({type:"hideTip"}),f.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[o==null?void 0:o.dataIndex]);const y=h.useCallback(()=>{r==null||r(null)},[r]);h.useEffect(()=>{if(u.current){const f=u.current.getEchartsInstance(),x=f.getDom(),M=m=>{y(m)};return x.addEventListener("mouseleave",M),()=>{x&&x.removeEventListener("mouseleave",M),f&&f.dispose()}}},[y]);const D=[];if(n&&D.push({title:b("system.instances"),metric:n}),a&&D.push({title:b("system.free"),metric:R(j,{short:!0,iec:!0})}),!A(i)){const f=Math.max(...i.map(m=>m.value),c,0),x=Math.ceil(c*.8),M={tooltip:{trigger:"axis",formatter(m){const z=m[0].data,X=R(z,{short:!0,iec:!0}),{seriesIndex:Y,dataIndex:W}=m[0];return r==null||r({seriesIndex:Y,dataIndex:W,dataValue:T[W],ref:(o==null?void 0:o.ref)||u}),`${m[0].name}: <b>${X}</b>`},backgroundColor:e.palette.background.paper,borderColor:e.palette.divider,textStyle:{color:e.palette.text.primary},extraCssText:`box-shadow: ${e.shadows[2]}; border-radius: 4px;`},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:T,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:Q(i.map(m=>new Date(m.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:f,interval:Math.ceil(f/2),axisLabel:{formatter:m=>R(m,{short:!0,iec:!0}),padding:[5,0,0,0]}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:[{max:x,color:$(e.palette.primary.main,e.palette.mode==="dark"?.15:.08)},{min:x,max:c,color:$(e.palette.warning.main,e.palette.mode==="dark"?.18:.12)},{min:c,color:$(e.palette.error.main,e.palette.mode==="dark"?.25:.18)}]},series:[{name:"Memory Usage",type:"line",smooth:!0,symbol:"none",lineStyle:{color:e.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:i.map(m=>m.value),markLine:{silent:!0,symbol:["none","none"],data:[{yAxis:c,lineStyle:{color:e.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${R(c,{short:!0,iec:!0})}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:x,lineStyle:{color:e.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${R(x,{short:!0,iec:!0})}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}}]}}]};return s.jsxs(F,{sx:{p:1,position:"relative"},onMouseLeave:y,children:[s.jsx(L,{sx:{position:"absolute",top:8,left:16,zIndex:10},fontSize:"16px",fontWeight:"bold",color:"text.secondary",children:E}),s.jsx(K,{ref:u,option:M,style:{width:"100%",height:"200px"}}),s.jsx(w,{sx:{ml:2,mt:1,fontSize:12},color:"text.secondary",children:D.map((m,z)=>s.jsxs(w,{sx:{marginLeft:z===0?0:1,display:"inline-flex"},children:[m.title,": ",m.metric]},m.title))})]})}return p}V.propTypes={title:l.string,instanceCount:l.number,total:l.number,used:l.number,history:l.array,empty:l.node,onHover:l.func,hoverIndex:l.number};V.defaultProps={title:"",instanceCount:null,total:null,used:null,history:[],empty:null,onHover:()=>{},hoverIndex:null};function I({blocklet:n,...g}){const{t:c}=P(),{info:d}=se(),{runtimeHistory:i}=J(),[p,r]=h.useState(null),o=h.useCallback(t=>n.status!=="running"?s.jsx(L,{children:c("blocklet.runtimeInfo.noRunning")}):t.length?null:s.jsx(ee,{children:c("common.empty")}),[n.status,c]),b=h.useCallback(t=>{r(t)},[]);return i.length===0?s.jsx(L,{children:c("blocklet.runtimeInfo.noRunning")}):s.jsxs(le,{component:"div",...g,children:[s.jsxs(C,{className:"page-metrics",container:!0,spacing:5,children:[s.jsx(C,{item:!0,xs:12,sx:{pt:"16px !important"},children:s.jsx(L,{fontSize:"16px",fontWeight:"bold",children:"CPU"})}),i==null?void 0:i.map(t=>{var e,a;return s.jsx(C,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:s.jsx(N,{title:`${t.name} CPU`,empty:o(t.cpu),currentLoad:((e=t.appRuntimeInfo)==null?void 0:e.cpuUsage)||0,cpus:((a=t.appRuntimeInfo)==null?void 0:a.cpus)||[],history:t.cpu,onHover:b,hoverIndex:p,style:{height:150}})},`${t.key}-cpu`)})]}),s.jsxs(C,{className:"page-metrics",container:!0,spacing:5,sx:{mt:1},children:[s.jsx(C,{item:!0,xs:12,sx:{pt:"16px !important"},children:s.jsx(L,{fontSize:"16px",fontWeight:"bold",children:"Memory"})}),i==null?void 0:i.map(t=>{var e,a,j;return s.jsx(C,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:s.jsx(V,{title:`${t.name} Memory`,empty:o(t.memory),total:(e=d.runtimeConfig)!=null&&e.blockletMaxMemoryLimit?R.parseSize(`${d.runtimeConfig.blockletMaxMemoryLimit*(t.key===((a=n==null?void 0:n.meta)==null?void 0:a.did)?i.length-1:1)}MiB`):0,used:((j=t.appRuntimeInfo)==null?void 0:j.memoryUsage)||0,history:t.memory,onHover:b,hoverIndex:p,style:{height:150}})},`${t.key}-memory`)})]})]})}I.propTypes={blocklet:l.object.isRequired,cpuHistory:l.arrayOf(l.shape({date:l.number,value:l.number})),memoryHistory:l.arrayOf(l.shape({date:l.number,value:l.number}))};I.defaultProps={cpuHistory:[],memoryHistory:[]};const le=O(L)``;function ce(){const{t:n,locale:g}=P(),[c,d]=h.useState(6),{blocklet:i,actions:{refreshBlocklet:p}}=J(),r=h.useMemo(()=>{const t=[];return U.forEachBlockletSync(i,(e,{ancestors:a,id:j,level:k})=>{var u;(u=e==null?void 0:e.meta)!=null&&u.did&&e.meta.did!==i.meta.did&&t.push({type:"blocklet",groupId:i.meta.did,groupName:U.getDisplayName(i),id:j,name:U.getDisplayName(e,!0),blocklet:i,component:e,level:k-1>=0?k-1:0,runtimeInfo:e.runtimeInfo,ancestors:a})}),t},[i]);h.useEffect(()=>{p({hours:c});const t=setInterval(()=>{p({hours:c})},1e3*10);return()=>{clearInterval(t)}},[c]);const o=t=>H(Number(t||0),{locale:ne(g)}),b=[{label:n("common.name"),name:"name",options:{customBodyRenderLite(t){const{name:e,component:a,level:j,ancestors:k}=r[t];return s.jsxs(w,{display:"flex",alignItems:"center",pl:j*2,children:[s.jsx(ie,{size:20,blocklet:a,ancestors:k}),s.jsx(w,{ml:1,children:e}),s.jsx(oe,{variant:"pin",style:{marginLeft:8},status:a.status,source:a.source,progress:a.progress})]})}}},{label:n("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):o(e==null?void 0:e.uptime)}}},{label:n("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):_((e==null?void 0:e.memoryUsage)||0)}}},{label:n("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):`${((e==null?void 0:e.cpuUsage)||0).toFixed(1)}%`}}},{label:n("analytics.runtime"),name:"runtimeInfo.runtime",options:{customBodyRenderLite(t){const{runtimeInfo:e}=r[t];return e!=null&&e.uptime?s.jsxs(w,{display:"flex",alignItems:"center",children:[s.jsx(te,{icon:e!=null&&e.runningDocker?"catppuccin:docker-ignore":"logos:nodejs-icon"}),s.jsx(w,{ml:1,children:e!=null&&e.runningDocker?"Docker":"Nodejs"})]}):null}}},{label:n("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):e==null?void 0:e.pid}}},{label:n("blocklet.runtimeInfo.port"),name:"runtimeInfo.port",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):e==null?void 0:e.port}}}];return s.jsxs(me,{component:"div",children:[s.jsxs(w,{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2,children:[s.jsx(L,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:2,children:n("analytics.trend")}),s.jsx(Z,{size:"small",exclusive:!0,value:c,onChange:(t,e)=>{re(e)&&d(e)},children:[1,3,6,12,24].map(t=>s.jsxs(v,{value:t,children:[t,"H"]},t))})]}),s.jsx(w,{children:s.jsx(I,{blocklet:i})}),s.jsx(w,{mt:3,children:s.jsx(ae,{title:n("analytics.detail"),className:"monitor-table",locale:g,data:r,columns:b,options:{search:!1,download:!1,filter:!1,print:!1,viewColumns:!1,pagination:!1,rowsPerPage:100}})})]})}ce.propTypes={};const me=O(L)``;export{ce as default};
|
|
1
|
+
import{r as h}from"./vendor-react-DEoibe3W.js";import{e as G,m as $,j as s,bL as F,T as L,aa as w,H as l,bc as C,ah as O,ad as S,co as Z,cp as v}from"./vendor-mui-core-UZpb7wT7.js";import{p as H}from"./use-blocklet-logo-sEJnYyNL.js";import{u as P,a0 as ee,I as te,a7 as ae}from"./vendor-ux-did-connect-TEE6cGq6.js";import{as as q,ax as _,z as se,C as J,f as U,aF as ne}from"./index-u-w3iMC9.js";import{b as A,aM as re}from"./vendor-utils-rHXShPKm.js";import{a5 as R}from"./vendor-arcblock-CN2B_oTr.js";import{R as K}from"./index-ftkgQlGr.js";import{B as ie}from"./bundle-avatar-Db5l8MQ4.js";import{B as oe}from"./dashboard-C124DXmc.js";import"./vendor-hooks-rDgu5KV9.js";import"./session-6XaVDQaE.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";const Q=n=>{const g=new Date(Math.min(...n)),i=(new Date(Math.max(...n))-g)/(1e3*60);return p=>{if(i<=10){const t=(n.length-n.length%i)/i;return p%t===0}const o=(n.length-n.length%6)/6;return p%o===0}},B=n=>`${n}%`;function N({title:n,cpus:g,currentLoad:c,history:d,empty:i,onHover:p,hoverIndex:r}){const{t:o,locale:b}=P(),t=G(),e=h.useRef(null),a=A(d)?[]:d.map(u=>q(u.date,"HH:mm",b)),j=`${n||o("common.cpu")} (${Math.floor(c||0)}%)`,k=h.useCallback(()=>{p==null||p(null)},[p]);if(h.useEffect(()=>{if(!e.current||(r==null?void 0:r.ref)===e)return;const u=e.current.getEchartsInstance(),E=r==null?void 0:r.seriesIndex,T=a.findIndex(y=>y===(r==null?void 0:r.dataValue));r&&T!==-1?u.dispatchAction({type:"showTip",seriesIndex:E,dataIndex:T}):(u.dispatchAction({type:"hideTip"}),u.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[r]),!A(d)){const T={tooltip:{trigger:"axis",formatter(y){const D=y[0].data,{seriesIndex:f,dataIndex:x}=y[0];return p==null||p({seriesIndex:f,dataIndex:x,dataValue:a[x],ref:(r==null?void 0:r.ref)||e}),`${y[0].name}: <b>${B(D)}</b>`},backgroundColor:t.palette.background.paper,borderColor:t.palette.divider,textStyle:{color:t.palette.text.primary},extraCssText:`box-shadow: ${t.shadows[2]}; border-radius: 4px;`},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:a,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:Q(d.map(y=>new Date(y.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:100,interval:Math.ceil(50),axisLabel:{formatter:B}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:[{max:80,color:$(t.palette.primary.main,t.palette.mode==="dark"?.15:.08)},{min:80,max:100,color:$(t.palette.warning.main,t.palette.mode==="dark"?.18:.12)},{min:100,color:$(t.palette.error.main,t.palette.mode==="dark"?.25:.18)}]},series:[{name:"CPU Usage",type:"line",smooth:!0,symbol:"none",lineStyle:{color:t.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:d.map(y=>y.value),markLine:{silent:!0,symbol:["none","none"],lineStyle:{color:t.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${B(100)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2},data:[{yAxis:100},{yAxis:80,lineStyle:{color:t.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${B(80)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2}}]}}]};return s.jsxs(F,{sx:{p:1,position:"relative"},onMouseLeave:k,children:[s.jsx(L,{sx:{position:"absolute",top:8,left:16,zIndex:10},fontSize:"16px",fontWeight:"bold",color:"text.secondary",children:j}),s.jsx(K,{ref:e,option:T,style:{width:"100%",height:"200px"},onEvents:{globalout:k}}),s.jsxs(w,{sx:{ml:2,mt:1,fontSize:12},color:"text.secondary",children:[`${o("system.cores")}: ${(g==null?void 0:g.length)||0}`," "]})]})}return i}N.propTypes={title:l.string,cpus:l.array,currentLoad:l.number,history:l.array,empty:l.node,onHover:l.func,hoverIndex:l.number};N.defaultProps={title:"",cpus:[],currentLoad:0,history:[],empty:null,onHover:()=>{},hoverIndex:null};function V({instanceCount:n,title:g,total:c,used:d,history:i,empty:p,onHover:r,hoverIndex:o}){const{t:b,locale:t}=P(),e=G(),a=!!c,j=c-d,k=a?`(${_(d)}, ${Math.floor(d/c*100)}%)`:"",u=h.useRef(null),E=`${g||b("common.memory")} ${k}`,T=A(i)?[]:i.map(f=>q(f.date,"HH:mm",t));h.useEffect(()=>{if(!u.current||(o==null?void 0:o.ref)===u)return;const f=u.current.getEchartsInstance(),x=o==null?void 0:o.seriesIndex,M=T.findIndex(m=>m===(o==null?void 0:o.dataValue));o&&M!==-1?f.dispatchAction({type:"showTip",seriesIndex:x,dataIndex:M}):(f.dispatchAction({type:"hideTip"}),f.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:-1}))},[o==null?void 0:o.dataIndex]);const y=h.useCallback(()=>{r==null||r(null)},[r]);h.useEffect(()=>{if(u.current){const f=u.current.getEchartsInstance(),x=f.getDom(),M=m=>{y(m)};return x.addEventListener("mouseleave",M),()=>{x&&x.removeEventListener("mouseleave",M),f&&f.dispose()}}},[y]);const D=[];if(n&&D.push({title:b("system.instances"),metric:n}),a&&D.push({title:b("system.free"),metric:R(j,{short:!0,iec:!0})}),!A(i)){const f=Math.max(...i.map(m=>m.value),c,0),x=Math.ceil(c*.8),M={tooltip:{trigger:"axis",formatter(m){const z=m[0].data,X=R(z,{short:!0,iec:!0}),{seriesIndex:Y,dataIndex:W}=m[0];return r==null||r({seriesIndex:Y,dataIndex:W,dataValue:T[W],ref:(o==null?void 0:o.ref)||u}),`${m[0].name}: <b>${X}</b>`},backgroundColor:e.palette.background.paper,borderColor:e.palette.divider,textStyle:{color:e.palette.text.primary},extraCssText:`box-shadow: ${e.shadows[2]}; border-radius: 4px;`},grid:{top:"48px",left:"16px",right:"16px",bottom:"0px",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:T,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{interval:Q(i.map(m=>new Date(m.date)))}},yAxis:{type:"value",axisTick:{show:!1},splitLine:{show:!1},min:0,max:f,interval:Math.ceil(f/2),axisLabel:{formatter:m=>R(m,{short:!0,iec:!0}),padding:[5,0,0,0]}},visualMap:{show:!1,type:"piecewise",dimension:1,seriesIndex:0,pieces:[{max:x,color:$(e.palette.primary.main,e.palette.mode==="dark"?.15:.08)},{min:x,max:c,color:$(e.palette.warning.main,e.palette.mode==="dark"?.18:.12)},{min:c,color:$(e.palette.error.main,e.palette.mode==="dark"?.25:.18)}]},series:[{name:"Memory Usage",type:"line",smooth:!0,symbol:"none",lineStyle:{color:e.palette.primary.main,width:2.5},areaStyle:{},itemStyle:{},emphasis:{disabled:!0},data:i.map(m=>m.value),markLine:{silent:!0,symbol:["none","none"],data:[{yAxis:c,lineStyle:{color:e.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${R(c,{short:!0,iec:!0})}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:x,lineStyle:{color:e.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${R(x,{short:!0,iec:!0})}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}}]}}]};return s.jsxs(F,{sx:{p:1,position:"relative"},onMouseLeave:y,children:[s.jsx(L,{sx:{position:"absolute",top:8,left:16,zIndex:10},fontSize:"16px",fontWeight:"bold",color:"text.secondary",children:E}),s.jsx(K,{ref:u,option:M,style:{width:"100%",height:"200px"}}),s.jsx(w,{sx:{ml:2,mt:1,fontSize:12},color:"text.secondary",children:D.map((m,z)=>s.jsxs(w,{sx:{marginLeft:z===0?0:1,display:"inline-flex"},children:[m.title,": ",m.metric]},m.title))})]})}return p}V.propTypes={title:l.string,instanceCount:l.number,total:l.number,used:l.number,history:l.array,empty:l.node,onHover:l.func,hoverIndex:l.number};V.defaultProps={title:"",instanceCount:null,total:null,used:null,history:[],empty:null,onHover:()=>{},hoverIndex:null};function I({blocklet:n,...g}){const{t:c}=P(),{info:d}=se(),{runtimeHistory:i}=J(),[p,r]=h.useState(null),o=h.useCallback(t=>n.status!=="running"?s.jsx(L,{children:c("blocklet.runtimeInfo.noRunning")}):t.length?null:s.jsx(ee,{children:c("common.empty")}),[n.status,c]),b=h.useCallback(t=>{r(t)},[]);return i.length===0?s.jsx(L,{children:c("blocklet.runtimeInfo.noRunning")}):s.jsxs(le,{component:"div",...g,children:[s.jsxs(C,{className:"page-metrics",container:!0,spacing:5,children:[s.jsx(C,{item:!0,xs:12,sx:{pt:"16px !important"},children:s.jsx(L,{fontSize:"16px",fontWeight:"bold",children:"CPU"})}),i==null?void 0:i.map(t=>{var e,a;return s.jsx(C,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:s.jsx(N,{title:`${t.name} CPU`,empty:o(t.cpu),currentLoad:((e=t.appRuntimeInfo)==null?void 0:e.cpuUsage)||0,cpus:((a=t.appRuntimeInfo)==null?void 0:a.cpus)||[],history:t.cpu,onHover:b,hoverIndex:p,style:{height:150}})},`${t.key}-cpu`)})]}),s.jsxs(C,{className:"page-metrics",container:!0,spacing:5,sx:{mt:1},children:[s.jsx(C,{item:!0,xs:12,sx:{pt:"16px !important"},children:s.jsx(L,{fontSize:"16px",fontWeight:"bold",children:"Memory"})}),i==null?void 0:i.map(t=>{var e,a,j;return s.jsx(C,{item:!0,lg:4,md:6,sm:6,xs:12,sx:{pt:"16px !important"},children:s.jsx(V,{title:`${t.name} Memory`,empty:o(t.memory),total:(e=d.runtimeConfig)!=null&&e.blockletMaxMemoryLimit?R.parseSize(`${d.runtimeConfig.blockletMaxMemoryLimit*(t.key===((a=n==null?void 0:n.meta)==null?void 0:a.did)?i.length-1:1)}MiB`):0,used:((j=t.appRuntimeInfo)==null?void 0:j.memoryUsage)||0,history:t.memory,onHover:b,hoverIndex:p,style:{height:150}})},`${t.key}-memory`)})]})]})}I.propTypes={blocklet:l.object.isRequired,cpuHistory:l.arrayOf(l.shape({date:l.number,value:l.number})),memoryHistory:l.arrayOf(l.shape({date:l.number,value:l.number}))};I.defaultProps={cpuHistory:[],memoryHistory:[]};const le=O(L)``;function ce(){const{t:n,locale:g}=P(),[c,d]=h.useState(6),{blocklet:i,actions:{refreshBlocklet:p}}=J(),r=h.useMemo(()=>{const t=[];return U.forEachBlockletSync(i,(e,{ancestors:a,id:j,level:k})=>{var u;(u=e==null?void 0:e.meta)!=null&&u.did&&e.meta.did!==i.meta.did&&t.push({type:"blocklet",groupId:i.meta.did,groupName:U.getDisplayName(i),id:j,name:U.getDisplayName(e,!0),blocklet:i,component:e,level:k-1>=0?k-1:0,runtimeInfo:e.runtimeInfo,ancestors:a})}),t},[i]);h.useEffect(()=>{p({hours:c});const t=setInterval(()=>{p({hours:c})},1e3*10);return()=>{clearInterval(t)}},[c]);const o=t=>H(Number(t||0),{locale:ne(g)}),b=[{label:n("common.name"),name:"name",options:{customBodyRenderLite(t){const{name:e,component:a,level:j,ancestors:k}=r[t];return s.jsxs(w,{display:"flex",alignItems:"center",pl:j*2,children:[s.jsx(ie,{size:20,blocklet:a,ancestors:k}),s.jsx(w,{ml:1,children:e}),s.jsx(oe,{variant:"pin",style:{marginLeft:8},status:a.status,source:a.source,progress:a.progress})]})}}},{label:n("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):o(e==null?void 0:e.uptime)}}},{label:n("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):_((e==null?void 0:e.memoryUsage)||0)}}},{label:n("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):`${((e==null?void 0:e.cpuUsage)||0).toFixed(1)}%`}}},{label:n("analytics.runtime"),name:"runtimeInfo.runtime",options:{customBodyRenderLite(t){const{runtimeInfo:e}=r[t];return e!=null&&e.uptime?s.jsxs(w,{display:"flex",alignItems:"center",children:[s.jsx(te,{icon:e!=null&&e.runningDocker?"catppuccin:docker-ignore":"logos:nodejs-icon"}),s.jsx(w,{ml:1,children:e!=null&&e.runningDocker?"Docker":"Nodejs"})]}):null}}},{label:n("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):e==null?void 0:e.pid}}},{label:n("blocklet.runtimeInfo.port"),name:"runtimeInfo.port",options:{customBodyRenderLite(t){const{runtimeInfo:e,component:a}=r[t];return!(a!=null&&a.status)||a.status!=="running"?s.jsx(S,{title:n("common.noData"),children:"--"}):e==null?void 0:e.port}}}];return s.jsxs(me,{component:"div",children:[s.jsxs(w,{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2,children:[s.jsx(L,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:2,children:n("analytics.trend")}),s.jsx(Z,{size:"small",exclusive:!0,value:c,onChange:(t,e)=>{re(e)&&d(e)},children:[1,3,6,12,24].map(t=>s.jsxs(v,{value:t,children:[t,"H"]},t))})]}),s.jsx(w,{children:s.jsx(I,{blocklet:i})}),s.jsx(w,{mt:3,children:s.jsx(ae,{title:n("analytics.detail"),className:"monitor-table",locale:g,data:r,columns:b,options:{search:!1,download:!1,filter:!1,print:!1,viewColumns:!1,pagination:!1,rowsPerPage:100}})})]})}ce.propTypes={};const me=O(L)``;export{ce as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Ie,I as Y,b2 as It,j as N,_ as Q,am as Gt,B as Yt,a6 as Jt,a7 as Qt,r as io,c5 as sn,as as so}from"./vendor-ux-did-connect-TEE6cGq6.js";import{a as Dt,m as jt,u as E,f as er,l as ln}from"./vendor-hooks-rDgu5KV9.js";import{r as H,a as ee,g as lo}from"./vendor-react-DEoibe3W.js";import{H as D,j as a,aa as k,ad as G,I as he,bu as Rt,e as $t,O as te,N as co,y as Xe,T as uo,a9 as A,cJ as fo,cK as po,cL as mo,cM as re,c6 as ue,cN as cn,cO as tr,cP as rr,cQ as ho,cR as un,cS as vo,cT as yo,b3 as xe,cU as go,cV as bo,cW as xo,cX as _o,cY as Po,cZ as Co,c_ as jo,c$ as Ro,d0 as Oo,d1 as wo,d2 as To,bp as ge,bR as Mt,bt as be,bS as Pt,br as qo,E as Mo,bL as So,C as Io,bX as Do,bv as dn,bw as fn,al as $o,ah as ko}from"./vendor-mui-core-UZpb7wT7.js";import{n as Se,P as St,aK as Wo,D as Ct,A as Bo,aB as dr,M as pn,I as Ce,o as mn}from"./vendor-utils-rHXShPKm.js";import{C as kt,z as Wt,E as nr,F as ce}from"./index-u-w3iMC9.js";import{S as Lt}from"./simple-select-C-wGUGQR.js";import{c as Ao,u as hn}from"./dashboard-C124DXmc.js";import{A as vn}from"./config-qG8JCIJ_.js";import{u as Ho}from"./use-mobile-Bh8CHBbH.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CN2B_oTr.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAjFH6d8.js";const Lo={width:24,height:24,body:'<path fill="currentColor" d="M11 14.2V6q0-.425.288-.713T12 5q.425 0 .713.288T13 6v8.2l2.9-2.9q.275-.275.7-.275t.7.275q.275.275.275.7t-.275.7l-4.6 4.6q-.3.3-.7.3t-.7-.3l-4.6-4.6q-.275-.275-.275-.7t.275-.7q.275-.275.7-.275t.7.275l2.9 2.9Z"/>'},Eo={width:24,height:24,body:'<path fill="currentColor" d="m11 8.8l-2.9 2.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L13 8.8V17q0 .425-.288.713T12 18q-.425 0-.713-.288T11 17V8.8Z"/>'},or={width:24,height:24,body:'<path fill="currentColor" d="M7 21q-.825 0-1.413-.588T5 19V6q-.425 0-.713-.288T4 5q0-.425.288-.713T5 4h4q0-.425.288-.713T10 3h4q.425 0 .713.288T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6v13q0 .825-.588 1.413T17 21H7Zm2-4h2V8H9v9Zm4 0h2V8h-2v9Z"/>'},ar={width:24,height:24,body:'<path fill="currentColor" d="M4 21q-.425 0-.713-.288T3 20v-2.425q0-.4.15-.763t.425-.637L16.2 3.575q.3-.275.663-.425t.762-.15q.4 0 .775.15t.65.45L20.425 5q.3.275.437.65T21 6.4q0 .4-.138.763t-.437.662l-12.6 12.6q-.275.275-.638.425t-.762.15H4ZM17.6 7.8L19 6.4L17.6 5l-1.4 1.4l1.4 1.4Z"/>'};function yn({enabled:e,showUp:d=!0,showDown:o=!0,showSwitch:n=!0,showDelete:i=!0,showEdit:c=!0,disableEdit:m=!1,disableSwitch:t=!1,onClickUp:r=()=>{},onClickDown:s=()=>{},onClickSwitch:u=()=>{},onClickDelete:P=()=>{},onClickEdit:v=()=>{}}){const{t:x}=Ie();return a.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:0},onClick:w=>w.stopPropagation(),children:[c?a.jsx(G,{title:x("common.edit"),children:a.jsx(he,{size:"small",onClick:v,color:"success",disabled:m,children:a.jsx(Y,{icon:ar,fontSize:18})})}):null,i?a.jsx(G,{title:x("common.delete"),children:a.jsx(he,{size:"small",onClick:P,color:"error",children:a.jsx(Y,{icon:or,fontSize:18})})}):null,n?a.jsx(G,{title:x(e?"common.enabled":"common.disabled"),children:a.jsx(Rt,{size:"small",checked:e,onClick:u,disabled:t})}):null,d?a.jsx(G,{title:x("common.moveUp"),children:a.jsx(he,{size:"small",onClick:r,disabled:m,children:a.jsx(Y,{icon:Eo,fontSize:20})})}):null,o?a.jsx(G,{title:x("common.moveDown"),children:a.jsx(he,{size:"small",onClick:s,disabled:m,children:a.jsx(Y,{icon:Lo,fontSize:20})})}):null]})}yn.propTypes={enabled:D.bool.isRequired,showUp:D.bool,showDown:D.bool,showSwitch:D.bool,showDelete:D.bool,showEdit:D.bool,disableEdit:D.bool,disableSwitch:D.bool,onClickUp:D.func,onClickDown:D.func,onClickSwitch:D.func,onClickDelete:D.func,onClickEdit:D.func};const zo=H.forwardRef((e,d)=>{var O,q,B;const{t:o}=H.useContext(It),{blocklet:n}=kt(),{api:i}=Wt(),c=(O=n==null?void 0:n.meta)==null?void 0:O.did,m=$t(),t=((B=(q=m==null?void 0:m.transitions)==null?void 0:q.duration)==null?void 0:B.leavingScreen)||300,r=Dt({mode:"add",show:!1,isDefaultRule:!1,callback:Se,get dialogTitle(){return this.mode==="edit"?o("securityRule.edit"):this.mode==="view"?o("securityRule.view"):o("securityRule.add")}}),s=jt(async()=>{const{accessPolicies:M}=await i.getBlockletAccessPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),u=jt(async()=>{const{responseHeaderPolicies:M}=await i.getBlockletResponseHeaderPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),{handleSubmit:P,control:v,watch:x,setValue:w,getValues:S,reset:I,formState:{errors:R}}=nr({mode:"onChange",defaultValues:{componentDid:"",pathPattern:"",responseHeaderPolicyId:"",accessPolicyId:"",remark:""}}),p=E(()=>{I(),r.mode="add"}),C=E(()=>{r.show=!1,setTimeout(()=>{p()},t)}),y=E((M,T=null)=>{r.show=!0,T&&(r.isDefaultRule=T.id===N.SECURITY_RULE_DEFAULT_ID,r.mode="edit",w("componentDid",T.componentDid),w("pathPattern",T.pathPattern),w("responseHeaderPolicyId",T.responseHeaderPolicyId),w("accessPolicyId",T.accessPolicyId),w("remark",T.remark||"")),M?r.callback=M:r.mode="view",s.run(),u.run()});H.useImperativeHandle(d,()=>({open:y,close:C}),[y,C]);const f=E(()=>{const[M,T]=S(["accessPolicyId","responseHeaderPolicyId"]);return!M&&!T?o("securityRule.form.accessPolicyOrResponseHeaderPolicyRequired"):!0}),b=E(M=>{const T=f();T===!0?r.callback(M,C):Q.error(T)}),_=x("componentDid"),h=E(M=>{const T=M==null?void 0:M.trim();if(!T)return o("common.requiredErrorText",{name:o("securityRule.form.pathPattern")});if(_){if(T.startsWith("/"))return o("securityRule.form.pathPatternErrorText")}else if(!T.startsWith("/")&&T!=="*")return o("securityRule.form.pathPatternErrorText");return!0}),l=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.accessPolicy")})),g=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.responseHeaderPolicy")})),j=er(()=>{const T=((n==null?void 0:n.children)||[]).find($=>$.meta.did===_);return T!=null&&T.mountPoint?Wo(T.mountPoint):null},[n,_]);return a.jsx(Gt,{open:r.show,title:r.dialogTitle,onClose:C,PaperProps:{style:{minHeight:"unset"}},actions:a.jsx(Yt,{color:"primary",autoFocus:!0,variant:"contained",onClick:P(b),children:o("common.confirm")}),children:a.jsxs("form",{noValidate:!0,autoComplete:"off",children:[r.isDefaultRule?null:a.jsx(ce,{name:"componentDid",control:v,render:({field:M})=>{var T,$;return a.jsx(Lt,{fullWidth:!0,margin:"dense",size:"small",label:o("securityRule.form.component"),placeholer:o("securityRule.form.componentPlaceholder"),options:n.children.map(L=>({title:L.meta.title,value:L.meta.did,description:L.mountPoint})),error:!!((T=R==null?void 0:R.componentDid)!=null&&T.message),helperText:(($=R==null?void 0:R.componentDid)==null?void 0:$.message)||"Choose belong to component",...Ct(M,"ref"),readOnly:r.mode==="view"})}}),a.jsx(ce,{name:"pathPattern",control:v,rules:{validate:h},render:({field:M})=>{var T,$;return a.jsx(te,{fullWidth:!0,required:!0,margin:"dense",size:"small",placeholder:o("securityRule.form.pathPatternPlaceholder"),label:o("securityRule.form.pathPattern"),error:!!((T=R==null?void 0:R.pathPattern)!=null&&T.message),helperText:(($=R==null?void 0:R.pathPattern)==null?void 0:$.message)||"/abc/bcd or /abc or /abc/*",InputProps:{startAdornment:j?a.jsx(co,{position:"start",children:j}):null},...M,disabled:r.isDefaultRule||r.mode==="view"})}}),a.jsx(ce,{name:"accessPolicyId",control:v,rules:{validate:r.isDefaultRule?l:Se},render:({field:M})=>{var T,$;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.accessPolicy"),placeholer:o("securityRule.form.accessPolicyPlaceholder"),options:(s.data||[]).map(L=>({value:L.id,title:L.name,description:L.description})),error:!!((T=R==null?void 0:R.accessPolicyId)!=null&&T.message),helperText:(($=R==null?void 0:R.accessPolicyId)==null?void 0:$.message)||o("securityRule.form.accessPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"responseHeaderPolicyId",control:v,rules:{validate:r.isDefaultRule?g:Se},render:({field:M})=>{var T,$;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.responseHeaderPolicy"),placeholer:o("securityRule.form.responseHeaderPolicyPlaceholder"),options:(u.data||[]).map(L=>({title:L.name,value:L.id,description:L.description})),error:!!((T=R==null?void 0:R.responseHeaderPolicyId)!=null&&T.message),helperText:(($=R==null?void 0:R.responseHeaderPolicyId)==null?void 0:$.message)||o("securityRule.form.responseHeaderPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"remark",control:v,render:({field:M})=>a.jsx(te,{fullWidth:!0,multiline:!0,minRows:3,maxRows:7,size:"small",margin:"dense",placeholder:o("securityRule.form.remarkPlaceholder"),label:o("securityRule.form.remark"),helperText:R==null?void 0:R.message,...M,disabled:r.mode==="view"})})]})})}),se=async(e,d="Failed to saved")=>{try{await e()}catch(o){Q.error((o==null?void 0:o.message)||d)}};function gn(){var h;const{t:e,locale:d}=Ie(),{blocklet:o}=kt(),{api:n}=Wt(),i=(h=o==null?void 0:o.meta)==null?void 0:h.did,c=$t(),m=H.useRef(null),t=H.useRef(null),{confirmApi:r,confirmHolder:s}=Jt(),u=jt(async()=>{const{securityRules:l}=await n.getBlockletSecurityRules({input:{did:i,includeDisabled:!0}});return l}),P=l=>l.id===N.SECURITY_RULE_DEFAULT_ID,v=E(l=>{var j;return(j=((o==null?void 0:o.children)||[]).find(O=>O.meta.did===l))==null?void 0:j.mountPoint}),x=(u.data||[]).map(l=>{if(l.componentDid){const g=v(l.componentDid);l._disabled=g===void 0}return l}),w=x.filter(l=>!P(l)),S=(l,g)=>{se(async()=>{const j=l.target.checked;await n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,enabled:j}}}),Q.success(e("common.succeeded")),u.run()})},I=(l,g,j)=>{se(async()=>{const O=j-1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},R=(l,g,j)=>{se(async()=>{const O=j+1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},p=()=>{m.current.open((l,g)=>{se(async()=>{await n.addBlockletSecurityRule({input:{did:i,data:l}}),Q.success(e("common.succeeded")),u.run(),g()})})},C=(l,g)=>{m.current.open((j,O)=>{se(async()=>{await n.updateBlockletSecurityRule({input:{did:i,data:{...j,id:g.id}}}),Q.success(e("common.succeeded")),u.run(),O()})},g)},y=(l,g)=>{r.open({title:e("securityRule.delete.title"),content:e("securityRule.delete.description"),confirmButtonText:e("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:e("common.cancel"),onConfirm(j){se(async()=>{await n.deleteBlockletSecurityRule({input:{did:i,id:g.id}}),Q.success(e("common.succeeded")),u.run(),j()})}})},f={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(l,{dataIndex:g},j){var O;if((O=t.current)!=null&&O.contains(j.target)){const q=x[g];m.current.open(void 0,q)}},setRowProps:(l,g)=>x[g]._disabled?{title:e("securityRule.useless"),style:{backgroundColor:c.palette.action.disabledBackground,cursor:"default"}}:{}},b=[a.jsx(Xe,{size:"small",variant:"outlined",onClick:()=>{u.run()},sx:{mr:1},children:e("common.refresh")},"refresh"),a.jsx(Xe,{size:"small",variant:"contained",onClick:p,children:e("common.add")})],_=[{label:e("securityRule.form.pathPattern"),name:"pathPattern",options:{customBodyRenderLite(l){const g=x[l];return a.jsx(k,{sx:{whiteSpace:"nowrap"},children:g.id===N.SECURITY_RULE_DEFAULT_ID?"Default":Bo(v(g.componentDid),g.pathPattern)})}}},{label:e("responseHeaderPolicy.title"),name:"responseHeaderPolicy",options:{customBodyRenderLite(l){var j;return(j=x[l].responseHeaderPolicy)==null?void 0:j.name}}},{label:e("accessPolicy.title"),name:"accessPolicyId",options:{customBodyRenderLite(l){var j;return(j=x[l].accessPolicy)==null?void 0:j.name}}},{label:e("securityRule.form.remark"),name:"remark"},{label:e("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(l){const g=x[l],j=P(g);return a.jsx(yn,{disableEdit:g._disabled,disableSwitch:g._disabled,enabled:g.enabled,showSwitch:!j,showDelete:!j,showUp:l>0&&!j,showDown:l<w.length-1&&!j,onClickSwitch:O=>{S(O,g)},onClickUp:O=>{I(O,g,l)},onClickDown:O=>{R(O,g,l)},onClickEdit:O=>{C(O,g)},onClickDelete:O=>{y(O,g)}})}}}].filter(Boolean);return a.jsxs(k,{sx:{display:"flex",flexDirection:"column",gap:2},ref:t,children:[a.jsx(Qt,{verticalKeyWidth:100,locale:d,title:a.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:1},children:[e("securityRule.title")," ",a.jsx(uo,{variant:"body2",children:e("securityRule.sortByDescription")})]}),data:x,columns:_,customButtons:b,options:f,loading:u.loading}),a.jsx(zo,{ref:m}),s]})}gn.propTypes={};const bn={width:24,height:24,body:'<path fill="currentColor" d="M5 21q-.825 0-1.413-.588T3 19V5q0-.825.588-1.413T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.588 1.413T19 21H5Zm0-2h14V7H5v12Zm7-2q-2.05 0-3.663-1.113T6 13q.725-1.775 2.337-2.888T12 9q2.05 0 3.663 1.113T18 13q-.725 1.775-2.337 2.888T12 17Zm0-2.5q-.625 0-1.063-.438T10.5 13q0-.625.438-1.063T12 11.5q.625 0 1.063.438T13.5 13q0 .625-.438 1.063T12 14.5Zm0 1q1.05 0 1.775-.725T14.5 13q0-1.05-.725-1.775T12 10.5q-1.05 0-1.775.725T9.5 13q0 1.05.725 1.775T12 15.5Z"/>'};var ir={},Fo=A;Object.defineProperty(ir,"__esModule",{value:!0});var xn=ir.default=void 0,No=Fo(io()),Vo=a;xn=ir.default=(0,No.default)((0,Vo.jsx)("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"}),"GroupRemove");var _n={},Te={};const je=ee(fo),Ke=ee(po);var Et={},Je={},Ae={};const Re=ee(mo);var Tt={},fr;function Uo(){if(fr)return Tt;fr=1;var e=A;Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.default=o;var d=e(re);function o(n,i){return(0,d.default)({toolbar:{minHeight:56,[n.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[n.up("sm")]:{minHeight:64}}},i)}return Tt}var _e={},Qe={},pr;function Xo(){if(pr)return Qe;pr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=void 0;const e={black:"#000",white:"#fff"};return Qe.default=e,Qe}var et={},mr;function Ko(){if(mr)return et;mr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.default=void 0;const e={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};return et.default=e,et}var tt={},hr;function Zo(){if(hr)return tt;hr=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.default=void 0;const e={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"};return tt.default=e,tt}var rt={},vr;function Go(){if(vr)return rt;vr=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.default=void 0;const e={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"};return rt.default=e,rt}var nt={},yr;function Yo(){if(yr)return nt;yr=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.default=void 0;const e={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"};return nt.default=e,nt}var ot={},gr;function Jo(){if(gr)return ot;gr=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.default=void 0;const e={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"};return ot.default=e,ot}var at={},br;function Qo(){if(br)return at;br=1,Object.defineProperty(at,"__esModule",{value:!0}),at.default=void 0;const e={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"};return at.default=e,at}var it={},xr;function ea(){if(xr)return it;xr=1,Object.defineProperty(it,"__esModule",{value:!0}),it.default=void 0;const e={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};return it.default=e,it}var _r;function ta(){if(_r)return _e;_r=1;var e=A;Object.defineProperty(_e,"__esModule",{value:!0}),_e.dark=void 0,_e.default=h,_e.light=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=rr,m=e(Xo()),t=e(Ko()),r=e(Zo()),s=e(Go()),u=e(Yo()),P=e(Jo()),v=e(Qo()),x=e(ea());const w=["mode","contrastThreshold","tonalOffset"],S=_e.light={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:m.default.white,default:m.default.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},I=_e.dark={text:{primary:m.default.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:m.default.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function R(l,g,j,O){const q=O.light||O,B=O.dark||O*1.5;l[g]||(l.hasOwnProperty(j)?l[g]=l[j]:g==="light"?l.light=(0,c.lighten)(l.main,q):g==="dark"&&(l.dark=(0,c.darken)(l.main,B)))}function p(l="light"){return l==="dark"?{main:P.default[200],light:P.default[50],dark:P.default[400]}:{main:P.default[700],light:P.default[400],dark:P.default[800]}}function C(l="light"){return l==="dark"?{main:r.default[200],light:r.default[50],dark:r.default[400]}:{main:r.default[500],light:r.default[300],dark:r.default[700]}}function y(l="light"){return l==="dark"?{main:s.default[500],light:s.default[300],dark:s.default[700]}:{main:s.default[700],light:s.default[400],dark:s.default[800]}}function f(l="light"){return l==="dark"?{main:v.default[400],light:v.default[300],dark:v.default[700]}:{main:v.default[700],light:v.default[500],dark:v.default[900]}}function b(l="light"){return l==="dark"?{main:x.default[400],light:x.default[300],dark:x.default[700]}:{main:x.default[800],light:x.default[500],dark:x.default[900]}}function _(l="light"){return l==="dark"?{main:u.default[400],light:u.default[300],dark:u.default[700]}:{main:"#ed6c02",light:u.default[500],dark:u.default[900]}}function h(l){const{mode:g="light",contrastThreshold:j=3,tonalOffset:O=.2}=l,q=(0,o.default)(l,w),B=l.primary||p(g),M=l.secondary||C(g),T=l.error||y(g),$=l.info||f(g),L=l.success||b(g),V=l.warning||_(g);function J(z){return(0,c.getContrastRatio)(z,I.text.primary)>=j?I.text.primary:S.text.primary}const U=({color:z,name:K,mainShade:de=500,lightShade:ne=300,darkShade:F=700})=>{if(z=(0,d.default)({},z),!z.main&&z[de]&&(z.main=z[de]),!z.hasOwnProperty("main"))throw new Error((0,n.default)(11,K?` (${K})`:"",de));if(typeof z.main!="string")throw new Error((0,n.default)(12,K?` (${K})`:"",JSON.stringify(z.main)));return R(z,"light",ne,O),R(z,"dark",F,O),z.contrastText||(z.contrastText=J(z.main)),z},X={dark:I,light:S};return(0,i.default)((0,d.default)({common:(0,d.default)({},m.default),mode:g,primary:U({color:B,name:"primary"}),secondary:U({color:M,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:U({color:T,name:"error"}),warning:U({color:V,name:"warning"}),info:U({color:$,name:"info"}),success:U({color:L,name:"success"}),grey:t.default,contrastThreshold:j,getContrastText:J,augmentColor:U,tonalOffset:O},X[g]),q)}return _e}var qt={},Pr;function ra(){if(Pr)return qt;Pr=1;var e=A;Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=r;var d=e(re),o=e(ue()),n=e(tr);const i=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function c(s){return Math.round(s*1e5)/1e5}const m={textTransform:"uppercase"},t='"Roboto", "Helvetica", "Arial", sans-serif';function r(s,u){const P=typeof u=="function"?u(s):u,{fontFamily:v=t,fontSize:x=14,fontWeightLight:w=300,fontWeightRegular:S=400,fontWeightMedium:I=500,fontWeightBold:R=700,htmlFontSize:p=16,allVariants:C,pxToRem:y}=P,f=(0,o.default)(P,i),b=x/14,_=y||(g=>`${g/p*b}rem`),h=(g,j,O,q,B)=>(0,d.default)({fontFamily:v,fontWeight:g,fontSize:_(j),lineHeight:O},v===t?{letterSpacing:`${c(q/j)}em`}:{},B,C),l={h1:h(w,96,1.167,-1.5),h2:h(w,60,1.2,-.5),h3:h(S,48,1.167,0),h4:h(S,34,1.235,.25),h5:h(S,24,1.334,0),h6:h(I,20,1.6,.15),subtitle1:h(S,16,1.75,.15),subtitle2:h(I,14,1.57,.1),body1:h(S,16,1.5,.15),body2:h(S,14,1.43,.15),button:h(I,14,1.75,.4,m),caption:h(S,12,1.66,.4),overline:h(S,12,2.66,1,m),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,n.default)((0,d.default)({htmlFontSize:p,pxToRem:_,fontFamily:v,fontSize:x,fontWeightLight:w,fontWeightRegular:S,fontWeightMedium:I,fontWeightBold:R},l),f,{clone:!1})}return qt}var st={},Cr;function na(){if(Cr)return st;Cr=1,Object.defineProperty(st,"__esModule",{value:!0}),st.default=void 0;const e=.2,d=.14,o=.12;function n(...c){return[`${c[0]}px ${c[1]}px ${c[2]}px ${c[3]}px rgba(0,0,0,${e})`,`${c[4]}px ${c[5]}px ${c[6]}px ${c[7]}px rgba(0,0,0,${d})`,`${c[8]}px ${c[9]}px ${c[10]}px ${c[11]}px rgba(0,0,0,${o})`].join(",")}const i=["none",n(0,2,1,-1,0,1,1,0,0,1,3,0),n(0,3,1,-2,0,2,2,0,0,1,5,0),n(0,3,3,-2,0,3,4,0,0,1,8,0),n(0,2,4,-1,0,4,5,0,0,1,10,0),n(0,3,5,-1,0,5,8,0,0,1,14,0),n(0,3,5,-1,0,6,10,0,0,1,18,0),n(0,4,5,-2,0,7,10,1,0,2,16,1),n(0,5,5,-3,0,8,10,1,0,3,14,2),n(0,5,6,-3,0,9,12,1,0,3,16,2),n(0,6,6,-3,0,10,14,1,0,4,18,3),n(0,6,7,-4,0,11,15,1,0,4,20,3),n(0,7,8,-4,0,12,17,2,0,5,22,4),n(0,7,8,-4,0,13,19,2,0,5,24,4),n(0,7,9,-4,0,14,21,2,0,5,26,4),n(0,8,9,-5,0,15,22,2,0,6,28,5),n(0,8,10,-5,0,16,24,2,0,6,30,5),n(0,8,11,-5,0,17,26,2,0,6,32,5),n(0,9,11,-5,0,18,28,2,0,7,34,6),n(0,9,12,-6,0,19,29,2,0,7,36,6),n(0,10,13,-6,0,20,31,3,0,8,38,7),n(0,10,13,-6,0,21,33,3,0,8,40,7),n(0,10,14,-6,0,22,35,3,0,8,42,7),n(0,11,14,-7,0,23,36,3,0,9,44,8),n(0,11,15,-7,0,24,38,3,0,9,46,8)];return st.default=i,st}var Pe={},jr;function oa(){if(jr)return Pe;jr=1;var e=A;Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.default=r,Pe.easing=Pe.duration=void 0;var d=e(ue()),o=e(re);const n=["duration","easing","delay"],i=Pe.easing={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},c=Pe.duration={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function m(s){return`${Math.round(s)}ms`}function t(s){if(!s)return 0;const u=s/36;return Math.round((4+15*u**.25+u/5)*10)}function r(s){const u=(0,o.default)({},i,s.easing),P=(0,o.default)({},c,s.duration),v=(x=["all"],w={})=>{const{duration:S=P.standard,easing:I=u.easeInOut,delay:R=0}=w;return(0,d.default)(w,n),(Array.isArray(x)?x:[x]).map(p=>`${p} ${typeof S=="string"?S:m(S)} ${I} ${typeof R=="string"?R:m(R)}`).join(",")};return(0,o.default)({getAutoHeightDuration:t,create:v},s,{easing:u,duration:P})}return Pe}var lt={},Rr;function aa(){if(Rr)return lt;Rr=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.default=void 0;const e={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};return lt.default=e,lt}var Or;function ia(){if(Or)return Ae;Or=1;var e=A;Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.createMuiTheme=R,Ae.default=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=S(un),m=e(ho);e(Re);var t=e(Uo()),r=e(ta()),s=e(ra()),u=e(na()),P=e(oa()),v=e(aa());const x=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function w(p){if(typeof WeakMap!="function")return null;var C=new WeakMap,y=new WeakMap;return(w=function(f){return f?y:C})(p)}function S(p,C){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var y=w(C);if(y&&y.has(p))return y.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var _ in p)if(_!=="default"&&Object.prototype.hasOwnProperty.call(p,_)){var h=b?Object.getOwnPropertyDescriptor(p,_):null;h&&(h.get||h.set)?Object.defineProperty(f,_,h):f[_]=p[_]}return f.default=p,y&&y.set(p,f),f}function I(p={},...C){const{mixins:y={},palette:f={},transitions:b={},typography:_={}}=p,h=(0,o.default)(p,x);if(p.vars&&p.generateCssVars===void 0)throw new Error((0,n.default)(18));const l=(0,r.default)(f),g=(0,m.default)(p);let j=(0,i.default)(g,{mixins:(0,t.default)(g.breakpoints,y),palette:l,shadows:u.default.slice(),typography:(0,s.default)(l,_),transitions:(0,P.default)(b),zIndex:(0,d.default)({},v.default)});return j=(0,i.default)(j,h),j=C.reduce((O,q)=>(0,i.default)(O,q),j),j.unstable_sxConfig=(0,d.default)({},c.unstable_defaultSxConfig,h==null?void 0:h.unstable_sxConfig),j.unstable_sx=function(q){return(0,c.default)({sx:q,theme:this})},j}function R(...p){return I(...p)}return Ae.default=I,Ae}var wr;function sa(){if(wr)return Je;wr=1;var e=A;Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=void 0;var d=e(ia());const o=(0,d.default)();return Je.default=o,Je}var ct={},Tr;function la(){return Tr||(Tr=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.default=void 0,ct.default="$$material"),ct}var ut={},dt={},qr;function Pn(){if(qr)return dt;qr=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.default=void 0;function e(d){return d!=="ownerState"&&d!=="theme"&&d!=="sx"&&d!=="as"}return dt.default=e,dt}var Mr;function ca(){if(Mr)return ut;Mr=1;var e=A;Object.defineProperty(ut,"__esModule",{value:!0}),ut.default=void 0;var d=e(Pn());const o=n=>(0,d.default)(n)&&n!=="classes";return ut.default=o,ut}var Sr;function De(){return Sr||(Sr=1,function(e){"use client";var d=A;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,Object.defineProperty(e,"rootShouldForwardProp",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"slotShouldForwardProp",{enumerable:!0,get:function(){return m.default}});var o=d(vo),n=d(sa()),i=d(la()),c=d(ca()),m=d(Pn());const t=(0,o.default)({themeId:i.default,defaultTheme:n.default,rootShouldForwardProp:c.default});e.default=t}(Et)),Et}var zt={},He={};const ua=ee(yo);var Ir;function da(){if(Ir)return He;Ir=1;var e=A;Object.defineProperty(He,"__esModule",{value:!0}),He.default=void 0,He.useDefaultProps=t;var d=e(re);c(H),e(xe);var o=c(ua),n=a;function i(r){if(typeof WeakMap!="function")return null;var s=new WeakMap,u=new WeakMap;return(i=function(P){return P?u:s})(r)}function c(r,s){if(r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var u=i(s);if(u&&u.has(r))return u.get(r);var P={__proto__:null},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in r)if(x!=="default"&&Object.prototype.hasOwnProperty.call(r,x)){var w=v?Object.getOwnPropertyDescriptor(r,x):null;w&&(w.get||w.set)?Object.defineProperty(P,x,w):P[x]=r[x]}return P.default=r,u&&u.set(r,P),P}function m(r){return(0,n.jsx)(o.default,(0,d.default)({},r))}He.default=m;function t(r){return(0,o.useDefaultProps)(r)}return He}var Dr;function $e(){return Dr||(Dr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(e,"useDefaultProps",{enumerable:!0,get:function(){return d.useDefaultProps}});var d=n(da());function o(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(o=function(t){return t?m:c})(i)}function n(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=o(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}}(zt)),zt}var ft={},$r;function sr(){if($r)return ft;$r=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.default=void 0;var e=o(H);function d(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(d=function(t){return t?m:c})(i)}function o(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=d(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}const n=e.createContext({});return ft.default=n,ft}var Ft={},qe={};const fa=ee(go),pa=ee(bo);var pt={};const ma=ee(xo);var kr;function Cn(){if(kr)return pt;kr=1;var e=A;Object.defineProperty(pt,"__esModule",{value:!0}),pt.default=void 0;var d=e(ma);return pt.default=d.default,pt}var mt={};const ha=ee(_o);var Wr;function va(){if(Wr)return mt;Wr=1;var e=A;Object.defineProperty(mt,"__esModule",{value:!0}),mt.default=void 0;var d=e(ha);return mt.default=d.default,mt}var ht={};const ya=ee(Po);var Br;function ga(){if(Br)return ht;Br=1;var e=A;Object.defineProperty(ht,"__esModule",{value:!0}),ht.default=void 0;var d=e(ya);return ht.default=d.default,ht}var le={};const ba=ee(Co),xa=ee(jo),_a=ee(Ro);var vt={},Ar;function Pa(){if(Ar)return vt;Ar=1;var e=A;Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var d=c(H);e(xe);var o=e(je),n=a;function i(t){if(typeof WeakMap!="function")return null;var r=new WeakMap,s=new WeakMap;return(i=function(u){return u?s:r})(t)}function c(t,r){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var s=i(r);if(s&&s.has(t))return s.get(t);var u={__proto__:null},P=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in t)if(v!=="default"&&Object.prototype.hasOwnProperty.call(t,v)){var x=P?Object.getOwnPropertyDescriptor(t,v):null;x&&(x.get||x.set)?Object.defineProperty(u,v,x):u[v]=t[v]}return u.default=t,s&&s.set(t,u),u}function m(t){const{className:r,classes:s,pulsate:u=!1,rippleX:P,rippleY:v,rippleSize:x,in:w,onExited:S,timeout:I}=t,[R,p]=d.useState(!1),C=(0,o.default)(r,s.ripple,s.rippleVisible,u&&s.ripplePulsate),y={width:x,height:x,top:-(x/2)+v,left:-(x/2)+P},f=(0,o.default)(s.child,R&&s.childLeaving,u&&s.childPulsate);return!w&&!R&&p(!0),d.useEffect(()=>{if(!w&&S!=null){const b=setTimeout(S,I);return()=>{clearTimeout(b)}}},[S,w,I]),(0,n.jsx)("span",{className:C,style:y,children:(0,n.jsx)("span",{className:f})})}return vt.default=m,vt}var Le={};const ke=ee(Oo);var Hr;function jn(){if(Hr)return Le;Hr=1;var e=A;Object.defineProperty(Le,"__esModule",{value:!0}),Le.default=void 0,Le.getTouchRippleUtilityClass=n;var d=e(ke),o=e(Re);function n(c){return(0,o.default)("MuiTouchRipple",c)}const i=(0,d.default)("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]);return Le.default=i,Le}var Lr;function Ca(){if(Lr)return le;Lr=1;var e=A;Object.defineProperty(le,"__esModule",{value:!0}),le.default=le.TouchRippleRoot=le.TouchRippleRipple=le.DELAY_RIPPLE=void 0;var d=e(re),o=e(ue()),n=S(H);e(xe);var i=ba,c=e(je),m=xa,t=e(_a),r=e(De()),s=$e(),u=e(Pa()),P=e(jn()),v=a;const x=["center","classes","className"];function w(h){if(typeof WeakMap!="function")return null;var l=new WeakMap,g=new WeakMap;return(w=function(j){return j?g:l})(h)}function S(h,l){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var g=w(l);if(g&&g.has(h))return g.get(h);var j={__proto__:null},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var q in h)if(q!=="default"&&Object.prototype.hasOwnProperty.call(h,q)){var B=O?Object.getOwnPropertyDescriptor(h,q):null;B&&(B.get||B.set)?Object.defineProperty(j,q,B):j[q]=h[q]}return j.default=h,g&&g.set(h,j),j}const I=550,R=le.DELAY_RIPPLE=80,p=(0,m.keyframes)`
|
|
1
|
+
import{u as Ie,I as Y,b2 as It,j as N,_ as Q,am as Gt,B as Yt,a6 as Jt,a7 as Qt,r as io,c5 as sn,as as so}from"./vendor-ux-did-connect-TEE6cGq6.js";import{a as Dt,m as jt,u as E,f as er,l as ln}from"./vendor-hooks-rDgu5KV9.js";import{r as H,a as ee,g as lo}from"./vendor-react-DEoibe3W.js";import{H as D,j as a,aa as k,ad as G,I as he,bu as Rt,e as $t,O as te,N as co,y as Xe,T as uo,a9 as A,cJ as fo,cK as po,cL as mo,cM as re,c6 as ue,cN as cn,cO as tr,cP as rr,cQ as ho,cR as un,cS as vo,cT as yo,b3 as xe,cU as go,cV as bo,cW as xo,cX as _o,cY as Po,cZ as Co,c_ as jo,c$ as Ro,d0 as Oo,d1 as wo,d2 as To,bp as ge,bR as Mt,bt as be,bS as Pt,br as qo,E as Mo,bL as So,C as Io,bX as Do,bv as dn,bw as fn,al as $o,ah as ko}from"./vendor-mui-core-UZpb7wT7.js";import{n as Se,P as St,aK as Wo,D as Ct,A as Bo,aB as dr,M as pn,I as Ce,o as mn}from"./vendor-utils-rHXShPKm.js";import{C as kt,z as Wt,E as nr,F as ce}from"./index-u-w3iMC9.js";import{S as Lt}from"./simple-select-C-wGUGQR.js";import{c as Ao,u as hn}from"./dashboard-C124DXmc.js";import{A as vn}from"./config-qG8JCIJ_.js";import{u as Ho}from"./use-mobile-BAjFH6d8.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CN2B_oTr.js";import"./useLocalStorage-C6U1Aqya.js";import"./confirm-BvUfAlkx.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-C9IFmc-j.js";import"./get-safe-url-2RcRY8gU.js";import"./session-6XaVDQaE.js";import"./use-blocklet-logo-sEJnYyNL.js";import"./InfoOutlined-Dy7jTc7H.js";import"./collapse-Bn_BDlF9.js";import"./dot-C05enzim.js";import"./useAsync-DV3NyLhI.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-Bh8CHBbH.js";const Lo={width:24,height:24,body:'<path fill="currentColor" d="M11 14.2V6q0-.425.288-.713T12 5q.425 0 .713.288T13 6v8.2l2.9-2.9q.275-.275.7-.275t.7.275q.275.275.275.7t-.275.7l-4.6 4.6q-.3.3-.7.3t-.7-.3l-4.6-4.6q-.275-.275-.275-.7t.275-.7q.275-.275.7-.275t.7.275l2.9 2.9Z"/>'},Eo={width:24,height:24,body:'<path fill="currentColor" d="m11 8.8l-2.9 2.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L13 8.8V17q0 .425-.288.713T12 18q-.425 0-.713-.288T11 17V8.8Z"/>'},or={width:24,height:24,body:'<path fill="currentColor" d="M7 21q-.825 0-1.413-.588T5 19V6q-.425 0-.713-.288T4 5q0-.425.288-.713T5 4h4q0-.425.288-.713T10 3h4q.425 0 .713.288T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6v13q0 .825-.588 1.413T17 21H7Zm2-4h2V8H9v9Zm4 0h2V8h-2v9Z"/>'},ar={width:24,height:24,body:'<path fill="currentColor" d="M4 21q-.425 0-.713-.288T3 20v-2.425q0-.4.15-.763t.425-.637L16.2 3.575q.3-.275.663-.425t.762-.15q.4 0 .775.15t.65.45L20.425 5q.3.275.437.65T21 6.4q0 .4-.138.763t-.437.662l-12.6 12.6q-.275.275-.638.425t-.762.15H4ZM17.6 7.8L19 6.4L17.6 5l-1.4 1.4l1.4 1.4Z"/>'};function yn({enabled:e,showUp:d=!0,showDown:o=!0,showSwitch:n=!0,showDelete:i=!0,showEdit:c=!0,disableEdit:m=!1,disableSwitch:t=!1,onClickUp:r=()=>{},onClickDown:s=()=>{},onClickSwitch:u=()=>{},onClickDelete:P=()=>{},onClickEdit:v=()=>{}}){const{t:x}=Ie();return a.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:0},onClick:w=>w.stopPropagation(),children:[c?a.jsx(G,{title:x("common.edit"),children:a.jsx(he,{size:"small",onClick:v,color:"success",disabled:m,children:a.jsx(Y,{icon:ar,fontSize:18})})}):null,i?a.jsx(G,{title:x("common.delete"),children:a.jsx(he,{size:"small",onClick:P,color:"error",children:a.jsx(Y,{icon:or,fontSize:18})})}):null,n?a.jsx(G,{title:x(e?"common.enabled":"common.disabled"),children:a.jsx(Rt,{size:"small",checked:e,onClick:u,disabled:t})}):null,d?a.jsx(G,{title:x("common.moveUp"),children:a.jsx(he,{size:"small",onClick:r,disabled:m,children:a.jsx(Y,{icon:Eo,fontSize:20})})}):null,o?a.jsx(G,{title:x("common.moveDown"),children:a.jsx(he,{size:"small",onClick:s,disabled:m,children:a.jsx(Y,{icon:Lo,fontSize:20})})}):null]})}yn.propTypes={enabled:D.bool.isRequired,showUp:D.bool,showDown:D.bool,showSwitch:D.bool,showDelete:D.bool,showEdit:D.bool,disableEdit:D.bool,disableSwitch:D.bool,onClickUp:D.func,onClickDown:D.func,onClickSwitch:D.func,onClickDelete:D.func,onClickEdit:D.func};const zo=H.forwardRef((e,d)=>{var O,q,B;const{t:o}=H.useContext(It),{blocklet:n}=kt(),{api:i}=Wt(),c=(O=n==null?void 0:n.meta)==null?void 0:O.did,m=$t(),t=((B=(q=m==null?void 0:m.transitions)==null?void 0:q.duration)==null?void 0:B.leavingScreen)||300,r=Dt({mode:"add",show:!1,isDefaultRule:!1,callback:Se,get dialogTitle(){return this.mode==="edit"?o("securityRule.edit"):this.mode==="view"?o("securityRule.view"):o("securityRule.add")}}),s=jt(async()=>{const{accessPolicies:M}=await i.getBlockletAccessPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),u=jt(async()=>{const{responseHeaderPolicies:M}=await i.getBlockletResponseHeaderPolicies({input:{did:c}});return St(M,T=>T.isProtected?1:0)},{manual:!0}),{handleSubmit:P,control:v,watch:x,setValue:w,getValues:S,reset:I,formState:{errors:R}}=nr({mode:"onChange",defaultValues:{componentDid:"",pathPattern:"",responseHeaderPolicyId:"",accessPolicyId:"",remark:""}}),p=E(()=>{I(),r.mode="add"}),C=E(()=>{r.show=!1,setTimeout(()=>{p()},t)}),y=E((M,T=null)=>{r.show=!0,T&&(r.isDefaultRule=T.id===N.SECURITY_RULE_DEFAULT_ID,r.mode="edit",w("componentDid",T.componentDid),w("pathPattern",T.pathPattern),w("responseHeaderPolicyId",T.responseHeaderPolicyId),w("accessPolicyId",T.accessPolicyId),w("remark",T.remark||"")),M?r.callback=M:r.mode="view",s.run(),u.run()});H.useImperativeHandle(d,()=>({open:y,close:C}),[y,C]);const f=E(()=>{const[M,T]=S(["accessPolicyId","responseHeaderPolicyId"]);return!M&&!T?o("securityRule.form.accessPolicyOrResponseHeaderPolicyRequired"):!0}),b=E(M=>{const T=f();T===!0?r.callback(M,C):Q.error(T)}),_=x("componentDid"),h=E(M=>{const T=M==null?void 0:M.trim();if(!T)return o("common.requiredErrorText",{name:o("securityRule.form.pathPattern")});if(_){if(T.startsWith("/"))return o("securityRule.form.pathPatternErrorText")}else if(!T.startsWith("/")&&T!=="*")return o("securityRule.form.pathPatternErrorText");return!0}),l=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.accessPolicy")})),g=E(M=>(M==null?void 0:M.trim())?!0:o("common.requiredErrorText",{name:o("securityRule.form.responseHeaderPolicy")})),j=er(()=>{const T=((n==null?void 0:n.children)||[]).find($=>$.meta.did===_);return T!=null&&T.mountPoint?Wo(T.mountPoint):null},[n,_]);return a.jsx(Gt,{open:r.show,title:r.dialogTitle,onClose:C,PaperProps:{style:{minHeight:"unset"}},actions:a.jsx(Yt,{color:"primary",autoFocus:!0,variant:"contained",onClick:P(b),children:o("common.confirm")}),children:a.jsxs("form",{noValidate:!0,autoComplete:"off",children:[r.isDefaultRule?null:a.jsx(ce,{name:"componentDid",control:v,render:({field:M})=>{var T,$;return a.jsx(Lt,{fullWidth:!0,margin:"dense",size:"small",label:o("securityRule.form.component"),placeholer:o("securityRule.form.componentPlaceholder"),options:n.children.map(L=>({title:L.meta.title,value:L.meta.did,description:L.mountPoint})),error:!!((T=R==null?void 0:R.componentDid)!=null&&T.message),helperText:(($=R==null?void 0:R.componentDid)==null?void 0:$.message)||"Choose belong to component",...Ct(M,"ref"),readOnly:r.mode==="view"})}}),a.jsx(ce,{name:"pathPattern",control:v,rules:{validate:h},render:({field:M})=>{var T,$;return a.jsx(te,{fullWidth:!0,required:!0,margin:"dense",size:"small",placeholder:o("securityRule.form.pathPatternPlaceholder"),label:o("securityRule.form.pathPattern"),error:!!((T=R==null?void 0:R.pathPattern)!=null&&T.message),helperText:(($=R==null?void 0:R.pathPattern)==null?void 0:$.message)||"/abc/bcd or /abc or /abc/*",InputProps:{startAdornment:j?a.jsx(co,{position:"start",children:j}):null},...M,disabled:r.isDefaultRule||r.mode==="view"})}}),a.jsx(ce,{name:"accessPolicyId",control:v,rules:{validate:r.isDefaultRule?l:Se},render:({field:M})=>{var T,$;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.accessPolicy"),placeholer:o("securityRule.form.accessPolicyPlaceholder"),options:(s.data||[]).map(L=>({value:L.id,title:L.name,description:L.description})),error:!!((T=R==null?void 0:R.accessPolicyId)!=null&&T.message),helperText:(($=R==null?void 0:R.accessPolicyId)==null?void 0:$.message)||o("securityRule.form.accessPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"responseHeaderPolicyId",control:v,rules:{validate:r.isDefaultRule?g:Se},render:({field:M})=>{var T,$;return a.jsx(Lt,{fullWidth:!0,required:r.isDefaultRule,margin:"dense",size:"small",label:o("securityRule.form.responseHeaderPolicy"),placeholer:o("securityRule.form.responseHeaderPolicyPlaceholder"),options:(u.data||[]).map(L=>({title:L.name,value:L.id,description:L.description})),error:!!((T=R==null?void 0:R.responseHeaderPolicyId)!=null&&T.message),helperText:(($=R==null?void 0:R.responseHeaderPolicyId)==null?void 0:$.message)||o("securityRule.form.responseHeaderPolicyHelperText"),...Ct(M,"ref"),disabled:r.mode==="view"})}}),a.jsx(ce,{name:"remark",control:v,render:({field:M})=>a.jsx(te,{fullWidth:!0,multiline:!0,minRows:3,maxRows:7,size:"small",margin:"dense",placeholder:o("securityRule.form.remarkPlaceholder"),label:o("securityRule.form.remark"),helperText:R==null?void 0:R.message,...M,disabled:r.mode==="view"})})]})})}),se=async(e,d="Failed to saved")=>{try{await e()}catch(o){Q.error((o==null?void 0:o.message)||d)}};function gn(){var h;const{t:e,locale:d}=Ie(),{blocklet:o}=kt(),{api:n}=Wt(),i=(h=o==null?void 0:o.meta)==null?void 0:h.did,c=$t(),m=H.useRef(null),t=H.useRef(null),{confirmApi:r,confirmHolder:s}=Jt(),u=jt(async()=>{const{securityRules:l}=await n.getBlockletSecurityRules({input:{did:i,includeDisabled:!0}});return l}),P=l=>l.id===N.SECURITY_RULE_DEFAULT_ID,v=E(l=>{var j;return(j=((o==null?void 0:o.children)||[]).find(O=>O.meta.did===l))==null?void 0:j.mountPoint}),x=(u.data||[]).map(l=>{if(l.componentDid){const g=v(l.componentDid);l._disabled=g===void 0}return l}),w=x.filter(l=>!P(l)),S=(l,g)=>{se(async()=>{const j=l.target.checked;await n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,enabled:j}}}),Q.success(e("common.succeeded")),u.run()})},I=(l,g,j)=>{se(async()=>{const O=j-1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},R=(l,g,j)=>{se(async()=>{const O=j+1,q=x[O];await Promise.all([n.updateBlockletSecurityRule({input:{did:i,data:{id:g.id,priority:q.priority}}}),n.updateBlockletSecurityRule({input:{did:i,data:{id:q.id,priority:g.priority}}})]),Q.success(e("common.succeeded")),u.run()})},p=()=>{m.current.open((l,g)=>{se(async()=>{await n.addBlockletSecurityRule({input:{did:i,data:l}}),Q.success(e("common.succeeded")),u.run(),g()})})},C=(l,g)=>{m.current.open((j,O)=>{se(async()=>{await n.updateBlockletSecurityRule({input:{did:i,data:{...j,id:g.id}}}),Q.success(e("common.succeeded")),u.run(),O()})},g)},y=(l,g)=>{r.open({title:e("securityRule.delete.title"),content:e("securityRule.delete.description"),confirmButtonText:e("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:e("common.cancel"),onConfirm(j){se(async()=>{await n.deleteBlockletSecurityRule({input:{did:i,id:g.id}}),Q.success(e("common.succeeded")),u.run(),j()})}})},f={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(l,{dataIndex:g},j){var O;if((O=t.current)!=null&&O.contains(j.target)){const q=x[g];m.current.open(void 0,q)}},setRowProps:(l,g)=>x[g]._disabled?{title:e("securityRule.useless"),style:{backgroundColor:c.palette.action.disabledBackground,cursor:"default"}}:{}},b=[a.jsx(Xe,{size:"small",variant:"outlined",onClick:()=>{u.run()},sx:{mr:1},children:e("common.refresh")},"refresh"),a.jsx(Xe,{size:"small",variant:"contained",onClick:p,children:e("common.add")})],_=[{label:e("securityRule.form.pathPattern"),name:"pathPattern",options:{customBodyRenderLite(l){const g=x[l];return a.jsx(k,{sx:{whiteSpace:"nowrap"},children:g.id===N.SECURITY_RULE_DEFAULT_ID?"Default":Bo(v(g.componentDid),g.pathPattern)})}}},{label:e("responseHeaderPolicy.title"),name:"responseHeaderPolicy",options:{customBodyRenderLite(l){var j;return(j=x[l].responseHeaderPolicy)==null?void 0:j.name}}},{label:e("accessPolicy.title"),name:"accessPolicyId",options:{customBodyRenderLite(l){var j;return(j=x[l].accessPolicy)==null?void 0:j.name}}},{label:e("securityRule.form.remark"),name:"remark"},{label:e("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(l){const g=x[l],j=P(g);return a.jsx(yn,{disableEdit:g._disabled,disableSwitch:g._disabled,enabled:g.enabled,showSwitch:!j,showDelete:!j,showUp:l>0&&!j,showDown:l<w.length-1&&!j,onClickSwitch:O=>{S(O,g)},onClickUp:O=>{I(O,g,l)},onClickDown:O=>{R(O,g,l)},onClickEdit:O=>{C(O,g)},onClickDelete:O=>{y(O,g)}})}}}].filter(Boolean);return a.jsxs(k,{sx:{display:"flex",flexDirection:"column",gap:2},ref:t,children:[a.jsx(Qt,{verticalKeyWidth:100,locale:d,title:a.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:1},children:[e("securityRule.title")," ",a.jsx(uo,{variant:"body2",children:e("securityRule.sortByDescription")})]}),data:x,columns:_,customButtons:b,options:f,loading:u.loading}),a.jsx(zo,{ref:m}),s]})}gn.propTypes={};const bn={width:24,height:24,body:'<path fill="currentColor" d="M5 21q-.825 0-1.413-.588T3 19V5q0-.825.588-1.413T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.588 1.413T19 21H5Zm0-2h14V7H5v12Zm7-2q-2.05 0-3.663-1.113T6 13q.725-1.775 2.337-2.888T12 9q2.05 0 3.663 1.113T18 13q-.725 1.775-2.337 2.888T12 17Zm0-2.5q-.625 0-1.063-.438T10.5 13q0-.625.438-1.063T12 11.5q.625 0 1.063.438T13.5 13q0 .625-.438 1.063T12 14.5Zm0 1q1.05 0 1.775-.725T14.5 13q0-1.05-.725-1.775T12 10.5q-1.05 0-1.775.725T9.5 13q0 1.05.725 1.775T12 15.5Z"/>'};var ir={},Fo=A;Object.defineProperty(ir,"__esModule",{value:!0});var xn=ir.default=void 0,No=Fo(io()),Vo=a;xn=ir.default=(0,No.default)((0,Vo.jsx)("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"}),"GroupRemove");var _n={},Te={};const je=ee(fo),Ke=ee(po);var Et={},Je={},Ae={};const Re=ee(mo);var Tt={},fr;function Uo(){if(fr)return Tt;fr=1;var e=A;Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.default=o;var d=e(re);function o(n,i){return(0,d.default)({toolbar:{minHeight:56,[n.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[n.up("sm")]:{minHeight:64}}},i)}return Tt}var _e={},Qe={},pr;function Xo(){if(pr)return Qe;pr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=void 0;const e={black:"#000",white:"#fff"};return Qe.default=e,Qe}var et={},mr;function Ko(){if(mr)return et;mr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.default=void 0;const e={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};return et.default=e,et}var tt={},hr;function Zo(){if(hr)return tt;hr=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.default=void 0;const e={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"};return tt.default=e,tt}var rt={},vr;function Go(){if(vr)return rt;vr=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.default=void 0;const e={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"};return rt.default=e,rt}var nt={},yr;function Yo(){if(yr)return nt;yr=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.default=void 0;const e={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"};return nt.default=e,nt}var ot={},gr;function Jo(){if(gr)return ot;gr=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.default=void 0;const e={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"};return ot.default=e,ot}var at={},br;function Qo(){if(br)return at;br=1,Object.defineProperty(at,"__esModule",{value:!0}),at.default=void 0;const e={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"};return at.default=e,at}var it={},xr;function ea(){if(xr)return it;xr=1,Object.defineProperty(it,"__esModule",{value:!0}),it.default=void 0;const e={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};return it.default=e,it}var _r;function ta(){if(_r)return _e;_r=1;var e=A;Object.defineProperty(_e,"__esModule",{value:!0}),_e.dark=void 0,_e.default=h,_e.light=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=rr,m=e(Xo()),t=e(Ko()),r=e(Zo()),s=e(Go()),u=e(Yo()),P=e(Jo()),v=e(Qo()),x=e(ea());const w=["mode","contrastThreshold","tonalOffset"],S=_e.light={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:m.default.white,default:m.default.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},I=_e.dark={text:{primary:m.default.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:m.default.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function R(l,g,j,O){const q=O.light||O,B=O.dark||O*1.5;l[g]||(l.hasOwnProperty(j)?l[g]=l[j]:g==="light"?l.light=(0,c.lighten)(l.main,q):g==="dark"&&(l.dark=(0,c.darken)(l.main,B)))}function p(l="light"){return l==="dark"?{main:P.default[200],light:P.default[50],dark:P.default[400]}:{main:P.default[700],light:P.default[400],dark:P.default[800]}}function C(l="light"){return l==="dark"?{main:r.default[200],light:r.default[50],dark:r.default[400]}:{main:r.default[500],light:r.default[300],dark:r.default[700]}}function y(l="light"){return l==="dark"?{main:s.default[500],light:s.default[300],dark:s.default[700]}:{main:s.default[700],light:s.default[400],dark:s.default[800]}}function f(l="light"){return l==="dark"?{main:v.default[400],light:v.default[300],dark:v.default[700]}:{main:v.default[700],light:v.default[500],dark:v.default[900]}}function b(l="light"){return l==="dark"?{main:x.default[400],light:x.default[300],dark:x.default[700]}:{main:x.default[800],light:x.default[500],dark:x.default[900]}}function _(l="light"){return l==="dark"?{main:u.default[400],light:u.default[300],dark:u.default[700]}:{main:"#ed6c02",light:u.default[500],dark:u.default[900]}}function h(l){const{mode:g="light",contrastThreshold:j=3,tonalOffset:O=.2}=l,q=(0,o.default)(l,w),B=l.primary||p(g),M=l.secondary||C(g),T=l.error||y(g),$=l.info||f(g),L=l.success||b(g),V=l.warning||_(g);function J(z){return(0,c.getContrastRatio)(z,I.text.primary)>=j?I.text.primary:S.text.primary}const U=({color:z,name:K,mainShade:de=500,lightShade:ne=300,darkShade:F=700})=>{if(z=(0,d.default)({},z),!z.main&&z[de]&&(z.main=z[de]),!z.hasOwnProperty("main"))throw new Error((0,n.default)(11,K?` (${K})`:"",de));if(typeof z.main!="string")throw new Error((0,n.default)(12,K?` (${K})`:"",JSON.stringify(z.main)));return R(z,"light",ne,O),R(z,"dark",F,O),z.contrastText||(z.contrastText=J(z.main)),z},X={dark:I,light:S};return(0,i.default)((0,d.default)({common:(0,d.default)({},m.default),mode:g,primary:U({color:B,name:"primary"}),secondary:U({color:M,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:U({color:T,name:"error"}),warning:U({color:V,name:"warning"}),info:U({color:$,name:"info"}),success:U({color:L,name:"success"}),grey:t.default,contrastThreshold:j,getContrastText:J,augmentColor:U,tonalOffset:O},X[g]),q)}return _e}var qt={},Pr;function ra(){if(Pr)return qt;Pr=1;var e=A;Object.defineProperty(qt,"__esModule",{value:!0}),qt.default=r;var d=e(re),o=e(ue()),n=e(tr);const i=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function c(s){return Math.round(s*1e5)/1e5}const m={textTransform:"uppercase"},t='"Roboto", "Helvetica", "Arial", sans-serif';function r(s,u){const P=typeof u=="function"?u(s):u,{fontFamily:v=t,fontSize:x=14,fontWeightLight:w=300,fontWeightRegular:S=400,fontWeightMedium:I=500,fontWeightBold:R=700,htmlFontSize:p=16,allVariants:C,pxToRem:y}=P,f=(0,o.default)(P,i),b=x/14,_=y||(g=>`${g/p*b}rem`),h=(g,j,O,q,B)=>(0,d.default)({fontFamily:v,fontWeight:g,fontSize:_(j),lineHeight:O},v===t?{letterSpacing:`${c(q/j)}em`}:{},B,C),l={h1:h(w,96,1.167,-1.5),h2:h(w,60,1.2,-.5),h3:h(S,48,1.167,0),h4:h(S,34,1.235,.25),h5:h(S,24,1.334,0),h6:h(I,20,1.6,.15),subtitle1:h(S,16,1.75,.15),subtitle2:h(I,14,1.57,.1),body1:h(S,16,1.5,.15),body2:h(S,14,1.43,.15),button:h(I,14,1.75,.4,m),caption:h(S,12,1.66,.4),overline:h(S,12,2.66,1,m),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,n.default)((0,d.default)({htmlFontSize:p,pxToRem:_,fontFamily:v,fontSize:x,fontWeightLight:w,fontWeightRegular:S,fontWeightMedium:I,fontWeightBold:R},l),f,{clone:!1})}return qt}var st={},Cr;function na(){if(Cr)return st;Cr=1,Object.defineProperty(st,"__esModule",{value:!0}),st.default=void 0;const e=.2,d=.14,o=.12;function n(...c){return[`${c[0]}px ${c[1]}px ${c[2]}px ${c[3]}px rgba(0,0,0,${e})`,`${c[4]}px ${c[5]}px ${c[6]}px ${c[7]}px rgba(0,0,0,${d})`,`${c[8]}px ${c[9]}px ${c[10]}px ${c[11]}px rgba(0,0,0,${o})`].join(",")}const i=["none",n(0,2,1,-1,0,1,1,0,0,1,3,0),n(0,3,1,-2,0,2,2,0,0,1,5,0),n(0,3,3,-2,0,3,4,0,0,1,8,0),n(0,2,4,-1,0,4,5,0,0,1,10,0),n(0,3,5,-1,0,5,8,0,0,1,14,0),n(0,3,5,-1,0,6,10,0,0,1,18,0),n(0,4,5,-2,0,7,10,1,0,2,16,1),n(0,5,5,-3,0,8,10,1,0,3,14,2),n(0,5,6,-3,0,9,12,1,0,3,16,2),n(0,6,6,-3,0,10,14,1,0,4,18,3),n(0,6,7,-4,0,11,15,1,0,4,20,3),n(0,7,8,-4,0,12,17,2,0,5,22,4),n(0,7,8,-4,0,13,19,2,0,5,24,4),n(0,7,9,-4,0,14,21,2,0,5,26,4),n(0,8,9,-5,0,15,22,2,0,6,28,5),n(0,8,10,-5,0,16,24,2,0,6,30,5),n(0,8,11,-5,0,17,26,2,0,6,32,5),n(0,9,11,-5,0,18,28,2,0,7,34,6),n(0,9,12,-6,0,19,29,2,0,7,36,6),n(0,10,13,-6,0,20,31,3,0,8,38,7),n(0,10,13,-6,0,21,33,3,0,8,40,7),n(0,10,14,-6,0,22,35,3,0,8,42,7),n(0,11,14,-7,0,23,36,3,0,9,44,8),n(0,11,15,-7,0,24,38,3,0,9,46,8)];return st.default=i,st}var Pe={},jr;function oa(){if(jr)return Pe;jr=1;var e=A;Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.default=r,Pe.easing=Pe.duration=void 0;var d=e(ue()),o=e(re);const n=["duration","easing","delay"],i=Pe.easing={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},c=Pe.duration={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function m(s){return`${Math.round(s)}ms`}function t(s){if(!s)return 0;const u=s/36;return Math.round((4+15*u**.25+u/5)*10)}function r(s){const u=(0,o.default)({},i,s.easing),P=(0,o.default)({},c,s.duration),v=(x=["all"],w={})=>{const{duration:S=P.standard,easing:I=u.easeInOut,delay:R=0}=w;return(0,d.default)(w,n),(Array.isArray(x)?x:[x]).map(p=>`${p} ${typeof S=="string"?S:m(S)} ${I} ${typeof R=="string"?R:m(R)}`).join(",")};return(0,o.default)({getAutoHeightDuration:t,create:v},s,{easing:u,duration:P})}return Pe}var lt={},Rr;function aa(){if(Rr)return lt;Rr=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.default=void 0;const e={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};return lt.default=e,lt}var Or;function ia(){if(Or)return Ae;Or=1;var e=A;Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.createMuiTheme=R,Ae.default=void 0;var d=e(re),o=e(ue()),n=e(cn),i=e(tr),c=S(un),m=e(ho);e(Re);var t=e(Uo()),r=e(ta()),s=e(ra()),u=e(na()),P=e(oa()),v=e(aa());const x=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function w(p){if(typeof WeakMap!="function")return null;var C=new WeakMap,y=new WeakMap;return(w=function(f){return f?y:C})(p)}function S(p,C){if(p&&p.__esModule)return p;if(p===null||typeof p!="object"&&typeof p!="function")return{default:p};var y=w(C);if(y&&y.has(p))return y.get(p);var f={__proto__:null},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var _ in p)if(_!=="default"&&Object.prototype.hasOwnProperty.call(p,_)){var h=b?Object.getOwnPropertyDescriptor(p,_):null;h&&(h.get||h.set)?Object.defineProperty(f,_,h):f[_]=p[_]}return f.default=p,y&&y.set(p,f),f}function I(p={},...C){const{mixins:y={},palette:f={},transitions:b={},typography:_={}}=p,h=(0,o.default)(p,x);if(p.vars&&p.generateCssVars===void 0)throw new Error((0,n.default)(18));const l=(0,r.default)(f),g=(0,m.default)(p);let j=(0,i.default)(g,{mixins:(0,t.default)(g.breakpoints,y),palette:l,shadows:u.default.slice(),typography:(0,s.default)(l,_),transitions:(0,P.default)(b),zIndex:(0,d.default)({},v.default)});return j=(0,i.default)(j,h),j=C.reduce((O,q)=>(0,i.default)(O,q),j),j.unstable_sxConfig=(0,d.default)({},c.unstable_defaultSxConfig,h==null?void 0:h.unstable_sxConfig),j.unstable_sx=function(q){return(0,c.default)({sx:q,theme:this})},j}function R(...p){return I(...p)}return Ae.default=I,Ae}var wr;function sa(){if(wr)return Je;wr=1;var e=A;Object.defineProperty(Je,"__esModule",{value:!0}),Je.default=void 0;var d=e(ia());const o=(0,d.default)();return Je.default=o,Je}var ct={},Tr;function la(){return Tr||(Tr=1,Object.defineProperty(ct,"__esModule",{value:!0}),ct.default=void 0,ct.default="$$material"),ct}var ut={},dt={},qr;function Pn(){if(qr)return dt;qr=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.default=void 0;function e(d){return d!=="ownerState"&&d!=="theme"&&d!=="sx"&&d!=="as"}return dt.default=e,dt}var Mr;function ca(){if(Mr)return ut;Mr=1;var e=A;Object.defineProperty(ut,"__esModule",{value:!0}),ut.default=void 0;var d=e(Pn());const o=n=>(0,d.default)(n)&&n!=="classes";return ut.default=o,ut}var Sr;function De(){return Sr||(Sr=1,function(e){"use client";var d=A;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,Object.defineProperty(e,"rootShouldForwardProp",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"slotShouldForwardProp",{enumerable:!0,get:function(){return m.default}});var o=d(vo),n=d(sa()),i=d(la()),c=d(ca()),m=d(Pn());const t=(0,o.default)({themeId:i.default,defaultTheme:n.default,rootShouldForwardProp:c.default});e.default=t}(Et)),Et}var zt={},He={};const ua=ee(yo);var Ir;function da(){if(Ir)return He;Ir=1;var e=A;Object.defineProperty(He,"__esModule",{value:!0}),He.default=void 0,He.useDefaultProps=t;var d=e(re);c(H),e(xe);var o=c(ua),n=a;function i(r){if(typeof WeakMap!="function")return null;var s=new WeakMap,u=new WeakMap;return(i=function(P){return P?u:s})(r)}function c(r,s){if(r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var u=i(s);if(u&&u.has(r))return u.get(r);var P={__proto__:null},v=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in r)if(x!=="default"&&Object.prototype.hasOwnProperty.call(r,x)){var w=v?Object.getOwnPropertyDescriptor(r,x):null;w&&(w.get||w.set)?Object.defineProperty(P,x,w):P[x]=r[x]}return P.default=r,u&&u.set(r,P),P}function m(r){return(0,n.jsx)(o.default,(0,d.default)({},r))}He.default=m;function t(r){return(0,o.useDefaultProps)(r)}return He}var Dr;function $e(){return Dr||(Dr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(e,"useDefaultProps",{enumerable:!0,get:function(){return d.useDefaultProps}});var d=n(da());function o(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(o=function(t){return t?m:c})(i)}function n(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=o(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}}(zt)),zt}var ft={},$r;function sr(){if($r)return ft;$r=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.default=void 0;var e=o(H);function d(i){if(typeof WeakMap!="function")return null;var c=new WeakMap,m=new WeakMap;return(d=function(t){return t?m:c})(i)}function o(i,c){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var m=d(c);if(m&&m.has(i))return m.get(i);var t={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in i)if(s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)){var u=r?Object.getOwnPropertyDescriptor(i,s):null;u&&(u.get||u.set)?Object.defineProperty(t,s,u):t[s]=i[s]}return t.default=i,m&&m.set(i,t),t}const n=e.createContext({});return ft.default=n,ft}var Ft={},qe={};const fa=ee(go),pa=ee(bo);var pt={};const ma=ee(xo);var kr;function Cn(){if(kr)return pt;kr=1;var e=A;Object.defineProperty(pt,"__esModule",{value:!0}),pt.default=void 0;var d=e(ma);return pt.default=d.default,pt}var mt={};const ha=ee(_o);var Wr;function va(){if(Wr)return mt;Wr=1;var e=A;Object.defineProperty(mt,"__esModule",{value:!0}),mt.default=void 0;var d=e(ha);return mt.default=d.default,mt}var ht={};const ya=ee(Po);var Br;function ga(){if(Br)return ht;Br=1;var e=A;Object.defineProperty(ht,"__esModule",{value:!0}),ht.default=void 0;var d=e(ya);return ht.default=d.default,ht}var le={};const ba=ee(Co),xa=ee(jo),_a=ee(Ro);var vt={},Ar;function Pa(){if(Ar)return vt;Ar=1;var e=A;Object.defineProperty(vt,"__esModule",{value:!0}),vt.default=void 0;var d=c(H);e(xe);var o=e(je),n=a;function i(t){if(typeof WeakMap!="function")return null;var r=new WeakMap,s=new WeakMap;return(i=function(u){return u?s:r})(t)}function c(t,r){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var s=i(r);if(s&&s.has(t))return s.get(t);var u={__proto__:null},P=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in t)if(v!=="default"&&Object.prototype.hasOwnProperty.call(t,v)){var x=P?Object.getOwnPropertyDescriptor(t,v):null;x&&(x.get||x.set)?Object.defineProperty(u,v,x):u[v]=t[v]}return u.default=t,s&&s.set(t,u),u}function m(t){const{className:r,classes:s,pulsate:u=!1,rippleX:P,rippleY:v,rippleSize:x,in:w,onExited:S,timeout:I}=t,[R,p]=d.useState(!1),C=(0,o.default)(r,s.ripple,s.rippleVisible,u&&s.ripplePulsate),y={width:x,height:x,top:-(x/2)+v,left:-(x/2)+P},f=(0,o.default)(s.child,R&&s.childLeaving,u&&s.childPulsate);return!w&&!R&&p(!0),d.useEffect(()=>{if(!w&&S!=null){const b=setTimeout(S,I);return()=>{clearTimeout(b)}}},[S,w,I]),(0,n.jsx)("span",{className:C,style:y,children:(0,n.jsx)("span",{className:f})})}return vt.default=m,vt}var Le={};const ke=ee(Oo);var Hr;function jn(){if(Hr)return Le;Hr=1;var e=A;Object.defineProperty(Le,"__esModule",{value:!0}),Le.default=void 0,Le.getTouchRippleUtilityClass=n;var d=e(ke),o=e(Re);function n(c){return(0,o.default)("MuiTouchRipple",c)}const i=(0,d.default)("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]);return Le.default=i,Le}var Lr;function Ca(){if(Lr)return le;Lr=1;var e=A;Object.defineProperty(le,"__esModule",{value:!0}),le.default=le.TouchRippleRoot=le.TouchRippleRipple=le.DELAY_RIPPLE=void 0;var d=e(re),o=e(ue()),n=S(H);e(xe);var i=ba,c=e(je),m=xa,t=e(_a),r=e(De()),s=$e(),u=e(Pa()),P=e(jn()),v=a;const x=["center","classes","className"];function w(h){if(typeof WeakMap!="function")return null;var l=new WeakMap,g=new WeakMap;return(w=function(j){return j?g:l})(h)}function S(h,l){if(h&&h.__esModule)return h;if(h===null||typeof h!="object"&&typeof h!="function")return{default:h};var g=w(l);if(g&&g.has(h))return g.get(h);var j={__proto__:null},O=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var q in h)if(q!=="default"&&Object.prototype.hasOwnProperty.call(h,q)){var B=O?Object.getOwnPropertyDescriptor(h,q):null;B&&(B.get||B.set)?Object.defineProperty(j,q,B):j[q]=h[q]}return j.default=h,g&&g.set(h,j),j}const I=550,R=le.DELAY_RIPPLE=80,p=(0,m.keyframes)`
|
|
2
2
|
0% {
|
|
3
3
|
transform: scale(0);
|
|
4
4
|
opacity: 0.1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-DGPdKMcu.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/useAsync-DV3NyLhI.js","assets/vendor-hooks-rDgu5KV9.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-u-w3iMC9.js","assets/vendor-arcblock-CN2B_oTr.js","assets/index-DOq-_YXu.css","assets/config-C8AXD1JH.js","assets/index-D09AfnR1.js","assets/Done-Ct5slWpT.js","assets/collapse-Bn_BDlF9.js","assets/Google-BbAgcDQ_.js","assets/cloneDeep-UpFQ2VNg.js","assets/logo-uploader-BYnd80uu.js","assets/index-DVQCgvFb.js","assets/page-header-CpNMTtn_.js","assets/layout-CyCulQBn.js","assets/content-layout-DzqMXifY.js","assets/step-actions-Bu3Q5M4V.js","assets/use-mobile-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-DGPdKMcu.js","assets/vendor-mui-core-UZpb7wT7.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/useAsync-DV3NyLhI.js","assets/vendor-hooks-rDgu5KV9.js","assets/vendor-ux-did-connect-TEE6cGq6.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-u-w3iMC9.js","assets/vendor-arcblock-CN2B_oTr.js","assets/index-DOq-_YXu.css","assets/config-C8AXD1JH.js","assets/index-D09AfnR1.js","assets/Done-Ct5slWpT.js","assets/collapse-Bn_BDlF9.js","assets/Google-BbAgcDQ_.js","assets/cloneDeep-UpFQ2VNg.js","assets/logo-uploader-BYnd80uu.js","assets/index-DVQCgvFb.js","assets/page-header-CpNMTtn_.js","assets/layout-CyCulQBn.js","assets/content-layout-DzqMXifY.js","assets/step-actions-Bu3Q5M4V.js","assets/use-mobile-Bh8CHBbH.js","assets/button-DotKXyjc.js","assets/index-BMPpz8ni.js","assets/config-space-CSKkMgqX.js","assets/spaces-Cp7TgoZP.js","assets/api-BjteVZFg.js","assets/connect-to-BBtnljQ-.js","assets/DeleteOutline-B6efX_Fy.js","assets/format-error-BrmqJs5a.js","assets/domain-DTrwCkop.js","assets/domain-action-card-D-WETV-f.js","assets/ExpandLess-CJXkgMMr.js","assets/permission-BkNXA8B5.js","assets/session-6XaVDQaE.js","assets/dot-C05enzim.js","assets/confirm-BvUfAlkx.js","assets/actions-BCWb2ez1.js","assets/MoreHoriz-BxJelL2A.js","assets/delete-confirm-BBaXcAXg.js","assets/click-to-copy-BxhgzyYL.js","assets/util-RWes6RwK.js","assets/useSetState-CWq0AVWn.js","assets/InfoOutlined-Dy7jTc7H.js","assets/index-C0SLCehH.js","assets/CheckCircle-Dvhgeo9j.js","assets/access-control-RJu7xYI3.js","assets/config-qG8JCIJ_.js","assets/fuel-DzWcrU-I.js","assets/Launch-DBKe0gh0.js","assets/did-address-BKBBjFqv.js","assets/complete-BRApuFsV.js","assets/launch-result-message-BaU6oEsi.js","assets/get-safe-url-CEvgWyL5.js","assets/starting-progress-CdpkXOrK.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{S as Q,L as W,_ as d,c as _}from"./vendor-arcblock-CN2B_oTr.js";import{j as e,ah as T,v as q,e as K,bE as G,aa as X,ab as J,b7 as Y}from"./vendor-mui-core-UZpb7wT7.js";import{h as ee,f as te,r as i,i as se,j as c,k as oe}from"./vendor-react-DEoibe3W.js";import{A as o}from"./vendor-utils-rHXShPKm.js";import{u as ae,aT as ne,j as A}from"./vendor-ux-did-connect-TEE6cGq6.js";import{C as re}from"./config-space-CSKkMgqX.js";import{H as ie}from"./addon-ygDS7Fug.js";import{S as le}from"./ServerLogo-CfbYjQbP.js";import{n as pe,u as ce,o as V,q as de,r as ue,P as k,N as Le,f as he,S as me}from"./index-u-w3iMC9.js";import{g as fe}from"./get-safe-url-CEvgWyL5.js";import"./vendor-hooks-rDgu5KV9.js";import"./lottie-web-jYmAQWuC.js";import"./spaces-Cp7TgoZP.js";import"./api-BjteVZFg.js";import"./QuestionMarkCircle-DCM9zW3a.js";var E=function(h){return e.jsxs("svg",{...h,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z",fill:"url(#paint0_linear_615_426)"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z",fill:"url(#paint1_linear_615_426)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"paint0_linear_615_426",x1:"31.72",y1:"95.7208",x2:"95.488",y2:"34.3249",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#0FA4B7"}),e.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),e.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]}),e.jsxs("linearGradient",{id:"paint1_linear_615_426",x1:"28.4374",y1:"99.2464",x2:"98.7613",y2:"44.9372",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#0FA4B7"}),e.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),e.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]})]})]})};E.defaultProps={width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"};E.displayName="server-logo-notext";const xe=E,_e=T.span`
|
|
3
3
|
color: ${h=>h.theme.palette.error.main};
|
|
4
4
|
&::before {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,aa as a,H as o,ah as p}from"./vendor-mui-core-UZpb7wT7.js";import{u as l}from"./use-mobile-
|
|
1
|
+
import{j as e,aa as a,H as o,ah as p}from"./vendor-mui-core-UZpb7wT7.js";import{u as l}from"./use-mobile-Bh8CHBbH.js";import{ah as m}from"./index-u-w3iMC9.js";function r({blocklet:t,children:n}){const i=l();return!t||m(t.meta)?e.jsx(s,{isMobile:i,children:n}):e.jsx(s,{isMobile:i,children:e.jsx(a,{display:"flex",variant:"contained",color:"primary",alignItems:"center",marginLeft:"32px",children:n})})}r.propTypes={blocklet:o.object,children:o.any};r.defaultProps={blocklet:null,children:null};const s=p(a)`
|
|
2
2
|
padding-top: 24px;
|
|
3
3
|
margin-top: auto;
|
|
4
4
|
width: 100%;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.43
|
|
6
|
+
"version": "1.16.43",
|
|
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.43
|
|
37
|
-
"@abtnode/auth": "1.16.43
|
|
38
|
-
"@abtnode/client": "1.16.43
|
|
39
|
-
"@abtnode/connect-storage": "1.16.43
|
|
40
|
-
"@abtnode/constant": "1.16.43
|
|
41
|
-
"@abtnode/core": "1.16.43
|
|
42
|
-
"@abtnode/cron": "1.16.43
|
|
43
|
-
"@abtnode/logger": "1.16.43
|
|
44
|
-
"@abtnode/models": "1.16.43
|
|
45
|
-
"@abtnode/router-templates": "1.16.43
|
|
46
|
-
"@abtnode/util": "1.16.43
|
|
36
|
+
"@abtnode/analytics": "1.16.43",
|
|
37
|
+
"@abtnode/auth": "1.16.43",
|
|
38
|
+
"@abtnode/client": "1.16.43",
|
|
39
|
+
"@abtnode/connect-storage": "1.16.43",
|
|
40
|
+
"@abtnode/constant": "1.16.43",
|
|
41
|
+
"@abtnode/core": "1.16.43",
|
|
42
|
+
"@abtnode/cron": "1.16.43",
|
|
43
|
+
"@abtnode/logger": "1.16.43",
|
|
44
|
+
"@abtnode/models": "1.16.43",
|
|
45
|
+
"@abtnode/router-templates": "1.16.43",
|
|
46
|
+
"@abtnode/util": "1.16.43",
|
|
47
47
|
"@arcblock/did": "1.20.8",
|
|
48
48
|
"@arcblock/did-auth": "1.20.8",
|
|
49
49
|
"@arcblock/did-ext": "1.20.8",
|
|
@@ -53,17 +53,17 @@
|
|
|
53
53
|
"@arcblock/jwt": "1.20.8",
|
|
54
54
|
"@arcblock/validator": "1.20.8",
|
|
55
55
|
"@arcblock/ws": "1.20.8",
|
|
56
|
-
"@blocklet/constant": "1.16.43
|
|
56
|
+
"@blocklet/constant": "1.16.43",
|
|
57
57
|
"@blocklet/dbhub": "^0.2.9",
|
|
58
58
|
"@blocklet/did-space-js": "^1.0.51",
|
|
59
|
-
"@blocklet/env": "1.16.43
|
|
59
|
+
"@blocklet/env": "1.16.43",
|
|
60
60
|
"@blocklet/form-builder": "^0.1.11",
|
|
61
61
|
"@blocklet/form-collector": "^0.1.8",
|
|
62
|
-
"@blocklet/images": "1.16.43
|
|
63
|
-
"@blocklet/js-sdk": "1.16.43
|
|
62
|
+
"@blocklet/images": "1.16.43",
|
|
63
|
+
"@blocklet/js-sdk": "1.16.43",
|
|
64
64
|
"@blocklet/mcp": "^1.10.2",
|
|
65
|
-
"@blocklet/meta": "1.16.43
|
|
66
|
-
"@blocklet/sdk": "1.16.43
|
|
65
|
+
"@blocklet/meta": "1.16.43",
|
|
66
|
+
"@blocklet/sdk": "1.16.43",
|
|
67
67
|
"@blocklet/theme": "^2.13.26",
|
|
68
68
|
"@blocklet/theme-builder": "^0.1.15",
|
|
69
69
|
"@blocklet/uploader-server": "^0.1.97",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"whatwg-url": "14.0.0"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
|
-
"@abtnode/ux": "1.16.43
|
|
122
|
+
"@abtnode/ux": "1.16.43",
|
|
123
123
|
"@arcblock/bridge": "^2.13.26",
|
|
124
124
|
"@arcblock/did-connect": "^2.13.26",
|
|
125
125
|
"@arcblock/icons": "^2.13.26",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"@arcblock/ux": "^2.13.26",
|
|
128
128
|
"@blocklet/launcher-layout": "^2.13.26",
|
|
129
129
|
"@blocklet/payment-react": "^1.18.40",
|
|
130
|
-
"@blocklet/tracker": "1.16.43
|
|
130
|
+
"@blocklet/tracker": "1.16.43",
|
|
131
131
|
"@blocklet/ui-react": "^2.13.26",
|
|
132
132
|
"@blocklet/uploader": "^0.1.89",
|
|
133
133
|
"@emotion/react": "^11.11.4",
|
|
@@ -205,5 +205,5 @@
|
|
|
205
205
|
"url": "https://github.com/ArcBlock/blocklet-server/issues",
|
|
206
206
|
"email": "shijun@arcblock.io"
|
|
207
207
|
},
|
|
208
|
-
"gitHead": "
|
|
208
|
+
"gitHead": "f8fc3d8ca3f4ef070db03d60a51e85f9741d8e87"
|
|
209
209
|
}
|