PageSourceSearch

https://joinhottub.com/_next/static/chunks/7067.d5ee4993a3e40d79.js

js joinhottub.com collected 2026-10-09 22:40:03 UTC 205,647 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4298,7067],{4298:(e,t,a)=>{"use strict";a.r(t),a.d(t,{CRITICAL_DISTANCE_COEFFICIENT:()=>o,DEFAULT_ACOUSTICS:()=>h,FAR_VOICE_METRES:()=>r,INTELLIGIBILITY_FLOOR_DB:()=>n,clarityDb:()=>p,criticalDistance:()=>l,roomAcousticsFor:()=>f,wetCeiling:()=>s});let n=6,o=.057,r=3.44,i={intimate:{decay:.7,radius:3,damp:.62,wet:.1},room:{decay:1.15,radius:5,damp:.45,wet:.15},stage:{decay:1.5,radius:9,damp:.32,wet:.2},hall:{decay:2.3,radius:16,damp:.28,wet:.24}};function l(e,t){return e>0&&t>0?o*Math.sqrt(2/3*Math.PI*t**3/e):0}function s(e,t){let a=l(e,t);return a<=0?0:Math.min(r/a,10**(-n/20))}function d(e){return{decay:e.decay,wet:Math.min(e.wet,s(e.decay,e.radius)),damp:e.damp}}let c={intimate:d(i.intimate),room:d(i.room),stage:d(i.stage),hall:d(i.hall)},h=c.room,u={coffee:"intimate",books:"intimate",kitchen:"intimate",film:"intimate",mountains:"hall",ocean:"hall",garden:"room",cycling:"room",gaming:"room",fitness:"room",music:"stage",stadium:"stage",funfair:"stage"};function f(e){var t;return e&&null!=(t=c[u[e]])?t:h}function p(e){return e.wet<=0?60:20*Math.log10(1/e.wet)}},7067:(e,t,a)=>{"use strict";a.r(t),a.d(t,{SpatialSoakRoom:()=>eI});var n=a(4536);a(83910);var o=a(11092),r=a(90625),i=a(14404),l=a(74678),s=a(31519),d=a(36560),c=a(41566),h=a(34662);let u={mountains:{bg:"#dde8ee",floor:"#cdd6cf",water:"#3a7d8c",light:"#eef4ff",hemiGround:0xc9d2c6,tubWall:"#8a7a66",rim:"#6e5f4d",seatColor:"#d6cdbb",accent:"#7fae8c",decor:"foliage"},ocean:{bg:"#cfe7ec",floor:"#d8c9a8",water:"#0f7a90",light:"#eaf6f4",hemiGround:0xbfd8d2,tubWall:"#c98f5e",rim:"#a06a3e",seatColor:"#e0cfa6",accent:"#e8a24a",decor:"buoys"},coffee:{bg:"#efe2d3",floor:"#5b4636",water:"#6b4a32",light:"#ffe9cf",hemiGround:7034180,tubWall:"#7a5236",rim:"#5e3f24",seatColor:"#cdb28f",accent:"#f0a24a",decor:"lanterns"},books:{bg:"#ece3d2",floor:"#5a4a36",water:"#7a5a3a",light:"#ffeccb",hemiGround:7035458,tubWall:"#6e4f33",rim:"#523a22",seatColor:"#c9b48d",accent:"#e6b15a",decor:"lanterns"},garden:{bg:"#d8ead0",floor:"#6f8456",water:"#2f8f7e",light:"#eef7da",hemiGround:5597247,tubWall:"#7a5a34",rim:"#5c4326",seatColor:"#a9c089",accent:"#8fc06a",decor:"foliage"},kitchen:{bg:"#f1e8da",floor:"#d8c4a2",water:"#b08a5e",light:"#fff0d8",hemiGround:0xcdb892,tubWall:"#9a6f44",rim:"#7a532f",seatColor:"#e2cda4",accent:"#f0b15a",decor:"lanterns"},cycling:{bg:"#d6e3ec",floor:"#8a8f93",water:"#3b7e96",light:"#eef4fb",hemiGround:0x9aa3a8,tubWall:"#6f6a64",rim:"#534f4a",seatColor:"#c4c8cb",accent:"#4aa8c0",decor:"beacons"},gaming:{bg:"#2a2e44",floor:"#33374f",water:"#6f5ad0",light:"#bcb6ff",hemiGround:3356495,tubWall:"#3e3a58",rim:"#2c2942",seatColor:"#4c4870",accent:"#8f7aff",decor:"pylons"},fitness:{bg:"#e7edf0",floor:"#8f969a",water:"#2f9aa8",light:"#fff0e6",hemiGround:0x9aa3a8,tubWall:"#6f6a64",rim:"#4f4a44",seatColor:"#cdd2d5",accent:"#ef7a5a",decor:"beacons"},film:{bg:"#2a2630",floor:"#33303a",water:"#7a5a7a",light:"#ddc7cf",hemiGround:3354682,tubWall:"#463a44",rim:"#322832",seatColor:"#4a4450",accent:"#c98fb0",decor:"lanterns"},music:{bg:"#2c2740",floor:"#36304a",water:"#7a5ac0",light:"#d8c8ff",hemiGround:3551306,tubWall:"#4a3f5e",rim:"#342a44",seatColor:"#4e466a",accent:"#9b6fe0",decor:"pylons"},stadium:{bg:"#cfe3ec",floor:"#4f8a4a",water:"#2f8fa0",light:"#eef6f4",hemiGround:5208644,tubWall:"#7a5a34",rim:"#5c4326",seatColor:"#6fa05a",accent:"#f2e29a",decor:"beacons"},funfair:{bg:"#f3e2ea",floor:"#d8b8c4",water:"#d05a8a",light:"#fff0e6",hemiGround:0xc99ab0,tubWall:"#b06a8a",rim:"#8a4f6a",seatColor:"#e8c4d2",accent:"#ff8fb4",decor:"lanterns"}},f=e=>new r._4j({color:new r.Q1f(e),roughness:.8}),p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new r._4j({color:e,emissive:e,emissiveIntensity:t,roughness:.5})};var m=a(4298);let g={wolftrail:"/xr/wolftrail-birds.wav","wolftrail-real":"/xr/wolftrail-birds.wav"};var w=a(35735);let b={KEY_COLOR:9,KEY_INTENSITY:12,AMBIENT_COLOR:13,AMBIENT_INTENSITY:16,BOUNCE_COLOR:17,RIM_COLOR:20,RIM_INTENSITY:23,FOG_COLOR:24,FOG_DENSITY:27,CAMERA_NEAR:38,CAMERA_FAR:39,WATER_ROUGHNESS:41,WATER_METALNESS:42},y={X:0,Y:1,Z:2,YAW:3,RADIUS:4,HEIGHT:5,R:6,TILT:9};function x(e,t,a){e.setRGB(t[a],t[a+1],t[a+2],r.Zr2)}function v(e){return new r.BKk({uniforms:{uScale:{value:e}},vertexShader:"\n      attribute float size;\n      varying vec3 vTint;\n      uniform float uScale;\n      void main() {\n        vTint = color;
1\n        vec4 view = modelViewMatrix * vec4(position, 1.0);\n        gl_PointSize = max(size * uScale / max(-view.z, 0.001), 1.0);\n        gl_Position = projectionMatrix * view;\n      }",fragmentShader:"\n      varying vec3 vTint;\n      void main() {\n        float d = length(gl_PointCoord - vec2(0.5));\n        float alpha = 1.0 - smoothstep(0.12, 0.5, d);\n        if (alpha <= 0.0) discard;\n        gl_FragColor = vec4(vTint * alpha, alpha);\n      }",transparent:!0,depthWrite:!1,vertexColors:!0,blending:r.EZo})}async function M(e){var t;let a=await fetch("/xr/surf-worlds-core.wasm",{signal:e.signal,cache:"force-cache"});if(!a.ok)throw Error("surf-worlds-core returned ".concat(a.status));let{instance:n}=await WebAssembly.instantiate(await a.arrayBuffer(),{});if(null==(t=e.signal)?void 0:t.aborted)throw new DOMException("World load cancelled","AbortError");let o=n.exports;if(5!==o.abi_version())throw Error("surf-worlds-core ABI ".concat(o.abi_version()," is unsupported"));let i=function(e){let t=e.memory.buffer,a=(e,a)=>new Float32Array(t,e,a),n=(e,a)=>new Uint32Array(t,e,a);return{terrainPositions:a(e.terrain_positions(),111747),terrainNormals:a(e.terrain_normals(),111747),terrainColors:a(e.terrain_colors(),111747),terrainIndices:n(e.terrain_indices(),221184),waterPositions:a(e.water_positions(),49923),waterNormals:a(e.water_normals(),49923),waterColors:a(e.water_colors(),49923),waterIndices:n(e.water_indices(),98304),skyPositions:a(e.sky_positions(),8979),skyColors:a(e.sky_colors(),8979),skyIndices:n(e.sky_indices(),17280),starPositions:a(e.star_positions(),3*e.star_capacity()),starColors:a(e.star_colors(),3*e.star_capacity()),starSizes:a(e.star_sizes(),e.star_capacity()),instances:a(e.instances(),e.instance_capacity()*e.instance_stride()),formOffsets:n(e.form_offsets(),e.form_count()),formCounts:n(e.form_counts(),e.form_count()),formEmissive:a(e.form_emissive(),4*e.form_count()),particlePositions:a(e.particle_positions(),3*e.particle_capacity()),particleColors:a(e.particle_colors(),3*e.particle_capacity()),particleSizes:a(e.particle_sizes(),e.particle_capacity()),bodies:a(e.bodies(),16*e.body_stride()),lights:a(e.lights(),8*e.light_stride()),frame:a(e.frame(),e.frame_len())}}(o),l=new TextEncoder().encode(e.slug);if(!l.length||l.length>128)throw Error("World address is invalid");new Uint8Array(o.memory.buffer,o.instances(),l.length).set(l);let s=o.world_index_for(o.instances(),l.length);if(s<0)throw Error("World ".concat(e.slug," is not in the Rust catalog"));if(!o.world_open(s,function(){var e;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;let t=null!=(e=navigator.deviceMemory)?e:4,a=navigator.hardwareConcurrency||4;return 500>Math.min(screen.width,screen.height)||t<=4||a<=4?0:t<=8||a<=8?1:2}()))throw Error("World ".concat(e.slug," exceeds its declared buffers"));let d=new r.YJl;d.name="surf-world:".concat(e.slug),e.scene.add(d),function(e,t,a){let n=t.terrain_vertex_count();if(!n)return;let o=new r.LoY;o.setAttribute("position",new r.THS(a.terrainPositions.subarray(0,3*n),3)),o.setAttribute("normal",new r.THS(a.terrainNormals.subarray(0,3*n),3)),o.setAttribute("color",new r.THS(a.terrainColors.subarray(0,3*n),3)),o.setIndex(new r.THS(a.terrainIndices.subarray(0,t.terrain_index_count()),1)),o.computeBoundingSphere(),e.add(new r.eaF(o,new r._4j({vertexColors:!0,roughness:.94,metalness:.02})))}(d,o,i);let c=function(e,t,a){let n=t.sky_vertex_count();if(!n)return null;let o=new r.LoY,i=new r.THS(a.skyColors.subarray(0,3*n),3);i.setUsage(r.Vnu),o.setAttribute("position",new r.THS(a.skyPositions.subarray(0,3*n),3)),o.setAttribute("color",i),o.setIndex(new r.THS(a.skyIndices.subarray(0,t.sky_index_count()),1));let l=new r.eaF(o,new r.V9B({vertexColors:!0,fog:!1,depthWrite:!1}));return l.renderOrder=-3,e.add(l),i}(d,o,i),h=!1;if(c){let e=i.skyColors.slice(0,Math.min(600,3*o.sky_vertex_count()));o.tick(1/60);for(let t=0;t<e.length;t+=1)if(e[t]!==i.skyColors[t]){h=!0;break}}!function(e,t,a){let n=t.star_count();if(!n)return;let o=new r.LoY;o.setAttribute("position",new r.THS(a.starPositions.subarray(0,3*n),3)),o.setAttribute("color",new r.THS(a.starColors.subarray(0,3*n),3)),o.setAttribute("size",new r.THS(a.starSizes.subarray(0,n),1));let i=new r.ONl(o,v(900));i.frustumCulled=!1,i.renderOrder=-2,e.add(i)}(d,o,i),function(e,t,a){let n=t.instance_stride(),o=new r.kn4,i=new r.PTz,l=new r.O9p,s=new r.Pq0,d=new r.Pq0,c=new r.Q1f;for(let p=0;p<t.form_count();p+=1){var h,u,f;let t=null!=(h=a.formCounts[p])?h:0,m=t?function(e){switch(e){case 0:return new r.qFE(1,1,7).translate(0,.5,0);case 1:return new r.WBB(1,1).scale(1,.75,1).translate(0,.75,0);case 2:return new r.WBB(1,0).scale(1,.65,1).translate(0,.5,0);case 3:return new r.WBB(1,1).scale(1,.7,1).translate(0,.5,0);case 4:return new r.qFE(.45,1,5).translate(0,.5,0);case 5:return new r.Ho_(.4,.55,1,7).rotateZ(Math.PI/2).translate(0,.45,0);case 6:return new r.qFE(.8,1,5).translate(0,.5,0);case 7:return new r.Ho_(.8,1,1,10).translate(0,.5,0);case 8:return new r.WBB(.8,1).translate(0,.8,0);case 9:return new r.qFE(.25,1,4).translate(0,.5,0);case 10:return new r.Ho_(.62,1,1,6).translate(0,.5,0);case 11:return new r.qFE(1,1,5).translate(0,.5,0);case 12:return new r.iNn(1.5,1,1.05).translate(0,.5,0);case 13:default:return null;case 14:return new r.Ho_(1,1,.12,28).translate(0,.9,0);case 15:return new r.O3Y(1,.12,12,44,Math.PI);case 16:return new r.iNn(2,.1,1).translate(0,.1,0);case 17:return new r.WBB(1,1).scale(1,.75,1).translate(0,.5,0);case 18:return new r.iNn(2.2,.22,.8).translate(0,.9,0);
1case 20:return new r.Gu$(1,10,6).scale(.34,.2,.34).translate(0,.9,0);case 21:return new r.Ho_(.92,1,1,9).translate(0,.5,0);case 22:return new r.Gu$(1,10,6).scale(.5,.34,.5).translate(0,.8,0);case 23:return new r.iNn(1.18,.09,.14).translate(0,1,0);case 24:return new r.Ho_(1,1,1,14).translate(0,.5,0);case 25:return new r.O3Y(1,.3,6,14).rotateX(Math.PI/2)}}(p):null;if(!t||!m)continue;let g=null!=(u=a.formEmissive[4*p])?u:0,w=new r._4j({roughness:g?.42:.88,metalness:.03,emissiveIntensity:Math.min(g,4)});g&&x(w.emissive,a.formEmissive,4*p+1);let b=new r.ZLX(m,w,t),v=null!=(f=a.formOffsets[p])?f:0;for(let e=0;e<t;e+=1){let t=(v+e)*n;s.set(a.instances[t+y.X],a.instances[t+y.Y],a.instances[t+y.Z]),l.set(a.instances[t+y.TILT],a.instances[t+y.YAW],0),i.setFromEuler(l);let r=a.instances[t+y.RADIUS],h=a.instances[t+y.HEIGHT];5===p||16===p||18===p?d.set(h,r,r):15===p?d.set(r,r,.14*r):d.set(r,h,r),o.compose(s,i,d),b.setMatrixAt(e,o),x(c,a.instances,t+y.R),b.setColorAt(e,c)}b.instanceMatrix.needsUpdate=!0,b.instanceColor&&(b.instanceColor.needsUpdate=!0),b.frustumCulled=!1,e.add(b)}}(d,o,i),function(e,t,a){let n=t.body_stride();for(let o=0;o<t.body_count();o+=1){let t=o*n,i=new r.Gu$(a.bodies[t+3],32,20),l=new r._4j({roughness:.92,emissiveIntensity:a.bodies[t+7],fog:!1});x(l.color,a.bodies,t+4),x(l.emissive,a.bodies,t+4);let s=new r.eaF(i,l);s.position.set(a.bodies[t],a.bodies[t+1],a.bodies[t+2]),e.add(s)}}(d,o,i),function(e,t,a){let n=a.frame,o=new r.dth(0xffffff,0xffffff,n[b.AMBIENT_INTENSITY]);x(o.color,n,b.AMBIENT_COLOR),x(o.groundColor,n,b.BOUNCE_COLOR),e.add(o);let i=new r.ZyN(0xffffff,n[b.KEY_INTENSITY]);x(i.color,n,b.KEY_COLOR),i.position.set(24,60,36),e.add(i);let l=new r.ZyN(0xffffff,n[b.RIM_INTENSITY]);x(l.color,n,b.RIM_COLOR),l.position.set(-36,24,-30),e.add(l);let s=t.light_stride();for(let n=0;n<t.light_count();n+=1){let t=n*s,o=new r.HiM(0xffffff,a.lights[t+6],a.lights[t+7],1.8);x(o.color,a.lights,t+3),o.position.set(a.lights[t],a.lights[t+1],a.lights[t+2]),e.add(o)}}(d,o,i);let u=o.water_vertex_count(),f=null,p=null;if(u){let e=new r.LoY;f=new r.THS(i.waterPositions.subarray(0,3*u),3),p=new r.THS(i.waterNormals.subarray(0,3*u),3),f.setUsage(r.Vnu),p.setUsage(r.Vnu),e.setAttribute("position",f),e.setAttribute("normal",p),e.setAttribute("color",new r.THS(i.waterColors.subarray(0,3*u),3)),e.setIndex(new r.THS(i.waterIndices.subarray(0,o.water_index_count()),1)),d.add(new r.eaF(e,new r._4j({vertexColors:!0,roughness:i.frame[b.WATER_ROUGHNESS],metalness:i.frame[b.WATER_METALNESS],transparent:!0,opacity:.9})))}let m=o.particle_count(),g=null,w=null,M=null;if(m){let e=new r.LoY;g=new r.THS(i.particlePositions.subarray(0,3*m),3),w=new r.THS(i.particleColors.subarray(0,3*m),3),M=new r.THS(i.particleSizes.subarray(0,m),1),g.setUsage(r.Vnu),w.setUsage(r.Vnu),M.setUsage(r.Vnu),e.setAttribute("position",g),e.setAttribute("color",w),e.setAttribute("size",M);let t=new r.ONl(e,v(620));t.frustumCulled=!1,d.add(t)}x((e.scene.fog=new r.cRK(0xffffff,i.frame[b.FOG_DENSITY])).color,i.frame,b.FOG_COLOR),e.camera.near=Math.max(.05,i.frame[b.CAMERA_NEAR]),e.camera.far=i.frame[b.CAMERA_FAR],e.camera.updateProjectionMatrix();let k=!1;return{update(e){!k&&(o.tick(Math.min(Math.max(e,0),.05)),f&&(f.needsUpdate=!0),p&&(p.needsUpdate=!0),g&&(g.needsUpdate=!0),w&&(w.needsUpdate=!0),M&&(M.needsUpdate=!0),c&&h&&(c.needsUpdate=!0))},dispose(){k||(k=!0,e.scene.remove(d),d.traverse(e=>{var t,a;null==(t=e.geometry)||t.dispose(),Array.isArray(e.material)?e.material.forEach(e=>e.dispose()):null==(a=e.material)||a.dispose()}))}}}class k{start(){this.stopped=!1,document.addEventListener("visibilitychange",this.onVisibilityChange),this.tick()}async stop(){!this.stopped&&(this.stopped=!0,this.timer&&clearTimeout(this.timer),this.timer=null,document.removeEventListener("visibilitychange",this.onVisibilityChange),this.opts.onPeers([]),this.joined&&await this.sendLeave())}async sendLeave(){this.joined=!1,await fetch(this.url(),{method:"DELETE",headers:{"content-type":"application/json",...(0,d.l)()},body:JSON.stringify({visitId:this.opts.visitId}),credentials:"same-origin",keepalive:!0}
1).catch(()=>{})}url(){return"/api/xr/surf-worlds/".concat(encodeURIComponent(this.opts.worldSlug),"/presence")}schedule(){this.stopped||(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>void this.tick(),this.heartbeatMs))}async tick(){if(!this.stopped&&!this.inFlight){this.inFlight=!0;try{let e=await fetch(this.url(),{method:"POST",headers:{"content-type":"application/json",...(0,d.l)()},body:JSON.stringify({visitId:this.opts.visitId}),credentials:"same-origin",cache:"no-store"});if(401===e.status||403===e.status||404===e.status||409===e.status){this.opts.onPeers([]),this.stopped=!0,document.removeEventListener("visibilitychange",this.onVisibilityChange);return}if(!e.ok)return;let t=await e.json();if(this.joined=!0,this.stopped)return void await this.sendLeave();"number"==typeof t.heartbeatMs&&(this.heartbeatMs=Math.max(1e3,Math.min(1e4,t.heartbeatMs))),this.opts.onPeers(Array.isArray(t.peers)?t.peers:[])}catch(e){}finally{this.inFlight=!1,this.schedule()}}}constructor(e){this.opts=e,this.timer=null,this.stopped=!1,this.joined=!1,this.inFlight=!1,this.heartbeatMs=5e3,this.onVisibilityChange=()=>{this.stopped||"visible"!==document.visibilityState||this.tick()}}}var S=a(38726);let I=e=>"/xr/wolftrail/".concat(e,".jpg"),P={"wolftrail-real":{radius:24,bottomY:-9,topY:12,skyColor:"#c2ccd2",groundColor:"#5b4f3b",panels:[{tex:I("0530"),centerDeg:0,arcDeg:100},{tex:I("0529"),centerDeg:76,arcDeg:52},{tex:I("0531"),centerDeg:128,arcDeg:52},{tex:I("0532"),centerDeg:180,arcDeg:52},{tex:I("0528"),centerDeg:232,arcDeg:52},{tex:I("0532"),centerDeg:284,arcDeg:52}]}};var T=a(32595),C=a(87494),j=a(28490),_=a(31040);class A{async start(){var e,t,a,n,o,r,i,l,s,c,h,u,f;let p,m;null!=this.endRealtimeAudioSurface||(this.endRealtimeAudioSurface=(0,_.m)()),null==(e=(t=this.opts).onState)||e.call(t,"connecting");try{let e=await fetch("/api/xr/stage/".concat(encodeURIComponent(this.opts.stageId),"/token"),{method:"POST",headers:{"content-type":"application/json",...(0,d.l)()},body:JSON.stringify({identity:this.opts.identity,name:this.opts.displayName,host:this.opts.asHost})});if(503===e.status){this.releaseRealtimeAudioSurface(),null==(o=(r=this.opts).onState)||o.call(r,"unconfigured");return}if(!e.ok){this.releaseRealtimeAudioSurface(),null==(i=(l=this.opts).onState)||i.call(l,"error","Could not join the stage.");return}let t=await e.json();p=t.url,m=t.token,this.role=t.role,this.canPublish=t.canPublish,this.hostKey=null!=(s=t.hostKey)?s:null}catch(e){this.releaseRealtimeAudioSurface(),null==(c=(h=this.opts).onState)||c.call(h,"error","Could not reach the stage.");return}let g=new C.Wv({adaptiveStream:!0,dynacast:!0,audioCaptureDefaults:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,voiceIsolation:!0,channelCount:1,sampleRate:48e3,sampleSize:24,latency:.015},publishDefaults:{audioPreset:C.Ft.music,dtx:!0,red:!0,forceStereo:!1}});this.room=g,g.on(C.u9.TrackSubscribed,(e,t,a)=>this.onTrack(e,a)).on(C.u9.TrackUnsubscribed,e=>this.detach(e)).on(C.u9.ParticipantConnected,()=>this.emitStage()).on(C.u9.ParticipantDisconnected,()=>this.emitStage()).on(C.u9.ParticipantPermissionsChanged,()=>this.refreshSelf()).on(C.u9.Disconnected,()=>{var e,t;this.stopped||null==(e=(t=this.opts).onState)||e.call(t,"error","Disconnected from the stage.")});try{await g.connect(p,m)}catch(e){this.releaseRealtimeAudioSurface(),null==(u=(f=this.opts).onState)||u.call(f,"error","Could not connect to the stage.");return}if(this.stopped)return void g.disconnect();null==(a=(n=this.opts).onState)||a.call(n,"connected"),this.refreshSelf(),this.tick(),this.poll=setInterval(()=>void this.tick(),2500)}async raiseHand(e){this.handRaised=e,this.emitSelf(),await this.post({identity:this.opts.identity,action:e?"raise":"lower"})}async grant(e,t){if(!this.hostKey)return{ok:!1};let a=await this.post({hostKey:this.hostKey,target:e,action:t?"grant":"release"});return(null==a?void 0:a.status)===409?{ok:!1,full:!0}:{ok:!!(null==a?void 0:a.ok)}}async setMuted(e){var t;let a=null==(t=this.room)?void 0:t.localParticipant;a&&this.canPublish&&await a.setMicrophoneEnabled(!e)}async stop(){var e,t,a,n;for(let e of(this.stopped=!0,this.poll&&clearInterval(this.poll),this.poll=null,this.audioNodes.values())
1)e.source.disconnect(),e.nodes.forEach(e=>e.disconnect()),e.cleanup(),e.panner.disconnect();this.audioNodes.clear();try{this.masterNodes.forEach(e=>e.disconnect())}catch(e){}for(let e of(this.masterInput=null,this.masterNodes=[],this.trackParticipants.clear(),this.audioEls.values()))e.srcObject=null,e.remove();this.audioEls.clear(),await (null==(e=this.audioCtx)?void 0:e.close().catch(()=>{})),this.audioCtx=null,await (null==(t=this.room)?void 0:t.disconnect()),this.room=null,this.releaseRealtimeAudioSurface(),null==(a=(n=this.opts).onState)||a.call(n,"connecting")}releaseRealtimeAudioSurface(){var e;null==(e=this.endRealtimeAudioSurface)||e.call(this),this.endRealtimeAudioSurface=null}onTrack(e,t){var a;if(e.kind!==C.CC.Kind.Audio)return;let n=e.attach();n.autoplay=!0;let o=null!=(a=e.sid)?a:Math.random().toString(36);this.audioEls.set(o,n),this.trackParticipants.set(o,t.identity),this.spatialize(o,n,t.identity),this.emitStage()}detach(e){if(e.detach().forEach(e=>e.remove()),e.sid){let t=this.audioNodes.get(e.sid);null==t||t.source.disconnect(),null==t||t.nodes.forEach(e=>e.disconnect()),null==t||t.cleanup(),null==t||t.panner.disconnect(),this.audioNodes.delete(e.sid),this.audioEls.delete(e.sid),this.trackParticipants.delete(e.sid)}this.emitStage()}spatialize(e,t,a){try{var n;let o=window.AudioContext||window.webkitAudioContext;if(!o)return;let r=null!=(n=this.audioCtx)?n:new o;this.audioCtx=r;let i=r.createMediaElementSource(t),l=function(e,t){let a=e.createBiquadFilter();a.type="highpass",a.frequency.value=90,a.Q.value=.7;let n=e.createBiquadFilter();n.type="lowshelf",n.frequency.value=180,n.gain.value=.6;let o=e.createBiquadFilter();o.type="peaking",o.frequency.value=3e3,o.Q.value=.75,o.gain.value=1.2;let r=e.createBiquadFilter();r.type="peaking",r.frequency.value=6500,r.Q.value=.9,r.gain.value=-1.6;let i=e.createBiquadFilter();i.type="lowpass",i.frequency.value=10500,i.Q.value=.65;let l=e.createDynamicsCompressor();l.threshold.value=-26,l.knee.value=20,l.ratio.value=2.4,l.attack.value=.004,l.release.value=.22;let s=e.createAnalyser();s.fftSize=256,s.smoothingTimeConstant=.78;let d=e.createGain();d.gain.value=.92;let c=e.createDynamicsCompressor();c.threshold.value=-6,c.knee.value=3,c.ratio.value=10,c.attack.value=.003,c.release.value=.08;let h=e.createGain();h.gain.value=.98,t.connect(a).connect(n).connect(o).connect(r).connect(i).connect(l),l.connect(s),l.connect(d).connect(c).connect(h);let u=new Uint8Array(s.fftSize),f=0,p=.92,m="function"==typeof requestAnimationFrame?requestAnimationFrame:e=>window.setTimeout(()=>e(performance.now()),33),g="function"==typeof cancelAnimationFrame?cancelAnimationFrame:window.clearTimeout,w=()=>{s.getByteTimeDomainData(u);let t=function(e){let t=0;for(let a=0;a<e.length;a++){let n=(e[a]-128)/128;t+=n*n}return Math.sqrt(t/Math.max(1,e.length))}(u),a=.92,n=(a=t<.006?.28:t<.018?.58:Math.max(.82,Math.min(1.18,.035/t)))<p?.18:.08;p+=(a-p)*n,d.gain.setTargetAtTime(p,e.currentTime,.045),f=m(w)};return f=m(w),{output:h,nodes:[a,n,o,r,i,l,s,d,c,h],cleanup:()=>{f&&g(f)}}}(r,i),s=r.createPanner();s.panningModel="HRTF",s.distanceModel="inverse",s.refDistance=2,s.maxDistance=14,s.rolloffFactor=.35,l.output.connect(s).connect(this.voiceOutputNode(r)),this.audioNodes.set(e,{source:i,panner:s,nodes:l.nodes,cleanup:l.cleanup}),this.placeSpeaker(s,this.stageIndex(a)),r.resume().catch(()=>{}),t.play().catch(()=>{})}catch(e){}}stageIndex(e){let t=this.lastRoster.openMics.findIndex(t=>t.identity===e);if(t>=0)return t;let a=0;for(let t=0;t<e.length;t++)a=31*a+e.charCodeAt(t)|0;return Math.abs(a)%j.TM}placeSpeaker(e,t){let a=Math.max(1,Math.min(j.TM,this.lastRoster.openMics.length||4)),n=1===a?.5:t/Math.max(1,a-1),o=(n-.5)*3.8,r=-2.8+.3*Math.sin(n*Math.PI);if(e.positionX)e.positionX.value=o,e.positionY.value=1.45,e.positionZ.value=r;else{var i;null==(i=e.setPosition)||i.call(e,o,1.45,r)}}updateSpatialStage(){for(let[e,t]of this.audioNodes){let a=this.trackParticipants.get(e);a&&this.placeSpeaker(t.panner,this.stageIndex(a))}}voiceOutputNode(e){if(this.masterInput)return this.masterInput;let t=e.createGain();t.gain.value=1;let a=e.createDynamicsCompressor();a.threshold.value=-12,a.knee.value=8,a.ratio.value=3.2,a.attack.value=.006,a.release.value=.16;let n=e.createDynamicsCompressor();n.threshold.value=-3,n.knee.value=1.5,n.ratio.value=14,n.attack.value=.002,n.release.value=.06;let o=e.createGain();return o.gain.value=.96,t.connect(a).connect(n).connect(o).connect(e.destination),this.masterInput=t,this.masterNodes=[t,a,n,o],t}refreshSelf(){var e,t;let a=null==(e=this.room)?void 0:e.localParticipant;a&&(this.canPublish=!!(null==(t=a.permissions)?void 0:t.canPublish)),this.emitSelf()}emitSelf(){var e,t;null==(e=(t=this.opts).onSelf)||e.call(t,{role:this.role,canPublish:this.canPublish,handRaised:this.handRaised})}async tick(){if(!this.stopped)try{let e=await fetch("/api/xr/stage/".concat(encodeURIComponent(this.opts.stageId)),{cache:"no-store"});if(!e.ok)return;let t=await e.json();this.lastRoster=t,this.emitStage()}catch(e){}}emitStage(){var e,t;let a=this.room?this.room.remoteParticipants.size+1:0;this.updateSpatialStage(),null==(e=(t=this.opts).onStage)||e.call(t,{openMics:this.lastRoster.openMics,hands:this.lastRoster.hands,audience:a})}async post(e){try{let t=await fetch("/api/xr/stage/".concat(encodeURIComponent(this.opts.stageId),"/mic"),{method:"POST",headers:{"content-type":"application/json",...(0,d.l)()},body:JSON.stringify(e)});return{ok:(await t.json().catch(()=>({}))).ok,status:t.status}}catch(e){return null}}constructor(e){this.room=null,this.hostKey=null,this.role="audience",this.canPublish=!1,this.handRaised=!1,this.poll=null,this.stopped=!1,this.audioCtx=null,this.audioEls=new Map,this.masterInput=null,this.masterNodes=[],this.audioNodes=new Map,this.trackParticipants=new Map,this.endRealtimeAudioSurface=null,this.lastRoster={openMics:[],hands:[]},this.opts=e}}class R{start(){var e,t;this.stopped=!1,null==(e=(t=this.opts).onStatus)||e.call(t,"connecting"),this.tick()}stop(){this.stopped=!0,this.timer&&(clearTimeout(this.timer),this.timer=null)}async act(e,t){try{var a,n;let o=await fetch("/api/xr/world/".concat(encodeURIComponent(this.opts.slug),"/event"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({kind:e,count:null==t?void 0:t.count,itemId:null==t?void 0:t.itemId,characterId:null==t?void 0:t.characterId,idx:null==t?void 0:t.idx,completed:null==t?void 0:t.completed})});if(!o.ok)return null;let{event:r}=await o.json();return r&&(null==(a=(n=this.opts).onEvents)||a.call(n,[r])),null!=r?r:null}catch(e){return null}}async tick(){var e,t,a,n,o,r,i,l,s,d,c,h,u,f,p;if(!this.stopped&&!this.inFlight){this.inFlight=!0;try{let u=await fetch("/api/xr/world/".concat(encodeURIComponent(this.opts.slug),"?since=").concat(this.version,"&cid=").concat(encodeURIComponent(this.clientId)),{cache:"no-store"});if(404===u.status){null==(e=(t=this.opts).onStatus)||e.call(t,"gone");return}if(u.ok){let e=await u.json();null==(o=(r=this.opts).onStatus)||o.call(r,"live"),null==(i=(l=this.opts).onState)||i.call(l,e.state,{version:e.version,name:e.name,variant:e.variant}),e.events.length>0&&(null==(s=(d=this.opts).onEvents)||s.call(d,e.events)),"number"==typeof e.present&&(null==(c=(h=this.opts).onPresence)||c.call(h,e.present)),this.version=e.version}else null==(a=(n=this.opts).onStatus)||a.call(n,"error","Could not reach the world.")}catch(e){null==(u=(f=this.opts).onStatus)||u.call(f,"error","Could not reach the world.")}finally{this.inFlight=!1,this.stopped||(this.timer=setTimeout(()=>void this.tick(),null!=(p=this.opts.pollMs)?p:3e3))}}}constructor(e){this.version=0,this.timer=null,this.stopped=!1,this.inFlight=!1,this.clientId=function(){try{if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID()}catch(e){}return"c-".concat(Math.random().toString(36).slice(2),"-").concat(Date.now().toString(36))}(),this.opts=e}}function E(e){if(0===e.length)return[];if(e.some(e=>e.hall&&e.hall.trim())){let t=[],a=new Map;for(let n of e){let e=n.hall&&n.hall.trim()||"Gallery",o=a.get(e);o||(o=[],a.set(e,o),t.push(e)),o.push(n)}return t.map(e=>({name:e,items:a.get(e)}))}if(e.length<=12)return[{name:"Gallery",items:e}];let t=[];for(let a=0;a<e.length;a+=12)t.push({name:"Hall ".concat(t.length+1),items:e.slice(a,a+12)});return t}let Y="wonderland",N=["Down the Rabbit-Hole","Advice from a Caterpillar","Pig and Pepper","A Mad Tea-Party","The Queen's Croquet-Ground","The Lobster Quadrille","Who Stole the Tarts?"],D="Chapter I",z="Chapter II",F="Chapter III",W="Chapter V",H="Chapter VI",O="Chapter VII",q="Chapter VIII",G="Chapter IX",J="Chapter X",L="Chapter XI",B="Chapter XII",U=(e,t,a)=>a?{text:e,ref:t,audio:a}:{text:e,ref:t},V=[{id:"white-rabbit",kind:"white-rabbit",name:"The White Rabbit",hall:"Down the Rabbit-Hole",pos:[-2.9,3.5],face:1.9,lines:[U("Oh dear! Oh dear! I shall be too late!",D),U("Oh my ears and whiskers, how late it's getting!",D),U("Oh! the Duchess, the Duchess! Oh! won't she be savage if I've kept her waiting!",z)]}
1,{id:"alice",kind:"alice",name:"Alice",hall:"Down the Rabbit-Hole",pos:[2.7,2.3],face:"center",lines:[U("Curiouser and curiouser!",z),U("What a curious feeling! I must be shutting up like a telescope.",D),U("Who in the world am I? Ah, that's the great puzzle!",z),U("Well, I'll eat it, and if it makes me grow larger, I can reach the key; and if it makes me grow smaller, I can creep under the door; so either way I'll get into the garden, and I don't care which happens!",D)]},{id:"the-mouse",kind:"mouse",name:"The Mouse",hall:"Down the Rabbit-Hole",pos:[0,0],face:"center",lines:[U("Mine is a long and a sad tale!",F),U("Sit down, all of you, and listen to me! I'll soon make you dry enough!",F),U("You insult me by talking such nonsense!",F)]},{id:"the-dodo",kind:"dodo",name:"The Dodo",hall:"Down the Rabbit-Hole",pos:[-3.5,-2.3],face:"center",lines:[U("EVERYBODY has won, and all must have prizes.",F),U("We beg your acceptance of this elegant thimble.",F),U("Why, the best way to explain it is to do it.",F)]},{id:"the-caterpillar",kind:"caterpillar",name:"The Caterpillar",hall:"Advice from a Caterpillar",pos:[-2.3,-1.5],face:"center",lines:[U("Who are you?",W),U("Keep your temper.",W),U("One side will make you grow taller, and the other side will make you grow shorter.",W),U("It is a very good height indeed!",W),U("You'll get used to it in time.",W)]},{id:"the-pigeon",kind:"pigeon",name:"The Pigeon",hall:"Advice from a Caterpillar",pos:[3.3,-4.7],face:"center",lines:[U("Serpent!",W),U("I've tried the roots of trees, and I've tried banks, and I've tried hedges, but those serpents! There's no pleasing them!",W),U("You're a serpent; and there's no use denying it. I suppose you'll be telling me next that you never tasted an egg!",W)]},{id:"the-frog-footman",kind:"frog-footman",name:"The Frog-Footman",hall:"Pig and Pepper",pos:[-1.4,-5.3],face:.4,lines:[U("There's no sort of use in knocking, and that for two reasons. First, because I'm on the same side of the door as you are; secondly, because they're making such a noise inside, no one could possibly hear you.",H),U("I shall sit here, on and off, for days and days.",H),U("Anything you like.",H)]},{id:"the-duchess",kind:"duchess",name:"The Duchess",hall:"Pig and Pepper",pos:[-3.3,-4.5],face:"center",lines:[U("It's a Cheshire cat, and that's why. Pig!",H),U("If everybody minded their own business, the world would go round a deal faster than it does.",H),U("Speak roughly to your little boy, And beat him when he sneezes: He only does it to annoy, Because he knows it teases.",H),U("Tut, tut, child! Everything's got a moral, if only you can find it.",G),U("Take care of the sense, and the sounds will take care of themselves.",G)]},{id:"the-cook",kind:"cook",name:"The Cook",hall:"Pig and Pepper",pos:[-2.2,-6.6],face:"center",lines:[U("Shan't.",L),U("Pepper, mostly.",L)]},{id:"the-cheshire-cat",kind:"cheshire-cat",name:"The Cheshire Cat",hall:"Pig and Pepper",pos:[3.9,-3],face:"center",lines:[U("We're all mad here. I'm mad. You're mad.",H),U("You must be, or you wouldn't have come here.",H),U("That depends a good deal on where you want to get to.",H),U("Oh, you're sure to do that, if you only walk long enough.",H),U("Did you say pig, or fig?",H),U("You'll see me there.",H)]},{id:"the-hatter",kind:"hatter",name:"The Hatter",hall:"A Mad Tea-Party",pos:[.6,4.4],face:"center",lines:[U("Why is a raven like a writing-desk?",O),U("Yes, that's it: it's always tea-time, and we've no time to wash the things between whiles.",O),U("I want a clean cup: let's all move one place on.",O),U("Twinkle, twinkle, little bat! How I wonder what you're at! Up above the world you fly, Like a teatray in the sky.",O),U("Two days wrong! I told you butter wouldn't suit the works!",O),U("If you knew Time as well as I do, you wouldn't talk about wasting it. It's him.",O)]},{id:"the-march-hare",kind:"march-hare",name:"The March Hare",hall:"A Mad Tea-Party",pos:[-1.6,4.4],face:"center",lines:[U("Have some wine.",O),U("It was the best butter.",O),U("Take some more tea.",O),U("You might just as well say that 'I like what I get' is the same thing as 'I get what I like'!",O)]},{id:"the-dormouse",kind:"dormouse",name:"The Dormouse",hall:"A Mad Tea-Party",pos:[-.5,4.15],face:"center",lines:[U("Once upon a time there were three little sisters, and their names were Elsie, Lacie, and Tillie; and they lived at the bottom of a well——",O),U("It was a treacle-well.",O),U("Twinkle, twinkle, twinkle, twinkle——",O),U("You've no right to grow here.",L)]},{id:"two-of-spades",kind:"card-gardener",name:"Two",variant:"2",hall:"The Queen's Croquet-Ground",pos:[-4.4,-2.6],face:"center",lines:[U("Why, the fact is, you see, Miss, this here ought to have been a red rose-tree, and we put a white one in by mistake; and if the Queen was to find it out, we should all have our heads cut off, you know.",q),U("May it please your Majesty, we were trying—",q)]},{id:"five-of-spades",kind:"card-gardener",name:"Five",variant:"5",hall:"The Queen's Croquet-Ground",pos:[-3,-3.9],face:"center",lines:[U("I couldn't help it. Seven jogged my elbow.",q),U("I heard the Queen say only yesterday you deserved to be beheaded!",q)]},{id:"seven-of-spades",kind:"card-gardener",name:"Seven",variant:"7",hall:"The Queen's Croquet-Ground",pos:[-4,-4.6],face:.5,lines:[U("That's right, Five! Always lay the blame on others!",q),U("Well, of all the unjust things—",q)]},{id:"the-queen-of-hearts",kind:"queen-of-hearts",name:"The Queen of Hearts",hall:"The Queen's Croquet-Ground",pos:[2.9,-4.4],face:"center",lines:[U("Off with her head!",q),U("Who is this?",q),U("Can you play croquet?",q),U("Are their heads off?",q),U("Now, I give you fair warning, either you or your head must be off, and that in about half no time! Take your choice!",G)]},{id:"the-king-of-hearts",kind:"king-of-hearts",name:"The King of Hearts",hall:"The Queen's Croquet-Ground",pos:[4.1,-3.6],face:"center",lines:[U("Consider, my dear: she is only a child!",q),U("My dear! I wish you would have this cat removed!",q),U("You are all pardoned.",G)]},{id:"the-gryphon",kind:"gryphon",name:"The Gryphon",hall:"The Lobster Quadrille",pos:[2.6,-.8],face:"center",lines:[U("It's all her fancy, that: they never executes nobody, you know. Come on!",G),U("They're called lessons, because they lessen from day to day.",G),U("Will you, won't you, will you, won't you, will you join the dance?",J),U("It does the boots and shoes.",J),U("Hjckrrh!",G)]},{id:"the-mock-turtle",kind:"mock-turtle",name:"The Mock Turtle",hall:"The Lobster Quadrille",pos:[4.3,-2.4],face:"center",lines:[U("Once, I was a real Turtle.",G),U("We called him Tortoise, because he taught us.",G),U("Reeling and Writhing, of course, to begin with, and then the different branches of Arithmetic—Ambition, Distraction, Uglification, and Derision.",G),U("'Will you walk a little faster?' said a whiting to a snail, 'There's a porpoise close behind us, and he's treading on my tail.'",J),U("Beautiful Soup, so rich and green, Waiting in a hot tureen! Who for such dainties would not stoop? Soup of the evening, beautiful Soup!",J)]},{id:"the-white-rabbit-herald",kind:"white-rabbit",name:"The White Rabbit",variant:"herald",hall:"Who Stole the Tarts?",pos:[-2.6,-5.1],face:"center",lines:[U("Silence in the court!",L,"/xr/voice/wonderland/the-white-rabbit-herald/silence-in-the-court.m4a"),U("The Queen of Hearts, she made some tarts, All on a summer day: The Knave of Hearts, he stole those tarts, And took them quite away!",L,"/xr/voice/wonderland/the-white-rabbit-herald/the-queen-of-hearts-she-made-some-tarts.m4a"),U("Alice!",L,"/xr/voice/wonderland/the-white-rabbit-herald/alice.m4a"),U("Unimportant, your Majesty means, of course.",B,"/xr/voice/wonderland/the-white-rabbit-herald/unimportant-your-majesty-means.m4a")]},{id:"the-king-in-court",kind:"king-of-hearts",name:"The King of Hearts",variant:"judge",hall:"Who Stole the Tarts?",pos:[-.75,-6.6],face:"center",lines:[U("Rule Forty-two. All persons more than a mile high to leave the court.",B,"/xr/voice/wonderland/the-king-in-court/rule-forty-two.m4a"),U("Begin at the beginning, and go on till you come to the end: then stop.",B,"/xr/voice/wonderland/the-king-in-court/begin-at-the-beginning.m4a"),U("Consider your verdict.",L,"/xr/voice/wonderland/the-king-in-court/consider-your-verdict.m4a"),U("It's a pun!",B,"/xr/voice/wonderland/the-king-in-court/its-a-pun.m4a")]},{id:"the-queen-in-court",kind:"queen-of-hearts",name:"The Queen of Hearts",variant:"bench",hall:"Who Stole the Tarts?",pos:[.75,-6.6],face:"center",lines:[U("Sentence first—verdict afterwards.",B,"/xr/voice/wonderland/the-queen-in-court/sentence-first-verdict-afterwards.m4a"),U("Off with her head!",B,"/xr/voice/wonderland/the-queen-in-court/off-with-her-head.m4a"),U("Collar that Dormouse! Behead that Dormouse! Turn that Dormouse out of court! Suppress him! Pinch him! Off with his whiskers!",L,"/xr/voice/wonderland/the-queen-in-court/collar-that-dormouse.m4a")]},{id:"the-knave-of-hearts",kind:"knave-of-hearts",name:"The Knave of Hearts",hall:"Who Stole the Tarts?",pos:[0,-3.6],face:"center",lines:[U("Please your Majesty, I didn't write it, and they can't prove I did: there's no name signed at the end.",B,"/xr/voice/wonderland/the-knave-of-hearts/please-your-majesty.m4a"),U("Do I look like it?",B,"/xr/voice/wonderland/the-knave-of-hearts/do-i-look-like-it.m4a")]},{id:"the-hatter-in-court",kind:"hatter",name:"The Hatter",variant:"witness",hall:"Who Stole the Tarts?",pos:[3.1,-4.4],face:"center",lines:[U("I'm a poor man, your Majesty.",L,"/xr/voice/wonderland/the-hatter-in-court/im-a-p
1oor-man.m4a"),U("It isn't mine. I keep them to sell. I've none of my own. I'm a hatter.",L,"/xr/voice/wonderland/the-hatter-in-court/it-isnt-mine.m4a"),U("Fourteenth of March, I think it was.",L,"/xr/voice/wonderland/the-hatter-in-court/fourteenth-of-march.m4a"),U("I'd rather finish my tea.",L,"/xr/voice/wonderland/the-hatter-in-court/id-rather-finish-my-tea.m4a")]}],$=[{hall:"Who Stole the Tarts?",title:"The trial of the Knave of Hearts",cues:[{characterId:"the-white-rabbit-herald",line:0},{characterId:"the-white-rabbit-herald",line:1},{characterId:"the-king-in-court",line:2},{characterId:"the-hatter-in-court",line:0},{characterId:"the-hatter-in-court",line:2},{characterId:"the-hatter-in-court",line:1},{characterId:"the-hatter-in-court",line:3},{characterId:"the-queen-in-court",line:2},{characterId:"the-white-rabbit-herald",line:2},{characterId:"the-king-in-court",line:0},{characterId:"the-white-rabbit-herald",line:3},{characterId:"the-knave-of-hearts",line:0},{characterId:"the-knave-of-hearts",line:1},{characterId:"the-king-in-court",line:3},{characterId:"the-queen-in-court",line:0},{characterId:"the-queen-in-court",line:1}]}];function K(e){var t;return null!=(t=$.find(t=>t.hall===e))?t:null}function Q(e,t,a,n){let o=document.createElement("canvas");return o.width=t,o.height=a,n(o.getContext("2d"),t,a),e.tex(new r.GOR(o))}let X={cream:"#fffbf7",ink:"#0c3b46",parchment:"#f4ead2",wood:"#7a5230",woodDark:"#5e3f24",brass:"#caa247"};function Z(e,t,a){let n=t.split(" "),o=[],r="";for(let t of n){let n=r?"".concat(r," ").concat(t):t;e.measureText(n).width>a&&r?(o.push(r),r=t):r=n}return r&&o.push(r),o}function ee(e,t,a,n){e.beginPath(),e.moveTo(t,a+.85*n),e.bezierCurveTo(t-1.05*n,a+.05*n,t-.6*n,a-.75*n,t,a-.25*n),e.bezierCurveTo(t+.6*n,a-.75*n,t+1.05*n,a+.05*n,t,a+.85*n),e.closePath(),e.fill()}let et={1:[[.5,.5]],2:[[.5,.24],[.5,.76]],5:[[.3,.24],[.7,.24],[.5,.5],[.3,.76],[.7,.76]],7:[[.3,.22],[.7,.22],[.5,.36],[.3,.52],[.7,.52],[.3,.78],[.7,.78]]};function ea(e,t,a,n,o){"spade"===t?(e.beginPath(),e.moveTo(a,n-o),e.bezierCurveTo(a+.95*o,n-.1*o,a+.62*o,n+.55*o,a+.08*o,n+.18*o),e.bezierCurveTo(a+.16*o,n+.62*o,a+.3*o,n+.78*o,a+.34*o,n+.86*o),e.lineTo(a-.34*o,n+.86*o),e.bezierCurveTo(a-.3*o,n+.78*o,a-.16*o,n+.62*o,a-.08*o,n+.18*o),e.bezierCurveTo(a-.62*o,n+.55*o,a-.95*o,n-.1*o,a,n-o),e.closePath(),e.fill()):"heart"===t?ee(e,a,n,o):(e.beginPath(),e.arc(a,n-.45*o,.42*o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(a-.42*o,n+.12*o,.42*o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(a+.42*o,n+.12*o,.42*o,0,2*Math.PI),e.fill(),e.beginPath(),e.moveTo(a+.3*o,n+.9*o),e.lineTo(a-.3*o,n+.9*o),e.lineTo(a-.06*o,n+.3*o),e.lineTo(a+.06*o,n+.3*o),e.closePath(),e.fill())}function en(e,t,a){return Q(e,256,384,(e,n,o)=>{var r;for(let[i,l]of(e.fillStyle="#f8f4ea",e.fillRect(0,0,n,o),e.strokeStyle="#2a2a30",e.lineWidth=6,e.strokeRect(5,5,n-10,o-10),e.fillStyle="heart"===t?"#c0392b":"#23232a",null!=(r=et[a])?r:et[1]))ea(e,t,i*n,l*o,1===a?64:30);e.font="700 40px Georgia, serif",e.textAlign="center",e.textBaseline="middle",e.fillText(String(a),28,36),ea(e,t,28,78,14),e.save(),e.translate(n-28,o-36),e.rotate(Math.PI),e.fillText(String(a),0,0),ea(e,t,0,42,14),e.restore()})}function eo(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,o=Q(e,128,128,(e,o,r)=>{let i=o/n;for(let o=0;o<n;o++)for(let r=0;r<n;r++)e.fillStyle=(r+o)%2?t:a,e.fillRect(r*i,o*i,i,i)});return o.wrapS=o.wrapT=r.GJx,o.repeat.set(3,2),o}function er(e,t,a){let n=Q(e,128,128,(e,n,o)=>{e.fillStyle=t,e.fillRect(0,0,n,o),e.fillStyle=a;for(let t=0;t<4;t++)for(let a=0;a<4;a++)ee(e,32*a+(t%2?16:32)-8,32*t+16,9)});return n.wrapS=n.wrapT=r.GJx,n.repeat.set(2,2),n}function ei(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=Q(e,128,128,(e,o,r)=>{e.fillStyle=t,e.fillRect(0,0,o,r),e.fillStyle=a;for(let t=0;t<8;t+=2)n?e.fillRect(0,16*t,o,16):e.fillRect(16*t,0,16,r)});return o.wrapS=o.wrapT=r.GJx,o}function el(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:44;return Q(e,256,128,(e,n,o)=>{e.fillStyle="#fdf8ec",e.fillRect(0,0,n,o),e.strokeStyle="rgba(40,32,14,0.45)",e.lineWidth=3,e.strokeRect(2,2,n-4,o-4),e.fillStyle="rgba(40,32,14,0.95)",e.textAlign="center",e.textBaseline="middle",e.font="700 ".concat(a,"px Georgia, serif");let r=a+8,i=o/2-(t.length-1)*r/2;t.forEach((t,a)=>e.fillText(t,n/2,i+a*r,n-24))})}function es(e,t,a){return new r.eaF(e.geo(t),a)}function ed(e,t,a,n,o,i){let l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1,c=es(e,new r.Gu$(a,18,14),t);return c.position.set(n,o,i),c.scale.set(l,s,d),c}function ec(e,t,a,n,o,i,l,s){let d=es(e,new r.Ho_(a,n,o,16),t);return d.position.set(i,l,s),d}function eh(e,t,a,n,o,i,l,s){let d=es(e,new r.iNn(a,n,o),t);return d.position.set(i,l,s),d}function eu(e,t,a,n,o,i,l){let s=es(e,new r.qFE(a,n,14),t);return s.position.set(o,i,l),s}function ef(e,t,a,n){let o=new r.B6O(a);return es(e,new r.j6(o,24,n,8,!1),t)}function ep(e,t){var a,n;let o=new r.YJl,i=null!=(a=t.headR)?a:.16*t.h,l=t.skirt?.18*t.h:.34*t.h,s=t.h-l-2.1*i;if(t.skirt){let a=[];for(let e=0;e<=6;e++){let n=e/6;
1a.push(new r.I9Y(.06+.21*t.h*Math.pow(n,1.4),(1-n)*(l+.62*s)))}let i=es(e,new r.nzx(a,20),null!=(n=t.skirtMat)?n:t.torso);o.add(i)}else for(let a of[-1,1]){let n=ec(e,t.legs,.045*t.h,.05*t.h,l,a*t.h*.07,l/2,0);o.add(n);let r=eh(e,t.legs,.085*t.h,.035*t.h,.13*t.h,a*t.h*.07,.0175*t.h,.03*t.h);o.add(r)}let d=ec(e,t.torso,.115*t.h,.135*t.h,s,0,l+s/2,0);o.add(d);let c=l+.86*s,h=[];for(let a of[-1,1]){let n=new r.YJl;n.position.set(a*t.h*.13,c,0);let i=ec(e,t.torso,.032*t.h,.028*t.h,.3*t.h,0,-(.15*t.h),0);n.add(i);let l=ed(e,t.skin,.038*t.h,0,-(.31*t.h),0);n.add(l),o.add(n),h.push(n)}let u=new r.YJl;return u.position.y=l+s+.95*i,u.add(ed(e,t.skin,i,0,0,0)),o.add(u),{group:o,head:u,arms:h,headR:i,headTopY:l+s+1.9*i,shoulderY:c,legH:l,torsoH:s}}function em(e,t,a,n){let o=new r.YJl,i=e.std("#e8c8a8"),{slab:l,w:s,h:d}=function(e,t,a){let n=e.flat("#f8f4ea",{map:en(e,t,a)}),o=e.flat("#a23b3b",{map:Q(e,256,384,(e,t,a)=>{e.fillStyle="#a23b3b",e.fillRect(0,0,t,a),e.strokeStyle="#f8f4ea",e.lineWidth=5,e.strokeRect(8,8,t-16,a-16),e.strokeStyle="rgba(248,244,234,0.55)",e.lineWidth=2;for(let n=-a;n<t+a;n+=18)e.beginPath(),e.moveTo(n,0),e.lineTo(n+a,a),e.stroke(),e.beginPath(),e.moveTo(n+a,0),e.lineTo(n,a),e.stroke()})}),i=e.std("#e8e4d6");return{slab:new r.eaF(e.geo(new r.iNn(.66,.98,.05)),[i,i,i,i,n,o]),w:.66,h:.98}}(e,t,a),c=.34+d/2;l.position.y=c,o.add(l);let h=[];for(let t of[-1,1]){let a=ec(e,e.std("#d8d0bd"),.035,.04,.34,t*(s/2-.06),.17,0);o.add(a),o.add(eh(e,e.std("#5a4a3a"),.09,.04,.16,t*(s/2-.06),.02,.04));let n=new r.YJl;n.position.set(s/2*t,c+d/2-.1,0);let l=ec(e,e.std("#d8d0bd"),.028,.026,.3,.05*t,-.14,0);l.rotation.z=.35*t,n.add(l),n.add(ed(e,i,.04,.11*t,-.28,0)),o.add(n),h.push(n)}let u=c+d/2+.13,f=new r.YJl;for(let t of(f.position.y=u,f.add(ed(e,i,.12,0,0,0)),[-1,1]))f.add(ed(e,e.std("#2a2a30"),.016,.045*t,.015,.1));if("flat"===n.cap)f.add(ec(e,e.std("#7d6b48"),.13,.13,.035,0,.1,0)),f.add(ed(e,e.std("#7d6b48"),.04,0,.13,0));else if("soldier"===n.cap)f.add(ec(e,e.std("#2a2a30"),.1,.12,.16,0,.13,0));else if("knave"===n.cap){f.add(ec(e,e.std("#c0392b"),.12,.13,.07,0,.1,0));let t=eu(e,e.std("#f4efe2"),.02,.22,.1,.2,0);t.rotation.z=-.5,f.add(t)}if(o.add(f),n.halberd){let t=ec(e,e.std(X.woodDark),.016,.016,1.9,s/2+.14,.95,.05);o.add(t);let a=eu(e,e.std("#9aa3ad",{metalness:.7,roughness:.3}),.06,.22,s/2+.14,1.95,.05);o.add(a)}if(n.chains){let t=e.std("#6b6f78",{metalness:.6,roughness:.45});for(let a=0;a<7;a++){let n=a/6,i=r.cj9.lerp(-(s/2+.1),s/2+.1,n),l=c+d/2-.38-.16*Math.sin(n*Math.PI),h=es(e,new r.O3Y(.026,.008,6,10),t);h.position.set(i,l,.1),h.rotation.y=a%2*Math.PI/2,o.add(h)}for(let e of h)e.rotation.z=0}if(n.brush){let t=new r.YJl;t.add(ec(e,e.std(X.wood),.012,.012,.3,0,0,0)),t.add(ec(e,e.std("#c0392b"),.03,.024,.07,0,.18,0)),t.position.set(.11,-.28,.05),h[1].add(t)}if(n.pot){let t=new r.YJl;t.add(ec(e,e.std("#8a744a"),.08,.06,.14,0,0,0)),t.add(ec(e,e.std("#c0392b"),.07,.07,.02,0,.08,0)),t.position.set(-.11,-.3,.05),h[0].add(t)}let p=Math.random()*Math.PI*2;return{group:o,headY:u+.42,animate:n.brush?(e,t)=>{p+=2*t,h[1].rotation.x=-.9+.35*Math.sin(p)}:void 0}}function eg(e){let t=new r.YJl,a=e.flat("#f8f4ea",{map:en(e,"club",5),side:r.$EB}),n=es(e,new r.Ho_(.42,.42,.62,16,1,!0,0,Math.PI),a);n.rotation.z=Math.PI/2,n.rotation.y=Math.PI/2,n.position.y=.42,t.add(n);let o=e.std("#e8c8a8");for(let a of(t.add(ed(e,o,.09,.36,.18,0)),[-1,1]))t.add(ed(e,o,.035,.4,.02,.2*a)),t.add(eh(e,e.std("#5a4a3a"),.07,.04,.12,-.4,.02,.2*a));return t}function ew(e,t){let a=new r.YJl,n=e.std("#7d6248");if(t){let t=ed(e,n,.13,0,.13,0);a.add(t);for(let t=0;t<22;t++){let n=t/22*Math.PI*2,o=7*t%11/11*Math.PI-Math.PI/2,r=eu(e,e.std("#5a4a3a"),.014,.07,Math.cos(n)*Math.cos(o)*.13,.13+.13*Math.sin(o),Math.sin(n)*Math.cos(o)*.13);r.lookAt(3*r.position.x,.13+(r.position.y-.13)*3,3*r.position.z),r.rotateX(Math.PI/2),a.add(r)}return{group:a,headY:.45}}a.add(ed(e,n,.12,0,.12,0,1.5,.9,1));for(let t=0;t<14;t++){let n=eu(e,e.std("#5a4a3a"),.013,.06,-.12+t%7*.04,.2+.012*Math.sin(t),(t<7?-1:1)*.05);n.rotation.x=(t<7?-1:1)*.4,a.add(n)}let o=ed(e,e.std("#a08a6e"),.06,.2,.1,0,1.3,.9,.9);for(let t of(a.add(o),a.add(eu(e,e.std("#3a2e22"),.014,.04,.3,.08,0)),[-1,1]))a.add(ed(e,e.std("#2a2a30"),.009,.26,.12,.025*t)),a.add(ec(e,e.std("#a08a6e"),.012,.012,.06,.1,.03,.07*t)),a.add(ec(e,e.std("#a08a6e"),.012,.012,.06,-.08,.03,.07*t));let i=Math.random()*Math.PI*2;return{group:a,headY:.4,animate:(e,t)=>
1{i+=.16*t,a.position.x=.9*Math.cos(i),a.position.z=.9*Math.sin(i)+3.6,a.rotation.y=-i}}}let eb={"the-cheshire-cat":2.42,"the-dormouse":.98,"the-mouse":.62},ey={"Down the Rabbit-Hole":{angles:[-55,-20,15,50,140,215],r:6.9},"Advice from a Caterpillar":{angles:[-40,5,50,95],r:6.7},"Pig and Pepper":{angles:[-15,25,65,110,155],r:6.8},"A Mad Tea-Party":{angles:[-130,-90,-50,-10,170,210],r:6.8},"The Queen's Croquet-Ground":{angles:[25,60,95,130,165,200],r:6.9},"The Lobster Quadrille":{angles:[95,130,165,200,235],r:6.8},"Who Stole the Tarts?":{angles:[-65,-25,15,55,90,125,160],r:6.7}};function ex(e,t,a,n,o,i){let l=new r.YJl;l.add(ec(e,e.std("#6b4a2b"),.75*o,o,n,0,n/2,0));for(let t=0;t<4;t++){let a=t/4*Math.PI*2,n=eu(e,e.std("#6b4a2b"),.5*o,1.6*o,Math.cos(a)*o*.9,.5*o,Math.sin(a)*o*.9);n.rotation.x=Math.PI,l.add(n)}let s=e.std(i,{roughness:.95});return l.add(ed(e,s,.42*n,0,n+.18*n,0,1.15,.9,1.1)),l.add(ed(e,s,.3*n,.22*n,n+.05*n,.12*n)),l.add(ed(e,s,.26*n,-(.24*n),n+.02*n,-(.08*n))),l.position.set(t,0,a),l}let ev={"Down the Rabbit-Hole":function(e){let t=new r.YJl,a=es(e,new r.tcD(8.45,48),e.std("#cdc2a8",{roughness:.95}));a.rotation.x=-Math.PI/2,a.position.y=.013,t.add(a);let n=es(e,new r.rKP(1.75,3.1,48),e.flat("#3c2e18",{transparent:!0,map:Q(e,1024,1024,(e,t)=>{let a=t/2;e.translate(a,a),e.fillStyle="rgba(60,46,24,0.78)",e.font="italic 600 26px Georgia, serif",e.textAlign="center",e.textBaseline="middle";let n=-Math.PI/2,o=240;for(let t of"\"Fury said to a mouse, That he met in the house, ‘Let us both go to law: I will prosecute you.—Come, I'll take no denial; We must have a trial: For really this morning I've nothing to do.’ Said the mouse to the cur, ‘Such a trial, dear sir, With no jury or judge, would be wasting our breath.’ ‘I’ll be judge, I’ll be jury,’ Said cunning old Fury; ‘I’ll try the whole cause, and condemn you to death.’\""){let a=30/o;e.save(),e.rotate(n),e.translate(0,-o),e.fillText(t,0,0),e.restore(),n+=a,o+=.55}}),depthWrite:!1}));n.rotation.x=-Math.PI/2,n.position.y=.02,n.renderOrder=2,t.add(n);let o=e.std("#cab98f",{side:r.hsX,roughness:.92}),i=es(e,new r.Ho_(8.5,8.5,3.55,48,1,!0),o);i.position.y=1.775,t.add(i);let l=es(e,new r.rKP(2.2,8.5,48),e.std("#b3a47e",{side:r.$EB}));l.rotation.x=Math.PI/2,l.position.y=3.55,t.add(l);let s=es(e,new r.Ho_(2.2,2.2,10.5,24,1,!0),e.std("#5a4732",{side:r.hsX}));s.position.y=8.8,t.add(s);let d=es(e,new r.tcD(2.2,24),e.flat("#14100c"));d.rotation.x=Math.PI/2,d.position.y=14,t.add(d);for(let a=0;a<6;a++){let n=a/6*Math.PI*2+.4,o=4.6+1.5*a,i=eh(e,e.std(X.wood),1,.06,.4,1.9*Math.cos(n),o,1.9*Math.sin(n));if(i.lookAt(0,o,0),t.add(i),2===a){let a=ec(e,e.std("#d8923a",{transparent:!0,opacity:.9}),.13,.13,.3,1.78*Math.cos(n),o+.18,1.78*Math.sin(n));t.add(a);let i=es(e,new r.bdM(.22,.12),e.flat("#fdf8ec",{map:el(e,["ORANGE","MARMALADE"],30)}));i.position.set(1.63*Math.cos(n),o+.18,1.63*Math.sin(n)),i.lookAt(0,o+.18,0),t.add(i)}else if(a%2==0){let i=es(e,new r.bdM(.5,.4),e.flat("#e8dcc0",{map:el(e,0===a?["A MAP"]:["A PICTURE"],34)}));i.position.set(2.12*Math.cos(n+.5),o+.8,2.12*Math.sin(n+.5)),i.lookAt(0,o+.8,0),t.add(i)}else{let a=eh(e,e.std("#6b4a2b"),.7,.9,.3,1.95*Math.cos(n+.4),o+.5,1.95*Math.sin(n+.4));a.lookAt(0,o+.5,0),t.add(a)}}let c=new r.HiM(0xffe9c4,.35,9,1.6);c.position.set(0,6.4,0),t.add(c);let h=e.std("#6b4a2b"),u=e.std("#52371d");for(let a=0;a<11;a++){let n=33*a+8;if(n>80&&n<125)continue;let o=n*Math.PI/180,i=8.32*Math.cos(o),l=8.32*Math.sin(o),s=new r.YJl;s.add(eh(e,u,1.18,2.42,.08,0,1.21,0)),s.add(eh(e,h,1,2.26,.1,0,1.18,0)),s.add(eh(e,u,.72,.84,.115,0,1.62,0)),s.add(eh(e,u,.72,.7,.115,0,.62,0)),s.add(ed(e,e.std(X.brass,{metalness:.8,roughness:.3}),.045,.38,1.12,.08)),s.position.set(i,0,l),s.lookAt(0,0,.001*(0===l)),t.add(s)}for(let a=0;a<6;a++){let n=a/6*Math.PI*2+.26,o=4.6*Math.cos(n),i=4.6*Math.sin(n);t.add(ec(e,e.std("#3a2e22"),.012,.012,.5,o,3.3,i));let l=ed(e,e.mat(new r._4j({color:"#ffd9a0",emissive:"#ffb85c",emissiveIntensity:.9,roughness:.4})),.13,o,3,i);t.add(l);let s=es(e,new r.O3Y(.14,.012,6,14),e.std("#3a2e22"));s.position.set(o,3,i),t.add(s)}let f=new r.HiM(0xffe2b0,.55,17,1.5);f.position.set(0,3,0),t.add(f);let p=e.mat(new r._4j({color:"#cfe3e8",transparent:!0,opacity:.3,roughness:.15,metalness:.05})),m=es(e,new r.Ho_(.42,.42,.03,24),p);m.position.set(1.8,.78,2.6),t.add(m);for(let a=0;a<3;a++){let n=a/3*Math.PI*2;t.add(ec(e,p,.035,.045,.78,1.8+.27*Math.cos(n),.39,2.6+.27*Math.sin(n)))}let g=e.std(X.brass,{metalness:.85,roughness:.25}),w=es(e,new r.O3Y(.035,.011,8,14),g);w.rotation.x=Math.PI/2,w.position.set(1.68,.805,2.52),t.add(w);let b=eh(e,g,.13,.012,.012,1.78,.805,2.58);b.rotation.y=.5,t.add(b),t.add(eh(e,g,.012,.012,.035,1.84,.805,2.615));let y=new r.YJl;y.add(ec(e,e.mat(new r._4j({color:"#9fc7b4",transparent:!0,opacity:.55,roughness:.2})),.05,.06,.16,0,.08,0)),y.add(ec(e,e.mat(new r._4j({color:"#9fc7b4",transparent:!0,opacity:.55,roughness:.2})),.018,.022,.07,0,.19,0)),y.add(ec(e,e.std("#8a744a"),.02,.02,.03,0,.24,0));let x=es(e,new r.bdM(.12,.07),e.flat("#fdf8ec",{map:el(e,["DRINK ME"],40),side:r.$EB}));x.position.set(.07,.1,.05),x.rotation.set(-.3,.5,.1),y.add(x),y.position.set(1.95,.795,2.72),y.userData.scaleAction="shrink",t.add(y);let v=new r.YJl;v.add(eh(e,e.mat(new r._4j({color:"#dfe8ea",transparent:!0,opacity:.4,roughness:.2})),.2,.1,.2,0,.05,0));let M=ec(e,e.std("#e8d0a0"),.07,.08,.05,0,.05,0);v.add(M);for(let t=0;t<6;t++)v.add(ed(e,e.std("#5a4030"),.008,.04*Math.cos(1.6*t),.078,.04*Math.sin(1.6*t)));let k=es(e,new r.bdM(.1,.05),e.flat("#fdf8ec",{map:el(e,["EAT ME"],44),side:r.$EB}));k.position.set(0,.085,.07),k.rotation.x=-.6,v.add(k),v.position.set(1.55,.013,2.85),v.userData.scaleAction="grow",t.add(v);let S=102*Math.PI/180,I=new r.YJl;I.position.set(8.3*Math.cos(S),0,8.3*Math.sin(S)),I.lookAt(0,0,0),I.add(ec(e,e.std(X.woodDark),.02,.02,1.7,0,1.5,0)).rotation.z=Math.PI/2;let P=ei(e,"#9a3b3b","#7d2a33");for(let t=0;t<4;t++){let a=ec(e,e.std("#9a3b3b",{map:P}),.09,.11,1.42,-.62-.13*t,.74,.04+t%2*.03);I.add(a)}let T=new r.YJl;T.add(eh(e,u,.5,.45,.05,0,.21,0)),T.add(eh(e,h,.4,.38,.06,0,.2,0)),T.add(ed(e,g,.02,.15,.19,.045)),I.add(T);let C=new r.YJl;C.position.set(0,0,-.4),C.add(eh(e,e.std("#8fb277",{emissive:"#5e8a4a",emissiveIntensity:.4}),.6,.5,.5,0,.25,0));for(let t=0;t<3;t++)C.add(ed(e,e.std(t%2?"#d96a6a":"#f4efe2",{emissive:t%2?"#a23b3b":"#caa247",emissiveIntensity:.35}),.05,-.18+.18*t,.42,.1)),C.add(ec(e,e.std("#4f6b3a"),.012,.012,.3,-.18+.18*t,.25,.1));let j=ec(e,e.std("#e8e4d6"),.05,.08,.18,0,.18,-.12);C.add(j),C.add(ed(e,e.std("#bcd9e8",{emissive:"#7fa9c0",emissiveIntensity:.5}),.04,0,.32,-.12));let _=new r.HiM(0xd8ffb0,.5,2.4,2);_.position.set(0,.35,-.3),C.add(_),I.add(C),t.add(I);for(let a=0;a<8;a++){let n=.8*a;t.add(ec(e,e.std(a%2?"#e8b7b0":"#e8d18a"),.025,.025,.012,-3.1+.5*Math.cos(n),.02,-2+.6*Math.sin(n)))}return{group:t,anims:[],scaleProps:[y,v]}},"Advice from a Caterpillar":function(e){let t=new r.YJl,a=es(e,new r.tcD(8.45,48),e.std("#6f8a4e",{roughness:1}));a.rotation.x=-Math.PI/2,a.position.y=.013,t.add(a);let n=[e.std("#5e8a4a"),e.std("#6f9a55"),e.std("#4f7b3f")];for(let a=0;a<30;a++){let o=a/30*Math.PI*2+13*a%7*.1,r=4.2+29*a%17/17*3.6,i=2.3+7*a%10/10*1.5,l=eu(e,n[a%3],.1,i,Math.cos(o)*r,i/2,Math.sin(o)*r);l.rotation.z=.16*Math.sin(3*o),l.rotation.x=.14*Math.cos(2*o),l.scale.z
1=.3,t.add(l)}for(let[a,n,o]of[[-4.6,1.8,3.4],[2.2,4.6,3.8],[5,-1.4,3.1]]){let i=ef(e,e.std("#4f7b3f"),[new r.Pq0(a,0,n),new r.Pq0(a+.2,.6*o,n),new r.Pq0(a+.6,o,n+.2),new r.Pq0(a+1,.92*o,n+.35)],.06);t.add(i);let l=es(e,new r.qFE(.42,.6,12,1,!0),e.std("#9a8cc0",{side:r.$EB}));l.position.set(a+1.05,.88*o,n+.37),l.rotation.x=.25,t.add(l)}for(let[a,n]of[[3.8,2.8],[-2.6,-4.9]]){let o=ec(e,e.std("#5e8a4a"),.05,.07,2.7,a,1.35,n);t.add(o);let r=ed(e,e.std("#e8b73a"),.3,a,2.75,n,1,.5,1);t.add(r);for(let o=0;o<10;o++){let r=o/10*Math.PI*2,i=ed(e,e.std("#f4efe2"),.24,a+.5*Math.cos(r),2.72,n+.5*Math.sin(r),1.6,.25,.7);i.rotation.y=-r,t.add(i)}}return{group:t,anims:[]}},"Pig and Pepper":function(e){let t=new r.YJl,a=[],n=es(e,new r.tcD(8.45,48),e.std("#8a7a5a",{roughness:1}));n.rotation.x=-Math.PI/2,n.position.y=.013,t.add(n);let o=new r.YJl,i=Q(e,128,128,(e,t,a)=>{e.fillStyle="#9a8d80",e.fillRect(0,0,t,a),e.strokeStyle="#7a6f64",e.lineWidth=3;for(let t=0;t<8;t++)for(let a=0;a<4;a++)e.strokeRect(32*a+(t%2?16:0)-8,16*t,32,16)});i.wrapS=i.wrapT=r.GJx,i.repeat.set(3,2);let l=e.std("#9a8d80",{map:i});o.add(eh(e,l,5.6,2.6,.4,0,1.3,0));let s=es(e,new r.Ho_(.01,2,1.4,4,1),l);s.rotation.y=Math.PI/4,s.scale.z=.2,s.position.set(0,3.3,0),o.add(s);let d=eh(e,l,.6,1.6,.6,1.7,3.6,0);o.add(d),o.add(eh(e,e.std("#52371d"),1.1,2,.1,-.9,1,.22));let c=eh(e,e.std("#6b4a2b"),.95,1.9,.07,-1.25,.95,.5);c.rotation.y=.8,o.add(c),o.add(eh(e,e.std("#52371d"),.8,.8,.1,1.3,1.5,.22)),o.add(eh(e,e.mat(new r._4j({color:"#ffb85c",emissive:"#e87f2a",emissiveIntensity:.7})),.66,.66,.08,1.3,1.5,.24));let h=new r.HiM(0xff9a4a,.7,7,1.8);h.position.set(-.9,1,.7),o.add(h);let u=new r.YJl;u.add(es(e,new r.Gu$(.42,18,12,0,2*Math.PI,0,.62*Math.PI),e.std("#3a3a40",{metalness:.4,roughness:.6}))),u.children[0].position.y=.42;let f=es(e,new r.tcD(.36,18),e.std("#8a9a52"));f.rotation.x=-Math.PI/2,f.position.y=.62,u.add(f);for(let t=0;t<3;t++)u.add(ec(e,e.std("#2a2a30"),.03,.03,.5,-.3+.3*t,.25,.36)).rotation.x=.4;u.position.set(-.9,0,1),o.add(u),o.position.set(-2.4,0,-6.7),o.lookAt(0,0,0),t.add(o);let p=[],m=[];for(let a=0;a<6;a++){let n=e.flat("#e8e4dc",{transparent:!0,opacity:0,depthWrite:!1}),o=es(e,new r.Gu$(.16+a%3*.05,10,8),n);o.renderOrder=4,t.add(o),p.push(n),m.push(o)}let g=new r.Pq0;d.getWorldPosition(g),a.push(e=>{for(let t=0;t<m.length;t++){let a=(.22*e+t/m.length)%1,n=t<4,o=n?g.x:-1.2,r=n?g.z:-6.7+1.4,i=n?4.4:1.1;m[t].position.set(o+.3*Math.sin(.6*e+t),i+2.2*a,r+.2*Math.cos(.5*e+t)),m[t].scale.setScalar(.7+1.8*a),p[t].opacity=.34*(1-a)}});let w=new Float32Array(120);for(let e=0;e<40;e++)w[3*e]=-3.4+13*e%23/23*2.4,w[3*e+1]=.3+7*e%19/19*1.8,w[3*e+2]=-5.2+29*e%17/17*1.6;let b=e.geo(new r.LoY);b.setAttribute("position",new r.THS(w,3));let y=e.mat(new r.BH$({color:"#4a3a2a",size:.022,transparent:!0,opacity:.7,depthWrite:!1})),x=new r.ONl(b,y);t.add(x),a.push((e,t)=>{let a=b.getAttribute("position"),n=a.array;for(let a=0;a<40;a++)n[3*a+1]+=.08*t,n[3*a+1]>2.2&&(n[3*a+1]=.3),n[3*a]+=Math.sin(e+a)*t*.02;a.needsUpdate=!0});let v=ex(e,4.75,-3.7,3.4,.5,"#3f5a35");t.add(v);let M=ec(e,e.std("#6b4a2b"),.1,.13,2.4,4.2,2.4,-3.25);M.rotation.z=Math.PI/2-.35,M.rotation.y=.7,t.add(M);let k=es(e,new r.Ho_(.16,.16,.025,18),e.std("#e8e4d6"));k.position.set(4.3,1.7,-3.15),k.rotation.set(.4,0,1.2),t.add(k);for(let a=0;a<5;a++){let n=eh(e,e.std("#e8e4d6"),.1,.015,.08,-.4+.35*a,.02,-4.6+a%2*.3);n.rotation.y=1.1*a,t.add(n)}let S=new r.YJl;S.add(eh(e,e.std("#f4efe2"),.9,.6,.04,0,.3,0));let I=ed(e,e.std("#c0392b"),.06,0,.3,.03,1,1,.4);return S.add(I),S.position.set(-.4,0,-5.6),S.rotation.set(-.25,.5,0),t.add(S),{group:t,anims:a}},"A Mad Tea-Party":function(e){let t=new r.YJl,a=es(e,new r.tcD(8.45,48),e.std("#7fa05a",{roughness:1}));a.rotation.x=-Math.PI/2,a.position.y=.013,t.add(a);let n=new r.YJl,o=e.std("#e0d4b8");n.add(eh(e,o,4.6,2.2,.5,0,1.1,0));let i=Q(e,128,128,(e,t,a)=>{e.fillStyle="#8a6b45",e.fillRect(0,0,t,a),e.strokeStyle="#6e5436",e.lineWidth=2;for(let n=0;n<60;n++){let o=37*n%t,r=23*n%a;e.beginPath(),e.moveTo(o,r),e.quadraticCurveTo(o+4,r+8,o+1,r+16),e.stroke()}});i.wrapS=i.wrapT=r.GJx,i.repeat.set(3,1.5);let l=e.std("#8a6b45",{map:i}),s=es(e,new r.Ho_(.01,1.9,1.5,4,1),l);
1for(let t of(s.rotation.y=Math.PI/4,s.scale.set(1.45,1,.36),s.position.y=2.95,n.add(s),n.add(eh(e,l,5.1,.22,.9,0,2.28,.1)),[-1,1])){let a=new r.YJl,o=eu(e,l,.26,1.5,0,.75,0);o.rotation.z=-(.22*t),a.add(o);let i=eu(e,e.std("#caa6a0"),.13,1,.05*t,.7,.1);i.rotation.z=-(.22*t),a.add(i),a.position.set(1.3*t,3.2,0),n.add(a)}n.add(eh(e,e.std("#52371d"),.9,1.6,.1,-1.2,.8,.28)),n.add(eh(e,e.std("#6b4a2b"),.78,1.5,.08,-1.2,.75,.3)),n.position.set(3.4,0,-6.4),n.lookAt(0,0,0),t.add(n);let d=ex(e,-2,6.1,3.8,.62,"#4f7b3f");t.add(d);let c=new r.YJl;c.add(eh(e,e.std("#52371d"),.62,.92,.1,0,.46,0));let h=eh(e,e.std("#6b4a2b"),.5,.82,.07,-.1,.45,.08);h.rotation.y=.55,c.add(h),c.add(ed(e,e.std(X.brass,{metalness:.8,roughness:.3}),.025,.18,.45,.06));let u=es(e,new r.bdM(.1,.78),e.flat("#ffe2a0",{transparent:!0,opacity:.85}));u.position.set(.16,.45,.045),c.add(u),c.position.set(-1.65,0,5.62),c.lookAt(0,.45,0),t.add(c);let f=new r.YJl,p=e.std("#f6f1e4");for(let t of(f.add(eh(e,p,6.4,.1,1.5,0,.92,0)),f.add(eh(e,p,6.5,.04,1.6,0,.875,0)),f.add(eh(e,p,6.5,.5,.02,0,.92-.3,.8)),f.add(eh(e,p,6.5,.5,.02,0,.92-.3,-.8)),[-1,1]))f.add(eh(e,p,.02,.5,1.6,3.25*t,.92-.3,0));for(let[t,a]of[[-2.9,.55],[-2.9,-.55],[0,.55],[0,-.55],[2.9,.55],[2.9,-.55]])f.add(ec(e,e.std(X.woodDark),.06,.07,.92-.07,t,(.92-.07)/2,a));let m=e.std("#f4efe2"),g=e.std("#9fb6d8");for(let t=0;t<12;t++){let a=-2.85+t%6*1.14,n=t<6?.42:-.42,o=ec(e,t%3?m:g,.11,.13,.018,a,.982,n);f.add(o);let i=ec(e,t%4?m:g,.06,.05,.07,a+.01,1.03,n);f.add(i);let l=es(e,new r.O3Y(.028,.008,6,10,Math.PI),t%4?m:g);l.position.set(a+.072,1.03,n),l.rotation.z=-Math.PI/2,f.add(l)}for(let[t,a,n]of[[-1.4,0,1],[1.6,-.1,.9]]){let o=new r.YJl;o.add(ed(e,g,.16*n,0,.16*n,0,1,.9,1)),o.add(ec(e,g,.05*n,.05*n,.04,0,.3*n,0)),o.add(ed(e,g,.022,0,.33*n,0));let i=ef(e,g,[new r.Pq0(.14*n,.12*n,0),new r.Pq0(.24*n,.2*n,0),new r.Pq0(.27*n,.28*n,0)],.022*n);o.add(i),o.position.set(t,.92+.05,a),f.add(o)}let w=new r.YJl;w.add(ed(e,m,.22,0,.2,0,1,.95,1));let b=ec(e,m,.1,.12,.04,.05,.4,0);b.rotation.z=-.35,w.add(b);let y=ef(e,e.std("#a08a6e"),[new r.Pq0(.1,.36,0),new r.Pq0(.2,.3,.06),new r.Pq0(.26,.18,.02)],.014);w.add(y),w.position.set(2.9,.92+.05,.2),f.add(w);let x=new r.YJl;x.add(ec(e,m,.06,.08,.16,0,.05,0)),x.rotation.z=Math.PI/2-.25,x.position.set(-.6,.92+.085,.1),f.add(x);let v=es(e,new r.tcD(.13,14),e.flat("#fdfdf8"));v.rotation.x=-Math.PI/2,v.position.set(-.78,.92+.105,.12),v.renderOrder=2,f.add(v),f.position.set(-1.6,0,3.4),t.add(f);let M=e.std("#a85f4a",{map:ei(e,"#a85f4a","#8a4a3a")}),k=new r.YJl;for(let t of(k.add(eh(e,M,.74,.16,.7,0,.42,0)),k.add(eh(e,M,.74,.9,.14,0,.85,-.31)),[-1,1]))k.add(eh(e,M,.12,.3,.6,.34*t,.62,0)),k.add(ec(e,e.std(X.woodDark),.035,.04,.36,.28*t,.17,.24)),k.add(ec(e,e.std(X.woodDark),.035,.04,.36,.28*t,.17,-.24));for(let a of(k.position.set(-5.35,0,3.4),k.lookAt(0,0,3.4),t.add(k),[-3,-1.1,.6])){let n=new r.YJl;for(let[t,a]of(n.add(eh(e,e.std(X.wood),.46,.06,.46,0,.46,0)),n.add(eh(e,e.std(X.wood),.46,.6,.06,0,.78,-.2)),[[-.19,-.19],[.19,-.19],[-.19,.19],[.19,.19]]))n.add(ec(e,e.std(X.woodDark),.025,.03,.46,t,.23,a));n.position.set(a-1.6,0,4.45),n.rotation.y=Math.PI,t.add(n)}return{group:t,anims:[]}},"The Queen's Croquet-Ground":function(e){let t=new r.YJl,a=[],n=es(e,new r.tcD(8.45,48),e.std("#6f9a55",{roughness:1}));n.rotation.x=-Math.PI/2,n.position.y=.013,t.add(n);for(let a=0;a<5;a++){let n=es(e,new r.Ho_(.08,.08,5.5-Math.abs(a-2),10,1,!1),e.std("#5e8a4a"));n.rotation.z=Math.PI/2,n.rotation.y=.35,n.position.set(-1+1.3*a,.04,2.2-1.1*a),n.scale.y=.5,t.add(n)}for(let a of[10,75,290]){let n=a*Math.PI/180,o=new r.YJl;for(let t of[-1,1])o.add(ec(e,e.std("#5e8a4a"),.07,.09,2,.9*t,1,0));let i=es(e,new r.O3Y(.9,.08,8,18,Math.PI),e.std("#5e8a4a"));i.position.y=2,o.add(i);for(let t=0;t<8;t++){let a=t/7*Math.PI;o.add(ed(e,e.std(t%2?"#d96a6a":"#f4efe2"),.08,.9*Math.cos(a),2+.9*Math.sin(a),.04)),o.add(ed(e,e.std("#4f7b3f"),.1,.9*Math.cos(a)+.05,1.94+.9*Math.sin(a),-.06))}o.position.set(7.4*Math.cos(n),0,7.4*Math.sin(n)),o.lookAt(0,0,0),t.add(o)}let o=new r.YJl;o.add(ec(e,e.std("#6b4a2b"),.09,.13,1.5,0,.75,0)),o.add(ed(e,e.std("#3f5a35"),.85,0,1.9,0,1.1,.95,1.1));let i=0;for(let t=0;t<14;t++){let a=t/14*Math.PI*2,n=5*t%7/7*Math.PI-Math.PI/2,r=Math.cos(a)*Math.cos(n)*.85,l=1.9+.8*Math.sin(n),s=Math.sin(a)*Math.cos(n)*.92;if(t%3==0&&i<4){let t=ed(e,e.std("#c0392b"),.1,r,l,s);o.add(t),o.add(ed(e,e.std("#f4efe2"),.045,r-.04,l-.06,s+.03)),i++}else o.add(ed(e,e.std(t%2?"#f4efe2":"#fdfdf8"),.1,r,l,s))}o.position.set(-3.7,0,-3.3),t.add(o);let l=new r.YJl;l.add(ec(e,e.std("#8a744a"),.14,.11,.22,0,.11,0));let s=es(e,new r.tcD(.12,14),e.flat("#c0392b"));s.rotation.x=-Math.PI/2,s.position.y=.225,l.add(s),l.position.set(-3,0,-2.7),t.add(l);let d=new r.YJl;d.add(ec(e,e.std("#a85f4a"),.5,.38,.8,0,.4,0)),d.add(ec(e,e.std("#8a4a3a"),.54,.54,.1,0,.78,0)),d.position.set(-5.6,0,-1.2),t.add(d);let c=eg(e);c.position.set(-1.5,0,4.9),c.rotation.y=.4,t.add(c);let h=eg(e);h.position.set(.9,0,5.6),h.rotation.y=-.6,t.add(h);let u=function(e){let t=new r.YJl,a=e.std("#e8a2b8");t.add(ed(e,a,.18,0,.62,0,1.35,1,.9)),t.add(ed(e,e.std("#d98aa4"),.1,-.2,.66,0,1,.8,.8));let n=ef(e,a,[new r.Pq0(.14,.7,0),new r.Pq0(.3,.95,.02),new r.Pq0(.26,1.2,0),new r.Pq0(.38,1.32,0)],.035);t.add(n);let o=new r.YJl;o.position.set(.42,1.34,0),o.add(ed(e,a,.06,0,0,0));let i=eu(e,e.std("#e8c89a"),.03,.12,0,-.045,.07);for(let t of(i.rotation.x=Math.PI/1.6,o.add(i),o.add(eu(e,e.std("#2a2a30"),.02,.05,0,-.1,.1)),[-1,1]))o.add(ed(e,e.std("#2a2a30"),.011,.035*t,.02,.04));t.add(o),t.add(ec(e,e.std("#d98aa4"),.016,.016,.52,.02,.26,.03));let l=ec(e,e.std("#d98aa4"),.014,.014,.26,-.06,.5,-.04);return l.rotation.x=1.2,t.add(l),{group:t,headY:1.7,animate:e=>{o.rotation.z=.9*Math.max(0,Math.sin(.5*e)),o.rotation.y=.4*Math.sin(.31*e)}}}(e);u.group.position.set(1.8,0,3.8),u.group.rotation.y=2.4,t.add(u.group),u.animate&&a.push(u.animate);let f=ew(e,!0);f.group.position.set(1.45,0,3.5),t.add(f.group);let p=ew(e,!1);t.add(p.group),p.animate&&a.push(p.animate);let m=function(e){let t=new r.YJl,a=e.std("#c4b094",{transparent:!0,opacity:0}
1),n=ed(e,a,.5,0,0,0,1.1,.95,1);t.add(n);let o=[];for(let a of[-1,1]){let n=eu(e,e.std("#8a7a5e",{transparent:!0,opacity:0}),.16,.36,.3*a,.48,0);n.rotation.z=-(.25*a),t.add(n),o.push(n)}let i=[];for(let a of[-1,1]){let n=ed(e,e.std("#e8e09a",{transparent:!0,opacity:0}),.12,.19*a,.16,.4);t.add(n),i.push(n)}let l=Q(e,256,128,(e,t,a)=>{e.fillStyle="#fffef2",e.beginPath(),e.moveTo(10,30),e.quadraticCurveTo(t/2,a+30,t-10,30),e.quadraticCurveTo(t/2,a-34,10,30),e.closePath(),e.fill()}),s=e.flat("#ffffff",{transparent:!0,opacity:0,map:l,depthWrite:!1}),d=es(e,new r.bdM(.74,.36),s);return d.position.set(0,-.14,.48),d.renderOrder=6,t.add(d),{group:t,headY:0,animate:e=>{let a=e%26,l=r.cj9.clamp((a-2)/1.5,0,1)*r.cj9.clamp((20-a)/1.5,0,1),d=r.cj9.clamp((a-4)/1.5,0,1)*r.cj9.clamp((18.6-a)/1.5,0,1),c=r.cj9.clamp((a-6)/2,0,1)*r.cj9.clamp((17.2-a)/1.8,0,1);for(let e of(s.opacity=l,i))e.material.opacity=d;for(let e of(n.material.opacity=.95*c,o))e.material.opacity=.95*c;t.visible=l>.01||a<21}}}(e);return m.group.position.set(.4,5.1,-5.6),t.add(m.group),m.animate&&a.push(m.animate),{group:t,anims:a}},"The Lobster Quadrille":function(e){let t=new r.YJl,a=[],n=es(e,new r.tcD(8.45,48),e.std("#e3d2a8",{roughness:1}));n.rotation.x=-Math.PI/2,n.position.y=.013,t.add(n);let o=es(e,new r.rKP(6.8,16,40,1,-(.42*Math.PI),.84*Math.PI),e.std("#4f8a96",{roughness:.35,metalness:.1}));o.rotation.x=-Math.PI/2,o.position.y=.02,t.add(o);for(let a=0;a<3;a++){let n=es(e,new r.rKP(6.82+.5*a,6.92+.5*a,40,1,-Math.PI*(.4-.05*a),Math.PI*(.8-.1*a)),e.flat("#f4f0e2",{transparent:!0,opacity:.7-.18*a,depthWrite:!1}));n.rotation.x=-Math.PI/2,n.position.y=.025+.002*a,n.renderOrder=2,t.add(n)}let i=Q(e,128,128,(e,t,a)=>{e.fillStyle="#cdbb92",e.fillRect(0,0,t,a);for(let n=0;n<90;n++)e.fillStyle=n%2?"#b9a684":"#a89878",e.beginPath(),e.ellipse(37*n%t,53*n%a,5,3.4,n,0,2*Math.PI),e.fill()});i.wrapS=i.wrapT=r.GJx,i.repeat.set(4,1);let l=es(e,new r.rKP(5.4,6.85,40,1,-(.4*Math.PI),.8*Math.PI),e.std("#cdbb92",{map:i}));l.rotation.x=-Math.PI/2,l.position.y=.018,t.add(l);let s=e.std("#9a8d80",{roughness:.95}),d=new r.YJl;d.add(eh(e,s,1.6,.8,1.3,0,.4,0)),d.add(eh(e,s,1.2,.34,1,.25,.95,-.1)),d.add(eh(e,s,.7,.3,.8,-.55,.15,.3)),d.position.set(4.3,0,-2.5),d.rotation.y=.4,t.add(d);let c=new r.YJl;c.add(eh(e,s,2.4,4.2,1.6,0,2.1,0)),c.add(eh(e,s,1.8,3.1,1.4,-1.4,1.55,.5)),c.add(eh(e,s,1.5,2.2,1.2,1.3,1.1,-.4)),c.position.set(7.2,0,-5.6),c.rotation.y=-.5,t.add(c);for(let a=0;a<10;a++){let n=a/10*Math.PI*2,o=eu(e,e.std(a%2?"#e8dcc0":"#d9b8c4"),.06,.05,3+1.1*Math.cos(n),.028,-1.2+1.1*Math.sin(n));o.rotation.x=Math.PI/2,o.rotation.z=n,t.add(o)}let h=es(e,new r.tcD(.7,18),e.std("#4f8a96",{roughness:.3,transparent:!0,opacity:.85}));h.rotation.x=-Math.PI/2,h.position.set(-2.6,.022,-3.4),t.add(h);for(let a=0;a<2;a++)t.add(ed(e,e.std("#b9aa90"),.07,-2.6+.3*a,.05,-3.2-.25*a,1.3,.5,1));let u=eh(e,s,1,.5,.9,5,.25,1.4);t.add(u);let f=new r.YJl,p=e.std("#f4efe2");f.add(ed(e,p,.3,0,.26,0,1,.75,1)),f.add(ec(e,p,.31,.31,.06,0,.4,0));let m=es(e,new r.O3Y(.27,.035,8,20),e.std("#69b98a"));m.rotation.x=Math.PI/2,m.position.y=.43,f.add(m);let g=ed(e,p,.26,.4,.16,.2,1,.5,1);g.rotation.z=.9,f.add(g),f.add(ed(e,p,.04,.48,.3,.22)),f.position.set(5,.5,1.4),t.add(f);let w=[],b=[];for(let a=0;a<3;a++){let a=e.flat("#f4f0e2",{transparent:!0,opacity:0,depthWrite:!1}),n=es(e,new r.Gu$(.08,10,8),a);n.renderOrder=4,t.add(n),w.push(a),b.push(n)}a.push(e=>{for(let t=0;t<b.length;t++){let a=(.3*e+t/3)%1;b[t].position.set(5+.08*Math.sin(e+2*t),.95+.9*a,1.4+.06*Math.cos(.8*e+t)),b[t].scale.setScalar(.8+1.6*a),w[t].opacity=.4*(1-a)}});let y=new r.YJl,x=e.std("#c0503a");y.add(ed(e,x,.12,0,.5,0,1,1.4,.8));for(let t=0;t<4;t++){let a=ed(e,x,.08-.012*t,0,.3-.1*t,-.08-.07*t,1,.7,1);a.rotation.x=-.4-.2*t,y.add(a)}let v=ed(e,x,.09,0,.02,-.42,1.6,.2,1);for(let t of(y.add(v),[-1,1])){let a=ec(e,x,.025,.03,.26,.12*t,.52,.08);a.rotation.x=-.9,y.add(a);let n=ed(e,x,.08,.14*t,.66,.22,1.2,.6,1.5);y.add(n),y.add(ed(e,x,.04,.18*t,.68,.34,1,.5,1.6));let o=ef(e,e.std("#8a3a2a"),[new r.Pq0(.04*t,.72,.06),new r.Pq0(.1*t,.92,.16),new r.Pq0(.2*t,1.05,.1)],.008);y.add(o)}for(let t of[-1,1])y.add(ed(e,e.std("#2a2a30"),.016,.05*t,.62,.1));y.position.set(-3.1,0,4.3),y.rotation.y=2.6,t.add(y);let M=new r.YJl;M.add(ec(e,e.std("#8a744a"),.03,.05,1.1,0,.55,0));let k=es(e,new r.O3Y(.3,.04,8,22),e.std(X.brass,{metalness:.6,roughness:.4}));k.position.y=1.2,M.add(k);let S=es(e,new r.tcD(.28,22),e.std("#cfe3e8",{metalness:.9,roughness:.12}));return S.position.y=1.2,S.position.z=.005,M.add(S),M.position.set(-3.55,0,4.75),M.lookAt(-3.1,1.1,4.3),t.add(M),{group:t,anims:a}},"Who Stole the Tarts?":function(e){let t=new r.YJl,a=[],n=Q(e,256,256,(e,t,a)=>{e.fillStyle="#9a7a52",e.fillRect(0,0,t,a),e.strokeStyle="#7d6242",e.lineWidth=3;for(let a=0;a<8;a++)e.beginPath(),e.moveTo(0,32*a),e.lineTo(t,32*a),e.stroke(),e.beginPath(),e.moveTo(67*a%t,32*a),e.lineTo(67*a%t,32*a+32),e.stroke()});n.wrapS=n.wrapT=r.GJx,n.repeat.set(4,4);let o=es(e,new r.tcD(8.45,48),e.std("#9a7a52",{map:n,roughness:.9}));o.rotation.x=-Math.PI/2,o.position.y=.013,t.add(o);let i=Q(e,256,128,(e,t,a)=>{e.fillStyle="#6e5436",e.fillRect(0,0,t,a),e.strokeStyle="#52371d",e.lineWidth=4;for(let t=0;t<4;
1t++)e.strokeRect(64*t+8,14,48,a-28)});i.wrapS=i.wrapT=r.GJx,i.repeat.set(10,2);let l=es(e,new r.Ho_(8.5,8.5,4,48,1,!0),e.std("#6e5436",{map:i,side:r.hsX}));l.position.y=2,t.add(l);let s=es(e,new r.tcD(8.5,48),e.std("#d8ccae",{side:r.$EB}));s.rotation.x=Math.PI/2,s.position.y=4,t.add(s);for(let a=0;a<26;a++){let n=.2*Math.PI+a/26*Math.PI*1.6;t.add(ec(e,e.std(X.woodDark),.035,.04,1,7.7*Math.cos(n),.5,7.7*Math.sin(n)))}let d=es(e,new r.O3Y(7.7,.05,8,48,1.6*Math.PI),e.std(X.wood));d.rotation.x=Math.PI/2,d.rotation.z=.2*Math.PI,d.position.y=1.02,t.add(d);let c=["heart","spade","club"];for(let a=0;a<15;a++){let n=.28*Math.PI+a/15*Math.PI*1.44,o=es(e,new r.bdM(.5,.74),e.flat("#f8f4ea",{map:en(e,c[a%3],[2,5,7][a%3]),side:r.$EB}));o.position.set(8.2*Math.cos(n),.95,8.2*Math.sin(n)),o.lookAt(0,.8,0),o.rotation.z=(7*a%5-2)*.06,t.add(o)}let h=new r.YJl;h.add(eh(e,e.std(X.wood),3.6,1.5,1.4,0,.75,0));let u=es(e,new r.bdM(3.4,1.3),e.std("#7d2a33",{map:er(e,"#7d2a33","#e8b73a")}));u.position.set(0,.72,.715),h.add(u),h.add(eh(e,e.std(X.woodDark),3.8,.12,1.6,0,1.56,0));let f=eh(e,e.std(X.woodDark),3,2.2,.16,0,2.7,-.6);h.add(f);let p=es(e,new r.bdM(1.1,1.1),e.flat("#f8f4ea",{map:Q(e,256,256,(e,t,a)=>{e.fillStyle="#f4ead2",e.fillRect(0,0,t,a),e.strokeStyle="#7d2a33",e.lineWidth=8,e.beginPath(),e.moveTo(48,40),e.lineTo(t-48,40),e.lineTo(t-48,140),e.quadraticCurveTo(t-48,200,t/2,224),e.quadraticCurveTo(48,200,48,140),e.closePath(),e.stroke(),e.fillStyle="#c0392b",ee(e,t/2,100,28),ee(e,t/2-44,150,18),ee(e,t/2+44,150,18)})}));p.position.set(0,3.1,-.51),h.add(p),h.position.set(0,0,-6.9),t.add(h);let m=new r.YJl;m.add(eh(e,e.std(X.wood),2.4,.9,1.2,0,.45,0)),m.add(eh(e,e.std(X.woodDark),2.5,.08,1.3,0,.92,0)),m.add(eh(e,e.std(X.wood),2.4,.3,.1,0,1.05,.6));let g=[e.std("#a08a6e"),e.std("#9aa3b4"),e.std("#9fb277"),e.std("#c2925a"),e.std("#b9aa90"),e.std("#7d6248"),e.std("#d8c9a6"),e.std("#8a93a4")],w=null,b=null;for(let t=0;t<12;t++){let a=t<6?0:1,n=-1+t%6*.4,o=.95+.42*a,i=0===a?.3:-.25,l=8===t,s=l?e.std("#7fa05a"):g[t%g.length],d=new r.YJl;d.add(ed(e,s,.12,0,0,0,1,1.1,.9));let c=new r.YJl;if(c.position.set(0,.16,.03),c.add(ed(e,s,.085,0,0,0)),t%4==0)for(let t of[-1,1])c.add(eu(e,s,.025,.09,.05*t,.1,0));else if(t%4==1)c.add(eu(e,e.std("#caa06a"),.022,.08,0,-.01,.1)).rotation.x=Math.PI/2;else if(t%4==2)for(let t of[-1,1])c.add(ed(e,s,.04,.07*t,.05,0,1,1,.5));else c.add(ed(e,e.std("#f4efe2"),.05,0,.07,.02,1,.6,1));if(l){let t=eh(e,e.flat("#23232a"),.02,.09,.012,.02,-.01,.082);c.add(t),w=c;let a=ec(e,s,.012,.012,.12,.12,-.06,.12);a.rotation.x=-.8,d.add(a),b=a}for(let t of[-1,1])c.add(ed(e,e.std("#2a2a30"),.012,.035*t,.02,.075));d.add(c);let h=eh(e,e.std("#4a4a52"),.16,.12,.014,0,.06,.16);h.rotation.x=-.5,d.add(h),d.position.set(n,o,i),m.add(d)}m.position.set(-4.7,0,-3.9),m.lookAt(0,0,-1.2),t.add(m),a.push(e=>{b&&(b.rotation.z=.25*Math.sin(5*e)),w&&(w.rotation.z=.1*Math.sin(.8*e))});let y=new r.YJl;y.add(ec(e,e.std(X.wood),.65,.7,.45,0,.225,0));let x=es(e,new r.O3Y(.62,.035,8,22,1.5*Math.PI),e.std(X.woodDark));x.rotation.x=Math.PI/2,x.rotation.z=.75*Math.PI,x.position.y=1,y.add(x);for(let t=0;t<4;t++){let a=.75*Math.PI+t/3*Math.PI*1.5;y.add(ec(e,e.std(X.woodDark),.025,.025,.55,.62*Math.cos(a),.725,.62*Math.sin(a)))}y.position.set(3.1,0,-4.4),t.add(y);let v=new r.YJl;v.add(ec(e,e.std(X.wood),.5,.55,.08,0,.78,0)),v.add(ec(e,e.std(X.woodDark),.08,.12,.74,0,.37,0));let M=ec(e,e.std("#f6f1e4"),.52,.58,.05,0,.84,0);v.add(M);let k=ec(e,e.std("#e8e4d6"),.4,.34,.05,0,.89,0);v.add(k);for(let t=0;t<9;t++){let a=t/9*Math.PI*2,n=.24*(0!==t),o=Math.cos(a)*n,i=Math.sin(a)*n,l=ec(e,e.std("#e0b873"),.07,.06,.05,o,.94,i);v.add(l);let s=es(e,new r.O3Y(.065,.014,6,14),e.std("#caa05a"));s.rotation.x=Math.PI/2,s.position.set(o,.965,i),v.add(s);let d=es(e,new r.tcD(.035,10),e.flat("#a23b3b"));d.rotation.x=-Math.PI/2,d.position.set(o,.972,i),v.add(d)}for(let a of(v.position.set(1.9,0,-1.9),t.add(v),[-1,1])){let n=em(e,"club",a<0?5:7,{cap:"soldier",halberd:!0});n.group.position.set(1.05*a,0,-3.6),n.group.lookAt(0,0,0),t.add(n.group)}let S=new r.YJl,I=e.std("#d8ccae");for(let t of(S.add(ed(e,I,.26,0,.24,0,1,.85,.9)),S.add(ec(e,e.std("#8a744a"),.03,.05,.1,0,.5,0)),[-1,1]))S.add(ec(e,e.std("#c2925a"),.018,.018,.1,.08*t,.06,.24)).rotation.x=1.2;let P=es(e,new r.bdM(.42,.62),e.flat("#f8f4ea",{map:en(e,"club",2),side:r.$EB}));P.position.set(0,.62,-.05),P.rotation.x=-.5,S.add(P),S.position.set(5.4,0,-.6
1),t.add(S);let T=new r.HiM(0xffe2b0,.5,16,1.6);T.position.set(0,3.4,-2),t.add(T);let C=new r.HiM(0xffe2b0,.35,14,1.6);C.position.set(2,3.2,3),t.add(C);let j=[],_=[en(e,"heart",2),en(e,"spade",5),en(e,"club",7)];for(let a=0;a<12;a++){let n=es(e,new r.bdM(.36,.54),e.flat("#f8f4ea",{map:_[a%3],side:r.$EB,transparent:!0}));n.visible=!1,t.add(n),j.push({mesh:n,phase:a/12*2.2,angle:.2*Math.PI+a/12*Math.PI*1.6})}return a.push(e=>{let t=e%42;for(let e of j){let a=(t-2-e.phase)/7;if(a<0||a>1){e.mesh.visible=!1;continue}e.mesh.visible=!0;let n=Math.sin(a*Math.PI),o=6.6+.5*Math.sin(9*a+e.phase);e.mesh.position.set(Math.cos(e.angle+.8*a)*o,.4+2.8*n,Math.sin(e.angle+.8*a)*o),e.mesh.rotation.set(7*a+e.phase,e.angle,5*a),e.mesh.material.opacity=Math.min(1,2*n)}}),{group:t,anims:a}}},eM={"Down the Rabbit-Hole":{file:"rabbit-hole.gif",w:.97,h:1.4,angleDeg:318,caption:"The White Rabbit"},"Advice from a Caterpillar":{file:"caterpillar.gif",w:1.06,h:1.4,angleDeg:268,caption:"Advice from a Caterpillar"},"Pig and Pepper":{file:"pig-and-pepper.gif",w:1.69,h:1.4,angleDeg:250,caption:"The Duchess’s Kitchen"},"A Mad Tea-Party":{file:"tea-party.gif",w:1.25,h:1.4,angleDeg:300,caption:"The Hatter"},"The Queen's Croquet-Ground":{file:"croquet.gif",w:1.04,h:1.4,angleDeg:212,caption:"Painting the Roses"},"The Lobster Quadrille":{file:"lobster.gif",w:1.81,h:1.3,angleDeg:252,caption:"The Gryphon"},"Who Stole the Tarts?":{file:"trial.gif",w:1.14,h:1.4,angleDeg:285,caption:"Alice Upsets the Jury"}},ek={"the-white-rabbit":'Carroll wrote that the Rabbit was made for contrast with Alice: where she is young and direct, he is "elderly, timid, feeble, and nervously shilly-shallying." The whole book begins because she follows his anxiety instead of her own boredom.',"the-rabbit-hole":'As she falls, Alice recites half-remembered lessons — latitude, longitude, "antipathies" (she means antipodes). Carroll, an Oxford mathematics don, is teasing rote schoolroom knowledge: it sounds impressive and explains nothing, even while falling through the earth.',"the-little-bottle":'Alice checks whether the bottle is marked "poison" before drinking — a wink at the moralizing cautionary tales Victorian children were raised on, where disobedient children meet instructive ends. Alice follows the safety rule precisely, and the nonsense happens anyway.',"eat-me":"The growing and shrinking is a mathematician's game: Alice keeps her proportions while her scale changes, and she reasons carefully inside an absurd premise — \"if it makes me grow larger, I can reach the key.\" Logic intact, world mad: that inversion is the book's engine.","the-po
1ol-of-tears":"The pool is Alice's own doing — she wept it when she was nine feet tall, then nearly drowns in it at three inches. In the original manuscript, \"Alice's Adventures Under Ground,\" this episode carried memories of a real soaked boating party from the summer the story was first told.","the-caucus-race":'A "caucus" was political committee-speak: everyone runs in circles, starts and stops where they like, and "everybody has won." The animals are the real 1862 boating party — the Dodo is Dodgson himself (his stammer made him say "Do-do-Dodgson"), the Duck is Rev. Duckworth, the Lory and Eaglet are Alice\'s sisters Lorina and Edith.',"who-are-you":"Three inches of hookah-smoking contempt, asking the book's central question. Alice has changed size so often she can't answer — \"I knew who I was when I got up this morning, but I think I must have been changed several times since then.\" Identity under transformation is a logician's puzzle wearing a child's words.","the-mushroom":'"One side will make you grow taller, and the other side will make you grow shorter" — of a round mushroom. Alice has to decide where the sides of a circle are: a quiet geometry joke, and the book\'s most practical magic once she solves it.',"father-william":"A precise parody of Robert Southey's solemn 1799 poem \"The Old Man's Comforts and How He Gained Them,\" which every Victorian child had to memorize. Carroll keeps the meter and replaces the moral lessons with headstands, back-somersaults, and an eel balanced on the nose.","the-pigeon":"The Pigeon's reasoning is a textbook logical fallacy: little girls eat eggs; serpents eat eggs; therefore little girls are a kind of serpent. Carroll taught logic at Oxford — Wonderland's creatures argue badly in technically instructive ways.","the-duchesss-kitchen":"Too much pepper in the soup, too much pepper in the air, and a cook throwing fire-irons: the kitchen is domestic order turned violent and arbitrary — the first room in Wonderland where an adult is simply dangerous to be near.",pig:'The baby turns out to be "neither more nor less than a pig," and Alice — sensibly — lets it trot off. Carroll\'s dream-logic rule: transformation is never explained, only accommodated. "If it had grown up, it would have made a dreadfully ugly child: but it makes rather a handsome pig."',"we-are-all-mad":"The Cat proves its madness by inverted syllogism: a dog growls when angry and wags when pleased; the Cat growls when pleased and wags when angry; therefore mad. The premises are wrong and the conclusion is confident — a perfect Wonderland argument.","the-cheshire-cat":'"To grin like a Cheshire cat" was already an old saying when Carroll borrowed it — Cheshire was his home county, and one tradition says its cheeses were once molded with grinning cat faces. He took a dead proverb and gave it a body. Then took the body away.',"the-vanishing":"The grin without the cat delights mathematicians: it is abstraction itself — the property persisting after the object is gone, like a number without the things counted. Generations of logic and physics writers have borrowed this image for exactly that reason.","the-mad-tea-party":'"No room! No room!" — at a table with plenty of room. "Mad as a hatter" was real Victorian slang with a dark source: hat-makers were poisoned by the mercury used in felting. "Mad as a March hare" described hares\' wild spring behavior. Carroll seated both proverbs at one table.',"the-raven-riddle":'"Why is a raven like a writing-desk?" had no answer — Carroll admitted the riddle was invented with none, which is the joke. Pressed for years, he finally offered one: "Because it can produce a few notes, tho they are very flat; and it is nevar put with the wrong end in front." Note "nevar": raven, reversed — a spelling printers kept "fixing."',"the-best-butter":"The Hatter's watch tells the day of the month but not the hour, and the March Hare's defense of buttering its works — \"it was the BEST butter\" — is quality control applied to the wrong question entirely. Time itself quarreled with the Hatter; it has been six o'clock ever since.","twinkle-twinkle":'A parody of Jane Taylor\'s "The Star," the most famous children\'s poem of the age. The "little bat" is an Oxford in-joke: Bartholomew Price, a mathematics professor Carroll knew well, was nicknamed "The Bat" — his lectures were said to soar far above his students\' heads.',"the-treacle-well":"The treacle-well is real. St Margaret's Well at Binsey, just outside Oxford, was a medieval healing well — \"treacle\" originally meant a healing balm, not syrup. And the three sisters who lived in it are the Liddells themselves: Elsie (L.C. — Lorina Charlotte), Lacie (an anagram of Alice), and Tillie (Edith's family nickname).","a-clean-cup":"With time stopped at perpetual tea-time, the only way forward is sideways: move roun
1d the table to the next place. The Hatter benefits, Alice gets a used saucer, and nobody washes up — an economy of pure procrastination, run by its only winner.","painting-the-roses":"Gardeners Two, Five, and Seven — spades, fittingly — planted a white rose-tree where a red one was ordered, and their solution is paint. It is bureaucratic survival in miniature: fix the appearance before the inspection, and never mention the mistake.","the-procession":"The procession sorts the whole deck into a society: clubs as soldiers, diamonds as courtiers, hearts as the royal children. Carroll builds an entire court from the logic of a card game — which is why, when the spell breaks, it can collapse back into one.","the-queen-of-hearts":'Carroll described her precisely: "a sort of embodiment of ungovernable passion — a blind and aimless Fury." He distinguished her carefully from chess\'s Red Queen in the next book, who is cold and correct. This Queen has exactly one idea, and it is the sentence.',"the-croquet-ground":'Flamingo mallets, hedgehog balls, soldier hoops that wander off: croquet was the fashionable garden craze of the 1860s, and Carroll was devoted to it — he even invented his own variant, "Castle Croquet," with rules he published. Here he lets the equipment have opinions.',"a-cat-may-look":'"A cat may look at a king" is a genuine English proverb, centuries old — the right of the lowliest to regard the highest. Alice deploys it as legal precedent, from a book she has read somewhere, against a king who has no counter-authority to cite.',"the-grin-in-the-air":"The executioner argues you cannot cut a head off unless there is a body to cut it from; the King argues anything with a head can be beheaded; the Queen argues that if nothing is done, everyone dies. Three positions, all internally consistent, none compatible: a logic seminar at execution speed.","the-gryphon":"A heraldic beast — half eagle, half lion — borrowed from coats of arms into the dream. Tenniel drew it dozing. The Gryphon's great contribution to justice: \"It's all her fancy, that: they never executes nobody, you know.\"","a-real-turtle":"The Mock Turtle is a soup pun walking: mock turtle soup was a real Victorian dish made from a calf's head when actual turtle was too dear. That is why Tenniel drew him with a calf's head, hooves, and tail — he is the recipe, grieving for the turtle he never was.",uglification:'The school under the sea taught "Reeling and Writhing" and the four branches of arithmetic: "Ambition, Distraction, Uglification, and Derision." And lessons "lessen" — ten hours the first day, nine the next: the pun explains the timetable.',"will-you-join-the-dance":'A parody of Mary Howitt\'s "The Spider and the Fly" ("Will you walk into my parlour?"), with its sinister invitation turned into a whiting urging a snail toward France. The original warned children about flattery; Carroll\'s version is just an irresistible dance.',"beautiful-soup":'A parody of "Star of the Evening," a sentimental song the real Liddell sisters had sung for Carroll. "Beau—ootiful Soo—oop" stretches its lovely long notes until sentiment becomes appetite — sung, fittingly, by someone who is himself a soup.',"the-court":'The King presides as judge "because of his great wig" — which he wears under his crown, as Tenniel faithfully drew. Carroll\'s courtroom keeps every form of English law and none of its substance: evidence, verdict, and sentence all present, in the wrong order.',"the-accusation":'The indictment is a real nursery rhyme — "The Queen of Hearts, she made some tarts" was in print by 1782, decades before the book. The whole trial rests on it: Wonderland prosecutes from a poem the jury already knows by heart, which is roughly how it felt to be tried by Victorian public opinion.',"the-hatters-evidence":'The Hatter arrives with teacup and bread-and-butter — dragged from the tea-table where time stopped — and testifies in terror of the very sovereign whose concerts he once sang at. His evidence establishes nothing except the date he cannot remember, "the fourteenth of March, I think."',"rule-forty-two":'"Rule Forty-two: All persons more than a mile high to leave the court." Alice: "Then it ought to be Number One." Forty-two followed Carroll around — the Snark\'s Rule 42, forty-two boxes, and this very book\'s forty-two illustrations. Coincidence, ritual, or a private joke he kept for life: scholars still argue.',"sentence-first":'"Sentence first — verdict afterwards" is the trial\'s thesis stated plainly: procedure severed from justice. It is the moment Alice stops being small enough — in any sense — to play along, and the dream begins to lose its authority over her.',"a-pack-of-cards":"\"You're nothing but a pack of cards!\" — at her full height, Alice names what the court is made of, and the naming breaks it. The whole apparatus of Wonderland power survives only as long as it is not described accurately. That sentence is the book's quiet politics.","the-wonderful-dream":'The ending steps outside the dream: Alice\'s sister sits in the late afternoon, replaying it all, knowing the rattle of teacups is only sheep-bells. Carroll closes a nonsense book with something unguarded — the hope that Alice would keep "the simple and loving heart of her childhood" into the years ahead.'},eS={default:{bg:"#dff0f2",fogNear:8,fogFar:26,floor:"#efe6d8",water:"#1b8a9e",tubWall:"#c4805a",rim:"#a9663f",light:"#fff2e0",hemiGround:0xd9c3a5,tubR:1.5,seats:6,seatColor:"#e7d9c4"},forest:{bg:"#cfe3d2",fogNear:7,fogFar:22,floor:"#6b7d56",water:"#2a8f86",tubWall:"#7a5230",rim:"#5e3f24",light:"#eaf6d8",hemiGround:4873530,tubR:1.5,seats:6,seatColor:"#8a6b45"},beach:{bg:"#ffe6c4",fogNear:12,fogFar:34,floor:"#f1ddb4",water:"#1b8a9e",tubWall:"#cf9b62",rim:"#b07a44",light:"#ffe9c9",hemiGround:0xe7cf9a,tubR:1.5,seats:6,seatColor:"#ecd9ac"},glacier:{bg:"#dcebf4",fogNear:9,fogFar:28,floor:"#eef4f8",water:"#8fc7da",tubWall:"#9fb6c4",rim:"#7f99a8",light:"#eaf3ff",hemiGround:0xcfe0ea,tubR:1.5,seats:6,seatColor:"#dbe7ef"},subtub:{bg:"#f3e3d6",fogNear:5,fogFar:16,floor:"#e9d6c0",water:"#e0714a",tubWall:"#c4805a",rim:"#a9663f",light:"#fff0e0",hemiGround:0xd8b79a,tubR:1,seats:4,seatColor:"#ecd9c4"},wolftrail:{bg:"#cdd9dd",fogNear:11,fogFar:52,floor:"#6a5d42",water:"#2f7d84",tubWall:"#7a5230",rim:"#5e3f24",light:"#eef3e6",hemiGround:4873530,tubR:1.5,seats:6,seatColor:"#8a6b45"},"wolftrail-real":{bg:"#c2ccd2",fogNear:34,fogFar:95,floor:"#5b4f3b",water:"#2f7d84",tubWall:"#6f4a2c",rim:"#553a22",light:"#f0f2ea",hemiGround:5918523,tubR:1.5,seats:6,seatColor:"#7d5f3f"},space:{bg:"#05070f",fogNear:100,fogFar:4e3,floor:"#0a0a14",water:"#1b8a9e",tubWall:"#c4805a",rim:"#a9663f",light:"#fff2e0",hemiGround:657940,tubR:1.5,seats:6,seatColor:"#e7d9c4"},arcade:{bg:"#0a0813",fogNear:9,fogFar:22,floor:"#0d0820",water:"#1b8a9e",tubWall:"#c4805a",rim:"#a9663f",light:"#fff2e0",hemiGround:1314847,tubR:1.5,seats:6,seatColor:"#e7d9c4"},tabletop:{bg:"#241d18",fogNear:6,fogFar:22,floor:"#1b1410",water:"#1b8a9e",tubWall:"#6b4a2b",rim:"#4a331e",light:"#fff0d8",hemiGround:2760728,tubR:1.5,seats:6,seatColor:"#e7d9c4"},babylon:{bg:"#171d2a",fogNear:10,fogFar:70,floor:"#30394c",water:"#1b8a9e",tubWall:"#685238",rim:"#4d3a28",light:"#e9efff",hemiGround:2634050,tubR:1.5,seats:6,seatColor:"#d8deea"},holograms:{bg:"#071021",fogNear:12,fogFar:90,floor:"#101b31",water:"#168d9e",tubWall:"#263a55",rim:"#3d617b",light:"#b9eeff",hemiGround:1055276,tubR:1.5,seats:6,seatColor:"#89b7c8"},arch:{bg:"#d9e4e7",fogNear:16,fogFar:110,floor:"#596b62",water:"#247e86",tubWall:"#735037",rim:"#563b29",light:"#f4f4e8",hemiGround:4412234,tubR:1.5,seats:6,seatColor:"#a99172"},circle:{bg:"#19242a",fogNear:8,fogFar:45,floor:"#303a35",water:"#226f77",tubWall:"#71513c",rim:"#51382a",light:"#ffd8a3",hemiGround:2502956,tubR:1.7,seats:8,seatColor:"#9a795b"}};function eI(e){var t,a,b,y,x,v,I,C,_;let{selfSeed:D="you",variant:z="default",roomId:F=null,roomTitle:W=null,sponsorName:H,sponsorOffer:O=null,sponsorHref:q=null,sponsorCampaignId:G=null,sponsorAction:J=null,sponsorEyebrow:L="Sponsor",roomsHref:B="/labs/spatial
1-soak",backHref:U=null,backLabel:$="Leave",stageId:ee=null,stageHost:et=!1,worldSlug:ea=null,worldName:en=null,worldSponsorName:eg=null,worldSponsorOffer:ew=null,worldSponsorHref:ex=null,worldSponsorCampaignId:eI=null,joinTubId:eC=null,isMember:e_=!1,livingPresence:eR=!1,topicScene:eE=null,rustWorldSlug:eY=null}=e,eN=!!ee,eD=(0,o.useRef)(null),[ez,eF]=(0,o.useState)(e_?"joined":"idle"),[eW,eH]=(0,o.useState)(!1),[eO,eq]=(0,o.useState)(!!e_);async function eG(){if(eC&&"joining"!==ez&&"joined"!==ez){eF("joining");try{let e=await fetch("/api/tubs/".concat(eC,"/join"),{method:"POST",headers:{"content-type":"application/json"},body:"{}"});if(401===e.status){let e=window.location.pathname+window.location.search;window.location.assign("/login?next=".concat(encodeURIComponent(e)));return}let t=await e.json().catch(()=>({}));if(!e.ok)return void eF("error");eF("pending"===t.status?"pending":"joined")}catch(e){eF("error")}}}(0,o.useEffect)(()=>{"joined"===ez&&eH(!0)},[ez]);let[eJ,eL]=(0,o.useState)(null),[eB,eU]=(0,o.useState)(!1),eV=(0,o.useRef)(null),e$=(0,o.useRef)(0),eK=(0,o.useRef)(null),[eQ,eX]=(0,o.useState)("connecting"),[eZ,e0]=(0,o.useState)(null),[e1,e2]=(0,o.useState)(null),[e5,e4]=(0,o.useState)(null),[e3,e6]=(0,o.useState)(null),[e8,e7]=(0,o.useState)(null),[e9,te]=(0,o.useState)(null),[tt,ta]=(0,o.useState)(en),[tn,to]=(0,o.useState)([]),[tr,ti]=(0,o.useState)([]),[tl,ts]=(0,o.useState)(0),td=(0,o.useRef)(0),tc=(0,o.useRef)([]),th=(0,o.useRef)({value:0,dir:0,pending:0}),tu=(0,o.useCallback)(e=>{let t=tr.length;if(t<=1)return;let a=(e%t+t)%t;(a!==td.current||0!==th.current.dir)&&(ts(a),th.current.pending=a,th.current.dir=1)},[tr.length]),[tf,tp]=(0,o.useState)(!1),[tm,tg]=(0,o.useState)(!1);async function tw(e,t){var a;await (null==(a=eK.current)?void 0:a.act(e,t))}(0,o.useEffect)(()=>{if(!ea)return;let e=new R({slug:ea,onStatus:e=>eX(e),onState:(e,t)=>{if(eV.current=e,e2(e.kind),"fishing"===e.kind)e0(e.fish);else if("gallery"===e.kind){var a,n,o;e6(e.items.length),e4(e.theme);let t=e.items.find(t=>t.id===e.featuredId);e7(null!=(a=null==t?void 0:t.title)?a:null);let r=E(e.items),i=r.map(e=>({name:e.name,count:e.items.length}));ti(i),tc.current=i,td.current>=r.length&&(td.current=0,ts(0));let l=null!=(n=e.cast)?n:{};ar.current=l,ao(l),ai.current=null!=(o=e.readAlong)?o:null}ta(e=>null!=e?e:t.name)},onEvents:e=>{for(let t of e)"stock"===t.kind&&(e$.current+=1);to(t=>[...e].reverse().map(e=>({id:e.id,summary:e.summary})).concat(t).slice(0,6))},onPresence:e=>te(e)});return eK.current=e,e.start(),()=>{e.stop(),eK.current=null,eV.current=null}},[ea,en]),(0,o.useEffect)(()=>{if(!eI)return;let e="/api/sponsor/impression/".concat(encodeURIComponent(eI));try{"undefined"!=typeof navigator&&navigator.sendBeacon?navigator.sendBeacon(e):fetch(e,{method:"POST",keepalive:!0}).catch(()=>{})}catch(e){}},[eI]),(0,o.useEffect)(()=>{if(!G)return;let e="/api/sponsor/impression/".concat(encodeURIComponent(G));try{"undefined"!=typeof navigator&&navigator.sendBeacon?navigator.sendBeacon(e):fetch(e,{method:"POST",keepalive:!0}).catch(()=>{})}catch(e){}},[G]),(0,o.useEffect)(()=>{if(!(null==F?void 0:F.startsWith("soak-")))return;let e=F.slice(5),t="/api/soaks/".concat(encodeURIComponent(e),"/presence"),a=eN?["spatial","stage"]:["spatial"],n=!1,o=e=>{n&&"away"!==e||fetch(t,{method:"POST",headers:{"content-type":"application/json",...(0,d.l)()},body:JSON.stringify({surface:"webxr",realityMode:"virtual",state:e,capabilities:a}),keepalive:"away"===e}).catch(()=>{})};o("in_world");let r=window.setInterval(()=>o("in_world"),5e3);return()=>{n=!0,window.clearInterval(r),o("away")}},[F,eN]);let tb=(0,o.useRef)(null),[ty,tx]=(0,o.useState)(!1),[tv,tM]=(0,o.useState)(!1),tk=(0,o.useRef)(null);function tS(){tx(!1),tM(!0),tk.current&&(clearTimeout(tk.current),tk.current=null)}(0,o.useEffect)(()=>()=>{tk.current&&clearTimeout(tk.current)},[]);let[tI,tP]=(0,o.useState)(!1),[tT,tC]=(0,o.useState)(!1),tj=tI||tT;(0,o.useEffect)(()=>{let e=()=>{let e=document;tP(!!(e.fullscreenElement||e.webkitFullscreenElement))};return document.addEventListener("fullscreenchange",e),document.addEventListener("webkitfullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e),document.removeEventListener("webkitfullscreenchange",e)}},[]),(0,o.useEffect)(()=>
1{if(!tT)return;let e=document.body.style.overflow;document.body.style.overflow="hidden";let t=e=>{"Escape"===e.key&&tC(!1)};return window.addEventListener("keydown",t),()=>{document.body.style.overflow=e,window.removeEventListener("keydown",t)}},[tT]);let[t_,tA]=(0,o.useState)(!1),[tR,tE]=(0,o.useState)(!1),[tY,tN]=(0,o.useState)(!1),[tD,tz]=(0,o.useState)(!1),[tF,tW]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=window.matchMedia("(orientation: portrait)"),t=window.matchMedia("(max-width: 820px), (pointer: coarse)"),a=window.matchMedia("(prefers-reduced-motion: reduce)"),n=()=>{tA(e.matches),tE(t.matches),tN(a.matches)};n();let o=()=>{tA(e.matches),tG(!1),tz(!0)};return e.addEventListener("change",o),t.addEventListener("change",n),a.addEventListener("change",n),()=>{e.removeEventListener("change",o),t.removeEventListener("change",n),a.removeEventListener("change",n)}},[]);let tH=tR&&t_&&!tD,tO=!tR&&!tT&&!tF&&!tY,[tq,tG]=(0,o.useState)(!0);(0,o.useEffect)(()=>{tG(!window.matchMedia("(max-width: 640px), (pointer: coarse)").matches)},[]);let[tJ,tL]=(0,o.useState)(!0),[tB,tU]=(0,o.useState)(()=>(0,c.i$)(D)),[tV,t$]=(0,o.useState)(!1),tK=(0,o.useRef)(!0),tQ=(0,o.useRef)(tB),tX=(0,o.useRef)(null);(0,o.useEffect)(()=>{var e;tK.current=tJ,tQ.current=tB,null==(e=tX.current)||e.call(tX),(0,c.l9)(tB)},[tJ,tB]);let tZ=(0,o.useRef)(null),t0=(0,o.useRef)(null),t1=(0,o.useRef)(!1),[t2,t5]=(0,o.useState)(!1),t4=(0,o.useRef)(null),[t3,t6]=(0,o.useState)(null),[t8,t7]=(0,o.useState)("hidden"),t9=(0,o.useRef)("hidden"),ae=e=>{t9.current=e,t7(e)},at=(0,o.useRef)(null),aa=(0,o.useRef)("auto"),[an,ao]=(0,o.useState)({}),ar=(0,o.useRef)({}),ai=(0,o.useRef)(null),al=(0,o.useRef)(null),[as,ad]=(0,o.useState)(null),[ac,ah]=(0,o.useState)(null),[au,af]=(0,o.useState)(!1),[ap,am]=(0,o.useState)(!1);function ag(){let e=t4.current;if(!e)return;let t=!e.motionOn();e.setMotion(t),t6(t);try{localStorage.setItem("hottub:wonderland-motion",t?"on":"off")}catch(e){}}function aw(){var e,t,a,n;let o=!t2;t5(o),t1.current=o;let i=tZ.current;if(i){let e=r.UtX.getContext();"suspended"===e.state&&e.resume(),o?i.buffer&&!i.isPlaying&&i.play():i.isPlaying&&i.pause();return}if(o){if(!t0.current)if(ea===Y)t0.current=(0,S.Tu)(null!=(t=null==(e=tc.current[td.current])?void 0:e.name)?t:"");else{let e=(null==(a=eV.current)?void 0:a.kind)==="gallery"?"gallery":"soak";t0.current=(0,S.zq)(e)}t0.current.start()}else null==(n=t0.current)||n.stop()}let ab=(0,o.useRef)(null),ay=(0,o.useRef)([]),ax=(0,o.useRef)(null),av=(0,o.useRef)([]),aM=(0,o.useRef)([]),ak=(0,o.useRef)("");ak.current||(ak.current=(null!=(_=null==(C=globalThis.crypto)||null==(I=C.randomUUID)?void 0:I.call(C))?_:"visit-".concat(Math.random().toString(36).slice(2),"-").concat(Date.now())).replace(/[^a-zA-Z0-9_-]/g,"_"));let aS=(0,o.useRef)(!1),[aI,aP]=(0,o.useState)("idle"),[aT,aC]=(0,o.useState)(0),[aj,a_]=(0,o.useState)([]),[aA,aR]=(0,o.useState)(!1),aE=(0,o.useRef)(!1),aY=(0,o.useRef)(0),[aN,aD]=(0,o.useState)(!1);function az(){let e=new Map(ay.current.map(e=>[e.id,e])),t=av.current.map(t=>({...t,voiceId:e.has(t.id)?t.id:null})),a=new Set(t.map(e=>e.id));for(let e of ay.current)a.has(e.id)||t.push({id:e.id,name:e.name,avatarColor:null,voiceId:e.id});aM.current=t}async function aF(){if(ab.current)return;let e=new T.VoiceMesh({roomId:null!=F?F:"vr:".concat(z),displayName:D,peerId:eY?ak.current:void 0,onState:aP,onPeers:e=>{ay.current=e,az(),aC(e.length),a_(e)}});ab.current=e,aS.current=!0,aR(!1),aE.current=!1,await e.start(),eR&&e.setRoomAcoustics((0,m.roomAcousticsFor)(eE))}async function aW(){let e=ab.current;ab.current=null,aS.current=!1,ay.current=[],az(),aC(0),a_([]),aP("idle"),await (null==e?void 0:e.stop())}function aH(){var e;let t=!aA;aR(t),aE.current=t,null==(e=ab.current)||e.setMuted(t)}(0,o.useEffect)(()=>{if(!eY)return;let e=new k({worldSlug:eY,visitId:ak.current,onPeers:e=>{av.current=e,az()}});return ax.current=e,e.start(),()=>{ax.current===e&&(ax.current=null),av.current=[],az(),e.stop()}},[eY]);let aO=(0,o.useRef)("idle"),aq=(0,o.useRef)({mic:()=>{},ambient:()=>{},motion:()=>{},ember:()=>{},sponsor:()=>{},spotlight:()=>{},hall:()=>{}});aq.current={mic:()=>{aS.current?aH():aF()},ambient:()=>aw(),motion:()=>ag(),hall:()=>tu(td.current+1),ember:e=>void aU(e),spotlight:e=>void tw("feature",{itemId:e}),sponsor:()=>{if(J)if(J.endpoint){if("doing"===aO.current||"done"===aO.current)return;aO.current="doing",fetch(J.endpoint,{method:"POST",headers:{"content-type":"application/json"},body:"{}"}).then(e=>{aO.current=e.ok?"done":"error"}).catch(()=>{aO.current="error"})}else J.href&&(window.location.href=J.href)}};let aG=(0,o.useRef)(!1),aJ=(0,o.useRef)(0);(0,o.useEffect)(()=>{aT>aY.current&&(aY.current=aT)},[aT]);let[aL,aB]=(0,o.useState)({});async function aU(e){if(e&&"sending"!==aL[e]&&"embered"!==aL[e]){aB(t=>({...t,[e]:"sending"}));try{let t=await fetch("/api/xr/ember",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e})});aB(a=>({...a,[e]:t.ok?"embered":"error"}))}catch(t){aB(t=>({...t,[e]:"error"}))}}}let aV=(0,o.useRef)(null),a$=(0,o.useRef)({openMics:[],hands:[],audience:0}),aK=(0,o.useRef)(!1),[aQ,aX]=(0,o.useState)("idle"),[aZ,a0]=(0,o.useState)({role:"audience",canPublish:!1,handRaised:!1}),[a1,a2]=(0,o.useState)({openMics:[],hands:[],audience:0}),[a5,a4]=(0,o.useState)(!0);async function a3(){if(!ee||aV.current)return;let e=new A({stageId:ee,identity:"".concat(D,"-").concat(Math.random().toString(36).slice(2,8)),displayName:
1D,asHost:et,onState:aX,onSelf:a0,onStage:e=>{a$.current=e,a2(e)}});aV.current=e,aK.current=!0,a4(!0),await e.start()}async function a6(){let e=aV.current;aV.current=null,aK.current=!1,a$.current={openMics:[],hands:[],audience:0},aX("idle"),await (null==e?void 0:e.stop())}(0,o.useEffect)(()=>()=>{var e,t;null==(e=ab.current)||e.stop(),ab.current=null,null==(t=aV.current)||t.stop(),aV.current=null},[]),(0,o.useEffect)(()=>{var e,t,a;let n=eD.current;if(!n)return;let o=!!eY;tg(!1),tp(!1);let d=null!=(t=eS[z])?t:eS.default,m=eR&&(a=eE)?u[a]:null,b=m?{...d,bg:m.bg,floor:m.floor,water:m.water,light:m.light,hemiGround:m.hemiGround,tubWall:m.tubWall,rim:m.rim,seatColor:m.seatColor}:d,y=P[z],x=navigator.xr;(null==x?void 0:x.isSessionSupported)?x.isSessionSupported("immersive-vr").then(eL).catch(()=>eL(!1)):eL(!1);let v=n.clientWidth||window.innerWidth,k=n.clientHeight||window.innerHeight,I=(0,w.uw)({host:n,width:v,height:k,onContextLost:()=>eU(!0)});if(!I)return void eU(!0);let T=i.Z.createButton(I);T.style.display="none",T.style.visibility="hidden",T.style.pointerEvents="none",n.appendChild(T),tb.current=T;let C=new r.Z58;C.background=new r.Q1f(y?y.skyColor:b.bg),C.fog=y?new r.jUj(y.skyColor,34,95):new r.jUj(b.bg,b.fogNear,b.fogFar);let _=new r.ubm(60,v/k,.1,100);_.position.set(0,1.6,4.2);let A=new l.N(_,I.domElement);A.target.set(0,1.05,0),A.enablePan=!1,A.minDistance=1.8,A.maxDistance=9,A.maxPolarAngle=Math.PI/1.9,A.mouseButtons.RIGHT=r.kBv.ROTATE,A.update();let R=new r.dth(0xffffff,b.hemiGround,1);C.add(R);let D=new r.ZyN(new r.Q1f(b.light),.95);D.position.set(3,6,4),C.add(D);let F=[],W=[],q=e=>(F.push({geometry:e.geometry,material:e.material}),e);o||C.add(q(new r.eaF(new r.tcD(y?y.radius-.5:16,64),new r._4j({color:y?y.groundColor:b.floor,roughness:1}))).rotateX(-Math.PI/2));let G=b.tubR,L=q(new r.eaF(new r.Ho_(G,G,.7,48,1,!0),new r._4j({color:b.tubWall,roughness:.8,side:r.$EB})));L.position.y=.35,C.add(L);let B=q(new r.eaF(new r.O3Y(G,.08,16,48),new r._4j({color:b.rim,roughness:.7})));B.rotation.x=Math.PI/2,B.position.y=.7,C.add(B);let U=q(new r.eaF(new r.tcD(G-.08,48),new r._4j({color:b.water,transparent:!0,opacity:.72,roughness:.2,metalness:.1})));U.rotation.x=-Math.PI/2,U.position.y=.62,C.add(U);let $=new r.YJl;$.visible=!1,C.add($);let ee=new r.Gu$(.05,10,8),et=new r.qFE(.04,.08,6),en=["#cdd9e0","#b9c7cf","#a7b7bf","#d8c9a6"].map(e=>new r._4j({color:e,roughness:.5,metalness:.2}));F.push({geometry:ee},{geometry:et}),en.forEach(e=>F.push({material:e}));let ex=[];for(let e=0;e<14;e++){let t=en[e%en.length],a=new r.eaF(ee,t);a.scale.set(1.7,.7,.95);let n=new r.eaF(et,t);n.rotation.z=Math.PI/2,n.position.x=-.07;let o=new r.YJl;o.add(a),o.add(n),o.visible=!1,o.scale.setScalar(.001),$.add(o),ex.push({mesh:o,active:!1,angle:Math.random()*Math.PI*2,radius:.18+.6*G*Math.random(),depth:.06+.12*Math.random(),speed:(.3+.4*Math.random())*(.5>Math.random()?1:-1),wob:1+2*Math.random(),scale:0})}let eI=new r.rKP(.02,.05,20);F.push({geometry:eI});let eT=[];for(let e=0;e<20;e++){let e=new r.V9B({color:"#eaf3f5",transparent:!0,opacity:0,side:r.$EB}),t=new r.eaF(eI,e);t.rotation.x=-Math.PI/2,t.position.y=.623,t.visible=!1,t.renderOrder=3,F.push({material:e}),$.add(t),eT.push({mesh:t,age:0,life:1,active:!1})}let eC=(e,t)=>{let a=eT.find(e=>!e.active);a&&(a.active=!0,a.age=0,a.life=1.1+.6*Math.random(),a.mesh.position.set(e,.623,t),a.mesh.visible=!0)},e_=new r.YJl;e_.visible=!1,C.add(e_);let ez=new r.Ho_(.42,.42,.06,48),eF=new r.bdM(.95,.95),eW=new r.bdM(1.06,1.06),eH=new r.bdM(1.14,1.14),eO=new r.Ho_(.16,.22,1.05,18),eq=new r._4j({color:"#9a8f73",metalness:.7,roughness:.4}),eG=new r._4j({color:"#d8d0bd",roughness:.7}),eJ=new r._4j({color:"#2e2a22",metalness:.1,roughness:.6});F.push({geometry:ez},{geometry:eF},{geometry:eW},{geometry:eH},{geometry:eO},{material:eq},{material:eG},{material:eJ});let eB=new r.HiM(0xffe6b8,0,8,2);eB.position.set(0,3.4,0),C.add(eB);let eK=new r.YJl;eK.visible=!1,C.add(eK);let eQ=null,eX=null,eZ=null,e0=4.2,e1=[],e2=[],e5=[];{let e=G+4.9,t=e+.5,a=3.9+.6*t,n=new r._4j({color:"#e3dac6",roughness:.9,metalness:.02,side:r.hsX}),o=new r._4j({color:"#ded5c0",roughness:.72,metalness:.03}),i=new r._4j({color:"#caa247",roughness:.35,metalness:.78}),l=new r._4j({color:"#ece6d8",roughness:.4,metalness:.05}),s=new r._4j({color:"#d8ccae",roughness:.96,metalness:0,side:r.hsX}),d=new r.V9B({color:"#fff3d6"});F.push({material:n},{material:o},{material:i}
1,{material:l},{material:s},{material:d});let c=new r.tcD(t-.05,64),h=new r.eaF(c,l);h.rotation.x=-Math.PI/2,h.position.y=.012,eK.add(h);let u=new r.Ho_(t,t,3.9,64,1,!0),f=new r.eaF(u,n);f.position.y=1.95,eK.add(f);let p=new r.O3Y(t-.02,.08,12,64),m=new r.eaF(p,i);m.rotation.x=Math.PI/2,m.position.y=3.9,eK.add(m);let g=new r.Gu$(t,40,18,0,2*Math.PI,0,Math.PI/2),w=new r.eaF(g,s);w.position.y=3.9,w.scale.y=.6,eK.add(w);let b=new r.tcD(.95,32),y=new r.eaF(b,d);y.rotation.x=Math.PI/2,y.position.y=a-.06,eK.add(y),F.push({geometry:c},{geometry:u},{geometry:p},{geometry:g},{geometry:b});let x=new r.Ho_(.2,.24,3.4,16),v=new r.Ho_(.3,.34,.22,16),M=new r.Ho_(.3,.24,.22,16);F.push({geometry:x},{geometry:v},{geometry:M});for(let t=0;t<12;t++){let a=t/12*Math.PI*2,n=Math.cos(a)*e,l=Math.sin(a)*e,s=new r.eaF(x,o);s.position.set(n,1.92,l),eK.add(s);let d=new r.eaF(v,o);d.position.set(n,.11,l),eK.add(d);let c=new r.eaF(M,i);c.position.set(n,3.51,l),eK.add(c)}let k=new r.nCl(0xffe9c4,0,24,Math.PI/5,.5,1.2);k.position.set(0,a-.1,0),k.target.position.set(0,.6,0),eK.add(k),eK.add(k.target);let S=new r.HiM(0xffe1b0,0,28,1.6);S.position.set(0,3.5,0),eK.add(S),eQ=k,eX=S,e0=.72*a;let I=new Float32Array(210);for(let e=0;e<70;e++){let a=Math.random()*Math.PI*2,n=.72*t*Math.random(),o=Math.cos(a)*n,r=Math.sin(a)*n,i=.4+Math.random()*e0;I[3*e]=o,I[3*e+1]=i,I[3*e+2]=r,e1.push(o,r),e2.push(.05+.11*Math.random()),e5.push(Math.random()*Math.PI*2)}let P=new r.LoY;P.setAttribute("position",new r.THS(I,3));let T=document.createElement("canvas");T.width=T.height=32;let C=T.getContext("2d"),j=C.createRadialGradient(16,16,0,16,16,16);j.addColorStop(0,"rgba(255,244,222,1)"),j.addColorStop(1,"rgba(255,244,222,0)"),C.fillStyle=j,C.fillRect(0,0,32,32);let _=new r.GOR(T),A=new r.BH$({size:.07,map:_,transparent:!0,opacity:.4,depthWrite:!1,blending:r.EZo,sizeAttenuation:!0}),R=new r.ONl(P,A);R.renderOrder=3,eK.add(R),eZ=R,F.push({geometry:P,material:A}),W.push(_)}let e4=!1,e3=ea===Y,e6=null,e8=-1,e7=null,e9=null,te=null,tt=-1,ta=null,tn="auto",to=()=>{var e;ta&&(clearTimeout(ta),ta=null),te=null,tt=-1,null==e6||e6.faceSpeaker(null),null==e6||e6.releasePlate(),e9&&(e9.pause(),e9=null),ae(e6&&K(null!=(e=e6.hallName())?e:"")?"idle":"hidden")},tr=()=>{if(ta=null,!e6||!te)return;tt++;let e=te.cues[tt];if(!e)return void to();e6.faceSpeaker(e.characterId);let t=e6.speak(e.characterId,e.line);if("the-king-in-court"===e.characterId&&t1.current&&(0,S.hJ)("gavel"),"read"===tn)return void e6.holdPlate();let a=t?Math.min(9e3,2400+45*t.text.length):1200;if(null==t?void 0:t.audio){e9&&e9.pause();let e=new window.Audio(t.audio);e9=e;let n=!1,o=()=>{n||null===te||(n=!0,ta=setTimeout(tr,700))};e.addEventListener("ended",o),e.play().catch(()=>o()),ta=setTimeout(o,a+5e3)}else ta=setTimeout(tr,a)};at.current={toggle:()=>{if(ai.current)return void tw("readAlong",{idx:-1,completed:!1});(e=>{var t;if(te)return to();let a=e6?K(null!=(t=e6.hallName())?t:""):null;a&&(tn=e,aa.current=e,te=a,tt=-1,ae("playing"),tr())})("auto")},readAlong:()=>{af(!0),tw("readAlong",{idx:0})},next:()=>{var e;let t=ai.current;if(!t){te&&"read"===tn&&tr();return}let a=e6?K(null!=(e=e6.hallName())?e:""):null,n=t.idx+1;tw("readAlong",a&&n>=a.cues.length?{idx:-1,completed:!0}:{idx:n})}};let ti=(e,t)=>{te&&to();let a=e.speak(t);a&&"the-king-in-court"===t&&t1.current&&(0,S.hJ)("gavel"),(null==a?void 0:a.audio)&&(e9&&(e9.pause(),e9=null),(e9=new window.Audio(a.audio)).play().catch(()=>{}))},tl=e=>"coin"===e||"stamp"===e,ts=[],tu=null,tf="",tm=null,ty=[],tx=(e,t,a,n)=>{let o=/^https?:\/\//.test(t)||t.startsWith("/")?t:"/xr/exhibits/".concat(e,"/").concat(t),i=new r.Tap;i.setCrossOrigin("anonymous"),t5++;let l=()=>{t5=Math.max(0,t5-1),t7()};i.load(o,e=>{if(tB){e.dispose(),l();return}e.colorSpace=r.er$,e.anisotropy=8,a.map=e,a.needsUpdate=!0,n.push(e),l()},void 0,()=>{l()})};function tv(e,t,a){let n=[],o=[],i=new r.YJl;if(tl(t)){var l,s;let d=ej(e,t,"front");n.push(d);let c=ej(e,t,"back");n.push(c);let h=new r._4j({metalness:.6,roughness:.45,map:d}),u=new r._4j({metalness:.6,roughness:.45,map:c});e.image&&tx(t,e.image,h,n),(null!=(l=e.reverse)?l:e.image)&&tx(t,null!=(s=e.reverse)?s:e.image,u,n);let f=new r.eaF(ez,[eq,h,u]);return f.rotation.x=Math.PI/2,f.scale.setScalar(a),i.add(f),{id:e.id,obj:i,mats:[h,u],tex:n,extras:o,nodes:[i]}}let d=ej(e,t,"front");n.push(d);let c=new r.V9B({map:d,side:r.$EB});e.image&&tx(t,e.image,c,n);let h=new r.eaF(eH,eJ);h.position.z=-.02;let u=new r.eaF(eW,eJ),f=new r.eaF(eF,c);f.position.z=.01;let p=new r.YJl;return p.add(h),p.add(u),p.add(f),p.scale.setScalar(a),i.add(p),{id:e.id,obj:i,mats:[c],tex:n,extras:o,nodes:[i]}}function tM(e){for(let t of e.nodes)e_.remove(t);for(let t of e.mats)t.dispose();for(let t of e.tex)t.dispose();for(let t of e.extras)t.dispose()}let tk=new Map,tS=e=>{let t=tk.get(e);return t||(t=new r.Q1f(/^#[0-9a-f]{6}$/i.test(e)?e:(0,s.XH)(e)),tk.set(e,t)),t},tI=["you","ari","sam","noor","kit","rio"],tP=G+1.1,tT=new r.YJl,tC=[];for(let e=0;e<b.seats;e++){let t=e/b.seats*Math.PI*2,a=Math.cos(t)*tP,n=Math.sin(t)*tP,o=q(new r.eaF(new r.Ho_(.34,.34,.45,24),new r._4j({color:b.seatColor,roughness:1})));if(o.position.set(a,.225,n),C.add(o),0!==e){let t=q(new r.eaF(new r.Gu$(.26,24,24),new r._4j({color:tS(tI[e
1%tI.length]),roughness:.5})));t.position.set(a,.95,n),t.lookAt(0,.95,0),tT.add(t);let o=q(new r.eaF(new r.Gu$(.27,24,24),new r._4j({color:0xffffff,roughness:.45})));o.position.set(a,.95,n),o.visible=!1,C.add(o),tC.push({x:a,z:n,orb:o,lvl:0})}}C.add(tT);let tj=null;m&&(tj=function(e){var t;let{kind:a,radius:n}=e,o=null!=(t=e.count)?t:8,i=new r.Q1f(e.accent),l=new r.YJl,s=new r.eaF(new r.Gu$(.7,16,12),new r.V9B({color:i.clone().offsetHSL(0,-.08,.22),transparent:!0,opacity:.16,blending:r.EZo,depthWrite:!1}));s.position.y=1.7,l.add(s);for(let e=0;e<o;e++){let t=e/o*Math.PI*2,s=function(e,t){let a=new r.YJl;switch(e){case"lanterns":{let e=new r.eaF(new r.Ho_(.02,.02,2.2,6),f(2761504));e.position.y=1.1;let n=new r.eaF(new r.Gu$(.12,14,12),p(t,1.15));n.position.y=2.15,a.add(e,n);break}case"foliage":{let e=new r.eaF(new r.Ho_(.07,.09,.6,6),f(7031343));e.position.y=.3;let n=new r.eaF(new r.qFE(.5,1.4,9),f(t.getHex()));n.position.y=1.2,a.add(e,n);break}case"pylons":{let e=new r.eaF(new r.iNn(.1,2.6,.1),p(t,1.25));e.position.y=1.3,a.add(e);break}case"beacons":{let e=new r.eaF(new r.Ho_(.05,.06,3,6),f(0x9aa0a4));e.position.y=1.5;let n=new r.eaF(new r.iNn(.34,.16,.12),p(t,1));n.position.y=3,a.add(e,n);break}case"buoys":{let e=new r.eaF(new r.Gu$(.18,14,12),p(t,.7));e.position.y=.2;let n=new r.eaF(new r.qFE(.1,.16,8),f(t.getHex()));n.position.y=.42,a.add(e,n)}}return a}(a,i);s.position.set(Math.cos(t)*n,0,Math.sin(t)*n),l.add(s)}return l}({kind:m.decor,accent:m.accent,radius:tP+1.7,count:b.seats+2}),C.add(tj));let t_=null,tA=+tP,tR=0*tP,tE=()=>{t_&&(C.remove(t_),(0,c.Vr)(t_),t_=null),tK.current&&((t_=(0,c.KV)(tQ.current,eR?{speaking:!0}:void 0)).position.set(tA,.45,tR),t_.lookAt(0,.45,0),C.add(t_))};tX.current=tE,tE();let tY=new r.Pq0,tN=new r.Pq0,tD=window.matchMedia("(prefers-reduced-motion: reduce)").matches,tz=new r.Gu$(.6,16,12),tF=new r.V9B({color:e3?"#241a12":"#ece6d8",transparent:!0,opacity:0,side:r.hsX,depthTest:!1,depthWrite:!1}),tW=new r.eaF(tz,tF);tW.renderOrder=9999,tW.visible=!1,C.add(tW),F.push({geometry:tz,material:tF});let tH=[],tO=new r.YJl;if(e3&&!tD){let e=(e,t,a,n,o,i)=>{let l=new r.V9B({color:t,transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}),s=new r.eaF(e,l);s.position.set(a,n,o),s.renderOrder=1e4,tO.add(s),tH.push({mesh:s,mat:l,speed:i}),F.push({geometry:e,material:l})};e(new r.iNn(.22,.012,.07),"#5a4630",.3,-.4,-.18,.55),e(new r.iNn(.26,.012,.07),"#4e3c2a",-.32,-.7,.1,.42),e(new r.iNn(.18,.012,.06),"#63503a",.05,-1,.33,.5),e(new r.Ho_(.022,.022,.05,10),"#c98a3b",.27,-.34,-.16,.55),e(new r.Ho_(.026,.026,.06,10),"#b3772f",-.29,-.62,.12,.42),e(new r.Ho_(.02,.02,.045,10),"#d29a4a",.07,-.93,.3,.5),tO.visible=!1,C.add(tO)}let tq=[];if(eN){let e=q(new r.eaF(new r.Ho_(3.2,3.4,.5,32),new r._4j({color:"#2a2336",roughness:.9})));e.position.set(0,.25,-6),C.add(e);for(let e=0;e<j.TM;e++){let t=(e-(j.TM-1)/2)*.7,a=q(new r.eaF(new r.Gu$(.3,24,24),new r._4j({color:0xffffff,roughness:.4})));a.position.set(t,.95,-6),a.visible=!1,C.add(a),tq.push(a)}}!o&&y?function(e,t,a,n,o){let i=new r.Tap,l=t.radius,s=t.topY-t.bottomY,d=(t.topY+t.bottomY)/2,c=Math.PI/180;for(let h of t.panels){let t=i.load(h.tex);t.colorSpace=r.er$,t.anisotropy=o,t.wrapS=r.GJx,t.repeat.x=-1,t.offset.x=1,n.push(t);let u=h.arcDeg*c,f=Math.PI+h.centerDeg*c-u/2,p=a(new r.eaF(new r.Ho_(l,l,s,48,1,!0,f,u),new r.V9B({map:t,side:r.hsX})));p.position.y=d,e.add(p)}let h=new r._4j({color:"#3b2c1c",roughness:1});for(let n of t.panels){let t=Math.PI+(n.centerDeg-n.arcDeg/2)*c,o=l-7,i=a(new r.eaF(new r.Ho_(.18,.3,16,8),h));i.position.set(Math.sin(t)*o,8,Math.cos(t)*o),e.add(i)}}(C,y,q,W,I.capabilities.getMaxAnisotropy()):o||function(e,t,a){if("forest"===t){let t=new r._4j({color:"#6b4a2b",roughness:1}),n=new r._4j({color:"#3f6b3a",roughness:1});for(let o=0;o<14;o++){let i=o/14*Math.PI*2+o%2*.2,l=7+o%3,s=Math.cos(i)*l,d=Math.sin(i)*l,c=a(new r.eaF(new r.Ho_(.22,.3,2.4,8),t));c.position.set(s,1.2,d),e.add(c);let h=a(new r.eaF(new r.qFE(1.1,2.6,10),n));h.position.set(s,3.2,d),e.add(h)}}else if("beach"===t){let t=a(new r.eaF(new r.bdM(60,30),new r._4j({color:"#3aa6c9",roughness:.3,metalness:.1,transparent:!0,opacity:.9})));for(let n of(t.rotation.x=-Math.PI/2,t.position.set(0,.02,-16),e.add(t),[-7,8])){let t=a(new r.eaF(new r.Ho_(.16,.22,3.2,8),new r._4j({color:"#8a6b45",roughness:1})));t.position.set(n,1.6,-3),t.rotation.z=n<0?.12:-.12,e.add(t);let o=a(new r.eaF(new r.Gu$(1,10,8),new r._4j({color:"#4f7d3f",roughness:1})));o.position.set(n,3.3,-3),o.scale.set(1.4,.5,1.4),e.add(o)}}else if("glacier"===t){let t=new r._4j({color:"#bfe0ef",roughness:.2,metalness:.05,transparent:!0,opacity:.9});for(let n=0;n<10;
1n++){let o=n/10*Math.PI*2,i=7+n%3*1.2,l=a(new r.eaF(new r.WBB(1+n%3*.5,0),t));l.position.set(Math.cos(o)*i,.6+n%3*.4,Math.sin(o)*i),l.rotation.set(Math.random(),Math.random(),Math.random()),e.add(l)}for(let t of[-10,0,11]){let n=a(new r.eaF(new r.qFE(4,7,4),new r._4j({color:"#eaf3fa",roughness:1})));n.position.set(t,3,-18),e.add(n)}}else if("wolftrail"===t){let t=new r._4j({color:"#5b4128",roughness:1}),n=new r._4j({color:"#33543a",roughness:1}),o=new r._4j({color:"#5f7a3f",roughness:1}),i=a(new r.eaF(new r.bdM(140,44),new r._4j({color:"#9fb6c0",roughness:.35,metalness:.1})));i.rotation.x=-Math.PI/2,i.position.set(0,-.5,-36),e.add(i);for(let t=0;t<8;t++){let n=a(new r.eaF(new r.qFE(7+t%3*2.2,6+t%2*3.5,5),new r._4j({color:"#7d93a3",roughness:1})));n.position.set(-34+10*t,2.2,-50+t%2*4),e.add(n)}for(let o=0;o<26;o++){let i=o/26*Math.PI*2;if(-.55>Math.sin(i))continue;let l=6.5+o%4*1.4,s=Math.cos(i)*l,d=Math.sin(i)*l,c=7+o%5,h=a(new r.eaF(new r.Ho_(.14,.26,c,8),t));h.position.set(s,c/2,d),e.add(h);for(let t=0;t<3;t++){let o=a(new r.eaF(new r.qFE(1.4-.3*t,2,9),n));o.position.set(s,c-1-1.3*t,d),e.add(o)}}for(let t=0;t<18;t++){let n=t/18*Math.PI*2+t%3*.4,i=3+t%5*.9,l=a(new r.eaF(new r.Gu$(.4+t%3*.18,8,6),o));l.position.set(Math.cos(n)*i,.28,Math.sin(n)*i),l.scale.y=.6,e.add(l)}let l=new r._4j({color:"#a89a86",roughness:1}),s=a(new r.eaF(new r.iNn(1.8,.12,.42),l));for(let t of(s.position.set(3,.46,.7),e.add(s),[-.7,.7])){let n=a(new r.eaF(new r.iNn(.12,.46,.4),l));n.position.set(3+t,.23,.7),e.add(n)}}else if("subtub"===t){let t=a(new r.eaF(new r.O3Y(4.6,.06,12,64),new r._4j({color:"#1b8a9e",transparent:!0,opacity:.35})));t.rotation.x=Math.PI/2,t.position.y=.04,e.add(t);let n=a(new r.eaF(new r.Gu$(5.4,32,16,0,2*Math.PI,0,Math.PI/2),new r._4j({color:"#ffd9c2",transparent:!0,opacity:.12,side:r.hsX})));e.add(n)}}(C,z,q);let tJ=null;!o&&!y&&["wolftrail","forest","beach"].includes(z)&&(tJ=function(e,t,a,n){let o=function(){let e=document.createElement("canvas");e.width=512,e.height=512;let t=e.getContext("2d"),a=t.createRadialGradient(256,256,150,256,256,256);a.addColorStop(0,"rgba(242,109,74,0.34)"),a.addColorStop(.6,"rgba(242,109,74,0.16)"),a.addColorStop(1,"rgba(242,109,74,0)"),t.fillStyle=a,t.fillRect(0,0,512,512);let n=t.createLinearGradient(120,120,392,392);n.addColorStop(0,eP.warm),n.addColorStop(1,eP.glow),t.fillStyle=n,t.beginPath(),t.arc(256,256,150,0,2*Math.PI),t.fill();let o=new r.GOR(e);o.colorSpace=r.er$;let i=new r.RoJ({map:o,transparent:!0,depthWrite:!1});return new r.kxk(i)}();return o.position.set(n.x,n.y,n.z),o.scale.set(n.scale,n.scale,1),e.add(o),t.push(o.material.map),a.push({material:o.material}),o}(C,W,F,{x:-6,y:10,z:-30,scale:13}));let tL=[];for(let e=0;e<14*!o;e++){let e=new r.V9B({color:0xffffff,transparent:!0,opacity:.15,depthWrite:!1}),t=q(new r.eaF(new r.Gu$(.12+.1*Math.random(),12,12),e));t.renderOrder=2;let a=Math.random()*Math.PI*2,n=.5*G*Math.random();t.position.set(Math.cos(a)*n,.7+1.4*Math.random(),Math.sin(a)*n),t.userData.speed=.15+.25*Math.random(),tL.push(t),C.add(t)}let tB=!1,tU=null,tV=new AbortController,t$=!1,t2=!1,t5=0,t3=!1,t8=!o,t7=()=>{if(!t$&&t2&&t8){if(ea){let e=eV.current;if(!e||"gallery"===e.kind&&(!t3||t5>0))return}t$=!0,tp(!0)}},an=setTimeout(()=>{t$||(t$=!0,tp(!0))},4500);eY&&M({scene:C,camera:_,slug:eY,signal:tV.signal}).then(e=>{if(tB)return void e.dispose();tU=e,t8=!0,R.intensity=0,D.intensity=0,t7()}).catch(e=>{tV.signal.aborted||(console.error("Rust world failed to open",e),tg(!0),t8=!0,t7())});let ao=null,as=g[z];if(as){ao=new r.Pf$,_.add(ao);let e=new r.fP5(ao);tZ.current=e,new r.Am1().load(as,t=>{if(!tB&&(e.setBuffer(t),e.setLoop(!0),e.setVolume(.16),t1.current&&!e.isPlaying)){let t=r.UtX.getContext();"suspended"===t.state&&t.resume(),e.play()}})}let ad=new r.zD7,ac=null,au=!1,ap="subtub"===z?null:(null==H?void 0:H.trim())||(null==eg?void 0:eg.trim())||null,am=(null==(e=(null==H?void 0:H.trim())?O:ew)?void 0:e.trim())||null,ag=!!ap;if(ap){let e=function(e,t,a){let n=document.createElement("canvas");n.width=2048,n.height=256;let o=n.getContext("2d"),i=new r.GOR(n);
1i.colorSpace=r.er$,i.anisotropy=4,i.wrapS=r.GJx,i.repeat.x=-1;let l=t=>{o.clearRect(0,0,2048,256),o.textBaseline="middle";for(let a=0;a<5;a++){let n=409.6*a+204.8;o.textAlign="center",o.lineJoin="round";let r=t?92.16:128;o.font="800 ".concat(t?88:104,"px -apple-system, system-ui, sans-serif"),o.lineWidth=11,o.strokeStyle="rgba(9,36,42,0.6)",o.strokeText(e.toUpperCase(),n,r,289.6),o.fillStyle="#ffe1b0",o.fillText(e.toUpperCase(),n,r,289.6),t&&(o.font="600 52px -apple-system, system-ui, sans-serif",o.lineWidth=7,o.strokeStyle="rgba(9,36,42,0.55)",o.strokeText(t,n,184.32,299.6),o.fillStyle="rgba(255,248,236,0.95)",o.fillText(t,n,184.32,299.6));let i=409.6*a,l=o.createLinearGradient(i-13,115,i+13,141);l.addColorStop(0,eP.warm),l.addColorStop(1,eP.glow),o.fillStyle=l,o.beginPath(),o.arc(i,128,11,0,2*Math.PI),o.fill()}i.needsUpdate=!0};l(t);let s=new r.eaF(new r.Ho_(a,a,.42,64,1,!0),new r.V9B({map:i,alphaTest:.45,side:r.hsX}));return s.position.y=.4,{mesh:s,paint:l}}(ap,am,G-.02);ac=e.paint,C.add(e.mesh),W.push(e.mesh.material.map),F.push({geometry:e.mesh.geometry,material:e.mesh.material})}let aw=function(){var e;let t=document.createElement("canvas");t.width=512,t.height=600;let a=t.getContext("2d"),n=new r.GOR(t);
1n.colorSpace=r.er$,n.anisotropy=4;let o=new Image,i=!1,l=["Mute mic"],s=0,d=(e,t)=>{l=e,s=t,a.clearRect(0,0,512,600),a.fillStyle="rgba(255,251,247,0.98)",eA(a,6,6,500,588,34),a.fill(),a.strokeStyle="rgba(242,109,74,0.5)",a.lineWidth=4,a.stroke();if(i)a.save(),a.beginPath(),a.arc(50,52,27,0,2*Math.PI),a.clip(),a.drawImage(o,23,25,54,54),a.restore();else{let e=a.createLinearGradient(23,25,77,79);e.addColorStop(0,eP.warm),e.addColorStop(1,eP.glow),a.fillStyle=e,a.beginPath(),a.arc(50,52,27,0,2*Math.PI),a.fill(),a.fillStyle="#fff",a.textAlign="center",a.textBaseline="middle",a.font="800 32px -apple-system, system-ui, sans-serif",a.fillText("H",50,53)}a.fillStyle=eP.ink,a.textAlign="left",a.textBaseline="middle",a.font="800 40px -apple-system, system-ui, sans-serif",a.fillText("Hottub",94,53);let r=Math.max(1,e.length),d=486/r;for(let n=0;n<r;n++){var c;let o=96+n*d;if(n===t){let e=a.createLinearGradient(0,o,0,o+d);e.addColorStop(0,eP.warm),e.addColorStop(1,eP.glow),a.fillStyle=e,eA(a,18,o+7,476,d-14,22),a.fill()}a.fillStyle=n===t?"#fff":eP.ink,a.font="".concat(n===t?"800":"600"," 38px -apple-system, system-ui, sans-serif"),a.textAlign="center",a.fillText(null!=(c=e[n])?c:"",256,o+d/2+4,458)}n.needsUpdate=!0};o.onload=()=>{i=!0,d(l,s)},o.src="/favicon.png",d([(e={inVoice:!1,muted:!1,ambientOn:!1}).inVoice?e.muted?"Unmute mic":"Mute mic":"Join voice",e.ambientOn?"Ambient: on":"Ambient: off","Exit VR","Close menu"],0);let c=new r.eaF(new r.bdM(.34,.4),new r.V9B({map:n,transparent:!0,side:r.$EB,depthTest:!1}));return c.renderOrder=1e3,{mesh:c,draw:d}}();aw.mesh.visible=!1,C.add(aw.mesh),W.push(aw.mesh.material.map),F.push({geometry:aw.mesh.geometry,material:aw.mesh.material});let ax="",av=new r.Pq0(0,0,1),ak=new r.Pq0,aI=new r.PTz,aP=new r.Pq0,aT=new r.Pq0,aC=new r.tBo,aj=new r.tBo,a_=new r.kn4,aA=null,aR=0,aY=!1,aN=null,az=0,aF=!1,aW=null,aH=0,aL=!1,aB=!1,aU=new Set,aV=e=>{let t=1===e.key.length?e.key.toLowerCase():e.key;["w","a","s","d","c","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Shift"].includes(t)&&(aU.add(t),t.startsWith("Arrow")&&e.preventDefault())},aQ=e=>aU.delete(1===e.key.length?e.key.toLowerCase():e.key);window.addEventListener("keydown",aV),window.addEventListener("keyup",aQ);let aX=new r.Pq0,aZ=new r.Pq0,a0=new r.Pq0(0,1,0),a1=e3?8.1:G+4.4,a2=0,a5=1,a4=1,a3=e=>{"shrink"===e?a4=a4<1?1:.16:"grow"===e&&(a4=a4>1?1:2.6)},a6=new r.tBo,a8=0,a7=0,a9=0,ne=e=>{a8=e.clientX,a7=e.clientY,a9=performance.now()},nt=e=>{if(I.xr.isPresenting||Math.hypot(e.clientX-a8,e.clientY-a7)>8||performance.now()-a9>600)return;let t=I.domElement.getBoundingClientRect();if(a6.setFromCamera(new r.I9Y((e.clientX-t.left)/t.width*2-1,-(2*((e.clientY-t.top)/t.height))+1),_),e6){var a,n;if(ai.current){null==(a=at.current)||a.next();return}if(te&&"read"===tn)return void tr();let e=a6.intersectObjects(e6.interactables(),!0)[0];if(!e)return;let t=e.object;for(;t&&!t.userData.characterId&&!t.userData.scaleAction&&!t.userData.itemId;)t=t.parent;let o=null==t?void 0:t.userData.scaleAction;if(o)return void a3(o);let r=null==t?void 0:t.userData.characterId;if(r)return void ti(e6,r);let i=null==t?void 0:t.userData.itemId;if(i){let e=ek[i];e&&e6.annotate(i,null!=(n=null==t?void 0:t.userData.itemTitle)?n:"About this line",e)}return}let o=eV.current;if(!o||"gallery"!==o.kind||!ts.length)return;let i=a6.intersectObjects(ts.map(e=>e.obj),!0)[0];if(!i)return;let l=i.object;for(;l&&!l.userData.itemId;)l=l.parent;let s=null==l?void 0:l.userData.itemId;s&&s!==o.featuredId&&aq.current.spotlight(s)};I.domElement.addEventListener("pointerdown",ne),I.domElement.addEventListener("pointerup",nt);let na=()=>{let e=[{label:aS.current?aE.current?"Unmute mic":"Mute mic":"Join voice",action:"mic"}];if(e.push({label:t1.current?"Ambient: on":"Ambient: off",action:"ambient"}),e6&&e.push({label:e6.motionOn()?"Characters: animated":"Characters: still",action:"motion"}),e6&&"hidden"!==t9.current){let t="playing"===t9.current,a=t&&"read"===aa.current;a&&e.push({label:"▸ Next line",action:"performNext"}),e.push({label:t?a?"End the read-along":"Stop the performance":"Perform the scene",action:"perform"})}J&&e.push({label:"done"===aO.current?J.doneLabel:"doing"===aO.current?"…":"error"===aO.current?"Try again":J.label,action:"sponsor"});let t=tc.current;if(t.length>1){var a,n;let o=null!=(n=null==(a=t[(td.current+1)%t.length])?void 0:a.name)?n:"next";e.push({label:"▸ ".concat(o),action:"hall"})}return e.push({label:"Exit VR",action:"exit"}),e.push({label:"Close menu",action:"close"}),e},nn=na(),no=()=>{nn=na(),aw.draw(nn.map(e=>e.label),aJ.current)},nr=new r.LoY().setFromPoints([new r.Pq0(0,0,0),new r.Pq0(0,0,-1.2)]),ni=new r.mrM({color:eP.warm,transparent:!0,opacity:.65});F.push({geometry:nr,material:ni});let nl=[],ns=e=>{for(let t of nl)t.visible=e},nd=()=>{aG.current=!1,aw.mesh.visible=!1,ns(!1)},nc=()=>
1{if(aG.current)(e=>{var t,a,n,o,r;let i=nn[e];if(i){if("mic"===i.action)aq.current.mic();else if("ambient"===i.action)aq.current.ambient();else if("motion"===i.action)aq.current.motion();else if("perform"===i.action)null==(t=at.current)||t.toggle();else if("performNext"===i.action)null==(a=at.current)||a.next();else if("sponsor"===i.action)aq.current.sponsor();else if("hall"===i.action)aq.current.hall();else return"exit"!==i.action?nd():null==(o=(r=I.xr).getSession)||null==(n=o.call(r))||n.end();aG.current&&no()}})(aJ.current);else{let e=I.xr.getCamera();e.getWorldPosition(ak),e.getWorldQuaternion(aI),aP.set(0,0,-1).applyQuaternion(aI),aP.y=0,1e-4>aP.lengthSq()&&aP.set(0,0,-1),aP.normalize(),aw.mesh.position.copy(ak).addScaledVector(aP,1.1),aw.mesh.position.y=ak.y-.05,aT.copy(aP).multiplyScalar(-1),aw.mesh.quaternion.setFromUnitVectors(av,aT),aJ.current=0,aG.current=!0,aw.mesh.visible=!0,ns(!0),ax=""}},nh=[];for(let e=0;e<2;e++){let t=I.xr.getController(e),a=()=>nc(),n=()=>aq.current.mic();t.addEventListener("selectstart",a),t.addEventListener("squeezestart",n);let o=new r.N1A(nr,ni);o.visible=!1,t.add(o),nl.push(o),C.add(t),nh.push({c:t,sel:a,sq:n,line:o})}let nu=()=>{aD(!1),nd(),aO.current="idle"},nf=()=>{nd(),ag&&aD(!0)};I.xr.addEventListener("sessionstart",nu),I.xr.addEventListener("sessionend",nf);let np={f:0,r:0,u:0,yaw:0},nm=e3?8.1:G+4.2,ng=new r.Pq0,nw=new r.Pq0,nb=e=>{if(!(e.repeat||(()=>{let e=document.activeElement;return!!e&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable)})()))switch(e.code){case"KeyW":case"ArrowUp":np.f=1,e.preventDefault();break;case"KeyS":case"ArrowDown":np.f=-1,e.preventDefault();break;case"KeyA":np.r=-1,e.preventDefault();break;case"KeyD":np.r=1,e.preventDefault();break;case"ArrowLeft":np.yaw=1,e.preventDefault();break;case"ArrowRight":np.yaw=-1,e.preventDefault();break;case"KeyE":case"PageUp":np.u=1,e.preventDefault();break;case"KeyQ":case"PageDown":np.u=-1,e.preventDefault();break;case"Space":tG(e=>!e),e.preventDefault()}},ny=e=>{switch(e.code){case"KeyW":case"ArrowUp":1===np.f&&(np.f=0);break;case"KeyS":case"ArrowDown":-1===np.f&&(np.f=0);break;case"KeyA":-1===np.r&&(np.r=0);break;case"KeyD":1===np.r&&(np.r=0);break;case"ArrowLeft":1===np.yaw&&(np.yaw=0);break;case"ArrowRight":-1===np.yaw&&(np.yaw=0);break;case"KeyE":case"PageUp":1===np.u&&(np.u=0);break;case"KeyQ":case"PageDown":-1===np.u&&(np.u=0)}};window.addEventListener("keydown",nb),window.addEventListener("keyup",ny),I.setAnimationLoop(()=>{var e,t,a,n,o,i,l,s,d,c,u,f,p,m,g,w,b,y,x,v,M,k,P,T;let j=ad.getDelta(),Y=ad.elapsedTime;for(let e of(null==tU||tU.update(j),tL))e.position.y+=e.userData.speed*j,e.material.opacity=.15*(1-(e.position.y-.7)/2.2),e.position.y>2.9&&(e.position.y=.7);{let e=th.current;if(0!==e.dir){let t=e3&&!tD?.9:.32;e.value+=e.dir*j/t,e.dir>0&&e.value>=1?(e.value=1,td.current=e.pending,e.dir=-1):e.dir<0&&e.value<=0&&(e.value=0,e.dir=0)}if(e.value>0){if(tW.visible=!0,tF.opacity=Math.min(1,e.value),(I.xr.isPresenting?I.xr.getCamera():_).getWorldPosition(tY),tW.position.copy(tY),tH.length)for(let t of(tO.visible=!0,tO.position.copy(tY),tH))t.mat.opacity=Math.max(0,1.2*e.value-.25),t.mesh.position.y+=t.speed*j,t.mesh.position.y>.5&&(t.mesh.position.y=-1.1)}else tW.visible&&(tW.visible=!1,tH.length&&(tO.visible=!1))}if(tJ&&!tD){let e=13*(1+.015*Math.sin(.5*Y));tJ.scale.set(e,e,1)}let z=aK.current,F=aM.current;if(tT.visible=0===F.length&&!z,z){for(let e of tC)e.orb.visible=!1;let e=a$.current.openMics;for(let t=0;t<tq.length;t++){let a=tq[t],n=e[t];n?(a.visible=!0,a.material.color.copy(tS(n.identity)),a.position.y=.95+.05*Math.sin(1.3*Y+t)):a.visible=!1}}else if(F.length>0){let r=null,d=null,c=ai.current;if(e6&&c){let o=null==(e=K(null!=(t=e6.hallName())?t:""))?void 0:e.cues[c.idx];o&&(d=(r=null!=(n=null==(a=ar.current[o.characterId])?void 0:a.actor)?n:null)?e6.characterPosition(o.characterId):null)}for(let e=0;e<tC.length;e++){let t=tC[e],a=F[e];if(a){t.orb.visible=!0;let n=t.orb.material;n.color.copy(tS(null!=(o=a.avatarColor)?o:a.id)),t.orb.position.y=.95+.03*Math.sin(1.3*Y+e);let s=a.voiceId;if(eR){let e=s&&null!=(l=null==(i=ab.current)?void 0:i.getPeerLevel(s))?l:0;
1t.lvl=(0,h.ic)(t.lvl,e,j),n.emissive.copy(n.color),n.emissiveIntensity=.9*t.lvl,t.orb.scale.setScalar(1+.13*t.lvl)}s&&ab.current&&(d&&r&&a.name===r?ab.current.setPeerPosition(s,d.x,d.y,d.z):ab.current.setPeerPosition(s,t.x,1.4,t.z))}else t.orb.visible=!1}if(eR&&t_&&ab.current&&(null==(s=t_.userData.speakingRig)||s.update(ab.current.getSelfLevel(),j)),ab.current){let e=I.xr.isPresenting?I.xr.getCamera():_;e.getWorldPosition(tY),e.getWorldDirection(tN),ab.current.setListenerPose(tY.x,tY.y,tY.z,tN.x,tN.y,tN.z)}}else{for(let e of tC)e.orb.visible=!1;tT.children.forEach((e,t)=>{e.position.y=.95+.03*Math.sin(1.3*Y+t)})}if(ac&&!au&&"done"===aO.current&&(ac((T=am)?T.replace(/(\d+)(\s*)members?/i,(e,t,a)=>{let n=Number(t)+1;return"".concat(n).concat(a).concat(1===n?"member":"members")}):T),au=!0),aG.current){let e=0,t=null==(d=(c=I.xr).getSession)?void 0:d.call(c);if(t)for(let a of t.inputSources){let t=null==(u=a.gamepad)?void 0:u.axes;if(t&&t.length>=4){let a=null!=(f=t[3])?f:0;Math.abs(a)>Math.abs(e)&&(e=a)}}let a=nn.length;Math.abs(e)>.6?aB||(aJ.current=(aJ.current+(e>0?1:a-1))%a,aB=!0):aB=!1;let n=!1;for(let{c:e,line:t}of nh){a_.identity().extractRotation(e.matrixWorld),aC.ray.origin.setFromMatrixPosition(e.matrixWorld),aC.ray.direction.set(0,0,-1).applyMatrix4(a_);let o=aC.intersectObject(aw.mesh,!1)[0];o?(t.scale.z=Math.max(.02,o.distance/1.2),o.uv&&!n&&(aJ.current=Math.min(a-1,Math.floor((1-o.uv.y)*a)),n=!0)):t.scale.z=1}let o="".concat(aJ.current,"-").concat(+!!aS.current).concat(+!!aE.current).concat(+!!t1.current,"-").concat(aO.current,"-h").concat(td.current);o!==ax&&(ax=o,no())}else if(I.xr.isPresenting&&aS.current){let e=I.xr.getCamera();e.getWorldPosition(ak),e.getWorldDirection(aP),aj.set(ak,aP);let t=tC.filter(e=>e.orb.visible).map(e=>e.orb),a=t.length?aj.intersectObjects(t,!1)[0]:void 0,n=a?tC.find(e=>e.orb===a.object):void 0,o=n?aM.current[tC.indexOf(n)]:void 0,i=(null==o?void 0:o.voiceId)?ay.current.find(e=>e.id===o.voiceId):void 0;if(i){i.id!==aA&&(aA=i.id,aR=Y,aY=!1);let e=Y-aR;n.orb.material.color.lerp(new r.Q1f(eP.warm),.6*Math.min(1,e/1.5)),e>=1.5&&!aY&&(aY=!0,aq.current.ember(i.name))}else aA=null,aY=!1}if(I.xr.isPresenting&&e6&&!aG.current){let e=I.xr.getCamera();e.getWorldPosition(ak),e.getWorldDirection(aP),aj.set(ak,aP);let t=aj.intersectObjects(e6.interactables(),!0)[0],a=null,n="";if(t){let e=t.object;for(;e&&!e.userData.characterId&&!e.userData.scaleAction&&!e.userData.itemId;)e=e.parent;a=null!=(m=null!=(p=null==e?void 0:e.userData.characterId)?p:(null==e?void 0:e.userData.scaleAction)?"scale:".concat(e.userData.scaleAction):null)?m:(null==e?void 0:e.userData.itemId)?"note:".concat(e.userData.itemId):null,n=null!=(g=null==e?void 0:e.userData.itemTitle)?g:""}if(a){if(a!==aW&&(aW=a,aH=Y,aL=!1),Y-aH>=1.2&&!aL)if(aL=!0,a.startsWith("scale:"))a3(a.slice(6));else if(a.startsWith("note:")){let e=ek[a.slice(5)];e&&e6.annotate(a.slice(5),n||"About this line",e)}else ti(e6,a)}else aW=null,aL=!1}let W=eV.current;if(I.xr.isPresenting&&W&&"gallery"===W.kind&&ts.length){let e=I.xr.getCamera();e.getWorldPosition(ak),e.getWorldDirection(aP),aj.set(ak,aP);let t=aj.intersectObjects(ts.map(e=>e.obj),!0)[0],a=null;if(t){let e=t.object;for(;e&&!e.userData.itemId;)e=e.parent;a=null!=(w=null==e?void 0:e.userData.itemId)?w:null}a&&a!==W.featuredId?(a!==aN&&(aN=a,az=Y,aF=!1),Y-az>=1.2&&!aF&&(aF=!0,aq.current.spotlight(a))):(aN=null,aF=!1)}if(I.xr.isPresenting){if(!aG.current){let e=0,t=0,a=null==(b=(y=I.xr).getSession)?void 0:b.call(y);if(a)for(let n of a.inputSources){let a=null==(x=n.gamepad)?void 0:x.axes;if(a&&a.length>=4){let n=null!=(M=null!=(v=a[2])?v:a[0])?M:0,o=null!=(P=null!=(k=a[3])?k:a[1])?P:0;Math.hypot(n,o)>Math.hypot(e,t)&&(e=n,t=o)}}if(Math.hypot(e,t)>.18&&(I.xr.getCamera().getWorldDirection(aP),aP.y=0,aP.lengthSq()>1e-4)){aP.normalize(),aZ.crossVectors(aP,a0).normalize(),aX.copy(aP).multiplyScalar(-t).addScaledVector(aZ,e).multiplyScalar(2.6*a5*j);let a=_.position.x+aX.x,n=_.position.z+aX.z;Math.hypot(a,n)<=a1&&(_.position.x=a,_.position.z=n)}}}else if(!tD){let e=0,t=0;if((aU.has("w")||aU.has("ArrowUp"))&&(e+=1),(aU.has("s")||aU.has("ArrowDown"))&&(e-=1),(aU.has("a")||aU.has("ArrowLeft"))&&(t-=1),(aU.has("d")||aU.has("ArrowRight"))&&(t+=1),(t||e)&&(_.getWorldDirection(aP),aP.y=0,aP.lengthSq()>1e-4)&&(aP.normalize(),aZ.crossVectors(aP,a0).normalize(),aX.copy(aP).multiplyScalar(e).addScaledVector(aZ,t),aX.lengthSq()>1e-4)){aX.normalize().multiplyScalar(2.6*a5*j);let e=_.position.x+aX.x,t=_.position.z+aX.z;Math.hypot(e,t)<=a1&&(_.position.x=e,_.position.z=t,A.target.x+=aX.x,A.target.z+=aX.z)}let a=aU.has("c")||aU.has("Shift")?-.55:0,n=a2+(a-a2)*Math.min(1,8*j),o=n-a2;Math.abs(o)>1e-5&&(_.position.y+=o,A.target.y+=o,a2=n)}if((e=>{if(a5===a4)return;let t=tD?a4:r.cj9.lerp(a5,a4,Math.min(1,1.9*e)),a=t/a5;_.position.y*=a,A.target.y*=a,a5=.003>Math.abs(t-a4)?a4:t})(j),((e,t)=>{let a=eV.current;if(!a||"fishing"!==a.kind){$.visible=!1;return}$.visible=!0;let n=Math.min(14,Math.max(0,a.fish));for(let e=0;e<ex.length;e++){let t=e<n;ex[e].active&&!t&&eC(Math.cos(ex[e].angle)*ex[e].radius,Math.sin(ex[e].angle)*ex[e].radius),ex[e].active=t}let o=e$.current;for(e$.current=0;o-- >0;)for(let e=0;e<5;e++){let e=Math.random()*Math.PI*2,t=.7*G*Math.random();eC(Math.cos(e)*t,Math.sin(e)*t)}let r=a.biting;for(let a of ex){a.scale+=(!!a.active-a.scale)*Math.min(1,4*t);let n=a.scale>.02;if(a.mesh.visible=n,!n)continue;a.mesh.scale.setScalar(.001+.999*a.scale),tD||(a.angle+=a.speed*t);let o=Math.cos(a.angle)*a.radius,r=Math.sin(a.angle)*a.radius;a.mesh.position.set(o,.62-a.depth+.015*Math.sin(e*a.wob),r),a.mesh.rotation.y=-a.angle+(a.speed<0?Math.PI:0)}if(r&&!tD&&Math.random()<1.2*t){let e=ex.find(e=>e.active&&e.scale>.8);
1e&&eC(Math.cos(e.angle)*e.radius,Math.sin(e.angle)*e.radius)}for(let e of eT){if(!e.active)continue;e.age+=t;let a=e.age/e.life;if(a>=1){e.active=!1,e.mesh.visible=!1;continue}e.mesh.scale.setScalar(.3+5.5*G*a),e.mesh.material.opacity=.5*(1-a)}})(Y,j),((e,t)=>{var a,n,o,i,l,s,d,c,h,u,f;let p=eV.current;if(e3&&p&&"gallery"===p.kind){if(!e6){e6=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={geos:[],mats:[],texs:[],geo(e){return this.geos.push(e),e},mat(e){return this.mats.push(e),e},tex(e){return e.colorSpace=r.er$,e.anisotropy=4,this.texs.push(e),e},std(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.mat(new r._4j({roughness:.85,metalness:.02,color:e,...t}))},flat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.mat(new r.V9B({color:e,...t}))},dispose(){for(let e of this.geos)e.dispose();for(let e of this.mats)e.dispose();for(let e of this.texs)e.dispose();this.geos.length=0,this.mats.length=0,this.texs.length=0}},a=new r.YJl,n=!e.reducedMotion,o=function(){let e=new Map;for(let t of V){let a=e.get(t.hall);a||(a=[],e.set(t.hall,a)),a.push(t)}return e}(),i=N.map(e=>({name:e,group:null,anims:[],charRoots:[],scaleProps:[],lecternRoots:[],figures:new Map,poses:new Map,lecterns:null,itemsSig:""})),l=[],s=-1,d=function(e){let t=document.createElement("canvas");t.width=768,t.height=460;let a=t.getContext("2d"),n=e.tex(new r.GOR(t)),o=e.flat("#ffffff",{transparent:!0,opacity:0,map:n,depthWrite:!1}),i=new r.eaF(e.geo(new r.bdM(1.25,.75)),o);i.renderOrder=60,i.visible=!1;let l=e.flat(X.cream,{transparent:!0,opacity:0,depthWrite:!1}),s=new r.eaF(e.geo(new r.qFE(.05,.16,4)),l);return s.rotation.x=Math.PI,s.renderOrder=60,s.visible=!1,{mesh:i,stem:s,paint:(e,o,r)=>{var i,l;let s=t.width,d=t.height;a.clearRect(0,0,s,d),a.fillStyle="rgba(255,251,247,0.97)",i=s-16,l=d-16,a.beginPath(),a.moveTo(38,8),a.arcTo(8+i,8,8+i,8+l,30),a.arcTo(8+i,8+l,8,8+l,30),a.arcTo(8,8+l,8,8,30),a.arcTo(8,8,8+i,8,30),a.closePath(),a.fill(),a.strokeStyle="rgba(242,109,74,0.55)",a.lineWidth=5,a.stroke(),a.fillStyle="rgba(12,59,70,0.62)",a.textAlign="left",a.textBaseline="middle",a.font="700 30px Georgia, serif",a.fillText(e,40,52,s-80),a.fillStyle=X.ink,a.textAlign="center";let c=o.length>150?30:o.length>90?34:40;a.font="italic 600 ".concat(c,"px Georgia, serif");let h=Z(a,"“".concat(o,"”"),s-110).slice(0,8),u=c+10,f=d/2+14-(h.length-1)*u/2;h.forEach((e,t)=>a.fillText(e,s/2,f+t*u,s-90)),a.font="600 24px Georgia, serif",a.fillStyle="rgba(12,59,70,0.55)",a.textAlign="right",a.fillText(r,s-40,d-40),n.needsUpdate=!0},ttl:0}}(t);a.add(d.mesh),a.add(d.stem);let c=null,h=null,u=0,f=new Map,p=e=>{var a;if(!e.group)return;let n=l.filter(t=>{var a;return(null!=(a=t.hall)?a:"")===e.name}),o=n.map(e=>e.id).join(",");if(o===e.itemsSig)return;e.itemsSig=o,e.lecterns&&e.group.remove(e.lecterns);let i=null!=(a=ey[e.name])?a:{angles:[-40,0,40,80,120],r:6.8},s=new r.YJl;e.lecternRoots=[],n.slice(0,i.angles.length).forEach((a,n)=>{let o=function(e,t,a,n){let o=new r.YJl,i=a*Math.PI/180,l=Math.cos(i)*n,s=Math.sin(i)*n,d=ec(e,e.std(X.woodDark),.05,.07,1,0,.5,0);o.add(d);let c=ec(e,e.std(X.woodDark),.16,.18,.05,0,.025,0);o.add(c);let h=eh(e,e.std(X.wood),.62,.66,.035,0,1.28,-.02);h.rotation.x=-.42,o.add(h);let u=es(e,new r.bdM(.56,.56),e.flat("#ffffff",{map:Q(e,512,512,(e,a)=>{var n;e.fillStyle=X.parchment,e.fillRect(0,0,a,a),t.tint&&(e.fillStyle=t.tint,e.globalAlpha=.16,e.fillRect(0,0,a,a),e.globalAlpha=1),e.strokeStyle="rgba(60,46,24,0.6)",e.lineWidth=10,e.strokeRect(10,10,a-20,a-20),e.fillStyle="rgba(40,32,14,0.86)",e.textAlign="center",e.textBaseline="middle",e.font="700 34px Georgia, serif",Z(e,t.title.toUpperCase(),a-120).slice(0,2).forEach((t,n)=>e.fillText(t,a/2,70+40*n,a-110)),e.font="italic 600 28px Georgia, serif";let o=Z(e,null!=(n=t.note)?n:"",a-130).slice(0,9),r=a/2+10-(o.length-1)*36/2;o.forEach((t,n)=>e.fillText(t,a/2,r+36*n,a-120)),t.subtitle&&(e.font="600 24px Georgia, serif",e.fillText(t.subtitle,a/2,a-84,a-120)),t.credit&&(e.font="500 19px Georgia, serif",e.fillStyle="rgba(40,32,14,0.6)",e.fillText(t.credit,a/2,a-46,a-100))})}));return u.position.set(0,1.28,.002),u.rotation.x=-.42,u.translateZ(.02),o.add(u),o.position.set(l,0,s),o.lookAt(0,0,0),o}(t,a,i.angles[n],i.r);o.userData.itemId=a.id,o.userData.itemTitle=a.title,s.add(o),e.lecternRoots.push(o)}),e.lecterns=s,e.group.add(s)},m=new r.Pq0;return{group:a,hallCount:()=>i.length,setHall:(e,n)=>{let l=e;if(n){let e=i.findIndex(e=>e.name===n);e>=0&&(l=e)}(l=(l%i.length+i.length)%i.length)!==s&&(s>=0&&i[s].group&&(i[s].group.visible=!1),(e=>{var n,l,s,d,c;let h=i[e];if(h.group)return;let u=null!=(l=null==(n=ev[h.name])?void 0:n.call(ev,t))?l:{group:new r.YJl,anims:[]};h.group=u.group,h.anims=u.anims,h.scaleProps=null!=(s=u.scaleProps)?s:[];let f=function(e,t){let a=eM[t];if(!a)return null;let n=new r.YJl,o=es(e,new r.iNn(a.w+.16,a.h+.16,.05),e.std("#4e3a28",{roughness:.8}));n.add(o);let i=es(e,new r.bdM(a.w+.07,a.h+.07),e.flat("#efe7d6"));i.position.z=.028,n.add(i);let l=e.flat("#e7dfcf"),s=es(e,new r.bdM(a.w,a.h),l);s.position.z=.034,n.add(s),new r.Tap().load("/xr/wonderland/tenniel/".concat(a.file),e=>
1{e.colorSpace=r.er$,e.anisotropy=8,l.map=e,l.color.set("#ffffff"),l.needsUpdate=!0});let d=es(e,new r.bdM(.86,.16),e.flat("#fdf8ec",{map:el(e,[a.caption,"John Tenniel, 1866 \xb7 Public domain"],26)}));d.position.set(0,-(a.h/2)-.22,.034),n.add(d);let c=a.angleDeg*Math.PI/180;return n.position.set(8.18*Math.cos(c),2.45,8.18*Math.sin(c)),n.lookAt(0,2.45,0),n}(t,h.name);for(let e of(f&&h.group.add(f),null!=(d=o.get(h.name))?d:[])){let a=function(e,t){switch(t.kind){case"white-rabbit":return function(e,t){let a=e.std("#f3efe6",{roughness:.9}),n="herald"===t,o=n?e.std("#f3efe6",{map:er(e,"#f3efe6","#c0392b")}):e.std("#caa06a",{map:eo(e,"#caa06a","#8a6b45",10)}),i=ep(e,{h:1.12,torso:o,legs:a,skin:a,headR:.17});for(let t of[-1,1]){let n=eu(e,a,.055,.46,.075*t,.36,0);n.rotation.z=-(.13*t),i.head.add(n);let o=eu(e,e.std("#e8b7b0"),.028,.3,.075*t,.33,.02);o.rotation.z=-(.13*t),i.head.add(o)}for(let t of[-1,1])i.head.add(ed(e,e.std("#d98a92"),.028,.075*t,.04,.145));for(let t of(i.head.add(ed(e,a,.06,0,-.045,.15,1,.8,1)),[-1,1]))for(let a=0;a<3;a++){let n=ec(e,e.std("#ffffff"),.0035,.0035,.16,.12*t,-.05+.018*a,.13);n.rotation.z=t*(Math.PI/2-.18+.12*a),i.head.add(n)}if(i.group.add(eh(e,e.std("#f6eed8"),.16,.24,.02,0,i.legH+.42*i.torsoH,.135)),n){for(let t=0;t<3;t++){let a=es(e,new r.O3Y(.13-.012*t,.028,10,22),e.std("#ffffff"));a.rotation.x=Math.PI/2,a.position.y=i.shoulderY+.05+.03*t,i.group.add(a)}let t=new r.YJl;t.add(ec(e,e.std(X.brass,{metalness:.7,roughness:.35}),.012,.012,.34,0,0,0));let a=eu(e,e.std(X.brass,{metalness:.7,roughness:.35}),.05,.1,0,.21,0);t.add(a),t.position.set(0,-.3,.02),t.rotation.z=2.2,i.arms[1].add(t),i.arms[1].rotation.x=-1.2;let n=ec(e,e.std("#f6eed8"),.035,.035,.3,0,-.31,.02);n.rotation.x=Math.PI/2,i.arms[0].add(n)}else{let t=i.arms[1];t.rotation.x=-1.05;let a=es(e,new r.Ho_(.045,.045,.016,18),e.std(X.brass,{metalness:.8,roughness:.3}));a.rotation.x=Math.PI/2,a.position.set(0,-.32,.05),t.add(a);let n=0;for(;n<3;){let a=es(e,new r.O3Y(.014,.004,6,10),e.std(X.brass,{metalness:.8,roughness:.3}));a.position.set(.02+.03*n,-.28+.045*n,.06),t.add(a),n++}let o=ec(e,e.std("#6b4a2b"),.016,.016,.5,-.05,-.2,-.04);o.rotation.x=.5,i.arms[0].add(o)}let l=Math.random()*Math.PI*2,s=i.group.position.y;return{group:i.group,headY:i.headTopY+.62,animate:e=>{let a=Math.max(0,Math.sin(1.4*e+l));i.arms[1].rotation.x=("herald"===t?-1.2:-1.05)-.25*a,i.group.position.y=s+.015*Math.abs(Math.sin(2.2*e+l))},onSpeak:()=>{l=0}}}(e,t.variant);case"alice":return function(e){let t=e.std("#f2d8c4"),a=e.std("#9fb6d8"),n=ep(e,{h:1.32,torso:a,legs:e.std("#f4efe2"),skin:t,headR:.16,skirt:!0,skirtMat:a});n.group.add(eh(e,e.std("#f8f5ec"),.2,.3,.02,0,n.legH+.45*n.torsoH,.125));let o=es(e,new r.qFE(.26,.42,16,1,!0),e.std("#f8f5ec",{side:r.$EB}));o.position.set(0,n.legH+.18*n.torsoH,.04),n.group.add(o);let i=e.std("#e8d18a");n.head.add(ed(e,i,.168,0,.02,-.015,1,1,1)),n.head.add(ed(e,t,.145,0,-.015,.035));let l=ed(e,i,.15,0,-.16,-.1,.9,1.7,.55);n.head.add(l);let s=es(e,new r.O3Y(.155,.012,8,24),e.std("#4a5d8a"));for(let t of(s.rotation.x=.5,s.position.y=.07,n.head.add(s),[-1,1]))n.head.add(ed(e,e.std("#34404a"),.018,.055*t,0,.135));for(let t of[-1,1])n.group.add(eh(e,e.std("#2a2a30"),.07,.04,.14,.07*t,.02,.05));return{group:n.group,headY:n.headTopY+.55,animate:e=>{n.head.rotation.y=.18*Math.sin(.5*e)}}}(e);case"mouse":return function(e){let t=new r.YJl,a=e.std("#9a8d80"),n=ed(e,a,.09,.16,.03,0,1.2,.9,.9);t.add(n),t.add(ed(e,a,.1,-.04,-.015,0,1.5,.55,.8));let o=eu(e,a,.04,.1,.29,.02,0);for(let a of(o.rotation.z=-Math.PI/2,t.add(o),[-1,1]))t.add(ed(e,e.std("#c9aeae"),.032,.12,.1,.055*a,1,1,.4)),t.add(ed(e,e.std("#2a2a30"),.012,.24,.05,.03*a));let i=ef(e,a,[new r.Pq0(-.18,0,0),new r.Pq0(-.34,.03,.08),new r.Pq0(-.48,0,-.04),new r.Pq0(-.6,.05,.05)],.012);t.add(i);let l=Math.random()*Math.PI*2;return{group:t,headY:.95,animate:(e,a)=>{l+=.5*a,t.position.x=.85*Math.cos(l),t.position.z=.85*Math.sin(l),t.position.y=.62+.012*Math.sin(6*l),t.rotation.y=-l+Math.PI/2}}}(e);case"dodo":return function(e){let t=new r.YJl,a=e.std("#9a8d72",{roughness:.95}),n=e.std("#7d6f58",{roughness:.95});t.add(ed(e,a,.34,0,.62,0,1,1.12,.92)),t.add(ed(e,n,.3,0,.5,-.1,1.05,.8,.9)),t.add(ed(e,n,.16,0,.62,-.34,.8,.6,.8)),t.add(ec(e,a,.09,.12,.3,0,.97,.08));let o=new r.YJl;o.position.set(0,1.16,.1),o.add(ed(e,a,.13,0,0,0));let i=eu(e,e.std("#caa06a"),.075,.3,0,-.01,.24);i.rotation.x=Math.PI/2,o.add(i);let l=eu(e,e.std("#a87f4f"),.045,.12,0,-.07,.36);for(let t of(l.rotation.x=Math.PI-.5,o.add(l),[-1,1]))o.add(ed(e,e.std("#2a2a30"),.02,.075*t,.045,.07));for(let a of(t.add(o),[-1,1])){let o=new r.YJl;if(o.position.set(.3*a,.72,.08),o.rotation.z=.5*a,o.add(ed(e,n,.13,0,-.08,0,.6,1.2,.5)),o.add(ec(e,e.std("#f4efe2"),.05,.055,.07,0,-.22,0)),o.add(ed(e,e.std("#e8c8a8"),.04,0,-.28,0)),1===a){let t=ec(e,e.std("#b9c1c9",{metalness:.75,roughness:.3}),.026,.032,.05,0,-.28,.06);o.add(t)}else{let t=ec(e,e.std(X.woodDark),.012,.012,.62,.02,-.5,.04);o.add(t),o.add(ed(e,e.std(X.brass,{metalness:.7,roughness:.4}),.025,.02,-.2,.04))}t.add(o)}for(let a of[-1,1])t.add(ec(e,e.std("#caa06a"),.035,.04,.3,.12*a,.15,0)),t.add(eh(e,e.std("#caa06a"),.14,.03,.2,.12*a,.015,.05));return{group:t,headY:1.62,animate:e=>{o.rotation.x=.08*Math.sin(.7*e)}}}(e);case"caterpillar":return function(e){let t=new r.YJl,a=ec(e,e.std("#e8dec2"),.2,.3,1.02,0,.51,0);t.add(a);let n=[];for(let e=0;e<=8;e++){let t=e/8;n.push(new r.I9Y(1.15*Math.sin(t*Math.PI*.5),.34*Math.cos(t*Math.PI*.5)))}let o=es(e,new r.nzx(n,24),e.std("#d8c9a6"));o.position.y=1.02,t.add(o);let i=es(e,new r.tcD(1.13,24),e.std("#c9b48c",{side:r.$EB}));for(let[a,n,o]of(i.rotation.x=Math.PI/2,i.position.y=1.025,t.add(i),[[-.5,.62,.55],[.42,.7,.4],[.7,.34,.3]])){let i=new r.YJl;i.add(ec(e,e.std("#e8dec2"),.05*o,.07*o,.34*o,0,.17*o,0));let l=ed(e,e.std("#cdb27e"),.16*o,0,.36*o,0,1,.55,1);i.add(l),i.position.set(a,0,n),t.add(i)}let l=new r.YJl,s=["#7da3c4","#6f95ba","#6188b0","#557da6","#4a739c","#416a93","#39628a"];[[0,0,.12],[.02,.13,.06],[.03,.26,-.02],[.02,.39,-.05],[0,.52,-.02],[-.02,.64,.04],[-.02,.76,.1]].forEac
1h((t,a)=>{let[n,o,r]=t;l.add(ed(e,e.std(s[a]),.16-.008*a,n,o,r,1,.82,1))});let d=new r.YJl;for(let t of(d.position.set(-.02,.88,.14),d.add(ed(e,e.std("#39628a"),.13,0,0,0)),[-1,1]))d.add(ed(e,e.std("#22303c"),.02,.05*t,.02,.11));for(let t of[-1,1]){let a=ec(e,e.std("#557da6"),.025,.025,.18,.05*t,.62,.13);a.rotation.z=1.35*t,l.add(a)}l.add(d),l.position.set(-.15,1.04,-.1),t.add(l);let c=e.std(X.brass,{metalness:.65,roughness:.35}),h=[];for(let e=0;e<=8;e++){let t=e/8;h.push(new r.I9Y(.02+.11*Math.sin(t*Math.PI),.34*t))}let u=es(e,new r.nzx(h,16),c);u.position.set(.42,1.02,.28),t.add(u);let f=ef(e,e.std("#8a4a3a"),[new r.Pq0(.42,1.34,.28),new r.Pq0(.52,1.52,.1),new r.Pq0(.3,1.02+.62,-.18),new r.Pq0(.05,1.82,.02),new r.Pq0(-.12,1.88,.2)],.018);t.add(f);let p=[];for(let a=0;a<4;a++){let n=e.flat("#dfe6ea",{transparent:!0,opacity:0,depthWrite:!1}),o=es(e,new r.O3Y(.07,.016,8,20),n);o.rotation.x=Math.PI/2,o.renderOrder=4,o.visible=!1,t.add(o),p.push({mesh:o,mat:n,age:2+1.6*a})}return{group:t,headY:2.27,animate:(e,t)=>{for(let a of(l.rotation.y=.1*Math.sin(.4*e),p)){a.age+=t;let e=a.age%6/6;a.mesh.visible=e<.75,a.mesh.visible&&(a.mesh.position.set(-.12,1.94+1.5*e,.2),a.mesh.scale.setScalar(.6+2.4*e),a.mat.opacity=.5*(1-e/.75))}}}}(e);case"pigeon":return function(e){let t=new r.YJl,a=ec(e,e.std(X.woodDark),.07,.12,3.6,0,1.8,0);a.rotation.z=.28,t.add(a);let n=es(e,new r.O3Y(.3,.1,10,20),e.std("#a08a5a",{roughness:1}));n.rotation.x=Math.PI/2,n.position.set(-1,3.35,0),t.add(n);for(let a=0;a<5;a++){let n=ec(e,e.std("#8a744a"),.012,.012,.5,-1+.28*Math.cos(1.3*a),3.37,.28*Math.sin(1.3*a));n.rotation.set(Math.PI/2,0,1.3*a),t.add(n)}let o=new r.YJl;o.position.set(-1,3.47,0);let i=e.std("#9aa3b4");o.add(ed(e,i,.16,0,.05,0,1,.9,1.25));let l=new r.YJl;l.position.set(0,.22,.14),l.add(ed(e,i,.085,0,0,0));let s=eu(e,e.std("#caa06a"),.025,.09,0,-.01,.11);for(let t of(s.rotation.x=Math.PI/2,l.add(s),[-1,1]))l.add(ed(e,e.std("#2a2a30"),.014,.05*t,.025,.045));o.add(l);let d=eh(e,i,.12,.02,.26,0,.08,-.26);d.rotation.x=-.35,o.add(d);let c=[];for(let t of[-1,1]){let a=eh(e,e.std("#8a93a4"),.04,.1,.3,.15*t,.08,-.02);a.rotation.z=.3*t,o.add(a),c.push(a)}t.add(o);let h=0;return{group:t,headY:4.1,animate:(e,t)=>
1{l.rotation.y=.5*Math.sin(.9*e),h=Math.max(0,h-t);for(let e=0;e<c.length;e++){let t=0===e?-1:1;c[e].rotation.z=t*(.3+(h>0?.9*Math.abs(Math.sin(18*h)):0))}},onSpeak:()=>{h=1.2}}}(e);case"frog-footman":return function(e){let t=new r.YJl,a=e.std("#9fb277"),n=e.std("#3f5a44",{map:ei(e,"#3f5a44","#caa247")});for(let o of(t.add(ed(e,n,.24,0,.3224,0,1,1.1,.9)),[-1,1])){let r=ec(e,a,.06,.05,.34,.16*o,.16,.18);r.rotation.x=1.35,r.rotation.z=.5*o,t.add(r),t.add(ed(e,a,.06,.3*o,.05,.34,1.4,.5,1.8));let i=ec(e,n,.04,.035,.3,.24*o,.312,.04);i.rotation.z=.65*o,t.add(i)}let o=new r.YJl;o.position.set(0,.74,.02),o.rotation.x=-.55,o.add(ed(e,a,.17,0,0,0,1.15,.9,1));let i=es(e,new r.O3Y(.12,.012,6,18,.9*Math.PI),e.std("#4a5d3a"));for(let t of(i.rotation.set(.25,0,Math.PI+.05),i.position.set(0,-.03,.12),o.add(i),[-1,1]))o.add(ed(e,e.std("#e8e4d2"),.05,.07*t,.13,.05)),o.add(ed(e,e.std("#2a2a30"),.022,.07*t,.15,.085));for(let t=0;t<7;t++){let a=-(.8*Math.PI)+t/6*Math.PI*1.6;o.add(ed(e,e.std("#f4efe2"),.05,.15*Math.cos(a),.02+.05*Math.sin(Math.abs(a)),.13*Math.sin(a)-.04))}return t.add(o),{group:t,headY:1.35,animate:e=>{o.rotation.z=.08*Math.sin(.35*e)}}}(e);case"duchess":return function(e){let t=e.std("#e8c8a8"),a=Q(e,128,128,(e,t,a)=>{e.fillStyle="#7d4a3a",e.fillRect(0,0,t,a),e.fillStyle="#caa247";for(let t=0;t<4;t++)for(let a=0;a<4;a++)e.beginPath(),e.arc(32*a+(t%2?16:0)+8,32*t+8,4,0,2*Math.PI),e.fill()});a.wrapS=a.wrapT=r.GJx,a.repeat.set(3,2);let n=e.std("#7d4a3a",{map:a}),o=ep(e,{h:1.38,torso:n,legs:n,skin:t,headR:.26,skirt:!0});for(let a of(o.group.add(eh(e,e.std("#f4efe2"),.26,.3,.02,0,o.legH+.4*o.torsoH,.16)),o.head.add(ed(e,t,.16,-.12,-.13,.1,1,.8,.9)),o.head.add(ed(e,t,.16,.12,-.13,.1,1,.8,.9)),o.head.add(eu(e,t,.045,.1,0,-.02,.26)),[-1,1]))o.head.add(ed(e,e.std("#2a2a30"),.02,.09*a,.05,.22)),o.head.add(eh(e,e.std("#5a4a3a"),.1,.022,.02,.09*a,.11,.23));let i=e.std("#f4efe2");for(let t of[-1,1]){let a=eh(e,i,.34,.4,.03,.14*t,.3,-.02);a.rotation.z=-.62*t,o.head.add(a),o.head.add(eh(e,i,.05,.3,.22,.27*t,.06,-.02))}o.head.add(eh(e,i,.4,.34,.02,0,.04,-.24));let l=new r.YJl,s=eu(e,e.std("#f4efe2"),.13,.4,0,0,0);s.rotation.z=Math.PI/2+.4,l.add(s);let d=new r.YJl;d.position.set(.2,.1,0),d.add(ed(e,e.std("#e8b7b0"),.085,0,0,0));let c=ec(e,e.std("#d98a92"),.035,.04,.04,0,0,.085);for(let t of(c.rotation.x=Math.PI/2,d.add(c),[-1,1])){let a=eu(e,e.std("#e8b7b0"),.03,.07,.06*t,.075,.01);a.rotation.z=.6*t,d.add(a)}for(let e of(l.add(d),l.position.set(.06,o.legH+.52*o.torsoH,.2),l.rotation.z=-.2,o.group.add(l),o.arms))e.rotation.x=-1.15;let h=0;return{group:o.group,headY:o.headTopY+.7,animate:(e,t)=>
1{h+=t,l.rotation.x=.12*Math.sin(2.4*h),d.rotation.z=.08*Math.sin(5*h)}}}(e);case"cook":return function(e){let t=e.std("#e8c8a8"),a=ep(e,{h:1.34,torso:e.std("#8a93a4"),legs:e.std("#8a93a4"),skin:t,headR:.155,skirt:!0});for(let t of(a.group.add(eh(e,e.std("#f4efe2"),.22,.34,.02,0,a.legH+.38*a.torsoH,.14)),a.head.add(ed(e,e.std("#f4efe2"),.16,0,.08,-.02,1.05,.7,1.05)),[-1,1]))a.head.add(ed(e,e.std("#2a2a30"),.018,.055*t,.01,.135));let n=a.arms[1];n.rotation.x=-1.5;let o=new r.YJl;o.add(ec(e,e.std("#6b6f78",{metalness:.6,roughness:.4}),.012,.012,.42,0,0,0));let i=ed(e,e.std("#6b6f78",{metalness:.6,roughness:.4}),.06,0,-.24,0,1,.55,1);o.add(i),o.position.set(0,-.34,.03),o.rotation.x=.6,n.add(o);let l=ec(e,e.std("#b9aa90"),.035,.04,.12,0,-.33,.04);a.arms[0].add(l);let s=0;return{group:a.group,headY:a.headTopY+.55,animate:(e,t)=>{s+=2.2*t,n.rotation.z=.22*Math.sin(s)}}}(e);case"cheshire-cat":return function(e){let t=new r.YJl,a=ei(e,"#b9a48a","#7d6a52",!0),n=e.std("#b9a48a",{map:a,transparent:!0}),o=e.std("#b9a48a",{map:a,transparent:!0}),i=e.std("#c4b094",{transparent:!0}),l=e.std("#8a7a5e",{transparent:!0}),s=e.std("#e8e09a",{transparent:!0}),d=e.std("#2a2a30",{transparent:!0});e.flat("#ffffff",{transparent:!0,depthWrite:!1});let c=new r.YJl,h=ef(e,n,[new r.Pq0(-.52,.02,0),new r.Pq0(-.78,-.18,.08),new r.Pq0(-.7,-.46,-.04),new r.Pq0(-.88,-.6,.06)],.045);c.add(h),t.add(c);let u=new r.YJl;for(let t of(u.add(ed(e,o,.24,-.18,.08,0,1.9,.95,1)),[-1,1]))u.add(ec(e,o,.05,.06,.2,.16,-.04,.12*t)),u.add(ed(e,i,.055,.16,-.15,.12*t));u.add(ed(e,o,.17,-.5,.12,0,1.1,.9,.95)),t.add(u);let f=new r.YJl;for(let t of(f.position.set(.22,.26,0),f.add(ed(e,i,.21,0,0,0,1.1,.95,1)),[-1,1])){let a=eu(e,l,.07,.16,.13*t,.2,0);a.rotation.z=-(.25*t),f.add(a)}t.add(f);let p=new r.YJl;for(let t of(p.position.set(.22,.26,0),[-1,1]))p.add(ed(e,s,.05,.08*t,.07,.165)),p.add(ed(e,d,.02,.08*t,.07,.205));let m=Q(e,256,128,(e,t,a)=>{e.clearRect(0,0,t,a),e.fillStyle="#fffef2",e.beginPath(),e.moveTo(14,34),e.quadraticCurveTo(t/2,a+26,t-14,34),e.quadraticCurveTo(t/2,a-38,14,34),e.closePath(),e.fill(),e.strokeStyle="rgba(60,46,24,0.65)",e.lineWidth=3;for(let a=1;a<8;a++){let n=14+(t-28)/8*a;e.beginPath(),e.moveTo(n,40),e.lineTo(n,64+18*Math.sin(a/8*Math.PI)),e.stroke()}}),g=es(e,new r.bdM(.3,.15),e.flat("#ffffff",{transparent:!0,map:m,depthWrite:!1}));g.position.set(0,-.06,.2),g.renderOrder=6,p.add(g),t.add(p);let w=-1,b=(e,t)=>{e.visible=t>.01,e.traverse(e=>{let a=e.material;a&&"opacity"in a&&(a.opacity=t)})};return{group:t,headY:.85,animate:(e,t)=>
1{if(c.rotation.x=.1*Math.sin(.8*e),w<0)return;w+=t;let a=(e,t)=>r.cj9.clamp(1-(w-e)/(t-e),0,1),n=(e,t)=>r.cj9.clamp((w-e)/(t-e),0,1);w<=6.6?(b(c,a(0,1.2)),b(u,a(1,2.4)),b(f,a(2.2,3.4)),b(p,w<5.6?1:a(5.6,6.6))):w<=10.2?(b(p,n(8,8.8)),b(f,n(8.8,9.6)),b(u,n(9.2,10)),b(c,n(9.6,10.2))):(b(c,1),b(u,1),b(f,1),b(p,1),w=-1)},onSpeak:()=>{w<0&&(w=0)}}}(e);case"hatter":return function(e,t){let a="witness"===t,n=e.std("#e8c8a8"),o=e.std("#b9aa90",{map:eo(e,"#b9aa90","#8a7a5e",6)}),i=ep(e,{h:1.36,torso:e.std("#5e6a52"),legs:o,skin:n,headR:.17});if(a)for(let t of[-1,1]){let a=eh(e,e.std("#2a2a30"),.09,.05,.18,.3*t,.025,.26);a.rotation.y=.7*t,i.group.add(a)}for(let t of[-1,1]){let a=eh(e,e.std("#5e6a52"),.1,.3,.02,.07*t,i.legH+.04,-.12);a.rotation.x=.18,i.group.add(a)}let l=Q(e,64,64,(e,t,a)=>{e.fillStyle="#e8b73a",e.fillRect(0,0,t,a),e.fillStyle="#7d4a3a";for(let t=0;t<3;t++)for(let a=0;a<3;a++)e.beginPath(),e.arc(21*a+(t%2?10:0)+6,21*t+8,4.6,0,2*Math.PI),e.fill()}),s=e.std("#e8b73a",{map:l});for(let t of[-1,1]){let a=eh(e,s,.16,.1,.03,.1*t,i.shoulderY+.02,.1);a.rotation.z=.18*t,i.group.add(a)}for(let t of(i.group.add(ed(e,s,.035,0,i.shoulderY+.02,.11)),i.head.add(eu(e,n,.035,.12,0,-.01,.19)),[-1,1]))i.head.add(ed(e,e.std("#caa06a"),.075,.15*t,-.03,-.02,.8,1,1)),i.head.add(ed(e,e.std("#2a2a30"),.02,.065*t,.04,.15));let d=new r.YJl,c=e.std("#d8d0bd"),h=es(e,new r.Ho_(.26,.26,.02,24),c);d.add(h),d.add(ec(e,c,.165,.185,.42,0,.22,0));let u=ec(e,e.std("#5a4a3a"),.187,.187,.07,0,.07,0);d.add(u);let f=es(e,new r.bdM(.17,.105),e.flat("#fdf8ec",{map:Q(e,256,160,(e,t,a)=>{e.fillStyle="#fdf8ec",e.fillRect(0,0,t,a),e.strokeStyle="rgba(40,32,14,0.5)",e.lineWidth=4,e.strokeRect(3,3,t-6,a-6),e.fillStyle="rgba(40,32,14,0.92)",e.textAlign="center",e.textBaseline="middle",e.font="italic 600 38px Georgia, serif",e.fillText("In this Style",t/2,52),e.font="700 52px Georgia, serif",e.fillText("10/6",t/2,112)})}));f.position.set(.1,.1,.155),f.rotation.set(-.06,.55,.05),d.add(f),d.position.set(0,.13,0),d.rotation.z=-.08,i.head.add(d);let p=e.std("#f4efe2"),m=new r.YJl;m.add(ec(e,p,.045,.035,.06,0,0,0));let g=es(e,new r.O3Y(.024,.007,6,12,Math.PI),p);g.position.set(.046,0,0),g.rotation.z=-Math.PI/2,m.add(g),m.position.set(0,-.32,.04),i.arms[1].add(m),i.arms[1].rotation.x=-1.1;let w=eh(e,e.std("#e0c89a"),.1,.016,.09,0,-.32,.03);w.rotation.x=-.3,i.arms[0].add(w),i.arms[0].rotation.x=-.8;let b=0;return{group:i.group,headY:i.headTopY+.95,animate:(e,t)=>
1{let n=(b=Math.max(0,b-t))>0?Math.sin(Math.min(1,(1.4-b)/1.4)*Math.PI):0;i.arms[1].rotation.x=-1.1-.55*n,a?i.group.rotation.z=.008*Math.sin(7*e):i.head.rotation.z=.06*Math.sin(.8*e)},onSpeak:()=>{b=1.4}}}(e,t.variant);case"march-hare":return function(e){let t=e.std("#b08a5e"),a=ep(e,{h:1.3,torso:e.std("#7d5f3f"),legs:t,skin:t,headR:.16}),n=[];for(let o of[-1,1]){let r=eu(e,t,.05,.5,.07*o,.4,-.02);r.rotation.z=-(.3*o),r.rotation.x=-.25,a.head.add(r),n.push(r)}for(let t=0;t<5;t++){let n=ec(e,e.std("#e8d18a"),.006,.006,.3,-.08+.04*t,.32+t%2*.05,0);n.rotation.z=-.9+.45*t,n.rotation.x=-.2+t%3*.2,a.head.add(n)}for(let n of(a.head.add(ed(e,t,.06,0,-.04,.14,1,.8,1.1)),[-1,1]))a.head.add(ed(e,e.std("#3a2e22"),.02,.065*n,.045,.135));let o=ec(e,e.std("#f4efe2"),.045,.035,.06,0,-.32,.04);return a.arms[0].add(o),a.arms[0].rotation.x=-1,a.arms[1].rotation.x=-.5,{group:a.group,headY:a.headTopY+.6,animate:e=>{n[0].rotation.x=-.25+.12*Math.sin(2.6*e),n[1].rotation.x=-.25+.12*Math.sin(2.6*e+1.7)}}}(e);case"dormouse":return function(e){let t=new r.YJl,a=e.std("#a08a6e"),n=ed(e,a,.16,0,.13,0,1,.9,1.1);t.add(n);let o=ed(e,a,.11,0,.2,.12,1,.9,1);for(let a of(o.rotation.x=.7,t.add(o),[-1,1]))t.add(ed(e,e.std("#c9aeae"),.035,.06*a,.29,.1,1,1,.5)),t.add(eh(e,e.std("#5a4a3a"),.035,.006,.006,.045*a,.2,.21));t.add(eu(e,e.std("#c9aeae"),.018,.04,0,.17,.23));let i=ef(e,a,[new r.Pq0(0,.05,-.12),new r.Pq0(.14,.02,-.2),new r.Pq0(.24,.01,-.1),new r.Pq0(.3,.02,.02)],.014);return t.add(i),{group:t,headY:.75,animate:e=>{let t=1+.025*Math.sin(1.1*e);n.scale.set(t,.9*t,1.1)}}}(e);case"card-gardener":{var a;let n=Number(null!=(a=t.variant)?a:"2");return em(e,"spade",n,{cap:"flat",brush:5===n,pot:7===n})}case"queen-of-hearts":return function(e,t){let a=e.std("#e8c8a8"),n=e.std("#7d2a33",{map:er(e,"#7d2a33","#e8b73a")}),o=ep(e,{h:1.6,torso:n,legs:n,skin:a,headR:.165,skirt:!0});for(let t of(o.group.add(es(e,new r.O3Y(.31,.018,8,26),e.std("#2a2a30"))).position.y=.18,o.group.children[o.group.children.length-1].rotation.x=Math.PI/2,o.group.add(eh(e,e.std("#f4efe2"),.3,.05,.2,0,o.shoulderY+.04,.02)),[-1,1])){o.head.add(ed(e,e.std("#2a2a30"),.019,.06*t,.02,.145));let a=eh(e,e.std("#3a2e22"),.07,.018,.02,.06*t,.075,.15);a.rotation.z=.35*t,o.head.add(a)}let i=es(e,new r.O3Y(.045,.008,6,14,.7*Math.PI),e.std("#7d2a33"));i.position.set(0,-.085,.145),i.rotation.set(0,0,.25+Math.PI),o.head.add(i);let l=new r.YJl,s=e.std(X.brass,{metalness:.75,roughness:.3});l.add(ec(e,s,.12,.13,.07,0,0,0));for(let t=0;t<6;t++){let a=t/6*Math.PI*2,n=eu(e,s,.024,.09,.11*Math.cos(a),.08,.11*Math.sin(a));l.add(n),l.add(ed(e,e.std("#f4efe2"),.014,.11*Math.cos(a),.135,.11*Math.sin(a)))}l.position.y=.18,o.head.add(l);let d=o.arms[1];d.rotation.x=-.4;let c=ec(e,a,.012,.012,.09,0,-.36,.02);d.add(c);let h=0,u="bench"===t?-.9:-.4;return{group:o.group,headY:o.headTopY+.65,animate:(e,t)=>
1{let a=(h=Math.max(0,h-t))>0?Math.sin(Math.min(1,(1.6-h)/1.6)*Math.PI):0;d.rotation.x=u-1.15*a},onSpeak:()=>{h=1.6}}}(e,t.variant);case"king-of-hearts":return function(e,t){let a="judge"===t,n=e.std("#e8c8a8"),o=Q(e,128,32,(e,t,a)=>{e.fillStyle="#f4efe2",e.fillRect(0,0,t,a),e.fillStyle="#2a2a30";for(let t=0;t<8;t++)e.beginPath(),e.ellipse(16*t+8,a/2,2.5,7,.2,0,2*Math.PI),e.fill()});o.wrapS=r.GJx,o.repeat.x=3;let i=e.std("#8a3a42",{map:er(e,"#8a3a42","#e8b73a")}),l=ep(e,{h:1.5,torso:i,legs:i,skin:n,headR:.16,skirt:!0}),s=es(e,new r.Ho_(.3,.31,.07,20,1,!0),e.std("#f4efe2",{map:o,side:r.$EB}));s.position.y=.1,l.group.add(s);let d=es(e,new r.O3Y(.13,.035,8,20),e.std("#f4efe2",{map:o}));for(let t of(d.rotation.x=Math.PI/2,d.position.y=l.shoulderY+.05,l.group.add(d),[-1,1])){l.head.add(ed(e,e.std("#2a2a30"),.017,.055*t,.02,.14));let a=eh(e,e.std("#b9b2a4"),.07,.018,.02,.045*t,-.05,.145);a.rotation.z=-(.3*t),l.head.add(a)}if(a){for(let t=0;t<8;t++){let a=-(.85*Math.PI)+t/7*Math.PI*1.7;l.head.add(ed(e,e.std("#dfdbd0"),.055,.14*Math.cos(a),-.02+t%2*.05,.12*Math.sin(a)-.03))}for(let t of[-1,1]){let a=ec(e,e.std("#dfdbd0"),.035,.035,.2,.14*t,-.16,-.04);l.head.add(a)}let t=e.std("#6b6f78",{metalness:.6,roughness:.3});for(let a of[-1,1]){let n=es(e,new r.O3Y(.035,.005,6,14),t);n.position.set(.055*a,.02,.155),l.head.add(n)}l.head.add(eh(e,t,.04,.006,.006,0,.02,.158))}let c=e.std(X.brass,{metalness:.75,roughness:.3}),h=new r.YJl;h.add(ec(e,c,.1,.11,.06,0,0,0));for(let t=0;t<5;t++){let a=t/5*Math.PI*2;h.add(eu(e,c,.02,.07,.09*Math.cos(a),.065,.09*Math.sin(a)))}return h.position.y=a?.21:.16,l.head.add(h),{group:l.group,headY:l.headTopY+.6,animate:e=>{l.head.rotation.y=.12*Math.sin(.4*e)}}}(e,t.variant);case"gryphon":return function(e){let t=new r.YJl,a=e.std("#c2925a"),n=e.std("#d8c9a6");for(let o of(t.add(ed(e,a,.34,-.38,.4,0,1.15,1,.95)),[-1,1])){t.add(ed(e,a,.16,-.5,.22,.22*o,1,1.3,.8)),t.add(ec(e,n,.06,.07,.42,.28,.21,.18*o));for(let a=-1;a<=1;a++){let n=eu(e,e.std("#8a744a"),.025,.1,.32+.04*a,.03,.18*o+.045*a);n.rotation.x=Math.PI/2.4,t.add(n)}}t.add(ed(e,n,.26,.12,.62,0,1,1.25,.9));let o=new r.YJl;o.position.set(.2,1.06,0),o.add(ed(e,n,.16,0,0,0,1.1,1,.95));let i=eu(e,e.std("#caa06a"),.06,.22,0,-.02,.2);i.rotation.x=Math.PI/2,o.add(i);let l=eu(e,e.std("#a87f4f"),.032,.09,0,-.075,.29);for(let t of(l.rotation.x=Math.PI-.45,o.add(l),[-1,1]))o.add(ed(e,e.std("#3a2e22"),.024,.08*t,.05,.1));for(let t=0;t<3;t++){let a=eu(e,n,.025,.12,-.06-.045*t,.12-.01*t,0);a.rotation.z=.7+.25*t,o.add(a)}t.add(o);let s=[];for(let o of[-1,1]){let i=new r.YJl;i.position.set(-.1,.74,.24*o);for(let t=0;t<5;t++){let o=eh(e,t%2?n:a,.5-.05*t,.05,.02,-.2-.07*t,.12-.05*t,0);o.rotation.z=.45+.12*t,i.add(o)}i.rotation.x=.35*o,t.add(i),s.push(i)}let d=ef(e,a,[new r.Pq0(-.66,.3,0),new r.Pq0(-.95,.12,.1),new r.Pq0(-1.1,.05,-.06)],.035);t.add(d),t.add(eu(e,a,.05,.12,-1.14,.06,-.08));let c=0;return{group:t,headY:1.55,animate:(e,a)=>{let n=(c=Math.max(0,c-a))>0?Math.abs(Math.sin((2.2-c)*6)):0;for(let a of(t.position.y=.12*n,t.rotation.y=.1*Math.sin(.25*e)+n*Math.sin(5*e)*.1,s))a.rotation.z=.5*n},onSpeak:()=>{c=2.2}}}(e);case"mock-turtle":return function(e){let t=new r.YJl,a=Q(e,256,256,(e,t,a)=>{e.fillStyle="#5e7a52",e.fillRect(0,0,t,a),e.strokeStyle="#3f5a44",e.lineWidth=6;for(let t=0;t<4;t++)for(let a=0;a<4;a++){let n=64*a+(t%2?32:0),o=64*t;e.strokeRect(n+6,o+6,52,52)}}),n=e.std("#5e7a52",{map:a}),o=e.std("#b09a78"),i=ed(e,n,.4,0,.62,-.08,1,1.25,.62);i.rotation.x=-.25,t.add(i);let l=ed(e,e.std("#d8c9a6"),.34,0,.56,.1,.95,1.1,.45);for(let a of(l.rotation.x=-.25,t.add(l),[-1,1])){let n=ec(e,o,.05,.045,.5,.18*a,.28,.22);n.rotation.x=.2,t.add(n),t.add(ec(e,e.std("#5a4a3a"),.05,.055,.07,.18*a,.04,.27))}for(let a of[-1,1]){let o=ed(e,n,.14,.3*a,.12,-.18,1.4,.35,1);o.rotation.y=.5*a,t.add(o)}let s=ec(e,o,.07,.09,.34,0,1.05,.06);s.rotation.x=-.25,t.add(s);let d=new r.YJl;d.position.set(0,1.28,.12),d.add(ed(e,o,.14,0,0,0,1,1.05,1.1));let c=eh(e,e.std("#c9b496"),.14,.1,.14,0,-.05,.15);for(let t of(c.rotation.x=.15,d.add(c),[-1,1])){d.add(ed(e,e.std("#3a2e22"),.012,.035*t,-.045,.225)),d.add(ed(e,e.std("#f4efe2"),.035,.07*t,.06,.11)),d.add(ed(e,e.std("#3a2e22"),.018,.07*t,.055,.14)),d.add(eh(e,o,.06,.014,.02,.07*t,.025,.13));let a=ed(e,o,.05,.15*t,.02,-.02,1.4,.5,.7);a.rotation.z=1.1*t,d.add(a),d.add(eu(e,e.std("#d8c9a6"),.02,.05,.08*t,.14,-.02))}t.add(d);let h=ef(e,o,[new r.Pq0(-.05,.4,-.3),new r.Pq0(-.1,.14,-.44),new r.Pq0(-.06,-.12,-.5)],.028);t.add(h),t.add(eu(e,e.std("#8a744a"),.045,.12,-.05,-.2,-.52));let u=[];for(let t of[-1,1]){let a=e.std("#bcd9e8",{transparent:!0,opacity:0,roughness:.2}),n=ed(e,a,.02,.07*t,-.01,.16);d.add(n),u.push(a)}return{group:t,headY:1.85,animate:e=>{let a=Math.max(0,Math.sin(.9*e))*Math.max(0,Math.sin(.23*e+1));for(let e of(t.rotation.z=.04*a,d.rotation.x=.18*a-.05,u))e.opacity=.25+.6*a}}}(e);case"knave-of-hearts":let n=em(e,"heart",1,{cap:"knave",chains:!0});return n.group.rotation.x=.06,n}}(t,e);if(a.group.position.set(e.pos[0],null!=(c=eb[e.id])?c:0,e.pos[1]),"center"===e.face?a.group.lookAt(0,a.group.position.y,0):a.group.rotation.y=e.face,a.group.userData.characterId=e.id,h.group.add(a.group),h.figures.set(e.id,{fig:a,char:e}),h.charRoots.push(a.group),a.animate)h.anims.push(a.animate);else{let t={y:a.group.position.y,home:a.group.rotation.y,face:a.group.rotation.y};h.poses.set(e.id,t);let n=0;for(let t=0;t<e.id.length;
1t++)n=(31*n+e.id.charCodeAt(t))%997;h.anims.push((e,o)=>{a.group.position.y=t.y+.014*Math.sin(1.5*e+n);let r=t.face+.035*Math.sin(.55*e+1.7*n);a.group.rotation.y+=(r-a.group.rotation.y)*Math.min(1,5*o)})}}h.group.visible=!1,a.add(h.group),p(h)})(l),i[l].group.visible=!0,s=l,d.ttl=0,d.mesh.visible=!1,d.stem.visible=!1,c=null)},setItems:e=>{for(let t of(l=e,i))t.group&&p(t)},update:(e,t,a)=>{let o=s>=0?i[s]:null;if(o&&n)for(let a of o.anims)a(e,t);if(d.ttl>0){d.ttl-=t;let e=Math.min(Math.min(1,(u+=t)/.25),Math.min(1,Math.max(0,d.ttl)/.5));d.mesh.material.opacity=e,d.stem.material.opacity=.9*e;let n=o&&c?o.figures.get(c):null;if(n){let e=n.fig.group.position,t=e.y+n.fig.headY;d.mesh.position.set(e.x,t,e.z),d.stem.position.set(e.x,t-.46,e.z),a.getWorldPosition(m);let o=Math.atan2(m.x-e.x,m.z-e.z);d.mesh.rotation.set(0,o,0)}else if(h){d.mesh.position.copy(h),d.stem.position.set(h.x,h.y-.46,h.z),a.getWorldPosition(m);let e=Math.atan2(m.x-h.x,m.z-h.z);d.mesh.rotation.set(0,e,0)}d.ttl<=0&&(d.mesh.visible=!1,d.stem.visible=!1,c=null)}},interactables:()=>s>=0?[...i[s].charRoots,...i[s].scaleProps,...i[s].lecternRoots]:[],speak:(e,t)=>{var a,n,o;let l=s>=0?i[s]:null,p=null==l?void 0:l.figures.get(e);if(!p)return null;let m=p.char.lines;if(!m.length)return null;let g=void 0!==t?Math.min(Math.max(0,t),m.length-1):((null!=(o=f.get(e))?o:-1)+1)%m.length;f.set(e,g);let w=m[g];return d.paint(p.char.name,w.text,w.ref),c=e,u=0,d.ttl=r.cj9.clamp(3.5+.045*w.text.length,4.5,12),d.mesh.visible=!0,d.stem.visible=!0,null==(a=(n=p.fig).onSpeak)||a.call(n),h=null,w.audio&&(d.ttl=Math.max(d.ttl,6)),{name:p.char.name,text:w.text,ref:w.ref,audio:w.audio}},annotate:(e,t,a)=>{let n=s>=0?i[s]:null;if(!n)return!1;let o=n.lecternRoots.find(t=>t.userData.itemId===e);return!!o&&(d.paint(t,a,"About this line \xb7 Hottub notes"),c=null,h=new r.Pq0(o.position.x,2.05,o.position.z),u=0,d.ttl=r.cj9.clamp(4+.045*a.length,8,22),d.mesh.visible=!0,d.stem.visible=!0,!0)},holdPlate:()=>{d.mesh.visible&&(d.ttl=3600)},releasePlate:()=>{d.ttl>4&&(d.ttl=2)},faceSpeaker:e=>{var t,a;let n=s>=0?i[s]:null;if(!n)return;let o=e?null==(t=n.figures.get(e))?void 0:t.fig.group.position:null;for(let[t,r]of n.poses){if(!o||t===e){r.face=r.home;continue}let i=null==(a=n.figures.get(t))?void 0:a.fig.group.position;i&&(r.face=Math.atan2(o.x-i.x,o.z-i.z))}},hallName:()=>s>=0?i[s].name:null,characterPosition:e=>{let t=s>=0?i[s].figures.get(e):null;if(!t)return null;let a=t.fig.group.position;return{x:a.x,y:a.y+t.fig.headY,z:a.z}},setMotion:e=>{n=e},motionOn:()=>n,dispose:()=>{for(let e of i)e.group&&a.remove(e.group),e.group=null,e.figures.clear(),e.charRoots.length=0,e.anims.length=0;t.dispose()}}}({reducedMotion:tD});try{let e=localStorage.getItem("hottub:wonderland-motion");null!==e&&e6.setMotion("on"===e)}catch(e){}t4.current=e6,t6(e6.motionOn()),C.add(e6.group),t3=!0}p.items!==tm&&(tm=p.items,ty=E(p.items),e6.setItems(p.items));let a=ty,u=a.length?Math.min(Math.max(0,td.current),a.length-1):0,f=u!==e8;f&&(e8=u,a4=1,t1.current&&t0.current&&(t0.current.dispose(),t0.current=(0,S.Tu)(null!=(i=null==(o=a[u])?void 0:o.name)?i:""),t0.current.start())),e6.setHall(u,null==(n=a[u])?void 0:n.name),f&&(te?to():ae(K(null!=(s=null==(l=a[u])?void 0:l.name)?s:"")?"idle":"hidden"));let m=null!=(d=p.readAlong)?d:null;if(m&&((null==e7?void 0:e7.at)!==m.at||(null==e7?void 0:e7.idx)!==m.idx)){e7=m;let e=K(null!=(c=e6.hallName())?c:""),t=null==e?void 0:e.cues[m.idx];if(t){e6.faceSpeaker(t.characterId);let e=e6.speak(t.characterId,t.line);e6.holdPlate(),aa.current="read",ae("playing"),ah(al.current===t.characterId&&e?e.text:null)}}else!m&&e7&&(e7=null,e6.faceSpeaker(null),e6.releasePlate(),ah(null),"read"===aa.current&&ae(K(null!=(h=e6.hallName())?h:"")?"idle":"hidden"));e6.update(e,t,I.xr.isPresenting?I.xr.getCamera():_),e_.visible=!1,eB.intensity=0,e4&&(e4=!1,eK.visible=!1,R.intensity=1,D.intensity=.95,eQ&&(eQ.intensity=0),eX&&(eX.intensity=0));return}let m=!!p&&"gallery"===p.kind;if(m!==e4&&(e4=m,eK.visible=m,R.intensity=m?.5:1,D.intensity=m?.45:.95,eQ&&(eQ.intensity=2.6*!!m),eX&&(eX.intensity=.95*!!m)),!p||"gallery"!==p.kind){e_.visible=!1,eB.intensity=0;return}e_.visible=!0,eB.intensity=1.5;let g=null==eZ?void 0:eZ.geometry.getAttribute("position");if(g){let a=g.array;for(let n=0;n<e2.length;n++){let o=a[3*n+1]+e2[n]*t;o>e0&&(o=.4),a[3*n+1]=o,a[3*n]=e1[2*n]+.18*Math.sin(.25*e+e5[n]),a[3*n+2]=e1[2*n+1]+.18*Math.cos(.22*e+e5[n])}g.needsUpdate=!0}eQ&&(eQ.intensity=2.6*(1+.05*Math.sin(.5*e))),p.items!==tm&&(tm=p.items,ty=E(p.items));let w=ty,b=w.length?Math.min(Math.max(0,td.current),w.length-1):0,y=null!=(u=w[b])?u:{name:"Gallery",items:p.items},x=y.items.some(e=>e.id===p.featuredId)?p.featuredId:null!=(f=null==(a=y.items[0])?void 0:a.id)?f:null,v=p.theme+"|"+b+"|"+y.items.map(e=>e.id).join(",")+"|"+(null!=x?x:"");if(v!==tf&&(tf=v,!function(e,t,a){var n,o;for(let e of(t3=!0,ts))tM(e);ts.length=0,tu&&(tM(tu),tu=null);let i=tl(a),l=(e,t,a,n,o)=>{let l=function(e){let t=document.createElement("canvas");t.width=512,t.height=160;let a=t.getContext("2d");a.fillStyle=eP.cream,eA(a,8,8,496,144,16),a.fill(),a.lineWidth=4,a.strokeStyle="rgba(12,59,70,0.25)",a.stroke(),a.textAlign="center",a.textBaseline="middle",a.fillStyle=eP.ink,a.font="800 38px Georgia, serif",a.fillText(e.title,256,54,472),e.subtitle&&(a.fillStyle="rgba(12,59,70,0.8)",a.font="600 28px Georgia, serif",a.fillText(e.subtitle,256,96,472)),e.credit&&(a.fillStyle="rgba(12,59,70,0.55)",a.font="500 22px system-ui, sans-serif",a.fillText(e.credit,256,134,472));let n=new r.GOR(t);
1return n.colorSpace=r.er$,n.anisotropy=4,n}(t),s=new r.V9B({map:l,transparent:!0,depthWrite:!1}),d=new r.bdM(i?.6:.7,i?.18:.2),c=new r.eaF(d,s);c.position.set(Math.cos(a)*n,o,Math.sin(a)*n),c.lookAt(0,c.position.y,0),c.renderOrder=5,e.tex.push(l),e.mats.push(s),e.extras.push(d),e_.add(c),e.nodes.push(c)};if(i){let t=e.length<=12?[G+2.6]:[G+2.2,G+3.7],o=[1.4,1.7],i=t.length,s=t.map(a=>Math.floor(e.length*a/t.reduce((e,t)=>e+t,0)));for(let t=e.length-s.reduce((e,t)=>e+t,0),a=i-1;t>0;a=(a-1+i)%i,t--)s[a]++;let d=0;for(let c=0;c<i;c++){let h=t[c],u=s[c],f=null!=(n=o[c])?n:1.4,p=c*Math.PI/i;for(let t=0;t<u&&d<e.length;t++,d++){let n=e[d],o=p+t/Math.max(1,u)*Math.PI*2,i=Math.cos(o)*h,s=Math.sin(o)*h,c=tv(n,a,.8);c.obj.userData.itemId=n.id,c.obj.position.set(i,f,s),c.obj.lookAt(0,f,0),e_.add(c.obj);let m=f-.336,g=new r.eaF(eO,eG);g.scale.y=Math.max(.2,m)/1.05,g.position.set(i,m/2,s),e_.add(g),c.nodes.push(g),l(c,n,o,h-.06,f-.336-.14),ts.push(c)}}}else{let t=G+3.9,n=e.length>20?[{y:1.3,n:Math.ceil(e.length/2)},{y:2.78,n:Math.floor(e.length/2)}]:[{y:1.5,n:e.length}],o=0;for(let r=0;r<n.length;r++){let{y:i,n:s}=n[r],d=1===r?Math.PI/Math.max(1,s):0;for(let n=0;n<s&&o<e.length;n++,o++){let r=e[o],c=d+n/Math.max(1,s)*Math.PI*2,h=Math.cos(c)*t,u=Math.sin(c)*t,f=tv(r,a,1.25);f.obj.userData.itemId=r.id,f.obj.position.set(h,i,u),f.obj.lookAt(0,i,0),e_.add(f.obj),l(f,r,c,t-.05,i-.6875-.15),ts.push(f)}}}let s=null!=(o=e.find(e=>e.id===t))?o:e[0];s&&((tu=tv(s,a,i?1.6:1.9)).obj.position.set(0,i?1.55:1.9,0),e_.add(tu.obj))}(y.items,x,p.theme)),!tD){let a=tl(p.theme)?.5:.25;for(let e of ts)e.obj.rotation.y+=t*a;tu&&(tu.obj.rotation.y+=t*(a+.2),tu.obj.position.y=(tl(p.theme)?1.6:1.9)+.04*Math.sin(.8*e))}})(Y,j),!I.xr.isPresenting&&0!==np.yaw){let e=1.5*np.yaw*j,t=Math.cos(e),a=Math.sin(e),n=A.target.x-_.position.x,o=A.target.z-_.position.z;A.target.x=_.position.x+(n*t+o*a),A.target.z=_.position.z+(-n*a+o*t)}if(!I.xr.isPresenting&&0!==np.u){let e=Math.max(.8*a5,Math.min(3.4*Math.max(1,a5),_.position.y+1.7*np.u*a5*j))-_.position.y;_.position.y+=e,A.target.y+=e}if(!I.xr.isPresenting&&(0!==np.f||0!==np.r)&&(_.getWorldDirection(ng),ng.y=0,ng.lengthSq()>1e-6)){ng.normalize(),nw.set(-ng.z,0,ng.x);let e=2.4*a5*j,t=ng.x*np.f*e+nw.x*np.r*e,a=ng.z*np.f*e+nw.z*np.r*e;_.position.x+=t,_.position.z+=a,A.target.x+=t,A.target.z+=a;let n=Math.hypot(_.position.x,_.position.z);if(n>nm){let e=n-nm,t=_.position.x/n,a=_.position.z/n;_.position.x-=t*e,_.position.z-=a*e,A.target.x-=t*e,A.target.z-=a*e}}I.xr.isPresenting||A.update(),I.render(C,_),t$||(t2=!0,t7())});let nx=null,nv=()=>{let e=n.clientWidth||window.innerWidth,t=n.clientHeight||window.innerHeight,a=t>=e;(_.aspect=e/t,a!==nx)&&(_.fov=a?70:58,_.position.set(0,1.7,a?5.8:4.2),A.target.set(0,1.05,0),a2=0,A.update(),nx=a);_.updateProjectionMatrix(),I.setSize(e,t)};return nv(),window.addEventListener("resize",nv),window.addEventListener("orientationchange",nv),()=>{var e,t,a,n,o;for(let{c:e,sel:t,sq:a}of(tB=!0,tV.abort(),null==tU||tU.dispose(),tU=null,clearTimeout(an),window.removeEventListener("keydown",nb),window.removeEventListener("keyup",ny),window.removeEventListener("resize",nv),window.removeEventListener("orientationchange",nv),window.removeEventListener("keydown",aV),window.removeEventListener("keyup",aQ),I.xr.removeEventListener("sessionstart",nu),I.xr.removeEventListener("sessionend",nf),nh))e.removeEventListener("selectstart",t),e.removeEventListener("squeezestart",a),C.remove(e);let r=tZ.current;for(let t of(r&&(r.isPlaying&&r.stop(),r.disconnect()),tZ.current=null,null==(e=t0.current)||e.dispose(),t0.current=null,ao&&_.remove(ao),ts))tM(t);for(let e of(tu&&tM(tu),ta&&(clearTimeout(ta),ta=null),te=null,e9&&(e9.pause(),e9=null),e6&&(C.remove(e6.group),e6.dispose(),e6=null,t4.current=null),tX.current=null,t_&&(C.remove(t_),(0,c.Vr)(t_),t_=null),tj&&(C.remove(tj),tj.traverse(e=>{var t,a,n;null==(a=e.geometry)||null==(t=a.dispose)||t.call(a);let o=e.material;Array.isArray(o)?o.forEach(e=>e.dispose()):null==o||null==(n=o.dispose)||n.call(o)}),tj=null),C.remove(eB),I.domElement.removeEventListener("pointerdown",ne),I.domElement.removeEventListener("pointerup",nt),A.dispose(),T.remove(),tb.current=null,(0,w.NP)(I),F))null==(a=e.geometry)||null==(t=a.dispose)||t.call(a),Array.isArray(e.material)?e.material.forEach(e
1=>e.dispose()):null==(o=e.material)||null==(n=o.dispose)||n.call(o);for(let e of W)e.dispose()}},[D,z,H,O,ee,eN,eg,ew,eR,eY]),(0,o.useEffect)(()=>{let e=()=>{let e=ab.current;ab.current=null,aS.current=!1,null==e||e.stop();let t=aV.current;aV.current=null,aK.current=!1,null==t||t.stop();let a=ax.current;ax.current=null,av.current=[],aM.current=[],null==a||a.stop()};return window.addEventListener("pagehide",e),()=>{window.removeEventListener("pagehide",e),e()}},[]);let a8="live"===aI||"connecting"===aI,a7="subtub"!==z&&!!(null==H?void 0:H.trim()),a9=null!=(b=null==H?void 0:H.trim())?b:"",ne={flex:1,padding:"6px 8px",borderRadius:9,cursor:"pointer",border:"1px solid var(--surface-2)",background:"var(--surface-2)",color:"var(--water-ink)",font:"700 0.78rem/1 var(--font-sans, system-ui)"};return(0,n.jsxs)("div",{ref:eD,className:"xr-host".concat(tT?" xr-host--immersive":"").concat(tj?" xr-host--fs":""),children:[(0,n.jsxs)("div",{className:"xr-loading".concat(tf?" is-ready":""),role:"status","aria-hidden":tf,children:[(0,n.jsx)("span",{className:"xr-loading__sun","aria-hidden":"true"}),(0,n.jsx)("p",{className:"xr-loading__text",children:W?"Stepping into ".concat(W,"…"):"Stepping into the room…"})]}),(0,n.jsx)("p",{className:"xr-sr-live","aria-live":"polite",children:[tj?"Full screen on.":"",a8?"Voice connected. ".concat(aT," ").concat(1===aT?"other person":"others"," here."):""].filter(Boolean).join(" ")}),!tT&&(0,n.jsxs)("a",{href:null!=U?U:B,className:"xr-leave","aria-label":"Leave this room and go back",style:{position:"absolute",left:12,top:12,zIndex:7,display:"inline-flex",alignItems:"center",gap:6,padding:"8px 13px",borderRadius:999,textDecoration:"none",background:"color-mix(in srgb, var(--paper) 92%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 4px 14px rgba(12,59,70,0.14)",font:"800 0.84rem/1 var(--font-sans, system-ui)",color:"var(--water-ink)"},children:["← ",$]}),W&&!tT&&(0,n.jsx)("div",{className:"xr-roomtitle",style:{position:"absolute",left:12,top:54,zIndex:6,maxWidth:240,padding:"7px 12px",borderRadius:999,background:"color-mix(in srgb, var(--paper) 90%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 4px 14px rgba(12,59,70,0.12)",font:"800 0.84rem/1.2 var(--font-sans, system-ui)",color:"var(--water-ink)",pointerEvents:"none",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:W}),!eO&&!tT&&"subtub"!==z&&(()=>{let e=(null==H?void 0:H.trim())||(null==eg?void 0:eg.trim())||"",t=(null==q?void 0:q.trim())||(null==ex?void 0:ex.trim())||"",a=e.length>0,o=()=>{eW&&eq(!0)},r={position:"absolute",left:12,top:W?96:54,zIndex:6,display:"inline-flex",alignItems:"center",gap:8,maxWidth:220,padding:"6px 11px",borderRadius:999,textDecoration:"none",background:"color-mix(in srgb, var(--paper) 90%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 4px 14px rgba(12,59,70,0.12)",transition:"opacity .5s ease, transform .5s ease",opacity:eW?0:a?1:.7,transform:eW?"translateX(-14px) scale(0.96)":"none"},i=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{"aria-hidden":"true",style:{width:15,height:15,borderRadius:"50%",flexShrink:0,background:a?"radial-gradient(circle at 35% 35%, #ffd9a8, #ff7a4d 72%)":"radial-gradient(circle at 35% 35%, color-mix(in srgb, #ff7a4d 42%, var(--paper)), color-mix(in srgb, #ff7a4d 20%, var(--paper)) 72%)",boxShadow:a?"0 0 7px rgba(255,122,77,0.55)":"none"}}),(0,n.jsxs)("span",{style:{display:"inline-flex",flexDirection:"column",lineHeight:1.12,minWidth:0},children:[(0,n.jsx)("span",{style:{fontSize:"0.58rem",fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted, #7c8a8a)"},children:"Sponsor"}),a&&(0,n.jsx)("span",{style:{fontSize:"0.82rem",fontWeight:800,color:"var(--water-ink)",maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})]});return a&&t?(0,n.jsx)("a",{href:t,"aria-label":"Sponsor: ".concat(e),title:"Sponsored by ".concat(e),onTransitionEnd:o,style:r,children:i}):(0,n.jsx)("div",{role:"note","aria-label":a?"Sponsor: ".concat(e):"Sponsor slot — open",title:a?"Sponsored by ".concat(e):"This space can be sponsored",onTransitionEnd:o,style:r,children:i})})(),!tT&&!eN&&"subtub"!==z&&eC&&"joined"!==ez&&(0,n.jsx)("button",{type:"button",onClick:()=>void eG(),disabled:"joining"===ez||"pending"===ez,"aria-label":W?"Join ".concat(W):"Join this Hottub",style:{position:"absolute",left:"50%",top:14,transform:"translateX(-50%)",zIndex:7,display:"inline-flex",alignItems:"center",gap:8,maxWidth:"74vw",padding:"9px 18px",borderRadius:999,border:0,cursor:"joining"===ez||"pending"===ez?"default":"pointer",background:"error"===ez?"var(--surface-2, #e6ebec)":"linear-gradient(180deg, #ff9d5c, #ff7a4d)",color:"error"===ez?"var(--water-ink)":"#fff",font:"800 0.92rem/1 var(--font-sans, system-ui)",boxShadow:"0 6px 18px rgba(255,122,77,0.34)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"joining"===ez?"Joining…":"pending"===ez?"Request sent":"error"===ez?"Try again":W?"Join ".concat(W):"Join this Hottub"}),!tT&&(0,n.jsxs)("div",{style:{position:"absolute",right:"calc(max(14px, env(safe-area-inset-right)) + clamp(40px, 11vw, 50px) + 10px)",top:"max(14px, env(safe-area-inset-top))",zIndex:7,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:8,maxWidth:"calc(100vw - clamp(40px, 11vw, 50px) - 160px)",font:"700 0.84rem/1.1 var(--font-sans, system-ui)",color:"var(--water-ink)"},children:[(0,n.jsxs)("div",{style:{display:"inline-flex",flexWrap:"wrap",justifyContent:"flex-end",gap:6},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>tL(e=>!e),"aria-pressed":tJ,title:tJ?"Hide your avatar":"Show your avatar",style:{display:"inline-flex",alignItems:"center",gap:7,cursor:"pointer",padding:"8px 13px",borderRadius:999,whiteSpace:"nowrap",background:"color-mix(in srgb, var(--paper) 92%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 4px 14px rgba(12,59,70,0.14)",font:"inherit",color:"inherit"},children:[(0,n.jsx)("span",{"aria-hidden":"true",style:{width:14,height:14,borderRadius:"50%",flexShrink:0,background:tB.color,boxShadow:tJ?"0 0 0 2px color-mix(in srgb, ".concat(tB.color," 40%, transparent)"):"none",opacity:tJ?1:.4}}),tJ?"Avatar: on":"Avatar: off"]}),(0,n.jsx)("button",{type:"button",onClick:()=>t$(e=>!e),"aria-expanded":tV,"aria-label":"Customize your avatar",title:"Customize your avatar",style:{display:"inline-flex",alignItems:"center",cursor:"pointer",padding:"8px 11px",borderRadius:999,background:"color-mix(in srgb, var(--paper) 92%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 4px 14px rgba(12,59,70,0.14)",font:"inherit",color:"inherit"},children:"Customize"})]}),tV&&(0,n.jsxs)("div",{role:"group","aria-label":"Avatar customization",style:{width:232,padding:12,borderRadius:14,background:"color-mix(in srgb, var(--paper) 95%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 8px 24px rgba(12,59,70,0.18)",display:"flex",flexDirection:"column",gap:11,textAlign:"left"},children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontSize:"0.62rem",fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted, #7c8a8a)",marginBottom:6},children:"Color"}),(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:7},children:c.CK.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>tU(t=>({...t,color:e})),"aria-label":"Color ".concat(e),"aria-pressed":tB.color===e,style:{width:24,height:24,borderRadius:"50%",cursor:"pointer",background:e,border:tB.color===e?"2px solid var(--water-ink)":"2px solid transparent",boxShadow:tB.color===e?"0 0 0 2px color-mix(in srgb, var(--water-ink) 25%, transparent)":"none"}},e))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontSize:"0.62rem",fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted, #7c8a8a)",marginBottom:6},children:"Body"}),(0,n.jsx)("div",{style:{display:"flex",gap:6},children:c.rr.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>tU(t=>({...t,body:e})),"aria-pressed":tB.body===e,style:{flex:1,padding:"7px 4px",borderRadius:9,cursor:"pointer",font:"700 0.76rem/1 var(--font-sans, system-ui)",background:tB.body===e?"var(--water-ink)":"transparent",color:tB.body===e?"var(--paper)":"var(--water-ink)",border:"1px solid var(--surface-2)"},children:c.kb[e]},e))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontSize:"0.62rem",fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted, #7c8a8a)",marginBottom:6},children:"Accessory"}),(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:c.pr.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>tU(t=>({...t,hat:e})),"aria-pressed":tB.hat===e,style:{padding:"7px 11px",borderRadius:9,cursor:"pointer",font:"700 0.76rem/1 var(--font-sans, system-ui)",background:tB.hat===e?"var(--water-ink)":"transparent",color:tB.hat===e?"var(--paper)":"var(--water-ink)",border:"1px solid var(--surface-2)"},children:c.jC[e]},e))})]}),!tJ&&(0,n.jsx)("p",{style:{margin:0,fontSize:"0.72rem",color:"var(--muted, #7c8a8a)",fontWeight:600},children:"Your avatar is hidden — turn “My avatar” on to see these changes in the room."})]})]}),eB&&(0,n.jsx)("div",{className:"xr-host__note",children:(0,n.jsxs)("p",{children:["This browser blocked 3D (WebGL). If you’re on ",(0,n.jsx)("strong",{children:"Brave"}),", tap the Shields icon and turn Shields ",(0,n.jsx)("strong",{children:"down for this site"})," (or allow fingerprinting), then reload — it works in Safari, Edge, Chrome, and the Quest browser."]}
1)}),tm&&!eB&&(0,n.jsx)("div",{className:"xr-host__note",role:"alert",children:(0,n.jsx)("p",{children:"The Rust world could not open on this device. Leave and try the room again; voice and sponsorship were not allowed to hide the failure."})}),!eB&&!eN&&!tv&&(0,n.jsxs)("button",{type:"button",className:"xr-enter".concat(tH?" xr-enter--raised":""),onClick:function(){if(eJ){var e;null==(e=tb.current)||e.click();return}tx(!0),tk.current&&clearTimeout(tk.current),tk.current=setTimeout(tS,5500)},"aria-label":eJ?"Enter VR":"About VR mode",children:[(0,n.jsx)("span",{className:"xr-enter__icon","aria-hidden":"true",children:"\uD83E\uDD7D"}),"Enter VR"]}),ty&&(0,n.jsxs)("div",{className:"xr-vrhint",role:"status",children:[(0,n.jsx)("button",{type:"button",className:"xr-vrhint__x",onClick:tS,"aria-label":"Close",children:"\xd7"}),(0,n.jsx)("span",{className:"xr-vrhint__sun","aria-hidden":"true"}),(0,n.jsxs)("p",{className:"xr-vrhint__text",children:[(0,n.jsx)("strong",{children:"Step inside in VR."})," Open this room on a Meta\xa0Quest or Apple\xa0Vision\xa0Pro to soak in full VR. For now, drag to look around — you’re welcome here either way."]}),(0,n.jsx)("button",{type:"button",className:"xr-vrhint__ok",onClick:tS,children:"Got it"})]}),ac&&(0,n.jsxs)("div",{className:"xr-rotate",role:"status",style:{borderColor:"var(--coral-500, #f26d4a)"},children:[(0,n.jsxs)("span",{className:"xr-rotate__text",children:[(0,n.jsx)("strong",{children:"Your line — read it aloud:"})," “",ac,"”"]}),(0,n.jsx)("button",{type:"button",className:"xr-rotate__x",onClick:()=>{var e;return null==(e=at.current)?void 0:e.next()},"aria-label":"Done — next line",children:"▸"})]}),tH&&(0,n.jsxs)("div",{className:"xr-rotate",role:"note",children:[(0,n.jsx)("span",{className:"xr-rotate__icon".concat(tY?"":" is-spin"),"aria-hidden":"true",children:"⟲"}),(0,n.jsx)("span",{className:"xr-rotate__text",children:"Rotate for the full room"}),(0,n.jsx)("button",{type:"button",className:"xr-rotate__x",onClick:()=>tz(!0),"aria-label":"Dismiss",children:"\xd7"})]}),tO&&(0,n.jsxs)("div",{role:"note",style:{position:"absolute",left:"50%",bottom:74,transform:"translateX(-50%)",zIndex:6,display:"inline-flex",alignItems:"center",gap:10,maxWidth:"92vw",padding:"7px 12px",borderRadius:999,background:"color-mix(in srgb, var(--paper) 90%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 4px 14px rgba(12,59,70,0.12)",font:"600 0.8rem/1.2 var(--font-sans, system-ui)",color:"var(--ink-700, var(--water-ink))"},children:[(0,n.jsxs)("span",{children:["Drag to look \xb7 ",(0,n.jsx)("strong",{children:"WASD"})," to walk \xb7 ",(0,n.jsx)("strong",{children:"C"})," to crouch"]}),(0,n.jsx)("button",{type:"button",onClick:()=>tW(!0),"aria-label":"Dismiss",style:{border:0,background:"transparent",cursor:"pointer",color:"inherit",fontSize:"1rem",lineHeight:1,padding:0},children:"\xd7"})]}),ea&&(0,n.jsxs)("div",{className:"xr-world",role:"status","aria-live":"polite",style:{position:"absolute",left:12,bottom:84,zIndex:6,maxWidth:280,padding:"11px 13px",borderRadius:14,background:"color-mix(in srgb, var(--paper) 92%, transparent)",border:"1px solid var(--surface-2)",boxShadow:"0 6px 20px rgba(12,59,70,0.14)",font:"500 0.82rem/1.35 var(--font-sans, system-ui)",color:"var(--water-ink)",pointerEvents:"auto"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:7,marginBottom:4},children:[(0,n.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",flex:"0 0 auto",background:"live"===eQ?"#3aa66f":"connecting"===eQ?"#d8a23a":"#b06a5a"}}),(0,n.jsx)("strong",{style:{fontWeight:800,fontSize:"0.86rem"},children:null!=tt?tt:"gallery"===e1?"The gallery":"The lake"}),("gallery"===e1?e3:eZ)!=null&&(0,n.jsxs)("span",{style:{marginLeft:"auto",color:"var(--water-700)",fontVariantNumeric:"tabular-nums"},children:["gallery"===e1?"".concat(e3," ").concat(null!=(y=eT[null!=e5?e5:"coin"])?y:"items"):"".concat(eZ," fish"),null!=e9&&e9>1?" \xb7 ".concat(e9," here"):""]})]}),"gallery"===e1&&e8&&(0,n.jsxs)("p",{style:{margin:"0 0 6px",fontSize:"0.78rem",color:"var(--water-ink)"},children:[(0,n.jsx)("span",{style:{fontWeight:800},children:"Spotlight"})," \xb7 ",e8]}),tn.length>0?(0,n.jsx)("p",{style:{margin:"0 0 9px",color:"var(--water-700)"},children:tn[0].summary}):(0,n.jsx)("p",{style:{margin:"0 0 9px",color:"var(--water-700)"},children:"connecting"===eQ?"gallery"===e1?"Reaching the gallery…":"Reaching the lake…":"gone"===eQ||"error"===eQ?"Out of reach.":"gallery"===e1?"Quiet cases. Something will arrive.":"Still water. Something will stir."}),(null==eg?void 0:eg.trim())&&(0,n.jsxs)("p",{style:{margin:"0 0 9px",fontSize:"0.72rem",color:"var(--water-700)"},children:[(0,n.jsx)("span",{style:{fontWeight:800,color:"var(--water-ink)"},children:"gallery"===e1?"Gallery":"Shoreline"})," \xb7 ",ex?(0,n.jsx)("a",{href:ex,style:{color:"var(--water-700)",textDecoration:"underline"},children:eg.trim()}):eg.trim(),(0,n.jsx)("span",{style:{opacity:.7},children:" \xb7 Sponsor"})]}),"fishing"===e1&&(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsx)("button",{type:"button",onClick:()=>void tw("catch"),disabled:"live"!==eQ,style:ne,children:"Cast a line"}),(0,n.jsx)("button",{type:"button",onClick:()=>void tw("stock",{count:3}),disabled:"live"!==eQ,style:ne,children:"Leave a few"})]})]}),aN&&(0,n.jsxs)("div",{className:"xr-afterglow",role:"dialog","aria-label":"After your soak",style:{position:"absolute",left:"50%",bottom:"max(20px, calc(env(safe-area-inset-bottom) + 16px))",transform:"translateX(-50%)",zIndex:12,width:"min(92vw, 380px)",padding:"16px 18px",borderRadius:18,background:"color-mix(in srgb, var(--paper) 96%, transparent)",border:"1px solid color-mix(in srgb, var(--coral-600) 30%, transparent)",boxShadow:"0 14px 40px rgba(0,0,0,0.22)",WebkitBackdropFilter:"blur(10px)",backdropFilter:"blur(10px)"},children:[(0,n.jsx)("button",{type:"button",onClick:()=>aD(!1),"aria-label":"Close",style:{position:"absolute",top:8,right:10,border:0,background:"transparent",fontSize:"1.2rem",lineHeight:1,color:"var(--ink-500)",cursor:"pointer"},children:"\xd7"}),(0,n.jsx)("p",{style:{margin:"0 0 4px",fontWeight:800,color:"var(--water-700)",fontSize:"0.82rem"},children:"Thanks for being here."}),(0,n.jsx)("p",{style:{margin:"0 0 10px",color:"var(--ink-500)",fontSize:"0.92rem",lineHeight:1.4},children:aY.current>0?"You shared the soak with ".concat(aY.current," ").concat(1===aY.current?"other person":"others","."):"Hope the soak was a good one."}),a7&&(0,n.jsxs)("div",{style:{borderTop:"1px solid var(--line)",paddingTop:10},children:[(0,n.jsxs)("p",{style:{margin:"0 0 8px",color:"var(--ink-500)",fontSize:"0.88rem",lineHeight:1.4},children:[(0,n.jsx)("strong",{style:{color:"var(--ink-900, #0c3b46)"},children:a9}),L?" hosted this soak":" — you might love it",O?" \xb7 ".concat(O):"",".",L?" Keep it going in person?":""]}),q&&(0,n.jsxs)("a",{href:q,target:"_blank",rel:"noopener noreferrer",className:"xr-sp
1onsor__go",style:{display:"inline-flex",alignItems:"center",gap:6,textDecoration:"none",fontWeight:700,color:"var(--coral-600)",fontSize:"0.92rem"},children:["Visit ",a9," ↗"]})]})]}),(0,n.jsxs)("div",{className:"xr-controls","data-open":tq,children:[(0,n.jsx)("button",{type:"button",className:"xr-ctl xr-ctl--menu",onClick:()=>tG(e=>!e),"aria-expanded":tq,"aria-haspopup":"menu","aria-label":tq?"Close room menu":"Open room menu",children:(0,n.jsx)("span",{className:"xr-ctl__mark","aria-hidden":"true",children:"H"})}),tq&&(0,n.jsxs)("div",{className:"xr-controls__panel",role:"menu","aria-label":"Room actions",children:[(0,n.jsxs)("div",{className:"xr-controls__brand",children:[(0,n.jsx)("span",{className:"xr-brand__mark","aria-hidden":"true",children:"H"}),(0,n.jsx)("span",{className:"xr-controls__brandword",children:"Hottub"})]}),(0,n.jsx)("p",{className:"xr-controls__group","aria-hidden":"true",children:"Room"}),(0,n.jsx)("a",{className:"xr-ctl",href:B,role:"menuitem",children:"← All rooms"}),tr.length>1&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"xr-controls__group","aria-hidden":"true",children:"Hall"}),(0,n.jsxs)("div",{className:"xr-ctl__hall",role:"group","aria-label":"Gallery hall",children:[(0,n.jsx)("button",{type:"button",className:"xr-ctl xr-ctl--hallnav",onClick:()=>tu(tl-1),"aria-label":"Previous hall",children:"◂"}),(0,n.jsxs)("span",{className:"xr-ctl__hallname","aria-live":"polite",children:[null!=(x=null==(t=tr[tl])?void 0:t.name)?x:"Gallery",(0,n.jsxs)("span",{className:"xr-ctl__hallmeta",children:[" \xb7 ",null!=(v=null==(a=tr[tl])?void 0:a.count)?v:0," works \xb7 ",tl+1,"/",tr.length]})]}),(0,n.jsx)("button",{type:"button",className:"xr-ctl xr-ctl--hallnav",onClick:()=>tu(tl+1),"aria-label":"Next hall",children:"▸"})]})]}),(0,n.jsx)("p",{className:"xr-controls__group","aria-hidden":"true",children:"View"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:function(){var e,t,a,n,o;let r=document;if(r.fullscreenElement||r.webkitFullscreenElement){null!=(null==(a=r.exitFullscreen)?void 0:a.call(r))||null==(n=r.webkitExitFullscreen)||n.call(r);return}if(tT)return void tC(!1);let i=eD.current,l=null!=(o=null==i||null==(e=i.requestFullscreen)?void 0:e.bind(i))?o:null==i||null==(t=i.webkitRequestFullscreen)?void 0:t.bind(i);l?Promise.resolve(l()).catch(e=>{console.warn("[SpatialSoak] native fullscreen rejected; using immersive fallback.",e),tC(!0)}):(console.info("[SpatialSoak] Element.requestFullscreen unavailable (e.g. iOS Safari); using immersive fallback."),tC(!0))},"aria-pressed":tj,role:"menuitem",children:tj?"⤡ Exit full screen":"⤢ Full screen"}),(0,n.jsxs)("span",{className:"xr-ctl__status xr-ctl__keys",children:[(0,n.jsx)("b",{children:"WASD"})," walk \xb7 ",(0,n.jsx)("b",{children:"←"}),"/",(0,n.jsx)("b",{children:"→"})," turn \xb7 ",(0,n.jsx)("b",{children:"E"}),"/",(0,n.jsx)("b",{children:"Q"})," up\xb7down \xb7 drag to look \xb7 ",(0,n.jsx)("b",{children:"Space"})," menu"]}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"xr-controls__group","aria-hidden":"true",children:"Ambient sound"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:aw,"aria-pressed":t2,role:"menuitem",children:t2?"\uD83D\uDD0A Ambient: on":"\uD83D\uDD08 Ambient: off"})]}),null!==t3&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"xr-controls__group","aria-hidden":"true",children:"Characters"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:ag,"aria-pressed":t3,role:"menuitem",children:t3?"Characters: animated":"Characters: still"}),"hidden"!==t8&&"playing"!==t8&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>{var e;return null==(e=at.current)?void 0:e.toggle()},role:"menuitem",children:"Perform the scene"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>{var e;return null==(e=at.current)?void 0:e.readAlong()},role:"menuitem",title:"The script holds each line while someone reads it aloud — tap anywhere for the next line",children:"Read along together"})]}),"playing"===t8&&(0,n.jsxs)(n.Fragment,{children:["read"===aa.current&&(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>{var e;return null==(e=at.current)?void 0:e.next()},role:"menuitem",children:"Next line"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>{var e;
1return null==(e=at.current)?void 0:e.toggle()},role:"menuitem",children:"read"===aa.current?"End the read-along":"Stop the performance"})]}),"hidden"!==t8&&(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>af(e=>!e),"aria-expanded":au,role:"menuitem",children:au?"Hide the cast list":as?"The cast (you have a part)":"Pick a part"}),"hidden"!==t8&&au&&(()=>{var e,t,a;let o=null!=(t=null==(e=tc.current[tl])?void 0:e.name)?t:"",r=K(o);if(!r)return null;let i=new Map;for(let e of r.cues)i.set(e.characterId,(null!=(a=i.get(e.characterId))?a:0)+1);let l=V.filter(e=>e.hall===o&&i.has(e.id));return(0,n.jsx)("div",{role:"group","aria-label":"The cast",children:l.map(e=>{var t;let a=an[e.id],o=as===e.id,r=!!a&&!o,l=null!=(t=i.get(e.id))?t:0;return(0,n.jsxs)("button",{type:"button",className:"xr-ctl",role:"menuitem",disabled:r,onClick:()=>{var t;return o?void(al.current=null,ad(null),tw("releaseRole")):void(al.current=t=e.id,ad(t),af(!0),tw("claimRole",{characterId:t}))},title:r?"".concat(a.actor," is reading this part"):o?"Tap to set the part down":"Claim this part — ".concat(l," line").concat(1===l?"":"s"),children:[e.name," \xb7 ",l," line",1===l?"":"s",o?" — you":r?" — ".concat(a.actor):""]},e.id)})})})(),"idle"===t8&&(null!=e9?e9:0)>=2&&0===Object.keys(an).length&&!ap&&!au&&(0,n.jsx)("button",{type:"button",className:"xr-ctl",style:{borderColor:"var(--coral-500, #f26d4a)"},role:"menuitem",onClick:()=>{af(!0),am(!0)},children:"Enough of you are here to read the scene — pick parts?"})]}),(0,n.jsx)("p",{className:"xr-controls__group","aria-hidden":"true",children:"Voice chat"}),eN?"idle"===aQ?(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>void a3(),role:"menuitem",children:et?"\uD83C\uDFA4 Open the stage":"\uD83C\uDFB6 Join the audience"}):"unconfigured"===aQ?(0,n.jsx)("span",{className:"xr-ctl__status",children:"Live stage isn’t configured yet (LiveKit)."}):"error"===aQ?(0,n.jsx)("span",{className:"xr-ctl__status",children:"Couldn’t reach the stage."}):"connecting"===aQ?(0,n.jsx)("span",{className:"xr-ctl__status",children:"Connecting…"}):(0,n.jsxs)(n.Fragment,{children:[aZ.canPublish?(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:function(){var e;let t=!a5;a4(t),null==(e=aV.current)||e.setMuted(t)},"aria-pressed":a5,role:"menuitem",children:a5?"\uD83D\uDD07 Unmute":"\uD83C\uDFA4 Mute"}):(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>{var e;null==(e=aV.current)||e.raiseHand(!aZ.handRaised)},"aria-pressed":aZ.handRaised,role:"menuitem",children:aZ.handRaised?"✋ Lower hand":"✋ Request to speak"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl xr-ctl--leave",onClick:()=>void a6(),role:"menuitem",children:"Leave"}),(0,n.jsxs)("span",{className:"xr-ctl__status",children:[a1.audience," here \xb7 ",a1.openMics.length,"/",j.TM," mics"]})]}):a8?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:aH,"aria-pressed":aA,role:"menuitem",children:aA?"\uD83D\uDD07 Unmute mic":"\uD83C\uDF99 Mute mic"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl xr-ctl--leave",onClick:()=>void aW(),role:"menuitem",children:"Leave voice chat"}),(0,n.jsx)("span",{className:"xr-ctl__status",children:"connecting"===aI?"Connecting…":0===aT?"Waiting for others…":"".concat(aT," other").concat(1===aT?"":"s"," here")})]}):(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>void aF(),role:"menuitem",children:"\uD83C\uDF99 Join voice chat"}),!eN&&"denied"===aI&&(0,n.jsx)("span",{className:"xr-ctl__status",children:"Mic permission needed."}),!eN&&"full"===aI&&(0,n.jsxs)("span",{className:"xr-ctl__status",children:["Voice room is full (max ",j.ut,")."]}),!eN&&a8&&aj.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"xr-controls__group","aria-hidden":"true",children:"In this room"}),(0,n.jsx)("ul",{className:"xr-embers","aria-label":"People in this room",children:aj.map(e=>{let t=aL[e.name],a="embered"===t;return(0,n.jsxs)("li",{className:"xr-ember-row",children:[(0,n.jsx)("span",{className:"xr-ember-row__name",children:e.name}),(0,n.jsx)("button",{type:"button",className:"xr-ctl xr-ctl--ember".concat(a?" is-on":""),onClick:()=>void aU(e.name),disabled:"sending"===t||a,"aria-pressed":a,"aria-label":a?"Embered ".concat(e.name):"Add an Ember for ".concat(e.name),children:a?"✨ Embered":"sending"===t?"…":"error"===t?"Not eligible":"✨ Ember"})]},e.id)})}),(0,n.jsx)("p",{className:"xr-embers__note",children:"Private — they’re never told."})]})]})]}),eN&&et&&"connected"===aQ&&(0,n.jsxs)("div",{className:"xr-stage-mod",children:[(0,n.jsxs)("p",{className:"xr-stage-mod__head",children:["Open mics (",a1.openMics.length,"/",j.TM,")"]}),0===a1.openMics.length&&(0,n.jsx)("p",{className:"xr-stage-mod__empty",children:"No open mics."}),a1.openMics.map(e=>{var t;return(0,n.jsxs)("div",{className:"xr-stage-mod__row",children:[(0,n.jsx)("span",{children:null!=(t=e.name)?t:"Speaker"}),(0,n.jsx)("button",{type:"button",className:"xr-ctl xr-ctl--leave",onClick:()=>{var t;null==(t=aV.current)||t.grant(e.identity,!1)},children:"Close mic"})]},e.identity)}),(0,n.jsxs)("p",{className:"xr-stage-mod__head",children:["Raised hands (",a1.hands.length,")"]}),0===a1.hands.length&&(0,n.jsx)("p",{className:"xr-stage-mod__empty",children:"No hands raised."}),a1.hands.map(e=>{var t;return(0,n.jsxs)("div",{className:"xr-stage-mod__row",children:[(0,n.jsxs)("span",{children:["✋ ",null!=(t=e.name)?t:"Guest"]}),(0,n.jsx)("button",{type:"button",className:"xr-ctl",onClick:()=>{var t;null==(t=aV.current)||t.grant(e.identity,!0)},children:"Grant mic"})]},e.identity)})]})]})}let eP={warm:"#f26d4a",glow:"#ffb84d",ink:"#0c3b46",cream:"#fffbf7"},eT={coin:"coins",stamp:"stamps",art:"works",map:"maps",book:"volumes",specimen:"specimens",vehicle:"craft",nature:"studies",space:"bodies"},eC={coin:["#f6db8f","#caa247","#7e5f1c"],stamp:["#f2e3c9","#cf9b62","#7a4a1f"],art:["#efe7d6","#c9b48c","#7d6b48"],map:["#f3e7c8","#cdb27e","#7d6233"],book:["#efe2c6","#c2a36f","#6f5128"],specimen:["#dfe6ea","#9fb1bb","#5f7079"],vehicle:["#d9dde2","#9aa3ad","#5b636d"],nature:["#dbe7cf","#8fb277","#4f6b3a"],space:["#b9c6e6","#5a6f9e","#1b2748"]};function ej(e,t,a){var n;let o=document.createElement("canvas");o.width=512,o.height=512;let i=o.getContext("2d"),[l,s,d]=e.tint?[e.tint,e.tint,"#33373f"]:null!=(n=eC[t])?n:eC.coin,c="coin"===t||"stamp"===t;if(c){let e=i.createRadialGradient(256,204.8,40.96,256,256,256);e.addColorStop(0,l),e.addColorStop(.6,s),e.addColorStop(1,d),i.fillStyle=d,i.beginPath(),i.arc(256,256,250,0,2*Math.PI),i.fill(),i.fillStyle=e,i.beginPath(),i.arc(256,256,238,0,2*Math.PI),i.fill(),i.lineWidth=10,i.strokeStyle=d,i.beginPath(),i.arc(256,256,226,0,2*Math.PI),i.stroke()}else{let e=i.createLinearGradient(0,0,0,512);e.addColorStop(0,l),e.addColorStop(1,s),i.fillStyle=e,i.fillRect(0,0,512,512),i.lineWidth=16,i.strokeStyle=d,i.strokeRect(8,8,496,496)}if(i.fillStyle="rgba(40,32,14,0.8)",i.textAlign="center",i.textBaseline="middle",!c&&"front"===a&&e.note){i.font="700 36px Georgia, serif",e_(i,e.title.toUpperCase(),256,84,372,42),i.font="italic 600 30px Georgia, serif";let t=(function(e,t,a){let n=t.split(" "),o=[],r="";for(let t of n){let a=r?"".concat(r," ").concat(t):t;e.measureText(a).width>362&&r?(o.push(r),r=t):r=a}return r&&o.push(r),o})(i,e.note,362).slice(0,8),a=264-(t.length-1)*38/2;t.forEach((e,t)=>i.fillText(e,256,a+38*t,372)),e.subtitle&&(i.font="600 26px Georgia, serif",i.fillText(e.subtitle,256,448,372))}else i.font="700 44px Georgia, serif",e_(i,e.title.toUpperCase(),256,256-("front"===a?24:6),362,50),"front"===a&&e.subtitle&&(i.font="600 34px Georgia, serif",i.fillText(e.subtitle,256,352,392));let h=new r.GOR(o);
1return h.colorSpace=r.er$,h.anisotropy=4,h}function e_(e,t,a,n,o,r){let i=t.split(" "),l=[],s="";for(let t of i){let a=s?"".concat(s," ").concat(t):t;e.measureText(a).width>o&&s?(l.push(s),s=t):s=a}s&&l.push(s);let d=n-(l.length-1)*r/2;l.slice(0,2).forEach((t,n)=>e.fillText(t,a,d+n*r,o))}function eA(e,t,a,n,o,r){e.beginPath(),e.moveTo(t+r,a),e.arcTo(t+n,a,t+n,a+o,r),e.arcTo(t+n,a+o,t,a+o,r),e.arcTo(t,a+o,t,a,r),e.arcTo(t,a,t+n,a,r),e.closePath()}},31519:(e,t,a)=>{"use strict";a.d(t,{CK:()=>n,VQ:()=>o,XH:()=>r});let n=["#E05A3A","#F1A23A","#4EA1B0","#B8526E","#6B9F6F","#8856A8","#D17A3E","#5A7BC8"];function o(e){let t=()=>n[Math.floor(Math.random()*n.length)],a=t();if(!e)return a;for(let n=0;n<8&&a===e;n++)a=t();return a}function r(e){let t=0;for(let a=0;a<e.length;a++)t=31*t+e.charCodeAt(a)>>>0;return n[t%n.length]}},34662:(e,t,a)=>{"use strict";a.d(t,{fx:()=>o,ic:()=>r});let n=e=>e<0?0:e>1?1:Number.isFinite(e)?e:0;function o(e){let t=n(e);return{opacity:.85*t,glowScale:1+.7*t,headScale:1+.05*t}}function r(e,t,a){return e+(n(t)-e)*Math.min(1,12*Math.max(0,a))}},36560:(e,t,a)=>{"use strict";function n(){let e=function(){if("undefined"!=typeof document)for(let e of document.cookie.split(";")){let[t,...a]=e.trim().split("=");if("hottub_csrf"===t)return decodeURIComponent(a.join("="))}}();return e?{"x-csrf-token":e}:{}}a.d(t,{l:()=>n})},41566:(e,t,a)=>{"use strict";a.d(t,{CK:()=>o.CK,KV:()=>p,Pf:()=>h,Vr:()=>m,i$:()=>u,jC:()=>d,kb:()=>s,l9:()=>f,pr:()=>l,rr:()=>i});var n=a(90625),o=a(31519),r=a(34662);let i=["capsule","orb","cube"],l=["none","cap","crown","antenna"],s={capsule:"Classic",orb:"Bubble",cube:"Blocky"},d={none:"None",cap:"Cap",crown:"Crown",antenna:"Antenna"},c="hottub:vr-avatar";function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"you";return{color:(0,o.XH)(e),body:"capsule",hat:"none"}}function u(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"you",t=h(e);try{let e=window.localStorage.getItem(c);if(!e)return t;let a=JSON.parse(e);return{color:"string"==typeof a.color&&o.CK.includes(a.color)?a.color:t.color,body:i.includes(a.body)?a.body:"capsule",hat:l.includes(a.hat)?a.hat:"none"}}catch(e){return t}}function f(e){try{window.localStorage.setItem(c,JSON.stringify(e))}catch(e){}}function p(e,t){let a,o,i=new n.YJl,l=new n.Q1f(e.color),s=new n._4j({color:l,roughness:.5,metalness:.05}),d=new n._4j({color:l.clone().offsetHSL(0,-.06,.1),roughness:.55});"orb"===e.body?((a=new n.eaF(new n.Gu$(.3,24,20),s)).position.y=.3,o=.66):"cube"===e.body?((a=new n.eaF(new n.iNn(.42,.5,.42),s)).position.y=.3,o=.72):((a=new n.eaF(new n.qU7(.22,.32,8,16),s)).position.y=.34,o=.74),i.add(a);let c=new n.eaF(new n.Gu$(.17,20,16),d);if(c.position.y=o,i.add(c),"cap"===e.hat){let e=new n._4j({color:2761504,roughness:.7}),t=new n.eaF(new n.Gu$(.18,18,10,0,2*Math.PI,0,Math.PI/2),e);t.position.y=o+.05;let a=new n.eaF(new n.iNn(.26,.03,.16),e);a.position.set(0,o+.04,.17),i.add(t),i.add(a)}else if("crown"===e.hat){let e=new n._4j({color:0xf1a23a,roughness:.35,metalness:.45}),t=new n.eaF(new n.Ho_(.16,.18,.12,8,1,!0),e);t.position.y=o+.16,i.add(t)}else if("antenna"===e.hat){let e=new n._4j({color:2761504,roughness:.7}),t=new n._4j({color:0xf1a23a,roughness:.3,metalness:.4}),a=new n.eaF(new n.Ho_(.012,.012,.22,6),e);a.position.y=o+.28;let r=new n.eaF(new n.Gu$(.045,12,10),t);r.position.y=o+.41,i.add(a),i.add(r)}if(null==t?void 0:t.speaking){let e=c.scale.x,t=new n.V9B({color:l.clone().offsetHSL(0,-.1,.18),transparent:!0,opacity:0,blending:n.EZo,depthWrite:!1}),a=new n.eaF(new n.Gu$(.24,18,14),t);a.position.y=o,i.add(a);let s=0;i.userData.speakingRig={update(n,o){s=(0,r.ic)(s,n,o);let{opacity:i,glowScale:l,headScale:d}=(0,r.fx)(s);t.opacity=i,a.scale.setScalar(l),c.scale.setScalar(e*d)}}}return i.userData.isSelfAvatar=!0,i}function m(e){e.traverse(e=>{e.geometry&&e.geometry.dispose();let t=e.material;Array.isArray(t)?t.forEach(e=>
1e.dispose()):null==t||t.dispose()})}},83910:()=>{}}]);

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.