@dcl/builder-site 7.4.1 → 7.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/assets/{Back-By-4R-U1.js → Back-B62mVjOv.js} +1 -1
  2. package/assets/{CollectionProvider.container-B55XxdNh.js → CollectionProvider.container-FTdRZ8FI.js} +1 -1
  3. package/assets/{CollectionStatus.container-Bg3t2d-h.js → CollectionStatus.container-CEXau8OY.js} +1 -1
  4. package/assets/{ConfirmDelete-qdY8nP-O.js → ConfirmDelete-BLQNvkka.js} +1 -1
  5. package/assets/{FileSaver.min-6d0fq5Zo.js → FileSaver.min-CeRhf4hO.js} +1 -1
  6. package/assets/{ItemProvider.container-BRoayas-.js → ItemProvider.container-nX_IipK6.js} +1 -1
  7. package/assets/{JumpIn.container-DH7vWxVG.js → JumpIn.container-C-3SfWd2.js} +1 -1
  8. package/assets/{LandAction-VPDjrQkE.js → LandAction-Lnm_J4-1.js} +1 -1
  9. package/assets/{LandProviderPage-D8_roYWH.js → LandProviderPage-oH9f8i7v.js} +1 -1
  10. package/assets/{LoggedInDetailPage.container-D9YzD5-u.js → LoggedInDetailPage.container-CgMIisR0.js} +1 -1
  11. package/assets/{Navigation-CQYgeT0w.css → Navigation-CYLdovRI.css} +1 -1
  12. package/assets/{Navigation.container-DNCp40XB.js → Navigation.container-CJ8N4u9A.js} +1 -1
  13. package/assets/{NotFound-CS8G9Pe7.js → NotFound-DrUt7rXf.js} +1 -1
  14. package/assets/{OptionsDropdown-C_I20F2W.js → OptionsDropdown-BqiAn02A.js} +1 -1
  15. package/assets/{RentalPeriod-B_tZDHSz.js → RentalPeriod-D1ikaziy.js} +1 -1
  16. package/assets/{SDKTag-DOrmnsZR.js → SDKTag-BrDktxn-.js} +1 -1
  17. package/assets/{SceneStats.container-D6Wzk9ps.js → SceneStats.container-DTkBXKub.js} +1 -1
  18. package/assets/{SignInRequired-oPiM_HvB.js → SignInRequired-Co3AdME1.js} +1 -1
  19. package/assets/{ThirdPartyKindBadge-1EbBCupx.js → ThirdPartyKindBadge-cFEUgKTo.js} +1 -1
  20. package/assets/{dataReader-DZpAk_6V.js → dataReader-C76OQs5c.js} +1 -1
  21. package/assets/{date-B65jEeMH.js → date-C2tNJtwt.js} +1 -1
  22. package/assets/{fortmatic-D-731_dx.js → fortmatic-B13b1ilW.js} +1 -1
  23. package/assets/{index-BgVtl5Kb.js → index-0uYZzMVh.js} +1 -1
  24. package/assets/{index-DWKsbmz4.css → index-2ADwdunP.css} +1 -1
  25. package/assets/{index-DBSmcWBI.js → index-5Lu_9-ML.js} +1 -1
  26. package/assets/{index-CevTTMEC.js → index-7dJvWLbI.js} +1 -1
  27. package/assets/{index-BRJz6R2g.js → index-B3bcE88H.js} +1 -1
  28. package/assets/index-BHubAszU.js +1 -0
  29. package/assets/{index-D2Tg9A0P.js → index-BM0TWj3K.js} +1 -1
  30. package/assets/{index-DKdhp46t.js → index-BQL5S7pF.js} +1 -1
  31. package/assets/{index-C-P9CP2I.js → index-BR3hEkAM.js} +1 -1
  32. package/assets/{index-BylH3QQG.js → index-BUPRY9cW.js} +2 -2
  33. package/assets/index-BWu2Xjny.js +1 -0
  34. package/assets/{index-trPgNxCf.js → index-BXELDlT4.js} +1 -1
  35. package/assets/{index-BaEn8M8S.js → index-BbDVb0yu.js} +1 -1
  36. package/assets/{index-CkRBTILh.js → index-BepCpL7N.js} +1 -1
  37. package/assets/{index-SYJEtIt5.css → index-BiO2UVsD.css} +1 -1
  38. package/assets/{index-C76j8aLR.js → index-BjmXCJXE.js} +1 -1
  39. package/assets/{index-BDU0HuvD.js → index-BkUehG-N.js} +1 -1
  40. package/assets/{index-D5d4Ja9w.js → index-BxBBz8iT.js} +1 -1
  41. package/assets/{index-DMjP9_6s.js → index-C1M-nBtY.js} +1 -1
  42. package/assets/{index-iE_RFPFQ.js → index-C3m9KePX.js} +1 -1
  43. package/assets/{index-Cq3OUMiL.js → index-C6Gbq4GC.js} +1 -1
  44. package/assets/{index-BdeFFxb_.js → index-C9kwV-aM.js} +1 -1
  45. package/assets/{index-BVPu4mBc.js → index-CEHPL_g7.js} +1 -1
  46. package/assets/{index-CY3zyJtP.js → index-CUQSBzdG.js} +1 -1
  47. package/assets/{index-D4N6UG21.js → index-CdR_aJJ2.js} +1 -1
  48. package/assets/{index-C322ZtLM.js → index-CeSsPR0B.js} +1 -1
  49. package/assets/{index-i84hpsRQ.js → index-CmIpVPtZ.js} +1 -1
  50. package/assets/{index-iQcJ-NCZ.js → index-CoWn-Ewy.js} +1 -1
  51. package/assets/{index-CXfXhCAZ.js → index-Cu7Q_46v.js} +1 -1
  52. package/assets/{index-5MY3U2K8.js → index-CynXpVXz.js} +1 -1
  53. package/assets/{index-B-7_EPGZ.js → index-CzG3UQf9.js} +1 -1
  54. package/assets/{index-Ydji3YUi.js → index-D-BLv39Z.js} +1 -1
  55. package/assets/{index-CCw_mTG8.css → index-DGOMuqho.css} +1 -1
  56. package/assets/{index-Crpg26Cm.js → index-DGXgLP2S.js} +1 -1
  57. package/assets/{index-buaXxN2s.css → index-DVh8RoH3.css} +1 -1
  58. package/assets/{index-BV-Nnza1.js → index-DYwSLcXN.js} +1 -1
  59. package/assets/{index-BJpiO9hV.css → index-DZc4gDF6.css} +1 -1
  60. package/assets/{index-KsM5oCK9.js → index-DhIukBcT.js} +1 -1
  61. package/assets/{index-82f5YOSU.js → index-DkbGiW76.js} +1 -1
  62. package/assets/{index-C6BvwEoI.css → index-DlROUR0k.css} +1 -1
  63. package/assets/{index-BYrhuK3j.js → index-Dn9-1u5V.js} +1 -1
  64. package/assets/{index-41C5YwXr.js → index-DnIS3hck.js} +22 -22
  65. package/assets/{index-DEvjUSh6.js → index-Dx-FwS0Z.js} +1 -1
  66. package/assets/{index-X8HThZEv.js → index-JrPhmS5Y.js} +1 -1
  67. package/assets/{index-bgb_kBBP.css → index-dwJpb0WF.css} +7 -7
  68. package/assets/{index-CtrKelMu.js → index-i91oqnzV.js} +1 -1
  69. package/assets/{index-DlHmKahn.js → index-kl_t07BE.js} +1 -1
  70. package/assets/{index-BvpgC1C7.js → index-mDNxs6ks.js} +1 -1
  71. package/assets/{index-pbqI9Pqo.js → index-xGrNxOTg.js} +1 -1
  72. package/assets/{index.es-BtOP83dX.js → index.es-Dt3Pk7ji.js} +4 -4
  73. package/assets/{selectors-B-FgaFOX.js → selectors-Du6lRm3_.js} +1 -1
  74. package/index.html +3 -3
  75. package/package.json +3 -3
  76. package/assets/index-BDB8oimK.js +0 -1
  77. package/assets/index-_fU_kOtI.js +0 -1
@@ -1 +1 @@
1
- var rt=Object.defineProperty;var dt=(n,l,e)=>l in n?rt(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e;var h=(n,l,e)=>dt(n,typeof l!="symbol"?l+"":l,e);import{af as z,H as t,M as c,G as d,bm as H,bD as ct,D as x,gt as K,L as ee,K as R,cf as Me,b8 as _,N as B,bw as V,eD as ht,gu as mt,gv as gt,gw as pt,gx as ut,gy as Ct,gz as It,gA as bt,gB as xt,gC as _t,gD as L,er as vt,gE as Z,gF as Et,gG as Q,fc as Le,fr as jt,fX as St,fY as ft,eA as he,gm as wt,aH as te,gH as Tt,db as be,gI as xe,bt as Oe,gJ as yt,fZ as Pt,eE as me,aW as At,gK as Nt,gL as Rt,gM as Dt,fo as Mt,f$ as Lt,g0 as Ot,Z as ke,bv as Be,gN as kt,eS as fe,bE as Bt,fk as We,ae as Wt,gO as Fe,eH as _e,X as He,eu as Ft,ep as Ve,fF as X,dD as ge,eq as Ht,eV as pe,gP as $e,bk as ve,fV as Ue,eY as y,es as Y,fA as Je,fB as ue,J as O,f6 as Ce,dC as Vt,eQ as $t,eB as Ut,gQ as Ee,fb as je,fj as Jt,gR as Yt,gS as zt,gT as qt,gU as Ye,gV as ze,gW as qe,gX as Ge,fJ as Ze,eK as Gt,eJ as Ke,eL as Zt,eN as Kt,eO as Qt,gY as Xt,gZ as es,g_ as ts,g$ as se,h0 as oe,h1 as ss,ed as as,h2 as ns,h3 as is,h4 as ls,h5 as os,h6 as rs,h7 as ds,h8 as cs,h9 as hs,ha as ms,hb as gs,hc as ps,hd as us,he as Cs,hf as Is,hg as bs,hh as xs,hi as _s,hj as vs,f_ as Es,bO as ne,hk as js,hl as we,hm as Ss,hn as fs,eU as Te,fG as re,ho as de,eT as ws,eP as ye,eW as Ts,eX as Pe,eZ as Ae,e_ as Ne,hp as ys,hq as Ps,e$ as As,f0 as Re,f1 as De,hr as Ns,f9 as Rs,hs as Ds,ht as Ms,hu as Ls,hv as Qe,hw as Os,hx as ks,hy as Bs,fd as Ws,hz as Fs,hA as Hs,eG as Vs,hB as $s,fe as Us,fg as Js,hC as Ys}from"./index-41C5YwXr.js";import{J as zs}from"./JumpIn.container-DH7vWxVG.js";import{C as qs}from"./CollectionProvider.container-B55XxdNh.js";import{C as Xe}from"./ConfirmDelete-qdY8nP-O.js";import{C as et}from"./CollectionStatus.container-Bg3t2d-h.js";import{d as Gs,e as Zs,c as Ks}from"./selectors-B-FgaFOX.js";import{I as Qs}from"./ItemProvider.container-BRoayas-.js";const Xs=({open:n,assignee:l,onConfirm:e,onClose:s})=>t.jsxs(c.Modal,{size:"tiny",className:"ConfirmApprovalModal",open:n,children:[t.jsx(c.Modal.Header,{children:d("curation_page.confirm_not_assigned_curation_modal.title")}),t.jsxs(c.Modal.Content,{children:[t.jsx("div",{className:"message-container",children:t.jsx(H,{id:"curation_page.confirm_not_assigned_curation_modal.body",values:{assignee:t.jsx("strong",{children:t.jsx(ct,{textOnly:!0,address:l})})}})}),t.jsx("span",{children:t.jsx(H,{id:"curation_page.confirm_not_assigned_curation_modal.confirm_footer"})})]}),t.jsxs(c.Modal.Actions,{children:[t.jsx(c.Button,{onClick:s,children:d("global.cancel")}),t.jsx(c.Button,{primary:!0,onClick:e,children:d("curation_page.confirm_not_assigned_curation_modal.confirm_button")})]})]}),ea=z.memo(Xs);var T=(n=>(n.REJECT_COLLECTION="REJECT_COLLECTION",n.REJECT_CURATION="REJECT_CURATION",n.DISABLE_COLLECTION="DISABLE_COLLECTION",n.DISABLE_THIRD_PARTY="DISABLE_THIRD_PARTY",n))(T||{});const k="item_editor.top_panel.rejection_modal",ta=({open:n,type:l,isLoading:e,thirdParty:s,hasPendingTransaction:a,onDisableThirdParty:i,collection:o,curation:r,onReject:m,onRejectCuration:g,onClose:p})=>{const I=x.useMemo(()=>{switch(l){case T.DISABLE_COLLECTION:return k+".disable_collection";case T.REJECT_CURATION:return k+".reject_curation";case T.DISABLE_THIRD_PARTY:return k+".disable_third_party";default:return""}},[l]),S=()=>{switch(l){case T.DISABLE_COLLECTION:m(o);break;case T.REJECT_CURATION:g(r.collectionId);break;case T.DISABLE_THIRD_PARTY:s&&i(s.id);break}},E=l===T.DISABLE_COLLECTION&&!o.isApproved||l===T.DISABLE_THIRD_PARTY&&!(s!=null&&s.isApproved)||l===T.REJECT_COLLECTION&&!o.isApproved||l===T.REJECT_CURATION&&(r==null?void 0:r.status)===K.REJECTED;return t.jsx(c.Modal,{size:"tiny",className:"RejectionModal",open:n,children:a?t.jsx(sa,{i18nKey:I}):E?t.jsx(aa,{link:o.forumLink,onClose:p}):t.jsx(na,{i18nKey:I,isLoading:e,onClose:p,onConfirm:S})})},sa=({i18nKey:n})=>t.jsxs(t.Fragment,{children:[t.jsx(c.Modal.Header,{children:d(`${n}.title`)}),t.jsxs("div",{className:"loading-transaction",children:[t.jsx("div",{className:"danger-text",children:d(`${n}.tx_pending`)}),t.jsx("small",{className:"danger-text",children:t.jsx(H,{id:k+".visit_activity",values:{activity_link:t.jsx(ee,{to:R.activity(),children:d("global.activity")})}})}),t.jsx(c.Loader,{active:!0,size:"large"})]})]}),aa=({link:n,onClose:l})=>t.jsxs(t.Fragment,{children:[t.jsx(c.Modal.Header,{children:d(k+".veredict_explanation")}),t.jsx(c.Modal.Content,{children:d(k+".go_to_forum")}),t.jsxs(c.Modal.Actions,{children:[t.jsx("a",{href:n,className:"forum-link",target:"_blank",rel:"noopener noreferrer",children:t.jsxs(c.Button,{secondary:!0,icon:!0,labelPosition:"right",children:[t.jsx("div",{children:d(k+".forum_link")}),t.jsx("div",{className:"discussion",children:d(k+".discussion")}),t.jsx(c.Icon,{name:"chevron right"})]})}),t.jsx(c.Button,{basic:!0,onClick:l,children:d("global.done")})]})]}),na=({i18nKey:n,isLoading:l,onConfirm:e,onClose:s})=>t.jsxs(t.Fragment,{children:[t.jsx(c.Modal.Header,{children:d(`${n}.title`)}),t.jsx(c.Modal.Content,{children:d(`${n}.subtitle`)}),t.jsxs(c.Modal.Actions,{children:[t.jsx(Me,{primary:!0,onClick:e,disabled:l,loading:l,network:_.Network.MATIC,children:d(`${n}.action`)}),t.jsx(c.Button,{disabled:l,onClick:s,children:d("global.cancel")})]})]}),ia=z.memo(ta),la=(n,l)=>({isLoading:V(ht(n),xt)||V(mt(n),_t)||gt(n),hasPendingTransaction:pt(n)||!!(l.thirdParty&&ut(n,l.thirdParty.id))}),oa=n=>({onReject:l=>n(Ct(l)),onRejectCuration:l=>n(It(l)),onDisableThirdParty:l=>n(bt(l))}),ra=B(la,oa)(ia);var j=(n=>(n[n.APPROVE=0]="APPROVE",n[n.REJECT=1]="REJECT",n[n.ENABLE=2]="ENABLE",n[n.DISABLE=3]="DISABLE",n))(j||{});let da=class extends z.PureComponent{constructor(){super(...arguments);h(this,"state",{currentVeredict:void 0,showRejectionModal:null,showApproveConfirmModal:!1});h(this,"handleBack",()=>{this.props.onNavigate(R.curation())});h(this,"handleConfirmApprovalModal",(e,s)=>{const{address:a,onInitiateApprovalFlow:i,onInitiateTPApprovalFlow:o,onSetAssignee:r}=this.props;this.setState({showApproveConfirmModal:!1}),a&&r(e.id,a,s),L(e)?o(e):i(e)});h(this,"setShowRejectionModal",e=>this.setState({showRejectionModal:e}));h(this,"renderPage",e=>{const{items:s,itemCurations:a,curation:i,totalItems:o,thirdParty:r}=this.props,{showRejectionModal:m,showApproveConfirmModal:g}=this.state,{chainId:p}=this.props,I=vt(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," · ",d(`collection.type.${I}`),t.jsx(zs,{size:"small",active:!0,collection:e,chainId:p,items:L(e)?s:void 0,text:d("global.see_in_decentraland")})]}),t.jsx("div",{className:"actions",children:t.jsx("span",{className:"button-container",children:L(e)&&o!==void 0?this.renderTPButtons(e,i,a):this.renderButtons(e,i)})}),m&&t.jsx(ra,{type:m,open:!0,collection:e,curation:i,thirdParty:r,onClose:()=>this.setShowRejectionModal(null)}),(i==null?void 0:i.assignee)&&g&&t.jsx(ea,{open:!0,assignee:i.assignee,onConfirm:()=>this.handleConfirmApprovalModal(e,i),onClose:()=>this.setState({showApproveConfirmModal:!1})})]})});h(this,"renderButton",(e,s,a)=>{const{address:i,thirdParty:o,onInitiateApprovalFlow:r,onInitiateTPApprovalFlow:m,reviewedItems:g,totalItems:p}=this.props,I={[j.APPROVE]:()=>a!=null&&a.assignee&&i!==(a==null?void 0:a.assignee)?this.setState({showApproveConfirmModal:!0}):L(s)?m(s):r(s),[j.ENABLE]:()=>r(s),[j.DISABLE]:()=>this.setShowRejectionModal(o?T.DISABLE_THIRD_PARTY:T.DISABLE_COLLECTION),[j.REJECT]:()=>{(a==null?void 0:a.status)===K.PENDING?this.setShowRejectionModal(T.REJECT_CURATION):this.setShowRejectionModal(T.REJECT_COLLECTION)}},S={[j.APPROVE]:"approve",[j.ENABLE]:"enable",[j.DISABLE]:"disable",[j.REJECT]:"reject"},E=e===j.APPROVE||e===j.ENABLE,b=!L(s)||!!p&&g.length>=Z(p);return t.jsx(c.Popup,{content:d("item_editor.top_panel.items_pending_to_review"),disabled:b,position:"bottom center",trigger:t.jsx("div",{children:t.jsx(c.Button,{primary:E,onClick:()=>I[e](),disabled:L(s)&&e===j.APPROVE&&!!p&&g.length<Z(p),children:d(`item_editor.top_panel.${S[e]}`)})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0})});h(this,"renderTPButtons",(e,s,a)=>{const{reviewedItems:i,totalItems:o,thirdParty:r}=this.props,m=a==null?void 0:a.some(g=>g.status===K.PENDING);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Header,{sub:!0,children:[m?d("item_editor.top_panel.reviewed_counter",{count:i.length,threshold:Z(o)}):d("item_editor.top_panel.not_enough_items_to_curate_more"),i.length>=Z(o)?t.jsx(c.Icon,{name:"check circle"}):null]}),m&&this.renderButton(j.APPROVE,e,s),m&&this.renderButton(j.REJECT,e,s),!m&&(r==null?void 0:r.isApproved)&&this.renderButton(j.DISABLE,e,null)]})});h(this,"renderButtons",(e,s)=>{if(s&&e.isApproved)switch(s.status){case"pending":return t.jsxs(t.Fragment,{children:[this.renderButton(j.APPROVE,e,s),this.renderButton(j.REJECT,e,s)]});case"approved":case"rejected":return this.renderButton(j.DISABLE,e,s)}return Et(e)?e.isApproved?this.renderButton(j.DISABLE,e,s):this.renderButton(j.ENABLE,e,s):t.jsxs(t.Fragment,{children:[this.renderButton(j.APPROVE,e,s),this.renderButton(j.REJECT,e,s)]})})}render(){const{collection:e,items:s,isCommitteeMember:a,isReviewing:i,isConnected:o,isLoading:r}=this.props,m=!e||r&&!s.length;return a&&i&&o?t.jsx("div",{className:"TopPanel",children:m?t.jsx(c.Loader,{size:"small",active:!0}):this.renderPage(e)}):null}};const ca=n=>{const l=Q(n),e=l?Le(n,l):null,s=e?jt(n,e.id):[],a=e?St(n,e.id):[],i=l?ft(n,l):null,o=l?he(n,l):void 0,r=e&&L(e)?wt(n,e):null;return{address:te(n),items:s,totalItems:(o==null?void 0:o.total)||null,collection:e,itemCurations:a,thirdParty:r,curation:i,chainId:Tt(n),isConnected:be(n),isReviewing:xe(n),isCommitteeMember:Oe(n),selectedCollectionId:Q(n),isLoading:V(yt(n),Mt)||V(Pt(n),Lt)||V(me(n),Ot)}},ha=n=>({onNavigate:l=>n(At(l)),onSetAssignee:(l,e,s)=>n(Nt(l,e,s)),onInitiateTPApprovalFlow:l=>n(Rt(l)),onInitiateApprovalFlow:l=>n(Dt(l))}),ma=B(ca,ha)(da),ga="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",pa=n=>{const{collectionId:l,itemName:e}=n,[s,a]=x.useState(!1),[i,o]=x.useState(null),r=ke(),m=Be();x.useEffect(()=>{e&&(a(!0),o(e))},[e]);function g(){a(!1);const p=new URLSearchParams(m.search);p.delete("newItem"),r.replace({search:p.toString()})}return s&&i&&l?t.jsx(c.Toast,{type:c.ToastType.INFO,title:d("sagas.item.item_added_toast.title"),closable:!0,icon:t.jsx("div",{className:"ItemAddedToast icon-container",children:t.jsx("img",{src:ga,alt:d("sagas.item.item_added_toast.title")})}),onClose:g,body:t.jsx(H,{id:"sagas.item.item_added_toast.body",values:{name:i,br:()=>t.jsx("br",{}),b:p=>t.jsx("strong",{children:p}),"collection-link":p=>t.jsx(ee,{to:R.collectionDetail(l),children:t.jsx(c.Button,{className:"ItemAddedToast view-collection-link",basic:!0,children:p})})}})}):null},ua=z.memo(pa),Ca=n=>({itemName:kt(n)}),Ia=B(Ca)(ua),ba=({collection:n,address:l,hasUserOrphanItems:e,isLoggedIn:s,isReviewing:a,onOpenModal:i,onDeleteCollection:o})=>{var u,W;const r=Be(),m=ke(),g=((u=r.state)==null?void 0:u.fromParam)===fe.COLLECTIONS,p=((W=r.state)==null?void 0:W.fromParam)===fe.TP_COLLECTIONS,I=x.useCallback(()=>{m.push(R.collections())},[m]),S=x.useCallback(()=>{if(n&&(g||p)){const F=g?R.collectionDetail:R.thirdPartyCollectionDetail;m.push(F(n.id))}else m.push(R.itemEditor())},[g,p,m,n]),E=x.useCallback(()=>{i("CreateCollectionModal")},[i]),b=x.useCallback(()=>{n&&i("CreateSingleItemModal",{collectionId:n.id})},[n,i]),C=x.useCallback(()=>{n&&i("AddExistingItemModal",{collectionId:n.id})},[n,i]),w=x.useCallback(()=>{n&&i("EditCollectionNameModal",{collection:n})},[n,i]),f=x.useCallback(()=>{n&&o(n)},[n,o]),D=x.useCallback(()=>{const F=n&&Bt(n.owner,l||"");return n?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`block ${g||p?"close":"back"}`,onClick:S}),t.jsxs("div",{className:"title",children:[t.jsx(ee,{to:R.collectionDetail(n.id),children:n.name}),t.jsx(et,{collection:n})]}),F&&!n.isPublished?t.jsx(c.Dropdown,{trigger:t.jsx("div",{className:"block actions"}),inline:!0,direction:"left",children:t.jsxs(c.Dropdown.Menu,{children:[t.jsx(c.Dropdown.Item,{onClick:w,children:d("item_editor.left_panel.actions.edit_name")}),t.jsx(c.Dropdown.Item,{onClick:b,children:d("item_editor.left_panel.actions.new_item")}),e&&t.jsx(c.Dropdown.Item,{onClick:C,children:d("item_editor.left_panel.actions.add_existing_item")}),t.jsx(Xe,{name:n.name,onDelete:f,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}):null},[n,l,e,g,p]),M=x.useCallback(()=>t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"block close",onClick:I}),t.jsx("div",{className:"title",children:e?d("item_editor.left_panel.title"):d("item_editor.left_panel.title_alternative")}),s?t.jsx(c.Dropdown,{trigger:t.jsx("div",{className:"block add"}),inline:!0,direction:"left",children:t.jsx(c.Dropdown.Menu,{children:t.jsx(c.Dropdown.Item,{onClick:E,children:d("item_editor.left_panel.actions.new_collection")})})}):t.jsx("div",{className:"block"})]}),[e,s]);return a?null:t.jsx(c.Row,{grow:!1,shrink:!1,className:"Header",children:n?D():M()})},xa=ba,_a=n=>{let l;const e=Q(n);e&&(l=We(n).find(i=>i.id===e));const s=te(n);return{address:s,isLoggedIn:Wt(n),isReviewing:xe(n),collection:l,hasEditRights:l!==void 0&&s!==void 0&&Fe(n,s,l),hasUserOrphanItems:_e(n)}},va=n=>({onOpenModal:(l,e)=>n(He(l,e)),onDeleteCollection:l=>n(Ft(l)),onDeleteItem:l=>n(Ve(l))}),Ea=B(_a,va)(xa),P=10;class N extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{isCollapsed:!1});h(this,"handleToggle",()=>{this.setState({isCollapsed:!this.state.isCollapsed})})}render(){const{label:e,children:s}=this.props,{isCollapsed:a}=this.state,i=!a;return t.jsxs("div",{className:`Collapsable ${i?"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:i?s:null})]})}}class ja extends x.PureComponent{constructor(){super(...arguments);h(this,"handleClick",()=>{const{item:e,onClick:s}=this.props;s(e)})}renderToggleItem(){const{item:e,isVisible:s,isPlayingEmote:a}=this.props;return X(e)?t.jsx(c.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:i}=this.props;return t.jsx("div",{className:`SidebarItem ${s?"is-selected":""}`,children:t.jsxs(ee,{to:R.itemEditor({itemId:e.id,collectionId:a||void 0,newItem:void 0}),children:[t.jsx(ge,{item:e}),t.jsxs("div",{className:"name",children:[t.jsx(Ht,{item:e}),e.name]}),t.jsx(c.Popup,{content:d("item_editor.left_panel.invalid_representation_tooltip",{bodyShape:t.jsx("b",{children:d(`body_shapes.${pe(e)}`).toLowerCase()})}),disabled:$e(e,i),position:"top center",trigger:this.renderToggleItem()})]})})}}const Sa=ja;var v=(n=>(n.TO_REVIEW="to-review",n.REVIEWED="reviewed",n.ALL_ITEMS="all-items",n))(v||{});const fa={[v.TO_REVIEW]:1,[v.REVIEWED]:1,[v.ALL_ITEMS]:1};class wa extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{currentTab:v.TO_REVIEW,currentPages:fa,reviewedTabPage:1,showGetMoreSamplesModal:!1,showAllItemsTabChangeModal:!1});h(this,"analytics",ve());h(this,"handleReviewItemsTrigger",e=>{const{items:s,onReviewItems:a}=this.props,{currentTab:i}=this.state;this.getIsReviewingTPItems()&&i===v.TO_REVIEW&&!Ue(s,e==null?void 0:e.items)&&a()});h(this,"isVisible",e=>{const{visibleItems:s}=this.props;return s.some(a=>a.id===e.id)});h(this,"handleClick",e=>{var g;const{bodyShape:s,visibleItems:a,wearableController:i,isPlayingEmote:o,onSetItems:r}=this.props;if(!$e(e,s))return;let m=a.filter(p=>p.id!==e.id);if(X(e))if(this.isVisible(e)){o?i==null||i.emote.pause():i==null||i.emote.play();return}else m=m.filter(p=>p.type!==y.EMOTE);this.isVisible(e)||(m.push(e),(g=this.analytics)==null||g.track("Preview Item",{ITEM_ID:e!=null&&e.urn?Y(e.urn)?Je(e.urn):ue(e.urn):null,ITEM_TYPE:e.type,ITEM_NAME:e.name,ITEM_IS_THIRD_PARTY:Y(e.urn)})),r(m)});h(this,"handleTabChange",e=>{const{onLoadPage:s,onReviewItems:a,onResetReviewedItems:i}=this.props,{currentPages:o}=this.state;e===v.ALL_ITEMS?this.setState({showAllItemsTabChangeModal:!1},()=>{i(),s(o[v.ALL_ITEMS])}):e===v.TO_REVIEW&&a(),this.setState({currentTab:e})});h(this,"handleGetRandomSampleClick",()=>{const{showSamplesModalAgain:e,onLoadRandomPage:s}=this.props;e?this.setState({showGetMoreSamplesModal:!0}):s()});h(this,"handleModalProceed",()=>{const{onLoadRandomPage:e}=this.props;e(),this.setState({showGetMoreSamplesModal:!1})});h(this,"handlePageChange",(e,s)=>{const{currentTab:a}=this.state,{onLoadPage:i}=this.props;this.setState(o=>({currentPages:{...o.currentPages,[a]:+s.activePage}})),a!==v.REVIEWED&&i(+s.activePage)});h(this,"handleSwitchToAllItemsTab",()=>{const{reviewedItems:e}=this.props;e.length>0?this.setState({showAllItemsTabChangeModal:!0}):this.handleTabChange(v.ALL_ITEMS)});h(this,"getIsReviewingTPItems",()=>{const{collection:e,isReviewing:s}=this.props;return e?Y(e.urn)&&s:!1});h(this,"renderSidebarItem",e=>{const{collection:s,selectedItemId:a,bodyShape:i,isPlayingEmote:o}=this.props;return t.jsx(Sa,{item:e,isSelected:a===e.id,isVisible:this.isVisible(e),isPlayingEmote:o,selectedCollectionId:(s==null?void 0:s.id)??null,bodyShape:i,onClick:this.handleClick},e.id)});h(this,"renderSidebarCategory",e=>{const s=e.filter(Ce),a=e.filter(X);return e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:d("item_editor.left_panel.empty_collection")})}):s.length===0||a.length===0?e.map(this.renderSidebarItem):t.jsxs(t.Fragment,{children:[t.jsx(N,{label:this.renderCollapsableLabel(y.WEARABLE),children:s.map(this.renderSidebarItem)}),t.jsx(N,{label:this.renderCollapsableLabel(y.EMOTE),children:a.map(this.renderSidebarItem)})]})});h(this,"renderTabPagination",e=>{const{currentTab:s,currentPages:a}=this.state,i=a[s],o=Math.ceil(e/P);return o>1?t.jsx(c.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:o,activePage:i,onPageChange:this.handlePageChange}):null});h(this,"renderPaginationStats",e=>{const{currentPages:s,currentTab:a}=this.state,i=s[a],o=(i-1)*P,r=i*P;return t.jsx(c.Header,{sub:!0,children:d("item_editor.left_panel.reviewed_tab.page_counter",{pageStart:o,pageEnd:r>e?e:r,total:e})})});h(this,"renderTabContent",()=>{const{items:e,isLoading:s,totalItems:a,reviewedItems:i}=this.props,{currentTab:o,currentPages:r}=this.state,m=this.getIsReviewingTPItems(),g=r[o];if(s)return t.jsx(c.Loader,{size:"large",active:!0});switch(o){case v.TO_REVIEW:return t.jsxs(t.Fragment,{children:[this.renderSidebarCategory(e),!m&&a?this.renderTabPagination(a):null]});case v.REVIEWED:{const p=i.slice((g-1)*P,g*P);return t.jsxs(t.Fragment,{children:[i.length?this.renderPaginationStats(i.length):null,this.renderSidebarCategory(p),i.length?this.renderTabPagination(i.length):null]})}case v.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}});h(this,"renderTabHeader",()=>{const{isLoading:e,totalItems:s,reviewedItems:a}=this.props,{currentTab:i}=this.state;let o;const r=!s||s<P||a.length===s;switch(i){case v.TO_REVIEW:o=t.jsx(c.Popup,{content:d("item_editor.top_panel.not_enough_items_to_curate_more"),disabled:!r,position:"bottom center",trigger:t.jsx("div",{children:t.jsxs(c.Button,{disabled:e||r,primary:!0,className:"random-sample-button",onClick:this.handleGetRandomSampleClick,children:[t.jsx(c.Icon,{name:"random"}),d("item_editor.left_panel.get_random_sample")]})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0});break;case v.REVIEWED:o=t.jsx(H,{id:"item_editor.left_panel.reviewed_samples",values:{reviewed_samples_bold:t.jsx("b",{children:d("item_editor.left_panel.reviewed_samples_bold",{count:a.length})}),total:Z(s??1)}});break;default:return null}return t.jsxs("div",{className:"tab-header",children:[" ",o," "]})});h(this,"renderModal",()=>{const{onToggleShowSamplesModalAgain:e,showSamplesModalAgain:s}=this.props,{showGetMoreSamplesModal:a}=this.state;return t.jsxs(c.Modal,{open:a,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(c.Modal.Header,{children:d("item_editor.left_panel.get_more_samples_modal.title")}),t.jsxs(c.Modal.Content,{children:[t.jsx(H,{id:"item_editor.left_panel.get_more_samples_modal.content",values:{count:10,tabName:t.jsx("b",{children:v.REVIEWED})}}),t.jsxs("div",{className:"checkbox-container",onClick:e,children:[t.jsx(c.Checkbox,{checked:!s}),d("item_editor.left_panel.get_more_samples_modal.dont_show_again")]})]}),t.jsxs(c.Modal.Actions,{children:[t.jsx(c.Button,{onClick:()=>this.setState({showGetMoreSamplesModal:!1}),children:d("global.cancel")}),t.jsx(c.Button,{primary:!0,onClick:this.handleModalProceed,children:d("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});h(this,"renderAllItemsTabChangeModal",()=>{const{showAllItemsTabChangeModal:e}=this.state;return t.jsxs(c.Modal,{open:e,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(c.Modal.Header,{children:d("item_editor.left_panel.all_items_check.title")}),t.jsx(c.Modal.Content,{children:d("item_editor.left_panel.all_items_check.content")}),t.jsxs(c.Modal.Actions,{children:[t.jsx(c.Button,{onClick:()=>this.setState({showAllItemsTabChangeModal:!1}),children:d("global.cancel")}),t.jsx(c.Button,{primary:!0,onClick:()=>this.handleTabChange(v.ALL_ITEMS),children:d("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});h(this,"renderTabs",()=>{const{currentTab:e}=this.state;return t.jsxs(c.Tabs,{isFullscreen:!0,children:[t.jsx(c.Tabs.Tab,{active:e===v.TO_REVIEW,onClick:()=>this.handleTabChange(v.TO_REVIEW),children:d("item_editor.left_panel.to_review")}),t.jsx(c.Tabs.Tab,{active:e===v.REVIEWED,onClick:()=>this.handleTabChange(v.REVIEWED),children:d("item_editor.left_panel.reviewed")}),t.jsx(c.Tabs.Tab,{active:e===v.ALL_ITEMS,onClick:this.handleSwitchToAllItemsTab,children:d("item_editor.left_panel.all_items")})]})})}componentDidMount(){this.handleReviewItemsTrigger()}componentDidUpdate(e){this.handleReviewItemsTrigger(e)}renderCollapsableLabel(e){return t.jsxs(t.Fragment,{children:[t.jsx(O,{name:e}),t.jsx(H,{id:`item_editor.left_panel.${e}`})]})}render(){return t.jsxs(c.Section,{className:"Items",children:[this.getIsReviewingTPItems()?t.jsxs(t.Fragment,{children:[this.renderTabs(),this.renderTabHeader()]}):null,this.renderTabContent(),this.renderModal(),this.renderAllItemsTabChangeModal()]})}}class Ta extends x.PureComponent{render(){const{collection:l,isSelected:e}=this.props;return t.jsx("div",{className:`SidebarCollection ${e?"is-selected":""}`,children:t.jsxs(ee,{to:R.itemEditor({collectionId:l.id}),children:[t.jsx(Vt,{collectionId:l.id}),t.jsxs("div",{className:"wrapper",children:[t.jsxs("div",{className:"name",children:[t.jsx(et,{collection:l}),l.name]}),t.jsx("div",{className:"count",children:d("item_editor.left_panel.items_count",{count:l.itemCount})})]})]})})}}const ya=Ta;class Pa extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{currentPage:1});h(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:i,totalCollections:o}=this.props,{currentPage:r}=this.state;if(e.length===0)return null;const m=Math.ceil(o/P);return s?t.jsx(c.Loader,{size:"small",active:!0}):!s&&a.length===0&&e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:d("collections_page.empty_description")})}):t.jsx(t.Fragment,{children:t.jsxs(c.Section,{className:"Collections",children:[e.map(g=>t.jsx(ya,{collection:g,items:a,isSelected:g.id===i},g.id)),m>1?t.jsx(c.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:m,activePage:r,onPageChange:this.handlePageChange}):null]})})}}var J=(n=>(n.COLLECTIONS="collections",n.ORPHAN_ITEMS="orphanItems",n))(J||{});const U=1;let Aa=class extends x.PureComponent{constructor(){super(...arguments);h(this,"state",this.getInitialState());h(this,"handleToggleShowSamplesModalAgain",()=>{this.setState(e=>({showSamplesModalAgain:!e.showSamplesModalAgain}))});h(this,"fetchResource",()=>{const{address:e,onFetchCollections:s,onFetchOrphanItems:a,isReviewing:i,selectedCollectionId:o}=this.props,{pages:r}=this.state;if(e&&!i&&!o){const m=r[r.length-1];(this.isCollectionTabActive()?s:a)(e,{limit:P,page:m})}});h(this,"loadPage",e=>{this.setState({pages:[e]},()=>this.fetchResource())});h(this,"getRandomPage",(e,s)=>Math.floor(Math.random()*(s-e+1)+e));h(this,"loadRandomPage",e=>{const{pages:s}=this.state,{totalItems:a,totalCollections:i,onSetReviewedItems:o}=this.props,r=this.isCollectionTabActive()?i:a,m=Math.ceil(r/P);if(m>s.length){const g=[...Array(m).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(I=>({pages:[...I.pages,p]}),this.fetchResource)}}o(e)});h(this,"handleTabChange",e=>{this.setState({currentTab:e,pages:[U]},this.fetchResource)});h(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:[U],currentTab:a,initialPage:U,showSamplesModalAgain:!0}}componentDidMount(){const{address:e,hasUserOrphanItems:s,selectedItem:a,onFetchOrphanItem:i,onSetItems:o}=this.props;this.fetchResource(),e&&s===void 0&&i(e),a&&o([a])}componentDidUpdate(e,s){const{isConnected:a,address:i,selectedCollectionId:o,selectedItemId:r,selectedItem:m,orphanItems:g,totalItems:p,visibleItems:I,hasUserOrphanItems:S,onSetItems:E,onFetchOrphanItem:b}=this.props,{initialPage:C,pages:w}=this.state;if(!o&&i&&r&&p&&(C===U||s.initialPage<C)){if(!g.find(f=>f.id===r)){const f=Math.ceil(p/P),D=w[w.length-1],M=Math.min(f,D+1);w.includes(M)||this.setState({pages:[M],initialPage:M},this.fetchResource)}}else if(e.selectedItemId&&r&&e.selectedItemId!==r){const f=I.filter(D=>D.type!==y.EMOTE);E(f)}else i&&a&&(a!==e.isConnected||e.selectedCollectionId&&!o)&&this.setState({pages:[U]},this.fetchResource),e.selectedCollectionId!==o&&this.setState({pages:[U]}),i&&i!==e.address&&S===void 0&&b(i);!e.selectedItem&&m&&m.type!==y.EMOTE&&E([m]),e.selectedCollectionId!==o&&E([])}componentWillUnmount(){const{onSetItems:e}=this.props;e([])}getItems(e,s,a){const{selectedCollectionId:i,orphanItems:o,isReviewing:r}=this.props;return i&&e?$t(e)&&r?s.filter(m=>!!(a!=null&&a.find(g=>g.itemId===m.id&&g.status===K.PENDING))):s:o}render(){const{items:e,totalItems:s,totalCollections:a,collections:i,selectedItemId:o,selectedCollectionId:r,visibleItems:m,bodyShape:g,reviewedItems:p,isReviewing:I,isPlayingEmote:S,isConnected:E,wearableController:b,isLoading:C,hasUserOrphanItems:w,onSetItems:f,onSetReviewedItems:D,onResetReviewedItems:M}=this.props,{pages:u,showSamplesModalAgain:W}=this.state,F=!r&&w,le=this.isCollectionTabActive()&&!r,A=!this.isCollectionTabActive()||r;return t.jsx("div",{className:"LeftPanel",children:E?t.jsx(qs,{id:r,itemSelected:o,itemsPage:u,itemsPageSize:P,fetchCollectionItemsOptions:{status:I?K.PENDING:void 0},onChangePage:q=>this.setState({pages:[q]}),children:({paginatedCollections:q,collection:$,paginatedItems:st,initialPage:at,isLoadingCollection:nt,isLoadingCollectionItems:it,itemCurations:lt})=>{const G=this.getItems($,st,lt),Se=this.isCollectionTabActive(),ot=r&&$?at:this.state.initialPage;return t.jsxs(t.Fragment,{children:[t.jsx(Ea,{}),F?t.jsxs(c.Tabs,{isFullscreen:!0,children:[t.jsx(c.Tabs.Tab,{active:Se,onClick:()=>this.handleTabChange(J.COLLECTIONS),children:d("collections_page.collections")}),t.jsx(c.Tabs.Tab,{active:!Se,onClick:()=>this.handleTabChange(J.ORPHAN_ITEMS),children:d("item_editor.left_panel.items")})]}):null,le?t.jsx(Pa,{collections:q,totalCollections:a||i.length,items:e,hasHeader:G.length>0,selectedCollectionId:r,onLoadPage:this.loadPage,isLoading:nt}):null,A?t.jsxs(t.Fragment,{children:[t.jsx(wa,{items:G,totalItems:s||G.length,hasHeader:!r&&i.length>0,selectedItemId:o,collection:$,isReviewing:I,isPlayingEmote:S,visibleItems:m,bodyShape:g,onResetReviewedItems:M,reviewedItems:p,onSetItems:f,wearableController:b,initialPage:ot,isLoading:it||C,onToggleShowSamplesModalAgain:this.handleToggleShowSamplesModalAgain,showSamplesModalAgain:W,onReviewItems:()=>D(G),onLoadRandomPage:()=>this.loadRandomPage(G),onLoadPage:this.loadPage}),t.jsx(Ia,{collectionId:r})]}):null]})}}):null})}};const Na=n=>{const l=Q(n),e=te(n),s=l?he(n,l):e?he(n,e):void 0,a=l?void 0:Ut(n),i=Ee(n)||"",o=je(n,i);return{address:e,isConnected:be(n),items:Jt(n),totalItems:(s==null?void 0:s.total)||null,totalCollections:(a==null?void 0:a.total)||null,orphanItems:e&&!l?Yt(n,e,s==null?void 0:s.limit):zt(n),collections:qt(n),selectedItemId:i,selectedItem:o,selectedCollectionId:l,visibleItems:Ye(n),bodyShape:ze(n),wearableController:qe(n),isReviewing:xe(n),isLoading:V(me(n),Kt)||V(me(n),Qt),isPlayingEmote:Ge(n),hasUserOrphanItems:_e(n)}},Ra=n=>({onSetItems:l=>n(Ze(l)),onFetchCollections:(l,e)=>n(Gt(l,e)),onFetchOrphanItems:(l,e)=>n(Ke(l,e)),onFetchOrphanItem:l=>n(Zt(l))}),Da=B(Na,Ra)(Aa);class ce extends z.PureComponent{constructor(){super(...arguments);h(this,"handleAvatarColorChange",(e,s)=>{const{currentColor:a,colors:i,onChange:o}=this.props;if(a.toHexString()!==s.value){const r=i.find(m=>m.toHexString()===s.value);o(r)}});h(this,"renderItem",(e,s)=>{const a=e.toHexString();return t.jsx(c.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,i=e.toHexString();return t.jsx(c.Dropdown,{inline:!0,direction:"right",className:"AvatarColorDropdown Select",value:i,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:i}})}),t.jsx("div",{className:"handle"})]}),children:t.jsx(c.Dropdown.Menu,{className:"colors-menu",children:s.map(this.renderItem)})})}}let Ma=class extends z.PureComponent{constructor(){super(...arguments);h(this,"handleAvatarChangeWearable",(e,s)=>{const{wearable:a,category:i,bodyShape:o,onChange:r,baseWearables:m}=this.props,g=s.value?m.find(p=>p.id===s.value):null;a!==g&&r(i,o,g??null)})}render(){const{wearable:e,bodyShape:s,category:a,label:i,isNullable:o,baseWearables:r}=this.props,m=Xt(r,a,s).map(p=>({value:p.id,text:es(p)}));o&&m.push({value:"",text:d("global.none")});const g=e?m.find(p=>p.value===e.id):null;return t.jsx(c.Dropdown,{inline:!0,direction:"right",className:"AvatarWearableDropdown Select",value:e?e.id:"",options:m,scrolling:!0,onChange:this.handleAvatarChangeWearable,trigger:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:i}),t.jsx("div",{className:"value",children:g?g.text:d("global.none")}),t.jsx("div",{className:"handle"})]})})}};const La=n=>({baseWearables:ts(n)}),ae=B(La)(Ma);let Oa=class extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{showSceneBoundaries:!1,isShowingAvatarAttributes:!1,isLoading:!1});h(this,"analytics",ve());h(this,"handleToggleShowingAvatarAttributes",()=>{this.setState({isShowingAvatarAttributes:!this.state.isShowingAvatarAttributes})});h(this,"handleBodyShapeChange",(e,{value:s})=>{const{onSetBodyShape:a}=this.props;a(s)});h(this,"handleAnimationChange",(e,{value:s})=>{const{emotes:a,visibleItems:i,onSetAvatarAnimation:o,onSetItems:r}=this.props,m=a.find(p=>p.id===s),g=i.filter(p=>p.type!==y.EMOTE);g.forEach(p=>{var I;(I=this.analytics)==null||I.track("Play Emote",{EMOTE_PLAYED_BASE:!m,EMOTE_PLAYED_ITEM_ID:m!=null&&m.urn?ue(m.urn):null,EMOTE_PLAYED_NAME:m?m.name:s,PREVIEWED_WEARABLE_ITEM_ID:p!=null&&p.urn?Y(p.urn)?Je(p.urn):ue(p.urn):null,PREVIEWED_WEARABLE_NAME:p.name})}),m?g.push(m):o(s),r(g)});h(this,"handleSkinColorChange",e=>{const{onSetSkinColor:s}=this.props;s(e)});h(this,"handleEyeColorChange",e=>{const{onSetEyeColor:s}=this.props;s(e)});h(this,"handleHairColorChange",e=>{const{onSetHairColor:s}=this.props;s(e)});h(this,"handleWearableChange",(e,s,a)=>{const{onSetBaseWearable:i}=this.props;i(e,s,a)});h(this,"handleWearablePreviewLoad",()=>{const{wearableController:e,onSetWearablePreviewController:s}=this.props;e||s(c.WearablePreview.createController("wearable-editor")),this.setState({isLoading:!1})});h(this,"handleControlActionChange",async e=>{const{wearableController:s}=this.props,a=.1;if(s)switch(await(s==null?void 0:s.emote.pause()),e){case se.ZOOM_IN:{await(s==null?void 0:s.scene.changeZoom(a));break}case se.ZOOM_OUT:{await(s==null?void 0:s.scene.changeZoom(-a));break}}});h(this,"handlePlayEmote",()=>{const{wearableController:e,isPlayingEmote:s,visibleItems:a,onSetAvatarAnimation:i,onSetItems:o}=this.props,r=a.filter(m=>m.type!==y.EMOTE);s?(i(_.PreviewEmote.IDLE),o(r)):e==null||e.emote.play()});h(this,"renderEmotePlayButton",()=>{const{isPlayingEmote:e}=this.props,s=e?"stop":"play",a=e?d("item_editor.center_panel.stop"):d("item_editor.center_panel.play_emote");return t.jsxs(c.Button,{icon:!0,onClick:this.handlePlayEmote,children:[t.jsx(c.Icon,{name:s}),t.jsx("span",{children:a})]})});h(this,"renderEmoteDropdownButton",()=>{const{collection:e,emotes:s,isPlayingEmote:a}=this.props,i=!!e,o=s.length>0;return a?null:t.jsx(c.Dropdown,{className:"avatar-animation button icon",floating:!0,scrolling:!0,children:t.jsxs(c.Dropdown.Menu,{children:[o&&t.jsxs(t.Fragment,{children:[t.jsx(c.Dropdown.Header,{content:i?d("item_editor.center_panel.from_collection"):d("item_editor.center_panel.from_items")}),t.jsx(c.Dropdown.Divider,{}),s.map(r=>t.jsx(c.Dropdown.Item,{value:r.id,text:r.name,onClick:this.handleAnimationChange},r.id)),t.jsx(c.Dropdown.Divider,{}),t.jsx(c.Dropdown.Header,{content:d("item_editor.center_panel.default")}),t.jsx(c.Dropdown.Divider,{})]}),_.PreviewEmote.schema.enum.map(r=>t.jsx(c.Dropdown.Item,{value:r,text:d(`emotes.${r}`),onClick:this.handleAnimationChange},r))]})})});h(this,"renderEmoteSelector",()=>t.jsx(c.Popup,{content:d("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(c.Button.Group,{children:[this.renderEmotePlayButton(),this.renderEmoteDropdownButton()]})})}))}componentDidMount(){const{address:e,collection:s,emotes:a,selectedBaseWearables:i,hasUserOrphanItems:o,onFetchBaseWearables:r,onFetchOrphanItems:m,onFetchCollectionItems:g}=this.props,p=a.length>0;i||r(),p||(s&&!L(s)?g(s.id):e&&o&&m(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 i=s.find(o=>o.value===e);return{value:e,options:s,trigger:this.renderSelectTrigger(a,i?i.text:"")}}render(){const{bodyShape:e,skinColor:s,eyeColor:a,hairColor:i,emote:o,selectedBaseWearables:r,selectedItem:m,visibleItems:g,isImportFilesModalOpen:p,wearableController:I}=this.props,{isShowingAvatarAttributes:S,showSceneBoundaries:E,isLoading:b}=this.state,C=g.some(X)&&(m==null?void 0:m.type)===y.EMOTE,w=o===_.PreviewEmote.JUMP?1:void 0;return t.jsxs("div",{className:`CenterPanel ${p?"import-files-modal-is-open":""}`,children:[t.jsx(c.WearablePreview,{id:"wearable-editor",profile:"default",bodyShape:e,emote:o,zoom:w,skin:oe(s),eyes:oe(a),hair:oe(i),urns:r?Object.values(r).map(f=>f?f.id:null).filter(f=>f!==null):[],base64s:g.map(ss),disableAutoRotate:!0,disableBackground:!0,wheelZoom:1.5,wheelStart:100,dev:as,onUpdate:()=>this.setState({isLoading:!0}),onLoad:this.handleWearablePreviewLoad,disableDefaultEmotes:C,showSceneBoundaries:E}),C?t.jsxs("div",{className:"zoom-controls",children:[t.jsx(c.Button,{className:"zoom-control zoom-in-control",onClick:()=>this.handleControlActionChange(se.ZOOM_IN),children:t.jsx(c.Icon,{name:"plus"})}),t.jsx(c.Button,{className:"zoom-control zoom-out-control",onClick:()=>this.handleControlActionChange(se.ZOOM_OUT),children:t.jsx(c.Icon,{name:"minus"})})]}):null,b&&t.jsx(c.Center,{children:t.jsx(c.Loader,{active:!0})}),t.jsxs("div",{className:"footer",children:[C&&!b&&I?t.jsx("div",{className:"emote-controls-container",children:t.jsx(c.EmoteControls,{className:"emote-controls",wearablePreviewId:"wearable-editor",wearablePreviewController:I})}):null,t.jsxs("div",{className:"options",children:[t.jsx("div",{className:`option ${S?"active":""}`,onClick:this.handleToggleShowingAvatarAttributes,children:t.jsx(c.Icon,{name:"user"})}),C?null:this.renderEmoteSelector(),t.jsx("div",{className:`option ${E?"active":""}`,children:t.jsx(O,{name:"cylinder",onClick:()=>this.setState(f=>({showSceneBoundaries:!f.showSceneBoundaries}))})})]}),t.jsxs("div",{className:`avatar-attributes ${S?"active":""}`,children:[t.jsx("div",{className:"dropdown-container",children:t.jsx(c.Dropdown,{inline:!0,direction:"right",className:"Select",onChange:this.handleBodyShapeChange,...this.getDropdownAttributes(e,[{value:_.BodyShape.MALE,text:d("body_shapes.male")},{value:_.BodyShape.FEMALE,text:d("body_shapes.female")}],d("wearable.category.body_shape"))})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:s,colors:ns(),label:d("wearable.color.skin"),onChange:this.handleSkinColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:a,colors:is(),label:d("wearable.color.eye"),onChange:this.handleEyeColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:i,colors:ls(),label:d("wearable.color.hair"),onChange:this.handleHairColorChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.HAIR],category:_.WearableCategory.HAIR,bodyShape:e,label:d("wearable.category.hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.FACIAL_HAIR],category:_.WearableCategory.FACIAL_HAIR,bodyShape:e,label:d("wearable.category.facial_hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.UPPER_BODY],category:_.WearableCategory.UPPER_BODY,bodyShape:e,label:d("wearable.category.upper_body"),onChange:this.handleWearableChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.LOWER_BODY],category:_.WearableCategory.LOWER_BODY,bodyShape:e,label:d("wearable.category.lower_body"),onChange:this.handleWearableChange})})]})]})]})}};const ka=n=>{const l=te(n);let e;const s=Q(n);let a=os(n);s?(e=We(n).find(b=>b.id===s),a=a.filter(b=>b.collectionId===s)):a=a.filter(E=>!E.collectionId);const i=Ee(n)||"",o=je(n,i),r=ze(n),m=rs(n),g=Ye(n),p=ds(n),I=!g.some(X)&&p===_.PreviewEmote.IDLE,S="CreateSingleItemModal"in cs(n);return{address:l,bodyShape:r,collection:e,selectedItem:o,selectedBaseWearables:m?m[r]:null,skinColor:hs(n),eyeColor:ms(n),hairColor:gs(n),emote:p,visibleItems:g,wearableController:qe(n),emotes:a,isPlayingEmote:I?!1:Ge(n),isImportFilesModalOpen:S,hasUserOrphanItems:_e(n)}},Ba=n=>({onSetBodyShape:l=>n(ps(l)),onSetAvatarAnimation:l=>n(us(l)),onSetSkinColor:l=>n(Cs(l)),onSetEyeColor:l=>n(Is(l)),onSetHairColor:l=>n(bs(l)),onSetBaseWearable:(l,e,s)=>n(xs(l,e,s)),onFetchBaseWearables:()=>n(_s()),onSetWearablePreviewController:l=>n(vs(l)),onSetItems:l=>n(Ze(l)),onFetchOrphanItems:(l,e)=>n(Ke(l,e)),onFetchCollectionItems:(l,e)=>n(Es(l,e))}),Wa=B(ka,Ba)(Oa);class Fa extends x.PureComponent{constructor(){super(...arguments);h(this,"handleChange",e=>{const{value:s,maxLength:a,onChange:i}=this.props,o=e.target.value;s!==o&&i(a?o.slice(0,a):o)})}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 ie extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{value:this.props.value});h(this,"handleChange",(e,s)=>{const{value:a,onChange:i}=this.props,o=s.value;o!==a&&(this.setState({value:o}),i(o))})}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,i=s.find(o=>o.value===a);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"value",children:i?i.text:d("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(c.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})}}h(ie,"defaultProps",{disabled:!1});class Ie extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{value:this.props.value});h(this,"handleChange",(e,s)=>{const{onChange:a}=this.props,{value:i}=this.state,o=s.value,r=[...i];for(const m of o)i.includes(m)||r.push(m);r.length!==i.length&&(this.setState({value:r}),a(r))});h(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(i=>i!==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:i}=this.state,o=a.reduce((r,m)=>(r[m.value]=m.text,r),{});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"label",children:[e,s?t.jsx(ne,{content:s,className:"info"}):null]}),t.jsx("div",{className:"values",children:i.length>0?i.map(r=>t.jsxs("div",{className:"value",children:[o[r],t.jsx("div",{className:"remove",onClick:m=>{this.handleRemove(r),m.stopPropagation()}})]},r)):t.jsx("div",{className:"placeholder",children:d("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(c.Dropdown,{inline:!0,multiple:!0,className:`MultiSelect ${a.length>0?"":"blank"}`.trim(),trigger:this.renderTrigger(),direction:"right",value:a,scrolling:!1,options:e.filter(i=>!a.includes(i.value)),disabled:s,onChange:this.handleChange,closeOnChange:!0})}}h(Ie,"defaultProps",{disabled:!1});class tt extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{draft:"",value:this.props.value});h(this,"handleChange",e=>{this.setState({draft:e.target.value})});h(this,"handleAdd",()=>{const{onChange:e}=this.props,{draft:s,value:a}=this.state,i=s.trim();if(i!=="")if(a.includes(i))this.setState({draft:""});else{const o=[...a,i];this.setState({value:o,draft:""}),e(o)}});h(this,"handleKeyDown",e=>{if(e.key==="#"){e.preventDefault();return}else if(e.keyCode===js||e.keyCode===we||e.keyCode===Ss)this.handleAdd();else if(e.keyCode===fs||e.keyCode===we){const{draft:s,value:a}=this.state,i=a[a.length-1];i&&s===""&&this.handleRemove(i)}});h(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(i=>i!==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(i=>t.jsxs("div",{className:"value",children:[i,t.jsx("div",{className:"remove",onClick:o=>{this.handleRemove(i),o.stopPropagation()}})]},i)),t.jsx("input",{value:s,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onBlur:this.handleAdd,disabled:e})]})})}}h(tt,"defaultProps",{isDisabled:!1});let Ha=class extends x.PureComponent{constructor(){super(...arguments);h(this,"analytics",ve());h(this,"state",this.getInitialState());h(this,"thumbnailInput",x.createRef());h(this,"handleDeleteItem",()=>{const{onDeleteItem:e}=this.props,{selectedItem:s}=this.props;e(s)});h(this,"handleAddRepresentationToItem",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,addRepresentation:!0})});h(this,"handleChangeItemFile",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,changeItemFile:!0})});h(this,"handleOpenVideoDialog",(e={})=>{const{selectedItem:s,onOpenModal:a}=this.props;a("EditVideoModal",{item:s,onSaveVideo:this.handleSaveVideo,...e})});h(this,"handleSaveVideo",e=>{this.setState({video:URL.createObjectURL(e),contents:{...this.state.contents,[Te]:e},isDirty:!0})});h(this,"handleChangeName",e=>{this.setState({name:e,isDirty:this.isDirty({name:e})})});h(this,"handleChangeDescription",(e,s)=>{const a=s.value??"";this.setState({description:a,isDirty:this.isDirty({description:a})})});h(this,"handleChangeUtility",(e,s)=>{const a=s.value??"";this.setState({utility:a,isDirty:this.isDirty({utility:a})})});h(this,"handleChangeRarity",e=>{this.setState({rarity:e,isDirty:this.isDirty({rarity:e})})});h(this,"handleAllowVrmExport",(e,{checked:s})=>{const a={...this.state.data,blockVrmExport:!s};this.setState({data:a,isDirty:this.isDirty({data:a})})});h(this,"handleAllowOutlineCompatible",(e,{checked:s})=>{const a={...this.state.data,outlineCompatible:s};this.setState({data:a,isDirty:this.isDirty({data:a})})});h(this,"handleChangeCategory",e=>{let s;re(this.state.data)?s={...this.state.data,category:e}:(s={...this.state.data,category:e},e===_.WearableCategory.SKIN&&(s=this.setReplaces(s,[]),s=this.setHides(s,[]))),this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handlePlayModeChange",e=>{const s={...this.state.data,loop:e===de.LOOP};this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handleChangeReplaces",e=>{const s=this.setReplaces(this.state.data,e);this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handleChangeHides",(e,s)=>{const a=this.state.data.hides;let i=[];s==="wearable"?i=[...a.filter(r=>!_.WearableCategory.schema.enum.includes(r)),...e]:i=[...a.filter(r=>!_.BodyPartCategory.schema.enum.includes(r)),...e];const o=this.setHides(this.state.data,i);this.setState({data:o,isDirty:this.isDirty({data:o})})});h(this,"handleChangeTags",e=>{const s={...this.state.data,tags:e};this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handleOnSaveItem",async()=>{var S,E;const{selectedItem:e,itemStatus:s,onSaveItem:a}=this.props,{name:i,description:o,utility:r,rarity:m,contents:g,data:p,isDirty:I}=this.state;if(I&&e){let b=p;b&&!re(b)&&(b={...b,removesDefaultHiding:b.category===_.WearableCategory.UPPER_BODY||(S=b.hides)!=null&&S.includes(_.WearableCategory.UPPER_BODY)?[_.BodyPartCategory.HANDS]:[],..."blockVrmExport"in b?{blockVrmExport:b.blockVrmExport}:{},..."outlineCompatible"in b?{outlineCompatible:b.outlineCompatible}:{}});const C={...e.contents,...await ws(g)},w={...e,name:i,description:o,rarity:m,data:b,contents:C,utility:r??void 0};s&&[ye.UNPUBLISHED,ye.UNDER_REVIEW].includes(s)&&(w.video=C[Te]),a(w,g),Y(w.urn)&&((E=this.analytics)==null||E.track("Edit Item",{contents:g})),this.setState({isDirty:!1}),this.handleOnResetItem()}});h(this,"handleOnResetItem",()=>{const{selectedItem:e}=this.props;e&&this.setItem(e)});h(this,"handleOpenThumbnailDialog",()=>{const{selectedItem:e,onOpenModal:s}=this.props;(e==null?void 0:e.type)===y.EMOTE?s("EditThumbnailModal",{onSaveThumbnail:this.handleEmoteThumbnailChange,item:e}):this.thumbnailInput.current&&this.thumbnailInput.current.click()});h(this,"handleEmoteThumbnailChange",e=>{const s=Ts(e);this.setState({thumbnail:e,contents:{[Pe]:s},isDirty:!0})});h(this,"handleThumbnailChange",async e=>{const{files:s}=e.target;if(s&&s.length>0){const a=s[0],i=await Ae(a),o=await Ae(a,1024,1024),r=URL.createObjectURL(i);this.setState({thumbnail:r,contents:{[Pe]:o},isDirty:!0})}});h(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;Ce(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&&Ne(s)?!1:a}isSkin(){const{data:e}=this.state;return(e==null?void 0:e.category)===_.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||!Ue(e.data,s.data)}asCategorySelect(e,s){return s.map(a=>({value:a,text:d(`${e}.category.${a}`)}))}asRaritySelect(e){return e.map(s=>({value:s,text:d(`wearable.rarity.${s}`)}))}asPlayModeSelect(e){return e.map(s=>({value:s,text:d(`emote.play_mode.${s}.text`),description:d(`emote.play_mode.${s}.description`)}))}renderOverrides(e){const s=this.canEditItemMetadata(e),a=this.state.data;if(!e||re(a))return null;const i=ys(e.contents,a.category),o=Ps(e.contents),r=a.hides.filter(g=>i.includes(g)),m=a.hides.filter(g=>o.includes(g));return t.jsxs(t.Fragment,{children:[t.jsx(Ie,{itemId:e.id,label:d("item_editor.right_panel.base_body"),info:d("item_editor.right_panel.base_body_info"),value:m,options:this.asCategorySelect(e.type,o),disabled:!s,onChange:g=>this.handleChangeHides(g,"bodypart")}),t.jsx(Ie,{itemId:e.id,label:d("item_editor.right_panel.wearables"),info:d("item_editor.right_panel.wearables_info"),value:r,options:this.asCategorySelect(e.type,r.some(g=>g===_.WearableCategory.BODY_SHAPE)?i:i.filter(g=>g!==_.WearableCategory.BODY_SHAPE)),disabled:!s,onChange:g=>this.handleChangeHides(g,"wearable")})]})}renderModelDetails(e){const{isDownloading:s}=this.props,{thumbnail:a}=this.state,i=this.canEditItemMetadata(e),o=s?t.jsx(c.Loader,{active:!0,size:"tiny",className:"donwload-item-loader"}):t.jsx(O,{name:"export",className:"download-item-button",onClick:this.handleDownloadItem});return t.jsxs("div",{className:"details",children:[i?t.jsxs(t.Fragment,{children:[t.jsx(O,{name:"edit",className:"edit-item-file",onClick:this.handleChangeItemFile}),o,t.jsxs("div",{className:"thumbnail-container",children:[t.jsx(ge,{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(O,{name:"camera",onClick:this.handleOpenThumbnailDialog})]})]})]}):t.jsxs(t.Fragment,{children:[o,t.jsx(ge,{item:e,src:a,hasBadge:!0,badgeSize:"small"})]}),t.jsx(As,{item:e})]})}renderVideoDetails(e){if(!Re(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(O,{name:"edit",className:"edit-item-file",onClick:a}),t.jsx(O,{name:"play",className:"play-video-button",onClick:a}),t.jsx(De,{item:e,src:this.state.video,showMetrics:!0,onClick:a})]}):t.jsxs(t.Fragment,{children:[Ns(e)&&t.jsx(O,{name:"play",className:"play-video-button",onClick:a}),t.jsx(De,{item:e,src:this.state.video,showMetrics:!0})]})})}renderPermissions(e){return t.jsx(Rs,{requiredPermissions:e.data.requiredPermissions})}render(){const{selectedItemId:e,address:s,isWearableUtilityEnabled:a,isConnected:i,error:o,isCampaignEnabled:r,isVrmOptOutEnabled:m,campaignName:g,campaignTag:p}=this.props,{name:I,description:S,utility:E,rarity:b,data:C,isDirty:w,hasItem:f}=this.state,D=_.Rarity.getRarities(),M=Ds();return t.jsx("div",{className:"RightPanel",children:i?t.jsx(Qs,{id:e,children:(u,W,F)=>{var $;const le=W&&Ne(W),A=this.canEditItemMetadata(u),q=u?Ce(u)?Ms(u.contents):Ls():[];return F?t.jsx(c.Loader,{size:"massive",active:!0}):f||!e?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"header",children:[t.jsx("div",{className:"title",children:d("item_editor.right_panel.properties")}),u&&Qe(u,s)&&!u.isPublished&&!le?t.jsx(c.Dropdown,{trigger:t.jsx("div",{className:"actions"}),inline:!0,direction:"left",children:t.jsxs(c.Dropdown.Menu,{children:[pe(u)!==null?t.jsx(c.Dropdown.Item,{text:d("item_detail_page.add_representation",{bodyShape:d(`body_shapes.${pe(u)}`).toLowerCase()}),onClick:this.handleAddRepresentationToItem}):null,t.jsx(Xe,{name:I,onDelete:this.handleDeleteItem,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}),t.jsxs("div",{className:"container",children:[t.jsx(N,{label:d("item_editor.right_panel.details"),children:u?t.jsxs(t.Fragment,{children:[this.renderModelDetails(u),this.renderVideoDetails(u)]}):null}),t.jsx(N,{label:d("item_editor.right_panel.basics"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(Fa,{label:d("global.name"),value:I,disabled:!A,maxLength:Os,onChange:this.handleChangeName}),t.jsx(c.TextAreaField,{maxLength:ks,onChange:this.handleChangeDescription,label:d("global.description"),placeholder:d("item_editor.right_panel.description_placeholder"),disabled:!A,value:S,rows:"2",cols:"12"}),a?t.jsx(c.TextAreaField,{maxLength:Bs,onChange:this.handleChangeUtility,label:d("global.utility"),placeholder:d("item_editor.right_panel.utility_placeholder"),disabled:!A,value:E,tooltip:{content:d("item_editor.right_panel.utility_tooltip")},rows:"2",cols:"12"}):null,t.jsx(ie,{itemId:u.id,label:d("global.category"),value:C.category,options:this.asCategorySelect(u.type,q),disabled:!A,onChange:this.handleChangeCategory}),!(u.urn&&Y(u.urn))&&t.jsx(ie,{itemId:u.id,label:d("global.rarity"),value:b,options:this.asRaritySelect(D),disabled:u.isPublished||!A,onChange:this.handleChangeRarity})]}):null}),(u==null?void 0:u.type)===y.WEARABLE&&t.jsx(N,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.overrides")}),t.jsx(ne,{content:d("item_editor.right_panel.overrides_info"),className:"info"})]}),children:this.renderOverrides(u)}),(u==null?void 0:u.type)===y.EMOTE&&t.jsx(N,{label:d("item_editor.right_panel.animation"),children:u?t.jsx(ie,{itemId:u.id,label:d("create_single_item_modal.play_mode_label"),value:C.loop?de.LOOP:de.SIMPLE,options:this.asPlayModeSelect(M),disabled:!A,onChange:this.handlePlayModeChange}):null}),u&&Re(u)&&(($=u.data.requiredPermissions)!=null&&$.length)?t.jsx(N,{label:d("item_editor.right_panel.required_permissions"),children:this.renderPermissions(u)}):null,t.jsx(N,{label:d("item_editor.right_panel.tags"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(tt,{itemId:u.id,value:C.tags,onChange:this.handleChangeTags,isDisabled:!A}),r&&g&&p&&A&&t.jsx("p",{className:"event-tag",children:d("item_editor.right_panel.event_tag",{event_tag:t.jsx("span",{children:p}),event_name:t.jsx("span",{children:g})})})]}):null}),(u==null?void 0:u.type)===y.WEARABLE&&m&&t.jsx(N,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.copyright.title")}),t.jsx(ne,{content:d("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:d("item_editor.right_panel.copyright.vrm_export")}),t.jsx(c.Checkbox,{toggle:!0,label:C!=null&&C.blockVrmExport?d("item_editor.right_panel.copyright.disabled"):d("item_editor.right_panel.copyright.enabled"),checked:!(C!=null&&C.blockVrmExport),onChange:this.handleAllowVrmExport,"aria-label":d("item_editor.right_panel.copyright.vrm_export")})]})})}),(u==null?void 0:u.type)===y.WEARABLE&&t.jsx(N,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.outline_compatible.title")}),t.jsx(ne,{content:d("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:d("item_editor.right_panel.outline_compatible.title")}),t.jsx(c.Checkbox,{toggle:!0,label:(C==null?void 0:C.outlineCompatible)!==!1?d("item_editor.right_panel.copyright.enabled"):d("item_editor.right_panel.copyright.disabled"),checked:(C==null?void 0:C.outlineCompatible)!==!1,onChange:this.handleAllowOutlineCompatible,"aria-label":d("item_editor.right_panel.outline_compatible.title")})]})})}),w?t.jsxs("div",{className:"edit-buttons",children:[t.jsx(c.Button,{secondary:!0,onClick:this.handleOnResetItem,children:d("global.cancel")}),t.jsx(Me,{primary:!0,onClick:this.handleOnSaveItem,network:_.Network.MATIC,children:d("global.save")})]}):o&&e?t.jsxs("p",{className:"danger-text",children:[d("global.error_ocurred"),": ",o]}):null]})]}):null}}):null})}};const Va=n=>{var r;const l=Ee(n)||"",e=je(n,l),s=te(n)||"",a=l&&e&&e.collectionId?Le(n,e.collectionId):null,i=Ws(n),o=l?i[l]:null;return{address:s,collection:a,selectedItem:e,selectedItemId:l,canEditSelectedItem:e?a?Fe(n,s,a):Qe(e,s):!1,itemStatus:o,error:Fs(n),isConnected:be(n),isDownloading:Hs(n),isCommitteeMember:Oe(n),isCampaignEnabled:Vs(n),campaignTag:Gs(n),campaignName:(r=Zs(n))==null?void 0:r[Ks(n)],isVrmOptOutEnabled:$s(n),isWearableUtilityEnabled:Us(n)}},$a=n=>({onSaveItem:(l,e)=>n(Js(l,e)),onDeleteItem:l=>n(Ve(l)),onOpenModal:(l,e)=>n(He(l,e)),onDownload:l=>n(Ys(l))}),Ua=B(Va,$a)(Ha);class nn extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{reviewedItems:[]});h(this,"handleOnSetReviewedItems",e=>{this.setState(s=>({reviewedItems:[...s.reviewedItems,...e.filter(a=>!s.reviewedItems.some(i=>i.id===a.id))]}))});h(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(ma,{reviewedItems:e}),t.jsxs("div",{className:"content",children:[t.jsx(Da,{reviewedItems:e,onResetReviewedItems:this.handleResetReviewedItems,onSetReviewedItems:this.handleOnSetReviewedItems}),t.jsx(Wa,{}),t.jsx(Ua,{})]})]})})}}export{nn as default};
1
+ var rt=Object.defineProperty;var dt=(n,l,e)=>l in n?rt(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e;var h=(n,l,e)=>dt(n,typeof l!="symbol"?l+"":l,e);import{af as z,H as t,M as c,G as d,bm as H,bD as ct,D as x,gt as K,L as ee,K as R,cf as Me,b8 as _,N as B,bw as V,eD as ht,gu as mt,gv as gt,gw as pt,gx as ut,gy as Ct,gz as It,gA as bt,gB as xt,gC as _t,gD as L,er as vt,gE as Z,gF as Et,gG as Q,fc as Le,fr as jt,fX as St,fY as ft,eA as he,gm as wt,aH as te,gH as Tt,db as be,gI as xe,bt as Oe,gJ as yt,fZ as Pt,eE as me,aW as At,gK as Nt,gL as Rt,gM as Dt,fo as Mt,f$ as Lt,g0 as Ot,Z as ke,bv as Be,gN as kt,eS as fe,bE as Bt,fk as We,ae as Wt,gO as Fe,eH as _e,X as He,eu as Ft,ep as Ve,fF as X,dD as ge,eq as Ht,eV as pe,gP as $e,bk as ve,fV as Ue,eY as y,es as Y,fA as Je,fB as ue,J as O,f6 as Ce,dC as Vt,eQ as $t,eB as Ut,gQ as Ee,fb as je,fj as Jt,gR as Yt,gS as zt,gT as qt,gU as Ye,gV as ze,gW as qe,gX as Ge,fJ as Ze,eK as Gt,eJ as Ke,eL as Zt,eN as Kt,eO as Qt,gY as Xt,gZ as es,g_ as ts,g$ as se,h0 as oe,h1 as ss,ed as as,h2 as ns,h3 as is,h4 as ls,h5 as os,h6 as rs,h7 as ds,h8 as cs,h9 as hs,ha as ms,hb as gs,hc as ps,hd as us,he as Cs,hf as Is,hg as bs,hh as xs,hi as _s,hj as vs,f_ as Es,bO as ne,hk as js,hl as we,hm as Ss,hn as fs,eU as Te,fG as re,ho as de,eT as ws,eP as ye,eW as Ts,eX as Pe,eZ as Ae,e_ as Ne,hp as ys,hq as Ps,e$ as As,f0 as Re,f1 as De,hr as Ns,f9 as Rs,hs as Ds,ht as Ms,hu as Ls,hv as Qe,hw as Os,hx as ks,hy as Bs,fd as Ws,hz as Fs,hA as Hs,eG as Vs,hB as $s,fe as Us,fg as Js,hC as Ys}from"./index-DnIS3hck.js";import{J as zs}from"./JumpIn.container-C-3SfWd2.js";import{C as qs}from"./CollectionProvider.container-FTdRZ8FI.js";import{C as Xe}from"./ConfirmDelete-BLQNvkka.js";import{C as et}from"./CollectionStatus.container-CEXau8OY.js";import{d as Gs,e as Zs,c as Ks}from"./selectors-Du6lRm3_.js";import{I as Qs}from"./ItemProvider.container-nX_IipK6.js";const Xs=({open:n,assignee:l,onConfirm:e,onClose:s})=>t.jsxs(c.Modal,{size:"tiny",className:"ConfirmApprovalModal",open:n,children:[t.jsx(c.Modal.Header,{children:d("curation_page.confirm_not_assigned_curation_modal.title")}),t.jsxs(c.Modal.Content,{children:[t.jsx("div",{className:"message-container",children:t.jsx(H,{id:"curation_page.confirm_not_assigned_curation_modal.body",values:{assignee:t.jsx("strong",{children:t.jsx(ct,{textOnly:!0,address:l})})}})}),t.jsx("span",{children:t.jsx(H,{id:"curation_page.confirm_not_assigned_curation_modal.confirm_footer"})})]}),t.jsxs(c.Modal.Actions,{children:[t.jsx(c.Button,{onClick:s,children:d("global.cancel")}),t.jsx(c.Button,{primary:!0,onClick:e,children:d("curation_page.confirm_not_assigned_curation_modal.confirm_button")})]})]}),ea=z.memo(Xs);var T=(n=>(n.REJECT_COLLECTION="REJECT_COLLECTION",n.REJECT_CURATION="REJECT_CURATION",n.DISABLE_COLLECTION="DISABLE_COLLECTION",n.DISABLE_THIRD_PARTY="DISABLE_THIRD_PARTY",n))(T||{});const k="item_editor.top_panel.rejection_modal",ta=({open:n,type:l,isLoading:e,thirdParty:s,hasPendingTransaction:a,onDisableThirdParty:i,collection:o,curation:r,onReject:m,onRejectCuration:g,onClose:p})=>{const I=x.useMemo(()=>{switch(l){case T.DISABLE_COLLECTION:return k+".disable_collection";case T.REJECT_CURATION:return k+".reject_curation";case T.DISABLE_THIRD_PARTY:return k+".disable_third_party";default:return""}},[l]),S=()=>{switch(l){case T.DISABLE_COLLECTION:m(o);break;case T.REJECT_CURATION:g(r.collectionId);break;case T.DISABLE_THIRD_PARTY:s&&i(s.id);break}},E=l===T.DISABLE_COLLECTION&&!o.isApproved||l===T.DISABLE_THIRD_PARTY&&!(s!=null&&s.isApproved)||l===T.REJECT_COLLECTION&&!o.isApproved||l===T.REJECT_CURATION&&(r==null?void 0:r.status)===K.REJECTED;return t.jsx(c.Modal,{size:"tiny",className:"RejectionModal",open:n,children:a?t.jsx(sa,{i18nKey:I}):E?t.jsx(aa,{link:o.forumLink,onClose:p}):t.jsx(na,{i18nKey:I,isLoading:e,onClose:p,onConfirm:S})})},sa=({i18nKey:n})=>t.jsxs(t.Fragment,{children:[t.jsx(c.Modal.Header,{children:d(`${n}.title`)}),t.jsxs("div",{className:"loading-transaction",children:[t.jsx("div",{className:"danger-text",children:d(`${n}.tx_pending`)}),t.jsx("small",{className:"danger-text",children:t.jsx(H,{id:k+".visit_activity",values:{activity_link:t.jsx(ee,{to:R.activity(),children:d("global.activity")})}})}),t.jsx(c.Loader,{active:!0,size:"large"})]})]}),aa=({link:n,onClose:l})=>t.jsxs(t.Fragment,{children:[t.jsx(c.Modal.Header,{children:d(k+".veredict_explanation")}),t.jsx(c.Modal.Content,{children:d(k+".go_to_forum")}),t.jsxs(c.Modal.Actions,{children:[t.jsx("a",{href:n,className:"forum-link",target:"_blank",rel:"noopener noreferrer",children:t.jsxs(c.Button,{secondary:!0,icon:!0,labelPosition:"right",children:[t.jsx("div",{children:d(k+".forum_link")}),t.jsx("div",{className:"discussion",children:d(k+".discussion")}),t.jsx(c.Icon,{name:"chevron right"})]})}),t.jsx(c.Button,{basic:!0,onClick:l,children:d("global.done")})]})]}),na=({i18nKey:n,isLoading:l,onConfirm:e,onClose:s})=>t.jsxs(t.Fragment,{children:[t.jsx(c.Modal.Header,{children:d(`${n}.title`)}),t.jsx(c.Modal.Content,{children:d(`${n}.subtitle`)}),t.jsxs(c.Modal.Actions,{children:[t.jsx(Me,{primary:!0,onClick:e,disabled:l,loading:l,network:_.Network.MATIC,children:d(`${n}.action`)}),t.jsx(c.Button,{disabled:l,onClick:s,children:d("global.cancel")})]})]}),ia=z.memo(ta),la=(n,l)=>({isLoading:V(ht(n),xt)||V(mt(n),_t)||gt(n),hasPendingTransaction:pt(n)||!!(l.thirdParty&&ut(n,l.thirdParty.id))}),oa=n=>({onReject:l=>n(Ct(l)),onRejectCuration:l=>n(It(l)),onDisableThirdParty:l=>n(bt(l))}),ra=B(la,oa)(ia);var j=(n=>(n[n.APPROVE=0]="APPROVE",n[n.REJECT=1]="REJECT",n[n.ENABLE=2]="ENABLE",n[n.DISABLE=3]="DISABLE",n))(j||{});let da=class extends z.PureComponent{constructor(){super(...arguments);h(this,"state",{currentVeredict:void 0,showRejectionModal:null,showApproveConfirmModal:!1});h(this,"handleBack",()=>{this.props.onNavigate(R.curation())});h(this,"handleConfirmApprovalModal",(e,s)=>{const{address:a,onInitiateApprovalFlow:i,onInitiateTPApprovalFlow:o,onSetAssignee:r}=this.props;this.setState({showApproveConfirmModal:!1}),a&&r(e.id,a,s),L(e)?o(e):i(e)});h(this,"setShowRejectionModal",e=>this.setState({showRejectionModal:e}));h(this,"renderPage",e=>{const{items:s,itemCurations:a,curation:i,totalItems:o,thirdParty:r}=this.props,{showRejectionModal:m,showApproveConfirmModal:g}=this.state,{chainId:p}=this.props,I=vt(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," · ",d(`collection.type.${I}`),t.jsx(zs,{size:"small",active:!0,collection:e,chainId:p,items:L(e)?s:void 0,text:d("global.see_in_decentraland")})]}),t.jsx("div",{className:"actions",children:t.jsx("span",{className:"button-container",children:L(e)&&o!==void 0?this.renderTPButtons(e,i,a):this.renderButtons(e,i)})}),m&&t.jsx(ra,{type:m,open:!0,collection:e,curation:i,thirdParty:r,onClose:()=>this.setShowRejectionModal(null)}),(i==null?void 0:i.assignee)&&g&&t.jsx(ea,{open:!0,assignee:i.assignee,onConfirm:()=>this.handleConfirmApprovalModal(e,i),onClose:()=>this.setState({showApproveConfirmModal:!1})})]})});h(this,"renderButton",(e,s,a)=>{const{address:i,thirdParty:o,onInitiateApprovalFlow:r,onInitiateTPApprovalFlow:m,reviewedItems:g,totalItems:p}=this.props,I={[j.APPROVE]:()=>a!=null&&a.assignee&&i!==(a==null?void 0:a.assignee)?this.setState({showApproveConfirmModal:!0}):L(s)?m(s):r(s),[j.ENABLE]:()=>r(s),[j.DISABLE]:()=>this.setShowRejectionModal(o?T.DISABLE_THIRD_PARTY:T.DISABLE_COLLECTION),[j.REJECT]:()=>{(a==null?void 0:a.status)===K.PENDING?this.setShowRejectionModal(T.REJECT_CURATION):this.setShowRejectionModal(T.REJECT_COLLECTION)}},S={[j.APPROVE]:"approve",[j.ENABLE]:"enable",[j.DISABLE]:"disable",[j.REJECT]:"reject"},E=e===j.APPROVE||e===j.ENABLE,b=!L(s)||!!p&&g.length>=Z(p);return t.jsx(c.Popup,{content:d("item_editor.top_panel.items_pending_to_review"),disabled:b,position:"bottom center",trigger:t.jsx("div",{children:t.jsx(c.Button,{primary:E,onClick:()=>I[e](),disabled:L(s)&&e===j.APPROVE&&!!p&&g.length<Z(p),children:d(`item_editor.top_panel.${S[e]}`)})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0})});h(this,"renderTPButtons",(e,s,a)=>{const{reviewedItems:i,totalItems:o,thirdParty:r}=this.props,m=a==null?void 0:a.some(g=>g.status===K.PENDING);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Header,{sub:!0,children:[m?d("item_editor.top_panel.reviewed_counter",{count:i.length,threshold:Z(o)}):d("item_editor.top_panel.not_enough_items_to_curate_more"),i.length>=Z(o)?t.jsx(c.Icon,{name:"check circle"}):null]}),m&&this.renderButton(j.APPROVE,e,s),m&&this.renderButton(j.REJECT,e,s),!m&&(r==null?void 0:r.isApproved)&&this.renderButton(j.DISABLE,e,null)]})});h(this,"renderButtons",(e,s)=>{if(s&&e.isApproved)switch(s.status){case"pending":return t.jsxs(t.Fragment,{children:[this.renderButton(j.APPROVE,e,s),this.renderButton(j.REJECT,e,s)]});case"approved":case"rejected":return this.renderButton(j.DISABLE,e,s)}return Et(e)?e.isApproved?this.renderButton(j.DISABLE,e,s):this.renderButton(j.ENABLE,e,s):t.jsxs(t.Fragment,{children:[this.renderButton(j.APPROVE,e,s),this.renderButton(j.REJECT,e,s)]})})}render(){const{collection:e,items:s,isCommitteeMember:a,isReviewing:i,isConnected:o,isLoading:r}=this.props,m=!e||r&&!s.length;return a&&i&&o?t.jsx("div",{className:"TopPanel",children:m?t.jsx(c.Loader,{size:"small",active:!0}):this.renderPage(e)}):null}};const ca=n=>{const l=Q(n),e=l?Le(n,l):null,s=e?jt(n,e.id):[],a=e?St(n,e.id):[],i=l?ft(n,l):null,o=l?he(n,l):void 0,r=e&&L(e)?wt(n,e):null;return{address:te(n),items:s,totalItems:(o==null?void 0:o.total)||null,collection:e,itemCurations:a,thirdParty:r,curation:i,chainId:Tt(n),isConnected:be(n),isReviewing:xe(n),isCommitteeMember:Oe(n),selectedCollectionId:Q(n),isLoading:V(yt(n),Mt)||V(Pt(n),Lt)||V(me(n),Ot)}},ha=n=>({onNavigate:l=>n(At(l)),onSetAssignee:(l,e,s)=>n(Nt(l,e,s)),onInitiateTPApprovalFlow:l=>n(Rt(l)),onInitiateApprovalFlow:l=>n(Dt(l))}),ma=B(ca,ha)(da),ga="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",pa=n=>{const{collectionId:l,itemName:e}=n,[s,a]=x.useState(!1),[i,o]=x.useState(null),r=ke(),m=Be();x.useEffect(()=>{e&&(a(!0),o(e))},[e]);function g(){a(!1);const p=new URLSearchParams(m.search);p.delete("newItem"),r.replace({search:p.toString()})}return s&&i&&l?t.jsx(c.Toast,{type:c.ToastType.INFO,title:d("sagas.item.item_added_toast.title"),closable:!0,icon:t.jsx("div",{className:"ItemAddedToast icon-container",children:t.jsx("img",{src:ga,alt:d("sagas.item.item_added_toast.title")})}),onClose:g,body:t.jsx(H,{id:"sagas.item.item_added_toast.body",values:{name:i,br:()=>t.jsx("br",{}),b:p=>t.jsx("strong",{children:p}),"collection-link":p=>t.jsx(ee,{to:R.collectionDetail(l),children:t.jsx(c.Button,{className:"ItemAddedToast view-collection-link",basic:!0,children:p})})}})}):null},ua=z.memo(pa),Ca=n=>({itemName:kt(n)}),Ia=B(Ca)(ua),ba=({collection:n,address:l,hasUserOrphanItems:e,isLoggedIn:s,isReviewing:a,onOpenModal:i,onDeleteCollection:o})=>{var u,W;const r=Be(),m=ke(),g=((u=r.state)==null?void 0:u.fromParam)===fe.COLLECTIONS,p=((W=r.state)==null?void 0:W.fromParam)===fe.TP_COLLECTIONS,I=x.useCallback(()=>{m.push(R.collections())},[m]),S=x.useCallback(()=>{if(n&&(g||p)){const F=g?R.collectionDetail:R.thirdPartyCollectionDetail;m.push(F(n.id))}else m.push(R.itemEditor())},[g,p,m,n]),E=x.useCallback(()=>{i("CreateCollectionModal")},[i]),b=x.useCallback(()=>{n&&i("CreateSingleItemModal",{collectionId:n.id})},[n,i]),C=x.useCallback(()=>{n&&i("AddExistingItemModal",{collectionId:n.id})},[n,i]),w=x.useCallback(()=>{n&&i("EditCollectionNameModal",{collection:n})},[n,i]),f=x.useCallback(()=>{n&&o(n)},[n,o]),D=x.useCallback(()=>{const F=n&&Bt(n.owner,l||"");return n?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`block ${g||p?"close":"back"}`,onClick:S}),t.jsxs("div",{className:"title",children:[t.jsx(ee,{to:R.collectionDetail(n.id),children:n.name}),t.jsx(et,{collection:n})]}),F&&!n.isPublished?t.jsx(c.Dropdown,{trigger:t.jsx("div",{className:"block actions"}),inline:!0,direction:"left",children:t.jsxs(c.Dropdown.Menu,{children:[t.jsx(c.Dropdown.Item,{onClick:w,children:d("item_editor.left_panel.actions.edit_name")}),t.jsx(c.Dropdown.Item,{onClick:b,children:d("item_editor.left_panel.actions.new_item")}),e&&t.jsx(c.Dropdown.Item,{onClick:C,children:d("item_editor.left_panel.actions.add_existing_item")}),t.jsx(Xe,{name:n.name,onDelete:f,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}):null},[n,l,e,g,p]),M=x.useCallback(()=>t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"block close",onClick:I}),t.jsx("div",{className:"title",children:e?d("item_editor.left_panel.title"):d("item_editor.left_panel.title_alternative")}),s?t.jsx(c.Dropdown,{trigger:t.jsx("div",{className:"block add"}),inline:!0,direction:"left",children:t.jsx(c.Dropdown.Menu,{children:t.jsx(c.Dropdown.Item,{onClick:E,children:d("item_editor.left_panel.actions.new_collection")})})}):t.jsx("div",{className:"block"})]}),[e,s]);return a?null:t.jsx(c.Row,{grow:!1,shrink:!1,className:"Header",children:n?D():M()})},xa=ba,_a=n=>{let l;const e=Q(n);e&&(l=We(n).find(i=>i.id===e));const s=te(n);return{address:s,isLoggedIn:Wt(n),isReviewing:xe(n),collection:l,hasEditRights:l!==void 0&&s!==void 0&&Fe(n,s,l),hasUserOrphanItems:_e(n)}},va=n=>({onOpenModal:(l,e)=>n(He(l,e)),onDeleteCollection:l=>n(Ft(l)),onDeleteItem:l=>n(Ve(l))}),Ea=B(_a,va)(xa),P=10;class N extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{isCollapsed:!1});h(this,"handleToggle",()=>{this.setState({isCollapsed:!this.state.isCollapsed})})}render(){const{label:e,children:s}=this.props,{isCollapsed:a}=this.state,i=!a;return t.jsxs("div",{className:`Collapsable ${i?"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:i?s:null})]})}}class ja extends x.PureComponent{constructor(){super(...arguments);h(this,"handleClick",()=>{const{item:e,onClick:s}=this.props;s(e)})}renderToggleItem(){const{item:e,isVisible:s,isPlayingEmote:a}=this.props;return X(e)?t.jsx(c.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:i}=this.props;return t.jsx("div",{className:`SidebarItem ${s?"is-selected":""}`,children:t.jsxs(ee,{to:R.itemEditor({itemId:e.id,collectionId:a||void 0,newItem:void 0}),children:[t.jsx(ge,{item:e}),t.jsxs("div",{className:"name",children:[t.jsx(Ht,{item:e}),e.name]}),t.jsx(c.Popup,{content:d("item_editor.left_panel.invalid_representation_tooltip",{bodyShape:t.jsx("b",{children:d(`body_shapes.${pe(e)}`).toLowerCase()})}),disabled:$e(e,i),position:"top center",trigger:this.renderToggleItem()})]})})}}const Sa=ja;var v=(n=>(n.TO_REVIEW="to-review",n.REVIEWED="reviewed",n.ALL_ITEMS="all-items",n))(v||{});const fa={[v.TO_REVIEW]:1,[v.REVIEWED]:1,[v.ALL_ITEMS]:1};class wa extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{currentTab:v.TO_REVIEW,currentPages:fa,reviewedTabPage:1,showGetMoreSamplesModal:!1,showAllItemsTabChangeModal:!1});h(this,"analytics",ve());h(this,"handleReviewItemsTrigger",e=>{const{items:s,onReviewItems:a}=this.props,{currentTab:i}=this.state;this.getIsReviewingTPItems()&&i===v.TO_REVIEW&&!Ue(s,e==null?void 0:e.items)&&a()});h(this,"isVisible",e=>{const{visibleItems:s}=this.props;return s.some(a=>a.id===e.id)});h(this,"handleClick",e=>{var g;const{bodyShape:s,visibleItems:a,wearableController:i,isPlayingEmote:o,onSetItems:r}=this.props;if(!$e(e,s))return;let m=a.filter(p=>p.id!==e.id);if(X(e))if(this.isVisible(e)){o?i==null||i.emote.pause():i==null||i.emote.play();return}else m=m.filter(p=>p.type!==y.EMOTE);this.isVisible(e)||(m.push(e),(g=this.analytics)==null||g.track("Preview Item",{ITEM_ID:e!=null&&e.urn?Y(e.urn)?Je(e.urn):ue(e.urn):null,ITEM_TYPE:e.type,ITEM_NAME:e.name,ITEM_IS_THIRD_PARTY:Y(e.urn)})),r(m)});h(this,"handleTabChange",e=>{const{onLoadPage:s,onReviewItems:a,onResetReviewedItems:i}=this.props,{currentPages:o}=this.state;e===v.ALL_ITEMS?this.setState({showAllItemsTabChangeModal:!1},()=>{i(),s(o[v.ALL_ITEMS])}):e===v.TO_REVIEW&&a(),this.setState({currentTab:e})});h(this,"handleGetRandomSampleClick",()=>{const{showSamplesModalAgain:e,onLoadRandomPage:s}=this.props;e?this.setState({showGetMoreSamplesModal:!0}):s()});h(this,"handleModalProceed",()=>{const{onLoadRandomPage:e}=this.props;e(),this.setState({showGetMoreSamplesModal:!1})});h(this,"handlePageChange",(e,s)=>{const{currentTab:a}=this.state,{onLoadPage:i}=this.props;this.setState(o=>({currentPages:{...o.currentPages,[a]:+s.activePage}})),a!==v.REVIEWED&&i(+s.activePage)});h(this,"handleSwitchToAllItemsTab",()=>{const{reviewedItems:e}=this.props;e.length>0?this.setState({showAllItemsTabChangeModal:!0}):this.handleTabChange(v.ALL_ITEMS)});h(this,"getIsReviewingTPItems",()=>{const{collection:e,isReviewing:s}=this.props;return e?Y(e.urn)&&s:!1});h(this,"renderSidebarItem",e=>{const{collection:s,selectedItemId:a,bodyShape:i,isPlayingEmote:o}=this.props;return t.jsx(Sa,{item:e,isSelected:a===e.id,isVisible:this.isVisible(e),isPlayingEmote:o,selectedCollectionId:(s==null?void 0:s.id)??null,bodyShape:i,onClick:this.handleClick},e.id)});h(this,"renderSidebarCategory",e=>{const s=e.filter(Ce),a=e.filter(X);return e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:d("item_editor.left_panel.empty_collection")})}):s.length===0||a.length===0?e.map(this.renderSidebarItem):t.jsxs(t.Fragment,{children:[t.jsx(N,{label:this.renderCollapsableLabel(y.WEARABLE),children:s.map(this.renderSidebarItem)}),t.jsx(N,{label:this.renderCollapsableLabel(y.EMOTE),children:a.map(this.renderSidebarItem)})]})});h(this,"renderTabPagination",e=>{const{currentTab:s,currentPages:a}=this.state,i=a[s],o=Math.ceil(e/P);return o>1?t.jsx(c.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:o,activePage:i,onPageChange:this.handlePageChange}):null});h(this,"renderPaginationStats",e=>{const{currentPages:s,currentTab:a}=this.state,i=s[a],o=(i-1)*P,r=i*P;return t.jsx(c.Header,{sub:!0,children:d("item_editor.left_panel.reviewed_tab.page_counter",{pageStart:o,pageEnd:r>e?e:r,total:e})})});h(this,"renderTabContent",()=>{const{items:e,isLoading:s,totalItems:a,reviewedItems:i}=this.props,{currentTab:o,currentPages:r}=this.state,m=this.getIsReviewingTPItems(),g=r[o];if(s)return t.jsx(c.Loader,{size:"large",active:!0});switch(o){case v.TO_REVIEW:return t.jsxs(t.Fragment,{children:[this.renderSidebarCategory(e),!m&&a?this.renderTabPagination(a):null]});case v.REVIEWED:{const p=i.slice((g-1)*P,g*P);return t.jsxs(t.Fragment,{children:[i.length?this.renderPaginationStats(i.length):null,this.renderSidebarCategory(p),i.length?this.renderTabPagination(i.length):null]})}case v.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}});h(this,"renderTabHeader",()=>{const{isLoading:e,totalItems:s,reviewedItems:a}=this.props,{currentTab:i}=this.state;let o;const r=!s||s<P||a.length===s;switch(i){case v.TO_REVIEW:o=t.jsx(c.Popup,{content:d("item_editor.top_panel.not_enough_items_to_curate_more"),disabled:!r,position:"bottom center",trigger:t.jsx("div",{children:t.jsxs(c.Button,{disabled:e||r,primary:!0,className:"random-sample-button",onClick:this.handleGetRandomSampleClick,children:[t.jsx(c.Icon,{name:"random"}),d("item_editor.left_panel.get_random_sample")]})}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0});break;case v.REVIEWED:o=t.jsx(H,{id:"item_editor.left_panel.reviewed_samples",values:{reviewed_samples_bold:t.jsx("b",{children:d("item_editor.left_panel.reviewed_samples_bold",{count:a.length})}),total:Z(s??1)}});break;default:return null}return t.jsxs("div",{className:"tab-header",children:[" ",o," "]})});h(this,"renderModal",()=>{const{onToggleShowSamplesModalAgain:e,showSamplesModalAgain:s}=this.props,{showGetMoreSamplesModal:a}=this.state;return t.jsxs(c.Modal,{open:a,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(c.Modal.Header,{children:d("item_editor.left_panel.get_more_samples_modal.title")}),t.jsxs(c.Modal.Content,{children:[t.jsx(H,{id:"item_editor.left_panel.get_more_samples_modal.content",values:{count:10,tabName:t.jsx("b",{children:v.REVIEWED})}}),t.jsxs("div",{className:"checkbox-container",onClick:e,children:[t.jsx(c.Checkbox,{checked:!s}),d("item_editor.left_panel.get_more_samples_modal.dont_show_again")]})]}),t.jsxs(c.Modal.Actions,{children:[t.jsx(c.Button,{onClick:()=>this.setState({showGetMoreSamplesModal:!1}),children:d("global.cancel")}),t.jsx(c.Button,{primary:!0,onClick:this.handleModalProceed,children:d("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});h(this,"renderAllItemsTabChangeModal",()=>{const{showAllItemsTabChangeModal:e}=this.state;return t.jsxs(c.Modal,{open:e,size:"small",className:"ConfirmNewSampleModal",children:[t.jsx(c.Modal.Header,{children:d("item_editor.left_panel.all_items_check.title")}),t.jsx(c.Modal.Content,{children:d("item_editor.left_panel.all_items_check.content")}),t.jsxs(c.Modal.Actions,{children:[t.jsx(c.Button,{onClick:()=>this.setState({showAllItemsTabChangeModal:!1}),children:d("global.cancel")}),t.jsx(c.Button,{primary:!0,onClick:()=>this.handleTabChange(v.ALL_ITEMS),children:d("item_editor.left_panel.get_more_samples_modal.understood")})]})]})});h(this,"renderTabs",()=>{const{currentTab:e}=this.state;return t.jsxs(c.Tabs,{isFullscreen:!0,children:[t.jsx(c.Tabs.Tab,{active:e===v.TO_REVIEW,onClick:()=>this.handleTabChange(v.TO_REVIEW),children:d("item_editor.left_panel.to_review")}),t.jsx(c.Tabs.Tab,{active:e===v.REVIEWED,onClick:()=>this.handleTabChange(v.REVIEWED),children:d("item_editor.left_panel.reviewed")}),t.jsx(c.Tabs.Tab,{active:e===v.ALL_ITEMS,onClick:this.handleSwitchToAllItemsTab,children:d("item_editor.left_panel.all_items")})]})})}componentDidMount(){this.handleReviewItemsTrigger()}componentDidUpdate(e){this.handleReviewItemsTrigger(e)}renderCollapsableLabel(e){return t.jsxs(t.Fragment,{children:[t.jsx(O,{name:e}),t.jsx(H,{id:`item_editor.left_panel.${e}`})]})}render(){return t.jsxs(c.Section,{className:"Items",children:[this.getIsReviewingTPItems()?t.jsxs(t.Fragment,{children:[this.renderTabs(),this.renderTabHeader()]}):null,this.renderTabContent(),this.renderModal(),this.renderAllItemsTabChangeModal()]})}}class Ta extends x.PureComponent{render(){const{collection:l,isSelected:e}=this.props;return t.jsx("div",{className:`SidebarCollection ${e?"is-selected":""}`,children:t.jsxs(ee,{to:R.itemEditor({collectionId:l.id}),children:[t.jsx(Vt,{collectionId:l.id}),t.jsxs("div",{className:"wrapper",children:[t.jsxs("div",{className:"name",children:[t.jsx(et,{collection:l}),l.name]}),t.jsx("div",{className:"count",children:d("item_editor.left_panel.items_count",{count:l.itemCount})})]})]})})}}const ya=Ta;class Pa extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{currentPage:1});h(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:i,totalCollections:o}=this.props,{currentPage:r}=this.state;if(e.length===0)return null;const m=Math.ceil(o/P);return s?t.jsx(c.Loader,{size:"small",active:!0}):!s&&a.length===0&&e.length===0?t.jsx("div",{className:"empty",children:t.jsx("div",{className:"subtitle",children:d("collections_page.empty_description")})}):t.jsx(t.Fragment,{children:t.jsxs(c.Section,{className:"Collections",children:[e.map(g=>t.jsx(ya,{collection:g,items:a,isSelected:g.id===i},g.id)),m>1?t.jsx(c.Pagination,{siblingRange:0,firstItem:null,lastItem:null,totalPages:m,activePage:r,onPageChange:this.handlePageChange}):null]})})}}var J=(n=>(n.COLLECTIONS="collections",n.ORPHAN_ITEMS="orphanItems",n))(J||{});const U=1;let Aa=class extends x.PureComponent{constructor(){super(...arguments);h(this,"state",this.getInitialState());h(this,"handleToggleShowSamplesModalAgain",()=>{this.setState(e=>({showSamplesModalAgain:!e.showSamplesModalAgain}))});h(this,"fetchResource",()=>{const{address:e,onFetchCollections:s,onFetchOrphanItems:a,isReviewing:i,selectedCollectionId:o}=this.props,{pages:r}=this.state;if(e&&!i&&!o){const m=r[r.length-1];(this.isCollectionTabActive()?s:a)(e,{limit:P,page:m})}});h(this,"loadPage",e=>{this.setState({pages:[e]},()=>this.fetchResource())});h(this,"getRandomPage",(e,s)=>Math.floor(Math.random()*(s-e+1)+e));h(this,"loadRandomPage",e=>{const{pages:s}=this.state,{totalItems:a,totalCollections:i,onSetReviewedItems:o}=this.props,r=this.isCollectionTabActive()?i:a,m=Math.ceil(r/P);if(m>s.length){const g=[...Array(m).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(I=>({pages:[...I.pages,p]}),this.fetchResource)}}o(e)});h(this,"handleTabChange",e=>{this.setState({currentTab:e,pages:[U]},this.fetchResource)});h(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:[U],currentTab:a,initialPage:U,showSamplesModalAgain:!0}}componentDidMount(){const{address:e,hasUserOrphanItems:s,selectedItem:a,onFetchOrphanItem:i,onSetItems:o}=this.props;this.fetchResource(),e&&s===void 0&&i(e),a&&o([a])}componentDidUpdate(e,s){const{isConnected:a,address:i,selectedCollectionId:o,selectedItemId:r,selectedItem:m,orphanItems:g,totalItems:p,visibleItems:I,hasUserOrphanItems:S,onSetItems:E,onFetchOrphanItem:b}=this.props,{initialPage:C,pages:w}=this.state;if(!o&&i&&r&&p&&(C===U||s.initialPage<C)){if(!g.find(f=>f.id===r)){const f=Math.ceil(p/P),D=w[w.length-1],M=Math.min(f,D+1);w.includes(M)||this.setState({pages:[M],initialPage:M},this.fetchResource)}}else if(e.selectedItemId&&r&&e.selectedItemId!==r){const f=I.filter(D=>D.type!==y.EMOTE);E(f)}else i&&a&&(a!==e.isConnected||e.selectedCollectionId&&!o)&&this.setState({pages:[U]},this.fetchResource),e.selectedCollectionId!==o&&this.setState({pages:[U]}),i&&i!==e.address&&S===void 0&&b(i);!e.selectedItem&&m&&m.type!==y.EMOTE&&E([m]),e.selectedCollectionId!==o&&E([])}componentWillUnmount(){const{onSetItems:e}=this.props;e([])}getItems(e,s,a){const{selectedCollectionId:i,orphanItems:o,isReviewing:r}=this.props;return i&&e?$t(e)&&r?s.filter(m=>!!(a!=null&&a.find(g=>g.itemId===m.id&&g.status===K.PENDING))):s:o}render(){const{items:e,totalItems:s,totalCollections:a,collections:i,selectedItemId:o,selectedCollectionId:r,visibleItems:m,bodyShape:g,reviewedItems:p,isReviewing:I,isPlayingEmote:S,isConnected:E,wearableController:b,isLoading:C,hasUserOrphanItems:w,onSetItems:f,onSetReviewedItems:D,onResetReviewedItems:M}=this.props,{pages:u,showSamplesModalAgain:W}=this.state,F=!r&&w,le=this.isCollectionTabActive()&&!r,A=!this.isCollectionTabActive()||r;return t.jsx("div",{className:"LeftPanel",children:E?t.jsx(qs,{id:r,itemSelected:o,itemsPage:u,itemsPageSize:P,fetchCollectionItemsOptions:{status:I?K.PENDING:void 0},onChangePage:q=>this.setState({pages:[q]}),children:({paginatedCollections:q,collection:$,paginatedItems:st,initialPage:at,isLoadingCollection:nt,isLoadingCollectionItems:it,itemCurations:lt})=>{const G=this.getItems($,st,lt),Se=this.isCollectionTabActive(),ot=r&&$?at:this.state.initialPage;return t.jsxs(t.Fragment,{children:[t.jsx(Ea,{}),F?t.jsxs(c.Tabs,{isFullscreen:!0,children:[t.jsx(c.Tabs.Tab,{active:Se,onClick:()=>this.handleTabChange(J.COLLECTIONS),children:d("collections_page.collections")}),t.jsx(c.Tabs.Tab,{active:!Se,onClick:()=>this.handleTabChange(J.ORPHAN_ITEMS),children:d("item_editor.left_panel.items")})]}):null,le?t.jsx(Pa,{collections:q,totalCollections:a||i.length,items:e,hasHeader:G.length>0,selectedCollectionId:r,onLoadPage:this.loadPage,isLoading:nt}):null,A?t.jsxs(t.Fragment,{children:[t.jsx(wa,{items:G,totalItems:s||G.length,hasHeader:!r&&i.length>0,selectedItemId:o,collection:$,isReviewing:I,isPlayingEmote:S,visibleItems:m,bodyShape:g,onResetReviewedItems:M,reviewedItems:p,onSetItems:f,wearableController:b,initialPage:ot,isLoading:it||C,onToggleShowSamplesModalAgain:this.handleToggleShowSamplesModalAgain,showSamplesModalAgain:W,onReviewItems:()=>D(G),onLoadRandomPage:()=>this.loadRandomPage(G),onLoadPage:this.loadPage}),t.jsx(Ia,{collectionId:r})]}):null]})}}):null})}};const Na=n=>{const l=Q(n),e=te(n),s=l?he(n,l):e?he(n,e):void 0,a=l?void 0:Ut(n),i=Ee(n)||"",o=je(n,i);return{address:e,isConnected:be(n),items:Jt(n),totalItems:(s==null?void 0:s.total)||null,totalCollections:(a==null?void 0:a.total)||null,orphanItems:e&&!l?Yt(n,e,s==null?void 0:s.limit):zt(n),collections:qt(n),selectedItemId:i,selectedItem:o,selectedCollectionId:l,visibleItems:Ye(n),bodyShape:ze(n),wearableController:qe(n),isReviewing:xe(n),isLoading:V(me(n),Kt)||V(me(n),Qt),isPlayingEmote:Ge(n),hasUserOrphanItems:_e(n)}},Ra=n=>({onSetItems:l=>n(Ze(l)),onFetchCollections:(l,e)=>n(Gt(l,e)),onFetchOrphanItems:(l,e)=>n(Ke(l,e)),onFetchOrphanItem:l=>n(Zt(l))}),Da=B(Na,Ra)(Aa);class ce extends z.PureComponent{constructor(){super(...arguments);h(this,"handleAvatarColorChange",(e,s)=>{const{currentColor:a,colors:i,onChange:o}=this.props;if(a.toHexString()!==s.value){const r=i.find(m=>m.toHexString()===s.value);o(r)}});h(this,"renderItem",(e,s)=>{const a=e.toHexString();return t.jsx(c.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,i=e.toHexString();return t.jsx(c.Dropdown,{inline:!0,direction:"right",className:"AvatarColorDropdown Select",value:i,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:i}})}),t.jsx("div",{className:"handle"})]}),children:t.jsx(c.Dropdown.Menu,{className:"colors-menu",children:s.map(this.renderItem)})})}}let Ma=class extends z.PureComponent{constructor(){super(...arguments);h(this,"handleAvatarChangeWearable",(e,s)=>{const{wearable:a,category:i,bodyShape:o,onChange:r,baseWearables:m}=this.props,g=s.value?m.find(p=>p.id===s.value):null;a!==g&&r(i,o,g??null)})}render(){const{wearable:e,bodyShape:s,category:a,label:i,isNullable:o,baseWearables:r}=this.props,m=Xt(r,a,s).map(p=>({value:p.id,text:es(p)}));o&&m.push({value:"",text:d("global.none")});const g=e?m.find(p=>p.value===e.id):null;return t.jsx(c.Dropdown,{inline:!0,direction:"right",className:"AvatarWearableDropdown Select",value:e?e.id:"",options:m,scrolling:!0,onChange:this.handleAvatarChangeWearable,trigger:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:i}),t.jsx("div",{className:"value",children:g?g.text:d("global.none")}),t.jsx("div",{className:"handle"})]})})}};const La=n=>({baseWearables:ts(n)}),ae=B(La)(Ma);let Oa=class extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{showSceneBoundaries:!1,isShowingAvatarAttributes:!1,isLoading:!1});h(this,"analytics",ve());h(this,"handleToggleShowingAvatarAttributes",()=>{this.setState({isShowingAvatarAttributes:!this.state.isShowingAvatarAttributes})});h(this,"handleBodyShapeChange",(e,{value:s})=>{const{onSetBodyShape:a}=this.props;a(s)});h(this,"handleAnimationChange",(e,{value:s})=>{const{emotes:a,visibleItems:i,onSetAvatarAnimation:o,onSetItems:r}=this.props,m=a.find(p=>p.id===s),g=i.filter(p=>p.type!==y.EMOTE);g.forEach(p=>{var I;(I=this.analytics)==null||I.track("Play Emote",{EMOTE_PLAYED_BASE:!m,EMOTE_PLAYED_ITEM_ID:m!=null&&m.urn?ue(m.urn):null,EMOTE_PLAYED_NAME:m?m.name:s,PREVIEWED_WEARABLE_ITEM_ID:p!=null&&p.urn?Y(p.urn)?Je(p.urn):ue(p.urn):null,PREVIEWED_WEARABLE_NAME:p.name})}),m?g.push(m):o(s),r(g)});h(this,"handleSkinColorChange",e=>{const{onSetSkinColor:s}=this.props;s(e)});h(this,"handleEyeColorChange",e=>{const{onSetEyeColor:s}=this.props;s(e)});h(this,"handleHairColorChange",e=>{const{onSetHairColor:s}=this.props;s(e)});h(this,"handleWearableChange",(e,s,a)=>{const{onSetBaseWearable:i}=this.props;i(e,s,a)});h(this,"handleWearablePreviewLoad",()=>{const{wearableController:e,onSetWearablePreviewController:s}=this.props;e||s(c.WearablePreview.createController("wearable-editor")),this.setState({isLoading:!1})});h(this,"handleControlActionChange",async e=>{const{wearableController:s}=this.props,a=.1;if(s)switch(await(s==null?void 0:s.emote.pause()),e){case se.ZOOM_IN:{await(s==null?void 0:s.scene.changeZoom(a));break}case se.ZOOM_OUT:{await(s==null?void 0:s.scene.changeZoom(-a));break}}});h(this,"handlePlayEmote",()=>{const{wearableController:e,isPlayingEmote:s,visibleItems:a,onSetAvatarAnimation:i,onSetItems:o}=this.props,r=a.filter(m=>m.type!==y.EMOTE);s?(i(_.PreviewEmote.IDLE),o(r)):e==null||e.emote.play()});h(this,"renderEmotePlayButton",()=>{const{isPlayingEmote:e}=this.props,s=e?"stop":"play",a=e?d("item_editor.center_panel.stop"):d("item_editor.center_panel.play_emote");return t.jsxs(c.Button,{icon:!0,onClick:this.handlePlayEmote,children:[t.jsx(c.Icon,{name:s}),t.jsx("span",{children:a})]})});h(this,"renderEmoteDropdownButton",()=>{const{collection:e,emotes:s,isPlayingEmote:a}=this.props,i=!!e,o=s.length>0;return a?null:t.jsx(c.Dropdown,{className:"avatar-animation button icon",floating:!0,scrolling:!0,children:t.jsxs(c.Dropdown.Menu,{children:[o&&t.jsxs(t.Fragment,{children:[t.jsx(c.Dropdown.Header,{content:i?d("item_editor.center_panel.from_collection"):d("item_editor.center_panel.from_items")}),t.jsx(c.Dropdown.Divider,{}),s.map(r=>t.jsx(c.Dropdown.Item,{value:r.id,text:r.name,onClick:this.handleAnimationChange},r.id)),t.jsx(c.Dropdown.Divider,{}),t.jsx(c.Dropdown.Header,{content:d("item_editor.center_panel.default")}),t.jsx(c.Dropdown.Divider,{})]}),_.PreviewEmote.schema.enum.map(r=>t.jsx(c.Dropdown.Item,{value:r,text:d(`emotes.${r}`),onClick:this.handleAnimationChange},r))]})})});h(this,"renderEmoteSelector",()=>t.jsx(c.Popup,{content:d("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(c.Button.Group,{children:[this.renderEmotePlayButton(),this.renderEmoteDropdownButton()]})})}))}componentDidMount(){const{address:e,collection:s,emotes:a,selectedBaseWearables:i,hasUserOrphanItems:o,onFetchBaseWearables:r,onFetchOrphanItems:m,onFetchCollectionItems:g}=this.props,p=a.length>0;i||r(),p||(s&&!L(s)?g(s.id):e&&o&&m(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 i=s.find(o=>o.value===e);return{value:e,options:s,trigger:this.renderSelectTrigger(a,i?i.text:"")}}render(){const{bodyShape:e,skinColor:s,eyeColor:a,hairColor:i,emote:o,selectedBaseWearables:r,selectedItem:m,visibleItems:g,isImportFilesModalOpen:p,wearableController:I}=this.props,{isShowingAvatarAttributes:S,showSceneBoundaries:E,isLoading:b}=this.state,C=g.some(X)&&(m==null?void 0:m.type)===y.EMOTE,w=o===_.PreviewEmote.JUMP?1:void 0;return t.jsxs("div",{className:`CenterPanel ${p?"import-files-modal-is-open":""}`,children:[t.jsx(c.WearablePreview,{id:"wearable-editor",profile:"default",bodyShape:e,emote:o,zoom:w,skin:oe(s),eyes:oe(a),hair:oe(i),urns:r?Object.values(r).map(f=>f?f.id:null).filter(f=>f!==null):[],base64s:g.map(ss),disableAutoRotate:!0,disableBackground:!0,wheelZoom:1.5,wheelStart:100,dev:as,onUpdate:()=>this.setState({isLoading:!0}),onLoad:this.handleWearablePreviewLoad,disableDefaultEmotes:C,showSceneBoundaries:E}),C?t.jsxs("div",{className:"zoom-controls",children:[t.jsx(c.Button,{className:"zoom-control zoom-in-control",onClick:()=>this.handleControlActionChange(se.ZOOM_IN),children:t.jsx(c.Icon,{name:"plus"})}),t.jsx(c.Button,{className:"zoom-control zoom-out-control",onClick:()=>this.handleControlActionChange(se.ZOOM_OUT),children:t.jsx(c.Icon,{name:"minus"})})]}):null,b&&t.jsx(c.Center,{children:t.jsx(c.Loader,{active:!0})}),t.jsxs("div",{className:"footer",children:[C&&!b&&I?t.jsx("div",{className:"emote-controls-container",children:t.jsx(c.EmoteControls,{className:"emote-controls",wearablePreviewId:"wearable-editor",wearablePreviewController:I})}):null,t.jsxs("div",{className:"options",children:[t.jsx("div",{className:`option ${S?"active":""}`,onClick:this.handleToggleShowingAvatarAttributes,children:t.jsx(c.Icon,{name:"user"})}),C?null:this.renderEmoteSelector(),t.jsx("div",{className:`option ${E?"active":""}`,children:t.jsx(O,{name:"cylinder",onClick:()=>this.setState(f=>({showSceneBoundaries:!f.showSceneBoundaries}))})})]}),t.jsxs("div",{className:`avatar-attributes ${S?"active":""}`,children:[t.jsx("div",{className:"dropdown-container",children:t.jsx(c.Dropdown,{inline:!0,direction:"right",className:"Select",onChange:this.handleBodyShapeChange,...this.getDropdownAttributes(e,[{value:_.BodyShape.MALE,text:d("body_shapes.male")},{value:_.BodyShape.FEMALE,text:d("body_shapes.female")}],d("wearable.category.body_shape"))})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:s,colors:ns(),label:d("wearable.color.skin"),onChange:this.handleSkinColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:a,colors:is(),label:d("wearable.color.eye"),onChange:this.handleEyeColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:i,colors:ls(),label:d("wearable.color.hair"),onChange:this.handleHairColorChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.HAIR],category:_.WearableCategory.HAIR,bodyShape:e,label:d("wearable.category.hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.FACIAL_HAIR],category:_.WearableCategory.FACIAL_HAIR,bodyShape:e,label:d("wearable.category.facial_hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.UPPER_BODY],category:_.WearableCategory.UPPER_BODY,bodyShape:e,label:d("wearable.category.upper_body"),onChange:this.handleWearableChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(ae,{wearable:r[_.WearableCategory.LOWER_BODY],category:_.WearableCategory.LOWER_BODY,bodyShape:e,label:d("wearable.category.lower_body"),onChange:this.handleWearableChange})})]})]})]})}};const ka=n=>{const l=te(n);let e;const s=Q(n);let a=os(n);s?(e=We(n).find(b=>b.id===s),a=a.filter(b=>b.collectionId===s)):a=a.filter(E=>!E.collectionId);const i=Ee(n)||"",o=je(n,i),r=ze(n),m=rs(n),g=Ye(n),p=ds(n),I=!g.some(X)&&p===_.PreviewEmote.IDLE,S="CreateSingleItemModal"in cs(n);return{address:l,bodyShape:r,collection:e,selectedItem:o,selectedBaseWearables:m?m[r]:null,skinColor:hs(n),eyeColor:ms(n),hairColor:gs(n),emote:p,visibleItems:g,wearableController:qe(n),emotes:a,isPlayingEmote:I?!1:Ge(n),isImportFilesModalOpen:S,hasUserOrphanItems:_e(n)}},Ba=n=>({onSetBodyShape:l=>n(ps(l)),onSetAvatarAnimation:l=>n(us(l)),onSetSkinColor:l=>n(Cs(l)),onSetEyeColor:l=>n(Is(l)),onSetHairColor:l=>n(bs(l)),onSetBaseWearable:(l,e,s)=>n(xs(l,e,s)),onFetchBaseWearables:()=>n(_s()),onSetWearablePreviewController:l=>n(vs(l)),onSetItems:l=>n(Ze(l)),onFetchOrphanItems:(l,e)=>n(Ke(l,e)),onFetchCollectionItems:(l,e)=>n(Es(l,e))}),Wa=B(ka,Ba)(Oa);class Fa extends x.PureComponent{constructor(){super(...arguments);h(this,"handleChange",e=>{const{value:s,maxLength:a,onChange:i}=this.props,o=e.target.value;s!==o&&i(a?o.slice(0,a):o)})}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 ie extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{value:this.props.value});h(this,"handleChange",(e,s)=>{const{value:a,onChange:i}=this.props,o=s.value;o!==a&&(this.setState({value:o}),i(o))})}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,i=s.find(o=>o.value===a);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"label",children:e}),t.jsx("div",{className:"value",children:i?i.text:d("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(c.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})}}h(ie,"defaultProps",{disabled:!1});class Ie extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{value:this.props.value});h(this,"handleChange",(e,s)=>{const{onChange:a}=this.props,{value:i}=this.state,o=s.value,r=[...i];for(const m of o)i.includes(m)||r.push(m);r.length!==i.length&&(this.setState({value:r}),a(r))});h(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(i=>i!==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:i}=this.state,o=a.reduce((r,m)=>(r[m.value]=m.text,r),{});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"label",children:[e,s?t.jsx(ne,{content:s,className:"info"}):null]}),t.jsx("div",{className:"values",children:i.length>0?i.map(r=>t.jsxs("div",{className:"value",children:[o[r],t.jsx("div",{className:"remove",onClick:m=>{this.handleRemove(r),m.stopPropagation()}})]},r)):t.jsx("div",{className:"placeholder",children:d("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(c.Dropdown,{inline:!0,multiple:!0,className:`MultiSelect ${a.length>0?"":"blank"}`.trim(),trigger:this.renderTrigger(),direction:"right",value:a,scrolling:!1,options:e.filter(i=>!a.includes(i.value)),disabled:s,onChange:this.handleChange,closeOnChange:!0})}}h(Ie,"defaultProps",{disabled:!1});class tt extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{draft:"",value:this.props.value});h(this,"handleChange",e=>{this.setState({draft:e.target.value})});h(this,"handleAdd",()=>{const{onChange:e}=this.props,{draft:s,value:a}=this.state,i=s.trim();if(i!=="")if(a.includes(i))this.setState({draft:""});else{const o=[...a,i];this.setState({value:o,draft:""}),e(o)}});h(this,"handleKeyDown",e=>{if(e.key==="#"){e.preventDefault();return}else if(e.keyCode===js||e.keyCode===we||e.keyCode===Ss)this.handleAdd();else if(e.keyCode===fs||e.keyCode===we){const{draft:s,value:a}=this.state,i=a[a.length-1];i&&s===""&&this.handleRemove(i)}});h(this,"handleRemove",e=>{const{onChange:s}=this.props,a=this.state.value.filter(i=>i!==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(i=>t.jsxs("div",{className:"value",children:[i,t.jsx("div",{className:"remove",onClick:o=>{this.handleRemove(i),o.stopPropagation()}})]},i)),t.jsx("input",{value:s,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onBlur:this.handleAdd,disabled:e})]})})}}h(tt,"defaultProps",{isDisabled:!1});let Ha=class extends x.PureComponent{constructor(){super(...arguments);h(this,"analytics",ve());h(this,"state",this.getInitialState());h(this,"thumbnailInput",x.createRef());h(this,"handleDeleteItem",()=>{const{onDeleteItem:e}=this.props,{selectedItem:s}=this.props;e(s)});h(this,"handleAddRepresentationToItem",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,addRepresentation:!0})});h(this,"handleChangeItemFile",()=>{const{selectedItem:e,onOpenModal:s}=this.props;s("CreateSingleItemModal",{item:e,changeItemFile:!0})});h(this,"handleOpenVideoDialog",(e={})=>{const{selectedItem:s,onOpenModal:a}=this.props;a("EditVideoModal",{item:s,onSaveVideo:this.handleSaveVideo,...e})});h(this,"handleSaveVideo",e=>{this.setState({video:URL.createObjectURL(e),contents:{...this.state.contents,[Te]:e},isDirty:!0})});h(this,"handleChangeName",e=>{this.setState({name:e,isDirty:this.isDirty({name:e})})});h(this,"handleChangeDescription",(e,s)=>{const a=s.value??"";this.setState({description:a,isDirty:this.isDirty({description:a})})});h(this,"handleChangeUtility",(e,s)=>{const a=s.value??"";this.setState({utility:a,isDirty:this.isDirty({utility:a})})});h(this,"handleChangeRarity",e=>{this.setState({rarity:e,isDirty:this.isDirty({rarity:e})})});h(this,"handleAllowVrmExport",(e,{checked:s})=>{const a={...this.state.data,blockVrmExport:!s};this.setState({data:a,isDirty:this.isDirty({data:a})})});h(this,"handleAllowOutlineCompatible",(e,{checked:s})=>{const a={...this.state.data,outlineCompatible:s};this.setState({data:a,isDirty:this.isDirty({data:a})})});h(this,"handleChangeCategory",e=>{let s;re(this.state.data)?s={...this.state.data,category:e}:(s={...this.state.data,category:e},e===_.WearableCategory.SKIN&&(s=this.setReplaces(s,[]),s=this.setHides(s,[]))),this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handlePlayModeChange",e=>{const s={...this.state.data,loop:e===de.LOOP};this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handleChangeReplaces",e=>{const s=this.setReplaces(this.state.data,e);this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handleChangeHides",(e,s)=>{const a=this.state.data.hides;let i=[];s==="wearable"?i=[...a.filter(r=>!_.WearableCategory.schema.enum.includes(r)),...e]:i=[...a.filter(r=>!_.BodyPartCategory.schema.enum.includes(r)),...e];const o=this.setHides(this.state.data,i);this.setState({data:o,isDirty:this.isDirty({data:o})})});h(this,"handleChangeTags",e=>{const s={...this.state.data,tags:e};this.setState({data:s,isDirty:this.isDirty({data:s})})});h(this,"handleOnSaveItem",async()=>{var S,E;const{selectedItem:e,itemStatus:s,onSaveItem:a}=this.props,{name:i,description:o,utility:r,rarity:m,contents:g,data:p,isDirty:I}=this.state;if(I&&e){let b=p;b&&!re(b)&&(b={...b,removesDefaultHiding:b.category===_.WearableCategory.UPPER_BODY||(S=b.hides)!=null&&S.includes(_.WearableCategory.UPPER_BODY)?[_.BodyPartCategory.HANDS]:[],..."blockVrmExport"in b?{blockVrmExport:b.blockVrmExport}:{},..."outlineCompatible"in b?{outlineCompatible:b.outlineCompatible}:{}});const C={...e.contents,...await ws(g)},w={...e,name:i,description:o,rarity:m,data:b,contents:C,utility:r??void 0};s&&[ye.UNPUBLISHED,ye.UNDER_REVIEW].includes(s)&&(w.video=C[Te]),a(w,g),Y(w.urn)&&((E=this.analytics)==null||E.track("Edit Item",{contents:g})),this.setState({isDirty:!1}),this.handleOnResetItem()}});h(this,"handleOnResetItem",()=>{const{selectedItem:e}=this.props;e&&this.setItem(e)});h(this,"handleOpenThumbnailDialog",()=>{const{selectedItem:e,onOpenModal:s}=this.props;(e==null?void 0:e.type)===y.EMOTE?s("EditThumbnailModal",{onSaveThumbnail:this.handleEmoteThumbnailChange,item:e}):this.thumbnailInput.current&&this.thumbnailInput.current.click()});h(this,"handleEmoteThumbnailChange",e=>{const s=Ts(e);this.setState({thumbnail:e,contents:{[Pe]:s},isDirty:!0})});h(this,"handleThumbnailChange",async e=>{const{files:s}=e.target;if(s&&s.length>0){const a=s[0],i=await Ae(a),o=await Ae(a,1024,1024),r=URL.createObjectURL(i);this.setState({thumbnail:r,contents:{[Pe]:o},isDirty:!0})}});h(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;Ce(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&&Ne(s)?!1:a}isSkin(){const{data:e}=this.state;return(e==null?void 0:e.category)===_.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||!Ue(e.data,s.data)}asCategorySelect(e,s){return s.map(a=>({value:a,text:d(`${e}.category.${a}`)}))}asRaritySelect(e){return e.map(s=>({value:s,text:d(`wearable.rarity.${s}`)}))}asPlayModeSelect(e){return e.map(s=>({value:s,text:d(`emote.play_mode.${s}.text`),description:d(`emote.play_mode.${s}.description`)}))}renderOverrides(e){const s=this.canEditItemMetadata(e),a=this.state.data;if(!e||re(a))return null;const i=ys(e.contents,a.category),o=Ps(e.contents),r=a.hides.filter(g=>i.includes(g)),m=a.hides.filter(g=>o.includes(g));return t.jsxs(t.Fragment,{children:[t.jsx(Ie,{itemId:e.id,label:d("item_editor.right_panel.base_body"),info:d("item_editor.right_panel.base_body_info"),value:m,options:this.asCategorySelect(e.type,o),disabled:!s,onChange:g=>this.handleChangeHides(g,"bodypart")}),t.jsx(Ie,{itemId:e.id,label:d("item_editor.right_panel.wearables"),info:d("item_editor.right_panel.wearables_info"),value:r,options:this.asCategorySelect(e.type,r.some(g=>g===_.WearableCategory.BODY_SHAPE)?i:i.filter(g=>g!==_.WearableCategory.BODY_SHAPE)),disabled:!s,onChange:g=>this.handleChangeHides(g,"wearable")})]})}renderModelDetails(e){const{isDownloading:s}=this.props,{thumbnail:a}=this.state,i=this.canEditItemMetadata(e),o=s?t.jsx(c.Loader,{active:!0,size:"tiny",className:"donwload-item-loader"}):t.jsx(O,{name:"export",className:"download-item-button",onClick:this.handleDownloadItem});return t.jsxs("div",{className:"details",children:[i?t.jsxs(t.Fragment,{children:[t.jsx(O,{name:"edit",className:"edit-item-file",onClick:this.handleChangeItemFile}),o,t.jsxs("div",{className:"thumbnail-container",children:[t.jsx(ge,{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(O,{name:"camera",onClick:this.handleOpenThumbnailDialog})]})]})]}):t.jsxs(t.Fragment,{children:[o,t.jsx(ge,{item:e,src:a,hasBadge:!0,badgeSize:"small"})]}),t.jsx(As,{item:e})]})}renderVideoDetails(e){if(!Re(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(O,{name:"edit",className:"edit-item-file",onClick:a}),t.jsx(O,{name:"play",className:"play-video-button",onClick:a}),t.jsx(De,{item:e,src:this.state.video,showMetrics:!0,onClick:a})]}):t.jsxs(t.Fragment,{children:[Ns(e)&&t.jsx(O,{name:"play",className:"play-video-button",onClick:a}),t.jsx(De,{item:e,src:this.state.video,showMetrics:!0})]})})}renderPermissions(e){return t.jsx(Rs,{requiredPermissions:e.data.requiredPermissions})}render(){const{selectedItemId:e,address:s,isWearableUtilityEnabled:a,isConnected:i,error:o,isCampaignEnabled:r,isVrmOptOutEnabled:m,campaignName:g,campaignTag:p}=this.props,{name:I,description:S,utility:E,rarity:b,data:C,isDirty:w,hasItem:f}=this.state,D=_.Rarity.getRarities(),M=Ds();return t.jsx("div",{className:"RightPanel",children:i?t.jsx(Qs,{id:e,children:(u,W,F)=>{var $;const le=W&&Ne(W),A=this.canEditItemMetadata(u),q=u?Ce(u)?Ms(u.contents):Ls():[];return F?t.jsx(c.Loader,{size:"massive",active:!0}):f||!e?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"header",children:[t.jsx("div",{className:"title",children:d("item_editor.right_panel.properties")}),u&&Qe(u,s)&&!u.isPublished&&!le?t.jsx(c.Dropdown,{trigger:t.jsx("div",{className:"actions"}),inline:!0,direction:"left",children:t.jsxs(c.Dropdown.Menu,{children:[pe(u)!==null?t.jsx(c.Dropdown.Item,{text:d("item_detail_page.add_representation",{bodyShape:d(`body_shapes.${pe(u)}`).toLowerCase()}),onClick:this.handleAddRepresentationToItem}):null,t.jsx(Xe,{name:I,onDelete:this.handleDeleteItem,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}),t.jsxs("div",{className:"container",children:[t.jsx(N,{label:d("item_editor.right_panel.details"),children:u?t.jsxs(t.Fragment,{children:[this.renderModelDetails(u),this.renderVideoDetails(u)]}):null}),t.jsx(N,{label:d("item_editor.right_panel.basics"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(Fa,{label:d("global.name"),value:I,disabled:!A,maxLength:Os,onChange:this.handleChangeName}),t.jsx(c.TextAreaField,{maxLength:ks,onChange:this.handleChangeDescription,label:d("global.description"),placeholder:d("item_editor.right_panel.description_placeholder"),disabled:!A,value:S,rows:"2",cols:"12"}),a?t.jsx(c.TextAreaField,{maxLength:Bs,onChange:this.handleChangeUtility,label:d("global.utility"),placeholder:d("item_editor.right_panel.utility_placeholder"),disabled:!A,value:E,tooltip:{content:d("item_editor.right_panel.utility_tooltip")},rows:"2",cols:"12"}):null,t.jsx(ie,{itemId:u.id,label:d("global.category"),value:C.category,options:this.asCategorySelect(u.type,q),disabled:!A,onChange:this.handleChangeCategory}),!(u.urn&&Y(u.urn))&&t.jsx(ie,{itemId:u.id,label:d("global.rarity"),value:b,options:this.asRaritySelect(D),disabled:u.isPublished||!A,onChange:this.handleChangeRarity})]}):null}),(u==null?void 0:u.type)===y.WEARABLE&&t.jsx(N,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.overrides")}),t.jsx(ne,{content:d("item_editor.right_panel.overrides_info"),className:"info"})]}),children:this.renderOverrides(u)}),(u==null?void 0:u.type)===y.EMOTE&&t.jsx(N,{label:d("item_editor.right_panel.animation"),children:u?t.jsx(ie,{itemId:u.id,label:d("create_single_item_modal.play_mode_label"),value:C.loop?de.LOOP:de.SIMPLE,options:this.asPlayModeSelect(M),disabled:!A,onChange:this.handlePlayModeChange}):null}),u&&Re(u)&&(($=u.data.requiredPermissions)!=null&&$.length)?t.jsx(N,{label:d("item_editor.right_panel.required_permissions"),children:this.renderPermissions(u)}):null,t.jsx(N,{label:d("item_editor.right_panel.tags"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(tt,{itemId:u.id,value:C.tags,onChange:this.handleChangeTags,isDisabled:!A}),r&&g&&p&&A&&t.jsx("p",{className:"event-tag",children:d("item_editor.right_panel.event_tag",{event_tag:t.jsx("span",{children:p}),event_name:t.jsx("span",{children:g})})})]}):null}),(u==null?void 0:u.type)===y.WEARABLE&&m&&t.jsx(N,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.copyright.title")}),t.jsx(ne,{content:d("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:d("item_editor.right_panel.copyright.vrm_export")}),t.jsx(c.Checkbox,{toggle:!0,label:C!=null&&C.blockVrmExport?d("item_editor.right_panel.copyright.disabled"):d("item_editor.right_panel.copyright.enabled"),checked:!(C!=null&&C.blockVrmExport),onChange:this.handleAllowVrmExport,"aria-label":d("item_editor.right_panel.copyright.vrm_export")})]})})}),(u==null?void 0:u.type)===y.WEARABLE&&t.jsx(N,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.outline_compatible.title")}),t.jsx(ne,{content:d("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:d("item_editor.right_panel.outline_compatible.title")}),t.jsx(c.Checkbox,{toggle:!0,label:(C==null?void 0:C.outlineCompatible)!==!1?d("item_editor.right_panel.copyright.enabled"):d("item_editor.right_panel.copyright.disabled"),checked:(C==null?void 0:C.outlineCompatible)!==!1,onChange:this.handleAllowOutlineCompatible,"aria-label":d("item_editor.right_panel.outline_compatible.title")})]})})}),w?t.jsxs("div",{className:"edit-buttons",children:[t.jsx(c.Button,{secondary:!0,onClick:this.handleOnResetItem,children:d("global.cancel")}),t.jsx(Me,{primary:!0,onClick:this.handleOnSaveItem,network:_.Network.MATIC,children:d("global.save")})]}):o&&e?t.jsxs("p",{className:"danger-text",children:[d("global.error_ocurred"),": ",o]}):null]})]}):null}}):null})}};const Va=n=>{var r;const l=Ee(n)||"",e=je(n,l),s=te(n)||"",a=l&&e&&e.collectionId?Le(n,e.collectionId):null,i=Ws(n),o=l?i[l]:null;return{address:s,collection:a,selectedItem:e,selectedItemId:l,canEditSelectedItem:e?a?Fe(n,s,a):Qe(e,s):!1,itemStatus:o,error:Fs(n),isConnected:be(n),isDownloading:Hs(n),isCommitteeMember:Oe(n),isCampaignEnabled:Vs(n),campaignTag:Gs(n),campaignName:(r=Zs(n))==null?void 0:r[Ks(n)],isVrmOptOutEnabled:$s(n),isWearableUtilityEnabled:Us(n)}},$a=n=>({onSaveItem:(l,e)=>n(Js(l,e)),onDeleteItem:l=>n(Ve(l)),onOpenModal:(l,e)=>n(He(l,e)),onDownload:l=>n(Ys(l))}),Ua=B(Va,$a)(Ha);class nn extends x.PureComponent{constructor(){super(...arguments);h(this,"state",{reviewedItems:[]});h(this,"handleOnSetReviewedItems",e=>{this.setState(s=>({reviewedItems:[...s.reviewedItems,...e.filter(a=>!s.reviewedItems.some(i=>i.id===a.id))]}))});h(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(ma,{reviewedItems:e}),t.jsxs("div",{className:"content",children:[t.jsx(Da,{reviewedItems:e,onResetReviewedItems:this.handleResetReviewedItems,onSetReviewedItems:this.handleOnSetReviewedItems}),t.jsx(Wa,{}),t.jsx(Ua,{})]})]})})}}export{nn as default};
@@ -1 +1 @@
1
- var S=Object.defineProperty;var L=(n,a,s)=>a in n?S(n,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[a]=s;var r=(n,a,s)=>L(n,typeof a!="symbol"?a+"":a,s);import{aB as b,D as x,de as g,H as e,M as c,G as o,L as m,K as p,bm as j,cf as C,b8 as f,N as P,a_ as R,df as w,cP as k}from"./index-41C5YwXr.js";import{L as v}from"./LandAction-VPDjrQkE.js";import{L as B}from"./LandProviderPage-D8_roYWH.js";import"./Back-By-4R-U1.js";import"./NotFound-CS8G9Pe7.js";const u=b.get("MARKETPLACE_WEB_URL","");class F extends x.PureComponent{constructor(){super(...arguments);r(this,"state",{selectedName:""});r(this,"handleChange",(s,i)=>{const{onFetchENS:l,land:t}=this.props,d=i.value;l(d,t),this.setState({selectedName:d})});r(this,"handleContinue",()=>{const{selectedName:s}=this.state,{onUpdateSubdomain:i,ensList:l}=this.props,t=l.find(d=>d.name===s);i(t.subdomain)})}render(){const{land:s,ensList:i,isLoading:l}=this.props,{selectedName:t}=this.state,d=i.map(({name:_,subdomain:E})=>({value:_,text:E})),h=i.find(_=>_.name===t),N=!h||g(h,s);return e.jsx(c.Form,{className:"LandSelectENSForm",children:!l&&d.length===0?e.jsxs(e.Fragment,{children:[e.jsx(c.Section,{size:"large",children:o("land_select_ens_page.empty_options_message")}),e.jsxs(c.Row,{children:[e.jsx(m,{className:"cancel",to:p.landDetail(s.id),children:e.jsx(c.Button,{children:o("global.cancel")})}),e.jsx(m,{to:`${u}/names/claim`,children:e.jsx(c.Button,{primary:!0,children:o("land_select_ens_page.claim_new_name")})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(c.Section,{size:"large",children:[e.jsxs("div",{className:"select-names",children:[e.jsx(c.Header,{sub:!0,className:"name",children:o("land_select_ens_page.select_name_title")}),e.jsx(c.Dropdown,{value:t,options:d,placeholder:o("land_select_ens_page.select_name_placeholder"),onChange:this.handleChange})]}),e.jsx("div",{className:"select-message",children:h&&g(h,s)?e.jsx("span",{className:"danger-text",children:o("land_select_ens_page.name_assigned")}):e.jsx(j,{id:"land_select_ens_page.click_to_claim_new_name",values:{click_here:e.jsx(m,{to:`${u}/names/claim`,children:o("global.click_here")})}})})]}),e.jsxs(c.Row,{children:[e.jsx(m,{className:"cancel",to:p.landDetail(s.id),children:e.jsx(c.Button,{children:o("global.cancel")})}),e.jsx(C,{type:"submit",disabled:N||l,primary:!0,onClick:this.handleContinue,loading:l,network:f.Network.ETHEREUM,children:o("global.continue")})]})]})})}}let D=class extends x.PureComponent{constructor(){super(...arguments);r(this,"handleUpdateSubdomain",(s,i)=>{const{history:l}=this.props;l.push(p.landAssignENS(s.id,i))})}render(){const{ensList:s,isLoading:i,onFetchENS:l}=this.props;return e.jsx(B,{children:t=>e.jsx(v,{land:t,title:o("land_select_ens_page.title"),subtitle:e.jsx(j,{id:"land_select_ens_page.subtitle",values:{land:e.jsx(m,{to:p.landDetail(t.id),children:t.name})}}),children:e.jsx(F,{land:t,ensList:s,isLoading:i,onUpdateSubdomain:d=>this.handleUpdateSubdomain(t,d),onFetchENS:l})})})}};const U=n=>({ensList:w(n)}),A=n=>({onFetchENS:(a,s)=>n(k(a,s))}),z=P(U,A)(R(D));export{z as default};
1
+ var S=Object.defineProperty;var L=(n,a,s)=>a in n?S(n,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[a]=s;var r=(n,a,s)=>L(n,typeof a!="symbol"?a+"":a,s);import{aB as b,D as x,de as g,H as e,M as c,G as o,L as m,K as p,bm as j,cf as C,b8 as f,N as P,a_ as R,df as w,cP as k}from"./index-DnIS3hck.js";import{L as v}from"./LandAction-Lnm_J4-1.js";import{L as B}from"./LandProviderPage-oH9f8i7v.js";import"./Back-B62mVjOv.js";import"./NotFound-DrUt7rXf.js";const u=b.get("MARKETPLACE_WEB_URL","");class F extends x.PureComponent{constructor(){super(...arguments);r(this,"state",{selectedName:""});r(this,"handleChange",(s,i)=>{const{onFetchENS:l,land:t}=this.props,d=i.value;l(d,t),this.setState({selectedName:d})});r(this,"handleContinue",()=>{const{selectedName:s}=this.state,{onUpdateSubdomain:i,ensList:l}=this.props,t=l.find(d=>d.name===s);i(t.subdomain)})}render(){const{land:s,ensList:i,isLoading:l}=this.props,{selectedName:t}=this.state,d=i.map(({name:_,subdomain:E})=>({value:_,text:E})),h=i.find(_=>_.name===t),N=!h||g(h,s);return e.jsx(c.Form,{className:"LandSelectENSForm",children:!l&&d.length===0?e.jsxs(e.Fragment,{children:[e.jsx(c.Section,{size:"large",children:o("land_select_ens_page.empty_options_message")}),e.jsxs(c.Row,{children:[e.jsx(m,{className:"cancel",to:p.landDetail(s.id),children:e.jsx(c.Button,{children:o("global.cancel")})}),e.jsx(m,{to:`${u}/names/claim`,children:e.jsx(c.Button,{primary:!0,children:o("land_select_ens_page.claim_new_name")})})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(c.Section,{size:"large",children:[e.jsxs("div",{className:"select-names",children:[e.jsx(c.Header,{sub:!0,className:"name",children:o("land_select_ens_page.select_name_title")}),e.jsx(c.Dropdown,{value:t,options:d,placeholder:o("land_select_ens_page.select_name_placeholder"),onChange:this.handleChange})]}),e.jsx("div",{className:"select-message",children:h&&g(h,s)?e.jsx("span",{className:"danger-text",children:o("land_select_ens_page.name_assigned")}):e.jsx(j,{id:"land_select_ens_page.click_to_claim_new_name",values:{click_here:e.jsx(m,{to:`${u}/names/claim`,children:o("global.click_here")})}})})]}),e.jsxs(c.Row,{children:[e.jsx(m,{className:"cancel",to:p.landDetail(s.id),children:e.jsx(c.Button,{children:o("global.cancel")})}),e.jsx(C,{type:"submit",disabled:N||l,primary:!0,onClick:this.handleContinue,loading:l,network:f.Network.ETHEREUM,children:o("global.continue")})]})]})})}}let D=class extends x.PureComponent{constructor(){super(...arguments);r(this,"handleUpdateSubdomain",(s,i)=>{const{history:l}=this.props;l.push(p.landAssignENS(s.id,i))})}render(){const{ensList:s,isLoading:i,onFetchENS:l}=this.props;return e.jsx(B,{children:t=>e.jsx(v,{land:t,title:o("land_select_ens_page.title"),subtitle:e.jsx(j,{id:"land_select_ens_page.subtitle",values:{land:e.jsx(m,{to:p.landDetail(t.id),children:t.name})}}),children:e.jsx(F,{land:t,ensList:s,isLoading:i,onUpdateSubdomain:d=>this.handleUpdateSubdomain(t,d),onFetchENS:l})})})}};const U=n=>({ensList:w(n)}),A=n=>({onFetchENS:(a,s)=>n(k(a,s))}),z=P(U,A)(R(D));export{z as default};
@@ -1 +1 @@
1
- import{H as e,g1 as Ae,g2 as Ge,a1 as V,dC as Re,M as n,N as B,fc as je,Z,e_ as We,G as i,fL as Ue,eS as ee,g3 as He,cD as Oe,X as D,eu as Fe,g4 as ze,fX as qe,bw as Ie,fZ as Ve,eF as Ne,g5 as Ze,f$ as Ye,D as r,K as M,g6 as Qe,g7 as Ke,eP as T,dD as fe,eq as Xe,g8 as Je,bu as ke,L as ye,fd as be,ep as ve,es as _e,g9 as es,ga as ue,gb as ss,gc as ts,gd as ns,ge as as,gf as is,fg as os,gg as ls,gh as we,ev as rs,gi as cs,gj as ds,gk as ge,J as ms,cB as _s,cC as us,fP as gs,eQ as he,eA as pe,fr as hs,aN as ps,e9 as Cs,gl as xs,gm as js,gn as Is,eD as Ns,go as fs,gp as ks,gq as ys,gr as bs,gs as vs,fT as ws}from"./index-41C5YwXr.js";import{g as Ss}from"./selector-CtnQnmhq.js";import{L as Ps}from"./LoggedInDetailPage.container-D9YzD5-u.js";import{C as Ds}from"./CollectionProvider.container-B55XxdNh.js";import{N as Es}from"./NotFound-CS8G9Pe7.js";import{B as Ts}from"./Back-By-4R-U1.js";import{C as Ms,T as $s}from"./ThirdPartyKindBadge-1EbBCupx.js";import{C as se}from"./ConfirmDelete-qdY8nP-O.js";import"./Navigation.container-DNCp40XB.js";import"./selectors-B-FgaFOX.js";import"./SignInRequired-oPiM_HvB.js";const Ls=s=>e.jsx("img",{"data-testid":Ae,src:Ge[s.network],alt:s.network,className:s.className}),Bs="_image_142g7_1",As="_main_142g7_2",Gs="_network_142g7_13",F={image:Bs,main:As,network:Gs},Rs=s=>{const{collection:t,collectionId:o,className:l,shape:c}=s;return e.jsxs("div",{className:V(F.main,l),children:[t!=null&&t.itemCount?e.jsx(Re,{collectionId:o,className:F.image}):e.jsx(n.Blockie,{className:F.image,seed:o,size:8,scale:8,shape:c??"circle"}),t!=null&&t.linkedContractNetwork?e.jsx(Ls,{network:t==null?void 0:t.linkedContractNetwork,className:F.network}):null]})},Ws=(s,t)=>({collection:je(s,t.collectionId)}),Us=B(Ws)(Rs),Hs="_ellipsis_4huv2_1",Ce={ellipsis:Hs},Os=s=>{const{collection:t}=s,o=Z(),l=()=>{t.isPublished&&t.forumLink&&v(t.forumLink,"_blank")},c=()=>{const{items:m,onOpenModal:d}=s;d("SeeInWorldModal",{itemIds:m.map(k=>k.id)})},a=()=>{const{collection:m,items:d}=s;o.push(Ue(m,d),{fromParam:ee.TP_COLLECTIONS})},x=()=>{const{collection:m,onDelete:d}=s;d(m)},p=()=>{const{collection:m,onOpenModal:d}=s;m.isPublished||d("EditCollectionURNModal",{collection:m})},N=()=>{const{collection:m,onOpenModal:d}=s;d("CreateAndEditMultipleItemsModal",{collectionId:m.id,type:He.EDIT})},v=(m,d="")=>{const k=window.open(m,d);k&&k.focus()},f=!We(t)&&!t.isPublished;return e.jsx(n.Dropdown,{className:Ce.dropdown,trigger:e.jsx(n.Button,{basic:!0,children:e.jsx(n.Icon,{className:Ce.ellipsis,size:"large",name:"ellipsis horizontal"})}),inline:!0,direction:"left",children:e.jsxs(n.Dropdown.Menu,{children:[e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.see_in_decentraland"),onClick:c}),e.jsx(n.Dropdown.Item,{text:i("global.open_in_editor"),onClick:a}),e.jsx(n.Popup,{content:i("collection_context_menu.delete_published_collection"),position:"right center",disabled:f,trigger:f?e.jsx(se,{name:t.name,onDelete:x,trigger:e.jsx(n.Dropdown.Item,{text:i("global.delete")})}):e.jsx(n.Dropdown.Item,{text:i("global.delete"),disabled:!0}),hideOnScroll:!0,on:"hover",inverted:!0}),e.jsx(n.Popup,{content:i("collection_context_menu.change_published_urn"),position:"right center",disabled:!t.isPublished,trigger:e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.edit_urn"),onClick:p,disabled:t.isPublished}),hideOnScroll:!0,on:"hover",inverted:!0}),e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.edit_in_bulk"),onClick:N}),e.jsx(n.Popup,{content:i("collection_context_menu.unpublished"),position:"right center",disabled:t.isPublished||!!t.forumLink,trigger:e.jsx(n.Dropdown.Item,{disabled:!t.isPublished||!t.forumLink,text:i("collection_context_menu.forum_post"),onClick:l}),hideOnScroll:!0,on:"hover",inverted:!0})]})})},Fs=Os,zs=s=>({name:Oe(s)||""}),qs=s=>({onOpenModal:(t,o)=>s(D(t,o)),onDelete:t=>s(Fe(t))}),Vs=B(zs,qs)(Fs),Zs=(s,t)=>{const{collection:o,items:l}=t;return{itemCurations:qe(s,o.id),isLoadingItemCurations:Ie(Ve(s),Ye),isLinkedWearablesPaymentsEnabled:Ne(s),itemsStatus:Ze(s,l.map(c=>c.id))}},Ys=s=>({onNewClick:(t,o,l)=>s(D("PublishWizardCollectionModal",{collectionId:t,itemsWithChanges:o,itemsToPublish:l})),onPushChangesClick:(t,o)=>s(D("PushChangesModal",{collectionId:t,itemsWithChanges:o})),onClick:(t,o,l)=>s(D("PublishThirdPartyCollectionModal",{collectionId:t,itemIds:o,action:l}))}),Qs=B(Zs,Ys)(ze),Ks="_itemImage_1y9df_1",Xs="_itemStatus_1y9df_10",Js="_grid_1y9df_14",et="_row_1y9df_25",st="_column_1y9df_30",tt="_statusColumn_1y9df_34",nt="_synced_1y9df_39",at="_unsynced_1y9df_43",it="_avatarColumn_1y9df_47",ot="_nameWrapper_1y9df_52",lt="_name_1y9df_52",rt="_itemActions_1y9df_65",ct="_action_1y9df_72",C={itemImage:Ks,itemStatus:Xs,grid:Js,row:et,column:st,statusColumn:tt,synced:nt,unsynced:at,avatarColumn:it,nameWrapper:ot,name:lt,itemActions:rt,action:ct};function dt({item:s,status:t,selected:o,onSelect:l,onOpenModal:c,onDelete:a}){const x=Z(),p=r.useCallback((h,P)=>{l(s,P.checked)},[s,l]),N=r.useCallback(()=>{c("SeeInWorldModal",{itemIds:[s.id]})},[s,c]),v=r.useCallback(()=>{s.isPublished||c("EditItemURNModal",{item:s})},[s,c]),f=r.useCallback(()=>{x.push(M.itemEditor({itemId:s.id,collectionId:s.collectionId}),{fromParam:ee.TP_COLLECTIONS})},[s,x]),m=r.useCallback(()=>{a(s)},[a,s]),d=r.useMemo(()=>{if(!s.urn)return"";try{const h=Qe(s.urn);return Ke(h)?h.thirdPartyTokenId??"":""}catch{return""}},[s]),k=r.useMemo(()=>{switch(t){case T.UNDER_REVIEW:return e.jsx(n.Icon,{name:"clock outline"});case T.SYNCED:return e.jsx(n.Icon,{name:"check circle outline"});case T.UNSYNCED:return e.jsx(n.Icon,{name:"exclamation circle"});default:return null}},[t]),y=s.data;return e.jsx(n.Grid,{className:`CollectionItem ${C.grid}`,columns:"equal",children:e.jsxs(n.Grid.Row,{className:C.row,children:[e.jsxs(n.Grid.Column,{className:`${C.column} ${C.avatarColumn}`,width:5,children:[e.jsx(n.Checkbox,{checked:o,disabled:s.isPublished,onClick:p}),e.jsx(fe,{className:C.itemImage,item:s,hasBadge:!0,badgeSize:"small"}),e.jsx("div",{className:C.nameWrapper,children:e.jsxs("div",{className:C.name,title:s.name,children:[e.jsx(Xe,{className:C.itemStatus,item:s}),s.name]})})]}),e.jsx(n.Grid.Column,{className:C.column,children:y.category?e.jsx("div",{children:i(`wearable.category.${y.category}`)}):null}),e.jsx(n.Grid.Column,{className:C.column,children:e.jsx("div",{children:i(`body_shapes.${Je(s)}`)})}),e.jsx(n.Grid.Column,{className:C.column,children:e.jsx("div",{children:d})}),e.jsxs(n.Grid.Column,{width:3,className:`${C.column} ${C.statusColumn} ${C[t]}`,children:[k,e.jsx("div",{children:i(`third_party_collection_detail_page.synced_statuses.${t}`)})]}),e.jsx(n.Grid.Column,{width:1,className:C.column,children:e.jsx("div",{className:C.itemActions,children:e.jsx(n.Dropdown,{trigger:e.jsx(n.Button,{basic:!0,children:e.jsx(n.Icon,{name:"ellipsis horizontal"})}),inline:!0,direction:"left",className:C.action,onClick:ke(),children:e.jsxs(n.Dropdown.Menu,{children:[e.jsx(n.Dropdown.Item,{text:i("collection_item.see_details"),as:ye,to:M.itemDetail(s.id)}),e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.see_in_decentraland"),onClick:N}),e.jsx(n.Dropdown.Item,{text:i("global.open_in_editor"),onClick:f}),e.jsx(n.Popup,{content:i("collection_item.cannot_edit_urn"),position:"right center",disabled:!s.isPublished,trigger:e.jsx(n.Dropdown.Item,{text:i("collection_item.edit_urn"),onClick:v,disabled:s.isPublished}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0}),!s.isPublished&&e.jsx(se,{name:s.name,onDelete:m,trigger:e.jsx(n.Dropdown.Item,{text:i("global.delete")})})]})})})})]})})}const mt=(s,t)=>({status:be(s)[t.item.id]}),_t=s=>({onDelete:t=>s(ve(t)),onOpenModal:(t,o)=>s(D(t,o))}),ut=B(mt,_t)(dt),gt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_8524_427)'%3e%3cpath%20d='M20.5%203L20.34%203.03L15%205.1L9%203L3.36%204.9C3.15%204.97%203%205.15%203%205.38V20.5C3%2020.78%203.22%2021%203.5%2021L3.66%2020.97L9%2018.9L15%2021L20.64%2019.1C20.85%2019.03%2021%2018.85%2021%2018.62V3.5C21%203.22%2020.78%203%2020.5%203ZM15%2019L9%2016.89V5L15%207.11V19Z'%20fill='%23A09BA8'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_8524_427'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.669%200H1.33362C0.593463%200%200%200.600131%200%201.33362V10.669C0%2011.4025%200.593463%2012.0026%201.33362%2012.0026H10.669C11.4025%2012.0026%2012.0026%2011.4025%2012.0026%2010.669V1.33362C12.0026%200.600131%2011.4092%200%2010.669%200ZM10.669%2010.669H1.33362V2.66725H10.669V10.669ZM7.00152%206.66812C7.00152%207.22157%206.55476%207.66834%206.00131%207.66834C5.44785%207.66834%205.00109%207.22157%205.00109%206.66812C5.00109%206.11466%205.44785%205.6679%206.00131%205.6679C6.55476%205.6679%207.00152%206.11466%207.00152%206.66812ZM6.00131%204.00087C4.18091%204.00087%202.62724%205.10778%202.00044%206.66812C2.62724%208.22846%204.18091%209.33537%206.00131%209.33537C7.8217%209.33537%209.37537%208.22846%2010.0022%206.66812C9.37537%205.10778%207.8217%204.00087%206.00131%204.00087ZM6.00131%208.33515C5.08111%208.33515%204.33428%207.58832%204.33428%206.66812C4.33428%205.74792%205.08111%205.00109%206.00131%205.00109C6.92151%205.00109%207.66834%205.74792%207.66834%206.66812C7.66834%207.58832%206.92151%208.33515%206.00131%208.33515Z'%20fill='%23ECEBED'/%3e%3c/svg%3e",pt="_status_rgxu1_1",Ct="_pending_migration_rgxu1_14",xt="_synced_rgxu1_19",jt="_unpublished_rgxu1_24",It="_unsynced_rgxu1_25",Nt="_pending_mapping_rgxu1_30",ft="_under_review_rgxu1_31",kt="_icon_rgxu1_10",z={status:pt,pending_migration:Ct,synced:xt,unpublished:jt,unsynced:It,pending_mapping:Nt,under_review:ft,icon:kt},yt=s=>{const{status:t,item:o}=s,l=!o.mappings&&_e(o.urn),c=!o.isMappingComplete&&_e(o.urn),a=r.useMemo(()=>{if(l)return e.jsx("img",{src:gt,className:z.icon});if(c)return e.jsx(n.Icon,{name:"warning circle"});switch(t){case T.UNDER_REVIEW:return e.jsx("img",{src:ht,className:z.icon});case T.SYNCED:return e.jsx(n.Icon,{name:"check circle"});case T.UNSYNCED:case T.UNPUBLISHED:return e.jsx(n.Icon,{name:"cloud upload"})}},[t,l,c]),x=r.useMemo(()=>l?i("item_status.pending_mapping"):c?i("item_status.pending_migration"):i(`item_status.${t}`),[t,l,c]),p=r.useMemo(()=>l?"pending_mapping":c?"pending_migration":t,[t,l,c]);return e.jsxs("div",{className:V(z[p],z.status),children:[a," ",x]})},bt="_itemImage_1rili_1",vt="_itemStatus_1rili_10",wt="_grid_1rili_14",St="_loading_1rili_21",Pt="_row_1rili_26",Dt="_column_1rili_31",Et="_avatarColumn_1rili_35",Tt="_nameWrapper_1rili_40",Mt="_name_1rili_40",$t="_itemActions_1rili_53",Lt="_action_1rili_60",Bt="_overlay_1rili_65",I={itemImage:bt,itemStatus:vt,grid:wt,loading:St,row:Pt,column:Dt,avatarColumn:Et,nameWrapper:Tt,name:Mt,itemActions:$t,action:Lt,overlay:Bt};function At({item:s,status:t,selected:o,loading:l,collection:c,onSaveItem:a,onSelect:x,onOpenModal:p,onDelete:N}){const v=Z(),f=r.useMemo(()=>es(s),[s]),m=r.useMemo(()=>c.linkedContractAddress&&c.linkedContractNetwork?{address:c.linkedContractAddress,network:c.linkedContractNetwork}:null,[c]),[d,k]=r.useState(f),y=r.useMemo(()=>{if(d&&m){const S=ue(d,m);return ss(S)?void 0:"Invalid mapping"}},[d,m]);r.useEffect(()=>{!m||y||(!f&&d||f&&d&&!ts(f,d))&&h(d,m)},[f,y,d,m]);const h=r.useCallback(ns((S,E)=>{const $=ue(S,E);a({...s,mappings:$})},1e3),[a]),P=r.useCallback((S,E)=>{l||x(s,E.checked)},[s,l,x]),w=r.useCallback(()=>{p("SeeInWorldModal",{itemIds:[s.id]})},[s,p]),H=r.useCallback(()=>{s.isPublished||p("EditItemURNModal",{item:s})},[s,p]),Y=r.useCallback(()=>{v.push(M.itemEditor({itemId:s.id,collectionId:s.collectionId}),{fromParam:ee.TP_COLLECTIONS})},[s,v]),A=r.useCallback(()=>{N(s)},[N,s]);return e.jsxs(n.Grid,{className:V(I.grid,l&&I.loading),columns:"equal",children:[l&&e.jsx("div",{className:I.overlay,children:e.jsx(n.Loader,{size:"large",active:!0})}),e.jsxs(n.Grid.Row,{className:I.row,children:[e.jsxs(n.Grid.Column,{className:`${I.column} ${I.avatarColumn}`,width:4,children:[e.jsx(n.Checkbox,{checked:o,disabled:s.isPublished||l,onClick:P}),e.jsx(fe,{className:I.itemImage,item:s,hasBadge:!0,badgeSize:"small"}),e.jsx("div",{className:I.nameWrapper,children:e.jsx("div",{className:I.name,title:s.name,children:s.name})})]}),e.jsx(n.Grid.Column,{children:m&&e.jsx(as,{disabled:l,mapping:d,error:y,onChange:k,isCompact:!0})}),e.jsx(n.Grid.Column,{width:3,className:V(I.column,I.statusColumn),children:e.jsx(yt,{status:t,item:s})}),e.jsx(n.Grid.Column,{width:1,className:I.column,children:e.jsx("div",{className:I.itemActions,children:e.jsx(n.Dropdown,{trigger:e.jsx(n.Button,{basic:!0,children:e.jsx(n.Icon,{name:"ellipsis horizontal"})}),inline:!0,direction:"left",className:I.action,disabled:l,onClick:ke(),children:e.jsxs(n.Dropdown.Menu,{children:[e.jsx(n.Dropdown.Item,{text:i("collection_item.see_details"),as:ye,to:M.itemDetail(s.id)}),e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.see_in_decentraland"),onClick:w}),e.jsx(n.Dropdown.Item,{text:i("global.open_in_editor"),onClick:Y}),e.jsx(n.Popup,{content:i("collection_item.cannot_edit_urn"),position:"right center",disabled:!s.isPublished,trigger:e.jsx(n.Dropdown.Item,{text:i("collection_item.edit_urn"),onClick:H,disabled:s.isPublished}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0}),!s.isPublished&&e.jsx(se,{name:s.name,onDelete:A,trigger:e.jsx(n.Dropdown.Item,{text:i("global.delete")})})]})})})})]})]})}const Gt=(s,t)=>{const o=be(s);return{loading:!!is(s)[t.item.id],status:o[t.item.id]}},Rt=s=>({onDelete:t=>s(ve(t)),onSaveItem:t=>s(os(t,{},{onlySaveItem:!0})),onOpenModal:(t,o)=>s(D(t,o))}),Wt=B(Gt,Rt)(At),L=50,Ut="_itemCheckbox_2k9qa_1",Ht="_gridHeader_2k9qa_5",Ot="_itemColumn_2k9qa_15",J={itemCheckbox:Ut,gridHeader:Ht,itemColumn:Ot},Ft=({areAllSelected:s,onSelectedAllClick:t})=>e.jsx(n.Grid,{columns:"equal",className:J.gridHeader,children:e.jsxs(n.Grid.Row,{children:[e.jsxs(n.Grid.Column,{width:5,className:J.itemColumn,children:[e.jsx(n.Checkbox,{className:J.itemCheckbox,checked:s,onClick:t})," ",i("global.item")]}),e.jsx(n.Grid.Column,{children:i("global.category")}),e.jsx(n.Grid.Column,{children:i("global.body_shape")}),e.jsx(n.Grid.Column,{children:"URN ID"}),e.jsxs(n.Grid.Column,{width:3,children:[" ",i("collection_row.status")," "]}),e.jsx(n.Grid.Column,{width:1})]})}),zt="_gridHeader_4acv6_1",qt="_itemColumn_4acv6_11",Vt="_itemCheckbox_4acv6_16",Zt="_linkedToColumn_4acv6_20",q={gridHeader:zt,itemColumn:qt,itemCheckbox:Vt,linkedToColumn:Zt},Yt=({areAllSelected:s,onSelectedAllClick:t})=>e.jsx(n.Grid,{columns:"equal",className:q.gridHeader,children:e.jsxs(n.Grid.Row,{children:[e.jsxs(n.Grid.Column,{width:4,className:q.itemColumn,children:[e.jsx(n.Checkbox,{className:q.itemCheckbox,checked:s,onClick:t})," ",i("global.item")]}),e.jsxs(n.Grid.Column,{className:q.linkedToColumn,children:[e.jsx("span",{children:i("third_party_collection_detail_page.linked_to")}),e.jsx(ls,{})]}),e.jsxs(n.Grid.Column,{width:3,children:[" ",i("collection_row.status")," "]}),e.jsx(n.Grid.Column,{width:1})]})}),Qt="_main_16i8r_3",Kt="_slots_16i8r_11",Xt="_empty_16i8r_28",Jt="_searchContainer_16i8r_32",en="_searchInfo_16i8r_42",sn="_syncedStatusList_16i8r_46",tn="_selectionInfo_16i8r_53",nn="_header_16i8r_63",an="_content_16i8r_74",on="_title_16i8r_83",ln="_editCollectionName_16i8r_96",rn="_name_16i8r_101",cn="_nameAndType_16i8r_105",dn="_nameWrapper_16i8r_115",mn="_size_16i8r_139",_n="_actions_16i8r_143",un="_body_16i8r_151",gn="_info_16i8r_162",hn="_infoHeader_16i8r_170",pn="_infoContent_16i8r_178",Cn="_slotsIcon_16i8r_195",xn="_copyButton_16i8r_207",jn="_sparkles_16i8r_232",In="_start_16i8r_241",Nn="_migrationBanner_16i8r_254",fn="_type_16i8r_277",kn="_linkedWearableBadge_16i8r_283",yn="_typeBadge_16i8r_288",bn="_programmaticBadge_16i8r_292",vn="_standardBadge_16i8r_296",wn="_loader_16i8r_302",_={main:Qt,slots:Kt,empty:Xt,searchContainer:Jt,searchInfo:en,syncedStatusList:sn,selectionInfo:tn,header:nn,content:an,title:on,editCollectionName:ln,name:rn,nameAndType:cn,nameWrapper:dn,size:mn,actions:_n,body:un,info:gn,infoHeader:hn,infoContent:pn,slotsIcon:Cn,copyButton:xn,sparkles:jn,start:In,migrationBanner:Nn,type:fn,linkedWearableBadge:kn,typeBadge:yn,programmaticBadge:bn,standardBadge:vn,loader:wn},xe=({children:s,title:t,info:o})=>e.jsxs("div",{className:_.info,children:[e.jsxs("div",{className:_.infoHeader,children:[t," ",o&&e.jsx(n.InfoTooltip,{content:o})]}),e.jsx("div",{className:_.infoContent,children:s})]});function Sn({currentPage:s,lastLocation:t,wallet:o,thirdParty:l,items:c,collection:a,totalItems:x,isLoading:p,isThirdPartyV2Enabled:N,isLinkedWearablesPaymentsEnabled:v,onFetchAvailableSlots:f,onFetchThirdParty:m,onNewItem:d,onEditName:k,isLoadingAvailableSlots:y}){const[h,P]=r.useState({}),[w,H]=r.useState(s),[Y,A]=r.useState(!1),[S,E]=r.useState(!1),[$,te]=r.useState("ALL"),G=Z(),ne=t===M.collections();r.useEffect(()=>{l&&l.availableSlots===void 0&&!y&&f(l.id)},[l,y,f]),r.useEffect(()=>{!p&&!l&&(a!=null&&a.urn)&&m(we(a.urn))},[a==null?void 0:a.urn,p,l]),r.useEffect(()=>{if(s!==w&&H(s),S){const u=c.reduce((g,j)=>(g[j.id]=!0,g),{});P(u),A(!1)}},[w,S,c,l,s]);const Se=r.useCallback(()=>{a!=null&&a.id&&d(a.id)},[a==null?void 0:a.id,d]),Pe=r.useCallback(()=>{a&&k(a)},[a,k]),De=r.useCallback(()=>{ne?G.goBack():G.push(M.collections(rs.THIRD_PARTY))},[G,ne]),Ee=r.useCallback((u,g)=>{H(+g.activePage),G.push(M.thirdPartyCollectionDetail(a.id,{page:+g.activePage}))},[a,G]),Q=r.useCallback((u,g)=>{P({...h,[u.id]:g}),E(!1),A(!1)},[h]),R=r.useCallback(u=>u.every(g=>h[g.id]),[h]),ae=r.useCallback((u,g)=>{const j={...h},W=!R(u);for(const U of u)j[U.id]=W;P(j),A(!0),E(S&&!!g.checked)},[h,S,R]),ie=r.useCallback(()=>{P({})},[]),oe=r.useMemo(()=>a&&l&&o&&cs(o.address,l),[a,l,o]),Te=r.useCallback(u=>{if(E(!0),a){const g=Math.ceil(x/L);u(a.id,{page:ds(g),limit:L,overridePaginationData:!1})}},[x]),le=r.useCallback((u,{value:g})=>{te(g)},[te]),Me=[{value:"ALL",text:i("third_party_collection_detail_page.synced_filter.all")},{value:"SYNCED",text:i("item_status.synced")},{value:"UNSYNCED",text:i("item_status.unsynced")},...a!=null&&a.isMappingComplete?[]:[{value:"MIGRATION_REQUIRED",text:i("item_status.pending_migration")},{value:"MAPPING_PENDING",text:i("item_status.pending_mapping")}]],$e=r.useMemo(()=>{switch($){case"SYNCED":return{synced:!0};case"UNSYNCED":return{synced:!1};case"MIGRATION_REQUIRED":return{mappingStatus:ge.UNPUBLISHED_MAPPING};case"MAPPING_PENDING":return{mappingStatus:ge.MISSING_MAPPING};default:return{}}},[$]),Le=r.useCallback((u,g,j,W,U)=>{const re=g.filter(b=>h[b.id]),ce=re.length,de=!!(a!=null&&a.linkedContractAddress&&(a!=null&&a.linkedContractNetwork)),O=x,K=Math.ceil(O/L),me=(a==null?void 0:a.itemCount)===0;return a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:_.header,children:[e.jsx(Ts,{absolute:!0,onClick:De}),e.jsxs("div",{className:_.content,children:[e.jsxs("div",{className:_.title,children:[e.jsx(Us,{collectionId:a.id}),e.jsxs("div",{className:_.nameAndType,children:[e.jsxs("div",{className:_.nameWrapper,children:[e.jsx(n.Header,{size:"large",className:_.name,onClick:Pe,children:a.name}),!a.isPublished&&e.jsx(ms,{name:"edit",className:_.editCollectionName})]}),e.jsxs("div",{className:_.type,children:[e.jsx(Ms,{isThirdParty:!0}),e.jsx($s,{isProgrammatic:u.isProgrammatic})]})]})]}),e.jsxs("div",{className:_.actions,children:[a.linkedContractAddress&&a.linkedContractNetwork&&e.jsxs(xe,{title:i("third_party_collection_detail_page.smart_contract_address_short"),info:i("third_party_collection_detail_page.smart_contract_address_long"),children:[_s(a.linkedContractAddress)," ",e.jsx(us,{className:_.copyButton,showPopup:!0,text:a.linkedContractAddress,role:"button",children:e.jsx(n.Icon,{name:"copy outline"})})]}),!v&&e.jsxs(xe,{title:i("third_party_collection_detail_page.slots_short"),info:i("third_party_collection_detail_page.slots_long"),children:[e.jsx("div",{className:_.slotsIcon}),y?e.jsx(n.Loader,{active:!0,inline:!0,size:"tiny"}):e.jsxs("span",{children:[u.availableSlots??0," / ",u.maxItems]})]}),e.jsxs(n.Button,{inverted:!0,onClick:Se,children:[e.jsx(n.Icon,{name:"plus"}),i("third_party_collection_detail_page.new_items")]}),u.availableSlots!==void 0?e.jsx(Qs,{collection:a,items:re,slots:u.availableSlots}):null,e.jsx(Vs,{collection:a,items:j})]})]})]}),!a.isMappingComplete&&e.jsxs("div",{className:_.migrationBanner,children:[e.jsx(n.Icon,{name:"sync"})," ",i("third_party_collection_detail_page.migration_banner")]}),e.jsx("div",{className:_.body,children:W?e.jsx("div",{className:_.loader,children:e.jsx(n.Loader,{size:"massive",inline:!0,active:!0})}):e.jsxs(e.Fragment,{children:[(a.itemCount??0)>0&&e.jsxs("div",{className:_.searchContainer,children:[j.length>0&&e.jsx("div",{className:_.searchInfo,children:i("third_party_collection_detail_page.search_info",{page:(w-1)*L+1,pageTotal:Math.min(O,w*L),total:O})}),e.jsx(n.Dropdown,{className:_.syncedStatusList,direction:"left",value:$,options:Me,onChange:le})]}),j.length?e.jsxs(e.Fragment,{children:[ce>0?e.jsxs("div",{className:_.selectionInfo,children:[i("third_party_collection_detail_page.selection",{count:ce})," ",e.jsx("span",{className:"link",onClick:ie,children:i("third_party_collection_detail_page.clear_selection")}),".  ",Y&&K>1?e.jsx("span",{className:"link",onClick:()=>Te(U),children:i("third_party_collection_detail_page.select_all",{total:O})}):null," "]}):null,e.jsxs("div",{children:[N&&de?e.jsx(Yt,{areAllSelected:R(j),onSelectedAllClick:(b,X)=>ae(j,X)}):e.jsx(Ft,{areAllSelected:R(j),onSelectedAllClick:(b,X)=>ae(j,X)}),j.map(b=>N&&de?e.jsx(Wt,{collection:a,item:b,selected:!!h[b.id],onSelect:Q},b.id):e.jsx(ut,{collection:a,item:b,selected:!!h[b.id],onSelect:Q},b.id)),K>1?e.jsx(n.Pagination,{firstItem:null,lastItem:null,totalPages:K,activePage:w,onPageChange:Ee}):null]})]}):e.jsxs("div",{className:_.empty,children:[e.jsx("div",{className:me?_.start:_.sparkles}),me?e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:i("third_party_collection_detail_page.start_adding_items")}),e.jsx("p",{children:i("third_party_collection_detail_page.cant_remove")})]}):e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:i("third_party_collection_detail_page.not_found")}),e.jsx("p",{children:i("third_party_collection_detail_page.try_again")})]})]})]})})]}):(console.error("No collection defined"),null)},[a,h,y,v,N,x,w,Q,R,le,ie,$]),Be=oe&&a;return e.jsx(Ds,{id:a==null?void 0:a.id,itemsPage:w,itemsPageSize:L,fetchCollectionItemsOptions:$e,children:({isLoadingCollection:u,isLoadingCollectionItems:g,items:j,paginatedItems:W,onFetchCollectionItemsPages:U})=>e.jsx(Ps,{className:_.main,hasNavigation:!oe&&!p&&!u,isLoading:p||u,children:Be&&l?Le(l,j,W,g,U):e.jsx(Es,{})})})}const Pn=s=>{var N;const t=gs(s)||"",o=je(s,t),l=o?he(o):!1,c=((N=pe(s,t))==null?void 0:N.total)||null,a=o?hs(s,o.id):[],x=o&&pe(s,o.id)||null,p=Number(ps(s).query.page??1);return{items:a,totalItems:c,currentPage:p,paginatedData:x,wallet:Cs(s),collection:o,isThirdPartyV2Enabled:xs(s),isLinkedWearablesPaymentsEnabled:Ne(s),thirdParty:o&&he(o)?js(s,o):null,authorizations:Is(s),isLoading:Ie(Ns(s),ws)||fs(s)||!!(l&&o&&ks(s,we(o.urn))),isLoadingAvailableSlots:ys(s),lastLocation:Ss(s)}},Dn=s=>({onNewItem:t=>s(D("CreateItemsModal",{collectionId:t})),onEditName:t=>s(D("EditCollectionNameModal",{collection:t})),onFetchAvailableSlots:t=>s(bs(t)),onFetchThirdParty:t=>s(vs(t))}),Hn=B(Pn,Dn)(Sn);export{Hn as default};
1
+ import{H as e,g1 as Ae,g2 as Ge,a1 as V,dC as Re,M as n,N as B,fc as je,Z,e_ as We,G as i,fL as Ue,eS as ee,g3 as He,cD as Oe,X as D,eu as Fe,g4 as ze,fX as qe,bw as Ie,fZ as Ve,eF as Ne,g5 as Ze,f$ as Ye,D as r,K as M,g6 as Qe,g7 as Ke,eP as T,dD as fe,eq as Xe,g8 as Je,bu as ke,L as ye,fd as be,ep as ve,es as _e,g9 as es,ga as ue,gb as ss,gc as ts,gd as ns,ge as as,gf as is,fg as os,gg as ls,gh as we,ev as rs,gi as cs,gj as ds,gk as ge,J as ms,cB as _s,cC as us,fP as gs,eQ as he,eA as pe,fr as hs,aN as ps,e9 as Cs,gl as xs,gm as js,gn as Is,eD as Ns,go as fs,gp as ks,gq as ys,gr as bs,gs as vs,fT as ws}from"./index-DnIS3hck.js";import{g as Ss}from"./selector-CtnQnmhq.js";import{L as Ps}from"./LoggedInDetailPage.container-CgMIisR0.js";import{C as Ds}from"./CollectionProvider.container-FTdRZ8FI.js";import{N as Es}from"./NotFound-DrUt7rXf.js";import{B as Ts}from"./Back-B62mVjOv.js";import{C as Ms,T as $s}from"./ThirdPartyKindBadge-cFEUgKTo.js";import{C as se}from"./ConfirmDelete-BLQNvkka.js";import"./Navigation.container-CJ8N4u9A.js";import"./selectors-Du6lRm3_.js";import"./SignInRequired-Co3AdME1.js";const Ls=s=>e.jsx("img",{"data-testid":Ae,src:Ge[s.network],alt:s.network,className:s.className}),Bs="_image_142g7_1",As="_main_142g7_2",Gs="_network_142g7_13",F={image:Bs,main:As,network:Gs},Rs=s=>{const{collection:t,collectionId:o,className:l,shape:c}=s;return e.jsxs("div",{className:V(F.main,l),children:[t!=null&&t.itemCount?e.jsx(Re,{collectionId:o,className:F.image}):e.jsx(n.Blockie,{className:F.image,seed:o,size:8,scale:8,shape:c??"circle"}),t!=null&&t.linkedContractNetwork?e.jsx(Ls,{network:t==null?void 0:t.linkedContractNetwork,className:F.network}):null]})},Ws=(s,t)=>({collection:je(s,t.collectionId)}),Us=B(Ws)(Rs),Hs="_ellipsis_4huv2_1",Ce={ellipsis:Hs},Os=s=>{const{collection:t}=s,o=Z(),l=()=>{t.isPublished&&t.forumLink&&v(t.forumLink,"_blank")},c=()=>{const{items:m,onOpenModal:d}=s;d("SeeInWorldModal",{itemIds:m.map(k=>k.id)})},a=()=>{const{collection:m,items:d}=s;o.push(Ue(m,d),{fromParam:ee.TP_COLLECTIONS})},x=()=>{const{collection:m,onDelete:d}=s;d(m)},p=()=>{const{collection:m,onOpenModal:d}=s;m.isPublished||d("EditCollectionURNModal",{collection:m})},N=()=>{const{collection:m,onOpenModal:d}=s;d("CreateAndEditMultipleItemsModal",{collectionId:m.id,type:He.EDIT})},v=(m,d="")=>{const k=window.open(m,d);k&&k.focus()},f=!We(t)&&!t.isPublished;return e.jsx(n.Dropdown,{className:Ce.dropdown,trigger:e.jsx(n.Button,{basic:!0,children:e.jsx(n.Icon,{className:Ce.ellipsis,size:"large",name:"ellipsis horizontal"})}),inline:!0,direction:"left",children:e.jsxs(n.Dropdown.Menu,{children:[e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.see_in_decentraland"),onClick:c}),e.jsx(n.Dropdown.Item,{text:i("global.open_in_editor"),onClick:a}),e.jsx(n.Popup,{content:i("collection_context_menu.delete_published_collection"),position:"right center",disabled:f,trigger:f?e.jsx(se,{name:t.name,onDelete:x,trigger:e.jsx(n.Dropdown.Item,{text:i("global.delete")})}):e.jsx(n.Dropdown.Item,{text:i("global.delete"),disabled:!0}),hideOnScroll:!0,on:"hover",inverted:!0}),e.jsx(n.Popup,{content:i("collection_context_menu.change_published_urn"),position:"right center",disabled:!t.isPublished,trigger:e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.edit_urn"),onClick:p,disabled:t.isPublished}),hideOnScroll:!0,on:"hover",inverted:!0}),e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.edit_in_bulk"),onClick:N}),e.jsx(n.Popup,{content:i("collection_context_menu.unpublished"),position:"right center",disabled:t.isPublished||!!t.forumLink,trigger:e.jsx(n.Dropdown.Item,{disabled:!t.isPublished||!t.forumLink,text:i("collection_context_menu.forum_post"),onClick:l}),hideOnScroll:!0,on:"hover",inverted:!0})]})})},Fs=Os,zs=s=>({name:Oe(s)||""}),qs=s=>({onOpenModal:(t,o)=>s(D(t,o)),onDelete:t=>s(Fe(t))}),Vs=B(zs,qs)(Fs),Zs=(s,t)=>{const{collection:o,items:l}=t;return{itemCurations:qe(s,o.id),isLoadingItemCurations:Ie(Ve(s),Ye),isLinkedWearablesPaymentsEnabled:Ne(s),itemsStatus:Ze(s,l.map(c=>c.id))}},Ys=s=>({onNewClick:(t,o,l)=>s(D("PublishWizardCollectionModal",{collectionId:t,itemsWithChanges:o,itemsToPublish:l})),onPushChangesClick:(t,o)=>s(D("PushChangesModal",{collectionId:t,itemsWithChanges:o})),onClick:(t,o,l)=>s(D("PublishThirdPartyCollectionModal",{collectionId:t,itemIds:o,action:l}))}),Qs=B(Zs,Ys)(ze),Ks="_itemImage_1y9df_1",Xs="_itemStatus_1y9df_10",Js="_grid_1y9df_14",et="_row_1y9df_25",st="_column_1y9df_30",tt="_statusColumn_1y9df_34",nt="_synced_1y9df_39",at="_unsynced_1y9df_43",it="_avatarColumn_1y9df_47",ot="_nameWrapper_1y9df_52",lt="_name_1y9df_52",rt="_itemActions_1y9df_65",ct="_action_1y9df_72",C={itemImage:Ks,itemStatus:Xs,grid:Js,row:et,column:st,statusColumn:tt,synced:nt,unsynced:at,avatarColumn:it,nameWrapper:ot,name:lt,itemActions:rt,action:ct};function dt({item:s,status:t,selected:o,onSelect:l,onOpenModal:c,onDelete:a}){const x=Z(),p=r.useCallback((h,P)=>{l(s,P.checked)},[s,l]),N=r.useCallback(()=>{c("SeeInWorldModal",{itemIds:[s.id]})},[s,c]),v=r.useCallback(()=>{s.isPublished||c("EditItemURNModal",{item:s})},[s,c]),f=r.useCallback(()=>{x.push(M.itemEditor({itemId:s.id,collectionId:s.collectionId}),{fromParam:ee.TP_COLLECTIONS})},[s,x]),m=r.useCallback(()=>{a(s)},[a,s]),d=r.useMemo(()=>{if(!s.urn)return"";try{const h=Qe(s.urn);return Ke(h)?h.thirdPartyTokenId??"":""}catch{return""}},[s]),k=r.useMemo(()=>{switch(t){case T.UNDER_REVIEW:return e.jsx(n.Icon,{name:"clock outline"});case T.SYNCED:return e.jsx(n.Icon,{name:"check circle outline"});case T.UNSYNCED:return e.jsx(n.Icon,{name:"exclamation circle"});default:return null}},[t]),y=s.data;return e.jsx(n.Grid,{className:`CollectionItem ${C.grid}`,columns:"equal",children:e.jsxs(n.Grid.Row,{className:C.row,children:[e.jsxs(n.Grid.Column,{className:`${C.column} ${C.avatarColumn}`,width:5,children:[e.jsx(n.Checkbox,{checked:o,disabled:s.isPublished,onClick:p}),e.jsx(fe,{className:C.itemImage,item:s,hasBadge:!0,badgeSize:"small"}),e.jsx("div",{className:C.nameWrapper,children:e.jsxs("div",{className:C.name,title:s.name,children:[e.jsx(Xe,{className:C.itemStatus,item:s}),s.name]})})]}),e.jsx(n.Grid.Column,{className:C.column,children:y.category?e.jsx("div",{children:i(`wearable.category.${y.category}`)}):null}),e.jsx(n.Grid.Column,{className:C.column,children:e.jsx("div",{children:i(`body_shapes.${Je(s)}`)})}),e.jsx(n.Grid.Column,{className:C.column,children:e.jsx("div",{children:d})}),e.jsxs(n.Grid.Column,{width:3,className:`${C.column} ${C.statusColumn} ${C[t]}`,children:[k,e.jsx("div",{children:i(`third_party_collection_detail_page.synced_statuses.${t}`)})]}),e.jsx(n.Grid.Column,{width:1,className:C.column,children:e.jsx("div",{className:C.itemActions,children:e.jsx(n.Dropdown,{trigger:e.jsx(n.Button,{basic:!0,children:e.jsx(n.Icon,{name:"ellipsis horizontal"})}),inline:!0,direction:"left",className:C.action,onClick:ke(),children:e.jsxs(n.Dropdown.Menu,{children:[e.jsx(n.Dropdown.Item,{text:i("collection_item.see_details"),as:ye,to:M.itemDetail(s.id)}),e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.see_in_decentraland"),onClick:N}),e.jsx(n.Dropdown.Item,{text:i("global.open_in_editor"),onClick:f}),e.jsx(n.Popup,{content:i("collection_item.cannot_edit_urn"),position:"right center",disabled:!s.isPublished,trigger:e.jsx(n.Dropdown.Item,{text:i("collection_item.edit_urn"),onClick:v,disabled:s.isPublished}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0}),!s.isPublished&&e.jsx(se,{name:s.name,onDelete:m,trigger:e.jsx(n.Dropdown.Item,{text:i("global.delete")})})]})})})})]})})}const mt=(s,t)=>({status:be(s)[t.item.id]}),_t=s=>({onDelete:t=>s(ve(t)),onOpenModal:(t,o)=>s(D(t,o))}),ut=B(mt,_t)(dt),gt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_8524_427)'%3e%3cpath%20d='M20.5%203L20.34%203.03L15%205.1L9%203L3.36%204.9C3.15%204.97%203%205.15%203%205.38V20.5C3%2020.78%203.22%2021%203.5%2021L3.66%2020.97L9%2018.9L15%2021L20.64%2019.1C20.85%2019.03%2021%2018.85%2021%2018.62V3.5C21%203.22%2020.78%203%2020.5%203ZM15%2019L9%2016.89V5L15%207.11V19Z'%20fill='%23A09BA8'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_8524_427'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.669%200H1.33362C0.593463%200%200%200.600131%200%201.33362V10.669C0%2011.4025%200.593463%2012.0026%201.33362%2012.0026H10.669C11.4025%2012.0026%2012.0026%2011.4025%2012.0026%2010.669V1.33362C12.0026%200.600131%2011.4092%200%2010.669%200ZM10.669%2010.669H1.33362V2.66725H10.669V10.669ZM7.00152%206.66812C7.00152%207.22157%206.55476%207.66834%206.00131%207.66834C5.44785%207.66834%205.00109%207.22157%205.00109%206.66812C5.00109%206.11466%205.44785%205.6679%206.00131%205.6679C6.55476%205.6679%207.00152%206.11466%207.00152%206.66812ZM6.00131%204.00087C4.18091%204.00087%202.62724%205.10778%202.00044%206.66812C2.62724%208.22846%204.18091%209.33537%206.00131%209.33537C7.8217%209.33537%209.37537%208.22846%2010.0022%206.66812C9.37537%205.10778%207.8217%204.00087%206.00131%204.00087ZM6.00131%208.33515C5.08111%208.33515%204.33428%207.58832%204.33428%206.66812C4.33428%205.74792%205.08111%205.00109%206.00131%205.00109C6.92151%205.00109%207.66834%205.74792%207.66834%206.66812C7.66834%207.58832%206.92151%208.33515%206.00131%208.33515Z'%20fill='%23ECEBED'/%3e%3c/svg%3e",pt="_status_rgxu1_1",Ct="_pending_migration_rgxu1_14",xt="_synced_rgxu1_19",jt="_unpublished_rgxu1_24",It="_unsynced_rgxu1_25",Nt="_pending_mapping_rgxu1_30",ft="_under_review_rgxu1_31",kt="_icon_rgxu1_10",z={status:pt,pending_migration:Ct,synced:xt,unpublished:jt,unsynced:It,pending_mapping:Nt,under_review:ft,icon:kt},yt=s=>{const{status:t,item:o}=s,l=!o.mappings&&_e(o.urn),c=!o.isMappingComplete&&_e(o.urn),a=r.useMemo(()=>{if(l)return e.jsx("img",{src:gt,className:z.icon});if(c)return e.jsx(n.Icon,{name:"warning circle"});switch(t){case T.UNDER_REVIEW:return e.jsx("img",{src:ht,className:z.icon});case T.SYNCED:return e.jsx(n.Icon,{name:"check circle"});case T.UNSYNCED:case T.UNPUBLISHED:return e.jsx(n.Icon,{name:"cloud upload"})}},[t,l,c]),x=r.useMemo(()=>l?i("item_status.pending_mapping"):c?i("item_status.pending_migration"):i(`item_status.${t}`),[t,l,c]),p=r.useMemo(()=>l?"pending_mapping":c?"pending_migration":t,[t,l,c]);return e.jsxs("div",{className:V(z[p],z.status),children:[a," ",x]})},bt="_itemImage_1rili_1",vt="_itemStatus_1rili_10",wt="_grid_1rili_14",St="_loading_1rili_21",Pt="_row_1rili_26",Dt="_column_1rili_31",Et="_avatarColumn_1rili_35",Tt="_nameWrapper_1rili_40",Mt="_name_1rili_40",$t="_itemActions_1rili_53",Lt="_action_1rili_60",Bt="_overlay_1rili_65",I={itemImage:bt,itemStatus:vt,grid:wt,loading:St,row:Pt,column:Dt,avatarColumn:Et,nameWrapper:Tt,name:Mt,itemActions:$t,action:Lt,overlay:Bt};function At({item:s,status:t,selected:o,loading:l,collection:c,onSaveItem:a,onSelect:x,onOpenModal:p,onDelete:N}){const v=Z(),f=r.useMemo(()=>es(s),[s]),m=r.useMemo(()=>c.linkedContractAddress&&c.linkedContractNetwork?{address:c.linkedContractAddress,network:c.linkedContractNetwork}:null,[c]),[d,k]=r.useState(f),y=r.useMemo(()=>{if(d&&m){const S=ue(d,m);return ss(S)?void 0:"Invalid mapping"}},[d,m]);r.useEffect(()=>{!m||y||(!f&&d||f&&d&&!ts(f,d))&&h(d,m)},[f,y,d,m]);const h=r.useCallback(ns((S,E)=>{const $=ue(S,E);a({...s,mappings:$})},1e3),[a]),P=r.useCallback((S,E)=>{l||x(s,E.checked)},[s,l,x]),w=r.useCallback(()=>{p("SeeInWorldModal",{itemIds:[s.id]})},[s,p]),H=r.useCallback(()=>{s.isPublished||p("EditItemURNModal",{item:s})},[s,p]),Y=r.useCallback(()=>{v.push(M.itemEditor({itemId:s.id,collectionId:s.collectionId}),{fromParam:ee.TP_COLLECTIONS})},[s,v]),A=r.useCallback(()=>{N(s)},[N,s]);return e.jsxs(n.Grid,{className:V(I.grid,l&&I.loading),columns:"equal",children:[l&&e.jsx("div",{className:I.overlay,children:e.jsx(n.Loader,{size:"large",active:!0})}),e.jsxs(n.Grid.Row,{className:I.row,children:[e.jsxs(n.Grid.Column,{className:`${I.column} ${I.avatarColumn}`,width:4,children:[e.jsx(n.Checkbox,{checked:o,disabled:s.isPublished||l,onClick:P}),e.jsx(fe,{className:I.itemImage,item:s,hasBadge:!0,badgeSize:"small"}),e.jsx("div",{className:I.nameWrapper,children:e.jsx("div",{className:I.name,title:s.name,children:s.name})})]}),e.jsx(n.Grid.Column,{children:m&&e.jsx(as,{disabled:l,mapping:d,error:y,onChange:k,isCompact:!0})}),e.jsx(n.Grid.Column,{width:3,className:V(I.column,I.statusColumn),children:e.jsx(yt,{status:t,item:s})}),e.jsx(n.Grid.Column,{width:1,className:I.column,children:e.jsx("div",{className:I.itemActions,children:e.jsx(n.Dropdown,{trigger:e.jsx(n.Button,{basic:!0,children:e.jsx(n.Icon,{name:"ellipsis horizontal"})}),inline:!0,direction:"left",className:I.action,disabled:l,onClick:ke(),children:e.jsxs(n.Dropdown.Menu,{children:[e.jsx(n.Dropdown.Item,{text:i("collection_item.see_details"),as:ye,to:M.itemDetail(s.id)}),e.jsx(n.Dropdown.Item,{text:i("collection_context_menu.see_in_decentraland"),onClick:w}),e.jsx(n.Dropdown.Item,{text:i("global.open_in_editor"),onClick:Y}),e.jsx(n.Popup,{content:i("collection_item.cannot_edit_urn"),position:"right center",disabled:!s.isPublished,trigger:e.jsx(n.Dropdown.Item,{text:i("collection_item.edit_urn"),onClick:H,disabled:s.isPublished}),hideOnScroll:!0,on:"hover",inverted:!0,flowing:!0}),!s.isPublished&&e.jsx(se,{name:s.name,onDelete:A,trigger:e.jsx(n.Dropdown.Item,{text:i("global.delete")})})]})})})})]})]})}const Gt=(s,t)=>{const o=be(s);return{loading:!!is(s)[t.item.id],status:o[t.item.id]}},Rt=s=>({onDelete:t=>s(ve(t)),onSaveItem:t=>s(os(t,{},{onlySaveItem:!0})),onOpenModal:(t,o)=>s(D(t,o))}),Wt=B(Gt,Rt)(At),L=50,Ut="_itemCheckbox_2k9qa_1",Ht="_gridHeader_2k9qa_5",Ot="_itemColumn_2k9qa_15",J={itemCheckbox:Ut,gridHeader:Ht,itemColumn:Ot},Ft=({areAllSelected:s,onSelectedAllClick:t})=>e.jsx(n.Grid,{columns:"equal",className:J.gridHeader,children:e.jsxs(n.Grid.Row,{children:[e.jsxs(n.Grid.Column,{width:5,className:J.itemColumn,children:[e.jsx(n.Checkbox,{className:J.itemCheckbox,checked:s,onClick:t})," ",i("global.item")]}),e.jsx(n.Grid.Column,{children:i("global.category")}),e.jsx(n.Grid.Column,{children:i("global.body_shape")}),e.jsx(n.Grid.Column,{children:"URN ID"}),e.jsxs(n.Grid.Column,{width:3,children:[" ",i("collection_row.status")," "]}),e.jsx(n.Grid.Column,{width:1})]})}),zt="_gridHeader_4acv6_1",qt="_itemColumn_4acv6_11",Vt="_itemCheckbox_4acv6_16",Zt="_linkedToColumn_4acv6_20",q={gridHeader:zt,itemColumn:qt,itemCheckbox:Vt,linkedToColumn:Zt},Yt=({areAllSelected:s,onSelectedAllClick:t})=>e.jsx(n.Grid,{columns:"equal",className:q.gridHeader,children:e.jsxs(n.Grid.Row,{children:[e.jsxs(n.Grid.Column,{width:4,className:q.itemColumn,children:[e.jsx(n.Checkbox,{className:q.itemCheckbox,checked:s,onClick:t})," ",i("global.item")]}),e.jsxs(n.Grid.Column,{className:q.linkedToColumn,children:[e.jsx("span",{children:i("third_party_collection_detail_page.linked_to")}),e.jsx(ls,{})]}),e.jsxs(n.Grid.Column,{width:3,children:[" ",i("collection_row.status")," "]}),e.jsx(n.Grid.Column,{width:1})]})}),Qt="_main_16i8r_3",Kt="_slots_16i8r_11",Xt="_empty_16i8r_28",Jt="_searchContainer_16i8r_32",en="_searchInfo_16i8r_42",sn="_syncedStatusList_16i8r_46",tn="_selectionInfo_16i8r_53",nn="_header_16i8r_63",an="_content_16i8r_74",on="_title_16i8r_83",ln="_editCollectionName_16i8r_96",rn="_name_16i8r_101",cn="_nameAndType_16i8r_105",dn="_nameWrapper_16i8r_115",mn="_size_16i8r_139",_n="_actions_16i8r_143",un="_body_16i8r_151",gn="_info_16i8r_162",hn="_infoHeader_16i8r_170",pn="_infoContent_16i8r_178",Cn="_slotsIcon_16i8r_195",xn="_copyButton_16i8r_207",jn="_sparkles_16i8r_232",In="_start_16i8r_241",Nn="_migrationBanner_16i8r_254",fn="_type_16i8r_277",kn="_linkedWearableBadge_16i8r_283",yn="_typeBadge_16i8r_288",bn="_programmaticBadge_16i8r_292",vn="_standardBadge_16i8r_296",wn="_loader_16i8r_302",_={main:Qt,slots:Kt,empty:Xt,searchContainer:Jt,searchInfo:en,syncedStatusList:sn,selectionInfo:tn,header:nn,content:an,title:on,editCollectionName:ln,name:rn,nameAndType:cn,nameWrapper:dn,size:mn,actions:_n,body:un,info:gn,infoHeader:hn,infoContent:pn,slotsIcon:Cn,copyButton:xn,sparkles:jn,start:In,migrationBanner:Nn,type:fn,linkedWearableBadge:kn,typeBadge:yn,programmaticBadge:bn,standardBadge:vn,loader:wn},xe=({children:s,title:t,info:o})=>e.jsxs("div",{className:_.info,children:[e.jsxs("div",{className:_.infoHeader,children:[t," ",o&&e.jsx(n.InfoTooltip,{content:o})]}),e.jsx("div",{className:_.infoContent,children:s})]});function Sn({currentPage:s,lastLocation:t,wallet:o,thirdParty:l,items:c,collection:a,totalItems:x,isLoading:p,isThirdPartyV2Enabled:N,isLinkedWearablesPaymentsEnabled:v,onFetchAvailableSlots:f,onFetchThirdParty:m,onNewItem:d,onEditName:k,isLoadingAvailableSlots:y}){const[h,P]=r.useState({}),[w,H]=r.useState(s),[Y,A]=r.useState(!1),[S,E]=r.useState(!1),[$,te]=r.useState("ALL"),G=Z(),ne=t===M.collections();r.useEffect(()=>{l&&l.availableSlots===void 0&&!y&&f(l.id)},[l,y,f]),r.useEffect(()=>{!p&&!l&&(a!=null&&a.urn)&&m(we(a.urn))},[a==null?void 0:a.urn,p,l]),r.useEffect(()=>{if(s!==w&&H(s),S){const u=c.reduce((g,j)=>(g[j.id]=!0,g),{});P(u),A(!1)}},[w,S,c,l,s]);const Se=r.useCallback(()=>{a!=null&&a.id&&d(a.id)},[a==null?void 0:a.id,d]),Pe=r.useCallback(()=>{a&&k(a)},[a,k]),De=r.useCallback(()=>{ne?G.goBack():G.push(M.collections(rs.THIRD_PARTY))},[G,ne]),Ee=r.useCallback((u,g)=>{H(+g.activePage),G.push(M.thirdPartyCollectionDetail(a.id,{page:+g.activePage}))},[a,G]),Q=r.useCallback((u,g)=>{P({...h,[u.id]:g}),E(!1),A(!1)},[h]),R=r.useCallback(u=>u.every(g=>h[g.id]),[h]),ae=r.useCallback((u,g)=>{const j={...h},W=!R(u);for(const U of u)j[U.id]=W;P(j),A(!0),E(S&&!!g.checked)},[h,S,R]),ie=r.useCallback(()=>{P({})},[]),oe=r.useMemo(()=>a&&l&&o&&cs(o.address,l),[a,l,o]),Te=r.useCallback(u=>{if(E(!0),a){const g=Math.ceil(x/L);u(a.id,{page:ds(g),limit:L,overridePaginationData:!1})}},[x]),le=r.useCallback((u,{value:g})=>{te(g)},[te]),Me=[{value:"ALL",text:i("third_party_collection_detail_page.synced_filter.all")},{value:"SYNCED",text:i("item_status.synced")},{value:"UNSYNCED",text:i("item_status.unsynced")},...a!=null&&a.isMappingComplete?[]:[{value:"MIGRATION_REQUIRED",text:i("item_status.pending_migration")},{value:"MAPPING_PENDING",text:i("item_status.pending_mapping")}]],$e=r.useMemo(()=>{switch($){case"SYNCED":return{synced:!0};case"UNSYNCED":return{synced:!1};case"MIGRATION_REQUIRED":return{mappingStatus:ge.UNPUBLISHED_MAPPING};case"MAPPING_PENDING":return{mappingStatus:ge.MISSING_MAPPING};default:return{}}},[$]),Le=r.useCallback((u,g,j,W,U)=>{const re=g.filter(b=>h[b.id]),ce=re.length,de=!!(a!=null&&a.linkedContractAddress&&(a!=null&&a.linkedContractNetwork)),O=x,K=Math.ceil(O/L),me=(a==null?void 0:a.itemCount)===0;return a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:_.header,children:[e.jsx(Ts,{absolute:!0,onClick:De}),e.jsxs("div",{className:_.content,children:[e.jsxs("div",{className:_.title,children:[e.jsx(Us,{collectionId:a.id}),e.jsxs("div",{className:_.nameAndType,children:[e.jsxs("div",{className:_.nameWrapper,children:[e.jsx(n.Header,{size:"large",className:_.name,onClick:Pe,children:a.name}),!a.isPublished&&e.jsx(ms,{name:"edit",className:_.editCollectionName})]}),e.jsxs("div",{className:_.type,children:[e.jsx(Ms,{isThirdParty:!0}),e.jsx($s,{isProgrammatic:u.isProgrammatic})]})]})]}),e.jsxs("div",{className:_.actions,children:[a.linkedContractAddress&&a.linkedContractNetwork&&e.jsxs(xe,{title:i("third_party_collection_detail_page.smart_contract_address_short"),info:i("third_party_collection_detail_page.smart_contract_address_long"),children:[_s(a.linkedContractAddress)," ",e.jsx(us,{className:_.copyButton,showPopup:!0,text:a.linkedContractAddress,role:"button",children:e.jsx(n.Icon,{name:"copy outline"})})]}),!v&&e.jsxs(xe,{title:i("third_party_collection_detail_page.slots_short"),info:i("third_party_collection_detail_page.slots_long"),children:[e.jsx("div",{className:_.slotsIcon}),y?e.jsx(n.Loader,{active:!0,inline:!0,size:"tiny"}):e.jsxs("span",{children:[u.availableSlots??0," / ",u.maxItems]})]}),e.jsxs(n.Button,{inverted:!0,onClick:Se,children:[e.jsx(n.Icon,{name:"plus"}),i("third_party_collection_detail_page.new_items")]}),u.availableSlots!==void 0?e.jsx(Qs,{collection:a,items:re,slots:u.availableSlots}):null,e.jsx(Vs,{collection:a,items:j})]})]})]}),!a.isMappingComplete&&e.jsxs("div",{className:_.migrationBanner,children:[e.jsx(n.Icon,{name:"sync"})," ",i("third_party_collection_detail_page.migration_banner")]}),e.jsx("div",{className:_.body,children:W?e.jsx("div",{className:_.loader,children:e.jsx(n.Loader,{size:"massive",inline:!0,active:!0})}):e.jsxs(e.Fragment,{children:[(a.itemCount??0)>0&&e.jsxs("div",{className:_.searchContainer,children:[j.length>0&&e.jsx("div",{className:_.searchInfo,children:i("third_party_collection_detail_page.search_info",{page:(w-1)*L+1,pageTotal:Math.min(O,w*L),total:O})}),e.jsx(n.Dropdown,{className:_.syncedStatusList,direction:"left",value:$,options:Me,onChange:le})]}),j.length?e.jsxs(e.Fragment,{children:[ce>0?e.jsxs("div",{className:_.selectionInfo,children:[i("third_party_collection_detail_page.selection",{count:ce})," ",e.jsx("span",{className:"link",onClick:ie,children:i("third_party_collection_detail_page.clear_selection")}),".  ",Y&&K>1?e.jsx("span",{className:"link",onClick:()=>Te(U),children:i("third_party_collection_detail_page.select_all",{total:O})}):null," "]}):null,e.jsxs("div",{children:[N&&de?e.jsx(Yt,{areAllSelected:R(j),onSelectedAllClick:(b,X)=>ae(j,X)}):e.jsx(Ft,{areAllSelected:R(j),onSelectedAllClick:(b,X)=>ae(j,X)}),j.map(b=>N&&de?e.jsx(Wt,{collection:a,item:b,selected:!!h[b.id],onSelect:Q},b.id):e.jsx(ut,{collection:a,item:b,selected:!!h[b.id],onSelect:Q},b.id)),K>1?e.jsx(n.Pagination,{firstItem:null,lastItem:null,totalPages:K,activePage:w,onPageChange:Ee}):null]})]}):e.jsxs("div",{className:_.empty,children:[e.jsx("div",{className:me?_.start:_.sparkles}),me?e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:i("third_party_collection_detail_page.start_adding_items")}),e.jsx("p",{children:i("third_party_collection_detail_page.cant_remove")})]}):e.jsxs(e.Fragment,{children:[e.jsx("h3",{children:i("third_party_collection_detail_page.not_found")}),e.jsx("p",{children:i("third_party_collection_detail_page.try_again")})]})]})]})})]}):(console.error("No collection defined"),null)},[a,h,y,v,N,x,w,Q,R,le,ie,$]),Be=oe&&a;return e.jsx(Ds,{id:a==null?void 0:a.id,itemsPage:w,itemsPageSize:L,fetchCollectionItemsOptions:$e,children:({isLoadingCollection:u,isLoadingCollectionItems:g,items:j,paginatedItems:W,onFetchCollectionItemsPages:U})=>e.jsx(Ps,{className:_.main,hasNavigation:!oe&&!p&&!u,isLoading:p||u,children:Be&&l?Le(l,j,W,g,U):e.jsx(Es,{})})})}const Pn=s=>{var N;const t=gs(s)||"",o=je(s,t),l=o?he(o):!1,c=((N=pe(s,t))==null?void 0:N.total)||null,a=o?hs(s,o.id):[],x=o&&pe(s,o.id)||null,p=Number(ps(s).query.page??1);return{items:a,totalItems:c,currentPage:p,paginatedData:x,wallet:Cs(s),collection:o,isThirdPartyV2Enabled:xs(s),isLinkedWearablesPaymentsEnabled:Ne(s),thirdParty:o&&he(o)?js(s,o):null,authorizations:Is(s),isLoading:Ie(Ns(s),ws)||fs(s)||!!(l&&o&&ks(s,we(o.urn))),isLoadingAvailableSlots:ys(s),lastLocation:Ss(s)}},Dn=s=>({onNewItem:t=>s(D("CreateItemsModal",{collectionId:t})),onEditName:t=>s(D("EditCollectionNameModal",{collection:t})),onFetchAvailableSlots:t=>s(bs(t)),onFetchThirdParty:t=>s(vs(t))}),Hn=B(Pn,Dn)(Sn);export{Hn as default};
@@ -1 +1 @@
1
- import{af as b,Z as k,bk as T,D as i,K as C,H as e,ah as f,M as s,aj as w,G as l,N as D,hN as S,hL as L,O as E,bw as P,b3 as R,X as M,Y as v,Q as F,en as y}from"./index-41C5YwXr.js";import{N as H}from"./NotFound-CS8G9Pe7.js";const I=n=>{const{template:a,isLoading:t,scene:c,onOpenModal:r,onLoadTemplateScene:m}=n,u=k(),o=T(),d=i.useMemo(()=>({id:a==null?void 0:a.id,name:a==null?void 0:a.title,description:a==null?void 0:a.description}),[a]);i.useEffect(()=>{a&&!c&&m(a)},[a,c,m]);const x=()=>e.jsx(s.Center,{children:e.jsx(s.Loader,{active:!0,size:"large"})}),j=()=>e.jsx(H,{}),h=i.useCallback(()=>{o==null||o.track("Download Template",d),r("ExportModal",{project:a})},[o,a,d,r]),g=i.useCallback(()=>{u.push(C.templates())},[u]),_=i.useCallback(()=>{a&&(o==null||o.track("Select Template",d),r("CloneTemplateModal",{template:a}))},[o,a,d,r]),N=p=>e.jsxs(e.Fragment,{children:[e.jsx(s.Section,{size:"large",children:e.jsx(s.Row,{children:e.jsx(s.Column,{children:e.jsx(s.Row,{children:e.jsxs("div",{className:"title-container",children:[e.jsx(s.Button,{className:"back-button",basic:!0,icon:e.jsx(s.Icon,{name:"arrow alternate circle left outline"}),onClick:g,"aria-label":l("templates_page.back_to_scenes")}),e.jsx(s.Header,{className:"name",children:p.title})]})})})})}),e.jsx(s.Section,{children:e.jsx("div",{className:"header-image",style:{backgroundImage:`url(${p.thumbnail})`}})}),e.jsxs(s.Section,{children:[e.jsxs(s.Row,{className:"content info-container",children:[e.jsxs(s.Column,{className:"creator-container",children:[e.jsx(s.Header,{children:l("template_detail_page.creator")}),e.jsxs("p",{className:"description-content",children:[e.jsx(s.Logo,{})," Decentraland",e.jsx("br",{}),"Foundation"]})]}),e.jsxs(s.Column,{className:"description-container",children:[e.jsx(s.Header,{children:l("template_detail_page.description")}),e.jsx("p",{className:"description-content",children:p.description})]}),e.jsxs(s.Column,{className:"action-buttons-container",children:[e.jsx(s.Button,{primary:!0,className:"select-button",onClick:_,children:l("template_detail_page.select_template")}),e.jsx(s.Button,{inverted:!0,className:"download-button",onClick:h,children:l("template_detail_page.download_scene")})]})]}),e.jsx(s.Row,{className:"content",children:e.jsxs(s.Column,{className:"scene-details-container",children:[e.jsx(s.Header,{children:l("template_detail_page.scene_details")}),e.jsx("p",{className:"description-content world",children:l("template_detail_page.built_for_world")}),e.jsx("p",{className:"description-content size-scene",children:l("template_detail_page.parcels",{...p.layout})}),e.jsx("p",{className:"description-content personalize-content",children:l("template_detail_page.personalize_it_yourself")}),c&&e.jsx("p",{className:"description-content sdk",children:c!=null&&c.sdk6?"SDK 6":"SDK 7"})]})})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(f,{}),e.jsxs(s.Page,{className:"TemplateDetailPage",isFullscreen:!0,children:[t&&!a?x():null,!t&&!a?j():null,a?N(a):null]}),e.jsx(w,{})]})},z=b.memo(I),O=n=>{const a=S(n),t=a&&L(n)[a],c=t?E(n)[t.sceneId]:null;return{template:t||null,scene:c,isLoading:P(R(n),y)}},B=n=>({onOpenModal:(a,t)=>n(M(a,t)),onLoadTemplateScene:a=>n(v(a,F.TEMPLATE))}),$=D(O,B)(z);export{$ as default};
1
+ import{af as b,Z as k,bk as T,D as i,K as C,H as e,ah as f,M as s,aj as w,G as l,N as D,hN as S,hL as L,O as E,bw as P,b3 as R,X as M,Y as v,Q as F,en as y}from"./index-DnIS3hck.js";import{N as H}from"./NotFound-DrUt7rXf.js";const I=n=>{const{template:a,isLoading:t,scene:c,onOpenModal:r,onLoadTemplateScene:m}=n,u=k(),o=T(),d=i.useMemo(()=>({id:a==null?void 0:a.id,name:a==null?void 0:a.title,description:a==null?void 0:a.description}),[a]);i.useEffect(()=>{a&&!c&&m(a)},[a,c,m]);const x=()=>e.jsx(s.Center,{children:e.jsx(s.Loader,{active:!0,size:"large"})}),j=()=>e.jsx(H,{}),h=i.useCallback(()=>{o==null||o.track("Download Template",d),r("ExportModal",{project:a})},[o,a,d,r]),g=i.useCallback(()=>{u.push(C.templates())},[u]),_=i.useCallback(()=>{a&&(o==null||o.track("Select Template",d),r("CloneTemplateModal",{template:a}))},[o,a,d,r]),N=p=>e.jsxs(e.Fragment,{children:[e.jsx(s.Section,{size:"large",children:e.jsx(s.Row,{children:e.jsx(s.Column,{children:e.jsx(s.Row,{children:e.jsxs("div",{className:"title-container",children:[e.jsx(s.Button,{className:"back-button",basic:!0,icon:e.jsx(s.Icon,{name:"arrow alternate circle left outline"}),onClick:g,"aria-label":l("templates_page.back_to_scenes")}),e.jsx(s.Header,{className:"name",children:p.title})]})})})})}),e.jsx(s.Section,{children:e.jsx("div",{className:"header-image",style:{backgroundImage:`url(${p.thumbnail})`}})}),e.jsxs(s.Section,{children:[e.jsxs(s.Row,{className:"content info-container",children:[e.jsxs(s.Column,{className:"creator-container",children:[e.jsx(s.Header,{children:l("template_detail_page.creator")}),e.jsxs("p",{className:"description-content",children:[e.jsx(s.Logo,{})," Decentraland",e.jsx("br",{}),"Foundation"]})]}),e.jsxs(s.Column,{className:"description-container",children:[e.jsx(s.Header,{children:l("template_detail_page.description")}),e.jsx("p",{className:"description-content",children:p.description})]}),e.jsxs(s.Column,{className:"action-buttons-container",children:[e.jsx(s.Button,{primary:!0,className:"select-button",onClick:_,children:l("template_detail_page.select_template")}),e.jsx(s.Button,{inverted:!0,className:"download-button",onClick:h,children:l("template_detail_page.download_scene")})]})]}),e.jsx(s.Row,{className:"content",children:e.jsxs(s.Column,{className:"scene-details-container",children:[e.jsx(s.Header,{children:l("template_detail_page.scene_details")}),e.jsx("p",{className:"description-content world",children:l("template_detail_page.built_for_world")}),e.jsx("p",{className:"description-content size-scene",children:l("template_detail_page.parcels",{...p.layout})}),e.jsx("p",{className:"description-content personalize-content",children:l("template_detail_page.personalize_it_yourself")}),c&&e.jsx("p",{className:"description-content sdk",children:c!=null&&c.sdk6?"SDK 6":"SDK 7"})]})})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(f,{}),e.jsxs(s.Page,{className:"TemplateDetailPage",isFullscreen:!0,children:[t&&!a?x():null,!t&&!a?j():null,a?N(a):null]}),e.jsx(w,{})]})},z=b.memo(I),O=n=>{const a=S(n),t=a&&L(n)[a],c=t?E(n)[t.sceneId]:null;return{template:t||null,scene:c,isLoading:P(R(n),y)}},B=n=>({onOpenModal:(a,t)=>n(M(a,t)),onLoadTemplateScene:a=>n(v(a,F.TEMPLATE))}),$=D(O,B)(z);export{$ as default};
@@ -1 +1 @@
1
- import{bP as h,bQ as s}from"./index-41C5YwXr.js";var N={};function O(){return N}function D(e){var a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),e.getTime()-a.getTime()}function M(e,a){h(2,arguments);var t=s(e),n=s(a),i=t.getTime()-n.getTime();return i<0?-1:i>0?1:i}function A(e,a){h(2,arguments);var t=s(e),n=s(a),i=t.getFullYear()-n.getFullYear(),o=t.getMonth()-n.getMonth();return i*12+o}function X(e,a){return h(2,arguments),s(e).getTime()-s(a).getTime()}var T={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(a){return a<0?Math.ceil(a):Math.floor(a)}},_="trunc";function I(e){return e?T[e]:T[_]}function R(e){h(1,arguments);var a=s(e);return a.setHours(23,59,59,999),a}function Y(e){h(1,arguments);var a=s(e),t=a.getMonth();return a.setFullYear(a.getFullYear(),t+1,0),a.setHours(23,59,59,999),a}function E(e){h(1,arguments);var a=s(e);return R(a).getTime()===Y(a).getTime()}function j(e,a){h(2,arguments);var t=s(e),n=s(a),i=M(t,n),o=Math.abs(A(t,n)),r;if(o<1)r=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-i*o);var l=M(t,n)===-i;E(s(e))&&o===1&&M(e,n)===1&&(l=!1),r=i*(o-Number(l))}return r===0?0:r}function q(e,a,t){h(2,arguments);var n=X(e,a)/1e3;return I(void 0)(n)}var V={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},z=function(a,t,n){var i,o=V[a];return typeof o=="string"?i=o:t===1?i=o.one:i=o.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i};function w(e){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=a.width?String(a.width):e.defaultWidth,n=e.formats[t]||e.formats[e.defaultWidth];return n}}var H={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},J={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},L={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Q={date:w({formats:H,defaultWidth:"full"}),time:w({formats:J,defaultWidth:"full"}),dateTime:w({formats:L,defaultWidth:"full"})},U={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},$=function(a,t,n,i){return U[a]};function g(e){return function(a,t){var n=t!=null&&t.context?String(t.context):"standalone",i;if(n==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,r=t!=null&&t.width?String(t.width):o;i=e.formattingValues[r]||e.formattingValues[o]}else{var l=e.defaultWidth,u=t!=null&&t.width?String(t.width):e.defaultWidth;i=e.values[u]||e.values[l]}var m=e.argumentCallback?e.argumentCallback(a):a;return i[m]}}var B={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},K={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},G={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Z={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ee={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},te={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ae=function(a,t){var n=Number(a),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},ne={ordinalNumber:ae,era:g({values:B,defaultWidth:"wide"}),quarter:g({values:K,defaultWidth:"wide",argumentCallback:function(a){return a-1}}),month:g({values:G,defaultWidth:"wide"}),day:g({values:Z,defaultWidth:"wide"}),dayPeriod:g({values:ee,defaultWidth:"wide",formattingValues:te,defaultFormattingWidth:"wide"})};function b(e){return function(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=a.match(i);if(!o)return null;var r=o[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(l)?ie(l,function(f){return f.test(r)}):re(l,function(f){return f.test(r)}),m;m=e.valueCallback?e.valueCallback(u):u,m=t.valueCallback?t.valueCallback(m):m;var c=a.slice(r.length);return{value:m,rest:c}}}function re(e,a){for(var t in e)if(e.hasOwnProperty(t)&&a(e[t]))return t}function ie(e,a){for(var t=0;t<e.length;t++)if(a(e[t]))return t}function oe(e){return function(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.match(e.matchPattern);if(!n)return null;var i=n[0],o=a.match(e.parsePattern);if(!o)return null;var r=e.valueCallback?e.valueCallback(o[0]):o[0];r=t.valueCallback?t.valueCallback(r):r;var l=a.slice(i.length);return{value:r,rest:l}}}var ue=/^(\d+)(th|st|nd|rd)?/i,se=/\d+/i,le={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},de={any:[/^b/i,/^(a|c)/i]},me={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},fe={any:[/1/i,/2/i,/3/i,/4/i]},he={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ce={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ve={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ge={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},be={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Me={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ye={ordinalNumber:oe({matchPattern:ue,parsePattern:se,valueCallback:function(a){return parseInt(a,10)}}),era:b({matchPatterns:le,defaultMatchWidth:"wide",parsePatterns:de,defaultParseWidth:"any"}),quarter:b({matchPatterns:me,defaultMatchWidth:"wide",parsePatterns:fe,defaultParseWidth:"any",valueCallback:function(a){return a+1}}),month:b({matchPatterns:he,defaultMatchWidth:"wide",parsePatterns:ce,defaultParseWidth:"any"}),day:b({matchPatterns:ve,defaultMatchWidth:"wide",parsePatterns:ge,defaultParseWidth:"any"}),dayPeriod:b({matchPatterns:be,defaultMatchWidth:"any",parsePatterns:Me,defaultParseWidth:"any"})},we={code:"en-US",formatDistance:z,formatLong:Q,formatRelative:$,localize:ne,match:ye,options:{weekStartsOn:0,firstWeekContainsDate:1}};function W(e,a){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t]);return e}function Pe(e){return W({},e)}var S=1440,pe=2520,P=43200,De=86400;function Se(e,a,t){var n,i;h(2,arguments);var o=O(),r=(n=(i=t==null?void 0:t.locale)!==null&&i!==void 0?i:o.locale)!==null&&n!==void 0?n:we;if(!r.formatDistance)throw new RangeError("locale must contain formatDistance property");var l=M(e,a);if(isNaN(l))throw new RangeError("Invalid time value");var u=W(Pe(t),{addSuffix:!!(t!=null&&t.addSuffix),comparison:l}),m,c;l>0?(m=s(a),c=s(e)):(m=s(e),c=s(a));var f=q(c,m),k=(D(c)-D(m))/1e3,d=Math.round((f-k)/60),v;if(d<2)return t!=null&&t.includeSeconds?f<5?r.formatDistance("lessThanXSeconds",5,u):f<10?r.formatDistance("lessThanXSeconds",10,u):f<20?r.formatDistance("lessThanXSeconds",20,u):f<40?r.formatDistance("halfAMinute",0,u):f<60?r.formatDistance("lessThanXMinutes",1,u):r.formatDistance("xMinutes",1,u):d===0?r.formatDistance("lessThanXMinutes",1,u):r.formatDistance("xMinutes",d,u);if(d<45)return r.formatDistance("xMinutes",d,u);if(d<90)return r.formatDistance("aboutXHours",1,u);if(d<S){var F=Math.round(d/60);return r.formatDistance("aboutXHours",F,u)}else{if(d<pe)return r.formatDistance("xDays",1,u);if(d<P){var x=Math.round(d/S);return r.formatDistance("xDays",x,u)}else if(d<De)return v=Math.round(d/P),r.formatDistance("aboutXMonths",v,u)}if(v=j(c,m),v<12){var C=Math.round(d/P);return r.formatDistance("xMonths",C,u)}else{var p=v%12,y=Math.floor(v/12);return p<3?r.formatDistance("aboutXYears",y,u):p<9?r.formatDistance("overXYears",y,u):r.formatDistance("almostXYears",y+1,u)}}export{g as a,w as b,oe as c,b as d,D as e,Se as f,O as g,we as l};
1
+ import{bP as h,bQ as s}from"./index-DnIS3hck.js";var N={};function O(){return N}function D(e){var a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),e.getTime()-a.getTime()}function M(e,a){h(2,arguments);var t=s(e),n=s(a),i=t.getTime()-n.getTime();return i<0?-1:i>0?1:i}function A(e,a){h(2,arguments);var t=s(e),n=s(a),i=t.getFullYear()-n.getFullYear(),o=t.getMonth()-n.getMonth();return i*12+o}function X(e,a){return h(2,arguments),s(e).getTime()-s(a).getTime()}var T={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(a){return a<0?Math.ceil(a):Math.floor(a)}},_="trunc";function I(e){return e?T[e]:T[_]}function R(e){h(1,arguments);var a=s(e);return a.setHours(23,59,59,999),a}function Y(e){h(1,arguments);var a=s(e),t=a.getMonth();return a.setFullYear(a.getFullYear(),t+1,0),a.setHours(23,59,59,999),a}function E(e){h(1,arguments);var a=s(e);return R(a).getTime()===Y(a).getTime()}function j(e,a){h(2,arguments);var t=s(e),n=s(a),i=M(t,n),o=Math.abs(A(t,n)),r;if(o<1)r=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-i*o);var l=M(t,n)===-i;E(s(e))&&o===1&&M(e,n)===1&&(l=!1),r=i*(o-Number(l))}return r===0?0:r}function q(e,a,t){h(2,arguments);var n=X(e,a)/1e3;return I(void 0)(n)}var V={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},z=function(a,t,n){var i,o=V[a];return typeof o=="string"?i=o:t===1?i=o.one:i=o.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i};function w(e){return function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=a.width?String(a.width):e.defaultWidth,n=e.formats[t]||e.formats[e.defaultWidth];return n}}var H={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},J={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},L={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Q={date:w({formats:H,defaultWidth:"full"}),time:w({formats:J,defaultWidth:"full"}),dateTime:w({formats:L,defaultWidth:"full"})},U={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},$=function(a,t,n,i){return U[a]};function g(e){return function(a,t){var n=t!=null&&t.context?String(t.context):"standalone",i;if(n==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,r=t!=null&&t.width?String(t.width):o;i=e.formattingValues[r]||e.formattingValues[o]}else{var l=e.defaultWidth,u=t!=null&&t.width?String(t.width):e.defaultWidth;i=e.values[u]||e.values[l]}var m=e.argumentCallback?e.argumentCallback(a):a;return i[m]}}var B={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},K={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},G={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Z={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ee={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},te={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ae=function(a,t){var n=Number(a),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},ne={ordinalNumber:ae,era:g({values:B,defaultWidth:"wide"}),quarter:g({values:K,defaultWidth:"wide",argumentCallback:function(a){return a-1}}),month:g({values:G,defaultWidth:"wide"}),day:g({values:Z,defaultWidth:"wide"}),dayPeriod:g({values:ee,defaultWidth:"wide",formattingValues:te,defaultFormattingWidth:"wide"})};function b(e){return function(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=a.match(i);if(!o)return null;var r=o[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(l)?ie(l,function(f){return f.test(r)}):re(l,function(f){return f.test(r)}),m;m=e.valueCallback?e.valueCallback(u):u,m=t.valueCallback?t.valueCallback(m):m;var c=a.slice(r.length);return{value:m,rest:c}}}function re(e,a){for(var t in e)if(e.hasOwnProperty(t)&&a(e[t]))return t}function ie(e,a){for(var t=0;t<e.length;t++)if(a(e[t]))return t}function oe(e){return function(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.match(e.matchPattern);if(!n)return null;var i=n[0],o=a.match(e.parsePattern);if(!o)return null;var r=e.valueCallback?e.valueCallback(o[0]):o[0];r=t.valueCallback?t.valueCallback(r):r;var l=a.slice(i.length);return{value:r,rest:l}}}var ue=/^(\d+)(th|st|nd|rd)?/i,se=/\d+/i,le={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},de={any:[/^b/i,/^(a|c)/i]},me={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},fe={any:[/1/i,/2/i,/3/i,/4/i]},he={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ce={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ve={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ge={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},be={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Me={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ye={ordinalNumber:oe({matchPattern:ue,parsePattern:se,valueCallback:function(a){return parseInt(a,10)}}),era:b({matchPatterns:le,defaultMatchWidth:"wide",parsePatterns:de,defaultParseWidth:"any"}),quarter:b({matchPatterns:me,defaultMatchWidth:"wide",parsePatterns:fe,defaultParseWidth:"any",valueCallback:function(a){return a+1}}),month:b({matchPatterns:he,defaultMatchWidth:"wide",parsePatterns:ce,defaultParseWidth:"any"}),day:b({matchPatterns:ve,defaultMatchWidth:"wide",parsePatterns:ge,defaultParseWidth:"any"}),dayPeriod:b({matchPatterns:be,defaultMatchWidth:"any",parsePatterns:Me,defaultParseWidth:"any"})},we={code:"en-US",formatDistance:z,formatLong:Q,formatRelative:$,localize:ne,match:ye,options:{weekStartsOn:0,firstWeekContainsDate:1}};function W(e,a){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t]);return e}function Pe(e){return W({},e)}var S=1440,pe=2520,P=43200,De=86400;function Se(e,a,t){var n,i;h(2,arguments);var o=O(),r=(n=(i=t==null?void 0:t.locale)!==null&&i!==void 0?i:o.locale)!==null&&n!==void 0?n:we;if(!r.formatDistance)throw new RangeError("locale must contain formatDistance property");var l=M(e,a);if(isNaN(l))throw new RangeError("Invalid time value");var u=W(Pe(t),{addSuffix:!!(t!=null&&t.addSuffix),comparison:l}),m,c;l>0?(m=s(a),c=s(e)):(m=s(e),c=s(a));var f=q(c,m),k=(D(c)-D(m))/1e3,d=Math.round((f-k)/60),v;if(d<2)return t!=null&&t.includeSeconds?f<5?r.formatDistance("lessThanXSeconds",5,u):f<10?r.formatDistance("lessThanXSeconds",10,u):f<20?r.formatDistance("lessThanXSeconds",20,u):f<40?r.formatDistance("halfAMinute",0,u):f<60?r.formatDistance("lessThanXMinutes",1,u):r.formatDistance("xMinutes",1,u):d===0?r.formatDistance("lessThanXMinutes",1,u):r.formatDistance("xMinutes",d,u);if(d<45)return r.formatDistance("xMinutes",d,u);if(d<90)return r.formatDistance("aboutXHours",1,u);if(d<S){var F=Math.round(d/60);return r.formatDistance("aboutXHours",F,u)}else{if(d<pe)return r.formatDistance("xDays",1,u);if(d<P){var x=Math.round(d/S);return r.formatDistance("xDays",x,u)}else if(d<De)return v=Math.round(d/P),r.formatDistance("aboutXMonths",v,u)}if(v=j(c,m),v<12){var C=Math.round(d/P);return r.formatDistance("xMonths",C,u)}else{var p=v%12,y=Math.floor(v/12);return p<3?r.formatDistance("aboutXYears",y,u):p<9?r.formatDistance("overXYears",y,u):r.formatDistance("almostXYears",y+1,u)}}export{g as a,w as b,oe as c,b as d,D as e,Se as f,O as g,we as l};