@abtnode/blocklet-services 1.16.40-beta-20250305-001025-5ee639c9 → 1.16.40-beta-20250305-022942-dea362e4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/api/services/studio/index.js +3 -3
  2. package/dist/assets/{access-control-DGnu8R-_.js → access-control-DPAjPJrm.js} +1 -1
  3. package/dist/assets/{add-component-core-Bbl0KUAk.js → add-component-core-s08ciPf7.js} +1 -1
  4. package/dist/assets/{add-resource-DtMCqT6r.js → add-resource-CVe7ZKgt.js} +1 -1
  5. package/dist/assets/{analytics-BpE1mSK8.js → analytics-BqkTOyTA.js} +1 -1
  6. package/dist/assets/{audit-logs-BniXTgud.js → audit-logs-YnCvzLMF.js} +1 -1
  7. package/dist/assets/{branding-Bo2bC8bs.js → branding-DufH4YY9.js} +2 -2
  8. package/dist/assets/{bundle-avatar-Sre-N_aE.js → bundle-avatar-DS4sS4Ug.js} +1 -1
  9. package/dist/assets/{complete-Bt6vm6Xh.js → complete-BrjCxDOq.js} +1 -1
  10. package/dist/assets/{component-Dc-fRks0.js → component-zxGl4zf8.js} +1 -1
  11. package/dist/assets/{config-Bs1nzYyR.js → config-CVwG5ii_.js} +1 -1
  12. package/dist/assets/{config-navigation-WPDlQ1RJ.js → config-navigation-ChjaLlA9.js} +3 -3
  13. package/dist/assets/{config-space-BwYNAO5S.js → config-space-DHtv33di.js} +1 -1
  14. package/dist/assets/{confirm-D9nnIOvs.js → confirm-Di8Vvymn.js} +1 -1
  15. package/dist/assets/{connect-BDN-wehP.js → connect-CykhV8jX.js} +1 -1
  16. package/dist/assets/{connect-CyW5d5Dv.js → connect-DpYoQ3xM.js} +1 -1
  17. package/dist/assets/{connect-to-Bl1JCiMg.js → connect-to-DGbSWMus.js} +1 -1
  18. package/dist/assets/{dashboard-DyGi-puS.js → dashboard-DdkKjU2L.js} +3 -3
  19. package/dist/assets/{delete-confirm-DZNkTsic.js → delete-confirm-B40CCTo2.js} +1 -1
  20. package/dist/assets/{domain-CoZiXxyK.js → domain-D37Iq-fb.js} +1 -1
  21. package/dist/assets/{domain-action-card-DatWnWEH.js → domain-action-card-B6iFs8uG.js} +1 -1
  22. package/dist/assets/{domains-Cczdqu0Z.js → domains-Bn5zR8JS.js} +1 -1
  23. package/dist/assets/{email-DALnM6tC.js → email-CnCbt9wS.js} +1 -1
  24. package/dist/assets/{exchange-passport-Bf-YSqcM.js → exchange-passport-BM0Ne4St.js} +1 -1
  25. package/dist/assets/{form-text-input-gQXonEjr.js → form-text-input-Bdb4wXRt.js} +1 -1
  26. package/dist/assets/{fuel-DqVOAgbE.js → fuel-B1DzM8DW.js} +1 -1
  27. package/dist/assets/{index-CpfGTKUf.js → index-0m-J-ZAX.js} +2 -2
  28. package/dist/assets/{index-Y6bMeXBB.js → index-8Xn_gix_.js} +1 -1
  29. package/dist/assets/{index-DZeG-UP6.js → index-B7_ziUTF.js} +1 -1
  30. package/dist/assets/{index-BUDaVPaJ.js → index-B9xDkTYZ.js} +4 -4
  31. package/dist/assets/{index-Zz9qzQ_9.js → index-BnIYxbxY.js} +1 -1
  32. package/dist/assets/{index-a-qtpRvq.js → index-CB8LRAXR.js} +3 -3
  33. package/dist/assets/{index-CR8UpawY.js → index-CENj2fOq.js} +1 -1
  34. package/dist/assets/{index-gpG3AUyG.js → index-DaVeYoNQ.js} +1 -1
  35. package/dist/assets/{index-BmW4nkqT.js → index-Deh5N0Ca.js} +1 -1
  36. package/dist/assets/{index-C6PabcPO.js → index-DqR_pNmL.js} +1 -1
  37. package/dist/assets/index-FDeY8Od4.js +138 -0
  38. package/dist/assets/{index-C-jNyGNZ.js → index-Fv88MhEb.js} +1 -1
  39. package/dist/assets/{index-Cszfyf7Q.js → index-Wl7uu5xS.js} +1 -1
  40. package/dist/assets/{index-bZdsGPmc.js → index-mso5VXSP.js} +1 -1
  41. package/dist/assets/{invitation-WgaVpLz-.js → invitation-nR3cIkjy.js} +1 -1
  42. package/dist/assets/{invite-CvRmEUzI.js → invite-D6h2Kml0.js} +1 -1
  43. package/dist/assets/{issue-passport-DvrxTzgL.js → issue-passport-CA5yDYxP.js} +1 -1
  44. package/dist/assets/{item-BmR66mZ6.js → item-Bhfjro40.js} +1 -1
  45. package/dist/assets/{layout-DTwYq-9q.js → layout-ZMeaWGok.js} +1 -1
  46. package/dist/assets/{list-BQIfnrdu.js → list-ChtSD939.js} +1 -1
  47. package/dist/assets/{log-MmG2K3Cy.js → log-MCKmey1M.js} +1 -1
  48. package/dist/assets/{login-D-xY5H2J.js → login-Bq2_5-hJ.js} +1 -1
  49. package/dist/assets/{logo-uploader-COOjI78W.js → logo-uploader-DeZeIw8p.js} +3 -3
  50. package/dist/assets/{lost-passport-XYMkiTwo.js → lost-passport-C9PbOpKs.js} +1 -1
  51. package/dist/assets/{overview-DhXk6dxJ.js → overview-DNIuos67.js} +1 -1
  52. package/dist/assets/{publish-resource-mmACXheB.js → publish-resource-Bu34onY2.js} +1 -1
  53. package/dist/assets/{relative-time-7jETcOaL.js → relative-time-Gzr-RzyU.js} +1 -1
  54. package/dist/assets/{setup-fPLYIoHX.js → setup-DwT-eZo_.js} +3 -3
  55. package/dist/assets/{start-R4emxzL_.js → start-BMPOdLHY.js} +1 -1
  56. package/dist/assets/{status-Cn67FaBl.js → status-DiWFAPO1.js} +1 -1
  57. package/dist/assets/{step-actions-BzTrLOhC.js → step-actions-D1-msdeY.js} +1 -1
  58. package/dist/assets/{traffic-DgHqx0ot.js → traffic-s8iVlNpL.js} +1 -1
  59. package/dist/assets/{transfer-CFTVWUIN.js → transfer-DOtiND1w.js} +1 -1
  60. package/dist/assets/{unsubscribe-ClBSlk0u.js → unsubscribe-DlO-9_z9.js} +1 -1
  61. package/dist/assets/{user-center-DlZwK1g7.js → user-center-BEC_SYzS.js} +1 -1
  62. package/dist/assets/{util-CuX2h5UG.js → util-iyBXvLTc.js} +1 -1
  63. package/dist/assets/{wrap-locale-CkbmGs8Q.js → wrap-locale-BtIDW28I.js} +1 -1
  64. package/dist/index.html +1 -1
  65. package/dist/service-worker.js +1 -1
  66. package/package.json +21 -21
  67. package/dist/assets/index-CsCfuYnX.js +0 -138
@@ -1 +1 @@
1
- import{E as T,j as K,aG as J}from"./vendor-mui-core-Dh3XBxY7.js";import{x as O}from"./vendor-utils-oUOK1Lc7.js";import{z as ee,h as _,T as te,Q as ne,U as se,E as re,V as oe}from"./index-CpfGTKUf.js";import{g as W,r as ae}from"./vendor-react-DoD83n6N.js";import{n as ie}from"./vendor-arcblock-Bv04Mkff.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,aG as J}from"./vendor-mui-core-Dh3XBxY7.js";import{x as O}from"./vendor-utils-oUOK1Lc7.js";import{z as ee,h as _,T as te,Q as ne,U as se,E as re,V as oe}from"./index-0m-J-ZAX.js";import{g as W,r as ae}from"./vendor-react-DoD83n6N.js";import{n as ie}from"./vendor-arcblock-Bv04Mkff.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 b}from"./vendor-react-DoD83n6N.js";import{j as e,E as d,a1 as Pe,R as bt,a4 as jt,T as G,a3 as R,A as Fe,bF as _e,cn as et,cm as Te,aI as Ie,bM as De,x as ye,bh as Ee,a2 as tt,aa as ae,V as nt,aC as Xe,bG as vt,aK as yt,ak as Je,co as St}from"./vendor-mui-core-Dh3XBxY7.js";import{b as Z,at as re,z as Ct}from"./vendor-utils-oUOK1Lc7.js";import{j as V,b as L,ad as Nt,a0 as Be,e as X,bC as wt,D as st,a3 as Ae,aY as at,aF as be,a8 as Rt,ao as Tt,bl as It}from"./vendor-arcblock-Bv04Mkff.js";import{z as Dt,G as $,m as Et,I as Qe}from"./index-CpfGTKUf.js";import{e as pe,a as Oe}from"./vendor-hooks-DlxYXMPL.js";import{S as ue}from"./shorten-label-DXP5M5GB.js";import{I as it}from"./index-DPFaqs63.js";import{S as At,a as Ot}from"./list-BQIfnrdu.js";import{R as ze}from"./relative-time-7jETcOaL.js";import{b as We}from"./dashboard-DyGi-puS.js";import{W as Lt}from"./did-address-nBrtfdFs.js";import{p as ot}from"./util-b7UGzXHn.js";import{D as kt,g as Pt}from"./traffic-DgHqx0ot.js";import{B as rt}from"./bundle-avatar-Sre-N_aE.js";import{B as Ft}from"./index-Y6bMeXBB.js";import"./index-C24CwgC5.js";import"./InfoOutlined-B6WkOk1K.js";import"./useLocalStorage-Cd_KRSFh.js";import"./confirm-D9nnIOvs.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-BtE24rss.js";import"./get-safe-url-DnoVfY5w.js";import"./session-BqpWYLN3.js";import"./useAsyncRetry-ru9OmM2c.js";import"./useAsync-HJBQVHgn.js";import"./useSetState-BL3ktMon.js";import"./base32-BaFZoAVl.js";import"./iframe-BW5fhB2Q.js";import"./LaunchOutlined-DnsoPOkc.js";import"./ChevronLeft-DyVK0SyV.js";import"./ChevronRight-CMCOlQoz.js";import"./index-DmFVT2Y_.js";import"./vendor-mui-x-l1ezRCJc.js";const lt=b.createContext({}),{Provider:_t,Consumer:Qn}=lt;function Bt({children:t,blocklet:n=""}){const{api:s,inService:i}=Dt(),[a,l]=b.useState([]),[p,f]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),y=pe(()=>{var j;return(j=n.meta)==null?void 0:j.did},[n]),[S,T]=b.useState([]),N=async({page:j=1,pageSize:v=20,...x}={})=>{if(!y)return[];try{const w={paging:{page:j,pageSize:v},...x,teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0},{dids:M,...B}=w;let K="";M.includes("system")&&(K="system");const _=M.filter(ee=>ee!=="system"),Q=await s.getNotificationSendLog({input:{...B,source:K,componentDids:_}});return l(Q.list),f(Q.paging),Q.list}catch(w){return V.error(w.message),[]}},A=async()=>{const j=await s.getNotificationComponents({input:{teamDid:y}});T(j.componentDids)},P=b.useCallback(j=>{const v=n.children.find(x=>{var w;return((w=x.meta)==null?void 0:w.did)===j});if(v)return v.ancestors=[n],v},[n]),O=async({notificationId:j,receivers:v,channels:x,...w})=>{await s.resendNotification({input:{teamDid:y,notificationId:j,receivers:v,channels:x.map(M=>M==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:M==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:M),...w}})},F=b.useCallback(async j=>(await s.getUser({input:{teamDid:y,user:{did:j}}})).user,[s,y]),I=b.useCallback(async({page:j=1,pageSize:v=20,...x}={})=>{try{const w={paging:{page:j,pageSize:v},...x,userName:x.searchText||"",teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[s,y]);b.useEffect(()=>{y&&A()},[y]);const U={fetch:N,data:a,paging:p,blocklet:n,getComponent:P,resendNotification:O,getUser:F,componentDids:S,getReceivers:I,inService:i,teamDid:y};return e.jsx(_t,{value:{notificationRecords:U},children:t})}function Me(){const{notificationRecords:t}=b.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const zt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(Nt,{type:zt[t],children:t})}var qe={},Wt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Mt=Wt(Be()),qt=e;ct=qe.default=(0,Mt.default)((0,qt.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");var Ke={},Kt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var dt=Ke.default=void 0,Ht=Kt(Be()),$t=e;dt=Ke.default=(0,Ht.default)((0,$t.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 He={},Ut=Pe;Object.defineProperty(He,"__esModule",{value:!0});var ut=He.default=void 0,Vt=Ut(Be()),Gt=e;ut=He.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Yt=(t,n,s="")=>{if(!s||!n)return"";switch(s){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return s}};function pt(t,n,s={}){const{status:i,updatedAt:a,reason:l="",channel:p="wallet"}=s,f=a?t("notification.sendStatus.sentTime",{date:Et(a,n)}):"",y=Yt(t,p,l);return i===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:i===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.email)==null?void 0:i.enabled},mt=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.pushKit)==null?void 0:i.enabled},Xt=(t,n)=>{const s=Z(n,"extra.notifications.email",!0);return{available:ft(t),enabled:s}},Jt=(t,n)=>{const s=Z(n,"extra.notifications.push",!0);return{available:mt(t),enabled:s}},Qt=t=>({enabled:Z(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:Z(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(n=>{setTimeout(()=>{n()},t*1e3)}),en=(t,n)=>n==="wallet"||n==="webhook"?[{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:n==="pushKit"||n==="email"?[{channel:n,type:"available",pass:t("notification.sendStatus.reason.available",{channel:n}),fail:t("notification.sendStatus.reason.unavailable",{channel:n})},{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:[],xe=(t=[])=>{const n=$().startOf("day");return t.filter(s=>$(s.sendAt).isSame(n,"day")).length},tn=(t,n="")=>{if(n&&ke.includes(n)){const l=`${n}SendRecord`,p=Z(t,l,[]);return xe(p)}const s=Z(t,"webhook",{}),i=Object.keys(s??{})??[];if(n&&i.includes(n)){const l=s[n]??[];return xe(l)}const a={};return ke.forEach(l=>{const p=`${l}SendRecord`,f=Z(t,p,[]),y=xe(f);a[l]=y}),i.length>0&&i.forEach(l=>{const p=s[l]??[],f=xe(p);a[l]=f}),a},je=(t,n,s)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[s].splice(n,1),t},ve=(t,n)=>{if(!Array.isArray(n))throw new Error("filters must be an array");return n.length?!n.includes(t):!1},nn=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>bt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function J({config:t,enableTooltip:n=!0,showTitle:s=!1,children:i}){const{status:a,title:l="",sentTime:p="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:y}),e.jsx("span",{children:p})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[a],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[a]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:s?l:i})]})})}J.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};J.defaultProps={enableTooltip:!0,showTitle:!1,children:null};le.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};le.defaultProps={onDelete:()=>{}};function le({list:t,label:n,onDelete:s}){const{t:i,locale:a}=X();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[n,": "]}),t.map(l=>{const p=pt(i,a,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(J,{config:p,enableTooltip:!1,children:p.title})}),onDelete:f=>s(f,l)},l)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:n,index:s,column:i,filterValues:a,label:l,renderLabel:p}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:a.map(f=>e.jsx(Ie,{control:e.jsx(De,{checked:t[s].indexOf(f.value??f)>-1,onChange:y=>{const S=[...t];y.target.checked?S[s]=[...S[s],f.value??f]:S[s]=S[s].filter(T=>T!==(f.value??f)),n(S[s],s,i)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:p(f)})},f.value??f))})]})}function Re(t){return e.jsx($e,{...t,renderLabel:n=>e.jsx(J,{enableTooltip:!1,config:{status:n.status},children:n.label})})}oe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function oe({status:t,updatedAt:n,reason:s="",channel:i="wallet",onResend:a}){const{t:l,locale:p}=X(),f=pt(l,p,{status:t,updatedAt:n,reason:s,channel:i});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(J,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(ye,{className:"resend-btn",size:"small",startIcon:e.jsx(We,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:l("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:n}){const{locale:s}=X(),i=$().toDate(),[a,l]=b.useState(null),p=b.useCallback(S=>{l(a?null:S.currentTarget)},[a]),f=!!a,y=b.useCallback(S=>{if(!S.startDate||!S.endDate){V.error("Please select a date range");return}if($(S.startDate).isAfter(S.endDate)||!$(S.startDate).isValid()||!$(S.endDate).isValid()){V.error("Invalid date range");return}n([S.startDate,S.endDate]),l(null)},[n]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(ye,{onClick:p,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],s)," - ",Qe(t[1],s)]})}),e.jsx(Ee,{open:f,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(kt,{open:!0,maxDate:i,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:p,definedRanges:Pt(i),onChange:y})})]})}Ve.propTypes={itemComponent:d.elementType.isRequired};function Ve({itemComponent:t,...n}){var a;const{t:s}=X();return!((a=n==null?void 0:n.filterList)!=null&&a.filter(l=>l.length).length)?null:e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...n,ItemComponent:t})})]})}function Se({label:t,onDelete:n,canDelete:s=()=>!0,...i}){const a=n&&typeof n=="function"?n:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:t,...i})),e.jsx(Fe,{label:t,variant:"outlined",...a&&l?{onDelete:a}:{}})}Se.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Se.defaultProps={canDelete:()=>!0};const sn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ge.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ge.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ge({loading:t=!1,onCancel:n,onConfirm:s}){const{t:i}=X(),[a,l]=b.useState(sn),[p,f]=b.useState(!0),y=(T,N)=>{N.checked=T.target.checked;const A=a.map(P=>({...P,checked:P.value===N.value?N.checked:P.checked}));l(A)},S=T=>{T.stopPropagation(),s({channels:a.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:p})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:i("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:i("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:a.map(T=>e.jsx(Ie,{control:e.jsx(De,{checked:T.checked,onChange:N=>y(N,T),name:T.value}),label:T.label},T.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(De,{checked:p,onChange:T=>f(T.target.checked)}),label:i("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(ye,{onClick:T=>{T.stopPropagation(),n()},color:"inherit",children:i("common.cancel")}),e.jsxs(ye,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),i("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:n,resending:s=!1}){const{t:i,locale:a}=X(),{getReceivers:l,inService:p,teamDid:f,getUser:y,blocklet:S}=Me(),[T,N]=b.useState(!1),[A,P]=b.useState([]),O=Oe({anchorEl:null,position:null}),F=Oe({anchorEl:null,position:null}),[I,U]=b.useState(null),[j,v]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[x,w]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[M,B]=b.useState([]),K=[{label:i("notification.sendStatus.pending"),value:0,status:"pending"},{label:i("notification.sendStatus.success"),value:1,status:"success"},{label:i("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!T&&t)try{N(!0);const o=await l({notificationId:t,...x}),r=o.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,f,p)}}));P(r),v(o.paging),N(!1)}catch(o){V.error(o.message),N(!1)}};b.useEffect(()=>{_()},[x]);const Q=o=>{o.stopPropagation();const r=o.currentTarget;F.anchorEl=r;const c=r.getBoundingClientRect();F.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ee=o=>o.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(We,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Q,children:i("notification.resend")})}):null,Ne={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:i("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:j.page-1,rowsPerPage:j.pageSize,count:j.total,searchText:x.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:M,onRowSelectionChange:(o,r)=>{B(r.map(c=>c.dataIndex))},customToolbarSelect:ee},we=({page:o,rowsPerPage:r,searchText:c,filterList:C})=>{const[,k=[],H=[],q=[]]=C;x.pageSize!==r?w(W=>({...W,pageSize:r,page:1})):x.page!==o+1?w(W=>({...W,page:o+1})):x.searchText!==c?w(W=>({...W,searchText:c,page:1})):re(k,x.walletSendStatus)?re(H,x.pushKitSendStatus)?re(q,x.emailSendStatus)||w(W=>({...W,emailSendStatus:q,page:1})):w(W=>({...W,pushKitSendStatus:H,page:1})):w(W=>({...W,walletSendStatus:k,page:1}))},me=b.useCallback(async(o,r)=>{if(!r)return!1;const c=await y(r);return c?o==="wallet"?Qt(c):o==="email"?Xt(S,c):o==="pushKit"?Jt(S,c):o==="webhook"?Zt(c):!0:!1},[y,S]),h=b.useCallback(o=>en(i,o),[i]),u=()=>{O.anchorEl=null,O.position=null,U(null)},m=()=>{F.anchorEl=null,F.position=null},g=async(o,r,c=!0,C="")=>{if(!(!r.length||!o.length))try{n(o,r,c,C),F.anchorEl||(await ge(.5),u())}catch(k){console.error("handleResend error",{error:k})}},D=async({channels:o,isResendFailedOnly:r})=>{const c=M.map(C=>A[C].receiver);await g(o,c,r),await ge(.5),m(),B([])},E=async(o,r=[],c=!0)=>{try{await g(["webhook"],[o.receiver],c,r)}catch(C){V.error(C.response?C.response.statusText:C.message)}},z=async(o,r,c,C=[],k=!0)=>{if(o.stopPropagation(),tn(r,c)>=4){V.warning(i("notification.resendLimit"));return}if(!ke.includes(c)){await E(r,C,k);return}if(o){const q=o.currentTarget,W=q.getBoundingClientRect();O.anchorEl=q,O.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}U({channel:c});try{const q=await me(c,r.receiver);await ge(1),U({channel:c,result:q}),(typeof q=="boolean"&&q||Ct(q)&&Object.values(q).every(W=>!!W))&&(await n([c],[r.receiver],k),F.anchorEl||(await ge(.5),u()))}catch(q){V.error(q.message)}},Y=o=>{w(r=>({...r,dateRange:o,page:1}))},te=(o,r,c,C)=>{o.stopPropagation();const k=c.filter(H=>H!==r);w(H=>({...H,[C]:k,page:1}))},ie=pe(()=>[{label:i("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:o=>{const{receiverUser:r,receiver:c}=A[o];return r?e.jsxs(R,{"data-cy":`member-name-${r.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(st,{src:`${r.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(ue,{children:r.fullName})]},c):e.jsx(Lt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:x.walletSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Wallet",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Wallet",filterList:o,onChange:r,index:c,column:C,filterValues:K})},customBodyRenderLite:o=>{const{walletSendStatus:r,walletSendAt:c,walletSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"wallet",onResend:k=>z(k,A[o],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{pushKitSendStatus:r,pushKitSendAt:c,pushKitSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"pushkit",onResend:k=>z(k,A[o],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:x.pushKitSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Push Kit",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Push Kit",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{emailSendStatus:r,emailSendAt:c,emailSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"email",onResend:k=>z(k,A[o],"email",[],!1)})},filter:!0,filterType:"custom",filterList:x.emailSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Email",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Email",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{webhook:r}=A[o];if(!r)return null;const c=Object.entries(r)[0];if(!c)return null;const[C,k]=c,H=k[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(ue,{maxLength:30,children:C},C),e.jsx(oe,{status:H.status,updatedAt:H.sendAt,reason:H.failedReason,channel:"webhook",onResend:q=>z(q,A[o],"webhook",[C],!1)})]},C)})}}},{label:i("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:o=>{const{createdAt:r}=A[o];return e.jsx(ze,{value:r,locale:a,shouldUpdate:!0})}}}],[A,a,x,i]),he=[e.jsx(Ue,{value:x.dateRange,onChange:Y},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:T,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:i("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(on,{children:e.jsxs(nt,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:a,loading:T,columns:ie,data:A,onChange:we,options:Ne,customButtons:he,components:{TableFilterList:o=>e.jsx(Ve,{...o,itemComponent:r=>e.jsx(Se,{...r,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(Ee,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rn,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:h(I==null?void 0:I.channel).map(o=>{var k,H;const{type:r,pass:c,fail:C}=o;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[r]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(H=I==null?void 0:I.result)!=null&&H[r]?be.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},r):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:be.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:C})]},r)})})]})}),F.anchorEl&&e.jsx(Ee,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ge,{loading:s,onCancel:m,onConfirm:D})})]})})})}const an=b.memo(gt),on=ae.div`
1
+ import{r as b}from"./vendor-react-DoD83n6N.js";import{j as e,E as d,a1 as Pe,R as bt,a4 as jt,T as G,a3 as R,A as Fe,bF as _e,cn as et,cm as Te,aI as Ie,bM as De,x as ye,bh as Ee,a2 as tt,aa as ae,V as nt,aC as Xe,bG as vt,aK as yt,ak as Je,co as St}from"./vendor-mui-core-Dh3XBxY7.js";import{b as Z,at as re,z as Ct}from"./vendor-utils-oUOK1Lc7.js";import{j as V,b as L,ad as Nt,a0 as Be,e as X,bC as wt,D as st,a3 as Ae,aY as at,aF as be,a8 as Rt,ao as Tt,bl as It}from"./vendor-arcblock-Bv04Mkff.js";import{z as Dt,G as $,m as Et,I as Qe}from"./index-0m-J-ZAX.js";import{e as pe,a as Oe}from"./vendor-hooks-DlxYXMPL.js";import{S as ue}from"./shorten-label-DXP5M5GB.js";import{I as it}from"./index-DPFaqs63.js";import{S as At,a as Ot}from"./list-ChtSD939.js";import{R as ze}from"./relative-time-Gzr-RzyU.js";import{b as We}from"./dashboard-DdkKjU2L.js";import{W as Lt}from"./did-address-nBrtfdFs.js";import{p as ot}from"./util-b7UGzXHn.js";import{D as kt,g as Pt}from"./traffic-s8iVlNpL.js";import{B as rt}from"./bundle-avatar-DS4sS4Ug.js";import{B as Ft}from"./index-8Xn_gix_.js";import"./index-C24CwgC5.js";import"./InfoOutlined-B6WkOk1K.js";import"./useLocalStorage-Cd_KRSFh.js";import"./confirm-Di8Vvymn.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-BtE24rss.js";import"./get-safe-url-DnoVfY5w.js";import"./session-BqpWYLN3.js";import"./useAsyncRetry-ru9OmM2c.js";import"./useAsync-HJBQVHgn.js";import"./useSetState-BL3ktMon.js";import"./base32-BaFZoAVl.js";import"./iframe-BW5fhB2Q.js";import"./LaunchOutlined-DnsoPOkc.js";import"./ChevronLeft-DyVK0SyV.js";import"./ChevronRight-CMCOlQoz.js";import"./index-DmFVT2Y_.js";import"./vendor-mui-x-l1ezRCJc.js";const lt=b.createContext({}),{Provider:_t,Consumer:Qn}=lt;function Bt({children:t,blocklet:n=""}){const{api:s,inService:i}=Dt(),[a,l]=b.useState([]),[p,f]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),y=pe(()=>{var j;return(j=n.meta)==null?void 0:j.did},[n]),[S,T]=b.useState([]),N=async({page:j=1,pageSize:v=20,...x}={})=>{if(!y)return[];try{const w={paging:{page:j,pageSize:v},...x,teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0},{dids:M,...B}=w;let K="";M.includes("system")&&(K="system");const _=M.filter(ee=>ee!=="system"),Q=await s.getNotificationSendLog({input:{...B,source:K,componentDids:_}});return l(Q.list),f(Q.paging),Q.list}catch(w){return V.error(w.message),[]}},A=async()=>{const j=await s.getNotificationComponents({input:{teamDid:y}});T(j.componentDids)},P=b.useCallback(j=>{const v=n.children.find(x=>{var w;return((w=x.meta)==null?void 0:w.did)===j});if(v)return v.ancestors=[n],v},[n]),O=async({notificationId:j,receivers:v,channels:x,...w})=>{await s.resendNotification({input:{teamDid:y,notificationId:j,receivers:v,channels:x.map(M=>M==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:M==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:M),...w}})},F=b.useCallback(async j=>(await s.getUser({input:{teamDid:y,user:{did:j}}})).user,[s,y]),I=b.useCallback(async({page:j=1,pageSize:v=20,...x}={})=>{try{const w={paging:{page:j,pageSize:v},...x,userName:x.searchText||"",teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[s,y]);b.useEffect(()=>{y&&A()},[y]);const U={fetch:N,data:a,paging:p,blocklet:n,getComponent:P,resendNotification:O,getUser:F,componentDids:S,getReceivers:I,inService:i,teamDid:y};return e.jsx(_t,{value:{notificationRecords:U},children:t})}function Me(){const{notificationRecords:t}=b.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const zt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(Nt,{type:zt[t],children:t})}var qe={},Wt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Mt=Wt(Be()),qt=e;ct=qe.default=(0,Mt.default)((0,qt.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");var Ke={},Kt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var dt=Ke.default=void 0,Ht=Kt(Be()),$t=e;dt=Ke.default=(0,Ht.default)((0,$t.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 He={},Ut=Pe;Object.defineProperty(He,"__esModule",{value:!0});var ut=He.default=void 0,Vt=Ut(Be()),Gt=e;ut=He.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Yt=(t,n,s="")=>{if(!s||!n)return"";switch(s){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return s}};function pt(t,n,s={}){const{status:i,updatedAt:a,reason:l="",channel:p="wallet"}=s,f=a?t("notification.sendStatus.sentTime",{date:Et(a,n)}):"",y=Yt(t,p,l);return i===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:i===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.email)==null?void 0:i.enabled},mt=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.pushKit)==null?void 0:i.enabled},Xt=(t,n)=>{const s=Z(n,"extra.notifications.email",!0);return{available:ft(t),enabled:s}},Jt=(t,n)=>{const s=Z(n,"extra.notifications.push",!0);return{available:mt(t),enabled:s}},Qt=t=>({enabled:Z(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:Z(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(n=>{setTimeout(()=>{n()},t*1e3)}),en=(t,n)=>n==="wallet"||n==="webhook"?[{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:n==="pushKit"||n==="email"?[{channel:n,type:"available",pass:t("notification.sendStatus.reason.available",{channel:n}),fail:t("notification.sendStatus.reason.unavailable",{channel:n})},{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:[],xe=(t=[])=>{const n=$().startOf("day");return t.filter(s=>$(s.sendAt).isSame(n,"day")).length},tn=(t,n="")=>{if(n&&ke.includes(n)){const l=`${n}SendRecord`,p=Z(t,l,[]);return xe(p)}const s=Z(t,"webhook",{}),i=Object.keys(s??{})??[];if(n&&i.includes(n)){const l=s[n]??[];return xe(l)}const a={};return ke.forEach(l=>{const p=`${l}SendRecord`,f=Z(t,p,[]),y=xe(f);a[l]=y}),i.length>0&&i.forEach(l=>{const p=s[l]??[],f=xe(p);a[l]=f}),a},je=(t,n,s)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[s].splice(n,1),t},ve=(t,n)=>{if(!Array.isArray(n))throw new Error("filters must be an array");return n.length?!n.includes(t):!1},nn=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>bt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function J({config:t,enableTooltip:n=!0,showTitle:s=!1,children:i}){const{status:a,title:l="",sentTime:p="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:y}),e.jsx("span",{children:p})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[a],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[a]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:s?l:i})]})})}J.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};J.defaultProps={enableTooltip:!0,showTitle:!1,children:null};le.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};le.defaultProps={onDelete:()=>{}};function le({list:t,label:n,onDelete:s}){const{t:i,locale:a}=X();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[n,": "]}),t.map(l=>{const p=pt(i,a,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(J,{config:p,enableTooltip:!1,children:p.title})}),onDelete:f=>s(f,l)},l)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:n,index:s,column:i,filterValues:a,label:l,renderLabel:p}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:a.map(f=>e.jsx(Ie,{control:e.jsx(De,{checked:t[s].indexOf(f.value??f)>-1,onChange:y=>{const S=[...t];y.target.checked?S[s]=[...S[s],f.value??f]:S[s]=S[s].filter(T=>T!==(f.value??f)),n(S[s],s,i)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:p(f)})},f.value??f))})]})}function Re(t){return e.jsx($e,{...t,renderLabel:n=>e.jsx(J,{enableTooltip:!1,config:{status:n.status},children:n.label})})}oe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function oe({status:t,updatedAt:n,reason:s="",channel:i="wallet",onResend:a}){const{t:l,locale:p}=X(),f=pt(l,p,{status:t,updatedAt:n,reason:s,channel:i});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(J,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(ye,{className:"resend-btn",size:"small",startIcon:e.jsx(We,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:l("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:n}){const{locale:s}=X(),i=$().toDate(),[a,l]=b.useState(null),p=b.useCallback(S=>{l(a?null:S.currentTarget)},[a]),f=!!a,y=b.useCallback(S=>{if(!S.startDate||!S.endDate){V.error("Please select a date range");return}if($(S.startDate).isAfter(S.endDate)||!$(S.startDate).isValid()||!$(S.endDate).isValid()){V.error("Invalid date range");return}n([S.startDate,S.endDate]),l(null)},[n]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(ye,{onClick:p,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],s)," - ",Qe(t[1],s)]})}),e.jsx(Ee,{open:f,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(kt,{open:!0,maxDate:i,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:p,definedRanges:Pt(i),onChange:y})})]})}Ve.propTypes={itemComponent:d.elementType.isRequired};function Ve({itemComponent:t,...n}){var a;const{t:s}=X();return!((a=n==null?void 0:n.filterList)!=null&&a.filter(l=>l.length).length)?null:e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...n,ItemComponent:t})})]})}function Se({label:t,onDelete:n,canDelete:s=()=>!0,...i}){const a=n&&typeof n=="function"?n:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:t,...i})),e.jsx(Fe,{label:t,variant:"outlined",...a&&l?{onDelete:a}:{}})}Se.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Se.defaultProps={canDelete:()=>!0};const sn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ge.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ge.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ge({loading:t=!1,onCancel:n,onConfirm:s}){const{t:i}=X(),[a,l]=b.useState(sn),[p,f]=b.useState(!0),y=(T,N)=>{N.checked=T.target.checked;const A=a.map(P=>({...P,checked:P.value===N.value?N.checked:P.checked}));l(A)},S=T=>{T.stopPropagation(),s({channels:a.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:p})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:i("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:i("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:a.map(T=>e.jsx(Ie,{control:e.jsx(De,{checked:T.checked,onChange:N=>y(N,T),name:T.value}),label:T.label},T.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(De,{checked:p,onChange:T=>f(T.target.checked)}),label:i("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(ye,{onClick:T=>{T.stopPropagation(),n()},color:"inherit",children:i("common.cancel")}),e.jsxs(ye,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),i("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:n,resending:s=!1}){const{t:i,locale:a}=X(),{getReceivers:l,inService:p,teamDid:f,getUser:y,blocklet:S}=Me(),[T,N]=b.useState(!1),[A,P]=b.useState([]),O=Oe({anchorEl:null,position:null}),F=Oe({anchorEl:null,position:null}),[I,U]=b.useState(null),[j,v]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[x,w]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[M,B]=b.useState([]),K=[{label:i("notification.sendStatus.pending"),value:0,status:"pending"},{label:i("notification.sendStatus.success"),value:1,status:"success"},{label:i("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!T&&t)try{N(!0);const o=await l({notificationId:t,...x}),r=o.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,f,p)}}));P(r),v(o.paging),N(!1)}catch(o){V.error(o.message),N(!1)}};b.useEffect(()=>{_()},[x]);const Q=o=>{o.stopPropagation();const r=o.currentTarget;F.anchorEl=r;const c=r.getBoundingClientRect();F.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ee=o=>o.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(We,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Q,children:i("notification.resend")})}):null,Ne={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:i("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:j.page-1,rowsPerPage:j.pageSize,count:j.total,searchText:x.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:M,onRowSelectionChange:(o,r)=>{B(r.map(c=>c.dataIndex))},customToolbarSelect:ee},we=({page:o,rowsPerPage:r,searchText:c,filterList:C})=>{const[,k=[],H=[],q=[]]=C;x.pageSize!==r?w(W=>({...W,pageSize:r,page:1})):x.page!==o+1?w(W=>({...W,page:o+1})):x.searchText!==c?w(W=>({...W,searchText:c,page:1})):re(k,x.walletSendStatus)?re(H,x.pushKitSendStatus)?re(q,x.emailSendStatus)||w(W=>({...W,emailSendStatus:q,page:1})):w(W=>({...W,pushKitSendStatus:H,page:1})):w(W=>({...W,walletSendStatus:k,page:1}))},me=b.useCallback(async(o,r)=>{if(!r)return!1;const c=await y(r);return c?o==="wallet"?Qt(c):o==="email"?Xt(S,c):o==="pushKit"?Jt(S,c):o==="webhook"?Zt(c):!0:!1},[y,S]),h=b.useCallback(o=>en(i,o),[i]),u=()=>{O.anchorEl=null,O.position=null,U(null)},m=()=>{F.anchorEl=null,F.position=null},g=async(o,r,c=!0,C="")=>{if(!(!r.length||!o.length))try{n(o,r,c,C),F.anchorEl||(await ge(.5),u())}catch(k){console.error("handleResend error",{error:k})}},D=async({channels:o,isResendFailedOnly:r})=>{const c=M.map(C=>A[C].receiver);await g(o,c,r),await ge(.5),m(),B([])},E=async(o,r=[],c=!0)=>{try{await g(["webhook"],[o.receiver],c,r)}catch(C){V.error(C.response?C.response.statusText:C.message)}},z=async(o,r,c,C=[],k=!0)=>{if(o.stopPropagation(),tn(r,c)>=4){V.warning(i("notification.resendLimit"));return}if(!ke.includes(c)){await E(r,C,k);return}if(o){const q=o.currentTarget,W=q.getBoundingClientRect();O.anchorEl=q,O.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}U({channel:c});try{const q=await me(c,r.receiver);await ge(1),U({channel:c,result:q}),(typeof q=="boolean"&&q||Ct(q)&&Object.values(q).every(W=>!!W))&&(await n([c],[r.receiver],k),F.anchorEl||(await ge(.5),u()))}catch(q){V.error(q.message)}},Y=o=>{w(r=>({...r,dateRange:o,page:1}))},te=(o,r,c,C)=>{o.stopPropagation();const k=c.filter(H=>H!==r);w(H=>({...H,[C]:k,page:1}))},ie=pe(()=>[{label:i("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:o=>{const{receiverUser:r,receiver:c}=A[o];return r?e.jsxs(R,{"data-cy":`member-name-${r.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(st,{src:`${r.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(ue,{children:r.fullName})]},c):e.jsx(Lt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:x.walletSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Wallet",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Wallet",filterList:o,onChange:r,index:c,column:C,filterValues:K})},customBodyRenderLite:o=>{const{walletSendStatus:r,walletSendAt:c,walletSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"wallet",onResend:k=>z(k,A[o],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{pushKitSendStatus:r,pushKitSendAt:c,pushKitSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"pushkit",onResend:k=>z(k,A[o],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:x.pushKitSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Push Kit",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Push Kit",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{emailSendStatus:r,emailSendAt:c,emailSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"email",onResend:k=>z(k,A[o],"email",[],!1)})},filter:!0,filterType:"custom",filterList:x.emailSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Email",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Email",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{webhook:r}=A[o];if(!r)return null;const c=Object.entries(r)[0];if(!c)return null;const[C,k]=c,H=k[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(ue,{maxLength:30,children:C},C),e.jsx(oe,{status:H.status,updatedAt:H.sendAt,reason:H.failedReason,channel:"webhook",onResend:q=>z(q,A[o],"webhook",[C],!1)})]},C)})}}},{label:i("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:o=>{const{createdAt:r}=A[o];return e.jsx(ze,{value:r,locale:a,shouldUpdate:!0})}}}],[A,a,x,i]),he=[e.jsx(Ue,{value:x.dateRange,onChange:Y},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:T,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:i("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(on,{children:e.jsxs(nt,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:a,loading:T,columns:ie,data:A,onChange:we,options:Ne,customButtons:he,components:{TableFilterList:o=>e.jsx(Ve,{...o,itemComponent:r=>e.jsx(Se,{...r,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(Ee,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rn,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:h(I==null?void 0:I.channel).map(o=>{var k,H;const{type:r,pass:c,fail:C}=o;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[r]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(H=I==null?void 0:I.result)!=null&&H[r]?be.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},r):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:be.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:C})]},r)})})]})}),F.anchorEl&&e.jsx(Ee,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ge,{loading:s,onCancel:m,onConfirm:D})})]})})})}const an=b.memo(gt),on=ae.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }