@dcl/builder-site 7.14.4-19333247245.commit-881855f → 7.14.4-19500651590.commit-4962afd
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/assets/{Back-Bq3Xcoly.js → Back-qfVBk6YN.js} +1 -1
- package/assets/{CollectionProvider.container-78TB9kiH.js → CollectionProvider.container-Dz4kU__V.js} +1 -1
- package/assets/{CollectionStatus.container-DBfnW5vX.js → CollectionStatus.container-SecVXoKZ.js} +1 -1
- package/assets/{ConfirmDelete-71BcCucu.js → ConfirmDelete-8N9eX1ru.js} +1 -1
- package/assets/{FileSaver.min-BZiMcTZh.js → FileSaver.min-D7RIIP64.js} +1 -1
- package/assets/{ItemProvider.container-B_BAvEtH.js → ItemProvider.container-BtouewED.js} +1 -1
- package/assets/{JumpIn.container-CeSOEwOc.js → JumpIn.container-va_LyMbu.js} +1 -1
- package/assets/{LandAction-Be_9Vd4x.js → LandAction-CUgZ-nVw.js} +1 -1
- package/assets/{LandProviderPage-C-6H7vWP.js → LandProviderPage-D194_isC.js} +1 -1
- package/assets/{LoggedInDetailPage.container-BwMfJFSQ.js → LoggedInDetailPage.container-BLLfFAse.js} +1 -1
- package/assets/{Navigation-jXq70jgH.css → Navigation-pnQrAplR.css} +1 -1
- package/assets/{Navigation.container-gTCRHjj6.js → Navigation.container-m_5Xay6X.js} +1 -1
- package/assets/{NotFound-BnVf99__.js → NotFound-BTo5pEaG.js} +1 -1
- package/assets/{OptionsDropdown-Ct56jDIF.js → OptionsDropdown-Dkcmv78a.js} +1 -1
- package/assets/{RentalPeriod-Dur2tZPB.js → RentalPeriod-DiTpnn81.js} +1 -1
- package/assets/{SDKTag-B-Q47VXc.js → SDKTag-B1AaBZZp.js} +1 -1
- package/assets/{SceneStats.container-DWiDhtTP.js → SceneStats.container-gb6NrI8H.js} +1 -1
- package/assets/{SignInRequired-hq09yAsv.js → SignInRequired-cMu1CrC_.js} +1 -1
- package/assets/{ThirdPartyKindBadge-BMfvIxcg.js → ThirdPartyKindBadge-85NbLCqg.js} +1 -1
- package/assets/{dataReader-BKwQpqk0.js → dataReader-J2q5Wk51.js} +1 -1
- package/assets/{date-fu0Q5SmK.js → date-C90QIauR.js} +1 -1
- package/assets/{fortmatic-DFjOPMpn.js → fortmatic-B5_sXpTq.js} +1 -1
- package/assets/{hooks-C8UcKsSN.js → hooks-B-YhDlyt.js} +1 -1
- package/assets/{index-1kC9v6hM.js → index--eP8RdN-.js} +1 -1
- package/assets/{index-DJzhTL6b.css → index-3ivXi3H6.css} +1 -1
- package/assets/index-4S3D4LaD.js +1 -0
- package/assets/{index-DGtPjzZG.js → index-B2y05o7K.js} +1 -1
- package/assets/{index-p2SgPRC2.js → index-B8mjr01h.js} +1 -1
- package/assets/{index-D2E7HW9r.js → index-B9la4WTD.js} +1 -1
- package/assets/{index-oifEF-AL.js → index-BBq_p2Jh.js} +1 -1
- package/assets/{index-l01ZXTQD.js → index-BGOe_558.js} +1 -1
- package/assets/{index-C_uyOxRe.js → index-BGbyjzTe.js} +1 -1
- package/assets/{index-B70jPWUC.js → index-BGrJJYrs.js} +1 -1
- package/assets/{index-CA5U2eoi.js → index-BItWASwT.js} +1 -1
- package/assets/{index-CcVM_MVj.js → index-BaBcvmM1.js} +1 -1
- package/assets/{index-DyL3RKfL.js → index-Bc3TZncd.js} +1 -1
- package/assets/{index-COGtA8En.js → index-Bl5LC4b1.js} +1 -1
- package/assets/{index-Dg630mlC.js → index-BpZF6T44.js} +2 -2
- package/assets/{index-Co-_AGGw.css → index-C1EVXuav.css} +7 -7
- package/assets/{index-CBJhwCuq.js → index-C1clPxBD.js} +1 -1
- package/assets/{index-CVnoGzvQ.js → index-CBnSo8Zh.js} +1 -1
- package/assets/{index-DYUIlIfe.js → index-CFPRYeOi.js} +1 -1
- package/assets/{index-BTDa9rgp.js → index-CHuI3qPX.js} +1 -1
- package/assets/{index-BdDRr38Q.js → index-CIoA4Sd_.js} +1 -1
- package/assets/{index-wzlt3Ngs.css → index-CJm4yYRA.css} +1 -1
- package/assets/{index-AIRgE-AH.js → index-CKyzF9VZ.js} +1 -1
- package/assets/{index-BHBiKgzq.js → index-CO7NEMGF.js} +1 -1
- package/assets/{index-rcrcGNw2.css → index-Cd58ce0H.css} +1 -1
- package/assets/{index-CqH-gavs.js → index-CflCMh4p.js} +1 -1
- package/assets/{index-DBkNL0Th.js → index-CgXwvFq0.js} +1 -1
- package/assets/{index-Dub0PLTM.js → index-Ci5vJnfQ.js} +1 -1
- package/assets/{index-Ijwig6A9.js → index-CztsBLiJ.js} +1 -1
- package/assets/{index-BO-dI8RM.js → index-D1LVGfhr.js} +1 -1
- package/assets/{index-DFRQoFbj.js → index-DLuf0EV2.js} +1 -1
- package/assets/{index-BpbrfPnW.js → index-DTuQuNzL.js} +1 -1
- package/assets/{index-BdqF7tuc.js → index-DV7YxGZN.js} +1 -1
- package/assets/{index-DJ8x8wA3.css → index-DXqNJi0c.css} +1 -1
- package/assets/index-D_fzj-h4.js +1 -0
- package/assets/{index-BnzPu6kN.js → index-DdHxFx5i.js} +1 -1
- package/assets/{index-C1dGl8XT.css → index-Dddu1BYO.css} +1 -1
- package/assets/{index-DM0r5dUd.js → index-DmE6V3G4.js} +1 -1
- package/assets/{index-D_RXKLMK.js → index-DmfVh-eI.js} +1 -1
- package/assets/{index-BwtkRqt7.css → index-DuO-zVHz.css} +1 -1
- package/assets/{index-C5rcmfcn.js → index-DztvhgAB.js} +1 -1
- package/assets/{index-CEJEtJkL.js → index-G58uvV_v.js} +1 -1
- package/assets/{index-BlcMW_g6.js → index-LbPj94fr.js} +222 -255
- package/assets/{index-BllbtnmR.js → index-Lx6kdj9H.js} +1 -1
- package/assets/{index-B7l7sJg2.js → index-Nu8JUQec.js} +1 -1
- package/assets/{index-BSV0ASyT.js → index-ocFbUjKw.js} +1 -1
- package/assets/{index-CczDtxja.js → index-poJQMTAu.js} +1 -1
- package/assets/{index-Pg38vW63.js → index-s99GEmyW.js} +1 -1
- package/assets/{index-CY1Kg1DY.js → index-y3QMYVxY.js} +1 -1
- package/assets/{index.es-B8BKm5UV.js → index.es-BM4hfwnw.js} +4 -4
- package/assets/{selectors-C5Krcz9D.js → selectors-CSnw6goy.js} +1 -1
- package/index.html +3 -3
- package/package.json +3 -3
- package/assets/index-CHxHn296.js +0 -1
- package/assets/index-e8nO5duU.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var ht=Object.defineProperty;var mt=(i,m,e)=>m in i?ht(i,m,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[m]=e;var c=(i,m,e)=>mt(i,typeof m!="symbol"?m+"":m,e);import{ae as q,H as t,M as d,G as r,bk as $,bJ as gt,D as b,gt as X,L as te,K as F,cj as Fe,b4 as P,N as He,bD as G,gu as pt,eF as ut,gv as Ct,gw as It,gx as bt,gy as _t,gz as xt,gA as Et,gB as vt,gC as jt,gD as H,et as St,gE as K,gF as Pe,a4 as se,Z as _e,a5 as C,aG as ae,gG as ft,de as xe,br as Ve,fe as Ee,ft as Tt,fW as wt,fX as yt,eC as ge,gm as Pt,gH as At,gI as Nt,fZ as Rt,eG as Ue,gJ as Mt,gK as Dt,gL as Lt,gM as Ot,fo as kt,fY as Bt,f_ as Wt,aM as ve,gN as Ft,gO as Ht,eU as Ae,bK as Vt,ad as Ut,eJ as je,gP as $e,X as Ge,ew as $t,er as Ye,fG as ee,dG as pe,es as Gt,eX as ue,gQ as Je,bi as Se,fV as ze,e_ as L,eu as z,fC as qe,fD as Ce,J as V,f9 as Ie,dF as Yt,eS as Jt,fl as zt,gR as qt,gS as Ze,gT as Ke,gU as Qe,fd as fe,eD as Zt,gV as Kt,gW as Qt,fK as Xe,eM as Xt,eL as et,eN as es,eP as ts,eQ as ss,gX as as,gY as ns,gZ as is,g_ as Ne,g$ as de,h0 as ls,eg as os,h1 as rs,h2 as ds,h3 as cs,h4 as hs,h5 as ms,h6 as gs,h7 as ps,h8 as us,h9 as Cs,ha as Is,hb as bs,fm as _s,hc as xs,hd as Es,he as vs,hf as js,hg as Ss,hh as fs,hi as Ts,hj as ws,f$ as ys,bU as ie,hk as Ps,hl as Re,hm as As,hn as Ns,eW as Me,fH as ce,ho as he,eV as Rs,eR as De,eY as Ms,eZ as Le,e$ as Oe,f0 as ke,hp as Ds,hq as Ls,f1 as Os,f2 as Be,f3 as We,hr as ks,fc as Bs,hs as Ws,ht as Fs,hu as Hs,hv as tt,hw as Vs,hx as Us,hy as $s,hz as Gs,hA as Ys,eI as Js,hB as zs,fg as qs,ff as Zs,fi as Ks,hC as Qs}from"./index-BlcMW_g6.js";import{g as oe,h as Te,i as we}from"./hooks-C8UcKsSN.js";import{J as Xs}from"./JumpIn.container-CeSOEwOc.js";import{C as ea}from"./CollectionProvider.container-78TB9kiH.js";import{C as st}from"./ConfirmDelete-71BcCucu.js";import{C as at}from"./CollectionStatus.container-DBfnW5vX.js";import{d as ta,e as sa,c as aa}from"./selectors-C5Krcz9D.js";import{I as na}from"./ItemProvider.container-B_BAvEtH.js";const ia=({open:i,assignee:m,onConfirm:e,onClose:s})=>t.jsxs(d.Modal,{size:"tiny",className:"ConfirmApprovalModal",open:i,children:[t.jsx(d.Modal.Header,{children:r("curation_page.confirm_not_assigned_curation_modal.title")}),t.jsxs(d.Modal.Content,{children:[t.jsx("div",{className:"message-container",children:t.jsx($,{id:"curation_page.confirm_not_assigned_curation_modal.body",values:{assignee:t.jsx("strong",{children:t.jsx(gt,{textOnly:!0,address:m})})}})}),t.jsx("span",{children:t.jsx($,{id:"curation_page.confirm_not_assigned_curation_modal.confirm_footer"})})]}),t.jsxs(d.Modal.Actions,{children:[t.jsx(d.Button,{onClick:s,children:r("global.cancel")}),t.jsx(d.Button,{primary:!0,onClick:e,children:r("curation_page.confirm_not_assigned_curation_modal.confirm_button")})]})]}),la=q.memo(ia);var D=(i=>(i.REJECT_COLLECTION="REJECT_COLLECTION",i.REJECT_CURATION="REJECT_CURATION",i.DISABLE_COLLECTION="DISABLE_COLLECTION",i.DISABLE_THIRD_PARTY="DISABLE_THIRD_PARTY",i))(D||{});const U="item_editor.top_panel.rejection_modal",oa=({open:i,type:m,isLoading:e,thirdParty:s,hasPendingTransaction:a,onDisableThirdParty:n,collection:l,curation:o,onReject:h,onRejectCuration:g,onClose:p})=>{const E=b.useMemo(()=>{switch(m){case D.DISABLE_COLLECTION:return U+".disable_collection";case D.REJECT_CURATION:return U+".reject_curation";case D.DISABLE_THIRD_PARTY:return U+".disable_third_party";default:return""}},[m]),w=()=>{switch(m){case D.DISABLE_COLLECTION:h(l);break;case D.REJECT_CURATION:g(o.collectionId);break;case D.DISABLE_THIRD_PARTY:s&&n(s.id);break}},S=m===D.DISABLE_COLLECTION&&!l.isApproved||m===D.DISABLE_THIRD_PARTY&&!(s!=null&&s.isApproved)||m===D.REJECT_COLLECTION&&!l.isApproved||m===D.REJECT_CURATION&&(o==null?void 0:o.status)===X.REJECTED;return t.jsx(d.Modal,{size:"tiny",className:"RejectionModal",open:i,children:a?t.jsx(ra,{i18nKey:E}):S?t.jsx(da,{link:l.forumLink,onClose:p}):t.jsx(ca,{i18nKey:E,isLoading:e,onClose:p,onConfirm:w})})},ra=({i18nKey:i})=>t.jsxs(t.Fragment,{children:[t.jsx(d.Modal.Header,{children:r(`${i}.title`)}),t.jsxs("div",{className:"loading-transaction",children:[t.jsx("div",{className:"danger-text",children:r(`${i}.tx_pending`)}),t.jsx("small",{className:"danger-text",children:t.jsx($,{id:U+".visit_activity",values:{activity_link:t.jsx(te,{to:F.activity(),children:r("global.activity")})}})}),t.jsx(d.Loader,{active:!0,size:"large"})]})]}),da=({link:i,onClose:m})=>t.jsxs(t.Fragment,{children:[t.jsx(d.Modal.Header,{children:r(U+".veredict_explanation")}),t.jsx(d.Modal.Content,{children:r(U+".go_to_forum")}),t.jsxs(d.Modal.Actions,{children:[t.jsx("a",{href:i,className:"forum-link",target:"_blank",rel:"noopener noreferrer",children:t.jsxs(d.Button,{secondary:!0,icon:!0,labelPosition:"right",children:[t.jsx("div",{children:r(U+".forum_link")}),t.jsx("div",{className:"discussion",children:r(U+".discussion")}),t.jsx(d.Icon,{name:"chevron right"})]})}),t.jsx(d.Button,{basic:!0,onClick:m,children:r("global.done")})]})]}),ca=({i18nKey:i,isLoading:m,onConfirm:e,onClose:s})=>t.jsxs(t.Fragment,{children:[t.jsx(d.Modal.Header,{children:r(`${i}.title`)}),t.jsx(d.Modal.Content,{children:r(`${i}.subtitle`)}),t.jsxs(d.Modal.Actions,{children:[t.jsx(Fe,{primary:!0,onClick:e,disabled:m,loading:m,network:P.Network.MATIC,children:r(`${i}.action`)}),t.jsx(d.Button,{disabled:m,onClick:s,children:r("global.cancel")})]})]}),ha=q.memo(oa),ma=(i,m)=>({isLoading:G(ut(i),pt)||G(It(i),Ct)||bt(i),hasPendingTransaction:_t(i)||!!(m.thirdParty&&xt(i,m.thirdParty.id))}),ga=i=>({onReject:m=>i(Et(m)),onRejectCuration:m=>i(vt(m)),onDisableThirdParty:m=>i(jt(m))}),pa=He(ma,ga)(ha);var y=(i=>(i[i.APPROVE=0]="APPROVE",i[i.REJECT=1]="REJECT",i[i.ENABLE=2]="ENABLE",i[i.DISABLE=3]="DISABLE",i[i.DEPLOY_MISSING_ENTITIES=4]="DEPLOY_MISSING_ENTITIES",i))(y||{});let ua=class extends q.PureComponent{constructor(){super(...arguments);c(this,"state",{currentVeredict:void 0,showRejectionModal:null,showApproveConfirmModal:!1});c(this,"handleBack",()=>{const{history:e}=this.props;e.push(F.curation())});c(this,"handleConfirmApprovalModal",(e,s)=>{const{address:a,onInitiateApprovalFlow:n,onInitiateTPApprovalFlow:l,onSetAssignee:o}=this.props;this.setState({showApproveConfirmModal:!1}),a&&o(e.id,a,s),H(e)?l(e):n(e)});c(this,"setShowRejectionModal",e=>this.setState({showRejectionModal:e}));c(this,"renderPage",e=>{const{items:s,itemCurations:a,curation:n,totalItems:l,thirdParty:o}=this.props,{showRejectionModal:h,showApproveConfirmModal:g}=this.state,{chainId:p}=this.props,E=St(e);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"actions",children:t.jsx("div",{className:"back",onClick:this.handleBack})}),t.jsxs("div",{className:"title",children:[e.name," · ",r(`collection.type.${E}`),t.jsx(Xs,{size:"small",active:!0,collection:e,chainId:p,items:H(e)?s:void 0,text:r("global.see_in_decentraland")})]}),t.jsx("div",{className:"actions",children:t.jsx("span",{className:"button-container",children:H(e)&&l!==void 0?this.renderTPButtons(e,n,a):this.renderButtons(e,n)})}),h&&t.jsx(pa,{type:h,open:!0,collection:e,curation:n,thirdParty:o,onClose:()=>this.setShowRejectionModal(null)}),(n==null?void 0:n.assignee)&&g&&t.jsx(la,{open:!0,assignee:n.assignee,onConfirm:()=>this.handleConfirmApprovalModal(e,n),onClose:()=>this.setState({showApproveConfirmModal:!1})})]})});c(this,"renderButton",(e,s,a)=>{const{address:n,thirdParty:l,onInitiateApprovalFlow:o,onInitiateTPApprovalFlow:h,onDeployMissingEntities:g,reviewedItems:p,totalItems:E}=this.props,w={[y.APPROVE]:()=>a!=null&&a.assignee&&n!==(a==null?void 0:a.assignee)?this.setState({showApproveConfirmModal:!0}):H(s)?h(s):o(s),[y.ENABLE]:()=>o(s),[y.DISABLE]:()=>this.setShowRejectionModal(l?D.DISABLE_THIRD_PARTY:D.DISABLE_COLLECTION),[y.REJECT]:()=>{(a==null?void 0:a.status)===X.PENDING?this.setShowRejectionModal(D.REJECT_CURATION):this.setShowRejectionModal(D.REJECT_COLLECTION)},[y.DEPLOY_MISSING_ENTITIES]:()=>g(s)},S={[y.APPROVE]:"approve",[y.ENABLE]:"enable",[y.DISABLE]:"disable",[y.REJECT]:"reject",[y.DEPLOY_MISSING_ENTITIES]:"deploy_missing_entities"},j=e===y.APPROVE||e===y.ENABLE||e===y.DEPLOY_MISSING_ENTITIES,x=!H(s)||!!E&&p.length>=K(E);return t.jsx(d.Popup,{content:r("item_editor.top_panel.items_pending_to_review"),disabled:x,position:"bottom center",trigger:t.jsx("div",{children:t.jsx(d.Button,{primary:j,onClick:()=>w[e](),disabled:H(s)&&e===y.APPROVE&&!!E&&p.length<K(E),children:r(`item_editor.top_panel.${S[e]}`)})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0})});c(this,"renderTPButtons",(e,s,a)=>{const{reviewedItems:n,totalItems:l,thirdParty:o}=this.props,h=a==null?void 0:a.some(g=>g.status===X.PENDING);return t.jsxs(t.Fragment,{children:[t.jsxs(d.Header,{sub:!0,children:[h?r("item_editor.top_panel.reviewed_counter",{count:n.length,threshold:K(l)}):r("item_editor.top_panel.not_enough_items_to_curate_more"),n.length>=K(l)?t.jsx(d.Icon,{name:"check circle"}):null]}),h&&this.renderButton(y.APPROVE,e,s),h&&this.renderButton(y.REJECT,e,s),!h&&(o==null?void 0:o.isApproved)&&this.renderButton(y.DISABLE,e,null)]})});c(this,"renderButtons",(e,s)=>s&&e.isApproved&&s.status==="pending"?t.jsxs(t.Fragment,{children:[this.renderButton(y.APPROVE,e,s),this.renderButton(y.REJECT,e,s)]}):s&&e.isApproved&&(s.status==="approved"||s.status==="rejected")?t.jsxs(t.Fragment,{children:[this.renderButton(y.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(y.DEPLOY_MISSING_ENTITIES,e,s)]}):Pe(e)&&e.isApproved?t.jsxs(t.Fragment,{children:[this.renderButton(y.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(y.DEPLOY_MISSING_ENTITIES,e,s)]}):Pe(e)?this.renderButton(y.ENABLE,e,s):t.jsxs(t.Fragment,{children:[this.renderButton(y.APPROVE,e,s),this.renderButton(y.REJECT,e,s)]}))}render(){const{collection:e,items:s,isCommitteeMember:a,isReviewing:n,isConnected:l,isLoading:o}=this.props,h=!e||o&&!s.length;return a&&n&&l?t.jsx("div",{className:"TopPanel",children:h?t.jsx(d.Loader,{size:"small",active:!0}):this.renderPage(e)}):null}};const Ca=({reviewedItems:i})=>{const m=se(),e=_e(),s=oe(),a=Te(),n=C(ae),l=C(ft),o=C(xe),h=C(Ve),g=C(u=>s?Ee(u,s):null),p=C(u=>g?Tt(u,g.id):[]),E=C(u=>g?wt(u,g.id):[]),w=C(u=>s?yt(u,s):null),S=C(u=>s?ge(u,s):void 0),j=C(u=>g&&H(g)?Pt(u,g):null),x=C(u=>s?At(u,s):!1),f=C(u=>G(Nt(u),kt)||G(Rt(u),Bt)||G(Ue(u),Wt)),T=b.useCallback((u,N,k)=>{m(Mt(u,N,k))},[m]),R=b.useCallback(u=>{m(Dt(u))},[m]),M=b.useCallback(u=>{m(Lt(u))},[m]),I=b.useCallback(u=>{m(Ot(u))},[m]);return t.jsx(ua,{address:n,items:p,totalItems:(S==null?void 0:S.total)||null,collection:g,itemCurations:E,thirdParty:j,curation:w,chainId:l,isConnected:o,isReviewing:a,isCommitteeMember:h,selectedCollectionId:s,hasCollectionMissingEntities:x,isLoading:f,reviewedItems:i,onSetAssignee:T,onInitiateTPApprovalFlow:R,onInitiateApprovalFlow:M,onDeployMissingEntities:I,history:e})},Ia=Ca,nt=()=>{const{search:i}=ve();return C(e=>Ft(e,i))},ba="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.22722%2012.7164C4.07574%2012.5731%204%2012.3582%204%2012.2149C4%2012.0716%204.07574%2011.8567%204.22722%2011.7134L5.28757%2010.7104C5.59053%2010.4239%206.04497%2010.4239%206.34793%2010.7104L9.35858%2013.8448C9.51006%2013.9881%209.73728%2013.9881%209.88876%2013.8448L17.6521%206.21493C17.955%205.92836%2018.4095%205.92836%2018.7124%206.21493L19.7728%207.21791C20.0757%207.50448%2020.0757%207.93433%2019.7728%208.2209L10.116%2017.7851C9.9645%2017.9284%209.81302%2018%209.5858%2018C9.35858%2018%209.2071%2017.9284%209.05562%2017.7851L4.22722%2012.7164Z'%20fill='white'/%3e%3c/svg%3e",_a=i=>{const{collectionId:m}=i,[e,s]=b.useState(!1),[a,n]=b.useState(null),l=_e(),o=ve(),h=b.useMemo(()=>Ht(o.search),[o.search]);b.useEffect(()=>{h&&(s(!0),n(h))},[h]);function g(){s(!1);const p=new URLSearchParams(o.search);p.delete("newItem"),l.replace({search:p.toString()})}return e&&a&&m?t.jsx(d.Toast,{type:d.ToastType.INFO,title:r("sagas.item.item_added_toast.title"),closable:!0,icon:t.jsx("div",{className:"ItemAddedToast icon-container",children:t.jsx("img",{src:ba,alt:r("sagas.item.item_added_toast.title")})}),onClose:g,body:t.jsx($,{id:"sagas.item.item_added_toast.body",values:{name:a,br:()=>t.jsx("br",{}),b:p=>t.jsx("strong",{children:p}),"collection-link":p=>t.jsx(te,{to:F.collectionDetail(m),children:t.jsx(d.Button,{className:"ItemAddedToast view-collection-link",basic:!0,children:p})})}})}):null},xa=q.memo(_a),Ea=({collection:i,address:m,hasUserOrphanItems:e,isLoggedIn:s,isReviewing:a,onOpenModal:n,onDeleteCollection:l})=>{var I,u;const o=ve(),h=_e(),g=((I=o.state)==null?void 0:I.fromParam)===Ae.COLLECTIONS,p=((u=o.state)==null?void 0:u.fromParam)===Ae.TP_COLLECTIONS,E=b.useCallback(()=>{h.push(F.collections())},[h]),w=b.useCallback(()=>{if(i&&(g||p)){const N=g?F.collectionDetail:F.thirdPartyCollectionDetail;h.push(N(i.id))}else h.push(F.itemEditor())},[g,p,h,i]),S=b.useCallback(()=>{n("CreateCollectionModal")},[n]),j=b.useCallback(()=>{i&&n("CreateSingleItemModal",{collectionId:i.id})},[i,n]),x=b.useCallback(()=>{i&&n("AddExistingItemModal",{collectionId:i.id})},[i,n]),f=b.useCallback(()=>{i&&n("EditCollectionNameModal",{collection:i})},[i,n]),T=b.useCallback(()=>{i&&l(i)},[i,l]),R=b.useCallback(()=>{const N=i&&Vt(i.owner,m||"");return i?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`block ${g||p?"close":"back"}`,onClick:w}),t.jsxs("div",{className:"title",children:[t.jsx(te,{to:F.collectionDetail(i.id),children:i.name}),t.jsx(at,{collection:i})]}),N&&!i.isPublished?t.jsx(d.Dropdown,{trigger:t.jsx("div",{className:"block actions"}),inline:!0,direction:"left",children:t.jsxs(d.Dropdown.Menu,{children:[t.jsx(d.Dropdown.Item,{onClick:f,children:r("item_editor.left_panel.actions.edit_name")}),t.jsx(d.Dropdown.Item,{onClick:j,children:r("item_editor.left_panel.actions.new_item")}),e&&t.jsx(d.Dropdown.Item,{onClick:x,children:r("item_editor.left_panel.actions.add_existing_item")}),t.jsx(st,{name:i.name,onDelete:T,trigger:t.jsx(d.Dropdown.Item,{text:r("global.delete")})})]})}):null]}):null},[i,m,e,g,p]),M=b.useCallback(()=>t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"block close",onClick:E}),t.jsx("div",{className:"title",children:e?r("item_editor.left_panel.title"):r("item_editor.left_panel.title_alternative")}),s?t.jsx(d.Dropdown,{trigger:t.jsx("div",{className:"block add"}),inline:!0,direction:"left",children:t.jsx(d.Dropdown.Menu,{children:t.jsx(d.Dropdown.Item,{onClick:S,children:r("item_editor.left_panel.actions.new_collection")})})}):t.jsx("div",{className:"block"})]}),[e,s]);return a?null:t.jsx(d.Row,{grow:!1,shrink:!1,className:"Header",children:i?R():M()})},va=()=>{const i=oe();return C(m=>i?Ee(m,i):null)},ja=()=>{const i=se(),m=C(ae),e=C(Ut),s=Te(),a=C(je),n=va(),l=C(p=>!!(n&&m&&$e(p,m,n))),o=b.useCallback((p,E)=>i(Ge(p,E)),[i]),h=b.useCallback(p=>i($t(p)),[i]),g=b.useCallback(p=>i(Ye(p)),[i]);return t.jsx(Ea,{address:m,collection:n??void 0,isLoggedIn:e,isReviewing:s,onOpenModal:o,onDeleteCollection:h,onDeleteItem:g,hasEditRights:l,hasUserOrphanItems:a})},B=10;class W extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{isCollapsed:!1});c(this,"handleToggle",()=>{this.setState({isCollapsed:!this.state.isCollapsed})})}render(){const{label:e,children:s}=this.props,{isCollapsed:a}=this.state,n=!a;return t.jsxs("div",{className:`Collapsable ${n?"is-open":""}`.trim(),children:[t.jsxs("div",{className:"header",onClick:this.handleToggle,children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"handle"})]}),t.jsx("div",{className:"content",children:n?s:null})]})}}class Sa extends b.PureComponent{constructor(){super(...arguments);c(this,"handleClick",()=>{const{item:e,onClick:s}=this.props;s(e)})}renderToggleItem(){const{item:e,isVisible:s,isPlayingEmote:a}=this.props;return ee(e)?t.jsx(d.Icon,{className:"toggle-emote",name:s&&a?"pause":"play",onClick:this.handleClick}):t.jsx("div",{className:`toggle ${s?"is-visible":"is-hidden"}`,onClick:this.handleClick})}render(){const{item:e,isSelected:s,selectedCollectionId:a,bodyShape:n}=this.props;return t.jsx("div",{className:`SidebarItem ${s?"is-selected":""}`,children:t.jsxs(te,{to:F.itemEditor({itemId:e.id,collectionId:a||void 0,newItem:void 0}),children:[t.jsx(pe,{item:e}),t.jsxs("div",{className:"name",children:[t.jsx(Gt,{item:e}),e.name]}),t.jsx(d.Popup,{content:r("item_editor.left_panel.invalid_representation_tooltip",{bodyShape:t.jsx("b",{children:r(`body_shapes.${ue(e)}`).toLowerCase()})}),disabled:Je(e,n),position:"top center",trigger:this.renderToggleItem()})]})})}}var A=(i=>(i.TO_REVIEW="to-review",i.REVIEWED="reviewed",i.ALL_ITEMS="all-items",i))(A||{});const fa={[A.TO_REVIEW]:1,[A.REVIEWED]:1,[A.ALL_ITEMS]:1};class Ta extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{currentTab:A.TO_REVIEW,currentPages:fa,reviewedTabPage:1,showGetMoreSamplesModal:!1,showAllItemsTabChangeModal:!1});c(this,"analytics",Se());c(this,"handleReviewItemsTrigger",e=>{const{items:s,onReviewItems:a}=this.props,{currentTab:n}=this.state;this.getIsReviewingTPItems()&&n===A.TO_REVIEW&&!ze(s,e==null?void 0:e.items)&&a()});c(this,"isVisible",e=>{const{visibleItems:s}=this.props;return s.some(a=>a.id===e.id)});c(this,"handleClick",e=>{var g;const{bodyShape:s,visibleItems:a,wearableController:n,isPlayingEmote:l,onSetItems:o}=this.props;if(!Je(e,s))return;let h=a.filter(p=>p.id!==e.id);if(ee(e))if(this.isVisible(e)){l?n==null||n.emote.pause():n==null||n.emote.play();return}else h=h.filter(p=>p.type!==L.EMOTE);this.isVisible(e)||(h.push(e),(g=this.analytics)==null||g.track("Preview Item",{ITEM_ID:e!=null&&e.urn?z(e.urn)?qe(e.urn):Ce(e.urn):null,ITEM_TYPE:e.type,ITEM_NAME:e.name,ITEM_IS_THIRD_PARTY:z(e.urn)})),o(h)});c(this,"handleTabChange",e=>{const{onLoadPage:s,onReviewItems:a,onResetReviewedItems:n}=this.props,{currentPages:l}=this.state;e===A.ALL_ITEMS?this.setState({showAllItemsTabChangeModal:!1},()=>{n(),s(l[A.ALL_ITEMS])}):e===A.TO_REVIEW&&a(),this.setState({currentTab:e})});c(this,"handleGetRandomSampleClick",()=>{const{showSamplesModalAgain:e,onLoadRandomPage:s}=this.props;e?this.setState({showGetMoreSamplesModal:!0}):s()});c(this,"handleModalProceed",()=>{const{onLoadRandomPage:e}=this.props;e(),this.setState({showGetMoreSamplesModal:!1})});c(this,"handlePageChange",(e,s)=>{const{currentTab:a}=this.state,{onLoadPage:n}=this.props;this.setState(l=>({currentPages:{...l.currentPages,[a]:+s.activePage}})),a!==A.REVIEWED&&n(+s.activePage)});c(this,"handleSwitchToAllItemsTab",()=>{const{reviewedItems:e}=this.props;e.length>0?this.setState({showAllItemsTabChangeModal:!0}):this.handleTabChange(A.ALL_ITEMS)});c(this,"getIsReviewingTPItems",()=>{const{collection:e,isReviewing:s}=this.props;return e?z(e.urn)&&s:!1});c(this,"renderSidebarItem",e=>{const{collection:s,selectedItemId:a,bodyShape:n,isPlayingEmote:l}=this.props;return t.jsx(Sa,{item:e,isSelected:a===e.id,isVisible:this.isVisible(e),isPlayingEmote:l,selectedCollectionId:(s==null?void 0:s.id)??null,bodyShape:n,onClick:this.handleClick},e.id)});c(this,"renderSidebarCategory",e=>{const s=e.filter(Ie),a=e.filter(ee);return e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:r("item_editor.left_panel.empty_collection")})}):s.length===0||a.length===0?e.map(this.renderSidebarItem):t.jsxs(t.Fragment,{children:[t.jsx(W,{label:this.renderCollapsableLabel(L.WEARABLE),children:s.map(this.renderSidebarItem)}),t.jsx(W,{label:this.renderCollapsableLabel(L.EMOTE),children:a.map(this.renderSidebarItem)})]})});c(this,"renderTabPagination",e=>{const{currentTab:s,currentPages:a}=this.state,n=a[s],l=Math.ceil(e/B);return l>1?t.jsx(d.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:l,activePage:n,onPageChange:this.handlePageChange}):null});c(this,"renderPaginationStats",e=>{const{currentPages:s,currentTab:a}=this.state,n=s[a],l=(n-1)*B,o=n*B;return t.jsx(d.Header,{sub:!0,children:r("item_editor.left_panel.reviewed_tab.page_counter",{pageStart:l,pageEnd:o>e?e:o,total:e})})});c(this,"renderTabContent",()=>{const{items:e,isLoading:s,totalItems:a,reviewedItems:n}=this.props,{currentTab:l,currentPages:o}=this.state,h=this.getIsReviewingTPItems(),g=o[l];if(s)return t.jsx(d.Loader,{size:"large",active:!0});switch(l){case A.TO_REVIEW:return t.jsxs(t.Fragment,{children:[this.renderSidebarCategory(e),!h&&a?this.renderTabPagination(a):null]});case A.REVIEWED:{const p=n.slice((g-1)*B,g*B);return t.jsxs(t.Fragment,{children:[n.length?this.renderPaginationStats(n.length):null,this.renderSidebarCategory(p),n.length?this.renderTabPagination(n.length):null]})}case A.ALL_ITEMS:return t.jsxs(t.Fragment,{children:[e.length&&a?this.renderPaginationStats(a):null,this.renderSidebarCategory(e),e.length&&a?this.renderTabPagination(a):null]});default:return null}});c(this,"renderTabHeader",()=>{const{isLoading:e,totalItems:s,reviewedItems:a}=this.props,{currentTab:n}=this.state;let l;const o=!s||s<B||a.length===s;switch(n){case A.TO_REVIEW:l=t.jsx(d.Popup,{content:r("item_editor.top_panel.not_enough_items_to_curate_more"),disabled:!o,position:"bottom center",trigger:t.jsx("div",{children:t.jsxs(d.Button,{disabled:e||o,primary:!0,className:"random-sample-button",onClick:this.handleGetRandomSampleClick,children:[t.jsx(d.Icon,{name:"random"}),r("item_editor.left_panel.get_random_sample")]})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0});break;case A.REVIEWED:l=t.jsx($,{id:"item_editor.left_panel.reviewed_samples",values:{reviewed_samples_bold:t.jsx("b",{children:r("item_editor.left_panel.reviewed_samples_bold",{count:a.length})}),total:K(s??1)}});break;default:return null}return t.jsxs("div",{className:"tab-header",children:[" ",l," "]})});c(this,"renderModal",()=>{const{onToggleShowSamplesModalAgain:e,showSamplesModalAgain:s}=this.props,{showGetMoreSamplesModal:a}=this.state;return t.jsxs(d.Modal,{open:a,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(d.Modal.Header,{children:r("item_editor.left_panel.get_more_samples_modal.title")}),t.jsxs(d.Modal.Content,{children:[t.jsx($,{id:"item_editor.left_panel.get_more_samples_modal.content",values:{count:10,tabName:t.jsx("b",{children:A.REVIEWED})}}),t.jsxs("div",{className:"checkbox-container",onClick:e,children:[t.jsx(d.Checkbox,{checked:!s}),r("item_editor.left_panel.get_more_samples_modal.dont_show_again")]})]}),t.jsxs(d.Modal.Actions,{children:[t.jsx(d.Button,{onClick:()=>this.setState({showGetMoreSamplesModal:!1}),children:r("global.cancel")}),t.jsx(d.Button,{primary:!0,onClick:this.handleModalProceed,children:r("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});c(this,"renderAllItemsTabChangeModal",()=>{const{showAllItemsTabChangeModal:e}=this.state;return t.jsxs(d.Modal,{open:e,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(d.Modal.Header,{children:r("item_editor.left_panel.all_items_check.title")}),t.jsx(d.Modal.Content,{children:r("item_editor.left_panel.all_items_check.content")}),t.jsxs(d.Modal.Actions,{children:[t.jsx(d.Button,{onClick:()=>this.setState({showAllItemsTabChangeModal:!1}),children:r("global.cancel")}),t.jsx(d.Button,{primary:!0,onClick:()=>this.handleTabChange(A.ALL_ITEMS),children:r("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});c(this,"renderTabs",()=>{const{currentTab:e}=this.state;return t.jsxs(d.Tabs,{isFullscreen:!0,children:[t.jsx(d.Tabs.Tab,{active:e===A.TO_REVIEW,onClick:()=>this.handleTabChange(A.TO_REVIEW),children:r("item_editor.left_panel.to_review")}),t.jsx(d.Tabs.Tab,{active:e===A.REVIEWED,onClick:()=>this.handleTabChange(A.REVIEWED),children:r("item_editor.left_panel.reviewed")}),t.jsx(d.Tabs.Tab,{active:e===A.ALL_ITEMS,onClick:this.handleSwitchToAllItemsTab,children:r("item_editor.left_panel.all_items")})]})})}componentDidMount(){this.handleReviewItemsTrigger()}componentDidUpdate(e){this.handleReviewItemsTrigger(e)}renderCollapsableLabel(e){return t.jsxs(t.Fragment,{children:[t.jsx(V,{name:e}),t.jsx($,{id:`item_editor.left_panel.${e}`})]})}render(){return t.jsxs(d.Section,{className:"Items",children:[this.getIsReviewingTPItems()?t.jsxs(t.Fragment,{children:[this.renderTabs(),this.renderTabHeader()]}):null,this.renderTabContent(),this.renderModal(),this.renderAllItemsTabChangeModal()]})}}class wa extends b.PureComponent{render(){const{collection:m,isSelected:e}=this.props;return t.jsx("div",{className:`SidebarCollection ${e?"is-selected":""}`,children:t.jsxs(te,{to:F.itemEditor({collectionId:m.id}),children:[t.jsx(Yt,{collectionId:m.id}),t.jsxs("div",{className:"wrapper",children:[t.jsxs("div",{className:"name",children:[t.jsx(at,{collection:m}),m.name]}),t.jsx("div",{className:"count",children:r("item_editor.left_panel.items_count",{count:m.itemCount})})]})]})})}}class ya extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{currentPage:1});c(this,"handlePageChange",(e,s)=>{const{onLoadPage:a}=this.props;this.setState({currentPage:+s.activePage}),a(+s.activePage)})}render(){const{collections:e,isLoading:s,items:a,selectedCollectionId:n,totalCollections:l}=this.props,{currentPage:o}=this.state;if(e.length===0)return null;const h=Math.ceil(l/B);return s?t.jsx(d.Loader,{size:"small",active:!0}):!s&&a.length===0&&e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:r("collections_page.empty_description")})}):t.jsx(t.Fragment,{children:t.jsxs(d.Section,{className:"Collections",children:[e.map(g=>t.jsx(wa,{collection:g,items:a,isSelected:g.id===n},g.id)),h>1?t.jsx(d.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:h,activePage:o,onPageChange:this.handlePageChange}):null]})})}}var J=(i=>(i.COLLECTIONS="collections",i.ORPHAN_ITEMS="orphanItems",i))(J||{});const Y=1;let Pa=class extends b.PureComponent{constructor(){super(...arguments);c(this,"state",this.getInitialState());c(this,"handleToggleShowSamplesModalAgain",()=>{this.setState(e=>({showSamplesModalAgain:!e.showSamplesModalAgain}))});c(this,"fetchResource",()=>{const{address:e,onFetchCollections:s,onFetchOrphanItems:a,isReviewing:n,selectedCollectionId:l}=this.props,{pages:o}=this.state;if(e&&!n&&!l){const h=o[o.length-1];(this.isCollectionTabActive()?s:a)(e,{limit:B,page:h})}});c(this,"loadPage",e=>{this.setState({pages:[e]},()=>this.fetchResource())});c(this,"getRandomPage",(e,s)=>Math.floor(Math.random()*(s-e+1)+e));c(this,"loadRandomPage",e=>{const{pages:s}=this.state,{totalItems:a,totalCollections:n,onSetReviewedItems:l}=this.props,o=this.isCollectionTabActive()?n:a,h=Math.ceil(o/B);if(h>s.length){const g=[...Array(h).keys()].map(p=>p+1).filter(p=>!s.includes(p));if(g.length>0){const p=g[Math.floor(Math.random()*g.length)];this.setState(E=>({pages:[...E.pages,p]}),this.fetchResource)}}l(e)});c(this,"handleTabChange",e=>{this.setState({currentTab:e,pages:[Y]},this.fetchResource)});c(this,"isCollectionTabActive",()=>{const{selectedCollectionId:e}=this.props,{currentTab:s}=this.state;return s===J.COLLECTIONS&&!e})}getInitialState(){const{selectedCollectionId:e,selectedItemId:s}=this.props;let a=J.COLLECTIONS;return!e&&s&&(a=J.ORPHAN_ITEMS),{pages:[Y],currentTab:a,initialPage:Y,showSamplesModalAgain:!0}}componentDidMount(){const{address:e,hasUserOrphanItems:s,selectedItem:a,onFetchOrphanItem:n,onSetItems:l}=this.props;this.fetchResource(),e&&s===void 0&&n(e),a&&l([a])}componentDidUpdate(e,s){const{isConnected:a,address:n,selectedCollectionId:l,selectedItemId:o,selectedItem:h,orphanItems:g,totalItems:p,visibleItems:E,hasUserOrphanItems:w,onSetItems:S,onFetchOrphanItem:j}=this.props,{initialPage:x,pages:f}=this.state;if(!l&&n&&o&&p&&(x===Y||s.initialPage<x)){if(!g.find(T=>T.id===o)){const T=Math.ceil(p/B),R=f[f.length-1],M=Math.min(T,R+1);f.includes(M)||this.setState({pages:[M],initialPage:M},this.fetchResource)}}else if(e.selectedItemId&&o&&e.selectedItemId!==o){const T=E.filter(R=>R.type!==L.EMOTE);S(T)}else n&&a&&(a!==e.isConnected||e.selectedCollectionId&&!l)&&this.setState({pages:[Y]},this.fetchResource),e.selectedCollectionId!==l&&this.setState({pages:[Y]}),n&&n!==e.address&&w===void 0&&j(n);!e.selectedItem&&h&&h.type!==L.EMOTE&&S([h]),e.selectedCollectionId!==l&&S([])}componentWillUnmount(){const{onSetItems:e}=this.props;e([])}getItems(e,s,a){const{selectedCollectionId:n,orphanItems:l,isReviewing:o}=this.props;return n&&e?Jt(e)&&o?s.filter(h=>!!(a!=null&&a.find(g=>g.itemId===h.id&&g.status===X.PENDING))):s:l}render(){const{items:e,totalItems:s,totalCollections:a,collections:n,selectedItemId:l,selectedCollectionId:o,visibleItems:h,bodyShape:g,reviewedItems:p,isReviewing:E,isPlayingEmote:w,isConnected:S,wearableController:j,isLoading:x,hasUserOrphanItems:f,onSetItems:T,onSetReviewedItems:R,onResetReviewedItems:M}=this.props,{pages:I,showSamplesModalAgain:u}=this.state,N=!o&&f,k=this.isCollectionTabActive()&&!o,_=!this.isCollectionTabActive()||o;return t.jsx("div",{className:"LeftPanel",children:S?t.jsx(ea,{id:o,itemSelected:l,itemsPage:I,itemsPageSize:B,fetchCollectionItemsOptions:{status:E?X.PENDING:void 0},onChangePage:v=>this.setState({pages:[v]}),children:({paginatedCollections:v,collection:O,paginatedItems:re,initialPage:lt,isLoadingCollection:ot,isLoadingCollectionItems:rt,itemCurations:dt})=>{const Z=this.getItems(O,re,dt),ye=this.isCollectionTabActive(),ct=o&&O?lt:this.state.initialPage;return t.jsxs(t.Fragment,{children:[t.jsx(ja,{}),N?t.jsxs(d.Tabs,{isFullscreen:!0,children:[t.jsx(d.Tabs.Tab,{active:ye,onClick:()=>this.handleTabChange(J.COLLECTIONS),children:r("collections_page.collections")}),t.jsx(d.Tabs.Tab,{active:!ye,onClick:()=>this.handleTabChange(J.ORPHAN_ITEMS),children:r("item_editor.left_panel.items")})]}):null,k?t.jsx(ya,{collections:v,totalCollections:a||n.length,items:e,hasHeader:Z.length>0,selectedCollectionId:o,onLoadPage:this.loadPage,isLoading:ot}):null,_?t.jsxs(t.Fragment,{children:[t.jsx(Ta,{items:Z,totalItems:s||Z.length,hasHeader:!o&&n.length>0,selectedItemId:l,collection:O,isReviewing:E,isPlayingEmote:w,visibleItems:h,bodyShape:g,onResetReviewedItems:M,reviewedItems:p,onSetItems:T,wearableController:j,initialPage:ct,isLoading:rt||x,onToggleShowSamplesModalAgain:this.handleToggleShowSamplesModalAgain,showSamplesModalAgain:u,onReviewItems:()=>R(Z),onLoadRandomPage:()=>this.loadRandomPage(Z),onLoadPage:this.loadPage}),t.jsx(xa,{collectionId:o})]}):null]})}}):null})}};const Aa=i=>{const m=se(),e=oe(),s=we(),a=Te(),n=nt(),l=C(_=>ae(_)),o=C(_=>xe(_)),h=C(_=>zt(_)),g=C(_=>qt(_)),p=C(_=>Ze(_)),E=C(_=>Ke(_)),w=C(_=>Qe(_)),S=C(_=>je(_)),j=C(_=>Ue(_)),x=C(_=>s?fe(_,s):null),f=C(_=>{if(e)return ge(_,e);if(l)return ge(_,l)}),T=C(_=>e?void 0:Zt(_)),R=C(_=>l&&!e?Kt(_,l,f==null?void 0:f.limit):Qt(_)),M=b.useMemo(()=>G(j,ts)||G(j,ss),[j]),I=b.useCallback(_=>m(Xe(_)),[m]),u=b.useCallback((_,v)=>m(Xt(_,v)),[m]),N=b.useCallback((_,v)=>m(et(_,v)),[m]),k=b.useCallback(_=>m(es(_)),[m]);return t.jsx(Pa,{...i,address:l,isConnected:o,items:h,totalItems:(f==null?void 0:f.total)||null,totalCollections:(T==null?void 0:T.total)||null,orphanItems:R,collections:g,selectedItemId:s,selectedItem:x,selectedCollectionId:e,visibleItems:n,bodyShape:p,wearableController:E,isReviewing:a,isLoading:M,isPlayingEmote:w,hasUserOrphanItems:S,onSetItems:I,onFetchCollections:u,onFetchOrphanItems:N,onFetchOrphanItem:k})},Na=Aa;var Q=(i=>(i[i.ZOOM_IN=0]="ZOOM_IN",i[i.ZOOM_OUT=1]="ZOOM_OUT",i[i.PAN_CAMERA_Y=2]="PAN_CAMERA_Y",i[i.CHANGE_CAMERA_ALPHA=3]="CHANGE_CAMERA_ALPHA",i))(Q||{});class me extends q.PureComponent{constructor(){super(...arguments);c(this,"handleAvatarColorChange",(e,s)=>{const{currentColor:a,colors:n,onChange:l}=this.props;if(a.toHexString()!==s.value){const o=n.find(h=>h.toHexString()===s.value);l(o)}});c(this,"renderItem",(e,s)=>{const a=e.toHexString();return t.jsx(d.Dropdown.Item,{value:a,onClick:this.handleAvatarColorChange,children:t.jsx("i",{className:"color",style:{background:a}})},s)})}render(){const{currentColor:e,colors:s,label:a}=this.props,n=e.toHexString();return t.jsx(d.Dropdown,{inline:!0,direction:"right",className:"AvatarColorDropdown Select",value:n,trigger:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:a}),t.jsx("div",{className:"value",children:t.jsx("i",{className:"color",style:{background:n}})}),t.jsx("div",{className:"handle"})]}),children:t.jsx(d.Dropdown.Menu,{className:"colors-menu",children:s.map(this.renderItem)})})}}let Ra=class extends q.PureComponent{constructor(){super(...arguments);c(this,"handleAvatarChangeWearable",(e,s)=>{const{wearable:a,category:n,bodyShape:l,onChange:o,baseWearables:h}=this.props,g=s.value?h.find(p=>p.id===s.value):null;a!==g&&o(n,l,g??null)})}render(){const{wearable:e,bodyShape:s,category:a,label:n,isNullable:l,baseWearables:o}=this.props,h=as(o,a,s).map(p=>({value:p.id,text:ns(p)}));l&&h.push({value:"",text:r("global.none")});const g=e?h.find(p=>p.value===e.id):null;return t.jsx(d.Dropdown,{inline:!0,direction:"right",className:"AvatarWearableDropdown Select",value:e?e.id:"",options:h,scrolling:!0,onChange:this.handleAvatarChangeWearable,trigger:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:n}),t.jsx("div",{className:"value",children:g?g.text:r("global.none")}),t.jsx("div",{className:"handle"})]})})}};const Ma=i=>({baseWearables:is(i)}),ne=He(Ma)(Ra);let Da=class extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{showSceneBoundaries:!1,isShowingAvatarAttributes:!1,isLoading:!1});c(this,"analytics",Se());c(this,"handleToggleShowingAvatarAttributes",()=>{this.setState({isShowingAvatarAttributes:!this.state.isShowingAvatarAttributes})});c(this,"handleBodyShapeChange",(e,{value:s})=>{const{onSetBodyShape:a}=this.props;a(s)});c(this,"handleAnimationChange",(e,{value:s})=>{const{emotes:a,visibleItems:n,onSetAvatarAnimation:l,onSetItems:o}=this.props,h=a.find(p=>p.id===s),g=n.filter(p=>p.type!==L.EMOTE);g.forEach(p=>{var E;(E=this.analytics)==null||E.track("Play Emote",{EMOTE_PLAYED_BASE:!h,EMOTE_PLAYED_ITEM_ID:h!=null&&h.urn?Ce(h.urn):null,EMOTE_PLAYED_NAME:h?h.name:s,PREVIEWED_WEARABLE_ITEM_ID:p!=null&&p.urn?z(p.urn)?qe(p.urn):Ce(p.urn):null,PREVIEWED_WEARABLE_NAME:p.name})}),h?g.push(h):l(s),o(g)});c(this,"handleSkinColorChange",e=>{const{onSetSkinColor:s}=this.props;s(e)});c(this,"handleEyeColorChange",e=>{const{onSetEyeColor:s}=this.props;s(e)});c(this,"handleHairColorChange",e=>{const{onSetHairColor:s}=this.props;s(e)});c(this,"handleWearableChange",(e,s,a)=>{const{onSetBaseWearable:n}=this.props;n(e,s,a)});c(this,"handleWearablePreviewLoad",()=>{const{wearableController:e,onSetWearablePreviewController:s}=this.props;e||s(Ne.createController("wearable-editor")),this.setState({isLoading:!1})});c(this,"handleControlActionChange",async e=>{const{wearableController:s}=this.props,a=.1;if(s)switch(await(s==null?void 0:s.emote.pause()),e){case Q.ZOOM_IN:{await(s==null?void 0:s.scene.changeZoom(a));break}case Q.ZOOM_OUT:{await(s==null?void 0:s.scene.changeZoom(-a));break}}});c(this,"handlePlayEmote",()=>{const{wearableController:e,isPlayingEmote:s,visibleItems:a,onSetAvatarAnimation:n,onSetItems:l}=this.props,o=a.filter(h=>h.type!==L.EMOTE);s?(n(P.PreviewEmote.IDLE),l(o)):e==null||e.emote.play()});c(this,"renderEmotePlayButton",()=>{const{isPlayingEmote:e}=this.props,s=e?"stop":"play",a=e?r("item_editor.center_panel.stop"):r("item_editor.center_panel.play_emote");return t.jsxs(d.Button,{icon:!0,onClick:this.handlePlayEmote,children:[t.jsx(d.Icon,{name:s}),t.jsx("span",{children:a})]})});c(this,"renderEmoteDropdownButton",()=>{const{collection:e,emotes:s,isPlayingEmote:a}=this.props,n=!!e,l=s.length>0;return a?null:t.jsx(d.Dropdown,{className:"avatar-animation button icon",floating:!0,scrolling:!0,children:t.jsxs(d.Dropdown.Menu,{children:[l&&t.jsxs(t.Fragment,{children:[t.jsx(d.Dropdown.Header,{content:n?r("item_editor.center_panel.from_collection"):r("item_editor.center_panel.from_items")}),t.jsx(d.Dropdown.Divider,{}),s.map(o=>t.jsx(d.Dropdown.Item,{value:o.id,text:o.name,onClick:this.handleAnimationChange},o.id)),t.jsx(d.Dropdown.Divider,{}),t.jsx(d.Dropdown.Header,{content:r("item_editor.center_panel.default")}),t.jsx(d.Dropdown.Divider,{})]}),P.PreviewEmote.schema.enum.map(o=>t.jsx(d.Dropdown.Item,{value:o,text:r(`emotes.${o}`),onClick:this.handleAnimationChange},o))]})})});c(this,"renderEmoteSelector",()=>t.jsx(d.Popup,{content:r("item_editor.center_panel.disabled_animation_dropdown"),disabled:!0,position:"top center",trigger:t.jsx("div",{className:"avatar-animation-dropdown-wrapper option",children:t.jsxs(d.Button.Group,{children:[this.renderEmotePlayButton(),this.renderEmoteDropdownButton()]})})}))}componentDidMount(){const{address:e,collection:s,emotes:a,selectedBaseWearables:n,hasUserOrphanItems:l,onFetchBaseWearables:o,onFetchOrphanItems:h,onFetchCollectionItems:g}=this.props,p=a.length>0;n||o(),p||(s&&!H(s)?g(s.id):e&&l&&h(e)),this.setState({isLoading:!0})}componentWillUnmount(){const{onSetWearablePreviewController:e}=this.props;e(null)}renderSelectTrigger(e,s){return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"value",children:s}),t.jsx("div",{className:"handle"})]})}getDropdownAttributes(e,s,a){const n=s.find(l=>l.value===e);return{value:e,options:s,trigger:this.renderSelectTrigger(a,n?n.text:"")}}render(){const{bodyShape:e,skinColor:s,eyeColor:a,hairColor:n,emote:l,selectedBaseWearables:o,selectedItem:h,visibleItems:g,isImportFilesModalOpen:p,wearableController:E}=this.props,{isShowingAvatarAttributes:w,showSceneBoundaries:S,isLoading:j}=this.state,x=g.some(ee)&&(h==null?void 0:h.type)===L.EMOTE,f=l===P.PreviewEmote.JUMP?1:void 0;return t.jsxs("div",{className:`CenterPanel ${p?"import-files-modal-is-open":""}`,children:[t.jsx(Ne,{id:"wearable-editor",profile:"default",bodyShape:e,emote:l,zoom:f,skin:de(s),eyes:de(a),hair:de(n),urns:o?Object.values(o).map(T=>T?T.id:null).filter(T=>T!==null):[],base64s:g.map(ls),disableAutoRotate:!0,disableBackground:!0,wheelZoom:1.5,wheelStart:100,dev:os,onUpdate:()=>this.setState({isLoading:!0}),onLoad:this.handleWearablePreviewLoad,disableDefaultEmotes:x,showSceneBoundaries:S}),x?t.jsxs("div",{className:"zoom-controls",children:[t.jsx(d.Button,{className:"zoom-control zoom-in-control",onClick:()=>this.handleControlActionChange(Q.ZOOM_IN),children:t.jsx(d.Icon,{name:"plus"})}),t.jsx(d.Button,{className:"zoom-control zoom-out-control",onClick:()=>this.handleControlActionChange(Q.ZOOM_OUT),children:t.jsx(d.Icon,{name:"minus"})})]}):null,j&&t.jsx(d.Center,{children:t.jsx(d.Loader,{active:!0})}),t.jsxs("div",{className:"footer",children:[x&&!j&&E?t.jsx("div",{className:"emote-controls-container",children:t.jsx(rs,{className:"emote-controls",wearablePreviewId:"wearable-editor",wearablePreviewController:E})}):null,t.jsxs("div",{className:"options",children:[t.jsx("div",{className:`option ${w?"active":""}`,onClick:this.handleToggleShowingAvatarAttributes,children:t.jsx(d.Icon,{name:"user"})}),x?null:this.renderEmoteSelector(),t.jsx("div",{className:`option ${S?"active":""}`,children:t.jsx(V,{name:"cylinder",onClick:()=>this.setState(T=>({showSceneBoundaries:!T.showSceneBoundaries}))})})]}),t.jsxs("div",{className:`avatar-attributes ${w?"active":""}`,children:[t.jsx("div",{className:"dropdown-container",children:t.jsx(d.Dropdown,{inline:!0,direction:"right",className:"Select",onChange:this.handleBodyShapeChange,...this.getDropdownAttributes(e,[{value:P.BodyShape.MALE,text:r("body_shapes.male")},{value:P.BodyShape.FEMALE,text:r("body_shapes.female")}],r("wearable.category.body_shape"))})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(me,{currentColor:s,colors:ds(),label:r("wearable.color.skin"),onChange:this.handleSkinColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(me,{currentColor:a,colors:cs(),label:r("wearable.color.eye"),onChange:this.handleEyeColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(me,{currentColor:n,colors:hs(),label:r("wearable.color.hair"),onChange:this.handleHairColorChange})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.HAIR],category:P.WearableCategory.HAIR,bodyShape:e,label:r("wearable.category.hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.FACIAL_HAIR],category:P.WearableCategory.FACIAL_HAIR,bodyShape:e,label:r("wearable.category.facial_hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.UPPER_BODY],category:P.WearableCategory.UPPER_BODY,bodyShape:e,label:r("wearable.category.upper_body"),onChange:this.handleWearableChange})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.LOWER_BODY],category:P.WearableCategory.LOWER_BODY,bodyShape:e,label:r("wearable.category.lower_body"),onChange:this.handleWearableChange})})]})]})]})}};const La=()=>{const i=se(),m=C(ae),e=C(Ze),s=C(ms),a=C(gs),n=C(ps),l=C(us),o=C(Cs),h=nt(),g=C(Ke),p=C(Is),E=C(Qe),w=C(bs),S=C(je),j=C(_s),x=oe(),f=we(),T=C(v=>f?fe(v,f):null),R=b.useMemo(()=>x?j.find(v=>v.id===x):void 0,[j,x]),M=b.useMemo(()=>x?p.filter(v=>v.collectionId===x):p.filter(v=>!v.collectionId),[p,x]),I=o?o[e]:null,N=b.useMemo(()=>!h.some(ee)&&l===P.PreviewEmote.IDLE,[h,l])?!1:E,k="CreateSingleItemModal"in w,_=b.useMemo(()=>({onSetBodyShape:v=>{i(xs(v))},onSetAvatarAnimation:v=>{i(Es(v))},onSetSkinColor:v=>{i(vs(v))},onSetEyeColor:v=>{i(js(v))},onSetHairColor:v=>{i(Ss(v))},onSetBaseWearable:(v,O,re)=>{i(fs(v,O,re))},onFetchBaseWearables:()=>{i(Ts())},onSetWearablePreviewController:v=>{i(ws(v))},onSetItems:v=>{i(Xe(v))},onFetchOrphanItems:(v,O)=>{i(et(v,O))},onFetchCollectionItems:(v,O)=>{i(ys(v,O))}}),[i]);return t.jsx(Da,{address:m,bodyShape:e,collection:R,selectedItem:T,selectedBaseWearables:I,skinColor:s,eyeColor:a,hairColor:n,emote:l,visibleItems:h,wearableController:g,emotes:M,isPlayingEmote:N,isImportFilesModalOpen:k,hasUserOrphanItems:S,..._})},Oa=La;class ka extends b.PureComponent{constructor(){super(...arguments);c(this,"handleChange",e=>{const{value:s,maxLength:a,onChange:n}=this.props,l=e.target.value;s!==l&&n(a?l.slice(0,a):l)})}render(){const{label:e,disabled:s,value:a}=this.props;return t.jsxs("div",{className:`Input ${s?"is-disabled":""}`.trim(),children:[t.jsx("div",{className:"label",children:e}),t.jsx("input",{value:a||"",onChange:this.handleChange,disabled:s})]})}}class le extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{value:this.props.value});c(this,"handleChange",(e,s)=>{const{value:a,onChange:n}=this.props,l=s.value;l!==a&&(this.setState({value:l}),n(l))})}componentWillReceiveProps(e){const{itemId:s,value:a}=e;(s!==this.props.itemId||a!==this.state.value)&&this.setState({value:a})}renderTrigger(){const{label:e,options:s}=this.props,{value:a}=this.state,n=s.find(l=>l.value===a);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"value",children:n?n.text:r("item_editor.right_panel.select_placeholder")}),t.jsx("div",{className:"handle"})]})}render(){const{options:e,disabled:s}=this.props,{value:a}=this.state;return t.jsx(d.Dropdown,{className:`Select ${a?"":"blank"}`.trim(),trigger:this.renderTrigger(),inline:!0,direction:"right",scrolling:e.length>4,value:a||void 0,options:e,disabled:s,onChange:this.handleChange})}}c(le,"defaultProps",{disabled:!1});class be extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{value:this.props.value});c(this,"handleChange",(e,s)=>{const{onChange:a}=this.props,{value:n}=this.state,l=s.value,o=[...n];for(const h of l)n.includes(h)||o.push(h);o.length!==n.length&&(this.setState({value:o}),a(o))});c(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(n=>n!==e);this.setState({value:a}),s(a)})}componentWillReceiveProps(e){const{itemId:s,value:a}=e;(s!==this.props.itemId||a!==this.state.value)&&this.setState({value:a})}renderTrigger(){const{label:e,info:s,options:a}=this.props,{value:n}=this.state,l=a.reduce((o,h)=>(o[h.value]=h.text,o),{});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"label",children:[e,s?t.jsx(ie,{content:s,className:"info"}):null]}),t.jsx("div",{className:"values",children:n.length>0?n.map(o=>t.jsxs("div",{className:"value",children:[l[o],t.jsx("div",{className:"remove",onClick:h=>{this.handleRemove(o),h.stopPropagation()}})]},o)):t.jsx("div",{className:"placeholder",children:r("item_editor.right_panel.select_placeholder")})}),t.jsx("div",{className:"handle"})]})}render(){const{options:e,disabled:s}=this.props,{value:a}=this.state;return t.jsx(d.Dropdown,{inline:!0,multiple:!0,className:`MultiSelect ${a.length>0?"":"blank"}`.trim(),trigger:this.renderTrigger(),direction:"right",value:a,scrolling:!1,options:e.filter(n=>!a.includes(n.value)),disabled:s,onChange:this.handleChange,closeOnChange:!0})}}c(be,"defaultProps",{disabled:!1});class it extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{draft:"",value:this.props.value});c(this,"handleChange",e=>{this.setState({draft:e.target.value})});c(this,"handleAdd",()=>{const{onChange:e}=this.props,{draft:s,value:a}=this.state,n=s.trim();if(n!=="")if(a.includes(n))this.setState({draft:""});else{const l=[...a,n];this.setState({value:l,draft:""}),e(l)}});c(this,"handleKeyDown",e=>{if(e.key==="#"){e.preventDefault();return}else if(e.keyCode===Ps||e.keyCode===Re||e.keyCode===As)this.handleAdd();else if(e.keyCode===Ns||e.keyCode===Re){const{draft:s,value:a}=this.state,n=a[a.length-1];n&&s===""&&this.handleRemove(n)}});c(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(n=>n!==e);this.setState({value:a}),s(a)})}componentWillReceiveProps(e){const{itemId:s,value:a}=e;(s!==this.props.itemId||a!==this.state.value)&&this.setState({value:a})}render(){const{isDisabled:e}=this.props,{draft:s,value:a}=this.state;return t.jsx("div",{className:`Tags ${a.length>0?"":"blank"} ${e?"is-disabled":""}`.trim(),children:t.jsxs("div",{className:"values",children:[a.map(n=>t.jsxs("div",{className:"value",children:[n,t.jsx("div",{className:"remove",onClick:l=>{this.handleRemove(n),l.stopPropagation()}})]},n)),t.jsx("input",{value:s,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onBlur:this.handleAdd,disabled:e})]})})}}c(it,"defaultProps",{isDisabled:!1});let Ba=class extends b.PureComponent{constructor(){super(...arguments);c(this,"analytics",Se());c(this,"state",this.getInitialState());c(this,"thumbnailInput",b.createRef());c(this,"handleDeleteItem",()=>{const{onDeleteItem:e}=this.props,{selectedItem:s}=this.props;e(s)});c(this,"handleAddRepresentationToItem",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,addRepresentation:!0})});c(this,"handleChangeItemFile",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,changeItemFile:!0})});c(this,"handleOpenVideoDialog",(e={})=>{const{selectedItem:s,onOpenModal:a}=this.props;a("EditVideoModal",{item:s,onSaveVideo:this.handleSaveVideo,...e})});c(this,"handleSaveVideo",e=>{this.setState({video:URL.createObjectURL(e),contents:{...this.state.contents,[Me]:e},isDirty:!0})});c(this,"handleChangeName",e=>{this.setState({name:e,isDirty:this.isDirty({name:e})})});c(this,"handleChangeDescription",(e,s)=>{const a=s.value??"";this.setState({description:a,isDirty:this.isDirty({description:a})})});c(this,"handleChangeUtility",(e,s)=>{const a=s.value??"";this.setState({utility:a,isDirty:this.isDirty({utility:a})})});c(this,"handleChangeRarity",e=>{this.setState({rarity:e,isDirty:this.isDirty({rarity:e})})});c(this,"handleAllowVrmExport",(e,{checked:s})=>{const a={...this.state.data,blockVrmExport:!s};this.setState({data:a,isDirty:this.isDirty({data:a})})});c(this,"handleAllowOutlineCompatible",(e,{checked:s})=>{const a={...this.state.data,outlineCompatible:s};this.setState({data:a,isDirty:this.isDirty({data:a})})});c(this,"handleChangeCategory",e=>{let s;ce(this.state.data)?s={...this.state.data,category:e}:(s={...this.state.data,category:e},e===P.WearableCategory.SKIN&&(s=this.setReplaces(s,[]),s=this.setHides(s,[]))),this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handlePlayModeChange",e=>{const s={...this.state.data,loop:e===he.LOOP};this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handleChangeReplaces",e=>{const s=this.setReplaces(this.state.data,e);this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handleChangeHides",(e,s)=>{const a=this.state.data.hides;let n=[];s==="wearable"?n=[...a.filter(o=>!P.WearableCategory.schema.enum.includes(o)),...e]:n=[...a.filter(o=>!P.BodyPartCategory.schema.enum.includes(o)),...e];const l=this.setHides(this.state.data,n);this.setState({data:l,isDirty:this.isDirty({data:l})})});c(this,"handleChangeTags",e=>{const s={...this.state.data,tags:e};this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handleOnSaveItem",async()=>{var w,S;const{selectedItem:e,itemStatus:s,onSaveItem:a}=this.props,{name:n,description:l,utility:o,rarity:h,contents:g,data:p,isDirty:E}=this.state;if(E&&e){let j=p;j&&!ce(j)&&(j={...j,removesDefaultHiding:j.category===P.WearableCategory.UPPER_BODY||(w=j.hides)!=null&&w.includes(P.WearableCategory.UPPER_BODY)?[P.BodyPartCategory.HANDS]:[],..."blockVrmExport"in j?{blockVrmExport:j.blockVrmExport}:{},..."outlineCompatible"in j?{outlineCompatible:j.outlineCompatible}:{}});const x={...e.contents,...await Rs(g)},f={...e,name:n,description:l,rarity:h,data:j,contents:x,utility:o??void 0};s&&[De.UNPUBLISHED,De.UNDER_REVIEW].includes(s)&&(f.video=x[Me]),a(f,g),z(f.urn)&&((S=this.analytics)==null||S.track("Edit Item",{contents:g})),this.setState({isDirty:!1}),this.handleOnResetItem()}});c(this,"handleOnResetItem",()=>{const{selectedItem:e}=this.props;e&&this.setItem(e)});c(this,"handleOpenThumbnailDialog",()=>{const{selectedItem:e,onOpenModal:s}=this.props;(e==null?void 0:e.type)===L.EMOTE?s("EditThumbnailModal",{onSaveThumbnail:this.handleEmoteThumbnailChange,item:e}):this.thumbnailInput.current&&this.thumbnailInput.current.click()});c(this,"handleEmoteThumbnailChange",e=>{const s=Ms(e);this.setState({thumbnail:e,contents:{[Le]:s},isDirty:!0})});c(this,"handleThumbnailChange",async e=>{const{files:s}=e.target;if(s&&s.length>0){const a=s[0],n=await Oe(a),l=await Oe(a,1024,1024),o=URL.createObjectURL(n);this.setState({thumbnail:o,contents:{[Le]:l},isDirty:!0})}});c(this,"handleDownloadItem",()=>{const{selectedItemId:e,onDownload:s}=this.props;e&&s(e)})}componentDidMount(){const{selectedItem:e}=this.props;e&&this.setItem(e)}componentDidUpdate(e){const{selectedItemId:s,selectedItem:a}=this.props;e.selectedItemId!==s?a?this.setItem(a):this.setState(this.getInitialState()):a&&(!e.selectedItem||this.hasSavedItem())&&this.setItem(a)}setItem(e){var a;const s=e.data;Ie(e)&&((a=s.replaces)!=null&&a.length)&&(s.hides=s.hides.concat(s.replaces),s.replaces=[]),this.setState({thumbnail:"",video:"",name:e.name,description:e.description,utility:e.utility||"",rarity:e.rarity,data:e.data,hasItem:!0,isDirty:!1})}getInitialState(){return{name:"",description:"",utility:"",thumbnail:"",video:"",rarity:void 0,contents:{},data:void 0,hasItem:!1,isDirty:!1}}setReplaces(e,s){return{...e,replaces:s,representations:e.representations.map(a=>({...a,overrideReplaces:s}))}}setHides(e,s){return{...e,hides:s,representations:e.representations.map(a=>({...a,overrideHides:s}))}}canEditItemMetadata(e){const{collection:s,canEditSelectedItem:a}=this.props;return!e||s&&ke(s)?!1:a}isSkin(){const{data:e}=this.state;return(e==null?void 0:e.category)===P.WearableCategory.SKIN}isDirty(e={}){const{selectedItem:s}=this.props,{hasItem:a}=this.state;return a?this.hasStateItemChanged({...this.state,...e},s):!1}hasSavedItem(){const{selectedItem:e}=this.props,{isDirty:s}=this.state;return e&&!s&&this.hasStateItemChanged(this.state,e)}hasStateItemChanged(e,s){return e.name!==s.name||e.description!==s.description||e.utility!==s.utility||e.rarity!==s.rarity||!ze(e.data,s.data)}asCategorySelect(e,s){return s.map(a=>({value:a,text:r(`${e}.category.${a}`)}))}asRaritySelect(e){return e.map(s=>({value:s,text:r(`wearable.rarity.${s}`)}))}asPlayModeSelect(e){return e.map(s=>({value:s,text:r(`emote.play_mode.${s}.text`),description:r(`emote.play_mode.${s}.description`)}))}renderOverrides(e){const s=this.canEditItemMetadata(e),a=this.state.data;if(!e||ce(a))return null;const n=Ds(e.contents,a.category),l=Ls(e.contents),o=a.hides.filter(g=>n.includes(g)),h=a.hides.filter(g=>l.includes(g));return t.jsxs(t.Fragment,{children:[t.jsx(be,{itemId:e.id,label:r("item_editor.right_panel.base_body"),info:r("item_editor.right_panel.base_body_info"),value:h,options:this.asCategorySelect(e.type,l),disabled:!s,onChange:g=>this.handleChangeHides(g,"bodypart")}),t.jsx(be,{itemId:e.id,label:r("item_editor.right_panel.wearables"),info:r("item_editor.right_panel.wearables_info"),value:o,options:this.asCategorySelect(e.type,o.some(g=>g===P.WearableCategory.BODY_SHAPE)?n:n.filter(g=>g!==P.WearableCategory.BODY_SHAPE)),disabled:!s,onChange:g=>this.handleChangeHides(g,"wearable")})]})}renderModelDetails(e){const{isDownloading:s}=this.props,{thumbnail:a}=this.state,n=this.canEditItemMetadata(e),l=s?t.jsx(d.Loader,{active:!0,size:"tiny",className:"donwload-item-loader"}):t.jsx(V,{name:"export",className:"download-item-button",onClick:this.handleDownloadItem});return t.jsxs("div",{className:"details",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(V,{name:"edit",className:"edit-item-file",onClick:this.handleChangeItemFile}),l,t.jsxs("div",{className:"thumbnail-container",children:[t.jsx(pe,{item:e,src:a,hasBadge:!0,badgeSize:"small"}),t.jsxs("div",{className:"thumbnail-edit-container",children:[t.jsx("input",{type:"file",ref:this.thumbnailInput,onChange:this.handleThumbnailChange,accept:"image/png"}),t.jsx("div",{className:"thumbnail-edit-background"}),t.jsx(V,{name:"camera",onClick:this.handleOpenThumbnailDialog})]})]})]}):t.jsxs(t.Fragment,{children:[l,t.jsx(pe,{item:e,src:a,hasBadge:!0,badgeSize:"small"})]}),t.jsx(Os,{item:e})]})}renderVideoDetails(e){if(!Be(e))return null;const s=this.canEditItemMetadata(e),a=s?()=>this.handleOpenVideoDialog():()=>this.handleOpenVideoDialog({viewOnly:!0});return t.jsx("div",{className:"details",children:s?t.jsxs(t.Fragment,{children:[t.jsx(V,{name:"edit",className:"edit-item-file",onClick:a}),t.jsx(V,{name:"play",className:"play-video-button",onClick:a}),t.jsx(We,{item:e,src:this.state.video,showMetrics:!0,onClick:a})]}):t.jsxs(t.Fragment,{children:[ks(e)&&t.jsx(V,{name:"play",className:"play-video-button",onClick:a}),t.jsx(We,{item:e,src:this.state.video,showMetrics:!0})]})})}renderPermissions(e){return t.jsx(Bs,{requiredPermissions:e.data.requiredPermissions})}render(){const{selectedItemId:e,address:s,isWearableUtilityEnabled:a,isConnected:n,error:l,isCampaignEnabled:o,isVrmOptOutEnabled:h,campaignName:g,campaignTag:p}=this.props,{name:E,description:w,utility:S,rarity:j,data:x,isDirty:f,hasItem:T}=this.state,R=P.Rarity.getRarities(),M=Ws();return t.jsx("div",{className:"RightPanel",children:n?t.jsx(na,{id:e,children:(I,u,N)=>{var O;const k=u&&ke(u),_=this.canEditItemMetadata(I),v=I?Ie(I)?Fs(I.contents):Hs():[];return N?t.jsx(d.Loader,{size:"massive",active:!0}):T||!e?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"header",children:[t.jsx("div",{className:"title",children:r("item_editor.right_panel.properties")}),I&&tt(I,s)&&!I.isPublished&&!k?t.jsx(d.Dropdown,{trigger:t.jsx("div",{className:"actions"}),inline:!0,direction:"left",children:t.jsxs(d.Dropdown.Menu,{children:[ue(I)!==null?t.jsx(d.Dropdown.Item,{text:r("item_detail_page.add_representation",{bodyShape:r(`body_shapes.${ue(I)}`).toLowerCase()}),onClick:this.handleAddRepresentationToItem}):null,t.jsx(st,{name:E,onDelete:this.handleDeleteItem,trigger:t.jsx(d.Dropdown.Item,{text:r("global.delete")})})]})}):null]}),t.jsxs("div",{className:"container",children:[t.jsx(W,{label:r("item_editor.right_panel.details"),children:I?t.jsxs(t.Fragment,{children:[this.renderModelDetails(I),this.renderVideoDetails(I)]}):null}),t.jsx(W,{label:r("item_editor.right_panel.basics"),children:I?t.jsxs(t.Fragment,{children:[t.jsx(ka,{label:r("global.name"),value:E,disabled:!_,maxLength:Vs,onChange:this.handleChangeName}),t.jsx(d.TextAreaField,{maxLength:Us,onChange:this.handleChangeDescription,label:r("global.description"),placeholder:r("item_editor.right_panel.description_placeholder"),disabled:!_,value:w,rows:"2",cols:"12"}),a?t.jsx(d.TextAreaField,{maxLength:$s,onChange:this.handleChangeUtility,label:r("global.utility"),placeholder:r("item_editor.right_panel.utility_placeholder"),disabled:!_,value:S,tooltip:{content:r("item_editor.right_panel.utility_tooltip")},rows:"2",cols:"12"}):null,t.jsx(le,{itemId:I.id,label:r("global.category"),value:x.category,options:this.asCategorySelect(I.type,v),disabled:!_,onChange:this.handleChangeCategory}),!(I.urn&&z(I.urn))&&t.jsx(le,{itemId:I.id,label:r("global.rarity"),value:j,options:this.asRaritySelect(R),disabled:I.isPublished||!_,onChange:this.handleChangeRarity})]}):null}),(I==null?void 0:I.type)===L.WEARABLE&&t.jsx(W,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:r("item_editor.right_panel.overrides")}),t.jsx(ie,{content:r("item_editor.right_panel.overrides_info"),className:"info"})]}),children:this.renderOverrides(I)}),(I==null?void 0:I.type)===L.EMOTE&&t.jsx(W,{label:r("item_editor.right_panel.animation"),children:I?t.jsx(le,{itemId:I.id,label:r("create_single_item_modal.play_mode_label"),value:x.loop?he.LOOP:he.SIMPLE,options:this.asPlayModeSelect(M),disabled:!_,onChange:this.handlePlayModeChange}):null}),I&&Be(I)&&((O=I.data.requiredPermissions)!=null&&O.length)?t.jsx(W,{label:r("item_editor.right_panel.required_permissions"),children:this.renderPermissions(I)}):null,t.jsx(W,{label:r("item_editor.right_panel.tags"),children:I?t.jsxs(t.Fragment,{children:[t.jsx(it,{itemId:I.id,value:x.tags,onChange:this.handleChangeTags,isDisabled:!_}),o&&g&&p&&_&&t.jsx("p",{className:"event-tag",children:r("item_editor.right_panel.event_tag",{event_tag:t.jsx("span",{children:p}),event_name:t.jsx("span",{children:g})})})]}):null}),(I==null?void 0:I.type)===L.WEARABLE&&h&&t.jsx(W,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:r("item_editor.right_panel.copyright.title")}),t.jsx(ie,{content:r("item_editor.right_panel.copyright.info"),className:"info"})]}),children:t.jsx("div",{className:"right-panel-copyright-section",children:t.jsxs("div",{className:"right-panel-export-protection",children:[t.jsx("span",{children:r("item_editor.right_panel.copyright.vrm_export")}),t.jsx(d.Checkbox,{toggle:!0,label:x!=null&&x.blockVrmExport?r("item_editor.right_panel.copyright.disabled"):r("item_editor.right_panel.copyright.enabled"),checked:!(x!=null&&x.blockVrmExport),onChange:this.handleAllowVrmExport,"aria-label":r("item_editor.right_panel.copyright.vrm_export")})]})})}),(I==null?void 0:I.type)===L.WEARABLE&&t.jsx(W,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:r("item_editor.right_panel.outline_compatible.title")}),t.jsx(ie,{content:r("item_editor.right_panel.outline_compatible.info"),className:"info"})]}),children:t.jsx("div",{className:"right-panel-copyright-section",children:t.jsxs("div",{className:"right-panel-export-protection",children:[t.jsx("span",{children:r("item_editor.right_panel.outline_compatible.title")}),t.jsx(d.Checkbox,{toggle:!0,label:(x==null?void 0:x.outlineCompatible)!==!1?r("item_editor.right_panel.copyright.enabled"):r("item_editor.right_panel.copyright.disabled"),checked:(x==null?void 0:x.outlineCompatible)!==!1,onChange:this.handleAllowOutlineCompatible,"aria-label":r("item_editor.right_panel.outline_compatible.title")})]})})}),f?t.jsxs("div",{className:"edit-buttons",children:[t.jsx(d.Button,{secondary:!0,onClick:this.handleOnResetItem,children:r("global.cancel")}),t.jsx(Fe,{primary:!0,onClick:this.handleOnSaveItem,network:P.Network.MATIC,children:r("global.save")})]}):l&&e?t.jsxs("p",{className:"danger-text",children:[r("global.error_ocurred"),": ",l]}):null]})]}):null}}):null})}};const Wa=()=>{const i=se(),m=we(),e=C(u=>ae(u)),s=C(u=>xe(u)),a=C(u=>Gs(u)),n=C(u=>Ys(u)),l=C(u=>Ve(u)),o=C(u=>Js(u)),h=C(u=>ta(u)),g=C(u=>zs(u)),p=C(u=>qs(u)),E=C(u=>m?fe(u,m):null),w=C(u=>m&&E&&E.collectionId?Ee(u,E.collectionId):null),S=C(u=>{const N=sa(u),k=aa(u);return N==null?void 0:N[k]}),j=C(u=>Zs(u)),x=C(u=>!E||!e?!1:w?$e(u,e,w):tt(E,e)),f=b.useMemo(()=>m?j[m]:null,[m,j]),T=b.useCallback((u,N)=>i(Ks(u,N)),[i]),R=b.useCallback(u=>i(Ye(u)),[i]),M=b.useCallback((u,N)=>i(Ge(u,N)),[i]),I=b.useCallback(u=>i(Qs(u)),[i]);return t.jsx(Ba,{address:e,collection:w,selectedItem:E,selectedItemId:m,canEditSelectedItem:x,itemStatus:f,error:a,isConnected:s,isDownloading:n,isCommitteeMember:l,isCampaignEnabled:o,campaignTag:h,campaignName:S,isVrmOptOutEnabled:g,isWearableUtilityEnabled:p,onSaveItem:T,onDeleteItem:R,onOpenModal:M,onDownload:I})},Fa=Wa;class tn extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{reviewedItems:[]});c(this,"handleOnSetReviewedItems",e=>{this.setState(s=>({reviewedItems:[...s.reviewedItems,...e.filter(a=>!s.reviewedItems.some(n=>n.id===a.id))]}))});c(this,"handleResetReviewedItems",()=>{this.setState({reviewedItems:[]})})}render(){const{reviewedItems:e}=this.state;return t.jsx(t.Fragment,{children:t.jsxs("div",{className:"ItemEditorPage",children:[t.jsx(Ia,{reviewedItems:e}),t.jsxs("div",{className:"content",children:[t.jsx(Na,{reviewedItems:e,onResetReviewedItems:this.handleResetReviewedItems,onSetReviewedItems:this.handleOnSetReviewedItems}),t.jsx(Oa,{}),t.jsx(Fa,{})]})]})})}}export{tn as default};
|
|
1
|
+
var ht=Object.defineProperty;var mt=(i,m,e)=>m in i?ht(i,m,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[m]=e;var c=(i,m,e)=>mt(i,typeof m!="symbol"?m+"":m,e);import{ae as q,H as t,M as d,G as r,bk as $,bJ as gt,D as b,gt as X,L as te,K as F,cj as Fe,b4 as P,N as He,bD as G,gu as pt,eF as ut,gv as Ct,gw as It,gx as bt,gy as _t,gz as xt,gA as Et,gB as vt,gC as jt,gD as H,et as St,gE as K,gF as Pe,a4 as se,Z as _e,a5 as C,aG as ae,gG as ft,de as xe,br as Ve,fe as Ee,ft as Tt,fW as wt,fX as yt,eC as ge,gm as Pt,gH as At,gI as Nt,fZ as Rt,eG as Ue,gJ as Mt,gK as Dt,gL as Lt,gM as Ot,fo as kt,fY as Bt,f_ as Wt,aM as ve,gN as Ft,gO as Ht,eU as Ae,bK as Vt,ad as Ut,eJ as je,gP as $e,X as Ge,ew as $t,er as Ye,fG as ee,dG as pe,es as Gt,eX as ue,gQ as Je,bi as Se,fV as ze,e_ as L,eu as z,fC as qe,fD as Ce,J as V,f9 as Ie,dF as Yt,eS as Jt,fl as zt,gR as qt,gS as Ze,gT as Ke,gU as Qe,fd as fe,eD as Zt,gV as Kt,gW as Qt,fK as Xe,eM as Xt,eL as et,eN as es,eP as ts,eQ as ss,gX as as,gY as ns,gZ as is,g_ as Ne,g$ as de,h0 as ls,eg as os,h1 as rs,h2 as ds,h3 as cs,h4 as hs,h5 as ms,h6 as gs,h7 as ps,h8 as us,h9 as Cs,ha as Is,hb as bs,fm as _s,hc as xs,hd as Es,he as vs,hf as js,hg as Ss,hh as fs,hi as Ts,hj as ws,f$ as ys,bU as ie,hk as Ps,hl as Re,hm as As,hn as Ns,eW as Me,fH as ce,ho as he,eV as Rs,eR as De,eY as Ms,eZ as Le,e$ as Oe,f0 as ke,hp as Ds,hq as Ls,f1 as Os,f2 as Be,f3 as We,hr as ks,fc as Bs,hs as Ws,ht as Fs,hu as Hs,hv as tt,hw as Vs,hx as Us,hy as $s,hz as Gs,hA as Ys,eI as Js,hB as zs,fg as qs,ff as Zs,fi as Ks,hC as Qs}from"./index-LbPj94fr.js";import{g as oe,h as Te,i as we}from"./hooks-B-YhDlyt.js";import{J as Xs}from"./JumpIn.container-va_LyMbu.js";import{C as ea}from"./CollectionProvider.container-Dz4kU__V.js";import{C as st}from"./ConfirmDelete-8N9eX1ru.js";import{C as at}from"./CollectionStatus.container-SecVXoKZ.js";import{d as ta,e as sa,c as aa}from"./selectors-CSnw6goy.js";import{I as na}from"./ItemProvider.container-BtouewED.js";const ia=({open:i,assignee:m,onConfirm:e,onClose:s})=>t.jsxs(d.Modal,{size:"tiny",className:"ConfirmApprovalModal",open:i,children:[t.jsx(d.Modal.Header,{children:r("curation_page.confirm_not_assigned_curation_modal.title")}),t.jsxs(d.Modal.Content,{children:[t.jsx("div",{className:"message-container",children:t.jsx($,{id:"curation_page.confirm_not_assigned_curation_modal.body",values:{assignee:t.jsx("strong",{children:t.jsx(gt,{textOnly:!0,address:m})})}})}),t.jsx("span",{children:t.jsx($,{id:"curation_page.confirm_not_assigned_curation_modal.confirm_footer"})})]}),t.jsxs(d.Modal.Actions,{children:[t.jsx(d.Button,{onClick:s,children:r("global.cancel")}),t.jsx(d.Button,{primary:!0,onClick:e,children:r("curation_page.confirm_not_assigned_curation_modal.confirm_button")})]})]}),la=q.memo(ia);var D=(i=>(i.REJECT_COLLECTION="REJECT_COLLECTION",i.REJECT_CURATION="REJECT_CURATION",i.DISABLE_COLLECTION="DISABLE_COLLECTION",i.DISABLE_THIRD_PARTY="DISABLE_THIRD_PARTY",i))(D||{});const U="item_editor.top_panel.rejection_modal",oa=({open:i,type:m,isLoading:e,thirdParty:s,hasPendingTransaction:a,onDisableThirdParty:n,collection:l,curation:o,onReject:h,onRejectCuration:g,onClose:p})=>{const E=b.useMemo(()=>{switch(m){case D.DISABLE_COLLECTION:return U+".disable_collection";case D.REJECT_CURATION:return U+".reject_curation";case D.DISABLE_THIRD_PARTY:return U+".disable_third_party";default:return""}},[m]),w=()=>{switch(m){case D.DISABLE_COLLECTION:h(l);break;case D.REJECT_CURATION:g(o.collectionId);break;case D.DISABLE_THIRD_PARTY:s&&n(s.id);break}},S=m===D.DISABLE_COLLECTION&&!l.isApproved||m===D.DISABLE_THIRD_PARTY&&!(s!=null&&s.isApproved)||m===D.REJECT_COLLECTION&&!l.isApproved||m===D.REJECT_CURATION&&(o==null?void 0:o.status)===X.REJECTED;return t.jsx(d.Modal,{size:"tiny",className:"RejectionModal",open:i,children:a?t.jsx(ra,{i18nKey:E}):S?t.jsx(da,{link:l.forumLink,onClose:p}):t.jsx(ca,{i18nKey:E,isLoading:e,onClose:p,onConfirm:w})})},ra=({i18nKey:i})=>t.jsxs(t.Fragment,{children:[t.jsx(d.Modal.Header,{children:r(`${i}.title`)}),t.jsxs("div",{className:"loading-transaction",children:[t.jsx("div",{className:"danger-text",children:r(`${i}.tx_pending`)}),t.jsx("small",{className:"danger-text",children:t.jsx($,{id:U+".visit_activity",values:{activity_link:t.jsx(te,{to:F.activity(),children:r("global.activity")})}})}),t.jsx(d.Loader,{active:!0,size:"large"})]})]}),da=({link:i,onClose:m})=>t.jsxs(t.Fragment,{children:[t.jsx(d.Modal.Header,{children:r(U+".veredict_explanation")}),t.jsx(d.Modal.Content,{children:r(U+".go_to_forum")}),t.jsxs(d.Modal.Actions,{children:[t.jsx("a",{href:i,className:"forum-link",target:"_blank",rel:"noopener noreferrer",children:t.jsxs(d.Button,{secondary:!0,icon:!0,labelPosition:"right",children:[t.jsx("div",{children:r(U+".forum_link")}),t.jsx("div",{className:"discussion",children:r(U+".discussion")}),t.jsx(d.Icon,{name:"chevron right"})]})}),t.jsx(d.Button,{basic:!0,onClick:m,children:r("global.done")})]})]}),ca=({i18nKey:i,isLoading:m,onConfirm:e,onClose:s})=>t.jsxs(t.Fragment,{children:[t.jsx(d.Modal.Header,{children:r(`${i}.title`)}),t.jsx(d.Modal.Content,{children:r(`${i}.subtitle`)}),t.jsxs(d.Modal.Actions,{children:[t.jsx(Fe,{primary:!0,onClick:e,disabled:m,loading:m,network:P.Network.MATIC,children:r(`${i}.action`)}),t.jsx(d.Button,{disabled:m,onClick:s,children:r("global.cancel")})]})]}),ha=q.memo(oa),ma=(i,m)=>({isLoading:G(ut(i),pt)||G(It(i),Ct)||bt(i),hasPendingTransaction:_t(i)||!!(m.thirdParty&&xt(i,m.thirdParty.id))}),ga=i=>({onReject:m=>i(Et(m)),onRejectCuration:m=>i(vt(m)),onDisableThirdParty:m=>i(jt(m))}),pa=He(ma,ga)(ha);var y=(i=>(i[i.APPROVE=0]="APPROVE",i[i.REJECT=1]="REJECT",i[i.ENABLE=2]="ENABLE",i[i.DISABLE=3]="DISABLE",i[i.DEPLOY_MISSING_ENTITIES=4]="DEPLOY_MISSING_ENTITIES",i))(y||{});let ua=class extends q.PureComponent{constructor(){super(...arguments);c(this,"state",{currentVeredict:void 0,showRejectionModal:null,showApproveConfirmModal:!1});c(this,"handleBack",()=>{const{history:e}=this.props;e.push(F.curation())});c(this,"handleConfirmApprovalModal",(e,s)=>{const{address:a,onInitiateApprovalFlow:n,onInitiateTPApprovalFlow:l,onSetAssignee:o}=this.props;this.setState({showApproveConfirmModal:!1}),a&&o(e.id,a,s),H(e)?l(e):n(e)});c(this,"setShowRejectionModal",e=>this.setState({showRejectionModal:e}));c(this,"renderPage",e=>{const{items:s,itemCurations:a,curation:n,totalItems:l,thirdParty:o}=this.props,{showRejectionModal:h,showApproveConfirmModal:g}=this.state,{chainId:p}=this.props,E=St(e);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"actions",children:t.jsx("div",{className:"back",onClick:this.handleBack})}),t.jsxs("div",{className:"title",children:[e.name," · ",r(`collection.type.${E}`),t.jsx(Xs,{size:"small",active:!0,collection:e,chainId:p,items:H(e)?s:void 0,text:r("global.see_in_decentraland")})]}),t.jsx("div",{className:"actions",children:t.jsx("span",{className:"button-container",children:H(e)&&l!==void 0?this.renderTPButtons(e,n,a):this.renderButtons(e,n)})}),h&&t.jsx(pa,{type:h,open:!0,collection:e,curation:n,thirdParty:o,onClose:()=>this.setShowRejectionModal(null)}),(n==null?void 0:n.assignee)&&g&&t.jsx(la,{open:!0,assignee:n.assignee,onConfirm:()=>this.handleConfirmApprovalModal(e,n),onClose:()=>this.setState({showApproveConfirmModal:!1})})]})});c(this,"renderButton",(e,s,a)=>{const{address:n,thirdParty:l,onInitiateApprovalFlow:o,onInitiateTPApprovalFlow:h,onDeployMissingEntities:g,reviewedItems:p,totalItems:E}=this.props,w={[y.APPROVE]:()=>a!=null&&a.assignee&&n!==(a==null?void 0:a.assignee)?this.setState({showApproveConfirmModal:!0}):H(s)?h(s):o(s),[y.ENABLE]:()=>o(s),[y.DISABLE]:()=>this.setShowRejectionModal(l?D.DISABLE_THIRD_PARTY:D.DISABLE_COLLECTION),[y.REJECT]:()=>{(a==null?void 0:a.status)===X.PENDING?this.setShowRejectionModal(D.REJECT_CURATION):this.setShowRejectionModal(D.REJECT_COLLECTION)},[y.DEPLOY_MISSING_ENTITIES]:()=>g(s)},S={[y.APPROVE]:"approve",[y.ENABLE]:"enable",[y.DISABLE]:"disable",[y.REJECT]:"reject",[y.DEPLOY_MISSING_ENTITIES]:"deploy_missing_entities"},j=e===y.APPROVE||e===y.ENABLE||e===y.DEPLOY_MISSING_ENTITIES,x=!H(s)||!!E&&p.length>=K(E);return t.jsx(d.Popup,{content:r("item_editor.top_panel.items_pending_to_review"),disabled:x,position:"bottom center",trigger:t.jsx("div",{children:t.jsx(d.Button,{primary:j,onClick:()=>w[e](),disabled:H(s)&&e===y.APPROVE&&!!E&&p.length<K(E),children:r(`item_editor.top_panel.${S[e]}`)})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0})});c(this,"renderTPButtons",(e,s,a)=>{const{reviewedItems:n,totalItems:l,thirdParty:o}=this.props,h=a==null?void 0:a.some(g=>g.status===X.PENDING);return t.jsxs(t.Fragment,{children:[t.jsxs(d.Header,{sub:!0,children:[h?r("item_editor.top_panel.reviewed_counter",{count:n.length,threshold:K(l)}):r("item_editor.top_panel.not_enough_items_to_curate_more"),n.length>=K(l)?t.jsx(d.Icon,{name:"check circle"}):null]}),h&&this.renderButton(y.APPROVE,e,s),h&&this.renderButton(y.REJECT,e,s),!h&&(o==null?void 0:o.isApproved)&&this.renderButton(y.DISABLE,e,null)]})});c(this,"renderButtons",(e,s)=>s&&e.isApproved&&s.status==="pending"?t.jsxs(t.Fragment,{children:[this.renderButton(y.APPROVE,e,s),this.renderButton(y.REJECT,e,s)]}):s&&e.isApproved&&(s.status==="approved"||s.status==="rejected")?t.jsxs(t.Fragment,{children:[this.renderButton(y.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(y.DEPLOY_MISSING_ENTITIES,e,s)]}):Pe(e)&&e.isApproved?t.jsxs(t.Fragment,{children:[this.renderButton(y.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(y.DEPLOY_MISSING_ENTITIES,e,s)]}):Pe(e)?this.renderButton(y.ENABLE,e,s):t.jsxs(t.Fragment,{children:[this.renderButton(y.APPROVE,e,s),this.renderButton(y.REJECT,e,s)]}))}render(){const{collection:e,items:s,isCommitteeMember:a,isReviewing:n,isConnected:l,isLoading:o}=this.props,h=!e||o&&!s.length;return a&&n&&l?t.jsx("div",{className:"TopPanel",children:h?t.jsx(d.Loader,{size:"small",active:!0}):this.renderPage(e)}):null}};const Ca=({reviewedItems:i})=>{const m=se(),e=_e(),s=oe(),a=Te(),n=C(ae),l=C(ft),o=C(xe),h=C(Ve),g=C(u=>s?Ee(u,s):null),p=C(u=>g?Tt(u,g.id):[]),E=C(u=>g?wt(u,g.id):[]),w=C(u=>s?yt(u,s):null),S=C(u=>s?ge(u,s):void 0),j=C(u=>g&&H(g)?Pt(u,g):null),x=C(u=>s?At(u,s):!1),f=C(u=>G(Nt(u),kt)||G(Rt(u),Bt)||G(Ue(u),Wt)),T=b.useCallback((u,N,k)=>{m(Mt(u,N,k))},[m]),R=b.useCallback(u=>{m(Dt(u))},[m]),M=b.useCallback(u=>{m(Lt(u))},[m]),I=b.useCallback(u=>{m(Ot(u))},[m]);return t.jsx(ua,{address:n,items:p,totalItems:(S==null?void 0:S.total)||null,collection:g,itemCurations:E,thirdParty:j,curation:w,chainId:l,isConnected:o,isReviewing:a,isCommitteeMember:h,selectedCollectionId:s,hasCollectionMissingEntities:x,isLoading:f,reviewedItems:i,onSetAssignee:T,onInitiateTPApprovalFlow:R,onInitiateApprovalFlow:M,onDeployMissingEntities:I,history:e})},Ia=Ca,nt=()=>{const{search:i}=ve();return C(e=>Ft(e,i))},ba="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4.22722%2012.7164C4.07574%2012.5731%204%2012.3582%204%2012.2149C4%2012.0716%204.07574%2011.8567%204.22722%2011.7134L5.28757%2010.7104C5.59053%2010.4239%206.04497%2010.4239%206.34793%2010.7104L9.35858%2013.8448C9.51006%2013.9881%209.73728%2013.9881%209.88876%2013.8448L17.6521%206.21493C17.955%205.92836%2018.4095%205.92836%2018.7124%206.21493L19.7728%207.21791C20.0757%207.50448%2020.0757%207.93433%2019.7728%208.2209L10.116%2017.7851C9.9645%2017.9284%209.81302%2018%209.5858%2018C9.35858%2018%209.2071%2017.9284%209.05562%2017.7851L4.22722%2012.7164Z'%20fill='white'/%3e%3c/svg%3e",_a=i=>{const{collectionId:m}=i,[e,s]=b.useState(!1),[a,n]=b.useState(null),l=_e(),o=ve(),h=b.useMemo(()=>Ht(o.search),[o.search]);b.useEffect(()=>{h&&(s(!0),n(h))},[h]);function g(){s(!1);const p=new URLSearchParams(o.search);p.delete("newItem"),l.replace({search:p.toString()})}return e&&a&&m?t.jsx(d.Toast,{type:d.ToastType.INFO,title:r("sagas.item.item_added_toast.title"),closable:!0,icon:t.jsx("div",{className:"ItemAddedToast icon-container",children:t.jsx("img",{src:ba,alt:r("sagas.item.item_added_toast.title")})}),onClose:g,body:t.jsx($,{id:"sagas.item.item_added_toast.body",values:{name:a,br:()=>t.jsx("br",{}),b:p=>t.jsx("strong",{children:p}),"collection-link":p=>t.jsx(te,{to:F.collectionDetail(m),children:t.jsx(d.Button,{className:"ItemAddedToast view-collection-link",basic:!0,children:p})})}})}):null},xa=q.memo(_a),Ea=({collection:i,address:m,hasUserOrphanItems:e,isLoggedIn:s,isReviewing:a,onOpenModal:n,onDeleteCollection:l})=>{var I,u;const o=ve(),h=_e(),g=((I=o.state)==null?void 0:I.fromParam)===Ae.COLLECTIONS,p=((u=o.state)==null?void 0:u.fromParam)===Ae.TP_COLLECTIONS,E=b.useCallback(()=>{h.push(F.collections())},[h]),w=b.useCallback(()=>{if(i&&(g||p)){const N=g?F.collectionDetail:F.thirdPartyCollectionDetail;h.push(N(i.id))}else h.push(F.itemEditor())},[g,p,h,i]),S=b.useCallback(()=>{n("CreateCollectionModal")},[n]),j=b.useCallback(()=>{i&&n("CreateSingleItemModal",{collectionId:i.id})},[i,n]),x=b.useCallback(()=>{i&&n("AddExistingItemModal",{collectionId:i.id})},[i,n]),f=b.useCallback(()=>{i&&n("EditCollectionNameModal",{collection:i})},[i,n]),T=b.useCallback(()=>{i&&l(i)},[i,l]),R=b.useCallback(()=>{const N=i&&Vt(i.owner,m||"");return i?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`block ${g||p?"close":"back"}`,onClick:w}),t.jsxs("div",{className:"title",children:[t.jsx(te,{to:F.collectionDetail(i.id),children:i.name}),t.jsx(at,{collection:i})]}),N&&!i.isPublished?t.jsx(d.Dropdown,{trigger:t.jsx("div",{className:"block actions"}),inline:!0,direction:"left",children:t.jsxs(d.Dropdown.Menu,{children:[t.jsx(d.Dropdown.Item,{onClick:f,children:r("item_editor.left_panel.actions.edit_name")}),t.jsx(d.Dropdown.Item,{onClick:j,children:r("item_editor.left_panel.actions.new_item")}),e&&t.jsx(d.Dropdown.Item,{onClick:x,children:r("item_editor.left_panel.actions.add_existing_item")}),t.jsx(st,{name:i.name,onDelete:T,trigger:t.jsx(d.Dropdown.Item,{text:r("global.delete")})})]})}):null]}):null},[i,m,e,g,p]),M=b.useCallback(()=>t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"block close",onClick:E}),t.jsx("div",{className:"title",children:e?r("item_editor.left_panel.title"):r("item_editor.left_panel.title_alternative")}),s?t.jsx(d.Dropdown,{trigger:t.jsx("div",{className:"block add"}),inline:!0,direction:"left",children:t.jsx(d.Dropdown.Menu,{children:t.jsx(d.Dropdown.Item,{onClick:S,children:r("item_editor.left_panel.actions.new_collection")})})}):t.jsx("div",{className:"block"})]}),[e,s]);return a?null:t.jsx(d.Row,{grow:!1,shrink:!1,className:"Header",children:i?R():M()})},va=()=>{const i=oe();return C(m=>i?Ee(m,i):null)},ja=()=>{const i=se(),m=C(ae),e=C(Ut),s=Te(),a=C(je),n=va(),l=C(p=>!!(n&&m&&$e(p,m,n))),o=b.useCallback((p,E)=>i(Ge(p,E)),[i]),h=b.useCallback(p=>i($t(p)),[i]),g=b.useCallback(p=>i(Ye(p)),[i]);return t.jsx(Ea,{address:m,collection:n??void 0,isLoggedIn:e,isReviewing:s,onOpenModal:o,onDeleteCollection:h,onDeleteItem:g,hasEditRights:l,hasUserOrphanItems:a})},B=10;class W extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{isCollapsed:!1});c(this,"handleToggle",()=>{this.setState({isCollapsed:!this.state.isCollapsed})})}render(){const{label:e,children:s}=this.props,{isCollapsed:a}=this.state,n=!a;return t.jsxs("div",{className:`Collapsable ${n?"is-open":""}`.trim(),children:[t.jsxs("div",{className:"header",onClick:this.handleToggle,children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"handle"})]}),t.jsx("div",{className:"content",children:n?s:null})]})}}class Sa extends b.PureComponent{constructor(){super(...arguments);c(this,"handleClick",()=>{const{item:e,onClick:s}=this.props;s(e)})}renderToggleItem(){const{item:e,isVisible:s,isPlayingEmote:a}=this.props;return ee(e)?t.jsx(d.Icon,{className:"toggle-emote",name:s&&a?"pause":"play",onClick:this.handleClick}):t.jsx("div",{className:`toggle ${s?"is-visible":"is-hidden"}`,onClick:this.handleClick})}render(){const{item:e,isSelected:s,selectedCollectionId:a,bodyShape:n}=this.props;return t.jsx("div",{className:`SidebarItem ${s?"is-selected":""}`,children:t.jsxs(te,{to:F.itemEditor({itemId:e.id,collectionId:a||void 0,newItem:void 0}),children:[t.jsx(pe,{item:e}),t.jsxs("div",{className:"name",children:[t.jsx(Gt,{item:e}),e.name]}),t.jsx(d.Popup,{content:r("item_editor.left_panel.invalid_representation_tooltip",{bodyShape:t.jsx("b",{children:r(`body_shapes.${ue(e)}`).toLowerCase()})}),disabled:Je(e,n),position:"top center",trigger:this.renderToggleItem()})]})})}}var A=(i=>(i.TO_REVIEW="to-review",i.REVIEWED="reviewed",i.ALL_ITEMS="all-items",i))(A||{});const fa={[A.TO_REVIEW]:1,[A.REVIEWED]:1,[A.ALL_ITEMS]:1};class Ta extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{currentTab:A.TO_REVIEW,currentPages:fa,reviewedTabPage:1,showGetMoreSamplesModal:!1,showAllItemsTabChangeModal:!1});c(this,"analytics",Se());c(this,"handleReviewItemsTrigger",e=>{const{items:s,onReviewItems:a}=this.props,{currentTab:n}=this.state;this.getIsReviewingTPItems()&&n===A.TO_REVIEW&&!ze(s,e==null?void 0:e.items)&&a()});c(this,"isVisible",e=>{const{visibleItems:s}=this.props;return s.some(a=>a.id===e.id)});c(this,"handleClick",e=>{var g;const{bodyShape:s,visibleItems:a,wearableController:n,isPlayingEmote:l,onSetItems:o}=this.props;if(!Je(e,s))return;let h=a.filter(p=>p.id!==e.id);if(ee(e))if(this.isVisible(e)){l?n==null||n.emote.pause():n==null||n.emote.play();return}else h=h.filter(p=>p.type!==L.EMOTE);this.isVisible(e)||(h.push(e),(g=this.analytics)==null||g.track("Preview Item",{ITEM_ID:e!=null&&e.urn?z(e.urn)?qe(e.urn):Ce(e.urn):null,ITEM_TYPE:e.type,ITEM_NAME:e.name,ITEM_IS_THIRD_PARTY:z(e.urn)})),o(h)});c(this,"handleTabChange",e=>{const{onLoadPage:s,onReviewItems:a,onResetReviewedItems:n}=this.props,{currentPages:l}=this.state;e===A.ALL_ITEMS?this.setState({showAllItemsTabChangeModal:!1},()=>{n(),s(l[A.ALL_ITEMS])}):e===A.TO_REVIEW&&a(),this.setState({currentTab:e})});c(this,"handleGetRandomSampleClick",()=>{const{showSamplesModalAgain:e,onLoadRandomPage:s}=this.props;e?this.setState({showGetMoreSamplesModal:!0}):s()});c(this,"handleModalProceed",()=>{const{onLoadRandomPage:e}=this.props;e(),this.setState({showGetMoreSamplesModal:!1})});c(this,"handlePageChange",(e,s)=>{const{currentTab:a}=this.state,{onLoadPage:n}=this.props;this.setState(l=>({currentPages:{...l.currentPages,[a]:+s.activePage}})),a!==A.REVIEWED&&n(+s.activePage)});c(this,"handleSwitchToAllItemsTab",()=>{const{reviewedItems:e}=this.props;e.length>0?this.setState({showAllItemsTabChangeModal:!0}):this.handleTabChange(A.ALL_ITEMS)});c(this,"getIsReviewingTPItems",()=>{const{collection:e,isReviewing:s}=this.props;return e?z(e.urn)&&s:!1});c(this,"renderSidebarItem",e=>{const{collection:s,selectedItemId:a,bodyShape:n,isPlayingEmote:l}=this.props;return t.jsx(Sa,{item:e,isSelected:a===e.id,isVisible:this.isVisible(e),isPlayingEmote:l,selectedCollectionId:(s==null?void 0:s.id)??null,bodyShape:n,onClick:this.handleClick},e.id)});c(this,"renderSidebarCategory",e=>{const s=e.filter(Ie),a=e.filter(ee);return e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:r("item_editor.left_panel.empty_collection")})}):s.length===0||a.length===0?e.map(this.renderSidebarItem):t.jsxs(t.Fragment,{children:[t.jsx(W,{label:this.renderCollapsableLabel(L.WEARABLE),children:s.map(this.renderSidebarItem)}),t.jsx(W,{label:this.renderCollapsableLabel(L.EMOTE),children:a.map(this.renderSidebarItem)})]})});c(this,"renderTabPagination",e=>{const{currentTab:s,currentPages:a}=this.state,n=a[s],l=Math.ceil(e/B);return l>1?t.jsx(d.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:l,activePage:n,onPageChange:this.handlePageChange}):null});c(this,"renderPaginationStats",e=>{const{currentPages:s,currentTab:a}=this.state,n=s[a],l=(n-1)*B,o=n*B;return t.jsx(d.Header,{sub:!0,children:r("item_editor.left_panel.reviewed_tab.page_counter",{pageStart:l,pageEnd:o>e?e:o,total:e})})});c(this,"renderTabContent",()=>{const{items:e,isLoading:s,totalItems:a,reviewedItems:n}=this.props,{currentTab:l,currentPages:o}=this.state,h=this.getIsReviewingTPItems(),g=o[l];if(s)return t.jsx(d.Loader,{size:"large",active:!0});switch(l){case A.TO_REVIEW:return t.jsxs(t.Fragment,{children:[this.renderSidebarCategory(e),!h&&a?this.renderTabPagination(a):null]});case A.REVIEWED:{const p=n.slice((g-1)*B,g*B);return t.jsxs(t.Fragment,{children:[n.length?this.renderPaginationStats(n.length):null,this.renderSidebarCategory(p),n.length?this.renderTabPagination(n.length):null]})}case A.ALL_ITEMS:return t.jsxs(t.Fragment,{children:[e.length&&a?this.renderPaginationStats(a):null,this.renderSidebarCategory(e),e.length&&a?this.renderTabPagination(a):null]});default:return null}});c(this,"renderTabHeader",()=>{const{isLoading:e,totalItems:s,reviewedItems:a}=this.props,{currentTab:n}=this.state;let l;const o=!s||s<B||a.length===s;switch(n){case A.TO_REVIEW:l=t.jsx(d.Popup,{content:r("item_editor.top_panel.not_enough_items_to_curate_more"),disabled:!o,position:"bottom center",trigger:t.jsx("div",{children:t.jsxs(d.Button,{disabled:e||o,primary:!0,className:"random-sample-button",onClick:this.handleGetRandomSampleClick,children:[t.jsx(d.Icon,{name:"random"}),r("item_editor.left_panel.get_random_sample")]})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0});break;case A.REVIEWED:l=t.jsx($,{id:"item_editor.left_panel.reviewed_samples",values:{reviewed_samples_bold:t.jsx("b",{children:r("item_editor.left_panel.reviewed_samples_bold",{count:a.length})}),total:K(s??1)}});break;default:return null}return t.jsxs("div",{className:"tab-header",children:[" ",l," "]})});c(this,"renderModal",()=>{const{onToggleShowSamplesModalAgain:e,showSamplesModalAgain:s}=this.props,{showGetMoreSamplesModal:a}=this.state;return t.jsxs(d.Modal,{open:a,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(d.Modal.Header,{children:r("item_editor.left_panel.get_more_samples_modal.title")}),t.jsxs(d.Modal.Content,{children:[t.jsx($,{id:"item_editor.left_panel.get_more_samples_modal.content",values:{count:10,tabName:t.jsx("b",{children:A.REVIEWED})}}),t.jsxs("div",{className:"checkbox-container",onClick:e,children:[t.jsx(d.Checkbox,{checked:!s}),r("item_editor.left_panel.get_more_samples_modal.dont_show_again")]})]}),t.jsxs(d.Modal.Actions,{children:[t.jsx(d.Button,{onClick:()=>this.setState({showGetMoreSamplesModal:!1}),children:r("global.cancel")}),t.jsx(d.Button,{primary:!0,onClick:this.handleModalProceed,children:r("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});c(this,"renderAllItemsTabChangeModal",()=>{const{showAllItemsTabChangeModal:e}=this.state;return t.jsxs(d.Modal,{open:e,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(d.Modal.Header,{children:r("item_editor.left_panel.all_items_check.title")}),t.jsx(d.Modal.Content,{children:r("item_editor.left_panel.all_items_check.content")}),t.jsxs(d.Modal.Actions,{children:[t.jsx(d.Button,{onClick:()=>this.setState({showAllItemsTabChangeModal:!1}),children:r("global.cancel")}),t.jsx(d.Button,{primary:!0,onClick:()=>this.handleTabChange(A.ALL_ITEMS),children:r("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});c(this,"renderTabs",()=>{const{currentTab:e}=this.state;return t.jsxs(d.Tabs,{isFullscreen:!0,children:[t.jsx(d.Tabs.Tab,{active:e===A.TO_REVIEW,onClick:()=>this.handleTabChange(A.TO_REVIEW),children:r("item_editor.left_panel.to_review")}),t.jsx(d.Tabs.Tab,{active:e===A.REVIEWED,onClick:()=>this.handleTabChange(A.REVIEWED),children:r("item_editor.left_panel.reviewed")}),t.jsx(d.Tabs.Tab,{active:e===A.ALL_ITEMS,onClick:this.handleSwitchToAllItemsTab,children:r("item_editor.left_panel.all_items")})]})})}componentDidMount(){this.handleReviewItemsTrigger()}componentDidUpdate(e){this.handleReviewItemsTrigger(e)}renderCollapsableLabel(e){return t.jsxs(t.Fragment,{children:[t.jsx(V,{name:e}),t.jsx($,{id:`item_editor.left_panel.${e}`})]})}render(){return t.jsxs(d.Section,{className:"Items",children:[this.getIsReviewingTPItems()?t.jsxs(t.Fragment,{children:[this.renderTabs(),this.renderTabHeader()]}):null,this.renderTabContent(),this.renderModal(),this.renderAllItemsTabChangeModal()]})}}class wa extends b.PureComponent{render(){const{collection:m,isSelected:e}=this.props;return t.jsx("div",{className:`SidebarCollection ${e?"is-selected":""}`,children:t.jsxs(te,{to:F.itemEditor({collectionId:m.id}),children:[t.jsx(Yt,{collectionId:m.id}),t.jsxs("div",{className:"wrapper",children:[t.jsxs("div",{className:"name",children:[t.jsx(at,{collection:m}),m.name]}),t.jsx("div",{className:"count",children:r("item_editor.left_panel.items_count",{count:m.itemCount})})]})]})})}}class ya extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{currentPage:1});c(this,"handlePageChange",(e,s)=>{const{onLoadPage:a}=this.props;this.setState({currentPage:+s.activePage}),a(+s.activePage)})}render(){const{collections:e,isLoading:s,items:a,selectedCollectionId:n,totalCollections:l}=this.props,{currentPage:o}=this.state;if(e.length===0)return null;const h=Math.ceil(l/B);return s?t.jsx(d.Loader,{size:"small",active:!0}):!s&&a.length===0&&e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:r("collections_page.empty_description")})}):t.jsx(t.Fragment,{children:t.jsxs(d.Section,{className:"Collections",children:[e.map(g=>t.jsx(wa,{collection:g,items:a,isSelected:g.id===n},g.id)),h>1?t.jsx(d.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:h,activePage:o,onPageChange:this.handlePageChange}):null]})})}}var J=(i=>(i.COLLECTIONS="collections",i.ORPHAN_ITEMS="orphanItems",i))(J||{});const Y=1;let Pa=class extends b.PureComponent{constructor(){super(...arguments);c(this,"state",this.getInitialState());c(this,"handleToggleShowSamplesModalAgain",()=>{this.setState(e=>({showSamplesModalAgain:!e.showSamplesModalAgain}))});c(this,"fetchResource",()=>{const{address:e,onFetchCollections:s,onFetchOrphanItems:a,isReviewing:n,selectedCollectionId:l}=this.props,{pages:o}=this.state;if(e&&!n&&!l){const h=o[o.length-1];(this.isCollectionTabActive()?s:a)(e,{limit:B,page:h})}});c(this,"loadPage",e=>{this.setState({pages:[e]},()=>this.fetchResource())});c(this,"getRandomPage",(e,s)=>Math.floor(Math.random()*(s-e+1)+e));c(this,"loadRandomPage",e=>{const{pages:s}=this.state,{totalItems:a,totalCollections:n,onSetReviewedItems:l}=this.props,o=this.isCollectionTabActive()?n:a,h=Math.ceil(o/B);if(h>s.length){const g=[...Array(h).keys()].map(p=>p+1).filter(p=>!s.includes(p));if(g.length>0){const p=g[Math.floor(Math.random()*g.length)];this.setState(E=>({pages:[...E.pages,p]}),this.fetchResource)}}l(e)});c(this,"handleTabChange",e=>{this.setState({currentTab:e,pages:[Y]},this.fetchResource)});c(this,"isCollectionTabActive",()=>{const{selectedCollectionId:e}=this.props,{currentTab:s}=this.state;return s===J.COLLECTIONS&&!e})}getInitialState(){const{selectedCollectionId:e,selectedItemId:s}=this.props;let a=J.COLLECTIONS;return!e&&s&&(a=J.ORPHAN_ITEMS),{pages:[Y],currentTab:a,initialPage:Y,showSamplesModalAgain:!0}}componentDidMount(){const{address:e,hasUserOrphanItems:s,selectedItem:a,onFetchOrphanItem:n,onSetItems:l}=this.props;this.fetchResource(),e&&s===void 0&&n(e),a&&l([a])}componentDidUpdate(e,s){const{isConnected:a,address:n,selectedCollectionId:l,selectedItemId:o,selectedItem:h,orphanItems:g,totalItems:p,visibleItems:E,hasUserOrphanItems:w,onSetItems:S,onFetchOrphanItem:j}=this.props,{initialPage:x,pages:f}=this.state;if(!l&&n&&o&&p&&(x===Y||s.initialPage<x)){if(!g.find(T=>T.id===o)){const T=Math.ceil(p/B),R=f[f.length-1],M=Math.min(T,R+1);f.includes(M)||this.setState({pages:[M],initialPage:M},this.fetchResource)}}else if(e.selectedItemId&&o&&e.selectedItemId!==o){const T=E.filter(R=>R.type!==L.EMOTE);S(T)}else n&&a&&(a!==e.isConnected||e.selectedCollectionId&&!l)&&this.setState({pages:[Y]},this.fetchResource),e.selectedCollectionId!==l&&this.setState({pages:[Y]}),n&&n!==e.address&&w===void 0&&j(n);!e.selectedItem&&h&&h.type!==L.EMOTE&&S([h]),e.selectedCollectionId!==l&&S([])}componentWillUnmount(){const{onSetItems:e}=this.props;e([])}getItems(e,s,a){const{selectedCollectionId:n,orphanItems:l,isReviewing:o}=this.props;return n&&e?Jt(e)&&o?s.filter(h=>!!(a!=null&&a.find(g=>g.itemId===h.id&&g.status===X.PENDING))):s:l}render(){const{items:e,totalItems:s,totalCollections:a,collections:n,selectedItemId:l,selectedCollectionId:o,visibleItems:h,bodyShape:g,reviewedItems:p,isReviewing:E,isPlayingEmote:w,isConnected:S,wearableController:j,isLoading:x,hasUserOrphanItems:f,onSetItems:T,onSetReviewedItems:R,onResetReviewedItems:M}=this.props,{pages:I,showSamplesModalAgain:u}=this.state,N=!o&&f,k=this.isCollectionTabActive()&&!o,_=!this.isCollectionTabActive()||o;return t.jsx("div",{className:"LeftPanel",children:S?t.jsx(ea,{id:o,itemSelected:l,itemsPage:I,itemsPageSize:B,fetchCollectionItemsOptions:{status:E?X.PENDING:void 0},onChangePage:v=>this.setState({pages:[v]}),children:({paginatedCollections:v,collection:O,paginatedItems:re,initialPage:lt,isLoadingCollection:ot,isLoadingCollectionItems:rt,itemCurations:dt})=>{const Z=this.getItems(O,re,dt),ye=this.isCollectionTabActive(),ct=o&&O?lt:this.state.initialPage;return t.jsxs(t.Fragment,{children:[t.jsx(ja,{}),N?t.jsxs(d.Tabs,{isFullscreen:!0,children:[t.jsx(d.Tabs.Tab,{active:ye,onClick:()=>this.handleTabChange(J.COLLECTIONS),children:r("collections_page.collections")}),t.jsx(d.Tabs.Tab,{active:!ye,onClick:()=>this.handleTabChange(J.ORPHAN_ITEMS),children:r("item_editor.left_panel.items")})]}):null,k?t.jsx(ya,{collections:v,totalCollections:a||n.length,items:e,hasHeader:Z.length>0,selectedCollectionId:o,onLoadPage:this.loadPage,isLoading:ot}):null,_?t.jsxs(t.Fragment,{children:[t.jsx(Ta,{items:Z,totalItems:s||Z.length,hasHeader:!o&&n.length>0,selectedItemId:l,collection:O,isReviewing:E,isPlayingEmote:w,visibleItems:h,bodyShape:g,onResetReviewedItems:M,reviewedItems:p,onSetItems:T,wearableController:j,initialPage:ct,isLoading:rt||x,onToggleShowSamplesModalAgain:this.handleToggleShowSamplesModalAgain,showSamplesModalAgain:u,onReviewItems:()=>R(Z),onLoadRandomPage:()=>this.loadRandomPage(Z),onLoadPage:this.loadPage}),t.jsx(xa,{collectionId:o})]}):null]})}}):null})}};const Aa=i=>{const m=se(),e=oe(),s=we(),a=Te(),n=nt(),l=C(_=>ae(_)),o=C(_=>xe(_)),h=C(_=>zt(_)),g=C(_=>qt(_)),p=C(_=>Ze(_)),E=C(_=>Ke(_)),w=C(_=>Qe(_)),S=C(_=>je(_)),j=C(_=>Ue(_)),x=C(_=>s?fe(_,s):null),f=C(_=>{if(e)return ge(_,e);if(l)return ge(_,l)}),T=C(_=>e?void 0:Zt(_)),R=C(_=>l&&!e?Kt(_,l,f==null?void 0:f.limit):Qt(_)),M=b.useMemo(()=>G(j,ts)||G(j,ss),[j]),I=b.useCallback(_=>m(Xe(_)),[m]),u=b.useCallback((_,v)=>m(Xt(_,v)),[m]),N=b.useCallback((_,v)=>m(et(_,v)),[m]),k=b.useCallback(_=>m(es(_)),[m]);return t.jsx(Pa,{...i,address:l,isConnected:o,items:h,totalItems:(f==null?void 0:f.total)||null,totalCollections:(T==null?void 0:T.total)||null,orphanItems:R,collections:g,selectedItemId:s,selectedItem:x,selectedCollectionId:e,visibleItems:n,bodyShape:p,wearableController:E,isReviewing:a,isLoading:M,isPlayingEmote:w,hasUserOrphanItems:S,onSetItems:I,onFetchCollections:u,onFetchOrphanItems:N,onFetchOrphanItem:k})},Na=Aa;var Q=(i=>(i[i.ZOOM_IN=0]="ZOOM_IN",i[i.ZOOM_OUT=1]="ZOOM_OUT",i[i.PAN_CAMERA_Y=2]="PAN_CAMERA_Y",i[i.CHANGE_CAMERA_ALPHA=3]="CHANGE_CAMERA_ALPHA",i))(Q||{});class me extends q.PureComponent{constructor(){super(...arguments);c(this,"handleAvatarColorChange",(e,s)=>{const{currentColor:a,colors:n,onChange:l}=this.props;if(a.toHexString()!==s.value){const o=n.find(h=>h.toHexString()===s.value);l(o)}});c(this,"renderItem",(e,s)=>{const a=e.toHexString();return t.jsx(d.Dropdown.Item,{value:a,onClick:this.handleAvatarColorChange,children:t.jsx("i",{className:"color",style:{background:a}})},s)})}render(){const{currentColor:e,colors:s,label:a}=this.props,n=e.toHexString();return t.jsx(d.Dropdown,{inline:!0,direction:"right",className:"AvatarColorDropdown Select",value:n,trigger:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:a}),t.jsx("div",{className:"value",children:t.jsx("i",{className:"color",style:{background:n}})}),t.jsx("div",{className:"handle"})]}),children:t.jsx(d.Dropdown.Menu,{className:"colors-menu",children:s.map(this.renderItem)})})}}let Ra=class extends q.PureComponent{constructor(){super(...arguments);c(this,"handleAvatarChangeWearable",(e,s)=>{const{wearable:a,category:n,bodyShape:l,onChange:o,baseWearables:h}=this.props,g=s.value?h.find(p=>p.id===s.value):null;a!==g&&o(n,l,g??null)})}render(){const{wearable:e,bodyShape:s,category:a,label:n,isNullable:l,baseWearables:o}=this.props,h=as(o,a,s).map(p=>({value:p.id,text:ns(p)}));l&&h.push({value:"",text:r("global.none")});const g=e?h.find(p=>p.value===e.id):null;return t.jsx(d.Dropdown,{inline:!0,direction:"right",className:"AvatarWearableDropdown Select",value:e?e.id:"",options:h,scrolling:!0,onChange:this.handleAvatarChangeWearable,trigger:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:n}),t.jsx("div",{className:"value",children:g?g.text:r("global.none")}),t.jsx("div",{className:"handle"})]})})}};const Ma=i=>({baseWearables:is(i)}),ne=He(Ma)(Ra);let Da=class extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{showSceneBoundaries:!1,isShowingAvatarAttributes:!1,isLoading:!1});c(this,"analytics",Se());c(this,"handleToggleShowingAvatarAttributes",()=>{this.setState({isShowingAvatarAttributes:!this.state.isShowingAvatarAttributes})});c(this,"handleBodyShapeChange",(e,{value:s})=>{const{onSetBodyShape:a}=this.props;a(s)});c(this,"handleAnimationChange",(e,{value:s})=>{const{emotes:a,visibleItems:n,onSetAvatarAnimation:l,onSetItems:o}=this.props,h=a.find(p=>p.id===s),g=n.filter(p=>p.type!==L.EMOTE);g.forEach(p=>{var E;(E=this.analytics)==null||E.track("Play Emote",{EMOTE_PLAYED_BASE:!h,EMOTE_PLAYED_ITEM_ID:h!=null&&h.urn?Ce(h.urn):null,EMOTE_PLAYED_NAME:h?h.name:s,PREVIEWED_WEARABLE_ITEM_ID:p!=null&&p.urn?z(p.urn)?qe(p.urn):Ce(p.urn):null,PREVIEWED_WEARABLE_NAME:p.name})}),h?g.push(h):l(s),o(g)});c(this,"handleSkinColorChange",e=>{const{onSetSkinColor:s}=this.props;s(e)});c(this,"handleEyeColorChange",e=>{const{onSetEyeColor:s}=this.props;s(e)});c(this,"handleHairColorChange",e=>{const{onSetHairColor:s}=this.props;s(e)});c(this,"handleWearableChange",(e,s,a)=>{const{onSetBaseWearable:n}=this.props;n(e,s,a)});c(this,"handleWearablePreviewLoad",()=>{const{wearableController:e,onSetWearablePreviewController:s}=this.props;e||s(Ne.createController("wearable-editor")),this.setState({isLoading:!1})});c(this,"handleControlActionChange",async e=>{const{wearableController:s}=this.props,a=.1;if(s)switch(await(s==null?void 0:s.emote.pause()),e){case Q.ZOOM_IN:{await(s==null?void 0:s.scene.changeZoom(a));break}case Q.ZOOM_OUT:{await(s==null?void 0:s.scene.changeZoom(-a));break}}});c(this,"handlePlayEmote",()=>{const{wearableController:e,isPlayingEmote:s,visibleItems:a,onSetAvatarAnimation:n,onSetItems:l}=this.props,o=a.filter(h=>h.type!==L.EMOTE);s?(n(P.PreviewEmote.IDLE),l(o)):e==null||e.emote.play()});c(this,"renderEmotePlayButton",()=>{const{isPlayingEmote:e}=this.props,s=e?"stop":"play",a=e?r("item_editor.center_panel.stop"):r("item_editor.center_panel.play_emote");return t.jsxs(d.Button,{icon:!0,onClick:this.handlePlayEmote,children:[t.jsx(d.Icon,{name:s}),t.jsx("span",{children:a})]})});c(this,"renderEmoteDropdownButton",()=>{const{collection:e,emotes:s,isPlayingEmote:a}=this.props,n=!!e,l=s.length>0;return a?null:t.jsx(d.Dropdown,{className:"avatar-animation button icon",floating:!0,scrolling:!0,children:t.jsxs(d.Dropdown.Menu,{children:[l&&t.jsxs(t.Fragment,{children:[t.jsx(d.Dropdown.Header,{content:n?r("item_editor.center_panel.from_collection"):r("item_editor.center_panel.from_items")}),t.jsx(d.Dropdown.Divider,{}),s.map(o=>t.jsx(d.Dropdown.Item,{value:o.id,text:o.name,onClick:this.handleAnimationChange},o.id)),t.jsx(d.Dropdown.Divider,{}),t.jsx(d.Dropdown.Header,{content:r("item_editor.center_panel.default")}),t.jsx(d.Dropdown.Divider,{})]}),P.PreviewEmote.schema.enum.map(o=>t.jsx(d.Dropdown.Item,{value:o,text:r(`emotes.${o}`),onClick:this.handleAnimationChange},o))]})})});c(this,"renderEmoteSelector",()=>t.jsx(d.Popup,{content:r("item_editor.center_panel.disabled_animation_dropdown"),disabled:!0,position:"top center",trigger:t.jsx("div",{className:"avatar-animation-dropdown-wrapper option",children:t.jsxs(d.Button.Group,{children:[this.renderEmotePlayButton(),this.renderEmoteDropdownButton()]})})}))}componentDidMount(){const{address:e,collection:s,emotes:a,selectedBaseWearables:n,hasUserOrphanItems:l,onFetchBaseWearables:o,onFetchOrphanItems:h,onFetchCollectionItems:g}=this.props,p=a.length>0;n||o(),p||(s&&!H(s)?g(s.id):e&&l&&h(e)),this.setState({isLoading:!0})}componentWillUnmount(){const{onSetWearablePreviewController:e}=this.props;e(null)}renderSelectTrigger(e,s){return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"value",children:s}),t.jsx("div",{className:"handle"})]})}getDropdownAttributes(e,s,a){const n=s.find(l=>l.value===e);return{value:e,options:s,trigger:this.renderSelectTrigger(a,n?n.text:"")}}render(){const{bodyShape:e,skinColor:s,eyeColor:a,hairColor:n,emote:l,selectedBaseWearables:o,selectedItem:h,visibleItems:g,isImportFilesModalOpen:p,wearableController:E}=this.props,{isShowingAvatarAttributes:w,showSceneBoundaries:S,isLoading:j}=this.state,x=g.some(ee)&&(h==null?void 0:h.type)===L.EMOTE,f=l===P.PreviewEmote.JUMP?1:void 0;return t.jsxs("div",{className:`CenterPanel ${p?"import-files-modal-is-open":""}`,children:[t.jsx(Ne,{id:"wearable-editor",profile:"default",bodyShape:e,emote:l,zoom:f,skin:de(s),eyes:de(a),hair:de(n),urns:o?Object.values(o).map(T=>T?T.id:null).filter(T=>T!==null):[],base64s:g.map(ls),disableAutoRotate:!0,disableBackground:!0,wheelZoom:1.5,wheelStart:100,dev:os,onUpdate:()=>this.setState({isLoading:!0}),onLoad:this.handleWearablePreviewLoad,disableDefaultEmotes:x,showSceneBoundaries:S}),x?t.jsxs("div",{className:"zoom-controls",children:[t.jsx(d.Button,{className:"zoom-control zoom-in-control",onClick:()=>this.handleControlActionChange(Q.ZOOM_IN),children:t.jsx(d.Icon,{name:"plus"})}),t.jsx(d.Button,{className:"zoom-control zoom-out-control",onClick:()=>this.handleControlActionChange(Q.ZOOM_OUT),children:t.jsx(d.Icon,{name:"minus"})})]}):null,j&&t.jsx(d.Center,{children:t.jsx(d.Loader,{active:!0})}),t.jsxs("div",{className:"footer",children:[x&&!j&&E?t.jsx("div",{className:"emote-controls-container",children:t.jsx(rs,{className:"emote-controls",wearablePreviewId:"wearable-editor",wearablePreviewController:E})}):null,t.jsxs("div",{className:"options",children:[t.jsx("div",{className:`option ${w?"active":""}`,onClick:this.handleToggleShowingAvatarAttributes,children:t.jsx(d.Icon,{name:"user"})}),x?null:this.renderEmoteSelector(),t.jsx("div",{className:`option ${S?"active":""}`,children:t.jsx(V,{name:"cylinder",onClick:()=>this.setState(T=>({showSceneBoundaries:!T.showSceneBoundaries}))})})]}),t.jsxs("div",{className:`avatar-attributes ${w?"active":""}`,children:[t.jsx("div",{className:"dropdown-container",children:t.jsx(d.Dropdown,{inline:!0,direction:"right",className:"Select",onChange:this.handleBodyShapeChange,...this.getDropdownAttributes(e,[{value:P.BodyShape.MALE,text:r("body_shapes.male")},{value:P.BodyShape.FEMALE,text:r("body_shapes.female")}],r("wearable.category.body_shape"))})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(me,{currentColor:s,colors:ds(),label:r("wearable.color.skin"),onChange:this.handleSkinColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(me,{currentColor:a,colors:cs(),label:r("wearable.color.eye"),onChange:this.handleEyeColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(me,{currentColor:n,colors:hs(),label:r("wearable.color.hair"),onChange:this.handleHairColorChange})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.HAIR],category:P.WearableCategory.HAIR,bodyShape:e,label:r("wearable.category.hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.FACIAL_HAIR],category:P.WearableCategory.FACIAL_HAIR,bodyShape:e,label:r("wearable.category.facial_hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.UPPER_BODY],category:P.WearableCategory.UPPER_BODY,bodyShape:e,label:r("wearable.category.upper_body"),onChange:this.handleWearableChange})}),t.jsx("div",{className:"dropdown-container",children:o&&t.jsx(ne,{wearable:o[P.WearableCategory.LOWER_BODY],category:P.WearableCategory.LOWER_BODY,bodyShape:e,label:r("wearable.category.lower_body"),onChange:this.handleWearableChange})})]})]})]})}};const La=()=>{const i=se(),m=C(ae),e=C(Ze),s=C(ms),a=C(gs),n=C(ps),l=C(us),o=C(Cs),h=nt(),g=C(Ke),p=C(Is),E=C(Qe),w=C(bs),S=C(je),j=C(_s),x=oe(),f=we(),T=C(v=>f?fe(v,f):null),R=b.useMemo(()=>x?j.find(v=>v.id===x):void 0,[j,x]),M=b.useMemo(()=>x?p.filter(v=>v.collectionId===x):p.filter(v=>!v.collectionId),[p,x]),I=o?o[e]:null,N=b.useMemo(()=>!h.some(ee)&&l===P.PreviewEmote.IDLE,[h,l])?!1:E,k="CreateSingleItemModal"in w,_=b.useMemo(()=>({onSetBodyShape:v=>{i(xs(v))},onSetAvatarAnimation:v=>{i(Es(v))},onSetSkinColor:v=>{i(vs(v))},onSetEyeColor:v=>{i(js(v))},onSetHairColor:v=>{i(Ss(v))},onSetBaseWearable:(v,O,re)=>{i(fs(v,O,re))},onFetchBaseWearables:()=>{i(Ts())},onSetWearablePreviewController:v=>{i(ws(v))},onSetItems:v=>{i(Xe(v))},onFetchOrphanItems:(v,O)=>{i(et(v,O))},onFetchCollectionItems:(v,O)=>{i(ys(v,O))}}),[i]);return t.jsx(Da,{address:m,bodyShape:e,collection:R,selectedItem:T,selectedBaseWearables:I,skinColor:s,eyeColor:a,hairColor:n,emote:l,visibleItems:h,wearableController:g,emotes:M,isPlayingEmote:N,isImportFilesModalOpen:k,hasUserOrphanItems:S,..._})},Oa=La;class ka extends b.PureComponent{constructor(){super(...arguments);c(this,"handleChange",e=>{const{value:s,maxLength:a,onChange:n}=this.props,l=e.target.value;s!==l&&n(a?l.slice(0,a):l)})}render(){const{label:e,disabled:s,value:a}=this.props;return t.jsxs("div",{className:`Input ${s?"is-disabled":""}`.trim(),children:[t.jsx("div",{className:"label",children:e}),t.jsx("input",{value:a||"",onChange:this.handleChange,disabled:s})]})}}class le extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{value:this.props.value});c(this,"handleChange",(e,s)=>{const{value:a,onChange:n}=this.props,l=s.value;l!==a&&(this.setState({value:l}),n(l))})}componentWillReceiveProps(e){const{itemId:s,value:a}=e;(s!==this.props.itemId||a!==this.state.value)&&this.setState({value:a})}renderTrigger(){const{label:e,options:s}=this.props,{value:a}=this.state,n=s.find(l=>l.value===a);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"value",children:n?n.text:r("item_editor.right_panel.select_placeholder")}),t.jsx("div",{className:"handle"})]})}render(){const{options:e,disabled:s}=this.props,{value:a}=this.state;return t.jsx(d.Dropdown,{className:`Select ${a?"":"blank"}`.trim(),trigger:this.renderTrigger(),inline:!0,direction:"right",scrolling:e.length>4,value:a||void 0,options:e,disabled:s,onChange:this.handleChange})}}c(le,"defaultProps",{disabled:!1});class be extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{value:this.props.value});c(this,"handleChange",(e,s)=>{const{onChange:a}=this.props,{value:n}=this.state,l=s.value,o=[...n];for(const h of l)n.includes(h)||o.push(h);o.length!==n.length&&(this.setState({value:o}),a(o))});c(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(n=>n!==e);this.setState({value:a}),s(a)})}componentWillReceiveProps(e){const{itemId:s,value:a}=e;(s!==this.props.itemId||a!==this.state.value)&&this.setState({value:a})}renderTrigger(){const{label:e,info:s,options:a}=this.props,{value:n}=this.state,l=a.reduce((o,h)=>(o[h.value]=h.text,o),{});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"label",children:[e,s?t.jsx(ie,{content:s,className:"info"}):null]}),t.jsx("div",{className:"values",children:n.length>0?n.map(o=>t.jsxs("div",{className:"value",children:[l[o],t.jsx("div",{className:"remove",onClick:h=>{this.handleRemove(o),h.stopPropagation()}})]},o)):t.jsx("div",{className:"placeholder",children:r("item_editor.right_panel.select_placeholder")})}),t.jsx("div",{className:"handle"})]})}render(){const{options:e,disabled:s}=this.props,{value:a}=this.state;return t.jsx(d.Dropdown,{inline:!0,multiple:!0,className:`MultiSelect ${a.length>0?"":"blank"}`.trim(),trigger:this.renderTrigger(),direction:"right",value:a,scrolling:!1,options:e.filter(n=>!a.includes(n.value)),disabled:s,onChange:this.handleChange,closeOnChange:!0})}}c(be,"defaultProps",{disabled:!1});class it extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{draft:"",value:this.props.value});c(this,"handleChange",e=>{this.setState({draft:e.target.value})});c(this,"handleAdd",()=>{const{onChange:e}=this.props,{draft:s,value:a}=this.state,n=s.trim();if(n!=="")if(a.includes(n))this.setState({draft:""});else{const l=[...a,n];this.setState({value:l,draft:""}),e(l)}});c(this,"handleKeyDown",e=>{if(e.key==="#"){e.preventDefault();return}else if(e.keyCode===Ps||e.keyCode===Re||e.keyCode===As)this.handleAdd();else if(e.keyCode===Ns||e.keyCode===Re){const{draft:s,value:a}=this.state,n=a[a.length-1];n&&s===""&&this.handleRemove(n)}});c(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(n=>n!==e);this.setState({value:a}),s(a)})}componentWillReceiveProps(e){const{itemId:s,value:a}=e;(s!==this.props.itemId||a!==this.state.value)&&this.setState({value:a})}render(){const{isDisabled:e}=this.props,{draft:s,value:a}=this.state;return t.jsx("div",{className:`Tags ${a.length>0?"":"blank"} ${e?"is-disabled":""}`.trim(),children:t.jsxs("div",{className:"values",children:[a.map(n=>t.jsxs("div",{className:"value",children:[n,t.jsx("div",{className:"remove",onClick:l=>{this.handleRemove(n),l.stopPropagation()}})]},n)),t.jsx("input",{value:s,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onBlur:this.handleAdd,disabled:e})]})})}}c(it,"defaultProps",{isDisabled:!1});let Ba=class extends b.PureComponent{constructor(){super(...arguments);c(this,"analytics",Se());c(this,"state",this.getInitialState());c(this,"thumbnailInput",b.createRef());c(this,"handleDeleteItem",()=>{const{onDeleteItem:e}=this.props,{selectedItem:s}=this.props;e(s)});c(this,"handleAddRepresentationToItem",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,addRepresentation:!0})});c(this,"handleChangeItemFile",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,changeItemFile:!0})});c(this,"handleOpenVideoDialog",(e={})=>{const{selectedItem:s,onOpenModal:a}=this.props;a("EditVideoModal",{item:s,onSaveVideo:this.handleSaveVideo,...e})});c(this,"handleSaveVideo",e=>{this.setState({video:URL.createObjectURL(e),contents:{...this.state.contents,[Me]:e},isDirty:!0})});c(this,"handleChangeName",e=>{this.setState({name:e,isDirty:this.isDirty({name:e})})});c(this,"handleChangeDescription",(e,s)=>{const a=s.value??"";this.setState({description:a,isDirty:this.isDirty({description:a})})});c(this,"handleChangeUtility",(e,s)=>{const a=s.value??"";this.setState({utility:a,isDirty:this.isDirty({utility:a})})});c(this,"handleChangeRarity",e=>{this.setState({rarity:e,isDirty:this.isDirty({rarity:e})})});c(this,"handleAllowVrmExport",(e,{checked:s})=>{const a={...this.state.data,blockVrmExport:!s};this.setState({data:a,isDirty:this.isDirty({data:a})})});c(this,"handleAllowOutlineCompatible",(e,{checked:s})=>{const a={...this.state.data,outlineCompatible:s};this.setState({data:a,isDirty:this.isDirty({data:a})})});c(this,"handleChangeCategory",e=>{let s;ce(this.state.data)?s={...this.state.data,category:e}:(s={...this.state.data,category:e},e===P.WearableCategory.SKIN&&(s=this.setReplaces(s,[]),s=this.setHides(s,[]))),this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handlePlayModeChange",e=>{const s={...this.state.data,loop:e===he.LOOP};this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handleChangeReplaces",e=>{const s=this.setReplaces(this.state.data,e);this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handleChangeHides",(e,s)=>{const a=this.state.data.hides;let n=[];s==="wearable"?n=[...a.filter(o=>!P.WearableCategory.schema.enum.includes(o)),...e]:n=[...a.filter(o=>!P.BodyPartCategory.schema.enum.includes(o)),...e];const l=this.setHides(this.state.data,n);this.setState({data:l,isDirty:this.isDirty({data:l})})});c(this,"handleChangeTags",e=>{const s={...this.state.data,tags:e};this.setState({data:s,isDirty:this.isDirty({data:s})})});c(this,"handleOnSaveItem",async()=>{var w,S;const{selectedItem:e,itemStatus:s,onSaveItem:a}=this.props,{name:n,description:l,utility:o,rarity:h,contents:g,data:p,isDirty:E}=this.state;if(E&&e){let j=p;j&&!ce(j)&&(j={...j,removesDefaultHiding:j.category===P.WearableCategory.UPPER_BODY||(w=j.hides)!=null&&w.includes(P.WearableCategory.UPPER_BODY)?[P.BodyPartCategory.HANDS]:[],..."blockVrmExport"in j?{blockVrmExport:j.blockVrmExport}:{},..."outlineCompatible"in j?{outlineCompatible:j.outlineCompatible}:{}});const x={...e.contents,...await Rs(g)},f={...e,name:n,description:l,rarity:h,data:j,contents:x,utility:o??void 0};s&&[De.UNPUBLISHED,De.UNDER_REVIEW].includes(s)&&(f.video=x[Me]),a(f,g),z(f.urn)&&((S=this.analytics)==null||S.track("Edit Item",{contents:g})),this.setState({isDirty:!1}),this.handleOnResetItem()}});c(this,"handleOnResetItem",()=>{const{selectedItem:e}=this.props;e&&this.setItem(e)});c(this,"handleOpenThumbnailDialog",()=>{const{selectedItem:e,onOpenModal:s}=this.props;(e==null?void 0:e.type)===L.EMOTE?s("EditThumbnailModal",{onSaveThumbnail:this.handleEmoteThumbnailChange,item:e}):this.thumbnailInput.current&&this.thumbnailInput.current.click()});c(this,"handleEmoteThumbnailChange",e=>{const s=Ms(e);this.setState({thumbnail:e,contents:{[Le]:s},isDirty:!0})});c(this,"handleThumbnailChange",async e=>{const{files:s}=e.target;if(s&&s.length>0){const a=s[0],n=await Oe(a),l=await Oe(a,1024,1024),o=URL.createObjectURL(n);this.setState({thumbnail:o,contents:{[Le]:l},isDirty:!0})}});c(this,"handleDownloadItem",()=>{const{selectedItemId:e,onDownload:s}=this.props;e&&s(e)})}componentDidMount(){const{selectedItem:e}=this.props;e&&this.setItem(e)}componentDidUpdate(e){const{selectedItemId:s,selectedItem:a}=this.props;e.selectedItemId!==s?a?this.setItem(a):this.setState(this.getInitialState()):a&&(!e.selectedItem||this.hasSavedItem())&&this.setItem(a)}setItem(e){var a;const s=e.data;Ie(e)&&((a=s.replaces)!=null&&a.length)&&(s.hides=s.hides.concat(s.replaces),s.replaces=[]),this.setState({thumbnail:"",video:"",name:e.name,description:e.description,utility:e.utility||"",rarity:e.rarity,data:e.data,hasItem:!0,isDirty:!1})}getInitialState(){return{name:"",description:"",utility:"",thumbnail:"",video:"",rarity:void 0,contents:{},data:void 0,hasItem:!1,isDirty:!1}}setReplaces(e,s){return{...e,replaces:s,representations:e.representations.map(a=>({...a,overrideReplaces:s}))}}setHides(e,s){return{...e,hides:s,representations:e.representations.map(a=>({...a,overrideHides:s}))}}canEditItemMetadata(e){const{collection:s,canEditSelectedItem:a}=this.props;return!e||s&&ke(s)?!1:a}isSkin(){const{data:e}=this.state;return(e==null?void 0:e.category)===P.WearableCategory.SKIN}isDirty(e={}){const{selectedItem:s}=this.props,{hasItem:a}=this.state;return a?this.hasStateItemChanged({...this.state,...e},s):!1}hasSavedItem(){const{selectedItem:e}=this.props,{isDirty:s}=this.state;return e&&!s&&this.hasStateItemChanged(this.state,e)}hasStateItemChanged(e,s){return e.name!==s.name||e.description!==s.description||e.utility!==s.utility||e.rarity!==s.rarity||!ze(e.data,s.data)}asCategorySelect(e,s){return s.map(a=>({value:a,text:r(`${e}.category.${a}`)}))}asRaritySelect(e){return e.map(s=>({value:s,text:r(`wearable.rarity.${s}`)}))}asPlayModeSelect(e){return e.map(s=>({value:s,text:r(`emote.play_mode.${s}.text`),description:r(`emote.play_mode.${s}.description`)}))}renderOverrides(e){const s=this.canEditItemMetadata(e),a=this.state.data;if(!e||ce(a))return null;const n=Ds(e.contents,a.category),l=Ls(e.contents),o=a.hides.filter(g=>n.includes(g)),h=a.hides.filter(g=>l.includes(g));return t.jsxs(t.Fragment,{children:[t.jsx(be,{itemId:e.id,label:r("item_editor.right_panel.base_body"),info:r("item_editor.right_panel.base_body_info"),value:h,options:this.asCategorySelect(e.type,l),disabled:!s,onChange:g=>this.handleChangeHides(g,"bodypart")}),t.jsx(be,{itemId:e.id,label:r("item_editor.right_panel.wearables"),info:r("item_editor.right_panel.wearables_info"),value:o,options:this.asCategorySelect(e.type,o.some(g=>g===P.WearableCategory.BODY_SHAPE)?n:n.filter(g=>g!==P.WearableCategory.BODY_SHAPE)),disabled:!s,onChange:g=>this.handleChangeHides(g,"wearable")})]})}renderModelDetails(e){const{isDownloading:s}=this.props,{thumbnail:a}=this.state,n=this.canEditItemMetadata(e),l=s?t.jsx(d.Loader,{active:!0,size:"tiny",className:"donwload-item-loader"}):t.jsx(V,{name:"export",className:"download-item-button",onClick:this.handleDownloadItem});return t.jsxs("div",{className:"details",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(V,{name:"edit",className:"edit-item-file",onClick:this.handleChangeItemFile}),l,t.jsxs("div",{className:"thumbnail-container",children:[t.jsx(pe,{item:e,src:a,hasBadge:!0,badgeSize:"small"}),t.jsxs("div",{className:"thumbnail-edit-container",children:[t.jsx("input",{type:"file",ref:this.thumbnailInput,onChange:this.handleThumbnailChange,accept:"image/png"}),t.jsx("div",{className:"thumbnail-edit-background"}),t.jsx(V,{name:"camera",onClick:this.handleOpenThumbnailDialog})]})]})]}):t.jsxs(t.Fragment,{children:[l,t.jsx(pe,{item:e,src:a,hasBadge:!0,badgeSize:"small"})]}),t.jsx(Os,{item:e})]})}renderVideoDetails(e){if(!Be(e))return null;const s=this.canEditItemMetadata(e),a=s?()=>this.handleOpenVideoDialog():()=>this.handleOpenVideoDialog({viewOnly:!0});return t.jsx("div",{className:"details",children:s?t.jsxs(t.Fragment,{children:[t.jsx(V,{name:"edit",className:"edit-item-file",onClick:a}),t.jsx(V,{name:"play",className:"play-video-button",onClick:a}),t.jsx(We,{item:e,src:this.state.video,showMetrics:!0,onClick:a})]}):t.jsxs(t.Fragment,{children:[ks(e)&&t.jsx(V,{name:"play",className:"play-video-button",onClick:a}),t.jsx(We,{item:e,src:this.state.video,showMetrics:!0})]})})}renderPermissions(e){return t.jsx(Bs,{requiredPermissions:e.data.requiredPermissions})}render(){const{selectedItemId:e,address:s,isWearableUtilityEnabled:a,isConnected:n,error:l,isCampaignEnabled:o,isVrmOptOutEnabled:h,campaignName:g,campaignTag:p}=this.props,{name:E,description:w,utility:S,rarity:j,data:x,isDirty:f,hasItem:T}=this.state,R=P.Rarity.getRarities(),M=Ws();return t.jsx("div",{className:"RightPanel",children:n?t.jsx(na,{id:e,children:(I,u,N)=>{var O;const k=u&&ke(u),_=this.canEditItemMetadata(I),v=I?Ie(I)?Fs(I.contents):Hs():[];return N?t.jsx(d.Loader,{size:"massive",active:!0}):T||!e?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"header",children:[t.jsx("div",{className:"title",children:r("item_editor.right_panel.properties")}),I&&tt(I,s)&&!I.isPublished&&!k?t.jsx(d.Dropdown,{trigger:t.jsx("div",{className:"actions"}),inline:!0,direction:"left",children:t.jsxs(d.Dropdown.Menu,{children:[ue(I)!==null?t.jsx(d.Dropdown.Item,{text:r("item_detail_page.add_representation",{bodyShape:r(`body_shapes.${ue(I)}`).toLowerCase()}),onClick:this.handleAddRepresentationToItem}):null,t.jsx(st,{name:E,onDelete:this.handleDeleteItem,trigger:t.jsx(d.Dropdown.Item,{text:r("global.delete")})})]})}):null]}),t.jsxs("div",{className:"container",children:[t.jsx(W,{label:r("item_editor.right_panel.details"),children:I?t.jsxs(t.Fragment,{children:[this.renderModelDetails(I),this.renderVideoDetails(I)]}):null}),t.jsx(W,{label:r("item_editor.right_panel.basics"),children:I?t.jsxs(t.Fragment,{children:[t.jsx(ka,{label:r("global.name"),value:E,disabled:!_,maxLength:Vs,onChange:this.handleChangeName}),t.jsx(d.TextAreaField,{maxLength:Us,onChange:this.handleChangeDescription,label:r("global.description"),placeholder:r("item_editor.right_panel.description_placeholder"),disabled:!_,value:w,rows:"2",cols:"12"}),a?t.jsx(d.TextAreaField,{maxLength:$s,onChange:this.handleChangeUtility,label:r("global.utility"),placeholder:r("item_editor.right_panel.utility_placeholder"),disabled:!_,value:S,tooltip:{content:r("item_editor.right_panel.utility_tooltip")},rows:"2",cols:"12"}):null,t.jsx(le,{itemId:I.id,label:r("global.category"),value:x.category,options:this.asCategorySelect(I.type,v),disabled:!_,onChange:this.handleChangeCategory}),!(I.urn&&z(I.urn))&&t.jsx(le,{itemId:I.id,label:r("global.rarity"),value:j,options:this.asRaritySelect(R),disabled:I.isPublished||!_,onChange:this.handleChangeRarity})]}):null}),(I==null?void 0:I.type)===L.WEARABLE&&t.jsx(W,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:r("item_editor.right_panel.overrides")}),t.jsx(ie,{content:r("item_editor.right_panel.overrides_info"),className:"info"})]}),children:this.renderOverrides(I)}),(I==null?void 0:I.type)===L.EMOTE&&t.jsx(W,{label:r("item_editor.right_panel.animation"),children:I?t.jsx(le,{itemId:I.id,label:r("create_single_item_modal.play_mode_label"),value:x.loop?he.LOOP:he.SIMPLE,options:this.asPlayModeSelect(M),disabled:!_,onChange:this.handlePlayModeChange}):null}),I&&Be(I)&&((O=I.data.requiredPermissions)!=null&&O.length)?t.jsx(W,{label:r("item_editor.right_panel.required_permissions"),children:this.renderPermissions(I)}):null,t.jsx(W,{label:r("item_editor.right_panel.tags"),children:I?t.jsxs(t.Fragment,{children:[t.jsx(it,{itemId:I.id,value:x.tags,onChange:this.handleChangeTags,isDisabled:!_}),o&&g&&p&&_&&t.jsx("p",{className:"event-tag",children:r("item_editor.right_panel.event_tag",{event_tag:t.jsx("span",{children:p}),event_name:t.jsx("span",{children:g})})})]}):null}),(I==null?void 0:I.type)===L.WEARABLE&&h&&t.jsx(W,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:r("item_editor.right_panel.copyright.title")}),t.jsx(ie,{content:r("item_editor.right_panel.copyright.info"),className:"info"})]}),children:t.jsx("div",{className:"right-panel-copyright-section",children:t.jsxs("div",{className:"right-panel-export-protection",children:[t.jsx("span",{children:r("item_editor.right_panel.copyright.vrm_export")}),t.jsx(d.Checkbox,{toggle:!0,label:x!=null&&x.blockVrmExport?r("item_editor.right_panel.copyright.disabled"):r("item_editor.right_panel.copyright.enabled"),checked:!(x!=null&&x.blockVrmExport),onChange:this.handleAllowVrmExport,"aria-label":r("item_editor.right_panel.copyright.vrm_export")})]})})}),(I==null?void 0:I.type)===L.WEARABLE&&t.jsx(W,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:r("item_editor.right_panel.outline_compatible.title")}),t.jsx(ie,{content:r("item_editor.right_panel.outline_compatible.info"),className:"info"})]}),children:t.jsx("div",{className:"right-panel-copyright-section",children:t.jsxs("div",{className:"right-panel-export-protection",children:[t.jsx("span",{children:r("item_editor.right_panel.outline_compatible.title")}),t.jsx(d.Checkbox,{toggle:!0,label:(x==null?void 0:x.outlineCompatible)!==!1?r("item_editor.right_panel.copyright.enabled"):r("item_editor.right_panel.copyright.disabled"),checked:(x==null?void 0:x.outlineCompatible)!==!1,onChange:this.handleAllowOutlineCompatible,"aria-label":r("item_editor.right_panel.outline_compatible.title")})]})})}),f?t.jsxs("div",{className:"edit-buttons",children:[t.jsx(d.Button,{secondary:!0,onClick:this.handleOnResetItem,children:r("global.cancel")}),t.jsx(Fe,{primary:!0,onClick:this.handleOnSaveItem,network:P.Network.MATIC,children:r("global.save")})]}):l&&e?t.jsxs("p",{className:"danger-text",children:[r("global.error_ocurred"),": ",l]}):null]})]}):null}}):null})}};const Wa=()=>{const i=se(),m=we(),e=C(u=>ae(u)),s=C(u=>xe(u)),a=C(u=>Gs(u)),n=C(u=>Ys(u)),l=C(u=>Ve(u)),o=C(u=>Js(u)),h=C(u=>ta(u)),g=C(u=>zs(u)),p=C(u=>qs(u)),E=C(u=>m?fe(u,m):null),w=C(u=>m&&E&&E.collectionId?Ee(u,E.collectionId):null),S=C(u=>{const N=sa(u),k=aa(u);return N==null?void 0:N[k]}),j=C(u=>Zs(u)),x=C(u=>!E||!e?!1:w?$e(u,e,w):tt(E,e)),f=b.useMemo(()=>m?j[m]:null,[m,j]),T=b.useCallback((u,N)=>i(Ks(u,N)),[i]),R=b.useCallback(u=>i(Ye(u)),[i]),M=b.useCallback((u,N)=>i(Ge(u,N)),[i]),I=b.useCallback(u=>i(Qs(u)),[i]);return t.jsx(Ba,{address:e,collection:w,selectedItem:E,selectedItemId:m,canEditSelectedItem:x,itemStatus:f,error:a,isConnected:s,isDownloading:n,isCommitteeMember:l,isCampaignEnabled:o,campaignTag:h,campaignName:S,isVrmOptOutEnabled:g,isWearableUtilityEnabled:p,onSaveItem:T,onDeleteItem:R,onOpenModal:M,onDownload:I})},Fa=Wa;class tn extends b.PureComponent{constructor(){super(...arguments);c(this,"state",{reviewedItems:[]});c(this,"handleOnSetReviewedItems",e=>{this.setState(s=>({reviewedItems:[...s.reviewedItems,...e.filter(a=>!s.reviewedItems.some(n=>n.id===a.id))]}))});c(this,"handleResetReviewedItems",()=>{this.setState({reviewedItems:[]})})}render(){const{reviewedItems:e}=this.state;return t.jsx(t.Fragment,{children:t.jsxs("div",{className:"ItemEditorPage",children:[t.jsx(Ia,{reviewedItems:e}),t.jsxs("div",{className:"content",children:[t.jsx(Na,{reviewedItems:e,onResetReviewedItems:this.handleResetReviewedItems,onSetReviewedItems:this.handleOnSetReviewedItems}),t.jsx(Oa,{}),t.jsx(Fa,{})]})]})})}}export{tn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as f,B as a}from"./index-
|
|
1
|
+
import{q as f,B as a}from"./index-LbPj94fr.js";var l=function(o,r){if(typeof Blob>"u"||!(o instanceof Blob))throw new Error("first argument must be a Blob");if(typeof r!="function")throw new Error("second argument must be a function");const e=new FileReader;function n(t){e.removeEventListener("loadend",n,!1),t.error?r(t.error):r(null,a.from(e.result))}e.addEventListener("loadend",n,!1),e.readAsArrayBuffer(o)};const u=f(l),s=Object.freeze(Object.defineProperty({__proto__:null,default:u},Symbol.toStringTag,{value:"Module"}));export{s as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aM as ye,ae as te,Z as ne,H as e,cU as z,G as n,N as Re,cV as me,a1 as ae,cW as Y,M as s,cX as Q,cY as De,cZ as M,cG as Pe,D as l,K as k,aA as le,bJ as Ae,a4 as ge,a5 as _,c_ as We,c$ as pe,d0 as Oe,bD as L,d1 as Ue,cM as xe,d2 as se,d3 as Ce,d4 as je,d5 as de,d6 as ue,d7 as K,d8 as G,J as be,$ as he,cI as Be,d9 as Me,da as Ie,cJ as He,db as $e,c5 as Fe,dc as ze,a6 as Ke,ad as Ge,dd as Ye,de as Qe,cN as Ve,X,df as qe,cO as Je,cP as Xe,c6 as Ze,dg as es}from"./index-BlcMW_g6.js";import{a as we,N as ss}from"./Navigation.container-gTCRHjj6.js";import{L as ts}from"./LoggedInDetailPage.container-BwMfJFSQ.js";import"./selectors-C5Krcz9D.js";import"./SignInRequired-hq09yAsv.js";var B=(t=>(t.DESC="DESC",t.ASC="ASC",t))(B||{});const Ne="tab";var b=(t=>(t.DCL="dcl",t.ENS="ens",t.CONTRIBUTOR="contributor",t))(b||{});const Ee=()=>{const t=ye(),a=new URLSearchParams(t.search),c=a.get(Ne),m={urlSearchParams:a,pathname:t.pathname};switch(c){case"dcl":m.tab="dcl";break;case"ens":m.tab="ens";break;case"contributor":m.tab="contributor";break}return m},ns=({isWorldContributorEnabled:t})=>{const{tab:a,pathname:c,urlSearchParams:m}=Ee(),d=ne(),g=o=>{const i=new URLSearchParams(m);i.set(Ne,o),d.push(`${c}?${i.toString()}`)};return!a||a===b.CONTRIBUTOR&&!t?(g(b.DCL),null):e.jsxs(z,{children:[e.jsx(z.Tab,{active:a===b.DCL,onClick:()=>g(b.DCL),children:n("worlds_list_page.name_tabs.dcl_names")}),e.jsx(z.Tab,{active:a===b.ENS,onClick:()=>g(b.ENS),children:n("worlds_list_page.name_tabs.ens_names")}),t&&e.jsx(z.Tab,{active:a===b.CONTRIBUTOR,onClick:()=>g(b.CONTRIBUTOR),children:n("worlds_list_page.name_tabs.contributor_names")})]})},as=te.memo(ns),ls=t=>({isWorldContributorEnabled:me(t)}),rs=Re(ls)(as),os="_container_12bci_1",is="_used_12bci_7",cs="_description_12bci_13",ds="_link_12bci_20",us="_space_12bci_27",bs="_current_12bci_33",hs="_bar_12bci_38",T={container:os,used:is,description:cs,link:ds,space:us,current:bs,bar:hs},_s="worlds-storage-current-mbs",ms="worlds-storage-bar-front",gs="worlds-storage",ps=({maxBytes:t,currentBytes:a,className:c,onViewDetails:m})=>{const d=Q(t),g=Q(a),o=g*100/d;return e.jsxs("div",{"data-testid":gs,className:ae(T.container,c),children:[e.jsx("span",{className:T.used,children:n("worlds_list_page.worlds_storage.used")}),e.jsxs("div",{className:T.description,children:[e.jsx("span",{children:n("worlds_list_page.worlds_storage.description")})," ",e.jsx("span",{className:T.link,onClick:m,children:n("worlds_list_page.worlds_storage.link")})]}),e.jsxs("div",{className:T.space,children:[e.jsxs("div",{"data-testid":_s,children:[e.jsx("span",{className:T.current,children:Y(g)})," / ",Y(d)," Mb"]}),e.jsx(s.Progress,{"data-testid":ms,percent:Math.trunc(o),className:T.bar,size:"small"})]})]})},xs=te.memo(ps),Cs="_worldUrl_1sb6i_1",js="_rightContainer_1sb6i_7",ws="_copyUrn_1sb6i_13",Z={worldUrl:Cs,rightContainer:js,copyUrn:ws};function Se({ens:t,deploymentsByWorlds:a}){const c=De(t.subdomain);return M(a,t)?e.jsxs("div",{className:Z.worldUrl,children:[e.jsx("span",{children:c}),e.jsxs("div",{className:Z.rightContainer,children:[e.jsx(Pe,{role:"button",text:c,showPopup:!0,children:e.jsx(s.Icon,{"aria-label":"Copy urn","aria-hidden":"false",className:ae("copy",Z.copyUrn),name:"copy outline"})}),e.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:e.jsx(s.Icon,{name:"external alternate"})})]})]}):e.jsx("span",{className:"empty-url",children:n("worlds_list_page.table.empty_url")})}function Te({deploymentsByWorlds:t,ens:a,projects:c,onEditScene:m,onUnpublishScene:d,onPublishScene:g}){const o=t[a.subdomain];return M(t,a)?e.jsxs("div",{className:"publish-scene",children:[e.jsx(s.Popup,{content:o==null?void 0:o.name,on:"hover",trigger:e.jsx("span",{children:o==null?void 0:o.name})}),c.find(i=>i.id===(o==null?void 0:o.projectId))?m&&e.jsx(s.Button,{inverted:!0,size:"small",onClick:()=>m(a),children:n("worlds_list_page.table.edit_scene")}):d&&e.jsx(s.Popup,{content:n("worlds_list_page.table.scene_published_outside_builder"),on:"hover",position:"top center",trigger:e.jsx(s.Button,{inverted:!0,size:"small",onClick:()=>d(a),children:n("worlds_list_page.table.unpublish_scene")})})]}):e.jsxs("div",{className:"publish-scene",children:[e.jsx("span",{children:"-"}),g&&e.jsx(s.Button,{primary:!0,size:"small",onClick:g,children:n("worlds_list_page.table.publish_scene")})]})}function Ns({items:t,deploymentsByWorlds:a,projects:c,loading:m,error:d,onUnpublishWorld:g}){const o=ne(),i=l.useCallback(()=>{o.push(k.scenes())},[o]),N=l.useCallback(p=>{const{projectId:x}=a[p.subdomain];o.push(k.sceneDetail(x))},[a,k,o]),E=l.useCallback(p=>{var C;const x=(C=a[p.subdomain])==null?void 0:C.id;x&&g(x)},[a,g]);return d?e.jsx(s.Message,{error:!0,size:"tiny",visible:!0,content:d.message,header:n("worlds_list_page.error_title")}):m?e.jsx(s.Loader,{active:!0,size:"big"}):t.length?e.jsxs(s.Table,{basic:"very",children:[e.jsx(s.Table.Header,{children:e.jsxs(s.Table.Row,{children:[e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.name")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.owner")}),e.jsx(s.Table.HeaderCell,{width:"2",children:n("worlds_list_page.table.url")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.published_scene")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.size")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.permissions")})]})}),e.jsx(s.Table.Body,{children:t.map((p,x)=>{var v,y;const C=(v=p.userPermissions)==null?void 0:v.includes("deployment"),f=(y=p.userPermissions)==null?void 0:y.map(R=>n(`worlds_list_page.table.user_permissions.${R}`)).join("/");return e.jsxs(s.Table.Row,{className:"TableRow",children:[e.jsx(s.Table.Cell,{width:1,children:p.name}),e.jsx(s.Table.Cell,{width:1,children:e.jsx(Ae,{address:p.nftOwnerAddress||""})}),e.jsx(s.Table.Cell,{width:2,children:e.jsx(Se,{deploymentsByWorlds:a,ens:p})}),e.jsx(s.Table.Cell,{width:1,children:e.jsx(Te,{deploymentsByWorlds:a,ens:p,projects:c,onEditScene:C?N:void 0,onPublishScene:C?i:void 0,onUnpublishScene:C?E:void 0})}),e.jsx(s.Table.Cell,{width:1,children:Y(Q(Number(p.size)||0))}),e.jsx(s.Table.Cell,{width:1,children:f})]},x)})})]}):e.jsxs(s.Empty,{className:"empty-names-container",height:500,children:[e.jsx("div",{className:"empty-icon dcl-icon"}),e.jsx("div",{className:"empty-title",children:n("worlds_list_page.empty_contributor_list.title")}),e.jsx("div",{className:"empty-description",children:n("worlds_list_page.empty_contributor_list.description",{b:p=>e.jsx("b",{children:p})})}),e.jsx(s.Button,{as:"a",href:`${le.get("MARKETPLACE_WEB_URL")}/names/claim`,target:"_blank",className:"empty-action",primary:!0,children:n("worlds_list_page.empty_list.cta")})]})}const Es=()=>{const t=ge(),a=we(),c=_(We),m=_(pe),d=_(Oe),g=_(i=>L(xe(i),Ue)||L(Ce(i),se)),o=l.useCallback(i=>t(je(i)),[t]);return e.jsx(Ns,{items:c,deploymentsByWorlds:m,projects:a,loading:g,error:d,onUnpublishWorld:o})},_e="Worlds List Page Action",Ss=le.get("ENS_DOMAINS_URL",""),Ts=le.get("MARKETPLACE_WEB_URL"),ee=12,Ls=t=>{const{ensList:a,externalNames:c,error:m,deploymentsByWorlds:d,isLoading:g,projects:o,worldsWalletStats:i,isConnected:N,isWorldContributorEnabled:E,ensTotal:p,onOpenYourStorageModal:x,onOpenWorldsForENSOwnersAnnouncementModal:C,onUnpublishWorld:f,onOpenPermissionsModal:v,onFetchContributableNames:y,onFetchENSList:R}=t,[I,D]=l.useState(B.DESC),[O,U]=l.useState(1),{tab:h}=Ee(),P=ne();l.useEffect(()=>{N&&E&&y()},[N,E]),l.useEffect(()=>{h===b.DCL&&R(ee,(O-1)*ee)},[R,O]);const A=l.useCallback(()=>{h===b.DCL?(de(_e,{action:"Click Claim NAME"}),window.open(`${Ts}/names/claim`,"_blank","noopener,noreferrer")):(de(_e,{action:"Click Claim ENS Domain"}),window.open(Ss,"_blank","noopener,noreferrer"))},[h]),V=l.useCallback(()=>{P.push(k.scenes())},[k,P]),q=l.useCallback(u=>{const{projectId:r}=d[u.subdomain];P.push(k.sceneDetail(r))},[d,k,P]),w=l.useCallback(u=>{var j;const r=(j=d[u.subdomain])==null?void 0:j.id;r&&f(r)},[d,f]),W=l.useCallback((u,r)=>{U(+r.activePage)},[]),re=l.useCallback(()=>e.jsx(s.Dropdown,{direction:"left",value:I,options:[{value:B.ASC,text:n("global.order.name_asc")},{value:B.DESC,text:n("global.order.name_desc")}],onChange:(u,{value:r})=>D(r)}),[I,D]),oe=l.useCallback(u=>{let r=M(d,u)?"active":"inactive";if(r==="active"&&i&&!ue(u.subdomain))switch(K(i).status){case G.BLOCKED:{r="blocked";break}case G.TO_BE_BLOCKED:r="warning"}return e.jsx("span",{className:`world-status ${r}`,children:n(`worlds_list_page.table.status_${r}`)})},[K,ue,M]),ie=l.useCallback((u,r)=>{var F;const j=h===b.DCL?r==null?void 0:r.dclNames:r==null?void 0:r.ensNames;if(!M(d,u)||!j)return"-";const S=(F=j.find(ve=>ve.name===u.subdomain))==null?void 0:F.size,J=h===b.ENS?" / 25":"";return Y(Q(Number(S)))+J},[h]),Le=l.useCallback((u,r)=>{v(r)},[]),H=l.useCallback(()=>{const u=h===b.DCL?p:c.length,r=Math.ceil(u/ee),j=h===b.DCL?a:c;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"filters",children:e.jsx(s.Container,{children:e.jsxs(s.Row,{children:[e.jsx(s.Column,{children:e.jsx(s.Row,{children:e.jsx(s.Header,{sub:!0,className:"items-count",children:n("ens_list_page.items",{count:t.ensTotal.toLocaleString()})})})}),e.jsx(s.Column,{align:"right",children:e.jsx(s.Row,{children:re()})}),e.jsx(s.Column,{align:"right",grow:!1,shrink:!0,children:e.jsx(s.Row,{children:e.jsx("div",{className:"actions",children:e.jsx(s.Button,{basic:!0,onClick:A,children:e.jsx(be,{name:"add-active"})})})})})]})})}),e.jsx(s.Container,{children:e.jsxs(s.Section,{className:"table-section",children:[e.jsxs(s.Table,{basic:"very",children:[e.jsx(s.Table.Header,{children:e.jsxs(s.Table.Row,{children:[e.jsx(s.Table.HeaderCell,{width:"2",children:n("worlds_list_page.table.name")}),e.jsx(s.Table.HeaderCell,{width:"2",children:n("worlds_list_page.table.url")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.published_scene")}),e.jsx(s.Table.HeaderCell,{width:"1",textAlign:"center",children:n("worlds_list_page.table.size")}),e.jsx(s.Table.HeaderCell,{width:"1",textAlign:"center",children:n("worlds_list_page.table.status")}),e.jsx(s.Table.HeaderCell,{width:"1",textAlign:"center"})]})}),e.jsx(s.Table.Body,{children:j.map((S,J)=>e.jsxs(s.Table.Row,{className:"TableRow",children:[e.jsx(s.Table.Cell,{width:2,children:S.name}),e.jsx(s.Table.Cell,{width:2,children:e.jsx(Se,{deploymentsByWorlds:d,ens:S})}),e.jsx(s.Table.Cell,{width:1,children:e.jsx(Te,{deploymentsByWorlds:d,ens:S,projects:o,onEditScene:q,onPublishScene:V,onUnpublishScene:w})}),e.jsx(s.Table.Cell,{width:1,textAlign:"center",children:ie(S,i)}),e.jsx(s.Table.Cell,{width:1,textAlign:"center",children:oe(S)}),e.jsx(s.Table.Cell,{width:1,textAlign:"center",children:e.jsx(s.Button,{basic:!0,onClick:F=>Le(F,S.subdomain),children:"Permissions"})})]},J))})]}),r>1&&e.jsx(s.Pagination,{firstItem:null,lastItem:null,totalPages:r,activePage:O,onPageChange:W})]})})]})},[h,a,c,A,re,ie,oe,W,p]),$=l.useCallback(()=>e.jsxs(s.Empty,{className:"empty-names-container",height:500,children:[e.jsx("div",{className:ae("empty-icon",h===b.DCL?"dcl-icon":"ens-icon")}),e.jsx("div",{className:"empty-title",children:h===b.DCL?n("worlds_list_page.empty_list.title"):n("worlds_list_page.empty_list.title_ens")}),e.jsx("div",{className:"empty-description",children:h===b.DCL?n("worlds_list_page.empty_list.description",{b:u=>e.jsx("b",{children:u})}):n("worlds_list_page.empty_list.description_ens",{b:u=>e.jsx("b",{children:u})})}),e.jsx(s.Button,{className:"empty-action",primary:!0,onClick:A,children:h===b.DCL?n("worlds_list_page.empty_list.cta"):n("worlds_list_page.empty_list.cta_ens")})]}),[h,A]),ce=l.useCallback(()=>{if(!i)return null;const u=K(i);if(u.status===G.OK)return null;let r;return u.status===G.TO_BE_BLOCKED?r=n("worlds_list_page.worlds_warning_message.to_be_blocked",{toBeBlockedAt:u.toBeBlockedAt.toLocaleDateString(),b:j=>e.jsx("b",{children:j})}):r=n("worlds_list_page.worlds_warning_message.blocked",{blockedAt:u.blockedAt.toLocaleDateString(),b:j=>e.jsx("b",{children:j})}),e.jsxs("div",{className:"insufficient-storage-message",children:[e.jsx("div",{children:e.jsx(be,{name:"alert-warning"})}),e.jsx("div",{children:r})]})},[i,K]),ke=l.useCallback(()=>a.length?e.jsxs("div",{children:[i?e.jsx(xs,{maxBytes:Number(i.maxAllowedSpace),currentBytes:Number(i.usedSpace),className:"worlds-storage",onViewDetails:()=>{x({stats:i})}}):null,ce(),H()]}):e.jsx("div",{children:$()}),[a,i,H,$,ce,x]),fe=l.useCallback(()=>e.jsx("div",{children:c.length>0?H():$()}),[c,$,H]);return l.useEffect(()=>{D(B.ASC),U(1)},[h,U,D]),l.useEffect(()=>{he()&&C()},[he,C]),e.jsx(ts,{className:"WorldListPage view",error:m,activeTab:ss.WORLDS,isLoading:g,isPageFullscreen:!0,children:e.jsxs(s.Container,{children:[e.jsx("h1",{children:n("worlds_list_page.title")}),e.jsx(rs,{}),h===b.DCL&&ke(),h===b.ENS&&fe(),h===b.CONTRIBUTOR&&E&&e.jsx(Es,{})]})})},ks=te.memo(Ls),fs=()=>{const t=ge(),a=we(),c=_(Be),m=_(Me),d=_(pe),g=_(Ie),o=_(He),i=_($e),N=_(xe),E=_(Ce),p=_(Fe),x=_(ze),C=_(Ke),f=_(Ge),v=_(Ye),y=_(Qe),R=_(me),I=_(Ve),D=(o==null?void 0:o.message)??i??void 0,O=l.useMemo(()=>L(N,Xe)||L(E,se)||L(p,Ze)||L(x,se)||L(N,es)||C,[N,E,p,x,C]),U=l.useCallback(w=>t(X("WorldsYourStorageModal",w)),[t]),h=l.useCallback((w,W)=>t(X("WorldPermissionsModal",{worldName:w,isCollaboratorsTabShown:W})),[t]),P=l.useCallback(()=>t(X("WorldsForENSOwnersAnnouncementModal")),[t]),A=l.useCallback(w=>t(je(w)),[t]),V=l.useCallback(()=>t(qe()),[t]),q=l.useCallback((w,W)=>t(Je(w,W)),[t]);return e.jsx(ks,{ensList:c,externalNames:m,deploymentsByWorlds:d,projects:a,worldsPermissions:g,error:D,isLoading:O,isLoggedIn:f,worldsWalletStats:v,isConnected:y,isWorldContributorEnabled:R,ensTotal:I,onOpenYourStorageModal:U,onOpenPermissionsModal:h,onOpenWorldsForENSOwnersAnnouncementModal:P,onUnpublishWorld:A,onFetchContributableNames:V,onFetchENSList:q})},As=fs;export{As as default};
|
|
1
|
+
import{aM as ye,ae as te,Z as ne,H as e,cU as z,G as n,N as Re,cV as me,a1 as ae,cW as Y,M as s,cX as Q,cY as De,cZ as M,cG as Pe,D as l,K as k,aA as le,bJ as Ae,a4 as ge,a5 as _,c_ as We,c$ as pe,d0 as Oe,bD as L,d1 as Ue,cM as xe,d2 as se,d3 as Ce,d4 as je,d5 as de,d6 as ue,d7 as K,d8 as G,J as be,$ as he,cI as Be,d9 as Me,da as Ie,cJ as He,db as $e,c5 as Fe,dc as ze,a6 as Ke,ad as Ge,dd as Ye,de as Qe,cN as Ve,X,df as qe,cO as Je,cP as Xe,c6 as Ze,dg as es}from"./index-LbPj94fr.js";import{a as we,N as ss}from"./Navigation.container-m_5Xay6X.js";import{L as ts}from"./LoggedInDetailPage.container-BLLfFAse.js";import"./selectors-CSnw6goy.js";import"./SignInRequired-cMu1CrC_.js";var B=(t=>(t.DESC="DESC",t.ASC="ASC",t))(B||{});const Ne="tab";var b=(t=>(t.DCL="dcl",t.ENS="ens",t.CONTRIBUTOR="contributor",t))(b||{});const Ee=()=>{const t=ye(),a=new URLSearchParams(t.search),c=a.get(Ne),m={urlSearchParams:a,pathname:t.pathname};switch(c){case"dcl":m.tab="dcl";break;case"ens":m.tab="ens";break;case"contributor":m.tab="contributor";break}return m},ns=({isWorldContributorEnabled:t})=>{const{tab:a,pathname:c,urlSearchParams:m}=Ee(),d=ne(),g=o=>{const i=new URLSearchParams(m);i.set(Ne,o),d.push(`${c}?${i.toString()}`)};return!a||a===b.CONTRIBUTOR&&!t?(g(b.DCL),null):e.jsxs(z,{children:[e.jsx(z.Tab,{active:a===b.DCL,onClick:()=>g(b.DCL),children:n("worlds_list_page.name_tabs.dcl_names")}),e.jsx(z.Tab,{active:a===b.ENS,onClick:()=>g(b.ENS),children:n("worlds_list_page.name_tabs.ens_names")}),t&&e.jsx(z.Tab,{active:a===b.CONTRIBUTOR,onClick:()=>g(b.CONTRIBUTOR),children:n("worlds_list_page.name_tabs.contributor_names")})]})},as=te.memo(ns),ls=t=>({isWorldContributorEnabled:me(t)}),rs=Re(ls)(as),os="_container_12bci_1",is="_used_12bci_7",cs="_description_12bci_13",ds="_link_12bci_20",us="_space_12bci_27",bs="_current_12bci_33",hs="_bar_12bci_38",T={container:os,used:is,description:cs,link:ds,space:us,current:bs,bar:hs},_s="worlds-storage-current-mbs",ms="worlds-storage-bar-front",gs="worlds-storage",ps=({maxBytes:t,currentBytes:a,className:c,onViewDetails:m})=>{const d=Q(t),g=Q(a),o=g*100/d;return e.jsxs("div",{"data-testid":gs,className:ae(T.container,c),children:[e.jsx("span",{className:T.used,children:n("worlds_list_page.worlds_storage.used")}),e.jsxs("div",{className:T.description,children:[e.jsx("span",{children:n("worlds_list_page.worlds_storage.description")})," ",e.jsx("span",{className:T.link,onClick:m,children:n("worlds_list_page.worlds_storage.link")})]}),e.jsxs("div",{className:T.space,children:[e.jsxs("div",{"data-testid":_s,children:[e.jsx("span",{className:T.current,children:Y(g)})," / ",Y(d)," Mb"]}),e.jsx(s.Progress,{"data-testid":ms,percent:Math.trunc(o),className:T.bar,size:"small"})]})]})},xs=te.memo(ps),Cs="_worldUrl_1sb6i_1",js="_rightContainer_1sb6i_7",ws="_copyUrn_1sb6i_13",Z={worldUrl:Cs,rightContainer:js,copyUrn:ws};function Se({ens:t,deploymentsByWorlds:a}){const c=De(t.subdomain);return M(a,t)?e.jsxs("div",{className:Z.worldUrl,children:[e.jsx("span",{children:c}),e.jsxs("div",{className:Z.rightContainer,children:[e.jsx(Pe,{role:"button",text:c,showPopup:!0,children:e.jsx(s.Icon,{"aria-label":"Copy urn","aria-hidden":"false",className:ae("copy",Z.copyUrn),name:"copy outline"})}),e.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:e.jsx(s.Icon,{name:"external alternate"})})]})]}):e.jsx("span",{className:"empty-url",children:n("worlds_list_page.table.empty_url")})}function Te({deploymentsByWorlds:t,ens:a,projects:c,onEditScene:m,onUnpublishScene:d,onPublishScene:g}){const o=t[a.subdomain];return M(t,a)?e.jsxs("div",{className:"publish-scene",children:[e.jsx(s.Popup,{content:o==null?void 0:o.name,on:"hover",trigger:e.jsx("span",{children:o==null?void 0:o.name})}),c.find(i=>i.id===(o==null?void 0:o.projectId))?m&&e.jsx(s.Button,{inverted:!0,size:"small",onClick:()=>m(a),children:n("worlds_list_page.table.edit_scene")}):d&&e.jsx(s.Popup,{content:n("worlds_list_page.table.scene_published_outside_builder"),on:"hover",position:"top center",trigger:e.jsx(s.Button,{inverted:!0,size:"small",onClick:()=>d(a),children:n("worlds_list_page.table.unpublish_scene")})})]}):e.jsxs("div",{className:"publish-scene",children:[e.jsx("span",{children:"-"}),g&&e.jsx(s.Button,{primary:!0,size:"small",onClick:g,children:n("worlds_list_page.table.publish_scene")})]})}function Ns({items:t,deploymentsByWorlds:a,projects:c,loading:m,error:d,onUnpublishWorld:g}){const o=ne(),i=l.useCallback(()=>{o.push(k.scenes())},[o]),N=l.useCallback(p=>{const{projectId:x}=a[p.subdomain];o.push(k.sceneDetail(x))},[a,k,o]),E=l.useCallback(p=>{var C;const x=(C=a[p.subdomain])==null?void 0:C.id;x&&g(x)},[a,g]);return d?e.jsx(s.Message,{error:!0,size:"tiny",visible:!0,content:d.message,header:n("worlds_list_page.error_title")}):m?e.jsx(s.Loader,{active:!0,size:"big"}):t.length?e.jsxs(s.Table,{basic:"very",children:[e.jsx(s.Table.Header,{children:e.jsxs(s.Table.Row,{children:[e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.name")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.owner")}),e.jsx(s.Table.HeaderCell,{width:"2",children:n("worlds_list_page.table.url")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.published_scene")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.size")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.permissions")})]})}),e.jsx(s.Table.Body,{children:t.map((p,x)=>{var v,y;const C=(v=p.userPermissions)==null?void 0:v.includes("deployment"),f=(y=p.userPermissions)==null?void 0:y.map(R=>n(`worlds_list_page.table.user_permissions.${R}`)).join("/");return e.jsxs(s.Table.Row,{className:"TableRow",children:[e.jsx(s.Table.Cell,{width:1,children:p.name}),e.jsx(s.Table.Cell,{width:1,children:e.jsx(Ae,{address:p.nftOwnerAddress||""})}),e.jsx(s.Table.Cell,{width:2,children:e.jsx(Se,{deploymentsByWorlds:a,ens:p})}),e.jsx(s.Table.Cell,{width:1,children:e.jsx(Te,{deploymentsByWorlds:a,ens:p,projects:c,onEditScene:C?N:void 0,onPublishScene:C?i:void 0,onUnpublishScene:C?E:void 0})}),e.jsx(s.Table.Cell,{width:1,children:Y(Q(Number(p.size)||0))}),e.jsx(s.Table.Cell,{width:1,children:f})]},x)})})]}):e.jsxs(s.Empty,{className:"empty-names-container",height:500,children:[e.jsx("div",{className:"empty-icon dcl-icon"}),e.jsx("div",{className:"empty-title",children:n("worlds_list_page.empty_contributor_list.title")}),e.jsx("div",{className:"empty-description",children:n("worlds_list_page.empty_contributor_list.description",{b:p=>e.jsx("b",{children:p})})}),e.jsx(s.Button,{as:"a",href:`${le.get("MARKETPLACE_WEB_URL")}/names/claim`,target:"_blank",className:"empty-action",primary:!0,children:n("worlds_list_page.empty_list.cta")})]})}const Es=()=>{const t=ge(),a=we(),c=_(We),m=_(pe),d=_(Oe),g=_(i=>L(xe(i),Ue)||L(Ce(i),se)),o=l.useCallback(i=>t(je(i)),[t]);return e.jsx(Ns,{items:c,deploymentsByWorlds:m,projects:a,loading:g,error:d,onUnpublishWorld:o})},_e="Worlds List Page Action",Ss=le.get("ENS_DOMAINS_URL",""),Ts=le.get("MARKETPLACE_WEB_URL"),ee=12,Ls=t=>{const{ensList:a,externalNames:c,error:m,deploymentsByWorlds:d,isLoading:g,projects:o,worldsWalletStats:i,isConnected:N,isWorldContributorEnabled:E,ensTotal:p,onOpenYourStorageModal:x,onOpenWorldsForENSOwnersAnnouncementModal:C,onUnpublishWorld:f,onOpenPermissionsModal:v,onFetchContributableNames:y,onFetchENSList:R}=t,[I,D]=l.useState(B.DESC),[O,U]=l.useState(1),{tab:h}=Ee(),P=ne();l.useEffect(()=>{N&&E&&y()},[N,E]),l.useEffect(()=>{h===b.DCL&&R(ee,(O-1)*ee)},[R,O]);const A=l.useCallback(()=>{h===b.DCL?(de(_e,{action:"Click Claim NAME"}),window.open(`${Ts}/names/claim`,"_blank","noopener,noreferrer")):(de(_e,{action:"Click Claim ENS Domain"}),window.open(Ss,"_blank","noopener,noreferrer"))},[h]),V=l.useCallback(()=>{P.push(k.scenes())},[k,P]),q=l.useCallback(u=>{const{projectId:r}=d[u.subdomain];P.push(k.sceneDetail(r))},[d,k,P]),w=l.useCallback(u=>{var j;const r=(j=d[u.subdomain])==null?void 0:j.id;r&&f(r)},[d,f]),W=l.useCallback((u,r)=>{U(+r.activePage)},[]),re=l.useCallback(()=>e.jsx(s.Dropdown,{direction:"left",value:I,options:[{value:B.ASC,text:n("global.order.name_asc")},{value:B.DESC,text:n("global.order.name_desc")}],onChange:(u,{value:r})=>D(r)}),[I,D]),oe=l.useCallback(u=>{let r=M(d,u)?"active":"inactive";if(r==="active"&&i&&!ue(u.subdomain))switch(K(i).status){case G.BLOCKED:{r="blocked";break}case G.TO_BE_BLOCKED:r="warning"}return e.jsx("span",{className:`world-status ${r}`,children:n(`worlds_list_page.table.status_${r}`)})},[K,ue,M]),ie=l.useCallback((u,r)=>{var F;const j=h===b.DCL?r==null?void 0:r.dclNames:r==null?void 0:r.ensNames;if(!M(d,u)||!j)return"-";const S=(F=j.find(ve=>ve.name===u.subdomain))==null?void 0:F.size,J=h===b.ENS?" / 25":"";return Y(Q(Number(S)))+J},[h]),Le=l.useCallback((u,r)=>{v(r)},[]),H=l.useCallback(()=>{const u=h===b.DCL?p:c.length,r=Math.ceil(u/ee),j=h===b.DCL?a:c;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"filters",children:e.jsx(s.Container,{children:e.jsxs(s.Row,{children:[e.jsx(s.Column,{children:e.jsx(s.Row,{children:e.jsx(s.Header,{sub:!0,className:"items-count",children:n("ens_list_page.items",{count:t.ensTotal.toLocaleString()})})})}),e.jsx(s.Column,{align:"right",children:e.jsx(s.Row,{children:re()})}),e.jsx(s.Column,{align:"right",grow:!1,shrink:!0,children:e.jsx(s.Row,{children:e.jsx("div",{className:"actions",children:e.jsx(s.Button,{basic:!0,onClick:A,children:e.jsx(be,{name:"add-active"})})})})})]})})}),e.jsx(s.Container,{children:e.jsxs(s.Section,{className:"table-section",children:[e.jsxs(s.Table,{basic:"very",children:[e.jsx(s.Table.Header,{children:e.jsxs(s.Table.Row,{children:[e.jsx(s.Table.HeaderCell,{width:"2",children:n("worlds_list_page.table.name")}),e.jsx(s.Table.HeaderCell,{width:"2",children:n("worlds_list_page.table.url")}),e.jsx(s.Table.HeaderCell,{width:"1",children:n("worlds_list_page.table.published_scene")}),e.jsx(s.Table.HeaderCell,{width:"1",textAlign:"center",children:n("worlds_list_page.table.size")}),e.jsx(s.Table.HeaderCell,{width:"1",textAlign:"center",children:n("worlds_list_page.table.status")}),e.jsx(s.Table.HeaderCell,{width:"1",textAlign:"center"})]})}),e.jsx(s.Table.Body,{children:j.map((S,J)=>e.jsxs(s.Table.Row,{className:"TableRow",children:[e.jsx(s.Table.Cell,{width:2,children:S.name}),e.jsx(s.Table.Cell,{width:2,children:e.jsx(Se,{deploymentsByWorlds:d,ens:S})}),e.jsx(s.Table.Cell,{width:1,children:e.jsx(Te,{deploymentsByWorlds:d,ens:S,projects:o,onEditScene:q,onPublishScene:V,onUnpublishScene:w})}),e.jsx(s.Table.Cell,{width:1,textAlign:"center",children:ie(S,i)}),e.jsx(s.Table.Cell,{width:1,textAlign:"center",children:oe(S)}),e.jsx(s.Table.Cell,{width:1,textAlign:"center",children:e.jsx(s.Button,{basic:!0,onClick:F=>Le(F,S.subdomain),children:"Permissions"})})]},J))})]}),r>1&&e.jsx(s.Pagination,{firstItem:null,lastItem:null,totalPages:r,activePage:O,onPageChange:W})]})})]})},[h,a,c,A,re,ie,oe,W,p]),$=l.useCallback(()=>e.jsxs(s.Empty,{className:"empty-names-container",height:500,children:[e.jsx("div",{className:ae("empty-icon",h===b.DCL?"dcl-icon":"ens-icon")}),e.jsx("div",{className:"empty-title",children:h===b.DCL?n("worlds_list_page.empty_list.title"):n("worlds_list_page.empty_list.title_ens")}),e.jsx("div",{className:"empty-description",children:h===b.DCL?n("worlds_list_page.empty_list.description",{b:u=>e.jsx("b",{children:u})}):n("worlds_list_page.empty_list.description_ens",{b:u=>e.jsx("b",{children:u})})}),e.jsx(s.Button,{className:"empty-action",primary:!0,onClick:A,children:h===b.DCL?n("worlds_list_page.empty_list.cta"):n("worlds_list_page.empty_list.cta_ens")})]}),[h,A]),ce=l.useCallback(()=>{if(!i)return null;const u=K(i);if(u.status===G.OK)return null;let r;return u.status===G.TO_BE_BLOCKED?r=n("worlds_list_page.worlds_warning_message.to_be_blocked",{toBeBlockedAt:u.toBeBlockedAt.toLocaleDateString(),b:j=>e.jsx("b",{children:j})}):r=n("worlds_list_page.worlds_warning_message.blocked",{blockedAt:u.blockedAt.toLocaleDateString(),b:j=>e.jsx("b",{children:j})}),e.jsxs("div",{className:"insufficient-storage-message",children:[e.jsx("div",{children:e.jsx(be,{name:"alert-warning"})}),e.jsx("div",{children:r})]})},[i,K]),ke=l.useCallback(()=>a.length?e.jsxs("div",{children:[i?e.jsx(xs,{maxBytes:Number(i.maxAllowedSpace),currentBytes:Number(i.usedSpace),className:"worlds-storage",onViewDetails:()=>{x({stats:i})}}):null,ce(),H()]}):e.jsx("div",{children:$()}),[a,i,H,$,ce,x]),fe=l.useCallback(()=>e.jsx("div",{children:c.length>0?H():$()}),[c,$,H]);return l.useEffect(()=>{D(B.ASC),U(1)},[h,U,D]),l.useEffect(()=>{he()&&C()},[he,C]),e.jsx(ts,{className:"WorldListPage view",error:m,activeTab:ss.WORLDS,isLoading:g,isPageFullscreen:!0,children:e.jsxs(s.Container,{children:[e.jsx("h1",{children:n("worlds_list_page.title")}),e.jsx(rs,{}),h===b.DCL&&ke(),h===b.ENS&&fe(),h===b.CONTRIBUTOR&&E&&e.jsx(Es,{})]})})},ks=te.memo(Ls),fs=()=>{const t=ge(),a=we(),c=_(Be),m=_(Me),d=_(pe),g=_(Ie),o=_(He),i=_($e),N=_(xe),E=_(Ce),p=_(Fe),x=_(ze),C=_(Ke),f=_(Ge),v=_(Ye),y=_(Qe),R=_(me),I=_(Ve),D=(o==null?void 0:o.message)??i??void 0,O=l.useMemo(()=>L(N,Xe)||L(E,se)||L(p,Ze)||L(x,se)||L(N,es)||C,[N,E,p,x,C]),U=l.useCallback(w=>t(X("WorldsYourStorageModal",w)),[t]),h=l.useCallback((w,W)=>t(X("WorldPermissionsModal",{worldName:w,isCollaboratorsTabShown:W})),[t]),P=l.useCallback(()=>t(X("WorldsForENSOwnersAnnouncementModal")),[t]),A=l.useCallback(w=>t(je(w)),[t]),V=l.useCallback(()=>t(qe()),[t]),q=l.useCallback((w,W)=>t(Je(w,W)),[t]);return e.jsx(ks,{ensList:c,externalNames:m,deploymentsByWorlds:d,projects:a,worldsPermissions:g,error:D,isLoading:O,isLoggedIn:f,worldsWalletStats:v,isConnected:y,isWorldContributorEnabled:R,ensTotal:I,onOpenYourStorageModal:U,onOpenPermissionsModal:h,onOpenWorldsForENSOwnersAnnouncementModal:P,onUnpublishWorld:A,onFetchContributableNames:V,onFetchENSList:q})},As=fs;export{As as default};
|