@dcl/builder-site 7.9.1 → 7.10.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 (83) hide show
  1. package/assets/{Back-iVIqxATW.js → Back-Bh77QWm7.js} +1 -1
  2. package/assets/{CollectionProvider.container-D5AviJmj.js → CollectionProvider.container-BzpdsqPe.js} +1 -1
  3. package/assets/{CollectionStatus.container-BA96F5oG.js → CollectionStatus.container-CG15tMSD.js} +1 -1
  4. package/assets/{ConfirmDelete-DbFeXC54.js → ConfirmDelete-D--HGMws.js} +1 -1
  5. package/assets/{FileSaver.min-Co5yNCWq.js → FileSaver.min-DuXdSbhX.js} +1 -1
  6. package/assets/{ItemProvider.container-DFEZSCMr.js → ItemProvider.container-MISPz4DG.js} +1 -1
  7. package/assets/{JumpIn.container-Bfsb8XQY.js → JumpIn.container-D3MOQe7Y.js} +1 -1
  8. package/assets/{LandAction-CPxdm2mW.js → LandAction-axbqGGf5.js} +1 -1
  9. package/assets/{LandProviderPage-CcaXrtuL.js → LandProviderPage-Dsc6j9cR.js} +1 -1
  10. package/assets/{LoggedInDetailPage.container-P8-KV9ow.js → LoggedInDetailPage.container-BHmdn9ps.js} +1 -1
  11. package/assets/{Navigation-DcWJGKAO.css → Navigation-C3wSZU-s.css} +1 -1
  12. package/assets/{Navigation.container-h_uvbEV-.js → Navigation.container-CKM19nBc.js} +1 -1
  13. package/assets/{NotFound-DLc93Jdo.js → NotFound-CcClt7IJ.js} +1 -1
  14. package/assets/{OptionsDropdown-D-NX2iG9.js → OptionsDropdown-Dc-RRhAK.js} +1 -1
  15. package/assets/{RentalPeriod-zYkY1mDE.js → RentalPeriod-Bji8F9rq.js} +1 -1
  16. package/assets/{SDKTag-zvq-EFlK.js → SDKTag-8IdhJB0E.js} +1 -1
  17. package/assets/{SceneStats.container-BaAgsVQY.js → SceneStats.container-DAop3AbS.js} +1 -1
  18. package/assets/{SignInRequired-CvEoVbqe.js → SignInRequired-Cq7FDGbD.js} +1 -1
  19. package/assets/{ThirdPartyKindBadge-BGDRAUQ5.js → ThirdPartyKindBadge-CiyZQeWO.js} +1 -1
  20. package/assets/{dataReader-CLgBoImj.js → dataReader-MntXPmyh.js} +1 -1
  21. package/assets/{date-DaS5tTOc.js → date-B0CFOy0I.js} +1 -1
  22. package/assets/{fortmatic-C5kGMbac.js → fortmatic-BKSgGJfo.js} +1 -1
  23. package/assets/{index-BlzBJCBk.css → index-89Me1z_W.css} +1 -1
  24. package/assets/{index-C9cg4O1G.js → index-B71dGBzR.js} +1 -1
  25. package/assets/{index-CzWZM_Xn.js → index-BAS0Ns7I.js} +1 -1
  26. package/assets/{index-g6IkFXl6.js → index-BAhhOFmz.js} +1 -1
  27. package/assets/index-BEKUvHaM.css +1 -0
  28. package/assets/{index-BvEd9UFa.js → index-BHvaRufS.js} +1 -1
  29. package/assets/{index-BYe-BrLx.js → index-BJVT5erM.js} +1 -1
  30. package/assets/index-BJfLTeYI.css +1 -0
  31. package/assets/{index-xeNI-sul.js → index-B_GOUZAB.js} +1 -1
  32. package/assets/{index-BrBCHOe4.js → index-B_Tlnyoa.js} +1 -1
  33. package/assets/{index-CR7Ij6lz.js → index-BhY1HXiS.js} +1 -1
  34. package/assets/{index-CcMbrywa.js → index-Bm6kG0Bo.js} +1 -1
  35. package/assets/{index-CaOeGZDQ.js → index-Bud75fOi.js} +1 -1
  36. package/assets/{index-Db_urTlf.css → index-C9oAPMqV.css} +7 -7
  37. package/assets/{index-CU5Zz03o.js → index-CHukA1by.js} +1 -1
  38. package/assets/{index-C5utrJrI.css → index-CKNejNzs.css} +1 -1
  39. package/assets/{index-Dal_XZcP.js → index-CSfVv_GL.js} +1 -1
  40. package/assets/{index-B75IRI8j.js → index-CVaJbOR8.js} +1 -1
  41. package/assets/index-C_dk2KKg.js +2 -0
  42. package/assets/{index-BfhfbjsI.js → index-CcueynFC.js} +1 -1
  43. package/assets/{index-CJrsLA__.js → index-CfAUTrd7.js} +1 -1
  44. package/assets/{index-DUc4VmF0.js → index-Cqh_t3sv.js} +1 -1
  45. package/assets/{index-C4iDnHzQ.js → index-CsUO7lHH.js} +1 -1
  46. package/assets/{index-BKK3ugfo.js → index-D2cqdHUa.js} +1 -1
  47. package/assets/{index-CKgGhN0e.js → index-D3jRON8g.js} +1 -1
  48. package/assets/{index-CTfA02Fv.js → index-D4wCFw-m.js} +1 -1
  49. package/assets/{index-BSn7FPUk.js → index-D6xkDbPC.js} +1 -1
  50. package/assets/index-D7HXnoZL.css +1 -0
  51. package/assets/{index-CR4G-DF6.js → index-D7T1WYbd.js} +1 -1
  52. package/assets/index-DT_ZZZaY.js +1 -0
  53. package/assets/{index-BTpC11Oq.js → index-DUwCx8TQ.js} +1 -1
  54. package/assets/{index-BeIUTgzC.js → index-DZePS7vG.js} +1 -1
  55. package/assets/{index-DBzbK1MF.js → index-DeDvwVqX.js} +1 -1
  56. package/assets/{index-nH65R0Ne.js → index-DhMu8MNt.js} +1 -1
  57. package/assets/{index-285OW5UD.js → index-Dkix4Zqt.js} +1 -1
  58. package/assets/{index-CJSWaccM.js → index-DmimCfcy.js} +1 -1
  59. package/assets/{index-MESwJQyA.js → index-DoOvQ7xc.js} +1 -1
  60. package/assets/{index-DMVn9XTQ.js → index-GC4nkNM6.js} +1 -1
  61. package/assets/{index-C2Y2eZ28.js → index-KAz1FpF_.js} +109 -109
  62. package/assets/{index-Bv5zwwVy.js → index-MM2OWEeF.js} +1 -1
  63. package/assets/{index-5MfovQ0h.js → index-NLCY1t4y.js} +1 -1
  64. package/assets/{index-C6KkvWBP.js → index-Td_t8HC1.js} +1 -1
  65. package/assets/{index-DvBGq_qU.js → index-XaOQyGC7.js} +1 -1
  66. package/assets/{index-GJXVneNz.js → index-dSnIfUoF.js} +1 -1
  67. package/assets/{index-BmBjMJGp.js → index-mVHnkPZ6.js} +1 -1
  68. package/assets/{index-BRnDLGtf.js → index-sGd1uZfw.js} +1 -1
  69. package/assets/index-tiHLy8Gb.js +1 -0
  70. package/assets/index-xSzGqmcU.css +1 -0
  71. package/assets/index-yNW484k2.js +1 -0
  72. package/assets/{index.es-I-3UUEct.js → index.es-BCUNOvbq.js} +4 -4
  73. package/assets/{selectors-Zkd3yj1l.js → selectors-CNQHtVVh.js} +1 -1
  74. package/index.html +3 -3
  75. package/package.json +3 -3
  76. package/assets/index-BKXwZXjK.css +0 -1
  77. package/assets/index-C2C0FpAa.css +0 -1
  78. package/assets/index-CFGFIaXM.js +0 -1
  79. package/assets/index-DKVSkEva.js +0 -1
  80. package/assets/index-Df2XL9vC.js +0 -2
  81. package/assets/index-DgBSAmDq.css +0 -1
  82. package/assets/index-Door2Ali.js +0 -1
  83. package/assets/index-oit6oKkQ.css +0 -1
@@ -1 +1 @@
1
- import{K as Wr,$ as qr,B as Kr,m as Vr,q as Xr,J as Ye}from"./index-Dal_XZcP.js";import{g as st,R as lt,T as dt,k as vt,E as ht,a as yt,V as pt,s as mt,I as bt,b as gt,c as _t,N as wt,f as It,d as Et,v as St,_ as Ot,e as jt,h as Nt,O as At,y as Bt,A as kt,i as xt,W as Dt,p as Rt,U as Ct,L as Lt,u as Mt,x as Tt}from"./index-Dal_XZcP.js";import"./index-C2Y2eZ28.js";var se={},Yr=Object.create,Qe=Object.defineProperty,Jr=Object.getOwnPropertyDescriptor,Qr=Object.getOwnPropertyNames,Zr=Object.getPrototypeOf,Hr=Object.prototype.hasOwnProperty,pe=(_=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(_,{get:(O,m)=>(typeof require<"u"?require:O)[m]}):_)(function(_){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+_+'" is not supported')}),Ze=(_,O)=>()=>(O||_((O={exports:{}}).exports,O),O.exports),Gr=(_,O,m,x)=>{if(O&&typeof O=="object"||typeof O=="function")for(let q of Qr(O))!Hr.call(_,q)&&q!==m&&Qe(_,q,{get:()=>O[q],enumerable:!(x=Jr(O,q))||x.enumerable});return _},He=(_,O,m)=>(m=_!=null?Yr(Zr(_)):{},Gr(!_||!_.__esModule?Qe(m,"default",{value:_,enumerable:!0}):m,_)),me=(_,O,m)=>new Promise((x,q)=>{var C=D=>{try{j(m.next(D))}catch(L){q(L)}},P=D=>{try{j(m.throw(D))}catch(L){q(L)}},j=D=>D.done?x(D.value):Promise.resolve(D.value).then(C,P);j((m=m.apply(_,O)).next())}),$r=Ze((_,O)=>{(function(m){if(typeof _=="object"&&typeof O<"u")O.exports=m();else if(typeof define=="function"&&define.amd)define([],m);else{var x;typeof window<"u"?x=window:typeof se<"u"?x=se:typeof self<"u"?x=self:x=this,x.localforage=m()}})(function(){return function m(x,q,C){function P(L,Y){if(!q[L]){if(!x[L]){var y=typeof pe=="function"&&pe;if(!Y&&y)return y(L,!0);if(j)return j(L,!0);var w=new Error("Cannot find module '"+L+"'");throw w.code="MODULE_NOT_FOUND",w}var z=q[L]={exports:{}};x[L][0].call(z.exports,function(F){var Z=x[L][1][F];return P(Z||F)},z,z.exports,m,x,q,C)}return q[L].exports}for(var j=typeof pe=="function"&&pe,D=0;D<C.length;D++)P(C[D]);return P}({1:[function(m,x,q){(function(C){var P=C.MutationObserver||C.WebKitMutationObserver,j;if(P){var D=0,L=new P(F),Y=C.document.createTextNode("");L.observe(Y,{characterData:!0}),j=function(){Y.data=D=++D%2}}else if(!C.setImmediate&&typeof C.MessageChannel<"u"){var y=new C.MessageChannel;y.port1.onmessage=F,j=function(){y.port2.postMessage(0)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?j=function(){var A=C.document.createElement("script");A.onreadystatechange=function(){F(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},C.document.documentElement.appendChild(A)}:j=function(){setTimeout(F,0)};var w,z=[];function F(){w=!0;for(var A,G,U=z.length;U;){for(G=z,z=[],A=-1;++A<U;)G[A]();U=z.length}w=!1}x.exports=Z;function Z(A){z.push(A)===1&&!w&&j()}}).call(this,typeof se<"u"?se:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(m,x,q){var C=m(1);function P(){}var j={},D=["REJECTED"],L=["FULFILLED"],Y=["PENDING"];x.exports=y;function y(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=Y,this.queue=[],this.outcome=void 0,v!==P&&Z(this,v)}y.prototype.catch=function(v){return this.then(null,v)},y.prototype.then=function(v,N){if(typeof v!="function"&&this.state===L||typeof N!="function"&&this.state===D)return this;var E=new this.constructor(P);if(this.state!==Y){var B=this.state===L?v:N;z(E,B,this.outcome)}else this.queue.push(new w(E,v,N));return E};function w(v,N,E){this.promise=v,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}w.prototype.callFulfilled=function(v){j.resolve(this.promise,v)},w.prototype.otherCallFulfilled=function(v){z(this.promise,this.onFulfilled,v)},w.prototype.callRejected=function(v){j.reject(this.promise,v)},w.prototype.otherCallRejected=function(v){z(this.promise,this.onRejected,v)};function z(v,N,E){C(function(){var B;try{B=N(E)}catch(K){return j.reject(v,K)}B===v?j.reject(v,new TypeError("Cannot resolve promise with itself")):j.resolve(v,B)})}j.resolve=function(v,N){var E=A(F,N);if(E.status==="error")return j.reject(v,E.value);var B=E.value;if(B)Z(v,B);else{v.state=L,v.outcome=N;for(var K=-1,X=v.queue.length;++K<X;)v.queue[K].callFulfilled(N)}return v},j.reject=function(v,N){v.state=D,v.outcome=N;for(var E=-1,B=v.queue.length;++E<B;)v.queue[E].callRejected(N);return v};function F(v){var N=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof N=="function")return function(){N.apply(v,arguments)}}function Z(v,N){var E=!1;function B(Q){E||(E=!0,j.reject(v,Q))}function K(Q){E||(E=!0,j.resolve(v,Q))}function X(){N(K,B)}var J=A(X);J.status==="error"&&B(J.value)}function A(v,N){var E={};try{E.value=v(N),E.status="success"}catch(B){E.status="error",E.value=B}return E}y.resolve=G;function G(v){return v instanceof this?v:j.resolve(new this(P),v)}y.reject=U;function U(v){var N=new this(P);return j.reject(N,v)}y.all=oe;function oe(v){var N=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=v.length,B=!1;if(!E)return this.resolve([]);for(var K=new Array(E),X=0,J=-1,Q=new this(P);++J<E;)$(v[J],J);return Q;function $(ie,ue){N.resolve(ie).then(le,function(re){B||(B=!0,j.reject(Q,re))});function le(re){K[ue]=re,++X===E&&!B&&(B=!0,j.resolve(Q,K))}}}y.race=ee;function ee(v){var N=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=v.length,B=!1;if(!E)return this.resolve([]);for(var K=-1,X=new this(P);++K<E;)J(v[K]);return X;function J(Q){N.resolve(Q).then(function($){B||(B=!0,j.resolve(X,$))},function($){B||(B=!0,j.reject(X,$))})}}},{1:1}],3:[function(m,x,q){(function(C){typeof C.Promise!="function"&&(C.Promise=m(2))}).call(this,typeof se<"u"?se:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(m,x,q){var C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function P(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function j(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var D=j();function L(){try{if(!D||!D.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!e||r)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function Y(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(i){if(i.name!=="TypeError")throw i;for(var t=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,o=new t,n=0;n<e.length;n+=1)o.append(e[n]);return o.getBlob(r.type)}}typeof Promise>"u"&&m(3);var y=Promise;function w(e,r){r&&e.then(function(t){r(null,t)},function(t){r(t)})}function z(e,r,t){typeof r=="function"&&e.then(r),typeof t=="function"&&e.catch(t)}function F(e){return typeof e!="string"&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function Z(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",G=void 0,U={},oe=Object.prototype.toString,ee="readonly",v="readwrite";function N(e){for(var r=e.length,t=new ArrayBuffer(r),o=new Uint8Array(t),n=0;n<r;n++)o[n]=e.charCodeAt(n);return t}function E(e){return new y(function(r){var t=e.transaction(A,v),o=Y([""]);t.objectStore(A).put(o,"key"),t.onabort=function(n){n.preventDefault(),n.stopPropagation(),r(!1)},t.oncomplete=function(){var n=navigator.userAgent.match(/Chrome\/(\d+)/),i=navigator.userAgent.match(/Edge\//);r(i||!n||parseInt(n[1],10)>=43)}}).catch(function(){return!1})}function B(e){return typeof G=="boolean"?y.resolve(G):E(e).then(function(r){return G=r,G})}function K(e){var r=U[e.name],t={};t.promise=new y(function(o,n){t.resolve=o,t.reject=n}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise}function X(e){var r=U[e.name],t=r.deferredOperations.pop();if(t)return t.resolve(),t.promise}function J(e,r){var t=U[e.name],o=t.deferredOperations.pop();if(o)return o.reject(r),o.promise}function Q(e,r){return new y(function(t,o){if(U[e.name]=U[e.name]||g(),e.db)if(r)K(e),e.db.close();else return t(e.db);var n=[e.name];r&&n.push(e.version);var i=D.open.apply(D,n);r&&(i.onupgradeneeded=function(u){var c=i.result;try{c.createObjectStore(e.storeName),u.oldVersion<=1&&c.createObjectStore(A)}catch(d){if(d.name==="ConstraintError")console.warn('The database "'+e.name+'" has been upgraded from version '+u.oldVersion+" to version "+u.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw d}}),i.onerror=function(u){u.preventDefault(),o(i.error)},i.onsuccess=function(){var u=i.result;u.onversionchange=function(c){c.target.close()},t(u),X(e)}})}function $(e){return Q(e,!1)}function ie(e){return Q(e,!0)}function ue(e,r){if(!e.db)return!0;var t=!e.db.objectStoreNames.contains(e.storeName),o=e.version<e.db.version,n=e.version>e.db.version;if(o&&(e.version!==r&&console.warn('The database "'+e.name+`" can't be downgraded from version `+e.db.version+" to version "+e.version+"."),e.version=e.db.version),n||t){if(t){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function le(e){return new y(function(r,t){var o=new FileReader;o.onerror=t,o.onloadend=function(n){var i=btoa(n.target.result||"");r({__local_forage_encoded_blob:!0,data:i,type:e.type})},o.readAsBinaryString(e)})}function re(e){var r=N(atob(e.data));return Y([r],{type:e.type})}function a(e){return e&&e.__local_forage_encoded_blob}function f(e){var r=this,t=r._initReady().then(function(){var o=U[r._dbInfo.name];if(o&&o.dbReady)return o.dbReady});return z(t,e,e),t}function h(e){K(e);for(var r=U[e.name],t=r.forages,o=0;o<t.length;o++){var n=t[o];n._dbInfo.db&&(n._dbInfo.db.close(),n._dbInfo.db=null)}return e.db=null,$(e).then(function(i){return e.db=i,ue(e)?ie(e):i}).then(function(i){e.db=r.db=i;for(var u=0;u<t.length;u++)t[u]._dbInfo.db=i}).catch(function(i){throw J(e,i),i})}function p(e,r,t,o){o===void 0&&(o=1);try{var n=e.db.transaction(e.storeName,r);t(null,n)}catch(i){if(o>0&&(!e.db||i.name==="InvalidStateError"||i.name==="NotFoundError"))return y.resolve().then(function(){if(!e.db||i.name==="NotFoundError"&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ie(e)}).then(function(){return h(e).then(function(){p(e,r,t,o-1)})}).catch(t);t(i)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function I(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=e[o];var n=U[t.name];n||(n=g(),U[t.name]=n),n.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=f);var i=[];function u(){return y.resolve()}for(var c=0;c<n.forages.length;c++){var d=n.forages[c];d!==r&&i.push(d._initReady().catch(u))}var l=n.forages.slice(0);return y.all(i).then(function(){return t.db=n.db,$(t)}).then(function(s){return t.db=s,ue(t,r._defaultConfig.version)?ie(t):s}).then(function(s){t.db=n.db=s,r._dbInfo=t;for(var b=0;b<l.length;b++){var S=l[b];S!==r&&(S._dbInfo.db=t.db,S._dbInfo.version=t.version)}})}function M(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){p(t._dbInfo,ee,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=d.get(e);l.onsuccess=function(){var s=l.result;s===void 0&&(s=null),a(s)&&(s=re(s)),n(s)},l.onerror=function(){i(l.error)}}catch(s){i(s)}})}).catch(i)});return w(o,r),o}function V(e,r){var t=this,o=new y(function(n,i){t.ready().then(function(){p(t._dbInfo,ee,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=d.openCursor(),s=1;l.onsuccess=function(){var b=l.result;if(b){var S=b.value;a(S)&&(S=re(S));var R=e(S,b.key,s++);R!==void 0?n(R):b.continue()}else n()},l.onerror=function(){i(l.error)}}catch(b){i(b)}})}).catch(i)});return w(o,r),o}function ce(e,r,t){var o=this;e=F(e);var n=new y(function(i,u){var c;o.ready().then(function(){return c=o._dbInfo,oe.call(r)==="[object Blob]"?B(c.db).then(function(d){return d?r:le(r)}):r}).then(function(d){p(o._dbInfo,v,function(l,s){if(l)return u(l);try{var b=s.objectStore(o._dbInfo.storeName);d===null&&(d=void 0);var S=b.put(d,e);s.oncomplete=function(){d===void 0&&(d=null),i(d)},s.onabort=s.onerror=function(){var R=S.error?S.error:S.transaction.error;u(R)}}catch(R){u(R)}})}).catch(u)});return w(n,t),n}function ae(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){p(t._dbInfo,v,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=d.delete(e);c.oncomplete=function(){n()},c.onerror=function(){i(l.error)},c.onabort=function(){var s=l.error?l.error:l.transaction.error;i(s)}}catch(s){i(s)}})}).catch(i)});return w(o,r),o}function de(e){var r=this,t=new y(function(o,n){r.ready().then(function(){p(r._dbInfo,v,function(i,u){if(i)return n(i);try{var c=u.objectStore(r._dbInfo.storeName),d=c.clear();u.oncomplete=function(){o()},u.onabort=u.onerror=function(){var l=d.error?d.error:d.transaction.error;n(l)}}catch(l){n(l)}})}).catch(n)});return w(t,e),t}function Ge(e){var r=this,t=new y(function(o,n){r.ready().then(function(){p(r._dbInfo,ee,function(i,u){if(i)return n(i);try{var c=u.objectStore(r._dbInfo.storeName),d=c.count();d.onsuccess=function(){o(d.result)},d.onerror=function(){n(d.error)}}catch(l){n(l)}})}).catch(n)});return w(t,e),t}function $e(e,r){var t=this,o=new y(function(n,i){if(e<0){n(null);return}t.ready().then(function(){p(t._dbInfo,ee,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=!1,s=d.openKeyCursor();s.onsuccess=function(){var b=s.result;if(!b){n(null);return}e===0||l?n(b.key):(l=!0,b.advance(e))},s.onerror=function(){i(s.error)}}catch(b){i(b)}})}).catch(i)});return w(o,r),o}function er(e){var r=this,t=new y(function(o,n){r.ready().then(function(){p(r._dbInfo,ee,function(i,u){if(i)return n(i);try{var c=u.objectStore(r._dbInfo.storeName),d=c.openKeyCursor(),l=[];d.onsuccess=function(){var s=d.result;if(!s){o(l);return}l.push(s.key),s.continue()},d.onerror=function(){n(d.error)}}catch(s){n(s)}})}).catch(n)});return w(t,e),t}function rr(e,r){r=Z.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,n;if(!e.name)n=y.reject("Invalid arguments");else{var i=e.name===t.name&&o._dbInfo.db,u=i?y.resolve(o._dbInfo.db):$(e).then(function(c){var d=U[e.name],l=d.forages;d.db=c;for(var s=0;s<l.length;s++)l[s]._dbInfo.db=c;return c});e.storeName?n=u.then(function(c){if(c.objectStoreNames.contains(e.storeName)){var d=c.version+1;K(e);var l=U[e.name],s=l.forages;c.close();for(var b=0;b<s.length;b++){var S=s[b];S._dbInfo.db=null,S._dbInfo.version=d}var R=new y(function(k,W){var T=D.open(e.name,d);T.onerror=function(H){var Oe=T.result;Oe.close(),W(H)},T.onupgradeneeded=function(){var H=T.result;H.deleteObjectStore(e.storeName)},T.onsuccess=function(){var H=T.result;H.close(),k(H)}});return R.then(function(k){l.db=k;for(var W=0;W<s.length;W++){var T=s[W];T._dbInfo.db=k,X(T._dbInfo)}}).catch(function(k){throw(J(e,k)||y.resolve()).catch(function(){}),k})}}):n=u.then(function(c){K(e);var d=U[e.name],l=d.forages;c.close();for(var s=0;s<l.length;s++){var b=l[s];b._dbInfo.db=null}var S=new y(function(R,k){var W=D.deleteDatabase(e.name);W.onerror=function(){var T=W.result;T&&T.close(),k(W.error)},W.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},W.onsuccess=function(){var T=W.result;T&&T.close(),R(T)}});return S.then(function(R){d.db=R;for(var k=0;k<l.length;k++){var W=l[k];X(W._dbInfo)}}).catch(function(R){throw(J(e,R)||y.resolve()).catch(function(){}),R})})}return w(n,r),n}var tr={_driver:"asyncStorage",_initStorage:I,_support:L(),iterate:V,getItem:M,setItem:ce,removeItem:ae,clear:de,length:Ge,key:$e,keys:er,dropInstance:rr};function nr(){return typeof openDatabase=="function"}var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",or="~~local_forage_type~",Ae=/^~~local_forage_type~([^~]+)~/,he="__lfsc__:",be=he.length,ge="arbf",_e="blob",Be="si08",ke="ui08",xe="uic8",De="si16",Re="si32",Ce="ur16",Le="ui32",Me="fl32",Te="fl64",ze=be+ge.length,Fe=Object.prototype.toString;function Pe(e){var r=e.length*.75,t=e.length,o,n=0,i,u,c,d;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var l=new ArrayBuffer(r),s=new Uint8Array(l);for(o=0;o<t;o+=4)i=te.indexOf(e[o]),u=te.indexOf(e[o+1]),c=te.indexOf(e[o+2]),d=te.indexOf(e[o+3]),s[n++]=i<<2|u>>4,s[n++]=(u&15)<<4|c>>2,s[n++]=(c&3)<<6|d&63;return l}function we(e){var r=new Uint8Array(e),t="",o;for(o=0;o<r.length;o+=3)t+=te[r[o]>>2],t+=te[(r[o]&3)<<4|r[o+1]>>4],t+=te[(r[o+1]&15)<<2|r[o+2]>>6],t+=te[r[o+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+"=":r.length%3===1&&(t=t.substring(0,t.length-2)+"=="),t}function ir(e,r){var t="";if(e&&(t=Fe.call(e)),e&&(t==="[object ArrayBuffer]"||e.buffer&&Fe.call(e.buffer)==="[object ArrayBuffer]")){var o,n=he;e instanceof ArrayBuffer?(o=e,n+=ge):(o=e.buffer,t==="[object Int8Array]"?n+=Be:t==="[object Uint8Array]"?n+=ke:t==="[object Uint8ClampedArray]"?n+=xe:t==="[object Int16Array]"?n+=De:t==="[object Uint16Array]"?n+=Ce:t==="[object Int32Array]"?n+=Re:t==="[object Uint32Array]"?n+=Le:t==="[object Float32Array]"?n+=Me:t==="[object Float64Array]"?n+=Te:r(new Error("Failed to get type for BinaryArray"))),r(n+we(o))}else if(t==="[object Blob]"){var i=new FileReader;i.onload=function(){var u=or+e.type+"~"+we(this.result);r(he+_e+u)},i.readAsArrayBuffer(e)}else try{r(JSON.stringify(e))}catch(u){console.error("Couldn't convert value into a JSON string: ",e),r(null,u)}}function ar(e){if(e.substring(0,be)!==he)return JSON.parse(e);var r=e.substring(ze),t=e.substring(be,ze),o;if(t===_e&&Ae.test(r)){var n=r.match(Ae);o=n[1],r=r.substring(n[0].length)}var i=Pe(r);switch(t){case ge:return i;case _e:return Y([i],{type:o});case Be:return new Int8Array(i);case ke:return new Uint8Array(i);case xe:return new Uint8ClampedArray(i);case De:return new Int16Array(i);case Ce:return new Uint16Array(i);case Re:return new Int32Array(i);case Le:return new Uint32Array(i);case Me:return new Float32Array(i);case Te:return new Float64Array(i);default:throw new Error("Unkown type: "+t)}}var Ie={serialize:ir,deserialize:ar,stringToBuffer:Pe,bufferToString:we};function Ue(e,r,t,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+r.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],t,o)}function ur(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=typeof e[o]!="string"?e[o].toString():e[o];var n=new y(function(i,u){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size)}catch(c){return u(c)}t.db.transaction(function(c){Ue(c,t,function(){r._dbInfo=t,i()},function(d,l){u(l)})},u)});return t.serializer=Ie,n}function ne(e,r,t,o,n,i){e.executeSql(t,o,n,function(u,c){c.code===c.SYNTAX_ERR?u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[r.storeName],function(d,l){l.rows.length?i(d,c):Ue(d,r,function(){d.executeSql(t,o,n,i)},i)},i):i(u,c)},i)}function cr(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"SELECT * FROM "+u.storeName+" WHERE key = ? LIMIT 1",[e],function(d,l){var s=l.rows.length?l.rows.item(0).value:null;s&&(s=u.serializer.deserialize(s)),n(s)},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function fr(e,r){var t=this,o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"SELECT * FROM "+u.storeName,[],function(d,l){for(var s=l.rows,b=s.length,S=0;S<b;S++){var R=s.item(S),k=R.value;if(k&&(k=u.serializer.deserialize(k)),k=e(k,R.key,S+1),k!==void 0){n(k);return}}n()},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function We(e,r,t,o){var n=this;e=F(e);var i=new y(function(u,c){n.ready().then(function(){r===void 0&&(r=null);var d=r,l=n._dbInfo;l.serializer.serialize(r,function(s,b){b?c(b):l.db.transaction(function(S){ne(S,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,s],function(){u(d)},function(R,k){c(k)})},function(S){if(S.code===S.QUOTA_ERR){if(o>0){u(We.apply(n,[e,d,t,o-1]));return}c(S)}})})}).catch(c)});return w(i,t),i}function sr(e,r,t){return We.apply(this,[e,r,t,1])}function lr(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"DELETE FROM "+u.storeName+" WHERE key = ?",[e],function(){n()},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function dr(e){var r=this,t=new y(function(o,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(u){ne(u,i,"DELETE FROM "+i.storeName,[],function(){o()},function(c,d){n(d)})})}).catch(n)});return w(t,e),t}function vr(e){var r=this,t=new y(function(o,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(u){ne(u,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],function(c,d){var l=d.rows.item(0).c;o(l)},function(c,d){n(d)})})}).catch(n)});return w(t,e),t}function hr(e,r){var t=this,o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"SELECT key FROM "+u.storeName+" WHERE id = ? LIMIT 1",[e+1],function(d,l){var s=l.rows.length?l.rows.item(0).key:null;n(s)},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function yr(e){var r=this,t=new y(function(o,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(u){ne(u,i,"SELECT key FROM "+i.storeName,[],function(c,d){for(var l=[],s=0;s<d.rows.length;s++)l.push(d.rows.item(s).key);o(l)},function(c,d){n(d)})})}).catch(n)});return w(t,e),t}function pr(e){return new y(function(r,t){e.transaction(function(o){o.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,i){for(var u=[],c=0;c<i.rows.length;c++)u.push(i.rows.item(c).name);r({db:e,storeNames:u})},function(n,i){t(i)})},function(o){t(o)})})}function mr(e,r){r=Z.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,n;return e.name?n=new y(function(i){var u;e.name===t.name?u=o._dbInfo.db:u=openDatabase(e.name,"","",0),e.storeName?i({db:u,storeNames:[e.storeName]}):i(pr(u))}).then(function(i){return new y(function(u,c){i.db.transaction(function(d){function l(R){return new y(function(k,W){d.executeSql("DROP TABLE IF EXISTS "+R,[],function(){k()},function(T,H){W(H)})})}for(var s=[],b=0,S=i.storeNames.length;b<S;b++)s.push(l(i.storeNames[b]));y.all(s).then(function(){u()}).catch(function(R){c(R)})},function(d){c(d)})})}):n=y.reject("Invalid arguments"),w(n,r),n}var br={_driver:"webSQLStorage",_initStorage:ur,_support:nr(),iterate:fr,getItem:cr,setItem:sr,removeItem:lr,clear:dr,length:vr,key:hr,keys:yr,dropInstance:mr};function gr(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function qe(e,r){var t=e.name+"/";return e.storeName!==r.storeName&&(t+=e.storeName+"/"),t}function _r(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}function wr(){return!_r()||localStorage.length>0}function Ir(e){var r=this,t={};if(e)for(var o in e)t[o]=e[o];return t.keyPrefix=qe(e,r._defaultConfig),wr()?(r._dbInfo=t,t.serializer=Ie,y.resolve()):y.reject()}function Er(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);i.indexOf(o)===0&&localStorage.removeItem(i)}});return w(t,e),t}function Sr(e,r){var t=this;e=F(e);var o=t.ready().then(function(){var n=t._dbInfo,i=localStorage.getItem(n.keyPrefix+e);return i&&(i=n.serializer.deserialize(i)),i});return w(o,r),o}function Or(e,r){var t=this,o=t.ready().then(function(){for(var n=t._dbInfo,i=n.keyPrefix,u=i.length,c=localStorage.length,d=1,l=0;l<c;l++){var s=localStorage.key(l);if(s.indexOf(i)===0){var b=localStorage.getItem(s);if(b&&(b=n.serializer.deserialize(b)),b=e(b,s.substring(u),d++),b!==void 0)return b}}});return w(o,r),o}function jr(e,r){var t=this,o=t.ready().then(function(){var n=t._dbInfo,i;try{i=localStorage.key(e)}catch{i=null}return i&&(i=i.substring(n.keyPrefix.length)),i});return w(o,r),o}function Nr(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo,n=localStorage.length,i=[],u=0;u<n;u++){var c=localStorage.key(u);c.indexOf(o.keyPrefix)===0&&i.push(c.substring(o.keyPrefix.length))}return i});return w(t,e),t}function Ar(e){var r=this,t=r.keys().then(function(o){return o.length});return w(t,e),t}function Br(e,r){var t=this;e=F(e);var o=t.ready().then(function(){var n=t._dbInfo;localStorage.removeItem(n.keyPrefix+e)});return w(o,r),o}function kr(e,r,t){var o=this;e=F(e);var n=o.ready().then(function(){r===void 0&&(r=null);var i=r;return new y(function(u,c){var d=o._dbInfo;d.serializer.serialize(r,function(l,s){if(s)c(s);else try{localStorage.setItem(d.keyPrefix+e,l),u(i)}catch(b){(b.name==="QuotaExceededError"||b.name==="NS_ERROR_DOM_QUOTA_REACHED")&&c(b),c(b)}})})});return w(n,t),n}function xr(e,r){if(r=Z.apply(this,arguments),e=typeof e!="function"&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName}var o=this,n;return e.name?n=new y(function(i){e.storeName?i(qe(e,o._defaultConfig)):i(e.name+"/")}).then(function(i){for(var u=localStorage.length-1;u>=0;u--){var c=localStorage.key(u);c.indexOf(i)===0&&localStorage.removeItem(c)}}):n=y.reject("Invalid arguments"),w(n,r),n}var Dr={_driver:"localStorageWrapper",_initStorage:Ir,_support:gr(),iterate:Or,getItem:Sr,setItem:kr,removeItem:Br,clear:Er,length:Ar,key:jr,keys:Nr,dropInstance:xr},Rr=function(e,r){return e===r||typeof e=="number"&&typeof r=="number"&&isNaN(e)&&isNaN(r)},Cr=function(e,r){for(var t=e.length,o=0;o<t;){if(Rr(e[o],r))return!0;o++}return!1},Ke=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},ve={},Ve={},fe={INDEXEDDB:tr,WEBSQL:br,LOCALSTORAGE:Dr},Lr=[fe.INDEXEDDB._driver,fe.WEBSQL._driver,fe.LOCALSTORAGE._driver],ye=["dropInstance"],Ee=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ye),Mr={description:"",driver:Lr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Tr(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})}}function Se(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(Ke(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t])}return arguments[0]}var zr=function(){function e(r){P(this,e);for(var t in fe)if(fe.hasOwnProperty(t)){var o=fe[t],n=o._driver;this[t]=n,ve[n]||this.defineDriver(o)}this._defaultConfig=Se({},Mr),this._config=Se({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(r){if((typeof r>"u"?"undefined":C(r))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in r){if(t==="storeName"&&(r[t]=r[t].replace(/\W/g,"_")),t==="version"&&typeof r[t]!="number")return new Error("Database version must be a number.");this._config[t]=r[t]}return"driver"in r&&r.driver?this.setDriver(this._config.driver):!0}else return typeof r=="string"?this._config[r]:this._config},e.prototype.defineDriver=function(r,t,o){var n=new y(function(i,u){try{var c=r._driver,d=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!r._driver){u(d);return}for(var l=Ee.concat("_initStorage"),s=0,b=l.length;s<b;s++){var S=l[s],R=!Cr(ye,S);if((R||r[S])&&typeof r[S]!="function"){u(d);return}}var k=function(){for(var T=function(Pr){return function(){var Ur=new Error("Method "+Pr+" is not implemented by the current driver"),Xe=y.reject(Ur);return w(Xe,arguments[arguments.length-1]),Xe}},H=0,Oe=ye.length;H<Oe;H++){var je=ye[H];r[je]||(r[je]=T(je))}};k();var W=function(T){ve[c]&&console.info("Redefining LocalForage driver: "+c),ve[c]=r,Ve[c]=T,i()};"_support"in r?r._support&&typeof r._support=="function"?r._support().then(W,u):W(!!r._support):W(!0)}catch(T){u(T)}});return z(n,t,o),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(r,t,o){var n=ve[r]?y.resolve(ve[r]):y.reject(new Error("Driver not found."));return z(n,t,o),n},e.prototype.getSerializer=function(r){var t=y.resolve(Ie);return z(t,r),t},e.prototype.ready=function(r){var t=this,o=t._driverSet.then(function(){return t._ready===null&&(t._ready=t._initDriver()),t._ready});return z(o,r,r),o},e.prototype.setDriver=function(r,t,o){var n=this;Ke(r)||(r=[r]);var i=this._getSupportedDrivers(r);function u(){n._config.driver=n.driver()}function c(s){return n._extend(s),u(),n._ready=n._initStorage(n._config),n._ready}function d(s){return function(){var b=0;function S(){for(;b<s.length;){var R=s[b];return b++,n._dbInfo=null,n._ready=null,n.getDriver(R).then(c).catch(S)}u();var k=new Error("No available storage method found.");return n._driverSet=y.reject(k),n._driverSet}return S()}}var l=this._driverSet!==null?this._driverSet.catch(function(){return y.resolve()}):y.resolve();return this._driverSet=l.then(function(){var s=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(s).then(function(b){n._driver=b._driver,u(),n._wrapLibraryMethodsWithReady(),n._initDriver=d(i)})}).catch(function(){u();var s=new Error("No available storage method found.");return n._driverSet=y.reject(s),n._driverSet}),z(this._driverSet,t,o),this._driverSet},e.prototype.supports=function(r){return!!Ve[r]},e.prototype._extend=function(r){Se(this,r)},e.prototype._getSupportedDrivers=function(r){for(var t=[],o=0,n=r.length;o<n;o++){var i=r[o];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var r=0,t=Ee.length;r<t;r++)Tr(this,Ee[r])},e.prototype.createInstance=function(r){return new e(r)},e}(),Fr=new zr;x.exports=Fr},{3:3}]},{},[4])(4)})}),et=Ze((_,O)=>{(function(m,x){typeof _=="object"&&typeof O<"u"?x(_):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],x):x(m.LocalforageDriverMemory={})})(typeof self<"u"?self:_,function(m){var x="localforage-driver-memory";function q(a){var f=typeof Symbol=="function"&&a[Symbol.iterator],h=0;return f?f.call(a):{next:function(){return a&&h>=a.length&&(a=void 0),{value:a&&a[h++],done:!a}}}}function C(a,f){a=a||[],f=f||{};try{return new Blob(a,f)}catch(I){if(I.name!=="TypeError")throw I;for(var h=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,p=new h,g=0;g<a.length;g+=1)p.append(a[g]);return p.getBlob(f.type)}}var P=/^~~local_forage_type~([^~]+)~/,j=9,D=j+4,L=Object.prototype.toString;function Y(a){var f=a.length*.75,h=a.length;a[a.length-1]==="="&&(f--,a[a.length-2]==="="&&f--);for(var p=new ArrayBuffer(f),g=new Uint8Array(p),I=0,M=0;I<h;I+=4){var V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I]),ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I+1]),ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I+2]),de="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I+3]);g[M++]=V<<2|ce>>4,g[M++]=(ce&15)<<4|ae>>2,g[M++]=(ae&3)<<6|de&63}return p}function y(a){for(var f=new Uint8Array(a),h="",p=0;p<f.length;p+=3)h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[f[p]>>2],h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(f[p]&3)<<4|f[p+1]>>4],h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(f[p+1]&15)<<2|f[p+2]>>6],h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[f[p+2]&63];return f.length%3===2?h=h.substring(0,h.length-1)+"=":f.length%3===1&&(h=h.substring(0,h.length-2)+"=="),h}function w(a,f){var h="";if(a&&(h=L.call(a)),a&&(h==="[object ArrayBuffer]"||a.buffer&&L.call(a.buffer)==="[object ArrayBuffer]")){var p=void 0,g="__lfsc__:";a instanceof ArrayBuffer?(p=a,g+="arbf"):(p=a.buffer,h==="[object Int8Array]"?g+="si08":h==="[object Uint8Array]"?g+="ui08":h==="[object Uint8ClampedArray]"?g+="uic8":h==="[object Int16Array]"?g+="si16":h==="[object Uint16Array]"?g+="ur16":h==="[object Int32Array]"?g+="si32":h==="[object Uint32Array]"?g+="ui32":h==="[object Float32Array]"?g+="fl32":h==="[object Float64Array]"?g+="fl64":f(new Error("Failed to get type for BinaryArray"))),f(g+y(p))}else if(h==="[object Blob]"){var I=new FileReader;I.onload=function(){var M="~~local_forage_type~"+a.type+"~"+y(this.result);f("__lfsc__:blob"+M)},I.readAsArrayBuffer(a)}else try{f(JSON.stringify(a))}catch(M){console.error("Couldn't convert value into a JSON string: ",a),f(null,M)}}function z(a){if(a.substring(0,j)!=="__lfsc__:")return JSON.parse(a);var f=a.substring(D),h=a.substring(j,D),p;if(h==="blob"&&P.test(f)){var g=f.match(P);p=g[1],f=f.substring(g[0].length)}var I=Y(f);switch(h){case"arbf":return I;case"blob":return C([I],{type:p});case"si08":return new Int8Array(I);case"ui08":return new Uint8Array(I);case"uic8":return new Uint8ClampedArray(I);case"si16":return new Int16Array(I);case"ur16":return new Uint16Array(I);case"si32":return new Int32Array(I);case"ui32":return new Uint32Array(I);case"fl32":return new Float32Array(I);case"fl64":return new Float64Array(I);default:throw new Error("Unkown type: "+h)}}function F(a){var f,h;if(a===null||typeof a!="object"||"isActiveClone"in a)return a;var p=a instanceof Date?new Date(a):a.constructor();try{for(var g=q(Object.keys(a)),I=g.next();!I.done;I=g.next()){var M=I.value;Object.prototype.hasOwnProperty.call(a,M)&&(a.isActiveClone=null,p[M]=F(a[M]),delete a.isActiveClone)}}catch(V){f={error:V}}finally{try{I&&!I.done&&(h=g.return)&&h.call(g)}finally{if(f)throw f.error}}return p}function Z(a,f){return(a.name||f.name)+"/"+(a.storeName||f.storeName)+"/"}function A(a,f){f&&a.then(function(h){f(null,h)},function(h){f(h)})}function G(){for(var a=[],f=0;f<arguments.length;f++)a[f]=arguments[f];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function U(a,f){var h=this;if(f=G.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var p=this.config();a.name=a.name||p.name,a.storeName=a.storeName||p.storeName}var g;return a.name?g=new Promise(function(I){a.storeName?I(Z(a,h._defaultConfig)):I(a.name+"/")}):g=Promise.reject("Invalid arguments"),{promise:g,callback:f}}function oe(a){return typeof a!="string"&&(console.warn(a+" used as a key, but it is not a string."),a=String(a)),a}var ee={bufferToString:y,deserialize:z,serialize:w,stringToBuffer:Y},v={},N=function(){function a(f){this.kp=f,this.data={}}return a.resolve=function(f){return v[f]||(v[f]=new a(f)),v[f]},a.prototype.clear=function(){this.data={}},a.prototype.drop=function(){this.clear(),delete v[this.kp]},a.prototype.get=function(f){return this.data[f]},a.prototype.key=function(f){return this.keys()[f]},a.prototype.keys=function(){return Object.keys(this.data)},a.prototype.rm=function(f){delete this.data[f]},a.prototype.set=function(f,h){this.data[f]=h},a}();function E(a){var f=a?F(a):{},h=Z(f,this._defaultConfig),p=N.resolve(h);return this._dbInfo=f,this._dbInfo.serializer=ee,this._dbInfo.keyPrefix=h,this._dbInfo.mStore=p,Promise.resolve()}function B(a){var f=this,h=this.ready().then(function(){f._dbInfo.mStore.clear()});return A(h,a),h}function K(a,f){var h=U.apply(this,arguments),p=h.promise,g=h.callback,I=p.then(function(M){N.resolve(M).drop()});return A(I,g),p}function X(a,f){var h=this;a=oe(a);var p=this.ready().then(function(){var g=h._dbInfo.mStore.get(a);return g==null?null:h._dbInfo.serializer.deserialize(g)});return A(p,f),p}function J(a,f){var h=this,p=this.ready().then(function(){for(var g=h._dbInfo.mStore,I=g.keys(),M=0;M<I.length;M++){var V=g.get(I[M]);if(V&&(V=h._dbInfo.serializer.deserialize(V)),V=a(V,I[M],M+1),V!==void 0)return V}});return A(p,f),p}function Q(a,f){var h=this,p=this.ready().then(function(){var g;try{g=h._dbInfo.mStore.key(a),g===void 0&&(g=null)}catch{g=null}return g});return A(p,f),p}function $(a){var f=this,h=this.ready().then(function(){return f._dbInfo.mStore.keys()});return A(h,a),h}function ie(a){var f=this.keys().then(function(h){return h.length});return A(f,a),f}function ue(a,f){var h=this;a=oe(a);var p=this.ready().then(function(){h._dbInfo.mStore.rm(a)});return A(p,f),p}function le(a,f,h){var p=this;a=oe(a);var g=this.ready().then(function(){f===void 0&&(f=null);var I=f;return new Promise(function(M,V){p._dbInfo.serializer.serialize(f,function(ce,ae){if(ae)V(ae);else try{p._dbInfo.mStore.set(a,ce),M(I)}catch(de){V(de)}})})});return A(g,h),g}var re=!0;m._support=re,m._driver=x,m._initStorage=E,m.clear=B,m.dropInstance=K,m.getItem=X,m.iterate=J,m.key=Q,m.keys=$,m.length=ie,m.removeItem=ue,m.setItem=le,Object.defineProperty(m,"__esModule",{value:!0})})}),Ne=He($r()),Je=He(et()),rt={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function tt(_){for(let[O,m]of Object.entries(rt))_.style[O]=m}function nt(_){return!![].slice.call(document.querySelectorAll(".magic-iframe")).find(m=>m.src.includes(_))}var ot=class extends Kr{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(_=>{let O=()=>{if(nt(encodeURIComponent(this.parameters)))Xr().log();else{let m=document.createElement("iframe");m.classList.add("magic-iframe"),m.dataset.magicIframeLabel=Ye(this.endpoint).host,m.title="Secure Modal",m.src=Ye(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,tt(m),document.body.appendChild(m),_(m)}};["loaded","interactive","complete"].includes(document.readyState)?O():window.addEventListener("load",O,!1)}),window.addEventListener("message",_=>{var O;if(_.origin===this.endpoint&&_.data&&_.data.msgType&&this.messageHandlers.size){_.data.response=(O=_.data.response)!=null?O:{};for(let m of this.messageHandlers.values())m(_)}})}showOverlay(){return me(this,null,function*(){let _=yield this.iframe;_.style.display="block",this.activeElement=document.activeElement,_.focus()})}hideOverlay(){return me(this,null,function*(){var _;let O=yield this.iframe;O.style.display="none",(_=this.activeElement)!=null&&_.focus&&this.activeElement.focus(),this.activeElement=null})}_post(_){return me(this,null,function*(){let O=yield this.iframe;if(O&&O.contentWindow)O.contentWindow.postMessage(_,this.endpoint);else throw Vr()})}},ut=Wr(qr,{platform:"web",sdkName:"magic-sdk",version:"27.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:ot,configureStorage:()=>me(void 0,null,function*(){let _=Ne.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield _.defineDriver(Je),yield _.setDriver([Ne.default.INDEXEDDB,Ne.default.LOCALSTORAGE,Je._driver]),_})});export{st as DeepLinkPage,lt as DeviceVerificationEventEmit,dt as DeviceVerificationEventOnReceived,vt as EthChainType,ht as Events,yt as Extension,pt as ExtensionError,mt as ExtensionWarning,bt as LoginWithEmailOTPEventEmit,gt as LoginWithEmailOTPEventOnReceived,_t as LoginWithMagicLinkEventEmit,wt as LoginWithMagicLinkEventOnReceived,ut as Magic,It as MagicIncomingWindowMessage,Et as MagicOutgoingWindowMessage,St as MagicPayloadMethod,Ot as RPCError,jt as RPCErrorCode,Nt as RecencyCheckEventEmit,At as RecencyCheckEventOnReceived,Bt as RecoveryMethodType,kt as SDKError,xt as SDKErrorCode,Dt as SDKWarning,Rt as SDKWarningCode,Ct as UpdateEmailEventEmit,Lt as UpdateEmailEventOnReceived,Mt as Wallets,Tt as isPromiEvent};
1
+ import{K as Wr,$ as qr,B as Kr,m as Vr,q as Xr,J as Ye}from"./index-CSfVv_GL.js";import{g as st,R as lt,T as dt,k as vt,E as ht,a as yt,V as pt,s as mt,I as bt,b as gt,c as _t,N as wt,f as It,d as Et,v as St,_ as Ot,e as jt,h as Nt,O as At,y as Bt,A as kt,i as xt,W as Dt,p as Rt,U as Ct,L as Lt,u as Mt,x as Tt}from"./index-CSfVv_GL.js";import"./index-KAz1FpF_.js";var se={},Yr=Object.create,Qe=Object.defineProperty,Jr=Object.getOwnPropertyDescriptor,Qr=Object.getOwnPropertyNames,Zr=Object.getPrototypeOf,Hr=Object.prototype.hasOwnProperty,pe=(_=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(_,{get:(O,m)=>(typeof require<"u"?require:O)[m]}):_)(function(_){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+_+'" is not supported')}),Ze=(_,O)=>()=>(O||_((O={exports:{}}).exports,O),O.exports),Gr=(_,O,m,x)=>{if(O&&typeof O=="object"||typeof O=="function")for(let q of Qr(O))!Hr.call(_,q)&&q!==m&&Qe(_,q,{get:()=>O[q],enumerable:!(x=Jr(O,q))||x.enumerable});return _},He=(_,O,m)=>(m=_!=null?Yr(Zr(_)):{},Gr(!_||!_.__esModule?Qe(m,"default",{value:_,enumerable:!0}):m,_)),me=(_,O,m)=>new Promise((x,q)=>{var C=D=>{try{j(m.next(D))}catch(L){q(L)}},P=D=>{try{j(m.throw(D))}catch(L){q(L)}},j=D=>D.done?x(D.value):Promise.resolve(D.value).then(C,P);j((m=m.apply(_,O)).next())}),$r=Ze((_,O)=>{(function(m){if(typeof _=="object"&&typeof O<"u")O.exports=m();else if(typeof define=="function"&&define.amd)define([],m);else{var x;typeof window<"u"?x=window:typeof se<"u"?x=se:typeof self<"u"?x=self:x=this,x.localforage=m()}})(function(){return function m(x,q,C){function P(L,Y){if(!q[L]){if(!x[L]){var y=typeof pe=="function"&&pe;if(!Y&&y)return y(L,!0);if(j)return j(L,!0);var w=new Error("Cannot find module '"+L+"'");throw w.code="MODULE_NOT_FOUND",w}var z=q[L]={exports:{}};x[L][0].call(z.exports,function(F){var Z=x[L][1][F];return P(Z||F)},z,z.exports,m,x,q,C)}return q[L].exports}for(var j=typeof pe=="function"&&pe,D=0;D<C.length;D++)P(C[D]);return P}({1:[function(m,x,q){(function(C){var P=C.MutationObserver||C.WebKitMutationObserver,j;if(P){var D=0,L=new P(F),Y=C.document.createTextNode("");L.observe(Y,{characterData:!0}),j=function(){Y.data=D=++D%2}}else if(!C.setImmediate&&typeof C.MessageChannel<"u"){var y=new C.MessageChannel;y.port1.onmessage=F,j=function(){y.port2.postMessage(0)}}else"document"in C&&"onreadystatechange"in C.document.createElement("script")?j=function(){var A=C.document.createElement("script");A.onreadystatechange=function(){F(),A.onreadystatechange=null,A.parentNode.removeChild(A),A=null},C.document.documentElement.appendChild(A)}:j=function(){setTimeout(F,0)};var w,z=[];function F(){w=!0;for(var A,G,U=z.length;U;){for(G=z,z=[],A=-1;++A<U;)G[A]();U=z.length}w=!1}x.exports=Z;function Z(A){z.push(A)===1&&!w&&j()}}).call(this,typeof se<"u"?se:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(m,x,q){var C=m(1);function P(){}var j={},D=["REJECTED"],L=["FULFILLED"],Y=["PENDING"];x.exports=y;function y(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=Y,this.queue=[],this.outcome=void 0,v!==P&&Z(this,v)}y.prototype.catch=function(v){return this.then(null,v)},y.prototype.then=function(v,N){if(typeof v!="function"&&this.state===L||typeof N!="function"&&this.state===D)return this;var E=new this.constructor(P);if(this.state!==Y){var B=this.state===L?v:N;z(E,B,this.outcome)}else this.queue.push(new w(E,v,N));return E};function w(v,N,E){this.promise=v,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof E=="function"&&(this.onRejected=E,this.callRejected=this.otherCallRejected)}w.prototype.callFulfilled=function(v){j.resolve(this.promise,v)},w.prototype.otherCallFulfilled=function(v){z(this.promise,this.onFulfilled,v)},w.prototype.callRejected=function(v){j.reject(this.promise,v)},w.prototype.otherCallRejected=function(v){z(this.promise,this.onRejected,v)};function z(v,N,E){C(function(){var B;try{B=N(E)}catch(K){return j.reject(v,K)}B===v?j.reject(v,new TypeError("Cannot resolve promise with itself")):j.resolve(v,B)})}j.resolve=function(v,N){var E=A(F,N);if(E.status==="error")return j.reject(v,E.value);var B=E.value;if(B)Z(v,B);else{v.state=L,v.outcome=N;for(var K=-1,X=v.queue.length;++K<X;)v.queue[K].callFulfilled(N)}return v},j.reject=function(v,N){v.state=D,v.outcome=N;for(var E=-1,B=v.queue.length;++E<B;)v.queue[E].callRejected(N);return v};function F(v){var N=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof N=="function")return function(){N.apply(v,arguments)}}function Z(v,N){var E=!1;function B(Q){E||(E=!0,j.reject(v,Q))}function K(Q){E||(E=!0,j.resolve(v,Q))}function X(){N(K,B)}var J=A(X);J.status==="error"&&B(J.value)}function A(v,N){var E={};try{E.value=v(N),E.status="success"}catch(B){E.status="error",E.value=B}return E}y.resolve=G;function G(v){return v instanceof this?v:j.resolve(new this(P),v)}y.reject=U;function U(v){var N=new this(P);return j.reject(N,v)}y.all=oe;function oe(v){var N=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=v.length,B=!1;if(!E)return this.resolve([]);for(var K=new Array(E),X=0,J=-1,Q=new this(P);++J<E;)$(v[J],J);return Q;function $(ie,ue){N.resolve(ie).then(le,function(re){B||(B=!0,j.reject(Q,re))});function le(re){K[ue]=re,++X===E&&!B&&(B=!0,j.resolve(Q,K))}}}y.race=ee;function ee(v){var N=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var E=v.length,B=!1;if(!E)return this.resolve([]);for(var K=-1,X=new this(P);++K<E;)J(v[K]);return X;function J(Q){N.resolve(Q).then(function($){B||(B=!0,j.resolve(X,$))},function($){B||(B=!0,j.reject(X,$))})}}},{1:1}],3:[function(m,x,q){(function(C){typeof C.Promise!="function"&&(C.Promise=m(2))}).call(this,typeof se<"u"?se:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(m,x,q){var C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function P(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function j(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var D=j();function L(){try{if(!D||!D.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!e||r)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function Y(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(i){if(i.name!=="TypeError")throw i;for(var t=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,o=new t,n=0;n<e.length;n+=1)o.append(e[n]);return o.getBlob(r.type)}}typeof Promise>"u"&&m(3);var y=Promise;function w(e,r){r&&e.then(function(t){r(null,t)},function(t){r(t)})}function z(e,r,t){typeof r=="function"&&e.then(r),typeof t=="function"&&e.catch(t)}function F(e){return typeof e!="string"&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function Z(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var A="local-forage-detect-blob-support",G=void 0,U={},oe=Object.prototype.toString,ee="readonly",v="readwrite";function N(e){for(var r=e.length,t=new ArrayBuffer(r),o=new Uint8Array(t),n=0;n<r;n++)o[n]=e.charCodeAt(n);return t}function E(e){return new y(function(r){var t=e.transaction(A,v),o=Y([""]);t.objectStore(A).put(o,"key"),t.onabort=function(n){n.preventDefault(),n.stopPropagation(),r(!1)},t.oncomplete=function(){var n=navigator.userAgent.match(/Chrome\/(\d+)/),i=navigator.userAgent.match(/Edge\//);r(i||!n||parseInt(n[1],10)>=43)}}).catch(function(){return!1})}function B(e){return typeof G=="boolean"?y.resolve(G):E(e).then(function(r){return G=r,G})}function K(e){var r=U[e.name],t={};t.promise=new y(function(o,n){t.resolve=o,t.reject=n}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise}function X(e){var r=U[e.name],t=r.deferredOperations.pop();if(t)return t.resolve(),t.promise}function J(e,r){var t=U[e.name],o=t.deferredOperations.pop();if(o)return o.reject(r),o.promise}function Q(e,r){return new y(function(t,o){if(U[e.name]=U[e.name]||g(),e.db)if(r)K(e),e.db.close();else return t(e.db);var n=[e.name];r&&n.push(e.version);var i=D.open.apply(D,n);r&&(i.onupgradeneeded=function(u){var c=i.result;try{c.createObjectStore(e.storeName),u.oldVersion<=1&&c.createObjectStore(A)}catch(d){if(d.name==="ConstraintError")console.warn('The database "'+e.name+'" has been upgraded from version '+u.oldVersion+" to version "+u.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw d}}),i.onerror=function(u){u.preventDefault(),o(i.error)},i.onsuccess=function(){var u=i.result;u.onversionchange=function(c){c.target.close()},t(u),X(e)}})}function $(e){return Q(e,!1)}function ie(e){return Q(e,!0)}function ue(e,r){if(!e.db)return!0;var t=!e.db.objectStoreNames.contains(e.storeName),o=e.version<e.db.version,n=e.version>e.db.version;if(o&&(e.version!==r&&console.warn('The database "'+e.name+`" can't be downgraded from version `+e.db.version+" to version "+e.version+"."),e.version=e.db.version),n||t){if(t){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function le(e){return new y(function(r,t){var o=new FileReader;o.onerror=t,o.onloadend=function(n){var i=btoa(n.target.result||"");r({__local_forage_encoded_blob:!0,data:i,type:e.type})},o.readAsBinaryString(e)})}function re(e){var r=N(atob(e.data));return Y([r],{type:e.type})}function a(e){return e&&e.__local_forage_encoded_blob}function f(e){var r=this,t=r._initReady().then(function(){var o=U[r._dbInfo.name];if(o&&o.dbReady)return o.dbReady});return z(t,e,e),t}function h(e){K(e);for(var r=U[e.name],t=r.forages,o=0;o<t.length;o++){var n=t[o];n._dbInfo.db&&(n._dbInfo.db.close(),n._dbInfo.db=null)}return e.db=null,$(e).then(function(i){return e.db=i,ue(e)?ie(e):i}).then(function(i){e.db=r.db=i;for(var u=0;u<t.length;u++)t[u]._dbInfo.db=i}).catch(function(i){throw J(e,i),i})}function p(e,r,t,o){o===void 0&&(o=1);try{var n=e.db.transaction(e.storeName,r);t(null,n)}catch(i){if(o>0&&(!e.db||i.name==="InvalidStateError"||i.name==="NotFoundError"))return y.resolve().then(function(){if(!e.db||i.name==="NotFoundError"&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ie(e)}).then(function(){return h(e).then(function(){p(e,r,t,o-1)})}).catch(t);t(i)}}function g(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function I(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=e[o];var n=U[t.name];n||(n=g(),U[t.name]=n),n.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=f);var i=[];function u(){return y.resolve()}for(var c=0;c<n.forages.length;c++){var d=n.forages[c];d!==r&&i.push(d._initReady().catch(u))}var l=n.forages.slice(0);return y.all(i).then(function(){return t.db=n.db,$(t)}).then(function(s){return t.db=s,ue(t,r._defaultConfig.version)?ie(t):s}).then(function(s){t.db=n.db=s,r._dbInfo=t;for(var b=0;b<l.length;b++){var S=l[b];S!==r&&(S._dbInfo.db=t.db,S._dbInfo.version=t.version)}})}function M(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){p(t._dbInfo,ee,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=d.get(e);l.onsuccess=function(){var s=l.result;s===void 0&&(s=null),a(s)&&(s=re(s)),n(s)},l.onerror=function(){i(l.error)}}catch(s){i(s)}})}).catch(i)});return w(o,r),o}function V(e,r){var t=this,o=new y(function(n,i){t.ready().then(function(){p(t._dbInfo,ee,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=d.openCursor(),s=1;l.onsuccess=function(){var b=l.result;if(b){var S=b.value;a(S)&&(S=re(S));var R=e(S,b.key,s++);R!==void 0?n(R):b.continue()}else n()},l.onerror=function(){i(l.error)}}catch(b){i(b)}})}).catch(i)});return w(o,r),o}function ce(e,r,t){var o=this;e=F(e);var n=new y(function(i,u){var c;o.ready().then(function(){return c=o._dbInfo,oe.call(r)==="[object Blob]"?B(c.db).then(function(d){return d?r:le(r)}):r}).then(function(d){p(o._dbInfo,v,function(l,s){if(l)return u(l);try{var b=s.objectStore(o._dbInfo.storeName);d===null&&(d=void 0);var S=b.put(d,e);s.oncomplete=function(){d===void 0&&(d=null),i(d)},s.onabort=s.onerror=function(){var R=S.error?S.error:S.transaction.error;u(R)}}catch(R){u(R)}})}).catch(u)});return w(n,t),n}function ae(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){p(t._dbInfo,v,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=d.delete(e);c.oncomplete=function(){n()},c.onerror=function(){i(l.error)},c.onabort=function(){var s=l.error?l.error:l.transaction.error;i(s)}}catch(s){i(s)}})}).catch(i)});return w(o,r),o}function de(e){var r=this,t=new y(function(o,n){r.ready().then(function(){p(r._dbInfo,v,function(i,u){if(i)return n(i);try{var c=u.objectStore(r._dbInfo.storeName),d=c.clear();u.oncomplete=function(){o()},u.onabort=u.onerror=function(){var l=d.error?d.error:d.transaction.error;n(l)}}catch(l){n(l)}})}).catch(n)});return w(t,e),t}function Ge(e){var r=this,t=new y(function(o,n){r.ready().then(function(){p(r._dbInfo,ee,function(i,u){if(i)return n(i);try{var c=u.objectStore(r._dbInfo.storeName),d=c.count();d.onsuccess=function(){o(d.result)},d.onerror=function(){n(d.error)}}catch(l){n(l)}})}).catch(n)});return w(t,e),t}function $e(e,r){var t=this,o=new y(function(n,i){if(e<0){n(null);return}t.ready().then(function(){p(t._dbInfo,ee,function(u,c){if(u)return i(u);try{var d=c.objectStore(t._dbInfo.storeName),l=!1,s=d.openKeyCursor();s.onsuccess=function(){var b=s.result;if(!b){n(null);return}e===0||l?n(b.key):(l=!0,b.advance(e))},s.onerror=function(){i(s.error)}}catch(b){i(b)}})}).catch(i)});return w(o,r),o}function er(e){var r=this,t=new y(function(o,n){r.ready().then(function(){p(r._dbInfo,ee,function(i,u){if(i)return n(i);try{var c=u.objectStore(r._dbInfo.storeName),d=c.openKeyCursor(),l=[];d.onsuccess=function(){var s=d.result;if(!s){o(l);return}l.push(s.key),s.continue()},d.onerror=function(){n(d.error)}}catch(s){n(s)}})}).catch(n)});return w(t,e),t}function rr(e,r){r=Z.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,n;if(!e.name)n=y.reject("Invalid arguments");else{var i=e.name===t.name&&o._dbInfo.db,u=i?y.resolve(o._dbInfo.db):$(e).then(function(c){var d=U[e.name],l=d.forages;d.db=c;for(var s=0;s<l.length;s++)l[s]._dbInfo.db=c;return c});e.storeName?n=u.then(function(c){if(c.objectStoreNames.contains(e.storeName)){var d=c.version+1;K(e);var l=U[e.name],s=l.forages;c.close();for(var b=0;b<s.length;b++){var S=s[b];S._dbInfo.db=null,S._dbInfo.version=d}var R=new y(function(k,W){var T=D.open(e.name,d);T.onerror=function(H){var Oe=T.result;Oe.close(),W(H)},T.onupgradeneeded=function(){var H=T.result;H.deleteObjectStore(e.storeName)},T.onsuccess=function(){var H=T.result;H.close(),k(H)}});return R.then(function(k){l.db=k;for(var W=0;W<s.length;W++){var T=s[W];T._dbInfo.db=k,X(T._dbInfo)}}).catch(function(k){throw(J(e,k)||y.resolve()).catch(function(){}),k})}}):n=u.then(function(c){K(e);var d=U[e.name],l=d.forages;c.close();for(var s=0;s<l.length;s++){var b=l[s];b._dbInfo.db=null}var S=new y(function(R,k){var W=D.deleteDatabase(e.name);W.onerror=function(){var T=W.result;T&&T.close(),k(W.error)},W.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},W.onsuccess=function(){var T=W.result;T&&T.close(),R(T)}});return S.then(function(R){d.db=R;for(var k=0;k<l.length;k++){var W=l[k];X(W._dbInfo)}}).catch(function(R){throw(J(e,R)||y.resolve()).catch(function(){}),R})})}return w(n,r),n}var tr={_driver:"asyncStorage",_initStorage:I,_support:L(),iterate:V,getItem:M,setItem:ce,removeItem:ae,clear:de,length:Ge,key:$e,keys:er,dropInstance:rr};function nr(){return typeof openDatabase=="function"}var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",or="~~local_forage_type~",Ae=/^~~local_forage_type~([^~]+)~/,he="__lfsc__:",be=he.length,ge="arbf",_e="blob",Be="si08",ke="ui08",xe="uic8",De="si16",Re="si32",Ce="ur16",Le="ui32",Me="fl32",Te="fl64",ze=be+ge.length,Fe=Object.prototype.toString;function Pe(e){var r=e.length*.75,t=e.length,o,n=0,i,u,c,d;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var l=new ArrayBuffer(r),s=new Uint8Array(l);for(o=0;o<t;o+=4)i=te.indexOf(e[o]),u=te.indexOf(e[o+1]),c=te.indexOf(e[o+2]),d=te.indexOf(e[o+3]),s[n++]=i<<2|u>>4,s[n++]=(u&15)<<4|c>>2,s[n++]=(c&3)<<6|d&63;return l}function we(e){var r=new Uint8Array(e),t="",o;for(o=0;o<r.length;o+=3)t+=te[r[o]>>2],t+=te[(r[o]&3)<<4|r[o+1]>>4],t+=te[(r[o+1]&15)<<2|r[o+2]>>6],t+=te[r[o+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+"=":r.length%3===1&&(t=t.substring(0,t.length-2)+"=="),t}function ir(e,r){var t="";if(e&&(t=Fe.call(e)),e&&(t==="[object ArrayBuffer]"||e.buffer&&Fe.call(e.buffer)==="[object ArrayBuffer]")){var o,n=he;e instanceof ArrayBuffer?(o=e,n+=ge):(o=e.buffer,t==="[object Int8Array]"?n+=Be:t==="[object Uint8Array]"?n+=ke:t==="[object Uint8ClampedArray]"?n+=xe:t==="[object Int16Array]"?n+=De:t==="[object Uint16Array]"?n+=Ce:t==="[object Int32Array]"?n+=Re:t==="[object Uint32Array]"?n+=Le:t==="[object Float32Array]"?n+=Me:t==="[object Float64Array]"?n+=Te:r(new Error("Failed to get type for BinaryArray"))),r(n+we(o))}else if(t==="[object Blob]"){var i=new FileReader;i.onload=function(){var u=or+e.type+"~"+we(this.result);r(he+_e+u)},i.readAsArrayBuffer(e)}else try{r(JSON.stringify(e))}catch(u){console.error("Couldn't convert value into a JSON string: ",e),r(null,u)}}function ar(e){if(e.substring(0,be)!==he)return JSON.parse(e);var r=e.substring(ze),t=e.substring(be,ze),o;if(t===_e&&Ae.test(r)){var n=r.match(Ae);o=n[1],r=r.substring(n[0].length)}var i=Pe(r);switch(t){case ge:return i;case _e:return Y([i],{type:o});case Be:return new Int8Array(i);case ke:return new Uint8Array(i);case xe:return new Uint8ClampedArray(i);case De:return new Int16Array(i);case Ce:return new Uint16Array(i);case Re:return new Int32Array(i);case Le:return new Uint32Array(i);case Me:return new Float32Array(i);case Te:return new Float64Array(i);default:throw new Error("Unkown type: "+t)}}var Ie={serialize:ir,deserialize:ar,stringToBuffer:Pe,bufferToString:we};function Ue(e,r,t,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+r.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],t,o)}function ur(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=typeof e[o]!="string"?e[o].toString():e[o];var n=new y(function(i,u){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size)}catch(c){return u(c)}t.db.transaction(function(c){Ue(c,t,function(){r._dbInfo=t,i()},function(d,l){u(l)})},u)});return t.serializer=Ie,n}function ne(e,r,t,o,n,i){e.executeSql(t,o,n,function(u,c){c.code===c.SYNTAX_ERR?u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[r.storeName],function(d,l){l.rows.length?i(d,c):Ue(d,r,function(){d.executeSql(t,o,n,i)},i)},i):i(u,c)},i)}function cr(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"SELECT * FROM "+u.storeName+" WHERE key = ? LIMIT 1",[e],function(d,l){var s=l.rows.length?l.rows.item(0).value:null;s&&(s=u.serializer.deserialize(s)),n(s)},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function fr(e,r){var t=this,o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"SELECT * FROM "+u.storeName,[],function(d,l){for(var s=l.rows,b=s.length,S=0;S<b;S++){var R=s.item(S),k=R.value;if(k&&(k=u.serializer.deserialize(k)),k=e(k,R.key,S+1),k!==void 0){n(k);return}}n()},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function We(e,r,t,o){var n=this;e=F(e);var i=new y(function(u,c){n.ready().then(function(){r===void 0&&(r=null);var d=r,l=n._dbInfo;l.serializer.serialize(r,function(s,b){b?c(b):l.db.transaction(function(S){ne(S,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,s],function(){u(d)},function(R,k){c(k)})},function(S){if(S.code===S.QUOTA_ERR){if(o>0){u(We.apply(n,[e,d,t,o-1]));return}c(S)}})})}).catch(c)});return w(i,t),i}function sr(e,r,t){return We.apply(this,[e,r,t,1])}function lr(e,r){var t=this;e=F(e);var o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"DELETE FROM "+u.storeName+" WHERE key = ?",[e],function(){n()},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function dr(e){var r=this,t=new y(function(o,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(u){ne(u,i,"DELETE FROM "+i.storeName,[],function(){o()},function(c,d){n(d)})})}).catch(n)});return w(t,e),t}function vr(e){var r=this,t=new y(function(o,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(u){ne(u,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],function(c,d){var l=d.rows.item(0).c;o(l)},function(c,d){n(d)})})}).catch(n)});return w(t,e),t}function hr(e,r){var t=this,o=new y(function(n,i){t.ready().then(function(){var u=t._dbInfo;u.db.transaction(function(c){ne(c,u,"SELECT key FROM "+u.storeName+" WHERE id = ? LIMIT 1",[e+1],function(d,l){var s=l.rows.length?l.rows.item(0).key:null;n(s)},function(d,l){i(l)})})}).catch(i)});return w(o,r),o}function yr(e){var r=this,t=new y(function(o,n){r.ready().then(function(){var i=r._dbInfo;i.db.transaction(function(u){ne(u,i,"SELECT key FROM "+i.storeName,[],function(c,d){for(var l=[],s=0;s<d.rows.length;s++)l.push(d.rows.item(s).key);o(l)},function(c,d){n(d)})})}).catch(n)});return w(t,e),t}function pr(e){return new y(function(r,t){e.transaction(function(o){o.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,i){for(var u=[],c=0;c<i.rows.length;c++)u.push(i.rows.item(c).name);r({db:e,storeNames:u})},function(n,i){t(i)})},function(o){t(o)})})}function mr(e,r){r=Z.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,n;return e.name?n=new y(function(i){var u;e.name===t.name?u=o._dbInfo.db:u=openDatabase(e.name,"","",0),e.storeName?i({db:u,storeNames:[e.storeName]}):i(pr(u))}).then(function(i){return new y(function(u,c){i.db.transaction(function(d){function l(R){return new y(function(k,W){d.executeSql("DROP TABLE IF EXISTS "+R,[],function(){k()},function(T,H){W(H)})})}for(var s=[],b=0,S=i.storeNames.length;b<S;b++)s.push(l(i.storeNames[b]));y.all(s).then(function(){u()}).catch(function(R){c(R)})},function(d){c(d)})})}):n=y.reject("Invalid arguments"),w(n,r),n}var br={_driver:"webSQLStorage",_initStorage:ur,_support:nr(),iterate:fr,getItem:cr,setItem:sr,removeItem:lr,clear:dr,length:vr,key:hr,keys:yr,dropInstance:mr};function gr(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function qe(e,r){var t=e.name+"/";return e.storeName!==r.storeName&&(t+=e.storeName+"/"),t}function _r(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}function wr(){return!_r()||localStorage.length>0}function Ir(e){var r=this,t={};if(e)for(var o in e)t[o]=e[o];return t.keyPrefix=qe(e,r._defaultConfig),wr()?(r._dbInfo=t,t.serializer=Ie,y.resolve()):y.reject()}function Er(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);i.indexOf(o)===0&&localStorage.removeItem(i)}});return w(t,e),t}function Sr(e,r){var t=this;e=F(e);var o=t.ready().then(function(){var n=t._dbInfo,i=localStorage.getItem(n.keyPrefix+e);return i&&(i=n.serializer.deserialize(i)),i});return w(o,r),o}function Or(e,r){var t=this,o=t.ready().then(function(){for(var n=t._dbInfo,i=n.keyPrefix,u=i.length,c=localStorage.length,d=1,l=0;l<c;l++){var s=localStorage.key(l);if(s.indexOf(i)===0){var b=localStorage.getItem(s);if(b&&(b=n.serializer.deserialize(b)),b=e(b,s.substring(u),d++),b!==void 0)return b}}});return w(o,r),o}function jr(e,r){var t=this,o=t.ready().then(function(){var n=t._dbInfo,i;try{i=localStorage.key(e)}catch{i=null}return i&&(i=i.substring(n.keyPrefix.length)),i});return w(o,r),o}function Nr(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo,n=localStorage.length,i=[],u=0;u<n;u++){var c=localStorage.key(u);c.indexOf(o.keyPrefix)===0&&i.push(c.substring(o.keyPrefix.length))}return i});return w(t,e),t}function Ar(e){var r=this,t=r.keys().then(function(o){return o.length});return w(t,e),t}function Br(e,r){var t=this;e=F(e);var o=t.ready().then(function(){var n=t._dbInfo;localStorage.removeItem(n.keyPrefix+e)});return w(o,r),o}function kr(e,r,t){var o=this;e=F(e);var n=o.ready().then(function(){r===void 0&&(r=null);var i=r;return new y(function(u,c){var d=o._dbInfo;d.serializer.serialize(r,function(l,s){if(s)c(s);else try{localStorage.setItem(d.keyPrefix+e,l),u(i)}catch(b){(b.name==="QuotaExceededError"||b.name==="NS_ERROR_DOM_QUOTA_REACHED")&&c(b),c(b)}})})});return w(n,t),n}function xr(e,r){if(r=Z.apply(this,arguments),e=typeof e!="function"&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName}var o=this,n;return e.name?n=new y(function(i){e.storeName?i(qe(e,o._defaultConfig)):i(e.name+"/")}).then(function(i){for(var u=localStorage.length-1;u>=0;u--){var c=localStorage.key(u);c.indexOf(i)===0&&localStorage.removeItem(c)}}):n=y.reject("Invalid arguments"),w(n,r),n}var Dr={_driver:"localStorageWrapper",_initStorage:Ir,_support:gr(),iterate:Or,getItem:Sr,setItem:kr,removeItem:Br,clear:Er,length:Ar,key:jr,keys:Nr,dropInstance:xr},Rr=function(e,r){return e===r||typeof e=="number"&&typeof r=="number"&&isNaN(e)&&isNaN(r)},Cr=function(e,r){for(var t=e.length,o=0;o<t;){if(Rr(e[o],r))return!0;o++}return!1},Ke=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},ve={},Ve={},fe={INDEXEDDB:tr,WEBSQL:br,LOCALSTORAGE:Dr},Lr=[fe.INDEXEDDB._driver,fe.WEBSQL._driver,fe.LOCALSTORAGE._driver],ye=["dropInstance"],Ee=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ye),Mr={description:"",driver:Lr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Tr(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})}}function Se(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(Ke(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t])}return arguments[0]}var zr=function(){function e(r){P(this,e);for(var t in fe)if(fe.hasOwnProperty(t)){var o=fe[t],n=o._driver;this[t]=n,ve[n]||this.defineDriver(o)}this._defaultConfig=Se({},Mr),this._config=Se({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(r){if((typeof r>"u"?"undefined":C(r))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in r){if(t==="storeName"&&(r[t]=r[t].replace(/\W/g,"_")),t==="version"&&typeof r[t]!="number")return new Error("Database version must be a number.");this._config[t]=r[t]}return"driver"in r&&r.driver?this.setDriver(this._config.driver):!0}else return typeof r=="string"?this._config[r]:this._config},e.prototype.defineDriver=function(r,t,o){var n=new y(function(i,u){try{var c=r._driver,d=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!r._driver){u(d);return}for(var l=Ee.concat("_initStorage"),s=0,b=l.length;s<b;s++){var S=l[s],R=!Cr(ye,S);if((R||r[S])&&typeof r[S]!="function"){u(d);return}}var k=function(){for(var T=function(Pr){return function(){var Ur=new Error("Method "+Pr+" is not implemented by the current driver"),Xe=y.reject(Ur);return w(Xe,arguments[arguments.length-1]),Xe}},H=0,Oe=ye.length;H<Oe;H++){var je=ye[H];r[je]||(r[je]=T(je))}};k();var W=function(T){ve[c]&&console.info("Redefining LocalForage driver: "+c),ve[c]=r,Ve[c]=T,i()};"_support"in r?r._support&&typeof r._support=="function"?r._support().then(W,u):W(!!r._support):W(!0)}catch(T){u(T)}});return z(n,t,o),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(r,t,o){var n=ve[r]?y.resolve(ve[r]):y.reject(new Error("Driver not found."));return z(n,t,o),n},e.prototype.getSerializer=function(r){var t=y.resolve(Ie);return z(t,r),t},e.prototype.ready=function(r){var t=this,o=t._driverSet.then(function(){return t._ready===null&&(t._ready=t._initDriver()),t._ready});return z(o,r,r),o},e.prototype.setDriver=function(r,t,o){var n=this;Ke(r)||(r=[r]);var i=this._getSupportedDrivers(r);function u(){n._config.driver=n.driver()}function c(s){return n._extend(s),u(),n._ready=n._initStorage(n._config),n._ready}function d(s){return function(){var b=0;function S(){for(;b<s.length;){var R=s[b];return b++,n._dbInfo=null,n._ready=null,n.getDriver(R).then(c).catch(S)}u();var k=new Error("No available storage method found.");return n._driverSet=y.reject(k),n._driverSet}return S()}}var l=this._driverSet!==null?this._driverSet.catch(function(){return y.resolve()}):y.resolve();return this._driverSet=l.then(function(){var s=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(s).then(function(b){n._driver=b._driver,u(),n._wrapLibraryMethodsWithReady(),n._initDriver=d(i)})}).catch(function(){u();var s=new Error("No available storage method found.");return n._driverSet=y.reject(s),n._driverSet}),z(this._driverSet,t,o),this._driverSet},e.prototype.supports=function(r){return!!Ve[r]},e.prototype._extend=function(r){Se(this,r)},e.prototype._getSupportedDrivers=function(r){for(var t=[],o=0,n=r.length;o<n;o++){var i=r[o];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var r=0,t=Ee.length;r<t;r++)Tr(this,Ee[r])},e.prototype.createInstance=function(r){return new e(r)},e}(),Fr=new zr;x.exports=Fr},{3:3}]},{},[4])(4)})}),et=Ze((_,O)=>{(function(m,x){typeof _=="object"&&typeof O<"u"?x(_):typeof define=="function"&&define.amd?define("localforage-driver-memory",["exports"],x):x(m.LocalforageDriverMemory={})})(typeof self<"u"?self:_,function(m){var x="localforage-driver-memory";function q(a){var f=typeof Symbol=="function"&&a[Symbol.iterator],h=0;return f?f.call(a):{next:function(){return a&&h>=a.length&&(a=void 0),{value:a&&a[h++],done:!a}}}}function C(a,f){a=a||[],f=f||{};try{return new Blob(a,f)}catch(I){if(I.name!=="TypeError")throw I;for(var h=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,p=new h,g=0;g<a.length;g+=1)p.append(a[g]);return p.getBlob(f.type)}}var P=/^~~local_forage_type~([^~]+)~/,j=9,D=j+4,L=Object.prototype.toString;function Y(a){var f=a.length*.75,h=a.length;a[a.length-1]==="="&&(f--,a[a.length-2]==="="&&f--);for(var p=new ArrayBuffer(f),g=new Uint8Array(p),I=0,M=0;I<h;I+=4){var V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I]),ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I+1]),ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I+2]),de="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a[I+3]);g[M++]=V<<2|ce>>4,g[M++]=(ce&15)<<4|ae>>2,g[M++]=(ae&3)<<6|de&63}return p}function y(a){for(var f=new Uint8Array(a),h="",p=0;p<f.length;p+=3)h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[f[p]>>2],h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(f[p]&3)<<4|f[p+1]>>4],h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(f[p+1]&15)<<2|f[p+2]>>6],h+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[f[p+2]&63];return f.length%3===2?h=h.substring(0,h.length-1)+"=":f.length%3===1&&(h=h.substring(0,h.length-2)+"=="),h}function w(a,f){var h="";if(a&&(h=L.call(a)),a&&(h==="[object ArrayBuffer]"||a.buffer&&L.call(a.buffer)==="[object ArrayBuffer]")){var p=void 0,g="__lfsc__:";a instanceof ArrayBuffer?(p=a,g+="arbf"):(p=a.buffer,h==="[object Int8Array]"?g+="si08":h==="[object Uint8Array]"?g+="ui08":h==="[object Uint8ClampedArray]"?g+="uic8":h==="[object Int16Array]"?g+="si16":h==="[object Uint16Array]"?g+="ur16":h==="[object Int32Array]"?g+="si32":h==="[object Uint32Array]"?g+="ui32":h==="[object Float32Array]"?g+="fl32":h==="[object Float64Array]"?g+="fl64":f(new Error("Failed to get type for BinaryArray"))),f(g+y(p))}else if(h==="[object Blob]"){var I=new FileReader;I.onload=function(){var M="~~local_forage_type~"+a.type+"~"+y(this.result);f("__lfsc__:blob"+M)},I.readAsArrayBuffer(a)}else try{f(JSON.stringify(a))}catch(M){console.error("Couldn't convert value into a JSON string: ",a),f(null,M)}}function z(a){if(a.substring(0,j)!=="__lfsc__:")return JSON.parse(a);var f=a.substring(D),h=a.substring(j,D),p;if(h==="blob"&&P.test(f)){var g=f.match(P);p=g[1],f=f.substring(g[0].length)}var I=Y(f);switch(h){case"arbf":return I;case"blob":return C([I],{type:p});case"si08":return new Int8Array(I);case"ui08":return new Uint8Array(I);case"uic8":return new Uint8ClampedArray(I);case"si16":return new Int16Array(I);case"ur16":return new Uint16Array(I);case"si32":return new Int32Array(I);case"ui32":return new Uint32Array(I);case"fl32":return new Float32Array(I);case"fl64":return new Float64Array(I);default:throw new Error("Unkown type: "+h)}}function F(a){var f,h;if(a===null||typeof a!="object"||"isActiveClone"in a)return a;var p=a instanceof Date?new Date(a):a.constructor();try{for(var g=q(Object.keys(a)),I=g.next();!I.done;I=g.next()){var M=I.value;Object.prototype.hasOwnProperty.call(a,M)&&(a.isActiveClone=null,p[M]=F(a[M]),delete a.isActiveClone)}}catch(V){f={error:V}}finally{try{I&&!I.done&&(h=g.return)&&h.call(g)}finally{if(f)throw f.error}}return p}function Z(a,f){return(a.name||f.name)+"/"+(a.storeName||f.storeName)+"/"}function A(a,f){f&&a.then(function(h){f(null,h)},function(h){f(h)})}function G(){for(var a=[],f=0;f<arguments.length;f++)a[f]=arguments[f];if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}function U(a,f){var h=this;if(f=G.apply(this,arguments),a=typeof a!="function"&&a||{},!a.name){var p=this.config();a.name=a.name||p.name,a.storeName=a.storeName||p.storeName}var g;return a.name?g=new Promise(function(I){a.storeName?I(Z(a,h._defaultConfig)):I(a.name+"/")}):g=Promise.reject("Invalid arguments"),{promise:g,callback:f}}function oe(a){return typeof a!="string"&&(console.warn(a+" used as a key, but it is not a string."),a=String(a)),a}var ee={bufferToString:y,deserialize:z,serialize:w,stringToBuffer:Y},v={},N=function(){function a(f){this.kp=f,this.data={}}return a.resolve=function(f){return v[f]||(v[f]=new a(f)),v[f]},a.prototype.clear=function(){this.data={}},a.prototype.drop=function(){this.clear(),delete v[this.kp]},a.prototype.get=function(f){return this.data[f]},a.prototype.key=function(f){return this.keys()[f]},a.prototype.keys=function(){return Object.keys(this.data)},a.prototype.rm=function(f){delete this.data[f]},a.prototype.set=function(f,h){this.data[f]=h},a}();function E(a){var f=a?F(a):{},h=Z(f,this._defaultConfig),p=N.resolve(h);return this._dbInfo=f,this._dbInfo.serializer=ee,this._dbInfo.keyPrefix=h,this._dbInfo.mStore=p,Promise.resolve()}function B(a){var f=this,h=this.ready().then(function(){f._dbInfo.mStore.clear()});return A(h,a),h}function K(a,f){var h=U.apply(this,arguments),p=h.promise,g=h.callback,I=p.then(function(M){N.resolve(M).drop()});return A(I,g),p}function X(a,f){var h=this;a=oe(a);var p=this.ready().then(function(){var g=h._dbInfo.mStore.get(a);return g==null?null:h._dbInfo.serializer.deserialize(g)});return A(p,f),p}function J(a,f){var h=this,p=this.ready().then(function(){for(var g=h._dbInfo.mStore,I=g.keys(),M=0;M<I.length;M++){var V=g.get(I[M]);if(V&&(V=h._dbInfo.serializer.deserialize(V)),V=a(V,I[M],M+1),V!==void 0)return V}});return A(p,f),p}function Q(a,f){var h=this,p=this.ready().then(function(){var g;try{g=h._dbInfo.mStore.key(a),g===void 0&&(g=null)}catch{g=null}return g});return A(p,f),p}function $(a){var f=this,h=this.ready().then(function(){return f._dbInfo.mStore.keys()});return A(h,a),h}function ie(a){var f=this.keys().then(function(h){return h.length});return A(f,a),f}function ue(a,f){var h=this;a=oe(a);var p=this.ready().then(function(){h._dbInfo.mStore.rm(a)});return A(p,f),p}function le(a,f,h){var p=this;a=oe(a);var g=this.ready().then(function(){f===void 0&&(f=null);var I=f;return new Promise(function(M,V){p._dbInfo.serializer.serialize(f,function(ce,ae){if(ae)V(ae);else try{p._dbInfo.mStore.set(a,ce),M(I)}catch(de){V(de)}})})});return A(g,h),g}var re=!0;m._support=re,m._driver=x,m._initStorage=E,m.clear=B,m.dropInstance=K,m.getItem=X,m.iterate=J,m.key=Q,m.keys=$,m.length=ie,m.removeItem=ue,m.setItem=le,Object.defineProperty(m,"__esModule",{value:!0})})}),Ne=He($r()),Je=He(et()),rt={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};function tt(_){for(let[O,m]of Object.entries(rt))_.style[O]=m}function nt(_){return!![].slice.call(document.querySelectorAll(".magic-iframe")).find(m=>m.src.includes(_))}var ot=class extends Kr{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise(_=>{let O=()=>{if(nt(encodeURIComponent(this.parameters)))Xr().log();else{let m=document.createElement("iframe");m.classList.add("magic-iframe"),m.dataset.magicIframeLabel=Ye(this.endpoint).host,m.title="Secure Modal",m.src=Ye(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,tt(m),document.body.appendChild(m),_(m)}};["loaded","interactive","complete"].includes(document.readyState)?O():window.addEventListener("load",O,!1)}),window.addEventListener("message",_=>{var O;if(_.origin===this.endpoint&&_.data&&_.data.msgType&&this.messageHandlers.size){_.data.response=(O=_.data.response)!=null?O:{};for(let m of this.messageHandlers.values())m(_)}})}showOverlay(){return me(this,null,function*(){let _=yield this.iframe;_.style.display="block",this.activeElement=document.activeElement,_.focus()})}hideOverlay(){return me(this,null,function*(){var _;let O=yield this.iframe;O.style.display="none",(_=this.activeElement)!=null&&_.focus&&this.activeElement.focus(),this.activeElement=null})}_post(_){return me(this,null,function*(){let O=yield this.iframe;if(O&&O.contentWindow)O.contentWindow.postMessage(_,this.endpoint);else throw Vr()})}},ut=Wr(qr,{platform:"web",sdkName:"magic-sdk",version:"27.0.0",defaultEndpoint:"https://auth.magic.link/",ViewController:ot,configureStorage:()=>me(void 0,null,function*(){let _=Ne.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield _.defineDriver(Je),yield _.setDriver([Ne.default.INDEXEDDB,Ne.default.LOCALSTORAGE,Je._driver]),_})});export{st as DeepLinkPage,lt as DeviceVerificationEventEmit,dt as DeviceVerificationEventOnReceived,vt as EthChainType,ht as Events,yt as Extension,pt as ExtensionError,mt as ExtensionWarning,bt as LoginWithEmailOTPEventEmit,gt as LoginWithEmailOTPEventOnReceived,_t as LoginWithMagicLinkEventEmit,wt as LoginWithMagicLinkEventOnReceived,ut as Magic,It as MagicIncomingWindowMessage,Et as MagicOutgoingWindowMessage,St as MagicPayloadMethod,Ot as RPCError,jt as RPCErrorCode,Nt as RecencyCheckEventEmit,At as RecencyCheckEventOnReceived,Bt as RecoveryMethodType,kt as SDKError,xt as SDKErrorCode,Dt as SDKWarning,Rt as SDKWarningCode,Ct as UpdateEmailEventEmit,Lt as UpdateEmailEventOnReceived,Mt as Wallets,Tt as isPromiEvent};
@@ -1,4 +1,4 @@
1
- import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-Df2XL9vC.js";import"./index-C2Y2eZ28.js";/**
1
+ import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-C_dk2KKg.js";import"./index-KAz1FpF_.js";/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1 +1 @@
1
- var dt=Object.defineProperty;var ct=(n,l,e)=>l in n?dt(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e;var h=(n,l,e)=>ct(n,typeof l!="symbol"?l+"":l,e);import{af as z,H as t,M as c,G as d,bm as H,bC as ht,D as _,gs as K,L as X,K as R,ce as Le,b8 as v,N as B,bw as V,eC as mt,gt,gu as pt,gv as ut,gw as Ct,gx as It,gy as bt,gz as xt,gA as _t,gB as vt,gC as L,eq as Et,gD as Z,gE as fe,gF as ie,fb as Oe,fq as jt,fW as St,fX as ft,ez as he,gl as Tt,gG as wt,aH as ee,gH as yt,da as be,gI as xe,bt as ke,gJ as Pt,fY as Nt,eD as me,aW as At,gK as Rt,gL as Dt,gM as Mt,gN as Lt,fn as Ot,f_ as kt,f$ as Bt,Z as Be,bv as We,gO as Wt,eR as Te,bD as Ft,fj as Fe,ae as Ht,gP as He,eG as _e,X as Ve,et as Vt,eo as $e,fE as Q,dC as ge,ep as $t,eU as pe,gQ as Ue,bk as ve,fU as Ye,eX as y,er as G,fz as Ge,fA as ue,J as O,f5 as Ce,dB as Ut,eP as Yt,eA as Gt,gR as Ee,fa as je,fi as zt,gS as Jt,gT as qt,gU as Zt,gV as ze,gW as Je,gX as qe,gY as Ze,fI as Ke,eJ as Kt,eI as Qe,eK as Qt,eM as Xt,eN as es,gZ as ts,g_ as ss,g$ as as,h0 as te,h1 as oe,h2 as ns,ec as is,h3 as ls,h4 as os,h5 as rs,h6 as ds,h7 as cs,h8 as hs,h9 as ms,ha as gs,hb as ps,hc as us,hd as Cs,he as Is,hf as bs,hg as xs,hh as _s,hi as vs,hj as Es,hk as js,fZ as Ss,bN as ae,hl as fs,hm as we,hn as Ts,ho as ws,eT as ye,fF as re,hp as de,eS as ys,eO as Pe,eV as Ps,eW as Ne,eY as Ae,eZ as Re,hq as Ns,hr as As,e_ as Rs,e$ as De,f0 as Me,hs as Ds,f8 as Ms,ht as Ls,hu as Os,hv as ks,hw as Xe,hx as Bs,hy as Ws,hz as Fs,fc as Hs,hA as Vs,hB as $s,eF as Us,hC as Ys,fd as Gs,ff as zs,hD as Js}from"./index-C2Y2eZ28.js";import{J as qs}from"./JumpIn.container-Bfsb8XQY.js";import{C as Zs}from"./CollectionProvider.container-D5AviJmj.js";import{C as et}from"./ConfirmDelete-DbFeXC54.js";import{C as tt}from"./CollectionStatus.container-BA96F5oG.js";import{d as Ks,e as Qs,c as Xs}from"./selectors-Zkd3yj1l.js";import{I as ea}from"./ItemProvider.container-DFEZSCMr.js";const ta=({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(ht,{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")})]})]}),sa=z.memo(ta);var w=(n=>(n.REJECT_COLLECTION="REJECT_COLLECTION",n.REJECT_CURATION="REJECT_CURATION",n.DISABLE_COLLECTION="DISABLE_COLLECTION",n.DISABLE_THIRD_PARTY="DISABLE_THIRD_PARTY",n))(w||{});const k="item_editor.top_panel.rejection_modal",aa=({open:n,type:l,isLoading:e,thirdParty:s,hasPendingTransaction:a,onDisableThirdParty:i,collection:o,curation:r,onReject:m,onRejectCuration:g,onClose:p})=>{const I=_.useMemo(()=>{switch(l){case w.DISABLE_COLLECTION:return k+".disable_collection";case w.REJECT_CURATION:return k+".reject_curation";case w.DISABLE_THIRD_PARTY:return k+".disable_third_party";default:return""}},[l]),S=()=>{switch(l){case w.DISABLE_COLLECTION:m(o);break;case w.REJECT_CURATION:g(r.collectionId);break;case w.DISABLE_THIRD_PARTY:s&&i(s.id);break}},j=l===w.DISABLE_COLLECTION&&!o.isApproved||l===w.DISABLE_THIRD_PARTY&&!(s!=null&&s.isApproved)||l===w.REJECT_COLLECTION&&!o.isApproved||l===w.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(na,{i18nKey:I}):j?t.jsx(ia,{link:o.forumLink,onClose:p}):t.jsx(la,{i18nKey:I,isLoading:e,onClose:p,onConfirm:S})})},na=({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(X,{to:R.activity(),children:d("global.activity")})}})}),t.jsx(c.Loader,{active:!0,size:"large"})]})]}),ia=({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")})]})]}),la=({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(Le,{primary:!0,onClick:e,disabled:l,loading:l,network:v.Network.MATIC,children:d(`${n}.action`)}),t.jsx(c.Button,{disabled:l,onClick:s,children:d("global.cancel")})]})]}),oa=z.memo(aa),ra=(n,l)=>({isLoading:V(mt(n),_t)||V(gt(n),vt)||pt(n),hasPendingTransaction:ut(n)||!!(l.thirdParty&&Ct(n,l.thirdParty.id))}),da=n=>({onReject:l=>n(It(l)),onRejectCuration:l=>n(bt(l)),onDisableThirdParty:l=>n(xt(l))}),ca=B(ra,da)(oa);var x=(n=>(n[n.APPROVE=0]="APPROVE",n[n.REJECT=1]="REJECT",n[n.ENABLE=2]="ENABLE",n[n.DISABLE=3]="DISABLE",n[n.DEPLOY_MISSING_ENTITIES=4]="DEPLOY_MISSING_ENTITIES",n))(x||{});let ha=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=Et(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(qs,{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(ca,{type:m,open:!0,collection:e,curation:i,thirdParty:r,onClose:()=>this.setShowRejectionModal(null)}),(i==null?void 0:i.assignee)&&g&&t.jsx(sa,{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,onDeployMissingEntities:g,reviewedItems:p,totalItems:I}=this.props,S={[x.APPROVE]:()=>a!=null&&a.assignee&&i!==(a==null?void 0:a.assignee)?this.setState({showApproveConfirmModal:!0}):L(s)?m(s):r(s),[x.ENABLE]:()=>r(s),[x.DISABLE]:()=>this.setShowRejectionModal(o?w.DISABLE_THIRD_PARTY:w.DISABLE_COLLECTION),[x.REJECT]:()=>{(a==null?void 0:a.status)===K.PENDING?this.setShowRejectionModal(w.REJECT_CURATION):this.setShowRejectionModal(w.REJECT_COLLECTION)},[x.DEPLOY_MISSING_ENTITIES]:()=>g(s)},j={[x.APPROVE]:"approve",[x.ENABLE]:"enable",[x.DISABLE]:"disable",[x.REJECT]:"reject",[x.DEPLOY_MISSING_ENTITIES]:"deploy_missing_entities"},b=e===x.APPROVE||e===x.ENABLE||e===x.DEPLOY_MISSING_ENTITIES,C=!L(s)||!!I&&p.length>=Z(I);return t.jsx(c.Popup,{content:d("item_editor.top_panel.items_pending_to_review"),disabled:C,position:"bottom center",trigger:t.jsx("div",{children:t.jsx(c.Button,{primary:b,onClick:()=>S[e](),disabled:L(s)&&e===x.APPROVE&&!!I&&p.length<Z(I),children:d(`item_editor.top_panel.${j[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(x.APPROVE,e,s),m&&this.renderButton(x.REJECT,e,s),!m&&(r==null?void 0:r.isApproved)&&this.renderButton(x.DISABLE,e,null)]})});h(this,"renderButtons",(e,s)=>s&&e.isApproved&&s.status==="pending"?t.jsxs(t.Fragment,{children:[this.renderButton(x.APPROVE,e,s),this.renderButton(x.REJECT,e,s)]}):s&&e.isApproved&&(s.status==="approved"||s.status==="rejected")?t.jsxs(t.Fragment,{children:[this.renderButton(x.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(x.DEPLOY_MISSING_ENTITIES,e,s)]}):fe(e)&&e.isApproved?t.jsxs(t.Fragment,{children:[this.renderButton(x.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(x.DEPLOY_MISSING_ENTITIES,e,s)]}):fe(e)?this.renderButton(x.ENABLE,e,s):t.jsxs(t.Fragment,{children:[this.renderButton(x.APPROVE,e,s),this.renderButton(x.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 ma=n=>{const l=ie(n),e=l?Oe(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)?Tt(n,e):null,m=l?wt(n,l):!1;return{address:ee(n),items:s,totalItems:(o==null?void 0:o.total)||null,collection:e,itemCurations:a,thirdParty:r,curation:i,chainId:yt(n),isConnected:be(n),isReviewing:xe(n),isCommitteeMember:ke(n),selectedCollectionId:l,hasCollectionMissingEntities:m,isLoading:V(Pt(n),Ot)||V(Nt(n),kt)||V(me(n),Bt)}},ga=n=>({onNavigate:l=>n(At(l)),onSetAssignee:(l,e,s)=>n(Rt(l,e,s)),onInitiateTPApprovalFlow:l=>n(Dt(l)),onInitiateApprovalFlow:l=>n(Mt(l)),onDeployMissingEntities:l=>n(Lt(l))}),pa=B(ma,ga)(ha),ua="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",Ca=n=>{const{collectionId:l,itemName:e}=n,[s,a]=_.useState(!1),[i,o]=_.useState(null),r=Be(),m=We();_.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:ua,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(X,{to:R.collectionDetail(l),children:t.jsx(c.Button,{className:"ItemAddedToast view-collection-link",basic:!0,children:p})})}})}):null},Ia=z.memo(Ca),ba=n=>({itemName:Wt(n)}),xa=B(ba)(Ia),_a=({collection:n,address:l,hasUserOrphanItems:e,isLoggedIn:s,isReviewing:a,onOpenModal:i,onDeleteCollection:o})=>{var u,W;const r=We(),m=Be(),g=((u=r.state)==null?void 0:u.fromParam)===Te.COLLECTIONS,p=((W=r.state)==null?void 0:W.fromParam)===Te.TP_COLLECTIONS,I=_.useCallback(()=>{m.push(R.collections())},[m]),S=_.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]),j=_.useCallback(()=>{i("CreateCollectionModal")},[i]),b=_.useCallback(()=>{n&&i("CreateSingleItemModal",{collectionId:n.id})},[n,i]),C=_.useCallback(()=>{n&&i("AddExistingItemModal",{collectionId:n.id})},[n,i]),T=_.useCallback(()=>{n&&i("EditCollectionNameModal",{collection:n})},[n,i]),f=_.useCallback(()=>{n&&o(n)},[n,o]),D=_.useCallback(()=>{const F=n&&Ft(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(X,{to:R.collectionDetail(n.id),children:n.name}),t.jsx(tt,{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:T,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(et,{name:n.name,onDelete:f,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}):null},[n,l,e,g,p]),M=_.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:j,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()})},va=_a,Ea=n=>{let l;const e=ie(n);e&&(l=Fe(n).find(i=>i.id===e));const s=ee(n);return{address:s,isLoggedIn:Ht(n),isReviewing:xe(n),collection:l,hasEditRights:l!==void 0&&s!==void 0&&He(n,s,l),hasUserOrphanItems:_e(n)}},ja=n=>({onOpenModal:(l,e)=>n(Ve(l,e)),onDeleteCollection:l=>n(Vt(l)),onDeleteItem:l=>n($e(l))}),Sa=B(Ea,ja)(va),P=10;class A extends _.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 fa extends _.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 Q(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(X,{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($t,{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:Ue(e,i),position:"top center",trigger:this.renderToggleItem()})]})})}}const Ta=fa;var E=(n=>(n.TO_REVIEW="to-review",n.REVIEWED="reviewed",n.ALL_ITEMS="all-items",n))(E||{});const wa={[E.TO_REVIEW]:1,[E.REVIEWED]:1,[E.ALL_ITEMS]:1};class ya extends _.PureComponent{constructor(){super(...arguments);h(this,"state",{currentTab:E.TO_REVIEW,currentPages:wa,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===E.TO_REVIEW&&!Ye(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(!Ue(e,s))return;let m=a.filter(p=>p.id!==e.id);if(Q(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?G(e.urn)?Ge(e.urn):ue(e.urn):null,ITEM_TYPE:e.type,ITEM_NAME:e.name,ITEM_IS_THIRD_PARTY:G(e.urn)})),r(m)});h(this,"handleTabChange",e=>{const{onLoadPage:s,onReviewItems:a,onResetReviewedItems:i}=this.props,{currentPages:o}=this.state;e===E.ALL_ITEMS?this.setState({showAllItemsTabChangeModal:!1},()=>{i(),s(o[E.ALL_ITEMS])}):e===E.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!==E.REVIEWED&&i(+s.activePage)});h(this,"handleSwitchToAllItemsTab",()=>{const{reviewedItems:e}=this.props;e.length>0?this.setState({showAllItemsTabChangeModal:!0}):this.handleTabChange(E.ALL_ITEMS)});h(this,"getIsReviewingTPItems",()=>{const{collection:e,isReviewing:s}=this.props;return e?G(e.urn)&&s:!1});h(this,"renderSidebarItem",e=>{const{collection:s,selectedItemId:a,bodyShape:i,isPlayingEmote:o}=this.props;return t.jsx(Ta,{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(Q);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(A,{label:this.renderCollapsableLabel(y.WEARABLE),children:s.map(this.renderSidebarItem)}),t.jsx(A,{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 E.TO_REVIEW:return t.jsxs(t.Fragment,{children:[this.renderSidebarCategory(e),!m&&a?this.renderTabPagination(a):null]});case E.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 E.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 E.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 E.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:E.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(E.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===E.TO_REVIEW,onClick:()=>this.handleTabChange(E.TO_REVIEW),children:d("item_editor.left_panel.to_review")}),t.jsx(c.Tabs.Tab,{active:e===E.REVIEWED,onClick:()=>this.handleTabChange(E.REVIEWED),children:d("item_editor.left_panel.reviewed")}),t.jsx(c.Tabs.Tab,{active:e===E.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 Pa extends _.PureComponent{render(){const{collection:l,isSelected:e}=this.props;return t.jsx("div",{className:`SidebarCollection ${e?"is-selected":""}`,children:t.jsxs(X,{to:R.itemEditor({collectionId:l.id}),children:[t.jsx(Ut,{collectionId:l.id}),t.jsxs("div",{className:"wrapper",children:[t.jsxs("div",{className:"name",children:[t.jsx(tt,{collection:l}),l.name]}),t.jsx("div",{className:"count",children:d("item_editor.left_panel.items_count",{count:l.itemCount})})]})]})})}}const Na=Pa;class Aa extends _.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(Na,{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 Y=(n=>(n.COLLECTIONS="collections",n.ORPHAN_ITEMS="orphanItems",n))(Y||{});const U=1;let Ra=class extends _.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===Y.COLLECTIONS&&!e})}getInitialState(){const{selectedCollectionId:e,selectedItemId:s}=this.props;let a=Y.COLLECTIONS;return!e&&s&&(a=Y.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:j,onFetchOrphanItem:b}=this.props,{initialPage:C,pages:T}=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=T[T.length-1],M=Math.min(f,D+1);T.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);j(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&&j([m]),e.selectedCollectionId!==o&&j([])}componentWillUnmount(){const{onSetItems:e}=this.props;e([])}getItems(e,s,a){const{selectedCollectionId:i,orphanItems:o,isReviewing:r}=this.props;return i&&e?Yt(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:j,wearableController:b,isLoading:C,hasUserOrphanItems:T,onSetItems:f,onSetReviewedItems:D,onResetReviewedItems:M}=this.props,{pages:u,showSamplesModalAgain:W}=this.state,F=!r&&T,le=this.isCollectionTabActive()&&!r,N=!this.isCollectionTabActive()||r;return t.jsx("div",{className:"LeftPanel",children:j?t.jsx(Zs,{id:r,itemSelected:o,itemsPage:u,itemsPageSize:P,fetchCollectionItemsOptions:{status:I?K.PENDING:void 0},onChangePage:J=>this.setState({pages:[J]}),children:({paginatedCollections:J,collection:$,paginatedItems:at,initialPage:nt,isLoadingCollection:it,isLoadingCollectionItems:lt,itemCurations:ot})=>{const q=this.getItems($,at,ot),Se=this.isCollectionTabActive(),rt=r&&$?nt:this.state.initialPage;return t.jsxs(t.Fragment,{children:[t.jsx(Sa,{}),F?t.jsxs(c.Tabs,{isFullscreen:!0,children:[t.jsx(c.Tabs.Tab,{active:Se,onClick:()=>this.handleTabChange(Y.COLLECTIONS),children:d("collections_page.collections")}),t.jsx(c.Tabs.Tab,{active:!Se,onClick:()=>this.handleTabChange(Y.ORPHAN_ITEMS),children:d("item_editor.left_panel.items")})]}):null,le?t.jsx(Aa,{collections:J,totalCollections:a||i.length,items:e,hasHeader:q.length>0,selectedCollectionId:r,onLoadPage:this.loadPage,isLoading:it}):null,N?t.jsxs(t.Fragment,{children:[t.jsx(ya,{items:q,totalItems:s||q.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:rt,isLoading:lt||C,onToggleShowSamplesModalAgain:this.handleToggleShowSamplesModalAgain,showSamplesModalAgain:W,onReviewItems:()=>D(q),onLoadRandomPage:()=>this.loadRandomPage(q),onLoadPage:this.loadPage}),t.jsx(xa,{collectionId:r})]}):null]})}}):null})}};const Da=n=>{const l=ie(n),e=ee(n),s=l?he(n,l):e?he(n,e):void 0,a=l?void 0:Gt(n),i=Ee(n)||"",o=je(n,i);return{address:e,isConnected:be(n),items:zt(n),totalItems:(s==null?void 0:s.total)||null,totalCollections:(a==null?void 0:a.total)||null,orphanItems:e&&!l?Jt(n,e,s==null?void 0:s.limit):qt(n),collections:Zt(n),selectedItemId:i,selectedItem:o,selectedCollectionId:l,visibleItems:ze(n),bodyShape:Je(n),wearableController:qe(n),isReviewing:xe(n),isLoading:V(me(n),Xt)||V(me(n),es),isPlayingEmote:Ze(n),hasUserOrphanItems:_e(n)}},Ma=n=>({onSetItems:l=>n(Ke(l)),onFetchCollections:(l,e)=>n(Kt(l,e)),onFetchOrphanItems:(l,e)=>n(Qe(l,e)),onFetchOrphanItem:l=>n(Qt(l))}),La=B(Da,Ma)(Ra);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 Oa=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=ts(r,a,s).map(p=>({value:p.id,text:ss(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 ka=n=>({baseWearables:as(n)}),se=B(ka)(Oa);let Ba=class extends _.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?G(p.urn)?Ge(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 te.ZOOM_IN:{await(s==null?void 0:s.scene.changeZoom(a));break}case te.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(v.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,{})]}),v.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:j,isLoading:b}=this.state,C=g.some(Q)&&(m==null?void 0:m.type)===y.EMOTE,T=o===v.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:T,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(ns),disableAutoRotate:!0,disableBackground:!0,wheelZoom:1.5,wheelStart:100,dev:is,onUpdate:()=>this.setState({isLoading:!0}),onLoad:this.handleWearablePreviewLoad,disableDefaultEmotes:C,showSceneBoundaries:j}),C?t.jsxs("div",{className:"zoom-controls",children:[t.jsx(c.Button,{className:"zoom-control zoom-in-control",onClick:()=>this.handleControlActionChange(te.ZOOM_IN),children:t.jsx(c.Icon,{name:"plus"})}),t.jsx(c.Button,{className:"zoom-control zoom-out-control",onClick:()=>this.handleControlActionChange(te.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 ${j?"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:v.BodyShape.MALE,text:d("body_shapes.male")},{value:v.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:ls(),label:d("wearable.color.skin"),onChange:this.handleSkinColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:a,colors:os(),label:d("wearable.color.eye"),onChange:this.handleEyeColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:i,colors:rs(),label:d("wearable.color.hair"),onChange:this.handleHairColorChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(se,{wearable:r[v.WearableCategory.HAIR],category:v.WearableCategory.HAIR,bodyShape:e,label:d("wearable.category.hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(se,{wearable:r[v.WearableCategory.FACIAL_HAIR],category:v.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(se,{wearable:r[v.WearableCategory.UPPER_BODY],category:v.WearableCategory.UPPER_BODY,bodyShape:e,label:d("wearable.category.upper_body"),onChange:this.handleWearableChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(se,{wearable:r[v.WearableCategory.LOWER_BODY],category:v.WearableCategory.LOWER_BODY,bodyShape:e,label:d("wearable.category.lower_body"),onChange:this.handleWearableChange})})]})]})]})}};const Wa=n=>{const l=ee(n);let e;const s=ie(n);let a=ds(n);s?(e=Fe(n).find(b=>b.id===s),a=a.filter(b=>b.collectionId===s)):a=a.filter(j=>!j.collectionId);const i=Ee(n)||"",o=je(n,i),r=Je(n),m=cs(n),g=ze(n),p=hs(n),I=!g.some(Q)&&p===v.PreviewEmote.IDLE,S="CreateSingleItemModal"in ms(n);return{address:l,bodyShape:r,collection:e,selectedItem:o,selectedBaseWearables:m?m[r]:null,skinColor:gs(n),eyeColor:ps(n),hairColor:us(n),emote:p,visibleItems:g,wearableController:qe(n),emotes:a,isPlayingEmote:I?!1:Ze(n),isImportFilesModalOpen:S,hasUserOrphanItems:_e(n)}},Fa=n=>({onSetBodyShape:l=>n(Cs(l)),onSetAvatarAnimation:l=>n(Is(l)),onSetSkinColor:l=>n(bs(l)),onSetEyeColor:l=>n(xs(l)),onSetHairColor:l=>n(_s(l)),onSetBaseWearable:(l,e,s)=>n(vs(l,e,s)),onFetchBaseWearables:()=>n(Es()),onSetWearablePreviewController:l=>n(js(l)),onSetItems:l=>n(Ke(l)),onFetchOrphanItems:(l,e)=>n(Qe(l,e)),onFetchCollectionItems:(l,e)=>n(Ss(l,e))}),Ha=B(Wa,Fa)(Ba);class Va extends _.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 ne extends _.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(ne,"defaultProps",{disabled:!1});class Ie extends _.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(ae,{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 st extends _.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===fs||e.keyCode===we||e.keyCode===Ts)this.handleAdd();else if(e.keyCode===ws||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(st,"defaultProps",{isDisabled:!1});let $a=class extends _.PureComponent{constructor(){super(...arguments);h(this,"analytics",ve());h(this,"state",this.getInitialState());h(this,"thumbnailInput",_.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,[ye]: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===v.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=>!v.WearableCategory.schema.enum.includes(r)),...e]:i=[...a.filter(r=>!v.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,j;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===v.WearableCategory.UPPER_BODY||(S=b.hides)!=null&&S.includes(v.WearableCategory.UPPER_BODY)?[v.BodyPartCategory.HANDS]:[],..."blockVrmExport"in b?{blockVrmExport:b.blockVrmExport}:{},..."outlineCompatible"in b?{outlineCompatible:b.outlineCompatible}:{}});const C={...e.contents,...await ys(g)},T={...e,name:i,description:o,rarity:m,data:b,contents:C,utility:r??void 0};s&&[Pe.UNPUBLISHED,Pe.UNDER_REVIEW].includes(s)&&(T.video=C[ye]),a(T,g),G(T.urn)&&((j=this.analytics)==null||j.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=Ps(e);this.setState({thumbnail:e,contents:{[Ne]: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:{[Ne]: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&&Re(s)?!1:a}isSkin(){const{data:e}=this.state;return(e==null?void 0:e.category)===v.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||!Ye(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=Ns(e.contents,a.category),o=As(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===v.WearableCategory.BODY_SHAPE)?i:i.filter(g=>g!==v.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(Rs,{item:e})]})}renderVideoDetails(e){if(!De(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(Me,{item:e,src:this.state.video,showMetrics:!0,onClick:a})]}):t.jsxs(t.Fragment,{children:[Ds(e)&&t.jsx(O,{name:"play",className:"play-video-button",onClick:a}),t.jsx(Me,{item:e,src:this.state.video,showMetrics:!0})]})})}renderPermissions(e){return t.jsx(Ms,{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:j,rarity:b,data:C,isDirty:T,hasItem:f}=this.state,D=v.Rarity.getRarities(),M=Ls();return t.jsx("div",{className:"RightPanel",children:i?t.jsx(ea,{id:e,children:(u,W,F)=>{var $;const le=W&&Re(W),N=this.canEditItemMetadata(u),J=u?Ce(u)?Os(u.contents):ks():[];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&&Xe(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(et,{name:I,onDelete:this.handleDeleteItem,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}),t.jsxs("div",{className:"container",children:[t.jsx(A,{label:d("item_editor.right_panel.details"),children:u?t.jsxs(t.Fragment,{children:[this.renderModelDetails(u),this.renderVideoDetails(u)]}):null}),t.jsx(A,{label:d("item_editor.right_panel.basics"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(Va,{label:d("global.name"),value:I,disabled:!N,maxLength:Bs,onChange:this.handleChangeName}),t.jsx(c.TextAreaField,{maxLength:Ws,onChange:this.handleChangeDescription,label:d("global.description"),placeholder:d("item_editor.right_panel.description_placeholder"),disabled:!N,value:S,rows:"2",cols:"12"}),a?t.jsx(c.TextAreaField,{maxLength:Fs,onChange:this.handleChangeUtility,label:d("global.utility"),placeholder:d("item_editor.right_panel.utility_placeholder"),disabled:!N,value:j,tooltip:{content:d("item_editor.right_panel.utility_tooltip")},rows:"2",cols:"12"}):null,t.jsx(ne,{itemId:u.id,label:d("global.category"),value:C.category,options:this.asCategorySelect(u.type,J),disabled:!N,onChange:this.handleChangeCategory}),!(u.urn&&G(u.urn))&&t.jsx(ne,{itemId:u.id,label:d("global.rarity"),value:b,options:this.asRaritySelect(D),disabled:u.isPublished||!N,onChange:this.handleChangeRarity})]}):null}),(u==null?void 0:u.type)===y.WEARABLE&&t.jsx(A,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.overrides")}),t.jsx(ae,{content:d("item_editor.right_panel.overrides_info"),className:"info"})]}),children:this.renderOverrides(u)}),(u==null?void 0:u.type)===y.EMOTE&&t.jsx(A,{label:d("item_editor.right_panel.animation"),children:u?t.jsx(ne,{itemId:u.id,label:d("create_single_item_modal.play_mode_label"),value:C.loop?de.LOOP:de.SIMPLE,options:this.asPlayModeSelect(M),disabled:!N,onChange:this.handlePlayModeChange}):null}),u&&De(u)&&(($=u.data.requiredPermissions)!=null&&$.length)?t.jsx(A,{label:d("item_editor.right_panel.required_permissions"),children:this.renderPermissions(u)}):null,t.jsx(A,{label:d("item_editor.right_panel.tags"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(st,{itemId:u.id,value:C.tags,onChange:this.handleChangeTags,isDisabled:!N}),r&&g&&p&&N&&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(A,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.copyright.title")}),t.jsx(ae,{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(A,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.outline_compatible.title")}),t.jsx(ae,{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")})]})})}),T?t.jsxs("div",{className:"edit-buttons",children:[t.jsx(c.Button,{secondary:!0,onClick:this.handleOnResetItem,children:d("global.cancel")}),t.jsx(Le,{primary:!0,onClick:this.handleOnSaveItem,network:v.Network.MATIC,children:d("global.save")})]}):o&&e?t.jsxs("p",{className:"danger-text",children:[d("global.error_ocurred"),": ",o]}):null]})]}):null}}):null})}};const Ua=n=>{var r;const l=Ee(n)||"",e=je(n,l),s=ee(n)||"",a=l&&e&&e.collectionId?Oe(n,e.collectionId):null,i=Hs(n),o=l?i[l]:null;return{address:s,collection:a,selectedItem:e,selectedItemId:l,canEditSelectedItem:e?a?He(n,s,a):Xe(e,s):!1,itemStatus:o,error:Vs(n),isConnected:be(n),isDownloading:$s(n),isCommitteeMember:ke(n),isCampaignEnabled:Us(n),campaignTag:Ks(n),campaignName:(r=Qs(n))==null?void 0:r[Xs(n)],isVrmOptOutEnabled:Ys(n),isWearableUtilityEnabled:Gs(n)}},Ya=n=>({onSaveItem:(l,e)=>n(zs(l,e)),onDeleteItem:l=>n($e(l)),onOpenModal:(l,e)=>n(Ve(l,e)),onDownload:l=>n(Js(l))}),Ga=B(Ua,Ya)($a);class on extends _.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(pa,{reviewedItems:e}),t.jsxs("div",{className:"content",children:[t.jsx(La,{reviewedItems:e,onResetReviewedItems:this.handleResetReviewedItems,onSetReviewedItems:this.handleOnSetReviewedItems}),t.jsx(Ha,{}),t.jsx(Ga,{})]})]})})}}export{on as default};
1
+ var dt=Object.defineProperty;var ct=(n,l,e)=>l in n?dt(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e;var h=(n,l,e)=>ct(n,typeof l!="symbol"?l+"":l,e);import{af as z,H as t,M as c,G as d,bm as H,bC as ht,D as _,gs as K,L as X,K as R,ce as Le,b8 as v,N as B,bw as V,eC as mt,gt,gu as pt,gv as ut,gw as Ct,gx as It,gy as bt,gz as xt,gA as _t,gB as vt,gC as L,eq as Et,gD as Z,gE as fe,gF as ie,fb as Oe,fq as jt,fW as St,fX as ft,ez as he,gl as Tt,gG as wt,aH as ee,gH as yt,da as be,gI as xe,bt as ke,gJ as Pt,fY as Nt,eD as me,aW as At,gK as Rt,gL as Dt,gM as Mt,gN as Lt,fn as Ot,f_ as kt,f$ as Bt,Z as Be,bv as We,gO as Wt,eR as Te,bD as Ft,fj as Fe,ae as Ht,gP as He,eG as _e,X as Ve,et as Vt,eo as $e,fE as Q,dC as ge,ep as $t,eU as pe,gQ as Ue,bk as ve,fU as Ye,eX as y,er as G,fz as Ge,fA as ue,J as O,f5 as Ce,dB as Ut,eP as Yt,eA as Gt,gR as Ee,fa as je,fi as zt,gS as Jt,gT as qt,gU as Zt,gV as ze,gW as Je,gX as qe,gY as Ze,fI as Ke,eJ as Kt,eI as Qe,eK as Qt,eM as Xt,eN as es,gZ as ts,g_ as ss,g$ as as,h0 as te,h1 as oe,h2 as ns,ec as is,h3 as ls,h4 as os,h5 as rs,h6 as ds,h7 as cs,h8 as hs,h9 as ms,ha as gs,hb as ps,hc as us,hd as Cs,he as Is,hf as bs,hg as xs,hh as _s,hi as vs,hj as Es,hk as js,fZ as Ss,bN as ae,hl as fs,hm as we,hn as Ts,ho as ws,eT as ye,fF as re,hp as de,eS as ys,eO as Pe,eV as Ps,eW as Ne,eY as Ae,eZ as Re,hq as Ns,hr as As,e_ as Rs,e$ as De,f0 as Me,hs as Ds,f8 as Ms,ht as Ls,hu as Os,hv as ks,hw as Xe,hx as Bs,hy as Ws,hz as Fs,fc as Hs,hA as Vs,hB as $s,eF as Us,hC as Ys,fd as Gs,ff as zs,hD as Js}from"./index-KAz1FpF_.js";import{J as qs}from"./JumpIn.container-D3MOQe7Y.js";import{C as Zs}from"./CollectionProvider.container-BzpdsqPe.js";import{C as et}from"./ConfirmDelete-D--HGMws.js";import{C as tt}from"./CollectionStatus.container-CG15tMSD.js";import{d as Ks,e as Qs,c as Xs}from"./selectors-CNQHtVVh.js";import{I as ea}from"./ItemProvider.container-MISPz4DG.js";const ta=({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(ht,{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")})]})]}),sa=z.memo(ta);var w=(n=>(n.REJECT_COLLECTION="REJECT_COLLECTION",n.REJECT_CURATION="REJECT_CURATION",n.DISABLE_COLLECTION="DISABLE_COLLECTION",n.DISABLE_THIRD_PARTY="DISABLE_THIRD_PARTY",n))(w||{});const k="item_editor.top_panel.rejection_modal",aa=({open:n,type:l,isLoading:e,thirdParty:s,hasPendingTransaction:a,onDisableThirdParty:i,collection:o,curation:r,onReject:m,onRejectCuration:g,onClose:p})=>{const I=_.useMemo(()=>{switch(l){case w.DISABLE_COLLECTION:return k+".disable_collection";case w.REJECT_CURATION:return k+".reject_curation";case w.DISABLE_THIRD_PARTY:return k+".disable_third_party";default:return""}},[l]),S=()=>{switch(l){case w.DISABLE_COLLECTION:m(o);break;case w.REJECT_CURATION:g(r.collectionId);break;case w.DISABLE_THIRD_PARTY:s&&i(s.id);break}},j=l===w.DISABLE_COLLECTION&&!o.isApproved||l===w.DISABLE_THIRD_PARTY&&!(s!=null&&s.isApproved)||l===w.REJECT_COLLECTION&&!o.isApproved||l===w.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(na,{i18nKey:I}):j?t.jsx(ia,{link:o.forumLink,onClose:p}):t.jsx(la,{i18nKey:I,isLoading:e,onClose:p,onConfirm:S})})},na=({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(X,{to:R.activity(),children:d("global.activity")})}})}),t.jsx(c.Loader,{active:!0,size:"large"})]})]}),ia=({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")})]})]}),la=({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(Le,{primary:!0,onClick:e,disabled:l,loading:l,network:v.Network.MATIC,children:d(`${n}.action`)}),t.jsx(c.Button,{disabled:l,onClick:s,children:d("global.cancel")})]})]}),oa=z.memo(aa),ra=(n,l)=>({isLoading:V(mt(n),_t)||V(gt(n),vt)||pt(n),hasPendingTransaction:ut(n)||!!(l.thirdParty&&Ct(n,l.thirdParty.id))}),da=n=>({onReject:l=>n(It(l)),onRejectCuration:l=>n(bt(l)),onDisableThirdParty:l=>n(xt(l))}),ca=B(ra,da)(oa);var x=(n=>(n[n.APPROVE=0]="APPROVE",n[n.REJECT=1]="REJECT",n[n.ENABLE=2]="ENABLE",n[n.DISABLE=3]="DISABLE",n[n.DEPLOY_MISSING_ENTITIES=4]="DEPLOY_MISSING_ENTITIES",n))(x||{});let ha=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=Et(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(qs,{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(ca,{type:m,open:!0,collection:e,curation:i,thirdParty:r,onClose:()=>this.setShowRejectionModal(null)}),(i==null?void 0:i.assignee)&&g&&t.jsx(sa,{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,onDeployMissingEntities:g,reviewedItems:p,totalItems:I}=this.props,S={[x.APPROVE]:()=>a!=null&&a.assignee&&i!==(a==null?void 0:a.assignee)?this.setState({showApproveConfirmModal:!0}):L(s)?m(s):r(s),[x.ENABLE]:()=>r(s),[x.DISABLE]:()=>this.setShowRejectionModal(o?w.DISABLE_THIRD_PARTY:w.DISABLE_COLLECTION),[x.REJECT]:()=>{(a==null?void 0:a.status)===K.PENDING?this.setShowRejectionModal(w.REJECT_CURATION):this.setShowRejectionModal(w.REJECT_COLLECTION)},[x.DEPLOY_MISSING_ENTITIES]:()=>g(s)},j={[x.APPROVE]:"approve",[x.ENABLE]:"enable",[x.DISABLE]:"disable",[x.REJECT]:"reject",[x.DEPLOY_MISSING_ENTITIES]:"deploy_missing_entities"},b=e===x.APPROVE||e===x.ENABLE||e===x.DEPLOY_MISSING_ENTITIES,C=!L(s)||!!I&&p.length>=Z(I);return t.jsx(c.Popup,{content:d("item_editor.top_panel.items_pending_to_review"),disabled:C,position:"bottom center",trigger:t.jsx("div",{children:t.jsx(c.Button,{primary:b,onClick:()=>S[e](),disabled:L(s)&&e===x.APPROVE&&!!I&&p.length<Z(I),children:d(`item_editor.top_panel.${j[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(x.APPROVE,e,s),m&&this.renderButton(x.REJECT,e,s),!m&&(r==null?void 0:r.isApproved)&&this.renderButton(x.DISABLE,e,null)]})});h(this,"renderButtons",(e,s)=>s&&e.isApproved&&s.status==="pending"?t.jsxs(t.Fragment,{children:[this.renderButton(x.APPROVE,e,s),this.renderButton(x.REJECT,e,s)]}):s&&e.isApproved&&(s.status==="approved"||s.status==="rejected")?t.jsxs(t.Fragment,{children:[this.renderButton(x.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(x.DEPLOY_MISSING_ENTITIES,e,s)]}):fe(e)&&e.isApproved?t.jsxs(t.Fragment,{children:[this.renderButton(x.DISABLE,e,s),this.props.hasCollectionMissingEntities&&this.renderButton(x.DEPLOY_MISSING_ENTITIES,e,s)]}):fe(e)?this.renderButton(x.ENABLE,e,s):t.jsxs(t.Fragment,{children:[this.renderButton(x.APPROVE,e,s),this.renderButton(x.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 ma=n=>{const l=ie(n),e=l?Oe(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)?Tt(n,e):null,m=l?wt(n,l):!1;return{address:ee(n),items:s,totalItems:(o==null?void 0:o.total)||null,collection:e,itemCurations:a,thirdParty:r,curation:i,chainId:yt(n),isConnected:be(n),isReviewing:xe(n),isCommitteeMember:ke(n),selectedCollectionId:l,hasCollectionMissingEntities:m,isLoading:V(Pt(n),Ot)||V(Nt(n),kt)||V(me(n),Bt)}},ga=n=>({onNavigate:l=>n(At(l)),onSetAssignee:(l,e,s)=>n(Rt(l,e,s)),onInitiateTPApprovalFlow:l=>n(Dt(l)),onInitiateApprovalFlow:l=>n(Mt(l)),onDeployMissingEntities:l=>n(Lt(l))}),pa=B(ma,ga)(ha),ua="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",Ca=n=>{const{collectionId:l,itemName:e}=n,[s,a]=_.useState(!1),[i,o]=_.useState(null),r=Be(),m=We();_.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:ua,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(X,{to:R.collectionDetail(l),children:t.jsx(c.Button,{className:"ItemAddedToast view-collection-link",basic:!0,children:p})})}})}):null},Ia=z.memo(Ca),ba=n=>({itemName:Wt(n)}),xa=B(ba)(Ia),_a=({collection:n,address:l,hasUserOrphanItems:e,isLoggedIn:s,isReviewing:a,onOpenModal:i,onDeleteCollection:o})=>{var u,W;const r=We(),m=Be(),g=((u=r.state)==null?void 0:u.fromParam)===Te.COLLECTIONS,p=((W=r.state)==null?void 0:W.fromParam)===Te.TP_COLLECTIONS,I=_.useCallback(()=>{m.push(R.collections())},[m]),S=_.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]),j=_.useCallback(()=>{i("CreateCollectionModal")},[i]),b=_.useCallback(()=>{n&&i("CreateSingleItemModal",{collectionId:n.id})},[n,i]),C=_.useCallback(()=>{n&&i("AddExistingItemModal",{collectionId:n.id})},[n,i]),T=_.useCallback(()=>{n&&i("EditCollectionNameModal",{collection:n})},[n,i]),f=_.useCallback(()=>{n&&o(n)},[n,o]),D=_.useCallback(()=>{const F=n&&Ft(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(X,{to:R.collectionDetail(n.id),children:n.name}),t.jsx(tt,{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:T,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(et,{name:n.name,onDelete:f,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}):null},[n,l,e,g,p]),M=_.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:j,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()})},va=_a,Ea=n=>{let l;const e=ie(n);e&&(l=Fe(n).find(i=>i.id===e));const s=ee(n);return{address:s,isLoggedIn:Ht(n),isReviewing:xe(n),collection:l,hasEditRights:l!==void 0&&s!==void 0&&He(n,s,l),hasUserOrphanItems:_e(n)}},ja=n=>({onOpenModal:(l,e)=>n(Ve(l,e)),onDeleteCollection:l=>n(Vt(l)),onDeleteItem:l=>n($e(l))}),Sa=B(Ea,ja)(va),P=10;class A extends _.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 fa extends _.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 Q(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(X,{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($t,{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:Ue(e,i),position:"top center",trigger:this.renderToggleItem()})]})})}}const Ta=fa;var E=(n=>(n.TO_REVIEW="to-review",n.REVIEWED="reviewed",n.ALL_ITEMS="all-items",n))(E||{});const wa={[E.TO_REVIEW]:1,[E.REVIEWED]:1,[E.ALL_ITEMS]:1};class ya extends _.PureComponent{constructor(){super(...arguments);h(this,"state",{currentTab:E.TO_REVIEW,currentPages:wa,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===E.TO_REVIEW&&!Ye(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(!Ue(e,s))return;let m=a.filter(p=>p.id!==e.id);if(Q(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?G(e.urn)?Ge(e.urn):ue(e.urn):null,ITEM_TYPE:e.type,ITEM_NAME:e.name,ITEM_IS_THIRD_PARTY:G(e.urn)})),r(m)});h(this,"handleTabChange",e=>{const{onLoadPage:s,onReviewItems:a,onResetReviewedItems:i}=this.props,{currentPages:o}=this.state;e===E.ALL_ITEMS?this.setState({showAllItemsTabChangeModal:!1},()=>{i(),s(o[E.ALL_ITEMS])}):e===E.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!==E.REVIEWED&&i(+s.activePage)});h(this,"handleSwitchToAllItemsTab",()=>{const{reviewedItems:e}=this.props;e.length>0?this.setState({showAllItemsTabChangeModal:!0}):this.handleTabChange(E.ALL_ITEMS)});h(this,"getIsReviewingTPItems",()=>{const{collection:e,isReviewing:s}=this.props;return e?G(e.urn)&&s:!1});h(this,"renderSidebarItem",e=>{const{collection:s,selectedItemId:a,bodyShape:i,isPlayingEmote:o}=this.props;return t.jsx(Ta,{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(Q);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(A,{label:this.renderCollapsableLabel(y.WEARABLE),children:s.map(this.renderSidebarItem)}),t.jsx(A,{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 E.TO_REVIEW:return t.jsxs(t.Fragment,{children:[this.renderSidebarCategory(e),!m&&a?this.renderTabPagination(a):null]});case E.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 E.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 E.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 E.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:E.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(E.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===E.TO_REVIEW,onClick:()=>this.handleTabChange(E.TO_REVIEW),children:d("item_editor.left_panel.to_review")}),t.jsx(c.Tabs.Tab,{active:e===E.REVIEWED,onClick:()=>this.handleTabChange(E.REVIEWED),children:d("item_editor.left_panel.reviewed")}),t.jsx(c.Tabs.Tab,{active:e===E.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 Pa extends _.PureComponent{render(){const{collection:l,isSelected:e}=this.props;return t.jsx("div",{className:`SidebarCollection ${e?"is-selected":""}`,children:t.jsxs(X,{to:R.itemEditor({collectionId:l.id}),children:[t.jsx(Ut,{collectionId:l.id}),t.jsxs("div",{className:"wrapper",children:[t.jsxs("div",{className:"name",children:[t.jsx(tt,{collection:l}),l.name]}),t.jsx("div",{className:"count",children:d("item_editor.left_panel.items_count",{count:l.itemCount})})]})]})})}}const Na=Pa;class Aa extends _.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(Na,{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 Y=(n=>(n.COLLECTIONS="collections",n.ORPHAN_ITEMS="orphanItems",n))(Y||{});const U=1;let Ra=class extends _.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===Y.COLLECTIONS&&!e})}getInitialState(){const{selectedCollectionId:e,selectedItemId:s}=this.props;let a=Y.COLLECTIONS;return!e&&s&&(a=Y.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:j,onFetchOrphanItem:b}=this.props,{initialPage:C,pages:T}=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=T[T.length-1],M=Math.min(f,D+1);T.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);j(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&&j([m]),e.selectedCollectionId!==o&&j([])}componentWillUnmount(){const{onSetItems:e}=this.props;e([])}getItems(e,s,a){const{selectedCollectionId:i,orphanItems:o,isReviewing:r}=this.props;return i&&e?Yt(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:j,wearableController:b,isLoading:C,hasUserOrphanItems:T,onSetItems:f,onSetReviewedItems:D,onResetReviewedItems:M}=this.props,{pages:u,showSamplesModalAgain:W}=this.state,F=!r&&T,le=this.isCollectionTabActive()&&!r,N=!this.isCollectionTabActive()||r;return t.jsx("div",{className:"LeftPanel",children:j?t.jsx(Zs,{id:r,itemSelected:o,itemsPage:u,itemsPageSize:P,fetchCollectionItemsOptions:{status:I?K.PENDING:void 0},onChangePage:J=>this.setState({pages:[J]}),children:({paginatedCollections:J,collection:$,paginatedItems:at,initialPage:nt,isLoadingCollection:it,isLoadingCollectionItems:lt,itemCurations:ot})=>{const q=this.getItems($,at,ot),Se=this.isCollectionTabActive(),rt=r&&$?nt:this.state.initialPage;return t.jsxs(t.Fragment,{children:[t.jsx(Sa,{}),F?t.jsxs(c.Tabs,{isFullscreen:!0,children:[t.jsx(c.Tabs.Tab,{active:Se,onClick:()=>this.handleTabChange(Y.COLLECTIONS),children:d("collections_page.collections")}),t.jsx(c.Tabs.Tab,{active:!Se,onClick:()=>this.handleTabChange(Y.ORPHAN_ITEMS),children:d("item_editor.left_panel.items")})]}):null,le?t.jsx(Aa,{collections:J,totalCollections:a||i.length,items:e,hasHeader:q.length>0,selectedCollectionId:r,onLoadPage:this.loadPage,isLoading:it}):null,N?t.jsxs(t.Fragment,{children:[t.jsx(ya,{items:q,totalItems:s||q.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:rt,isLoading:lt||C,onToggleShowSamplesModalAgain:this.handleToggleShowSamplesModalAgain,showSamplesModalAgain:W,onReviewItems:()=>D(q),onLoadRandomPage:()=>this.loadRandomPage(q),onLoadPage:this.loadPage}),t.jsx(xa,{collectionId:r})]}):null]})}}):null})}};const Da=n=>{const l=ie(n),e=ee(n),s=l?he(n,l):e?he(n,e):void 0,a=l?void 0:Gt(n),i=Ee(n)||"",o=je(n,i);return{address:e,isConnected:be(n),items:zt(n),totalItems:(s==null?void 0:s.total)||null,totalCollections:(a==null?void 0:a.total)||null,orphanItems:e&&!l?Jt(n,e,s==null?void 0:s.limit):qt(n),collections:Zt(n),selectedItemId:i,selectedItem:o,selectedCollectionId:l,visibleItems:ze(n),bodyShape:Je(n),wearableController:qe(n),isReviewing:xe(n),isLoading:V(me(n),Xt)||V(me(n),es),isPlayingEmote:Ze(n),hasUserOrphanItems:_e(n)}},Ma=n=>({onSetItems:l=>n(Ke(l)),onFetchCollections:(l,e)=>n(Kt(l,e)),onFetchOrphanItems:(l,e)=>n(Qe(l,e)),onFetchOrphanItem:l=>n(Qt(l))}),La=B(Da,Ma)(Ra);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 Oa=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=ts(r,a,s).map(p=>({value:p.id,text:ss(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 ka=n=>({baseWearables:as(n)}),se=B(ka)(Oa);let Ba=class extends _.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?G(p.urn)?Ge(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 te.ZOOM_IN:{await(s==null?void 0:s.scene.changeZoom(a));break}case te.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(v.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,{})]}),v.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:j,isLoading:b}=this.state,C=g.some(Q)&&(m==null?void 0:m.type)===y.EMOTE,T=o===v.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:T,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(ns),disableAutoRotate:!0,disableBackground:!0,wheelZoom:1.5,wheelStart:100,dev:is,onUpdate:()=>this.setState({isLoading:!0}),onLoad:this.handleWearablePreviewLoad,disableDefaultEmotes:C,showSceneBoundaries:j}),C?t.jsxs("div",{className:"zoom-controls",children:[t.jsx(c.Button,{className:"zoom-control zoom-in-control",onClick:()=>this.handleControlActionChange(te.ZOOM_IN),children:t.jsx(c.Icon,{name:"plus"})}),t.jsx(c.Button,{className:"zoom-control zoom-out-control",onClick:()=>this.handleControlActionChange(te.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 ${j?"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:v.BodyShape.MALE,text:d("body_shapes.male")},{value:v.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:ls(),label:d("wearable.color.skin"),onChange:this.handleSkinColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:a,colors:os(),label:d("wearable.color.eye"),onChange:this.handleEyeColorChange})}),t.jsx("div",{className:"dropdown-container",children:t.jsx(ce,{currentColor:i,colors:rs(),label:d("wearable.color.hair"),onChange:this.handleHairColorChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(se,{wearable:r[v.WearableCategory.HAIR],category:v.WearableCategory.HAIR,bodyShape:e,label:d("wearable.category.hair"),onChange:this.handleWearableChange,isNullable:!0})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(se,{wearable:r[v.WearableCategory.FACIAL_HAIR],category:v.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(se,{wearable:r[v.WearableCategory.UPPER_BODY],category:v.WearableCategory.UPPER_BODY,bodyShape:e,label:d("wearable.category.upper_body"),onChange:this.handleWearableChange})}),t.jsx("div",{className:"dropdown-container",children:r&&t.jsx(se,{wearable:r[v.WearableCategory.LOWER_BODY],category:v.WearableCategory.LOWER_BODY,bodyShape:e,label:d("wearable.category.lower_body"),onChange:this.handleWearableChange})})]})]})]})}};const Wa=n=>{const l=ee(n);let e;const s=ie(n);let a=ds(n);s?(e=Fe(n).find(b=>b.id===s),a=a.filter(b=>b.collectionId===s)):a=a.filter(j=>!j.collectionId);const i=Ee(n)||"",o=je(n,i),r=Je(n),m=cs(n),g=ze(n),p=hs(n),I=!g.some(Q)&&p===v.PreviewEmote.IDLE,S="CreateSingleItemModal"in ms(n);return{address:l,bodyShape:r,collection:e,selectedItem:o,selectedBaseWearables:m?m[r]:null,skinColor:gs(n),eyeColor:ps(n),hairColor:us(n),emote:p,visibleItems:g,wearableController:qe(n),emotes:a,isPlayingEmote:I?!1:Ze(n),isImportFilesModalOpen:S,hasUserOrphanItems:_e(n)}},Fa=n=>({onSetBodyShape:l=>n(Cs(l)),onSetAvatarAnimation:l=>n(Is(l)),onSetSkinColor:l=>n(bs(l)),onSetEyeColor:l=>n(xs(l)),onSetHairColor:l=>n(_s(l)),onSetBaseWearable:(l,e,s)=>n(vs(l,e,s)),onFetchBaseWearables:()=>n(Es()),onSetWearablePreviewController:l=>n(js(l)),onSetItems:l=>n(Ke(l)),onFetchOrphanItems:(l,e)=>n(Qe(l,e)),onFetchCollectionItems:(l,e)=>n(Ss(l,e))}),Ha=B(Wa,Fa)(Ba);class Va extends _.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 ne extends _.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(ne,"defaultProps",{disabled:!1});class Ie extends _.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(ae,{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 st extends _.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===fs||e.keyCode===we||e.keyCode===Ts)this.handleAdd();else if(e.keyCode===ws||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(st,"defaultProps",{isDisabled:!1});let $a=class extends _.PureComponent{constructor(){super(...arguments);h(this,"analytics",ve());h(this,"state",this.getInitialState());h(this,"thumbnailInput",_.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,[ye]: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===v.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=>!v.WearableCategory.schema.enum.includes(r)),...e]:i=[...a.filter(r=>!v.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,j;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===v.WearableCategory.UPPER_BODY||(S=b.hides)!=null&&S.includes(v.WearableCategory.UPPER_BODY)?[v.BodyPartCategory.HANDS]:[],..."blockVrmExport"in b?{blockVrmExport:b.blockVrmExport}:{},..."outlineCompatible"in b?{outlineCompatible:b.outlineCompatible}:{}});const C={...e.contents,...await ys(g)},T={...e,name:i,description:o,rarity:m,data:b,contents:C,utility:r??void 0};s&&[Pe.UNPUBLISHED,Pe.UNDER_REVIEW].includes(s)&&(T.video=C[ye]),a(T,g),G(T.urn)&&((j=this.analytics)==null||j.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=Ps(e);this.setState({thumbnail:e,contents:{[Ne]: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:{[Ne]: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&&Re(s)?!1:a}isSkin(){const{data:e}=this.state;return(e==null?void 0:e.category)===v.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||!Ye(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=Ns(e.contents,a.category),o=As(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===v.WearableCategory.BODY_SHAPE)?i:i.filter(g=>g!==v.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(Rs,{item:e})]})}renderVideoDetails(e){if(!De(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(Me,{item:e,src:this.state.video,showMetrics:!0,onClick:a})]}):t.jsxs(t.Fragment,{children:[Ds(e)&&t.jsx(O,{name:"play",className:"play-video-button",onClick:a}),t.jsx(Me,{item:e,src:this.state.video,showMetrics:!0})]})})}renderPermissions(e){return t.jsx(Ms,{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:j,rarity:b,data:C,isDirty:T,hasItem:f}=this.state,D=v.Rarity.getRarities(),M=Ls();return t.jsx("div",{className:"RightPanel",children:i?t.jsx(ea,{id:e,children:(u,W,F)=>{var $;const le=W&&Re(W),N=this.canEditItemMetadata(u),J=u?Ce(u)?Os(u.contents):ks():[];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&&Xe(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(et,{name:I,onDelete:this.handleDeleteItem,trigger:t.jsx(c.Dropdown.Item,{text:d("global.delete")})})]})}):null]}),t.jsxs("div",{className:"container",children:[t.jsx(A,{label:d("item_editor.right_panel.details"),children:u?t.jsxs(t.Fragment,{children:[this.renderModelDetails(u),this.renderVideoDetails(u)]}):null}),t.jsx(A,{label:d("item_editor.right_panel.basics"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(Va,{label:d("global.name"),value:I,disabled:!N,maxLength:Bs,onChange:this.handleChangeName}),t.jsx(c.TextAreaField,{maxLength:Ws,onChange:this.handleChangeDescription,label:d("global.description"),placeholder:d("item_editor.right_panel.description_placeholder"),disabled:!N,value:S,rows:"2",cols:"12"}),a?t.jsx(c.TextAreaField,{maxLength:Fs,onChange:this.handleChangeUtility,label:d("global.utility"),placeholder:d("item_editor.right_panel.utility_placeholder"),disabled:!N,value:j,tooltip:{content:d("item_editor.right_panel.utility_tooltip")},rows:"2",cols:"12"}):null,t.jsx(ne,{itemId:u.id,label:d("global.category"),value:C.category,options:this.asCategorySelect(u.type,J),disabled:!N,onChange:this.handleChangeCategory}),!(u.urn&&G(u.urn))&&t.jsx(ne,{itemId:u.id,label:d("global.rarity"),value:b,options:this.asRaritySelect(D),disabled:u.isPublished||!N,onChange:this.handleChangeRarity})]}):null}),(u==null?void 0:u.type)===y.WEARABLE&&t.jsx(A,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.overrides")}),t.jsx(ae,{content:d("item_editor.right_panel.overrides_info"),className:"info"})]}),children:this.renderOverrides(u)}),(u==null?void 0:u.type)===y.EMOTE&&t.jsx(A,{label:d("item_editor.right_panel.animation"),children:u?t.jsx(ne,{itemId:u.id,label:d("create_single_item_modal.play_mode_label"),value:C.loop?de.LOOP:de.SIMPLE,options:this.asPlayModeSelect(M),disabled:!N,onChange:this.handlePlayModeChange}):null}),u&&De(u)&&(($=u.data.requiredPermissions)!=null&&$.length)?t.jsx(A,{label:d("item_editor.right_panel.required_permissions"),children:this.renderPermissions(u)}):null,t.jsx(A,{label:d("item_editor.right_panel.tags"),children:u?t.jsxs(t.Fragment,{children:[t.jsx(st,{itemId:u.id,value:C.tags,onChange:this.handleChangeTags,isDisabled:!N}),r&&g&&p&&N&&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(A,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.copyright.title")}),t.jsx(ae,{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(A,{label:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"overrides-label-panel",children:d("item_editor.right_panel.outline_compatible.title")}),t.jsx(ae,{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")})]})})}),T?t.jsxs("div",{className:"edit-buttons",children:[t.jsx(c.Button,{secondary:!0,onClick:this.handleOnResetItem,children:d("global.cancel")}),t.jsx(Le,{primary:!0,onClick:this.handleOnSaveItem,network:v.Network.MATIC,children:d("global.save")})]}):o&&e?t.jsxs("p",{className:"danger-text",children:[d("global.error_ocurred"),": ",o]}):null]})]}):null}}):null})}};const Ua=n=>{var r;const l=Ee(n)||"",e=je(n,l),s=ee(n)||"",a=l&&e&&e.collectionId?Oe(n,e.collectionId):null,i=Hs(n),o=l?i[l]:null;return{address:s,collection:a,selectedItem:e,selectedItemId:l,canEditSelectedItem:e?a?He(n,s,a):Xe(e,s):!1,itemStatus:o,error:Vs(n),isConnected:be(n),isDownloading:$s(n),isCommitteeMember:ke(n),isCampaignEnabled:Us(n),campaignTag:Ks(n),campaignName:(r=Qs(n))==null?void 0:r[Xs(n)],isVrmOptOutEnabled:Ys(n),isWearableUtilityEnabled:Gs(n)}},Ya=n=>({onSaveItem:(l,e)=>n(zs(l,e)),onDeleteItem:l=>n($e(l)),onOpenModal:(l,e)=>n(Ve(l,e)),onDownload:l=>n(Js(l))}),Ga=B(Ua,Ya)($a);class on extends _.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(pa,{reviewedItems:e}),t.jsxs("div",{className:"content",children:[t.jsx(La,{reviewedItems:e,onResetReviewedItems:this.handleResetReviewedItems,onSetReviewedItems:this.handleOnSetReviewedItems}),t.jsx(Ha,{}),t.jsx(Ga,{})]})]})})}}export{on as default};
@@ -1 +1 @@
1
- var C=Object.defineProperty;var v=(s,r,e)=>r in s?C(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var l=(s,r,e)=>v(s,typeof r!="symbol"?r+"":r,e);import{aB as b,D as u,Q as P,H as t,al as L,ah as p,M as a,aj as g,G as d,aX as f,K as y,aY as k,aZ as j,J as h,N as w,a_ as N,an as S,aq as F,ap as m,a$ as I,ae as R,at as A,b0 as E,O as _,b1 as O,b2 as T,b3 as B,b4 as M,b5 as D,av as U,b6 as $,X as V,Y as q}from"./index-C2Y2eZ28.js";import{B as W}from"./Back-iVIqxATW.js";import{S as K}from"./SDKTag-zvq-EFlK.js";function X(s){return s?{id:s.id,title:s.title,description:s.description,thumbnail:s.thumbnail,isPublic:!1,sceneId:s.sceneId,ethAddress:s.ethAddress,createdAt:s.createdAt,updatedAt:s.updatedAt,layout:s.layout,isTemplate:!1,video:s.video,templateStatus:null}:null}const Y=b.get("PROFILE_URL","");let z=class extends u.PureComponent{constructor(){super(...arguments);l(this,"handlePreview",()=>{this.props.onPreview()});l(this,"handleLike",()=>{const{currentPool:e,isLoggedIn:n,onOpenModal:o}=this.props;e&&(n?this.props.onLikePool(e.id,!e.like):o("LikeModal",{}))});l(this,"handleBack",()=>{const{history:e}=this.props;e.push(y.poolSearch())})}componentDidMount(){const{match:e,onLoadProject:n}=this.props;e.params.projectId&&n(e.params.projectId,this.getType())}componentDidUpdate(){const e=this.getCurrentProject(),n=this.getCurrentScene(),{isLoading:o,onLoadProjectScene:i}=this.props;e&&!n&&!o&&i(e,this.getType())}componentWillUnmount(){this.props.onCloseEditor()}getType(){return this.props.match&&this.props.match.params&&this.props.match.params.type||P.PUBLIC}getCurrentProject(){const{currentProject:e,currentPool:n}=this.props;switch(this.getType()){case"pool":return n;default:return e}}getCurrentScene(){const{scenes:e}=this.props,n=this.getCurrentProject();return n&&e[n.sceneId]||null}getCurrentPool(){const{currentPool:e}=this.props;switch(this.getType()){case"pool":return e;default:return null}}getParcelCount(){const e=this.getCurrentProject();return e?e.layout.cols*e.layout.rows:0}getObjectCount(){const e=this.getCurrentScene();if(!e||!e.sdk6)return 0;const n=this.getParcelCount();if(n===0)return 0;const o=Object.keys(e.sdk6.entities).length;return o<n?0:o-n}renderNotFount(){return t.jsx(L,{})}renderLoading(){return t.jsxs(t.Fragment,{children:[t.jsx(p,{}),t.jsx(a.Page,{isFullscreen:!0,children:t.jsx(a.Loader,{active:!0,size:"huge"})}),t.jsx(g,{isFullscreen:!0})]})}handleExportProject(){const{onOpenModal:e}=this.props;e("ExportModal",{project:X(this.getCurrentProject())})}renderAuthor(){const{currentAuthor:e}=this.props;if(!e)return null;const n=e.avatars[0].ethAddress;return t.jsxs("div",{className:"author",children:[d("public_page.made_by"),t.jsx(f,{address:n,as:"a",href:`${Y}/accounts/${n}`})]})}render(){const{isFetching:e,isPreviewing:n,isReady:o}=this.props;if(e)return this.renderLoading();const i=this.getCurrentProject();if(!i)return this.renderNotFount();const c=this.getCurrentPool(),x=this.getCurrentScene();return t.jsxs(t.Fragment,{children:[!n&&t.jsxs(t.Fragment,{children:[t.jsx(p,{}),t.jsxs(a.Container,{className:"back-container",children:[t.jsx(W,{absolute:!0,onClick:this.handleBack}),t.jsxs(a.Button,{secondary:!0,onClick:this.handleExportProject.bind(this),loading:!i,disabled:!i,children:[t.jsx(a.Icon,{name:"download"}),d("scene_detail_page.download_scene")]})]})]}),t.jsxs("div",{className:"SceneViewPage"+(n?" preview":" mini"),children:[t.jsx("div",{className:"thumbnail",style:{backgroundImage:`url("${i.thumbnail}")`},children:t.jsx(a.Responsive,{minWidth:1025,as:u.Fragment,children:t.jsx(k,{isReadOnly:!0,type:this.getType()},i.id)})}),t.jsxs("div",{className:"scene-action-list",children:[c&&t.jsx("div",{className:"scene-action",children:t.jsx(j,{text:t.jsxs(t.Fragment,{children:[t.jsx(h,{name:c.like?"heart-full":"heart"}),c.likes>0&&t.jsx("span",{className:"LikeCount",children:c.likes})]}),type:"circle",onClick:this.handleLike})}),t.jsx("div",{style:{flex:1}}),t.jsx(a.Responsive,{minWidth:1025,as:u.Fragment,children:t.jsx("div",{className:"scene-action",children:t.jsx(j,{icon:"view",type:"circle",isActive:n,isDisabled:!o,onClick:this.handlePreview})})})]}),t.jsxs("div",{className:"detail",children:[t.jsxs("div",{className:"title",children:[t.jsx("h1",{children:i.title}),t.jsx(K,{scene:x})]}),this.renderAuthor(),i.description&&t.jsx("div",{className:"description",children:t.jsx("p",{children:i.description})}),t.jsxs("div",{className:"component-list",children:[t.jsxs("div",{className:"component",children:[t.jsx(h,{name:"scene-parcel"})," ",d("public_page.parcel_count",{parcels:this.getParcelCount()})]}),t.jsxs("div",{className:"component",children:[t.jsx(h,{name:"scene-object"})," ",d("public_page.item_count",{items:this.getObjectCount()})]})]})]})]}),!n&&t.jsx(g,{})]})}};const G=s=>({isPreviewing:S(s),isReady:!F(s)&&m(s),isFetching:I(s)&&!m(s),isLoggedIn:R(s),currentProject:A(s),currentPool:E(s),scenes:_(s),currentAuthor:O(s),isLoading:T(s)||!!B(s).length}),H=s=>({onLikePool:(r,e=!0)=>s(M(r,e)),onPreview:()=>s(D(!0)),onCloseEditor:()=>s(U()),onLoadProject:(r,e=P.PUBLIC)=>s($(r,e)),onOpenModal:(r,e)=>s(V(r,e)),onLoadProjectScene:(r,e)=>s(q(r,e))}),se=w(G,H)(N(z));export{se as default};
1
+ var C=Object.defineProperty;var v=(s,r,e)=>r in s?C(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var l=(s,r,e)=>v(s,typeof r!="symbol"?r+"":r,e);import{aB as b,D as u,Q as P,H as t,al as L,ah as p,M as a,aj as g,G as d,aX as f,K as y,aY as k,aZ as j,J as h,N as w,a_ as N,an as S,aq as F,ap as m,a$ as I,ae as R,at as A,b0 as E,O as _,b1 as O,b2 as T,b3 as B,b4 as M,b5 as D,av as U,b6 as $,X as V,Y as q}from"./index-KAz1FpF_.js";import{B as W}from"./Back-Bh77QWm7.js";import{S as K}from"./SDKTag-8IdhJB0E.js";function X(s){return s?{id:s.id,title:s.title,description:s.description,thumbnail:s.thumbnail,isPublic:!1,sceneId:s.sceneId,ethAddress:s.ethAddress,createdAt:s.createdAt,updatedAt:s.updatedAt,layout:s.layout,isTemplate:!1,video:s.video,templateStatus:null}:null}const Y=b.get("PROFILE_URL","");let z=class extends u.PureComponent{constructor(){super(...arguments);l(this,"handlePreview",()=>{this.props.onPreview()});l(this,"handleLike",()=>{const{currentPool:e,isLoggedIn:n,onOpenModal:o}=this.props;e&&(n?this.props.onLikePool(e.id,!e.like):o("LikeModal",{}))});l(this,"handleBack",()=>{const{history:e}=this.props;e.push(y.poolSearch())})}componentDidMount(){const{match:e,onLoadProject:n}=this.props;e.params.projectId&&n(e.params.projectId,this.getType())}componentDidUpdate(){const e=this.getCurrentProject(),n=this.getCurrentScene(),{isLoading:o,onLoadProjectScene:i}=this.props;e&&!n&&!o&&i(e,this.getType())}componentWillUnmount(){this.props.onCloseEditor()}getType(){return this.props.match&&this.props.match.params&&this.props.match.params.type||P.PUBLIC}getCurrentProject(){const{currentProject:e,currentPool:n}=this.props;switch(this.getType()){case"pool":return n;default:return e}}getCurrentScene(){const{scenes:e}=this.props,n=this.getCurrentProject();return n&&e[n.sceneId]||null}getCurrentPool(){const{currentPool:e}=this.props;switch(this.getType()){case"pool":return e;default:return null}}getParcelCount(){const e=this.getCurrentProject();return e?e.layout.cols*e.layout.rows:0}getObjectCount(){const e=this.getCurrentScene();if(!e||!e.sdk6)return 0;const n=this.getParcelCount();if(n===0)return 0;const o=Object.keys(e.sdk6.entities).length;return o<n?0:o-n}renderNotFount(){return t.jsx(L,{})}renderLoading(){return t.jsxs(t.Fragment,{children:[t.jsx(p,{}),t.jsx(a.Page,{isFullscreen:!0,children:t.jsx(a.Loader,{active:!0,size:"huge"})}),t.jsx(g,{isFullscreen:!0})]})}handleExportProject(){const{onOpenModal:e}=this.props;e("ExportModal",{project:X(this.getCurrentProject())})}renderAuthor(){const{currentAuthor:e}=this.props;if(!e)return null;const n=e.avatars[0].ethAddress;return t.jsxs("div",{className:"author",children:[d("public_page.made_by"),t.jsx(f,{address:n,as:"a",href:`${Y}/accounts/${n}`})]})}render(){const{isFetching:e,isPreviewing:n,isReady:o}=this.props;if(e)return this.renderLoading();const i=this.getCurrentProject();if(!i)return this.renderNotFount();const c=this.getCurrentPool(),x=this.getCurrentScene();return t.jsxs(t.Fragment,{children:[!n&&t.jsxs(t.Fragment,{children:[t.jsx(p,{}),t.jsxs(a.Container,{className:"back-container",children:[t.jsx(W,{absolute:!0,onClick:this.handleBack}),t.jsxs(a.Button,{secondary:!0,onClick:this.handleExportProject.bind(this),loading:!i,disabled:!i,children:[t.jsx(a.Icon,{name:"download"}),d("scene_detail_page.download_scene")]})]})]}),t.jsxs("div",{className:"SceneViewPage"+(n?" preview":" mini"),children:[t.jsx("div",{className:"thumbnail",style:{backgroundImage:`url("${i.thumbnail}")`},children:t.jsx(a.Responsive,{minWidth:1025,as:u.Fragment,children:t.jsx(k,{isReadOnly:!0,type:this.getType()},i.id)})}),t.jsxs("div",{className:"scene-action-list",children:[c&&t.jsx("div",{className:"scene-action",children:t.jsx(j,{text:t.jsxs(t.Fragment,{children:[t.jsx(h,{name:c.like?"heart-full":"heart"}),c.likes>0&&t.jsx("span",{className:"LikeCount",children:c.likes})]}),type:"circle",onClick:this.handleLike})}),t.jsx("div",{style:{flex:1}}),t.jsx(a.Responsive,{minWidth:1025,as:u.Fragment,children:t.jsx("div",{className:"scene-action",children:t.jsx(j,{icon:"view",type:"circle",isActive:n,isDisabled:!o,onClick:this.handlePreview})})})]}),t.jsxs("div",{className:"detail",children:[t.jsxs("div",{className:"title",children:[t.jsx("h1",{children:i.title}),t.jsx(K,{scene:x})]}),this.renderAuthor(),i.description&&t.jsx("div",{className:"description",children:t.jsx("p",{children:i.description})}),t.jsxs("div",{className:"component-list",children:[t.jsxs("div",{className:"component",children:[t.jsx(h,{name:"scene-parcel"})," ",d("public_page.parcel_count",{parcels:this.getParcelCount()})]}),t.jsxs("div",{className:"component",children:[t.jsx(h,{name:"scene-object"})," ",d("public_page.item_count",{items:this.getObjectCount()})]})]})]})]}),!n&&t.jsx(g,{})]})}};const G=s=>({isPreviewing:S(s),isReady:!F(s)&&m(s),isFetching:I(s)&&!m(s),isLoggedIn:R(s),currentProject:A(s),currentPool:E(s),scenes:_(s),currentAuthor:O(s),isLoading:T(s)||!!B(s).length}),H=s=>({onLikePool:(r,e=!0)=>s(M(r,e)),onPreview:()=>s(D(!0)),onCloseEditor:()=>s(U()),onLoadProject:(r,e=P.PUBLIC)=>s($(r,e)),onOpenModal:(r,e)=>s(V(r,e)),onLoadProjectScene:(r,e)=>s(q(r,e))}),se=w(G,H)(N(z));export{se as default};