@abtnode/blocklet-services 1.16.39-beta-20250210-090045-0b8f243f → 1.16.39-beta-20250211-013701-5e3d1ce3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{access-control-DdXj5niw.js → access-control-Cvyyosl7.js} +1 -1
- package/dist/assets/{add-component-core-BtRcqhKo.js → add-component-core-DlH-ksP3.js} +1 -1
- package/dist/assets/{add-resource-nU5RWMls.js → add-resource-Bi7DpPfy.js} +1 -1
- package/dist/assets/{analytics-X9VRwkzm.js → analytics-D5Wg9yw6.js} +1 -1
- package/dist/assets/{audit-logs-BJdGmYfI.js → audit-logs-CpENNExh.js} +1 -1
- package/dist/assets/{branding-DzXJA2pJ.js → branding-D_9x1yUc.js} +2 -2
- package/dist/assets/{bundle-avatar-CYdInmjR.js → bundle-avatar-3QSGrsNA.js} +1 -1
- package/dist/assets/{complete-DtNcnxdf.js → complete-DWza6ypd.js} +1 -1
- package/dist/assets/{component-DOOz4rgK.js → component-CMPB9eGw.js} +1 -1
- package/dist/assets/{config-navigation-B5FcBZZN.js → config-navigation-D-th1tcR.js} +3 -3
- package/dist/assets/{config-space-Y_f6nwhj.js → config-space-DQcEAb4q.js} +1 -1
- package/dist/assets/{config-CSlXpbL2.js → config-wRVMZtMQ.js} +1 -1
- package/dist/assets/{confirm-CpCj_oj-.js → confirm-dIU5y9cG.js} +1 -1
- package/dist/assets/{connect-BprUwdvy.js → connect-BCsAv_0T.js} +1 -1
- package/dist/assets/connect-Bzzh-qas.js +1 -0
- package/dist/assets/{connect-to-BYvNqC5N.js → connect-to-BzwS4rD2.js} +1 -1
- package/dist/assets/{dashboard-Cgj1BkGn.js → dashboard-DEaIei4u.js} +3 -3
- package/dist/assets/{domain-BD1Bntmg.js → domain-SUtQ2mKp.js} +1 -1
- package/dist/assets/{domain-list-h_f8stui.js → domain-list-C6MW__fO.js} +1 -1
- package/dist/assets/{email-BaNlnEr5.js → email-C1qoJ5wN.js} +1 -1
- package/dist/assets/{exchange-passport-CjaHJzsV.js → exchange-passport-DN1dbwCF.js} +1 -1
- package/dist/assets/{form-text-input-DS_PVT1r.js → form-text-input-DixVGGLY.js} +1 -1
- package/dist/assets/{fuel-BM8_TX9D.js → fuel-DbSYx7td.js} +1 -1
- package/dist/assets/{index-DRwuz-J9.js → index-B19CQ2ic.js} +1 -1
- package/dist/assets/{index-D6IQwB0H.js → index-BkTpbxSu.js} +1 -1
- package/dist/assets/{index-PcImULKW.js → index-Bv_3agvW.js} +1 -1
- package/dist/assets/{index-BMWG7Eya.js → index-Bwql_DnM.js} +1 -1
- package/dist/assets/{index-LIf2LIyz.js → index-C85gVBzh.js} +2 -2
- package/dist/assets/{index-0u5pzPhR.js → index-Cld1HWxz.js} +1 -1
- package/dist/assets/{index-Cqc33Ts_.js → index-DUoD69VU.js} +1 -1
- package/dist/assets/{index-C7dWd4bS.js → index-Dz_dMBd6.js} +4 -4
- package/dist/assets/{index-DF1jJ-bb.js → index-_suzTPHn.js} +3 -3
- package/dist/assets/{index-BA_7CRkd.js → index-aIv-YSXW.js} +1 -1
- package/dist/assets/{index-Dzj545ro.js → index-bmafJpME.js} +1 -1
- package/dist/assets/{index-ee8g6Cmz.js → index-sPEpq71V.js} +1 -1
- package/dist/assets/{index-DzU25sJ1.js → index-xXoK_djD.js} +1 -1
- package/dist/assets/{invitation-DSIQ2w-K.js → invitation-CBTcflFA.js} +1 -1
- package/dist/assets/{invite-C4uHXoFz.js → invite-BX9Ow66V.js} +1 -1
- package/dist/assets/{issue-passport-Dq9lOjJK.js → issue-passport-CgO1vOso.js} +1 -1
- package/dist/assets/{item-Ba7fzXuK.js → item-IntWv1pk.js} +1 -1
- package/dist/assets/{layout-BwWrVSXk.js → layout-DNDd_arD.js} +1 -1
- package/dist/assets/{list-DI-9r9EP.js → list-Cy1my35m.js} +1 -1
- package/dist/assets/{log-D4hWjoeK.js → log-BQgDF08N.js} +1 -1
- package/dist/assets/{login-DnwZJEBm.js → login-BUeQyCFg.js} +1 -1
- package/dist/assets/{logo-uploader-DbSGPbXh.js → logo-uploader-lx0oUxRg.js} +3 -3
- package/dist/assets/{lost-passport-Cqpxv9tR.js → lost-passport-C-DfyBDR.js} +1 -1
- package/dist/assets/open-window-BCSIX9-I.js +1 -1
- package/dist/assets/{overview-DMjokddi.js → overview-BZ7IJTY1.js} +1 -1
- package/dist/assets/{publish-resource-BeEqCNhj.js → publish-resource-C6LjZThR.js} +1 -1
- package/dist/assets/{relative-time-DpRjdL5Z.js → relative-time-ChYpdg43.js} +1 -1
- package/dist/assets/{setup-hqq9REGL.js → setup-BlbLoMQQ.js} +3 -3
- package/dist/assets/{start-C1K4M5DN.js → start-C_qLBKVg.js} +1 -1
- package/dist/assets/{step-actions-BJ9p7QSx.js → step-actions-BYvMcDu2.js} +1 -1
- package/dist/assets/{traffic-DelPjTGb.js → traffic-CctA2CCp.js} +1 -1
- package/dist/assets/{transfer-Dqy9gGzf.js → transfer-D5wgUCh5.js} +1 -1
- package/dist/assets/{unsubscribe-Bq-uODgj.js → unsubscribe-Fvp6J_a-.js} +1 -1
- package/dist/assets/{user-center-D0eTpKkD.js → user-center-BPnFfNIW.js} +1 -1
- package/dist/assets/{util-BpKZM3xV.js → util-XV_5OnOm.js} +1 -1
- package/dist/assets/{wrap-locale-oTlFUOZf.js → wrap-locale-BQ1e-7Pm.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
- package/dist/assets/connect-ByH0XoiE.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as T,j as K,aM as J}from"./vendor-mui-core-xF5F4eT7.js";import{x as O}from"./vendor-utils-5TjOM6td.js";import{y as ee,h as _,R as te,O as ne,T as se,D as re,U as oe}from"./index-LIf2LIyz.js";import{g as W,r as ae}from"./vendor-react-D-afvo_7.js";import{n as ie}from"./vendor-arcblock-DZrZ_x_3.js";const S=(e,t)=>{var n;let s="?v=";return t?s+=te(t):s+=`${(n=e==null?void 0:e.meta)==null?void 0:n.version}${ne(e==null?void 0:e.status)?"~":""}`,s};function ce({blocklet:e}){var L,x,N,C,B,F,j;const{inService:t}=ee(),s=(L=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE))==null?void 0:L.value,n=(x=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT))==null?void 0:x.value,r=(N=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON))==null?void 0:N.value,o=(C=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_PORTRAIT))==null?void 0:C.value,i=(B=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_LANDSCAPE))==null?void 0:B.value,a=(F=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_OG_IMAGE))==null?void 0:F.value,c=((j=window.env)==null?void 0:j.apiPrefix)||"/",d=`${O(c,`/blocklet/logo/${t?"":e.meta.did}`)}${S(e,s)}`,l=`${O(c,`/blocklet/logo-rect/${t?"":e.meta.did}`)}${S(e,n??s)}`,f=`${O(c,`/blocklet/logo-favicon/${t?"":e.meta.did}`)}${S(e,r??s)}`,p=`${O(c,`/blocklet/splash/portrait/${t?"":e.meta.did}`)}${S(e,o)}`,h=`${O(c,`/blocklet/splash/landscape/${t?"":e.meta.did}`)}${S(e,i)}`,u=`${O(c,`/blocklet/og-image/${t?"":e.meta.did}`)}${S(e,a)}`;return{logoUrl:d,rectLogoUrl:l,faviconUrl:f,splashPortraitUrl:p,splashLandscapeUrl:h,ogImageUrl:u}}function V({blocklet:e,style:t,size:s,...n}){const{logoUrl:r}=ce({blocklet:e}),{variant:o}=n;return K.jsx(J,{variant:o||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},t),...n,children:K.jsx("img",{src:r,alt:"",style:{width:s}})})}V.propTypes={blocklet:T.object.isRequired,style:T.object,size:T.oneOfType([T.number,T.string])};V.defaultProps={style:{},size:40};var le=ae;function de(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var w=de(le);function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},M.apply(this,arguments)}function ue(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,A(e,t)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},A(e,t)}function fe(e,t){if(e==null)return{};var s={},n=Object.keys(e),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(s[r]=e[r]);return s}var G={position:"absolute",bottom:0,left:0,height:0,overflow:"hidden","padding-top":0,"padding-bottom":0,border:"none"},pe=["box-sizing","width","font-size","font-weight","font-family","font-style","letter-spacing","text-indent","white-space","word-break","overflow-wrap","padding-left","padding-right"];function me(e,t){if(!e||typeof e!="object")return e;var s={};return Object.keys(e).forEach(function(n){t.indexOf(n)>-1||(s[n]=e[n])}),s}var he=["component","className","unsafeHTML"];function Y(e,t){if(t!=="letters"&&t!=="words")throw new Error("Unsupported options basedOn: "+t);if(e.nodeType===Node.TEXT_NODE){var s=document.createDocumentFragment(),n;switch(t){case"words":n=e.textContent.split(/\b|(?=\W)/);break;case"letters":n=Array.from(e.textContent);break}n.forEach(function(a){s.appendChild(ge(a))}),e.parentNode.replaceChild(s,e)}else if(e.nodeType===Node.ELEMENT_NODE)for(var r=[].slice.call(e.childNodes),o=r.length,i=0;i<o;i++)Y(r[i],t)}function ge(e){var t=document.createElement("span");return t.className="LinesEllipsis-unit",t.textContent=e,t}function z(e){e.parentNode.replaceChild(document.createTextNode(e.textContent),e)}function q(e,t){if(!(!t.contains(e)||e===t)){for(;e.nextElementSibling;)e.parentNode.removeChild(e.nextElementSibling);q(e.parentNode,t)}}function Le(e){for(var t=e;t=t.parentNode;)if(/p|div|main|section|h\d|ul|ol|li/.test(t.tagName.toLowerCase()))return t}function b(e){return!!(e.offsetHeight&&(e.offsetWidth||/\S/.test(e.textContent)))}var k={component:"div",unsafeHTML:"",maxLine:1,ellipsis:"…",ellipsisHTML:void 0,className:"",basedOn:void 0,onReflow:function(){},winWidth:void 0},Ee=Object.keys(k),Q=function(e){ue(t,e);function t(n){var r;return r=e.call(this,n)||this,r.state={html:n.unsafeHTML,clamped:!1},r.canvas=null,r.maxLine=0,r.nlUnits=[],r}var s=t.prototype;return s.componentDidMount=function(){this.initCanvas(),this.reflow(this.props)},s.componentDidUpdate=function(r){r.winWidth!==this.props.winWidth&&this.copyStyleToCanvas(),this.props!==r&&this.reflow(this.props)},s.componentWillUnmount=function(){this.canvas.parentNode.removeChild(this.canvas),this.canvas=null},s.setState=function(r,o){return typeof r.clamped<"u"&&(this.clamped=r.clamped),e.prototype.setState.call(this,r,o)},s.initCanvas=function(){if(!this.canvas){var r=this.canvas=document.createElement("div");r.className="LinesEllipsis-canvas "+this.props.className,r.setAttribute("aria-hidden","true"),this.copyStyleToCanvas(),Object.keys(G).forEach(function(o){r.style[o]=G[o]}),document.body.appendChild(r)}},s.copyStyleToCanvas=function(){var r=this,o=window.getComputedStyle(this.target);pe.forEach(function(i){r.canvas.style[i]=o[i]})},s.reflow=function(r){this.maxLine=+r.maxLine||1,this.canvas.innerHTML=r.unsafeHTML;var o=r.basedOn||(/^[\x00-\x7F]+$/.test(r.unsafeHTML)?"words":"letters");Y(this.canvas,o);var i=this.putEllipsis(this.calcIndexes()),a={clamped:i,html:this.canvas.innerHTML};this.setState(a,r.onReflow.bind(this,a))},s.calcIndexes=function(){var r=[0],o=this.nlUnits=Array.from(this.canvas.querySelectorAll(".LinesEllipsis-unit")),i=o.length;if(!o.length)return r;var a=o.find(b);if(!a)return r;for(var c=1,d=a.offsetTop,l=1;l<i&&!(b(o[l])&&o[l].offsetTop-d>1&&(c++,r.push(l),d=o[l].offsetTop,c>this.maxLine));l++);return r},s.putEllipsis=function(r){if(r.length<=this.maxLine)return!1;this.nlUnits=this.nlUnits.slice(0,r[this.maxLine]);var o=this.nlUnits.pop(),i=this.makeEllipsisSpan();do q(o,this.canvas),Le(o).appendChild(i),o=this.nlUnits.pop();while(o&&(!b(o)||i.offsetHeight>o.offsetHeight||i.offsetTop>o.offsetTop));return o&&z(o),this.nlUnits.forEach(z),!0},s.makeEllipsisSpan=function(){var r=this.props,o=r.ellipsisHTML,i=r.ellipsis,a=document.createElement("span");a.appendChild(document.createElement("wbr"));var c=document.createElement("span");return c.className="LinesEllipsis-ellipsis",o?c.innerHTML=o:c.textContent=i,a.appendChild(c),a},s.isClamped=function(){return this.clamped},s.render=function(){var r=this,o=this.state,i=o.html,a=o.clamped,c=this.props,d=c.component,l=c.className,f=c.unsafeHTML,p=fe(c,he);return w.default.createElement(d,M({className:"LinesEllipsis "+(a?"LinesEllipsis--clamped":"")+" "+l,ref:function(u){return r.target=u}},me(p,Ee)),w.default.createElement("div",{dangerouslySetInnerHTML:{__html:a?i:f}}))},t}(w.default.Component);Q.defaultProps=k;var ve=Q;const qe=W(ve),{joinURL:g,withQuery:E}=se,{toTypeInfo:ye}=ie,{isEVMChain:xe,getExplorerUrl:Oe}=re,{arcChainConfig:_e}=oe,Se={ROLE_ACCOUNT:"number",ROLE_NODE:"number",ROLE_DEVICE:"number",ROLE_APPLICATION:"number",ROLE_SMART_CONTRACT:"number",ROLE_BOT:"number",ROLE_ASSET:"number",ROLE_STAKE:"number",ROLE_VALIDATOR:"number",ROLE_GROUP:"number",ROLE_TX:"number",ROLE_TETHER:"number",ROLE_SWAP:"number",ROLE_DELEGATION:"number",ROLE_VC:"number",ROLE_BLOCKLET:"number",ROLE_STORE:"number",ROLE_TOKEN:"number",ROLE_FACTORY:"number",ROLE_ROLLUP:"number",ROLE_STORAGE:"number",ROLE_PROFILE:"number",ROLE_ANY:"number"},v="https://explorer.abtnetwork.io/explorer/";var Ce=function({hash:t,asset:s,rollup:n,address:r,token:o,stake:i,chainId:a=""}){if(xe(a)){const f=Oe(a);return t?g(f,`tx/${t}`):s?g(f,`token/${s}`):g(f,`address/${r}`)}const c=_e[a],d=c==null?void 0:c.defaultRPC,l=d?`${d}`:void 0;return n&&ye(n).role===Se.ROLE_ROLLUP?t?E(g(v,`rollups/${n}/moves/${t}`),{host:l}):E(g(v,`rollups/${n}`),{host:l}):s?E(g(v,`assets/${s}`),{host:l}):t?E(g(v,`txs/${t}`),{host:l}):o?E(g(v,`tokens/${o}/tx`),{host:l}):i?E(g(v,`stakes/${i}`),{host:l}):E(g(v,`accounts/${r}`),{host:l})},Te={isSameAddr:(e,t)=>String(e).toLowerCase()===String(t).toLowerCase()};const $=Ce,{isSameAddr:y}=Te;class U{constructor({type:t,did:s,chainId:n,text:r}){this.text=r,this.did=s,this.type=t,this.chainId=n}}const D=e=>{const t=[];try{let s=0;const n=/<(.+?)\(?[tx|nft|token|stake|did|dapp|link]+[:](.+?)\)?>/gi,r=e.matchAll(n);for(const o of r){const i=/\([tx|nft|token|stake|did|dapp|link]+[:](.+?)\)/gi,a=o[0],c=o.index||s,d=c+a.length;if([...a.matchAll(i)].length>1)return[e];let f="";const p=i.exec(a);let h="";if(p){const C=p[0];f=a.replace(C,"").replace(/^</,"").replace(/(>)$/,""),h=C.replace(/\)$/,"").replace(/^\(/,"")}else h=a;const u=h.split(":"),L=(u[0]||"").replace(/^</,"").replace(/^\(/,"").toUpperCase(),x=(u[1]||"").replace(/>$/,"").replace(/\)$/,""),N=(u[u.length-1]||"").replace(/>$/,"").replace(/\)$/,"");t.push(e.substring(s,c)),t.push(new U({type:L,chainId:x,did:N,text:f||L})),s=d}return s<e.length&&t.push(e.substring(s)),t}catch(s){return console.error(s==null?void 0:s.message),[e]}},H=e=>{let t;const{type:s,chainId:n,did:r}=e;return y(s,"link")?t=`${n}:${r}`:y(s,"tx")?t=$({hash:r,chainId:n}):y(s,"stake")?t=$({stake:r,chainId:n}):y(s,"nft")?t=$({asset:r,chainId:n}):y(s,"token")?t=$({token:r,chainId:n}):y(s,"did")&&(t=$({address:r,chainId:n})),t},$e=(e,t=!0)=>D(e).map(n=>{if(n instanceof U){if(t){const r=H(n),{type:o,chainId:i,did:a}=n;return y(o,"dapp")?`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`:r?`<a target="_blank" rel="noopener noreferrer" style="color:#4598fa;font-weight:bold;" href="${r}">${n.text}</a>`:`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`}return n.text}return n}).join(""),Re=e=>D(e).map(s=>s instanceof U?`<${H(s)}|${s.text}>`:s.replace(/:\n/g,": ")).join("");var ke={toClickableSpan:$e,toTextList:D,toSlackLink:Re,Link:U,getLink:H};const Ne=e=>{const t="explorer.arcblockio.cn";return e&&{beta:"beta.abtnetwork.io",main:"main.abtnetwork.io"}[e]||t},Ue=e=>{try{return new URL(e).host}catch{return e}};var Qe={getChainHost:Ne,getUrlHost:Ue},Xe={linkStyle:{color:"#2754C5",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"14px",textDecoration:"underline"},actionsStyle:{margin:"20px -8px 0px"},actionStyle:{color:"#4598fa",fontSize:14,border:"1px solid #4598fa",display:"inline-block",borderRadius:"4px",margin:"8px",marginTop:"8px",marginBottom:"8px",marginLeft:"8px",marginRight:"8px"},assetStyle:{backgroundColor:"#f6f6f6",borderRadius:"8px",padding:"8px"},remarkStyle:{color:"#9397a1",fontSize:"12px",margin:0,whiteSpace:"pre-line!important"},summaryStyle:{color:"#49c3ad",fontWeight:700},titleStyle:{marginBottom:"6px"},severityColorMap:{normal:"#C4C5CA",success:"#25C99B",error:"#F16E6E",warning:"#DE9E37"},attachmentsStyle:{borderLeft:"2px solid transparent",paddingLeft:"20px"},h1Style:{color:"#333",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"24px",fontWeight:"bold",margin:"40px 0",padding:"0"},footerStyle:{color:"#898989",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"12px",lineHeight:"22px",margin:0}},we={year:{long:"year",short:"y"},day:{long:"day",short:"d"},hour:{long:"hour",short:"h"},minute:{long:"minute",short:"m"},second:{long:"second",short:"s"},millisecond:{long:"millisecond",short:"ms"},microsecond:{long:"microsecond",short:"µs"},nanosecond:{long:"nanosecond",short:"ns"}},be={year:{long:"年",short:"年"},day:{long:"天",short:"天"},hour:{long:"小时",short:"小时"},minute:{long:"分钟",short:"分"},second:{long:"秒钟",short:"秒"},millisecond:{long:"毫秒",short:"毫秒"},microsecond:{long:"微秒",short:"微秒"},nanosecond:{long:"纳秒",short:"纳秒"}};const P=new Map,Me=(e,t)=>{P.set(e,t)},Ae=(e="en_US")=>P.get(e)||P.get("en_US");var X={registerLang:Me,getLang:Ae},Pe=e=>{if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}};const De=Pe,{getLang:R}=X,He=(e,t)=>t===1?e:`${e}s`,Ie=1e-7;var Be=(e,t={})=>{if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const s=R(t.locale),n=[],r=(a,c)=>{const d=Math.floor(a*10**c+Ie);return(Math.round(d)/10**c).toFixed(c)},o=(a,c,d)=>{if((n.length===0||!t.colonNotation)&&a===0&&!(t.colonNotation&&c==="minute"))return;const{long:l}=s[c]||R("en_US")[c],{short:f}=s[c]||R("en_US")[c];let p=(d||a||"0").toString(),h,u;if(t.colonNotation){h=n.length>0?":":"",u="";const L=p.includes(".")?p.split(".")[0].length:p.length,x=n.length>0?2:1;p="0".repeat(Math.max(0,x-L))+p}else h="",t.locale==="zh_CN"?Object.values(i).filter(L=>L>0).length>1?!i.days&&!i.hours&&i.minutes&&t.compact?u=l:u=f:i.minutes?u=l:u=f:u=t.verbose?` ${He(l,a)}`:f;n.push(h+p+u)},i=De(e);if(o(Math.trunc(i.days/365),"year"),o(i.days%365,"day"),o(i.hours,"hour"),o(i.minutes,"minute"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(o(i.seconds,"second"),t.formatSubMilliseconds)o(i.milliseconds,"millisecond"),o(i.microseconds,"microsecond"),o(i.nanoseconds,"nanosecond");else{const a=i.milliseconds+i.microseconds/1e3+i.nanoseconds/1e6,c=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,d=a>=1?Math.round(a):Math.ceil(a),l=c?a.toFixed(c):d;o(Number.parseFloat(l,10),"millisecond",l)}else{const a=e/1e3%60,c=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,d=r(a,c),l=t.keepDecimalsOnWholeSeconds?d:d.replace(/\.0+$/,"");o(Number.parseFloat(l,10),"second",l)}if(n.length===0){const a=(s.millisecond||R("en_US").millisecond).long,c=(s.millisecond||R("en_US").millisecond).short;return t.locale==="zh_CN"?`0${t.verbose?`${a}`:c}`:`0${t.verbose?` ${a}s`:c}`}if(t.compact)return n[0];if(typeof t.unitCount=="number"){const a=t.colonNotation?"":" ";return n.slice(0,Math.max(t.unitCount,1)).join(a)}return t.colonNotation?n.join(""):n.join(" ")};const Fe=we,je=be,{registerLang:I}=X,Z=Be;I("en_US",Fe);I("zh_CN",je);Z.registerLang=I;var Ke=Z;const Ze=W(Ke);export{V as B,qe as H,Qe as c,Te as f,ke as h,Ze as p,Xe as s,ce as u};
|
|
1
|
+
import{E as T,j as K,aM as J}from"./vendor-mui-core-xF5F4eT7.js";import{x as O}from"./vendor-utils-5TjOM6td.js";import{y as ee,h as _,R as te,O as ne,T as se,D as re,U as oe}from"./index-C85gVBzh.js";import{g as W,r as ae}from"./vendor-react-D-afvo_7.js";import{n as ie}from"./vendor-arcblock-DZrZ_x_3.js";const S=(e,t)=>{var n;let s="?v=";return t?s+=te(t):s+=`${(n=e==null?void 0:e.meta)==null?void 0:n.version}${ne(e==null?void 0:e.status)?"~":""}`,s};function ce({blocklet:e}){var L,x,N,C,B,F,j;const{inService:t}=ee(),s=(L=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE))==null?void 0:L.value,n=(x=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT))==null?void 0:x.value,r=(N=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON))==null?void 0:N.value,o=(C=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_PORTRAIT))==null?void 0:C.value,i=(B=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_LANDSCAPE))==null?void 0:B.value,a=(F=((e==null?void 0:e.environments)||[]).find(m=>m.key===_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_OG_IMAGE))==null?void 0:F.value,c=((j=window.env)==null?void 0:j.apiPrefix)||"/",d=`${O(c,`/blocklet/logo/${t?"":e.meta.did}`)}${S(e,s)}`,l=`${O(c,`/blocklet/logo-rect/${t?"":e.meta.did}`)}${S(e,n??s)}`,f=`${O(c,`/blocklet/logo-favicon/${t?"":e.meta.did}`)}${S(e,r??s)}`,p=`${O(c,`/blocklet/splash/portrait/${t?"":e.meta.did}`)}${S(e,o)}`,h=`${O(c,`/blocklet/splash/landscape/${t?"":e.meta.did}`)}${S(e,i)}`,u=`${O(c,`/blocklet/og-image/${t?"":e.meta.did}`)}${S(e,a)}`;return{logoUrl:d,rectLogoUrl:l,faviconUrl:f,splashPortraitUrl:p,splashLandscapeUrl:h,ogImageUrl:u}}function V({blocklet:e,style:t,size:s,...n}){const{logoUrl:r}=ce({blocklet:e}),{variant:o}=n;return K.jsx(J,{variant:o||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},t),...n,children:K.jsx("img",{src:r,alt:"",style:{width:s}})})}V.propTypes={blocklet:T.object.isRequired,style:T.object,size:T.oneOfType([T.number,T.string])};V.defaultProps={style:{},size:40};var le=ae;function de(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var w=de(le);function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},M.apply(this,arguments)}function ue(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,A(e,t)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},A(e,t)}function fe(e,t){if(e==null)return{};var s={},n=Object.keys(e),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(s[r]=e[r]);return s}var G={position:"absolute",bottom:0,left:0,height:0,overflow:"hidden","padding-top":0,"padding-bottom":0,border:"none"},pe=["box-sizing","width","font-size","font-weight","font-family","font-style","letter-spacing","text-indent","white-space","word-break","overflow-wrap","padding-left","padding-right"];function me(e,t){if(!e||typeof e!="object")return e;var s={};return Object.keys(e).forEach(function(n){t.indexOf(n)>-1||(s[n]=e[n])}),s}var he=["component","className","unsafeHTML"];function Y(e,t){if(t!=="letters"&&t!=="words")throw new Error("Unsupported options basedOn: "+t);if(e.nodeType===Node.TEXT_NODE){var s=document.createDocumentFragment(),n;switch(t){case"words":n=e.textContent.split(/\b|(?=\W)/);break;case"letters":n=Array.from(e.textContent);break}n.forEach(function(a){s.appendChild(ge(a))}),e.parentNode.replaceChild(s,e)}else if(e.nodeType===Node.ELEMENT_NODE)for(var r=[].slice.call(e.childNodes),o=r.length,i=0;i<o;i++)Y(r[i],t)}function ge(e){var t=document.createElement("span");return t.className="LinesEllipsis-unit",t.textContent=e,t}function z(e){e.parentNode.replaceChild(document.createTextNode(e.textContent),e)}function q(e,t){if(!(!t.contains(e)||e===t)){for(;e.nextElementSibling;)e.parentNode.removeChild(e.nextElementSibling);q(e.parentNode,t)}}function Le(e){for(var t=e;t=t.parentNode;)if(/p|div|main|section|h\d|ul|ol|li/.test(t.tagName.toLowerCase()))return t}function b(e){return!!(e.offsetHeight&&(e.offsetWidth||/\S/.test(e.textContent)))}var k={component:"div",unsafeHTML:"",maxLine:1,ellipsis:"…",ellipsisHTML:void 0,className:"",basedOn:void 0,onReflow:function(){},winWidth:void 0},Ee=Object.keys(k),Q=function(e){ue(t,e);function t(n){var r;return r=e.call(this,n)||this,r.state={html:n.unsafeHTML,clamped:!1},r.canvas=null,r.maxLine=0,r.nlUnits=[],r}var s=t.prototype;return s.componentDidMount=function(){this.initCanvas(),this.reflow(this.props)},s.componentDidUpdate=function(r){r.winWidth!==this.props.winWidth&&this.copyStyleToCanvas(),this.props!==r&&this.reflow(this.props)},s.componentWillUnmount=function(){this.canvas.parentNode.removeChild(this.canvas),this.canvas=null},s.setState=function(r,o){return typeof r.clamped<"u"&&(this.clamped=r.clamped),e.prototype.setState.call(this,r,o)},s.initCanvas=function(){if(!this.canvas){var r=this.canvas=document.createElement("div");r.className="LinesEllipsis-canvas "+this.props.className,r.setAttribute("aria-hidden","true"),this.copyStyleToCanvas(),Object.keys(G).forEach(function(o){r.style[o]=G[o]}),document.body.appendChild(r)}},s.copyStyleToCanvas=function(){var r=this,o=window.getComputedStyle(this.target);pe.forEach(function(i){r.canvas.style[i]=o[i]})},s.reflow=function(r){this.maxLine=+r.maxLine||1,this.canvas.innerHTML=r.unsafeHTML;var o=r.basedOn||(/^[\x00-\x7F]+$/.test(r.unsafeHTML)?"words":"letters");Y(this.canvas,o);var i=this.putEllipsis(this.calcIndexes()),a={clamped:i,html:this.canvas.innerHTML};this.setState(a,r.onReflow.bind(this,a))},s.calcIndexes=function(){var r=[0],o=this.nlUnits=Array.from(this.canvas.querySelectorAll(".LinesEllipsis-unit")),i=o.length;if(!o.length)return r;var a=o.find(b);if(!a)return r;for(var c=1,d=a.offsetTop,l=1;l<i&&!(b(o[l])&&o[l].offsetTop-d>1&&(c++,r.push(l),d=o[l].offsetTop,c>this.maxLine));l++);return r},s.putEllipsis=function(r){if(r.length<=this.maxLine)return!1;this.nlUnits=this.nlUnits.slice(0,r[this.maxLine]);var o=this.nlUnits.pop(),i=this.makeEllipsisSpan();do q(o,this.canvas),Le(o).appendChild(i),o=this.nlUnits.pop();while(o&&(!b(o)||i.offsetHeight>o.offsetHeight||i.offsetTop>o.offsetTop));return o&&z(o),this.nlUnits.forEach(z),!0},s.makeEllipsisSpan=function(){var r=this.props,o=r.ellipsisHTML,i=r.ellipsis,a=document.createElement("span");a.appendChild(document.createElement("wbr"));var c=document.createElement("span");return c.className="LinesEllipsis-ellipsis",o?c.innerHTML=o:c.textContent=i,a.appendChild(c),a},s.isClamped=function(){return this.clamped},s.render=function(){var r=this,o=this.state,i=o.html,a=o.clamped,c=this.props,d=c.component,l=c.className,f=c.unsafeHTML,p=fe(c,he);return w.default.createElement(d,M({className:"LinesEllipsis "+(a?"LinesEllipsis--clamped":"")+" "+l,ref:function(u){return r.target=u}},me(p,Ee)),w.default.createElement("div",{dangerouslySetInnerHTML:{__html:a?i:f}}))},t}(w.default.Component);Q.defaultProps=k;var ve=Q;const qe=W(ve),{joinURL:g,withQuery:E}=se,{toTypeInfo:ye}=ie,{isEVMChain:xe,getExplorerUrl:Oe}=re,{arcChainConfig:_e}=oe,Se={ROLE_ACCOUNT:"number",ROLE_NODE:"number",ROLE_DEVICE:"number",ROLE_APPLICATION:"number",ROLE_SMART_CONTRACT:"number",ROLE_BOT:"number",ROLE_ASSET:"number",ROLE_STAKE:"number",ROLE_VALIDATOR:"number",ROLE_GROUP:"number",ROLE_TX:"number",ROLE_TETHER:"number",ROLE_SWAP:"number",ROLE_DELEGATION:"number",ROLE_VC:"number",ROLE_BLOCKLET:"number",ROLE_STORE:"number",ROLE_TOKEN:"number",ROLE_FACTORY:"number",ROLE_ROLLUP:"number",ROLE_STORAGE:"number",ROLE_PROFILE:"number",ROLE_ANY:"number"},v="https://explorer.abtnetwork.io/explorer/";var Ce=function({hash:t,asset:s,rollup:n,address:r,token:o,stake:i,chainId:a=""}){if(xe(a)){const f=Oe(a);return t?g(f,`tx/${t}`):s?g(f,`token/${s}`):g(f,`address/${r}`)}const c=_e[a],d=c==null?void 0:c.defaultRPC,l=d?`${d}`:void 0;return n&&ye(n).role===Se.ROLE_ROLLUP?t?E(g(v,`rollups/${n}/moves/${t}`),{host:l}):E(g(v,`rollups/${n}`),{host:l}):s?E(g(v,`assets/${s}`),{host:l}):t?E(g(v,`txs/${t}`),{host:l}):o?E(g(v,`tokens/${o}/tx`),{host:l}):i?E(g(v,`stakes/${i}`),{host:l}):E(g(v,`accounts/${r}`),{host:l})},Te={isSameAddr:(e,t)=>String(e).toLowerCase()===String(t).toLowerCase()};const $=Ce,{isSameAddr:y}=Te;class U{constructor({type:t,did:s,chainId:n,text:r}){this.text=r,this.did=s,this.type=t,this.chainId=n}}const D=e=>{const t=[];try{let s=0;const n=/<(.+?)\(?[tx|nft|token|stake|did|dapp|link]+[:](.+?)\)?>/gi,r=e.matchAll(n);for(const o of r){const i=/\([tx|nft|token|stake|did|dapp|link]+[:](.+?)\)/gi,a=o[0],c=o.index||s,d=c+a.length;if([...a.matchAll(i)].length>1)return[e];let f="";const p=i.exec(a);let h="";if(p){const C=p[0];f=a.replace(C,"").replace(/^</,"").replace(/(>)$/,""),h=C.replace(/\)$/,"").replace(/^\(/,"")}else h=a;const u=h.split(":"),L=(u[0]||"").replace(/^</,"").replace(/^\(/,"").toUpperCase(),x=(u[1]||"").replace(/>$/,"").replace(/\)$/,""),N=(u[u.length-1]||"").replace(/>$/,"").replace(/\)$/,"");t.push(e.substring(s,c)),t.push(new U({type:L,chainId:x,did:N,text:f||L})),s=d}return s<e.length&&t.push(e.substring(s)),t}catch(s){return console.error(s==null?void 0:s.message),[e]}},H=e=>{let t;const{type:s,chainId:n,did:r}=e;return y(s,"link")?t=`${n}:${r}`:y(s,"tx")?t=$({hash:r,chainId:n}):y(s,"stake")?t=$({stake:r,chainId:n}):y(s,"nft")?t=$({asset:r,chainId:n}):y(s,"token")?t=$({token:r,chainId:n}):y(s,"did")&&(t=$({address:r,chainId:n})),t},$e=(e,t=!0)=>D(e).map(n=>{if(n instanceof U){if(t){const r=H(n),{type:o,chainId:i,did:a}=n;return y(o,"dapp")?`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`:r?`<a target="_blank" rel="noopener noreferrer" style="color:#4598fa;font-weight:bold;" href="${r}">${n.text}</a>`:`<em style="font-weight:bold;" data-type="${o}" data-chain-id="${i}" data-did="${a}">${n.text}</em>`}return n.text}return n}).join(""),Re=e=>D(e).map(s=>s instanceof U?`<${H(s)}|${s.text}>`:s.replace(/:\n/g,": ")).join("");var ke={toClickableSpan:$e,toTextList:D,toSlackLink:Re,Link:U,getLink:H};const Ne=e=>{const t="explorer.arcblockio.cn";return e&&{beta:"beta.abtnetwork.io",main:"main.abtnetwork.io"}[e]||t},Ue=e=>{try{return new URL(e).host}catch{return e}};var Qe={getChainHost:Ne,getUrlHost:Ue},Xe={linkStyle:{color:"#2754C5",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"14px",textDecoration:"underline"},actionsStyle:{margin:"20px -8px 0px"},actionStyle:{color:"#4598fa",fontSize:14,border:"1px solid #4598fa",display:"inline-block",borderRadius:"4px",margin:"8px",marginTop:"8px",marginBottom:"8px",marginLeft:"8px",marginRight:"8px"},assetStyle:{backgroundColor:"#f6f6f6",borderRadius:"8px",padding:"8px"},remarkStyle:{color:"#9397a1",fontSize:"12px",margin:0,whiteSpace:"pre-line!important"},summaryStyle:{color:"#49c3ad",fontWeight:700},titleStyle:{marginBottom:"6px"},severityColorMap:{normal:"#C4C5CA",success:"#25C99B",error:"#F16E6E",warning:"#DE9E37"},attachmentsStyle:{borderLeft:"2px solid transparent",paddingLeft:"20px"},h1Style:{color:"#333",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"24px",fontWeight:"bold",margin:"40px 0",padding:"0"},footerStyle:{color:"#898989",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",fontSize:"12px",lineHeight:"22px",margin:0}},we={year:{long:"year",short:"y"},day:{long:"day",short:"d"},hour:{long:"hour",short:"h"},minute:{long:"minute",short:"m"},second:{long:"second",short:"s"},millisecond:{long:"millisecond",short:"ms"},microsecond:{long:"microsecond",short:"µs"},nanosecond:{long:"nanosecond",short:"ns"}},be={year:{long:"年",short:"年"},day:{long:"天",short:"天"},hour:{long:"小时",short:"小时"},minute:{long:"分钟",short:"分"},second:{long:"秒钟",short:"秒"},millisecond:{long:"毫秒",short:"毫秒"},microsecond:{long:"微秒",short:"微秒"},nanosecond:{long:"纳秒",short:"纳秒"}};const P=new Map,Me=(e,t)=>{P.set(e,t)},Ae=(e="en_US")=>P.get(e)||P.get("en_US");var X={registerLang:Me,getLang:Ae},Pe=e=>{if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}};const De=Pe,{getLang:R}=X,He=(e,t)=>t===1?e:`${e}s`,Ie=1e-7;var Be=(e,t={})=>{if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const s=R(t.locale),n=[],r=(a,c)=>{const d=Math.floor(a*10**c+Ie);return(Math.round(d)/10**c).toFixed(c)},o=(a,c,d)=>{if((n.length===0||!t.colonNotation)&&a===0&&!(t.colonNotation&&c==="minute"))return;const{long:l}=s[c]||R("en_US")[c],{short:f}=s[c]||R("en_US")[c];let p=(d||a||"0").toString(),h,u;if(t.colonNotation){h=n.length>0?":":"",u="";const L=p.includes(".")?p.split(".")[0].length:p.length,x=n.length>0?2:1;p="0".repeat(Math.max(0,x-L))+p}else h="",t.locale==="zh_CN"?Object.values(i).filter(L=>L>0).length>1?!i.days&&!i.hours&&i.minutes&&t.compact?u=l:u=f:i.minutes?u=l:u=f:u=t.verbose?` ${He(l,a)}`:f;n.push(h+p+u)},i=De(e);if(o(Math.trunc(i.days/365),"year"),o(i.days%365,"day"),o(i.hours,"hour"),o(i.minutes,"minute"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(o(i.seconds,"second"),t.formatSubMilliseconds)o(i.milliseconds,"millisecond"),o(i.microseconds,"microsecond"),o(i.nanoseconds,"nanosecond");else{const a=i.milliseconds+i.microseconds/1e3+i.nanoseconds/1e6,c=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,d=a>=1?Math.round(a):Math.ceil(a),l=c?a.toFixed(c):d;o(Number.parseFloat(l,10),"millisecond",l)}else{const a=e/1e3%60,c=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,d=r(a,c),l=t.keepDecimalsOnWholeSeconds?d:d.replace(/\.0+$/,"");o(Number.parseFloat(l,10),"second",l)}if(n.length===0){const a=(s.millisecond||R("en_US").millisecond).long,c=(s.millisecond||R("en_US").millisecond).short;return t.locale==="zh_CN"?`0${t.verbose?`${a}`:c}`:`0${t.verbose?` ${a}s`:c}`}if(t.compact)return n[0];if(typeof t.unitCount=="number"){const a=t.colonNotation?"":" ";return n.slice(0,Math.max(t.unitCount,1)).join(a)}return t.colonNotation?n.join(""):n.join(" ")};const Fe=we,je=be,{registerLang:I}=X,Z=Be;I("en_US",Fe);I("zh_CN",je);Z.registerLang=I;var Ke=Z;const Ze=W(Ke);export{V as B,qe as H,Qe as c,Te as f,ke as h,Ze as p,Xe as s,ce as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as h}from"./vendor-react-D-afvo_7.js";import{j as e,a1 as Ne,E as y,a4 as qe,T as U,a3 as w,aa as ue,a2 as pe,ah as Ue,aj as Re,x as Te,R as Me,bH as De,bI as $e,aP as Ve,al as Se,V as He,cn as Ge,cm as Je,aN as Qe,bL as Xe,A as Ie}from"./vendor-mui-core-xF5F4eT7.js";import{b as se,z as Ye,A as Ze,ap as re}from"./vendor-utils-5TjOM6td.js";import{b as M,j as Q,$ as Ae,aC as V,e as ne,a6 as et,am as tt,B as Ee,bj as st,aU as nt,bA as at}from"./vendor-arcblock-DZrZ_x_3.js";import{y as it,F as B,m as ot,H as ye}from"./index-LIf2LIyz.js";import{d as J,a as rt}from"./vendor-hooks-BKxTDk_P.js";import{b as he}from"./dashboard-Cgj1BkGn.js";import{p as lt}from"./util-NSOsPZWM.js";import{W as ke}from"./did-address-D0Fo5eTl.js";import{S as te}from"./shorten-label-J69eHfMN.js";import{I as je}from"./index-DGzAI_hi.js";import{c as ve}from"./index-DoZ2YM4T.js";import{S as ct,a as dt}from"./list-DI-9r9EP.js";import{R as Le}from"./relative-time-DpRjdL5Z.js";import{D as ut,g as pt}from"./traffic-DelPjTGb.js";import{B as Oe}from"./bundle-avatar-CYdInmjR.js";import{B as ft}from"./index-0u5pzPhR.js";import"./useLocalStorage-DV4AIe5L.js";import"./confirm-CpCj_oj-.js";import"./format-error-C0Ke3VXF.js";import"./PlayArrow-DZfknrYj.js";import"./get-safe-url-DDeO6YpV.js";import"./session-CM1ewS-k.js";import"./useAsyncRetry-Bmo6a1Zp.js";import"./useAsync-Ua5iss51.js";import"./InfoOutlined-C_J3Y0fX.js";import"./useSetState-Crt4S51m.js";import"./index-CHFvfli7.js";import"./iframe-CU0LfRyS.js";import"./LaunchOutlined-DaJw5LME.js";import"./ChevronLeft-CmbkC1dP.js";import"./ChevronRight-DlIj8Fj2.js";import"./index-C-D-nCB1.js";import"./vendor-mui-x-CSUdon8K.js";const Pe=h.createContext({}),{Provider:mt,Consumer:Ss}=Pe;function ht({children:t,blocklet:i=""}){const{api:a,inService:f,ws:{useSubscription:m}}=it(),[u,c]=h.useState([]),[j,A]=h.useState({total:0,pageSize:20,pageCount:0,page:1}),[R,_]=h.useState(!1),E=J(()=>{var T;return(T=i.meta)==null?void 0:T.did},[i]),[K,Y]=h.useState({}),[O,H]=h.useState([]),F=async({page:T=1,pageSize:L=20,...C}={})=>{if(!(R||!E))try{_(!0);const I={paging:{page:T,pageSize:L},...C,userName:C.searchText||"",teamDid:E,dateRange:C.dateRange?[B(C.dateRange[0]).toISOString(),B(C.dateRange[1]).toISOString()]:void 0},{dids:W,...Z}=I;let G="";W.includes("system")&&(G="system");const q=W.filter(z=>z!=="system"),ee=await a.getNotificationSendLog({input:{...Z,source:G,componentDids:q}});Y(I);const ae=ee.list.map(z=>({...z,receiverUser:{...z.receiverUser,avatar:lt(z.receiverUser.avatar,E,f)}}));c(ae),A(ee.paging),_(!1)}catch(I){Q.error(I.message),_(!1)}},g=async()=>{const T=await a.getNotificationComponents({input:{teamDid:E}});H(T.componentDids)},D=h.useCallback(T=>{const L=i.children.find(C=>{var I;return((I=C.meta)==null?void 0:I.did)===T});if(L)return L.ancestors=[i],L},[i]),k=async({notificationReceiverIds:T,channels:L,...C})=>{await a.resendNotification({input:{teamDid:E,notificationReceiverIds:T,channels:L.map(I=>I==="wallet"?M.NOTIFICATION_SEND_CHANNEL.WALLET:I==="pushKit"?M.NOTIFICATION_SEND_CHANNEL.PUSH:I),...C}})},$=h.useCallback(async T=>(await a.getUser({input:{teamDid:E,user:{did:T}}})).user,[a,E]);m(`${M.EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,T=>{T&&(F(K),g())},[K]),h.useEffect(()=>{E&&g()},[E]);const S={loading:R,fetch:F,data:u,paging:j,blocklet:i,getComponent:D,resendNotification:k,getUser:$,componentDids:O};return e.jsx(mt,{value:{notificationRecords:S},children:t})}function Fe(){const{notificationRecords:t}=h.useContext(Pe);return t}var xe={},gt=Ne;Object.defineProperty(xe,"__esModule",{value:!0});var ze=xe.default=void 0,xt=gt(Ae()),bt=e;ze=xe.default=(0,xt.default)((0,bt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var be={},St=Ne;Object.defineProperty(be,"__esModule",{value:!0});var Be=be.default=void 0,yt=St(Ae()),jt=e;Be=be.default=(0,yt.default)((0,jt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");const vt=(t,i,a="")=>{if(!a||!i)return"";switch(a){case M.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:i});case M.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:i});case M.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:i});case M.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return a}};function de(t,i,a={}){const{status:f,updatedAt:m,reason:u="",channel:c="wallet"}=a,j=m?t("notification.sendStatus.sentTime",{date:ot(m,i)}):"",A=vt(t,c,u);return f===M.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:j,reason:A}:f===M.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:j}:{status:"pending",title:t("notification.sendStatus.pending"),reason:A,sentTime:j}}const we={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ge=["wallet","pushKit","email"],wt=(t,i)=>{var m,u;const{settings:a}=t,f=se(i,"extra.notifications.email",!0);return{available:(u=(m=a==null?void 0:a.notification)==null?void 0:m.email)==null?void 0:u.enabled,enabled:f}},Ct=(t,i)=>{var m,u;const{settings:a}=t,f=se(i,"extra.notifications.push",!0);return{available:(u=(m=a==null?void 0:a.notification)==null?void 0:m.pushKit)==null?void 0:u.enabled,enabled:f}},Nt=t=>({enabled:se(t,"extra.notifications.wallet",!0)}),Rt=t=>({enabled:se(t,"extra.webhooks",[]).length>0}),Ce=(t=3e3)=>new Promise(i=>{setTimeout(()=>{i()},t)}),Tt=(t,i)=>i==="wallet"||i==="webhook"?[{channel:i,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:i}),fail:t("notification.sendStatus.reason.disabled",{channel:i})}]:i==="pushKit"||i==="email"?[{channel:i,type:"available",pass:t("notification.sendStatus.reason.available",{channel:i}),fail:t("notification.sendStatus.reason.unavailable",{channel:i})},{channel:i,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:i}),fail:t("notification.sendStatus.reason.disabled",{channel:i})}]:[],Dt=t=>{const i={},a=B().startOf("day");ge.forEach(u=>{const c=`${u}SendRecord`,A=se(t,c,[]).filter(R=>B(R.sendAt).isSame(a,"day")).length;i[u]=A});const f=se(t,"webhook",{}),m=Object.keys(f??{})??[];return m.length>0&&m.forEach(u=>{const j=(f[u]??[]).filter(A=>B(A.sendAt).isSame(a,"day")).length;i[u]=j}),i};function X({config:t,enableTooltip:i=!0,showTitle:a=!1}){const{status:f,title:m="",sentTime:u="",reason:c=""}=t,j=[m,c].filter(Boolean).join(", ");return e.jsx(qe,{title:i?e.jsxs(e.Fragment,{children:[e.jsx(U,{color:"inherit",sx:{fontSize:12},children:j}),e.jsx("span",{children:u})]}):null,arrow:!0,placement:"top",children:e.jsxs(w,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[e.jsxs(w,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(w,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:we[f],style:{opacity:.15}}),e.jsx(w,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:we[f]})]}),a?e.jsx(U,{color:"inherit",sx:{fontSize:12},children:m}):null]})})}X.propTypes={config:y.object.isRequired,enableTooltip:y.bool,showTitle:y.bool};X.defaultProps={enableTooltip:!0,showTitle:!1};_e.propTypes={notification:y.object.isRequired,onCancel:y.func,blocklet:y.object.isRequired,resendChannel:y.string,refresh:y.func,tab:y.string};function _e({notification:t,onCancel:i=()=>{},blocklet:a,resendChannel:f="",refresh:m=()=>{},tab:u="info"}){const{t:c,locale:j}=ne(),{getComponent:A,resendNotification:R,getUser:_}=Fe(),[E,K]=h.useState([]),[Y,O]=h.useState([]),[H,F]=h.useState(null),[g,D]=h.useState(null),k=h.useRef({}),$=J(()=>A(t.componentDid)||a,[a,t.componentDid]),S=J(()=>{var s;return(s=t==null?void 0:t.receivers)==null?void 0:s[0]},[t.receivers]),T=J(()=>S==null?void 0:S.receiver,[S]),L=J(()=>S==null?void 0:S.receiverUser,[S]),C=rt({tab:u||"info"}),I=J(()=>Dt(S),[S]),W=h.useCallback(async s=>{const{receiver:l}=S??{};if(!l)return!1;const p=await _(l);return p?s==="wallet"?Nt(p):s==="email"?wt(a,p):s==="pushKit"?Ct(a,p):s==="webhook"?Rt(p):!0:!1},[S,_,a]);h.useEffect(()=>{if(!S)K([]);else{const s=ge.map(p=>{const b=S[`${p}SendStatus`],v=S[`${p}SendAt`],P=S[`${p}SendFailedReason`],We=de(c,j,{status:b,updatedAt:v,reason:P,channel:p});return{type:p==="pushKit"?"Push Kit":p,extra:We}});K(s);const l=(S==null?void 0:S.webhook)||{};O(Object.entries(l))}},[S,j,c]);const Z=h.useCallback(async(s,l="")=>{const{id:p}=S??{};if(p)try{await R({notificationReceiverIds:[p],channels:[s],...s==="webhook"&&l?{webhookUrls:[l]}:{}}),Q.success("Message has been sent!"),s!=="webhook"&&(await Ce(1e3),F(null))}catch(b){console.error("handleResend error",{error:b}),Q.error(b.response?b.response.statusText:b.message)}},[R,S]),G=async(s,l)=>{if(l==null||l.stopPropagation(),I[s.type]>=4){Q.warning(c("notification.resendLimit"));return}if(l&&F(l==null?void 0:l.currentTarget),D({channel:s.type}),!(!s||s.checking)){K(b=>b.map(v=>s.type===v.type?{...v,checking:!0}:v));try{const b=await W(s.type);await Ce(),D({channel:s.type,result:b}),(typeof b=="boolean"&&b||Ye(b)&&Object.values(b).every(v=>!!v))&&(await Z(s.type),m()),K(v=>v.map(P=>s.type===P.type?{...P,checking:!1}:P))}catch(b){console.error("handleResend error",{error:b})}}},q=async(s,l=null)=>{if(l==null||l.stopPropagation(),I[s]>=4){Q.warning(c("notification.resendLimit"));return}O(b=>b.map(v=>s===v[0]?[...v.slice(0,2),!0]:v));try{await Z("webhook",s),O(b=>b.map(v=>s===v[0]?[...v.slice(0,2),!0]:v)),m()}catch(b){console.error("handleResend error",{error:b})}};h.useEffect(()=>{f&&(C.tab="status",setTimeout(()=>{const s=k.current[f];s&&(ge.includes(f)?(F(s),G({type:f})):q(f))},500))},[f]);const ee=()=>{F(null)},ae=h.useCallback(s=>Tt(c,s),[c]),z=!!H,o=z?"check-resend-popover":void 0;function n(){return[{name:c("notification.from"),value:e.jsx(ct,{size:32,blocklet:$,showName:!0,hideDot:!0})},{name:c("notification.to"),value:e.jsx(w,{children:L?e.jsxs(w,{"data-cy":`member-name-${L.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Ee,{src:`${L.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:T,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(te,{children:L.fullName})]},T):e.jsx(ke,{size:14,responsive:!1,compact:!0,copyable:!1,did:T})})},{name:c("notification.notificationTitle"),value:e.jsx(te,{maxLength:50,children:t.title})},{name:c("notification.body"),value:e.jsx(dt,{notification:t,rows:0})},{name:c("notification.createdAt"),value:e.jsx(Le,{value:t.createdAt,locale:j,shouldUpdate:!0})}].map(l=>e.jsx(je,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:l.name,children:l.value},l.name))}const r={info:{label:c("common.basicInfo"),value:"info",component:n},status:{label:c("notification.status"),value:"status"}},d=Object.values(r).map(({label:s,value:l})=>({label:s,value:l})),x=r[C.tab]||r.info,N=s=>{C.tab=s};return e.jsx(et,{title:c("notification.notificationDetails"),onClose:()=>{C.tab="info",F(null),i()},open:!0,PaperProps:{style:{maxWidth:832,maxHeight:"80vh"}},sx:{"& .MuiDialogContent-root":{paddingTop:0}},fullWidth:!0,actionsPosition:"left",children:e.jsxs(It,{children:[e.jsx(w,{mx:3,className:"tabs",children:e.jsx(tt,{tabs:d,current:C.tab,onChange:N,scrollButtons:"auto"})}),e.jsx("div",{className:"body",children:C.tab==="info"?e.jsx(x.component,{}):e.jsxs(w,{children:[E.map(s=>e.jsx(je,{valueComponent:"div",nameWidth:120,name:s.type,children:e.jsxs(w,{className:"channel-item",display:"flex",alignItems:"center",sx:{gap:"4px",fontSize:14},children:[e.jsx(w,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(X,{config:s.extra,showTitle:!0})}),s.extra.status!=="success"&&e.jsxs(U,{ref:l=>{k.current[s.type]=l},component:"span",display:"flex",alignItems:"center",sx:{color:V.primary.main,fontSize:14},className:ve("resend-btn",{disabled:s.checking||I[s.type]>=4}),onClick:l=>G(s,l),children:[s.checking?e.jsx(pe,{size:12,sx:{color:V.primary.main}}):e.jsx(he,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]})},s.type)),e.jsx(Ue,{textAlign:"left",sx:{mt:1,mb:1},children:"Webhook"}),e.jsx(w,{className:"notification-resend-section",display:"flex",flexDirection:"column",gap:1,style:{paddingLeft:0},children:Y.map(([s,l,p])=>{const b=l[0],v=de(c,j,{...b,updatedAt:b.sendAt,reason:b.failedReason,channel:"webhook"});return e.jsxs(w,{className:"channel-item",display:"flex",alignItems:"center",sx:{gap:"4px",fontSize:12},children:[e.jsx(te,{maxLength:30,children:s}),e.jsx(w,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(X,{config:v,showTitle:!0})}),v.status!=="success"&&e.jsxs(U,{ref:P=>{k.current[s]=P},component:"span",sx:{color:V.primary.main},className:ve("resend-btn",{disabled:p||I[s]>=4}),onClick:P=>q(s,P),children:[p?e.jsx(pe,{size:12,sx:{color:V.primary.main}}):e.jsx(he,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]},s)})})]})}),e.jsx(Re,{id:o,open:z,anchorEl:H,onClose:ee,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(At,{children:[e.jsxs(U,{variant:"body1",component:"div",className:"check-title",children:[g==null?void 0:g.channel," Checking"]}),e.jsx(w,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:ae(g==null?void 0:g.channel).map(s=>{var v,P;const{type:l,pass:p,fail:b}=s;return!(g!=null&&g.result)||(v=g==null?void 0:g.result)!=null&&v[l]?e.jsxs(U,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(P=g==null?void 0:g.result)!=null&&P[l]?V.success.main:"inherit"},children:[g!=null&&g.result?e.jsx(Be,{}):e.jsx(pe,{size:12,sx:{color:V.primary.main}}),e.jsx("span",{children:p})]},l):e.jsxs(U,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:V.error.main},children:[e.jsx(ze,{}),e.jsx("span",{children:b})]},l)})})]})})]})})}const It=ue.div`
|
|
1
|
+
import{r as h}from"./vendor-react-D-afvo_7.js";import{j as e,a1 as Ne,E as y,a4 as qe,T as U,a3 as w,aa as ue,a2 as pe,ah as Ue,aj as Re,x as Te,R as Me,bH as De,bI as $e,aP as Ve,al as Se,V as He,cn as Ge,cm as Je,aN as Qe,bL as Xe,A as Ie}from"./vendor-mui-core-xF5F4eT7.js";import{b as se,z as Ye,A as Ze,ap as re}from"./vendor-utils-5TjOM6td.js";import{b as M,j as Q,$ as Ae,aC as V,e as ne,a6 as et,am as tt,B as Ee,bj as st,aU as nt,bA as at}from"./vendor-arcblock-DZrZ_x_3.js";import{y as it,F as B,m as ot,H as ye}from"./index-C85gVBzh.js";import{d as J,a as rt}from"./vendor-hooks-BKxTDk_P.js";import{b as he}from"./dashboard-DEaIei4u.js";import{p as lt}from"./util-NSOsPZWM.js";import{W as ke}from"./did-address-D0Fo5eTl.js";import{S as te}from"./shorten-label-J69eHfMN.js";import{I as je}from"./index-DGzAI_hi.js";import{c as ve}from"./index-DoZ2YM4T.js";import{S as ct,a as dt}from"./list-Cy1my35m.js";import{R as Le}from"./relative-time-ChYpdg43.js";import{D as ut,g as pt}from"./traffic-CctA2CCp.js";import{B as Oe}from"./bundle-avatar-3QSGrsNA.js";import{B as ft}from"./index-Cld1HWxz.js";import"./useLocalStorage-DV4AIe5L.js";import"./confirm-dIU5y9cG.js";import"./format-error-C0Ke3VXF.js";import"./PlayArrow-DZfknrYj.js";import"./get-safe-url-Du4BhDgB.js";import"./session-CM1ewS-k.js";import"./useAsyncRetry-Bmo6a1Zp.js";import"./useAsync-Ua5iss51.js";import"./InfoOutlined-C_J3Y0fX.js";import"./useSetState-Crt4S51m.js";import"./index-CHFvfli7.js";import"./iframe-CU0LfRyS.js";import"./LaunchOutlined-DaJw5LME.js";import"./ChevronLeft-CmbkC1dP.js";import"./ChevronRight-DlIj8Fj2.js";import"./index-C-D-nCB1.js";import"./vendor-mui-x-CSUdon8K.js";const Pe=h.createContext({}),{Provider:mt,Consumer:Ss}=Pe;function ht({children:t,blocklet:i=""}){const{api:a,inService:f,ws:{useSubscription:m}}=it(),[u,c]=h.useState([]),[j,A]=h.useState({total:0,pageSize:20,pageCount:0,page:1}),[R,_]=h.useState(!1),E=J(()=>{var T;return(T=i.meta)==null?void 0:T.did},[i]),[K,Y]=h.useState({}),[O,H]=h.useState([]),F=async({page:T=1,pageSize:L=20,...C}={})=>{if(!(R||!E))try{_(!0);const I={paging:{page:T,pageSize:L},...C,userName:C.searchText||"",teamDid:E,dateRange:C.dateRange?[B(C.dateRange[0]).toISOString(),B(C.dateRange[1]).toISOString()]:void 0},{dids:W,...Z}=I;let G="";W.includes("system")&&(G="system");const q=W.filter(z=>z!=="system"),ee=await a.getNotificationSendLog({input:{...Z,source:G,componentDids:q}});Y(I);const ae=ee.list.map(z=>({...z,receiverUser:{...z.receiverUser,avatar:lt(z.receiverUser.avatar,E,f)}}));c(ae),A(ee.paging),_(!1)}catch(I){Q.error(I.message),_(!1)}},g=async()=>{const T=await a.getNotificationComponents({input:{teamDid:E}});H(T.componentDids)},D=h.useCallback(T=>{const L=i.children.find(C=>{var I;return((I=C.meta)==null?void 0:I.did)===T});if(L)return L.ancestors=[i],L},[i]),k=async({notificationReceiverIds:T,channels:L,...C})=>{await a.resendNotification({input:{teamDid:E,notificationReceiverIds:T,channels:L.map(I=>I==="wallet"?M.NOTIFICATION_SEND_CHANNEL.WALLET:I==="pushKit"?M.NOTIFICATION_SEND_CHANNEL.PUSH:I),...C}})},$=h.useCallback(async T=>(await a.getUser({input:{teamDid:E,user:{did:T}}})).user,[a,E]);m(`${M.EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,T=>{T&&(F(K),g())},[K]),h.useEffect(()=>{E&&g()},[E]);const S={loading:R,fetch:F,data:u,paging:j,blocklet:i,getComponent:D,resendNotification:k,getUser:$,componentDids:O};return e.jsx(mt,{value:{notificationRecords:S},children:t})}function Fe(){const{notificationRecords:t}=h.useContext(Pe);return t}var xe={},gt=Ne;Object.defineProperty(xe,"__esModule",{value:!0});var ze=xe.default=void 0,xt=gt(Ae()),bt=e;ze=xe.default=(0,xt.default)((0,bt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var be={},St=Ne;Object.defineProperty(be,"__esModule",{value:!0});var Be=be.default=void 0,yt=St(Ae()),jt=e;Be=be.default=(0,yt.default)((0,jt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");const vt=(t,i,a="")=>{if(!a||!i)return"";switch(a){case M.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:i});case M.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:i});case M.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:i});case M.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return a}};function de(t,i,a={}){const{status:f,updatedAt:m,reason:u="",channel:c="wallet"}=a,j=m?t("notification.sendStatus.sentTime",{date:ot(m,i)}):"",A=vt(t,c,u);return f===M.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:j,reason:A}:f===M.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:j}:{status:"pending",title:t("notification.sendStatus.pending"),reason:A,sentTime:j}}const we={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ge=["wallet","pushKit","email"],wt=(t,i)=>{var m,u;const{settings:a}=t,f=se(i,"extra.notifications.email",!0);return{available:(u=(m=a==null?void 0:a.notification)==null?void 0:m.email)==null?void 0:u.enabled,enabled:f}},Ct=(t,i)=>{var m,u;const{settings:a}=t,f=se(i,"extra.notifications.push",!0);return{available:(u=(m=a==null?void 0:a.notification)==null?void 0:m.pushKit)==null?void 0:u.enabled,enabled:f}},Nt=t=>({enabled:se(t,"extra.notifications.wallet",!0)}),Rt=t=>({enabled:se(t,"extra.webhooks",[]).length>0}),Ce=(t=3e3)=>new Promise(i=>{setTimeout(()=>{i()},t)}),Tt=(t,i)=>i==="wallet"||i==="webhook"?[{channel:i,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:i}),fail:t("notification.sendStatus.reason.disabled",{channel:i})}]:i==="pushKit"||i==="email"?[{channel:i,type:"available",pass:t("notification.sendStatus.reason.available",{channel:i}),fail:t("notification.sendStatus.reason.unavailable",{channel:i})},{channel:i,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:i}),fail:t("notification.sendStatus.reason.disabled",{channel:i})}]:[],Dt=t=>{const i={},a=B().startOf("day");ge.forEach(u=>{const c=`${u}SendRecord`,A=se(t,c,[]).filter(R=>B(R.sendAt).isSame(a,"day")).length;i[u]=A});const f=se(t,"webhook",{}),m=Object.keys(f??{})??[];return m.length>0&&m.forEach(u=>{const j=(f[u]??[]).filter(A=>B(A.sendAt).isSame(a,"day")).length;i[u]=j}),i};function X({config:t,enableTooltip:i=!0,showTitle:a=!1}){const{status:f,title:m="",sentTime:u="",reason:c=""}=t,j=[m,c].filter(Boolean).join(", ");return e.jsx(qe,{title:i?e.jsxs(e.Fragment,{children:[e.jsx(U,{color:"inherit",sx:{fontSize:12},children:j}),e.jsx("span",{children:u})]}):null,arrow:!0,placement:"top",children:e.jsxs(w,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1},children:[e.jsxs(w,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(w,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:we[f],style:{opacity:.15}}),e.jsx(w,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:we[f]})]}),a?e.jsx(U,{color:"inherit",sx:{fontSize:12},children:m}):null]})})}X.propTypes={config:y.object.isRequired,enableTooltip:y.bool,showTitle:y.bool};X.defaultProps={enableTooltip:!0,showTitle:!1};_e.propTypes={notification:y.object.isRequired,onCancel:y.func,blocklet:y.object.isRequired,resendChannel:y.string,refresh:y.func,tab:y.string};function _e({notification:t,onCancel:i=()=>{},blocklet:a,resendChannel:f="",refresh:m=()=>{},tab:u="info"}){const{t:c,locale:j}=ne(),{getComponent:A,resendNotification:R,getUser:_}=Fe(),[E,K]=h.useState([]),[Y,O]=h.useState([]),[H,F]=h.useState(null),[g,D]=h.useState(null),k=h.useRef({}),$=J(()=>A(t.componentDid)||a,[a,t.componentDid]),S=J(()=>{var s;return(s=t==null?void 0:t.receivers)==null?void 0:s[0]},[t.receivers]),T=J(()=>S==null?void 0:S.receiver,[S]),L=J(()=>S==null?void 0:S.receiverUser,[S]),C=rt({tab:u||"info"}),I=J(()=>Dt(S),[S]),W=h.useCallback(async s=>{const{receiver:l}=S??{};if(!l)return!1;const p=await _(l);return p?s==="wallet"?Nt(p):s==="email"?wt(a,p):s==="pushKit"?Ct(a,p):s==="webhook"?Rt(p):!0:!1},[S,_,a]);h.useEffect(()=>{if(!S)K([]);else{const s=ge.map(p=>{const b=S[`${p}SendStatus`],v=S[`${p}SendAt`],P=S[`${p}SendFailedReason`],We=de(c,j,{status:b,updatedAt:v,reason:P,channel:p});return{type:p==="pushKit"?"Push Kit":p,extra:We}});K(s);const l=(S==null?void 0:S.webhook)||{};O(Object.entries(l))}},[S,j,c]);const Z=h.useCallback(async(s,l="")=>{const{id:p}=S??{};if(p)try{await R({notificationReceiverIds:[p],channels:[s],...s==="webhook"&&l?{webhookUrls:[l]}:{}}),Q.success("Message has been sent!"),s!=="webhook"&&(await Ce(1e3),F(null))}catch(b){console.error("handleResend error",{error:b}),Q.error(b.response?b.response.statusText:b.message)}},[R,S]),G=async(s,l)=>{if(l==null||l.stopPropagation(),I[s.type]>=4){Q.warning(c("notification.resendLimit"));return}if(l&&F(l==null?void 0:l.currentTarget),D({channel:s.type}),!(!s||s.checking)){K(b=>b.map(v=>s.type===v.type?{...v,checking:!0}:v));try{const b=await W(s.type);await Ce(),D({channel:s.type,result:b}),(typeof b=="boolean"&&b||Ye(b)&&Object.values(b).every(v=>!!v))&&(await Z(s.type),m()),K(v=>v.map(P=>s.type===P.type?{...P,checking:!1}:P))}catch(b){console.error("handleResend error",{error:b})}}},q=async(s,l=null)=>{if(l==null||l.stopPropagation(),I[s]>=4){Q.warning(c("notification.resendLimit"));return}O(b=>b.map(v=>s===v[0]?[...v.slice(0,2),!0]:v));try{await Z("webhook",s),O(b=>b.map(v=>s===v[0]?[...v.slice(0,2),!0]:v)),m()}catch(b){console.error("handleResend error",{error:b})}};h.useEffect(()=>{f&&(C.tab="status",setTimeout(()=>{const s=k.current[f];s&&(ge.includes(f)?(F(s),G({type:f})):q(f))},500))},[f]);const ee=()=>{F(null)},ae=h.useCallback(s=>Tt(c,s),[c]),z=!!H,o=z?"check-resend-popover":void 0;function n(){return[{name:c("notification.from"),value:e.jsx(ct,{size:32,blocklet:$,showName:!0,hideDot:!0})},{name:c("notification.to"),value:e.jsx(w,{children:L?e.jsxs(w,{"data-cy":`member-name-${L.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Ee,{src:`${L.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:T,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(te,{children:L.fullName})]},T):e.jsx(ke,{size:14,responsive:!1,compact:!0,copyable:!1,did:T})})},{name:c("notification.notificationTitle"),value:e.jsx(te,{maxLength:50,children:t.title})},{name:c("notification.body"),value:e.jsx(dt,{notification:t,rows:0})},{name:c("notification.createdAt"),value:e.jsx(Le,{value:t.createdAt,locale:j,shouldUpdate:!0})}].map(l=>e.jsx(je,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:l.name,children:l.value},l.name))}const r={info:{label:c("common.basicInfo"),value:"info",component:n},status:{label:c("notification.status"),value:"status"}},d=Object.values(r).map(({label:s,value:l})=>({label:s,value:l})),x=r[C.tab]||r.info,N=s=>{C.tab=s};return e.jsx(et,{title:c("notification.notificationDetails"),onClose:()=>{C.tab="info",F(null),i()},open:!0,PaperProps:{style:{maxWidth:832,maxHeight:"80vh"}},sx:{"& .MuiDialogContent-root":{paddingTop:0}},fullWidth:!0,actionsPosition:"left",children:e.jsxs(It,{children:[e.jsx(w,{mx:3,className:"tabs",children:e.jsx(tt,{tabs:d,current:C.tab,onChange:N,scrollButtons:"auto"})}),e.jsx("div",{className:"body",children:C.tab==="info"?e.jsx(x.component,{}):e.jsxs(w,{children:[E.map(s=>e.jsx(je,{valueComponent:"div",nameWidth:120,name:s.type,children:e.jsxs(w,{className:"channel-item",display:"flex",alignItems:"center",sx:{gap:"4px",fontSize:14},children:[e.jsx(w,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(X,{config:s.extra,showTitle:!0})}),s.extra.status!=="success"&&e.jsxs(U,{ref:l=>{k.current[s.type]=l},component:"span",display:"flex",alignItems:"center",sx:{color:V.primary.main,fontSize:14},className:ve("resend-btn",{disabled:s.checking||I[s.type]>=4}),onClick:l=>G(s,l),children:[s.checking?e.jsx(pe,{size:12,sx:{color:V.primary.main}}):e.jsx(he,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]})},s.type)),e.jsx(Ue,{textAlign:"left",sx:{mt:1,mb:1},children:"Webhook"}),e.jsx(w,{className:"notification-resend-section",display:"flex",flexDirection:"column",gap:1,style:{paddingLeft:0},children:Y.map(([s,l,p])=>{const b=l[0],v=de(c,j,{...b,updatedAt:b.sendAt,reason:b.failedReason,channel:"webhook"});return e.jsxs(w,{className:"channel-item",display:"flex",alignItems:"center",sx:{gap:"4px",fontSize:12},children:[e.jsx(te,{maxLength:30,children:s}),e.jsx(w,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(X,{config:v,showTitle:!0})}),v.status!=="success"&&e.jsxs(U,{ref:P=>{k.current[s]=P},component:"span",sx:{color:V.primary.main},className:ve("resend-btn",{disabled:p||I[s]>=4}),onClick:P=>q(s,P),children:[p?e.jsx(pe,{size:12,sx:{color:V.primary.main}}):e.jsx(he,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]},s)})})]})}),e.jsx(Re,{id:o,open:z,anchorEl:H,onClose:ee,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(At,{children:[e.jsxs(U,{variant:"body1",component:"div",className:"check-title",children:[g==null?void 0:g.channel," Checking"]}),e.jsx(w,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:ae(g==null?void 0:g.channel).map(s=>{var v,P;const{type:l,pass:p,fail:b}=s;return!(g!=null&&g.result)||(v=g==null?void 0:g.result)!=null&&v[l]?e.jsxs(U,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(P=g==null?void 0:g.result)!=null&&P[l]?V.success.main:"inherit"},children:[g!=null&&g.result?e.jsx(Be,{}):e.jsx(pe,{size:12,sx:{color:V.primary.main}}),e.jsx("span",{children:p})]},l):e.jsxs(U,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:V.error.main},children:[e.jsx(ze,{}),e.jsx("span",{children:b})]},l)})})]})})]})})}const It=ue.div`
|
|
2
2
|
& > .notification-row {
|
|
3
3
|
padding: 0;
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as S,k as Dt,l as lt,L as ce,f as Hn,h as Gn,i as pt}from"./vendor-react-D-afvo_7.js";import{a1 as be,j as t,t as ze,a3 as u,aM as Wo,E as d,a4 as pe,I as ne,T as A,bU as Uo,aa as de,aE as Xn,bL as Ge,ad as Fo,aN as Xe,bq as jt,x as Y,a2 as et,P as Ho,G as Go,v as Tt,$ as Xo,ar as Jo,al as fe,ah as Jn,D as _t,ab as Qo,r as Yo,bK as Qn,K as Be,y as Zo,M as Z,ac as ye,aL as Yn,L as Zn,z as Kn,bn as es,aA as Ko,az as tt,bt as ts,bu as os,bV as ns,bW as ss,aP as en,bH as rs,bN as is,bx as ls,by as ft}from"./vendor-mui-core-xF5F4eT7.js";import{y as xe,B as Te,h as ie,a5 as cs,f as mo,_ as tn,ad as bo}from"./index-LIf2LIyz.js";import{$ as ge,b as H,e as Q,a2 as ot,ab as on,aT as nn,a9 as sn,Z as as,aU as Pt,j as W,n as ds,aV as us,aW as ps,Y as fs,aB as re,aX as hs,ao as ms,aL as Re,a6 as Lt,aY as ve,ah as bs,am as xs}from"./vendor-arcblock-DZrZ_x_3.js";import{d as qt}from"./Add-DSPtuudj.js";import{d as gs}from"./Error-CN75ZRlV.js";import{C as $t}from"./confirm-CpCj_oj-.js";import{u as ct}from"./session-CM1ewS-k.js";import{W as xo}from"./did-address-D0Fo5eTl.js";import{E as Ve,D as go,C as jo,P as ko}from"./react-beautiful-dnd.esm-DwxjmShi.js";import{B as Nt}from"./bundle-avatar-CYdInmjR.js";import{S as he}from"./shorten-label-J69eHfMN.js";import{T as js,x as ae,G as At,C as Je}from"./vendor-utils-5TjOM6td.js";import{d as ks}from"./Download-B4M4wwJm.js";import{d as ys}from"./QuestionMarkCircle-BvUTckGB.js";import{u as vs}from"./vendor-hooks-BKxTDk_P.js";import{_ as Se}from"./useSetState-Crt4S51m.js";import{c as Et}from"./index-DoZ2YM4T.js";import{E as Mt}from"./index-CHFvfli7.js";import{p as nt}from"./index-BA_7CRkd.js";import"./api-K65cLqol.js";import{d as ws}from"./ChevronRight-DlIj8Fj2.js";import{T as Cs,a as Ss}from"./vendor-mui-x-CSUdon8K.js";import{d as yo}from"./DeleteOutline-BzV7E1BM.js";import{c as Rs,A as rn,u as Is,S as Ds,U as Ts,a as ht,b as ln,n as _s,e as Ps,f as vo,g as Ls}from"./item-Ba7fzXuK.js";import{d as qs}from"./ArrowDropDown-DM9y1OaN.js";import{f as Ie}from"./format-error-C0Ke3VXF.js";import{C as $s}from"./click-to-copy-Bu9H6mvL.js";import{d as Ns}from"./Launch-BX35m3eH.js";import{M as As}from"./index-ChSPqVLh.js";import{r as Es}from"./index-DtwN19zv.js";import{d as Ms}from"./Done-DJfjmlFC.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-DDeO6YpV.js";var Ot={},Os=be;Object.defineProperty(Ot,"__esModule",{value:!0});var cn=Ot.default=void 0,zs=Os(ge()),Bs=t;cn=Ot.default=(0,zs.default)((0,Bs.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var zt={},Vs=be;Object.defineProperty(zt,"__esModule",{value:!0});var an=zt.default=void 0,Ws=Vs(ge()),Us=t;an=zt.default=(0,Ws.default)((0,Us.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Fs=be;Object.defineProperty(Bt,"__esModule",{value:!0});var dn=Bt.default=void 0,Hs=Fs(ge()),Gs=t;dn=Bt.default=(0,Hs.default)((0,Gs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Vt({did:e,projectId:o,title:n,logo:r,describe:s}){const i=`${`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=S.useState(!1),f=ze(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Wo,{sx:{borderRadius:1},src:i}),t.jsxs(u,{children:[t.jsx(he,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(he,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Vt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Wt({initUrl:e}){const o=Dt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:l}=xe(),{api:i}=ct(),[a,c]=S.useState(!0),{blocklet:f}=Te(),[h,g]=S.useState(null),[m,p]=S.useState(!1),v=ze(j=>j.breakpoints.down("xl")),{componentDid:w=""}=lt(),[T,x]=S.useState(null),b=()=>{l.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(j=>{const P=(j==null?void 0:j.projects)||[];c(!1),x(P)}).catch(j=>{c(!1),W.error(j.message)})},I=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},L=j=>{g(j)},D=()=>{c(!1),p(!0)},k=()=>{p(!1),g(null)},_=j=>{W.error(j.message),p(!1),g(null)},N=j=>{if(!(j!=null&&j.deleted)){W.error("Delete project failed");return}b(),p(!1),g(null)},U=(j,P,E)=>{let F=j==null?void 0:j.trim();return F?(F=ds.toAddress(F).toLocaleLowerCase(),E.some((O,R)=>{const q=P[R];return q&&O.searchable&&O.display!=="excluded"&&O.display!=="false"&&q.toLocaleLowerCase().includes(F)})):!0};if(S.useEffect(()=>{b()},[]),!T&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!T)return null;if(!T.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(ot,{onClick:I,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const y=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:j=>{const P=T[j];return t.jsx(ce,{to:`${P.id}`,children:t.jsx(Vt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:j=>j?t.jsx(on,{type:"success",children:j}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:j=>j?t.jsx(xo,{size:14,compact:!0,responsive:!1,did:j}):null}},v||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:j=>j?t.jsx(xo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${j}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:j}):null}},v||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:j=>{const P=(f.children||[]).find(E=>E.meta.did===j);return P?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Nt,{size:14,blocklet:P,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},j):""}}},v||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:j=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(he,{children:j})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:j=>t.jsx(nn,{value:Number(j),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:j=>{const P=T[j];return t.jsxs(u,{display:"flex",children:[t.jsx(ce,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:t.jsx(pe,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"create",children:t.jsx(cn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&t.jsx(pe,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx(ce,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:t.jsx(an,{sx:{fontSize:18}})})})}),t.jsx(pe,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>L(P),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),C=m?t.jsx(as,{open:!0,popup:!0,onClose:k,action:"check-has-project-id",locale:s,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:N,onError:_,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(pe,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(dn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(ot,{onClick:I,variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Pt,{className:"main-table",locale:s,data:T,columns:y,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:U}}),h&&t.jsx($t,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:D,onCancel:()=>g(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(j=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(gs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:j})]}))})}),C]})}Wt.propTypes={initUrl:d.object};Wt.defaultProps={initUrl:null};var Ut={},Xs=be;Object.defineProperty(Ut,"__esModule",{value:!0});var un=Ut.default=void 0,Js=Xs(ge()),wo=t;un=Ut.default=(0,Js.default)([(0,wo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,wo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Qs(){var D;const{t:e,locale:o}=Q(),{projectId:n}=lt(),{api:r}=xe(),[s,l]=S.useState(!0),{blocklet:i}=Te(),a=ze(k=>k.breakpoints.down("md")),[c,f]=S.useState(null),[h,g]=S.useState(null),[m,p]=S.useState(null),v=(D=window.env)==null?void 0:D.serverEndpoint,w=()=>{r.getReleases({input:{did:i.meta.did,projectId:n}}).then(k=>{const _=(k==null?void 0:k.releases)||[];l(!1),f(_)}).catch(k=>{l(!1),W.error(k.message)})},T=()=>{r.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:n}},getReleases:{input:{did:i.meta.did,projectId:n}}}).then(k=>{g(k.getProject.project||{}),f(k.getReleases.releases||[]),l(!1)}).catch(k=>{l(!1),W.error(k.message)})};S.useEffect(()=>{T()},[]);const x=()=>{l(!1);const k=m.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:k}}).then(()=>{l(!1),w(),W.success(e("common.removeSuccess")),p(null)}).catch(_=>{l(!1),W.error(_.message)})},b=k=>{p(k)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!c)return null;const I=t.jsxs(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ce,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(he,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[I,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(ce,{to:"create/none",children:t.jsx(ot,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const L=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(ce,{to:`view/${_.id}`,children:t.jsx(Vt,{did:i.meta.did,projectId:h.id,logo:_.blockletLogo,title:_.blockletVersion,describe:_.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(A,{className:"note",children:_.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:k=>t.jsx(on,{type:k==="published"?"success":"warning",children:k==="published"?"Released":js(k)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const _=c[k];return _.status!==ie.PROJECT.RELEASE_STATUS.published?"":t.jsx(nn,{value:Number(_.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var j;const _=c[k];let N="",U="";const y=_.status==="published";if(y){const P=ae(v,`/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),E=new URL(v);E.pathname=ae(E.pathname,"/launch-blocklet/agreement"),E.searchParams.set("blocklet_meta_url",P),N=E.href,U=ae(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const C=(j=h.blockletComponents)!=null&&j.some(P=>P.included)||_.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[y&&C==="pack"&&t.jsx(pe,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:N,target:"_blank",rel:"noreferrer",children:t.jsx(un,{sx:{fontSize:18}})})})}),y&&t.jsx(pe,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:U,children:t.jsx(ks,{sx:{fontSize:18}})})})}),t.jsx(pe,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>b(_),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(Ys,{children:[t.jsxs(u,{className:"header",children:[I,t.jsx(ce,{to:"new-release/none",children:t.jsxs(ot,{variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Pt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:L,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),m&&t.jsx($t,{title:e(`${e("common.delete")} ${m.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:x,onCancel:()=>p(null)})]})}const Ys=de(u)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-_suzTPHn.js","assets/vendor-arcblock-DZrZ_x_3.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-5TjOM6td.js","assets/vendor-mui-core-xF5F4eT7.js","assets/vendor-hooks-BKxTDk_P.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-C2fPoxDR.js","assets/index-C85gVBzh.js","assets/index-DoZ2YM4T.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as S,k as Dt,l as lt,L as ce,f as Hn,h as Gn,i as pt}from"./vendor-react-D-afvo_7.js";import{a1 as be,j as t,t as ze,a3 as u,aM as Wo,E as d,a4 as pe,I as ne,T as A,bU as Uo,aa as de,aE as Xn,bL as Ge,ad as Fo,aN as Xe,bq as jt,x as Y,a2 as et,P as Ho,G as Go,v as Tt,$ as Xo,ar as Jo,al as fe,ah as Jn,D as _t,ab as Qo,r as Yo,bK as Qn,K as Be,y as Zo,M as Z,ac as ye,aL as Yn,L as Zn,z as Kn,bn as es,aA as Ko,az as tt,bt as ts,bu as os,bV as ns,bW as ss,aP as en,bH as rs,bN as is,bx as ls,by as ft}from"./vendor-mui-core-xF5F4eT7.js";import{y as xe,B as Te,h as ie,a5 as cs,f as mo,_ as tn,ad as bo}from"./index-C85gVBzh.js";import{$ as ge,b as H,e as Q,a2 as ot,ab as on,aT as nn,a9 as sn,Z as as,aU as Pt,j as W,n as ds,aV as us,aW as ps,Y as fs,aB as re,aX as hs,ao as ms,aL as Re,a6 as Lt,aY as ve,ah as bs,am as xs}from"./vendor-arcblock-DZrZ_x_3.js";import{d as qt}from"./Add-DSPtuudj.js";import{d as gs}from"./Error-CN75ZRlV.js";import{C as $t}from"./confirm-dIU5y9cG.js";import{u as ct}from"./session-CM1ewS-k.js";import{W as xo}from"./did-address-D0Fo5eTl.js";import{E as Ve,D as go,C as jo,P as ko}from"./react-beautiful-dnd.esm-DwxjmShi.js";import{B as Nt}from"./bundle-avatar-3QSGrsNA.js";import{S as he}from"./shorten-label-J69eHfMN.js";import{T as js,x as ae,G as At,C as Je}from"./vendor-utils-5TjOM6td.js";import{d as ks}from"./Download-B4M4wwJm.js";import{d as ys}from"./QuestionMarkCircle-BvUTckGB.js";import{u as vs}from"./vendor-hooks-BKxTDk_P.js";import{_ as Se}from"./useSetState-Crt4S51m.js";import{c as Et}from"./index-DoZ2YM4T.js";import{E as Mt}from"./index-CHFvfli7.js";import{p as nt}from"./index-aIv-YSXW.js";import"./api-K65cLqol.js";import{d as ws}from"./ChevronRight-DlIj8Fj2.js";import{T as Cs,a as Ss}from"./vendor-mui-x-CSUdon8K.js";import{d as yo}from"./DeleteOutline-BzV7E1BM.js";import{c as Rs,A as rn,u as Is,S as Ds,U as Ts,a as ht,b as ln,n as _s,e as Ps,f as vo,g as Ls}from"./item-IntWv1pk.js";import{d as qs}from"./ArrowDropDown-DM9y1OaN.js";import{f as Ie}from"./format-error-C0Ke3VXF.js";import{C as $s}from"./click-to-copy-Bu9H6mvL.js";import{d as Ns}from"./Launch-BX35m3eH.js";import{M as As}from"./index-ChSPqVLh.js";import{r as Es}from"./index-DtwN19zv.js";import{d as Ms}from"./Done-DJfjmlFC.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-Du4BhDgB.js";var Ot={},Os=be;Object.defineProperty(Ot,"__esModule",{value:!0});var cn=Ot.default=void 0,zs=Os(ge()),Bs=t;cn=Ot.default=(0,zs.default)((0,Bs.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var zt={},Vs=be;Object.defineProperty(zt,"__esModule",{value:!0});var an=zt.default=void 0,Ws=Vs(ge()),Us=t;an=zt.default=(0,Ws.default)((0,Us.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Fs=be;Object.defineProperty(Bt,"__esModule",{value:!0});var dn=Bt.default=void 0,Hs=Fs(ge()),Gs=t;dn=Bt.default=(0,Hs.default)((0,Gs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Vt({did:e,projectId:o,title:n,logo:r,describe:s}){const i=`${`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=S.useState(!1),f=ze(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Wo,{sx:{borderRadius:1},src:i}),t.jsxs(u,{children:[t.jsx(he,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(he,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Vt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Wt({initUrl:e}){const o=Dt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:l}=xe(),{api:i}=ct(),[a,c]=S.useState(!0),{blocklet:f}=Te(),[h,g]=S.useState(null),[m,p]=S.useState(!1),v=ze(j=>j.breakpoints.down("xl")),{componentDid:w=""}=lt(),[T,x]=S.useState(null),b=()=>{l.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(j=>{const P=(j==null?void 0:j.projects)||[];c(!1),x(P)}).catch(j=>{c(!1),W.error(j.message)})},I=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},L=j=>{g(j)},D=()=>{c(!1),p(!0)},k=()=>{p(!1),g(null)},_=j=>{W.error(j.message),p(!1),g(null)},N=j=>{if(!(j!=null&&j.deleted)){W.error("Delete project failed");return}b(),p(!1),g(null)},U=(j,P,E)=>{let F=j==null?void 0:j.trim();return F?(F=ds.toAddress(F).toLocaleLowerCase(),E.some((O,R)=>{const q=P[R];return q&&O.searchable&&O.display!=="excluded"&&O.display!=="false"&&q.toLocaleLowerCase().includes(F)})):!0};if(S.useEffect(()=>{b()},[]),!T&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!T)return null;if(!T.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(ot,{onClick:I,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const y=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:j=>{const P=T[j];return t.jsx(ce,{to:`${P.id}`,children:t.jsx(Vt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:j=>j?t.jsx(on,{type:"success",children:j}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:j=>j?t.jsx(xo,{size:14,compact:!0,responsive:!1,did:j}):null}},v||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:j=>j?t.jsx(xo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${j}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:j}):null}},v||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:j=>{const P=(f.children||[]).find(E=>E.meta.did===j);return P?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Nt,{size:14,blocklet:P,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},j):""}}},v||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:j=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(he,{children:j})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:j=>t.jsx(nn,{value:Number(j),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:j=>{const P=T[j];return t.jsxs(u,{display:"flex",children:[t.jsx(ce,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:t.jsx(pe,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"create",children:t.jsx(cn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&t.jsx(pe,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx(ce,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:t.jsx(an,{sx:{fontSize:18}})})})}),t.jsx(pe,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>L(P),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),C=m?t.jsx(as,{open:!0,popup:!0,onClose:k,action:"check-has-project-id",locale:s,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:N,onError:_,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(pe,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(dn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(ot,{onClick:I,variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Pt,{className:"main-table",locale:s,data:T,columns:y,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:U}}),h&&t.jsx($t,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:D,onCancel:()=>g(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(j=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(gs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:j})]}))})}),C]})}Wt.propTypes={initUrl:d.object};Wt.defaultProps={initUrl:null};var Ut={},Xs=be;Object.defineProperty(Ut,"__esModule",{value:!0});var un=Ut.default=void 0,Js=Xs(ge()),wo=t;un=Ut.default=(0,Js.default)([(0,wo.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,wo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Qs(){var D;const{t:e,locale:o}=Q(),{projectId:n}=lt(),{api:r}=xe(),[s,l]=S.useState(!0),{blocklet:i}=Te(),a=ze(k=>k.breakpoints.down("md")),[c,f]=S.useState(null),[h,g]=S.useState(null),[m,p]=S.useState(null),v=(D=window.env)==null?void 0:D.serverEndpoint,w=()=>{r.getReleases({input:{did:i.meta.did,projectId:n}}).then(k=>{const _=(k==null?void 0:k.releases)||[];l(!1),f(_)}).catch(k=>{l(!1),W.error(k.message)})},T=()=>{r.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:n}},getReleases:{input:{did:i.meta.did,projectId:n}}}).then(k=>{g(k.getProject.project||{}),f(k.getReleases.releases||[]),l(!1)}).catch(k=>{l(!1),W.error(k.message)})};S.useEffect(()=>{T()},[]);const x=()=>{l(!1);const k=m.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:k}}).then(()=>{l(!1),w(),W.success(e("common.removeSuccess")),p(null)}).catch(_=>{l(!1),W.error(_.message)})},b=k=>{p(k)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!c)return null;const I=t.jsxs(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ce,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(he,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[I,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(ce,{to:"create/none",children:t.jsx(ot,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const L=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(ce,{to:`view/${_.id}`,children:t.jsx(Vt,{did:i.meta.did,projectId:h.id,logo:_.blockletLogo,title:_.blockletVersion,describe:_.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(A,{className:"note",children:_.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:k=>t.jsx(on,{type:k==="published"?"success":"warning",children:k==="published"?"Released":js(k)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const _=c[k];return _.status!==ie.PROJECT.RELEASE_STATUS.published?"":t.jsx(nn,{value:Number(_.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var j;const _=c[k];let N="",U="";const y=_.status==="published";if(y){const P=ae(v,`/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),E=new URL(v);E.pathname=ae(E.pathname,"/launch-blocklet/agreement"),E.searchParams.set("blocklet_meta_url",P),N=E.href,U=ae(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const C=(j=h.blockletComponents)!=null&&j.some(P=>P.included)||_.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[y&&C==="pack"&&t.jsx(pe,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:N,target:"_blank",rel:"noreferrer",children:t.jsx(un,{sx:{fontSize:18}})})})}),y&&t.jsx(pe,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:U,children:t.jsx(ks,{sx:{fontSize:18}})})})}),t.jsx(pe,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>b(_),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(Ys,{children:[t.jsxs(u,{className:"header",children:[I,t.jsx(ce,{to:"new-release/none",children:t.jsxs(ot,{variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Pt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:L,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),m&&t.jsx($t,{title:e(`${e("common.delete")} ${m.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:x,onCancel:()=>p(null)})]})}const Ys=de(u)`
|
|
3
3
|
.header {
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: center;
|
|
@@ -129,7 +129,7 @@ import{r as S,k as Dt,l as lt,L as ce,f as Hn,h as Gn,i as pt}from"./vendor-reac
|
|
|
129
129
|
background: #fff;
|
|
130
130
|
z-index: 10;
|
|
131
131
|
}
|
|
132
|
-
`;var Yt={},cr=be;Object.defineProperty(Yt,"__esModule",{value:!0});var kt=Yt.default=void 0,ar=cr(ge()),dr=t;kt=Yt.default=(0,ar.default)((0,dr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const Co="lastWantToConnectStoreId";function ur(e){var a,c;const[o,n]=S.useState(null),{session:r}=ct(),s=S.useCallback(f=>{n(f),localStorage.setItem(Co,f==null?void 0:f.id)},[n]),l=S.useMemo(()=>{var m,p,v,w;const f=localStorage.getItem(Co),h=f?(((m=e==null?void 0:e.settings)==null?void 0:m.storeList)||[]).find(T=>T.id===f):null;if(h)return h;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(T=>{var x;return!(T.id!==H.BLOCKLET_STORE.id||T.scope&&T.scope!=="studio"&&T.scope!==((x=r==null?void 0:r.user)==null?void 0:x.did))});return g||(g=(w=(v=e==null?void 0:e.settings)==null?void 0:v.storeList)==null?void 0:w[0]),g},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||l||{},s]}const bt={};async function fn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){bt[s]&&clearTimeout(bt[s]),await new Promise(a=>setTimeout(a,r));const l=Date.now(),i=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-l>n?c(f):s?bt[s]=setTimeout(()=>i(a,c),o):setTimeout(()=>i(a,c),o)}};return new Promise(i)}function pr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function fr(e,{did:o,projectId:n,messageId:r}){return fn(async()=>{var l;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((l=s==null?void 0:s.project)!=null&&l.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function hr(e,{did:o,projectId:n,storeId:r}){return fn(async()=>{var i,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(i=s==null?void 0:s.project)==null?void 0:i.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const hn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var i,a;const s=e?(i=n==null?void 0:n.meta)==null?void 0:i.did:o==null?void 0:o.did;let l=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(l)||(l=[]),l=l.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:l}};function Zt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:l,componentDid:i}){var j,P,E;const{t:a}=Q(),{session:c}=ct(),{api:f,info:h,inService:g}=xe(),m=Te(),[p,v]=S.useState(!1),w=S.useRef(null),[T,x]=S.useState(!1),[b,I]=S.useState(null),L=F=>{n(F),v(!1)},D=()=>{v(!p)},k=F=>{w.current&&w.current.contains(F.target)||v(!1)},_=()=>{x(!0)},N=()=>{x(!1)},U=async()=>{var F;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((F=m==null?void 0:m.actions)==null?void 0:F.refreshBlocklet())}catch(O){W.error(`Remove Blocklet Store Error: ${Ie(O)}`)}finally{I(null)}},{storeList:y}=hn({fromBlocklet:g,blocklet:e,nodeInfo:h,componentDid:i,userDid:(j=c==null?void 0:c.user)==null?void 0:j.did}),C=(P=e==null?void 0:e.meta)==null?void 0:P.did;return t.jsxs(t.Fragment,{children:[t.jsxs(jt,{disabled:s,ref:w,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Y,{onClick:r,children:[l&&t.jsx(et,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(Y,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:D,children:t.jsx(qs,{})})]}),t.jsx(Ho,{sx:{zIndex:10},open:p,anchorEl:w.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:F})=>t.jsx(Go,{...F,style:{transformOrigin:"center top"},children:t.jsx(Tt,{children:t.jsx(Xo,{onClickAway:k,children:t.jsxs(Jo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[y==null?void 0:y.map(O=>{var R;return t.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>L(O),children:[t.jsxs(u,{children:[t.jsx(he,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),t.jsx(he,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Rs({store:O,userDid:(R=c==null?void 0:c.user)==null?void 0:R.did})&&t.jsx(ne,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),I(O)},children:t.jsx(re,{icon:"ic:outline-delete"})})]},O.url)}),t.jsx(Jn,{}),t.jsxs(fe,{onClick:_,children:[t.jsx(qt,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),T&&t.jsx(rn,{hiddenChildren:!0,open:!0,onClose:N,teamDid:C,storeList:y,scope:"studio",onAdd:(E=m==null?void 0:m.actions)==null?void 0:E.refreshBlocklet}),b&&t.jsx($t,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:U,onCancel:()=>I(null)})]})}Zt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Zt.defaultProps={store:null,blocklet:null};var me=S;const Ae=/^[a-z0-9]+(-[a-z0-9]+)*$/,at=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Ze(f)?null:f}const l=s[0],i=l.split("-");if(i.length>1){const a={provider:r,prefix:i.shift(),name:i.join("-")};return o&&!Ze(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:l};return o&&!Ze(a,n)?null:a}return null},Ze=(e,o)=>e?!!((e.provider===""||e.provider.match(Ae))&&(o&&e.prefix===""||e.prefix.match(Ae))&&e.name.match(Ae)):!1,mn=Object.freeze({left:0,top:0,width:16,height:16}),st=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Kt=Object.freeze({...mn,...st}),yt=Object.freeze({...Kt,body:"",hidden:!1});function mr(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function So(e,o){const n=mr(e,o);for(const r in yt)r in st?r in e&&!(r in n)&&(n[r]=st[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function br(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function l(i){if(n[i])return s[i]=[];if(!(i in s)){s[i]=null;const a=r[i]&&r[i].parent,c=a&&l(a);c&&(s[i]=[a].concat(c))}return s[i]}return Object.keys(n).concat(Object.keys(r)).forEach(l),s}function xr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let l={};function i(a){l=So(r[a]||s[a],l)}return i(o),n.forEach(i),So(e,l)}function bn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=br(e);for(const s in r){const l=r[s];l&&(o(s,xr(e,s,l)),n.push(s))}return n}const gr={provider:"",aliases:{},not_found:{},...mn};function xt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function xn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!xt(e,gr))return null;const n=o.icons;for(const s in n){const l=n[s];if(!s.match(Ae)||typeof l.body!="string"||!xt(l,yt))return null}const r=o.aliases||Object.create(null);for(const s in r){const l=r[s],i=l.parent;if(!s.match(Ae)||typeof i!="string"||!n[i]&&!r[i]||!xt(l,yt))return null}return o}const Ro=Object.create(null);function jr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function we(e,o){const n=Ro[e]||(Ro[e]=Object.create(null));return n[o]||(n[o]=jr(e,o))}function eo(e,o){return xn(o)?bn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function kr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Me=!1;function gn(e){return typeof e=="boolean"&&(Me=e),Me}function yr(e){const o=typeof e=="string"?at(e,!0,Me):e;if(o){const n=we(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function vr(e,o){const n=at(e,!0,Me);if(!n)return!1;const r=we(n.provider,n.prefix);return kr(r,n.name,o)}function wr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Me&&!o&&!e.prefix){let s=!1;return xn(e)&&(e.prefix="",bn(e,(l,i)=>{i&&vr(l,i)&&(s=!0)})),s}const n=e.prefix;if(!Ze({provider:o,prefix:n,name:"a"}))return!1;const r=we(o,n);return!!eo(r,e)}const jn=Object.freeze({width:null,height:null}),kn=Object.freeze({...jn,...st}),Cr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Sr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Io(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Cr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=Sr.test(l);for(;;){if(i){const a=parseFloat(l);isNaN(a)?s.push(l):s.push(Math.ceil(a*o*n)/n)}else s.push(l);if(l=r.shift(),l===void 0)return s.join("");i=!i}}const Rr=e=>e==="unset"||e==="undefined"||e==="none";function Ir(e,o){const n={...Kt,...e},r={...kn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let l=n.body;[n,r].forEach(v=>{const w=[],T=v.hFlip,x=v.vFlip;let b=v.rotate;T?x?b+=2:(w.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),w.push("scale(-1 1)"),s.top=s.left=0):x&&(w.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),w.push("scale(1 -1)"),s.top=s.left=0);let I;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:I=s.height/2+s.top,w.unshift("rotate(90 "+I.toString()+" "+I.toString()+")");break;case 2:w.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:I=s.width/2+s.left,w.unshift("rotate(-90 "+I.toString()+" "+I.toString()+")");break}b%2===1&&(s.left!==s.top&&(I=s.left,s.left=s.top,s.top=I),s.width!==s.height&&(I=s.width,s.width=s.height,s.height=I)),w.length&&(l='<g transform="'+w.join(" ")+'">'+l+"</g>")});const i=r.width,a=r.height,c=s.width,f=s.height;let h,g;i===null?(g=a===null?"1em":a==="auto"?f:a,h=Io(g,c/f)):(h=i==="auto"?c:i,g=a===null?Io(h,f/c):a==="auto"?f:a);const m={},p=(v,w)=>{Rr(w)||(m[v]=w.toString())};return p("width",h),p("height",g),m.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:m,body:l}}const Dr=/\sid="(\S+)"/g,Tr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let _r=0;function Pr(e,o=Tr){const n=[];let r;for(;r=Dr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(l=>{const i=typeof o=="function"?o(l):o+(_r++).toString(),a=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+i+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const vt=Object.create(null);function Lr(e,o){vt[e]=o}function wt(e){return vt[e]||vt[""]}function to(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const oo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Ke=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Ke.push(Ne.shift()):Ke.push(Ne.pop());oo[""]=to({resources:["https://api.iconify.design"].concat(Ke)});function qr(e,o){const n=to(o);return n===null?!1:(oo[e]=n,!0)}function no(e){return oo[e]}const $r=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Do=$r();function Nr(e,o){const n=no(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(i=>{s=Math.max(s,i.length)});const l=o+".json?icons=";r=n.maxURL-s-n.path.length-l.length}return r}function Ar(e){return e===404}const Er=(e,o,n)=>{const r=[],s=Nr(e,o),l="icons";let i={type:l,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(i),i={type:l,provider:e,prefix:o,icons:[]},a=c.length),i.icons.push(c)}),r.push(i),r};function Mr(e){if(typeof e=="string"){const o=no(e);if(o)return o.path}return"/"}const Or=(e,o,n)=>{if(!Do){n("abort",424);return}let r=Mr(o.provider);switch(o.type){case"icons":{const l=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=l+".json?"+c.toString();break}case"custom":{const l=o.uri;r+=l.slice(0,1)==="/"?l.slice(1):l;break}default:n("abort",400);return}let s=503;Do(e+r).then(l=>{const i=l.status;if(i!==200){setTimeout(()=>{n(Ar(i)?"abort":"next",i)});return}return s=501,l.json()}).then(l=>{if(typeof l!="object"||l===null){setTimeout(()=>{l===404?n("abort",l):n("next",s)});return}setTimeout(()=>{n("success",l)})}).catch(()=>{n("next",s)})},zr={prepare:Er,send:Or};function Br(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,l)=>s.provider!==l.provider?s.provider.localeCompare(l.provider):s.prefix!==l.prefix?s.prefix.localeCompare(l.prefix):s.name.localeCompare(l.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const l=s.provider,i=s.prefix,a=s.name,c=n[l]||(n[l]=Object.create(null)),f=c[i]||(c[i]=we(l,i));let h;a in f.icons?h=o.loaded:i===""||f.missing.has(a)?h=o.missing:h=o.pending;const g={provider:l,prefix:i,name:a};h.push(g)}),o}function yn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Vr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(l=>{const i=l.icons,a=i.pending.length;i.pending=i.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])i.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))i.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),i.pending.length!==a&&(n||yn([e],l.id),l.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),l.abort))})}))}let Wr=0;function Ur(e,o,n){const r=Wr++,s=yn.bind(null,n,r);if(!o.pending.length)return s;const l={id:r,icons:o,callback:e,abort:s};return n.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(l)}),s}function Fr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const l=typeof s=="string"?at(s,o,n):s;l&&r.push(l)}),r}var Hr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Gr(e,o,n,r){const s=e.resources.length,l=e.random?Math.floor(Math.random()*s):e.index;let i;if(e.random){let k=e.resources.slice(0);for(i=[];k.length>1;){const _=Math.floor(Math.random()*k.length);i.push(k[_]),k=k.slice(0,_).concat(k.slice(_+1))}i=i.concat(k)}else i=e.resources.slice(l).concat(e.resources.slice(0,l));const a=Date.now();let c="pending",f=0,h,g=null,m=[],p=[];typeof r=="function"&&p.push(r);function v(){g&&(clearTimeout(g),g=null)}function w(){c==="pending"&&(c="aborted"),v(),m.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),m=[]}function T(k,_){_&&(p=[]),typeof k=="function"&&p.push(k)}function x(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:m.length,subscribe:T,abort:w}}function b(){c="failed",p.forEach(k=>{k(void 0,h)})}function I(){m.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),m=[]}function L(k,_,N){const U=_!=="success";switch(m=m.filter(y=>y!==k),c){case"pending":break;case"failed":if(U||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){h=N,b();return}if(U){h=N,m.length||(i.length?D():b());return}if(v(),I(),!e.random){const y=e.resources.indexOf(k.resource);y!==-1&&y!==e.index&&(e.index=y)}c="completed",p.forEach(y=>{y(N)})}function D(){if(c!=="pending")return;v();const k=i.shift();if(k===void 0){if(m.length){g=setTimeout(()=>{v(),c==="pending"&&(I(),b())},e.timeout);return}b();return}const _={status:"pending",resource:k,callback:(N,U)=>{L(_,N,U)}};m.push(_),f++,g=setTimeout(D,e.rotate),n(k,o,_.callback)}return setTimeout(D),x}function vn(e){const o={...Hr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Gr(o,a,c,(g,m)=>{r(),f&&f(g,m)});return n.push(h),h}function l(a){return n.find(c=>a(c))||null}return{query:s,find:l,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function To(){}const gt=Object.create(null);function Xr(e){if(!gt[e]){const o=no(e);if(!o)return;const n=vn(o),r={config:o,redundancy:n};gt[e]=r}return gt[e]}function Jr(e,o,n){let r,s;if(typeof e=="string"){const l=wt(e);if(!l)return n(void 0,424),To;s=l.send;const i=Xr(e);i&&(r=i.redundancy)}else{const l=to(e);if(l){r=vn(l);const i=e.resources?e.resources[0]:"",a=wt(i);a&&(s=a.send)}}return!r||!s?(n(void 0,424),To):r.query(o,s,n)().abort}const _o="iconify2",Oe="iconify",wn=Oe+"-count",Po=Oe+"-version",Cn=36e5,Qr=168;function Ct(e,o){try{return e.getItem(o)}catch{}}function so(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Lo(e,o){try{e.removeItem(o)}catch{}}function St(e,o){return so(e,wn,o.toString())}function Rt(e){return parseInt(Ct(e,wn))||0}const dt={local:!0,session:!0},Sn={local:new Set,session:new Set};let ro=!1;function Yr(e){ro=e}let He=typeof window>"u"?{}:window;function Rn(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}dt[e]=!1}function In(e,o){const n=Rn(e);if(!n)return;const r=Ct(n,Po);if(r!==_o){if(r){const a=Rt(n);for(let c=0;c<a;c++)Lo(n,Oe+c.toString())}so(n,Po,_o),St(n,0);return}const s=Math.floor(Date.now()/Cn)-Qr,l=a=>{const c=Oe+a.toString(),f=Ct(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Lo(n,c)}};let i=Rt(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,St(n,i)):Sn[e].add(a))}function Dn(){if(!ro){Yr(!0);for(const e in dt)In(e,o=>{const n=o.data,r=o.provider,s=n.prefix,l=we(r,s);if(!eo(l,n).length)return!1;const i=n.lastModified||-1;return l.lastModifiedCached=l.lastModifiedCached?Math.min(l.lastModifiedCached,i):i,!0})}}function Zr(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in dt)In(r,s=>{const l=s.data;return s.provider!==e.provider||l.prefix!==e.prefix||l.lastModified===o});return!0}function Kr(e,o){ro||Dn();function n(r){let s;if(!dt[r]||!(s=Rn(r)))return;const l=Sn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=Rt(s),!St(s,i+1))return;const a={cached:Math.floor(Date.now()/Cn),provider:e.provider,data:o};return so(s,Oe+i.toString(),JSON.stringify(a))}o.lastModified&&!Zr(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function qo(){}function ei(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Vr(e)}))}function ti(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let l;if(!s||!(l=wt(n)))return;l.prepare(n,r,s).forEach(a=>{Jr(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=eo(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(g=>{h.delete(g)}),Kr(e,c)}catch(f){console.error(f)}ei(e)})})}))}const oi=(e,o)=>{const n=Fr(e,!0,gn()),r=Br(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,qo)}),()=>{c=!1}}const s=Object.create(null),l=[];let i,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===i)return;i=f,a=h,l.push(we(f,h));const g=s[f]||(s[f]=Object.create(null));g[h]||(g[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:g}=c,m=we(f,h),p=m.pendingIcons||(m.pendingIcons=new Set);p.has(g)||(p.add(g),s[f][h].push(g))}),l.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ti(c,s[f][h])}),o?Ur(o,r,l):qo};function ni(e,o){const n={...e};for(const r in o){const s=o[r],l=typeof s;r in jn?(s===null||s&&(l==="string"||l==="number"))&&(n[r]=s):l===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const si=/[\s,]+/;function ri(e,o){o.split(si).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ii(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let l=parseFloat(e.slice(0,e.length-n.length));return isNaN(l)?0:(l=l/s,l%1===0?r(l):0)}}return o}function li(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function ci(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ai(e){return"data:image/svg+xml,"+ci(e)}function di(e){return'url("'+ai(e)+'")'}let Ee;function ui(){try{Ee=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ee=null}}function pi(e){return Ee===void 0&&ui(),Ee?Ee.createHTML(e):e}const Tn={...kn,inline:!1},fi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},hi={display:"inline-block"},It={backgroundColor:"currentColor"},_n={backgroundColor:"transparent"},$o={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},No={WebkitMask:It,mask:It,background:_n};for(const e in No){const o=No[e];for(const n in $o)o[e+n]=$o[n]}const mi={...Tn,inline:!0};function Ao(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const bi=(e,o,n,r)=>{const s=n?mi:Tn,l=ni(s,o),i=o.mode||"svg",a={},c=o.style||{},f={...i==="svg"?fi:{},ref:r};for(let x in o){const b=o[x];if(b!==void 0)switch(x){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":l[x]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&ri(l,b);break;case"color":a.color=b;break;case"rotate":typeof b=="string"?l[x]=ii(b):typeof b=="number"&&(l[x]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[x]===void 0&&(f[x]=b)}}const h=Ir(e,l),g=h.attributes;if(l.inline&&(a.verticalAlign="-0.125em"),i==="svg"){f.style={...a,...c},Object.assign(f,g);let x=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:pi(Pr(h.body,b?()=>b+"ID"+x++:"iconifyReact"))},me.createElement("svg",f)}const{body:m,width:p,height:v}=e,w=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),T=li(m,{...g,width:p+"",height:v+""});return f.style={...a,"--svg":di(T),width:Ao(g.width),height:Ao(g.height),...hi,...w?It:_n,...c},me.createElement("span",f)};gn(!0);Lr("",zr);if(typeof document<"u"&&typeof window<"u"){Dn();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!wr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;qr(n,s)||console.error(r)}catch{console.error(r)}}}}class Pn extends me.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=at(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const l=yr(s);if(!l){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),l!==null&&(this._loading={name:r,abort:oi([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const i=["iconify"];s.prefix!==""&&i.push("iconify--"+s.prefix),s.provider!==""&&i.push("iconify--"+s.provider),this._setData({data:l,classes:i}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:me.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),bi({...Kt,...n.data},r,o._inline,o._ref)}}const xi=me.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return me.createElement(Pn,r)});me.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return me.createElement(Pn,r)});var gi=xi;const ji=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ut({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Q(),l=e.includes("youtube.com")||e.includes("youtu.be"),i=e.includes("vimeo.com");if(l){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[t.jsx(gi,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(A,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ut.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ut.defaultProps={style:{},controls:1,modestbranding:1};function Ln({setParams:e,onClose:o,params:n}){const{t:r}=Q(),[s,l]=S.useState(""),i=s&&n.blockletVideos.includes(s),a=ji(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(_t,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Qo,{children:r("studio.videoDialogTitle")}),t.jsxs(Yo,{children:[t.jsx(Qn,{fullWidth:!0,value:s,onChange:f=>l(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Be,{position:"end",children:t.jsx(ne,{onClick:()=>l(""),children:t.jsx(ms,{})})}):null,error:i}),i&&t.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ut,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Zo,{children:[t.jsx(Y,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Y,{disabled:!a||i,onClick:c,children:r("studio.confirm")})]})]})}Ln.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Eo=S.lazy(()=>tn(()=>import("./index-DF1jJ-bb.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function qn({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:l,paramsErrTip:i,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:g,componentDid:m}){const{t:p,locale:v}=Q(),{api:w}=xe(),T=Dt(),x=S.useRef(null),b=S.useRef(null),[I,L]=ur(r),[D,k]=S.useState(!1),_=Is({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),N=async R=>{const q=setTimeout(()=>{c(!1)},2e4),z=await fr(w,R);c(!1),clearTimeout(q),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),T(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${z}/create`),{replace:!0})},U=()=>{if(!s.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const R=pr();_(async(q,z)=>{var G,X,K;try{const J=await w.connectByStudio({input:{did:(G=r==null?void 0:r.meta)==null?void 0:G.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((X=s==null?void 0:s.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:m,messageId:R,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){W.error("failed to connect to store");return}z(J.url),N({did:(K=r==null?void 0:r.meta)==null?void 0:K.did,projectId:"",messageId:R})}catch(J){const se=Ie(J);W.error(se),c(!1)}})},y=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,C=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,j=s!=null&&s.blockletLogo?`${y}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,P=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(R=>`${C}/${R}`),E=()=>o?!1:!e||e===H.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=R=>{if(!R.destination)return;const q=Array.from(s.blockletScreenshots),[z]=q.splice(R.source.index,1);q.splice(R.destination.index,0,z),l(G=>({...G,blockletScreenshots:q}))},O=R=>{if(!R.destination)return;const q=Array.from(s.blockletVideos),[z]=q.splice(R.source.index,1);q.splice(R.destination.index,0,z),l(G=>({...G,blockletVideos:q}))};return t.jsxs(ki,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:s.blockletTitle||"",onChange:R=>{a({blockletTitle:""}),l({blockletTitle:R.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),t.jsx(Z,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===H.UNOWNED_DID&&t.jsx(Be,{position:"end",children:t.jsx(Zt,{blocklet:r,store:I,componentDid:m,onChangeStore:L,disabled:!s.blockletTitle||o||n,loading:n,onClick:U})})},error:!!i.projectId,helperText:i.projectId||"",value:e===H.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletDescription||"",onChange:R=>{a({blockletDescription:""}),l({blockletDescription:R.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletHomepage||"",onChange:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),l({blockletHomepage:R.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletCommunity||"",onChange:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),l({blockletCommunity:R.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletSupport||"",onChange:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(R.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),l({blockletSupport:R.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletRepository||"",onChange:R=>{R.target.value&&!/^(git|https|svn)/.test(R.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),l({blockletRepository:R.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(ye,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Wo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||j,onClick:()=>{var R;E()&&((R=x.current)==null||R.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(ye,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:F,children:t.jsx(jo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:R.innerRef,...R.droppableProps,children:[P.map((z,G)=>t.jsx(ko,{draggableId:z,index:G,isDragDisabled:o,children:(X,K)=>t.jsxs(u,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:K.isDragging?"scale(1.05)":"none",boxShadow:K.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:z}),!o&&t.jsx(ne,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletScreenshots];return se.splice(G,1),{...J,blockletScreenshots:se}})},children:t.jsx(yo,{})})]})},z)),R.placeholder,P.length<5&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var z;E()&&((z=b.current)==null||z.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(ye,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:O,children:t.jsx(jo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:R.innerRef,...R.droppableProps,children:[s.blockletVideos.map((z,G)=>t.jsx(ko,{draggableId:z,index:G,isDragDisabled:o,children:(X,K)=>t.jsxs(u,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:K.isDragging?"scale(1.05)":"none",boxShadow:K.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ut,{url:z,style:{pointerEvents:K.isDragging?"none":"auto"}}),!o&&t.jsx(ne,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletVideos];return se.splice(G,1),{...J,blockletVideos:se}})},children:t.jsx(yo,{})})]})},z)),R.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{E()&&k(!0)},children:"+"})]})})})]})]})}),t.jsxs(S.Suspense,{fallback:t.jsx(Ve,{}),children:[t.jsx(Eo,{ref:x,locale:v,popup:!0,onUploadFinish:R=>{var q;l({blockletLogo:R.data.filename}),g(""),(q=x.current)==null||q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:y,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),D&&t.jsx(Ln,{onClose:()=>k(!1),params:s,setParams:l}),t.jsx(Eo,{ref:b,popup:!0,onUploadFinish:R=>{var q;l(z=>{var X;const G=z.blockletScreenshots||[];return G.push((X=R.data)==null?void 0:X.filename),{...z,blockletScreenshots:G}}),(q=b.current)==null||q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:C,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-P.length}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}qn.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const ki=de.div`
|
|
132
|
+
`;var Yt={},cr=be;Object.defineProperty(Yt,"__esModule",{value:!0});var kt=Yt.default=void 0,ar=cr(ge()),dr=t;kt=Yt.default=(0,ar.default)((0,dr.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const Co="lastWantToConnectStoreId";function ur(e){var a,c;const[o,n]=S.useState(null),{session:r}=ct(),s=S.useCallback(f=>{n(f),localStorage.setItem(Co,f==null?void 0:f.id)},[n]),l=S.useMemo(()=>{var m,p,v,w;const f=localStorage.getItem(Co),h=f?(((m=e==null?void 0:e.settings)==null?void 0:m.storeList)||[]).find(T=>T.id===f):null;if(h)return h;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(T=>{var x;return!(T.id!==H.BLOCKLET_STORE.id||T.scope&&T.scope!=="studio"&&T.scope!==((x=r==null?void 0:r.user)==null?void 0:x.did))});return g||(g=(w=(v=e==null?void 0:e.settings)==null?void 0:v.storeList)==null?void 0:w[0]),g},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||l||{},s]}const bt={};async function fn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){bt[s]&&clearTimeout(bt[s]),await new Promise(a=>setTimeout(a,r));const l=Date.now(),i=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-l>n?c(f):s?bt[s]=setTimeout(()=>i(a,c),o):setTimeout(()=>i(a,c),o)}};return new Promise(i)}function pr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function fr(e,{did:o,projectId:n,messageId:r}){return fn(async()=>{var l;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((l=s==null?void 0:s.project)!=null&&l.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function hr(e,{did:o,projectId:n,storeId:r}){return fn(async()=>{var i,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(i=s==null?void 0:s.project)==null?void 0:i.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const hn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var i,a;const s=e?(i=n==null?void 0:n.meta)==null?void 0:i.did:o==null?void 0:o.did;let l=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(l)||(l=[]),l=l.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:l}};function Zt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:l,componentDid:i}){var j,P,E;const{t:a}=Q(),{session:c}=ct(),{api:f,info:h,inService:g}=xe(),m=Te(),[p,v]=S.useState(!1),w=S.useRef(null),[T,x]=S.useState(!1),[b,I]=S.useState(null),L=F=>{n(F),v(!1)},D=()=>{v(!p)},k=F=>{w.current&&w.current.contains(F.target)||v(!1)},_=()=>{x(!0)},N=()=>{x(!1)},U=async()=>{var F;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((F=m==null?void 0:m.actions)==null?void 0:F.refreshBlocklet())}catch(O){W.error(`Remove Blocklet Store Error: ${Ie(O)}`)}finally{I(null)}},{storeList:y}=hn({fromBlocklet:g,blocklet:e,nodeInfo:h,componentDid:i,userDid:(j=c==null?void 0:c.user)==null?void 0:j.did}),C=(P=e==null?void 0:e.meta)==null?void 0:P.did;return t.jsxs(t.Fragment,{children:[t.jsxs(jt,{disabled:s,ref:w,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Y,{onClick:r,children:[l&&t.jsx(et,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(Y,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:D,children:t.jsx(qs,{})})]}),t.jsx(Ho,{sx:{zIndex:10},open:p,anchorEl:w.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:F})=>t.jsx(Go,{...F,style:{transformOrigin:"center top"},children:t.jsx(Tt,{children:t.jsx(Xo,{onClickAway:k,children:t.jsxs(Jo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[y==null?void 0:y.map(O=>{var R;return t.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>L(O),children:[t.jsxs(u,{children:[t.jsx(he,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),t.jsx(he,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Rs({store:O,userDid:(R=c==null?void 0:c.user)==null?void 0:R.did})&&t.jsx(ne,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),I(O)},children:t.jsx(re,{icon:"ic:outline-delete"})})]},O.url)}),t.jsx(Jn,{}),t.jsxs(fe,{onClick:_,children:[t.jsx(qt,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),T&&t.jsx(rn,{hiddenChildren:!0,open:!0,onClose:N,teamDid:C,storeList:y,scope:"studio",onAdd:(E=m==null?void 0:m.actions)==null?void 0:E.refreshBlocklet}),b&&t.jsx($t,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:U,onCancel:()=>I(null)})]})}Zt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Zt.defaultProps={store:null,blocklet:null};var me=S;const Ae=/^[a-z0-9]+(-[a-z0-9]+)*$/,at=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Ze(f)?null:f}const l=s[0],i=l.split("-");if(i.length>1){const a={provider:r,prefix:i.shift(),name:i.join("-")};return o&&!Ze(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:l};return o&&!Ze(a,n)?null:a}return null},Ze=(e,o)=>e?!!((e.provider===""||e.provider.match(Ae))&&(o&&e.prefix===""||e.prefix.match(Ae))&&e.name.match(Ae)):!1,mn=Object.freeze({left:0,top:0,width:16,height:16}),st=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Kt=Object.freeze({...mn,...st}),yt=Object.freeze({...Kt,body:"",hidden:!1});function mr(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function So(e,o){const n=mr(e,o);for(const r in yt)r in st?r in e&&!(r in n)&&(n[r]=st[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function br(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function l(i){if(n[i])return s[i]=[];if(!(i in s)){s[i]=null;const a=r[i]&&r[i].parent,c=a&&l(a);c&&(s[i]=[a].concat(c))}return s[i]}return Object.keys(n).concat(Object.keys(r)).forEach(l),s}function xr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let l={};function i(a){l=So(r[a]||s[a],l)}return i(o),n.forEach(i),So(e,l)}function bn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=br(e);for(const s in r){const l=r[s];l&&(o(s,xr(e,s,l)),n.push(s))}return n}const gr={provider:"",aliases:{},not_found:{},...mn};function xt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function xn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!xt(e,gr))return null;const n=o.icons;for(const s in n){const l=n[s];if(!s.match(Ae)||typeof l.body!="string"||!xt(l,yt))return null}const r=o.aliases||Object.create(null);for(const s in r){const l=r[s],i=l.parent;if(!s.match(Ae)||typeof i!="string"||!n[i]&&!r[i]||!xt(l,yt))return null}return o}const Ro=Object.create(null);function jr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function we(e,o){const n=Ro[e]||(Ro[e]=Object.create(null));return n[o]||(n[o]=jr(e,o))}function eo(e,o){return xn(o)?bn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function kr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Me=!1;function gn(e){return typeof e=="boolean"&&(Me=e),Me}function yr(e){const o=typeof e=="string"?at(e,!0,Me):e;if(o){const n=we(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function vr(e,o){const n=at(e,!0,Me);if(!n)return!1;const r=we(n.provider,n.prefix);return kr(r,n.name,o)}function wr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Me&&!o&&!e.prefix){let s=!1;return xn(e)&&(e.prefix="",bn(e,(l,i)=>{i&&vr(l,i)&&(s=!0)})),s}const n=e.prefix;if(!Ze({provider:o,prefix:n,name:"a"}))return!1;const r=we(o,n);return!!eo(r,e)}const jn=Object.freeze({width:null,height:null}),kn=Object.freeze({...jn,...st}),Cr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Sr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Io(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Cr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=Sr.test(l);for(;;){if(i){const a=parseFloat(l);isNaN(a)?s.push(l):s.push(Math.ceil(a*o*n)/n)}else s.push(l);if(l=r.shift(),l===void 0)return s.join("");i=!i}}const Rr=e=>e==="unset"||e==="undefined"||e==="none";function Ir(e,o){const n={...Kt,...e},r={...kn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let l=n.body;[n,r].forEach(v=>{const w=[],T=v.hFlip,x=v.vFlip;let b=v.rotate;T?x?b+=2:(w.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),w.push("scale(-1 1)"),s.top=s.left=0):x&&(w.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),w.push("scale(1 -1)"),s.top=s.left=0);let I;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:I=s.height/2+s.top,w.unshift("rotate(90 "+I.toString()+" "+I.toString()+")");break;case 2:w.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:I=s.width/2+s.left,w.unshift("rotate(-90 "+I.toString()+" "+I.toString()+")");break}b%2===1&&(s.left!==s.top&&(I=s.left,s.left=s.top,s.top=I),s.width!==s.height&&(I=s.width,s.width=s.height,s.height=I)),w.length&&(l='<g transform="'+w.join(" ")+'">'+l+"</g>")});const i=r.width,a=r.height,c=s.width,f=s.height;let h,g;i===null?(g=a===null?"1em":a==="auto"?f:a,h=Io(g,c/f)):(h=i==="auto"?c:i,g=a===null?Io(h,f/c):a==="auto"?f:a);const m={},p=(v,w)=>{Rr(w)||(m[v]=w.toString())};return p("width",h),p("height",g),m.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:m,body:l}}const Dr=/\sid="(\S+)"/g,Tr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let _r=0;function Pr(e,o=Tr){const n=[];let r;for(;r=Dr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(l=>{const i=typeof o=="function"?o(l):o+(_r++).toString(),a=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+i+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const vt=Object.create(null);function Lr(e,o){vt[e]=o}function wt(e){return vt[e]||vt[""]}function to(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const oo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Ke=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Ke.push(Ne.shift()):Ke.push(Ne.pop());oo[""]=to({resources:["https://api.iconify.design"].concat(Ke)});function qr(e,o){const n=to(o);return n===null?!1:(oo[e]=n,!0)}function no(e){return oo[e]}const $r=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Do=$r();function Nr(e,o){const n=no(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(i=>{s=Math.max(s,i.length)});const l=o+".json?icons=";r=n.maxURL-s-n.path.length-l.length}return r}function Ar(e){return e===404}const Er=(e,o,n)=>{const r=[],s=Nr(e,o),l="icons";let i={type:l,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(i),i={type:l,provider:e,prefix:o,icons:[]},a=c.length),i.icons.push(c)}),r.push(i),r};function Mr(e){if(typeof e=="string"){const o=no(e);if(o)return o.path}return"/"}const Or=(e,o,n)=>{if(!Do){n("abort",424);return}let r=Mr(o.provider);switch(o.type){case"icons":{const l=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=l+".json?"+c.toString();break}case"custom":{const l=o.uri;r+=l.slice(0,1)==="/"?l.slice(1):l;break}default:n("abort",400);return}let s=503;Do(e+r).then(l=>{const i=l.status;if(i!==200){setTimeout(()=>{n(Ar(i)?"abort":"next",i)});return}return s=501,l.json()}).then(l=>{if(typeof l!="object"||l===null){setTimeout(()=>{l===404?n("abort",l):n("next",s)});return}setTimeout(()=>{n("success",l)})}).catch(()=>{n("next",s)})},zr={prepare:Er,send:Or};function Br(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,l)=>s.provider!==l.provider?s.provider.localeCompare(l.provider):s.prefix!==l.prefix?s.prefix.localeCompare(l.prefix):s.name.localeCompare(l.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const l=s.provider,i=s.prefix,a=s.name,c=n[l]||(n[l]=Object.create(null)),f=c[i]||(c[i]=we(l,i));let h;a in f.icons?h=o.loaded:i===""||f.missing.has(a)?h=o.missing:h=o.pending;const g={provider:l,prefix:i,name:a};h.push(g)}),o}function yn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Vr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(l=>{const i=l.icons,a=i.pending.length;i.pending=i.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])i.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))i.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),i.pending.length!==a&&(n||yn([e],l.id),l.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),l.abort))})}))}let Wr=0;function Ur(e,o,n){const r=Wr++,s=yn.bind(null,n,r);if(!o.pending.length)return s;const l={id:r,icons:o,callback:e,abort:s};return n.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(l)}),s}function Fr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const l=typeof s=="string"?at(s,o,n):s;l&&r.push(l)}),r}var Hr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Gr(e,o,n,r){const s=e.resources.length,l=e.random?Math.floor(Math.random()*s):e.index;let i;if(e.random){let k=e.resources.slice(0);for(i=[];k.length>1;){const _=Math.floor(Math.random()*k.length);i.push(k[_]),k=k.slice(0,_).concat(k.slice(_+1))}i=i.concat(k)}else i=e.resources.slice(l).concat(e.resources.slice(0,l));const a=Date.now();let c="pending",f=0,h,g=null,m=[],p=[];typeof r=="function"&&p.push(r);function v(){g&&(clearTimeout(g),g=null)}function w(){c==="pending"&&(c="aborted"),v(),m.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),m=[]}function T(k,_){_&&(p=[]),typeof k=="function"&&p.push(k)}function x(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:m.length,subscribe:T,abort:w}}function b(){c="failed",p.forEach(k=>{k(void 0,h)})}function I(){m.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),m=[]}function L(k,_,N){const U=_!=="success";switch(m=m.filter(y=>y!==k),c){case"pending":break;case"failed":if(U||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){h=N,b();return}if(U){h=N,m.length||(i.length?D():b());return}if(v(),I(),!e.random){const y=e.resources.indexOf(k.resource);y!==-1&&y!==e.index&&(e.index=y)}c="completed",p.forEach(y=>{y(N)})}function D(){if(c!=="pending")return;v();const k=i.shift();if(k===void 0){if(m.length){g=setTimeout(()=>{v(),c==="pending"&&(I(),b())},e.timeout);return}b();return}const _={status:"pending",resource:k,callback:(N,U)=>{L(_,N,U)}};m.push(_),f++,g=setTimeout(D,e.rotate),n(k,o,_.callback)}return setTimeout(D),x}function vn(e){const o={...Hr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Gr(o,a,c,(g,m)=>{r(),f&&f(g,m)});return n.push(h),h}function l(a){return n.find(c=>a(c))||null}return{query:s,find:l,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function To(){}const gt=Object.create(null);function Xr(e){if(!gt[e]){const o=no(e);if(!o)return;const n=vn(o),r={config:o,redundancy:n};gt[e]=r}return gt[e]}function Jr(e,o,n){let r,s;if(typeof e=="string"){const l=wt(e);if(!l)return n(void 0,424),To;s=l.send;const i=Xr(e);i&&(r=i.redundancy)}else{const l=to(e);if(l){r=vn(l);const i=e.resources?e.resources[0]:"",a=wt(i);a&&(s=a.send)}}return!r||!s?(n(void 0,424),To):r.query(o,s,n)().abort}const _o="iconify2",Oe="iconify",wn=Oe+"-count",Po=Oe+"-version",Cn=36e5,Qr=168;function Ct(e,o){try{return e.getItem(o)}catch{}}function so(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Lo(e,o){try{e.removeItem(o)}catch{}}function St(e,o){return so(e,wn,o.toString())}function Rt(e){return parseInt(Ct(e,wn))||0}const dt={local:!0,session:!0},Sn={local:new Set,session:new Set};let ro=!1;function Yr(e){ro=e}let He=typeof window>"u"?{}:window;function Rn(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}dt[e]=!1}function In(e,o){const n=Rn(e);if(!n)return;const r=Ct(n,Po);if(r!==_o){if(r){const a=Rt(n);for(let c=0;c<a;c++)Lo(n,Oe+c.toString())}so(n,Po,_o),St(n,0);return}const s=Math.floor(Date.now()/Cn)-Qr,l=a=>{const c=Oe+a.toString(),f=Ct(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Lo(n,c)}};let i=Rt(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,St(n,i)):Sn[e].add(a))}function Dn(){if(!ro){Yr(!0);for(const e in dt)In(e,o=>{const n=o.data,r=o.provider,s=n.prefix,l=we(r,s);if(!eo(l,n).length)return!1;const i=n.lastModified||-1;return l.lastModifiedCached=l.lastModifiedCached?Math.min(l.lastModifiedCached,i):i,!0})}}function Zr(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in dt)In(r,s=>{const l=s.data;return s.provider!==e.provider||l.prefix!==e.prefix||l.lastModified===o});return!0}function Kr(e,o){ro||Dn();function n(r){let s;if(!dt[r]||!(s=Rn(r)))return;const l=Sn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=Rt(s),!St(s,i+1))return;const a={cached:Math.floor(Date.now()/Cn),provider:e.provider,data:o};return so(s,Oe+i.toString(),JSON.stringify(a))}o.lastModified&&!Zr(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function qo(){}function ei(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Vr(e)}))}function ti(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let l;if(!s||!(l=wt(n)))return;l.prepare(n,r,s).forEach(a=>{Jr(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=eo(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(g=>{h.delete(g)}),Kr(e,c)}catch(f){console.error(f)}ei(e)})})}))}const oi=(e,o)=>{const n=Fr(e,!0,gn()),r=Br(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,qo)}),()=>{c=!1}}const s=Object.create(null),l=[];let i,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===i)return;i=f,a=h,l.push(we(f,h));const g=s[f]||(s[f]=Object.create(null));g[h]||(g[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:g}=c,m=we(f,h),p=m.pendingIcons||(m.pendingIcons=new Set);p.has(g)||(p.add(g),s[f][h].push(g))}),l.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ti(c,s[f][h])}),o?Ur(o,r,l):qo};function ni(e,o){const n={...e};for(const r in o){const s=o[r],l=typeof s;r in jn?(s===null||s&&(l==="string"||l==="number"))&&(n[r]=s):l===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const si=/[\s,]+/;function ri(e,o){o.split(si).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ii(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let l=parseFloat(e.slice(0,e.length-n.length));return isNaN(l)?0:(l=l/s,l%1===0?r(l):0)}}return o}function li(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function ci(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ai(e){return"data:image/svg+xml,"+ci(e)}function di(e){return'url("'+ai(e)+'")'}let Ee;function ui(){try{Ee=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ee=null}}function pi(e){return Ee===void 0&&ui(),Ee?Ee.createHTML(e):e}const Tn={...kn,inline:!1},fi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},hi={display:"inline-block"},It={backgroundColor:"currentColor"},_n={backgroundColor:"transparent"},$o={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},No={WebkitMask:It,mask:It,background:_n};for(const e in No){const o=No[e];for(const n in $o)o[e+n]=$o[n]}const mi={...Tn,inline:!0};function Ao(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const bi=(e,o,n,r)=>{const s=n?mi:Tn,l=ni(s,o),i=o.mode||"svg",a={},c=o.style||{},f={...i==="svg"?fi:{},ref:r};for(let x in o){const b=o[x];if(b!==void 0)switch(x){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":l[x]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&ri(l,b);break;case"color":a.color=b;break;case"rotate":typeof b=="string"?l[x]=ii(b):typeof b=="number"&&(l[x]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[x]===void 0&&(f[x]=b)}}const h=Ir(e,l),g=h.attributes;if(l.inline&&(a.verticalAlign="-0.125em"),i==="svg"){f.style={...a,...c},Object.assign(f,g);let x=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:pi(Pr(h.body,b?()=>b+"ID"+x++:"iconifyReact"))},me.createElement("svg",f)}const{body:m,width:p,height:v}=e,w=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),T=li(m,{...g,width:p+"",height:v+""});return f.style={...a,"--svg":di(T),width:Ao(g.width),height:Ao(g.height),...hi,...w?It:_n,...c},me.createElement("span",f)};gn(!0);Lr("",zr);if(typeof document<"u"&&typeof window<"u"){Dn();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!wr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;qr(n,s)||console.error(r)}catch{console.error(r)}}}}class Pn extends me.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=at(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const l=yr(s);if(!l){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),l!==null&&(this._loading={name:r,abort:oi([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const i=["iconify"];s.prefix!==""&&i.push("iconify--"+s.prefix),s.provider!==""&&i.push("iconify--"+s.provider),this._setData({data:l,classes:i}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:me.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),bi({...Kt,...n.data},r,o._inline,o._ref)}}const xi=me.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return me.createElement(Pn,r)});me.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return me.createElement(Pn,r)});var gi=xi;const ji=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ut({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Q(),l=e.includes("youtube.com")||e.includes("youtu.be"),i=e.includes("vimeo.com");if(l){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[t.jsx(gi,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(A,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ut.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ut.defaultProps={style:{},controls:1,modestbranding:1};function Ln({setParams:e,onClose:o,params:n}){const{t:r}=Q(),[s,l]=S.useState(""),i=s&&n.blockletVideos.includes(s),a=ji(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(_t,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Qo,{children:r("studio.videoDialogTitle")}),t.jsxs(Yo,{children:[t.jsx(Qn,{fullWidth:!0,value:s,onChange:f=>l(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Be,{position:"end",children:t.jsx(ne,{onClick:()=>l(""),children:t.jsx(ms,{})})}):null,error:i}),i&&t.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ut,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Zo,{children:[t.jsx(Y,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Y,{disabled:!a||i,onClick:c,children:r("studio.confirm")})]})]})}Ln.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Eo=S.lazy(()=>tn(()=>import("./index-_suzTPHn.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function qn({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:l,paramsErrTip:i,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:g,componentDid:m}){const{t:p,locale:v}=Q(),{api:w}=xe(),T=Dt(),x=S.useRef(null),b=S.useRef(null),[I,L]=ur(r),[D,k]=S.useState(!1),_=Is({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),N=async R=>{const q=setTimeout(()=>{c(!1)},2e4),z=await fr(w,R);c(!1),clearTimeout(q),window.parent.postMessage({event:"studioDialog.connected",componentDid:m},"*"),T(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${z}/create`),{replace:!0})},U=()=>{if(!s.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const R=pr();_(async(q,z)=>{var G,X,K;try{const J=await w.connectByStudio({input:{did:(G=r==null?void 0:r.meta)==null?void 0:G.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((X=s==null?void 0:s.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:m,messageId:R,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){W.error("failed to connect to store");return}z(J.url),N({did:(K=r==null?void 0:r.meta)==null?void 0:K.did,projectId:"",messageId:R})}catch(J){const se=Ie(J);W.error(se),c(!1)}})},y=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,C=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,j=s!=null&&s.blockletLogo?`${y}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,P=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(R=>`${C}/${R}`),E=()=>o?!1:!e||e===H.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,F=R=>{if(!R.destination)return;const q=Array.from(s.blockletScreenshots),[z]=q.splice(R.source.index,1);q.splice(R.destination.index,0,z),l(G=>({...G,blockletScreenshots:q}))},O=R=>{if(!R.destination)return;const q=Array.from(s.blockletVideos),[z]=q.splice(R.source.index,1);q.splice(R.destination.index,0,z),l(G=>({...G,blockletVideos:q}))};return t.jsxs(ki,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:s.blockletTitle||"",onChange:R=>{a({blockletTitle:""}),l({blockletTitle:R.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),t.jsx(Z,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===H.UNOWNED_DID&&t.jsx(Be,{position:"end",children:t.jsx(Zt,{blocklet:r,store:I,componentDid:m,onChangeStore:L,disabled:!s.blockletTitle||o||n,loading:n,onClick:U})})},error:!!i.projectId,helperText:i.projectId||"",value:e===H.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletDescription||"",onChange:R=>{a({blockletDescription:""}),l({blockletDescription:R.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletHomepage||"",onChange:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),l({blockletHomepage:R.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletCommunity||"",onChange:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),l({blockletCommunity:R.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletSupport||"",onChange:R=>{R.target.value&&!/^(http|https):\/\//.test(R.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(R.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),l({blockletSupport:R.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3}}),t.jsx(Z,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletRepository||"",onChange:R=>{R.target.value&&!/^(git|https|svn)/.test(R.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),l({blockletRepository:R.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(ye,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Wo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||j,onClick:()=>{var R;E()&&((R=x.current)==null||R.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(ye,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:F,children:t.jsx(jo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:R.innerRef,...R.droppableProps,children:[P.map((z,G)=>t.jsx(ko,{draggableId:z,index:G,isDragDisabled:o,children:(X,K)=>t.jsxs(u,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:K.isDragging?"scale(1.05)":"none",boxShadow:K.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:z}),!o&&t.jsx(ne,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletScreenshots];return se.splice(G,1),{...J,blockletScreenshots:se}})},children:t.jsx(yo,{})})]})},z)),R.placeholder,P.length<5&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var z;E()&&((z=b.current)==null||z.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ye,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(ye,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:O,children:t.jsx(jo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(R,q)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:q.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:q.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:R.innerRef,...R.droppableProps,children:[s.blockletVideos.map((z,G)=>t.jsx(ko,{draggableId:z,index:G,isDragDisabled:o,children:(X,K)=>t.jsxs(u,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:K.isDragging?"scale(1.05)":"none",boxShadow:K.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ut,{url:z,style:{pointerEvents:K.isDragging?"none":"auto"}}),!o&&t.jsx(ne,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{l(J=>{const se=[...J.blockletVideos];return se.splice(G,1),{...J,blockletVideos:se}})},children:t.jsx(yo,{})})]})},z)),R.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{E()&&k(!0)},children:"+"})]})})})]})]})}),t.jsxs(S.Suspense,{fallback:t.jsx(Ve,{}),children:[t.jsx(Eo,{ref:x,locale:v,popup:!0,onUploadFinish:R=>{var q;l({blockletLogo:R.data.filename}),g(""),(q=x.current)==null||q.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:y,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),D&&t.jsx(Ln,{onClose:()=>k(!1),params:s,setParams:l}),t.jsx(Eo,{ref:b,popup:!0,onUploadFinish:R=>{var q;l(z=>{var X;const G=z.blockletScreenshots||[];return G.push((X=R.data)==null?void 0:X.filename),{...z,blockletScreenshots:G}}),(q=b.current)==null||q.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:C,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-P.length}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}qn.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const ki=de.div`
|
|
133
133
|
margin-top: 24px;
|
|
134
134
|
.screenshot {
|
|
135
135
|
margin-bottom: 16px;
|
|
@@ -177,7 +177,7 @@ import{r as S,k as Dt,l as lt,L as ce,f as Hn,h as Gn,i as pt}from"./vendor-reac
|
|
|
177
177
|
padding-bottom: 12px;
|
|
178
178
|
border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
|
|
179
179
|
}
|
|
180
|
-
`;function On({text:e}){return e?t.jsx(As,{wrapperElement:{"data-color-mode":"light"},source:bs.sanitize(e),rehypePlugins:[[Es,{target:"_blank"}]]}):t.jsx(De,{Icon:Mt})}On.propTypes={text:d.string.isRequired};function zn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var h;const{t:i}=Q(),[a,c]=S.useState(l?"preview":"write"),f=(g,m)=>{c(m)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(A,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),t.jsxs(Ko,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(tt,{value:"write",label:"Write"}),t.jsx(tt,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Z,{disabled:r||l,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:l,endAdornment:t.jsxs(Be,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",ie.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{s({blockletIntroduction:""}),o({blockletIntroduction:g.target.value.slice(0,ie.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(On,{text:e.blockletIntroduction||""})})]})}zn.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var co={},_i=be;Object.defineProperty(co,"__esModule",{value:!0});var Bn=co.default=void 0,Pi=_i(ge()),Oo=t;Bn=co.default=(0,Pi.default)([(0,Oo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Oo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function ao({step:e,ok:o,active:n,error:r}){let s="grey.500",l=e+1;return o&&(l=t.jsx(Ms,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",l=t.jsx(Bn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}ao.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};ao.defaultProps={step:0,ok:!1,active:0,error:""};function Vn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:f}=Q(),h=()=>{n(v=>v+1)},g=()=>{n(v=>v-1)},m=v=>v===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription)||(i==null?void 0:i.blockletHomepage)||(i==null?void 0:i.blockletSupport)||(i==null?void 0:i.blockletCommunity)||(i==null?void 0:i.blockletRepository):v===2?(i==null?void 0:i.blockletResource)||(i==null?void 0:i.blockletDocker)||(i==null?void 0:i.dockerImageName):v>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||Nn({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(ts,{activeStep:o,orientation:"vertical",children:e.map((v,w)=>{const T={},x=l||!Di({hasSelectedResources:r,params:s,projectId:c,step:w,t:f}),b=l?"":m(w);return b&&(T.optional=t.jsx(A,{variant:"caption",color:"error",children:b}),T.error=!0),t.jsxs(os,{children:[t.jsx(ns,{icon:t.jsx(ao,{error:b,active:p?99:o,step:w,ok:x}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...T,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:b||!x&&o>w?"error.main":"inherit",children:v.label})}),t.jsxs(ss,{children:[t.jsx(A,{fontSize:12,children:v.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[w<e.length-1&&t.jsx(Y,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:b||!x,children:f("common.continue")}),w>0&&t.jsx(Y,{disabled:w===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},v.label)})}),o>=e.length-1&&t.jsx(Tt,{square:!0,elevation:0,sx:{p:3},children:t.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Vn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const Li=[".zip",".gz"],qi=1024*1024*100,$i=S.lazy(()=>tn(()=>import("./index-DF1jJ-bb.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function uo({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a,locale:c}=Q(),f=S.useRef(null),h=()=>n?!1:!o||o===H.UNOWNED_DID?(W.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,g=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(A,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(ye,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(A,{component:"a",href:`${g}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Y,{variant:"outlined",size:"small",onClick:()=>{var m;h()&&((m=f.current)==null||m.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(S.Suspense,{fallback:t.jsx(Ve,{}),children:t.jsx($i,{ref:f,locale:c,popup:!0,onUploadFinish:m=>{var p;s({uploadedResource:m.data.filename}),l({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Li,maxFileSize:qi,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:i})]})}uo.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};uo.defaultProps={};function rt({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:l}){var a;const{t:i}=Q();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Z,{required:!0,disabled:l||e,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(Z,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:l||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Be,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",ie.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,ie.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}rt.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};rt.defaultProps={};function Wn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Wn(e[o]);return e}function it({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:l,readOnly:i}){const a=(o==null?void 0:o.value)||"",[c,f]=S.useState(!1),h=()=>{var y;(y=n[s])==null||y.splice(e,1),r({...n,[s]:[...n[s]]})},g=(y,C)=>{var j;(j=n[s])!=null&&j[e]&&(C?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${ht(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},m=(y,C)=>{var P;const j=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],secure:C,value:C&&j===ie.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[s]:[...n[s]]})},p=(y,C)=>{n[s][e]={...n[s][e],shared:C},r({...n,[s]:[...n[s]]})},v=(y,C)=>{var P;const j=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],required:C,value:C&&j===ie.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[s]:[...n[s]]})},w=(y,C)=>{n[s][e]={...n[s][e],value:C?ie.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},T=y=>{n[s][e]={...n[s][e],description:y.target.value},r({...n,[s]:[...n[s]]})},x=y=>{const C=y.target.value==="web"?"web":"docker";C==="web"&&n.dockerArgs.forEach(E=>{E.type="docker"});const P=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:C,path:C==="docker"?P:"/",protocol:"http",prefix:C==="docker"?P:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},b=y=>{const C=y.target.value;n[s][e]={...n[s][e],prefix:C,path:C==="*"?"/":C},r({...n,[s]:[...n[s]]})},I=y=>{var C;(C=n[s])!=null&&C[e]&&(n[s][e].value=y.target.value),r({...n,[s]:[...n[s]]})},L=a===`$${ht(o.key)}`||o.custom,D=s==="dockerArgs"&&!ln[o.key],k=_s[o.key],_=s==="dockerEnvs",N=o.key==="--publish";let U=o.key;return N&&o.type==="web"?U="--publish (Web)":_&&(U=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:U})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Z,{disabled:i||L||D||o.value===ie.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${ht(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Be,{position:"end",sx:{zoom:.9},children:[(!(k||D)||_||N)&&t.jsx(ne,{onClick:()=>f(!0),children:t.jsx(re,{icon:"icon-park-outline:setting-config"})}),!i&&t.jsx(ne,{onClick:h,color:D?"error":"default",children:t.jsx(re,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ps[o.key](a)&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Lt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:l(_?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[k||D||_?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.needCustomInput")}),t.jsx(ve,{disabled:i,checked:L,onChange:g,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.shared")}),t.jsx(ve,{disabled:i,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.required")}),t.jsx(ve,{disabled:i,checked:o.required,onChange:v,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.secure")}),t.jsx(ve,{disabled:i,checked:o.secure,onChange:m,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.autoGenerated")}),t.jsx(ve,{disabled:i,checked:o.value===ie.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:w,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.description")}),t.jsx(Z,{disabled:i,value:o.description,onChange:T,sx:{flex:1},label:l("blocklet.publish.docker.description")})]}),N&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.portType")}),t.jsxs(en,{value:o.type||"docker",onChange:x,children:[t.jsx(fe,{value:"docker",children:"Docker"}),t.jsx(fe,{value:"web",children:"Web"})]})]}),N&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.prefix")}),t.jsx(Z,{disabled:i,value:o.prefix,onChange:b,sx:{flex:1},label:l("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};it.defaultProps={};const Ni=`
|
|
180
|
+
`;function On({text:e}){return e?t.jsx(As,{wrapperElement:{"data-color-mode":"light"},source:bs.sanitize(e),rehypePlugins:[[Es,{target:"_blank"}]]}):t.jsx(De,{Icon:Mt})}On.propTypes={text:d.string.isRequired};function zn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var h;const{t:i}=Q(),[a,c]=S.useState(l?"preview":"write"),f=(g,m)=>{c(m)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(A,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),t.jsxs(Ko,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(tt,{value:"write",label:"Write"}),t.jsx(tt,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Z,{disabled:r||l,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:l,endAdornment:t.jsxs(Be,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",ie.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{s({blockletIntroduction:""}),o({blockletIntroduction:g.target.value.slice(0,ie.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(On,{text:e.blockletIntroduction||""})})]})}zn.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var co={},_i=be;Object.defineProperty(co,"__esModule",{value:!0});var Bn=co.default=void 0,Pi=_i(ge()),Oo=t;Bn=co.default=(0,Pi.default)([(0,Oo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Oo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function ao({step:e,ok:o,active:n,error:r}){let s="grey.500",l=e+1;return o&&(l=t.jsx(Ms,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",l=t.jsx(Bn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}ao.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};ao.defaultProps={step:0,ok:!1,active:0,error:""};function Vn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:f}=Q(),h=()=>{n(v=>v+1)},g=()=>{n(v=>v-1)},m=v=>v===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription)||(i==null?void 0:i.blockletHomepage)||(i==null?void 0:i.blockletSupport)||(i==null?void 0:i.blockletCommunity)||(i==null?void 0:i.blockletRepository):v===2?(i==null?void 0:i.blockletResource)||(i==null?void 0:i.blockletDocker)||(i==null?void 0:i.dockerImageName):v>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||Nn({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(ts,{activeStep:o,orientation:"vertical",children:e.map((v,w)=>{const T={},x=l||!Di({hasSelectedResources:r,params:s,projectId:c,step:w,t:f}),b=l?"":m(w);return b&&(T.optional=t.jsx(A,{variant:"caption",color:"error",children:b}),T.error=!0),t.jsxs(os,{children:[t.jsx(ns,{icon:t.jsx(ao,{error:b,active:p?99:o,step:w,ok:x}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...T,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:b||!x&&o>w?"error.main":"inherit",children:v.label})}),t.jsxs(ss,{children:[t.jsx(A,{fontSize:12,children:v.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[w<e.length-1&&t.jsx(Y,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:b||!x,children:f("common.continue")}),w>0&&t.jsx(Y,{disabled:w===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},v.label)})}),o>=e.length-1&&t.jsx(Tt,{square:!0,elevation:0,sx:{p:3},children:t.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Vn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const Li=[".zip",".gz"],qi=1024*1024*100,$i=S.lazy(()=>tn(()=>import("./index-_suzTPHn.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function uo({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a,locale:c}=Q(),f=S.useRef(null),h=()=>n?!1:!o||o===H.UNOWNED_DID?(W.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,g=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(A,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(ye,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(A,{component:"a",href:`${g}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Y,{variant:"outlined",size:"small",onClick:()=>{var m;h()&&((m=f.current)==null||m.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(S.Suspense,{fallback:t.jsx(Ve,{}),children:t.jsx($i,{ref:f,locale:c,popup:!0,onUploadFinish:m=>{var p;s({uploadedResource:m.data.filename}),l({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Li,maxFileSize:qi,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:i})]})}uo.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};uo.defaultProps={};function rt({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:l}){var a;const{t:i}=Q();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Z,{required:!0,disabled:l||e,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(Z,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:l||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Be,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",ie.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,ie.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}rt.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};rt.defaultProps={};function Wn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Wn(e[o]);return e}function it({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:l,readOnly:i}){const a=(o==null?void 0:o.value)||"",[c,f]=S.useState(!1),h=()=>{var y;(y=n[s])==null||y.splice(e,1),r({...n,[s]:[...n[s]]})},g=(y,C)=>{var j;(j=n[s])!=null&&j[e]&&(C?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${ht(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},m=(y,C)=>{var P;const j=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],secure:C,value:C&&j===ie.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[s]:[...n[s]]})},p=(y,C)=>{n[s][e]={...n[s][e],shared:C},r({...n,[s]:[...n[s]]})},v=(y,C)=>{var P;const j=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],required:C,value:C&&j===ie.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[s]:[...n[s]]})},w=(y,C)=>{n[s][e]={...n[s][e],value:C?ie.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},T=y=>{n[s][e]={...n[s][e],description:y.target.value},r({...n,[s]:[...n[s]]})},x=y=>{const C=y.target.value==="web"?"web":"docker";C==="web"&&n.dockerArgs.forEach(E=>{E.type="docker"});const P=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:C,path:C==="docker"?P:"/",protocol:"http",prefix:C==="docker"?P:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},b=y=>{const C=y.target.value;n[s][e]={...n[s][e],prefix:C,path:C==="*"?"/":C},r({...n,[s]:[...n[s]]})},I=y=>{var C;(C=n[s])!=null&&C[e]&&(n[s][e].value=y.target.value),r({...n,[s]:[...n[s]]})},L=a===`$${ht(o.key)}`||o.custom,D=s==="dockerArgs"&&!ln[o.key],k=_s[o.key],_=s==="dockerEnvs",N=o.key==="--publish";let U=o.key;return N&&o.type==="web"?U="--publish (Web)":_&&(U=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:U})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Z,{disabled:i||L||D||o.value===ie.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${ht(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Be,{position:"end",sx:{zoom:.9},children:[(!(k||D)||_||N)&&t.jsx(ne,{onClick:()=>f(!0),children:t.jsx(re,{icon:"icon-park-outline:setting-config"})}),!i&&t.jsx(ne,{onClick:h,color:D?"error":"default",children:t.jsx(re,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ps[o.key](a)&&t.jsx(A,{variant:"caption",color:"error",children:l("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Lt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:l(_?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[k||D||_?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.needCustomInput")}),t.jsx(ve,{disabled:i,checked:L,onChange:g,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.shared")}),t.jsx(ve,{disabled:i,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.required")}),t.jsx(ve,{disabled:i,checked:o.required,onChange:v,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.secure")}),t.jsx(ve,{disabled:i,checked:o.secure,onChange:m,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:l("blocklet.publish.docker.autoGenerated")}),t.jsx(ve,{disabled:i,checked:o.value===ie.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:w,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.description")}),t.jsx(Z,{disabled:i,value:o.description,onChange:T,sx:{flex:1},label:l("blocklet.publish.docker.description")})]}),N&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.portType")}),t.jsxs(en,{value:o.type||"docker",onChange:x,children:[t.jsx(fe,{value:"docker",children:"Docker"}),t.jsx(fe,{value:"web",children:"Web"})]})]}),N&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:l("blocklet.publish.docker.prefix")}),t.jsx(Z,{disabled:i,value:o.prefix,onChange:b,sx:{flex:1},label:l("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};it.defaultProps={};const Ni=`
|
|
181
181
|
docker run --name postgrest
|
|
182
182
|
-p 3000:3000
|
|
183
183
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|