tempest.games 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -4307,4 +4307,4 @@ if (edgeAlpha == 0.0) {
|
|
|
4307
4307
|
`;function Sxe(n){const e=YD(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new st},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new di(0,0,0,0)},uTroikaClipRect:{value:new di(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new st},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ct},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new pn},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:vxe,vertexTransform:bxe,fragmentDefs:xxe,fragmentColorTransform:_xe,customRewriter({vertexShader:t,fragmentShader:i}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(i)&&(i=i.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(d9,`uniform vec3 diffuse;
|
|
4308
4308
|
$&
|
|
4309
4309
|
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
|
|
4310
|
-
`))),{vertexShader:t,fragmentShader:i}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const cN=new td({color:16777215,side:mc,transparent:!0}),tz=8421504,nz=new nn,uw=new se,WR=new se,ab=[],wxe=new se,qR="+x+y";function iz(n){return Array.isArray(n)?n[0]:n}let v9=()=>{const n=new dr(new nd(1,1),cN);return v9=()=>n,n},b9=()=>{const n=new dr(new nd(1,1,32,1),cN);return b9=()=>n,n};const Mxe={type:"syncstart"},Txe={type:"synccomplete"},x9=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Exe=x9.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let _9=class extends dr{constructor(){const e=new yxe;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=tz,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=qR,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(Mxe),p9({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const i=this._queuedSyncs;i&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{i.forEach(r=>r&&r())})),this.dispatchEvent(Txe),e&&e()})))}onBeforeRender(e,t,i,r,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return Sxe(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=cN.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function i(){t.removeEventListener("dispose",i),e.dispose()})),this.hasOutline()){let i=e._outlineMtl;return i||(i=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),i.isTextOutlineMaterial=!0,i.depthWrite=!1,i.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),i.dispose()})),[i,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return iz(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return iz(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,i=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:a,blockBounds:c}=r;i.uTroikaSDFTexture.value=a,i.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),i.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,i.uTroikaSDFExponent.value=r.sdfExponent,i.uTroikaTotalBounds.value.fromArray(c),i.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let f=0,h=0,g=0,y,v,_,S=0,M=0;if(t){let{outlineWidth:A,outlineOffsetX:R,outlineOffsetY:P,outlineBlur:I,outlineOpacity:k}=this;f=this._parsePercent(A)||0,h=Math.max(0,this._parsePercent(I)||0),y=k,S=this._parsePercent(R)||0,M=this._parsePercent(P)||0}else g=Math.max(0,this._parsePercent(this.strokeWidth)||0),g&&(_=this.strokeColor,i.uTroikaStrokeColor.value.set(_??tz),v=this.strokeOpacity,v==null&&(v=1)),y=this.fillOpacity;i.uTroikaEdgeOffset.value=f,i.uTroikaPositionOffset.value.set(S,M),i.uTroikaBlurRadius.value=h,i.uTroikaStrokeWidth.value=g,i.uTroikaStrokeOpacity.value=v,i.uTroikaFillOpacity.value=y??1,i.uTroikaCurveRadius.value=this.curveRadius||0;let w=this.clipRect;if(w&&Array.isArray(w)&&w.length===4)i.uTroikaClipRect.value.fromArray(w);else{const A=(this.fontSize||.1)*100;i.uTroikaClipRect.value.set(c[0]-A,c[1]-A,c[2]+A,c[3]+A)}this.geometry.applyClipRect(i.uTroikaClipRect.value)}i.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ct;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||qR;if(o!==e._orientation){let a=i.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let c=o!==qR&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,f,h,g,y]=c;uw.set(0,0,0)[h]=f==="-"?1:-1,WR.set(0,0,0)[y]=g==="-"?-1:1,nz.lookAt(wxe,uw.cross(WR),WR),a.setFromMatrix4(nz)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),i=t?parseFloat(t[1]):NaN;e=(isNaN(i)?0:i/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new st){t.copy(e);const i=this.curveRadius;return i&&(t.x=Math.atan2(e.x,Math.abs(i)-Math.abs(e.z))*Math.abs(i)),t}worldPositionToTextCoords(e,t=new st){return uw.copy(e),this.localPositionToTextCoords(this.worldToLocal(uw),t)}raycast(e,t){const{textRenderInfo:i,curveRadius:r}=this;if(i){const s=i.blockBounds,o=r?b9():v9(),a=o.geometry,{position:c,uv:f}=a.attributes;for(let h=0;h<f.count;h++){let g=s[0]+f.getX(h)*(s[2]-s[0]);const y=s[1]+f.getY(h)*(s[3]-s[1]);let v=0;r&&(v=r-Math.cos(g/r)*r,g=Math.sin(g/r)*r),c.setXYZ(h,g,y,v)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,ab.length=0,o.raycast(e,ab);for(let h=0;h<ab.length;h++)ab[h].object=this,t.push(ab[h])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,Exe.forEach(i=>{this[i]=e[i]}),this}clone(){return new this.constructor().copy(this)}};x9.forEach(n=>{const e="_private_"+n;Object.defineProperty(_9.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new As;new Ct;const S9=te.forwardRef(({sdfGlyphSize:n=64,anchorX:e="center",anchorY:t="middle",font:i,fontSize:r=1,children:s,characters:o,onSync:a,...c},f)=>{const h=cc(({invalidate:_})=>_),[g]=te.useState(()=>new _9),[y,v]=te.useMemo(()=>{const _=[];let S="";return te.Children.forEach(s,M=>{typeof M=="string"||typeof M=="number"?S+=M:_.push(M)}),[_,S]},[s]);return f0e(()=>new Promise(_=>uxe({font:i,characters:o},_)),["troika-text",i,o]),te.useLayoutEffect(()=>{g.sync(()=>{h(),a&&a(g)})}),te.useEffect(()=>()=>g.dispose(),[g]),te.createElement("primitive",hT({object:g,ref:f,font:i,text:v,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:n},c),y)}),Axe=te.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:i,enableDamping:r=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:c,...f},h)=>{const g=cc(k=>k.invalidate),y=cc(k=>k.camera),v=cc(k=>k.gl),_=cc(k=>k.events),S=cc(k=>k.setEvents),M=cc(k=>k.set),w=cc(k=>k.get),A=cc(k=>k.performance),R=e||y,P=i||_.connected||v.domElement,I=te.useMemo(()=>new Pbe(R),[R]);return WO(()=>{I.enabled&&I.update()},-1),te.useEffect(()=>(s&&I.connect(s===!0?P:s),I.connect(P),()=>{I.dispose()}),[s,P,t,I,g]),te.useEffect(()=>{const k=N=>{g(),t&&A.regress(),o&&o(N)},L=N=>{a&&a(N)},F=N=>{c&&c(N)};return I.addEventListener("change",k),I.addEventListener("start",L),I.addEventListener("end",F),()=>{I.removeEventListener("start",L),I.removeEventListener("end",F),I.removeEventListener("change",k)}},[o,a,c,I,g,S]),te.useEffect(()=>{if(n){const k=w().controls;return M({controls:I}),()=>M({controls:k})}},[n,I]),te.createElement("primitive",hT({ref:h,object:I,enableDamping:r},f))}),Cxe=["set","truncate","extend","pop","push","shift","unshift","copyWithin","fill","splice","reverse","sort"],rz=B2(Cxe);class yy extends Array{mode="record";subject=new Oi;READONLY_VIEW=this;constructor(...e){return super(...e),new Proxy(this,{set:(t,i,r,s)=>{if(typeof i=="string"&&!Number.isNaN(Number.parseInt(i,10))){const o=Number(i);let a;return this.mode==="record"&&(a=t[o]),t[o]=r,a?this.emit({type:"set",index:o,next:r,prev:a}):this.mode==="record"&&this.emit({type:"set",index:o,next:r}),!0}if(i==="length"){if(this.mode==="record"){const o=t.length;if(o===r)return!0;if(o>r){const a=t.slice(r);t.length=r,this.emit({type:"truncate",length:r,items:a})}else t.length=r,this.emit({type:"extend",next:r,prev:o})}else t.length=r;return!0}return Reflect.set(t,i,r,s)}})}toJSON(){return[...this]}static fromJSON(e){return new yy(...e)}push(...e){let t;return this.mode==="record"?(this.mode="playback",t=super.push(...e),this.mode="record",this.emit({type:"push",items:e})):t=super.push(...e),t}pop(){let e;return this.mode==="record"?(this.mode="playback",e=super.pop(),e===void 0?this.emit({type:"pop"}):this.emit({type:"pop",value:e}),this.mode="record"):e=super.pop(),e}shift(){let e;return this.mode==="record"?(this.mode="playback",e=super.shift(),e===void 0?this.emit({type:"shift"}):this.emit({type:"shift",value:e}),this.mode="record"):e=super.shift(),e}unshift(...e){let t;return this.mode==="record"?(this.mode="playback",t=super.unshift(...e),this.emit({type:"unshift",items:e}),this.mode="record"):t=super.unshift(...e),t}reverse(){return super.reverse(),this.mode==="record"&&this.emit({type:"reverse"}),this}fill(e,t,i){if(this.mode==="record"){this.mode="playback";const r=this.slice(t,i);super.fill(e,t,i),t===void 0?this.emit({type:"fill",value:e,prev:r}):i===void 0?this.emit({type:"fill",value:e,start:t,prev:r}):this.emit({type:"fill",value:e,start:t,end:i,prev:r}),this.mode="record"}else super.fill(e,t,i);return this}sort(e){if(this.mode==="record"){this.mode="playback";const t=[...this];super.sort(e);const i=[...this];this.emit({type:"sort",next:i,prev:t}),this.mode="record"}return this}splice(...e){const[t,i,...r]=e,s=this.mode;s==="record"&&(this.mode="playback");const o=super.splice(...e);return s==="record"&&(this.mode="record"),i===void 0?this.emit({type:"splice",start:t,items:r,deleted:o,deleteCount:o.length}):this.emit({type:"splice",start:t,items:r,deleted:o,deleteCount:i}),o}copyWithin(e,t,i){const r=this.mode;let s;return r==="record"&&(s=this.slice(e),this.mode="playback"),super.copyWithin(e,t,i),r==="record"&&(this.mode="record"),s&&(i===void 0?this.emit({type:"copyWithin",prev:s,target:e,start:t}):this.emit({type:"copyWithin",prev:s,target:e,start:t,end:i})),this}subscribe(e,t){return this.subject.subscribe(e,t)}emit(e){this.subject.next(yy.packUpdate(e))}doStep(e){switch(e.type){case"copyWithin":this.copyWithin(e.target,e.start,e.end);break;case"extend":this.length=e.next;break;case"fill":this.fill(e.value,e.start,e.end);break;case"pop":this.pop();break;case"push":this.push(...e.items);break;case"reverse":this.reverse();break;case"shift":this.shift();break;case"sort":for(let i=0;i<e.next.length;i++)this[i]=e.next[i];this.length=e.next.length;break;case"splice":this.splice(e.start,e.deleteCount,...e.items);break;case"truncate":this.length=e.length;break;case"set":this[e.index]=e.next;break;case"unshift":this.unshift(...e.items);break}}do(e){this.mode="playback";const t=yy.unpackUpdate(e);return this.doStep(t),this.mode="record",null}undoStep(e){switch(e.type){case"copyWithin":for(let t=0;t<e.prev.length;t++)this[t+e.target]=e.prev[t];break;case"extend":this.length=e.prev;break;case"fill":{const t=e.start??0;for(let i=0;i<e.prev.length;i++)this[i+t]=e.prev[i]}break;case"pop":e.value&&this.push(e.value);break;case"push":{let t=e.items.length-1;for(;t>=0;)this.pop(),--t}break;case"reverse":this.reverse();break;case"shift":e.value&&this.unshift(e.value);break;case"sort":for(let t=0;t<e.prev.length;t++)this[t]=e.prev[t];this.length=e.prev.length;break;case"set":if(e.prev)this[e.index]=e.prev;else{delete this[e.index];const t=this.findIndex((i,r)=>!Object.hasOwn(this,r));t!==-1&&(this.length=t)}break;case"splice":this.splice(e.start,e.items.length,...e.deleted);break;case"truncate":this.push(...e.items);break;case"unshift":{let t=e.items.length-1;for(;t>=0;)this.shift(),--t}break}}undo(e){this.mode="playback";const t=yy.unpackUpdate(e);return this.undoStep(t),this.mode="record",null}static packUpdate(e){let t=rz[e.type]+"";switch(e.type){case"set":return t+=e.index+""+da(e.next),e.prev!==void 0&&(t+=""+da(e.prev)),t;case"truncate":return t+e.length+""+e.items.map(da).join("");case"extend":return t+e.next+""+e.prev;case"pop":case"shift":return e.value!==void 0&&(t+=da(e.value)),t;case"push":case"unshift":return t+e.items.map(da).join("");case"copyWithin":return t+=e.target+""+e.start,e.end!==void 0&&(t+=""+e.end),t+=""+e.prev.map(da).join(""),t;case"fill":return t+=da(e.value),e.start!==void 0&&(t+=""+e.start),e.end!==void 0&&(t+=""+e.end),t+=""+e.prev.map(da).join(""),t;case"splice":return t+e.start+""+e.deleteCount+""+e.items.map(da).join("")+""+e.deleted.map(da).join("");case"reverse":return t;case"sort":return t+e.next.map(da).join("")+""+e.prev.map(da).join("")}}static unpackUpdate(e){const[t,i]=e.split(""),r=rz[t];switch(r){case"set":{const[s,o,a]=i.split(""),c=+s,f=ha(o);if(a===void 0)return{type:r,index:c,next:f};const h=ha(a);return{type:r,index:c,next:f,prev:h}}case"truncate":{const[s,...o]=i.split(""),a=+s,c=o.map(ha);return{type:r,length:a,items:c}}case"extend":{const[s,o]=i.split(""),a=+s,c=+o;return{type:r,next:a,prev:c}}case"pop":case"shift":if(i!==""){const s=ha(i);return{type:r,value:s}}return{type:r};case"push":case"unshift":{const s=i.split("").map(ha);return{type:r,items:s}}case"copyWithin":{const[s,o]=i.split(""),a=o?o.split("").map(ha):[],[c,f,h]=s.split(""),g=+c,y=+f;if(h===void 0)return{type:r,target:g,start:y,prev:a};const v=+h;return{type:r,target:g,start:y,prev:a,end:v}}case"fill":{const[s,o]=i.split(""),a=o?o.split("").map(ha):[],[c,f,h]=s.split(""),g=ha(c);if(f===void 0&&h===void 0)return{type:r,value:g,prev:a};const y=+f;if(h===void 0)return{type:r,value:g,prev:a,start:y};const v=+h;return{type:r,value:g,prev:a,start:y,end:v}}case"splice":{const[s,o,a,c]=i.split(""),f=+s,h=+o,g=a?a.split("").map(ha):[],y=c?c.split("").map(ha):[];return{type:r,start:f,deleteCount:h,items:g,deleted:y}}case"reverse":return{type:r};case"sort":{const[s,o]=i.split(""),a=s?s.split("").map(ha):[],c=o?o.split("").map(ha):[];return{type:r,next:a,prev:c}}}}}const Py=fi({key:"dragState",default:null}),kx=fi({key:"dragPoint",default:null});function rA(n){return n.split("_").map(Number)}const Tc=QP({key:"gameTiles",class:nh}),sA=Ec({key:"tile3dPosition",get:n=>()=>{const[e,t,i]=rA(n),r=Math.sqrt(3),s=Math.PI/3,o=s*2,a=Math.sin(s),c=Math.cos(s),f=Math.sin(o),h=Math.cos(o),g=r*e,y=r*t,v=r*i,_=g*a,S=g*c,M=y*f,w=y*h,A=_+M,R=S+w+v;return new se(A,0,R)}}),pT=Ec({key:"adjacentZones",get:n=>()=>{const[e,t,i]=rA(n),r=new Set;return r.add(`${e+1}_${t-1}_${i}`),r.add(`${e+1}_${t}_${i-1}`),r.add(`${e-1}_${t+1}_${i}`),r.add(`${e-1}_${t}_${i+1}`),r.add(`${e+2}_${t-1}_${i-1}`),r.add(`${e-2}_${t+1}_${i+1}`),Array.from(r)}}),n0=Ec({key:"adjacentTiles",get:n=>({get:e})=>{const t=e(pT,n),i=e(Tc);return t.filter(r=>i.has(r))}}),w9=Gi({key:"playableZone",get:({get:n})=>{const e=n(Tc);if(e.size===0)return["0_0_0"];const t=new Set;for(const r of e){const s=n(pT,r);for(const o of s)t.add(o)}for(const r of e)t.delete(r);for(const r of t)n(n0,r).length>=5&&t.delete(r);const i=n(Yi);if(i?.type==="move"){t.delete(i.origin);const r=n(pT,i.origin);for(const s of r)n(n0,s).length===1&&t.delete(s)}return Array.from(t)}}),Rxe=Ec({key:"tileIsStructural",get:n=>({get:e})=>{const t=e(Tc),i=new Set(t);i.delete(n);const r=new Set,s=[];for(const o of i){s.push(o);break}for(;s.length>0;){const o=s.pop();r.add(o);const a=e(pT,o);for(const c of a)if(i.has(c)){if(r.has(c))continue;s.push(c)}}return r.size!==i.size}}),i0=Dh({key:"gameTilesStackHeight",default:1}),M9=Gi({key:"closestPlayableZone",get:({get:n})=>{const e=n(kx);if(!e)return null;let t=null,i=Number.POSITIVE_INFINITY;for(const r of n(w9)){const s=n(sA,r),o=e.distanceTo(s);o<i&&(i=o,t=r)}return t}}),T9=Ec({key:"ownedTiles",get:n=>({get:e,json:t})=>e(t(Tc)).filter(r=>e(ku,r)===n)}),Fa=Dh({key:"tileCubeCount",default:0}),ku=Dh({key:"tileOwner",default:null}),sz=Ec({key:"closestOwnedTile",get:n=>({get:e})=>{const t=e(T9,n);if(t.length===0)return null;const i=e(kx);if(!i)return null;let r=Number.POSITIVE_INFINITY,s=null;for(const o of t){const a=e(sA,o),c=i.distanceTo(a);c<r&&(r=c,s=o)}return s}}),Yi=fi({key:"turnInProgress",default:null}),mT=Gi({key:"validWarDeclarators",get:({get:n})=>{const e=[],t=n(Fh);if(t===null)return e;const i=n(Yi);if(i?.type==="arm")return e;if(i?.type==="war"&&i.attacker!==null)return e.push(i.attacker),e;const o=n(T9,t);for(const a of o)n(Fa,a)>=4&&e.push(a);return e}}),Dxe=Gi({key:"validWarTargets",get:({get:n})=>{const e=[],t=n(Fh),i=n(Yi);if(i?.type!=="war")return e;const r=i.attacker;if(!r)return e;const s=n(n0,r),o=new Set,a=[];for(const c of s)n(ku,c)===t&&a.push(c),e.push(c);for(;a.length>0;){const c=a.pop();o.add(c);const f=n(n0,c);for(const h of f)n(ku,h)===t&&!o.has(h)&&a.push(h)}return o.delete(r),e.push(...o),e}}),Pxe=Ec({key:"tileStatus",get:n=>({get:e})=>{const t=e(Yi);if(t?.type==="war"&&t.attacker===n)return"isInvader";if(e(mT).includes(n))return"mayInvade";if(e(Dxe).includes(n))return"mayBeInvaded";if(t?.type==="move"){if(t.origin===n)return"isMovingFromHere";if(t.target===n)return"isMovingToHere"}if(t!==null||e(mT).length>0)return null;const o=e(Fh);return o===null||e(r0,o)>0||e(ku,n)!==o||e(i0,n)!==1||e(n0,n).length>=5||e(Rxe,n)?null:"mayBeMoved"}}),E9=Ec({key:"maximumStackHeight",get:([n,e])=>({get:t})=>{const r=t(n0,n).filter(o=>t(ku,o)===e);let s=0;for(const o of r){const a=t(i0,o);if(a>=2)return 3;a>s&&(s=a)}return s+1}}),g_=QP({key:"playerTurnOrder",class:yy});Gi({key:"spectators",get:({get:n})=>{const e=n(g_),t=n(gI),i=[];if(!t)return i;const[r]=c0(_m),s=n(r,t);for(const o of s)e.includes(o)||i.push(o);return i}});const A9=fi({key:"turnNumber",default:0}),Fh=Gi({key:"playerTurn",get:({get:n})=>{const e=n(A9),t=n(g_);if(t.length===0)return null;const i=e%t.length;return t[i]}}),Ixe=Dh({key:"playerReadyStatus",default:"notReady"}),uN=fi({key:"gameState",default:"setup"}),Oxe=Gi({key:"setupGroups",get:({get:n})=>{const e=[],t=[],i=[],r=n(g_),s=n(gI);if(!s)return{notReady:e,readyDoesNotWantFirst:t,readyWantsFirst:i};const[o]=c0(_m),a=n(o,s);for(const c of a){const f=n(Ixe,c);if(!r.includes(c))switch(f){case"notReady":e.push(c);break;case"readyDoesNotWantFirst":t.push(c);break;case"readyWantsFirst":i.push(c);break}}return{notReady:e,readyDoesNotWantFirst:t,readyWantsFirst:i}}}),Nxe=["#f46","#f96","#fe0","#5a6","#5af","#a7e"],kxe={"#f46":"Red","#f96":"Orange","#fe0":"Yellow","#5a6":"Green","#5af":"Blue","#a7e":"Purple"},Dm=Dh({key:"playerColor",default:null}),Lxe=Gi({key:"colorsChosen",get:({get:n})=>{const e=new Set,t=n(g_);for(const i of t){const r=n(Dm,i);r&&e.add(r)}return e}}),Uxe=Gi({key:"turnCanBeEnded",get:({get:n})=>{const e=n(Yi);switch(e?.type){case"build":case void 0:case null:return!1;case"arm":return e.targets.length>0;case"move":return e.target!==null;case"war":{const t=n(Tc);for(const i of t)if(n(Fa,i)===0)return!1;return e.targets.length>0}}}});function Fxe(n,e,t,i,r){let s,o;if(n===e)s=-1,o=1;else{const h=Cn(i0,i.attacker);s=-1-(i.targets.includes(r)?0:t>h?t-h:0),o=-1}if(Cn(Fa,i.attacker)+s<=0)return;if(It(Yi,{...i,targets:[...i.targets,r]}),It(Fa,r,h=>h+o),It(Fa,i.attacker,h=>h+s),Cn(Fa,r)===0){const h=Cn(ku,r);h!==null&&(i.originalOwners[r]=h),It(ku,r,n)}}const r0=Dh({key:"playerRemainingTiles",default:12}),gT=Dh({key:"playerRemainingCubes",default:20});function oA(){const{socket:n}=PT.useContext(Sm);return n}const fN=fi({key:"cameraTarget",default:[0,0,0]}),dN=fi({key:"controlsEnabled",default:!0}),C9=fi({key:"cameraAnchoredSphere",default:null}),hN=Gi({key:"isMyTurn",get:({get:n})=>{const e=n(Fh),t=n(kl);return e===t}}),R9=Gi({key:"iAmReadyToPlay",get:({get:n})=>{const e=n(kl);return e===null||n(Dm,e)===null?!1:n(hN)}}),Bxe=Gi({key:"playableZonesVisible",get:({get:n})=>{if(!n(R9))return!1;const t=n(Yi);switch(t?.type){case"arm":case"build":case"war":return!1;case"move":if(t.target===null)return"toMove";break;case null:case void 0:{const i=n(kl);if(i===null||n(mT).length>0)return!1;if(n(r0,i)>0)return"toBuild"}}return!1}}),zxe=Gi({key:"playerToolsVisible",get:({get:n})=>n(R9)?n(mT).length<=0:!1}),Vxe=Gi({key:"mayPlaceTile",get:({get:n})=>{const e=n(kl);if(e===null||n(r0,e)<=0)return!1;const i=n(Yi);switch(i?.type){case void 0:return!0;case"arm":case"move":case"war":return!1;case"build":{const{count:r}=i,s=n(E9,[i.target,e]);return r<s}}}}),jxe=Gi({key:"mayPlaceCube",get:({get:n})=>{const e=n(kl);if(e===null||n(gT,e)<=0)return!1;const i=n(Yi);switch(i?.type){case"move":case"war":return!1;case void 0:{const r=n(Tc);for(const s of r)if(n(ku,s)===e)return!0;return!1}case"arm":{const{targets:r}=i;return r.length<2}case"build":{const{count:r}=i;return r>=1}}}});function Gxe({size:n=10,radius:e=1,color:t="#808080",opacity:i=.75,y:r=0,dashed:s=!1}){const o=te.useRef(null),{geometry:a,dashSize:c,gapSize:f}=te.useMemo(()=>{const g=[0,60,120,180,240,300].map(k=>k*Math.PI/180),y=k=>Math.cos(k),v=k=>Math.sin(k),_=(k,L)=>{const F=e*(1.5*k),N=e*(Math.sqrt(3)*(L+k/2));return new st(F,N)},S=Math.ceil(n*2/(1.5*e)),M=Math.ceil(n*2/(Math.sqrt(3)*e)),w=g.map(k=>new se(e*y(k),0,e*v(k))),A=[];for(let k=-S;k<=S;k++)for(let L=-M;L<=M;L++){const F=_(k,L);if(!(Math.abs(F.x)>n+e||Math.abs(F.y)>n+e))for(let N=0;N<6;N++){const U=w[N],$=w[(N+1)%6];A.push(U.x+F.x,0,U.z+F.y),A.push($.x+F.x,0,$.z+F.y)}}const R=new cn;R.setAttribute("position",new Ut(A,3)),R.computeBoundingSphere();const P=e*.6,I=e*.6;return{geometry:R,dashSize:P,gapSize:I}},[n,e]),h=te.useMemo(()=>s?new nT({color:t,transparent:i<1,opacity:i,dashSize:c,gapSize:f}):new go({color:t,transparent:i<1,opacity:i}),[t,i,s]);return te.useLayoutEffect(()=>{if(o.current&&o.current.material instanceof nT){const g=o.current.geometry,y=g.getAttribute("position"),v=new Float32Array(y.count);for(let _=0;_<y.count;_+=2){const S=y.getX(_),M=y.getY(_),w=y.getZ(_),A=y.getX(_+1),R=y.getY(_+1),P=y.getZ(_+1),I=Math.hypot(A-S,R-M,P-w);v[_]=0,v[_+1]=I}g.setAttribute("lineDistance",new hi(v,1)),o.current.material.needsUpdate=!0}},[]),j.jsx("group",{"position-y":r,"rotation-x":-Math.PI*0,children:j.jsx("lineSegments",{ref:o,geometry:a,position:[0,r+1e-4,0],rotation:[0,0,0],material:h})})}function Hxe({position:[n,e,t],count:i,ownerKey:r}){const s=[];for(;i>0;)i>=4?(s.push(4),i-=4):(s.push(i),i=0);return j.jsx(j.Fragment,{children:s.map((o,a)=>j.jsx($xe,{position:new se(n,e+a*.5,t),count:o,rotation:new po(0,a*Math.PI/3,0),ownerKey:r},a))})}function $xe({position:n,rotation:e,count:t,ownerKey:i}){const r=t*.1+.1,s=ln(Dm,i)??"#555";return j.jsx("group",{position:n,rotation:e,children:t===1?j.jsx(ZD,{color:s,position:new se(0,0,0),rotation:new po(0,0,0)}):Array.from({length:t}).map((o,a)=>{const c=a/t*Math.PI*2,f=Math.cos(c)*r,h=Math.sin(c)*r,g=new po(0,Math.PI*3/2-c,0);return j.jsx(ZD,{color:s,position:new se(f,0,h),rotation:g},a)})})}function ZD(n){return j.jsxs("mesh",{...n,receiveShadow:!0,children:[j.jsx("boxGeometry",{args:[.5,.5,.5]}),j.jsx("meshStandardMaterial",{color:n.color??"hotpink"})]})}function Bb({ref:n,radius:e=1,height:t=.3,position3d:i=new se(0,0,0),color:r="#ee5",virtual:s=!1,onClick:o,onPointerDown:a,onPointerUp:c}){const[f,h]=te.useState(!1),g=te.useMemo(()=>{const v=new ph;for(let _=0;_<6;_++){const S=Math.PI/180*(60*_),M=e*Math.cos(S),w=e*Math.sin(S);_===0?v.moveTo(M,w):v.lineTo(M,w)}return v.closePath(),v},[e]),y=te.useMemo(()=>new a_(g,{depth:s?t-.1:t,bevelEnabled:!1}),[g,t]);return j.jsx("mesh",{ref:n,geometry:y,position:i,rotation:[-Math.PI/2,0,0],castShadow:!0,receiveShadow:!0,onClick:()=>{o?.(i)},onPointerOver:()=>{h(!0)},onPointerOut:()=>{h(!1)},onPointerDown:()=>{a?.(i)},onPointerUp:()=>{c?.(i)},children:j.jsx("meshStandardMaterial",{color:r,transparent:s,opacity:s?f?.5:.2:1})})}function Wxe({coordinatesSerialized:n}){const e=oA(),t=rA(n),[i,r,s]=t,o=Cn(sA,n),[a,c,f]=o,g=ln(M9)===n;return i+r+s!==0?(console.error("GameTile: bad coordinates did not add to zero",t),null):j.jsxs(j.Fragment,{children:[j.jsx(S9,{position:[a,.2+.7,f],fontSize:.25,color:"white",children:n}),j.jsx(Bb,{virtual:!0,position3d:o,color:g?"#f00":"#0ff",onClick:v=>{It(fN,v.toArray());const _=Cn(Yi);if(_?.type==="move"){const{origin:S}=_,M=n;It(Yi,{..._,target:M});const w=Cn(Fa,S);It(Fa,M,w),It(Fa,S,0),It(Tc,A=>(A.delete(S),A.add(M),A)),e.emit("finishMove",M)}else It(Tc,S=>(S.add(n),S)),e.emit("placeTile",n)}})]})}function qxe({coordinatesSerialized:n}){const e=oA(),t=rA(n),[i,r,s]=t,o=bc(i0,n),a=bc(Fa,n),c=bc(ku,n),f=Ru(Fh),h=Ru(hN),g=Cn(sA,n),[y,v,_]=g,S=wc(Yi),M=TZ(Pxe,n);let w;switch(M){case null:w="#aa5";break;case"mayBeInvaded":case"isMovingToHere":w="#664";break;case"isInvader":case"isMovingFromHere":w="#ee1";break;case"mayInvade":case"mayBeMoved":w="#cc3";break}if(i+r+s!==0)return console.error("GameTile: bad coordinates did not add to zero",t),null;const A=o*.33;return j.jsxs(j.Fragment,{children:[j.jsx(S9,{position:[y,A+.7,_],fontSize:.25,color:"white",children:n}),c!==null&&a>0?j.jsx(Hxe,{position:new se(y,A+.25,_),count:a,ownerKey:c}):null,j.jsx(Bb,{position3d:g,color:w,onClick:R=>{It(fN,R.toArray()),h&&M==="mayInvade"&&(It(Yi,{type:"war",attacker:n,targets:[],originalOwners:{}}),e.emit("chooseAttacker",n)),h&&M==="mayBeInvaded"&&S?.type==="war"&&S.attacker!==null&&(Fxe(f,c,o,S,n),e.emit("chooseTarget",n)),h&&M==="mayBeMoved"&&(It(Yi,{type:"move",origin:n,target:null}),e.emit("startMove",n))},virtual:!1}),o>1?j.jsx(Bb,{position3d:new se(y,.33,_),color:w}):null,o>2?j.jsx(Bb,{position3d:new se(y,.66,_),color:w}):null]})}function Kxe(){const n=wc(kl),e=Ru(Vxe),t=Ru(jxe);return n?j.jsxs(j.Fragment,{children:[e?j.jsx(Xxe,{myUserKey:n}):null,t?j.jsx(Yxe,{myUserKey:n}):null]}):null}const fh=new se,Iy=new se,D9=new se(0,1,0),yT=new se,P9=new gu(new se(0,1,0),0),I9=10,O9=-2,Jp=new se;function Xxe({myUserKey:n}){const e=lV(C9,te.useRef),{camera:t,raycaster:i,pointer:r}=cc(),s=ka(dN),o=ln(Py),a=oA(),c=()=>{s(!1),It(Py,"tile")},f=()=>{s(!0),It(Py,null);const h=Cn(Yi);switch(h?.type){case"arm":case"war":case"move":break;case null:case void 0:{const g=Cn(M9);g&&(It(Tc,y=>(y.add(g),y)),It(r0,n,y=>y-1),It(Yi,{type:"build",target:g,count:1}),a.emit("placeTile",g))}break;case"build":{const g=Cn(E9,[h.target,n]);if(g===0)return;const y=Cn(i0,h.target);if(y>=g)return;It(i0,h.target,y+1),It(r0,n,v=>v-1),It(Yi,{type:"build",target:h.target,count:h.count+1}),a.emit("placeTile",h.target)}break}It(kx,null)};return WO(()=>{if(e.current)switch(o){case"tile":if(i.setFromCamera(r,t),i.ray.intersectPlane(P9,Jp)){const h=new se(Jp.x,Jp.y+.001,Jp.z);It(kx,h),e.current.position.copy(h)}break;case null:case"cube":t.getWorldDirection(fh),Iy.copy(fh).cross(D9).normalize(),yT.copy(Iy).cross(fh).normalize(),e.current.position.copy(t.position.clone().add(fh.multiplyScalar(I9)).add(Iy.multiplyScalar(O9)).add(yT.multiplyScalar(-1)))}}),j.jsx(Bb,{ref:e,onPointerDown:c,onPointerUp:f})}function Yxe({myUserKey:n}){const e=lV(C9,te.useRef),{camera:t,raycaster:i,pointer:r}=cc(),s=ka(dN),o=ln(Py),a=ln(Dm,n),c=oA(),f=()=>{s(!1),It(Py,"cube")},h=()=>{s(!0),It(Py,null);const g=Cn(Yi);switch(g?.type){case"move":case"war":break;case null:case void 0:{const y=Cn(sz,n);y&&(It(Yi,{type:"arm",targets:[y]}),It(Fa,y,v=>v+1),c.emit("placeCube",y))}break;case"arm":{if(g.targets.length>=2)return;const y=Cn(sz,n);y&&(It(Fa,y,v=>v+1),It(gT,n,v=>v-1),It(Yi,{type:"arm",targets:[g.targets[0],y]}),c.emit("placeCube",y))}break;case"build":It(Fa,g.target,y=>y+1),It(gT,n,y=>y-1),It(ku,g.target,n),It(Yi,null),c.emit("placeCube",g.target);break}};return WO(()=>{if(e.current)switch(o){case"cube":i.setFromCamera(r,t),i.ray.intersectPlane(P9,Jp)&&(It(kx,Jp),e.current.position.copy(Jp));break;case null:case"tile":t.getWorldDirection(fh),Iy.copy(fh).cross(D9).normalize(),yT.copy(Iy).cross(fh).normalize(),e.current.position.copy(t.position.clone().add(fh.multiplyScalar(I9)).add(Iy.multiplyScalar(-O9)).add(yT.multiplyScalar(-1)))}}),j.jsx(ZD,{ref:e,onPointerDown:f,onPointerUp:h,color:a??"#555"})}function Jxe(){return yI(Tc),VT(Tc).map(e=>j.jsx(qxe,{coordinatesSerialized:e},e))}function Zxe(){return Ru(w9).map(e=>j.jsx(Wxe,{coordinatesSerialized:e},e))}function Qxe(){const n=ln(fN);return c9({animatedCam:n,config:{mass:1,tension:170,friction:26}}),j.jsxs(hve,{camera:{position:[15,15,15],fov:50},style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh"},children:[j.jsx("ambientLight",{intensity:.5}),j.jsx("directionalLight",{position:[5,10,5]}),j.jsx(n_e,{target:[...n]}),j.jsx(Gxe,{size:20,radius:1,color:"#6f6f6f",opacity:.5}),j.jsx(e_e,{})]})}function e_e(){return ln(gI)?j.jsx(t_e,{}):null}function t_e(){const n=Ru(Bxe),e=Ru(zxe);return j.jsxs(j.Fragment,{children:[j.jsx(Jxe,{}),n?j.jsx(Zxe,{}):null,e?j.jsx(Kxe,{}):null]})}function n_e({target:n}){const e=te.useRef(null),t=ln(dN);return c9({animatedTarget:n,config:{mass:1,tension:170,friction:26},onChange:({value:i})=>{e.current?.target.lerp(new se(...i.animatedTarget),.2),e.current?.update()}}),j.jsx(Axe,{ref:e,enableDamping:!0,dampingFactor:.05,enabled:t})}const lt=Symbol.for("drizzle:entityKind");function xr(n,e){if(!n||typeof n!="object")return!1;if(n instanceof e)return!0;if(!Object.prototype.hasOwnProperty.call(e,lt))throw new Error(`Class "${e.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let t=Object.getPrototypeOf(n).constructor;if(t)for(;t;){if(lt in t&&t[lt]===e[lt])return!0;t=Object.getPrototypeOf(t)}return!1}class aA{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[lt]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class i_e{static[lt]="ColumnBuilder";config;constructor(e,t,i){this.config={name:e,keyAsName:e==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===""&&(this.config.name=e)}}const Oy=Symbol.for("drizzle:Name");class r_e{static[lt]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{const{name:i,columns:r,foreignColumns:s}=e();return{name:i,columns:r,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new s_e(e,this)}}class s_e{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[lt]="PgForeignKey";reference;onUpdate;onDelete;getName(){const{name:e,columns:t,foreignColumns:i}=this.reference(),r=t.map(a=>a.name),s=i.map(a=>a.name),o=[this.table[Oy],...r,i[0].table[Oy],...s];return e??`${o.join("_")}_fk`}}function o_e(n,...e){return n(...e)}function a_e(n,e){return`${n[Oy]}_${e.join("_")}_unique`}function oz(n,e,t){for(let i=e;i<n.length;i++){const r=n[i];if(r==="\\"){i++;continue}if(r==='"')return[n.slice(e,i).replace(/\\/g,""),i+1];if(!t&&(r===","||r==="}"))return[n.slice(e,i).replace(/\\/g,""),i]}return[n.slice(e).replace(/\\/g,""),n.length]}function N9(n,e=0){const t=[];let i=e,r=!1;for(;i<n.length;){const s=n[i];if(s===","){(r||i===e)&&t.push(""),r=!0,i++;continue}if(r=!1,s==="\\"){i+=2;continue}if(s==='"'){const[c,f]=oz(n,i+1,!0);t.push(c),i=f;continue}if(s==="}")return[t,i+1];if(s==="{"){const[c,f]=N9(n,i+1);t.push(c),i=f;continue}const[o,a]=oz(n,i,!1);t.push(o),i=a}return[t,i]}function l_e(n){const[e]=N9(n,1);return e}function k9(n){return`{${n.map(e=>Array.isArray(e)?k9(e):typeof e=="string"?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${e}`).join(",")}}`}class Bn extends i_e{foreignKeyConfigs=[];static[lt]="PgColumnBuilder";array(e){return new u_e(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:r})=>o_e((s,o)=>{const a=new r_e(()=>{const c=s();return{columns:[e],foreignColumns:[c]}});return o.onUpdate&&a.onUpdate(o.onUpdate),o.onDelete&&a.onDelete(o.onDelete),a.build(t)},i,r))}buildExtraConfigColumn(e){return new c_e(e,this.config)}}class un extends aA{constructor(e,t){t.uniqueName||(t.uniqueName=a_e(e,[t.name])),super(e,t),this.table=e}static[lt]="PgColumn"}class c_e extends un{static[lt]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class KR{static[lt]="IndexedColumn";constructor(e,t,i,r){this.name=e,this.keyAsName=t,this.type=i,this.indexConfig=r}name;keyAsName;type;indexConfig}class u_e extends Bn{static[lt]="PgArrayBuilder";constructor(e,t,i){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=i}build(e){const t=this.config.baseBuilder.build(e);return new pN(e,this.config,t)}}class pN extends un{constructor(e,t,i,r){super(e,t),this.baseColumn=i,this.range=r,this.size=t.size}size;static[lt]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(e){return typeof e=="string"&&(e=l_e(e)),e.map(t=>this.baseColumn.mapFromDriverValue(t))}mapToDriverValue(e,t=!1){const i=e.map(r=>r===null?null:xr(this.baseColumn,pN)?this.baseColumn.mapToDriverValue(r,!0):this.baseColumn.mapToDriverValue(r));return t?i:k9(i)}}class f_e extends Bn{static[lt]="PgEnumObjectColumnBuilder";constructor(e,t){super(e,"string","PgEnumObjectColumn"),this.config.enum=t}build(e){return new d_e(e,this.config)}}class d_e extends un{static[lt]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}const vT=Symbol.for("drizzle:isPgEnum");function h_e(n){return!!n&&typeof n=="function"&&vT in n&&n[vT]===!0}class p_e extends Bn{static[lt]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new m_e(e,this.config)}}class m_e extends un{static[lt]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}function lA(n,e){return Array.isArray(e)?g_e(n,[...e],void 0):y_e(n,e,void 0)}function g_e(n,e,t){const i=Object.assign(r=>new p_e(r??"",i),{enumName:n,enumValues:e,schema:t,[vT]:!0});return i}function y_e(n,e,t){const i=Object.assign(r=>new f_e(r??"",i),{enumName:n,enumValues:Object.values(e),schema:t,[vT]:!0});return i}class L9{static[lt]="Subquery";constructor(e,t,i,r=!1,s=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:r,usedTables:s}}}const v_e={startActiveSpan(n,e){return e()}},zb=Symbol.for("drizzle:ViewBaseConfig"),XR=Symbol.for("drizzle:Schema"),az=Symbol.for("drizzle:Columns"),lz=Symbol.for("drizzle:ExtraConfigColumns"),YR=Symbol.for("drizzle:OriginalName"),JR=Symbol.for("drizzle:BaseName"),bT=Symbol.for("drizzle:IsAlias"),cz=Symbol.for("drizzle:ExtraConfigBuilder"),b_e=Symbol.for("drizzle:IsDrizzleTable");class Ms{static[lt]="Table";static Symbol={Name:Oy,Schema:XR,OriginalName:YR,Columns:az,ExtraConfigColumns:lz,BaseName:JR,IsAlias:bT,ExtraConfigBuilder:cz};[Oy];[YR];[XR];[az];[lz];[JR];[bT]=!1;[b_e]=!0;[cz]=void 0;constructor(e,t,i){this[Oy]=this[YR]=e,this[XR]=t,this[JR]=i}}function U9(n){return n!=null&&typeof n.getSQL=="function"}function x_e(n){const e={sql:"",params:[]};for(const t of n)e.sql+=t.sql,e.params.push(...t.params),t.typings?.length&&(e.typings||(e.typings=[]),e.typings.push(...t.typings));return e}class uc{static[lt]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new ur([this])}}class ur{constructor(e){this.queryChunks=e;for(const t of e)if(xr(t,Ms)){const i=t[Ms.Symbol.Schema];this.usedTables.push(i===void 0?t[Ms.Symbol.Name]:i+"."+t[Ms.Symbol.Name])}}static[lt]="SQL";decoder=F9;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return v_e.startActiveSpan("drizzle.buildSQL",t=>{const i=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(e,t){const i=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:r,escapeName:s,escapeParam:o,prepareTyping:a,inlineParams:c,paramStartIndex:f}=i;return x_e(e.map(h=>{if(xr(h,uc))return{sql:h.value.join(""),params:[]};if(xr(h,QD))return{sql:s(h.value),params:[]};if(h===void 0)return{sql:"",params:[]};if(Array.isArray(h)){const g=[new uc("(")];for(const[y,v]of h.entries())g.push(v),y<h.length-1&&g.push(new uc(", "));return g.push(new uc(")")),this.buildQueryFromSourceParams(g,i)}if(xr(h,ur))return this.buildQueryFromSourceParams(h.queryChunks,{...i,inlineParams:c||h.shouldInlineParams});if(xr(h,Ms)){const g=h[Ms.Symbol.Schema],y=h[Ms.Symbol.Name];return{sql:g===void 0||h[bT]?s(y):s(g)+"."+s(y),params:[]}}if(xr(h,aA)){const g=r.getColumnCasing(h);if(t.invokeSource==="indexes")return{sql:s(g),params:[]};const y=h.table[Ms.Symbol.Schema];return{sql:h.table[bT]||y===void 0?s(h.table[Ms.Symbol.Name])+"."+s(g):s(y)+"."+s(h.table[Ms.Symbol.Name])+"."+s(g),params:[]}}if(xr(h,z9)){const g=h[zb].schema,y=h[zb].name;return{sql:g===void 0||h[zb].isAlias?s(y):s(g)+"."+s(y),params:[]}}if(xr(h,xT)){if(xr(h.value,_T))return{sql:o(f.value++,h),params:[h],typings:["none"]};const g=h.value===null?null:h.encoder.mapToDriverValue(h.value);if(xr(g,ur))return this.buildQueryFromSourceParams([g],i);if(c)return{sql:this.mapInlineParam(g,i),params:[]};let y=["none"];return a&&(y=[a(h.encoder)]),{sql:o(f.value++,g),params:[g],typings:y}}return xr(h,_T)?{sql:o(f.value++,h),params:[h],typings:["none"]}:xr(h,ur.Aliased)&&h.fieldAlias!==void 0?{sql:s(h.fieldAlias),params:[]}:xr(h,L9)?h._.isWith?{sql:s(h._.alias),params:[]}:this.buildQueryFromSourceParams([new uc("("),h._.sql,new uc(") "),new QD(h._.alias)],i):h_e(h)?h.schema?{sql:s(h.schema)+"."+s(h.enumName),params:[]}:{sql:s(h.enumName),params:[]}:U9(h)?h.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([h.getSQL()],i):this.buildQueryFromSourceParams([new uc("("),h.getSQL(),new uc(")")],i):c?{sql:this.mapInlineParam(h,i),params:[]}:{sql:o(f.value++,h),params:[h],typings:["none"]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="string")return t(e);if(typeof e=="object"){const i=e.toString();return t(i==="[object Object]"?JSON.stringify(e):i)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return e===void 0?this:new ur.Aliased(this,e)}mapWith(e){return this.decoder=typeof e=="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class QD{constructor(e){this.value=e}static[lt]="Name";brand;getSQL(){return new ur([this])}}function __e(n){return typeof n=="object"&&n!==null&&"mapToDriverValue"in n&&typeof n.mapToDriverValue=="function"}const F9={mapFromDriverValue:n=>n},B9={mapToDriverValue:n=>n};({...F9,...B9});class xT{constructor(e,t=B9){this.value=e,this.encoder=t}static[lt]="Param";brand;getSQL(){return new ur([this])}}function ym(n,...e){const t=[];(e.length>0||n.length>0&&n[0]!=="")&&t.push(new uc(n[0]));for(const[i,r]of e.entries())t.push(r,new uc(n[i+1]));return new ur(t)}(n=>{function e(){return new ur([])}n.empty=e;function t(c){return new ur(c)}n.fromList=t;function i(c){return new ur([new uc(c)])}n.raw=i;function r(c,f){const h=[];for(const[g,y]of c.entries())g>0&&f!==void 0&&h.push(f),h.push(y);return new ur(h)}n.join=r;function s(c){return new QD(c)}n.identifier=s;function o(c){return new _T(c)}n.placeholder=o;function a(c,f){return new xT(c,f)}n.param=a})(ym||(ym={}));(n=>{class e{constructor(i,r){this.sql=i,this.fieldAlias=r}static[lt]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new e(this.sql,this.fieldAlias)}}n.Aliased=e})(ur||(ur={}));class _T{constructor(e){this.name=e}static[lt]="Placeholder";getSQL(){return new ur([this])}}const S_e=Symbol.for("drizzle:IsDrizzleView");class z9{static[lt]="View";[zb];[S_e]=!0;constructor({name:e,schema:t,selectedFields:i,query:r}){this[zb]={name:e,originalName:e,schema:t,selectedFields:i,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new ur([this])}}aA.prototype.getSQL=function(){return new ur([this])};Ms.prototype.getSQL=function(){return new ur([this])};L9.prototype.getSQL=function(){return new ur([this])};function Rs(n,e){return{name:typeof n=="string"&&n.length>0?n:"",config:typeof n=="object"?n:e}}typeof TextDecoder>"u"||new TextDecoder;class cA extends Bn{static[lt]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){const{name:t,...i}=e;this.config.generatedIdentity={type:"always",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){const{name:t,...i}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class w_e extends cA{static[lt]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53")}build(e){return new M_e(e,this.config)}}class M_e extends un{static[lt]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}class T_e extends cA{static[lt]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new E_e(e,this.config)}}class E_e extends un{static[lt]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}function A_e(n,e){const{name:t,config:i}=Rs(n,e);return i.mode==="number"?new w_e(t):new T_e(t)}class C_e extends Bn{static[lt]="PgBigSerial53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new R_e(e,this.config)}}class R_e extends un{static[lt]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}class D_e extends Bn{static[lt]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new P_e(e,this.config)}}class P_e extends un{static[lt]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}function I_e(n,e){const{name:t,config:i}=Rs(n,e);return i.mode==="number"?new C_e(t):new D_e(t)}class O_e extends Bn{static[lt]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean")}build(e){return new N_e(e,this.config)}}class N_e extends un{static[lt]="PgBoolean";getSQLType(){return"boolean"}}function mN(n){return new O_e(n??"")}class k_e extends Bn{static[lt]="PgCharBuilder";constructor(e,t){super(e,"string","PgChar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new L_e(e,this.config)}}class L_e extends un{static[lt]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function U_e(n,e={}){const{name:t,config:i}=Rs(n,e);return new k_e(t,i)}class F_e extends Bn{static[lt]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr")}build(e){return new B_e(e,this.config)}}class B_e extends un{static[lt]="PgCidr";getSQLType(){return"cidr"}}function z_e(n){return new F_e(n??"")}class V_e extends Bn{static[lt]="PgCustomColumnBuilder";constructor(e,t,i){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new j_e(e,this.config)}}class j_e extends un{static[lt]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom=="function"?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo=="function"?this.mapTo(e):e}}function G_e(n){return(e,t)=>{const{name:i,config:r}=Rs(e,t);return new V_e(i,r,n)}}class y_ extends Bn{static[lt]="PgDateColumnBaseBuilder";defaultNow(){return this.default(ym`now()`)}}class H_e extends y_{static[lt]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new $_e(e,this.config)}}class $_e extends un{static[lt]="PgDate";getSQLType(){return"date"}mapFromDriverValue(e){return typeof e=="string"?new Date(e):e}mapToDriverValue(e){return e.toISOString()}}class W_e extends y_{static[lt]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new q_e(e,this.config)}}class q_e extends un{static[lt]="PgDateString";getSQLType(){return"date"}mapFromDriverValue(e){return typeof e=="string"?e:e.toISOString().slice(0,-14)}}function K_e(n,e){const{name:t,config:i}=Rs(n,e);return i?.mode==="date"?new H_e(t):new W_e(t)}class X_e extends Bn{static[lt]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new Y_e(e,this.config)}}class Y_e extends un{static[lt]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(e){return typeof e=="string"?Number.parseFloat(e):e}}function J_e(n){return new X_e(n??"")}class Z_e extends Bn{static[lt]="PgInetBuilder";constructor(e){super(e,"string","PgInet")}build(e){return new Q_e(e,this.config)}}class Q_e extends un{static[lt]="PgInet";getSQLType(){return"inet"}}function eSe(n){return new Z_e(n??"")}class tSe extends cA{static[lt]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger")}build(e){return new nSe(e,this.config)}}class nSe extends un{static[lt]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(e){return typeof e=="string"?Number.parseInt(e):e}}function gN(n){return new tSe(n??"")}class iSe extends Bn{static[lt]="PgIntervalBuilder";constructor(e,t){super(e,"string","PgInterval"),this.config.intervalConfig=t}build(e){return new rSe(e,this.config)}}class rSe extends un{static[lt]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){const e=this.fields?` ${this.fields}`:"",t=this.precision?`(${this.precision})`:"";return`interval${e}${t}`}}function sSe(n,e={}){const{name:t,config:i}=Rs(n,e);return new iSe(t,i)}class oSe extends Bn{static[lt]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new aSe(e,this.config)}}class aSe extends un{static[lt]="PgJson";constructor(e,t){super(e,t)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}function lSe(n){return new oSe(n??"")}class cSe extends Bn{static[lt]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new uSe(e,this.config)}}class uSe extends un{static[lt]="PgJsonb";constructor(e,t){super(e,t)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}function fSe(n){return new cSe(n??"")}class dSe extends Bn{static[lt]="PgLineBuilder";constructor(e){super(e,"array","PgLine")}build(e){return new hSe(e,this.config)}}class hSe extends un{static[lt]="PgLine";getSQLType(){return"line"}mapFromDriverValue(e){const[t,i,r]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i),Number.parseFloat(r)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}class pSe extends Bn{static[lt]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC")}build(e){return new mSe(e,this.config)}}class mSe extends un{static[lt]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(e){const[t,i,r]=e.slice(1,-1).split(",");return{a:Number.parseFloat(t),b:Number.parseFloat(i),c:Number.parseFloat(r)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}function gSe(n,e){const{name:t,config:i}=Rs(n,e);return!i?.mode||i.mode==="tuple"?new dSe(t):new pSe(t)}class ySe extends Bn{static[lt]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr")}build(e){return new vSe(e,this.config)}}class vSe extends un{static[lt]="PgMacaddr";getSQLType(){return"macaddr"}}function bSe(n){return new ySe(n??"")}class xSe extends Bn{static[lt]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8")}build(e){return new _Se(e,this.config)}}class _Se extends un{static[lt]="PgMacaddr8";getSQLType(){return"macaddr8"}}function SSe(n){return new xSe(n??"")}class wSe extends Bn{static[lt]="PgNumericBuilder";constructor(e,t,i){super(e,"string","PgNumeric"),this.config.precision=t,this.config.scale=i}build(e){return new MSe(e,this.config)}}class MSe extends un{static[lt]="PgNumeric";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return typeof e=="string"?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}class TSe extends Bn{static[lt]="PgNumericNumberBuilder";constructor(e,t,i){super(e,"number","PgNumericNumber"),this.config.precision=t,this.config.scale=i}build(e){return new ESe(e,this.config)}}class ESe extends un{static[lt]="PgNumericNumber";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}class ASe extends Bn{static[lt]="PgNumericBigIntBuilder";constructor(e,t,i){super(e,"bigint","PgNumericBigInt"),this.config.precision=t,this.config.scale=i}build(e){return new CSe(e,this.config)}}class CSe extends un{static[lt]="PgNumericBigInt";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}function RSe(n,e){const{name:t,config:i}=Rs(n,e),r=i?.mode;return r==="number"?new TSe(t,i?.precision,i?.scale):r==="bigint"?new ASe(t,i?.precision,i?.scale):new wSe(t,i?.precision,i?.scale)}class DSe extends Bn{static[lt]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple")}build(e){return new PSe(e,this.config)}}class PSe extends un{static[lt]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[t,i]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}class ISe extends Bn{static[lt]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject")}build(e){return new OSe(e,this.config)}}class OSe extends un{static[lt]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[t,i]=e.slice(1,-1).split(",");return{x:Number.parseFloat(t),y:Number.parseFloat(i)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}function NSe(n,e){const{name:t,config:i}=Rs(n,e);return!i?.mode||i.mode==="tuple"?new DSe(t):new ISe(t)}function kSe(n){const e=[];for(let t=0;t<n.length;t+=2)e.push(Number.parseInt(n.slice(t,t+2),16));return new Uint8Array(e)}function uz(n,e){const t=new ArrayBuffer(8),i=new DataView(t);for(let r=0;r<8;r++)i.setUint8(r,n[e+r]);return i.getFloat64(0,!0)}function V9(n){const e=kSe(n);let t=0;const i=e[t];t+=1;const r=new DataView(e.buffer),s=r.getUint32(t,i===1);if(t+=4,s&536870912&&(r.getUint32(t,i===1),t+=4),(s&65535)===1){const o=uz(e,t);t+=8;const a=uz(e,t);return t+=8,[o,a]}throw new Error("Unsupported geometry type")}class LSe extends Bn{static[lt]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry")}build(e){return new USe(e,this.config)}}class USe extends un{static[lt]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return V9(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}class FSe extends Bn{static[lt]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject")}build(e){return new BSe(e,this.config)}}class BSe extends un{static[lt]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){const t=V9(e);return{x:t[0],y:t[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}function zSe(n,e){const{name:t,config:i}=Rs(n,e);return!i?.mode||i.mode==="tuple"?new LSe(t):new FSe(t)}class VSe extends Bn{static[lt]="PgRealBuilder";constructor(e,t){super(e,"number","PgReal"),this.config.length=t}build(e){return new jSe(e,this.config)}}class jSe extends un{static[lt]="PgReal";constructor(e,t){super(e,t)}getSQLType(){return"real"}mapFromDriverValue=e=>typeof e=="string"?Number.parseFloat(e):e}function GSe(n){return new VSe(n??"")}class HSe extends Bn{static[lt]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new $Se(e,this.config)}}class $Se extends un{static[lt]="PgSerial";getSQLType(){return"serial"}}function WSe(n){return new HSe(n??"")}class qSe extends cA{static[lt]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt")}build(e){return new KSe(e,this.config)}}class KSe extends un{static[lt]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=e=>typeof e=="string"?Number(e):e}function XSe(n){return new qSe(n??"")}class YSe extends Bn{static[lt]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new JSe(e,this.config)}}class JSe extends un{static[lt]="PgSmallSerial";getSQLType(){return"smallserial"}}function ZSe(n){return new YSe(n??"")}class QSe extends Bn{static[lt]="PgTextBuilder";constructor(e,t){super(e,"string","PgText"),this.config.enumValues=t.enum}build(e){return new e1e(e,this.config)}}class e1e extends un{static[lt]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function t1e(n,e={}){const{name:t,config:i}=Rs(n,e);return new QSe(t,i)}class n1e extends y_{constructor(e,t,i){super(e,"string","PgTime"),this.withTimezone=t,this.precision=i,this.config.withTimezone=t,this.config.precision=i}static[lt]="PgTimeBuilder";build(e){return new i1e(e,this.config)}}class i1e extends un{static[lt]="PgTime";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function r1e(n,e={}){const{name:t,config:i}=Rs(n,e);return new n1e(t,i.withTimezone??!1,i.precision)}class s1e extends y_{static[lt]="PgTimestampBuilder";constructor(e,t,i){super(e,"date","PgTimestamp"),this.config.withTimezone=t,this.config.precision=i}build(e){return new o1e(e,this.config)}}class o1e extends un{static[lt]="PgTimestamp";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(e){return typeof e=="string"?new Date(this.withTimezone?e:e+"+0000"):e}mapToDriverValue=e=>e.toISOString()}class a1e extends y_{static[lt]="PgTimestampStringBuilder";constructor(e,t,i){super(e,"string","PgTimestampString"),this.config.withTimezone=t,this.config.precision=i}build(e){return new l1e(e,this.config)}}class l1e extends un{static[lt]="PgTimestampString";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(e){if(typeof e=="string")return e;const t=e.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone){const i=e.getTimezoneOffset(),r=i<=0?"+":"-";return`${t}${r}${Math.floor(Math.abs(i)/60).toString().padStart(2,"0")}`}return t}}function c1e(n,e={}){const{name:t,config:i}=Rs(n,e);return i?.mode==="string"?new a1e(t,i.withTimezone??!1,i.precision):new s1e(t,i?.withTimezone??!1,i?.precision)}class u1e extends Bn{static[lt]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(ym`gen_random_uuid()`)}build(e){return new f1e(e,this.config)}}class f1e extends un{static[lt]="PgUUID";getSQLType(){return"uuid"}}function Nl(n){return new u1e(n??"")}class d1e extends Bn{static[lt]="PgVarcharBuilder";constructor(e,t){super(e,"string","PgVarchar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new h1e(e,this.config)}}class h1e extends un{static[lt]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function va(n,e={}){const{name:t,config:i}=Rs(n,e);return new d1e(t,i)}class p1e extends Bn{static[lt]="PgBinaryVectorBuilder";constructor(e,t){super(e,"string","PgBinaryVector"),this.config.dimensions=t.dimensions}build(e){return new m1e(e,this.config)}}class m1e extends un{static[lt]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function g1e(n,e){const{name:t,config:i}=Rs(n,e);return new p1e(t,i)}class y1e extends Bn{static[lt]="PgHalfVectorBuilder";constructor(e,t){super(e,"array","PgHalfVector"),this.config.dimensions=t.dimensions}build(e){return new v1e(e,this.config)}}class v1e extends un{static[lt]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(t=>Number.parseFloat(t))}}function b1e(n,e){const{name:t,config:i}=Rs(n,e);return new y1e(t,i)}class x1e extends Bn{static[lt]="PgSparseVectorBuilder";constructor(e,t){super(e,"string","PgSparseVector"),this.config.dimensions=t.dimensions}build(e){return new _1e(e,this.config)}}class _1e extends un{static[lt]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function S1e(n,e){const{name:t,config:i}=Rs(n,e);return new x1e(t,i)}class w1e extends Bn{static[lt]="PgVectorBuilder";constructor(e,t){super(e,"array","PgVector"),this.config.dimensions=t.dimensions}build(e){return new M1e(e,this.config)}}class M1e extends un{static[lt]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(t=>Number.parseFloat(t))}}function T1e(n,e){const{name:t,config:i}=Rs(n,e);return new w1e(t,i)}function E1e(){return{bigint:A_e,bigserial:I_e,boolean:mN,char:U_e,cidr:z_e,customType:G_e,date:K_e,doublePrecision:J_e,inet:eSe,integer:gN,interval:sSe,json:lSe,jsonb:fSe,line:gSe,macaddr:bSe,macaddr8:SSe,numeric:RSe,point:NSe,geometry:zSe,real:GSe,serial:WSe,smallint:XSe,smallserial:ZSe,text:t1e,time:r1e,timestamp:c1e,uuid:Nl,varchar:va,bit:g1e,halfvec:b1e,sparsevec:S1e,vector:T1e}}const eP=Symbol.for("drizzle:PgInlineForeignKeys"),fz=Symbol.for("drizzle:EnableRLS");class Iw extends Ms{static[lt]="PgTable";static Symbol=Object.assign({},Ms.Symbol,{InlineForeignKeys:eP,EnableRLS:fz});[eP]=[];[fz]=!1;[Ms.Symbol.ExtraConfigBuilder]=void 0;[Ms.Symbol.ExtraConfigColumns]={}}function A1e(n,e,t,i,r=n){const s=new Iw(n,i,r),o=typeof e=="function"?e(E1e()):e,a=Object.fromEntries(Object.entries(o).map(([h,g])=>{const y=g;y.setName(h);const v=y.build(s);return s[eP].push(...y.buildForeignKeys(v,s)),[h,v]})),c=Object.fromEntries(Object.entries(o).map(([h,g])=>{const y=g;y.setName(h);const v=y.buildExtraConfigColumn(s);return[h,v]})),f=Object.assign(s,a);return f[Ms.Symbol.Columns]=a,f[Ms.Symbol.ExtraConfigColumns]=c,t&&(f[Iw.Symbol.ExtraConfigBuilder]=t),Object.assign(f,{enableRLS:()=>(f[Iw.Symbol.EnableRLS]=!0,f)})}const Bh=(n,e,t)=>A1e(n,e,t,void 0);function C1e(...n){return n[0].columns?new dz(n[0].columns,n[0].name):new dz(n)}class dz{static[lt]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new R1e(e,this.columns,this.name)}}class R1e{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static[lt]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[Iw.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}function D1e(n,e){return __e(e)&&!U9(n)&&!xr(n,xT)&&!xr(n,_T)&&!xr(n,aA)&&!xr(n,Ms)&&!xr(n,z9)?new xT(n,e):n}const P1e=(n,e)=>ym`${n} = ${D1e(e,n)}`;class j9{constructor(e,t){this.unique=e,this.name=t}static[lt]="PgIndexBuilderOn";on(...e){return new ZR(e.map(t=>{if(xr(t,ur))return t;t=t;const i=new KR(t.name,!!t.keyAsName,t.columnType,t.indexConfig);return t.indexConfig=JSON.parse(JSON.stringify(t.defaultConfig)),i}),this.unique,!1,this.name)}onOnly(...e){return new ZR(e.map(t=>{if(xr(t,ur))return t;t=t;const i=new KR(t.name,!!t.keyAsName,t.columnType,t.indexConfig);return t.indexConfig=t.defaultConfig,i}),this.unique,!0,this.name)}using(e,...t){return new ZR(t.map(i=>{if(xr(i,ur))return i;i=i;const r=new KR(i.name,!!i.keyAsName,i.columnType,i.indexConfig);return i.indexConfig=JSON.parse(JSON.stringify(i.defaultConfig)),r}),this.unique,!0,this.name,e)}}class ZR{static[lt]="PgIndexBuilder";config;constructor(e,t,i,r,s="btree"){this.config={name:r,columns:e,unique:t,only:i,method:s}}concurrently(){return this.config.concurrently=!0,this}with(e){return this.config.with=e,this}where(e){return this.config.where=e,this}build(e){return new I1e(this.config,e)}}class I1e{static[lt]="PgIndex";config;constructor(e,t){this.config={...e,table:t}}}function O1e(n){return new j9(!1,n)}function hz(n){return new j9(!0,n)}function Zf(){return va({length:24}).$type()}function pz(n){return ym`lower(${n})`}const v_=ym`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,N1e=lA("role",["admin","user"]),_0=Bh("users",{id:Nl().primaryKey().defaultRandom(),username:va({length:16}).$type().notNull(),emailOffered:va({length:254}).notNull(),emailVerified:va({length:254}),password:va({length:254}),createdAtIso:Zf().notNull().default(v_),createdIp:va({length:45}).notNull(),isActive:mN().notNull().default(!1),verifiedAtIso:Zf(),userRole:N1e().default("user")},n=>[hz("usernameUniqueIndex").on(pz(n.username)),hz("emailVerifiedUniqueIndex").on(pz(n.emailVerified))]),k1e=["username","emailOffered","emailVerified","password","userRole"];lA("trackedUserColumnName",k1e);const L1e=lA("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]);Bh("accountActions",{userId:Nl().references(()=>_0.id).primaryKey(),action:L1e().notNull(),code:va({length:254}).notNull(),wrongCodeCount:gN().notNull().default(0),expiresAtIso:Zf().notNull()});const U1e=Bh("games",{id:Nl().primaryKey().defaultRandom()});Bh("players",{userId:Nl().notNull().references(()=>_0.id,{onDelete:"cascade"}),gameId:Nl().notNull().references(()=>U1e.id,{onDelete:"cascade"}),score:gN().notNull()},n=>[C1e({name:"players_userId_gameId_pk",columns:[n.userId,n.gameId]})]);Bh("signInHistory",{id:Nl().primaryKey().defaultRandom(),userId:Nl().references(()=>_0.id,{onDelete:"cascade"}),signInTimeIso:Zf().notNull().default(v_),ipAddress:va({length:45}).notNull(),userAgent:va({length:1024}),successful:mN().notNull().default(!1)});const F1e=lA("twoFactorMethod",["email","phone"]);Bh("passwordResetAttempts",{id:Nl().primaryKey().defaultRandom(),userId:Nl().notNull().references(()=>_0.id,{onDelete:"cascade"}),requestedIp:va({length:45}).notNull(),requestedAtIso:Zf().notNull().default(v_),succeededIp:va({length:45}),succeededAtIso:Zf(),verificationMethod:F1e().notNull()});Bh("banishedIps",{ip:va({length:45}).primaryKey(),reason:va({length:2048}).notNull(),banishedAtIso:Zf().notNull().default(v_),banishedUntilIso:Zf()});Bh("userSessions",{sessionKey:Nl().notNull().primaryKey(),userId:Nl().notNull().references(()=>_0.id,{onDelete:"cascade"}),createdAtIso:Zf().notNull().default(v_)},n=>[O1e("userIdIndex").on(n.userId)]);const uA=Dh({key:"usernames",default:n=>n.slice(6,12),effects:n=>[({setSelf:e})=>{if(LI){const t=n.replace(/^user::/,"");mI(async()=>{const{db:i}=await import("@backend/db");return{db:i}},[]).then(({db:i})=>i.drizzle.query.users.findFirst({columns:{username:!0},where:P1e(_0.id,t)}).then(r=>{r&&e(r.username)}))}}]}),B1e={class:"_class_8npqa_1"};function z1e({fill:n="none",stroke:e="black",strokeWidth:t=1,strokeMiterlimit:i=10}){return j.jsxs("svg",{id:"uuid-55af1f58-4ded-4edb-a44d-2a28837a648d",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 142 142",children:[j.jsx("title",{children:"icon representing a tile"}),j.jsx("polygon",{points:"86.53 13.04 28.57 26.97 13.04 78.94 55.47 116.99 113.43 103.06 128.96 51.09 86.53 13.04",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("polygon",{points:"86.53 27.06 28.57 40.98 13.04 92.95 55.47 131 113.43 117.07 128.96 65.1 86.53 27.06",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"13.04",y1:"78.94",x2:"13.04",y2:"92.95",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"128.96",y1:"65.1",x2:"128.96",y2:"51.09",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}})]})}function V1e({fill:n="none",stroke:e="black",strokeWidth:t=1,strokeMiterlimit:i=10}){return j.jsxs("svg",{id:"uuid-d0d5f6c5-fe00-4880-9c8d-d1bebac5afc6",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 142 142",children:[j.jsx("title",{children:"icon representing a cube"}),j.jsx("polygon",{points:"106.74 37.53 18.72 34.44 18.72 119.48 106.74 122.57 106.74 37.53",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("polygon",{points:"122.88 19.92 39.58 16.97 39.58 98.05 122.88 101 122.88 19.92",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"18.72",y1:"34.44",x2:"39.58",y2:"16.97",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"106.74",y1:"122.57",x2:"122.88",y2:"101",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}})]})}function j1e(){const{myRoomKey:n}=wm(),e=wc(kl);return j.jsxs("main",{className:B1e.class,children:[e?j.jsx($1e,{myUserKey:e}):null,e&&n?j.jsx(H1e,{myUserKey:e}):j.jsx(G1e,{})]})}function G1e(){const{roomSocket:n,allRoomKeysAtom:e}=wm(),t=VT(e),i=t[0];return j.jsx("article",{"data-css":"room-exterior",children:j.jsx("button",{type:"button",disabled:i===void 0,onClick:()=>{n.emit("joinRoom",t[0])},children:i?"Join Game":"Waiting for host"})})}function H1e({myUserKey:n}){const e=wc(uN),t=bc(r0,n),i=bc(gT,n),r=Ru(Fh);return j.jsxs(j.Fragment,{children:[j.jsx(W1e,{}),r?j.jsx(nwe,{playerTurn:r}):null,e==="playing"?j.jsxs(j.Fragment,{children:[j.jsx(Y1e,{}),j.jsxs("article",{"data-css-counter":"tiles",children:[j.jsx(z1e,{stroke:"var(--fg)",strokeWidth:2}),j.jsx("span",{children:t})]}),j.jsxs("article",{"data-css-counter":"cubes",children:[j.jsx(V1e,{stroke:"var(--fg)",strokeWidth:2}),j.jsx("span",{children:i})]})]}):null]})}function $1e({myUserKey:n}){return bc(uA,n)==="jeremy"?j.jsx(q1e,{}):null}function W1e(){const{myMutualsAtom:n}=wm(),e=wc(uN);return j.jsx("article",{"data-css":"room-module",children:j.jsxs(La.main,{layout:!0,children:[j.jsx(Q1e,{isCurrentPhase:e==="setup"}),j.jsx(ewe,{isCurrentPhase:e==="playing",gameState:e,myMutualsAtom:n})]})})}const mz=fi({key:"showBugRangersDevtools",default:!1});function q1e(){const n=wc(mz),{myRoomKey:e}=wm();return j.jsxs(j.Fragment,{children:[j.jsxs("button",{type:"button","data-css":"devtools-toggle",onClick:()=>{It(mz,t=>!t)},children:[n?"hide":"show"," devtools"]}),n?j.jsxs("article",{"data-css":"devtools",children:[j.jsx("h1",{children:e??"null"}),j.jsx(J1e,{}),e?j.jsx(K1e,{}):null]}):null]})}function K1e(){const n=wc(uN),e=wc(A9),t=Ru(Fh);return j.jsxs(j.Fragment,{children:[j.jsx("span",{children:n==="setup"?"Setup":j.jsxs(j.Fragment,{children:[j.jsx(X1e,{userKey:t??"user::$_NONE_$"})," ","playing turn ",e]})}),j.jsx(Z1e,{})]})}function X1e({userKey:n}){const e=bc(uA,n);return j.jsx(j.Fragment,{children:e})}function Y1e(){const n=ln(kl),e=ln(Dm,n),{socket:t}=te.useContext(Sm),i=t,r=ln(Lxe),s=ln(hN),o=ln(Uxe),a=wc(Yi);return j.jsx("article",{"data-css":"turn-controls",children:e===null?Nxe.map((c,f)=>j.jsx("button",{"data-css-color-choice":!0,disabled:r.has(c)||!s,type:"button",style:{pointerEvents:"all",background:c},onClick:()=>{i.emit("chooseColor",c)},children:kxe[c]},f)):j.jsxs(j.Fragment,{children:[j.jsx("button",{type:"button",disabled:!s||a===null,onClick:()=>{It(Yi,null),i.emit("turnRestart")},children:"restart turn"}),j.jsx("button",{type:"button",disabled:!o||!s,onClick:()=>{It(Yi,null),i.emit("turnEnd")},children:"end turn"})]})})}function J1e(){const{roomSocket:n,allRoomKeysAtom:e,myRoomKey:t}=wm(),i=VT(e);return j.jsxs("section",{"data-css":"room-controls",children:[t?j.jsxs("button",{type:"button",onClick:()=>{n?.emit("leaveRoom")},children:["Leave ",t]}):j.jsx("button",{type:"button",onClick:()=>{i.length===0?n?.emit("createRoom","backend.worker.bug-rangers.bun"):n?.emit("joinRoom",i[0])},children:i.length===0?"Create room":`Join ${i[0]}`}),i.length===0?null:j.jsxs("button",{type:"button",onClick:()=>{n?.emit("deleteRoom",i[0])},children:["Delete ",i[0]]})]})}function Z1e(){const{socket:n}=te.useContext(Sm),e=n;return j.jsxs("section",{children:[j.jsx("button",{type:"button",onClick:()=>{e.emit("startGame")},children:"start game"}),j.jsx("button",{type:"button",onClick:()=>{n?.emit("RESET_GAME")},children:"reset game"})]})}function Q1e({isCurrentPhase:n}){const{socket:e}=te.useContext(Sm),t=e,i=Ru(Oxe);return j.jsxs(La.section,{layout:!0,"data-css":"setup","data-css-current":n||void 0,children:[j.jsx(Ow,{groupName:"Not Ready",dataCss:"not-ready",userKeys:i.notReady}),j.jsx(Ow,{groupName:"Does not Want First",dataCss:"ready-does-not-want-first",userKeys:i.readyDoesNotWantFirst,onClick:()=>{t?.emit("wantNotFirst")}}),j.jsx(Ow,{groupName:"Wants First",dataCss:"ready-wants-first",userKeys:i.readyWantsFirst,onClick:()=>{t?.emit("wantFirst")}})]})}function ewe({isCurrentPhase:n}){const e=yI(g_);return j.jsx(La.section,{layout:!0,"data-css":"playing","data-css-current":n||void 0,children:j.jsx(Ow,{groupName:"Turn Order",dataCss:"turn-order",userKeys:e})})}function Ow({groupName:n,dataCss:e,userKeys:t,onClick:i}){return j.jsxs("section",{"data-css":e,children:[j.jsx("button",{type:"button",onClick:i,disabled:!i}),j.jsx("header",{children:n}),j.jsx("main",{children:t.map(r=>j.jsx(twe,{userKey:r},r))})]})}function twe({userKey:n}){const e=ln(kl),{myRoomKey:t}=wm(),i=TJ(hV,t??"room::"),r=ln(i.userKeyOfRoom),s=bc(uA,n),o=bc(Dm,n)??"#555",a=ln(Fh);return j.jsxs(La.div,{layoutId:n,"data-css-user":!0,children:[n===e?n===r?j.jsx(joe,{color:o}):j.jsx(zoe,{color:o}):n===r?j.jsx(Goe,{color:o}):j.jsx(Voe,{color:o}),n===a?j.jsx(Hoe,{color:o}):null,j.jsx("span",{children:s.slice(0,3)})]})}function nwe({playerTurn:n}){const e=bc(uA,n),t=bc(Dm,n),i=ln(kl);return j.jsxs("article",{"data-css":"turn-banner",children:[j.jsx(QS,{mode:"wait",children:j.jsx(La.div,{initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["-1500%","2%","4%","1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","90vw","90vw","10vw"]},transition:{duration:3,times:[0,.1,.77,1],ease:["circOut","linear","easeIn"]}},n)}),j.jsx(QS,{mode:"wait",children:j.jsx(La.span,{"data-css":"top",style:{backgroundColor:t??"#555"},initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["-1500%","2%","4%","1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","20vw","100vw","10vw"]},transition:{duration:3,times:[0,.1,.7,1],ease:["circOut","linear","easeIn"]}},n)}),j.jsx(QS,{mode:"wait",children:j.jsx(La.span,{"data-css":"bottom",initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["1500%","4%","2%","-1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","20vw","100vw","10vw"]},transition:{duration:3,times:[0,.1,.7,1],ease:["circOut","linear","easeIn"]}},n)}),j.jsx(QS,{mode:"wait",children:j.jsx(La.h1,{style:{backgroundColor:t??"#555"},initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["-1500%","5%","10%","1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","80vw","80vw","10vw"]},transition:{duration:3,times:[0,.2,.75,1],ease:["circOut","linear","easeIn"]},children:n===i?"your turn":`${e}'s turn`},n)})]})}function iwe(){return j.jsxs(j.Fragment,{children:[j.jsx(Qxe,{}),j.jsx(j1e,{})]})}const G9=fi({key:"count",default:0}),rwe=DJ({key:"incrementTX",do:({set:n})=>{n(G9,e=>e+1)}});bZ({key:"countContinuity",config:n=>n.add(G9).add(rwe)});const swe=fi({key:"cpuCount",default:1,effects:[({setSelf:n})=>{LI&&mI(async()=>{const{cpus:e}=await Promise.resolve().then(()=>pwe);return{cpus:e}},void 0).then(({cpus:e})=>{n(e().length)})}]});function owe(){const n=wc(swe),e=VT(I3),{myRoomKey:t,myOwnedRoomsAtom:i,roomSocket:r}=wm(),s=ln(i);return j.jsxs("article",{"data-css":"server-control",children:[Array.from({length:n}).map((o,a)=>{const c=e[a],f=c&&c===t,h=s.has(c);return j.jsx(awe,{indexNumber:a,roomKey:c,roomSocket:r,ownsRoom:h,hasJoined:f},a)}),j.jsx("button",{type:"button",onClick:()=>{r.emit("createRoom","backend.worker.bug-rangers.bun")},children:"create room"})]})}function awe({indexNumber:n,roomKey:e,hasJoined:t,ownsRoom:i,roomSocket:r}){return j.jsxs("div",{"data-css":"",children:[j.jsxs("span",{children:["Core ",n,": ",e," ",j.jsx("input",{type:"checkbox",checked:i,disabled:!0}),j.jsx("input",{type:"checkbox",checked:t,disabled:!0})]}),e===void 0?null:t?j.jsx("button",{type:"button",onClick:()=>{r.emit("leaveRoom")},children:"leave"}):j.jsx("button",{type:"button",onClick:()=>{r.emit("joinRoom",e)},children:"join"}),e&&i?j.jsx("button",{type:"button",onClick:()=>{r.emit("deleteRoom",e)},children:"delete"}):null]})}function lwe({route:[,n]}){return j.jsx("article",{className:mce.class,children:n?j.jsx(uwe,{gameId:n}):j.jsx(cwe,{})})}function cwe(){return j.jsx("nav",{children:j.jsx(j8,{href:"/game/hexiom",children:j.jsx("h1",{children:"HEXIOM"})})})}PJ(yj[1].game[1]).map(([n])=>n);function uwe(n){switch(n.gameId){case"hexiom":return j.jsx(iwe,{});case"server_control":return j.jsx(owe,{})}}function fwe(){const n=ka(Hy),e=ka(bu),t=ka(Ff),i=ln(Hy),r=ln(bu),s=ln(Ff),o=`email-${te.useId()}`,a=`password-${te.useId()}`,c=`one-time-code-${te.useId()}`,[f,h]=te.useState(null),[g,y]=te.useState("email"),v=`form-${te.useId()}`;return te.useEffect(()=>{if(s.length===6){const _=document.getElementById(v);_ instanceof HTMLFormElement&&_.requestSubmit()}},[s]),j.jsx("form",{id:v,onSubmit:async _=>{_.preventDefault();const S=Cn(hu);try{switch(g){case"email":{const{nextStep:M,userKey:w}=await ga.declareAuthTarget.query({email:i});switch(It(hu,w),M){case"otc_login":case"otc_verify":{y("otc");break}case"password_login":{y("password");break}}break}case"otc":{if(!S){console.error("somehow userKey is null");return}const M=await ga.verifyAccountAction.mutate({oneTimeCode:s,userKey:S});It(wr,M),Pu.once("connect",()=>{cm("/game"),n(""),t("")});break}case"password":{const M=await ga.openSession.mutate({email:i,password:r});It(wr,M),Pu.once("connect",()=>{cm("/game"),n(""),e("")});break}}}catch(M){M instanceof Gy&&h(M.message)}},children:j.jsxs("main",{children:[f?j.jsx("aside",{children:f}):null,j.jsxs(La.label,{htmlFor:o,children:[j.jsx("span",{children:"Email"}),j.jsx("input",{id:o,type:"text",value:i,onChange:_=>{n(_.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?j.jsxs("label",{htmlFor:a,children:[j.jsx("span",{children:"Password"}),j.jsx("input",{id:a,type:"password",value:r,onChange:_=>{e(_.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?j.jsxs("label",{htmlFor:c,children:[j.jsx("span",{children:"One-time Code"}),j.jsx("input",{id:c,type:"number",inputMode:"numeric",enterKeyHint:"go",value:s,onChange:_=>{t(_.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,j.jsxs("footer",{children:[g==="password"?j.jsx("button",{type:"button",onClick:async()=>{const _=Cn(hu);if(!_)return new Error("No userKey");await ga.startPasswordReset.mutate({userKey:_}),y("otc")},children:"Forgot Password?"}):null,j.jsx("span",{}),j.jsx("button",{type:"submit",disabled:!i&&g==="email"||!r&&g==="password"||!s&&g==="otc",children:">>->"})]})]})})}function dwe({route:[,n]}){const e=ln(wr),t=ln(Ff),i=ka(Ff),r=`code-${te.useId()}`;return te.useEffect(()=>{n&&i(n)},[]),e?j.jsx("form",{onSubmit:async s=>{s.preventDefault();try{const o=await ga.verifyAccountAction.mutate({oneTimeCode:t,userKey:"CHANGEME"});It(wr,o),o.action==="resetPassword"?cm("/account"):cm("/game")}catch(o){console.error(o)}},children:j.jsxs("main",{children:[j.jsx("p",{children:"Check your email for a verification code."}),j.jsxs("label",{htmlFor:r,children:[j.jsx("span",{children:"Verification code"}),j.jsx("input",{id:r,type:"text",value:t,onChange:s=>{i(s.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})}):j.jsx("p",{children:"You must be logged in to verify your account."})}ET.STORE.loggers[0].logLevel="warn";function hwe(){const n=ln(cce),e=ln(wr),[t,i]=te.useState(!1),{refs:r,floatingStyles:s,context:o}=Ioe({open:t,onOpenChange:i,placement:"bottom-end",middleware:[ioe(5),soe(),roe()],whileElementsMounted:Xse}),a=Aoe(o),c=Doe(o),f=koe(o),{getReferenceProps:h,getFloatingProps:g}=Ooe([a,c,f]),y=ln(Jae);return j.jsxs("main",{className:$oe.class,children:[j.jsxs("header",{children:[j.jsxs("main",{children:[typeof n=="object"&&n[0]==="game"?null:j.jsx(Boe,{}),j.jsx("span",{children:j.jsx(Woe,{input:y})})]}),j.jsx("button",{"data-css":"profile",ref:r.setReference,...h(),children:e?.username?e.username.slice(0,3):""}),t&&e&&j.jsx(Toe,{context:o,modal:!1,children:j.jsxs("div",{"data-css":"profile-actions",ref:r.setFloating,style:s,...g(),children:[j.jsx("span",{children:e.username}),j.jsx("button",{type:"button",onClick:()=>{cm("/account")},children:"Account"}),j.jsx("button",{type:"button",onClick:async()=>{e&&(await ga.closeSession.mutate({username:e.username}),Pu.once("disconnect",()=>{It(wr,null),cm("/")}),Pu.disconnect())},children:"Sign out"})]})})]}),j.jsx("main",{children:typeof n=="number"?j.jsxs("article",{children:[j.jsx("h1",{children:n}),j.jsx("h2",{children:JSON.parse(V8[n])}),j.jsx(j8,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(n[0]){case void 0:return j.jsx(fwe,{});case"admin":return j.jsx(pce,{});case"game":return j.jsx(lwe,{route:n});case"verify":return j.jsx(dwe,{route:n});case"account":return j.jsx(hce,{})}})()})]})}DZ.createRoot(document.getElementById("root")).render(j.jsx(te.StrictMode,{children:j.jsxs(MZ,{socket:Pu,children:[j.jsx(hwe,{}),j.jsx(_J,{hideByDefault:UI.VITE_HIDE_DEVTOOLS})]})}));const pwe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));
|
|
4310
|
+
`))),{vertexShader:t,fragmentShader:i}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const cN=new td({color:16777215,side:mc,transparent:!0}),tz=8421504,nz=new nn,uw=new se,WR=new se,ab=[],wxe=new se,qR="+x+y";function iz(n){return Array.isArray(n)?n[0]:n}let v9=()=>{const n=new dr(new nd(1,1),cN);return v9=()=>n,n},b9=()=>{const n=new dr(new nd(1,1,32,1),cN);return b9=()=>n,n};const Mxe={type:"syncstart"},Txe={type:"synccomplete"},x9=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Exe=x9.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let _9=class extends dr{constructor(){const e=new yxe;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=tz,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=qR,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(Mxe),p9({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const i=this._queuedSyncs;i&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{i.forEach(r=>r&&r())})),this.dispatchEvent(Txe),e&&e()})))}onBeforeRender(e,t,i,r,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return Sxe(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=cN.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function i(){t.removeEventListener("dispose",i),e.dispose()})),this.hasOutline()){let i=e._outlineMtl;return i||(i=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),i.isTextOutlineMaterial=!0,i.depthWrite=!1,i.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),i.dispose()})),[i,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return iz(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return iz(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,i=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:a,blockBounds:c}=r;i.uTroikaSDFTexture.value=a,i.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),i.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,i.uTroikaSDFExponent.value=r.sdfExponent,i.uTroikaTotalBounds.value.fromArray(c),i.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let f=0,h=0,g=0,y,v,_,S=0,M=0;if(t){let{outlineWidth:A,outlineOffsetX:R,outlineOffsetY:P,outlineBlur:I,outlineOpacity:k}=this;f=this._parsePercent(A)||0,h=Math.max(0,this._parsePercent(I)||0),y=k,S=this._parsePercent(R)||0,M=this._parsePercent(P)||0}else g=Math.max(0,this._parsePercent(this.strokeWidth)||0),g&&(_=this.strokeColor,i.uTroikaStrokeColor.value.set(_??tz),v=this.strokeOpacity,v==null&&(v=1)),y=this.fillOpacity;i.uTroikaEdgeOffset.value=f,i.uTroikaPositionOffset.value.set(S,M),i.uTroikaBlurRadius.value=h,i.uTroikaStrokeWidth.value=g,i.uTroikaStrokeOpacity.value=v,i.uTroikaFillOpacity.value=y??1,i.uTroikaCurveRadius.value=this.curveRadius||0;let w=this.clipRect;if(w&&Array.isArray(w)&&w.length===4)i.uTroikaClipRect.value.fromArray(w);else{const A=(this.fontSize||.1)*100;i.uTroikaClipRect.value.set(c[0]-A,c[1]-A,c[2]+A,c[3]+A)}this.geometry.applyClipRect(i.uTroikaClipRect.value)}i.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ct;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||qR;if(o!==e._orientation){let a=i.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let c=o!==qR&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,f,h,g,y]=c;uw.set(0,0,0)[h]=f==="-"?1:-1,WR.set(0,0,0)[y]=g==="-"?-1:1,nz.lookAt(wxe,uw.cross(WR),WR),a.setFromMatrix4(nz)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),i=t?parseFloat(t[1]):NaN;e=(isNaN(i)?0:i/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new st){t.copy(e);const i=this.curveRadius;return i&&(t.x=Math.atan2(e.x,Math.abs(i)-Math.abs(e.z))*Math.abs(i)),t}worldPositionToTextCoords(e,t=new st){return uw.copy(e),this.localPositionToTextCoords(this.worldToLocal(uw),t)}raycast(e,t){const{textRenderInfo:i,curveRadius:r}=this;if(i){const s=i.blockBounds,o=r?b9():v9(),a=o.geometry,{position:c,uv:f}=a.attributes;for(let h=0;h<f.count;h++){let g=s[0]+f.getX(h)*(s[2]-s[0]);const y=s[1]+f.getY(h)*(s[3]-s[1]);let v=0;r&&(v=r-Math.cos(g/r)*r,g=Math.sin(g/r)*r),c.setXYZ(h,g,y,v)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,ab.length=0,o.raycast(e,ab);for(let h=0;h<ab.length;h++)ab[h].object=this,t.push(ab[h])}}copy(e){const t=this.geometry;return super.copy(e),this.geometry=t,Exe.forEach(i=>{this[i]=e[i]}),this}clone(){return new this.constructor().copy(this)}};x9.forEach(n=>{const e="_private_"+n;Object.defineProperty(_9.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new As;new Ct;const S9=te.forwardRef(({sdfGlyphSize:n=64,anchorX:e="center",anchorY:t="middle",font:i,fontSize:r=1,children:s,characters:o,onSync:a,...c},f)=>{const h=cc(({invalidate:_})=>_),[g]=te.useState(()=>new _9),[y,v]=te.useMemo(()=>{const _=[];let S="";return te.Children.forEach(s,M=>{typeof M=="string"||typeof M=="number"?S+=M:_.push(M)}),[_,S]},[s]);return f0e(()=>new Promise(_=>uxe({font:i,characters:o},_)),["troika-text",i,o]),te.useLayoutEffect(()=>{g.sync(()=>{h(),a&&a(g)})}),te.useEffect(()=>()=>g.dispose(),[g]),te.createElement("primitive",hT({object:g,ref:f,font:i,text:v,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:n},c),y)}),Axe=te.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:i,enableDamping:r=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:c,...f},h)=>{const g=cc(k=>k.invalidate),y=cc(k=>k.camera),v=cc(k=>k.gl),_=cc(k=>k.events),S=cc(k=>k.setEvents),M=cc(k=>k.set),w=cc(k=>k.get),A=cc(k=>k.performance),R=e||y,P=i||_.connected||v.domElement,I=te.useMemo(()=>new Pbe(R),[R]);return WO(()=>{I.enabled&&I.update()},-1),te.useEffect(()=>(s&&I.connect(s===!0?P:s),I.connect(P),()=>{I.dispose()}),[s,P,t,I,g]),te.useEffect(()=>{const k=N=>{g(),t&&A.regress(),o&&o(N)},L=N=>{a&&a(N)},F=N=>{c&&c(N)};return I.addEventListener("change",k),I.addEventListener("start",L),I.addEventListener("end",F),()=>{I.removeEventListener("start",L),I.removeEventListener("end",F),I.removeEventListener("change",k)}},[o,a,c,I,g,S]),te.useEffect(()=>{if(n){const k=w().controls;return M({controls:I}),()=>M({controls:k})}},[n,I]),te.createElement("primitive",hT({ref:h,object:I,enableDamping:r},f))}),Cxe=["set","truncate","extend","pop","push","shift","unshift","copyWithin","fill","splice","reverse","sort"],rz=B2(Cxe);class yy extends Array{mode="record";subject=new Oi;READONLY_VIEW=this;constructor(...e){return super(...e),new Proxy(this,{set:(t,i,r,s)=>{if(typeof i=="string"&&!Number.isNaN(Number.parseInt(i,10))){const o=Number(i);let a;return this.mode==="record"&&(a=t[o]),t[o]=r,a?this.emit({type:"set",index:o,next:r,prev:a}):this.mode==="record"&&this.emit({type:"set",index:o,next:r}),!0}if(i==="length"){if(this.mode==="record"){const o=t.length;if(o===r)return!0;if(o>r){const a=t.slice(r);t.length=r,this.emit({type:"truncate",length:r,items:a})}else t.length=r,this.emit({type:"extend",next:r,prev:o})}else t.length=r;return!0}return Reflect.set(t,i,r,s)}})}toJSON(){return[...this]}static fromJSON(e){return new yy(...e)}push(...e){let t;return this.mode==="record"?(this.mode="playback",t=super.push(...e),this.mode="record",this.emit({type:"push",items:e})):t=super.push(...e),t}pop(){let e;return this.mode==="record"?(this.mode="playback",e=super.pop(),e===void 0?this.emit({type:"pop"}):this.emit({type:"pop",value:e}),this.mode="record"):e=super.pop(),e}shift(){let e;return this.mode==="record"?(this.mode="playback",e=super.shift(),e===void 0?this.emit({type:"shift"}):this.emit({type:"shift",value:e}),this.mode="record"):e=super.shift(),e}unshift(...e){let t;return this.mode==="record"?(this.mode="playback",t=super.unshift(...e),this.emit({type:"unshift",items:e}),this.mode="record"):t=super.unshift(...e),t}reverse(){return super.reverse(),this.mode==="record"&&this.emit({type:"reverse"}),this}fill(e,t,i){if(this.mode==="record"){this.mode="playback";const r=this.slice(t,i);super.fill(e,t,i),t===void 0?this.emit({type:"fill",value:e,prev:r}):i===void 0?this.emit({type:"fill",value:e,start:t,prev:r}):this.emit({type:"fill",value:e,start:t,end:i,prev:r}),this.mode="record"}else super.fill(e,t,i);return this}sort(e){if(this.mode==="record"){this.mode="playback";const t=[...this];super.sort(e);const i=[...this];this.emit({type:"sort",next:i,prev:t}),this.mode="record"}return this}splice(...e){const[t,i,...r]=e,s=this.mode;s==="record"&&(this.mode="playback");const o=super.splice(...e);return s==="record"&&(this.mode="record"),i===void 0?this.emit({type:"splice",start:t,items:r,deleted:o,deleteCount:o.length}):this.emit({type:"splice",start:t,items:r,deleted:o,deleteCount:i}),o}copyWithin(e,t,i){const r=this.mode;let s;return r==="record"&&(s=this.slice(e),this.mode="playback"),super.copyWithin(e,t,i),r==="record"&&(this.mode="record"),s&&(i===void 0?this.emit({type:"copyWithin",prev:s,target:e,start:t}):this.emit({type:"copyWithin",prev:s,target:e,start:t,end:i})),this}subscribe(e,t){return this.subject.subscribe(e,t)}emit(e){this.subject.next(yy.packUpdate(e))}doStep(e){switch(e.type){case"copyWithin":this.copyWithin(e.target,e.start,e.end);break;case"extend":this.length=e.next;break;case"fill":this.fill(e.value,e.start,e.end);break;case"pop":this.pop();break;case"push":this.push(...e.items);break;case"reverse":this.reverse();break;case"shift":this.shift();break;case"sort":for(let i=0;i<e.next.length;i++)this[i]=e.next[i];this.length=e.next.length;break;case"splice":this.splice(e.start,e.deleteCount,...e.items);break;case"truncate":this.length=e.length;break;case"set":this[e.index]=e.next;break;case"unshift":this.unshift(...e.items);break}}do(e){this.mode="playback";const t=yy.unpackUpdate(e);return this.doStep(t),this.mode="record",null}undoStep(e){switch(e.type){case"copyWithin":for(let t=0;t<e.prev.length;t++)this[t+e.target]=e.prev[t];break;case"extend":this.length=e.prev;break;case"fill":{const t=e.start??0;for(let i=0;i<e.prev.length;i++)this[i+t]=e.prev[i]}break;case"pop":e.value&&this.push(e.value);break;case"push":{let t=e.items.length-1;for(;t>=0;)this.pop(),--t}break;case"reverse":this.reverse();break;case"shift":e.value&&this.unshift(e.value);break;case"sort":for(let t=0;t<e.prev.length;t++)this[t]=e.prev[t];this.length=e.prev.length;break;case"set":if(e.prev)this[e.index]=e.prev;else{delete this[e.index];const t=this.findIndex((i,r)=>!Object.hasOwn(this,r));t!==-1&&(this.length=t)}break;case"splice":this.splice(e.start,e.items.length,...e.deleted);break;case"truncate":this.push(...e.items);break;case"unshift":{let t=e.items.length-1;for(;t>=0;)this.shift(),--t}break}}undo(e){this.mode="playback";const t=yy.unpackUpdate(e);return this.undoStep(t),this.mode="record",null}static packUpdate(e){let t=rz[e.type]+"";switch(e.type){case"set":return t+=e.index+""+da(e.next),e.prev!==void 0&&(t+=""+da(e.prev)),t;case"truncate":return t+e.length+""+e.items.map(da).join("");case"extend":return t+e.next+""+e.prev;case"pop":case"shift":return e.value!==void 0&&(t+=da(e.value)),t;case"push":case"unshift":return t+e.items.map(da).join("");case"copyWithin":return t+=e.target+""+e.start,e.end!==void 0&&(t+=""+e.end),t+=""+e.prev.map(da).join(""),t;case"fill":return t+=da(e.value),e.start!==void 0&&(t+=""+e.start),e.end!==void 0&&(t+=""+e.end),t+=""+e.prev.map(da).join(""),t;case"splice":return t+e.start+""+e.deleteCount+""+e.items.map(da).join("")+""+e.deleted.map(da).join("");case"reverse":return t;case"sort":return t+e.next.map(da).join("")+""+e.prev.map(da).join("")}}static unpackUpdate(e){const[t,i]=e.split(""),r=rz[t];switch(r){case"set":{const[s,o,a]=i.split(""),c=+s,f=ha(o);if(a===void 0)return{type:r,index:c,next:f};const h=ha(a);return{type:r,index:c,next:f,prev:h}}case"truncate":{const[s,...o]=i.split(""),a=+s,c=o.map(ha);return{type:r,length:a,items:c}}case"extend":{const[s,o]=i.split(""),a=+s,c=+o;return{type:r,next:a,prev:c}}case"pop":case"shift":if(i!==""){const s=ha(i);return{type:r,value:s}}return{type:r};case"push":case"unshift":{const s=i.split("").map(ha);return{type:r,items:s}}case"copyWithin":{const[s,o]=i.split(""),a=o?o.split("").map(ha):[],[c,f,h]=s.split(""),g=+c,y=+f;if(h===void 0)return{type:r,target:g,start:y,prev:a};const v=+h;return{type:r,target:g,start:y,prev:a,end:v}}case"fill":{const[s,o]=i.split(""),a=o?o.split("").map(ha):[],[c,f,h]=s.split(""),g=ha(c);if(f===void 0&&h===void 0)return{type:r,value:g,prev:a};const y=+f;if(h===void 0)return{type:r,value:g,prev:a,start:y};const v=+h;return{type:r,value:g,prev:a,start:y,end:v}}case"splice":{const[s,o,a,c]=i.split(""),f=+s,h=+o,g=a?a.split("").map(ha):[],y=c?c.split("").map(ha):[];return{type:r,start:f,deleteCount:h,items:g,deleted:y}}case"reverse":return{type:r};case"sort":{const[s,o]=i.split(""),a=s?s.split("").map(ha):[],c=o?o.split("").map(ha):[];return{type:r,next:a,prev:c}}}}}const Py=fi({key:"dragState",default:null}),kx=fi({key:"dragPoint",default:null});function rA(n){return n.split("_").map(Number)}const Tc=QP({key:"gameTiles",class:nh}),sA=Ec({key:"tile3dPosition",get:n=>()=>{const[e,t,i]=rA(n),r=Math.sqrt(3),s=Math.PI/3,o=s*2,a=Math.sin(s),c=Math.cos(s),f=Math.sin(o),h=Math.cos(o),g=r*e,y=r*t,v=r*i,_=g*a,S=g*c,M=y*f,w=y*h,A=_+M,R=S+w+v;return new se(A,0,R)}}),pT=Ec({key:"adjacentZones",get:n=>()=>{const[e,t,i]=rA(n),r=new Set;return r.add(`${e+1}_${t-1}_${i}`),r.add(`${e+1}_${t}_${i-1}`),r.add(`${e-1}_${t+1}_${i}`),r.add(`${e-1}_${t}_${i+1}`),r.add(`${e+2}_${t-1}_${i-1}`),r.add(`${e-2}_${t+1}_${i+1}`),Array.from(r)}}),n0=Ec({key:"adjacentTiles",get:n=>({get:e})=>{const t=e(pT,n),i=e(Tc);return t.filter(r=>i.has(r))}}),w9=Gi({key:"playableZone",get:({get:n})=>{const e=n(Tc);if(e.size===0)return["0_0_0"];const t=new Set;for(const r of e){const s=n(pT,r);for(const o of s)t.add(o)}for(const r of e)t.delete(r);for(const r of t)n(n0,r).length>=5&&t.delete(r);const i=n(Yi);if(i?.type==="move"){t.delete(i.origin);const r=n(pT,i.origin);for(const s of r)n(n0,s).length===1&&t.delete(s)}return Array.from(t)}}),Rxe=Ec({key:"tileIsStructural",get:n=>({get:e})=>{const t=e(Tc),i=new Set(t);i.delete(n);const r=new Set,s=[];for(const o of i){s.push(o);break}for(;s.length>0;){const o=s.pop();r.add(o);const a=e(pT,o);for(const c of a)if(i.has(c)){if(r.has(c))continue;s.push(c)}}return r.size!==i.size}}),i0=Dh({key:"gameTilesStackHeight",default:1}),M9=Gi({key:"closestPlayableZone",get:({get:n})=>{const e=n(kx);if(!e)return null;let t=null,i=Number.POSITIVE_INFINITY;for(const r of n(w9)){const s=n(sA,r),o=e.distanceTo(s);o<i&&(i=o,t=r)}return t}}),T9=Ec({key:"ownedTiles",get:n=>({get:e,json:t})=>e(t(Tc)).filter(r=>e(ku,r)===n)}),Fa=Dh({key:"tileCubeCount",default:0}),ku=Dh({key:"tileOwner",default:null}),sz=Ec({key:"closestOwnedTile",get:n=>({get:e})=>{const t=e(T9,n);if(t.length===0)return null;const i=e(kx);if(!i)return null;let r=Number.POSITIVE_INFINITY,s=null;for(const o of t){const a=e(sA,o),c=i.distanceTo(a);c<r&&(r=c,s=o)}return s}}),Yi=fi({key:"turnInProgress",default:null}),mT=Gi({key:"validWarDeclarators",get:({get:n})=>{const e=[],t=n(Fh);if(t===null)return e;const i=n(Yi);if(i?.type==="arm")return e;if(i?.type==="war"&&i.attacker!==null)return e.push(i.attacker),e;const o=n(T9,t);for(const a of o)n(Fa,a)>=4&&e.push(a);return e}}),Dxe=Gi({key:"validWarTargets",get:({get:n})=>{const e=[],t=n(Fh),i=n(Yi);if(i?.type!=="war")return e;const r=i.attacker;if(!r)return e;const s=n(n0,r),o=new Set,a=[];for(const c of s)n(ku,c)===t&&a.push(c),e.push(c);for(;a.length>0;){const c=a.pop();o.add(c);const f=n(n0,c);for(const h of f)n(ku,h)===t&&!o.has(h)&&a.push(h)}return o.delete(r),e.push(...o),e}}),Pxe=Ec({key:"tileStatus",get:n=>({get:e})=>{const t=e(Yi);if(t?.type==="war"&&t.attacker===n)return"isInvader";if(e(mT).includes(n))return"mayInvade";if(e(Dxe).includes(n))return"mayBeInvaded";if(t?.type==="move"){if(t.origin===n)return"isMovingFromHere";if(t.target===n)return"isMovingToHere"}if(t!==null||e(mT).length>0)return null;const o=e(Fh);return o===null||e(r0,o)>0||e(ku,n)!==o||e(i0,n)!==1||e(n0,n).length>=5||e(Rxe,n)?null:"mayBeMoved"}}),E9=Ec({key:"maximumStackHeight",get:([n,e])=>({get:t})=>{const r=t(n0,n).filter(o=>t(ku,o)===e);let s=0;for(const o of r){const a=t(i0,o);if(a>=2)return 3;a>s&&(s=a)}return s+1}}),g_=QP({key:"playerTurnOrder",class:yy});Gi({key:"spectators",get:({get:n})=>{const e=n(g_),t=n(gI),i=[];if(!t)return i;const[r]=c0(_m),s=n(r,t);for(const o of s)e.includes(o)||i.push(o);return i}});const A9=fi({key:"turnNumber",default:0}),Fh=Gi({key:"playerTurn",get:({get:n})=>{const e=n(A9),t=n(g_);if(t.length===0)return null;const i=e%t.length;return t[i]}}),Ixe=Dh({key:"playerReadyStatus",default:"notReady"}),uN=fi({key:"gameState",default:"setup"}),Oxe=Gi({key:"setupGroups",get:({get:n})=>{const e=[],t=[],i=[],r=n(g_),s=n(gI);if(!s)return{notReady:e,readyDoesNotWantFirst:t,readyWantsFirst:i};const[o]=c0(_m),a=n(o,s);for(const c of a){const f=n(Ixe,c);if(!r.includes(c))switch(f){case"notReady":e.push(c);break;case"readyDoesNotWantFirst":t.push(c);break;case"readyWantsFirst":i.push(c);break}}return{notReady:e,readyDoesNotWantFirst:t,readyWantsFirst:i}}}),Nxe=["#f46","#f96","#fe0","#5a6","#5af","#a7e"],kxe={"#f46":"Red","#f96":"Orange","#fe0":"Yellow","#5a6":"Green","#5af":"Blue","#a7e":"Purple"},Dm=Dh({key:"playerColor",default:null}),Lxe=Gi({key:"colorsChosen",get:({get:n})=>{const e=new Set,t=n(g_);for(const i of t){const r=n(Dm,i);r&&e.add(r)}return e}}),Uxe=Gi({key:"turnCanBeEnded",get:({get:n})=>{const e=n(Yi);switch(e?.type){case"build":case void 0:case null:return!1;case"arm":return e.targets.length>0;case"move":return e.target!==null;case"war":{const t=n(Tc);for(const i of t)if(n(Fa,i)===0)return!1;return e.targets.length>0}}}});function Fxe(n,e,t,i,r){let s,o;if(n===e)s=-1,o=1;else{const h=Cn(i0,i.attacker);s=-1-(i.targets.includes(r)?0:t>h?t-h:0),o=-1}if(Cn(Fa,i.attacker)+s<=0)return;if(It(Yi,{...i,targets:[...i.targets,r]}),It(Fa,r,h=>h+o),It(Fa,i.attacker,h=>h+s),Cn(Fa,r)===0){const h=Cn(ku,r);h!==null&&(i.originalOwners[r]=h),It(ku,r,n)}}const r0=Dh({key:"playerRemainingTiles",default:12}),gT=Dh({key:"playerRemainingCubes",default:20});function oA(){const{socket:n}=PT.useContext(Sm);return n}const fN=fi({key:"cameraTarget",default:[0,0,0]}),dN=fi({key:"controlsEnabled",default:!0}),C9=fi({key:"cameraAnchoredSphere",default:null}),hN=Gi({key:"isMyTurn",get:({get:n})=>{const e=n(Fh),t=n(kl);return e===t}}),R9=Gi({key:"iAmReadyToPlay",get:({get:n})=>{const e=n(kl);return e===null||n(Dm,e)===null?!1:n(hN)}}),Bxe=Gi({key:"playableZonesVisible",get:({get:n})=>{if(!n(R9))return!1;const t=n(Yi);switch(t?.type){case"arm":case"build":case"war":return!1;case"move":if(t.target===null)return"toMove";break;case null:case void 0:{const i=n(kl);if(i===null||n(mT).length>0)return!1;if(n(r0,i)>0)return"toBuild"}}return!1}}),zxe=Gi({key:"playerToolsVisible",get:({get:n})=>n(R9)?n(mT).length<=0:!1}),Vxe=Gi({key:"mayPlaceTile",get:({get:n})=>{const e=n(kl);if(e===null||n(r0,e)<=0)return!1;const i=n(Yi);switch(i?.type){case void 0:return!0;case"arm":case"move":case"war":return!1;case"build":{const{count:r}=i,s=n(E9,[i.target,e]);return r<s}}}}),jxe=Gi({key:"mayPlaceCube",get:({get:n})=>{const e=n(kl);if(e===null||n(gT,e)<=0)return!1;const i=n(Yi);switch(i?.type){case"move":case"war":return!1;case void 0:{const r=n(Tc);for(const s of r)if(n(ku,s)===e)return!0;return!1}case"arm":{const{targets:r}=i;return r.length<2}case"build":{const{count:r}=i;return r>=1}}}});function Gxe({size:n=10,radius:e=1,color:t="#808080",opacity:i=.75,y:r=0,dashed:s=!1}){const o=te.useRef(null),{geometry:a,dashSize:c,gapSize:f}=te.useMemo(()=>{const g=[0,60,120,180,240,300].map(k=>k*Math.PI/180),y=k=>Math.cos(k),v=k=>Math.sin(k),_=(k,L)=>{const F=e*(1.5*k),N=e*(Math.sqrt(3)*(L+k/2));return new st(F,N)},S=Math.ceil(n*2/(1.5*e)),M=Math.ceil(n*2/(Math.sqrt(3)*e)),w=g.map(k=>new se(e*y(k),0,e*v(k))),A=[];for(let k=-S;k<=S;k++)for(let L=-M;L<=M;L++){const F=_(k,L);if(!(Math.abs(F.x)>n+e||Math.abs(F.y)>n+e))for(let N=0;N<6;N++){const U=w[N],$=w[(N+1)%6];A.push(U.x+F.x,0,U.z+F.y),A.push($.x+F.x,0,$.z+F.y)}}const R=new cn;R.setAttribute("position",new Ut(A,3)),R.computeBoundingSphere();const P=e*.6,I=e*.6;return{geometry:R,dashSize:P,gapSize:I}},[n,e]),h=te.useMemo(()=>s?new nT({color:t,transparent:i<1,opacity:i,dashSize:c,gapSize:f}):new go({color:t,transparent:i<1,opacity:i}),[t,i,s]);return te.useLayoutEffect(()=>{if(o.current&&o.current.material instanceof nT){const g=o.current.geometry,y=g.getAttribute("position"),v=new Float32Array(y.count);for(let _=0;_<y.count;_+=2){const S=y.getX(_),M=y.getY(_),w=y.getZ(_),A=y.getX(_+1),R=y.getY(_+1),P=y.getZ(_+1),I=Math.hypot(A-S,R-M,P-w);v[_]=0,v[_+1]=I}g.setAttribute("lineDistance",new hi(v,1)),o.current.material.needsUpdate=!0}},[]),j.jsx("group",{"position-y":r,"rotation-x":-Math.PI*0,children:j.jsx("lineSegments",{ref:o,geometry:a,position:[0,r+1e-4,0],rotation:[0,0,0],material:h})})}function Hxe({position:[n,e,t],count:i,ownerKey:r}){const s=[];for(;i>0;)i>=4?(s.push(4),i-=4):(s.push(i),i=0);return j.jsx(j.Fragment,{children:s.map((o,a)=>j.jsx($xe,{position:new se(n,e+a*.5,t),count:o,rotation:new po(0,a*Math.PI/3,0),ownerKey:r},a))})}function $xe({position:n,rotation:e,count:t,ownerKey:i}){const r=t*.1+.1,s=ln(Dm,i)??"#555";return j.jsx("group",{position:n,rotation:e,children:t===1?j.jsx(ZD,{color:s,position:new se(0,0,0),rotation:new po(0,0,0)}):Array.from({length:t}).map((o,a)=>{const c=a/t*Math.PI*2,f=Math.cos(c)*r,h=Math.sin(c)*r,g=new po(0,Math.PI*3/2-c,0);return j.jsx(ZD,{color:s,position:new se(f,0,h),rotation:g},a)})})}function ZD(n){return j.jsxs("mesh",{...n,receiveShadow:!0,children:[j.jsx("boxGeometry",{args:[.5,.5,.5]}),j.jsx("meshStandardMaterial",{color:n.color??"hotpink"})]})}function Bb({ref:n,radius:e=1,height:t=.3,position3d:i=new se(0,0,0),color:r="#ee5",virtual:s=!1,onClick:o,onPointerDown:a,onPointerUp:c}){const[f,h]=te.useState(!1),g=te.useMemo(()=>{const v=new ph;for(let _=0;_<6;_++){const S=Math.PI/180*(60*_),M=e*Math.cos(S),w=e*Math.sin(S);_===0?v.moveTo(M,w):v.lineTo(M,w)}return v.closePath(),v},[e]),y=te.useMemo(()=>new a_(g,{depth:s?t-.1:t,bevelEnabled:!1}),[g,t]);return j.jsx("mesh",{ref:n,geometry:y,position:i,rotation:[-Math.PI/2,0,0],castShadow:!0,receiveShadow:!0,onClick:()=>{o?.(i)},onPointerOver:()=>{h(!0)},onPointerOut:()=>{h(!1)},onPointerDown:()=>{a?.(i)},onPointerUp:()=>{c?.(i)},children:j.jsx("meshStandardMaterial",{color:r,transparent:s,opacity:s?f?.5:.2:1})})}function Wxe({coordinatesSerialized:n}){const e=oA(),t=rA(n),[i,r,s]=t,o=Cn(sA,n),[a,c,f]=o,g=ln(M9)===n;return i+r+s!==0?(console.error("GameTile: bad coordinates did not add to zero",t),null):j.jsxs(j.Fragment,{children:[j.jsx(S9,{position:[a,.2+.7,f],fontSize:.25,color:"white",children:n}),j.jsx(Bb,{virtual:!0,position3d:o,color:g?"#f00":"#0ff",onClick:v=>{It(fN,v.toArray());const _=Cn(Yi);if(_?.type==="move"){const{origin:S}=_,M=n;It(Yi,{..._,target:M});const w=Cn(Fa,S);It(Fa,M,w),It(Fa,S,0),It(Tc,A=>(A.delete(S),A.add(M),A)),e.emit("finishMove",M)}else It(Tc,S=>(S.add(n),S)),e.emit("placeTile",n)}})]})}function qxe({coordinatesSerialized:n}){const e=oA(),t=rA(n),[i,r,s]=t,o=bc(i0,n),a=bc(Fa,n),c=bc(ku,n),f=Ru(Fh),h=Ru(hN),g=Cn(sA,n),[y,v,_]=g,S=wc(Yi),M=TZ(Pxe,n);let w;switch(M){case null:w="#aa5";break;case"mayBeInvaded":case"isMovingToHere":w="#664";break;case"isInvader":case"isMovingFromHere":w="#ee1";break;case"mayInvade":case"mayBeMoved":w="#cc3";break}if(i+r+s!==0)return console.error("GameTile: bad coordinates did not add to zero",t),null;const A=o*.33;return j.jsxs(j.Fragment,{children:[j.jsx(S9,{position:[y,A+.7,_],fontSize:.25,color:"white",children:n}),c!==null&&a>0?j.jsx(Hxe,{position:new se(y,A+.25,_),count:a,ownerKey:c}):null,j.jsx(Bb,{position3d:g,color:w,onClick:R=>{It(fN,R.toArray()),h&&M==="mayInvade"&&(It(Yi,{type:"war",attacker:n,targets:[],originalOwners:{}}),e.emit("chooseAttacker",n)),h&&M==="mayBeInvaded"&&S?.type==="war"&&S.attacker!==null&&(Fxe(f,c,o,S,n),e.emit("chooseTarget",n)),h&&M==="mayBeMoved"&&(It(Yi,{type:"move",origin:n,target:null}),e.emit("startMove",n))},virtual:!1}),o>1?j.jsx(Bb,{position3d:new se(y,.33,_),color:w}):null,o>2?j.jsx(Bb,{position3d:new se(y,.66,_),color:w}):null]})}function Kxe(){const n=wc(kl),e=Ru(Vxe),t=Ru(jxe);return n?j.jsxs(j.Fragment,{children:[e?j.jsx(Xxe,{myUserKey:n}):null,t?j.jsx(Yxe,{myUserKey:n}):null]}):null}const fh=new se,Iy=new se,D9=new se(0,1,0),yT=new se,P9=new gu(new se(0,1,0),0),I9=10,O9=-2,Jp=new se;function Xxe({myUserKey:n}){const e=lV(C9,te.useRef),{camera:t,raycaster:i,pointer:r}=cc(),s=ka(dN),o=ln(Py),a=oA(),c=()=>{s(!1),It(Py,"tile")},f=()=>{s(!0),It(Py,null);const h=Cn(Yi);switch(h?.type){case"arm":case"war":case"move":break;case null:case void 0:{const g=Cn(M9);g&&(It(Tc,y=>(y.add(g),y)),It(r0,n,y=>y-1),It(Yi,{type:"build",target:g,count:1}),a.emit("placeTile",g))}break;case"build":{const g=Cn(E9,[h.target,n]);if(g===0)return;const y=Cn(i0,h.target);if(y>=g)return;It(i0,h.target,y+1),It(r0,n,v=>v-1),It(Yi,{type:"build",target:h.target,count:h.count+1}),a.emit("placeTile",h.target)}break}It(kx,null)};return WO(()=>{if(e.current)switch(o){case"tile":if(i.setFromCamera(r,t),i.ray.intersectPlane(P9,Jp)){const h=new se(Jp.x,Jp.y+.001,Jp.z);It(kx,h),e.current.position.copy(h)}break;case null:case"cube":t.getWorldDirection(fh),Iy.copy(fh).cross(D9).normalize(),yT.copy(Iy).cross(fh).normalize(),e.current.position.copy(t.position.clone().add(fh.multiplyScalar(I9)).add(Iy.multiplyScalar(O9)).add(yT.multiplyScalar(-1)))}}),j.jsx(Bb,{ref:e,onPointerDown:c,onPointerUp:f})}function Yxe({myUserKey:n}){const e=lV(C9,te.useRef),{camera:t,raycaster:i,pointer:r}=cc(),s=ka(dN),o=ln(Py),a=ln(Dm,n),c=oA(),f=()=>{s(!1),It(Py,"cube")},h=()=>{s(!0),It(Py,null);const g=Cn(Yi);switch(g?.type){case"move":case"war":break;case null:case void 0:{const y=Cn(sz,n);y&&(It(Yi,{type:"arm",targets:[y]}),It(Fa,y,v=>v+1),c.emit("placeCube",y))}break;case"arm":{if(g.targets.length>=2)return;const y=Cn(sz,n);y&&(It(Fa,y,v=>v+1),It(gT,n,v=>v-1),It(Yi,{type:"arm",targets:[g.targets[0],y]}),c.emit("placeCube",y))}break;case"build":It(Fa,g.target,y=>y+1),It(gT,n,y=>y-1),It(ku,g.target,n),It(Yi,null),c.emit("placeCube",g.target);break}};return WO(()=>{if(e.current)switch(o){case"cube":i.setFromCamera(r,t),i.ray.intersectPlane(P9,Jp)&&(It(kx,Jp),e.current.position.copy(Jp));break;case null:case"tile":t.getWorldDirection(fh),Iy.copy(fh).cross(D9).normalize(),yT.copy(Iy).cross(fh).normalize(),e.current.position.copy(t.position.clone().add(fh.multiplyScalar(I9)).add(Iy.multiplyScalar(-O9)).add(yT.multiplyScalar(-1)))}}),j.jsx(ZD,{ref:e,onPointerDown:f,onPointerUp:h,color:a??"#555"})}function Jxe(){return yI(Tc),VT(Tc).map(e=>j.jsx(qxe,{coordinatesSerialized:e},e))}function Zxe(){return Ru(w9).map(e=>j.jsx(Wxe,{coordinatesSerialized:e},e))}function Qxe(){const n=ln(fN);return c9({animatedCam:n,config:{mass:1,tension:170,friction:26}}),j.jsxs(hve,{camera:{position:[15,15,15],fov:50},style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh"},children:[j.jsx("ambientLight",{intensity:.5}),j.jsx("directionalLight",{position:[5,10,5]}),j.jsx(n_e,{target:[...n]}),j.jsx(Gxe,{size:20,radius:1,color:"#6f6f6f",opacity:.5}),j.jsx(e_e,{})]})}function e_e(){return ln(gI)?j.jsx(t_e,{}):null}function t_e(){const n=Ru(Bxe),e=Ru(zxe);return j.jsxs(j.Fragment,{children:[j.jsx(Jxe,{}),n?j.jsx(Zxe,{}):null,e?j.jsx(Kxe,{}):null]})}function n_e({target:n}){const e=te.useRef(null),t=ln(dN);return c9({animatedTarget:n,config:{mass:1,tension:170,friction:26},onChange:({value:i})=>{e.current?.target.lerp(new se(...i.animatedTarget),.2),e.current?.update()}}),j.jsx(Axe,{ref:e,enableDamping:!0,dampingFactor:.05,enabled:t})}const lt=Symbol.for("drizzle:entityKind");function xr(n,e){if(!n||typeof n!="object")return!1;if(n instanceof e)return!0;if(!Object.prototype.hasOwnProperty.call(e,lt))throw new Error(`Class "${e.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let t=Object.getPrototypeOf(n).constructor;if(t)for(;t;){if(lt in t&&t[lt]===e[lt])return!0;t=Object.getPrototypeOf(t)}return!1}class aA{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[lt]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}class i_e{static[lt]="ColumnBuilder";config;constructor(e,t,i){this.config={name:e,keyAsName:e==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===""&&(this.config.name=e)}}const Oy=Symbol.for("drizzle:Name");class r_e{static[lt]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{const{name:i,columns:r,foreignColumns:s}=e();return{name:i,columns:r,foreignTable:s[0].table,foreignColumns:s}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new s_e(e,this)}}class s_e{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[lt]="PgForeignKey";reference;onUpdate;onDelete;getName(){const{name:e,columns:t,foreignColumns:i}=this.reference(),r=t.map(a=>a.name),s=i.map(a=>a.name),o=[this.table[Oy],...r,i[0].table[Oy],...s];return e??`${o.join("_")}_fk`}}function o_e(n,...e){return n(...e)}function a_e(n,e){return`${n[Oy]}_${e.join("_")}_unique`}function oz(n,e,t){for(let i=e;i<n.length;i++){const r=n[i];if(r==="\\"){i++;continue}if(r==='"')return[n.slice(e,i).replace(/\\/g,""),i+1];if(!t&&(r===","||r==="}"))return[n.slice(e,i).replace(/\\/g,""),i]}return[n.slice(e).replace(/\\/g,""),n.length]}function N9(n,e=0){const t=[];let i=e,r=!1;for(;i<n.length;){const s=n[i];if(s===","){(r||i===e)&&t.push(""),r=!0,i++;continue}if(r=!1,s==="\\"){i+=2;continue}if(s==='"'){const[c,f]=oz(n,i+1,!0);t.push(c),i=f;continue}if(s==="}")return[t,i+1];if(s==="{"){const[c,f]=N9(n,i+1);t.push(c),i=f;continue}const[o,a]=oz(n,i,!1);t.push(o),i=a}return[t,i]}function l_e(n){const[e]=N9(n,1);return e}function k9(n){return`{${n.map(e=>Array.isArray(e)?k9(e):typeof e=="string"?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${e}`).join(",")}}`}class Bn extends i_e{foreignKeyConfigs=[];static[lt]="PgColumnBuilder";array(e){return new u_e(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:r})=>o_e((s,o)=>{const a=new r_e(()=>{const c=s();return{columns:[e],foreignColumns:[c]}});return o.onUpdate&&a.onUpdate(o.onUpdate),o.onDelete&&a.onDelete(o.onDelete),a.build(t)},i,r))}buildExtraConfigColumn(e){return new c_e(e,this.config)}}class un extends aA{constructor(e,t){t.uniqueName||(t.uniqueName=a_e(e,[t.name])),super(e,t),this.table=e}static[lt]="PgColumn"}class c_e extends un{static[lt]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class KR{static[lt]="IndexedColumn";constructor(e,t,i,r){this.name=e,this.keyAsName=t,this.type=i,this.indexConfig=r}name;keyAsName;type;indexConfig}class u_e extends Bn{static[lt]="PgArrayBuilder";constructor(e,t,i){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=i}build(e){const t=this.config.baseBuilder.build(e);return new pN(e,this.config,t)}}class pN extends un{constructor(e,t,i,r){super(e,t),this.baseColumn=i,this.range=r,this.size=t.size}size;static[lt]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(e){return typeof e=="string"&&(e=l_e(e)),e.map(t=>this.baseColumn.mapFromDriverValue(t))}mapToDriverValue(e,t=!1){const i=e.map(r=>r===null?null:xr(this.baseColumn,pN)?this.baseColumn.mapToDriverValue(r,!0):this.baseColumn.mapToDriverValue(r));return t?i:k9(i)}}class f_e extends Bn{static[lt]="PgEnumObjectColumnBuilder";constructor(e,t){super(e,"string","PgEnumObjectColumn"),this.config.enum=t}build(e){return new d_e(e,this.config)}}class d_e extends un{static[lt]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}const vT=Symbol.for("drizzle:isPgEnum");function h_e(n){return!!n&&typeof n=="function"&&vT in n&&n[vT]===!0}class p_e extends Bn{static[lt]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new m_e(e,this.config)}}class m_e extends un{static[lt]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}function lA(n,e){return Array.isArray(e)?g_e(n,[...e],void 0):y_e(n,e,void 0)}function g_e(n,e,t){const i=Object.assign(r=>new p_e(r??"",i),{enumName:n,enumValues:e,schema:t,[vT]:!0});return i}function y_e(n,e,t){const i=Object.assign(r=>new f_e(r??"",i),{enumName:n,enumValues:Object.values(e),schema:t,[vT]:!0});return i}class L9{static[lt]="Subquery";constructor(e,t,i,r=!1,s=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:r,usedTables:s}}}const v_e={startActiveSpan(n,e){return e()}},zb=Symbol.for("drizzle:ViewBaseConfig"),XR=Symbol.for("drizzle:Schema"),az=Symbol.for("drizzle:Columns"),lz=Symbol.for("drizzle:ExtraConfigColumns"),YR=Symbol.for("drizzle:OriginalName"),JR=Symbol.for("drizzle:BaseName"),bT=Symbol.for("drizzle:IsAlias"),cz=Symbol.for("drizzle:ExtraConfigBuilder"),b_e=Symbol.for("drizzle:IsDrizzleTable");class Ms{static[lt]="Table";static Symbol={Name:Oy,Schema:XR,OriginalName:YR,Columns:az,ExtraConfigColumns:lz,BaseName:JR,IsAlias:bT,ExtraConfigBuilder:cz};[Oy];[YR];[XR];[az];[lz];[JR];[bT]=!1;[b_e]=!0;[cz]=void 0;constructor(e,t,i){this[Oy]=this[YR]=e,this[XR]=t,this[JR]=i}}function U9(n){return n!=null&&typeof n.getSQL=="function"}function x_e(n){const e={sql:"",params:[]};for(const t of n)e.sql+=t.sql,e.params.push(...t.params),t.typings?.length&&(e.typings||(e.typings=[]),e.typings.push(...t.typings));return e}class uc{static[lt]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new ur([this])}}class ur{constructor(e){this.queryChunks=e;for(const t of e)if(xr(t,Ms)){const i=t[Ms.Symbol.Schema];this.usedTables.push(i===void 0?t[Ms.Symbol.Name]:i+"."+t[Ms.Symbol.Name])}}static[lt]="SQL";decoder=F9;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return v_e.startActiveSpan("drizzle.buildSQL",t=>{const i=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(e,t){const i=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:r,escapeName:s,escapeParam:o,prepareTyping:a,inlineParams:c,paramStartIndex:f}=i;return x_e(e.map(h=>{if(xr(h,uc))return{sql:h.value.join(""),params:[]};if(xr(h,QD))return{sql:s(h.value),params:[]};if(h===void 0)return{sql:"",params:[]};if(Array.isArray(h)){const g=[new uc("(")];for(const[y,v]of h.entries())g.push(v),y<h.length-1&&g.push(new uc(", "));return g.push(new uc(")")),this.buildQueryFromSourceParams(g,i)}if(xr(h,ur))return this.buildQueryFromSourceParams(h.queryChunks,{...i,inlineParams:c||h.shouldInlineParams});if(xr(h,Ms)){const g=h[Ms.Symbol.Schema],y=h[Ms.Symbol.Name];return{sql:g===void 0||h[bT]?s(y):s(g)+"."+s(y),params:[]}}if(xr(h,aA)){const g=r.getColumnCasing(h);if(t.invokeSource==="indexes")return{sql:s(g),params:[]};const y=h.table[Ms.Symbol.Schema];return{sql:h.table[bT]||y===void 0?s(h.table[Ms.Symbol.Name])+"."+s(g):s(y)+"."+s(h.table[Ms.Symbol.Name])+"."+s(g),params:[]}}if(xr(h,z9)){const g=h[zb].schema,y=h[zb].name;return{sql:g===void 0||h[zb].isAlias?s(y):s(g)+"."+s(y),params:[]}}if(xr(h,xT)){if(xr(h.value,_T))return{sql:o(f.value++,h),params:[h],typings:["none"]};const g=h.value===null?null:h.encoder.mapToDriverValue(h.value);if(xr(g,ur))return this.buildQueryFromSourceParams([g],i);if(c)return{sql:this.mapInlineParam(g,i),params:[]};let y=["none"];return a&&(y=[a(h.encoder)]),{sql:o(f.value++,g),params:[g],typings:y}}return xr(h,_T)?{sql:o(f.value++,h),params:[h],typings:["none"]}:xr(h,ur.Aliased)&&h.fieldAlias!==void 0?{sql:s(h.fieldAlias),params:[]}:xr(h,L9)?h._.isWith?{sql:s(h._.alias),params:[]}:this.buildQueryFromSourceParams([new uc("("),h._.sql,new uc(") "),new QD(h._.alias)],i):h_e(h)?h.schema?{sql:s(h.schema)+"."+s(h.enumName),params:[]}:{sql:s(h.enumName),params:[]}:U9(h)?h.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([h.getSQL()],i):this.buildQueryFromSourceParams([new uc("("),h.getSQL(),new uc(")")],i):c?{sql:this.mapInlineParam(h,i),params:[]}:{sql:o(f.value++,h),params:[h],typings:["none"]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="string")return t(e);if(typeof e=="object"){const i=e.toString();return t(i==="[object Object]"?JSON.stringify(e):i)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return e===void 0?this:new ur.Aliased(this,e)}mapWith(e){return this.decoder=typeof e=="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class QD{constructor(e){this.value=e}static[lt]="Name";brand;getSQL(){return new ur([this])}}function __e(n){return typeof n=="object"&&n!==null&&"mapToDriverValue"in n&&typeof n.mapToDriverValue=="function"}const F9={mapFromDriverValue:n=>n},B9={mapToDriverValue:n=>n};({...F9,...B9});class xT{constructor(e,t=B9){this.value=e,this.encoder=t}static[lt]="Param";brand;getSQL(){return new ur([this])}}function ym(n,...e){const t=[];(e.length>0||n.length>0&&n[0]!=="")&&t.push(new uc(n[0]));for(const[i,r]of e.entries())t.push(r,new uc(n[i+1]));return new ur(t)}(n=>{function e(){return new ur([])}n.empty=e;function t(c){return new ur(c)}n.fromList=t;function i(c){return new ur([new uc(c)])}n.raw=i;function r(c,f){const h=[];for(const[g,y]of c.entries())g>0&&f!==void 0&&h.push(f),h.push(y);return new ur(h)}n.join=r;function s(c){return new QD(c)}n.identifier=s;function o(c){return new _T(c)}n.placeholder=o;function a(c,f){return new xT(c,f)}n.param=a})(ym||(ym={}));(n=>{class e{constructor(i,r){this.sql=i,this.fieldAlias=r}static[lt]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new e(this.sql,this.fieldAlias)}}n.Aliased=e})(ur||(ur={}));class _T{constructor(e){this.name=e}static[lt]="Placeholder";getSQL(){return new ur([this])}}const S_e=Symbol.for("drizzle:IsDrizzleView");class z9{static[lt]="View";[zb];[S_e]=!0;constructor({name:e,schema:t,selectedFields:i,query:r}){this[zb]={name:e,originalName:e,schema:t,selectedFields:i,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new ur([this])}}aA.prototype.getSQL=function(){return new ur([this])};Ms.prototype.getSQL=function(){return new ur([this])};L9.prototype.getSQL=function(){return new ur([this])};function Rs(n,e){return{name:typeof n=="string"&&n.length>0?n:"",config:typeof n=="object"?n:e}}typeof TextDecoder>"u"||new TextDecoder;class cA extends Bn{static[lt]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){const{name:t,...i}=e;this.config.generatedIdentity={type:"always",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){const{name:t,...i}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}class w_e extends cA{static[lt]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53")}build(e){return new M_e(e,this.config)}}class M_e extends un{static[lt]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}class T_e extends cA{static[lt]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new E_e(e,this.config)}}class E_e extends un{static[lt]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}function A_e(n,e){const{name:t,config:i}=Rs(n,e);return i.mode==="number"?new w_e(t):new T_e(t)}class C_e extends Bn{static[lt]="PgBigSerial53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new R_e(e,this.config)}}class R_e extends un{static[lt]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}class D_e extends Bn{static[lt]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new P_e(e,this.config)}}class P_e extends un{static[lt]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}function I_e(n,e){const{name:t,config:i}=Rs(n,e);return i.mode==="number"?new C_e(t):new D_e(t)}class O_e extends Bn{static[lt]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean")}build(e){return new N_e(e,this.config)}}class N_e extends un{static[lt]="PgBoolean";getSQLType(){return"boolean"}}function mN(n){return new O_e(n??"")}class k_e extends Bn{static[lt]="PgCharBuilder";constructor(e,t){super(e,"string","PgChar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new L_e(e,this.config)}}class L_e extends un{static[lt]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}function U_e(n,e={}){const{name:t,config:i}=Rs(n,e);return new k_e(t,i)}class F_e extends Bn{static[lt]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr")}build(e){return new B_e(e,this.config)}}class B_e extends un{static[lt]="PgCidr";getSQLType(){return"cidr"}}function z_e(n){return new F_e(n??"")}class V_e extends Bn{static[lt]="PgCustomColumnBuilder";constructor(e,t,i){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new j_e(e,this.config)}}class j_e extends un{static[lt]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom=="function"?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo=="function"?this.mapTo(e):e}}function G_e(n){return(e,t)=>{const{name:i,config:r}=Rs(e,t);return new V_e(i,r,n)}}class y_ extends Bn{static[lt]="PgDateColumnBaseBuilder";defaultNow(){return this.default(ym`now()`)}}class H_e extends y_{static[lt]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new $_e(e,this.config)}}class $_e extends un{static[lt]="PgDate";getSQLType(){return"date"}mapFromDriverValue(e){return typeof e=="string"?new Date(e):e}mapToDriverValue(e){return e.toISOString()}}class W_e extends y_{static[lt]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new q_e(e,this.config)}}class q_e extends un{static[lt]="PgDateString";getSQLType(){return"date"}mapFromDriverValue(e){return typeof e=="string"?e:e.toISOString().slice(0,-14)}}function K_e(n,e){const{name:t,config:i}=Rs(n,e);return i?.mode==="date"?new H_e(t):new W_e(t)}class X_e extends Bn{static[lt]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new Y_e(e,this.config)}}class Y_e extends un{static[lt]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(e){return typeof e=="string"?Number.parseFloat(e):e}}function J_e(n){return new X_e(n??"")}class Z_e extends Bn{static[lt]="PgInetBuilder";constructor(e){super(e,"string","PgInet")}build(e){return new Q_e(e,this.config)}}class Q_e extends un{static[lt]="PgInet";getSQLType(){return"inet"}}function eSe(n){return new Z_e(n??"")}class tSe extends cA{static[lt]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger")}build(e){return new nSe(e,this.config)}}class nSe extends un{static[lt]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(e){return typeof e=="string"?Number.parseInt(e):e}}function gN(n){return new tSe(n??"")}class iSe extends Bn{static[lt]="PgIntervalBuilder";constructor(e,t){super(e,"string","PgInterval"),this.config.intervalConfig=t}build(e){return new rSe(e,this.config)}}class rSe extends un{static[lt]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){const e=this.fields?` ${this.fields}`:"",t=this.precision?`(${this.precision})`:"";return`interval${e}${t}`}}function sSe(n,e={}){const{name:t,config:i}=Rs(n,e);return new iSe(t,i)}class oSe extends Bn{static[lt]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new aSe(e,this.config)}}class aSe extends un{static[lt]="PgJson";constructor(e,t){super(e,t)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}function lSe(n){return new oSe(n??"")}class cSe extends Bn{static[lt]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new uSe(e,this.config)}}class uSe extends un{static[lt]="PgJsonb";constructor(e,t){super(e,t)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}function fSe(n){return new cSe(n??"")}class dSe extends Bn{static[lt]="PgLineBuilder";constructor(e){super(e,"array","PgLine")}build(e){return new hSe(e,this.config)}}class hSe extends un{static[lt]="PgLine";getSQLType(){return"line"}mapFromDriverValue(e){const[t,i,r]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i),Number.parseFloat(r)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}class pSe extends Bn{static[lt]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC")}build(e){return new mSe(e,this.config)}}class mSe extends un{static[lt]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(e){const[t,i,r]=e.slice(1,-1).split(",");return{a:Number.parseFloat(t),b:Number.parseFloat(i),c:Number.parseFloat(r)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}function gSe(n,e){const{name:t,config:i}=Rs(n,e);return!i?.mode||i.mode==="tuple"?new dSe(t):new pSe(t)}class ySe extends Bn{static[lt]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr")}build(e){return new vSe(e,this.config)}}class vSe extends un{static[lt]="PgMacaddr";getSQLType(){return"macaddr"}}function bSe(n){return new ySe(n??"")}class xSe extends Bn{static[lt]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8")}build(e){return new _Se(e,this.config)}}class _Se extends un{static[lt]="PgMacaddr8";getSQLType(){return"macaddr8"}}function SSe(n){return new xSe(n??"")}class wSe extends Bn{static[lt]="PgNumericBuilder";constructor(e,t,i){super(e,"string","PgNumeric"),this.config.precision=t,this.config.scale=i}build(e){return new MSe(e,this.config)}}class MSe extends un{static[lt]="PgNumeric";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return typeof e=="string"?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}class TSe extends Bn{static[lt]="PgNumericNumberBuilder";constructor(e,t,i){super(e,"number","PgNumericNumber"),this.config.precision=t,this.config.scale=i}build(e){return new ESe(e,this.config)}}class ESe extends un{static[lt]="PgNumericNumber";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}class ASe extends Bn{static[lt]="PgNumericBigIntBuilder";constructor(e,t,i){super(e,"bigint","PgNumericBigInt"),this.config.precision=t,this.config.scale=i}build(e){return new CSe(e,this.config)}}class CSe extends un{static[lt]="PgNumericBigInt";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}function RSe(n,e){const{name:t,config:i}=Rs(n,e),r=i?.mode;return r==="number"?new TSe(t,i?.precision,i?.scale):r==="bigint"?new ASe(t,i?.precision,i?.scale):new wSe(t,i?.precision,i?.scale)}class DSe extends Bn{static[lt]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple")}build(e){return new PSe(e,this.config)}}class PSe extends un{static[lt]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[t,i]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}class ISe extends Bn{static[lt]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject")}build(e){return new OSe(e,this.config)}}class OSe extends un{static[lt]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[t,i]=e.slice(1,-1).split(",");return{x:Number.parseFloat(t),y:Number.parseFloat(i)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}function NSe(n,e){const{name:t,config:i}=Rs(n,e);return!i?.mode||i.mode==="tuple"?new DSe(t):new ISe(t)}function kSe(n){const e=[];for(let t=0;t<n.length;t+=2)e.push(Number.parseInt(n.slice(t,t+2),16));return new Uint8Array(e)}function uz(n,e){const t=new ArrayBuffer(8),i=new DataView(t);for(let r=0;r<8;r++)i.setUint8(r,n[e+r]);return i.getFloat64(0,!0)}function V9(n){const e=kSe(n);let t=0;const i=e[t];t+=1;const r=new DataView(e.buffer),s=r.getUint32(t,i===1);if(t+=4,s&536870912&&(r.getUint32(t,i===1),t+=4),(s&65535)===1){const o=uz(e,t);t+=8;const a=uz(e,t);return t+=8,[o,a]}throw new Error("Unsupported geometry type")}class LSe extends Bn{static[lt]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry")}build(e){return new USe(e,this.config)}}class USe extends un{static[lt]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return V9(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}class FSe extends Bn{static[lt]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject")}build(e){return new BSe(e,this.config)}}class BSe extends un{static[lt]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){const t=V9(e);return{x:t[0],y:t[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}function zSe(n,e){const{name:t,config:i}=Rs(n,e);return!i?.mode||i.mode==="tuple"?new LSe(t):new FSe(t)}class VSe extends Bn{static[lt]="PgRealBuilder";constructor(e,t){super(e,"number","PgReal"),this.config.length=t}build(e){return new jSe(e,this.config)}}class jSe extends un{static[lt]="PgReal";constructor(e,t){super(e,t)}getSQLType(){return"real"}mapFromDriverValue=e=>typeof e=="string"?Number.parseFloat(e):e}function GSe(n){return new VSe(n??"")}class HSe extends Bn{static[lt]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new $Se(e,this.config)}}class $Se extends un{static[lt]="PgSerial";getSQLType(){return"serial"}}function WSe(n){return new HSe(n??"")}class qSe extends cA{static[lt]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt")}build(e){return new KSe(e,this.config)}}class KSe extends un{static[lt]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=e=>typeof e=="string"?Number(e):e}function XSe(n){return new qSe(n??"")}class YSe extends Bn{static[lt]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new JSe(e,this.config)}}class JSe extends un{static[lt]="PgSmallSerial";getSQLType(){return"smallserial"}}function ZSe(n){return new YSe(n??"")}class QSe extends Bn{static[lt]="PgTextBuilder";constructor(e,t){super(e,"string","PgText"),this.config.enumValues=t.enum}build(e){return new e1e(e,this.config)}}class e1e extends un{static[lt]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function t1e(n,e={}){const{name:t,config:i}=Rs(n,e);return new QSe(t,i)}class n1e extends y_{constructor(e,t,i){super(e,"string","PgTime"),this.withTimezone=t,this.precision=i,this.config.withTimezone=t,this.config.precision=i}static[lt]="PgTimeBuilder";build(e){return new i1e(e,this.config)}}class i1e extends un{static[lt]="PgTime";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}function r1e(n,e={}){const{name:t,config:i}=Rs(n,e);return new n1e(t,i.withTimezone??!1,i.precision)}class s1e extends y_{static[lt]="PgTimestampBuilder";constructor(e,t,i){super(e,"date","PgTimestamp"),this.config.withTimezone=t,this.config.precision=i}build(e){return new o1e(e,this.config)}}class o1e extends un{static[lt]="PgTimestamp";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(e){return typeof e=="string"?new Date(this.withTimezone?e:e+"+0000"):e}mapToDriverValue=e=>e.toISOString()}class a1e extends y_{static[lt]="PgTimestampStringBuilder";constructor(e,t,i){super(e,"string","PgTimestampString"),this.config.withTimezone=t,this.config.precision=i}build(e){return new l1e(e,this.config)}}class l1e extends un{static[lt]="PgTimestampString";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(e){if(typeof e=="string")return e;const t=e.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone){const i=e.getTimezoneOffset(),r=i<=0?"+":"-";return`${t}${r}${Math.floor(Math.abs(i)/60).toString().padStart(2,"0")}`}return t}}function c1e(n,e={}){const{name:t,config:i}=Rs(n,e);return i?.mode==="string"?new a1e(t,i.withTimezone??!1,i.precision):new s1e(t,i?.withTimezone??!1,i?.precision)}class u1e extends Bn{static[lt]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(ym`gen_random_uuid()`)}build(e){return new f1e(e,this.config)}}class f1e extends un{static[lt]="PgUUID";getSQLType(){return"uuid"}}function Nl(n){return new u1e(n??"")}class d1e extends Bn{static[lt]="PgVarcharBuilder";constructor(e,t){super(e,"string","PgVarchar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new h1e(e,this.config)}}class h1e extends un{static[lt]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}function va(n,e={}){const{name:t,config:i}=Rs(n,e);return new d1e(t,i)}class p1e extends Bn{static[lt]="PgBinaryVectorBuilder";constructor(e,t){super(e,"string","PgBinaryVector"),this.config.dimensions=t.dimensions}build(e){return new m1e(e,this.config)}}class m1e extends un{static[lt]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function g1e(n,e){const{name:t,config:i}=Rs(n,e);return new p1e(t,i)}class y1e extends Bn{static[lt]="PgHalfVectorBuilder";constructor(e,t){super(e,"array","PgHalfVector"),this.config.dimensions=t.dimensions}build(e){return new v1e(e,this.config)}}class v1e extends un{static[lt]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(t=>Number.parseFloat(t))}}function b1e(n,e){const{name:t,config:i}=Rs(n,e);return new y1e(t,i)}class x1e extends Bn{static[lt]="PgSparseVectorBuilder";constructor(e,t){super(e,"string","PgSparseVector"),this.config.dimensions=t.dimensions}build(e){return new _1e(e,this.config)}}class _1e extends un{static[lt]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}function S1e(n,e){const{name:t,config:i}=Rs(n,e);return new x1e(t,i)}class w1e extends Bn{static[lt]="PgVectorBuilder";constructor(e,t){super(e,"array","PgVector"),this.config.dimensions=t.dimensions}build(e){return new M1e(e,this.config)}}class M1e extends un{static[lt]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(t=>Number.parseFloat(t))}}function T1e(n,e){const{name:t,config:i}=Rs(n,e);return new w1e(t,i)}function E1e(){return{bigint:A_e,bigserial:I_e,boolean:mN,char:U_e,cidr:z_e,customType:G_e,date:K_e,doublePrecision:J_e,inet:eSe,integer:gN,interval:sSe,json:lSe,jsonb:fSe,line:gSe,macaddr:bSe,macaddr8:SSe,numeric:RSe,point:NSe,geometry:zSe,real:GSe,serial:WSe,smallint:XSe,smallserial:ZSe,text:t1e,time:r1e,timestamp:c1e,uuid:Nl,varchar:va,bit:g1e,halfvec:b1e,sparsevec:S1e,vector:T1e}}const eP=Symbol.for("drizzle:PgInlineForeignKeys"),fz=Symbol.for("drizzle:EnableRLS");class Iw extends Ms{static[lt]="PgTable";static Symbol=Object.assign({},Ms.Symbol,{InlineForeignKeys:eP,EnableRLS:fz});[eP]=[];[fz]=!1;[Ms.Symbol.ExtraConfigBuilder]=void 0;[Ms.Symbol.ExtraConfigColumns]={}}function A1e(n,e,t,i,r=n){const s=new Iw(n,i,r),o=typeof e=="function"?e(E1e()):e,a=Object.fromEntries(Object.entries(o).map(([h,g])=>{const y=g;y.setName(h);const v=y.build(s);return s[eP].push(...y.buildForeignKeys(v,s)),[h,v]})),c=Object.fromEntries(Object.entries(o).map(([h,g])=>{const y=g;y.setName(h);const v=y.buildExtraConfigColumn(s);return[h,v]})),f=Object.assign(s,a);return f[Ms.Symbol.Columns]=a,f[Ms.Symbol.ExtraConfigColumns]=c,t&&(f[Iw.Symbol.ExtraConfigBuilder]=t),Object.assign(f,{enableRLS:()=>(f[Iw.Symbol.EnableRLS]=!0,f)})}const Bh=(n,e,t)=>A1e(n,e,t,void 0);function C1e(...n){return n[0].columns?new dz(n[0].columns,n[0].name):new dz(n)}class dz{static[lt]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new R1e(e,this.columns,this.name)}}class R1e{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static[lt]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[Iw.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}function D1e(n,e){return __e(e)&&!U9(n)&&!xr(n,xT)&&!xr(n,_T)&&!xr(n,aA)&&!xr(n,Ms)&&!xr(n,z9)?new xT(n,e):n}const P1e=(n,e)=>ym`${n} = ${D1e(e,n)}`;class j9{constructor(e,t){this.unique=e,this.name=t}static[lt]="PgIndexBuilderOn";on(...e){return new ZR(e.map(t=>{if(xr(t,ur))return t;t=t;const i=new KR(t.name,!!t.keyAsName,t.columnType,t.indexConfig);return t.indexConfig=JSON.parse(JSON.stringify(t.defaultConfig)),i}),this.unique,!1,this.name)}onOnly(...e){return new ZR(e.map(t=>{if(xr(t,ur))return t;t=t;const i=new KR(t.name,!!t.keyAsName,t.columnType,t.indexConfig);return t.indexConfig=t.defaultConfig,i}),this.unique,!0,this.name)}using(e,...t){return new ZR(t.map(i=>{if(xr(i,ur))return i;i=i;const r=new KR(i.name,!!i.keyAsName,i.columnType,i.indexConfig);return i.indexConfig=JSON.parse(JSON.stringify(i.defaultConfig)),r}),this.unique,!0,this.name,e)}}class ZR{static[lt]="PgIndexBuilder";config;constructor(e,t,i,r,s="btree"){this.config={name:r,columns:e,unique:t,only:i,method:s}}concurrently(){return this.config.concurrently=!0,this}with(e){return this.config.with=e,this}where(e){return this.config.where=e,this}build(e){return new I1e(this.config,e)}}class I1e{static[lt]="PgIndex";config;constructor(e,t){this.config={...e,table:t}}}function O1e(n){return new j9(!1,n)}function hz(n){return new j9(!0,n)}function Zf(){return va({length:24}).$type()}function pz(n){return ym`lower(${n})`}const v_=ym`TO_CHAR(NOW() AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.MS"Z"')`,N1e=lA("role",["admin","user"]),_0=Bh("users",{id:Nl().primaryKey().defaultRandom(),username:va({length:16}).$type().notNull(),emailOffered:va({length:254}).notNull(),emailVerified:va({length:254}),password:va({length:254}),createdAtIso:Zf().notNull().default(v_),createdIp:va({length:45}).notNull(),isActive:mN().notNull().default(!1),verifiedAtIso:Zf(),userRole:N1e().default("user")},n=>[hz("usernameUniqueIndex").on(pz(n.username)),hz("emailVerifiedUniqueIndex").on(pz(n.emailVerified))]),k1e=["username","emailOffered","emailVerified","password","userRole"];lA("trackedUserColumnName",k1e);const L1e=lA("accountAction",["cooldown","confirmEmail","signIn","resetPassword"]);Bh("accountActions",{userId:Nl().references(()=>_0.id).primaryKey(),action:L1e().notNull(),code:va({length:254}).notNull(),wrongCodeCount:gN().notNull().default(0),expiresAtIso:Zf().notNull()});const U1e=Bh("games",{id:Nl().primaryKey().defaultRandom()});Bh("players",{userId:Nl().notNull().references(()=>_0.id,{onDelete:"cascade"}),gameId:Nl().notNull().references(()=>U1e.id,{onDelete:"cascade"}),score:gN().notNull()},n=>[C1e({name:"players_userId_gameId_pk",columns:[n.userId,n.gameId]})]);Bh("signInHistory",{id:Nl().primaryKey().defaultRandom(),userId:Nl().references(()=>_0.id,{onDelete:"cascade"}),signInTimeIso:Zf().notNull().default(v_),ipAddress:va({length:45}).notNull(),userAgent:va({length:1024}),successful:mN().notNull().default(!1)});const F1e=lA("twoFactorMethod",["email","phone"]);Bh("passwordResetAttempts",{id:Nl().primaryKey().defaultRandom(),userId:Nl().notNull().references(()=>_0.id,{onDelete:"cascade"}),requestedIp:va({length:45}).notNull(),requestedAtIso:Zf().notNull().default(v_),succeededIp:va({length:45}),succeededAtIso:Zf(),verificationMethod:F1e().notNull()});Bh("banishedIps",{ip:va({length:45}).primaryKey(),reason:va({length:2048}).notNull(),banishedAtIso:Zf().notNull().default(v_),banishedUntilIso:Zf()});Bh("userSessions",{sessionKey:Nl().notNull().primaryKey(),userId:Nl().notNull().references(()=>_0.id,{onDelete:"cascade"}),createdAtIso:Zf().notNull().default(v_)},n=>[O1e("userIdIndex").on(n.userId)]);const uA=Dh({key:"usernames",default:n=>n.slice(6,12),effects:n=>[({setSelf:e})=>{if(LI){const t=n.replace(/^user::/,"");mI(async()=>{const{db:i}=await import("@backend/db");return{db:i}},[]).then(({db:i})=>i.drizzle.query.users.findFirst({columns:{username:!0},where:P1e(_0.id,t)}).then(r=>{r&&e(r.username)}))}}]}),B1e={class:"_class_8npqa_1"};function z1e({fill:n="none",stroke:e="black",strokeWidth:t=1,strokeMiterlimit:i=10}){return j.jsxs("svg",{id:"uuid-55af1f58-4ded-4edb-a44d-2a28837a648d",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 142 142",children:[j.jsx("title",{children:"icon representing a tile"}),j.jsx("polygon",{points:"86.53 13.04 28.57 26.97 13.04 78.94 55.47 116.99 113.43 103.06 128.96 51.09 86.53 13.04",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("polygon",{points:"86.53 27.06 28.57 40.98 13.04 92.95 55.47 131 113.43 117.07 128.96 65.1 86.53 27.06",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"13.04",y1:"78.94",x2:"13.04",y2:"92.95",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"128.96",y1:"65.1",x2:"128.96",y2:"51.09",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}})]})}function V1e({fill:n="none",stroke:e="black",strokeWidth:t=1,strokeMiterlimit:i=10}){return j.jsxs("svg",{id:"uuid-d0d5f6c5-fe00-4880-9c8d-d1bebac5afc6",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 142 142",children:[j.jsx("title",{children:"icon representing a cube"}),j.jsx("polygon",{points:"106.74 37.53 18.72 34.44 18.72 119.48 106.74 122.57 106.74 37.53",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("polygon",{points:"122.88 19.92 39.58 16.97 39.58 98.05 122.88 101 122.88 19.92",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"18.72",y1:"34.44",x2:"39.58",y2:"16.97",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}}),j.jsx("line",{x1:"106.74",y1:"122.57",x2:"122.88",y2:"101",style:{fill:n,stroke:e,strokeWidth:t,strokeMiterlimit:i}})]})}function j1e(){const{myRoomKey:n}=wm(),e=wc(kl);return j.jsxs("main",{className:B1e.class,children:[e?j.jsx($1e,{myUserKey:e}):null,e&&n?j.jsx(H1e,{myUserKey:e}):j.jsx(G1e,{})]})}function G1e(){const{roomSocket:n,allRoomKeysAtom:e}=wm(),t=VT(e),i=t.find(r=>r.includes("bug-rangers"));return j.jsx("article",{"data-css":"room-exterior",children:j.jsx("button",{type:"button",disabled:i===void 0,onClick:()=>{n.emit("joinRoom",t[0])},children:i?"Join Game":"Waiting for Host"})})}function H1e({myUserKey:n}){const e=wc(uN),t=bc(r0,n),i=bc(gT,n),r=Ru(Fh);return j.jsxs(j.Fragment,{children:[j.jsx(W1e,{}),r?j.jsx(nwe,{playerTurn:r}):null,e==="playing"?j.jsxs(j.Fragment,{children:[j.jsx(Y1e,{}),j.jsxs("article",{"data-css-counter":"tiles",children:[j.jsx(z1e,{stroke:"var(--fg)",strokeWidth:2}),j.jsx("span",{children:t})]}),j.jsxs("article",{"data-css-counter":"cubes",children:[j.jsx(V1e,{stroke:"var(--fg)",strokeWidth:2}),j.jsx("span",{children:i})]})]}):null]})}function $1e({myUserKey:n}){return bc(uA,n)==="jeremy"?j.jsx(q1e,{}):null}function W1e(){const{myMutualsAtom:n}=wm(),e=wc(uN);return j.jsx("article",{"data-css":"room-module",children:j.jsxs(La.main,{layout:!0,children:[j.jsx(Q1e,{isCurrentPhase:e==="setup"}),j.jsx(ewe,{isCurrentPhase:e==="playing",gameState:e,myMutualsAtom:n})]})})}const mz=fi({key:"showBugRangersDevtools",default:!1});function q1e(){const n=wc(mz),{myRoomKey:e}=wm();return j.jsxs(j.Fragment,{children:[j.jsxs("button",{type:"button","data-css":"devtools-toggle",onClick:()=>{It(mz,t=>!t)},children:[n?"hide":"show"," devtools"]}),n?j.jsxs("article",{"data-css":"devtools",children:[j.jsx("h1",{children:e??"null"}),j.jsx(J1e,{}),e?j.jsx(K1e,{}):null]}):null]})}function K1e(){const n=wc(uN),e=wc(A9),t=Ru(Fh);return j.jsxs(j.Fragment,{children:[j.jsx("span",{children:n==="setup"?"Setup":j.jsxs(j.Fragment,{children:[j.jsx(X1e,{userKey:t??"user::$_NONE_$"})," ","playing turn ",e]})}),j.jsx(Z1e,{})]})}function X1e({userKey:n}){const e=bc(uA,n);return j.jsx(j.Fragment,{children:e})}function Y1e(){const n=ln(kl),e=ln(Dm,n),{socket:t}=te.useContext(Sm),i=t,r=ln(Lxe),s=ln(hN),o=ln(Uxe),a=wc(Yi);return j.jsx("article",{"data-css":"turn-controls",children:e===null?Nxe.map((c,f)=>j.jsx("button",{"data-css-color-choice":!0,disabled:r.has(c)||!s,type:"button",style:{pointerEvents:"all",background:c},onClick:()=>{i.emit("chooseColor",c)},children:kxe[c]},f)):j.jsxs(j.Fragment,{children:[j.jsx("button",{type:"button",disabled:!s||a===null,onClick:()=>{It(Yi,null),i.emit("turnRestart")},children:"restart turn"}),j.jsx("button",{type:"button",disabled:!o||!s,onClick:()=>{It(Yi,null),i.emit("turnEnd")},children:"end turn"})]})})}function J1e(){const{roomSocket:n,allRoomKeysAtom:e,myRoomKey:t}=wm(),i=VT(e).find(r=>r.includes("bug-rangers"));return j.jsxs("section",{"data-css":"room-controls",children:[t?j.jsxs("button",{type:"button",onClick:()=>{n?.emit("leaveRoom")},children:["Leave ",t]}):j.jsx("button",{type:"button",onClick:()=>{i?n?.emit("joinRoom",i):n?.emit("createRoom","backend.worker.bug-rangers.bun")},children:i?`Join ${i}`:"Create room"}),i?j.jsxs("button",{type:"button",onClick:()=>{n?.emit("deleteRoom",i)},children:["Delete ",i]}):null]})}function Z1e(){const{socket:n}=te.useContext(Sm),e=n;return j.jsxs("section",{children:[j.jsx("button",{type:"button",onClick:()=>{e.emit("startGame")},children:"start game"}),j.jsx("button",{type:"button",onClick:()=>{n?.emit("RESET_GAME")},children:"reset game"})]})}function Q1e({isCurrentPhase:n}){const{socket:e}=te.useContext(Sm),t=e,i=Ru(Oxe);return j.jsxs(La.section,{layout:!0,"data-css":"setup","data-css-current":n||void 0,children:[j.jsx(Ow,{groupName:"Not Ready",dataCss:"not-ready",userKeys:i.notReady}),j.jsx(Ow,{groupName:"Does not Want First",dataCss:"ready-does-not-want-first",userKeys:i.readyDoesNotWantFirst,onClick:()=>{t?.emit("wantNotFirst")}}),j.jsx(Ow,{groupName:"Wants First",dataCss:"ready-wants-first",userKeys:i.readyWantsFirst,onClick:()=>{t?.emit("wantFirst")}})]})}function ewe({isCurrentPhase:n}){const e=yI(g_);return j.jsx(La.section,{layout:!0,"data-css":"playing","data-css-current":n||void 0,children:j.jsx(Ow,{groupName:"Turn Order",dataCss:"turn-order",userKeys:e})})}function Ow({groupName:n,dataCss:e,userKeys:t,onClick:i}){return j.jsxs("section",{"data-css":e,children:[j.jsx("button",{type:"button",onClick:i,disabled:!i}),j.jsx("header",{children:n}),j.jsx("main",{children:t.map(r=>j.jsx(twe,{userKey:r},r))})]})}function twe({userKey:n}){const e=ln(kl),{myRoomKey:t}=wm(),i=TJ(hV,t??"room::"),r=ln(i.userKeyOfRoom),s=bc(uA,n),o=bc(Dm,n)??"#555",a=ln(Fh);return j.jsxs(La.div,{layoutId:n,"data-css-user":!0,children:[n===e?n===r?j.jsx(joe,{color:o}):j.jsx(zoe,{color:o}):n===r?j.jsx(Goe,{color:o}):j.jsx(Voe,{color:o}),n===a?j.jsx(Hoe,{color:o}):null,j.jsx("span",{children:s.slice(0,3)})]})}function nwe({playerTurn:n}){const e=bc(uA,n),t=bc(Dm,n),i=ln(kl);return j.jsxs("article",{"data-css":"turn-banner",children:[j.jsx(QS,{mode:"wait",children:j.jsx(La.div,{initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["-1500%","2%","4%","1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","90vw","90vw","10vw"]},transition:{duration:3,times:[0,.1,.77,1],ease:["circOut","linear","easeIn"]}},n)}),j.jsx(QS,{mode:"wait",children:j.jsx(La.span,{"data-css":"top",style:{backgroundColor:t??"#555"},initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["-1500%","2%","4%","1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","20vw","100vw","10vw"]},transition:{duration:3,times:[0,.1,.7,1],ease:["circOut","linear","easeIn"]}},n)}),j.jsx(QS,{mode:"wait",children:j.jsx(La.span,{"data-css":"bottom",initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["1500%","4%","2%","-1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","20vw","100vw","10vw"]},transition:{duration:3,times:[0,.1,.7,1],ease:["circOut","linear","easeIn"]}},n)}),j.jsx(QS,{mode:"wait",children:j.jsx(La.h1,{style:{backgroundColor:t??"#555"},initial:{x:"-1500%",skewX:"-50deg",width:"20vw"},animate:{x:["-1500%","5%","10%","1500%"],skewX:["-50deg","-5deg","-5deg","-50deg"],width:["20vw","80vw","80vw","10vw"]},transition:{duration:3,times:[0,.2,.75,1],ease:["circOut","linear","easeIn"]},children:n===i?"your turn":`${e}'s turn`},n)})]})}function iwe(){return j.jsxs(j.Fragment,{children:[j.jsx(Qxe,{}),j.jsx(j1e,{})]})}const G9=fi({key:"count",default:0}),rwe=DJ({key:"incrementTX",do:({set:n})=>{n(G9,e=>e+1)}});bZ({key:"countContinuity",config:n=>n.add(G9).add(rwe)});const swe=fi({key:"cpuCount",default:1,effects:[({setSelf:n})=>{LI&&mI(async()=>{const{cpus:e}=await Promise.resolve().then(()=>pwe);return{cpus:e}},void 0).then(({cpus:e})=>{n(e().length)})}]});function owe(){const n=wc(swe),e=VT(I3),{myRoomKey:t,myOwnedRoomsAtom:i,roomSocket:r}=wm(),s=ln(i);return j.jsxs("article",{"data-css":"server-control",children:[Array.from({length:n}).map((o,a)=>{const c=e[a],f=c&&c===t,h=s.has(c);return j.jsx(awe,{indexNumber:a,roomKey:c,roomSocket:r,ownsRoom:h,hasJoined:f},a)}),j.jsx("button",{type:"button",onClick:()=>{r.emit("createRoom","backend.worker.bug-rangers.bun")},children:"create room"})]})}function awe({indexNumber:n,roomKey:e,hasJoined:t,ownsRoom:i,roomSocket:r}){return j.jsxs("div",{"data-css":"",children:[j.jsxs("span",{children:["Core ",n,": ",e," ",j.jsx("input",{type:"checkbox",checked:i,disabled:!0}),j.jsx("input",{type:"checkbox",checked:t,disabled:!0})]}),e===void 0?null:t?j.jsx("button",{type:"button",onClick:()=>{r.emit("leaveRoom")},children:"leave"}):j.jsx("button",{type:"button",onClick:()=>{r.emit("joinRoom",e)},children:"join"}),e&&i?j.jsx("button",{type:"button",onClick:()=>{r.emit("deleteRoom",e)},children:"delete"}):null]})}function lwe({route:[,n]}){return j.jsx("article",{className:mce.class,children:n?j.jsx(uwe,{gameId:n}):j.jsx(cwe,{})})}function cwe(){return j.jsx("nav",{children:j.jsx(j8,{href:"/game/hexiom",children:j.jsx("h1",{children:"HEXIOM"})})})}PJ(yj[1].game[1]).map(([n])=>n);function uwe(n){switch(n.gameId){case"hexiom":return j.jsx(iwe,{});case"server_control":return j.jsx(owe,{})}}function fwe(){const n=ka(Hy),e=ka(bu),t=ka(Ff),i=ln(Hy),r=ln(bu),s=ln(Ff),o=`email-${te.useId()}`,a=`password-${te.useId()}`,c=`one-time-code-${te.useId()}`,[f,h]=te.useState(null),[g,y]=te.useState("email"),v=`form-${te.useId()}`;return te.useEffect(()=>{if(s.length===6){const _=document.getElementById(v);_ instanceof HTMLFormElement&&_.requestSubmit()}},[s]),j.jsx("form",{id:v,onSubmit:async _=>{_.preventDefault();const S=Cn(hu);try{switch(g){case"email":{const{nextStep:M,userKey:w}=await ga.declareAuthTarget.query({email:i});switch(It(hu,w),M){case"otc_login":case"otc_verify":{y("otc");break}case"password_login":{y("password");break}}break}case"otc":{if(!S){console.error("somehow userKey is null");return}const M=await ga.verifyAccountAction.mutate({oneTimeCode:s,userKey:S});It(wr,M),Pu.once("connect",()=>{cm("/game"),n(""),t("")});break}case"password":{const M=await ga.openSession.mutate({email:i,password:r});It(wr,M),Pu.once("connect",()=>{cm("/game"),n(""),e("")});break}}}catch(M){M instanceof Gy&&h(M.message)}},children:j.jsxs("main",{children:[f?j.jsx("aside",{children:f}):null,j.jsxs(La.label,{htmlFor:o,children:[j.jsx("span",{children:"Email"}),j.jsx("input",{id:o,type:"text",value:i,onChange:_=>{n(_.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?j.jsxs("label",{htmlFor:a,children:[j.jsx("span",{children:"Password"}),j.jsx("input",{id:a,type:"password",value:r,onChange:_=>{e(_.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?j.jsxs("label",{htmlFor:c,children:[j.jsx("span",{children:"One-time Code"}),j.jsx("input",{id:c,type:"number",inputMode:"numeric",enterKeyHint:"go",value:s,onChange:_=>{t(_.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,j.jsxs("footer",{children:[g==="password"?j.jsx("button",{type:"button",onClick:async()=>{const _=Cn(hu);if(!_)return new Error("No userKey");await ga.startPasswordReset.mutate({userKey:_}),y("otc")},children:"Forgot Password?"}):null,j.jsx("span",{}),j.jsx("button",{type:"submit",disabled:!i&&g==="email"||!r&&g==="password"||!s&&g==="otc",children:">>->"})]})]})})}function dwe({route:[,n]}){const e=ln(wr),t=ln(Ff),i=ka(Ff),r=`code-${te.useId()}`;return te.useEffect(()=>{n&&i(n)},[]),e?j.jsx("form",{onSubmit:async s=>{s.preventDefault();try{const o=await ga.verifyAccountAction.mutate({oneTimeCode:t,userKey:"CHANGEME"});It(wr,o),o.action==="resetPassword"?cm("/account"):cm("/game")}catch(o){console.error(o)}},children:j.jsxs("main",{children:[j.jsx("p",{children:"Check your email for a verification code."}),j.jsxs("label",{htmlFor:r,children:[j.jsx("span",{children:"Verification code"}),j.jsx("input",{id:r,type:"text",value:t,onChange:s=>{i(s.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})}):j.jsx("p",{children:"You must be logged in to verify your account."})}ET.STORE.loggers[0].logLevel="warn";function hwe(){const n=ln(cce),e=ln(wr),[t,i]=te.useState(!1),{refs:r,floatingStyles:s,context:o}=Ioe({open:t,onOpenChange:i,placement:"bottom-end",middleware:[ioe(5),soe(),roe()],whileElementsMounted:Xse}),a=Aoe(o),c=Doe(o),f=koe(o),{getReferenceProps:h,getFloatingProps:g}=Ooe([a,c,f]),y=ln(Jae);return j.jsxs("main",{className:$oe.class,children:[j.jsxs("header",{children:[j.jsxs("main",{children:[typeof n=="object"&&n[0]==="game"?null:j.jsx(Boe,{}),j.jsx("span",{children:j.jsx(Woe,{input:y})})]}),j.jsx("button",{"data-css":"profile",ref:r.setReference,...h(),children:e?.username?e.username.slice(0,3):""}),t&&e&&j.jsx(Toe,{context:o,modal:!1,children:j.jsxs("div",{"data-css":"profile-actions",ref:r.setFloating,style:s,...g(),children:[j.jsx("span",{children:e.username}),j.jsx("button",{type:"button",onClick:()=>{cm("/account")},children:"Account"}),j.jsx("button",{type:"button",onClick:async()=>{e&&(await ga.closeSession.mutate({username:e.username}),Pu.once("disconnect",()=>{It(wr,null),cm("/")}),Pu.disconnect())},children:"Sign out"})]})})]}),j.jsx("main",{children:typeof n=="number"?j.jsxs("article",{children:[j.jsx("h1",{children:n}),j.jsx("h2",{children:JSON.parse(V8[n])}),j.jsx(j8,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(n[0]){case void 0:return j.jsx(fwe,{});case"admin":return j.jsx(pce,{});case"game":return j.jsx(lwe,{route:n});case"verify":return j.jsx(dwe,{route:n});case"account":return j.jsx(hce,{})}})()})]})}DZ.createRoot(document.getElementById("root")).render(j.jsx(te.StrictMode,{children:j.jsxs(MZ,{socket:Pu,children:[j.jsx(hwe,{}),j.jsx(_J,{hideByDefault:UI.VITE_HIDE_DEVTOOLS})]})}));const pwe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));
|
package/app/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
/>
|
|
11
11
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
12
12
|
<title>TEMPEST</title>
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-BW3Efm0c.js"></script>
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/index-oxk15HrU.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
package/bin/backend.bun.js
CHANGED
|
@@ -4239,7 +4239,7 @@ function spawnRoom({
|
|
|
4239
4239
|
}) {
|
|
4240
4240
|
return async (roomName) => {
|
|
4241
4241
|
store.logger.info(`\uD83D\uDCE1`, `socket`, socket.id ?? `[ID MISSING?!]`, `\uD83D\uDC64 ${userKey} spawns room ${roomName}`);
|
|
4242
|
-
const roomKey = `room::${roomMeta.count++}`;
|
|
4242
|
+
const roomKey = `room::${roomMeta.count++}-${roomName}`;
|
|
4243
4243
|
const [command, args] = resolveRoomScript(roomName);
|
|
4244
4244
|
const child = await new Promise((resolve) => {
|
|
4245
4245
|
const room2 = spawn(command, args, {
|
|
@@ -88128,8 +88128,8 @@ init_drizzle_orm();
|
|
|
88128
88128
|
var {CookieMap: CookieMap2 } = globalThis.Bun;
|
|
88129
88129
|
|
|
88130
88130
|
// src/backend.worker.ts
|
|
88131
|
-
import { resolve as resolve2 } from "path";
|
|
88132
88131
|
init_env();
|
|
88132
|
+
import { resolve as resolve2 } from "path";
|
|
88133
88133
|
function resolveRoomScript(name2) {
|
|
88134
88134
|
const extension = env2.RUN_WORKERS_FROM_SOURCE ? `ts` : `js`;
|
|
88135
88135
|
const runner = name2.endsWith(`.bun`) ? `bun` : `node`;
|
|
@@ -88147,13 +88147,15 @@ function resolveRoomScript(name2) {
|
|
|
88147
88147
|
}
|
|
88148
88148
|
return [runner, args2];
|
|
88149
88149
|
}
|
|
88150
|
-
var workerNames = [
|
|
88151
|
-
`backend.worker.bug-rangers.bun`
|
|
88152
|
-
];
|
|
88153
88150
|
|
|
88154
88151
|
// src/backend/websockets.ts
|
|
88155
88152
|
init_tempest_db_schema();
|
|
88156
88153
|
|
|
88154
|
+
// src/library/room-names.ts
|
|
88155
|
+
var roomNames = [
|
|
88156
|
+
`backend.worker.bug-rangers.bun`
|
|
88157
|
+
];
|
|
88158
|
+
|
|
88157
88159
|
// src/library/store.ts
|
|
88158
88160
|
init_env();
|
|
88159
88161
|
var countAtom = atom2({
|
|
@@ -88264,7 +88266,7 @@ var serveSocket = (config3) => {
|
|
|
88264
88266
|
socket,
|
|
88265
88267
|
userKey: consumer,
|
|
88266
88268
|
store: IMPLICIT.STORE,
|
|
88267
|
-
roomNames
|
|
88269
|
+
roomNames,
|
|
88268
88270
|
resolveRoomScript
|
|
88269
88271
|
})
|
|
88270
88272
|
];
|
|
@@ -12916,7 +12916,7 @@ function spawnRoom({
|
|
|
12916
12916
|
}) {
|
|
12917
12917
|
return async (roomName) => {
|
|
12918
12918
|
store.logger.info(`\uD83D\uDCE1`, `socket`, socket.id ?? `[ID MISSING?!]`, `\uD83D\uDC64 ${userKey} spawns room ${roomName}`);
|
|
12919
|
-
const roomKey = `room::${roomMeta.count++}`;
|
|
12919
|
+
const roomKey = `room::${roomMeta.count++}-${roomName}`;
|
|
12920
12920
|
const [command, args2] = resolveRoomScript(roomName);
|
|
12921
12921
|
const child = await new Promise((resolve) => {
|
|
12922
12922
|
const room2 = spawn(command, args2, {
|
package/bin/frontend.bun.js
CHANGED
|
@@ -12895,7 +12895,7 @@ function spawnRoom({
|
|
|
12895
12895
|
}) {
|
|
12896
12896
|
return async (roomName) => {
|
|
12897
12897
|
store.logger.info(`\uD83D\uDCE1`, `socket`, socket.id ?? `[ID MISSING?!]`, `\uD83D\uDC64 ${userKey} spawns room ${roomName}`);
|
|
12898
|
-
const roomKey = `room::${roomMeta.count++}`;
|
|
12898
|
+
const roomKey = `room::${roomMeta.count++}-${roomName}`;
|
|
12899
12899
|
const [command, args2] = resolveRoomScript(roomName);
|
|
12900
12900
|
const child = await new Promise((resolve) => {
|
|
12901
12901
|
const room2 = spawn(command, args2, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tempest.games",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"socket.io-client": "4.8.3",
|
|
51
51
|
"three": "0.182.0",
|
|
52
52
|
"three-stdlib": "2.36.1",
|
|
53
|
-
"
|
|
53
|
+
"atom.io": "0.46.15",
|
|
54
54
|
"safedeposit": "0.1.2",
|
|
55
|
-
"
|
|
55
|
+
"treetrunks": "0.1.5"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@react-email/preview-server": "5.1.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vite": "7.3.0",
|
|
77
77
|
"vite-tsconfig-paths": "6.0.3",
|
|
78
78
|
"vitest": "4.0.16",
|
|
79
|
-
"flightdeck": "0.3.
|
|
79
|
+
"flightdeck": "0.3.35",
|
|
80
80
|
"varmint": "0.5.11"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|