1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2815],{25635:(e,t,n)=>{n.d(t,{$:()=>l,N:()=>o});var r=n(58419);let a=/page/i;function i(e){return!!(e&&e.isMeshStandardMaterial)}function o(e){return Object.values(e).find(e=>i(e)&&a.test(e.name))}function l(e,t){t&&i(t)&&e.traverse(e=>{if(!e.isMesh||!e.material||!function(e){let t=Array.isArray(e.material)?e.material:[e.material];return a.test(e.name)||t.some(e=>{var t;return a.test(null!=(t=e.name)?t:"")})}(e))return;let n=t.clone();n.map=null,n.color.setRGB(.796,.784,.761,r.er$),n.metalness=0,n.roughness=.78,n.emissive.set(0,0,0),n.emissiveMap=null,n.emissiveIntensity=0,n.envMapIntensity=0;e.geometry.computeBoundingBox();let i=e.geometry.boundingBox,o=i?i.min.clone():new r.Pq0,l=(i?i.max.clone().sub(i.min):new r.Pq0(1,1,1)).max(new r.Pq0(1e-5,1e-5,1e-5));n.onBeforeCompile=e=>{e.uniforms.pageMin={value:o},e.uniforms.pageSize={value:l},e.vertexShader=e.vertexShader.replace("#include <common>","\n #include <common>\n varying vec3 vPageRest;\n ").replace("#include <begin_vertex>","\n #include <begin_vertex>\n vPageRest = position;\n "),e.fragmentShader=e.fragmentShader.replace("#include <common>","\n #include <common>\n uniform vec3 pageMin;\n uniform vec3 pageSize;\n varying vec3 vPageRest;\n\n // Blend weight toward a term's mean once one period no longer covers a pixel.\n float pageBandLimit(float period) {\n return clamp(fwidth(period) * 1.6, 0.0, 1.0);\n }\n ").replace("#include <map_fragment>","\n #include <map_fragment>\n\n vec3 pageUvw = clamp((vPageRest - pageMin) / pageSize, 0.0, 1.0);\n\n float fine = pageUvw.z * ".concat("190.0",";\n float fineWave = abs(fract(fine) - 0.5) * 2.0;\n float fineLine = mix(smoothstep(0.0, 0.75, fineWave), 0.5, pageBandLimit(fine));\n\n float mid = pageUvw.z * ").concat("52.0",";\n float midWave = abs(fract(mid) - 0.5) * 2.0;\n float midLine = mix(smoothstep(0.1, 0.9, midWave), 0.5, pageBandLimit(mid));\n\n float group = pageUvw.z * ").concat("7.5",";\n float groupWave = 0.5 + 0.5 * sin(group * 6.2831853);\n float groupBand = mix(groupWave, 0.5, pageBandLimit(group));\n\n float shade =\n mix(0.93, 1.02, fineLine) * mix(0.955, 1.015, midLine) * mix(0.968, 1.0, groupBand);\n\n float edgeAO = smoothstep(0.0, 0.05, pageUvw.y) * smoothstep(0.0, 0.05, 1.0 - pageUvw.y);\n \n edgeAO *= smoothstep(0.0, 0.1, pageUvw.x);\n\n diffuseColor.rgb *= shade * mix(0.78, 1.0, edgeAO);\n "))},n.customProgramCacheKey=()=>"book-pages-".concat(190,"-").concat(52,"-").concat(7.5),n.needsUpdate=!0,e.material=n})}},42815:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var r=n(20369);n(55516);var a=n(25635),i=n(56862),o=n(97215),l=n(28832),c=n(68486),u=n(29127),s=n(52207),d=n(33270),m=n(55785),f=n(5072),p=n(86708),v=n(66933),h=n(58419),g=n(29516);d.p.preload(g.Tc),d.p.preload("/models/book-9.glb");let y=()=>void 0,w=new h.Pq0,x=new Map;function b(e){let{playIntro:t,onReady:n}=e,{scene:b,animations:M,cameras:E}=(0,d.p)(g.Tc),{materials:R}=(0,d.p)("/models/book-9.glb"),{actions:T,mixer:j}=(0,m.f)(M,b),{gl:P,scene:k,size:C,camera:L}=(0,p.C)(),S=E[0],q=(0,v.useRef)(null),z=(0,v.useRef)([]),B=(0,v.useRef)([]),O=(0,v.useRef)([]),A=(0,v.useRef)(-1),W=(0,v.useRef)(!1),_=(0,v.useRef)({x:0,y:0}),D=(0,v.useRef)(0),F=(0,v.useRef)(0),U=(0,v.useRef)(new h.Pq0),I=(0,v.useRef)(new h.Pq0(0,1,0)),N=(0,v.useRef)(new h.PTz),G=(0,v.useRef)(new h.PTz),{isTouch:$}=(0,s.k)(),Y=(0,i.Y)($),H=(0,o.H)(!$),[K,Q]=(0,v.useState)(!1),[V,Z]=(0,v.useState)(()=>{var e;return null!=(e=x.get(g.Tc))?e:null}),J=(0,v.useRef)(n);(0,v.useEffect)(()=>{J.current=n},[n]),(0,v.useEffect)(()=>{P.debug.checkShaderErrors=!1},[P]),(0,v.useEffect)(()=>{(0,a.$)(b,(0,a.N)(R))},[b,R]),(0,v.useEffect)(()=>{b.traverse(e=>{e.isLight&&void 0===e.userData.baseIntensity&&(e.userData.baseIntensity=e.intensity,e.intensity=e.intensity*g.j3)})},[b]);let X=(0,v.useMemo)(()=>{let e=[];
1return b.children.forEach(t=>{let n=!1;t.traverse(e=>{e.isMesh&&(n=!0)}),n&&e.push(t)}),e},[b]);(0,v.useEffect)(()=>{z.current=X,B.current=X.map(e=>e.quaternion.clone())},[X]),(0,v.useEffect)(()=>{let e=[];return b.traverse(t=>{var n;t.isMesh&&(null==(n=t.morphTargetInfluences)?void 0:n.length)&&(t.raycast=y,e.push(t))}),()=>{e.forEach(e=>delete e.raycast)}},[b]),(0,v.useEffect)(()=>{O.current=g.oE.map(e=>{let t=e.map(e=>T[e]).filter(Boolean);return t.forEach(e=>{e.setLoop(h.G3T,1),e.clampWhenFinished=!0,e.play().paused=!0}),t})},[T]),(0,v.useEffect)(()=>{if(!S)return;let e=!1,t=null,n=null;return t=requestAnimationFrame(()=>{if(t=null,!e){try{P.compile(k,S)}catch(e){console.warn("[WhyNowBooksModel] gl.compile failed",e)}n=requestAnimationFrame(()=>{var t;n=null,e||(Q(!0),null==(t=J.current)||t.call(J))})}}),()=>{e=!0,null!==t&&cancelAnimationFrame(t),null!==n&&cancelAnimationFrame(n)}},[P,k,S]),(0,v.useEffect)(()=>{K&&V&&q.current&&(q.current.visible=!0)},[K,V]);let ee=(0,v.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=O.current[e];(null==n?void 0:n.length)&&n.forEach(e=>{!e.isRunning()&&(e.reset(),e.paused=!1,e.timeScale=1,e.play(),t>0&&e.startAt(j.time+t))})},[j]);(0,v.useEffect)(()=>{t&&K&&V&&!W.current&&(W.current=!0,q.current&&u.os.fromTo(q.current.position,{y:-g._5},{y:0,duration:g.Ou,ease:"power2.out",overwrite:!0}),O.current.forEach((e,t)=>ee(t,t*g.s9)))},[t,K,V,ee]),(0,p.D)((e,t)=>{let n=z.current;if(!K||!n.length)return;let r=Y.current,a=$&&r.active,i=_.current;if(!a&&$)i.x=h.cj9.lerp(i.x,0,c.cC.yaw),i.y=h.cj9.lerp(i.y,0,c.cC.pitch);else{let e=H.current,t=a?r.x:e.x,n=a?r.y:e.y,o=a?c.b8:g.CI,l=a?c.Mi:g.vR;i.x=h.cj9.lerp(i.x,h.cj9.clamp(t,-1,1)*o,c.cC.yaw),i.y=h.cj9.lerp(i.y,h.cj9.clamp(n,-1,1)*l,c.cC.pitch)}let o=$&&!a?1:0,l=Math.min(t,.1),u=l>0?Math.min(1,l/c.Ts.blendSec):1;D.current+=(o-D.current)*u;let s=0,d=0;if(D.current>5e-4){F.current+=l;let e=F.current/c.Ts.periodSec*Math.PI*2,t=D.current;s=Math.sin(e)*c.Ts.yawRad*t,d=Math.sin(.5*e)*c.Ts.pitchRad*t}U.current.set(1,0,0).transformDirection(L.matrixWorld),N.current.setFromAxisAngle(I.current,i.x+s),G.current.setFromAxisAngle(U.current,i.y+d);let m=B.current;for(let e=0;e<n.length;e++)n[e].quaternion.copy(N.current).multiply(G.current).multiply(m[e])});let et=(0,v.useCallback)(e=>{let t=z.current,n=e;for(;n;){let e=t.indexOf(n);if(-1!==e)return e;n=n.parent}return -1},[]),en=(0,v.useCallback)(e=>{A.current!==e&&(A.current=e,document.body.style.cursor=-1===e?"auto":"pointer",-1!==e&&ee(e))},[ee]),er=(0,v.useCallback)(e=>{e.stopPropagation(),en(et(e.object))},[en,et]),ea=(0,v.useCallback)(e=>{e.intersections.length||en(-1)},[en]),ei=(0,v.useCallback)(e=>{e.stopPropagation();let t=l.E.getBookOnlineStores.amazon;t&&window.open(t,"_blank","noopener, noreferrer")},[]);(0,v.useEffect)(()=>()=>{-1!==A.current&&(document.body.style.cursor="auto")},[]),(0,v.useEffect)(()=>{var e,t;let n=x.get(g.Tc);if(n)return void Z(e=>null!=e?e:n);if(!X.length)return;let r=O.current.flat();if(!r.length)return;let a=r.map(e=>({action:e,time:e.time,paused:e.paused})),i=B.current,o=X.map(e=>e.quaternion.clone()),l=b.position.clone(),c=null!=(t=null==(e=q.current)?void 0:e.position.y)?t:0;try{r.forEach(e=>{e.paused=!0,e.time=e.getClip().duration}),j.update(0),X.forEach((e,t)=>{let n=i[t];n&&e.quaternion.copy(n)}),b.position.set(0,0,0),q.current&&(q.current.position.y=0),b.updateMatrixWorld(!0);let e=new h.NRn;
1X.forEach(t=>e.expandByObject(t)),e.isEmpty()||(x.set(g.Tc,e),Z(e))}finally{b.position.copy(l),q.current&&(q.current.position.y=c),X.forEach((e,t)=>e.quaternion.copy(o[t])),a.forEach(e=>{let{action:t,time:n,paused:r}=e;t.time=n,t.paused=r}),j.update(0),b.updateMatrixWorld(!0)}},[T,X,j,b]);let eo=(0,g.Zz)(C.width,C.height),{fov:el,fitOffset:ec}=(0,v.useMemo)(()=>{var e;let t=null!=(e=null==S?void 0:S.fov)?e:45;return S&&V&&!(eo<=0)?function(e,t,n){e.updateMatrixWorld();let r=new h.kn4().copy(e.matrixWorld).invert(),a=[];for(let e=0;e<8;e++)a.push(new h.Pq0(1&e?t.max.x:t.min.x,2&e?t.max.y:t.min.y,4&e?t.max.z:t.min.z).applyMatrix4(r));let i=(Math.min(...a.map(e=>e.x))+Math.max(...a.map(e=>e.x)))/2,o=(Math.min(...a.map(e=>e.y))+Math.max(...a.map(e=>e.y)))/2,l=0,c=0,u=1/0,s=-1/0;a.forEach(e=>{let t=-e.z;t<=0||(l=Math.max(l,Math.abs(e.y-o)/t,Math.abs(e.x-i)/(t*n)),c=Math.max(c,Math.abs(e.y-o)/t),u=Math.min(u,e.z),s=Math.max(s,e.z))});let d=Math.min(g.TV,h.cj9.radToDeg(2*Math.atan(l/g.pG))),m=Math.max(0,Math.tan(h.cj9.degToRad(d)/2)-c),f=Number.isFinite(u)?-(u+s)/2:0,p=f>0?-m*f*g.f9:0;return{fov:d,fitOffset:new h.Pq0(-i,-o+p,0).applyQuaternion(e.quaternion)}}(S,V,eo):{fov:t,fitOffset:w}},[S,V,eo]);return S?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.u,{makeDefault:!0,fov:el,near:S.near,far:S.far,position:[S.position.x,S.position.y,S.position.z],rotation:[S.rotation.x,S.rotation.y,S.rotation.z]}),(0,r.jsx)("group",{ref:q,visible:!1,children:(0,r.jsx)("primitive",{object:b,position:ec,onPointerOver:er,onPointerMove:er,onPointerOut:ea,onClick:ei})})]}):null}}
1,56862:(e,t,n)=>{n.d(t,{Y:()=>i});var r=n(66933);let a=e=>Math.min(1,Math.max(-1,e));function i(e){let t=(0,r.useRef)({x:0,y:0,active:!1,denied:!1});return(0,r.useEffect)(()=>{if(!e||"undefined"==typeof DeviceOrientationEvent)return;let n=t.current,r=null,i=0,o=0,l=0,c=0,u=0,s=0,d=!1,m=!1,f=e=>{let{beta:t,gamma:d}=e;if(null===t||null===d)return;let m=(()=>{var e;if(null==(e=window.screen)?void 0:e.orientation)return window.screen.orientation.angle;let t=window.orientation;return"number"==typeof t?(t+360)%360:0})();if(!r||r.angle!==m)return void(r={beta:t,gamma:d,angle:m},i=performance.now(),o=t,l=d,c=1,u=0,s=0,n.x=0,n.y=0);if(performance.now()-i<450){o+=t,l+=d,c+=1,r.beta=o/c,r.gamma=l/c;return}let f=a((t-r.beta)/28),p=a((d-r.gamma)/28);u+=(f-u)*.16,s+=(p-s)*.16;let v=((e,t,n)=>{let r=n*Math.PI/180,a=Math.cos(r),i=Math.sin(r),o=-e;return{x:t*a+o*i,y:-t*i+o*a}})(u,s,m);n.x=v.x,n.y=v.y,n.active=!0},p=()=>{d||m||(d=!0,window.addEventListener("deviceorientation",f,{passive:!0}))},v=DeviceOrientationEvent.requestPermission,h=["touchend","touchstart","pointerup","click"],g=()=>{h.forEach(e=>window.removeEventListener(e,w))},y=()=>v.call(DeviceOrientationEvent).then(e=>"granted"===e?(g(),p(),!0):(g(),n.denied=!0,!1)),w=()=>
1{if(g(),"function"!=typeof v)return void p();y().catch(()=>{m||n.denied||h.forEach(e=>window.addEventListener(e,w,{passive:!0}))})};"function"==typeof v?(h.forEach(e=>window.addEventListener(e,w,{passive:!0})),y().catch(()=>{})):p();let x=()=>{r=null},b=()=>{"visible"===document.visibilityState&&(r=null)};return window.addEventListener("orientationchange",x,{passive:!0}),window.addEventListener("visibilitychange",b),()=>{m=!0,window.removeEventListener("orientationchange",x),window.removeEventListener("visibilitychange",b),g(),window.removeEventListener("deviceorientation",f),n.x=0,n.y=0,n.active=!1,n.denied=!1}},[e]),t}},68486:(e,t,n)=>{n.d(t,{Mi:()=>l,OU:()=>i,Ts:()=>u,b8:()=>o,cC:()=>c,vN:()=>a});var r=n(58419);let a=r.cj9.degToRad(10),i=r.cj9.degToRad(9),o=r.cj9.degToRad(7),l=r.cj9.degToRad(5.5),c={yaw:.05,pitch:.035},u={periodSec:1.667,yawRad:r.cj9.degToRad(2.2),pitchRad:r.cj9.degToRad(1.3),blendSec:.7}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.