YGG.Product3D_v2=function(e,t){const n=0,a=2,i=3,o=6,r=7,l=0,c=1,s=2,u=3,p=new THREE.Vector3(0,106,0),d=new THREE.Vector3(0,0,-40),E=new THREE.Vector3(3,10,2),T=100,h=100;let f,m,_,O,P,R,g,b,y,w,M,H,x=this,C=4096,N=4,I=!0,v=new YGG.Utils,A=new YGG.UtilityWASM,S=new YGG.JJ_Object,Y=new YGG.JJ_DataManager,k=n,U=n,V=new THREE.WebGLRenderer({antialias:!0}),D=new THREE.Scene,z=new THREE.PerspectiveCamera(T,window.innerWidth/window.innerHeight,.01,5e3),W=new YGG.UserControls(z,V.domElement,h),j=new YGG.OrbitControls(z,V.domElement),X=new THREE.Group,G=new THREE.Group,F=new THREE.Group,Z=new THREE.Group,Q=new THREE.Group,L=new THREE.Group,q=new THREE.Group,B=new THREE.Group,J=new THREE.Group,K=new THREE.Group,$=new THREE.Group,ee=new THREE.Group,te=new THREE.Group,ne=new THREE.Group,ae=new THREE.Group,ie=S.createSphere(50),oe=S.createSphere(50),re=new THREE.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}),le=new THREE.Raycaster,ce=new THREE.Vector3,se=null,ue=null,pe=null,de=null,Ee="z0000",Te="s0000",he="",fe="",me="",_e=!1,Oe=new THREE.Vector3,Pe=new THREE.Vector3,Re=new THREE.Vector2,ge=new THREE.Vector2,be=new THREE.Vector2,ye=0,we=.001*Date.now(),Me=[],He=0,xe=[],Ce=[],Ne=[],Ie=[],ve=[],Ae=[],Se=null,Ye=null,ke=[],Ue="",Ve=!1,De=new THREE.Matrix4,ze=function(e){},We=function(e){},je=function(e){},Xe=function(e){},Ge=function(e){},Fe=function(e){},Ze=function(e){},Qe=function(e){},Le=function(e){},qe=function(e){};function Be(e,t){switch(k){case a:z.aspect=e/t,z.updateProjectionMatrix();default:z.aspect=e/t,z.updateProjectionMatrix()}}function Je(e,t){let l=e.image.src,c=l.substring(l.lastIndexOf("/")+1),s=c.substring(0,c.indexOf("_")),u="",p=c.substring(c.indexOf("_")+1,c.indexOf("-"));c.indexOf("t")>=0&&(u=parseInt(c.substring(c.indexOf("_")+2,c.indexOf("_")+4)),p=c.substring(c.indexOf("_")+5,c.indexOf("-")));let d=e.image.naturalWidth,E=e.image.naturalHeight,T=c.substring(c.indexOf("-")+1,c.lastIndexOf("-")),h=c.substring(c.lastIndexOf("-")+1,c.indexOf(".")),f=256;switch(p.length>2?(T=0,h=0,0==p.localeCompare("512")&&(f=512)):f=0==p.localeCompare("1k")?1024:0==p.localeCompare("2k")?2048:0==p.localeCompare("4k")?4096:8192,s.indexOf("m")>=0?s.indexOf("z")>=0?function(e,t,a,i,o,r,l,c){for(let s=0;s=0?function(e,t,n,i,o,r,l){nt(a,1,Ne[e],t,n,i,o,r,l,e)}(u,e,f,T,h,d,E):s.indexOf("s")>=0?function(e,t,n,a,i,r,l){nt(o,1,ve[e],t,n,a,i,r,l,e)}(u,e,f,T,h,d,E):3==s.length?U!=i&&U!=a||0!=he.localeCompare(s)||function(e,t,n,a,o,r,l){if(0!=e.localeCompare(he))return;switch(function(e){return 0==ie.name.localeCompare(e)?0:0==oe.name.localeCompare(e)?1:-1}(e)){case 0:if(null==g||null==g){g=$e(C);let e=256/C;ie.material.map=g,g.repeat.set(e,-e),g.wrapS=g.wrapT=THREE.RepeatWrapping,g.minFilter=THREE.LinearFilter,g.generateMipmaps=!1}nt(i,2,g,t,n,a,o,r,l,0);break;case 1:if(null==b||null==b){b=$e(C);let e=256/C;oe.material.map=b,b.repeat.set(e,-e),b.wrapS=b.wrapT=THREE.RepeatWrapping,b.minFilter=THREE.LinearFilter,b.generateMipmaps=!1}nt(i,2,b,t,n,a,o,r,l,0);break}}(s,e,f,T,h,d,E):U!=r&&U!=o||function(e,t,n,a,i,o,l){0==P.name.localeCompare(e)?nt(r,2,P,t,n,a,i,o,l,0):0==R.name.localeCompare(e)&&nt(r,2,R,t,n,a,i,o,l,0)}(s,e,f,T,h,d,E),U){case n:t(Y.TEXTURE_MODE.T_MAP);break;case a:t(Y.TEXTURE_MODE.T_ZONE);break;case i:t(Y.TEXTURE_MODE.T_ZONE_WAYPOINT);break;case o:t(Y.TEXTURE_MODE.T_SHOP);break;case r:t(Y.TEXTURE_MODE.T_SHOP_WAYPOINT);break;default:break}}function Ke(e,t,p,d,E,T,h){switch(e.scene.traverseVisible((function(e){if(e.isMesh)switch(e.material.isGLTFSpecularGlossinessMaterial&&(e.onBeforeRender=function(){}),p){case l:f=e,e.material=O,e.name=d,X.add(e);break;case c:{let n=e;if(n.pointType=POINT_TYPE_ZONE,n.name=d,n.position.set(0,0,0),n.renderOrder=ZONEMESH_TRANSPARENT_ORDER,t<0)null==n.material?n.setAttribute("material",re.clone()):n.material=re.clone();else for(let e=0;eT){n.repeat.set(E,-E);let f=function(e,t,n,a,i,o){let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r);let l=V.properties.get(t);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webglTexture,0);let c=new Uint8Array(n*a*4);e.readPixels(0,t.image.height-a,n,a,e.RGBA,e.UNSIGNED_BYTE,c),e.deleteFramebuffer(r),null!=M&&null!=M||(M=document.createElement("canvas").getContext("2d",{alpha:!1})),M.canvas.width=n,M.canvas.height=a;let s=M.createImageData(n,a);return s.data.set(c),M.putImageData(s,0,0),null!=H&&null!=H||(H=document.createElement("canvas").getContext("2d",{alpha:!1})),H.canvas.width=i,H.canvas.height=o,H.save(),H.scale(1,-1),H.translate(0,-H.canvas.height),H.drawImage(M.canvas,0,0,n,a,0,0,i,o),H.restore(),H}(V.getContext(),n,n.image.width*T,n.image.height*T,n.image.width*E,n.image.height*E),m=new THREE.CanvasTexture(f.canvas);if(V.copyTextureToTexture(new THREE.Vector2(0,n.image.height-n.image.height*E),m,n),e==o)Me[d].offsetRepeat.value=[0,0,E,-E];else if(e==r)if(n==P)for(let e=0;e1/12?requestAnimationFrame(Dt):V.getContext().flush()}else if(c==s&&c==f)requestAnimationFrame(Dt);else{let e=Date.now();e*=.001,e-we>1/12?requestAnimationFrame(Dt):V.getContext().flush()}}function at(e){W.enabled=!e,j.enabled=e,e?j.refresh():W.refresh()}function it(e,t){let n="",a=parseInt(e[4]);return isNaN(a)?n+="P"+e[4].toUpperCase()+e[4].toUpperCase():n+="M"+e.substring(3,5),n+="00",n+="0",n+=t.substring(2,5),n}function ot(e){if(null==e||null==e||9!=e.length)return{zone_id:"z0000",shop_id:"s0000"};let t={zone_id:"",shop_id:""},n=parseInt(e[2]);return isNaN(n)?t.zone_id="z000"+e[2].toLowerCase():t.zone_id="z00"+e.substring(1,3),t.shop_id="s0"+e.substring(6,9),t}function rt(){k==o?(ue=z.position,_t()):k==a&&(he="",se=mt(a,z.position,!1,50),null!=se&&(he=se.name,function(e){let t,n=RESOURCE_VR_ROOTPATH+"zones/"+Ee+"/waypoints/img360/"+e+"/";if(k==i){if(0==he.localeCompare(e))return;he=se.name,t=ne.children[1],t.name=e,Y.clearTextureQueueByMode(Y.TEXTURE_MODE.T_ZONE_WAYPOINT),Y.generateTextureQueue(n,e,-1,0,Y.TEXTURE_MODE.T_ZONE_WAYPOINT),Y.generateTextureQueue(n,e,-1,2,Y.TEXTURE_MODE.T_ZONE_WAYPOINT),Y.generateTextureQueue(n,e,-1,N,Y.TEXTURE_MODE.T_ZONE_WAYPOINT),t==ie?(ie.material.map=g,null!=g&&null!=g&&(g.needsUpdate=!0)):(oe.material.map=b,null!=b&&null!=b&&(b.needsUpdate=!0)),t.position.copy(se.position),t.position.add(se.children[0].position),t.rotation.copy(se.rotation),At(i)}else if(he=se.name,0==ne.children[0].name.localeCompare(e)){let e=ne.children[0];ne.children[0]=ne.children[1],ne.children[1]=e,At(i)}else 0==ne.children[1].name.localeCompare(e)||(t=ne.children[1],t.name=e,Y.clearTextureQueueByMode(Y.TEXTURE_MODE.T_ZONE_WAYPOINT),Y.generateTextureQueue(n,e,-1,0,Y.TEXTURE_MODE.T_ZONE_WAYPOINT),Y.generateTextureQueue(n,e,-1,2,Y.TEXTURE_MODE.T_ZONE_WAYPOINT),Y.generateTextureQueue(n,e,-1,N,Y.TEXTURE_MODE.T_ZONE_WAYPOINT),t==ie?(ie.material.map=g,null!=g&&null!=g&&(g.needsUpdate=!0)):(oe.material.map=b,null!=b&&null!=b&&(b.needsUpdate=!0)),t.position.copy(se.position),t.position.add(se.children[0].position),t.rotation.copy(se.rotation)),At(i)}(se.name)))}function lt(t){if(t.preventDefault(),!W.enabled&&!j.enabled)return;if(se){switch(se.pointType){case POINT_TYPE_ZONE_WAYPOINT:case POINT_TYPE_SHOP_TOP_ICON:case POINT_TYPE_SHOP_WAYPOINT:case POINT_TYPE_SHOP_POINT:case POINT_TYPE_PRODUCT:case POINT_TYPE_PRODUCT_GROUP:case POINT_TYPE_SHOP_ICON:case POINT_TYPE_COIN:se.material.color.set(16777215);break;case POINT_TYPE_ZONE:se.material?se.material.opacity=0:se.children.length>0&&(se.children[0].material.opacity=0);break;case POINT_TYPE_ZONE_ICON:se.parent.children[0].material.opacity=0;break;default:}se=null,requestAnimationFrame(Dt)}let n=v.getMousePos(e,t),a=Et(n.x,n.y);if(null!=a&&a.length>0){let e=a.filter((function(e){return e&&e.object}))[0];if(e&&e.object){switch(se=e.object,se.pointType){case POINT_TYPE_ZONE_WAYPOINT:case POINT_TYPE_SHOP_TOP_ICON:case POINT_TYPE_SHOP_WAYPOINT:case POINT_TYPE_SHOP_POINT:case POINT_TYPE_PRODUCT:case POINT_TYPE_PRODUCT_GROUP:case POINT_TYPE_SHOP_ICON:case POINT_TYPE_COIN:se.material.color.set(4513279);break;case POINT_TYPE_ZONE:se.material.opacity=.1;break;case POINT_TYPE_ZONE_ICON:se.parent.children[0].material.opacity=.1;break;default:}requestAnimationFrame(Dt)}}}function ct(t){if(1==t.touches.length){let n=v.getMousePos(e,t.touches[0]),a=Et(n.x,n.y);if(null!=a&&a.length>0){let e=a.filter((function(e){return e&&e.object}))[0];e&&e.object&&(se=e.object,se.pointType!=POINT_TYPE_ZONE&&se.pointType!=POINT_TYPE_ZONE_ICON||(Tt(n.x,n.y),pe=new THREE.Vector3,pe.copy(ue),ue=null))}else Tt(n.x,n.y)}}function st(t){if(j.isDraging()||W.isDraging())return j.isDrag=!1,W.isDrag=!1,se=null,void(ue=null);if(null==se||null==se){let n=v.getMousePos(e,t);Tt(n.x,n.y)}else if(se.pointType==POINT_TYPE_ZONE||se.pointType==POINT_TYPE_ZONE_ICON){let n=v.getMousePos(e,t);Tt(n.x,n.y),pe=new THREE.Vector3,pe.copy(ue),ue=null}pt()}function ut(e){if(j.isDraging()||W.isDraging())return j.isDrag=!1,W.isDrag=!1,se=null,void(ue=null);pt()}function pt(){if(null!=se){switch(k){case n:se.pointType!=POINT_TYPE_ZONE_ICON&&(se.material.opacity=0),0==se.name.localeCompare("z0012")?x.syncTo3DCanvas(it(se.name,"s0001")):0==se.name.localeCompare("z0001")||0==se.name.localeCompare("z0003")||0==se.name.localeCompare("z0005")?je({code_name:it(se.name,"s0001"),support_3d:0}):je({code_name:it(se.name,"s0001"),support_3d:1}),requestAnimationFrame(Dt);break;case o:switch(se.pointType){case POINT_TYPE_SHOP_WAYPOINT:fe=se.name,xt(se.name,!1);break;case POINT_TYPE_PRODUCT:Xe({code_name:it(Ee,Te),product_id:se.name});break;case POINT_TYPE_PRODUCT_GROUP:Ge({code_name:it(Ee,Te),product_group_id:se.name});break}break;case r:switch(se.pointType){case POINT_TYPE_SHOP_WAYPOINT:fe=se.name,xt(se.name,!1);break;case POINT_TYPE_PRODUCT:Xe({code_name:it(Ee,Te),product_id:se.name});break;case POINT_TYPE_PRODUCT_GROUP:if(se.jump){let e=se.jump.code_name;0==e.localeCompare("M01000001")||0==e.localeCompare("M03000001")||0==e.localeCompare("M05000001")?je({code_name:e,support_3d:0}):se.jump.waypoint?Ge({code_name:it(Ee,Te),product_group_id:se.name,jump:se.jump}):je({code_name:e,support_3d:1})}else Ge({code_name:it(Ee,Te),product_group_id:se.name});requestAnimationFrame(Dt);break;case POINT_TYPE_COIN:se.parent.remove(se),Qe({cid:se.name}),requestAnimationFrame(Dt);break}break}null!=se&&(se.pointType==POINT_TYPE_ZONE?se.material.opacity=0:se.material&&se.material.color&&se.material.color.set(16777215))}else null!=ue&&null!=ue&&_t();if(se)switch(se.pointType){case POINT_TYPE_ZONE_WAYPOINT:case POINT_TYPE_SHOP_TOP_ICON:case POINT_TYPE_SHOP_WAYPOINT:case POINT_TYPE_SHOP_POINT:case POINT_TYPE_PRODUCT:case POINT_TYPE_PRODUCT_GROUP:case POINT_TYPE_SHOP_ICON:case POINT_TYPE_COIN:se.material.color.set(16777215);break;case POINT_TYPE_ZONE:se.material?se.material.opacity=0:se.children.length>0&&(se.children[0].material.opacity=0);break;default:}se=null,ue=null}function dt(e){let t=[];if(null!=e&&null!=e)for(let n=0;n0?c:dt(le.intersectObject(q,!0));case i:return c=dt(le.intersectObject(Q,!0)),null!=c&&c.length>0?c:(c=dt(le.intersectObject(Z,!0)),null!=c&&c.length>0?c:dt(le.intersectObject(L,!0)));case o:return c=dt(le.intersectObject(K,!0)),c;case r:return c=dt(le.intersectObject(K,!0)),null!=c&&c.length>0?c:(c=dt(le.intersectObject(ee,!0)),null!=c&&c.length>0?c:(c=dt(le.intersectObject(te,!0)),null!=c&&c.length>0?c:dt(le.intersectObject($,!0))))}}function Tt(t,l){switch(null==e||null==e?(t=t/window.innerWidth*2-1,l=-l/window.innerHeight*2+1):(t=t/e.offsetWidth*2-1,l=-l/e.offsetHeight*2+1),ce.set(t,l,.5),le.setFromCamera(ce,z),k){case n:{let e=le.intersectObject(G,!0);null!=e&&e.length>0&&(ue=e[0].point)}break;case a:{let e=le.intersectObject(m,!0);null!=e&&e.length>0&&(ue=e[0].point)}break;case i:{let e=le.intersectObject(ne,!0);null!=e&&e.length>0&&(ue=e[0].point)}break;case o:{let e=le.intersectObject(ae,!0);null!=e&&e.length>0&&(ue=e[0].point)}break;case r:{let e=le.intersectObject(ae,!0);null!=e&&e.length>0?ue=e[0].point:(e=le.intersectObject(ne,!0),null!=e&&e.length>0&&(ue=e[0].point))}break}}function ht(e,t){let n=new THREE.Vector3,a=new THREE.Vector3;return n.copy(e),n.sub(z.position),n.y=0,0==n.length()||(a.copy(t),a.sub(z.position),a.y=0,n.normalize().dot(a.normalize())>=.75)}function ft(e){let t,n=null,a=1e6,i=new THREE.Vector3,o=!1;for(let r=0;ra&&(a=t)}if(null!=Ne&&null!=Ne)for(;Ne.length>0;)Ne.shift();if(null!=Ie&&null!=Ie)for(;Ie.length>0;)Ie.shift();Y.clearTextureQueueByMode(Y.TEXTURE_MODE.T_ZONE);for(let n=0;n<=a;n++)Ne.push(et(C)),Ne[n].repeat.set(1,-1),Ne[n].wrapS=Ne[n].wrapT=THREE.RepeatWrapping,Ne[n].minFilter=THREE.LinearFilter,Ne[n].generateMipmaps=!1,Ie.push(new THREE.MeshBasicMaterial({color:16777215,map:Ne[n]})),Y.generateTextureQueue(t,e,n,0,Y.TEXTURE_MODE.T_ZONE);for(let n=0;n<=a;n++)Y.generateTextureQueue(t,e,n,2,Y.TEXTURE_MODE.T_ZONE),N>2&&Y.generateTextureQueue(t,e,n,N,Y.TEXTURE_MODE.T_ZONE);Y.clearModelQueueByMode(s);for(let e=0;e0){if(Z.children.length<=0)return;let i=0;i=0==a.inZone?t[n].count/Z.children.length:t[n].count*(a.inZone/(a.inZone+a.inShop))/Z.children.length;let o=i*K.children.length;for(let a=0;as&&(s=t);p.length2&&Y.generateTextureQueue(i,e,t,N,Y.TEXTURE_MODE.T_SHOP));Y.clearModelQueueByMode(Y.MESH_MODE.M_SHOP);for(let e=0;e2&&Y.generateTextureQueue(a,e,-1,N,Y.TEXTURE_MODE.T_SHOP_WAYPOINT);let i=ne.children[1];i.name=e,ne.position.copy(J.position),ne.rotation.copy(J.rotation),i.position.copy(se.position),i.position.add(se.children[0].position),i.rotation.copy(se.rotation),De=new THREE.Matrix4,De.copy(se.matrix),De.multiply((new THREE.Matrix4).setPosition(se.children[0].position));let o=256/C;if(null==P||null==P){P=$e(C),P.repeat.set(o,-o),P.wrapS=P.wrapT=THREE.RepeatWrapping,P.minFilter=THREE.LinearFilter,P.generateMipmaps=!1;for(let e=0;e=1?(n=se.parent.bound.height/t,a=se.parent.bound.width/(t*z.aspect),e=new THREE.Vector2(-Math.PI,-se.parent.yaw*Math.PI/180)):(n=se.parent.bound.width/t,a=se.parent.bound.height/(t*z.aspect),e=new THREE.Vector2(-Math.PI,(90-se.parent.yaw)*Math.PI/180));let i=new THREE.Vector3(se.parent.bound.offsetX,0,se.parent.bound.offsetY),o=new THREE.Quaternion;o.setFromAxisAngle(new THREE.Vector3(0,1,0),-se.parent.yaw*Math.PI/180),i.applyQuaternion(o),Pe.x+=i.x,Pe.y+=Math.max(n,a),Pe.z+=i.z}else{Pe.copy(se.position),z.aspect>=1?(n=se.bound.height/t,a=se.bound.width/(t*z.aspect),e=new THREE.Vector2(-Math.PI,-se.yaw*Math.PI/180)):(n=se.bound.width/t,a=se.bound.height/(t*z.aspect),e=new THREE.Vector2(-Math.PI,(90-se.yaw)*Math.PI/180));let i=new THREE.Vector3(se.bound.offsetX,0,se.bound.offsetY),o=new THREE.Quaternion;o.setFromAxisAngle(new THREE.Vector3(0,1,0),-se.yaw*Math.PI/180),i.applyQuaternion(o),Pe.x+=i.x,Pe.y+=Math.max(n,a),Pe.z+=i.z}ge.set(e.x,e.y)}break;case i:Pe.copy(se.position),Pe.add(F.position),Pe.add(se.children[0].position),ne.position.copy(F.position),ne.rotation.copy(F.rotation),ge.set(0,W.getEulerY());break;case o:if(Ht(me),null==J.camera||null==J.camera){let e=new THREE.Vector3;e.copy(E),e.applyQuaternion(J.quaternion),Pe.copy(e),Pe.add(J.position);let t=new THREE.Vector3;J.getWorldPosition(t);let n=vt(Pe,t);ge.set(n.x,n.y)}else{let e=new THREE.Vector3;e.copy(J.camera.position),e.applyQuaternion(J.quaternion),Pe.copy(e),Pe.add(J.position);let t=new THREE.Vector3;t.copy(J.camera.target),t.applyQuaternion(J.quaternion),t.add(J.position);let n=vt(Pe,t);ge.set(n.x,n.y)}t&&je({code_name:it(Ee,me),support_3d:1});break;case r:{let e=new THREE.Vector3;if(e.copy(se.position),e.applyQuaternion(J.quaternion),Pe.copy(e),Pe.add(J.position),Pe.add(se.children[0].position),de)ge.set(-de.phi+Math.PI/2,de.theta);else if(t&&se.isGate){let e=J.rotation.y+se.rotation.y+se.children[0].rotation.y;ge.set(0,e)}else ge.set(0,W.getEulerY())}break}_e=!0,ye=0;let l=(ge.y-Re.y)%(2*Math.PI);l>Math.PI?ge.y=Re.y-(2*Math.PI-l):l<-Math.PI?ge.y=Re.y+(2*Math.PI+l):ge.y=Re.y+l,requestAnimationFrame(Yt)}function St(e,t,n){let a=e;return a=(t-(e*=W.fakeZoom))*n+e,a}function Yt(){let e=ye/30;if(e>=1)se=null,function(){switch(z.position.copy(Pe),function(e){e!=n&&(X.visible=!1);e!=a&&e!=i?F.visible=!1:(e!=a&&(q.visible=!1,B.visible=!1,m.visible=!1),e!=i&&(L.visible=!1,Q.visible=!1));e!=o&&e!=r?J.visible=!1:e!=r&&(ee.visible=!1,te.visible=!1,$.visible=!1);ne.children[0].material.opacity=0,ne.children[0].children[0].material.opacity=0,ne.children[1].material.opacity=0,ne.children[1].children[0].material.opacity=0,z.fov=e==n?T:h;z.updateProjectionMatrix(),W.fakeZoom=1}(U),U){case n:W.setEuler(ge),W.update(),at(!1),j.target.copy(d),j.update(),X.visible=!0;break;case a:{W.setEuler(ge),W.update(),z.updateProjectionMatrix(),at(!0),F.visible=!0,null!=m&&null!=m&&(m.visible=!0),q.visible=!0,B.visible=!0,Ct(Z),Ct(L);let e=new THREE.Vector3;F.getWorldPosition(e),j.target.set(z.position.x,0,z.position.z),z.aspect>=1?j.setAngle(ge.x-Math.PI/2,ge.y):j.setAngle(ge.x,ge.y),j.update()}break;case i:at(!1),F.visible=!0,Q.visible=!0,kt(U),L.visible=!0,Nt(Z),It(L),It(Q,1.1),function(e){if(null!=Ye&&null!=Ye){let t=it(Ee,"s0000").substring(0,3);for(let n=0;n0&&(e=!0);break;default:break}Fe({state:k,hasShopModel:e}),requestAnimationFrame(Dt),Ut(1)}();else{switch(requestAnimationFrame(Yt),ye++,z.position.lerpVectors(Oe,Pe,e),k){case n:U==n||(z.fov=St(T,h,e),z.updateProjectionMatrix());break;case a:U==n?(z.fov=St(h,T,e),z.updateProjectionMatrix()):(z.fov=St(h,h,e),z.updateProjectionMatrix());break;case i:U==n?(z.fov=St(h,T,e),z.updateProjectionMatrix()):(z.fov=St(h,h,e),z.updateProjectionMatrix()),ne.children[0].material.opacity=1*(1-e);break;case o:U==n?(z.fov=St(h,T,e),z.updateProjectionMatrix()):(z.fov=St(h,h,e),z.updateProjectionMatrix());break;case r:U==n?(z.fov=St(h,T,e),z.updateProjectionMatrix()):(z.fov=St(h,h,e),z.updateProjectionMatrix()),ne.children[0].material.opacity=1-e;break}switch(U){case n:W.setEuler(be.lerpVectors(Re,ge,e)),W.update();break;case a:W.setEuler(be.lerpVectors(Re,ge,e)),W.update();break;case i:ne.children[1].material.opacity=1*e,W.setEuler(be.lerpVectors(Re,ge,e)),W.update();break;case o:if(k==r)if(ne.children[0].material.opacity=1-e,2==He)for(let t=0;t1/12&&requestAnimationFrame(Dt),Ut(e)}function kt(e){let t=he;e==r&&(t=fe);let n=ne.children[0].name.localeCompare(t),a=ne.children[1].name.localeCompare(t);if(n==a){let e=new THREE.Vector3,t=new THREE.Vector3;ne.children[0].getWorldPosition(e),ne.children[1].getWorldPosition(t);let n=e.distanceTo(z.position);if(t.distanceTo(z.position)0&&n.inShop>0){let a=n.inZone/(n.inZone+n.inShop);if(Math.random()>a){let n=S.createCoinPoint(t[e].cid);n.position.copy(Ot()),(new THREE.TextureLoader).load(t[e].icon,(function(e){n.material.map=e})),n.visible=!1,Q.add(n)}}else if(n.inZone>0){let n=S.createCoinPoint(t[e].cid);n.position.copy(Ot()),(new THREE.TextureLoader).load(t[e].icon,(function(e){n.material.map=e})),n.visible=!1,Q.add(n)}}}}(Ee),k!=r&&k!=o||Mt(bt(Te))},this.updatePin=function(e,t){let n=ot(e);switch(ke=t,Ue=n.zone_id,Ve=!0,k){case a:Pt(Ee)}},this.setSize=function(e,t){V.setSize(e,t),e>=t?I?(z.aspect=e/t,z.updateProjectionMatrix()):(I=!0,Be(e,t)):I?(I=!1,Be(e,t)):(z.aspect=e/t,z.updateProjectionMatrix()),requestAnimationFrame(Dt)},this.setPromoConfig=function(e){Ye=e},this.showLayout=function(){k==r?At(o):k==i&&(se=null,At(a))},this.showWaypoint=function(){rt()},this.backStep=function(){switch(k){case n:break;case o:case r:At(n);break}},this.syncTo3DCanvas=function(e){if(null==e||null==e)return;let t=ot(e);0==t.zone_id.substring(3,5).localeCompare("00")?At(n):0==t.shop_id.substring(2,5).localeCompare("000")?(0==t.zone_id.localeCompare("z0011")&&(t.zone_id="z0012"),se=gt(t.zone_id),At(a),Rt(t.zone_id),F.position.copy(se.position),null!=se.bound&&null!=se.bound?(F.yaw=se.yaw,F.north=se.north,F.offsetX=se.bound.offsetX,F.offsetY=se.bound.offsetY):(F.yaw=se.parent.yaw,F.north=se.parent.north,F.offsetX=se.parent.bound.offsetX,F.offsetY=se.parent.bound.offsetY)):(me=t.shop_id,0==t.zone_id.localeCompare("z0011")&&(t.zone_id="z0012"),0!=Ee.localeCompare(t.zone_id)?(se=gt(t.zone_id),Rt(t.zone_id,!0),Ee=t.zone_id,F.position.copy(se.position),null!=se.bound&&null!=se.bound?(F.yaw=se.yaw,F.north=se.north,F.offsetX=se.bound.offsetX,F.offsetY=se.bound.offsetY):(F.yaw=se.parent.yaw,F.north=se.parent.north,F.offsetX=se.parent.bound.offsetX,F.offsetY=se.parent.bound.offsetY)):Ht(me,!0,pe||z.position))},this.gotoShopWaypoint=function(e,t){if(null==e||null==e)return;let n=ot(e);0==n.zone_id.substring(3,5).localeCompare("00")||0==n.shop_id.substring(2,5).localeCompare("000")||(me=n.shop_id,0!=Ee.localeCompare(n.zone_id)?(se=gt(n.zone_id),Rt(n.zone_id,!0,t),Ee=n.zone_id,F.position.copy(se.position),null!=se.bound&&null!=se.bound?(F.yaw=se.yaw,F.north=se.north,F.offsetX=se.bound.offsetX,F.offsetY=se.bound.offsetY):(F.yaw=se.parent.yaw,F.north=se.parent.north,F.offsetX=se.parent.bound.offsetX,F.offsetY=se.parent.bound.offsetY)):Ht(me,!0,pe||z.position,t))},this.gotoProductGroup=function(e,t){},function(){navigator.deviceMemory>=3?(C=4096,N=4):(C=2048,N=3),V.domElement.addEventListener("mousemove",lt,!1),V.setClearColor(new THREE.Color(1644825)),V.setPixelRatio(window.devicePixelRatio),null==e||null==e?(V.setSize(window.innerWidth,window.innerHeight),document.body.appendChild(V.domElement),x.setSize(window.innerWidth,window.innerHeight)):(V.setSize(e.offsetWidth,e.offsetHeight),e.appendChild(V.domElement),x.setSize(e.offsetWidth,e.offsetHeight)),z.layers.enable(0),z.layers.enable(1),z.position.copy(p),z.lookAt(d),j.target.copy(d),j.update(),W.refresh(),W.addEventListener("change",Vt),j.addEventListener("change",Dt),j.maxPolarAngle=Math.PI/2-1/9,j.setOnMouseUpCallback(st),j.setOnTouchStartCallback(ct),j.setOnTouchEndCallback(ut),W.setOnMouseUpCallback(st),W.setOnTouchStartCallback(ct),W.setOnTouchEndCallback(ut),D.add(X),X.add(G),D.add(F),F.add(Z),F.add(q),F.add(L),F.add(Q),F.add(B),Q.visible=!1,D.add(J),J.add(ae),J.add(K),J.add(ee),J.add(te),J.add($),$.visible=!1,D.add(ne),ne.add(ie),ne.add(oe);let n=S.createGroundPoint(),a=S.createGroundPoint();n.material.depthTest=!1,n.material.depthWrite=!1,a.material.depthTest=!1,a.material.depthWrite=!1,ie.add(n),oe.add(a),requestAnimationFrame(Dt),Y.setOnTextureLoadCallback(Je),Y.setOnModelLoadCallback(Ke),Module._setActivate(),at(!1),function(e){_=et(C),_.repeat.set(1,-1),_.wrapS=_.wrapT=THREE.RepeatWrapping,_.minFilter=THREE.LinearFilter,_.generateMipmaps=!1,O=new THREE.MeshBasicMaterial({color:16777215,map:_,side:THREE.DoubleSide}),f=new THREE.Mesh(new THREE.SphereGeometry(1e3,50,50),O),f.scale.set(-1,-1,1),f.rotation.y=67/180*Math.PI,f.position.copy(p),X.add(f),Y.generateTextureQueue(RESOURCE_VR_ROOTPATH,"map",0,0,Y.TEXTURE_MODE.T_MAP),Y.generateTextureQueue(RESOURCE_VR_ROOTPATH,"map",0,2,Y.TEXTURE_MODE.T_MAP),Y.generateTextureQueue(RESOURCE_VR_ROOTPATH,"map",0,N,Y.TEXTURE_MODE.T_MAP),v.jsonReader(RESOURCE_VR_ROOTPATH+"zones/zones.json",(function(t){S.clearArray(xe),S.clearArray(Ce);for(let e=0;e=0){let n=et(C);xe.push({id:t[e].id,texture:n}),n.repeat.set(1,-1),n.wrapS=n.wrapT=THREE.RepeatWrapping,n.minFilter=THREE.NearestFilter,n.generateMipmaps=!1;let a=new THREE.MeshBasicMaterial({color:16777215,map:n});null!=t[e].alpha&&null!=t[e].alpha&&t[e].alpha<1&&(a.transparent=!0,a.opacity=t[e].alpha),Ce.push({id:t[e].id,material:a});let i=RESOURCE_VR_ROOTPATH+"zones/"+t[e].id+"/";Y.generateTextureQueue(i,"m"+t[e].id,0,0,Y.TEXTURE_MODE.T_MAP_ZONE),Y.generateTextureQueue(i,"m"+t[e].id,0,3,Y.TEXTURE_MODE.T_MAP_ZONE)}}Y.modelLoad(Y.MESH_MODE.M_MAP_ZONE),null!=e&&null!=e&&x.syncTo3DCanvas(e)}))}(t)}(),this.testBlend=function(e){for(let t=0;t