1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28984],{28984:(e,t,i)=>{i.d(t,{KF:()=>ei,bW:()=>A,xv:()=>R,yC:()=>et,Rw:()=>S,VC:()=>H,WF:()=>c,Zf:()=>V,VD:()=>J,JW:()=>x,pM:()=>k,zj:()=>M,fI:()=>ec,v3:()=>eh,Gh:()=>K,cq:()=>q,jT:()=>N,HM:()=>_,cD:()=>B,tW:()=>U,t5:()=>ea,PN:()=>ed,Nb:()=>er,hC:()=>I,P3:()=>O});let n='button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="link"], [role="menuitem"], [role="tab"], [role="option"], [role="checkbox"], [role="radio"]';function s(e){let t=[];for(let i of e){if(!(i instanceof HTMLElement)||i.disabled||"true"===i.getAttribute("aria-hidden")||i.closest("[data-focus-skip]"))continue;let e=i.getBoundingClientRect();0!==e.width&&0!==e.height&&(i.closest('[data-input-zone="viewport"]')||t.push(i))}return t}function o(e){return{x:e.left+e.width/2,y:e.top+e.height/2}}function a(e,t,i,n){if(0===t.length)return null;let s=n?.wrap??!0,a=n?.wrapPerpendicularThreshold??50,r=n?.perpendicularWeight??.3,l=o(e),d="left"===i||"right"===i,h="right"===i||"down"===i,c=-1/0,u=null;for(let e of t){let t=o(e.rect),i=t.x-l.x,n=t.y-l.y,s=d?i:n,a=d?n:i;if(h&&s<=0||!h&&s>=0)continue;let p=1/(Math.abs(s)+Math.abs(a)*r);p>c&&(c=p,u=e)}if(u)return u;if(!s)return null;let p=1/0,f=null;for(let e of t){let t=o(e.rect);if((d?Math.abs(t.y-l.y):Math.abs(t.x-l.x))>a)continue;let i=d?t.x:t.y,n=h?i:-i;n<p&&(p=n,f=e)}return f}let r=new Set(["INPUT","TEXTAREA"]);function l(e){let t=e.closest("[data-focus-section]");return t?t.getAttribute("data-focus-section")??"":null}class d{navigate(e){if("u"<typeof document)return!1;let t=document.activeElement;if(t instanceof HTMLElement){let e=t.tagName.toUpperCase();if(r.has(e)||t.isContentEditable)return!1}let i=s(document.querySelectorAll(n));if(0===i.length)return!1;if(!t||t===document.body)return i[0].focus({preventScroll:!1}),!0;let o=t.getBoundingClientRect();if(0===o.width&&0===o.height)return i[0].focus({preventScroll:!1}),!0;let d=[];for(let e=0;e<i.length;e++){let n=i[e];if(n===t)continue;let s=n.getBoundingClientRect();d.push({id:n.id||String(e),rect:s,element:n,section:l(n)})}let h=function(e,t,i,n){let s=new Set([n]);for(let e of t)s.add(e.section);if(s.size<=1)return a(e,t,i);let o=t.filter(t=>{var s;return t.section===n&&(s=t.rect,"left"===i||"right"===i?s.top<e.bottom&&s.bottom>e.top:s.left<e.right&&s.right>e.left)}),r=a(e,o,i,{wrap:!1});if(r)return r;let l=a(e,t.filter(e=>e.section!==n),i,{wrap:!1});return l||a(e,t,i)}(o,d,e,l(t));if(!h)return!1;let c=h.element;return c.focus({preventScroll:!0}),"function"==typeof c.scrollIntoView&&c.scrollIntoView({block:"nearest",behavior:"smooth"}),!0}focusSection(e){if("u"<typeof document)return!1;let t=s(document.querySelectorAll(n));if(0===t.length)return!1;let i=[],o=new Map;for(let e of t){let t=l(e);o.has(t)||(o.set(t,e),i.push(t))}if(i.length<=1)return!1;let a=document.activeElement instanceof HTMLElement?document.activeElement:null,r=a?l(a):null,d=i.indexOf(r);-1===d&&(d=0);let h=i[(d+("next"===e?1:-1)+i.length)%i.length],c=o.get(h);return!!c&&(c.focus({preventScroll:!0}),"function"==typeof c.scrollIntoView&&c.scrollIntoView({block:"nearest",behavior:"smooth"}),!0)}}class h{get zone(){return this._zone}get viewportHandler(){return this.handler}get viewportFamily(){return this._family}registerViewport(e,t){this.handler=e,this._family=t??null}unregisterViewport(){this.handler=null,this._family=null,"viewport"===this._zone&&this.setZone("shell")}enterZone(e){return("viewport"!==e||!!this.handler)&&(this.setZone(e),!0)}onZoneChange(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setZone(e){if(this._zone!==e)for(let t of(this._zone=e,this.listeners))t(e)}constructor(){this._zone="shell",this.handler=null,this._family=null,this.listeners=new Set}}class c{registerProvider(e){if(this.providers.has(e.id))return;this.providers.set(e.id,e);let t=e.subscribe(e=>this.handleAction(e));this.providerUnsubs.set(e.id,t)}unregisterProvider(e){let t=this.providerUnsubs.get(e);t&&t(),this.providers.delete(e),this.providerUnsubs.delete(e)}subscribe(e,t){let i=this.subscribers.get(e);
1return i||(i=new Set,this.subscribers.set(e,i)),i.add(t),()=>{i?.delete(t)}}onAction(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="zone"===t.phase?this.zoneActionListeners:this.actionListeners;return i.add(e),()=>{i.delete(e)}}onStateChange(e){return this.stateListeners.add(e),()=>{this.stateListeners.delete(e)}}getActiveDevice(){return this.state.activeDevice}getActiveSubtype(){return this.state.activeSubtype}getForceShowFocusRings(){return this.state.forceShowFocusRings}getLockedDevice(){return this.state.lockedDevice}getState(){return{...this.state}}setForceShowFocusRings(e){this.state.forceShowFocusRings!==e&&(this.state={...this.state,forceShowFocusRings:e},this.notifyStateListeners())}setLockedDevice(e){this.state.lockedDevice!==e&&(this.state={...this.state,lockedDevice:e},null!=e&&this.state.activeDevice!==e&&(this.state={...this.state,activeDevice:e}),this.notifyStateListeners())}getFocusZoneManager(){return this.focusZone}getProvider(e){return this.providers.get(e)}setActiveSubtype(e){this.state.activeSubtype!==e&&(this.state={...this.state,activeSubtype:e},this.notifyStateListeners())}acquireDispatchSuppression(e){let t=Symbol("dispatch-suppression");this.dispatchSuppressors.set(t,e);let i=!1;return()=>{i||(i=!0,this.dispatchSuppressors.delete(t))}}setDispatchSuppressed(e){if(e){this.legacyDispatchSuppressionRelease??=this.acquireDispatchSuppression();return}this.legacyDispatchSuppressionRelease?.(),this.legacyDispatchSuppressionRelease=null}handleAction(e){if(this.dispatchSuppressors.size>0){let t=Array.from(this.dispatchSuppressors.values());t[t.length-1]?.(e);return}for(let t of this.zoneActionListeners)t(e);for(let t of this.actionListeners)t(e);null==this.state.lockedDevice&&this.state.activeDevice!==e.source&&(this.state={...this.state,activeDevice:e.source},this.notifyStateListeners());let t=e.action.type,i=this.focusZone.zone;if("viewport"===i){let i=this.focusZone.viewportHandler;if(i){if("cancel"===t){i.onExitRequest(e.source)&&this.focusZone.enterZone("shell");return}if(i.onAction(e.action))return}if("navigate.up"===t||"navigate.down"===t||"navigate.left"===t||"navigate.right"===t||"confirm"===t)return}if("text"===i){if(t.startsWith("navigate."))return;if("confirm"===t){this.dispatchSyntheticKey("confirm");let e=this.subscribers.get(t);if(e)for(let t of e)t();return}if("cancel"===t){"u">typeof document&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),this.focusZone.enterZone("shell");return}}if("navigate.up"===t||"navigate.down"===t||"navigate.left"===t||"navigate.right"===t){let e=t.replace("navigate.","");this.spatialFocus.navigate(e)}else if("confirm"===t)"u">typeof document&&document.activeElement instanceof HTMLElement&&document.activeElement.click(),this.dispatchSyntheticKey(t);else if("shell"===i&&("cycle.next"===t||"cycle.prev"===t))this.spatialFocus.focusSection("cycle.next"===t?"next":"prev");else if("scroll.up"===t||"scroll.down"===t){let i=e.action.amount??0;i>0&&this.scrollFocusedRegion("scroll.down"===t?i:-i)}let n=this.subscribers.get(t);if(n)for(let e of n)e()}scrollFocusedRegion(e){if("u"<typeof document)return;let t=document.activeElement instanceof HTMLElement?document.activeElement:null;for(;t;){let i=window.getComputedStyle(t).overflowY;if(("auto"===i||"scroll"===i||"overlay"===i)&&t.scrollHeight>t.clientHeight)return void t.scrollBy({top:e,behavior:"auto"});t=t.parentElement}document.scrollingElement?.scrollBy({top:e,behavior:"auto"})}dispatchSyntheticKey(e){let t={"navigate.up":"ArrowUp","navigate.down":"ArrowDown","navigate.left":"ArrowLeft","navigate.right":"ArrowRight","navigate.first":"Home","navigate.last":"End",confirm:"Enter"}[e];if(!t)return;let i=new KeyboardEvent("keydown",{key:t,bubbles:!0});Object.defineProperty(i,"wildsSynthetic",{value:!0}),window.dispatchEvent(i)}notifyStateListeners(){for(let e of this.stateListeners)e()}constructor(){this.spatialFocus=new d,this.focusZone=new h,this.providers=new Map,this.providerUnsubs=new Map,this.actionListeners=new Set,this.zoneActionListeners=new Set,this.subscribers=new Map,this.stateListeners=new Set,this.state={activeDevice:"keyboard",activeSubtype:null,forceShowFocusRings:!1,lockedDevice:null},this.dispatchSuppressors=new Map,this.legacyDispatchSuppressionRelease=null}}let u={ArrowUp:"navigate.up",ArrowDown:"navigate.down",ArrowLeft:"navigate.left",ArrowRight:"navigate.right",w:"navigate.up",s:"navigate.down",a:"navigate.left",d:"navigate.right",Home:"navigate.first",End:"navigate.last",Enter:"confirm",Space
1:"confirm",Escape:"cancel",PageUp:"scroll.up",PageDown:"scroll.down",F10:"menu",e:"interact",q:"use_item",f:"pickup",r:"reload",KeyR:"reload",t:"chat_open",ShiftLeft:"dash",ShiftRight:"dash",ControlLeft:"block",ControlRight:"block"},p={0:"confirm",1:"cancel",2:"secondary",3:"tertiary",4:"cycle.prev",5:"cycle.next",6:"dash",7:"attack",8:"help",9:"menu",10:"lock_target",12:"navigate.up",13:"navigate.down",14:"navigate.left",15:"navigate.right"},f={xIndex:0,yIndex:1,deadzone:.5,repeatMs:150},g={xIndex:2,yIndex:3,deadzone:.4,pixelsPerTick:24},m={1:"menu",3:"help"};function v(e){return e>=16?{next:5,prev:4,fallbackUsed:!1}:{next:3,prev:2,fallbackUsed:!0}}let b=new Set(["navigate.up","navigate.down","navigate.left","navigate.right","navigate.first","navigate.last","confirm","cancel","secondary","tertiary","cycle.next","cycle.prev","menu","help","attack","attack_secondary","dash","block","interact","pickup","use_item","lock_target","weapon_next","weapon_prev","reload","chat_open"]);function w(e){return"scroll.up"===e?{type:"scroll.up",amount:200}:"scroll.down"===e?{type:"scroll.down",amount:200}:b.has(e)?{type:e}:null}let y=new Set(["INPUT","TEXTAREA","SELECT"]);class x{constructor(e=u){this.id="keyboard",this.type="keyboard",this.deviceLabel="Keyboard",this.handlers=new Set,this.lastActivityMs=0,this.listening=!1,this.onKeyDown=e=>this.handleKeyDown(e),this.bindings=e}setBindings(e){this.bindings=e}isActive(){return Date.now()-this.lastActivityMs<5e3}subscribe(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}start(){this.listening||(window.addEventListener("keydown",this.onKeyDown),this.listening=!0)}stop(){this.listening&&(window.removeEventListener("keydown",this.onKeyDown),this.listening=!1)}handleKeyDown(e){var t;let i;if(e.wildsSynthetic||e.defaultPrevented)return;let n=" "===e.key?"Space":1===e.key.length?e.key.toLowerCase():e.key,s=(t=e.code,(i=/^(?:Digit|Numpad)([1-9])$/.exec(t))?Number(i[1])-1:null),o=null==s?this.bindings[n]??this.bindings[e.code]:"ability_slot";if(!o||(e.ctrlKey||e.metaKey||e.altKey)&&"Control"!==n&&"Shift"!==n&&"Alt"!==n&&"Meta"!==n)return;let a=(document.activeElement?.tagName??"").toUpperCase(),r=y.has(a)||document.activeElement?.isContentEditable===!0;r&&"cancel"===o&&(e.isComposing||229===e.keyCode)||r&&"cancel"!==o||(e.preventDefault(),this.emit(o,s))}emit(e,t){this.lastActivityMs=Date.now();let i="ability_slot"===e&&null!=t?{type:"ability_slot",index:t}:w(e);if(!i)return;let n={action:i,source:"keyboard",timestamp:Date.now()};for(let e of this.handlers)e(n)}}class k{isActive(){return Date.now()-this.lastActivityMs<5e3}subscribe(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}start(){this.listening||(window.addEventListener("pointermove",this.onMove),window.addEventListener("click",this.onClick),window.addEventListener("pointerdown",this.onPointerDown),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("blur",this.onBlur),document.addEventListener("pointerlockchange",this.onPointerLockChange),this.listening=!0)}stop(){this.listening&&(window.removeEventListener("pointermove",this.onMove),window.removeEventListener("click",this.onClick),window.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("blur",this.onBlur),document.removeEventListener("pointerlockchange",this.onPointerLockChange),this.attackHeld=!1,this.listening=!1)}clearAttack(){this.attackHeld&&(this.attackHeld=!1,this.emitAttack(!1))}emitPassive(){this.lastActivityMs=Date.now();let e={action:{type:"scroll.up",amount:0},source:"mouse",timestamp:Date.now()};for(let t of this.handlers)t(e)}emitAttack(e){this.lastActivityMs=Date.now();let t={action:{type:"attack",active:e},source:"mouse",timestamp:Date.now()};for(let e of this.handlers)e(t)}constructor(){this.id="mouse",this.type="mouse",this.deviceLabel="Mouse",this.handlers=new Set,this.lastActivityMs=0,this.listening=!1,this.attackHeld=!1,this.onMove=()=>this.emitPassive(),this.onClick=()=>this.emitPassive(),this.onPointerDown=e=>{"mouse"===e.pointerType&&0===e.button&&(this.attackHeld=!0,this.emitAttack(!0))},this.onPointerUp=e=>{"mouse"===e.pointerType&&0===e.button&&this.clearAttack()},this.onBlur=()=>this.clearAttack(),this.onPointerLockChange=()=>{"u">typeof document&&null==document.pointerLockElement&&this.clearAttack()}}}class E{constructor(e){this.active=new Map,this.thresholdMs=e}press(e,t){this.active.has(e)||this.active.set(e,{startedAtMs:Date.now(),fired:!1,callback:t})}release(e){this.active.delete(e)}tick(){let e=Date.now();for(let[,t]of this.active)!t.fired&&e-t.startedAtMs>=this.thresholdMs&&(t.fired=!0,t.callback())}reset(){this.active.clear()}}class S{constructor(e=p){this.id="gamepad",this.type="gamepad",this.deviceLabel="Gamepad",this.handlers=new Set,this.connectedPads=new Map,this.lastActivityMs=0,this.lastRightStickPollMs=0,this.rafId=null,this.listening=!1,this.longPress=new E(500),this.onConnect=e=>this.handleConnect(e),this.onDisconnect=e=>this.handleDisconnect(e),this.bindings=e}setBindings(e){this.bindings=e}isActive(){return Date.now()-this.lastActivityMs<5e3}subscribe(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}start(){this.listening||(window.addEventListener("gamepadconnected",this.onConnect),window.addEventListener("gamepaddisconnected",this.onDisconnect),this.listening=!0,this.registerAlreadyConnectedPads(),this.scheduleNextPoll())}stop(){this.listening&&(window.removeEventListener("gamepadconnected",this.onConnect),window.removeEventListener("gamepaddisconnected",this.onDisconnect),null!=this.rafId&&"u">typeof cancelAnimationFrame&&cancelAnimationFrame(this.rafId),this.rafId=null,this.connectedPads.clear(),this.listening=!1)}handleConnect(e){this.registerPad(e.gamepad),this.listening&&null==this.rafId&&this.scheduleNextPoll()}registerAlreadyConnectedPads(){if("u">typeof navigator&&navigator.getGamepads)try{for(let e of navigator.getGamepads())e&&!1!==e.connected&&(this.connectedPads.has(e.index)||this.registerPad(e))}catch{}}registerPad(e){let t,i=(t=e.id.toLowerCase(),/xbox|xinput|x-box|microsoft.*pad/.test(t)?"xbox":/playstation|dualshock|dualsense|sony/.test(t)?"playstation":/switch|joy.?con|pro controller|nintendo
1/.test(t)?"nintendo":/arcade|fight ?stick|hori|qanba|madcatz|mad cats|atrox/.test(t)?"arcade":"generic"),n=e.buttons.length,s=v(n),o={...this.bindings};s.fallbackUsed&&(delete o[4],delete o[5],o[s.next]="cycle.next",o[s.prev]="cycle.prev"),this.connectedPads.set(e.index,{index:e.index,id:e.id,subtype:i,buttonCount:n,buttonBindings:o,prevButtonStates:Array(n).fill(!1),prevAxisDirections:[null,null],lastAxisRepeatMs:[0,0]}),this.subtype=i}handleDisconnect(e){this.connectedPads.delete(e.gamepad.index),0===this.connectedPads.size&&(this.subtype=void 0)}poll(){if("u"<typeof navigator||!navigator.getGamepads)return;let e=navigator.getGamepads();for(let t of(this.longPress.tick(),e)){if(!t)continue;let e=this.connectedPads.get(t.index);e&&(this.pollButtons(t,e),this.pollAxes(t,e))}}pollButtons(e,t){for(let i=0;i<e.buttons.length;i++){let n=t.prevButtonStates[i]??!1,s=e.buttons[i].pressed;if(s&&!n){let e=t.buttonBindings[i];e&&this.emit(e);let n=m[i];n&&this.longPress.press(`pad-${t.index}-btn-${i}`,()=>this.emit(n))}else!s&&n&&this.longPress.release(`pad-${t.index}-btn-${i}`);t.prevButtonStates[i]=s}}pollAxes(e,t){this.pollLeftStickNav(e,t),this.pollRightStickScroll(e)}pollLeftStickNav(e,t){let i=e.axes[f.xIndex]??0,n=e.axes[f.yIndex]??0,s=this.axisDirection(i,n,f.deadzone),o=Date.now();if(null==s){t.prevAxisDirections[0]=null;return}let a=t.lastAxisRepeatMs[0]??0;(t.prevAxisDirections[0]!==s||o-a>=f.repeatMs)&&(this.emit(`navigate.${s}`),t.lastAxisRepeatMs[0]=o),t.prevAxisDirections[0]=s}pollRightStickScroll(e){let t=e.axes[g.yIndex]??0,i=Date.now(),n=this.lastRightStickPollMs>0?Math.min(i-this.lastRightStickPollMs,100):17;if(this.lastRightStickPollMs=i,Math.abs(t)<g.deadzone)return;let s=(Math.abs(t)-g.deadzone)/(1-g.deadzone),o=Math.max(1,Math.round(g.pixelsPerTick*s*(n/(1e3/60))));this.lastActivityMs=i;let a={action:{type:t>0?"scroll.down":"scroll.up",amount:o},source:"gamepad",timestamp:i};for(let e of this.handlers)e(a)}axisDirection(e,t,i){return Math.abs(e)<i&&Math.abs(t)<i?null:Math.abs(e)>Math.abs(t)?e>0?"right":"left":t>0?"down":"up"}emit(e){this.lastActivityMs=Date.now();let t=w(e);if(!t)return;let i={action:t,source:"gamepad",timestamp:Date.now()};for(let e of this.handlers)e(i)}scheduleNextPoll(){if("u">typeof requestAnimationFrame){if(0===this.connectedPads.size){this.rafId=null;return}this.rafId=requestAnimationFrame(()=>{this.poll(),this.listening&&this.scheduleNextPoll()})}}}let A=16,D=` 2<div class="wilds-dpad" style="position:fixed;bottom:${A}px;left:16px;right:16px;z-index:9999;display:flex;justify-content:space-between;align-items:flex-end;pointer-events:none"> 3 <div style="display:flex;flex-direction:column;gap:4px;pointer-events:auto"> 4 <div style="display:flex;gap:4px"> 5 <div style="width:60px;height:60px"></div> 6 <button data-dpad="up" style="width:60px;height:60px;display:flex;align-items:center;justify-content:center;background:rgba(18,20,26,.66);border:1px solid rgba(255,255,255,.5);border-radius:8px;color:rgba(255,255,255,.95);font-size:20px;touch-action:none;-webkit-user-select:none;user-select:none">▲</button> 7 <div style="width:60px;height:60px"></div> 8 </div> 9 <div style="display:flex;gap:4px"> 10 <button data-dpad="left" style="width:60px;height:60px;display:flex;align-items:center;justify-content:center;background:rgba(18,20,26,.66);border:1px solid rgba(255,255,255,.5);border-radius:8px;color:rgba(255,255,255,.95);font-size:20px;touch-action:none;-webkit-user-select:none;user-select:none">◀</button> 11 <div style="width:60px;height:60px"></div> 12 <button data-dpad="right" style="width:60px;height:60px;display:flex;align-items:center;justify-content:center;background:rgba(18,20,26,.66);border:1px solid rgba(255,255,255,.5);border-radius:8px;color:rgba(255,255,255,.95);font-size:20px;touch-action:none;-webkit-user-select:none;user-select:none">▶</button> 13 </div> 14 <div style="display:flex;gap:4px"> 15 <div style="width:60px;height:60px"></div> 16 <button data-dpad="down" style="width:60px;height:60px;display:flex;align-items:center;justify-content:center;background:rgba(18,20,26,.66);border:1px solid rgba(255,255,255,.5);border-radius:8px;color:rgba(255,255,255,.95);font-size:20px;touch-action:none;-webkit-user-select:none;user-select:none">▼</button> 17 <div style="width:60px;height:60px"></div> 18 </div> 19 </div> 20 <div style="display:flex;gap:8px;pointer-events:auto;align-items:flex-end"> 21 <button data-dpad="secondary" style="width:64px;
21height:64px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:rgba(18,20,26,.62);border:1px solid rgba(255,255,255,.45);color:rgba(255,255,255,.9);font-size:12px;font-weight:700;touch-action:none;-webkit-user-select:none;user-select:none">B</button> 22 <button data-dpad="primary" style="width:72px;height:72px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:rgba(18,20,26,.7);border:1px solid rgba(255,255,255,.6);color:rgba(255,255,255,.98);font-size:13px;font-weight:700;touch-action:none;-webkit-user-select:none;user-select:none">A</button> 23 </div> 24</div>`,P={up:"navigate.up",down:"navigate.down",left:"navigate.left",right:"navigate.right"},L={primary:"confirm",secondary:"cancel"};class M{isActive(){return Date.now()-this.lastActivityMs<5e3}subscribe(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}start(){!this.listening&&(window.addEventListener("touchstart",this.onTouchStart,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd),this.listening=!0,("ontouchstart"in window||navigator.maxTouchPoints>0)&&this.mountDpad())}stop(){this.listening&&(window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),this.longPressTimer&&clearTimeout(this.longPressTimer),this.unmountDpad(),this.listening=!1)}setButtonMap(e){this.buttonMap={...this.buttonMap,...e}}showDpad(){this.dpadContainer&&(this.dpadContainer.style.display="",this.dpadVisible=!0,this.publishFootprint())}hideDpad(){this.dpadContainer&&(this.dpadContainer.style.display="none",this.dpadVisible=!1,this.clearFootprint())}publishFootprint(){if("u"<typeof document)return;let e=this.dpadBottomPx+188+8,t=document.documentElement;t.style.setProperty("--wilds-dpad-clear-bottom",`${e}px`),t.style.setProperty("--wilds-dpad-active","1")}clearFootprint(){if("u"<typeof document)return;let e=document.documentElement;e.style.removeProperty("--wilds-dpad-clear-bottom"),e.style.removeProperty("--wilds-dpad-active")}setDpadBottomPx(e){Number.isFinite(e)&&!(e<0)&&(this.dpadBottomPx=e,this.applyDpadBottom())}applyDpadBottom(){let e=this.dpadContainer?.querySelector(".wilds-dpad");e&&(e.style.bottom=`${this.dpadBottomPx}px`),this.dpadVisible&&this.publishFootprint()}mountDpad(){if(this.dpadContainer||"u"<typeof document||"function"==typeof window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)return;let e=document.createElement("div");e.innerHTML=D,document.body.appendChild(e),this.dpadContainer=e,this.applyDpadBottom(),e.style.display="none",this.dpadVisible=!1,e.querySelectorAll("[data-dpad]").forEach(e=>{e.addEventListener("touchstart",t=>{t.preventDefault();let i=e.dataset.dpad,n=P[i]??("primary"===i?this.buttonMap.primary:"secondary"===i?this.buttonMap.secondary:void 0);n&&(this.emit(n),("up"===i||"down"===i||"left"===i||"right"===i)&&(this.stopDpadRepeat(),this.repeatTimer=setInterval(()=>
24this.emit(n),150)))},{passive:!1}),e.addEventListener("touchend",()=>this.stopDpadRepeat()),e.addEventListener("touchcancel",()=>this.stopDpadRepeat())})}unmountDpad(){this.stopDpadRepeat(),this.dpadContainer&&(this.dpadContainer.remove(),this.dpadContainer=null,this.dpadVisible=!1,this.clearFootprint())}stopDpadRepeat(){this.repeatTimer&&(clearInterval(this.repeatTimer),this.repeatTimer=null)}handleStart(e){let t=e.touches[0];t&&(this.startX=t.clientX,this.startY=t.clientY,this.startTime=Date.now(),this.lastActivityMs=Date.now(),this.longPressTimer&&clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.emit("secondary")},500))}handleMove(e){let t=e.touches[0];if(!t)return;let i=Math.abs(t.clientX-this.startX),n=Math.abs(t.clientY-this.startY);(i>10||n>10)&&this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}handleEnd(e){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null);let t=e.changedTouches[0];if(!t)return;let i=t.clientX-this.startX,n=t.clientY-this.startY,s=Date.now()-this.startTime;this.startX<20&&i>60&&60>Math.abs(n)?this.emit("cancel"):s<200&&10>Math.abs(i)&&10>Math.abs(n)&&(this.lastActivityMs=Date.now())}emit(e){this.lastActivityMs=Date.now();let t={action:{type:e},source:"touch",timestamp:Date.now()};for(let e of this.handlers)e(t)}constructor(){this.id="touch",this.type="touch",this.deviceLabel="Touch",this.handlers=new Set,this.lastActivityMs=0,this.listening=!1,this.startX=0,this.startY=0,this.startTime=0,this.longPressTimer=null,this.dpadContainer=null,this.dpadVisible=!1,this.repeatTimer=null,this.dpadBottomPx=A,this.buttonMap={...L},this.onTouchStart=e=>this.handleStart(e),this.onTouchMove=e=>this.handleMove(e),this.onTouchEnd=e=>this.handleEnd(e)}}let C={axisX:0,axisZ:0,sprint:!1,attackPressed:!1,rangedPressed:!1,dodgePressed:!1,pausePressed:!1,connected:!1,buttonsHeld:0},T=[4];function _(){if("u"<typeof navigator||"function"!=typeof navigator.getGamepads)return null;for(let e of navigator.getGamepads())if(e&&e.connected)return e;return null}function B(e){return!!e&&"standard"===e.mapping&&!v(e.buttons.length).fallbackUsed}function z(e){return!!e&&(e.pressed||e.value>.5)}class R{constructor(e={}){this.state={...C},this.subscribers=new Set,this.rafId=null,this.listening=!1,this.prevStart=!1,this.sprintButtons=e.sprintButtons?[...e.sprintButtons]:T,this.reportButtons=!0===e.reportButtons}start(){this.listening||(this.listening=!0,this.scheduleNextPoll())}stop(){this.listening&&(this.listening=!1,null!==this.rafId&&"u">typeof cancelAnimationFrame&&cancelAnimationFrame(this.rafId),this.rafId=null,this.state={...C},this.prevStart=!1)}getState(){return this.state}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}scheduleNextPoll(){!this.listening||"u">typeof requestAnimationFrame&&(this.rafId=requestAnimationFrame(()=>{this.poll(),this.scheduleNextPoll()}))}poll(){if("u"<typeof navigator||"function"!=typeof navigator.getGamepads)return;let e=_();if(!e){if(!this.state.connected&&0===this.state.axisX&&0===this.state.axisZ)return;this.commit({...C});return}let t=e.axes[0]??0,i=e.axes[1]??0,n=Math.sqrt(t*t+i*i),s=0,o=0;if(n>.18){let e=Math.min(1,(n-.18)/.8200000000000001);s=t/n*e,o=i/n*e}let a=e.buttons,r=(B(e)?this.sprintButtons:T).some(e=>z(a[e])),l=a[7],d=!!l&&(l.pressed||l.value>
24.5),h=(a[0]?.pressed??!1)||d,c=a[2]?.pressed??!1,u=a[1]?.pressed??!1,p=a[9]?.pressed??!1,f=p&&!this.prevStart;this.prevStart=p;let g=0;if(this.reportButtons){let e=Math.min(a.length,31);for(let t=0;t<e;t+=1)z(a[t])&&(g|=1<<t)}let m={axisX:s,axisZ:o,sprint:r,attackPressed:h,rangedPressed:c,dodgePressed:u,pausePressed:f,connected:!0,buttonsHeld:g};(m.axisX!==this.state.axisX||m.axisZ!==this.state.axisZ||m.sprint!==this.state.sprint||m.attackPressed!==this.state.attackPressed||m.rangedPressed!==this.state.rangedPressed||m.dodgePressed!==this.state.dodgePressed||m.pausePressed!==this.state.pausePressed||m.connected!==this.state.connected||m.buttonsHeld!==this.state.buttonsHeld)&&this.commit(m)}commit(e){for(let t of(this.state=e,this.subscribers))t(this.state)}}let F=new Set;function I(e){return F.add(e),()=>{F.delete(e)}}let j=new Set;function U(){let e=Symbol("viewport-pad-play");return j.add(e),()=>{j.delete(e)}}function O(){return j.size>0}function K(e){return{onAction(t){let i,n,s=(i=document.querySelector('[data-input-zone="viewport"]'))?Array.from(i.querySelectorAll('button:not([disabled]), [tabindex]:not([tabindex="-1"]), a[href], input:not([disabled]), select:not([disabled])')):[];if(0===s.length)return!1;let o=(n=document.activeElement)?s.indexOf(n):-1;
24switch(t.type){case"navigate.down":case"navigate.right":{let t=o<s.length-1?o+1:0;return s[t].focus(),e.haptic("selection_tick"),e.playUiSound("ui_hover"),!0}case"navigate.up":case"navigate.left":{let t=o>0?o-1:s.length-1;return s[t].focus(),e.haptic("selection_tick"),e.playUiSound("ui_hover"),!0}case"confirm":return(o>=0?s[o]:s[0]).click(),e.haptic("medium_impact"),e.playUiSound("ui_click"),!0;case"cancel":return document.activeElement?.blur(),!1;default:return!1}},onExitRequest:()=>!0}}function q(e){return{onAction(e){switch(e.type){case"navigate.up":case"navigate.down":case"navigate.left":case"navigate.right":case"dash":case"attack":case"confirm":case"interact":case"use_item":case"pickup":return!0;default:return!1}},onExitRequest:()=>!0}}function N(e){let t=q(e);return{onAction(e){if("cycle.prev"===e.type||"cycle.next"===e.type){if(!B(_()))return!1;var i="cycle.next"===e.type?"next":"prev";let t=!1;for(let e of[...F])e(i)&&(t=!0);return t}return t.onAction(e)},onExitRequest:e=>(!("gamepad"===e&&O())||!!("u">typeof document&&null!==document.querySelector('[role="dialog"]')))&&t.onExitRequest(e)}}let Z=Object.freeze(Object.assign(new Set,{add(){throw Error("IDLE_KEYBOARD_AXIS_STATE.held is immutable")},delete(){throw Error("IDLE_KEYBOARD_AXIS_STATE.held is immutable")},clear(){throw Error("IDLE_KEYBOARD_AXIS_STATE.held is immutable")}})),X={axisX:0,axisZ:0,sprint:!1,held:Z},H=Object.freeze({axisX:0,axisZ:0,sprint:!1,held:Z}),$={"navigate.left":{axis:"axisX",value:-1},"navigate.right":{axis:"axisX",value:1},"navigate.up":{axis:"axisZ",value:-1},"navigate.down":{axis:"axisZ",value:1}},G=new Set(["INPUT","TEXTAREA","SELECT"]);class V{constructor(e=u,t=[]){this.heldActions=new Set,this.listening=!1,this.state={...X},this.subscribers=new Set,this.onDown=e=>this.handleKey(e,!0),this.onUp=e=>this.handleKey(e,!1),this.onBlur=()=>{0!==this.heldActions.size&&(this.heldActions.clear(),this.recompute())},this.bindings=e,this.watched=new Set(t)}isHeld(e){return this.state.held.has(e)}setBindings(e){this.bindings=e,this.heldActions.size>0&&(this.heldActions.clear(),this.recompute())}start(){this.listening||(window.addEventListener("keydown",this.onDown),window.addEventListener("keyup",this.onUp),window.addEventListener("blur",this.onBlur),this.listening=!0)}stop(){this.listening&&(window.removeEventListener("keydown",this.onDown),window.removeEventListener("keyup",this.onUp),window.removeEventListener("blur",this.onBlur),this.listening=!1,this.heldActions.clear(),this.state={...X})}getState(){return this.state}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}handleKey(e,t){let i=(document.activeElement?.tagName??"").toUpperCase();if(G.has(i)||document.activeElement?.isContentEditable===!0)return;let n=this.bindings[e.key]??this.bindings[e.code];if(!n||!$[n]&&"dash"!==n&&!this.watched.has(n))return;let s=this.heldActions.has(n);if(t&&!s)this.heldActions.add(n);else{if(t||!s)return;this.heldActions.delete(n)}this.recompute()}recompute(){let e={...X,held:new Set(this.heldActions)};for(let t of this.heldActions){let i=$[t];i?e[i.axis]+=i.value:"dash"===t&&(e.sprint=!0)}if(e.axisX=Math.max(-1,Math.min(1,e.axisX)),e.axisZ=Math.max(-1,Math.min(1,e.axisZ)),!(e.axisX===this.state.axisX&&e.axisZ===this.state.axisZ&&e.sprint===this.state.sprint&&function(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let i of e)if(!t.has(i))return!1;return!0}(e.held,this.state.held)))for(let t of(this.state=e,this.subscribers))t(this.state)}}let Y=new Set(["TEXTAREA","SELECT"]),W=new Set(["file","range","checkbox","radio","button","submit","reset","image","color","hidden"]);class J{constructor(e={}){this.heldCodes=new Set,this.listening=!1,this.handleDown=e=>{e instanceof KeyboardEvent&&this.handleKey(e,!0)},this.handleUp=e=>{e instanceof KeyboardEvent&&this.handleKey(e,!1)},this.handleBlur=()=>{this.heldCodes.clear(),this.onBlur?.(new Set(this.heldCodes))},this.preventDefaultCodes=new Set(e.preventDefaultCodes??[]),this.ignoreTextFields=!1!==e.ignoreTextFields,this.target=e.target??"document",this.onKeyDown=e.onKeyDown,this.onKeyUp=e.onKeyUp,this.onBlur=e.onBlur}start(){this.listening||"u">typeof document&&(this.listenerTarget().addEventListener("keydown",this.handleDown,{capture:!0}),this.listenerTarget().addEventListener("keyup",this.handleUp,{capture:!0}),window.addEventListener("blur",this.handleBlur),this.listening=!0)}stop(){this.listening&&("u">typeof document&&(this.listenerTarget().removeEventListener("keydown",this.handleDown,{capture:!0}),this.listenerTarget().removeEventListener("keyup",this.handleUp,{capture:!0})),window.removeEventListener("blur",this.handleBlur),this.heldCodes.clear(),this.listening=!1)}has(e){return this.heldCodes.has(e)}snapshot(){return new Set(this.heldCodes)}getHeldCodes(){return this.heldCodes}handleKey(e,t){let i=e.code||e.key;if(i){if(t){if(this.ignoreTextFields&&(Q(document.activeElement)||Q(e.target)))return;this.heldCodes.add(i),this.preventDefaultCodes.has(i)&&e.preventDefault(),this.onKeyDown?.(e,i,new Set(this.heldCodes));return}this.heldCodes.delete(i),this.onKeyUp?.(e,i,new Set(this.heldCodes))}}listenerTarget(){return"window"===this.target?window:document}}function Q(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return"INPUT"===t?!W.has(e.type.toLowerCase()):!!Y.has(t)||!0===e.isContentEditable}let ee=[[0,"face_down"],[1,"face_right"],[2,"face_left"],[3,"face_up"],[4,"lb"],[5,"rb"],[8,"select"],[9,"start"],[12,"dpad_up"],[13,"dpad_down"],[14,"dpad_left"],[15,"dpad_right"]];class et{constructor(e={}){this.opts=e,this.prev=new Set,this.wasConnected=!1,this.rafId=null,this.listening=!1}start(){this.listening||(this.listening=!0,this.scheduleNextPoll())}stop(){for(let e of(this.listening=!1,null!==this.rafId&&"u">typeof cancelAnimationFrame&&cancelAnimationFrame(this.rafId),this.rafId=null,this.prev))this.opts.onButtonUp?.(e);this.prev=new Set,this.wasConnected=!1}scheduleNextPoll(){this.listening&&"u">typeof requestAnimationFrame&&(this.rafId=requestAnimationFrame(()=>{this.poll(),this.scheduleNextPoll()}))}poll(){let e=this.firstConnectedPad(),t=new Set;if(e){for(let[i,n]of ee)e.buttons[i]?.pressed&&t.add(n);let i=this.opts.stickDeadzone??.4,n=e.axes[0]??0,s=e.axes[1]??0;n<-i?t.add("dpad_left"):n>i&&t.add("dpad_right"),s<-i?t.add("dpad_up"):s>i&&t.add("dpad_down")}for(let e of t)this.prev.has(e)||this.opts.onButtonDown?.(e);for(let e of this.prev)t.has(e)||this.opts.onButtonUp?.(e);this.prev=t,e?this.wasConnected=!0:this.wasConnected&&(this.wasConnected=!1,this.opts.onDisconnect?.())}firstConnectedPad(){if("u"<typeof navigator||"function"!=typeof navigator.getGamepads)return null;for(let e of navigator.getGamepads())if(e&&e.connected)return e;return null}}let ei=[{id:"navigate.up",label:"Move up",group:"movement"},{id:"navigate.down",label:"Move down",group:"movement"},{id:"navigate.left",label:"Move left",group:"movement"},{id:"navigate.right",label:"Move right",group:"movement"},{id:"confirm",label:"Confirm / primary",group:"action"},{id:"cancel",label:"Cancel / back",group:"action"},{id:"interact",label:"Interact",group:"action"},{id:"pickup",label:"Pick up",group:"action"},{id:"use_item",label:"Use item",group:"action"},{id:"reload",label:"Reload",group:"action"},{id:"dash",label:"Dash",group:"action"},{id:"block",label:"Block",group:"action"},{id:"attack",label:"Attack",group:"action"},{id:"menu",label:"Menu",group:"system"},{id:"help",label:"Help",group:"system"}],en=new Set(ei.map(e=>e.id)),es=new Set(["Tab","Escape","MetaLeft","MetaRight","AltLeft","AltRight"]);function eo(){let e={},t={};for(let i of ei)e[i.id]=[],t[i.id]=[];for(let[t,i]of Object.entries(u))en.has(i)&&e[i].push(t);for(let[e,i]of Object.entries(p))en.has(i)&&t[i].push(Number(e));return{keyboard:e,gamepad:t}}function ea(e){return es.has(e)}function er(e){return/^[a-z]$/.test(e)?`Key${e.toUpperCase()}`:/^[A-Z]$/.test(e)?`Key${e}`:/^[0-9]$/.test(e)?`Digit${e}`:" "===e?"Space":e}function el(e){let t=eo();if(e?.keyboard)for(let[i,n]of Object.entries(e.keyboard))en.has(i)&&(t.keyboard[i]=n.filter(e=>!ea(e)));if(e?.gamepad)for(let[i,n]of Object.entries(e.gamepad))en.has(i)&&(t.gamepad[i]=[...n]);return{keyboard:Object.freeze(Object.fromEntries(Object.entries(t.keyboard).map(e=>{let[t,i]=e;return[t,Object.freeze(i)]}))),gamepad:Object.freeze(Object.fromEntries(Object.entries(t.gamepad).map(e=>{let[t,i]=e;return[t,Object.freeze(i)]})))}}function ed(e){let t=e,i=el(t),n=new Set;return{get:()=>i,resolvedKeyboard:()=>(function(e){let t={...u};if(!e?.keyboard)return t;for(let[i,n]of Object.entries(e.keyboard))if(en.has(i)){for(let[e,n]of Object.entries(t))n===i&&delete t[e];for(let e of n)ea(e)||(t[e]=i)}return t})(t),resolvedGamepad:()=>(function(e){let t={...p};if(!e?.gamepad)return t;for(let[i,n]of Object.entries(e.gamepad))if(en.has(i)){for(let[e,n]of Object.entries(t))n===i&&delete t[Number(e)];for(let e of n)t[e]=i}return t})(t),getOverrides:()=>t,setOverrides(e){for(let s of(i=el(t=e),n))s(i)},subscribe:e=>(n.add(e),()=>n.delete(e))}}function eh(e,t){let{onCaptured:i,onCancelled:n}=t,s=!1,o=null,a=e.acquireDispatchSuppression(),r=e=>{!s&&(s=!0,window.removeEventListener("keydown",d,!0),window.removeEventListener("keyup",h,!0),a(),e&&e())},l=e=>{e.preventDefault(),e.stopImmediatePropagation()},d=e=>{if(l(e),!e.repeat){if("Escape"===e.code)return void r(n);o=e.code}},h=e=>{if(l(e),null!=o&&e.code===o){let e=o;r(()=>i(e))}};return window.addEventListener("keydown",d,!0),window.addEventListener("keyup",h,!0),()=>r(null)}function ec(e,t){let{onCaptured:i,onCancelled:n}=t;if("u"<typeof navigator||"function"!=typeof navigator.getGamepads)return n(),()=>{};let s=!1,o=null,a=null,r=new Set,l=e.acquireDispatchSuppression(),d=e=>{!s&&(s=!0,null!=o&&"u">typeof cancelAnimationFrame&&cancelAnimationFrame(o),window.removeEventListener("keydown",c,!0),window.removeEventListener("keyup",h,!0),l(),e&&e())},h=e=>{e.preventDefault(),e.stopImmediatePropagation()},c=e=>{h(e),e.repeat||"Escape"!==e.code||d(n)},u=()=>{try{return Array.from(navigator.getGamepads()).filter(e=>null!=e)}catch{return[]}};for(let e of u())for(let t=0;t<e.buttons.length;t++)e.buttons[t].pressed&&r.add(`${e.index}:${t}`);let p=()=>
24{if(!s){for(let e of u())for(let t=0;t<e.buttons.length;t++){let n=`${e.index}:${t}`;if(e.buttons[t].pressed)r.has(n)||null!=a||(a={padIndex:e.index,button:t});else if(r.delete(n),null!=a&&a.padIndex===e.index&&a.button===t){let e=a.button;d(()=>i(e));return}}"u">typeof requestAnimationFrame&&(o=requestAnimationFrame(p))}};return window.addEventListener("keydown",c,!0),window.addEventListener("keyup",h,!0),"u">typeof requestAnimationFrame&&(o=requestAnimationFrame(p)),()=>d(null)}Object.freeze({keyboard:Object.freeze(Object.fromEntries(Object.entries(eo().keyboard).map(e=>{let[t,i]=e;return[t,Object.freeze(i)]}))),gamepad:Object.freeze(Object.fromEntries(Object.entries(eo().gamepad).map(e=>{let[t,i]=e;return[t,Object.freeze(i)]})))})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.