@abtnode/blocklet-services 1.17.6 → 1.17.7-beta-20251224-045844-3c7f459a
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/api/services/notification/queue.js +4 -0
- package/dist/assets/{access-control-BhOT85R4.js → access-control-DwlD3_cw.js} +1 -1
- package/dist/assets/{add-component-core-heDvzsX8.js → add-component-core-BITgGwN0.js} +3 -3
- package/dist/assets/{add-resource-BkuSIexh.js → add-resource-ENVSA34x.js} +1 -1
- package/dist/assets/{addon-B_DwHOas.js → addon-C2qdiHVb.js} +1 -1
- package/dist/assets/{advanced-swM31Eiv.js → advanced-BosetBVE.js} +1 -1
- package/dist/assets/{aigne-CQrMsm7D.js → aigne-DbMeOdg9.js} +1 -1
- package/dist/assets/{appearance-1Y_gCbL9.js → appearance-DhUAX-xn.js} +1 -1
- package/dist/assets/{audit-logs-CHjIu_sG.js → audit-logs-BHPPGieH.js} +1 -1
- package/dist/assets/{authorize-BjNz4CIx.js → authorize-Dfo70g1t.js} +1 -1
- package/dist/assets/{bind-account-Cp_jRmuc.js → bind-account-Drs3IDFN.js} +1 -1
- package/dist/assets/{branding-BkFb6cTS.js → branding-B-5oLD-k.js} +1 -1
- package/dist/assets/{branding-DclrAcmZ.js → branding-BhvacExo.js} +1 -1
- package/dist/assets/{branding-Cy4S7ifJ.js → branding-ByK6n-fM.js} +1 -1
- package/dist/assets/{bundle-avatar-BZ_OHQ8d.js → bundle-avatar-DVOaAXid.js} +1 -1
- package/dist/assets/{complete-BBxVJgzT.js → complete-Djtuko3J.js} +1 -1
- package/dist/assets/{component-DTec6zax.js → component-UsgyDUkb.js} +29 -29
- package/dist/assets/{config-Bu8dI7mW.js → config-CUYR0yDP.js} +1 -1
- package/dist/assets/{config-B6DS9_16.js → config-Co1ZhGgP.js} +1 -1
- package/dist/assets/{config-uF2iao7N.js → config-DuS3gx_m.js} +2 -2
- package/dist/assets/{config-navigation-hnPNfA90.js → config-navigation-DjF2jJY9.js} +2 -2
- package/dist/assets/{config-space-OgBdtdQ7.js → config-space-zEV0JkDF.js} +1 -1
- package/dist/assets/{confirm-btfSjmnK.js → confirm-DTx9f3Ke.js} +1 -1
- package/dist/assets/{connect-C_8n2GAP.js → connect-BX2QwOaU.js} +1 -1
- package/dist/assets/{connect-0rgz4tLV.js → connect-nknm0LHt.js} +1 -1
- package/dist/assets/{connect-to-_CNpUNET.js → connect-to-eBtGI4_9.js} +1 -1
- package/dist/assets/{dashboard-C0oSA3oj.js → dashboard-DbjH3qe4.js} +3 -3
- package/dist/assets/{delete-confirm-dqp-ol9_.js → delete-confirm-HiRqbh9-.js} +1 -1
- package/dist/assets/{domain-C8SVzMQz.js → domain-Xaa2OTQZ.js} +1 -1
- package/dist/assets/{domain-action-card-B9GypCwf.js → domain-action-card-BzceZepB.js} +1 -1
- package/dist/assets/{domains-CiKmqXgC.js → domains-D_GcYdME.js} +1 -1
- package/dist/assets/{email-Dg6hVyjU.js → email-CaObtYNf.js} +1 -1
- package/dist/assets/engine-BzngvK61.js +1 -0
- package/dist/assets/{exchange-passport-DBGg6mtf.js → exchange-passport-BA6t_lld.js} +1 -1
- package/dist/assets/{form-ayzBN20_.js → form-DNo4HCRt.js} +1 -1
- package/dist/assets/{fuel-Vs28WoOz.js → fuel-Cr5W3cGy.js} +1 -1
- package/dist/assets/{gen-access-key-BzRnSZMg.js → gen-access-key-Bw62ox39.js} +1 -1
- package/dist/assets/{gen-simple-access-key-ClX05cKV.js → gen-simple-access-key-QTWh5kxW.js} +1 -1
- package/dist/assets/{get-safe-url-BW-k89rQ.js → get-safe-url-CqAaHb9L.js} +1 -1
- package/dist/assets/{home-Ds1wkYQ9.js → home-iaPbLBtv.js} +1 -1
- package/dist/assets/{iframe-CXruOREe.js → iframe-C8myLb4U.js} +1 -1
- package/dist/assets/{index-B4oHJYN3.js → index-1azOxnKy.js} +1 -1
- package/dist/assets/{index-jh20BesS.js → index-9h1okNKA.js} +1 -1
- package/dist/assets/{index-DgEP8auA.js → index-B7jV3her.js} +1 -1
- package/dist/assets/{index-BAO6XTWC.js → index-B8sa2W5r.js} +1 -1
- package/dist/assets/{index-DwK0GIrs.js → index-BHa1_Bjz.js} +65 -65
- package/dist/assets/{index-D-q1dCoY.js → index-BNeXCm1B.js} +1 -1
- package/dist/assets/{index-Cn9-WXPN.js → index-BleAAm7x.js} +1 -1
- package/dist/assets/{index-B5Fc7Exm.js → index-BzU09Azd.js} +1 -1
- package/dist/assets/{index-LIDGq9IJ.js → index-C2HNVEZ0.js} +1 -1
- package/dist/assets/{index-DQ5hcDOb.js → index-C4nyPKIr.js} +1 -1
- package/dist/assets/{index-C8ve20rA.js → index-CaQnmN3Y.js} +1 -1
- package/dist/assets/{index-DQ6KmrJ_.js → index-CnWFrsC2.js} +1 -1
- package/dist/assets/{index-u9yYWXco.js → index-CtJhxyJT.js} +2 -2
- package/dist/assets/{index-DajrAixi.js → index-CzvNhDIJ.js} +1 -1
- package/dist/assets/{index-DooQPBUl.js → index-D3g5TOJl.js} +1 -1
- package/dist/assets/{index-Bcpfja_q.js → index-DHvO7Oyu.js} +1 -1
- package/dist/assets/{index-Bgm1pC2t.js → index-DeG3Ee92.js} +1 -1
- package/dist/assets/{index-B1BMtpDu.js → index-Df4GSKx6.js} +1 -1
- package/dist/assets/{index-C6f1LKt3.js → index-Dk6ZABgc.js} +1 -1
- package/dist/assets/{index-CF3y44xd.js → index-Dnd0o2ng.js} +1 -1
- package/dist/assets/{index-BmSuXiNh.js → index-DoVbUHDU.js} +1 -1
- package/dist/assets/{index-DG2f1wAe.js → index-SACCniHf.js} +1 -1
- package/dist/assets/{index-BqmdsAZZ.js → index-SCaAOhtj.js} +1 -1
- package/dist/assets/{index-BvsQyxi_.js → index-YLno1Cst.js} +6 -6
- package/dist/assets/{index-B88jTj-J.js → index-pAjb_WaG.js} +1 -1
- package/dist/assets/{index-DVQWYAIC.js → index-seQ_ufVM.js} +1 -1
- package/dist/assets/{invitation-BcEFpMQA.js → invitation-DwMnPB2W.js} +1 -1
- package/dist/assets/{invitations-DmsPff5b.js → invitations-mhxsPoWR.js} +1 -1
- package/dist/assets/{invite-GF63A7GD.js → invite-DpZe41tL.js} +1 -1
- package/dist/assets/{isURL-CkV6bNHJ.js → isURL-CASPeQFe.js} +1 -1
- package/dist/assets/{issue-passport-BXOKXvyV.js → issue-passport-ClIYXZHr.js} +1 -1
- package/dist/assets/{item-BSFssoYN.js → item-B3LlwO_A.js} +1 -1
- package/dist/assets/{landing-page-BE08UeOH.js → landing-page-Cv6belCa.js} +1 -1
- package/dist/assets/{layout-BPsPNtH9.js → layout-DkW-u1GX.js} +1 -1
- package/dist/assets/{list-Byc72bDA.js → list-CBP3Lj7-.js} +1 -1
- package/dist/assets/{list-CLOYr71b.js → list-Dqz9X41o.js} +1 -1
- package/dist/assets/{localization-L4ZbLe_a.js → localization-gLf4FT3Q.js} +1 -1
- package/dist/assets/{log-D198F7U3.js → log-Ch1_gOOt.js} +1 -1
- package/dist/assets/{login-wDtMfbHT.js → login-_zzURN5A.js} +1 -1
- package/dist/assets/{login-oauth-callback-CC9N1S9d.js → login-oauth-callback-BiIj9E0o.js} +1 -1
- package/dist/assets/{logo-uploader-BL-x4TAv.js → logo-uploader-BmnoHisE.js} +1 -1
- package/dist/assets/{lost-passport-CKHtQDwr.js → lost-passport-DYnJRD_t.js} +1 -1
- package/dist/assets/{open-window-CU415CjG.js → open-window-Btzsgc7g.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-Bux67LFM.js → over-due-invoice-payment-BFDFMUwK.js} +1 -1
- package/dist/assets/{overview-DLpRsiS6.js → overview-Bf86Sw9l.js} +1 -1
- package/dist/assets/{passport-jAMdp3_i.js → passport-D6ZhqZ1F.js} +1 -1
- package/dist/assets/{passport-item-regWhYCV.js → passport-item-Dx140DTL.js} +1 -1
- package/dist/assets/{permission-PnySJGEl.js → permission-HtrJm1h2.js} +1 -1
- package/dist/assets/{preferences-BdtsycEO.js → preferences-Dri2a4fE.js} +1 -1
- package/dist/assets/{profile-embed-BjhIRlnb.js → profile-embed-BpG6-Rqz.js} +1 -1
- package/dist/assets/{publish-resource-B_cHs_c_.js → publish-resource-CruXcF2L.js} +1 -1
- package/dist/assets/{runtime-B9zsyQJH.js → runtime-Ck_rDqm2.js} +1 -1
- package/dist/assets/sdk-C3wBexZ2.js +1 -0
- package/dist/assets/{security-DsvOVk8Y.js → security-Duf_ZEVi.js} +1 -1
- package/dist/assets/{session-nLCSznMa.js → session-Cm8j8XeZ.js} +1 -1
- package/dist/assets/{setup-D28cEOB_.js → setup-COruOAew.js} +1 -1
- package/dist/assets/{spaces-B6hICxl4.js → spaces-BuZf3GoQ.js} +1 -1
- package/dist/assets/{start-D6x0fYx9.js → start-D_yHRXzR.js} +1 -1
- package/dist/assets/{starting-progress-D4qoLrH0.js → starting-progress-DahUM5Xo.js} +1 -1
- package/dist/assets/{status-BOjZ6Vaq.js → status-DVjLoqLm.js} +1 -1
- package/dist/assets/{step-actions-Cfagh9Pk.js → step-actions-DkehnzsP.js} +1 -1
- package/dist/assets/{studio-D_ap2IaO.js → studio-D4hiQNwZ.js} +1 -1
- package/dist/assets/{team-BETRxUUw.js → team-DNuHMrzV.js} +1 -1
- package/dist/assets/{traffic-CYr-3G37.js → traffic-B0WH67Yr.js} +1 -1
- package/dist/assets/{transfer-Cg9oSSyL.js → transfer-BpjPR3S_.js} +1 -1
- package/dist/assets/{unsubscribe-Csiks0SI.js → unsubscribe-CzgQXfYP.js} +1 -1
- package/dist/assets/{use-app-logo-BgQdzlhG.js → use-app-logo-CZWb8lrs.js} +1 -1
- package/dist/assets/{user-center-CGXOHu_w.js → user-center-DndqALOV.js} +1 -1
- package/dist/assets/{user-follower-__aq0tH0.js → user-follower-Bzb2ZR_9.js} +1 -1
- package/dist/assets/{util-Bps9wpLH.js → util-CVjlaHo_.js} +1 -1
- package/dist/assets/{util-D27AtnBb.js → util-DIVJQVg1.js} +1 -1
- package/dist/assets/{wait-connect-AqdGAvY7.js → wait-connect-Be1Dmt0P.js} +1 -1
- package/dist/assets/{wizard-asHyteJr.js → wizard-BhUdbQos.js} +1 -1
- package/dist/assets/{wizard-components-YsOxzGWe.js → wizard-components-D3PqSMGt.js} +1 -1
- package/dist/assets/{wrap-locale-Dfmt13Mn.js → wrap-locale-DtcRIeKF.js} +1 -1
- package/dist/assets/{zh-DEgV10nE.js → zh-B_cpka88.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +23 -23
- package/dist/assets/engine-0ct2xW2c.js +0 -1
- package/dist/assets/sdk-CkLW4ZmH.js +0 -1
|
@@ -402,6 +402,7 @@ const init = ({ node, notificationService }) => {
|
|
|
402
402
|
job: {
|
|
403
403
|
email,
|
|
404
404
|
notificationId: notification.id,
|
|
405
|
+
teamDid: teamDid ?? nodeInfo.did,
|
|
405
406
|
input: {
|
|
406
407
|
notification,
|
|
407
408
|
sender,
|
|
@@ -525,6 +526,7 @@ const init = ({ node, notificationService }) => {
|
|
|
525
526
|
job: {
|
|
526
527
|
url,
|
|
527
528
|
notificationId: notification.id,
|
|
529
|
+
teamDid: teamDid ?? nodeInfo.did,
|
|
528
530
|
input: {
|
|
529
531
|
notification,
|
|
530
532
|
sender,
|
|
@@ -607,6 +609,7 @@ const init = ({ node, notificationService }) => {
|
|
|
607
609
|
receiver: receiverDid,
|
|
608
610
|
isResend,
|
|
609
611
|
pushOnly: props.pushOnly && !isResend,
|
|
612
|
+
teamDid: teamDid ?? nodeInfo.did,
|
|
610
613
|
},
|
|
611
614
|
delay: 10,
|
|
612
615
|
});
|
|
@@ -652,6 +655,7 @@ const init = ({ node, notificationService }) => {
|
|
|
652
655
|
isResend,
|
|
653
656
|
pushOnly: props.pushOnly && !isResend,
|
|
654
657
|
source,
|
|
658
|
+
teamDid: teamDid ?? nodeInfo.did,
|
|
655
659
|
},
|
|
656
660
|
delay: 5,
|
|
657
661
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as E,j as e,ak as l,y as h,bW as A,bX as g,bY as y,at as L,W as N}from"./vendor-mui-core-DnR6WYuU.js";import{r as m}from"./vendor-react-CTtPmzVP.js";import{V as I,H as j}from"./vendor-ux-DfSgTRg5.js";import{A as b}from"./config-
|
|
1
|
+
import{D as E,j as e,ak as l,y as h,bW as A,bX as g,bY as y,at as L,W as N}from"./vendor-mui-core-DnR6WYuU.js";import{r as m}from"./vendor-react-CTtPmzVP.js";import{V as I,H as j}from"./vendor-ux-DfSgTRg5.js";import{A as b}from"./config-Co1ZhGgP.js";import{a as O}from"./page-header-CHAwrgX-.js";import{y as v,q as R,c as o,r as Y}from"./index-BHa1_Bjz.js";import{S as T}from"./layout-DkW-u1GX.js";import{S as W}from"./step-actions-DkehnzsP.js";import{S as D}from"./button-D6RwAFss.js";import"./vendor-utils-drLlzTVq.js";import"./vendor-hooks-cYMUGE4V.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CPCSE54a.js";import"./content-layout-DmSBGGVm.js";import"./use-mobile-D5clNlrm.js";function P({onNext:a=()=>{}}){const C=E(),{t:n,locale:p}=I(),[i,c]=m.useState(!1),[S,d]=m.useState(""),{blocklet:r}=v();m.useEffect(()=>{const t=R.findServiceFromMeta(r.meta,o.NODE_SERVICES.AUTH);d(t?.config?.whoCanAccess||o.WHO_CAN_ACCESS.ALL)},[r]);const f=async t=>{let s=o.ACCESS_POLICY_PUBLIC;t===o.WHO_CAN_ACCESS.ALL?s=o.ACCESS_POLICY_PUBLIC:t===o.WHO_CAN_ACCESS.INVITED?s=o.ACCESS_POLICY_INVITED_ONLY:t===o.WHO_CAN_ACCESS.OWNER?s=o.ACCESS_POLICY_OWNER_ONLY:t===o.WHO_CAN_ACCESS.ADMIN&&(s=o.ACCESS_POLICY_ADMIN_ONLY);try{c(!0),await Y.updateBlockletSecurityRule({input:{did:r.meta.did,data:{id:o.SECURITY_RULE_DEFAULT_ID,accessPolicyId:s}}}),c(!1)}catch(_){c(!1),j.error(_.message)}},x=async t=>{i||(d(t.target.value),await f(t.target.value))},u={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:C.palette.text.secondary};return e.jsxs(k,{children:[e.jsx(l,{className:"header",children:e.jsx(O,{title:n("blocklet.config.access.title"),subTitle:n("blocklet.config.access.description")})}),e.jsx(l,{className:"form-container",children:e.jsx(h,{component:"fieldset",children:e.jsx(A,{name:"inherit",value:S,onChange:x,children:b.map(t=>e.jsxs(l,{sx:{mb:2,"&:last-child":{mb:0}},children:[e.jsx(g,{value:t.value,control:e.jsx(y,{size:"small",color:"primary"}),label:e.jsxs("span",{style:{display:"flex",alignItems:"center",position:"relative"},children:[e.jsx(t.icon,{style:u}),e.jsx("span",{style:{marginTop:2},children:t.title[p]})]})}),e.jsx(l,{className:"tip",children:t.description[p]})]},t.value))})})}),e.jsx(W,{mt:8,disabled:i,blocklet:r,onStartNow:()=>a("complete"),children:e.jsx(D,{loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:n("setup.continue")})})]})}P.propTypes={onNext:N.func};const k=L(T)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
.header {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as Ut,T as je,J as Yt,bX as ei,a5 as ti,I as No,cy as Ao,S as Do,cu as va,ba as ya,aP as Mo,F as ba,z as Hn,bv as xa,bw as wa,bx as Sa,bf as Ea,aZ as Bo,V as ka,aO as Ta,cP as ja,cQ as Oa,cq as Ca,cG as Ia,M as ni,am as Fo,aq as Ra,b6 as lt,c5 as Pa,c7 as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,ca as Wo,o as zo,aU as Aa,ar as Xt,cR as Da,cS as Ma,b4 as ki,U as Ti,ah as Ba,bg as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,cT as Va}from"./vendor-mui-core-DnR6WYuU.js";import{r as q,g as ri,j as Ka,u as Ga,p as Ha,e as Xa,a as $t,d as Ya,f as Rn,m as Ja}from"./vendor-react-CTtPmzVP.js";import{r as ii,S as Qa,s as Ko,A as Za}from"./item-
|
|
1
|
+
import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as Ut,T as je,J as Yt,bX as ei,a5 as ti,I as No,cy as Ao,S as Do,cu as va,ba as ya,aP as Mo,F as ba,z as Hn,bv as xa,bw as wa,bx as Sa,bf as Ea,aZ as Bo,V as ka,aO as Ta,cP as ja,cQ as Oa,cq as Ca,cG as Ia,M as ni,am as Fo,aq as Ra,b6 as lt,c5 as Pa,c7 as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,ca as Wo,o as zo,aU as Aa,ar as Xt,cR as Da,cS as Ma,b4 as ki,U as Ti,ah as Ba,bg as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,cT as Va}from"./vendor-mui-core-DnR6WYuU.js";import{r as q,g as ri,j as Ka,u as Ga,p as Ha,e as Xa,a as $t,d as Ya,f as Rn,m as Ja}from"./vendor-react-CTtPmzVP.js";import{r as ii,S as Qa,s as Ko,A as Za}from"./item-B3LlwO_A.js";import{w as vt,aJ as oi,J as Go,V as xt,z as yt,p as el,r as tl,o as Xn,H as Yn,bh as Oi,l as Qt,K as Ho,$ as Vn,aX as Xo,aa as nl,aN as rl,ay as Fr,bi as il}from"./vendor-ux-DfSgTRg5.js";import{Z as dn,q as Ft,c as ol,bB as sl,bC as al,bD as Yo,bE as ll,bF as cl,bG as ul,bH as dl,z as hl,J as Mt,_ as fl,l as Jo,bI as pl,bJ as ml,ay as gl,bK as vl,Y as Jn,bL as Qo,bw as Zo,k as Qn,be as Ci,bM as yl,bu as bl,bN as xl,bO as wl,bP as Pn,bQ as Ii,bR as Sl}from"./index-BHa1_Bjz.js";import{j as Ri,o as El,T as kl,L as Tl,P as jl}from"./vendor-arcblock-CPCSE54a.js";import{u as Pi}from"./launch-result-message-MNpx7ysR.js";import{a as $r}from"./page-header-CHAwrgX-.js";import{e as gt,B as Ol,C as rn,J as Zn,D as Li,a4 as es,$ as Cl,a9 as Il,A as Rl,o as sr,aa as Pl,ah as Ll,ai as _l,aj as Nl,a as xn,ak as Al,b as Dl}from"./vendor-utils-drLlzTVq.js";import{f as Ur}from"./index-DBs9Ljax.js";import{e as Ml}from"./engine-BzngvK61.js";import{u as Bl,C as Fl}from"./config-space-zEV0JkDF.js";import{R as Ln}from"./required-BQln5OcV.js";import{S as $l}from"./index-seQ_ufVM.js";import{s as ts,h as Ul,w as ql,f as Wl,a as zl,b as Vl,c as Kl,M as Gl}from"./index-B0Q9wWG1.js";import{q as On,a as Hl,b as Xl,u as ns,g as Yl,v as Jl}from"./vendor-hooks-cYMUGE4V.js";import{g as Ql}from"./get-safe-url-CqAaHb9L.js";import{r as rs,A as Zl}from"./config-DuS3gx_m.js";import{r as ec}from"./index-_tncRnTu.js";import{r as tc}from"./cloneDeep-BbaR0xRl.js";import{u as si}from"./useLocalStorage-BV1BIwfo.js";import{v as _i}from"./index-BP_Fl0Mu.js";import{u as nc}from"./session-Cm8j8XeZ.js";import{W as rc}from"./did-address-DqhneWXa.js";import{a as Ni}from"./api-C_w0YD2j.js";import{v as ic,e as oc}from"./util-DIVJQVg1.js";import{u as is}from"./use-mobile-BINJTzMb.js";import{C as sc}from"./content-layout-DmSBGGVm.js";import{C as ac,D as lc,a as cc}from"./connect-to-eBtGI4_9.js";import{d as ar}from"./search-4YYphs0l.js";const _f="blocklet-add-component-registry",Nf="server-add-registry",Af=e=>`resource-${e}-add-registry`;function os(e){const{info:t}=dn();return q.useMemo(()=>!e||!e.docker?.image||e.docker?.image&&e.docker?.runBaseScript?!0:window.blocklet?window.blocklet.enableDocker&&window.blocklet.enableDockerNetwork:t.enableDocker&&t.enableDockerNetwork,[e,t])}function ss({disabled:e=!1,children:t,onConfirm:r}){return q.useEffect(()=>{if(e)return()=>{};const i=s=>{s.code==="Enter"&&(s.metaKey===!0||s.ctrlKey===!0)&&(s.preventDefault(),s.stopPropagation(),r())};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[e,r]),t}ss.propTypes={disabled:B.bool,children:B.any.isRequired,onConfirm:B.func.isRequired};function as({onContinue:e,nextDisabled:t=!1,launching:r=!1,texts:i={listenName:"",launchingText:"",buttonNext:""},description:s=""}){const[n,o]=q.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(uc,{children:l.jsxs(ss,{disabled:t,onConfirm:e,children:[l.jsx("div",{className:"eula-trigger",onClick:()=>o(a=>!a),children:i.listenName}),l.jsx(vt,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:r?l.jsxs(l.Fragment,{children:[l.jsx(Tt,{size:14}),i.launchingText]}):i.buttonNext})]})}),l.jsx(oi,{open:n,title:i.listenName,onClose:()=>o(!1),children:s})]})}as.propTypes={onContinue:B.func.isRequired,nextDisabled:B.bool,launching:B.bool,description:B.any,texts:B.object};const uc=tt.div`
|
|
2
2
|
margin: 0 auto;
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -203,7 +203,7 @@ import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as Ut,T as je,J as Yt,bX as ei
|
|
|
203
203
|
* is-var-name | ISC (c) Shinnosuke Watanabe
|
|
204
204
|
* https://github.com/shinnn/is-var-name
|
|
205
205
|
*/function eu(e){if(typeof e!="string"||e.trim()!==e)return!1;try{new Function(e,"var "+e)}catch{return!1}return!0}const tu=Object.freeze(Object.defineProperty({__proto__:null,default:eu},Symbol.toStringTag,{value:"Module"})),nu=Xa(tu);var Ge={},eo;function ru(){if(eo)return Ge;eo=1;const e=ii();function t(W){return W&&typeof W=="object"&&"default"in W?W.default:W}const r=t(e),i={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},s={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},n={"-rm":!0,"--name":!0,"--label":!0,"--network":!0,"--user":!0},o={"--volume":!0,"--publish":!0},a=new Set(["--publish","--volume"]),d=W=>{const[U]=W.split(":");return U?.startsWith("/")||U?.startsWith("./")||U?.startsWith("../")||U?.startsWith("~")||U?.startsWith("$BLOCKLET")};function h(W){return W.map(U=>{if(U.key!=="--volume"||U.value.startsWith("$BLOCKLET_APP_DIR/")||U.value.startsWith("$BLOCKLET_DATA_DIR/"))return U;const[H,...A]=U.value.split(":");if(!H||!d(U.value))return U;const J=H.startsWith("/")?`$BLOCKLET_DATA_DIR${H}`:`$BLOCKLET_DATA_DIR/${H}`;return{...U,value:[J,...A].join(":")}})}function u(W){let U=!0;return W.find(A=>A.key==="--publish"&&A.type==="web")?W.map(A=>{if(A.key==="--publish"){const J={...A,type:U?"docker":A.type};return U=A.type==="web",J}return A}):W.map(A=>{if(A.key==="--publish"){const J={...A,type:U?"web":"docker"};return U=!1,J}return A})}function f(W){if(!W)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(W=W.trim(),W.startsWith("$ docker run")&&(W=W.replace("$ docker run","docker run")),!W.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const H=W.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!H)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const A=[],J=[];let M=0,ue="",Ie="";const K=[];for(;M<H.length;){const ce=H[M];if(!ce){M++;continue}if(ce==="docker"||ce==="run"){M++;continue}if((ce==="-e"||ce==="--env")&&M+1<H.length){const Me=H[M+1]||"",[me,...Oe]=Me.split("=");if(me){const Pe=Oe.join("=").replace(/^['"]|['"]$/g,"");J.push({key:me,value:Pe})}M+=2;continue}if(ce.startsWith("-")&&K.length===0){const Me=ce.indexOf("=");let me=ce,Oe=null;Me!==-1&&(me=ce.substring(0,Me),Oe=ce.substring(Me+1).replace(/^['"]|['"]$/g,""));const Pe=i[me];if(!Pe){M+=2;continue}if(Pe==="--publish"){let nt="";if(Oe)nt=Oe,A.push({key:Pe,value:nt});else if(M+1<H.length&&!(H[M+1]||"").startsWith("-")){nt=(H[M+1]||"").replace(/^['"]|['"]$/g,""),A.push({key:Pe,value:nt}),M+=2;continue}else{A.push({key:Pe,value:"true"}),M++;continue}M++;continue}if(Oe!==null){A.push({key:Pe,value:Oe}),M++;continue}else if(M+1<H.length&&!(H[M+1]||"").startsWith("-")){const nt=(H[M+1]||"").replace(/^['"]|['"]$/g,"");A.push({key:Pe,value:nt}),M+=2;continue}else{A.push({key:Pe,value:"true"}),M++;continue}}K.push(ce),M++}ue=K[0]||"",Ie=K.slice(1).join(" ");const Ee=[];for(const ce of A)ce.name="",ce.path="",ce.prefix="",ce.protocol="",ce.proxyBehavior="service",ce.type="docker",!(a.has(ce.key)&&ce.value==="true")&&Ee.push(ce);for(const ce of J)ce.custom="",ce.description="",ce.secure=!1,ce.shared=!1,ce.required=!1;return{dockerArgs:u(h(Ee)),dockerEnvs:J,dockerImage:ue,dockerCommand:Ie}}function j({dockerArgs:W,dockerEnvs:U,dockerImage:H,dockerCommand:A}){if(W.length===0&&U.length===0&&!H)return"";const J=["docker run \\"],M=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const ue of W){const{key:Ie,value:K}=ue;if(M.has(Ie))if(K==="true")J.push(` ${Ie} \\`);else{const Ee=/[\s"']/g.test(K)?`"${K}"`:K;J.push(` ${Ie} ${Ee} \\`)}else if(!J.some(Ee=>Ee.startsWith(` ${Ie}`)))if(K==="true")J.push(` ${Ie} \\`);else{const Ee=/[\s"']/g.test(K)?`"${K}"`:K;J.push(` ${Ie} ${Ee} \\`)}}for(const ue of U){const{key:Ie,value:K}=ue,Ee=/["']/g.test(K)?K:`"${K}"`;J.push(` -e ${Ie}=${Ee} \\`)}return H&&J.push(` ${H} \\`),A&&J.push(` ${A} \\`),J[J.length-1]?.endsWith(" \\")&&(J[J.length-1]=(J[J.length-1]||"").slice(0,-2)),J.join(`
|
|
206
|
-
`)}const m={"--volume":W=>{const[U]=W.split(":");return U?d(W)&&!W.startsWith("$BLOCKLET_APP_DIR/")&&!W.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":W.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},S=W=>W.replace(/^[-]+/,"").replace(/-([a-z])/g,(A,J)=>J.toUpperCase()),E=W=>`--${W.replace(/([A-Z])/g,"-$1").toLowerCase()}`,C=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],c=["rm ","sudo "];function N(W){if(W==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(W))throw new Error("Docker CMD is invalid");const H=W.toLocaleLowerCase();if(c.some(J=>H.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(C.some(J=>W.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(W))throw new Error("Docker CMD is invalid")}const $=Array.from(new Set(Object.keys(s).map(S))),O=["publish","volume"],w=r.object({workdir:r.string().trim().optional(),image:r.string().trim().regex(/^[^\s]+$/).optional(),shell:r.string().trim().optional(),volumes:r.array().items(r.string().trim()).optional(),script:r.string().trim().optional(),installNodeModules:r.boolean().optional(),skipWrapDockerfile:r.boolean().optional(),command:r.string().allow("").default("").optional().custom((W,U)=>{try{return N(W),W}catch(H){return U.error("any.invalid",{message:H.message})}},"Docker CMD validation"),runBaseScript:r.boolean().optional(),...$.reduce((W,U)=>{const H=m[E(U)];return O.includes(U)?(W[U]=r.array().items(r.string().trim()).optional(),H?W[U]=r.array().items(r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A})).optional():W[U]=r.array().items(r.string().trim()).optional(),W):(H?W[U]=r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A}).optional():W[U]=r.string().trim().optional(),W)},{})}).optional(),R=W=>{const U=/^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?\/)?(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(:[a-zA-Z0-9_.-]+)?$/;return r.string().trim().regex(U).required().validate(W)},F=(W,U,H)=>{const A={};H.forEach(M=>{const ue=S(M.key);O.includes(ue)?A[ue]=[...A[ue]||[],M.value]:A[ue]=M.value});const{error:J}=R(W);if(J)return{error:J,value:A};try{N(W)}catch(M){return{error:M,value:A}}return A.image=W,A.command=U||"",w.validate(A)};function D(W,U){const H=JSON.parse(JSON.stringify(U)),A=new Map;let J=1;const M=[];return H.forEach(ue=>{if(ue.key==="--publish"){const K=ue.value.split(":");let Ee="127.0.0.1",ce="",Me="";K.length===2?[ce,Me]=K:K.length===3?[Ee,ce,Me]=K:K.length===1&&(Me=K[0]||"");let me=A.get(ce||"");if(me||(me=`$BLOCKLET_PORT_${J++}`,A.set(ce||"",me)),!M.find(Oe=>Oe.port===ce)){const Oe=ue.type||"docker",Pe=`${W.replace(/\W/g,"-")}-${M.length+1}`;M.push({type:Oe,proxyBehavior:ue.proxyBehavior||"",name:Pe,path:`/${Pe}`,port:ce||Me,containerPort:Number(Me)||0,hostIP:Ee,prefix:Oe==="docker"?`/${Pe}`:ue.prefix||"*"})}}}),M}function ne(W,U=!1){const H=[];if(!W)return H;for(const A of W){const J={name:A.key,default:A.value===`$${A.key}`?"":A.value,secure:A.secure!==void 0?A.secure:!1,shared:A.shared!==void 0?A.shared:!1,required:A.required!==void 0?A.required:!1,description:A.description||A.key};U||(J.custom=A.custom||""),H.push(J)}return H}function Y(W,U){const H=JSON.parse(JSON.stringify(W));return U.split(".").map(J=>{const M=J.match(/(.+)\[(.+?)\]/);return M?[M[1],M[2]]:J}).flat().filter(Boolean).reduce((J,M)=>{if(!J||!M)return;const ue=M?.match(/(.+?)=(.+)/);if(Array.isArray(J)&&ue){const[,K,Ee]=ue;return K&&Ee&&(J=J.find(ce=>{const Me=Object.keys(ce).find(me=>me.toLowerCase()===K.toLowerCase());return Me&&ce[Me]===Ee})),J}const Ie=Object.keys(J).find(K=>K.toLowerCase()===M.toLowerCase());return Ie?J[Ie]:void 0},H)}return Ge.addBlockletPrefixVolume=h,Ge.allowDockerArgs=s,Ge.autoSetDockerArgs=n,Ge.dockerArgsToCamelCase=S,Ge.dockerArgsValidator=m,Ge.dockerBuildCommand=j,Ge.dockerCamelCaseToDash=E,Ge.dockerCmdValidator=N,Ge.dockerParseCommand=f,Ge.dockerParseEnvironments=ne,Ge.dockerParsePublishPorts=D,Ge.dockerSchema=w,Ge.getObjByPath=Y,Ge.isVolumePath=d,Ge.multiValueArgs=O,Ge.notAllowUseCustomDockerArgs=o,Ge.parseDockerArgsToSchema=F,Ge.whiteDockerArgs=i,Ge}var vn={},to;function iu(){if(to)return vn;to=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.toBlockletDid=void 0;const e=el(),t=tl(),r=Xn(),i=s=>{if((0,r.isValid)(s))return s;const n=(0,t.toHex)(Ol.from(typeof s=="string"?s.trim():s));return(0,r.fromPublicKey)(n,{role:e.types.RoleType.ROLE_ANY})};return vn.toBlockletDid=i,vn}var Nt={},no;function ou(){if(no)return Nt;no=1;var e=Nt&&Nt.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.didExtension=Nt.fileExtension=void 0;const t=e(rs),r=e(ec()),i=Xn(),s=o=>({type:"file",base:o.string(),validate(a,{error:d}){return a&&typeof a=="string"?{value:a}:{errors:d("file.empty",{file:a})}},messages:{"file.empty":'file "{{#file}}" must be non-empty string',"file.enoent":'file "{{#file}}" does not exist',"file.error.generic":'file could not be read. message: "{{#message}}"'},rules:{exists:{multi:!1,method({baseDir:a=null,canSkip:d=()=>!1}={}){return this.$_addRule({name:"exists",args:{baseDir:a,canSkip:d}})},args:[{name:"baseDir",assert:a=>t.default.existsSync(a),message:"baseDir must exist"},{name:"canSkip",assert:a=>typeof a=="function",message:"canSkip must be a function"}],validate(a,{error:d},{baseDir:h,canSkip:u}={}){if(typeof u=="function"&&u(h,a))return a;try{return t.default.statSync(r.default.join(h,a)),a}catch(f){switch(f.code){case"ENOENT":return d("file.enoent",{file:a})}return d("file.error.generic",{message:f.message})}}}}});Nt.fileExtension=s;const n=o=>({type:"DID",base:o.string(),validate(a,{error:d}){return!a||typeof a!="string"?{errors:d("did.empty",{did:a})}:(0,i.isValid)(a)===!1?{errors:d("did.invalid",{did:a})}:{value:a}},messages:{"did.empty":'did "{{#did}}" must be non-empty string',"did.invalid":'did "{{#did}}" is not valid'}});return Nt.didExtension=n,Nt.default={fileExtension:s,didExtension:n},Nt}var yn={},Er={exports:{}};const su=["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"];var ro;function au(){if(ro)return Er.exports;ro=1;var e=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),t=su,r=["node_modules","favicon.ico"],i=Er.exports=function(n){var o=[],a=[];if(n===null)return a.push("name cannot be null"),s(o,a);if(n===void 0)return a.push("name cannot be undefined"),s(o,a);if(typeof n!="string")return a.push("name must be a string"),s(o,a);if(n.length||a.push("name length must be greater than zero"),n.match(/^\./)&&a.push("name cannot start with a period"),n.match(/^_/)&&a.push("name cannot start with an underscore"),n.trim()!==n&&a.push("name cannot contain leading or trailing spaces"),r.forEach(function(f){n.toLowerCase()===f&&a.push(f+" is a blacklisted name")}),t.forEach(function(f){n.toLowerCase()===f&&o.push(f+" is a core module name")}),n.length>214&&o.push("name can no longer contain more than 214 characters"),n.toLowerCase()!==n&&o.push("name can no longer contain capital letters"),/[~'!()*]/.test(n.split("/").slice(-1)[0])&&o.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(n)!==n){var d=n.match(e);if(d){var h=d[1],u=d[2];if(encodeURIComponent(h)===h&&encodeURIComponent(u)===u)return s(o,a)}a.push("name can only contain URL-friendly characters")}return s(o,a)};i.scopedPackagePattern=e;var s=function(n,o){var a={validForNewPackages:o.length===0&&n.length===0,validForOldPackages:o.length===0,warnings:n,errors:o};return a.warnings.length||delete a.warnings,a.errors.length||delete a.errors,a};return Er.exports}var io;function ms(){return io||(io=1,function(e){var t=yn&&yn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateName=e.validateNewDid=void 0;const r=Xn(),i=t(au()),s=32,n=a=>{if((0,r.toTypeInfo)(a).role!==r.types.RoleType.ROLE_BLOCKLET)throw new Error("Blocklet DID's type must be ROLE_BLOCKLET")};e.validateNewDid=n;const o=(a,{checkDid:d=!0}={})=>{if((0,r.isValid)(a))d&&(0,e.validateNewDid)(a);else{const{validForNewPackages:h,errors:u=[],warnings:f=[]}=(0,i.default)(a);if(!h)throw new Error(u[0]||f[0]);if(a.length>s)throw new Error("Blocklet name is too long")}};e.validateName=o,e.default={validateName:e.validateName,validateNewDid:e.validateNewDid}}(yn)),yn}var oo;function gs(){if(oo)return ae;oo=1;var e=ae&&ae.__importDefault||function(V){return V&&V.__esModule?V:{default:V}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Joi=ae.eventsSchema=ae.installBlockletDescriptionSchema=ae.installBlockletTitleSchema=ae.resourceBundleSchema=ae.authConfigSchema=ae.cacheableSchema=ae.statsSchema=ae.titleSchema=ae.themeSchema=ae.signatureSchema=ae.serviceSchema=ae.scriptsSchema=ae.personSchema=ae.navigationSchema=ae.navigationItemSchema=ae.updateMountPointSchema=ae.mountPointSchema=ae.logoSchema=ae.interfaceSchema=ae.environmentNameSchema=ae.environmentSchema=ae.engineSchema=ae.endpointSchema=ae.distSchema=ae.descriptionSchema=ae.createBlockletSchema=ae.componentSchema=ae.blockletNameSchema=ae.blockletMetaSchema=void 0;const t=e(rs),r=e(ii()),i=e(Xc()),s=e(Jc()),n=Zc(),o=e(nu),a=al(),d=Xn(),h=ru(),u=Yo(),f=iu(),j=ou(),m=ms(),S=ll(),E=i.default.default,C="/.well-known",c=r.default.extend(n.semver).extend(n.semverRange).extend(j.fileExtension).extend(j.didExtension);ae.Joi=c;const N=(V,he)=>(0,S.checkLink)(V)?V:he.message(`Invalid navigation link: ${V}
|
|
206
|
+
`)}const m={"--volume":W=>{const[U]=W.split(":");return U?d(W)&&!W.startsWith("$BLOCKLET_APP_DIR/")&&!W.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":W.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},S=W=>W.replace(/^[-]+/,"").replace(/-([a-z])/g,(A,J)=>J.toUpperCase()),E=W=>`--${W.replace(/([A-Z])/g,"-$1").toLowerCase()}`,C=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],c=["rm ","sudo "];function N(W){if(W==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(W))throw new Error("Docker CMD is invalid");const H=W.toLocaleLowerCase();if(c.some(J=>H.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(C.some(J=>W.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(W))throw new Error("Docker CMD is invalid")}const $=Array.from(new Set(Object.keys(s).map(S))),O=["publish","volume"],w=r.object({workdir:r.string().trim().optional(),image:r.string().trim().regex(/^[^\s]+$/).optional(),shell:r.string().trim().optional(),volumes:r.array().items(r.string().trim()).optional(),script:r.string().trim().optional(),installNodeModules:r.boolean().optional(),skipWrapDockerfile:r.boolean().optional(),tmpfs:r.string().trim().optional(),command:r.string().allow("").default("").optional().custom((W,U)=>{try{return N(W),W}catch(H){return U.error("any.invalid",{message:H.message})}},"Docker CMD validation"),runBaseScript:r.boolean().optional(),...$.reduce((W,U)=>{const H=m[E(U)];return O.includes(U)?(W[U]=r.array().items(r.string().trim()).optional(),H?W[U]=r.array().items(r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A})).optional():W[U]=r.array().items(r.string().trim()).optional(),W):(H?W[U]=r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A}).optional():W[U]=r.string().trim().optional(),W)},{})}).optional(),R=W=>{const U=/^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?\/)?(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(:[a-zA-Z0-9_.-]+)?$/;return r.string().trim().regex(U).required().validate(W)},F=(W,U,H)=>{const A={};H.forEach(M=>{const ue=S(M.key);O.includes(ue)?A[ue]=[...A[ue]||[],M.value]:A[ue]=M.value});const{error:J}=R(W);if(J)return{error:J,value:A};try{N(W)}catch(M){return{error:M,value:A}}return A.image=W,A.command=U||"",w.validate(A)};function D(W,U){const H=JSON.parse(JSON.stringify(U)),A=new Map;let J=1;const M=[];return H.forEach(ue=>{if(ue.key==="--publish"){const K=ue.value.split(":");let Ee="127.0.0.1",ce="",Me="";K.length===2?[ce,Me]=K:K.length===3?[Ee,ce,Me]=K:K.length===1&&(Me=K[0]||"");let me=A.get(ce||"");if(me||(me=`$BLOCKLET_PORT_${J++}`,A.set(ce||"",me)),!M.find(Oe=>Oe.port===ce)){const Oe=ue.type||"docker",Pe=`${W.replace(/\W/g,"-")}-${M.length+1}`;M.push({type:Oe,proxyBehavior:ue.proxyBehavior||"",name:Pe,path:`/${Pe}`,port:ce||Me,containerPort:Number(Me)||0,hostIP:Ee,prefix:Oe==="docker"?`/${Pe}`:ue.prefix||"*"})}}}),M}function ne(W,U=!1){const H=[];if(!W)return H;for(const A of W){const J={name:A.key,default:A.value===`$${A.key}`?"":A.value,secure:A.secure!==void 0?A.secure:!1,shared:A.shared!==void 0?A.shared:!1,required:A.required!==void 0?A.required:!1,description:A.description||A.key};U||(J.custom=A.custom||""),H.push(J)}return H}function Y(W,U){const H=JSON.parse(JSON.stringify(W));return U.split(".").map(J=>{const M=J.match(/(.+)\[(.+?)\]/);return M?[M[1],M[2]]:J}).flat().filter(Boolean).reduce((J,M)=>{if(!J||!M)return;const ue=M?.match(/(.+?)=(.+)/);if(Array.isArray(J)&&ue){const[,K,Ee]=ue;return K&&Ee&&(J=J.find(ce=>{const Me=Object.keys(ce).find(me=>me.toLowerCase()===K.toLowerCase());return Me&&ce[Me]===Ee})),J}const Ie=Object.keys(J).find(K=>K.toLowerCase()===M.toLowerCase());return Ie?J[Ie]:void 0},H)}return Ge.addBlockletPrefixVolume=h,Ge.allowDockerArgs=s,Ge.autoSetDockerArgs=n,Ge.dockerArgsToCamelCase=S,Ge.dockerArgsValidator=m,Ge.dockerBuildCommand=j,Ge.dockerCamelCaseToDash=E,Ge.dockerCmdValidator=N,Ge.dockerParseCommand=f,Ge.dockerParseEnvironments=ne,Ge.dockerParsePublishPorts=D,Ge.dockerSchema=w,Ge.getObjByPath=Y,Ge.isVolumePath=d,Ge.multiValueArgs=O,Ge.notAllowUseCustomDockerArgs=o,Ge.parseDockerArgsToSchema=F,Ge.whiteDockerArgs=i,Ge}var vn={},to;function iu(){if(to)return vn;to=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.toBlockletDid=void 0;const e=el(),t=tl(),r=Xn(),i=s=>{if((0,r.isValid)(s))return s;const n=(0,t.toHex)(Ol.from(typeof s=="string"?s.trim():s));return(0,r.fromPublicKey)(n,{role:e.types.RoleType.ROLE_ANY})};return vn.toBlockletDid=i,vn}var Nt={},no;function ou(){if(no)return Nt;no=1;var e=Nt&&Nt.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.didExtension=Nt.fileExtension=void 0;const t=e(rs),r=e(ec()),i=Xn(),s=o=>({type:"file",base:o.string(),validate(a,{error:d}){return a&&typeof a=="string"?{value:a}:{errors:d("file.empty",{file:a})}},messages:{"file.empty":'file "{{#file}}" must be non-empty string',"file.enoent":'file "{{#file}}" does not exist',"file.error.generic":'file could not be read. message: "{{#message}}"'},rules:{exists:{multi:!1,method({baseDir:a=null,canSkip:d=()=>!1}={}){return this.$_addRule({name:"exists",args:{baseDir:a,canSkip:d}})},args:[{name:"baseDir",assert:a=>t.default.existsSync(a),message:"baseDir must exist"},{name:"canSkip",assert:a=>typeof a=="function",message:"canSkip must be a function"}],validate(a,{error:d},{baseDir:h,canSkip:u}={}){if(typeof u=="function"&&u(h,a))return a;try{return t.default.statSync(r.default.join(h,a)),a}catch(f){switch(f.code){case"ENOENT":return d("file.enoent",{file:a})}return d("file.error.generic",{message:f.message})}}}}});Nt.fileExtension=s;const n=o=>({type:"DID",base:o.string(),validate(a,{error:d}){return!a||typeof a!="string"?{errors:d("did.empty",{did:a})}:(0,i.isValid)(a)===!1?{errors:d("did.invalid",{did:a})}:{value:a}},messages:{"did.empty":'did "{{#did}}" must be non-empty string',"did.invalid":'did "{{#did}}" is not valid'}});return Nt.didExtension=n,Nt.default={fileExtension:s,didExtension:n},Nt}var yn={},Er={exports:{}};const su=["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"];var ro;function au(){if(ro)return Er.exports;ro=1;var e=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),t=su,r=["node_modules","favicon.ico"],i=Er.exports=function(n){var o=[],a=[];if(n===null)return a.push("name cannot be null"),s(o,a);if(n===void 0)return a.push("name cannot be undefined"),s(o,a);if(typeof n!="string")return a.push("name must be a string"),s(o,a);if(n.length||a.push("name length must be greater than zero"),n.match(/^\./)&&a.push("name cannot start with a period"),n.match(/^_/)&&a.push("name cannot start with an underscore"),n.trim()!==n&&a.push("name cannot contain leading or trailing spaces"),r.forEach(function(f){n.toLowerCase()===f&&a.push(f+" is a blacklisted name")}),t.forEach(function(f){n.toLowerCase()===f&&o.push(f+" is a core module name")}),n.length>214&&o.push("name can no longer contain more than 214 characters"),n.toLowerCase()!==n&&o.push("name can no longer contain capital letters"),/[~'!()*]/.test(n.split("/").slice(-1)[0])&&o.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(n)!==n){var d=n.match(e);if(d){var h=d[1],u=d[2];if(encodeURIComponent(h)===h&&encodeURIComponent(u)===u)return s(o,a)}a.push("name can only contain URL-friendly characters")}return s(o,a)};i.scopedPackagePattern=e;var s=function(n,o){var a={validForNewPackages:o.length===0&&n.length===0,validForOldPackages:o.length===0,warnings:n,errors:o};return a.warnings.length||delete a.warnings,a.errors.length||delete a.errors,a};return Er.exports}var io;function ms(){return io||(io=1,function(e){var t=yn&&yn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateName=e.validateNewDid=void 0;const r=Xn(),i=t(au()),s=32,n=a=>{if((0,r.toTypeInfo)(a).role!==r.types.RoleType.ROLE_BLOCKLET)throw new Error("Blocklet DID's type must be ROLE_BLOCKLET")};e.validateNewDid=n;const o=(a,{checkDid:d=!0}={})=>{if((0,r.isValid)(a))d&&(0,e.validateNewDid)(a);else{const{validForNewPackages:h,errors:u=[],warnings:f=[]}=(0,i.default)(a);if(!h)throw new Error(u[0]||f[0]);if(a.length>s)throw new Error("Blocklet name is too long")}};e.validateName=o,e.default={validateName:e.validateName,validateNewDid:e.validateNewDid}}(yn)),yn}var oo;function gs(){if(oo)return ae;oo=1;var e=ae&&ae.__importDefault||function(V){return V&&V.__esModule?V:{default:V}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Joi=ae.eventsSchema=ae.installBlockletDescriptionSchema=ae.installBlockletTitleSchema=ae.resourceBundleSchema=ae.authConfigSchema=ae.cacheableSchema=ae.statsSchema=ae.titleSchema=ae.themeSchema=ae.signatureSchema=ae.serviceSchema=ae.scriptsSchema=ae.personSchema=ae.navigationSchema=ae.navigationItemSchema=ae.updateMountPointSchema=ae.mountPointSchema=ae.logoSchema=ae.interfaceSchema=ae.environmentNameSchema=ae.environmentSchema=ae.engineSchema=ae.endpointSchema=ae.distSchema=ae.descriptionSchema=ae.createBlockletSchema=ae.componentSchema=ae.blockletNameSchema=ae.blockletMetaSchema=void 0;const t=e(rs),r=e(ii()),i=e(Xc()),s=e(Jc()),n=Zc(),o=e(nu),a=al(),d=Xn(),h=ru(),u=Yo(),f=iu(),j=ou(),m=ms(),S=ll(),E=i.default.default,C="/.well-known",c=r.default.extend(n.semver).extend(n.semverRange).extend(j.fileExtension).extend(j.didExtension);ae.Joi=c;const N=(V,he)=>(0,S.checkLink)(V)?V:he.message(`Invalid navigation link: ${V}
|
|
207
207
|
|
|
208
208
|
A valid navigation link should be a relative url which start with '/' or a absolute url, such as:
|
|
209
209
|
- /en/home
|
|
@@ -217,7 +217,7 @@ A valid navigation id is should follow the rules of javascript variables, such a
|
|
|
217
217
|
- foo123
|
|
218
218
|
|
|
219
219
|
see detail in https://www.npmjs.com/package/is-var-name
|
|
220
|
-
`),O=c.string().trim().min(1).custom(V=>{if(E(V)>u.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${u.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return V}).meta({className:"TTitle"});ae.titleSchema=O;const w=c.string().trim().min(3).max(160).meta({className:"TDescription"});ae.descriptionSchema=w;const R=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ae.installBlockletTitleSchema=R;const F=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ae.installBlockletDescriptionSchema=F;const D=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((V,he)=>V.includes(a.WELLKNOWN_BLOCKLET_LOGO_PATH)?he.message(`logo url should not include ${a.WELLKNOWN_BLOCKLET_LOGO_PATH}`):V).meta({className:"TLogo"});ae.logoSchema=D;const ne=c.string().trim().min(1),Y=ne.meta({className:"TMountPoint"}).custom((V,he)=>(0,S.isValidUrlPath)(V)?V:he.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ae.mountPointSchema=Y;const W=ne.meta({className:"TUpdateMountPoint"}).custom(V=>(0,S.urlPathFriendly)(V));ae.updateMountPointSchema=W;const U=c.string().custom(V=>((0,m.validateName)(V),V)).meta({className:"TBlockletName"});ae.blockletNameSchema=U;const H=[],A=c.string().trim().min(1).max(50).required().custom((V,he)=>V.startsWith("BLOCKLET")&&!H.includes(V)?he.message("Env name can not start with BLOCKLET_"):V.startsWith("COMPONENT")?he.message("Env name can not start with COMPONENT_"):V.startsWith("ABTNODE")?he.message("Env name can not start with ABTNODE_"):/[^\w]/.test(V)?he.message('Env name can include only numbers or letters or "_"'):V).meta({className:"TEnvironmentName",unknownType:"any"});ae.environmentNameSchema=A;const J=c.object({name:A.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(V=>V.secure?!1:void 0)}).custom((V,he)=>V.secure&&V.default?he.message(`Cannot declare default value for secure env ${V.name}`):V).meta({className:"TEnvironment",unknownType:"any"});ae.environmentSchema=J;const M=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ae.scriptsSchema=M;const ue=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ae.serviceSchema=ue;const Ie=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ae.endpointSchema=Ie;const K=c.string().trim().custom((V,he)=>{const De=V.split("/").filter(Boolean);return De.length===0?he.message("cacheable path must be a valid pathname that is not /"):`/${De.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ae.cacheableSchema=K;const Ee=c.object({type:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(u.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(u.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(u.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items(K).unique(),services:c.array().items(ue).unique("name"),endpoints:c.array().items(Ie).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ae.interfaceSchema=Ee;const ce=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),Me=c.object({platform:c.string().valid(...u.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:ce,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ae.engineSchema=Me;const me=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ae.personSchema=me;const Oe=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ae.distSchema=Oe;const Pe=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ae.statsSchema=Pe;const ut={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:O,description:w,mountPoint:Y,name:U},ft=(V,he)=>c.object(V).custom((De,Xe)=>!he&&De.source&&De.source.name&&!De.source.store?Xe.message(`missing 'store' in source of component ${De.name}`):De),rt=ft(ut).meta({className:"TComponent",unknownType:"any"});ae.componentSchema=rt;const we=ft(ut,!0),de=({checkStore:V}={})=>{const he=[rt,we];return c.array().items(V?he[0]:he[1]).optional().default([])},ge=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ae.signatureSchema=ge;const Fe=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],$e={id:c.string().custom($),title:c.alternatives().try(c.string().min(1).max(u.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(N),c.object().min(1).pattern(c.string().valid(...Fe),c.string().custom(N))),component:c.string().min(1),section:c.array().items(c.string().valid("header","footer","bottom","social","dashboard","sessionManager","userCenter","bottomNavigation")).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},jt=c.object({...$e,items:c.array().items(c.object({...$e}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ae.navigationItemSchema=jt;const Ae=c.array().items(jt).unique((V,he)=>V.id&&he.id?V.id===he.id:!1).meta({className:"TNavigation",unknownType:"any"});ae.navigationSchema=Ae;const Et=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ae.themeSchema=Et;const Ot=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ae.authConfigSchema=Ot;const Ct=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),It=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ae.resourceBundleSchema=It;const Ve=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ae.eventsSchema=Ve;const Rt={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:w.required(),group:c.string().valid(...u.BLOCKLET_GROUPS),main:c.string().trim(),title:O.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:me.optional(),contributors:c.array().items(me).optional(),maintainers:c.array().items(me).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(V=>{if(V.length===0)return V;const he=V.reduce((De,Xe)=>De+Xe.value,0);if(he!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${he}`);return V},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((V,he)=>V.length!==2?he.message("length of range should be 2"):V[0]<0?he.message("the first value should not less than 0 in range"):V[1]<=V[0]?he.message("the second value should greater than the first value in range"):V),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...u.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...u.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:u.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(Ee).unique("name").custom((V,he)=>{if(V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return he.message(`Only one ${u.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Xe=V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const it of Xe)if(!it.prefix.startsWith(C))return he.message(`Wellknown path prefix must start with: ${C}`);return V}).default([]),environments:c.array().items(J).default([]).optional().custom((V,he)=>{if(V&&V.length){const De=V.filter((Xe,it)=>V.findIndex(wt=>wt.name===Xe.name)!==it);if(De.length)return he.message(`find duplicate environment names ${De.map(Xe=>Xe.name).join(", ")}`)}return V}),scripts:M,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(u.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional(),singleton:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(It),types:c.array().items(Ct).max(10)}),engine:c.alternatives().try(Me,c.array().items(Me)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:Oe.optional(),stats:Pe.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(ge).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:de(),navigation:Ae,theme:Et,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:Ve.optional()},pt=c.object(Rt).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ae.blockletMetaSchema=pt;const st=(V,{ensureFiles:he=!1,ensureDist:De=!1,ensureComponentStore:Xe=!0,ensureName:it=!1,skipValidateDidName:wt=!1,...qt}={})=>((!V||!t.default.existsSync(V))&&(he=!1),c.object({...Rt,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:he?c.file().trim().exists({baseDir:V}).optional():c.string().trim().optional(),files:c.array().items(he?c.file().exists({baseDir:V,canSkip:(Ue,L)=>[u.BLOCKLET_ENTRY_FILE,u.BLOCKLET_BUNDLE_FILE].includes(L)||(0,s.default)(L)}):c.string().trim()).optional(),dist:De?Oe.required():Oe.optional(),components:de({checkStore:Xe}),name:it?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:h.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...qt}).rename("children","components").custom((Ue,L)=>{const{did:re,name:ve,docker:Re}=Ue;if(Re){const{image:b,dockerfile:k,network:_}=Re;if(!b&&!k)return L.message("Image or dockerfile must be set");if(b&&k)return L.message("Image and dockerfile cannot be set at the same time");if(_)return L.message("ExportPorts and network cannot be set at the same time");k&&(Ue.files||(Ue.files=[]),Ue.files.push(k))}let p;if((0,d.isValid)(re))try{return(0,m.validateNewDid)(re),Ue}catch(b){p=b}if(ve){(0,m.validateName)(ve,{checkDid:!wt});const b=(0,f.toBlockletDid)(ve);return b!==re?L.message(`The did of name "${ve}" should be "${b}"`):Ue}return p?L.message(p.message):Ue}));return ae.createBlockletSchema=st,ae.default={blockletNameSchema:U,componentSchema:rt,endpointSchema:Ie,serviceSchema:ue,createBlockletSchema:st,interfaceSchema:Ee,environmentSchema:J,environmentNameSchema:A,scriptsSchema:M,personSchema:me,distSchema:Oe,titleSchema:O,descriptionSchema:w,logoSchema:D,navigationSchema:Ae,themeSchema:Et,mountPointSchema:Y,updateMountPointSchema:W,authConfigSchema:Ot,resourceBundleSchema:It,installBlockletTitleSchema:R,installBlockletDescriptionSchema:F,eventsSchema:Ve,Joi:c},ae}var ht={},so;function lu(){if(so)return ht;so=1;var e=ht&&ht.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.setService=ht.findService=ht.getDefaultServiceConfig=ht.getServiceConfig=void 0;const t=e(tc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ht.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:S,error:E}=j.validate(m);if(f&&E)throw new Error(`Invalid blocklet service config: ${E.details.map(C=>C.message).join(", ")}`);return S};ht.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ht.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ht.findService=d,ht.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ht}var ao;function cu(){if(ao)return Gt;ao=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.fixAndValidateService=Gt.validateMeta=void 0;const e=gs(),t=lu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Gt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(S=>S.message).join(", ")}`);return j};return Gt.validateMeta=i,Gt.default=i,Gt}var lo;function uu(){return lo||(lo=1,function(e){var t=kt&&kt.__createBinding||(Object.create?function(w,R,F,D){D===void 0&&(D=F);var ne=Object.getOwnPropertyDescriptor(R,F);(!ne||("get"in ne?!R.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return R[F]}}),Object.defineProperty(w,D,ne)}:function(w,R,F,D){D===void 0&&(D=F),w[D]=R[F]}),r=kt&&kt.__setModuleDefault||(Object.create?function(w,R){Object.defineProperty(w,"default",{enumerable:!0,value:R})}:function(w,R){w.default=R}),i=kt&&kt.__importStar||function(){var w=function(R){return w=Object.getOwnPropertyNames||function(F){var D=[];for(var ne in F)Object.prototype.hasOwnProperty.call(F,ne)&&(D[D.length]=ne);return D},w(R)};return function(R){if(R&&R.__esModule)return R;var F={};if(R!=null)for(var D=w(R),ne=0;ne<D.length;ne++)D[ne]!=="default"&&t(F,R,D[ne]);return r(F,R),F}}(),s=kt&&kt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(cl),o=i(Gc()),a=Yo(),d=cu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,R)=>{w.description||(w.description=`Blocklet from ${R}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const R=o.fromUrl(w.repository.url);R&&(w.repository.url=R.getDefaultRepresentation()==="shortcut"?R.https():R.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(R=>!(!R||typeof R!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(R=>!(typeof R!="string"||!R)))};e.fixKeywords=m;const S=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(R=>!(typeof R!="string"||!R)))};e.fixTags=S;const E=(w,R)=>(w.author&&(w.author=R(w.author)),["maintainers","contributors"].forEach(F=>{Array.isArray(w[F])&&(w[F]=w[F].map(R))}),w),C=w=>{if(!w)return"";if(typeof w=="string")return w;const R=w.name||"",F=w.url||w.web,D=F?` (${F})`:"",ne=w.email||w.mail,Y=ne?` <${ne}>`:"";return R+Y+D};e.formatPerson=C;const c=w=>{if(typeof w!="string")return w;const R=w.match(/^([^(<]+)/),F=w.match(/\(([^)]+)\)/),D=w.match(/<([^>]+)>/),ne={};return R&&R[0].trim()&&(ne.name=R[0].trim()),D&&([,ne.email]=D),F&&([,ne.url]=F),ne};e.parsePerson=c;const N=w=>(E(w,C),E(w,c),w);e.fixPerson=N;const $=(w,R=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Y=>{Y.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Y.protocol="http")}),w;const D=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Y="web",name:W,path:U="/",protocol:H="http",port:A=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Y,name:W,path:U,prefix:D,port:A,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Y=>{w[Y]&&ne({name:Y,path:w[Y]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Y=>{ne({type:"service",name:Y.protocol,protocol:Y.protocol,port:{internal:`BLOCKLET_${Y.protocol}_PORT`.toUpperCase(),external:Y.port}})}),R&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=$;const O=w=>{const{did:R}=w;try{(0,h.validateNewDid)(R),w.name=R}catch{}return w};e.fixName=O,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:N,fixTags:S,fixName:O,formatPerson:C,parsePerson:c,fixInterfaces:$,fixService:d.fixAndValidateService}}(kt)),kt}var du=uu();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:B.object.isRequired,locale:B.string.isRequired};const hu="install-blocklet-from-URL",ys=()=>{const[e,t]=si(hu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>$t.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:B.func,children:B.node,value:B.string,helperText:B.string};function xs({onClick:e}){const{t}=xt();return l.jsx(ul,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(yt,{icon:dl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:B.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=dn(),{api:a,session:d}=nc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:S}=xt(),E={dist:{}},{encryptKey:C}=hl(),[c,N]=q.useState(e),[$,O]=q.useState(e?1:0),[w,R]=q.useState(E),[F,D]=q.useState(!1),[ne,Y]=q.useState(""),[W]=si("instant-blocklet-install",!1),[U,H]=q.useState({}),A=s==="component",J=A?!0:!e,{addUrlRecord:M}=ys(),ue=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(Fe=>Fe.provider===Mt.LOGIN_PROVIDER.WALLET),[d.user]),Ie=q.useMemo(()=>{let de=c.trim();return!de.startsWith("https://")&&!de.startsWith("http://")&&!de.startsWith("file://")&&(de=`file://${de}`),de},[c]),K=async()=>{R(E),j(null),u(!0);const de=Ie;try{const ge=decodeURIComponent(de);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:Fe,inStore:$e,registryUrl:jt}=await o.getBlockletMetaFromUrl({input:{url:ge}});R(Fe),H({inStore:$e,registryUrl:jt,inputUrl:de}),M(de)}catch(ge){console.error(ge);const Fe=`Blocklet Install failed: ${Ur(ge)}`;j(Fe),i(ge)}finally{u(!1)}},Ee=()=>{if(A){r({meta:w,...U}),t();return}if(W){u(!0),D(!0);return}const de=rn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Zn(de,{blocklet_meta_url:decodeURIComponent(Ie.trim()),from:"url"})},ce=()=>{u(!1),D(!1),r({meta:w,...U}),t()},Me=()=>{u(!1),D(!1)};q.useEffect(()=>{e&&K()},[e]);const me=q.useMemo(()=>({title:w.title,wt:fl(w),blockletMetaUrl:decodeURIComponent(c.trim())}),[w,c]),Oe=q.useCallback(async()=>{if(ue||W){Y("");return}const de=new URL(window.location.href);de.pathname=rn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),de.searchParams.set("_ek_",C),Object.keys(me).forEach(Fe=>{de.searchParams.set(Fe,me[Fe])});const{data:ge}=await a.get(de.href);ge.url?Y(ge.url):Y("")},[ue,me,a,C,W]);q.useEffect(()=>{Oe()},[Oe]);const Pe=q.useMemo(()=>ue&&ne?{...me,nw:ne,skipMigrateAccount:!0}:me,[me,ne,ue]),nt=[{name:m("common.name"),value:Ft.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(rc,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:S}):du.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],ut=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(Tt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:nt.map(de=>de.name===m("common.did")?l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,nameFormatter:()=>m("common.did"),children:de.value},de.name):l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,children:de.value},de.name))}):null,ft=Xl(async()=>{let de=w.title;d.user&&(de=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:de,blockletMetaUrl:decodeURIComponent(c.trim()),type:"store",storeUrl:U.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Yn.error(Ur(ge),{autoHideDuration:3e3})}}),rt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(je,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:c,helperText:m("blocklet.fromUrl.description"),onValueChange:de=>{j(null),N(de)},children:l.jsx(Hn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:c,onChange:de=>{j(null),N(de.target.value)},disabled:h,onKeyPress:de=>{de.key==="Enter"&&(de.preventDefault(),K(),O(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{K(),O(1)}},{label:m("blocklet.fromUrl.step1"),body:ut(),cancel:m(J?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{J?O(de=>de-1):t()},onConfirm:()=>{Ee()}}],we=rt[$];return l.jsxs(l.Fragment,{children:[l.jsxs(oi,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>we.onCancel(),showCloseButton:$===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[we.cancel&&l.jsx(vt,{onClick:de=>{de.stopPropagation(),j(null),we.onCancel()},color:"inherit",children:we.cancel||m("common.cancel")}),l.jsxs(vt,{onClick:de=>{de.stopPropagation(),we.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!c||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&$===0&&l.jsx(Tt,{size:16}),we.confirm]})]}),children:[J&&l.jsx(xa,{alternativeLabel:!0,activeStep:$,children:rt.map(({label:de})=>l.jsx(wa,{children:l.jsx(Sa,{children:de})},de))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:we.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&F&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!ue&&!W?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:Pe,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:Me,customItems:W?[]:[l.jsx(xs,{onClick:ft})]})]})}ws.propTypes={defaultUrl:B.string,onCancel:B.func.isRequired,onSuccess:B.func.isRequired,onError:B.func,mode:B.oneOf(["install","component"]),handleText:B.object};const fu={meta:B.object.isRequired,onCancel:B.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=xt(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?Oi.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?Oi.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(vt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:B.oneOf(["both","purchase","verify"]).isRequired,onSelect:B.func.isRequired,onNext:B.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=xt(),{info:o}=dn(),a=pl(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=Ft.getDisplayName({meta:e}),j=async(S,E)=>{const C=({downloadTokenList:$})=>{i({downloadTokenList:$})},c=$=>{Yn.error($),t($)};function N($){return gl(()=>Ni.get($).then(async({data:O})=>{const w=O?.downloadTokenList;if(O.status==="succeed"){if(w&&w.length)await C({downloadTokenList:w});else return await c(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return O.status==="error"?(console.error("vc error: ",O),await c(O?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:$}=ml(d);await N($)}else await C({downloadTokenList:S.downloadTokenList&&E(S.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const S=new URL(u);S.pathname="/api/did/verify-purchase-blocklet/token",S.searchParams.set("serverDid",o.did),S.searchParams.set("blockletDid",e?.did);try{Ni.get(S.href).then(({data:E})=>{const C=`${E.url}`;h(C)})}catch(E){console.error("get next workflow url error: ",E)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Li.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Li.create({baseURL:rn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...fu,handlePaySuccess:B.func,mode:B.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:B.oneOf(["both","verify","purchase"]).isRequired,ref:B.any};function pu({...e}){return l.jsx(vt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=xt(),n=is();return!e||vl(e.meta)?l.jsx(mu,{children:r}):l.jsxs(gu,{isMobile:n,children:[l.jsx(pu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:B.object,onStartNow:B.func,children:B.any,disabled:B.bool};const mu=tt(te)`
|
|
220
|
+
`),O=c.string().trim().min(1).custom(V=>{if(E(V)>u.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${u.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return V}).meta({className:"TTitle"});ae.titleSchema=O;const w=c.string().trim().min(3).max(160).meta({className:"TDescription"});ae.descriptionSchema=w;const R=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ae.installBlockletTitleSchema=R;const F=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ae.installBlockletDescriptionSchema=F;const D=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((V,he)=>V.includes(a.WELLKNOWN_BLOCKLET_LOGO_PATH)?he.message(`logo url should not include ${a.WELLKNOWN_BLOCKLET_LOGO_PATH}`):V).meta({className:"TLogo"});ae.logoSchema=D;const ne=c.string().trim().min(1),Y=ne.meta({className:"TMountPoint"}).custom((V,he)=>(0,S.isValidUrlPath)(V)?V:he.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ae.mountPointSchema=Y;const W=ne.meta({className:"TUpdateMountPoint"}).custom(V=>(0,S.urlPathFriendly)(V));ae.updateMountPointSchema=W;const U=c.string().custom(V=>((0,m.validateName)(V),V)).meta({className:"TBlockletName"});ae.blockletNameSchema=U;const H=[],A=c.string().trim().min(1).max(50).required().custom((V,he)=>V.startsWith("BLOCKLET")&&!H.includes(V)?he.message("Env name can not start with BLOCKLET_"):V.startsWith("COMPONENT")?he.message("Env name can not start with COMPONENT_"):V.startsWith("ABTNODE")?he.message("Env name can not start with ABTNODE_"):/[^\w]/.test(V)?he.message('Env name can include only numbers or letters or "_"'):V).meta({className:"TEnvironmentName",unknownType:"any"});ae.environmentNameSchema=A;const J=c.object({name:A.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(V=>V.secure?!1:void 0)}).custom((V,he)=>V.secure&&V.default?he.message(`Cannot declare default value for secure env ${V.name}`):V).meta({className:"TEnvironment",unknownType:"any"});ae.environmentSchema=J;const M=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ae.scriptsSchema=M;const ue=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ae.serviceSchema=ue;const Ie=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ae.endpointSchema=Ie;const K=c.string().trim().custom((V,he)=>{const De=V.split("/").filter(Boolean);return De.length===0?he.message("cacheable path must be a valid pathname that is not /"):`/${De.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ae.cacheableSchema=K;const Ee=c.object({type:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(u.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(u.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(u.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items(K).unique(),services:c.array().items(ue).unique("name"),endpoints:c.array().items(Ie).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ae.interfaceSchema=Ee;const ce=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),Me=c.object({platform:c.string().valid(...u.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:ce,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ae.engineSchema=Me;const me=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ae.personSchema=me;const Oe=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ae.distSchema=Oe;const Pe=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ae.statsSchema=Pe;const ut={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:O,description:w,mountPoint:Y,name:U},ft=(V,he)=>c.object(V).custom((De,Xe)=>!he&&De.source&&De.source.name&&!De.source.store?Xe.message(`missing 'store' in source of component ${De.name}`):De),rt=ft(ut).meta({className:"TComponent",unknownType:"any"});ae.componentSchema=rt;const we=ft(ut,!0),de=({checkStore:V}={})=>{const he=[rt,we];return c.array().items(V?he[0]:he[1]).optional().default([])},ge=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ae.signatureSchema=ge;const Fe=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],$e={id:c.string().custom($),title:c.alternatives().try(c.string().min(1).max(u.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(N),c.object().min(1).pattern(c.string().valid(...Fe),c.string().custom(N))),component:c.string().min(1),section:c.array().items(c.string().valid("header","footer","bottom","social","dashboard","sessionManager","userCenter","bottomNavigation")).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},jt=c.object({...$e,items:c.array().items(c.object({...$e}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ae.navigationItemSchema=jt;const Ae=c.array().items(jt).unique((V,he)=>V.id&&he.id?V.id===he.id:!1).meta({className:"TNavigation",unknownType:"any"});ae.navigationSchema=Ae;const Et=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ae.themeSchema=Et;const Ot=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ae.authConfigSchema=Ot;const Ct=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),It=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ae.resourceBundleSchema=It;const Ve=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ae.eventsSchema=Ve;const Rt={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:w.required(),group:c.string().valid(...u.BLOCKLET_GROUPS),main:c.string().trim(),title:O.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:me.optional(),contributors:c.array().items(me).optional(),maintainers:c.array().items(me).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(V=>{if(V.length===0)return V;const he=V.reduce((De,Xe)=>De+Xe.value,0);if(he!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${he}`);return V},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((V,he)=>V.length!==2?he.message("length of range should be 2"):V[0]<0?he.message("the first value should not less than 0 in range"):V[1]<=V[0]?he.message("the second value should greater than the first value in range"):V),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...u.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...u.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:u.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(Ee).unique("name").custom((V,he)=>{if(V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return he.message(`Only one ${u.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Xe=V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const it of Xe)if(!it.prefix.startsWith(C))return he.message(`Wellknown path prefix must start with: ${C}`);return V}).default([]),environments:c.array().items(J).default([]).optional().custom((V,he)=>{if(V&&V.length){const De=V.filter((Xe,it)=>V.findIndex(wt=>wt.name===Xe.name)!==it);if(De.length)return he.message(`find duplicate environment names ${De.map(Xe=>Xe.name).join(", ")}`)}return V}),scripts:M,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(u.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional(),singleton:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(It),types:c.array().items(Ct).max(10)}),engine:c.alternatives().try(Me,c.array().items(Me)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:Oe.optional(),stats:Pe.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(ge).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:de(),navigation:Ae,theme:Et,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:Ve.optional()},pt=c.object(Rt).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ae.blockletMetaSchema=pt;const st=(V,{ensureFiles:he=!1,ensureDist:De=!1,ensureComponentStore:Xe=!0,ensureName:it=!1,skipValidateDidName:wt=!1,...qt}={})=>((!V||!t.default.existsSync(V))&&(he=!1),c.object({...Rt,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:he?c.file().trim().exists({baseDir:V}).optional():c.string().trim().optional(),files:c.array().items(he?c.file().exists({baseDir:V,canSkip:(Ue,L)=>[u.BLOCKLET_ENTRY_FILE,u.BLOCKLET_BUNDLE_FILE].includes(L)||(0,s.default)(L)}):c.string().trim()).optional(),dist:De?Oe.required():Oe.optional(),components:de({checkStore:Xe}),name:it?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:h.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...qt}).rename("children","components").custom((Ue,L)=>{const{did:re,name:ve,docker:Re}=Ue;if(Re){const{image:b,dockerfile:k,network:_}=Re;if(b&&k)return L.message("Image and dockerfile cannot be set at the same time");if(_)return L.message("ExportPorts and network cannot be set at the same time");k&&(Ue.files||(Ue.files=[]),Ue.files.push(k))}let p;if((0,d.isValid)(re))try{return(0,m.validateNewDid)(re),Ue}catch(b){p=b}if(ve){(0,m.validateName)(ve,{checkDid:!wt});const b=(0,f.toBlockletDid)(ve);return b!==re?L.message(`The did of name "${ve}" should be "${b}"`):Ue}return p?L.message(p.message):Ue}));return ae.createBlockletSchema=st,ae.default={blockletNameSchema:U,componentSchema:rt,endpointSchema:Ie,serviceSchema:ue,createBlockletSchema:st,interfaceSchema:Ee,environmentSchema:J,environmentNameSchema:A,scriptsSchema:M,personSchema:me,distSchema:Oe,titleSchema:O,descriptionSchema:w,logoSchema:D,navigationSchema:Ae,themeSchema:Et,mountPointSchema:Y,updateMountPointSchema:W,authConfigSchema:Ot,resourceBundleSchema:It,installBlockletTitleSchema:R,installBlockletDescriptionSchema:F,eventsSchema:Ve,Joi:c},ae}var ht={},so;function lu(){if(so)return ht;so=1;var e=ht&&ht.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.setService=ht.findService=ht.getDefaultServiceConfig=ht.getServiceConfig=void 0;const t=e(tc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ht.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:S,error:E}=j.validate(m);if(f&&E)throw new Error(`Invalid blocklet service config: ${E.details.map(C=>C.message).join(", ")}`);return S};ht.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ht.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ht.findService=d,ht.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ht}var ao;function cu(){if(ao)return Gt;ao=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.fixAndValidateService=Gt.validateMeta=void 0;const e=gs(),t=lu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Gt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(S=>S.message).join(", ")}`);return j};return Gt.validateMeta=i,Gt.default=i,Gt}var lo;function uu(){return lo||(lo=1,function(e){var t=kt&&kt.__createBinding||(Object.create?function(w,R,F,D){D===void 0&&(D=F);var ne=Object.getOwnPropertyDescriptor(R,F);(!ne||("get"in ne?!R.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return R[F]}}),Object.defineProperty(w,D,ne)}:function(w,R,F,D){D===void 0&&(D=F),w[D]=R[F]}),r=kt&&kt.__setModuleDefault||(Object.create?function(w,R){Object.defineProperty(w,"default",{enumerable:!0,value:R})}:function(w,R){w.default=R}),i=kt&&kt.__importStar||function(){var w=function(R){return w=Object.getOwnPropertyNames||function(F){var D=[];for(var ne in F)Object.prototype.hasOwnProperty.call(F,ne)&&(D[D.length]=ne);return D},w(R)};return function(R){if(R&&R.__esModule)return R;var F={};if(R!=null)for(var D=w(R),ne=0;ne<D.length;ne++)D[ne]!=="default"&&t(F,R,D[ne]);return r(F,R),F}}(),s=kt&&kt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(cl),o=i(Gc()),a=Yo(),d=cu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,R)=>{w.description||(w.description=`Blocklet from ${R}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const R=o.fromUrl(w.repository.url);R&&(w.repository.url=R.getDefaultRepresentation()==="shortcut"?R.https():R.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(R=>!(!R||typeof R!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(R=>!(typeof R!="string"||!R)))};e.fixKeywords=m;const S=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(R=>!(typeof R!="string"||!R)))};e.fixTags=S;const E=(w,R)=>(w.author&&(w.author=R(w.author)),["maintainers","contributors"].forEach(F=>{Array.isArray(w[F])&&(w[F]=w[F].map(R))}),w),C=w=>{if(!w)return"";if(typeof w=="string")return w;const R=w.name||"",F=w.url||w.web,D=F?` (${F})`:"",ne=w.email||w.mail,Y=ne?` <${ne}>`:"";return R+Y+D};e.formatPerson=C;const c=w=>{if(typeof w!="string")return w;const R=w.match(/^([^(<]+)/),F=w.match(/\(([^)]+)\)/),D=w.match(/<([^>]+)>/),ne={};return R&&R[0].trim()&&(ne.name=R[0].trim()),D&&([,ne.email]=D),F&&([,ne.url]=F),ne};e.parsePerson=c;const N=w=>(E(w,C),E(w,c),w);e.fixPerson=N;const $=(w,R=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Y=>{Y.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Y.protocol="http")}),w;const D=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Y="web",name:W,path:U="/",protocol:H="http",port:A=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Y,name:W,path:U,prefix:D,port:A,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Y=>{w[Y]&&ne({name:Y,path:w[Y]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Y=>{ne({type:"service",name:Y.protocol,protocol:Y.protocol,port:{internal:`BLOCKLET_${Y.protocol}_PORT`.toUpperCase(),external:Y.port}})}),R&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=$;const O=w=>{const{did:R}=w;try{(0,h.validateNewDid)(R),w.name=R}catch{}return w};e.fixName=O,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:N,fixTags:S,fixName:O,formatPerson:C,parsePerson:c,fixInterfaces:$,fixService:d.fixAndValidateService}}(kt)),kt}var du=uu();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:B.object.isRequired,locale:B.string.isRequired};const hu="install-blocklet-from-URL",ys=()=>{const[e,t]=si(hu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>$t.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:B.func,children:B.node,value:B.string,helperText:B.string};function xs({onClick:e}){const{t}=xt();return l.jsx(ul,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(yt,{icon:dl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:B.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=dn(),{api:a,session:d}=nc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:S}=xt(),E={dist:{}},{encryptKey:C}=hl(),[c,N]=q.useState(e),[$,O]=q.useState(e?1:0),[w,R]=q.useState(E),[F,D]=q.useState(!1),[ne,Y]=q.useState(""),[W]=si("instant-blocklet-install",!1),[U,H]=q.useState({}),A=s==="component",J=A?!0:!e,{addUrlRecord:M}=ys(),ue=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(Fe=>Fe.provider===Mt.LOGIN_PROVIDER.WALLET),[d.user]),Ie=q.useMemo(()=>{let de=c.trim();return!de.startsWith("https://")&&!de.startsWith("http://")&&!de.startsWith("file://")&&(de=`file://${de}`),de},[c]),K=async()=>{R(E),j(null),u(!0);const de=Ie;try{const ge=decodeURIComponent(de);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:Fe,inStore:$e,registryUrl:jt}=await o.getBlockletMetaFromUrl({input:{url:ge}});R(Fe),H({inStore:$e,registryUrl:jt,inputUrl:de}),M(de)}catch(ge){console.error(ge);const Fe=`Blocklet Install failed: ${Ur(ge)}`;j(Fe),i(ge)}finally{u(!1)}},Ee=()=>{if(A){r({meta:w,...U}),t();return}if(W){u(!0),D(!0);return}const de=rn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Zn(de,{blocklet_meta_url:decodeURIComponent(Ie.trim()),from:"url"})},ce=()=>{u(!1),D(!1),r({meta:w,...U}),t()},Me=()=>{u(!1),D(!1)};q.useEffect(()=>{e&&K()},[e]);const me=q.useMemo(()=>({title:w.title,wt:fl(w),blockletMetaUrl:decodeURIComponent(c.trim())}),[w,c]),Oe=q.useCallback(async()=>{if(ue||W){Y("");return}const de=new URL(window.location.href);de.pathname=rn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),de.searchParams.set("_ek_",C),Object.keys(me).forEach(Fe=>{de.searchParams.set(Fe,me[Fe])});const{data:ge}=await a.get(de.href);ge.url?Y(ge.url):Y("")},[ue,me,a,C,W]);q.useEffect(()=>{Oe()},[Oe]);const Pe=q.useMemo(()=>ue&&ne?{...me,nw:ne,skipMigrateAccount:!0}:me,[me,ne,ue]),nt=[{name:m("common.name"),value:Ft.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(rc,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:S}):du.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],ut=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(Tt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:nt.map(de=>de.name===m("common.did")?l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,nameFormatter:()=>m("common.did"),children:de.value},de.name):l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,children:de.value},de.name))}):null,ft=Xl(async()=>{let de=w.title;d.user&&(de=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:de,blockletMetaUrl:decodeURIComponent(c.trim()),type:"store",storeUrl:U.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Yn.error(Ur(ge),{autoHideDuration:3e3})}}),rt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(je,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:c,helperText:m("blocklet.fromUrl.description"),onValueChange:de=>{j(null),N(de)},children:l.jsx(Hn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:c,onChange:de=>{j(null),N(de.target.value)},disabled:h,onKeyPress:de=>{de.key==="Enter"&&(de.preventDefault(),K(),O(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{K(),O(1)}},{label:m("blocklet.fromUrl.step1"),body:ut(),cancel:m(J?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{J?O(de=>de-1):t()},onConfirm:()=>{Ee()}}],we=rt[$];return l.jsxs(l.Fragment,{children:[l.jsxs(oi,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>we.onCancel(),showCloseButton:$===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[we.cancel&&l.jsx(vt,{onClick:de=>{de.stopPropagation(),j(null),we.onCancel()},color:"inherit",children:we.cancel||m("common.cancel")}),l.jsxs(vt,{onClick:de=>{de.stopPropagation(),we.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!c||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&$===0&&l.jsx(Tt,{size:16}),we.confirm]})]}),children:[J&&l.jsx(xa,{alternativeLabel:!0,activeStep:$,children:rt.map(({label:de})=>l.jsx(wa,{children:l.jsx(Sa,{children:de})},de))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:we.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&F&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!ue&&!W?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:Pe,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:Me,customItems:W?[]:[l.jsx(xs,{onClick:ft})]})]})}ws.propTypes={defaultUrl:B.string,onCancel:B.func.isRequired,onSuccess:B.func.isRequired,onError:B.func,mode:B.oneOf(["install","component"]),handleText:B.object};const fu={meta:B.object.isRequired,onCancel:B.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=xt(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?Oi.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?Oi.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(vt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:B.oneOf(["both","purchase","verify"]).isRequired,onSelect:B.func.isRequired,onNext:B.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=xt(),{info:o}=dn(),a=pl(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=Ft.getDisplayName({meta:e}),j=async(S,E)=>{const C=({downloadTokenList:$})=>{i({downloadTokenList:$})},c=$=>{Yn.error($),t($)};function N($){return gl(()=>Ni.get($).then(async({data:O})=>{const w=O?.downloadTokenList;if(O.status==="succeed"){if(w&&w.length)await C({downloadTokenList:w});else return await c(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return O.status==="error"?(console.error("vc error: ",O),await c(O?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:$}=ml(d);await N($)}else await C({downloadTokenList:S.downloadTokenList&&E(S.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const S=new URL(u);S.pathname="/api/did/verify-purchase-blocklet/token",S.searchParams.set("serverDid",o.did),S.searchParams.set("blockletDid",e?.did);try{Ni.get(S.href).then(({data:E})=>{const C=`${E.url}`;h(C)})}catch(E){console.error("get next workflow url error: ",E)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Li.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Li.create({baseURL:rn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...fu,handlePaySuccess:B.func,mode:B.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:B.oneOf(["both","verify","purchase"]).isRequired,ref:B.any};function pu({...e}){return l.jsx(vt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=xt(),n=is();return!e||vl(e.meta)?l.jsx(mu,{children:r}):l.jsxs(gu,{isMobile:n,children:[l.jsx(pu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:B.object,onStartNow:B.func,children:B.any,disabled:B.bool};const mu=tt(te)`
|
|
221
221
|
width: 100%;
|
|
222
222
|
margin-top: auto;
|
|
223
223
|
padding-top: 24px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as v,j as l}from"./vendor-mui-core-DnR6WYuU.js";import{m as B,r}from"./vendor-react-CTtPmzVP.js";import{C as W,D as L}from"./vendor-utils-drLlzTVq.js";import{V as O,aJ as A}from"./vendor-ux-DfSgTRg5.js";import{h as d,b as T,t as _}from"./vendor-hooks-cYMUGE4V.js";import{A as $,S as F}from"./add-component-core-
|
|
1
|
+
import{J as v,j as l}from"./vendor-mui-core-DnR6WYuU.js";import{m as B,r}from"./vendor-react-CTtPmzVP.js";import{C as W,D as L}from"./vendor-utils-drLlzTVq.js";import{V as O,aJ as A}from"./vendor-ux-DfSgTRg5.js";import{h as d,b as T,t as _}from"./vendor-hooks-cYMUGE4V.js";import{A as $,S as F}from"./add-component-core-BITgGwN0.js";import{y as K,an as J}from"./index-BHa1_Bjz.js";import"./lottie-web-4koyQiv_.js";import"./item-B3LlwO_A.js";import"./index-DBs9Ljax.js";import"./delete-confirm-HiRqbh9-.js";import"./click-to-copy-B2HIKJMV.js";import"./confirm-DTx9f3Ke.js";import"./session-Cm8j8XeZ.js";import"./get-safe-url-CqAaHb9L.js";import"./did-address-DqhneWXa.js";import"./wait-connect-Be1Dmt0P.js";import"./vendor-arcblock-CPCSE54a.js";import"./launch-result-message-MNpx7ysR.js";import"./page-header-CHAwrgX-.js";import"./engine-BzngvK61.js";import"./config-space-zEV0JkDF.js";import"./spaces-BuZf3GoQ.js";import"./api-C_w0YD2j.js";import"./required-BQln5OcV.js";import"./index-seQ_ufVM.js";import"./Google-Cwpw9PRe.js";import"./cloneDeep-BbaR0xRl.js";import"./create-passport-svg-BQhmIwWD.js";import"./form-wrapper-PT5ZzMQy.js";import"./logo-uploader-BmnoHisE.js";import"./collapse-B7gUzFaX.js";import"./index-B0Q9wWG1.js";import"./config-DuS3gx_m.js";import"./isURL-CASPeQFe.js";import"./section-jXB9AxBb.js";import"./form-text-input-BjQKx89L.js";import"./edit.svg-RRSklUg-.js";import"./index-_tncRnTu.js";import"./useLocalStorage-BV1BIwfo.js";import"./index-BP_Fl0Mu.js";import"./util-DIVJQVg1.js";import"./use-mobile-BINJTzMb.js";import"./content-layout-DmSBGGVm.js";import"./connect-to-eBtGI4_9.js";import"./index-BzU09Azd.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-CHuKoofS.js";import"./search-4YYphs0l.js";function $t(){const{t:u}=O(),{blocklet:h}=K(),{componentDid:s}=B(),w=v(t=>t.breakpoints.down("md")),e=new URL(window.location.href),f=e.searchParams.get("mode")==="dialog",n=e.searchParams.get("resourceType")||"",m=e.searchParams.get("resourceDid")||s,g=e.searchParams.get("store")||"",C=e.searchParams.get("showFromUrl")!=="false",R=e.searchParams.get("showResourcesSwitch")!=="false",y=e.searchParams.get("enableRunBackground")!=="false",S=e.searchParams.get("showCategory")!=="false",a=h?.meta?.did,i=g.split(",").filter(Boolean).map(t=>{try{return new URL(t.startsWith("http")?t:`https://${t}`).origin}catch(o){return console.error(o),null}}).filter(Boolean),[b,E]=r.useState(i.map(t=>({url:t,name:t.replace("https://","")}))),[P,D]=r.useState(null),[U,j]=r.useState("");r.useEffect(()=>{(async()=>{try{const t=await Promise.all(i.map(async o=>{const x=W(o,"/api/store.json"),{data:M}=await L.get(x);return{url:o,name:M.name}}));E(t||[])}catch(t){console.error(t)}})()},[i.join(",")]);const k=()=>{window.parent.postMessage({event:"resourceDialog.close",componentDid:s},"*")};r.useEffect(()=>{const t=J();return a&&t.connect(),()=>{a&&t.isConnected()&&t.disconnect()}},[a]),d(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:s},"*")});const c=T(t=>{t.data?.event==="resourceDialog.select"&&t.data?.componentDid===s&&(D(t.data.data),j(t.data.storeUrl))});d(()=>{window.addEventListener("message",c)}),_(()=>{window.removeEventListener("message",c)});const p=({inDialog:t=!0}={})=>l.jsx($,{stores:b,selectedMeta:P,storeUrl:U,resourceType:n,resourceDid:m,mode:"embed",inDialog:t,storageKey:F(`${n}+${m}`),showResourcesSwitch:R,showFromUrl:C,enableRunBackground:y,showCategory:S});return f?l.jsx(A,{className:"resource-dialog",title:u("blocklet.publish.addResource"),maxWidth:!1,fullWidth:!1,PaperProps:{style:w?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:(t,o)=>{o!=="backdropClick"&&k()},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:p()}):p({inDialog:!1})}export{$t as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as t,i as x}from"./vendor-react-CTtPmzVP.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-DnR6WYuU.js";import{aT as M,aK as b,aL as f}from"./vendor-ux-DfSgTRg5.js";import{X as H}from"./index-
|
|
1
|
+
import{r as t,i as x}from"./vendor-react-CTtPmzVP.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-DnR6WYuU.js";import{aT as M,aK as b,aL as f}from"./vendor-ux-DfSgTRg5.js";import{X as H}from"./index-BHa1_Bjz.js";import{t as Z}from"./question-mark-circle.svg-CByEVDhb.js";const g=s=>t.createElement("svg",{width:21,height:20,viewBox:"0 0 21 20",xmlns:"http://www.w3.org/2000/svg",...s},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.60567 17.3203C7.38971 16.9661 7.19606 16.5686 7.02468 16.1402C6.86016 15.7289 6.7127 15.2804 6.58436 14.801C6.01415 15.0849 5.48171 15.439 4.99946 15.855C5.7556 16.5015 6.63848 17.004 7.60567 17.3203ZM8.26264 15.645C8.10246 15.2446 7.95842 14.7971 7.83425 14.3104C8.53612 14.104 9.26539 13.9991 9.9998 14H10.0015C10.7359 13.9991 11.4652 14.104 12.167 14.3104C12.0429 14.7971 11.8988 15.2446 11.7386 15.645C11.4556 16.3525 11.1353 16.8804 10.8137 17.2204C10.4935 17.559 10.2185 17.6667 10.0006 17.6667C9.78281 17.6667 9.50783 17.559 9.18757 17.2204C8.86599 16.8804 8.54566 16.3525 8.26264 15.645ZM10.0007 12.6667C10.8258 12.6657 11.6453 12.7785 12.4365 13.0005C12.5533 12.274 12.6295 11.49 12.6565 10.6666H7.34483C7.37175 11.49 7.448 12.274 7.56482 13.0006C8.35599 12.7785 9.17556 12.6657 10.0007 12.6667ZM7.34483 9.33331C7.37175 8.50999 7.448 7.72596 7.56482 6.99945C8.35598 7.22152 9.17556 7.33433 10.0007 7.33334C10.8258 7.33433 11.6453 7.22153 12.4365 6.99947C12.5533 7.72597 12.6295 8.51 12.6565 9.33331H7.34483ZM13.9905 10.6666C13.9603 11.6495 13.8639 12.5916 13.7104 13.4645C14.5207 13.8311 15.2715 14.3159 15.9385 14.9026C16.9065 13.7315 17.5347 12.2691 17.6722 10.6666H13.9905ZM17.6721 9.33331H13.9904C13.9603 8.35043 13.8639 7.40842 13.7104 6.5355C14.5207 6.16891 15.2715 5.68412 15.9385 5.09743C16.9065 6.26854 17.5347 7.73084 17.6721 9.33331ZM19.0006 10.0017C18.9997 14.9715 14.9706 19 10.0006 19H10.0006C5.03005 19 1.00061 14.9706 1.00061 10C1.00061 9.99999 1.00061 9.99999 1.00061 9.99998C1.00062 5.02943 5.03005 1 10.0006 1C14.9712 1 19.0006 5.02944 19.0006 10C19.0006 10.0006 19.0006 10.0011 19.0006 10.0017ZM2.32907 9.33331C2.46651 7.73082 3.09476 6.2685 4.0628 5.09738C4.72975 5.68407 5.48055 6.16888 6.29084 6.53548C6.13742 7.40841 6.041 8.35042 6.01083 9.33331H2.32907ZM2.32907 10.6666H6.01083C6.04099 11.6496 6.13742 12.5916 6.29084 13.4645C5.48055 13.8311 4.72975 14.3159 4.06281 14.9026C3.09475 13.7315 2.46649 12.2692 2.32907 10.6666ZM12.9766 16.1402C13.1411 15.7289 13.2886 15.2804 13.4169 14.8009C13.9871 15.0849 14.5196 15.4389 15.0018 15.8549C14.2457 16.5014 13.3628 17.004 12.3956 17.3202C12.6116 16.9661 12.8052 16.5686 12.9766 16.1402ZM12.3956 2.67976C13.3628 2.996 14.2457 3.49858 15.0018 4.14508C14.5196 4.56106 13.9871 4.91516 13.4169 5.19908C13.2886 4.71963 13.1411 4.2711 12.9766 3.85979C12.8052 3.43137 12.6116 3.03387 12.3956 2.67976ZM11.7386 4.355C11.8988 4.75545 12.0429 5.20292 12.167 5.68962C11.4652 5.89603 10.7359 6.00096 10.0015 6.00001H9.9998C9.26539 6.00096 8.53612 5.89602 7.83424 5.68961C7.95841 5.20291 8.10246 4.75544 8.26264 4.355C8.54566 3.64747 8.86599 3.11964 9.18757 2.7796C9.50783 2.44096 9.78281 2.33333 10.0006 2.33333C10.2185 2.33333 10.4935 2.44096 10.8137 2.7796C11.1353 3.11964 11.4556 3.64747 11.7386 4.355ZM7.02468 3.85979C6.86015 4.2711 6.71269 4.71961 6.58436 5.19906C6.01414 4.91513 5.4817 4.56103 4.99945 4.14504C5.7556 3.49854 6.63848 2.99596 7.60567 2.67973C7.38971 3.03385 7.19606 3.43136 7.02468 3.85979Z",fill:"currentColor"}));function j({SessionContext:s,extraItems:n=[],showLocale:r=!0,showHelper:l=!0,showSessionManager:c=!0,sessionManagerProps:i={}}){const{session:d}=t.useContext(s),{locale:p}=t.useContext(M),w=x(),h=()=>{if(w.pathname.indexOf("/store")>-1){window.open("https://www.arcblock.io/content/docs/createblocklet","_blank");return}window.open("https://www.arcblock.io/content/docs/blocklet-developer","_blank")};return e.jsxs(e.Fragment,{children:[n.map((a,m)=>t.cloneElement(a,{key:m})),r&&e.jsx(v,{"data-cy":"locale-addon",icon:g,size:23,showText:!1,className:"locale-addon"}),e.jsx(H,{}),l&&e.jsx(u,{onClick:h,children:e.jsx(Z,{})}),c&&e.jsx(k,{locale:p,session:d,size:24,showRole:!0,...i,showManageBlocklet:!1})]})}j.propTypes={SessionContext:o.object.isRequired,extraItems:o.array,showLocale:o.bool,showSessionManager:o.bool,showHelper:o.bool,sessionManagerProps:o.object};const k=C(f)`
|
|
2
2
|
.user-addon {
|
|
3
3
|
.user-avatar {
|
|
4
4
|
width: 28px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as z}from"./vendor-react-CTtPmzVP.js";import{j as k,a6 as ce,ak as T,Q as Me,dK as Pe,T as te,W as J,bX as Ne,a5 as Fe,bf as ze,aZ as Je,at as ke,U as Be,b6 as ie,z as Ue,A as Ve,dL as Se,bn as Y,a3 as V,dM as We,am as ge,bl as ye}from"./vendor-mui-core-DnR6WYuU.js";import{Z as re,Y as Ke,l as Re,q as He,a3 as Ge,cj as Ze,C as Ye,ck as Qe,c as Xe,R as be,G as Oe,ak as Ae,J as Z,cl as et}from"./index-
|
|
1
|
+
import{r as z}from"./vendor-react-CTtPmzVP.js";import{j as k,a6 as ce,ak as T,Q as Me,dK as Pe,T as te,W as J,bX as Ne,a5 as Fe,bf as ze,aZ as Je,at as ke,U as Be,b6 as ie,z as Ue,A as Ve,dL as Se,bn as Y,a3 as V,dM as We,am as ge,bl as ye}from"./vendor-mui-core-DnR6WYuU.js";import{Z as re,Y as Ke,l as Re,q as He,a3 as Ge,cj as Ze,C as Ye,ck as Qe,c as Xe,R as be,G as Oe,ak as Ae,J as Z,cl as et}from"./index-BHa1_Bjz.js";import{w as ue,P as tt}from"./permission-HtrJm1h2.js";import{V as le,w as G,H as W,aJ as Ee,cr as rt,p as st,o as nt,q as H,J as ve,aT as at}from"./vendor-ux-DfSgTRg5.js";import{x as Ce}from"./vendor-hooks-cYMUGE4V.js";import{C as me}from"./confirm-DTx9f3Ke.js";import{f as oe}from"./index-DBs9Ljax.js";import{u as it}from"./useSetState-L-f8mSga.js";import{u as De}from"./session-Cm8j8XeZ.js";import{S as U}from"./section-jXB9AxBb.js";import{C as ot}from"./click-to-copy-B2HIKJMV.js";import{b as Ie}from"./team-DNuHMrzV.js";import{v as lt,ac as ct}from"./vendor-utils-drLlzTVq.js";import{v as ut}from"./index-BP_Fl0Mu.js";import{W as ft}from"./did-address-DqhneWXa.js";import{V as dt}from"./status-DVjLoqLm.js";import{F as _e}from"./form-text-input-BjQKx89L.js";import"./vendor-arcblock-CPCSE54a.js";import"./lottie-web-4koyQiv_.js";import"./required-BQln5OcV.js";import"./isURL-CASPeQFe.js";import"./use-app-logo-CZWb8lrs.js";import"./omit-BgmLPtMY.js";import"./form-wrapper-PT5ZzMQy.js";import"./edit.svg-RRSklUg-.js";const mt=localStorage.getItem("enableDebug")==="true";function ht({teamDid:$,size:q="small",...P}){const{t:C}=le(),{api:j}=re(),[w,p]=z.useState(!1),[o,g]=z.useState(null),m=()=>{p(!1),g(null)},f=async()=>{try{p(!0);const a=await j.clearCache({input:{teamDid:$}});W.success(C("blocklet.config.clearCache.success",{count:a.removed?.length||0}))}catch(a){W.error(oe(a))}finally{p(!1),g(null)}},e={title:C("blocklet.config.clearCache.title"),description:C("blocklet.config.clearCache.description"),confirm:C("common.confirm"),cancel:C("common.cancel"),onConfirm:f,onCancel:m};return k.jsxs("div",{...P,children:[k.jsxs(G,{onClick:()=>g(e),color:"error",variant:"outlined",size:q,children:[w?k.jsx(ce,{size:16,style:{marginRight:5}}):null,C("blocklet.config.clearCache.action")]}),o&&k.jsx(me,{title:o.title,description:o.description,confirm:o.confirm,cancel:o.cancel,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}function Te({onChange:$=()=>{},disabled:q=!1,loading:P=!1,inService:C=!1}){const{t:j}=le(),{api:w,session:p}=De(),{blocklet:o}=Ke(),[g,m]=it({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),f=()=>m({isConnectOpen:!1}),e=()=>{if(He.isInProgress(o.status)){W.error(j("blocklet.error.isInProgress"));return}m({confirmDialogOpen:!0})};return k.jsxs(k.Fragment,{children:[k.jsx(U,{title:j("blocklet.config.migrate.button"),desc:j("blocklet.config.migrate.description"),children:k.jsx(T,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:k.jsxs(Me,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:q||P,onClick:e,children:[k.jsx(Pe,{style:{fontSize:"1.3em",marginRight:4}}),j("blocklet.config.migrate.button")]})})}),k.jsxs(k.Fragment,{children:[g.isConnectOpen&&k.jsx(Re,{popup:!0,open:g.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:w.get,checkTimeout:5*60*1e3,onSuccess:()=>{$(),C&&p.logout(),f()},extraParams:{appDid:o.appDid},messages:{title:j("setup.keyPair.title"),scan:j("setup.keyPair.scan"),confirm:j("setup.keyPair.confirm"),success:j("setup.keyPair.success")},onClose:f}),g.confirmDialogOpen&&k.jsx(me,{title:k.jsx(te,{sx:{fontSize:"20px",fontWeight:"500"},children:j("blocklet.config.migrate.title")}),description:k.jsx(te,{sx:{fontSize:"14px",color:"#9397A1"},children:j("blocklet.config.migrate.confirm")}),confirm:j("common.confirm"),cancel:j("common.cancel"),onConfirm:()=>m({confirmDialogOpen:!1,isConnectOpen:!0}),onCancel:()=>m({confirmDialogOpen:!1})})]})]})}Te.propTypes={onChange:J.func,disabled:J.bool,loading:J.bool,inService:J.bool};function Le({onCancel:$,onSuccess:q,onError:P=()=>{}}){const{api:C}=z.useContext(Ge),[j,w]=z.useState(!1),{t:p,locale:o}=le(),[g,m]=z.useState(""),[f,e]=z.useState(!1),[a,n]=z.useState(0),[r,t]=z.useState(""),{endpoint:l}=Ie(),[s,i]=z.useState(!1),u=c=>{m(null),w(!0);try{t(c.result),n(_.length-1)}catch(h){const b=oe(h);m(b),P(h)}finally{w(!1)}},d=()=>{e(!0),n(1)},y=()=>{e(!1),n(0)},_=[{body:k.jsxs(T,{children:[k.jsx(te,{children:p("team.transferApp.transferDialog.tips.progress")}),k.jsx(te,{sx:{mt:3,mb:2},children:p("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),onCancel:$,onConfirm:d},{cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),body:()=>k.jsx(Re,{action:"transfer-app-owner",open:f,locale:o,checkFn:C.get,onClose:y,onSuccess:u,checkTimeout:5*60*1e3,extraParams:{},messages:{title:p("team.transferApp.connectDialog.title"),scan:p("team.transferApp.connectDialog.scan"),confirm:p("team.transferApp.connectDialog.confirm"),success:p("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const c=Ze({transferId:r.transferId,endpoint:l});return k.jsxs(k.Fragment,{children:[k.jsx(T,{component:Q,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),k.jsxs(T,{children:[k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:Ye(r.expireDate,o)})})}),k.jsx(T,{sx:{my:1},children:k.jsx(ot,{children:c})})]}),k.jsx("div",{children:k.jsx(Ne,{value:"end",control:k.jsx(Fe,{checked:s,onChange:h=>i(h.target.checked)}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:q}],v=_[a];return k.jsxs(Ee,{title:k.jsx(Q,{className:"title",children:p("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:k.jsxs(k.Fragment,{children:[v.cancel&&k.jsx(G,{onClick:v.onCancel,color:"inherit",children:v.cancel}),k.jsxs(G,{onClick:v.onConfirm,color:"error",disabled:j||a===_.length-1&&!s,variant:"contained",autoFocus:!0,children:[j&&k.jsx(ce,{size:16}),v.confirm]})]}),children:[k.jsx(ze,{component:"div",children:typeof v.body=="function"?v.body():v.body}),!!g&&k.jsx(Je,{severity:"error",variant:"icon",children:g})]})}Le.propTypes={onCancel:J.func.isRequired,onSuccess:J.func.isRequired,onError:J.func};const Q=ke.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
&.title {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,ak as d,Q as p,at as x,W as u}from"./vendor-mui-core-DnR6WYuU.js";import{r as o}from"./vendor-react-CTtPmzVP.js";import{aT as g}from"./vendor-ux-DfSgTRg5.js";import{a as h}from"./page-header-CHAwrgX-.js";import{Y as j}from"./index-
|
|
1
|
+
import{j as t,ak as d,Q as p,at as x,W as u}from"./vendor-mui-core-DnR6WYuU.js";import{r as o}from"./vendor-react-CTtPmzVP.js";import{aT as g}from"./vendor-ux-DfSgTRg5.js";import{a as h}from"./page-header-CHAwrgX-.js";import{Y as j}from"./index-BHa1_Bjz.js";import{A as b}from"./config-DuS3gx_m.js";import{S as k}from"./step-actions-DkehnzsP.js";import{S}from"./layout-DkW-u1GX.js";import"./vendor-utils-drLlzTVq.js";import"./vendor-hooks-cYMUGE4V.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CPCSE54a.js";import"./isURL-CASPeQFe.js";import"./section-jXB9AxBb.js";import"./required-BQln5OcV.js";import"./form-wrapper-PT5ZzMQy.js";import"./form-text-input-BjQKx89L.js";import"./edit.svg-RRSklUg-.js";import"./wait-connect-Be1Dmt0P.js";import"./get-safe-url-CqAaHb9L.js";import"./index-_tncRnTu.js";import"./index-DBs9Ljax.js";import"./use-mobile-D5clNlrm.js";import"./content-layout-DmSBGGVm.js";function y({onNext:s=()=>{},onPrevious:l=()=>{}}){const{t:r}=o.useContext(g),{blocklet:e}=j(),i=o.useMemo(()=>e?.meta?.requirements,[e]),n=o.useRef(null),[a,m]=o.useState(!1),f=async()=>{try{m(!0),(await n.current.onSubmit()||!i?.aigne)&&s()}catch(c){console.error("error",c)}finally{m(!1)}};return t.jsxs(C,{children:[t.jsx("div",{className:"header",children:t.jsx(h,{title:r("setting.aigne.config"),onClickBack:l})}),t.jsx(d,{className:"form-container",children:t.jsx(b,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,ref:n,source:"setup",forceValidate:i?.aigne})}),t.jsxs(k,{blocklet:e,children:[!i?.aigne&&t.jsx(p,{className:"bottom-button-skip",sx:{mr:1},onClick:()=>s(),children:r("setup.skip")}),t.jsx(p,{className:"start-now bottom-button",loading:a,variant:"contained",disabled:a,onClick:f,children:r("setup.continue")})]})]})}y.propTypes={onNext:u.func,onPrevious:u.func};const C=x(S)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as E,A as k}from"./vendor-utils-drLlzTVq.js";import{Z as T,Y as j,c as M}from"./index-
|
|
1
|
+
import{C as E,A as k}from"./vendor-utils-drLlzTVq.js";import{Z as T,Y as j,c as M}from"./index-BHa1_Bjz.js";import{r as e}from"./vendor-react-CTtPmzVP.js";import{V as B}from"./vendor-ux-DfSgTRg5.js";import{u as D}from"./use-mobile-BINJTzMb.js";import{D as H,j as o,ak as w,a6 as I}from"./vendor-mui-core-DnR6WYuU.js";import"./vendor-arcblock-CPCSE54a.js";import"./vendor-hooks-cYMUGE4V.js";import"./lottie-web-4koyQiv_.js";function K(){const{info:x,inService:g}=T(),{blocklet:y}=j(),{locale:u}=B(),f=e.useRef(null),r=H(),[L,R]=e.useState(0),m=D(),[t,S]=e.useState(!0),s=e.useRef(null);let a="";g?a=M.WELLKNOWN_SERVICE_PATH_PREFIX:a=x.routing.adminPath;const c=new URLSearchParams;g?c.set("appUrl",window.location.origin):c.set("authKey","__sst"),c.set("schemaKey",E(window.location.origin,a,`/api/theme?id=${encodeURIComponent(y.meta.did)}`));const l=e.useCallback(()=>{if(s.current){const n=k(JSON.parse(JSON.stringify(r)),["palette","typography","shape","direction","breakpoints","mixins","shadows","transitions","zIndex"]);s.current.contentWindow.postMessage({type:"SEND_THEME",payload:n},window.location.origin)}},[r]),d=e.useCallback(()=>{s.current&&s.current.contentWindow.postMessage({type:"SEND_LOCALE",payload:u},window.location.origin)},[u]);return e.useEffect(()=>{const n=i=>{i.origin===window.location.origin&&(i.data.type==="REQUEST_THEME"&&l(),i.data.type==="THEME_BUILDER_LOADED"&&(d(),S(!1)))};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[l,d]),e.useEffect(()=>{t===!1&&l()},[r,t,l]),e.useEffect(()=>{t===!1&&d()},[u,t,d]),e.useEffect(()=>{const n=document.querySelector("#arc__dashboard-main"),i=document.querySelector(".dashboard-content"),p=()=>{if(f.current){const{height:C}=n.getBoundingClientRect(),{top:b}=i.getBoundingClientRect(),{top:_}=f.current.getBoundingClientRect();let h=C-_+b-(m?108:164);m&&(h=Math.min(h,600)),R(h)}};return p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[m,r]),o.jsxs(o.Fragment,{children:[o.jsx(w,{ref:f}),t&&o.jsx(w,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px"},children:o.jsx(I,{})}),o.jsx("iframe",{title:"Theme Builder",ref:s,src:`${E(window.location.origin,a,"/hosted/theme-builder/")}?${c.toString()}`,style:{border:0,width:"100%",height:`${L}px`,display:t?"none":"block"}})]})}export{K as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{H as U,V as _,b1 as H,b9 as F,bp as Z,aN as G,aU as K}from"./vendor-ux-DfSgTRg5.js";import{Z as N,c as A}from"./index-
|
|
1
|
+
import{H as U,V as _,b1 as H,b9 as F,bp as Z,aN as G,aU as K}from"./vendor-ux-DfSgTRg5.js";import{Z as N,c as A}from"./index-BHa1_Bjz.js";import{j as e,D as I,ak as g,b2 as X,T as $,am as W,bl as J,I as D,cj as Q,dP as q,J as Y,a6 as ee,y as te,x as ne,bZ as oe,M as se,b_ as re,at as ae}from"./vendor-mui-core-DnR6WYuU.js";import{r as i,L as ie}from"./vendor-react-CTtPmzVP.js";import{p as le}from"./util-CVjlaHo_.js";import{u as ce}from"./useLocalStorage-BV1BIwfo.js";import{M as T}from"./index-B0Q9wWG1.js";import{d as de,e as M}from"./vendor-utils-drLlzTVq.js";import{S as V}from"./shorten-label-C4py9TLA.js";import{r as O}from"./index-CRAuhYSg.js";import{b as ue}from"./team-DNuHMrzV.js";import"./vendor-hooks-cYMUGE4V.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CPCSE54a.js";import"./base32-CXgP3JJ5.js";import"./session-Cm8j8XeZ.js";import"./isURL-CASPeQFe.js";import"./use-app-logo-CZWb8lrs.js";const B=i.createContext({}),{Provider:pe,Consumer:We}=B;function fe(){return localStorage.getItem("audit-log-page-size")&&Number(localStorage.getItem("audit-log-page-size"))||10}function me({children:t,scope:c="",categories:o=[],showScope:l,scopeFormatter:p,blocklets:x}){const{api:h,info:v}=N(),[C,f]=i.useState([]),[m,y]=i.useState({total:0,pageSize:fe(),pageCount:0,page:1}),[L,s]=i.useState(!1),[w,a]=i.useState(""),[d,n]=ce(`audit-log-category-${c}`,"all"),j=[{value:"all",label:"All",description:""},{value:"blocklet",label:"Blocklet Management",description:""},{value:"server",label:"Server Management",description:""},{value:"team",label:"Team Management",description:""},{value:"security",label:"Security",description:""},{value:"certificates",label:"Certificate Management",description:""},{value:"integrations",label:"Integration Management",description:""},{value:"gateway",label:"Gateway",description:""}].filter(P=>o.length?P.value==="all"||o.includes(P.value):!0),b=async({page:P=1,pageSize:r=20,silent:z=!0}={})=>{if(!L){z||s(!0);try{const S=await h.getAuditLogs({input:{paging:{page:P,pageSize:r},category:d==="all"?"":d,scope:c,actionOrContent:w}});l&&(S.list||[]).forEach(E=>{E.scope!==v.did&&(E.link=`/blocklets/${E.scope}/components`)}),f(S.list),y(S.paging),s(!1)}catch(S){U.error(S.message),s(!1)}}};i.useEffect(()=>{localStorage.setItem("audit-log-page-size",m.pageSize)},[m.pageSize]),i.useEffect(()=>{b({page:1,pageSize:m.pageSize,silent:!1})},[]),i.useEffect(()=>{b({page:1,pageSize:m.pageSize,silent:!1})},[d,w]);const k={loading:L,fetch:b,filter:{category:d,scope:c},categories:j,blocklets:x,setCategory:n,data:C,paging:m,setPaging:y,showScope:l,scopeFormatter:p,actionOrContent:w,setActionOrContent:a};return e.jsx(pe,{value:{auditLogs:k},children:t})}function R(){const{auditLogs:t}=i.useContext(B);return t}function ge(t){if(!t)return[];const c=/\[([^\]]+)\]\(([^)]+)\)/g,o=[];let l;for(;(l=c.exec(t))!==null;)o.push({text:l[1],url:l[2]});return o}const xe=`
|
|
2
2
|
<svg style="width:38px;height:38px;" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path fill-rule="evenodd" clip-rule="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_606_96)"/>
|
|
4
4
|
<path fill-rule="evenodd" clip-rule="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_606_96)"/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as A,j as e,ak as t,a6 as E,Q as l,cm as W,T as o,b2 as z,am as I,b$ as R,bX as L,a5 as O,a3 as T,bb as f,b6 as F}from"./vendor-mui-core-DnR6WYuU.js";import{r as x}from"./vendor-react-CTtPmzVP.js";import{x as D}from"./vendor-hooks-cYMUGE4V.js";import{C as b}from"./vendor-utils-drLlzTVq.js";import{u as B,c as u,V as H,H as U,b6 as M,o as V}from"./index-
|
|
1
|
+
import{J as A,j as e,ak as t,a6 as E,Q as l,cm as W,T as o,b2 as z,am as I,b$ as R,bX as L,a5 as O,a3 as T,bb as f,b6 as F}from"./vendor-mui-core-DnR6WYuU.js";import{r as x}from"./vendor-react-CTtPmzVP.js";import{x as D}from"./vendor-hooks-cYMUGE4V.js";import{C as b}from"./vendor-utils-drLlzTVq.js";import{u as B,c as u,V as H,H as U,b6 as M,o as V}from"./index-BHa1_Bjz.js";import{K as p}from"./landing-page-Cv6belCa.js";import{V as K,M as y}from"./vendor-ux-DfSgTRg5.js";import{W as Q}from"./did-address-DqhneWXa.js";import"./vendor-arcblock-CPCSE54a.js";import"./lottie-web-4koyQiv_.js";function re(){const{searchParams:r}=new URL(window.location.href),{session:d}=B(),{t:c}=K(),m=r.get("client_id"),_=r.get("scope")||"profile:read",[g,w]=x.useState(_.split(" ").filter(Boolean)),v=A("(max-width: 600px)"),k=b(window.location.origin,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/oauth/authorize"),C=x.useCallback(i=>i?i.startsWith("http")?i:`${b(u.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/media/upload",window.blocklet.appPid)}/${i}`:"",[]),[h,j]=D({client:null,loading:!0});x.useEffect(()=>{(async()=>{const{data:n}=await V.get("/oauth/client",{params:{clientId:m}});j({client:n,loading:!1})})()},[m,j]);const S=i=>{i!=="profile:read"&&w(n=>n.includes(i)?n.filter(P=>P!==i):[...n,i])};if(h.loading||!d?.user)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(E,{})})});if(!h.client)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(H,{style:{backgroundColor:"transparent"},status:"error",title:c("notFoundOauthClient"),extra:e.jsx(l,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(W,{}),href:"/",style:{borderRadius:4},children:c("connectCli.home")})})})});const{client:s}=h,{user:a}=d,N=(s.scope||"").split(" ");return e.jsxs(p,{did:window.blocklet?.appPid,standalone:!0,children:[e.jsx(U,{children:e.jsxs("title",{children:[c("oauth.authorize")," | ",window.blocklet?.appName]})}),e.jsx(M,{hideCloseButton:!0,children:e.jsxs(t,{sx:{display:"flex",flexDirection:"column",p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},className:"page-authorize",children:[e.jsxs(t,{sx:{textAlign:"center",mb:2},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:[e.jsx(y,{src:window.blocklet?.appLogo,alt:"Server",width:48,height:48}),e.jsxs(t,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"})]}),e.jsx(y,{src:C(s.logo_uri),alt:s.client_name,width:48,height:48})]}),e.jsxs(o,{sx:{mb:1,fontSize:"1.2rem","& .app-name":{color:"primary.main"}},children:["Authorize ",e.jsx("span",{className:"app-name",children:s.client_name})]})]}),e.jsxs(t,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden",mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},className:"info",children:[e.jsx(z,{src:a.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),e.jsxs(t,{sx:{flex:1,overflow:"hidden"},children:[e.jsx(I,{title:a.fullName,children:e.jsx(t,{className:"name",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:a.fullName})}),e.jsx(t,{className:"did",children:e.jsx(Q,{compact:!0,responsive:!1,did:a.did,showQrcode:!v})})]})]}),e.jsxs(o,{variant:"subtitle1",sx:{mb:2,fontWeight:500},children:["Allow ",s.client_name," to do the following on your behalf:"]}),e.jsxs(t,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden"},children:[e.jsx(t,{sx:{p:2},children:e.jsx(R,{children:Object.entries(u.OAUTH_SCOPES).filter(([i])=>N.includes(i)).map(([i,n])=>e.jsx(L,{control:e.jsx(O,{checked:g.includes(i),onChange:()=>S(i),disabled:i==="profile:read"||["blocklet:read","blocklet:write"].includes(i)&&!["owner","admin","member"].includes(a.role),color:"primary",sx:{"&.Mui-checked":{color:"success.main"}}}),label:e.jsx(t,{children:e.jsx(o,{variant:"body1",sx:{fontWeight:500},children:n})}),sx:{mb:0}},i))})}),(s.tos_uri||s.policy_uri)&&e.jsxs(e.Fragment,{children:[e.jsx(T,{}),e.jsx(t,{sx:{height:1,bgcolor:"divider"}}),e.jsx(t,{sx:{p:2,color:"text.secondary"},children:e.jsxs(o,{variant:"body2",children:["By authorize the access, you also agree with the"," ",!!s.tos_uri&&e.jsx(f,{href:s.tos_uri,target:"_blank",children:"Terms of Use"}),!!s.tos_uri&&!!s.policy_uri&&" and ",!!s.policy_uri&&e.jsx(f,{href:s.policy_uri,target:"_blank",children:"Privacy Policy"})]})})]})]}),e.jsxs("form",{method:"POST",action:k,children:[r.get("client_id")&&e.jsx("input",{type:"hidden",name:"client_id",value:r.get("client_id")}),r.get("response_type")&&e.jsx("input",{type:"hidden",name:"response_type",value:r.get("response_type")}),r.get("redirect_uri")&&e.jsx("input",{type:"hidden",name:"redirect_uri",value:r.get("redirect_uri")}),r.get("code_challenge")&&e.jsx("input",{type:"hidden",name:"code_challenge",value:r.get("code_challenge")}),r.get("code_challenge_method")&&e.jsx("input",{type:"hidden",name:"code_challenge_method",value:r.get("code_challenge_method")}),r.get("state")&&e.jsx("input",{type:"hidden",name:"state",value:r.get("state")}),e.jsx("input",{type:"hidden",name:"scope",value:g.join(" ")}),e.jsx(t,{sx:{mt:"auto",pt:3},children:e.jsxs(F,{direction:"row",spacing:2,children:[e.jsx(l,{variant:"outlined",size:"large",fullWidth:!0,type:"submit",name:"action",value:"deny",children:"Cancel"}),e.jsx(l,{variant:"contained",size:"large",fullWidth:!0,type:"submit",name:"action",value:"allow",children:"Authorize"})]})}),r.get("redirect_uri")&&e.jsxs(t,{sx:{mt:3,textAlign:"center"},children:[e.jsx(o,{variant:"body2",sx:{color:"text.secondary"},children:"You will be redirected to"}),e.jsx(o,{variant:"body2",sx:{color:"text.secondary",wordBreak:"break-all"},children:r.get("redirect_uri")})]}),e.jsx(t,{sx:{mt:2,textAlign:"center"},children:e.jsxs(o,{variant:"body2",children:["Not you?"," ",e.jsx(l,{variant:"text",color:"primary",onClick:()=>d.switchDid(),sx:{p:0,minWidth:"auto",textTransform:"none",verticalAlign:"baseline",fontWeight:"inherit",fontSize:"inherit","&:hover":{background:"none",textDecoration:"underline"}},children:"Use another account"})]})})]})]})})]})}export{re as default};
|