PageSourceSearch

https://joinhottub.com/_next/static/chunks/64489.fa6948aa169657f0.js

js joinhottub.com collected 2026-10-09 22:40:17 UTC 60,182 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[64489],{31519:(e,t,l)=>{l.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)],l=t();if(!e)return l;for(let n=0;n<8&&l===e;n++)l=t();return l}function r(e){let t=0;for(let l=0;l<e.length;l++)t=31*t+e.charCodeAt(l)>>>0;return n[t%n.length]}},36560:(e,t,l)=>{l.d(t,{l:()=>n});function n(){let e=function(){if("undefined"!=typeof document)for(let e of document.cookie.split(";")){let[t,...l]=e.trim().split("=");if("hottub_csrf"===t)return decodeURIComponent(l.join("="))}}();return e?{"x-csrf-token":e}:{}}},64489:(e,t,l)=>{l.r(t),l.d(t,{TabletopRoom:()=>$});var n=l(4536),o=l(11092),r=l(90625),i=l(14404),a=l(74678),s=l(35735),c=l(38726),d=l(32595),u=l(31519);let f={crypt:{decay:2.6,wet:.26,damp:.5},cavern:{decay:2.9,wet:.28,damp:.55},tavern:{decay:.8,wet:.1,damp:.6},"fog-city":{decay:.9,wet:.12,damp:.35},alcatraz:{decay:2.2,wet:.22,damp:.4},"verdant-deep":{decay:1.4,wet:.14,damp:.7},emberfall:{decay:1.8,wet:.2,damp:.35},"starlit-hulk":{decay:1.2,wet:.18,damp:.2},"salt-wreck":{decay:1,wet:.12,damp:.5},glasswaste:{decay:.6,wet:.06,damp:.5},hollowfrost:{decay:2,wet:.2,damp:.25},undermarket:{decay:1.6,wet:.18,damp:.45}};function h(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"#";return Array.from({length:t},()=>Array.from({length:e},()=>l))}function p(e,t,l,n,o){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:".";for(let i=l;i<l+o;i++)for(let l=t;l<t+n;l++)i>=0&&i<e.length&&l>=0&&l<e[0].length&&(e[i][l]=r)}function m(e,t,l,n,o){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:".";for(let o=Math.min(t,n);o<=Math.max(t,n);o++)e[l][o]=r;for(let t=Math.min(l,o);t<=Math.max(l,o);t++)e[t][n]=r}let w=e=>e.map(e=>e.join("")),b=[function(){let e=h(20,14);return p(e,0,3,20,2),p(e,0,9,20,2),p(e,3,0,2,14),p(e,9,0,2,14),p(e,15,0,2,14),m(e,1,1,6,6),m(e,6,6,12,8),m(e,12,8,18,12),p(e,6,5,2,3,"="),p(e,12,1,2,2,"="),p(e,0,12,20,2,"~"),p(e,9,11,2,3,"="),p(e,3,12,2,1,"."),p(e,16,12,3,2,"#"),p(e,17,12,1,1,"."),p(e,18,13,1,1,"="),{id:"fog-city",name:"San Francisco 2087",blurb:"Cyberpunk San Francisco — rain-slick avenues, Market Street neon, rooftop decks, a bay causeway, and Old Alcatraz glowing offshore.",cols:20,rows:14,tiles:w(e),tokens:[{kind:"fire",col:1,row:4},{kind:"loot",col:6,row:5},{kind:"loot",col:12,row:1},{kind:"portal",col:9,row:12},{kind:"loot",col:18,row:13}],labels:[{text:"MARKET",col:7,row:7,width:4},{text:"ALCATRAZ",col:15,row:12,width:5}],palette:{"#":"#141824",".":"#2b3140","~":"#0d3742","=":"#7a2b66"," ":"#0a0c12"},gridLine:"rgba(80,220,255,0.30)",glowGrid:!0,ambience:{bg:"#0b0e17",hemiSky:"#7fd8ff",hemiGround:"#1a1030",key:"#ff7ad9"},life:"rain"}}(),function(){let e=h(20,14,"~");p(e,2,1,16,11,"#"),p(e,3,5,14,2);for(let t=4;t<=15;t+=2)p(e,t,4,1,1),p(e,t,7,1,1);return p(e,3,2,4,2),p(e,13,2,4,2),m(e,4,4,4,5),m(e,14,4,14,5),p(e,3,9,6,3),p(e,3,9,6,1,"="),p(e,12,9,5,3),m(e,5,7,5,9),m(e,14,7,14,9),p(e,9,11,2,3,"="),m(e,10,9,10,11,"="),{id:"alcatraz",name:"Old Alcatraz 2087",blurb:"The prison island off Fog City — cell rows off Broadway, D-block silence, the yard, and one rusted pier into the cold bay.",cols:20,rows:14,tiles:w(e),tokens:[{kind:"fire",col:9,row:12},{kind:"loot",col:14,row:2},{kind:"loot",col:4,row:2},{kind:"portal",col:10,row:13}],palette:{"#":"#242c33",".":"#3d474f","~":"#0e2c38","=":"#5a4632"," ":"#05080c"},gridLine:"rgba(140,205,235,0.22)",glowGrid:!0,ambience:{bg:"#0a1218",hemiSky:"#9fc4d8",hemiGround:"#0a141c",key:"#ffe9c4"},life:"rain"}}(),function(){let e=h(18,13);return p(e,1,1,5,4),p(e,12,1,5,4),p(e,7,2,4,3),p(e,1,8,6,4),p(e,11,7,6,5),p(e,7,6,4,4),m(e,5,3,7,3),m(e,11,3,12,3),m(e,9,5,9,6),m(e,4,5,4,8),m(e,13,5,13,7),m(e,7,9,6,9),m(e,11,9,11,9),p(e,2,9,2,2,"="),p(e,13,9,2,2,"~"),{id:"crypt",name:"The Sunken Crypt",blurb:"Cramped burial chambers, a flooded sarcophagus, and a tomb at the heart.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"fire",col:8,row:3},{kind:"fire",col:9,row:8},{kind:"loot",col:14,row:9},{kind:"loot",col:3,row:2},{kind:"portal",col:15,row:2}],life:"motes"}}(),function(){let e=h(18,13);return p(e,2,2,7,5),p(e,6,4,8,6),p(e,10,1,6,5),p(e,3,8,6,4),p(e,11,8,5,4),m(e,8,6,11,9),p(e,7,6,4,3,"~"),p(e,12,9,2,2,"~"),{id:"cavern",name:"The Echoing Cavern",blurb
1:"A wide natural cave around a black underground lake.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"fire",col:3,row:3},{kind:"fire",col:14,row:10},{kind:"loot",col:13,row:2},{kind:"portal",col:5,row:10}],life:"motes"}}(),function(){let e=h(16,12);return p(e,1,1,14,10),p(e,2,2,3,2,"="),p(e,11,2,3,2,"="),p(e,2,8,3,2,"="),p(e,11,8,3,2,"="),p(e,7,5,2,2,"="),p(e,6,0,4,1,"."),{id:"tavern",name:"The Soaking Stag",blurb:"A warm tavern common-room — rugs, a central hearth, room to gather.",cols:16,rows:12,tiles:w(e),tokens:[{kind:"fire",col:7,row:5},{kind:"fire",col:8,row:6},{kind:"loot",col:13,row:9}],life:"embers"}}(),function(){let e=h(18,13);return p(e,2,1,6,5),p(e,10,2,6,4),p(e,3,8,5,4),p(e,10,8,6,4),m(e,7,3,10,4),m(e,5,5,5,8),m(e,12,5,12,8),m(e,0,6,17,6,"~"),p(e,11,9,2,2,"="),{id:"verdant-deep",name:"The Verdant Deep",blurb:"Clearings in an old-growth forest, split by a cold river; a mossy shrine waits.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"fire",col:4,row:9},{kind:"loot",col:11,row:9},{kind:"portal",col:14,row:3}],palette:{"#":"#1e3320",".":"#4a6b3a","~":"#2b6b78","=":"#6b8f4e"," ":"#101a10"},gridLine:"rgba(0,0,0,0.18)",ambience:{bg:"#101d12",hemiSky:"#d8ffd8",hemiGround:"#12240f",key:"#ffe9b0"},life:"fireflies"}}(),function(){let e=h(18,13);return p(e,1,1,16,11),p(e,6,4,6,5,"#"),p(e,7,5,4,3),p(e,8,8,2,1),p(e,8,0,2,1),p(e,2,2,2,2,"="),p(e,14,9,2,2,"="),p(e,2,9,2,2,"~"),{id:"emberfall",name:"Emberfall Keep",blurb:"A bailey under siege, braziers lit, and the great hall barred at the heart.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"fire",col:5,row:2},{kind:"fire",col:12,row:10},{kind:"loot",col:8,row:6},{kind:"portal",col:8,row:0}],palette:{"#":"#3a2f28",".":"#6b5a44","~":"#33606e","=":"#8f2f2a"," ":"#171310"},gridLine:"rgba(0,0,0,0.22)",ambience:{bg:"#1c130d",hemiSky:"#ffd8a8",hemiGround:"#2a160c",key:"#ff9d5c"},life:"embers"}}(),function(){let e=h(18,13," ");return p(e,7,5,4,3,"#"),p(e,8,6,2,1),p(e,2,2,4,3),p(e,12,2,4,3),p(e,2,9,4,3),p(e,12,9,4,3),m(e,4,4,4,10),m(e,13,4,13,10),m(e,4,3,13,3),m(e,4,10,13,10),m(e,6,6,8,6),m(e,10,6,12,6),p(e,12,9,2,1,"~"),p(e,3,2,2,1,"="),{id:"starlit-hulk",name:"The Starlit Hulk",blurb:"A derelict station adrift — ring corridors over open void, a coolant spill, the core humming.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"fire",col:8,row:6},{kind:"loot",col:14,row:10},{kind:"portal",col:3,row:2}],palette:{"#":"#2a3242",".":"#4a5568","~":"#39856e","=":"#8f7a2f"," ":"#05060d"},gridLine:"rgba(140,180,255,0.20)",glowGrid:!0,ambience:{bg:"#05070f",hemiSky:"#9db8ff",hemiGround:"#060a18",key:"#cfe0ff"},life:"stars"}}(),function(){let e=h(18,13,"~");return p(e,2,3,6,7),p(e,3,4,4,2,"="),p(e,11,2,5,4),p(e,11,9,5,3),m(e,8,6,11,4,"="),m(e,8,8,11,10,"="),{id:"salt-wreck",name:"The Salt Queen’s Wreck",blurb:"A beached hull, plank walks lashed between rocks, and the tide always coming in.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"loot",col:4,row:5},{kind:"loot",col:13,row:3},{kind:"fire",col:12,row:10},{kind:"portal",col:15,row:10}],palette:{"#":"#4a3a26",".":"#8f7346","~":"#1e5f74","=":"#6b4a2b"," ":"#0d1a20"},gridLine:"rgba(0,0,0,0.18)",ambience:{bg:"#0e2028",hemiSky:"#cfeaff",hemiGround:"#0a1a20",key:"#ffe9c4"},life:"motes"}}(),function(){let e=h(18,13,".");return p(e,0,0,4,3,"#"),p(e,14,1,4,3,"#"),p(e,7,10,5,3,"#"),p(e,8,4,3,3,"~"),p(e,3,8,3,2,"="),p(e,13,6,2,2,"="),{id:"glasswaste",name:"The Glasswaste",blurb:"A fused-sand desert around one impossible oasis; a caravan camp shelters in the lee.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"fire",col:4,row:8},{kind:"loot",col:13,row:6},{kind:"portal",col:9,row:8}],palette:{"#":"#6e5636",".":"#b89a62","~":"#2f8a8f","=":"#8f5a3a"," ":"#241c10"},gridLine:"rgba(0,0,0,0.14)",ambience:{bg:"#2a1f10",hemiSky:"#ffe8bd",hemiGround:"#3a2a12",key:"#fff2d0"},life:"motes"}}(),function(){let e=h(18,13,".");return p(e,0,0,18,1," "),p(e,0,12,18,1," "),p(e,7,3,5,4,"~"),p(e,2,2,3,3,"#"),p(e,13,7,4,4,"#"),m(e,5,9,12,9,"="),p(e,2,8,2,2,"="),{id:"hollowfrost",name:"Hollowfrost Vault",blurb:"An ice shelf between two sheer drops; the lake at the middle is thinner than it looks.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"fire",col:3,row:8},{kind:"loot",col:14,row:5},{kind:"portal",col:16,row:2}],palette:{"#":"#7fa8c4",".":"#cfe4ef","~":"#5aa2c4","=":"#8f6b4a"," ":"#0c1620"},gridLine:"rgba(20,60,90,0.20)",ambience:{bg:"#0d1b26",hemiSky:"#e8f6ff",hemiGround:"#0e2230",key:"#dff2ff"},life:"snow"}}(),function(){let e=h(18,13);for(let[t,l]of(p(e,1,1,16,11),m(e,0,6,17,6,"~"),p(e,8,5,2,3,"="),[[2,2],[6,2],[11,2],[14,2],[2,9],[6,9],[11,9],[14,9]]))p(e,t,l,2,2,"=");return p(e,8,1,2,1,"#"),p(e,8,11,2,1,"#"),{id:"undermarket",name:"The Gilded Undermarket",blurb:"A lantern-lit bazaar dug around a canal — every rug a stall, every deal a story.",cols:18,rows:13,tiles:w(e),tokens:[{kind:"loot",col:3,row:2},{kind:"loot",col:14,row:9},{kind:"fire",col:8,row:5},{kind:"portal",col:16,row:6}],palette:{"#":"#33241c",".":"#5c452e","~":"#2f6d6e","=":"#9a6b2f"," ":"#140e0a"},gridLine:"rgba(0,0,0,0.22)",ambience:{bg:"#171008",hemiSky:"#ffce8a",hemiGround:"#221408",key:"#ffb45e"},life:"embers"}}()],y=b[0].id;
1function v(e){return b.find(t=>t.id===e)}function g(e,t,l){return t>=0&&t<e.cols&&l>=0&&l<e.rows}let k={"#":"#2f2925",".":"#6f6757","~":"#2f6d7a","=":"#7a3b32"," ":"#161311"};var x=l(36560);class S{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){try{let n=await fetch("/api/soaks/".concat(encodeURIComponent(this.opts.soakId),"/table"),{method:"POST",headers:{"content-type":"application/json",...(0,x.l)()},body:JSON.stringify(e)});if(!n.ok)return null;let{table:o}=await n.json();if(o){var t,l;this.version=o.version,null==(t=(l=this.opts).onState)||t.call(l,o,{isHost:!1,present:0})}return null!=o?o:null}catch(e){return null}}async tick(){var e,t,l,n,o,r,i,a,s,c,d,u,f;if(!this.stopped&&!this.inFlight){this.inFlight=!0;try{let d=await fetch("/api/soaks/".concat(encodeURIComponent(this.opts.soakId),"/table"),{cache:"no-store"});if(d.ok){let e=await d.json();e.table?(null==(i=(a=this.opts).onStatus)||i.call(a,"live"),e.table.version!==this.version&&(this.version=e.table.version,null==(s=(c=this.opts).onState)||s.call(c,e.table,{isHost:e.isHost,present:e.present}))):(null==(l=(n=this.opts).onStatus)||l.call(n,"waiting"),null==(o=(r=this.opts).onWaiting)||o.call(r,{isHost:e.isHost,present:e.present}))}else null==(e=(t=this.opts).onStatus)||e.call(t,"error","Could not reach the table.")}catch(e){null==(d=(u=this.opts).onStatus)||d.call(u,"error","Could not reach the table.")}finally{this.inFlight=!1,this.stopped||(this.timer=setTimeout(()=>void this.tick(),null!=(f=this.opts.pollMs)?f:800))}}}constructor(e){this.version=-1,this.timer=null,this.stopped=!1,this.inFlight=!1,this.opts=e}}var j=l(14453);function M(){let e=window;return j.env.NEXT_PUBLIC_DAILY_DOMAIN&&e.DailyIframe?e.DailyIframe:null}function C(e){return!!((null==e?void 0:e.inScene)&&"daily"===e.provider&&M())}let T={meet:2784737,zoom:2985215,teams:6448295,discord:5793266,jitsi:1940623,daily:8150271,whereby:5913807,other:0xc9a35a};class I{setCall(e){var t,l;if(this.live=!!e,this.group.visible=this.live,!e)return void this.stopFaces();this.tint=null!=(l=null!=(t=T[e.provider])?t:T.other)?l:0xc9a35a;let n=C(e);this.paintSlate(e.label,n?"Joining…":"Call live — join to see & hear the table")}async startFaces(e,t){var l,n;let o=M();if(!o)return!1;if(this.daily)return!0;try{null==t||null==(l=t.onState)||l.call(t,"joining");let n=o.createCallObject({subscribeToTracksAutomatically:!0});this.daily=n;let r=()=>this.reconcileFaces();return n.on("participant-joined",r),n.on("participant-updated",r),n.on("participant-left",r),n.on("track-started",r),n.on("track-stopped",r),n.on("joined-meeting",()=>{var e;null==t||null==(e=t.onState)||e.call(t,"live"),r()}),n.on("left-meeting",()=>{var e;return null==t||null==(e=t.onState)?void 0:e.call(t,"left")}),n.on("error",()=>{var e;return null==t||null==(e=t.onState)?void 0:e.call(t,"error")}),await n.join({url:e}),this.reconcileFaces(),!0}catch(e){return null==t||null==(n=t.onState)||n.call(t,"error"),this.stopFaces(),!1}}stopFaces(){for(let[,e]of this.tiles)this.disposeTile(e);for(let[,e]of(this.tiles.clear(),this.audios))e.srcObject=null,e.remove();this.audios.clear(),this.mediaHost&&(this.mediaHost.remove(),this.mediaHost=null);let e=this.daily;if(this.daily=null,e){try{e.leave()}catch(e){}try{e.destroy()}catch(e){}}}ensureMediaHost(){if(this.mediaHost)return this.mediaHost;let e=document.createElement("div");return e.setAttribute("aria-hidden","true"),e.style.cssText="position:fixed;width:0;height:0;overflow:hidden;opacity:0;pointer-events:none;left:-9999px;",document.body.appendChild(e),this.mediaHost=e,e}reconcileFaces(){let e=this.daily;if(!e)return;let t=Object.values(e.participants()),l=t.filter(e=>{var t,l;return(null==(l=e.tracks)||null==(t=l.video)?void 0:t.state)==="playable"&&e.tracks.video.persistentTrack}),n=new Set;for(let[e,t]of(l.forEach((e,t)=>{n.add(e.session_id);let o=e.tracks.video.persistentTrack,r=this.tiles.get(e.session_id);if(r){let e=r.video.srcObject;
1e&&e.getVideoTracks()[0]===o||(r.video.srcObject=new MediaStream([o]),r.video.play().catch(()=>{}))}else r=this.makeTile(o),this.tiles.set(e.session_id,r),this.group.add(r.plane);this.layoutTile(r.plane,t,l.length)}),this.tiles))n.has(e)||(this.group.remove(t.plane),this.disposeTile(t),this.tiles.delete(e));this.reconcileAudio(t),this.slate.visible=0===this.tiles.size}reconcileAudio(e){let t=new Set;for(let o of e){var l,n;if(o.local)continue;let e=(null==(n=o.tracks)||null==(l=n.audio)?void 0:l.state)==="playable"?o.tracks.audio.persistentTrack:null;if(!e)continue;t.add(o.session_id);let r=this.audios.get(o.session_id);r||((r=document.createElement("audio")).autoplay=!0,this.ensureMediaHost().appendChild(r),this.audios.set(o.session_id,r));let i=r.srcObject;i&&i.getAudioTracks()[0]===e||(r.srcObject=new MediaStream([e]),r.play().catch(()=>{}))}for(let[e,l]of this.audios)t.has(e)||(l.srcObject=null,l.remove(),this.audios.delete(e))}makeTile(e){let t=document.createElement("video");t.autoplay=!0,t.muted=!0,t.playsInline=!0,t.srcObject=new MediaStream([e]),this.ensureMediaHost().appendChild(t),t.play().catch(()=>{});let l=new r.Nv2(t);l.colorSpace=r.er$;let n=new r.eaF(new r.bdM(.26,.2),new r.V9B({map:l}));return n.position.z=.004,{plane:n,video:t,tex:l}}layoutTile(e,t,l){let n=Math.min(4,Math.max(1,l)),o=Math.floor(t/n);e.position.set((t%n-(n-1)/2)*.3,.08-.22*o,.004)}disposeTile(e){e.tex.dispose(),e.plane.material.dispose(),e.plane.geometry.dispose(),e.video.srcObject=null,e.video.remove()}update(e){if(this.live)for(let[,t]of(this.group.position.y=this.baseY+.62+.01*Math.sin(.8*e),this.tiles))t.tex.needsUpdate=!0}paintSlate(e,t){var l,n,o,i,a,s,c;let d=document.createElement("canvas");d.width=512,d.height=268;let u=d.getContext("2d"),f="#".concat(this.tint.toString(16).padStart(6,"0")),h=u.createLinearGradient(0,0,0,268);h.addColorStop(0,"#161009"),h.addColorStop(1,"#0c0906"),u.fillStyle=h,u.fillRect(0,0,512,268),u.strokeStyle=f,u.lineWidth=4,u.globalAlpha=.85,o=14,i=14,a=484,s=240,c=18,(n=u).beginPath(),n.moveTo(32,14),n.arcTo(o+484,i,o+a,i+240,c),n.arcTo(o+a,i+s,o,i+s,c),n.arcTo(o,i+s,o,i,c),n.arcTo(o,i,o+a,i,c),n.closePath(),u.stroke(),u.globalAlpha=1,u.fillStyle=f,u.beginPath(),u.arc(46,52,9,0,2*Math.PI),u.fill(),u.fillStyle="#fff7e6",u.font="700 30px ui-sans-serif, system-ui, sans-serif",u.textBaseline="middle",u.fillText("LIVE",66,52),u.fillStyle="#fff7e6",u.font="700 40px ui-sans-serif, system-ui, sans-serif",u.fillText(e.slice(0,22),32,128),u.fillStyle="#e2d3b5",u.font="400 24px ui-sans-serif, system-ui, sans-serif",function(e,t,l,n,o,r){let i=t.split(" "),a="",s=178;for(let t of i){let l=a?"".concat(a," ").concat(t):t;e.measureText(l).width>448&&a?(e.fillText(a,32,s),a=t,s+=30):a=l}a&&e.fillText(a,l,s)}(u,t,32,178,448,30),null==(l=this.slateTex)||l.dispose(),this.slateTex=new r.GOR(d),this.slateTex.colorSpace=r.er$,this.slate.material.map=this.slateTex,this.slate.material.needsUpdate=!0,this.frame.material.color.set(this.tint).multiplyScalar(.25)}dispose(){var e,t;this.stopFaces(),null==(e=this.slateTex)||e.dispose(),this.group.traverse(e=>{var t,l,n;null==(l=e.geometry)||null==(t=l.dispose)||t.call(l);let o=e.material;Array.isArray(o)?o.forEach(e=>e.dispose()):null==o||null==(n=o.dispose)||n.call(o)}),null==(t=this.group.parent)||t.remove(this.group)}constructor(e,t){var l;this.group=new r.YJl,this.slateTex=null,this.tiles=new Map,this.audios=new Map,this.live=!1,this.tint=null!=(l=T.other)?l:0xc9a35a,this.daily=null,this.mediaHost=null,this.baseY=t.y,this.frame=new r.eaF(new r.bdM(.92,.5),new r.V9B({color:1314312,transparent:!0,opacity:.9})),this.slate=new r.eaF(new r.bdM(.88,.46),new r.V9B({transparent:!0})),this.slate.position.z=.001,this.group.add(this.frame,this.slate),this.group.position.set(0,this.baseY+.62,-.34),this.group.rotation.x=-.18,this.group.visible=!1,e.add(this.group)}}let D=[{match:e=>"meet.google.com"===e,provider:"meet",label:"Google Meet",inScene:!1},{match:e=>"zoom.us"===e||e.endsWith(".zoom.us"),provider:"zoom",label:"Zoom",inScene:!1},{match:e=>"teams.microsoft.com"===e||"teams.live.com"===e,provider:"teams",label:"Microsoft Teams",inScene:!1},{match:e=>"discord.gg"===e||"discord.com"===e||e.endsWith(".discord.com"),provider:"discord",label:"Discord",inScene:!1},{match:e=>"daily.co"===e||e.endsWith(".daily.co"),provider:"daily",label:"Daily",inScene:!0},{match:e=>"whereby.com"===e||e.endsWith(".whereby.com"),provider:"whereby",label:"Whereby",inScene:!1},{match:e=>"meet.jit.si"===e||e.endsWith(".jit.si"),provider:"jitsi",label:"Jitsi Meet",inScene:!0}];function A(e){let t,l=(null!=e?e:"").trim();if(!l||l.length>2048)return null;try{t=new URL(l)}catch(e){return null}if("https:"!==t.protocol)return null;let n=t.hostname.toLowerCase(),o=D.find(e=>e.match(n));return o?{url:t.toString(),provider:o.provider,label:o.label,inScene:o.inScene}:{url:t.toString(),provider:"other",label:n.replace(/^www\./,""),inScene:!1}}let R=["blinded","charmed","frightened","grappled","incapacitated","invisible","paralyzed","poisoned","prone","restrained","stunned","unconscious"],F=new Set([2,4,6,8,10,12,20,100]),H=0,_=e=>"".concat(e).concat(Date.now().toString(36)).concat((H++).toString(36)),E=(e,t)=>Math.max(0,Math.min(t,Math.round(e)));function L(e){return{...e,minis:e.minis.map(e=>({...e})),tokens:e.tokens.map(e=>({...e})),version:e.version+1}}let O=new Set(["setMap","removeMini","addToken","removeToken","moveToken","spawnCreature","setStance","setHp","say","paintTile","fogTile","fogAll","setCall","clearCall"]);function P(e,t,l){if(!e)return e;let n={...e},o=!1;for(let e=-1;e<=1;e+=1)for(let r=-1;r<=1;r+=1){let i="".concat(t+r,",").concat(l+e);n[i]&&(delete n[i],o=!0)}return o?Object.keys(n).length?n:void 0:e}let U=new Set(["#",".","~","="," "]),N=new Set(["idle","friendly","hostile"]),z=new Set(["humanoid","beast","construct"]);function B(e,t,l,n){if(!g(e,l,n))return!1;let o=null==t?void 0:t["".concat(l,",").concat(n)];return void 0!==o?"."===o||"="===o:function(e,t,l){var n;let o=g(e,t,l)&&null!=(n=e.tiles[l][t])?n:null;return"."===o||"="===o}(e,l,n)}function G(e,t,l){var n,o,r,i,a,s,c,d;if(O.has(t.op)&&!l.isHost)return{ok:!1,error:"Only the host can do that."};let u=v(e.mapId);if(!u)return{ok:!1,error:"Unknown map."};switch(t.op){case"setMap":{let l=v(t.mapId);if(!l)return{ok:!1,error:"Unknown map."};let n=L(e);return n.mapId=l.id,n.cols=l.cols,n.rows=l.rows,n.minis=[],n.tokens=l.tokens.map(e=>({id:_("tk"),kind:e.kind,col:e.col,row:e.row})),n.ruler=null,n.overrides=void 0,n.fog=void 0,{ok:!0,state:n}}case"addMini":{if(e.minis.length>=24)return{ok:!1,error:"The table is full of minis."};let r=l.isHost?null!=(n=t.ownerUserId)?n:null:l.userId;if(!l.isHost&&e.minis.filter(e=>e.ownerUserId===l.userId).length>=1)return{ok:!1,error:"You already have a mini on the table."};let i=E(t.col,u.cols-1),a=E(t.row,u.rows-1);if(!B(u,e.overrides,i,a))return{ok:!1,error:"A mini can’t stand there."};let s=L(e);return s.minis.push({id:_("mn"),label:t.label.trim().slice(0,24)||"Hero",ownerUserId:r,color:null!=(o=t.color)?o:"#e0714a",col:i,row:a}),s.fog=P(s.fog,i,a),{ok:!0,state:s}}case"removeMini":{let l=L(e);return l.minis=l.minis.filter(e=>e.id!==t.miniId),{ok:!0,state:l}}case"moveMini":{let n=e.minis.find(e=>e.id===t.miniId);if(!n)return{ok:!1,error:"That mini is gone."};if(!l.isHost&&n.ownerUserId!==l.userId)return{ok:!1,error:"That isn’t your mini to move."};let o=E(t.col,u.cols-1),i=E(t.row,u.rows-1);if(!B(u,e.overrides,o,i))return{ok:!1,error:"A mini can’t stand there."};let a=L(e),s=a.minis.find(e=>e.id===t.miniId);return s.col=o,s.row=i,(null!=(r=s.kind)?r:"hero")==="hero"&&(a.fog=P(a.fog,o,i)),{ok:!0,state:a}}case"claimMini":{let n=e.minis.find(e=>e.id===t.miniId);if(!n)return{ok:!1,error:"That mini is gone."};if(!l.isHost&&n.ownerUserId&&n.ownerUserId!==l.userId)return{ok:!1,error:"Someone already has that one."};let o=L(e);return o.minis.find(e=>e.id===t.miniId).ownerUserId=l.userId,{ok:!0,state:o}}case"addToken":{if(e.tokens.length>=32)return{ok:!1,error:"Too many tokens."};if(!g(u,t.col,t.row))return{ok:!1,error:"Off the map."};let l=L(e);return l.tokens.push({id:_("tk"),kind:t.kind,col:E(t.col,u.cols-1),row:E(t.row,u.rows-1)}),{ok:!0,state:l}}case"removeToken":{let l=L(e);return l.tokens=l.tokens.filter(e=>e.id!==t.tokenId),{ok:!0,state:l}}case"moveToken":{if(!e.tokens.find(e=>e.id===t.tokenId))return{ok:!1,error:"That token is gone."};if(!g(u,t.col,t.row))return{ok:!1,error:"Off the map."};let l=L(e),n=l.tokens.find(e=>e.id===t.tokenId);return n.col=E(t.col,u.cols-1),n.row=E(t.row,u.rows-1),{ok:!0,state:l}}case"rollDice":{if(!F.has(t.sides))return{ok:!1,error:"That isn’t a die we have."};let n=1+Math.floor(Math.random()*t.sides),o=L(e);return o.lastRoll={id:_("rd"),sides:t.sides,value:n,byUserId:l.userId,byName:l.name,at:Date.now()},{ok:!0,state:o}}case"setRuler":{let n=L(e);return n.ruler={fromCol:E(t.fromCol,u.cols-1),fromRow:E(t.fromRow,u.rows-1),toCol:E(t.toCol,u.cols-1),toRow:E(t.toRow,u.rows-1),byUserId:l.userId},{ok:!0,state:n}}case"clearRuler":{let t=L(e);return t.ruler=null,{ok:!0,state:t}}case"spawnCreature":{if(e.minis.length>=24)return{ok:!1,error:"The table is full of minis."};if(!z.has(t.shape))return{ok:!1,error:"That isn’t a creature we can shape."};let l=E(t.col,u.cols-1),n=E(t.row,u.rows-1);if(!B(u,e.overrides,l,n))return{ok:!1,error:"A creature can’t stand there."};let o="number"==typeof t.hp&&t.hp>0?Math.min(999,Math.round(t.hp)):null,r=L(e);return r.minis.push({id:_("cr"),label:t.label.trim().slice(0,24)||"Creature",ownerUserId:null,color:null!=(i=t.color)?i:"#7a4a8f",col:l,row:n,kind:"creature",shape:t.shape,stance:t.stance&&N.has(t.stance)?t.stance:"idle",hp:o,maxHp:o,say:null}),{ok:!0,state:r}}case"setStance":{let l=e.minis.find(e=>e.id===t.miniId);if(!l||"creature"!==l.kind)return{ok:!1,error:"That isn’t a creature."};if(!N.has(t.stance))return{ok:!1,error:"Unknown stance."};let n=L(e);return n.minis.find(e=>e.id===t.miniId).stance=t.stance,{ok:!0,state:n}}case"setHp":{let l=e.minis.find(e=>e.id===t.miniId);if(!l||"creature"!==l.kind)return{ok:!1,error:"That isn’t a creature."};let n=L(e),o=n.minis.find(e=>e.id===t.miniId),r=null!=(a=o.maxHp)?a:Math.max(1,Math.round(t.hp));return o.maxHp=r,o.hp=Math.max(0,Math.min(r,Math.round(t.hp))),{ok:!0,state:n}}case"setConditions":{let n=e.minis.find(e=>e.id===t.miniId);if(!n)return{ok:!1,error:"That mini is gone."};if(!l.isHost&&n.ownerUserId!==l.userId)return{ok:!1,error:"That piece isn’t yours to tag."};let o=new Set(R),r=[...new Set(t.conditions.filter(e=>o.has(e)))].slice(0,4),i=L(e);return i.minis.find(e=>e.id===t.miniId).conditions=r.length?r:void 0,{ok:!0,state:i}}
1case"say":{if(!e.minis.find(e=>e.id===t.miniId))return{ok:!1,error:"That mini is gone."};let l=t.text.trim().slice(0,120),n=L(e);return n.minis.find(e=>e.id===t.miniId).say=l?{text:l,at:Date.now()}:null,{ok:!0,state:n}}case"paintTile":{if(!g(u,t.col,t.row))return{ok:!1,error:"Off the map."};if(!U.has(t.tile))return{ok:!1,error:"That isn’t a tile we have."};let l="".concat(t.col,",").concat(t.row),n={...null!=(s=e.overrides)?s:{}};if(u.tiles[t.row][t.col]===t.tile?delete n[l]:n[l]=t.tile,Object.keys(n).length>400)return{ok:!1,error:"That’s as much redrawing as one world can hold."};if("."!==t.tile&&"="!==t.tile&&e.minis.some(e=>e.col===t.col&&e.row===t.row))return{ok:!1,error:"Someone is standing there."};let o=L(e);return o.overrides=Object.keys(n).length?n:void 0,{ok:!0,state:o}}case"fogTile":{if(!g(u,t.col,t.row))return{ok:!1,error:"Off the map."};let l="".concat(t.col,",").concat(t.row),n={...null!=(c=e.fog)?c:{}};t.shroud?n[l]=1:delete n[l];let o=L(e);return o.fog=Object.keys(n).length?n:void 0,{ok:!0,state:o}}case"fogAll":{let l=L(e);if(!t.shroud)return l.fog=void 0,{ok:!0,state:l};let n={};for(let e=0;e<u.rows;e+=1)for(let t=0;t<u.cols;t+=1)n["".concat(t,",").concat(e)]=1;for(let t of e.minis)(null!=(d=t.kind)?d:"hero")==="hero"&&(n=P(n,t.col,t.row));return l.fog=n&&Object.keys(n).length?n:void 0,{ok:!0,state:l}}case"setCall":{let n=A(t.url);if(!n)return{ok:!1,error:"That doesn’t look like a call link — paste an https:// meeting URL."};let o=L(e);return o.call={...n,byUserId:l.userId,at:Date.now()},{ok:!0,state:o}}case"clearCall":{let t=L(e);return t.call=null,{ok:!0,state:t}}default:return{ok:!1,error:"Unknown move."}}}let W=globalThis;null!=W.__hottubSoakTables||(W.__hottubSoakTables=new Map);var Y=l(14453);let J={fire:0xff7a3a,loot:0xffcf5a,portal:5752831};function V(e,t,l,n,o){return[(e+.5-l/2)*o,(t+.5-n/2)*o]}function $(e){let{surface:t="table",soakId:l,currentUserId:h,selfSeed:p="you",backHref:m="/labs/spatial
1-soak",roomsHref:w="/labs/spatial-soak",sponsorName:b=null,sponsorOffer:g=null,sponsorHref:j=null,sponsorEyebrow:M=null}=e,T=(0,o.useRef)(null),[D,R]=(0,o.useState)(null),[F,H]=(0,o.useState)(!1),[E,L]=(0,o.useState)(!1),[O,P]=(0,o.useState)("connecting"),[U,N]=(0,o.useState)(!1),[z,W]=(0,o.useState)(!1),[$,eo]=(0,o.useState)("idle"),[er,ei]=(0,o.useState)(!1),[ea,es]=(0,o.useState)(null),ec=(0,o.useRef)(""),[ed,eu]=(0,o.useState)(""),[ef,eh]=(0,o.useState)(!1),[ep,em]=(0,o.useState)(null),[ew,eb]=(0,o.useState)(!1),ey=(0,o.useRef)(null),ev=(0,o.useRef)(null),eg=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{(0,c.iJ)()||(0,c.ZM)()},[]);let ek=(0,o.useRef)(null),ex=(0,o.useRef)("Guest-".concat(Math.random().toString(36).slice(2,5)));async function eS(){if(ek.current)return;let e=new d.VoiceMesh({roomId:l?"soak-".concat(l):"tabletop",displayName:ex.current,onState:e=>eo(e)});ek.current=e,ei(!1),await e.start(),eT.current&&e.announceNarrator(!0),e.setRoomAcoustics(eJ.current)}function ej(){var e;null==(e=ek.current)||e.stop(),ek.current=null,eo("idle")}(0,o.useEffect)(()=>()=>{var e;null==(e=ek.current)||e.stop(),ek.current=null},[]);let eM=(0,o.useRef)(null),eC=(0,o.useRef)(null),eT=(0,o.useRef)(!1),[eI,eD]=(0,o.useState)(null),[eA,eR]=(0,o.useState)(!1),[eF,eH]=(0,o.useState)([]),e_=async()=>{if(l)try{var e;let t=await fetch("/api/soaks/".concat(l,"/npcs"),{cache:"no-store"});t.ok&&eH(null!=(e=(await t.json()).npcs)?e:[])}catch(e){}},eE=(0,o.useRef)(null),[eL,eO]=(0,o.useState)(""),eP=(0,o.useRef)("");(0,o.useEffect)(()=>{eP.current=eL},[eL]);let[eU,eN]=(0,o.useState)(""),[ez,eB]=(0,o.useState)("humanoid"),[eG,eW]=(0,o.useState)(""),eY=(0,o.useRef)(null),eJ=(0,o.useRef)(null),eV=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=T.current;if(!e)return;let n=!l,o=navigator.xr;(null==o?void 0:o.isSessionSupported)?o.isSessionSupported("immersive-vr").then(R).catch(()=>R(!1)):R(!1);let c=e.clientWidth||window.innerWidth,d=e.clientHeight||window.innerHeight,m=(0,s.uw)({host:e,width:c,height:d,onContextLost:()=>L(!0)});if(!m)return void L(!0);let w=i.Z.createButton(m);w.style.position="absolute",w.style.bottom="24px",w.style.left="50%",w.style.transform="translateX(-50%)",e.appendChild(w);let x="tub"===t,C=new r.Z58,D=x?"#1d2b30":"#241d18";C.background=new r.Q1f(D),C.fog=new r.jUj(D,6,22);let A=new r.ubm(55,c/d,.05,100);A.position.set(0,1.55,1.7);let F=new a.N(A,m.domElement);F.target.set(0,x?.55:.95,0),F.enablePan=!1,F.minDistance=.9,F.maxDistance=6,F.maxPolarAngle=Math.PI/2.05,F.update();let E=new r.dth(0xfff1da,x?1586234:2760728,.95);C.add(E);let O=new r.ZyN(0xfff0d8,.9);O.position.set(3,6,4),C.add(O);let U=new r.eaF(new r.tcD(14,48),new r._4j({color:x?1321005:1774608,roughness:1}));U.rotation.x=-Math.PI/2,C.add(U);let z=v("crypt"),W=x?1.05:1.55,Y=x?1.05:1.15,$=Math.min(W/z.cols,Y/z.rows),X=x?.52:.95,ee=new r.YJl;C.add(ee);let et=new r._4j({color:7031339,roughness:.85}),el=new r._4j({color:4862750,roughness:.9}),en=new r.YJl,eo=new r.YJl;ee.add(eo,en);let er=null,ei=null,ea={motes:{color:0xd8cfa8,size:.008,rise:.01,drift:.05,count:50},embers:{color:0xff9a4d,size:.01,rise:.045,drift:.06,count:40},snow:{color:0xeaf6ff,size:.011,rise:-.05,drift:.09,count:70},rain:{color:8837631,size:.007,rise:-.55,drift:.02,count:90},stars:{color:0xcfe0ff,size:.009,rise:.002,drift:.01,count:80},fireflies:{color:0xc8ff7a,size:.013,rise:.008,drift:.16,count:30}},ed=null,eu=ea.motes,ef={w:1.6,d:1.2},eh=new r._4j({roughness:.9}),ep=new r.eaF(new r.bdM(1,1),eh);ep.rotation.x=-Math.PI/2,ep.position.y=X+.001,en.add(ep);let em=null;function ew(e,t){let l=function(e,t,l){var n,o,r,i,a,s;let c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"player";if("undefined"==typeof document)return null;let d=document.createElement("canvas");d.width=48*e.cols,d.height=48*e.rows;let u=d.getContext("2d");if(!u)return null;let f={...k,...e.palette};for(let l=0;l<e.rows;l++)for(let r=0;r<e.cols;r++){let i=null!=(o=null==t?void 0:t["".concat(r,",").concat(l)])?o:null!=(n=e.tiles[l][r])?n:" ",a=48*r,s=48*l;if(u.fillStyle=f[i],u.fillRect(a,s,48,48),"."===i||"~"===i||"="===i){let e=(0x466f45d*r^0x127409f*l)>>>0;u.fillStyle="rgba(255,255,255,".concat(.02+e%5/100,")"),u.fillRect(a+e%48,s+(e>>8)%48,3,3)}"#"===i&&(u.fillStyle="rgba(255,255,255,0.05)",u.fillRect(a,s,48,4),u.fillStyle="rgba(0,0,0,0.30)",u.fillRect(a,s+48-4,48,4))}
1if(e.labels){for(let t of(u.save(),e.labels)){let l=Math.max(0,Math.min(e.cols-1,Math.round(t.col))),n=Math.max(0,Math.min(e.rows-1,Math.round(t.row))),o=Math.max(1,Math.min(e.cols-l,Math.round(null!=(r=t.width)?r:3))),a=48*l,s=48*n,c=48*o;u.fillStyle="rgba(8,10,18,0.72)",u.fillRect(a+4,s+8,c-8,24),u.strokeStyle=null!=(i=e.gridLine)?i:"rgba(255,255,255,0.22)",u.strokeRect(a+4.5,s+8.5,c-9,23),u.fillStyle="#dff9ff",u.font="bold 13px sans-serif",u.textAlign="center",u.textBaseline="middle",u.fillText(t.text.toUpperCase().slice(0,16),a+c/2,s+20)}u.restore()}if(l)for(let e of Object.keys(l)){let[t,l]=e.split(",").map(Number);if(void 0===t||void 0===l||Number.isNaN(t)||Number.isNaN(l))continue;let n=48*t,o=48*l;u.fillStyle="dm"===c?"rgba(8,10,14,0.45)":"rgba(8,10,14,0.96)",u.fillRect(n,o,48,48),"dm"===c&&(u.strokeStyle="rgba(255,255,255,0.10)",u.beginPath(),u.moveTo(n,o+48),u.lineTo(n+48,o),u.stroke())}u.strokeStyle=null!=(a=e.gridLine)?a:"rgba(0,0,0,0.22)",u.lineWidth=1,e.glowGrid&&(u.shadowColor=null!=(s=e.gridLine)?s:"rgba(80,220,255,0.30)",u.shadowBlur=6);for(let t=0;t<=e.cols;t++)u.beginPath(),u.moveTo(48*t,0),u.lineTo(48*t,d.height),u.stroke();for(let t=0;t<=e.rows;t++)u.beginPath(),u.moveTo(0,48*t),u.lineTo(d.width,48*t),u.stroke();return u.shadowBlur=0,d}(z,e,t,eT.current?"dm":"player");null==em||em.dispose(),(em=l?new r.GOR(l):null)&&(em.colorSpace=r.er$,eh.map=em,eh.needsUpdate=!0)}function eg(e,t,l){$=Math.min(W/(z=e).cols,Y/z.rows);let n=z.cols*$,o=z.rows*$;ep.geometry.dispose(),ep.geometry=new r.bdM(n,o),ew(t,l),function(e,t){for(let e of[...eo.children])eo.remove(e);if(ei&&(en.remove(ei),ei=null),x){let l=.95*Math.max(e,t)+.5,n=new r.eaF(new r.Ho_(l,l,.6,48,1,!0),new r._4j({color:8016432,roughness:.8,side:r.$EB}));n.position.y=.3,eo.add(n);let o=new r.eaF(new r.O3Y(l,.06,12,48),new r._4j({color:6176548,roughness:.7}));o.rotation.x=Math.PI/2,o.position.y=.6,eo.add(o);let i=new r.eaF(new r.tcD(l-.05,48),new r._4j({color:1804958,roughness:.25,metalness:.1,transparent:!0,opacity:.9}));i.rotation.x=-Math.PI/2,i.position.y=.5,eo.add(i),(ei=new r.eaF(new r.Ho_(.62*Math.max(e,t),.66*Math.max(e,t),.06,32),new r._4j({color:7031339,roughness:.85}))).position.y=X-.04,en.add(ei),(er=new r.eaF(new r.bdM(1.1*l,.16),new r.V9B({transparent:!0}))).position.set(0,.42,l-.02),eo.add(er);for(let e=0;e<6;e++){let t=e/6*Math.PI*2,n=Math.cos(t)*(l-.18),o=Math.sin(t)*(l-.18),i=new r.eaF(new r.Gu$(.1,16,16),new r._4j({color:(0,u.XH)("".concat(p,"-").concat(e)),roughness:.7}));i.position.set(n,.56,o),eo.add(i)}}else{let l=new r.eaF(new r.iNn(e+.34,.08,t+.34),et);l.position.y=X-.04,eo.add(l);let n=e+.34,o=t+.34,i=(e,t,l,n)=>{let o=new r.eaF(new r.iNn(e,.07,t),el);o.position.set(l,X+.035-.01,n),eo.add(o)};for(let[e,t]of(i(n,.09,0,-o/2+.045),i(n,.09,0,o/2-.045),i(.09,o,-n/2+.045,0),i(.09,o,n/2-.045,0),[[-1,-1],[1,-1],[-1,1],[1,1]])){let l=new r.eaF(new r.iNn(.08,X-.08,.08),el);l.position.set(e*(n/2-.1),(X-.08)/2,t*(o/2-.1)),eo.add(l)}(er=new r.eaF(new r.bdM(.8*n,.05),new r.V9B({transparent:!0}))).position.set(0,X-.04,o/2+.171),eo.add(er);for(let e=0;e<6;e++){let t=e/6*Math.PI*2,l=.62*Math.max(n,o)*Math.cos(t),i=.62*Math.max(n,o)*Math.sin(t),a=new r.eaF(new r.Ho_(.12,.12,.04,16),el);a.position.set(l,.45,i),eo.add(a)}}!function(){if(!er)return;let e=er.material;if(!b){er.visible=!1;return}e.map=function(e,t,l){let n=document.createElement("canvas");n.width=1024,n.height=160;let o=n.getContext("2d");o.clearRect(0,0,1024,160),o.fillStyle="rgba(20,14,8,0.0)",o.fillRect(0,0,1024,160),o.fillStyle="#1c140c",Q(o,12,24,1e3,112,18),o.fill(),o.strokeStyle="#ffcf73",o.lineWidth=3,Q(o,12,24,1e3,112,18),o.stroke(),o.textBaseline="middle",l&&(o.fillStyle="#ffcf73",o.font="600 26px ui-sans-serif, system-ui, sans-serif",o.fillText(l.toUpperCase(),40,56)),o.fillStyle="#fff7e6",o.font="700 44px ui-sans-serif, system-ui, sans-serif",o.fillText(e.slice(0,32),40,l?96:80),t&&(o.fillStyle="#e9d9bd",o.font="400 26px ui-sans-serif, system-ui, sans-serif",o.fillText(t.slice(0,60),40,132));let i=new r.GOR(n);
1return i.colorSpace=r.er$,i}(b,g,M),e.needsUpdate=!0,er.visible=!0,er.userData.sponsor=!0}()}(n,o),function(e){var t,l,n,o,i,a,s;let c=e.ambience,d=null!=(l=null==c?void 0:c.bg)?l:D;C.background=new r.Q1f(d),C.fog=new r.jUj(d,6,22),E.color.set(null!=(n=null==c?void 0:c.hemiSky)?n:"#fff1da"),E.groundColor.set(null!=(o=null==c?void 0:c.hemiGround)?o:x?"#18343a":"#2a2018"),O.color.set(null!=(i=null==c?void 0:c.key)?i:"#fff0d8"),eJ.current=null!=(s=null!=(a=e.acoustics)?a:f[e.id])?s:null,null==(t=ek.current)||t.setRoomAcoustics(eJ.current)}(e),function(e){ed&&(en.remove(ed),ed.geometry.dispose(),ed.material.dispose(),ed=null);let t=e.life;if(!t)return;eu=ea[t],ef={w:e.cols*$+.5,d:e.rows*$+.5};let l=new Float32Array(3*eu.count);for(let e=0;e<eu.count;e+=1)l[3*e]=(Math.random()-.5)*ef.w,l[3*e+1]=X+.05+1.1*Math.random(),l[3*e+2]=(Math.random()-.5)*ef.d;let n=new r.LoY;n.setAttribute("position",new r.THS(l,3));let o=new r.BH$({color:eu.color,size:eu.size,transparent:!0,opacity:.8,depthWrite:!1,sizeAttenuation:!0});ed=new r.ONl(n,o),en.add(ed)}(e)}let ex=new Map,eS=new Map,ej=new r.YJl;en.add(ej);let eI={idle:9082528,friendly:2864836,hostile:0xff5a3c},eA=new r.eaF(new r.iNn(.1,.1,.1),[new r._4j({color:0xf3ece0}),new r._4j({color:0xf3ece0}),new r._4j({color:0xf3ece0}),new r._4j({color:0xf3ece0}),new r._4j({color:0xf3ece0}),new r._4j({color:0xf3ece0})]);eA.visible=!1,en.add(eA);let eR=0,eF=null,eH=q("");eH.scale.set(.7,.22,1),eH.position.set(0,X+.55,0),eH.visible=!1,en.add(eH);let e_=q("");e_.scale.set(1.1,.3,1),e_.position.set(0,X+.32,.25),e_.visible=!1,en.add(e_);let eL=new I(en,{y:X});ey.current=e=>{eL.startFaces(e,{onState:e=>eb("live"===e||"joining"===e)}).then(e=>{e||eb(!1)})},ev.current=()=>{eL.stopFaces(),eb(!1)};let eO=new r.mrM({color:0xffd27a,depthTest:!1}),eU=new r.LoY().setFromPoints([new r.Pq0,new r.Pq0]),eN=new r.N1A(eU,eO);eN.renderOrder=999,eN.visible=!1,en.add(eN);let ez=q("");ez.renderOrder=1e3,ez.visible=!1,en.add(ez);let eB=null,eG="";function eW(e){var t,l,n,o,i,a,s,c,d;let u=!eB||eB.mapId!==e.mapId,f="".concat(JSON.stringify(null!=(t=e.overrides)?t:{}),"|").concat(JSON.stringify(null!=(l=e.fog)?l:{}));if(eB=e,u){let t=v(e.mapId);eG=f,t&&eg(t,e.overrides,e.fog)}else f!==eG&&(eG=f,ew(e.overrides,e.fog));let h=X+.006,p=new Set;for(let t of e.minis){p.add(t.id);let l=ex.get(t.id),i="".concat(null!=(n=t.kind)?n:"hero",":").concat(null!=(o=t.shape)?o:"");l&&l.userData.builtShape!==i&&(ej.remove(l),ex.delete(t.id),l=void 0),l||(l=function(e){var t,l,n,o;let i=new r.YJl,a=new r.Q1f(e.color||"#e0714a"),s=new r._4j({color:a,roughness:.5,metalness:.1}),c=new r.eaF(new r.Ho_(.34*$,.36*$,.012,20),s);if(i.add(c),"creature"===e.kind){if("beast"===e.shape){let e=new r.eaF(new r.iNn(.66*$,.3*$,.36*$),s);e.position.y=.24*$;let t=new r.eaF(new r.Gu$(.17*$,14,14),s);t.position.set(.4*$,.34*$,0),i.add(e,t)}else if("construct"===e.shape){let e=new r._4j({color:a,roughness:.35,metalness:.6}),t=new r.eaF(new r.iNn(.4*$,.62*$,.4*$),e);t.position.y=.33*$;let l=new r.eaF(new r.iNn(.24*$,.2*$,.24*$),e);l.position.y=.76*$,i.add(t,l)}else{let e=new r.eaF(new r.Ho_(.14*$,.24*$,.72*$,14),s);e.position.y=.38*$;let t=new r.eaF(new r.Gu$(.18*$,14,14),s);t.position.y=.86*$;let l=new r.eaF(new r.qFE(.05*$,.16*$,8),s);l.position.set(-(.11*$),+$,0);let n=l.clone();n.position.x=.11*$,i.add(e,t,l,n)}let l=new r.eaF(new r.rKP(.38*$,.46*$,24),new r.V9B({color:eI[null!=(t=e.stance)?t:"idle"],transparent:!0,opacity:.85,side:r.$EB}));
1l.rotation.x=-Math.PI/2,l.position.y=.004,i.add(l),i.userData.ring=l;let n=q("");n.scale.set(.26,.07,1),n.position.y=1.22*$,n.visible=!1,i.add(n),i.userData.hpSprite=n}else{let e=new r.eaF(new r.Ho_(.12*$,.22*$,.7*$,16),s);e.position.y=.37*$;let t=new r.eaF(new r.Gu$(.2*$,16,16),s);t.position.y=.82*$,i.add(e,t)}let d=q("");return d.scale.set(.6,.2,1),d.position.y=1.5*$,d.visible=!1,i.add(d),i.userData.saySprite=d,i.userData.miniId=e.id,i.userData.kind=null!=(l=e.kind)?l:"hero",i.userData.builtShape="".concat(null!=(n=e.kind)?n:"hero",":").concat(null!=(o=e.shape)?o:""),i}(t),ex.set(t.id,l),ej.add(l));let[a,s]=V(t.col,t.row,e.cols,e.rows,$);!0!==l.userData.dragging&&l.position.set(a,h,s),l.userData.ownerUserId=t.ownerUserId,function(e,t){var l,n,o;let i=e.userData.ring;i&&(i.material.color.set(eI[null!=(l=t.stance)?l:"idle"]),i.userData.hostile="hostile"===t.stance);let a=e.userData.hpSprite;if(a){let l="number"==typeof t.hp&&"number"==typeof t.maxHp&&t.maxHp>0;a.visible=l;let n=l?"".concat(t.hp,"/").concat(t.maxHp):"";l&&e.userData.hpKey!==n&&(e.userData.hpKey=n,function(e,t,l){var n;let o=document.createElement("canvas");o.width=256,o.height=64;let i=o.getContext("2d");i.fillStyle="rgba(20,14,8,0.8)",Q(i,4,18,248,28,10),i.fill();let a=Math.max(0,Math.min(1,t/l));i.fillStyle=a>.5?"#69c780":a>.2?"#f2b04a":"#f26d4a",a>0&&(Q(i,8,22,Math.max(12,240*a),20,8),i.fill()),i.fillStyle="#fff7e6",i.font="700 26px ui-sans-serif, system-ui, sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText("".concat(t,"/").concat(l),128,32);let s=new r.GOR(o);
1s.colorSpace=r.er$,null==(n=e.material.map)||n.dispose(),e.material.map=s,e.material.needsUpdate=!0}(a,t.hp,t.maxHp))}let s="creature"===t.kind&&0===t.hp;e.rotation.z=s?Math.PI/2:0;let c=e.userData.saySprite;if(c){let l=null!=(o=null==(n=t.say)?void 0:n.at)?o:0;t.say&&e.userData.sayAt!==l&&(e.userData.sayAt=l,e.userData.sayShownAt=performance.now(),K(c,t.say.text.length>34?"".concat(t.say.text.slice(0,33),"…"):t.say.text)),e.userData.sayActive=!!t.say}}(l,t)}for(let[e,t]of ex)p.has(e)||(ej.remove(t),ex.delete(e));if(eE.current){let t=e.minis.find(e=>e.id===eE.current);t&&"creature"===t.kind?eD({id:t.id,label:t.label,stance:null!=(i=t.stance)?i:"idle",hp:null!=(a=t.hp)?a:null,maxHp:null!=(s=t.maxHp)?s:null,color:t.color}):(eE.current=null,eD(null))}let m=e.call?e.call.url:"";if(m!==ec.current){ec.current=m;let t=e.call?{url:e.call.url,provider:e.call.provider,label:e.call.label,inScene:e.call.inScene}:null;es(t),eL.setCall(t),t||null==(d=window.__hottubSurf)||null==(c=d.closeCall)||c.call(d)}let w=new Set;for(let t of e.tokens){w.add(t.id);let l=eS.get(t.id);l||(l=function(e){let t=J[e.kind],l=new r.eaF(new r.Ho_(.3*$,.3*$,.01,20),new r._4j({color:t,emissive:t,emissiveIntensity:.9,roughness:.4}));return l.userData.tokenId=e.id,l.userData.kind=e.kind,l}(t),eS.set(t.id,l),ej.add(l));let[n,o]=V(t.col,t.row,e.cols,e.rows,$);l.position.set(n,h,o)}for(let[e,t]of eS)w.has(e)||(ej.remove(t),eS.delete(e));if(e.lastRoll&&e.lastRoll.id!==eF){eF=e.lastRoll.id;let t=Z(e.lastRoll.value);eA.material.forEach(e=>{e.map=t,e.needsUpdate=!0}),eA.position.set(e.cols/2*$+.12,X+.06,0),eA.visible=!0,eR=performance.now()+900}if(e.ruler){let[t,l]=V(e.ruler.fromCol,e.ruler.fromRow,e.cols,e.rows,$),[n,o]=V(e.ruler.toCol,e.ruler.toRow,e.cols,e.rows,$);eU.setFromPoints([new r.Pq0(t,h,l),new r.Pq0(n,h,o)]);let i=Math.max(Math.abs(e.ruler.toCol-e.ruler.fromCol),Math.abs(e.ruler.toRow-e.ruler.fromRow));K(ez,"".concat(i," sq")),ez.position.set((t+n)/2,h+.12,(l+o)/2),eN.visible=!0,ez.visible=!0}else eN.visible=!1,ez.visible=!1}let e$=new r.tBo,eX=new r.I9Y,eZ=new r.Zcv(new r.Pq0(0,1,0),-(X+.006)),eq=null;function eK(e){let t=m.domElement.getBoundingClientRect();eX.set((e.clientX-t.left)/t.width*2-1,-(2*((e.clientY-t.top)/t.height))+1)}function eQ(e){return eT.current||e.userData.ownerUserId===h}let e0=!1,e1="";function e2(e){var t,l;let n=eP.current;if(!n)return;let o=function(e){if(!eB)return null;eK(e),e$.setFromCamera(eX,A);let t=new r.Pq0;if(!e$.ray.intersectPlane(eZ,t))return null;let l=Math.floor(t.x/$+eB.cols/2),n=Math.floor(t.z/$+eB.rows/2);return l<0||l>=eB.cols||n<0||n>=eB.rows?null:[l,n]}(e);if(!o)return;let i="".concat(o[0],",").concat(o[1]);i!==e1&&(e1=i,"fog"===n||"reveal"===n?null==(t=eC.current)||t.call(eC,{op:"fogTile",col:o[0],row:o[1],shroud:"fog"===n}):null==(l=eC.current)||l.call(eC,{op:"paintTile",col:o[0],row:o[1],tile:n}))}function e4(e){if(eP.current&&eT.current){e0=!0,e1="",F.enabled=!1,e2(e);return}eK(e),e$.setFromCamera(eX,A);let t=e$.intersectObjects([...ex.values()],!0);if(t.length){let e=t[0].object;for(;e&&!e.userData.miniId;)e=e.parent;if(e&&eT.current&&"creature"===e.userData.kind){var l,n,o;eE.current=e.userData.miniId;let t=null==eB?void 0:eB.minis.find(e=>e.id===eE.current);t&&eD({id:t.id,label:t.label,stance:null!=(l=t.stance)?l:"idle",hp:null!=(n=t.hp)?n:null,maxHp:null!=(o=t.maxHp)?o:null,color:t.color})}e&&eQ(e)&&((eq=e).userData.dragging=!0,F.enabled=!1)}}function e5(e){if(e0)return void e2(e);if(!eq){eK(e),e$.setFromCamera(eX,A);let t=e$.intersectObjects([...ex.values()],!0),l=!1;if(t.length){let e=t[0].object;for(;e&&!e.userData.miniId;)e=e.parent;l=!!e&&eQ(e)}m.domElement.style.cursor=l?"grab":"default";return}eK(e),e$.setFromCamera(eX,A);let t=new r.Pq0;e$.ray.intersectPlane(eZ,t)&&eq.position.set(t.x,X+.006,t.z)}function e3(){var e;if(e0){e0=!1,F.enabled=!0;return}if(!eq||!eB){eq=null,F.enabled=!0;return}let t=eq,l=Math.floor(t.position.x/$+eB.cols/2),n=Math.floor(t.position.z/$+eB.rows/2),o=t.userData.miniId;t.userData.dragging=!1,eq=null,F.enabled=!0,null==(e=eC.current)||e.call(eC,{op:"moveMini",miniId:o,col:l,row:n})}function e8(e){!eq&&er&&er.visible&&j&&(eK(e),e$.setFromCamera(eX,A),e$.intersectObject(er,!1).length&&(window.location.href=j))}if(m.domElement.addEventListener("pointerdown",e4),m.domElement.addEventListener("pointermove",e5),window.addEventListener("pointerup",e3),m.domElement.addEventListener("click",e8),eg(z),n){let e={userId:null!=h?h:"you",name:"You",isHost:!0},t=function(e,t){var l;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:y,o=null!=(l=v(n))?l:v(y);return{soakId:e,mapId:o.id,cols:o.cols,rows:o.rows,minis:[],tokens:o.tokens.map(e=>({id:_("tk"),kind:e.kind,col:e.col,row:e.row})),lastRoll:null,ruler:null,hostUserId:t,version:0,startedAt:Date.now()}}("preview",e.userId,"crypt"),l=G(t,{op:"addMini",label:"You",ownerUserId:e.userId,color:(0,u.XH)(p),col:3,row:3},e);l.ok&&(t=l.state),eT.current=!0,N(!0),P("live"),eW(t),eC.current=l=>{let n=G(t,l,e);n.ok&&eW(t=n.state)}}
1else{let e=new S({soakId:l,onStatus:e=>P(e),onWaiting:e=>{let{isHost:t}=e;eT.current=t,N(t)},onState:(e,t)=>{let{isHost:l}=t;eT.current=l||eT.current,N(eT.current),eW(e)}});eM.current=e,eC.current=t=>{e.act(t).then(e=>{e&&eW(e)})},e.start()}let e6=0,e9=null;if(!n&&l){let e=async()=>{try{var e,t,n,o,r,i;let a=await fetch("/api/soaks/".concat(l,"/game"),{cache:"no-store"});if(!a.ok)return;let s=await a.json(),c=null==(e=s.game)?void 0:e.state;if(!s.game||(null==c?void 0:c.kind)!=="table"){eV.current=null,eH.visible=!1,e_.visible=!1;return}eV.current=s.game.id;let d=s.game.seatNames,u=null==(t=c.rolls)?void 0:t[0];if(u&&u.n!==e6){e6=u.n;let e=Z(null!=(n=u.total)?n:"?");eA.material.forEach(t=>{t.map=e,t.needsUpdate=!0}),eA.position.set(z.cols/2*$+.12,X+.06,0),eA.visible=!0,eR=performance.now()+900}let f=c.initiative;if(f&&!f.open&&f.entries.length){let e=f.entries[f.turn],t=(null==e?void 0:e.seat)==null?null!=(o=null==e?void 0:e.label)?o:"the other side":null!=(r=null==d?void 0:d[e.seat])?r:"Seat ".concat(e.seat+1);K(eH,"Round ".concat(f.round," \xb7 ").concat(t)),eH.visible=!0}else eH.visible=!1;let h=!!(c.previously&&(null!=(i=c.rollCount)?i:0)===0);if(h&&e_.userData.text!==c.previously){e_.userData.text=c.previously;let e=c.previously.length>52?"".concat(c.previously.slice(0,51),"…"):c.previously;K(e_,"Previously: ".concat(e))}e_.visible=h}catch(e){}};e(),e9=setInterval(()=>{e()},4e3)}eY.current=(e,t,l)=>{if(!eB)return;let n=v(eB.mapId);if(!n)return;let o=Math.floor(eB.cols/2),r=Math.floor(eB.rows/2),i=new Set(eB.minis.map(e=>"".concat(e.col,",").concat(e.row))),a=null;for(let e=0;e<Math.max(eB.cols,eB.rows)&&!a;e+=1)for(let t=-e;t<=e&&!a;t+=1)for(let l=-e;l<=e&&!a;l+=1){if(Math.max(Math.abs(l),Math.abs(t))!==e)continue;let s=o+l,c=r+t;!i.has("".concat(s,",").concat(c))&&B(n,eB.overrides,s,c)&&(a=[s,c])}if(a){var s;null==(s=eC.current)||s.call(eC,{op:"spawnCreature",label:e,shape:t,col:a[0],row:a[1],stance:null==l?void 0:l.stance,hp:null==l?void 0:l.hp,color:null==l?void 0:l.color})}};let e7=new r.zD7;m.setAnimationLoop(()=>{let e=e7.getElapsedTime();for(let t of(x&&(en.position.y=.012*Math.sin(.9*e)),eL.update(e),eS.values()))t.material.emissiveIntensity=.7+.3*Math.sin(2.4*e+3*t.position.x);for(let t of(eA.visible&&performance.now()<eR?(eA.rotation.x+=.3,eA.rotation.y+=.24):eA.rotation.set(0,0,0),ex.values())){let l=t.userData.ring;(null==l?void 0:l.userData.hostile)&&(l.material.opacity=.6+.25*Math.sin(5*e));let n=t.userData.saySprite;if(n){let e=t.userData.sayShownAt,l=!0===t.userData.sayActive&&void 0!==e&&performance.now()-e<7e3;if(n.visible=l,l){let t=7e3-(performance.now()-(null!=e?e:0));n.material.opacity=Math.min(1,t/1500)}}}if(ed){let t=ed.geometry.getAttribute("position");for(let l=0;l<t.count;l+=1){let n=t.getY(l)+.016*eu.rise,o=t.getX(l)+Math.sin(.7*e+l)*eu.drift*.016;n>X+1.2&&(n=X+.05),n<X+.03&&(n=X+1.15),o>ef.w/2?o=-ef.w/2:o<-ef.w/2&&(o=ef.w/2),t.setXYZ(l,o,n,t.getZ(l))}t.needsUpdate=!0,eu.drift>=.16&&(ed.material.opacity=.5+.35*Math.sin(2.2*e))}F.update(),m.render(C,A)}),H(!0);let te=()=>{let t=e.clientWidth||window.innerWidth,l=e.clientHeight||window.innerHeight;A.aspect=t/l,A.updateProjectionMatrix(),m.setSize(t,l)};return te(),window.addEventListener("resize",te),window.addEventListener("orientationchange",te),()=>{var e;e9&&clearInterval(e9),eL.dispose(),ey.current=null,ev.current=null,window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),m.domElement.removeEventListener("pointerdown",e4),m.domElement.removeEventListener("pointermove",e5),window.removeEventListener("pointerup",e3),m.domElement.removeEventListener("click",e8),null==(e=eM.current)||e.stop(),F.dispose(),null==em||em.dispose(),C.traverse(e=>{var t;e.geometry&&e.geometry.dispose();let l=e.material;Array.isArray(l)?l.forEach(e=>e.dispose()):null==l||null==(t=l.dispose)||t.call(l)}),w.remove(),(0,s.NP)(m)}},[l,t]);let e$=e=>{var t;return null==(t=eC.current)?void 0:t.call(eC,e)},eX=()=>{let e=A(ed);if(!e)return void em("Paste an https:// meeting link — Meet, Zoom, Jitsi, and others all work.");em(null),e$({op:"setCall",url:e.url}),eu(""),eh(!1)};return(0,n.jsxs)("div",{ref:T,className:"xr-host",children:[!F&&!E&&(0,n.jsx)("div",{style:ee,children:(0,n.jsx)("p",{className:"xr-host__note",children:"Setting the table…"})}),E&&(0,n.jsxs)("p",{className:"xr-host__note",children:["This browser blocked 3D (WebGL). If you’re on ",(0,n.jsx)("strong",{children:"Brave"}),", set Shields",(0,n.jsx)("strong",{children:" Down for this site"})," and reload. Works in Safari, Edge, Chrome, and the Meta Quest browser."]}
1),!l&&F&&!E&&(0,n.jsx)("p",{className:"xr-host__note",style:{top:"auto",bottom:8},children:"Preview — open from a live Soak to play together."}),F&&!E&&(0,n.jsxs)("div",{className:"xr-tabletop__bar",role:"toolbar","aria-label":"Table controls",style:et,children:[(0,n.jsx)("a",{href:m,style:el,children:"Leave"}),(0,n.jsx)("button",{type:"button",style:el,onClick:function(){W(e=>{let t=!e;if(t)eg.current||(eg.current=(0,c.UK)("soak")),eg.current.start();else{var l;null==(l=eg.current)||l.stop()}return t})},children:z?"Sound off":"Sound on"}),"idle"===$?(0,n.jsx)("button",{type:"button",style:el,onClick:eS,children:"Join voice"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",style:el,onClick:function(){ei(e=>{var t;let l=!e;return null==(t=ek.current)||t.setMuted(l),l})},children:er?"Unmute":"Mute"}),(0,n.jsx)("button",{type:"button",style:el,onClick:ej,children:"Leave voice"})]}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>e$({op:"addMini",label:ex.current,color:(0,u.XH)(p),col:1,row:1}),children:"Add my mini"}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{let e=eV.current;e&&l?fetch("/api/soaks/".concat(l,"/game/move"),{method:"POST",headers:{"content-type":"application/json",...(0,x.l)()},body:JSON.stringify({gameId:e,move:{type:"roll",expression:"d20",label:"from the 3D table"}})}).then(e=>{e.ok||e$({op:"rollDice",sides:20})}):e$({op:"rollDice",sides:20})},children:"Roll d20"}),ea?(0,n.jsxs)(n.Fragment,{children:[ew?(0,n.jsx)("button",{type:"button",style:{...el,outline:"2px solid #ffd27a"},onClick:()=>{var e;return null==(e=ev.current)?void 0:e.call(ev)},children:"Leave call"}):(0,n.jsxs)("button",{type:"button",style:el,onClick:()=>{if(ea){if("idle"!==$&&ej(),C(ea)){var e;null==(e=ey.current)||e.call(ey,ea.url);return}(e=>{let t=window.__hottubSurf;return null!=t&&!!t.dockCall&&(t.dockCall(e),!0)})(ea.url)||window.open(ea.url,"_blank","noopener,noreferrer")}},title:ea.url,children:["Join ",ea.label]}),U&&(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{var e;null==(e=ev.current)||e.call(ev),e$({op:"clearCall"})},children:"End call"})]}):U?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",style:{...el,outline:ef?"2px solid #ffd27a":"none"},onClick:()=>{eh(e=>!e),em(null)},children:"Call…"}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{em(null),e$({op:"setCall",url:(()=>{var e;let t=(null!=(e=null!=l?l:p)?e:"table").replace(/[^a-z0-9]/gi,"").slice(0,40)||"table",n=Y.env.NEXT_PUBLIC_DAILY_DOMAIN;return n?"https://".concat(n,"/hottub-").concat(t):"https://meet.jit.si/HottubTable-".concat(t)})()})},title:"Start a ready-made call for the whole table",children:"Hottub call"})]}):null,U&&(0,n.jsx)(X,{onPick:e=>e$({op:"setMap",mapId:e})}),U&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("select",{value:eL,onChange:e=>eO(e.target.value),style:{...el,appearance:"auto",outline:eL?"2px solid #ffd27a":"none"},"aria-label":"Draw the world",children:[(0,n.jsx)("option",{value:"",children:"Draw…"}),(0,n.jsx)("option",{value:".",children:"Floor"}),(0,n.jsx)("option",{value:"#",children:"Wall"}),(0,n.jsx)("option",{value:"~",children:"Water"}),(0,n.jsx)("option",{value:"=",children:"Walkway"}),(0,n.jsx)("option",{value:" ",children:"Void"}),(0,n.jsx)("option",{value:"fog",children:"Fog"}),(0,n.jsx)("option",{value:"reveal",children:"Reveal"})]}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>e$({op:"fogAll",shroud:!0}),title:"Shroud the whole world — the party's minis keep their light",children:"Shroud all"}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>e$({op:"fogAll",shroud:!1}),title:"Lift all fog",children:"Lift fog"}),(0,n.jsxs)("form",{onSubmit:e=>{var t;e.preventDefault();let l=eU.trim();l&&(null==(t=eY.current)||t.call(eY,l,ez)),eN("")},style:{display:"flex",gap:6},children:[(0,n.jsx)("input",{value:eU,onChange:e=>eN(e.target.value),placeholder:"creature name",maxLength:24,style:{...el,width:116,cursor:"text"},"aria-label":"Creature name"}),(0,n.jsxs)("select",{value:ez,onChange:e=>eB(e.target.value),style:{...el,appearance:"auto"},"aria-label":"Creature shape",children:[(0,n.jsx)("option",{value:"humanoid",children:"Humanoid"}),(0,n.jsx)("option",{value:"beast",children:"Beast"}),(0,n.jsx)("option",{value:"construct",children:"Construct"})]}),(0,n.jsx)("button",{type:"submit",style:el,disabled:!eU.trim(),children:"Spawn"})]}),l&&(0,n.jsx)("button",{type:"button",style:{...el,outline:eA?"2px solid #ffd27a":"none"},onClick:()=>{eR(!eA),eA||e_()},children:"Roster"})]}),(0,n.jsx)("span",{style:{...el,cursor:"default",opacity:.7},children:"waiting"===O?"Waiting for host…":"live"===O?"Live":"error"===O?"Reconnecting…":"Connecting…"})]}),U&&ef&&!ea&&F&&!E&&(0,n.jsxs)("div",{style:{...en,left:"50%",right:"auto",transform:"translateX(-50%)",bottom:"auto",top:72,flexDirection:"row",alignItems:"center",flexWrap:"wrap",maxWidth:420},role:"dialog","aria-label":"Paste a call link",children:[(0,n.jsx)("input",{value:ed,onChange:e=>{eu(e.target.value),em(null)},onKeyDown:e=>{"Enter"===e.key&&eX()},placeholder:"Paste Meet / Zoom / Jitsi link",style:{...el,width:240,cursor:"text"},"aria-label":"Call link",autoFocus:!0}),(0,n.jsx)("button",{type:"button",style:el,onClick:eX,disabled:!ed.trim(),children:"Set"}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{eh(!1),em(null)},children:"Cancel"}),ep&&(0,n.jsx)("span",{style:{color:"#ffb4a2",fontSize:12,flexBasis:"100%"},children:ep})]}),U&&eI&&F&&!E&&(0,n.jsxs)("div",{style:en,role:"dialog","aria-label":"Directing ".concat(eI.label),children:[(0,n.jsx)("strong",{style:{color:"#fff",fontSize:13},children:eI.label}),(0,n.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:["idle","friendly","hostile"].map(e=>(0,n.jsx)("button",{type:"button",style:{...el,outline:eI.stance===e?"2px solid #ffd27a":"none"},onClick:()=>e$({op:"setStance",miniId:eI.id,stance:e}),children:e},e))}),(0,n.jsxs)("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{var e,t;return e$({op:"setHp",miniId:eI.id,hp:(null!=(t=null!=(e=eI.hp)?e:eI.maxHp)?t:10)-1})},children:"−1"}),(0,n.jsx)("span",{style:{color:"#fff",fontSize:13,minWidth:48,textAlign:"center"},children:null!=eI.hp?"".concat(eI.hp,"/").concat(eI.maxHp):"HP"}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{var e;return e$({op:"setHp",miniId:eI.id,hp:(null!=(e=eI.hp)?e:0)+1})},children:"+1"})]}),(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=eG.trim();t&&e$({op:"say",miniId:eI.id,text:t}),eW("")},style:{display:"flex",gap:6},children:[(0,n.jsx)("input",{value:eG,onChange:e=>eW(e.target.value),maxLength:120,placeholder:"speak as them…",style:{...el,width:150,cursor:"text"},"aria-label":"Speak as this creature"}),(0,n.jsx)("button",{type:"submit",style:el,disabled:!eG.trim(),children:"Say"})]}),(0,n.jsxs)("div",{style:{display:"flex",gap:6},children:[l&&(0,n.jsx)("button",{type:"button",style:el,title:"Keep them for next session — the campaign roster",onClick:()=>{var e;return e={name:eI.label,stance:eI.stance,hp:eI.maxHp,color:eI.color},void(l&&fetch("/api/soaks/".concat(l,"/npcs"),{method:"POST",headers:{"content-type":"application/json",...(0,x.l)()},body:JSON.stringify(e)}).then(()=>{eA&&e_()}))},children:"Save to roster"}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{e$({op:"removeMini",miniId:eI.id}),eD(null),eE.current=null},children:"Remove"}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>{eD(null),eE.current=null},children:"Close"})]})]}),U&&eA&&F&&!E&&(0,n.jsxs)("div",{style:{...en,left:"auto",right:16},role:"dialog","aria-label":"Campaign roster",children:[(0,n.jsx)("strong",{style:{color:"#fff",fontSize:13},children:"Campaign roster"}),0===eF.length?(0,n.jsx)("span",{style:{color:"rgba(255,255,255,0.7)",fontSize:12,maxWidth:200},children:"Empty so far — select a creature and Save to roster; it comes back next session."}):eF.map(e=>{var t;return(0,n.jsxs)("button",{type:"button",style:{...el,textAlign:"left"},title:null!=(t=e.notes)?t:void 0,onClick:()=>{var t,n,o;null==(t=eY.current)||t.call(eY,e.name,e.shape,{stance:e.stance,hp:null!=(n=e.hp)?n:void 0,color:null!=(o=e.color)?o:void 0}),fetch("/api/soaks/".concat(l,"/npcs"),{method:"POST",headers:{"content-type":"application/json",...(0,x.l)()},body:JSON.stringify({action:"touch",id:e.id})})},children:[e.name," \xb7 ",e.shape,e.hp?" \xb7 ".concat(e.hp," hp"):""]},e.id)}),(0,n.jsx)("button",{type:"button",style:el,onClick:()=>eR(!1),children:"Close"})]}),!1===D&&F&&(0,n.jsxs)("p",{className:"xr-host__note",style:{bottom:64},children:["Look around with your mouse, or open in a Meta Quest headset and tap ",(0,n.jsx)("strong",{children:"Enter VR"}),"."]})]})}function X(e){let{onPick:t}=e;return(0,n.jsxs)("select",{defaultValue:"",onChange:e=>{e.target.value&&t(e.target.value)},style:{...el,appearance:"auto"},"aria-label":"Change the battlemap",children:[(0,n.jsx)("option",{value:"",disabled:!0,children:"Map…"}),b.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})}function Z(e){let t=document.createElement("canvas");t.width=128,t.height=128;let l=t.getContext("2d");l.fillStyle="#f3ece0",l.fillRect(0,0,128,128),l.fillStyle="#2a2018",l.font="700 64px ui-sans-serif, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.fillText(String(e),64,68);let n=new r.GOR(t);
1return n.colorSpace=r.er$,n}function q(e){let t=new r.RoJ({depthTest:!1,transparent:!0}),l=new r.kxk(t);return l.scale.set(.4,.16,1),K(l,e),l}function K(e,t){var l;let n=document.createElement("canvas");n.width=256,n.height=96;let o=n.getContext("2d");o.fillStyle="rgba(20,14,8,0.78)",Q(o,8,24,240,48,12),o.fill(),o.fillStyle="#ffd27a",o.font="700 40px ui-sans-serif, system-ui, sans-serif",o.textAlign="center",o.textBaseline="middle",o.fillText(t,128,50);let i=new r.GOR(n);i.colorSpace=r.er$,null==(l=e.material.map)||l.dispose(),e.material.map=i,e.material.needsUpdate=!0}function Q(e,t,l,n,o,r){e.beginPath(),e.moveTo(t+r,l),e.arcTo(t+n,l,t+n,l+o,r),e.arcTo(t+n,l+o,t,l+o,r),e.arcTo(t,l+o,t,l,r),e.arcTo(t,l,t+n,l,r),e.closePath()}let ee={position:"absolute",inset:0,display:"grid",placeItems:"center",background:"linear-gradient(160deg,#241d18,#12100d)",zIndex:8},et={position:"absolute",top:16,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,flexWrap:"wrap",justifyContent:"center",background:"rgba(18,14,10,0.6)",padding:"8px 10px",borderRadius:12,zIndex:5,maxWidth:"94%"},el={background:"rgba(255,255,255,0.1)",color:"#fff",border:"1px solid rgba(255,255,255,0.2)",padding:"6px 12px",borderRadius:8,fontSize:13,cursor:"pointer",textDecoration:"none"},en={position:"absolute",left:16,bottom:76,zIndex:6,display:"flex",flexDirection:"column",gap:8,background:"rgba(18,14,10,0.75)",padding:"10px 12px",borderRadius:12,border:"1px solid rgba(255,255,255,0.15)"}}}]);

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.