@utsp/types 0.17.0-nightly.20260128135217.8ab29d7 → 0.17.0-nightly.20260128161430.00e511d
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/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var xi=Object.getOwnPropertyNames;var ci=Object.prototype.hasOwnProperty;var ni=(s,r,x)=>r in s?M(s,r,{enumerable:!0,configurable:!0,writable:!0,value:x}):s[r]=x;var g=(s,r)=>M(s,"name",{value:r,configurable:!0});var gi=(s,r)=>{for(var x in r)M(s,x,{get:r[x],enumerable:!0})},fi=(s,r,x,D)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of xi(r))!ci.call(s,o)&&o!==x&&M(s,o,{get:()=>r[o],enumerable:!(D=li(r,o))||D.enumerable});return s};var ai=s=>fi(M({},"__esModule",{value:!0}),s);var P=(s,r,x)=>(ni(s,typeof r!="symbol"?r+"":r,x),x);var Yi={};gi(Yi,{GRID_DEFAULTS:()=>hi,GamepadInput:()=>A,InputDeviceType:()=>X,KeyboardInput:()=>Y,MouseInput:()=>z,NetworkEvent:()=>F,NetworkState:()=>si,NetworkTransportType:()=>ti,POST_PROCESS_DEFAULTS:()=>mi,ScalingMode:()=>ei,ScalingModeValue:()=>ri,TVRemoteInput:()=>C,TouchInput:()=>B,TouchZoneInput:()=>w,Vector2:()=>L,Vector3:()=>k,createInputDescriptor:()=>K,deserializeInputDescriptor:()=>p,gamepadAxisIndexToInput:()=>O,gamepadButtonIndexToInput:()=>$,getTouchXAxis:()=>j,getTouchYAxis:()=>G,getTouchZoneXAxis:()=>b,getTouchZoneYAxis:()=>_,inputDescriptorToString:()=>I,isAxis:()=>T,isButton:()=>H,isGamepadAxis:()=>W,isGamepadButton:()=>Q,isMouseAxis:()=>v,isMouseButton:()=>U,isNetworkEvent:()=>Si,isTVRemoteAxis:()=>Z,isTVRemoteButton:()=>R,isTouchButton:()=>d,isTouchGesture:()=>N,isTouchPosition:()=>J,isTouchZoneButton:()=>y,isTouchZonePosition:()=>V,keyCodeToKeyboardInput:()=>q,keyboardInputToKeyCode:()=>E,parseInputDescriptor:()=>ii,scalingModeToValue:()=>Di,serializeInputDescriptor:()=>u,valueToScalingMode:()=>oi});module.exports=ai(Yi);var X=(h=>(h[h.Keyboard=0]="Keyboard",h[h.Mouse=1]="Mouse",h[h.Gamepad=2]="Gamepad",h[h.Touch=3]="Touch",h[h.TVRemote=4]="TVRemote",h[h.TextInput=5]="TextInput",h[h.Motion=6]="Motion",h[h.TouchZone=7]="TouchZone",h))(X||{});var Y=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(Y||{});function q(s){let r=Y[s];return r!==void 0?r:null}g(q,"keyCodeToKeyboardInput");function E(s){return Y[s]}g(E,"keyboardInputToKeyCode");var z=(n=>(n[n.LeftButton=0]="LeftButton",n[n.MiddleButton=1]="MiddleButton",n[n.RightButton=2]="RightButton",n[n.Button4=3]="Button4",n[n.Button5=4]="Button5",n[n.PositionX=100]="PositionX",n[n.PositionY=101]="PositionY",n[n.DeltaX=102]="DeltaX",n[n.DeltaY=103]="DeltaY",n[n.WheelDeltaY=104]="WheelDeltaY",n[n.WheelDeltaX=105]="WheelDeltaX",n))(z||{});function U(s){return s<100}g(U,"isMouseButton");function v(s){return s>=100}g(v,"isMouseAxis");var A=(c=>(c[c.ButtonA=0]="ButtonA",c[c.ButtonB=1]="ButtonB",c[c.ButtonX=2]="ButtonX",c[c.ButtonY=3]="ButtonY",c[c.LeftShoulder=4]="LeftShoulder",c[c.RightShoulder=5]="RightShoulder",c[c.LeftTrigger=6]="LeftTrigger",c[c.RightTrigger=7]="RightTrigger",c[c.Select=8]="Select",c[c.Start=9]="Start",c[c.LeftStick=10]="LeftStick",c[c.RightStick=11]="RightStick",c[c.DPadUp=12]="DPadUp",c[c.DPadDown=13]="DPadDown",c[c.DPadLeft=14]="DPadLeft",c[c.DPadRight=15]="DPadRight",c[c.Home=16]="Home",c[c.Touchpad=17]="Touchpad",c[c.LeftStickX=100]="LeftStickX",c[c.LeftStickY=101]="LeftStickY",c[c.RightStickX=102]="RightStickX",c[c.RightStickY=103]="RightStickY",c[c.LeftTriggerAxis=104]="LeftTriggerAxis",c[c.RightTriggerAxis=105]="RightTriggerAxis",c))(A||{});function Q(s){return s<100}g(Q,"isGamepadButton");function W(s){return s>=100}g(W,"isGamepadAxis");function $(s){return s>=0&&s<=19?s:null}g($,"gamepadButtonIndexToInput");function O(s){return{0:100,1:101,2:102,3:103}[s]??null}g(O,"gamepadAxisIndexToInput");var B=(l=>(l[l.Touch0=0]="Touch0",l[l.Touch1=1]="Touch1",l[l.Touch2=2]="Touch2",l[l.Touch3=3]="Touch3",l[l.Touch4=4]="Touch4",l[l.Touch5=5]="Touch5",l[l.Touch6=6]="Touch6",l[l.Touch7=7]="Touch7",l[l.Touch8=8]="Touch8",l[l.Touch9=9]="Touch9",l[l.Touch0X=100]="Touch0X",l[l.Touch0Y=101]="Touch0Y",l[l.Touch1X=102]="Touch1X",l[l.Touch1Y=103]="Touch1Y",l[l.Touch2X=104]="Touch2X",l[l.Touch2Y=105]="Touch2Y",l[l.Touch3X=106]="Touch3X",l[l.Touch3Y=107]="Touch3Y",l[l.Touch4X=108]="Touch4X",l[l.Touch4Y=109]="Touch4Y",l[l.Touch5X=110]="Touch5X",l[l.Touch5Y=111]="Touch5Y",l[l.Touch6X=112]="Touch6X",l[l.Touch6Y=113]="Touch6Y",l[l.Touch7X=114]="Touch7X",l[l.Touch7Y=115]="Touch7Y",l[l.Touch8X=116]="Touch8X",l[l.Touch8Y=117]="Touch8Y",l[l.Touch9X=118]="Touch9X",l[l.Touch9Y=119]="Touch9Y",l[l.PinchScale=200]="PinchScale",l[l.RotationAngle=201]="RotationAngle",l[l.SwipeVelocityX=202]="SwipeVelocityX",l[l.SwipeVelocityY=203]="SwipeVelocityY",l))(B||{});function d(s){return s<100}g(d,"isTouchButton");function J(s){return s>=100&&s<200}g(J,"isTouchPosition");function N(s){return s>=200}g(N,"isTouchGesture");function j(s){return s<0||s>9?null:100+s*2}g(j,"getTouchXAxis");function G(s){return s<0||s>9?null:101+s*2}g(G,"getTouchYAxis");var w=(e=>(e[e.Zone0=0]="Zone0",e[e.Zone1=1]="Zone1",e[e.Zone2=2]="Zone2",e[e.Zone3=3]="Zone3",e[e.Zone4=4]="Zone4",e[e.Zone5=5]="Zone5",e[e.Zone6=6]="Zone6",e[e.Zone7=7]="Zone7",e[e.Zone8=8]="Zone8",e[e.Zone9=9]="Zone9",e[e.Zone10=10]="Zone10",e[e.Zone11=11]="Zone11",e[e.Zone12=12]="Zone12",e[e.Zone13=13]="Zone13",e[e.Zone14=14]="Zone14",e[e.Zone15=15]="Zone15",e[e.Zone16=16]="Zone16",e[e.Zone17=17]="Zone17",e[e.Zone18=18]="Zone18",e[e.Zone19=19]="Zone19",e[e.Zone20=20]="Zone20",e[e.Zone21=21]="Zone21",e[e.Zone22=22]="Zone22",e[e.Zone23=23]="Zone23",e[e.Zone24=24]="Zone24",e[e.Zone25=25]="Zone25",e[e.Zone26=26]="Zone26",e[e.Zone27=27]="Zone27",e[e.Zone28=28]="Zone28",e[e.Zone29=29]="Zone29",e[e.Zone30=30]="Zone30",e[e.Zone31=31]="Zone31",e[e.Zone0X=100]="Zone0X",e[e.Zone0Y=101]="Zone0Y",e[e.Zone1X=102]="Zone1X",e[e.Zone1Y=103]="Zone1Y",e[e.Zone2X=104]="Zone2X",e[e.Zone2Y=105]="Zone2Y",e[e.Zone3X=106]="Zone3X",e[e.Zone3Y=107]="Zone3Y",e[e.Zone4X=108]="Zone4X",e[e.Zone4Y=109]="Zone4Y",e[e.Zone5X=110]="Zone5X",e[e.Zone5Y=111]="Zone5Y",e[e.Zone6X=112]="Zone6X",e[e.Zone6Y=113]="Zone6Y",e[e.Zone7X=114]="Zone7X",e[e.Zone7Y=115]="Zone7Y",e[e.Zone8X=116]="Zone8X",e[e.Zone8Y=117]="Zone8Y",e[e.Zone9X=118]="Zone9X",e[e.Zone9Y=119]="Zone9Y",e[e.Zone10X=120]="Zone10X",e[e.Zone10Y=121]="Zone10Y",e[e.Zone11X=122]="Zone11X",e[e.Zone11Y=123]="Zone11Y",e[e.Zone12X=124]="Zone12X",e[e.Zone12Y=125]="Zone12Y",e[e.Zone13X=126]="Zone13X",e[e.Zone13Y=127]="Zone13Y",e[e.Zone14X=128]="Zone14X",e[e.Zone14Y=129]="Zone14Y",e[e.Zone15X=130]="Zone15X",e[e.Zone15Y=131]="Zone15Y",e[e.Zone16X=132]="Zone16X",e[e.Zone16Y=133]="Zone16Y",e[e.Zone17X=134]="Zone17X",e[e.Zone17Y=135]="Zone17Y",e[e.Zone18X=136]="Zone18X",e[e.Zone18Y=137]="Zone18Y",e[e.Zone19X=138]="Zone19X",e[e.Zone19Y=139]="Zone19Y",e[e.Zone20X=140]="Zone20X",e[e.Zone20Y=141]="Zone20Y",e[e.Zone21X=142]="Zone21X",e[e.Zone21Y=143]="Zone21Y",e[e.Zone22X=144]="Zone22X",e[e.Zone22Y=145]="Zone22Y",e[e.Zone23X=146]="Zone23X",e[e.Zone23Y=147]="Zone23Y",e[e.Zone24X=148]="Zone24X",e[e.Zone24Y=149]="Zone24Y",e[e.Zone25X=150]="Zone25X",e[e.Zone25Y=151]="Zone25Y",e[e.Zone26X=152]="Zone26X",e[e.Zone26Y=153]="Zone26Y",e[e.Zone27X=154]="Zone27X",e[e.Zone27Y=155]="Zone27Y",e[e.Zone28X=156]="Zone28X",e[e.Zone28Y=157]="Zone28Y",e[e.Zone29X=158]="Zone29X",e[e.Zone29Y=159]="Zone29Y",e[e.Zone30X=160]="Zone30X",e[e.Zone30Y=161]="Zone30Y",e[e.Zone31X=162]="Zone31X",e[e.Zone31Y=163]="Zone31Y",e))(w||{});function y(s){return s<100}g(y,"isTouchZoneButton");function V(s){return s>=100}g(V,"isTouchZonePosition");function b(s){return s<0||s>31?null:100+s*2}g(b,"getTouchZoneXAxis");function _(s){return s<0||s>31?null:101+s*2}g(_,"getTouchZoneYAxis");var C=(t=>(t[t.DPadUp=0]="DPadUp",t[t.DPadDown=1]="DPadDown",t[t.DPadLeft=2]="DPadLeft",t[t.DPadRight=3]="DPadRight",t[t.DPadCenter=4]="DPadCenter",t[t.Play=5]="Play",t[t.Pause=6]="Pause",t[t.PlayPause=7]="PlayPause",t[t.Stop=8]="Stop",t[t.Rewind=9]="Rewind",t[t.FastForward=10]="FastForward",t[t.Previous=11]="Previous",t[t.Next=12]="Next",t[t.Record=13]="Record",t[t.VolumeUp=15]="VolumeUp",t[t.VolumeDown=16]="VolumeDown",t[t.Mute=17]="Mute",t[t.ChannelUp=18]="ChannelUp",t[t.ChannelDown=19]="ChannelDown",t[t.Back=20]="Back",t[t.Home=21]="Home",t[t.Menu=22]="Menu",t[t.Info=23]="Info",t[t.Guide=24]="Guide",t[t.Exit=25]="Exit",t[t.Red=30]="Red",t[t.Green=31]="Green",t[t.Yellow=32]="Yellow",t[t.Blue=33]="Blue",t[t.Digit0=40]="Digit0",t[t.Digit1=41]="Digit1",t[t.Digit2=42]="Digit2",t[t.Digit3=43]="Digit3",t[t.Digit4=44]="Digit4",t[t.Digit5=45]="Digit5",t[t.Digit6=46]="Digit6",t[t.Digit7=47]="Digit7",t[t.Digit8=48]="Digit8",t[t.Digit9=49]="Digit9",t[t.Input=50]="Input",t[t.Settings=51]="Settings",t[t.Subtitle=52]="Subtitle",t[t.Audio=53]="Audio",t[t.Power=54]="Power",t[t.PointerX=100]="PointerX",t[t.PointerY=101]="PointerY",t[t.GyroX=102]="GyroX",t[t.GyroY=103]="GyroY",t[t.GyroZ=104]="GyroZ",t))(C||{});function R(s){return s<100}g(R,"isTVRemoteButton");function Z(s){return s>=100}g(Z,"isTVRemoteAxis");function K(s,r){return{device:s,input:r}}g(K,"createInputDescriptor");function H(s){switch(s.device){case 0:return!0;case 1:return s.input<100;case 2:return s.input<100;case 3:return s.input<100;case 7:return s.input<100;case 4:return s.input<100;default:return!1}}g(H,"isButton");function T(s){return!H(s)}g(T,"isAxis");function u(s){let r=new Uint8Array(3);return r[0]=s.device,r[1]=s.input&255,r[2]=s.input>>8&255,r}g(u,"serializeInputDescriptor");function p(s,r=0){let x=s[r],D=s[r+1]|s[r+2]<<8;return{device:x,input:D}}g(p,"deserializeInputDescriptor");function I(s){let r=X[s.device],x;switch(s.device){case 0:x=Y[s.input];break;case 1:x=z[s.input];break;case 2:x=A[s.input];break;case 3:x=B[s.input];break;case 7:x=w[s.input];break;case 4:x=C[s.input];break;default:x="Unknown"}return`${r}:${x}`}g(I,"inputDescriptorToString");function ii(s){let[r,x]=s.split(":");if(!r||!x)return null;let D=Object.entries(X).find(([S,f])=>S.toLowerCase()===r.toLowerCase()&&typeof f=="number")?.[1];if(D===void 0)return null;let o;switch(D){case 0:o=Y[x];break;case 1:o=z[x];break;case 2:o=A[x];break;case 3:o=B[x];break;case 4:o=C[x];break;case 7:o=w[x];break}return o===void 0?null:{device:D,input:o}}g(ii,"parseInputDescriptor");var m=class m{constructor(r=0,x=0){P(this,"x");P(this,"y");this.x=r,this.y=x}static zero(){return new m(0,0)}static one(){return new m(1,1)}static up(){return new m(0,-1)}static down(){return new m(0,1)}static left(){return new m(-1,0)}static right(){return new m(1,0)}add(r){return new m(this.x+r.x,this.y+r.y)}subtract(r){return new m(this.x-r.x,this.y-r.y)}multiply(r){return new m(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new m(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?m.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let x=Math.cos(r),D=Math.sin(r);return new m(this.x*x-this.y*D,this.x*D+this.y*x)}lerp(r,x){return new m(this.x+(r.x-this.x)*x,this.y+(r.y-this.y)*x)}clone(){return new m(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,x){return this.x=r,this.y=x,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};g(m,"Vector2");var L=m;var a=class a{constructor(r=0,x=0,D=0){P(this,"x");P(this,"y");P(this,"z");this.x=r,this.y=x,this.z=D}static zero(){return new a(0,0,0)}static one(){return new a(1,1,1)}static up(){return new a(0,1,0)}static down(){return new a(0,-1,0)}static left(){return new a(-1,0,0)}static right(){return new a(1,0,0)}static forward(){return new a(0,0,1)}static back(){return new a(0,0,-1)}add(r){return new a(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new a(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new a(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new a(this.x/r,this.y/r,this.z/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let r=this.length();return r===0?a.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new a(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,x){return new a(this.x+(r.x-this.x)*x,this.y+(r.y-this.y)*x,this.z+(r.z-this.z)*x)}clone(){return new a(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,x,D){return this.x=r,this.y=x,this.z=D,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};g(a,"Vector3");var k=a;var mi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},hi={color:"rgba(144, 24, 24, 1)",lineWidth:1};var ei=(f=>(f.None="none",f.Eighth="eighth",f.Quarter="quarter",f.Half="half",f.Integer="integer",f.Responsive="responsive",f))(ei||{}),ri=(f=>(f[f.None=0]="None",f[f.Eighth=1]="Eighth",f[f.Quarter=2]="Quarter",f[f.Half=3]="Half",f[f.Integer=4]="Integer",f[f.Responsive=5]="Responsive",f))(ri||{});function Di(s){switch(s){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}g(Di,"scalingModeToValue");function oi(s){switch(s){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}g(oi,"valueToScalingMode");var si=(S=>(S[S.Disconnected=0]="Disconnected",S[S.Connecting=1]="Connecting",S[S.Connected=2]="Connected",S[S.Reconnecting=3]="Reconnecting",S[S.Error=4]="Error",S))(si||{});var ti=(x=>(x.SocketIO="socketio",x.WebRTC="webrtc",x))(ti||{});var F=(n=>(n[n.Ping=0]="Ping",n[n.Pong=1]="Pong",n[n.Join=2]="Join",n[n.JoinResponse=3]="JoinResponse",n[n.SystemMessage=4]="SystemMessage",n[n.Input=16]="Input",n[n.Update=17]="Update",n[n.Audio=18]="Audio",n[n.Vibration=19]="Vibration",n[n.Load=48]="Load",n[n.Asset=49]="Asset",n))(F||{});function Si(s){return s in F}g(Si,"isNetworkEvent");
|
|
1
|
+
"use strict";var M=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var xi=Object.getOwnPropertyNames;var ci=Object.prototype.hasOwnProperty;var ni=(s,r,x)=>r in s?M(s,r,{enumerable:!0,configurable:!0,writable:!0,value:x}):s[r]=x;var g=(s,r)=>M(s,"name",{value:r,configurable:!0});var gi=(s,r)=>{for(var x in r)M(s,x,{get:r[x],enumerable:!0})},fi=(s,r,x,D)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of xi(r))!ci.call(s,o)&&o!==x&&M(s,o,{get:()=>r[o],enumerable:!(D=li(r,o))||D.enumerable});return s};var ai=s=>fi(M({},"__esModule",{value:!0}),s);var P=(s,r,x)=>(ni(s,typeof r!="symbol"?r+"":r,x),x);var Yi={};gi(Yi,{GRID_DEFAULTS:()=>hi,GamepadInput:()=>A,InputDeviceType:()=>X,KeyboardInput:()=>Y,MouseInput:()=>z,NetworkEvent:()=>F,NetworkState:()=>si,NetworkTransportType:()=>ti,POST_PROCESS_DEFAULTS:()=>mi,ScalingMode:()=>ei,ScalingModeValue:()=>ri,TVRemoteInput:()=>C,TouchInput:()=>B,TouchZoneInput:()=>w,Vector2:()=>L,Vector3:()=>k,createInputDescriptor:()=>K,deserializeInputDescriptor:()=>p,gamepadAxisIndexToInput:()=>d,gamepadButtonIndexToInput:()=>$,getTouchXAxis:()=>j,getTouchYAxis:()=>G,getTouchZoneXAxis:()=>b,getTouchZoneYAxis:()=>_,inputDescriptorToString:()=>I,isAxis:()=>T,isButton:()=>H,isGamepadAxis:()=>W,isGamepadButton:()=>Q,isMouseAxis:()=>U,isMouseButton:()=>E,isNetworkEvent:()=>Si,isTVRemoteAxis:()=>Z,isTVRemoteButton:()=>R,isTouchButton:()=>O,isTouchGesture:()=>N,isTouchPosition:()=>J,isTouchZoneButton:()=>y,isTouchZonePosition:()=>V,keyCodeToKeyboardInput:()=>v,keyboardInputToKeyCode:()=>q,parseInputDescriptor:()=>ii,scalingModeToValue:()=>Di,serializeInputDescriptor:()=>u,valueToScalingMode:()=>oi});module.exports=ai(Yi);var X=(h=>(h[h.Keyboard=0]="Keyboard",h[h.Mouse=1]="Mouse",h[h.Gamepad=2]="Gamepad",h[h.Touch=3]="Touch",h[h.TVRemote=4]="TVRemote",h[h.TextInput=5]="TextInput",h[h.Motion=6]="Motion",h[h.TouchZone=7]="TouchZone",h))(X||{});var Y=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(Y||{});function v(s){let r=Y[s];return r!==void 0?r:null}g(v,"keyCodeToKeyboardInput");function q(s){return Y[s]}g(q,"keyboardInputToKeyCode");var z=(n=>(n[n.LeftButton=0]="LeftButton",n[n.MiddleButton=1]="MiddleButton",n[n.RightButton=2]="RightButton",n[n.Button4=3]="Button4",n[n.Button5=4]="Button5",n[n.PositionX=100]="PositionX",n[n.PositionY=101]="PositionY",n[n.DeltaX=102]="DeltaX",n[n.DeltaY=103]="DeltaY",n[n.WheelDeltaY=104]="WheelDeltaY",n[n.WheelDeltaX=105]="WheelDeltaX",n))(z||{});function E(s){return s<100}g(E,"isMouseButton");function U(s){return s>=100}g(U,"isMouseAxis");var A=(c=>(c[c.ButtonA=0]="ButtonA",c[c.ButtonB=1]="ButtonB",c[c.ButtonX=2]="ButtonX",c[c.ButtonY=3]="ButtonY",c[c.LeftShoulder=4]="LeftShoulder",c[c.RightShoulder=5]="RightShoulder",c[c.LeftTrigger=6]="LeftTrigger",c[c.RightTrigger=7]="RightTrigger",c[c.Select=8]="Select",c[c.Start=9]="Start",c[c.LeftStick=10]="LeftStick",c[c.RightStick=11]="RightStick",c[c.DPadUp=12]="DPadUp",c[c.DPadDown=13]="DPadDown",c[c.DPadLeft=14]="DPadLeft",c[c.DPadRight=15]="DPadRight",c[c.Home=16]="Home",c[c.Touchpad=17]="Touchpad",c[c.LeftStickX=100]="LeftStickX",c[c.LeftStickY=101]="LeftStickY",c[c.RightStickX=102]="RightStickX",c[c.RightStickY=103]="RightStickY",c[c.LeftTriggerAxis=104]="LeftTriggerAxis",c[c.RightTriggerAxis=105]="RightTriggerAxis",c))(A||{});function Q(s){return s<100}g(Q,"isGamepadButton");function W(s){return s>=100}g(W,"isGamepadAxis");function $(s){return s>=0&&s<=19?s:null}g($,"gamepadButtonIndexToInput");function d(s){return{0:100,1:101,2:102,3:103}[s]??null}g(d,"gamepadAxisIndexToInput");var B=(l=>(l[l.Touch0=0]="Touch0",l[l.Touch1=1]="Touch1",l[l.Touch2=2]="Touch2",l[l.Touch3=3]="Touch3",l[l.Touch4=4]="Touch4",l[l.Touch5=5]="Touch5",l[l.Touch6=6]="Touch6",l[l.Touch7=7]="Touch7",l[l.Touch8=8]="Touch8",l[l.Touch9=9]="Touch9",l[l.Touch0X=100]="Touch0X",l[l.Touch0Y=101]="Touch0Y",l[l.Touch1X=102]="Touch1X",l[l.Touch1Y=103]="Touch1Y",l[l.Touch2X=104]="Touch2X",l[l.Touch2Y=105]="Touch2Y",l[l.Touch3X=106]="Touch3X",l[l.Touch3Y=107]="Touch3Y",l[l.Touch4X=108]="Touch4X",l[l.Touch4Y=109]="Touch4Y",l[l.Touch5X=110]="Touch5X",l[l.Touch5Y=111]="Touch5Y",l[l.Touch6X=112]="Touch6X",l[l.Touch6Y=113]="Touch6Y",l[l.Touch7X=114]="Touch7X",l[l.Touch7Y=115]="Touch7Y",l[l.Touch8X=116]="Touch8X",l[l.Touch8Y=117]="Touch8Y",l[l.Touch9X=118]="Touch9X",l[l.Touch9Y=119]="Touch9Y",l[l.PinchScale=200]="PinchScale",l[l.RotationAngle=201]="RotationAngle",l[l.SwipeVelocityX=202]="SwipeVelocityX",l[l.SwipeVelocityY=203]="SwipeVelocityY",l))(B||{});function O(s){return s<100}g(O,"isTouchButton");function J(s){return s>=100&&s<200}g(J,"isTouchPosition");function N(s){return s>=200}g(N,"isTouchGesture");function j(s){return s<0||s>9?null:100+s*2}g(j,"getTouchXAxis");function G(s){return s<0||s>9?null:101+s*2}g(G,"getTouchYAxis");var w=(e=>(e[e.Zone0=0]="Zone0",e[e.Zone1=1]="Zone1",e[e.Zone2=2]="Zone2",e[e.Zone3=3]="Zone3",e[e.Zone4=4]="Zone4",e[e.Zone5=5]="Zone5",e[e.Zone6=6]="Zone6",e[e.Zone7=7]="Zone7",e[e.Zone8=8]="Zone8",e[e.Zone9=9]="Zone9",e[e.Zone10=10]="Zone10",e[e.Zone11=11]="Zone11",e[e.Zone12=12]="Zone12",e[e.Zone13=13]="Zone13",e[e.Zone14=14]="Zone14",e[e.Zone15=15]="Zone15",e[e.Zone16=16]="Zone16",e[e.Zone17=17]="Zone17",e[e.Zone18=18]="Zone18",e[e.Zone19=19]="Zone19",e[e.Zone20=20]="Zone20",e[e.Zone21=21]="Zone21",e[e.Zone22=22]="Zone22",e[e.Zone23=23]="Zone23",e[e.Zone24=24]="Zone24",e[e.Zone25=25]="Zone25",e[e.Zone26=26]="Zone26",e[e.Zone27=27]="Zone27",e[e.Zone28=28]="Zone28",e[e.Zone29=29]="Zone29",e[e.Zone30=30]="Zone30",e[e.Zone31=31]="Zone31",e[e.Zone0X=100]="Zone0X",e[e.Zone0Y=101]="Zone0Y",e[e.Zone1X=102]="Zone1X",e[e.Zone1Y=103]="Zone1Y",e[e.Zone2X=104]="Zone2X",e[e.Zone2Y=105]="Zone2Y",e[e.Zone3X=106]="Zone3X",e[e.Zone3Y=107]="Zone3Y",e[e.Zone4X=108]="Zone4X",e[e.Zone4Y=109]="Zone4Y",e[e.Zone5X=110]="Zone5X",e[e.Zone5Y=111]="Zone5Y",e[e.Zone6X=112]="Zone6X",e[e.Zone6Y=113]="Zone6Y",e[e.Zone7X=114]="Zone7X",e[e.Zone7Y=115]="Zone7Y",e[e.Zone8X=116]="Zone8X",e[e.Zone8Y=117]="Zone8Y",e[e.Zone9X=118]="Zone9X",e[e.Zone9Y=119]="Zone9Y",e[e.Zone10X=120]="Zone10X",e[e.Zone10Y=121]="Zone10Y",e[e.Zone11X=122]="Zone11X",e[e.Zone11Y=123]="Zone11Y",e[e.Zone12X=124]="Zone12X",e[e.Zone12Y=125]="Zone12Y",e[e.Zone13X=126]="Zone13X",e[e.Zone13Y=127]="Zone13Y",e[e.Zone14X=128]="Zone14X",e[e.Zone14Y=129]="Zone14Y",e[e.Zone15X=130]="Zone15X",e[e.Zone15Y=131]="Zone15Y",e[e.Zone16X=132]="Zone16X",e[e.Zone16Y=133]="Zone16Y",e[e.Zone17X=134]="Zone17X",e[e.Zone17Y=135]="Zone17Y",e[e.Zone18X=136]="Zone18X",e[e.Zone18Y=137]="Zone18Y",e[e.Zone19X=138]="Zone19X",e[e.Zone19Y=139]="Zone19Y",e[e.Zone20X=140]="Zone20X",e[e.Zone20Y=141]="Zone20Y",e[e.Zone21X=142]="Zone21X",e[e.Zone21Y=143]="Zone21Y",e[e.Zone22X=144]="Zone22X",e[e.Zone22Y=145]="Zone22Y",e[e.Zone23X=146]="Zone23X",e[e.Zone23Y=147]="Zone23Y",e[e.Zone24X=148]="Zone24X",e[e.Zone24Y=149]="Zone24Y",e[e.Zone25X=150]="Zone25X",e[e.Zone25Y=151]="Zone25Y",e[e.Zone26X=152]="Zone26X",e[e.Zone26Y=153]="Zone26Y",e[e.Zone27X=154]="Zone27X",e[e.Zone27Y=155]="Zone27Y",e[e.Zone28X=156]="Zone28X",e[e.Zone28Y=157]="Zone28Y",e[e.Zone29X=158]="Zone29X",e[e.Zone29Y=159]="Zone29Y",e[e.Zone30X=160]="Zone30X",e[e.Zone30Y=161]="Zone30Y",e[e.Zone31X=162]="Zone31X",e[e.Zone31Y=163]="Zone31Y",e))(w||{});function y(s){return s<100}g(y,"isTouchZoneButton");function V(s){return s>=100}g(V,"isTouchZonePosition");function b(s){return s<0||s>31?null:100+s*2}g(b,"getTouchZoneXAxis");function _(s){return s<0||s>31?null:101+s*2}g(_,"getTouchZoneYAxis");var C=(t=>(t[t.DPadUp=0]="DPadUp",t[t.DPadDown=1]="DPadDown",t[t.DPadLeft=2]="DPadLeft",t[t.DPadRight=3]="DPadRight",t[t.DPadCenter=4]="DPadCenter",t[t.Play=5]="Play",t[t.Pause=6]="Pause",t[t.PlayPause=7]="PlayPause",t[t.Stop=8]="Stop",t[t.Rewind=9]="Rewind",t[t.FastForward=10]="FastForward",t[t.Previous=11]="Previous",t[t.Next=12]="Next",t[t.Record=13]="Record",t[t.VolumeUp=15]="VolumeUp",t[t.VolumeDown=16]="VolumeDown",t[t.Mute=17]="Mute",t[t.ChannelUp=18]="ChannelUp",t[t.ChannelDown=19]="ChannelDown",t[t.Back=20]="Back",t[t.Home=21]="Home",t[t.Menu=22]="Menu",t[t.Info=23]="Info",t[t.Guide=24]="Guide",t[t.Exit=25]="Exit",t[t.Red=30]="Red",t[t.Green=31]="Green",t[t.Yellow=32]="Yellow",t[t.Blue=33]="Blue",t[t.Digit0=40]="Digit0",t[t.Digit1=41]="Digit1",t[t.Digit2=42]="Digit2",t[t.Digit3=43]="Digit3",t[t.Digit4=44]="Digit4",t[t.Digit5=45]="Digit5",t[t.Digit6=46]="Digit6",t[t.Digit7=47]="Digit7",t[t.Digit8=48]="Digit8",t[t.Digit9=49]="Digit9",t[t.Input=50]="Input",t[t.Settings=51]="Settings",t[t.Subtitle=52]="Subtitle",t[t.Audio=53]="Audio",t[t.Power=54]="Power",t[t.PointerX=100]="PointerX",t[t.PointerY=101]="PointerY",t[t.GyroX=102]="GyroX",t[t.GyroY=103]="GyroY",t[t.GyroZ=104]="GyroZ",t))(C||{});function R(s){return s<100}g(R,"isTVRemoteButton");function Z(s){return s>=100}g(Z,"isTVRemoteAxis");function K(s,r){return{device:s,input:r}}g(K,"createInputDescriptor");function H(s){switch(s.device){case 0:return!0;case 1:return s.input<100;case 2:return s.input<100;case 3:return s.input<100;case 7:return s.input<100;case 4:return s.input<100;default:return!1}}g(H,"isButton");function T(s){return!H(s)}g(T,"isAxis");function u(s){let r=new Uint8Array(3);return r[0]=s.device,r[1]=s.input&255,r[2]=s.input>>8&255,r}g(u,"serializeInputDescriptor");function p(s,r=0){let x=s[r],D=s[r+1]|s[r+2]<<8;return{device:x,input:D}}g(p,"deserializeInputDescriptor");function I(s){let r=X[s.device],x;switch(s.device){case 0:x=Y[s.input];break;case 1:x=z[s.input];break;case 2:x=A[s.input];break;case 3:x=B[s.input];break;case 7:x=w[s.input];break;case 4:x=C[s.input];break;default:x="Unknown"}return`${r}:${x}`}g(I,"inputDescriptorToString");function ii(s){let[r,x]=s.split(":");if(!r||!x)return null;let D=Object.entries(X).find(([S,f])=>S.toLowerCase()===r.toLowerCase()&&typeof f=="number")?.[1];if(D===void 0)return null;let o;switch(D){case 0:o=Y[x];break;case 1:o=z[x];break;case 2:o=A[x];break;case 3:o=B[x];break;case 4:o=C[x];break;case 7:o=w[x];break}return o===void 0?null:{device:D,input:o}}g(ii,"parseInputDescriptor");var m=class m{constructor(r=0,x=0){P(this,"x");P(this,"y");this.x=r,this.y=x}static zero(){return new m(0,0)}static one(){return new m(1,1)}static up(){return new m(0,-1)}static down(){return new m(0,1)}static left(){return new m(-1,0)}static right(){return new m(1,0)}add(r){return new m(this.x+r.x,this.y+r.y)}subtract(r){return new m(this.x-r.x,this.y-r.y)}multiply(r){return new m(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new m(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?m.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let x=Math.cos(r),D=Math.sin(r);return new m(this.x*x-this.y*D,this.x*D+this.y*x)}lerp(r,x){return new m(this.x+(r.x-this.x)*x,this.y+(r.y-this.y)*x)}clone(){return new m(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,x){return this.x=r,this.y=x,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};g(m,"Vector2");var L=m;var a=class a{constructor(r=0,x=0,D=0){P(this,"x");P(this,"y");P(this,"z");this.x=r,this.y=x,this.z=D}static zero(){return new a(0,0,0)}static one(){return new a(1,1,1)}static up(){return new a(0,1,0)}static down(){return new a(0,-1,0)}static left(){return new a(-1,0,0)}static right(){return new a(1,0,0)}static forward(){return new a(0,0,1)}static back(){return new a(0,0,-1)}add(r){return new a(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new a(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new a(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new a(this.x/r,this.y/r,this.z/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let r=this.length();return r===0?a.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new a(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,x){return new a(this.x+(r.x-this.x)*x,this.y+(r.y-this.y)*x,this.z+(r.z-this.z)*x)}clone(){return new a(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,x,D){return this.x=r,this.y=x,this.z=D,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};g(a,"Vector3");var k=a;var mi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},hi={color:"rgba(144, 24, 24, 1)",lineWidth:1};var ei=(f=>(f.None="none",f.Eighth="eighth",f.Quarter="quarter",f.Half="half",f.Integer="integer",f.Responsive="responsive",f))(ei||{}),ri=(f=>(f[f.None=0]="None",f[f.Eighth=1]="Eighth",f[f.Quarter=2]="Quarter",f[f.Half=3]="Half",f[f.Integer=4]="Integer",f[f.Responsive=5]="Responsive",f))(ri||{});function Di(s){switch(s){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}g(Di,"scalingModeToValue");function oi(s){switch(s){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}g(oi,"valueToScalingMode");var si=(S=>(S[S.Disconnected=0]="Disconnected",S[S.Connecting=1]="Connecting",S[S.Connected=2]="Connected",S[S.Reconnecting=3]="Reconnecting",S[S.Error=4]="Error",S))(si||{});var ti=(x=>(x.SocketIO="socketio",x.WebRTC="webrtc",x))(ti||{});var F=(n=>(n[n.Ping=0]="Ping",n[n.Pong=1]="Pong",n[n.Join=2]="Join",n[n.JoinResponse=3]="JoinResponse",n[n.SystemMessage=4]="SystemMessage",n[n.Input=16]="Input",n[n.Update=17]="Update",n[n.Audio=18]="Audio",n[n.Vibration=19]="Vibration",n[n.Load=48]="Load",n[n.Asset=49]="Asset",n))(F||{});function Si(s){return s in F}g(Si,"isNetworkEvent");
|
package/dist/index.d.ts
CHANGED
|
@@ -1232,6 +1232,8 @@ interface INetworkClient {
|
|
|
1232
1232
|
disconnect(): void;
|
|
1233
1233
|
/** Send event to server */
|
|
1234
1234
|
send(event: string, data: any): void;
|
|
1235
|
+
/** Send volatile event to server (unreliable/UDP-like where supported) */
|
|
1236
|
+
sendVolatile?(event: string, data: any): void;
|
|
1235
1237
|
/** Listen for server events */
|
|
1236
1238
|
on<T = any>(event: string, handler: NetworkEventHandler<T>): void;
|
|
1237
1239
|
/** Remove event listener */
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var k=Object.defineProperty;var q=(t,r,c)=>r in t?k(t,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[r]=c;var g=(t,r)=>k(t,"name",{value:r,configurable:!0});var Y=(t,r,c)=>(q(t,typeof r!="symbol"?r+"":r,c),c);var X=(h=>(h[h.Keyboard=0]="Keyboard",h[h.Mouse=1]="Mouse",h[h.Gamepad=2]="Gamepad",h[h.Touch=3]="Touch",h[h.TVRemote=4]="TVRemote",h[h.TextInput=5]="TextInput",h[h.Motion=6]="Motion",h[h.TouchZone=7]="TouchZone",h))(X||{});var P=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(P||{});function E(t){let r=P[t];return r!==void 0?r:null}g(E,"keyCodeToKeyboardInput");function U(t){return P[t]}g(U,"keyboardInputToKeyCode");var z=(n=>(n[n.LeftButton=0]="LeftButton",n[n.MiddleButton=1]="MiddleButton",n[n.RightButton=2]="RightButton",n[n.Button4=3]="Button4",n[n.Button5=4]="Button5",n[n.PositionX=100]="PositionX",n[n.PositionY=101]="PositionY",n[n.DeltaX=102]="DeltaX",n[n.DeltaY=103]="DeltaY",n[n.WheelDeltaY=104]="WheelDeltaY",n[n.WheelDeltaX=105]="WheelDeltaX",n))(z||{});function v(t){return t<100}g(v,"isMouseButton");function Q(t){return t>=100}g(Q,"isMouseAxis");var A=(x=>(x[x.ButtonA=0]="ButtonA",x[x.ButtonB=1]="ButtonB",x[x.ButtonX=2]="ButtonX",x[x.ButtonY=3]="ButtonY",x[x.LeftShoulder=4]="LeftShoulder",x[x.RightShoulder=5]="RightShoulder",x[x.LeftTrigger=6]="LeftTrigger",x[x.RightTrigger=7]="RightTrigger",x[x.Select=8]="Select",x[x.Start=9]="Start",x[x.LeftStick=10]="LeftStick",x[x.RightStick=11]="RightStick",x[x.DPadUp=12]="DPadUp",x[x.DPadDown=13]="DPadDown",x[x.DPadLeft=14]="DPadLeft",x[x.DPadRight=15]="DPadRight",x[x.Home=16]="Home",x[x.Touchpad=17]="Touchpad",x[x.LeftStickX=100]="LeftStickX",x[x.LeftStickY=101]="LeftStickY",x[x.RightStickX=102]="RightStickX",x[x.RightStickY=103]="RightStickY",x[x.LeftTriggerAxis=104]="LeftTriggerAxis",x[x.RightTriggerAxis=105]="RightTriggerAxis",x))(A||{});function W(t){return t<100}g(W,"isGamepadButton");function $(t){return t>=100}g($,"isGamepadAxis");function O(t){return t>=0&&t<=19?t:null}g(O,"gamepadButtonIndexToInput");function d(t){return{0:100,1:101,2:102,3:103}[t]??null}g(d,"gamepadAxisIndexToInput");var B=(l=>(l[l.Touch0=0]="Touch0",l[l.Touch1=1]="Touch1",l[l.Touch2=2]="Touch2",l[l.Touch3=3]="Touch3",l[l.Touch4=4]="Touch4",l[l.Touch5=5]="Touch5",l[l.Touch6=6]="Touch6",l[l.Touch7=7]="Touch7",l[l.Touch8=8]="Touch8",l[l.Touch9=9]="Touch9",l[l.Touch0X=100]="Touch0X",l[l.Touch0Y=101]="Touch0Y",l[l.Touch1X=102]="Touch1X",l[l.Touch1Y=103]="Touch1Y",l[l.Touch2X=104]="Touch2X",l[l.Touch2Y=105]="Touch2Y",l[l.Touch3X=106]="Touch3X",l[l.Touch3Y=107]="Touch3Y",l[l.Touch4X=108]="Touch4X",l[l.Touch4Y=109]="Touch4Y",l[l.Touch5X=110]="Touch5X",l[l.Touch5Y=111]="Touch5Y",l[l.Touch6X=112]="Touch6X",l[l.Touch6Y=113]="Touch6Y",l[l.Touch7X=114]="Touch7X",l[l.Touch7Y=115]="Touch7Y",l[l.Touch8X=116]="Touch8X",l[l.Touch8Y=117]="Touch8Y",l[l.Touch9X=118]="Touch9X",l[l.Touch9Y=119]="Touch9Y",l[l.PinchScale=200]="PinchScale",l[l.RotationAngle=201]="RotationAngle",l[l.SwipeVelocityX=202]="SwipeVelocityX",l[l.SwipeVelocityY=203]="SwipeVelocityY",l))(B||{});function J(t){return t<100}g(J,"isTouchButton");function N(t){return t>=100&&t<200}g(N,"isTouchPosition");function j(t){return t>=200}g(j,"isTouchGesture");function G(t){return t<0||t>9?null:100+t*2}g(G,"getTouchXAxis");function y(t){return t<0||t>9?null:101+t*2}g(y,"getTouchYAxis");var w=(e=>(e[e.Zone0=0]="Zone0",e[e.Zone1=1]="Zone1",e[e.Zone2=2]="Zone2",e[e.Zone3=3]="Zone3",e[e.Zone4=4]="Zone4",e[e.Zone5=5]="Zone5",e[e.Zone6=6]="Zone6",e[e.Zone7=7]="Zone7",e[e.Zone8=8]="Zone8",e[e.Zone9=9]="Zone9",e[e.Zone10=10]="Zone10",e[e.Zone11=11]="Zone11",e[e.Zone12=12]="Zone12",e[e.Zone13=13]="Zone13",e[e.Zone14=14]="Zone14",e[e.Zone15=15]="Zone15",e[e.Zone16=16]="Zone16",e[e.Zone17=17]="Zone17",e[e.Zone18=18]="Zone18",e[e.Zone19=19]="Zone19",e[e.Zone20=20]="Zone20",e[e.Zone21=21]="Zone21",e[e.Zone22=22]="Zone22",e[e.Zone23=23]="Zone23",e[e.Zone24=24]="Zone24",e[e.Zone25=25]="Zone25",e[e.Zone26=26]="Zone26",e[e.Zone27=27]="Zone27",e[e.Zone28=28]="Zone28",e[e.Zone29=29]="Zone29",e[e.Zone30=30]="Zone30",e[e.Zone31=31]="Zone31",e[e.Zone0X=100]="Zone0X",e[e.Zone0Y=101]="Zone0Y",e[e.Zone1X=102]="Zone1X",e[e.Zone1Y=103]="Zone1Y",e[e.Zone2X=104]="Zone2X",e[e.Zone2Y=105]="Zone2Y",e[e.Zone3X=106]="Zone3X",e[e.Zone3Y=107]="Zone3Y",e[e.Zone4X=108]="Zone4X",e[e.Zone4Y=109]="Zone4Y",e[e.Zone5X=110]="Zone5X",e[e.Zone5Y=111]="Zone5Y",e[e.Zone6X=112]="Zone6X",e[e.Zone6Y=113]="Zone6Y",e[e.Zone7X=114]="Zone7X",e[e.Zone7Y=115]="Zone7Y",e[e.Zone8X=116]="Zone8X",e[e.Zone8Y=117]="Zone8Y",e[e.Zone9X=118]="Zone9X",e[e.Zone9Y=119]="Zone9Y",e[e.Zone10X=120]="Zone10X",e[e.Zone10Y=121]="Zone10Y",e[e.Zone11X=122]="Zone11X",e[e.Zone11Y=123]="Zone11Y",e[e.Zone12X=124]="Zone12X",e[e.Zone12Y=125]="Zone12Y",e[e.Zone13X=126]="Zone13X",e[e.Zone13Y=127]="Zone13Y",e[e.Zone14X=128]="Zone14X",e[e.Zone14Y=129]="Zone14Y",e[e.Zone15X=130]="Zone15X",e[e.Zone15Y=131]="Zone15Y",e[e.Zone16X=132]="Zone16X",e[e.Zone16Y=133]="Zone16Y",e[e.Zone17X=134]="Zone17X",e[e.Zone17Y=135]="Zone17Y",e[e.Zone18X=136]="Zone18X",e[e.Zone18Y=137]="Zone18Y",e[e.Zone19X=138]="Zone19X",e[e.Zone19Y=139]="Zone19Y",e[e.Zone20X=140]="Zone20X",e[e.Zone20Y=141]="Zone20Y",e[e.Zone21X=142]="Zone21X",e[e.Zone21Y=143]="Zone21Y",e[e.Zone22X=144]="Zone22X",e[e.Zone22Y=145]="Zone22Y",e[e.Zone23X=146]="Zone23X",e[e.Zone23Y=147]="Zone23Y",e[e.Zone24X=148]="Zone24X",e[e.Zone24Y=149]="Zone24Y",e[e.Zone25X=150]="Zone25X",e[e.Zone25Y=151]="Zone25Y",e[e.Zone26X=152]="Zone26X",e[e.Zone26Y=153]="Zone26Y",e[e.Zone27X=154]="Zone27X",e[e.Zone27Y=155]="Zone27Y",e[e.Zone28X=156]="Zone28X",e[e.Zone28Y=157]="Zone28Y",e[e.Zone29X=158]="Zone29X",e[e.Zone29Y=159]="Zone29Y",e[e.Zone30X=160]="Zone30X",e[e.Zone30Y=161]="Zone30Y",e[e.Zone31X=162]="Zone31X",e[e.Zone31Y=163]="Zone31Y",e))(w||{});function V(t){return t<100}g(V,"isTouchZoneButton");function b(t){return t>=100}g(b,"isTouchZonePosition");function _(t){return t<0||t>31?null:100+t*2}g(_,"getTouchZoneXAxis");function R(t){return t<0||t>31?null:101+t*2}g(R,"getTouchZoneYAxis");var C=(s=>(s[s.DPadUp=0]="DPadUp",s[s.DPadDown=1]="DPadDown",s[s.DPadLeft=2]="DPadLeft",s[s.DPadRight=3]="DPadRight",s[s.DPadCenter=4]="DPadCenter",s[s.Play=5]="Play",s[s.Pause=6]="Pause",s[s.PlayPause=7]="PlayPause",s[s.Stop=8]="Stop",s[s.Rewind=9]="Rewind",s[s.FastForward=10]="FastForward",s[s.Previous=11]="Previous",s[s.Next=12]="Next",s[s.Record=13]="Record",s[s.VolumeUp=15]="VolumeUp",s[s.VolumeDown=16]="VolumeDown",s[s.Mute=17]="Mute",s[s.ChannelUp=18]="ChannelUp",s[s.ChannelDown=19]="ChannelDown",s[s.Back=20]="Back",s[s.Home=21]="Home",s[s.Menu=22]="Menu",s[s.Info=23]="Info",s[s.Guide=24]="Guide",s[s.Exit=25]="Exit",s[s.Red=30]="Red",s[s.Green=31]="Green",s[s.Yellow=32]="Yellow",s[s.Blue=33]="Blue",s[s.Digit0=40]="Digit0",s[s.Digit1=41]="Digit1",s[s.Digit2=42]="Digit2",s[s.Digit3=43]="Digit3",s[s.Digit4=44]="Digit4",s[s.Digit5=45]="Digit5",s[s.Digit6=46]="Digit6",s[s.Digit7=47]="Digit7",s[s.Digit8=48]="Digit8",s[s.Digit9=49]="Digit9",s[s.Input=50]="Input",s[s.Settings=51]="Settings",s[s.Subtitle=52]="Subtitle",s[s.Audio=53]="Audio",s[s.Power=54]="Power",s[s.PointerX=100]="PointerX",s[s.PointerY=101]="PointerY",s[s.GyroX=102]="GyroX",s[s.GyroY=103]="GyroY",s[s.GyroZ=104]="GyroZ",s))(C||{});function Z(t){return t<100}g(Z,"isTVRemoteButton");function K(t){return t>=100}g(K,"isTVRemoteAxis");function T(t,r){return{device:t,input:r}}g(T,"createInputDescriptor");function H(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 7:return t.input<100;case 4:return t.input<100;default:return!1}}g(H,"isButton");function u(t){return!H(t)}g(u,"isAxis");function p(t){let r=new Uint8Array(3);return r[0]=t.device,r[1]=t.input&255,r[2]=t.input>>8&255,r}g(p,"serializeInputDescriptor");function I(t,r=0){let c=t[r],D=t[r+1]|t[r+2]<<8;return{device:c,input:D}}g(I,"deserializeInputDescriptor");function ii(t){let r=X[t.device],c;switch(t.device){case 0:c=P[t.input];break;case 1:c=z[t.input];break;case 2:c=A[t.input];break;case 3:c=B[t.input];break;case 7:c=w[t.input];break;case 4:c=C[t.input];break;default:c="Unknown"}return`${r}:${c}`}g(ii,"inputDescriptorToString");function ei(t){let[r,c]=t.split(":");if(!r||!c)return null;let D=Object.entries(X).find(([o,f])=>o.toLowerCase()===r.toLowerCase()&&typeof f=="number")?.[1];if(D===void 0)return null;let S;switch(D){case 0:S=P[c];break;case 1:S=z[c];break;case 2:S=A[c];break;case 3:S=B[c];break;case 4:S=C[c];break;case 7:S=w[c];break}return S===void 0?null:{device:D,input:S}}g(ei,"parseInputDescriptor");var m=class m{constructor(r=0,c=0){Y(this,"x");Y(this,"y");this.x=r,this.y=c}static zero(){return new m(0,0)}static one(){return new m(1,1)}static up(){return new m(0,-1)}static down(){return new m(0,1)}static left(){return new m(-1,0)}static right(){return new m(1,0)}add(r){return new m(this.x+r.x,this.y+r.y)}subtract(r){return new m(this.x-r.x,this.y-r.y)}multiply(r){return new m(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new m(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?m.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let c=Math.cos(r),D=Math.sin(r);return new m(this.x*c-this.y*D,this.x*D+this.y*c)}lerp(r,c){return new m(this.x+(r.x-this.x)*c,this.y+(r.y-this.y)*c)}clone(){return new m(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,c){return this.x=r,this.y=c,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};g(m,"Vector2");var M=m;var a=class a{constructor(r=0,c=0,D=0){Y(this,"x");Y(this,"y");Y(this,"z");this.x=r,this.y=c,this.z=D}static zero(){return new a(0,0,0)}static one(){return new a(1,1,1)}static up(){return new a(0,1,0)}static down(){return new a(0,-1,0)}static left(){return new a(-1,0,0)}static right(){return new a(1,0,0)}static forward(){return new a(0,0,1)}static back(){return new a(0,0,-1)}add(r){return new a(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new a(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new a(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new a(this.x/r,this.y/r,this.z/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let r=this.length();return r===0?a.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new a(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,c){return new a(this.x+(r.x-this.x)*c,this.y+(r.y-this.y)*c,this.z+(r.z-this.z)*c)}clone(){return new a(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,c,D){return this.x=r,this.y=c,this.z=D,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};g(a,"Vector3");var L=a;var bi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},_i={color:"rgba(144, 24, 24, 1)",lineWidth:1};var ri=(f=>(f.None="none",f.Eighth="eighth",f.Quarter="quarter",f.Half="half",f.Integer="integer",f.Responsive="responsive",f))(ri||{}),si=(f=>(f[f.None=0]="None",f[f.Eighth=1]="Eighth",f[f.Quarter=2]="Quarter",f[f.Half=3]="Half",f[f.Integer=4]="Integer",f[f.Responsive=5]="Responsive",f))(si||{});function Zi(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}g(Zi,"scalingModeToValue");function Ki(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}g(Ki,"valueToScalingMode");var ti=(o=>(o[o.Disconnected=0]="Disconnected",o[o.Connecting=1]="Connecting",o[o.Connected=2]="Connected",o[o.Reconnecting=3]="Reconnecting",o[o.Error=4]="Error",o))(ti||{});var li=(c=>(c.SocketIO="socketio",c.WebRTC="webrtc",c))(li||{});var F=(n=>(n[n.Ping=0]="Ping",n[n.Pong=1]="Pong",n[n.Join=2]="Join",n[n.JoinResponse=3]="JoinResponse",n[n.SystemMessage=4]="SystemMessage",n[n.Input=16]="Input",n[n.Update=17]="Update",n[n.Audio=18]="Audio",n[n.Vibration=19]="Vibration",n[n.Load=48]="Load",n[n.Asset=49]="Asset",n))(F||{});function ie(t){return t in F}g(ie,"isNetworkEvent");export{_i as GRID_DEFAULTS,A as GamepadInput,X as InputDeviceType,P as KeyboardInput,z as MouseInput,F as NetworkEvent,ti as NetworkState,li as NetworkTransportType,bi as POST_PROCESS_DEFAULTS,ri as ScalingMode,si as ScalingModeValue,C as TVRemoteInput,B as TouchInput,w as TouchZoneInput,M as Vector2,L as Vector3,T as createInputDescriptor,I as deserializeInputDescriptor,d as gamepadAxisIndexToInput,O as gamepadButtonIndexToInput,G as getTouchXAxis,y as getTouchYAxis,_ as getTouchZoneXAxis,R as getTouchZoneYAxis,ii as inputDescriptorToString,u as isAxis,H as isButton,$ as isGamepadAxis,W as isGamepadButton,Q as isMouseAxis,v as isMouseButton,ie as isNetworkEvent,K as isTVRemoteAxis,Z as isTVRemoteButton,J as isTouchButton,j as isTouchGesture,N as isTouchPosition,V as isTouchZoneButton,b as isTouchZonePosition,E as keyCodeToKeyboardInput,U as keyboardInputToKeyCode,ei as parseInputDescriptor,Zi as scalingModeToValue,p as serializeInputDescriptor,Ki as valueToScalingMode};
|
|
1
|
+
var k=Object.defineProperty;var v=(t,r,c)=>r in t?k(t,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[r]=c;var g=(t,r)=>k(t,"name",{value:r,configurable:!0});var Y=(t,r,c)=>(v(t,typeof r!="symbol"?r+"":r,c),c);var X=(h=>(h[h.Keyboard=0]="Keyboard",h[h.Mouse=1]="Mouse",h[h.Gamepad=2]="Gamepad",h[h.Touch=3]="Touch",h[h.TVRemote=4]="TVRemote",h[h.TextInput=5]="TextInput",h[h.Motion=6]="Motion",h[h.TouchZone=7]="TouchZone",h))(X||{});var P=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(P||{});function q(t){let r=P[t];return r!==void 0?r:null}g(q,"keyCodeToKeyboardInput");function E(t){return P[t]}g(E,"keyboardInputToKeyCode");var z=(n=>(n[n.LeftButton=0]="LeftButton",n[n.MiddleButton=1]="MiddleButton",n[n.RightButton=2]="RightButton",n[n.Button4=3]="Button4",n[n.Button5=4]="Button5",n[n.PositionX=100]="PositionX",n[n.PositionY=101]="PositionY",n[n.DeltaX=102]="DeltaX",n[n.DeltaY=103]="DeltaY",n[n.WheelDeltaY=104]="WheelDeltaY",n[n.WheelDeltaX=105]="WheelDeltaX",n))(z||{});function U(t){return t<100}g(U,"isMouseButton");function Q(t){return t>=100}g(Q,"isMouseAxis");var A=(x=>(x[x.ButtonA=0]="ButtonA",x[x.ButtonB=1]="ButtonB",x[x.ButtonX=2]="ButtonX",x[x.ButtonY=3]="ButtonY",x[x.LeftShoulder=4]="LeftShoulder",x[x.RightShoulder=5]="RightShoulder",x[x.LeftTrigger=6]="LeftTrigger",x[x.RightTrigger=7]="RightTrigger",x[x.Select=8]="Select",x[x.Start=9]="Start",x[x.LeftStick=10]="LeftStick",x[x.RightStick=11]="RightStick",x[x.DPadUp=12]="DPadUp",x[x.DPadDown=13]="DPadDown",x[x.DPadLeft=14]="DPadLeft",x[x.DPadRight=15]="DPadRight",x[x.Home=16]="Home",x[x.Touchpad=17]="Touchpad",x[x.LeftStickX=100]="LeftStickX",x[x.LeftStickY=101]="LeftStickY",x[x.RightStickX=102]="RightStickX",x[x.RightStickY=103]="RightStickY",x[x.LeftTriggerAxis=104]="LeftTriggerAxis",x[x.RightTriggerAxis=105]="RightTriggerAxis",x))(A||{});function W(t){return t<100}g(W,"isGamepadButton");function $(t){return t>=100}g($,"isGamepadAxis");function d(t){return t>=0&&t<=19?t:null}g(d,"gamepadButtonIndexToInput");function O(t){return{0:100,1:101,2:102,3:103}[t]??null}g(O,"gamepadAxisIndexToInput");var B=(l=>(l[l.Touch0=0]="Touch0",l[l.Touch1=1]="Touch1",l[l.Touch2=2]="Touch2",l[l.Touch3=3]="Touch3",l[l.Touch4=4]="Touch4",l[l.Touch5=5]="Touch5",l[l.Touch6=6]="Touch6",l[l.Touch7=7]="Touch7",l[l.Touch8=8]="Touch8",l[l.Touch9=9]="Touch9",l[l.Touch0X=100]="Touch0X",l[l.Touch0Y=101]="Touch0Y",l[l.Touch1X=102]="Touch1X",l[l.Touch1Y=103]="Touch1Y",l[l.Touch2X=104]="Touch2X",l[l.Touch2Y=105]="Touch2Y",l[l.Touch3X=106]="Touch3X",l[l.Touch3Y=107]="Touch3Y",l[l.Touch4X=108]="Touch4X",l[l.Touch4Y=109]="Touch4Y",l[l.Touch5X=110]="Touch5X",l[l.Touch5Y=111]="Touch5Y",l[l.Touch6X=112]="Touch6X",l[l.Touch6Y=113]="Touch6Y",l[l.Touch7X=114]="Touch7X",l[l.Touch7Y=115]="Touch7Y",l[l.Touch8X=116]="Touch8X",l[l.Touch8Y=117]="Touch8Y",l[l.Touch9X=118]="Touch9X",l[l.Touch9Y=119]="Touch9Y",l[l.PinchScale=200]="PinchScale",l[l.RotationAngle=201]="RotationAngle",l[l.SwipeVelocityX=202]="SwipeVelocityX",l[l.SwipeVelocityY=203]="SwipeVelocityY",l))(B||{});function J(t){return t<100}g(J,"isTouchButton");function N(t){return t>=100&&t<200}g(N,"isTouchPosition");function j(t){return t>=200}g(j,"isTouchGesture");function G(t){return t<0||t>9?null:100+t*2}g(G,"getTouchXAxis");function y(t){return t<0||t>9?null:101+t*2}g(y,"getTouchYAxis");var w=(e=>(e[e.Zone0=0]="Zone0",e[e.Zone1=1]="Zone1",e[e.Zone2=2]="Zone2",e[e.Zone3=3]="Zone3",e[e.Zone4=4]="Zone4",e[e.Zone5=5]="Zone5",e[e.Zone6=6]="Zone6",e[e.Zone7=7]="Zone7",e[e.Zone8=8]="Zone8",e[e.Zone9=9]="Zone9",e[e.Zone10=10]="Zone10",e[e.Zone11=11]="Zone11",e[e.Zone12=12]="Zone12",e[e.Zone13=13]="Zone13",e[e.Zone14=14]="Zone14",e[e.Zone15=15]="Zone15",e[e.Zone16=16]="Zone16",e[e.Zone17=17]="Zone17",e[e.Zone18=18]="Zone18",e[e.Zone19=19]="Zone19",e[e.Zone20=20]="Zone20",e[e.Zone21=21]="Zone21",e[e.Zone22=22]="Zone22",e[e.Zone23=23]="Zone23",e[e.Zone24=24]="Zone24",e[e.Zone25=25]="Zone25",e[e.Zone26=26]="Zone26",e[e.Zone27=27]="Zone27",e[e.Zone28=28]="Zone28",e[e.Zone29=29]="Zone29",e[e.Zone30=30]="Zone30",e[e.Zone31=31]="Zone31",e[e.Zone0X=100]="Zone0X",e[e.Zone0Y=101]="Zone0Y",e[e.Zone1X=102]="Zone1X",e[e.Zone1Y=103]="Zone1Y",e[e.Zone2X=104]="Zone2X",e[e.Zone2Y=105]="Zone2Y",e[e.Zone3X=106]="Zone3X",e[e.Zone3Y=107]="Zone3Y",e[e.Zone4X=108]="Zone4X",e[e.Zone4Y=109]="Zone4Y",e[e.Zone5X=110]="Zone5X",e[e.Zone5Y=111]="Zone5Y",e[e.Zone6X=112]="Zone6X",e[e.Zone6Y=113]="Zone6Y",e[e.Zone7X=114]="Zone7X",e[e.Zone7Y=115]="Zone7Y",e[e.Zone8X=116]="Zone8X",e[e.Zone8Y=117]="Zone8Y",e[e.Zone9X=118]="Zone9X",e[e.Zone9Y=119]="Zone9Y",e[e.Zone10X=120]="Zone10X",e[e.Zone10Y=121]="Zone10Y",e[e.Zone11X=122]="Zone11X",e[e.Zone11Y=123]="Zone11Y",e[e.Zone12X=124]="Zone12X",e[e.Zone12Y=125]="Zone12Y",e[e.Zone13X=126]="Zone13X",e[e.Zone13Y=127]="Zone13Y",e[e.Zone14X=128]="Zone14X",e[e.Zone14Y=129]="Zone14Y",e[e.Zone15X=130]="Zone15X",e[e.Zone15Y=131]="Zone15Y",e[e.Zone16X=132]="Zone16X",e[e.Zone16Y=133]="Zone16Y",e[e.Zone17X=134]="Zone17X",e[e.Zone17Y=135]="Zone17Y",e[e.Zone18X=136]="Zone18X",e[e.Zone18Y=137]="Zone18Y",e[e.Zone19X=138]="Zone19X",e[e.Zone19Y=139]="Zone19Y",e[e.Zone20X=140]="Zone20X",e[e.Zone20Y=141]="Zone20Y",e[e.Zone21X=142]="Zone21X",e[e.Zone21Y=143]="Zone21Y",e[e.Zone22X=144]="Zone22X",e[e.Zone22Y=145]="Zone22Y",e[e.Zone23X=146]="Zone23X",e[e.Zone23Y=147]="Zone23Y",e[e.Zone24X=148]="Zone24X",e[e.Zone24Y=149]="Zone24Y",e[e.Zone25X=150]="Zone25X",e[e.Zone25Y=151]="Zone25Y",e[e.Zone26X=152]="Zone26X",e[e.Zone26Y=153]="Zone26Y",e[e.Zone27X=154]="Zone27X",e[e.Zone27Y=155]="Zone27Y",e[e.Zone28X=156]="Zone28X",e[e.Zone28Y=157]="Zone28Y",e[e.Zone29X=158]="Zone29X",e[e.Zone29Y=159]="Zone29Y",e[e.Zone30X=160]="Zone30X",e[e.Zone30Y=161]="Zone30Y",e[e.Zone31X=162]="Zone31X",e[e.Zone31Y=163]="Zone31Y",e))(w||{});function V(t){return t<100}g(V,"isTouchZoneButton");function b(t){return t>=100}g(b,"isTouchZonePosition");function _(t){return t<0||t>31?null:100+t*2}g(_,"getTouchZoneXAxis");function R(t){return t<0||t>31?null:101+t*2}g(R,"getTouchZoneYAxis");var C=(s=>(s[s.DPadUp=0]="DPadUp",s[s.DPadDown=1]="DPadDown",s[s.DPadLeft=2]="DPadLeft",s[s.DPadRight=3]="DPadRight",s[s.DPadCenter=4]="DPadCenter",s[s.Play=5]="Play",s[s.Pause=6]="Pause",s[s.PlayPause=7]="PlayPause",s[s.Stop=8]="Stop",s[s.Rewind=9]="Rewind",s[s.FastForward=10]="FastForward",s[s.Previous=11]="Previous",s[s.Next=12]="Next",s[s.Record=13]="Record",s[s.VolumeUp=15]="VolumeUp",s[s.VolumeDown=16]="VolumeDown",s[s.Mute=17]="Mute",s[s.ChannelUp=18]="ChannelUp",s[s.ChannelDown=19]="ChannelDown",s[s.Back=20]="Back",s[s.Home=21]="Home",s[s.Menu=22]="Menu",s[s.Info=23]="Info",s[s.Guide=24]="Guide",s[s.Exit=25]="Exit",s[s.Red=30]="Red",s[s.Green=31]="Green",s[s.Yellow=32]="Yellow",s[s.Blue=33]="Blue",s[s.Digit0=40]="Digit0",s[s.Digit1=41]="Digit1",s[s.Digit2=42]="Digit2",s[s.Digit3=43]="Digit3",s[s.Digit4=44]="Digit4",s[s.Digit5=45]="Digit5",s[s.Digit6=46]="Digit6",s[s.Digit7=47]="Digit7",s[s.Digit8=48]="Digit8",s[s.Digit9=49]="Digit9",s[s.Input=50]="Input",s[s.Settings=51]="Settings",s[s.Subtitle=52]="Subtitle",s[s.Audio=53]="Audio",s[s.Power=54]="Power",s[s.PointerX=100]="PointerX",s[s.PointerY=101]="PointerY",s[s.GyroX=102]="GyroX",s[s.GyroY=103]="GyroY",s[s.GyroZ=104]="GyroZ",s))(C||{});function Z(t){return t<100}g(Z,"isTVRemoteButton");function K(t){return t>=100}g(K,"isTVRemoteAxis");function T(t,r){return{device:t,input:r}}g(T,"createInputDescriptor");function H(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 7:return t.input<100;case 4:return t.input<100;default:return!1}}g(H,"isButton");function u(t){return!H(t)}g(u,"isAxis");function p(t){let r=new Uint8Array(3);return r[0]=t.device,r[1]=t.input&255,r[2]=t.input>>8&255,r}g(p,"serializeInputDescriptor");function I(t,r=0){let c=t[r],D=t[r+1]|t[r+2]<<8;return{device:c,input:D}}g(I,"deserializeInputDescriptor");function ii(t){let r=X[t.device],c;switch(t.device){case 0:c=P[t.input];break;case 1:c=z[t.input];break;case 2:c=A[t.input];break;case 3:c=B[t.input];break;case 7:c=w[t.input];break;case 4:c=C[t.input];break;default:c="Unknown"}return`${r}:${c}`}g(ii,"inputDescriptorToString");function ei(t){let[r,c]=t.split(":");if(!r||!c)return null;let D=Object.entries(X).find(([o,f])=>o.toLowerCase()===r.toLowerCase()&&typeof f=="number")?.[1];if(D===void 0)return null;let S;switch(D){case 0:S=P[c];break;case 1:S=z[c];break;case 2:S=A[c];break;case 3:S=B[c];break;case 4:S=C[c];break;case 7:S=w[c];break}return S===void 0?null:{device:D,input:S}}g(ei,"parseInputDescriptor");var m=class m{constructor(r=0,c=0){Y(this,"x");Y(this,"y");this.x=r,this.y=c}static zero(){return new m(0,0)}static one(){return new m(1,1)}static up(){return new m(0,-1)}static down(){return new m(0,1)}static left(){return new m(-1,0)}static right(){return new m(1,0)}add(r){return new m(this.x+r.x,this.y+r.y)}subtract(r){return new m(this.x-r.x,this.y-r.y)}multiply(r){return new m(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new m(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?m.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let c=Math.cos(r),D=Math.sin(r);return new m(this.x*c-this.y*D,this.x*D+this.y*c)}lerp(r,c){return new m(this.x+(r.x-this.x)*c,this.y+(r.y-this.y)*c)}clone(){return new m(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,c){return this.x=r,this.y=c,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};g(m,"Vector2");var M=m;var a=class a{constructor(r=0,c=0,D=0){Y(this,"x");Y(this,"y");Y(this,"z");this.x=r,this.y=c,this.z=D}static zero(){return new a(0,0,0)}static one(){return new a(1,1,1)}static up(){return new a(0,1,0)}static down(){return new a(0,-1,0)}static left(){return new a(-1,0,0)}static right(){return new a(1,0,0)}static forward(){return new a(0,0,1)}static back(){return new a(0,0,-1)}add(r){return new a(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new a(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new a(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new a(this.x/r,this.y/r,this.z/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let r=this.length();return r===0?a.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new a(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,c){return new a(this.x+(r.x-this.x)*c,this.y+(r.y-this.y)*c,this.z+(r.z-this.z)*c)}clone(){return new a(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,c,D){return this.x=r,this.y=c,this.z=D,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};g(a,"Vector3");var L=a;var bi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},_i={color:"rgba(144, 24, 24, 1)",lineWidth:1};var ri=(f=>(f.None="none",f.Eighth="eighth",f.Quarter="quarter",f.Half="half",f.Integer="integer",f.Responsive="responsive",f))(ri||{}),si=(f=>(f[f.None=0]="None",f[f.Eighth=1]="Eighth",f[f.Quarter=2]="Quarter",f[f.Half=3]="Half",f[f.Integer=4]="Integer",f[f.Responsive=5]="Responsive",f))(si||{});function Zi(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}g(Zi,"scalingModeToValue");function Ki(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}g(Ki,"valueToScalingMode");var ti=(o=>(o[o.Disconnected=0]="Disconnected",o[o.Connecting=1]="Connecting",o[o.Connected=2]="Connected",o[o.Reconnecting=3]="Reconnecting",o[o.Error=4]="Error",o))(ti||{});var li=(c=>(c.SocketIO="socketio",c.WebRTC="webrtc",c))(li||{});var F=(n=>(n[n.Ping=0]="Ping",n[n.Pong=1]="Pong",n[n.Join=2]="Join",n[n.JoinResponse=3]="JoinResponse",n[n.SystemMessage=4]="SystemMessage",n[n.Input=16]="Input",n[n.Update=17]="Update",n[n.Audio=18]="Audio",n[n.Vibration=19]="Vibration",n[n.Load=48]="Load",n[n.Asset=49]="Asset",n))(F||{});function ie(t){return t in F}g(ie,"isNetworkEvent");export{_i as GRID_DEFAULTS,A as GamepadInput,X as InputDeviceType,P as KeyboardInput,z as MouseInput,F as NetworkEvent,ti as NetworkState,li as NetworkTransportType,bi as POST_PROCESS_DEFAULTS,ri as ScalingMode,si as ScalingModeValue,C as TVRemoteInput,B as TouchInput,w as TouchZoneInput,M as Vector2,L as Vector3,T as createInputDescriptor,I as deserializeInputDescriptor,O as gamepadAxisIndexToInput,d as gamepadButtonIndexToInput,G as getTouchXAxis,y as getTouchYAxis,_ as getTouchZoneXAxis,R as getTouchZoneYAxis,ii as inputDescriptorToString,u as isAxis,H as isButton,$ as isGamepadAxis,W as isGamepadButton,Q as isMouseAxis,U as isMouseButton,ie as isNetworkEvent,K as isTVRemoteAxis,Z as isTVRemoteButton,J as isTouchButton,j as isTouchGesture,N as isTouchPosition,V as isTouchZoneButton,b as isTouchZonePosition,q as keyCodeToKeyboardInput,E as keyboardInputToKeyCode,ei as parseInputDescriptor,Zi as scalingModeToValue,p as serializeInputDescriptor,Ki as valueToScalingMode};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utsp/types",
|
|
3
|
-
"version": "0.17.0-nightly.
|
|
3
|
+
"version": "0.17.0-nightly.20260128161430.00e511d",
|
|
4
4
|
"description": "Type definitions and interfaces for UTSP (Universal Tile Stream Protocol)",
|
|
5
5
|
"author": "THP Software",
|
|
6
6
|
"license": "MIT",
|