(window.webpackJsonp=window.webpackJsonp||[]).push([[29],{1374:function(e,t,a){e.exports={phone:"screen and (max-width: 500px), screen and (max-height: 500px)",tablet:"screen and (orientation: portrait) and (min-width: 501px) and (max-width: 1024px) and (min-height: 501px) and (max-height: 1366px), screen and (orientation: landscape) and (min-height: 501px) and (max-height: 1024px) and (min-width: 501px) and (max-width: 1366px)",glViewContainer:"_27IuoWa8mD2WaQSuZN23yX",glViewer:"_2jROZBqou-eQTd2S0_5TBI",rotateTip:"_3c1KRFdcbWndtryIi08YiP",arrowContainer:"_1D5ItjclsfQKjGAxOJVQnO",container:"NbynZRPlobkzizE6fhH7j",disabled:"_13f9hwQ-KvJAcEy-yDRhxy",viewCount:"_1Fv_Hr7D0XCaEVZ7p9TlrN",detail:"BTI6MbaQgknUwz5ei2R9r",authorAvatar:"_3MUXRCLwFF8wNQggYK7GJ8",btnViewDetail:"Og7fDTwrRXUxnzClIik84",mobileGlViewContainer:"_3Ym3lsBsGQxO5Bx2tgNunp",mobileGlViewer:"gc3OT_Yp6X7sBSwKbwQIB",mobileDetail:"_3dnhDgCHLAAAHLq9YQurc6",mobileArrowContainer:"_1QFRol1HE9qqPawgfoW0_9",mobileLeftArrow:"_1gLOXu9KZ69c8cWuBVEXFK",mobileRightArrow:"_2e6bU3zPyYJElWfi2HrFUT"}},988:function(e,t,a){"use strict";a.r(t);var n=a(1),r=a.n(n),i=a(23),o=a(57),c=a(252),l=a(70),s=a(7),m=a(24),h=a(94),d=a(1360),u=a(73),b=a(93),p=a(22),w=a(2),f=a(11),g=a(19),v=a(51),E=a(131),O=a(75),y=a(8),j=a(236);const C=a(1374);i.a.ContentType.game,i.a.ContentType.asset,i.a.ContentType.music;function N(e){const{contentList:t,isPro:a}=e,i=!a,o=e.commonHandlers,c=Object(u.g)(),{currIndex:l}=o;Object(n.useEffect)(()=>()=>e.onClose(),[]);const s=t[l];return s?r.a.createElement(b.a,{title:s.name,invisible:e.invisible,onClose:o.handleOnClose,className:C.container,titleStyle:{marginBottom:9}},r.a.createElement("div",{className:C.viewCount},r.a.createElement(m.a,{icon:"view",size:16}),r.a.createElement(y.a,{size:12,className:"ml-8",weight:"minor"},Object(j.b)(s.view_count))),r.a.createElement("div",{className:"flex justify-center mt-24"},r.a.createElement("div",{title:Object(w.e)("previous"),className:Object(p.a)(C.arrowContainer,o.isFirstOne(l)&&C.disabled),onClick:e=>{e.preventDefault(),o.goPrev()}},r.a.createElement(m.a,{size:24,icon:"arrow-right",className:"rotate-180 mr-24"})),e.children,r.a.createElement("div",{title:Object(w.e)("next"),className:Object(p.a)(C.arrowContainer,o.isLastOne(l)&&C.disabled),onClick:e=>{e.preventDefault(),o.goNext()}},r.a.createElement(m.a,{size:24,icon:"arrow-right",className:"ml-24"}))),r.a.createElement("div",{className:C.detail},r.a.createElement(O.a,{className:"flex flex-1",to:f.b.user(s.author_id)},r.a.createElement(v.b,{className:C.authorAvatar,hash:s.author_avatar,width:48,height:48}),r.a.createElement(y.a,{size:14,bold:!0},s.author_name)),i&&r.a.createElement(E.a,{fontSize:14,color:"red",className:C.btnViewDetail,onClick:()=>c.push(f.b.content(e.type,s.content_id))},Object(w.e)("viewDetail")))):null}function x(e){const t=e.commonHandlers,{contentList:a,isPro:n}=e,i=!n,{currIndex:o}=t,c=Object(u.g)(),l=a[o];return l?r.a.createElement(b.a.MobilePopupFromBottom,{className:C.container,title:l.name,onClose:t.handleOnClose,fullWidth:!0},r.a.createElement("div",{className:C.viewCount},r.a.createElement(m.a,{icon:"view",size:16}),r.a.createElement(y.a,{size:12,className:"ml-4",weight:"minor"},Object(j.b)(l.view_count))),r.a.createElement("div",{className:C.mobileDetail},r.a.createElement(O.a,{className:"flex",to:f.b.user(l.author_id)},r.a.createElement(v.b,{className:C.authorAvatar,hash:l.author_avatar,width:30,height:30}),r.a.createElement(y.a,{size:15},l.author_name)),i&&r.a.createElement(E.a,{className:C.btnViewDetail,color:"red",fontSize:14,onClick:()=>c.push(f.b.content(e.type,l.content_id))},Object(w.e)("viewDetail"))),e.children,r.a.createElement("div",{className:C.mobileArrowContainer},r.a.createElement("div",{className:C.mobileLeftArrow,onClick:e=>{e.preventDefault(),t.goPrev()}},r.a.createElement(m.a,{size:16,icon:"arrow-right",className:Object(p.a)("rotate-180",t.isFirstOne(o)&&C.disabled)})),r.a.createElement("div",{className:C.mobileRightArrow,onClick:e=>{e.preventDefault(),t.goNext()}},r.a.createElement(m.a,{size:16,icon:"arrow-right",className:Object(p.a)(C.rightArrow,t.isLastOne(o)&&C.disabled)})))):null}function P(e){const{contentList:t,contentId:a}=e,[r,i]=Object(n.useState)(e.contentList.findIndex(t=>t.content_id===e.contentId)),[o,c]=Object(n.useState)(!1),[l,s]=Object(n.useState)(""),[m,h]=Object(n.useState)(""),d=e=>e<=0,u=t=>e.contentList.length-1<=t,b=Object(n.useRef)({}),p=Object(n.useRef)(0),w=t=>{const a=b.current[t];if(a)return s(a.hash),void h(a.image);c(!0),e.fetch(t).then(e=>{if(p.current!==e.id)return s(""),void h("");s(e.hash);const t=e.image||"";h(t),c(!1),b.current[e.id]={hash:e.hash,image:t}}).catch(e=>{c(!1),s(""),h(""),g.a.rpcError(e)})};return Object(n.useEffect)(()=>{const e=t[r];e?(p.current=e.content_id,w(e.content_id)):(s(""),h(""))},[r]),Object(n.useEffect)(()=>{i(t.findIndex(e=>e.content_id===a))},[a,t]),{goPrev:()=>{d(r)||i(r-1)},goNext:()=>{u(r)||i(r+1)},currIndex:r,setCurrIndex:i,handleOnClose:()=>{i(-1),e.onClose()},isLastOne:u,isFirstOne:d,loading:o,hash:l,image:m,refresh:()=>{w(t[r].content_id)}}}function _(){const{innerHeight:e,innerWidth:t}=window;let a=.4*e;if(Object(s.g)()){const n=e<800?e<670?e<500?.55:.7:.8:1;a=Math.floor(t*n)}return{width:Math.floor(t),height:a}}var I=a(215),T=a(42),z=a(155);const D=a(1374),S=e=>{const{env:t}=T.a;console.log(t,"env");return`${z.c}/player?modelFileHash=${e}&autoRotate=true`};function L(e){const[t,a]=Object(n.useState)(!1),{hash:i}=e;return Object(n.useEffect)(()=>{a(!1)},[i]),r.a.createElement("div",{className:D.glViewer,style:{position:"relative"}},!t&&r.a.createElement("div",{style:{position:"absolute",top:0,right:0,bottom:0,left:0,zIndex:10,opacity:.8}},r.a.createElement(h.a,null)),r.a.createElement("iframe",{style:{border:"none",width:"100%",height:"100%"},onLoad:()=>a(!0),src:S(i)}))}var V=Object.defineProperty,H=Object.defineProperties,A=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,M=(e,t,a)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Q=(e,t)=>{for(var a in t||(t={}))k.call(t,a)&&M(e,a,t[a]);if(F)for(var a of F(t))R.call(t,a)&&M(e,a,t[a]);return e},B=(e,t)=>H(e,A(t));const G=a(1374),W=e=>{const t=Object(c.b)(),{tipShow:a,setTipShow:n,common:i}=X(e),{loading:o,hash:l,refresh:s}=i;return r.a.createElement(N,B(Q({},e),{commonHandlers:i}),r.a.createElement("div",{className:G.glViewContainer,onMouseDownCapture:()=>n(!1)},o?r.a.createElement(h.a,null):l?r.a.createElement(r.a.Fragment,null,e.isPro?r.a.createElement(L,{hash:l}):r.a.createElement(d.a,{hash:l,content:t.content,className:G.glViewer}),a&&!e.isPro&&r.a.createElement("div",{className:G.rotateTip},r.a.createElement(m.a,{size:64,icon:"rotate"}))):r.a.createElement("div",{className:"flex justify-center bg-color w-full h-full rounded-16"},r.a.createElement(m.a,{icon:"refresh",size:32,onClick:s}))))},K=e=>{const t=Object(c.b)(),{tipShow:a,setTipShow:n,common:i}=X(e),o=_();return r.a.createElement(x,B(Q({},e),{commonHandlers:i}),r.a.createElement("div",{style:o,className:G.mobileGlViewContainer,onTouchMoveCapture:()=>n(!1)},i.loading?r.a.createElement(h.a,null):i.hash?r.a.createElement(r.a.Fragment,null,e.isPro?r.a.createElement(L,{hash:i.hash}):r.a.createElement(d.a,{hash:i.hash,content:t.content,className:G.glViewer}),a&&r.a.createElement("div",{className:G.rotateTip},r.a.createElement(m.a,{size:64,icon:"rotate"}))):r.a.createElement("div",{className:"flex justify-center bg-color w-full h-full"},r.a.createElement(m.a,{icon:"refresh",size:32,onClick:i.refresh}))))},X=e=>{const t=Object(c.b)(),a=P(B(Q({},e),{fetch:a=>{return n=void 0,r=null,o=function*(){if(e.isPro){const e=yield I.a.Model.getModelV2UsingGet({modelId:a});return{hash:e.modelFileHash,id:e.id}}const n=yield t.rpc.content.api.get({type:"id",data:{type:i.a.ContentType.asset,meshHash:!0,isPublic:!0,userId:0,contentId:a}});return{hash:n.meshHash,id:n.content_id}},new Promise((e,t)=>{var a=e=>{try{c(o.next(e))}catch(e){t(e)}},i=e=>{try{c(o.throw(e))}catch(e){t(e)}},c=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,i);c((o=o.apply(n,r)).next())});var n,r,o}})),{invisible:r}=e,o=l.a.get("openModelPreviewTimes"),[s,m]=Object(n.useState)(o<=3);return Object(n.useEffect)(()=>{if(!r){const e=o+1;o<=10&&l.a.put("openModelPreviewTimes",e),!s&&e<=3&&m(!0)}},[r]),Object(n.useEffect)(()=>{s&&setTimeout(()=>{m(!1)},3e3)},[s]),{tipShow:s,setTipShow:m,common:a}};var J=e=>Object(s.f)()?r.a.createElement(K,Q({},e)):r.a.createElement(W,Q({},e)),U=a(1363),Y=Object.defineProperty,Z=Object.defineProperties,q=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,ae=(e,t,a)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,ne=(e,t)=>{for(var a in t||(t={}))ee.call(t,a)&&ae(e,a,t[a]);if($)for(var a of $(t))te.call(t,a)&&ae(e,a,t[a]);return e},re=(e,t)=>Z(e,q(t));const ie=a(1374),oe=e=>{const{common:t}=le(e);return r.a.createElement(N,re(ne({},e),{commonHandlers:t}),r.a.createElement("div",{className:ie.glViewContainer},t.loading?r.a.createElement(h.a,null):r.a.createElement(U.a,{width:416,height:416,hash:t.hash,image:t.image,className:ie.glViewer})))},ce=e=>{const{common:t}=le(e),{width:a,height:n}=_();return r.a.createElement(x,re(ne({},e),{commonHandlers:t}),t.loading?r.a.createElement(h.a,null):r.a.createElement(U.a,{image:t.image,hash:t.hash,width:a,height:n,className:ie.mobileGlViewer}))};function le(e){const t=Object(c.b)();return{common:P(re(ne({},e),{fetch:e=>{return a=this,n=null,r=function*(){const a=yield t.rpc.content.api.get({type:"id",data:{type:i.a.ContentType.music,meshHash:!1,isPublic:!0,userId:0,contentId:e}});return{id:a.content_id,hash:a.audio_hash,image:a.image}},new Promise((e,t)=>{var i=e=>{try{c(r.next(e))}catch(e){t(e)}},o=e=>{try{c(r.throw(e))}catch(e){t(e)}},c=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);c((r=r.apply(a,n)).next())});var a,n,r}}))}}var se=e=>Object(s.f)()?r.a.createElement(ce,ne({},e)):r.a.createElement(oe,ne({},e));t.default=e=>{const t=Object(o.j)(e.type);if(t&&t!==e.type)return null;switch(e.type){case i.a.ContentType.asset:return r.a.createElement(J,{isPro:e.isPro,invisible:e.invisible,contentId:e.contentId,contentList:e.contentList,onClose:e.onClose,type:e.type});case i.a.ContentType.music:return r.a.createElement(se,{invisible:e.invisible,contentId:e.contentId,contentList:e.contentList,onClose:e.onClose,type:e.type});default:return null}}}}]);