@iwsdk/xr-input 1.1.0 → 1.2.0-rc.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"gaze-pointer.d.ts","sourceRoot":"","sources":["../../src/pointer/gaze-pointer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EAGR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,KAAK,EAGL,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EAEjB,KAAK,EACL,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,eAAe,EACf,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAEV,qBAAqB,EAEtB,MAAM,8BAA8B,CAAC;AAItC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAExC,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACpC,sDAAsD;IACtD,UAAU,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9C,yDAAyD;IACzD,QAAQ,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5C,+CAA+C;IAC/C,WAAW,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAC/C,iEAAiE;IACjE,m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AC3E,OAAO,CAAC,SAAS;IAUjB,0EAA0E;IAC1E,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,yBAAyB;IAiBjC,OAAO,CAAC,oBAAoB;IAM5B,kFAAkF;IAClF,OAAO,CAAC,eAAe;IAUvB,0DAA0D;IAC1D,OAAO,CAAC,mBAAmB;IAY3B,qEAAqE;IACrE,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,eAAe;IAwEvB,OAAO,CAAC,gBAAgB;IAoCxB,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,aAAa;IAmCrB,sEAAsE;IACtE,gBAAgB,IAAI,QAAQ,GAAG,IAAI;IAInC,yDAAyD;IACzD,aAAa,IAAI,QAAQ,GAAG,IAAI;IAIhC,8CAA8C;IAC9C,WAAW,IAAI,OAAO;IAItB,6CAA6C;IAC7C,SAAS,IAAI,OAAO;IAIpB,6DAA6D;IAC7D,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,aAAa,IAAI,UAAU;IAI3B;;;;OAIG;IACH,KAAK,IAAI,IAAI;IAab,OAAO,IAAI,IAAI;CAOhB"}
@@ -423,6 +423,8 @@ class GazePointer {
423
423
  const raycaster = this.pointer.intersector.raycaster;
424
424
  if (raycaster) {
425
425
  raycaster.firstHitOnly = true;
426
+ // Sprite.raycast needs the viewing camera (see RayPointer).
427
+ raycaster.camera = camera;
426
428
  }
427
429
  }
428
430
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"gaze-pointer.js","sources":["../../src/pointer/gaze-pointer.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Pointer,\n createRayPointer,\n type Intersection,\n} from '@pmndrs/pointer-events';\nimport {\n CircleGeometry,\n Color,\n Matrix3,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n PerspectiveCamera,\n Quaternion,\n Scene,\n Vector3,\n} from 'three';\nimport type { GazeOrigin, XROrigin } from '../rig/xr-origin.js';\nimport {\n FilteredEyeGaze,\n FilteredEyeGazeOptions,\n} from './filtered-eye-gaze.js';\nimport type {\n GazeCandidateContext,\n GazeCandidateProvider,\n GazeHit,\n} from './gaze-candidate-provider.js';\nimport { GazeConecaster } from './gaze-conecaster.js';\nimport { isObjectTreeVisible } from './visibility.js';\n\nexport type GazeHand = 'left' | 'right';\n\n/** Metadata exposed as `PointerEvent.pointerState` for the gaze ray. */\nexport interface GazePointerState {\n source: 'gaze';\n handedness: GazeHand | null;\n}\n\n/**\n * Per-frame input context passed into {@link GazePointer.update}.\n */\nexport interface GazePointerInput {\n /** Candidate Object3D roots (gaze-eligible interactables). */\n candidates: ReadonlyArray<Object3D>;\n /** Whether each hand's pinch went down this frame. */\n pinchStart: { left: boolean; right: boolean };\n /** Whether each hand's pinch was released this frame. */\n pinchEnd: { left: boolean; right: boolean };\n /** Whether each hand is currently pinching. */\n pinchActive: { left: boolean; right: boolean };\n /** Whether either hand has an active near touch/grab pointer. */\n directPointerActive: { left: boolean; right: boolean };\n}\n\n/**\n * The live WebXR state {@link GazePointer.sampleGazePose} needs to read the\n * gaze target ray itself, rather than trusting another system to have\n * refreshed the rig first.\n */\nexport interface GazeFrameContext {\n /** The frame currently being rendered. */\n frame: XRFrame;\n /**\n * Reference space the pose is resolved against. Must be the same space\n * {@link XROrigin.updateHead} used, since the result is written into\n * {@link XROrigin.eyeSpace}, which lives in that space.\n */\n referenceSpace: XRReferenceSpace;\n /** Session to scan for the gaze input source. */\n session: XRSession;\n}\n\nexport interface GazePointerOptions {\n /** Suppress hover/select while a near touch/grab pointer is active. @default true */\n suppressWhenDirectPointerActive?: boolean;\n /**\n * On select commit, move the effective pointer origin to the pinching\n * hand's ray space so captured drags track the hand, not the eyes.\n * @default true\n */\n pointerTransformFollowsHand?: boolean;\n /** Reticle color while gaze is genuinely tracked. @default 0xffffff */\n reticleColor?: Color | number;\n /** Reticle radius in meters. @default 0.012 */\n reticleRadius?: number;\n /** Show the developer-only gaze hit reticle. @default false */\n showDebugReticle?: boolean;\n /** Keep gaze mode active briefly after tracking becomes invalid. @default 5 */\n trackingLossGraceSeconds?: number;\n /** OneEuro filter parameters applied to the gaze pose. */\n filter?: FilteredEyeGazeOptions;\n /**\n * Emit `[iwsdk][gaze]` console diagnostics explaining why gaze is (or isn't)\n * tracked, and whether the runtime's gaze ray actually separates from the\n * head ray. Eye tracking has several silent failure modes that are otherwise\n * indistinguishable from a missing source.\n * @default true\n */\n diagnostics?: boolean;\n}\n\n/**\n * Locate the eye-tracking input source.\n *\n * The primary scan is the one the standalone WebXR eye-gaze diagnostic page\n * uses verbatim — the gaze source is whichever entry of `session.inputSources`\n * reports `targetRayMode === 'gaze'`. `trackedSources` is checked afterwards\n * because some runtimes surface non-primary sources only there; the\n * diagnostics log says which list produced the hit.\n */\nfunction findGazeSource(session: XRSession): {\n source: XRInputSource | undefined;\n fromTrackedSources: boolean;\n} {\n for (const source of session.inputSources) {\n if (source.targetRayMode === 'gaze') {\n return { source, fromTrackedSources: false };\n }\n }\n if (session.trackedSources) {\n for (const source of session.trackedSources) {\n if (source.targetRayMode === 'gaze') {\n return { source, fromTrackedSources: true };\n }\n }\n }\n return { source: undefined, fromTrackedSources: false };\n}\n\n/**\n * Thresholds lifted from the standalone WebXR eye-gaze diagnostic page, so a\n * verdict logged here means the same thing as a verdict shown there.\n */\nconst GAZE_VERDICT = {\n /** Gaze/head separation that proves the eye ray is genuinely independent. */\n passAngleDeg: 1.5,\n /** Below this, one frame's gaze and head rays count as \"the same ray\". */\n identicalAngleDeg: 0.05,\n /** Below this (millimetres), one frame's gaze and head origins coincide. */\n identicalPositionMm: 0.5,\n /** Ratio of identical frames that indicates a head-pose mapping bug. */\n headLockedRatio: 0.95,\n /** Max separation still counted as head-locked. */\n headLockedAngleDeg: 0.1,\n /** Minimum evidence before any negative verdict is logged. */\n minSeconds: 3,\n minFrames: 90,\n} as const;\n\nconst RAD_TO_DEG = 180 / Math.PI;\nconst diagForward = new Vector3();\nconst diagHeadForward = new Vector3();\n\nconst RETICLE_FORWARD = new Vector3(0, 0, 1);\n\nfunction isIntentionalHeadDirectedPreview(): boolean {\n const preview = (\n globalThis as typeof globalThis & {\n __IWSDK_TARGET_DEVICE_PREVIEW__?: {\n active?: boolean;\n gazeSimulation?: 'head' | false;\n };\n }\n ).__IWSDK_TARGET_DEVICE_PREVIEW__;\n return preview?.active === true && preview.gazeSimulation === 'head';\n}\n\n/**\n * The development emulator (desktop IWER or a native override) supplies gaze\n * that only moves when aimed, so it starts out matching the head and must not\n * be reported as real eye data or as a head-locked runtime.\n */\nfunction isEmulatedGaze(): boolean {\n const profile = (\n globalThis as typeof globalThis & {\n __IWSDK_EMULATION_PROFILE?: { active?: boolean };\n }\n ).__IWSDK_EMULATION_PROFILE;\n return profile?.active === true;\n}\n\n/**\n * One-shot console diagnostics for the gaze pipeline.\n *\n * Eye tracking fails silently in several distinct ways — feature not granted,\n * no gaze input source, source present but posed null, or a runtime that maps\n * the gaze target ray onto the head pose. These can otherwise look like either\n * missing or head-locked gaze, so each gets its own message with the\n * remediation that actually applies. Every message fires at most once per\n * state transition, so this is safe to leave on in a per-frame path.\n */\nclass GazeDiagnostics {\n private sessionStart = -1;\n private loggedFeature = false;\n private loggedMissingSource = false;\n private loggedTrackedSourcesFallback = false;\n private loggedPoseThrow = false;\n private loggedNoTargets = false;\n private loggedVerdict = false;\n private loggedInconclusive = false;\n private sourcePresent = false;\n /** Tri-state so the very first sample always logs its pose validity. */\n private poseValid: boolean | null = null;\n\n // Head-versus-gaze separation stats, accumulated over valid poses only.\n private firstValidPoseAt = -1;\n private comparisonFrames = 0;\n private identicalFrames = 0;\n private maxAngleDeg = 0;\n private maxPositionMm = 0;\n\n reset(): void {\n this.sessionStart = -1;\n this.loggedFeature = false;\n this.loggedMissingSource = false;\n this.loggedTrackedSourcesFallback = false;\n this.loggedPoseThrow = false;\n this.loggedNoTargets = false;\n this.loggedVerdict = false;\n this.loggedInconclusive = false;\n this.sourcePresent = false;\n this.poseValid = null;\n this.firstValidPoseAt = -1;\n this.comparisonFrames = 0;\n this.identicalFrames = 0;\n this.maxAngleDeg = 0;\n this.maxPositionMm = 0;\n }\n\n /**\n * @param time Monotonic seconds, matching {@link GazePointer.update}.\n * @param xrOrigin Rig whose `eyeSpace`/`head` hold this frame's poses.\n */\n frame(\n time: number,\n xrOrigin: XROrigin,\n session: XRSession,\n gazeSource: XRInputSource | undefined,\n fromTrackedSources: boolean,\n posed: boolean,\n ): void {\n if (this.sessionStart < 0) {\n this.sessionStart = time;\n }\n this.logFeature(session);\n this.logSource(time, gazeSource, fromTrackedSources);\n this.logPose(gazeSource, posed);\n if (posed) {\n this.compareWithHead(time, xrOrigin);\n }\n }\n\n /** Nothing is gaze-eligible, so gaze can never hit anything. */\n targets(count: number): void {\n if (count > 0) {\n this.loggedNoTargets = false;\n return;\n }\n if (this.loggedNoTargets) {\n return;\n }\n this.loggedNoTargets = true;\n console.info(\n '[iwsdk][gaze] no ray-interactable targets are available, so the gaze ' +\n 'cone has nothing to hit.',\n );\n }\n\n poseThrew(error: unknown): void {\n if (this.loggedPoseThrow) {\n return;\n }\n this.loggedPoseThrow = true;\n console.warn(\n '[iwsdk][gaze] frame.getPose(gazeSource.targetRaySpace) threw; tracked ' +\n 'gaze is unavailable for this frame.',\n error,\n );\n }\n\n /** Report whether the runtime actually granted `gaze-tracking`. */\n private logFeature(session: XRSession): void {\n if (this.loggedFeature) {\n return;\n }\n this.loggedFeature = true;\n // `enabledFeatures` is not in every UA's lib.dom typing yet.\n const enabled = (session as XRSession & { enabledFeatures?: string[] })\n .enabledFeatures;\n if (!enabled) {\n console.info(\n \"[iwsdk][gaze] this browser doesn't expose session.enabledFeatures, \" +\n \"so whether 'gaze-tracking' was granted can't be confirmed here. \" +\n 'Watch for the gaze XRInputSource message below instead.',\n );\n return;\n }\n const enabledFeatures = Array.from(enabled);\n if (\n enabledFeatures.includes('gaze-tracking') ||\n enabledFeatures.includes('eye-tracking')\n ) {\n console.info(\"[iwsdk][gaze] 'gaze-tracking' granted for this session.\", {\n enabledFeatures,\n });\n return;\n }\n console.warn(\n \"[iwsdk][gaze] 'gaze-tracking' was NOT granted for this session, so \" +\n 'tracked gaze is unavailable. Check that the project requests ' +\n 'xr.features.gazeTracking, that this browser build exposes eye ' +\n \"tracking, and that the page's permissions policy allows \" +\n 'xr-spatial-tracking.',\n { enabledFeatures },\n );\n }\n\n private logSource(\n time: number,\n gazeSource: XRInputSource | undefined,\n fromTrackedSources: boolean,\n ): void {\n const present = !!gazeSource;\n\n if (present && fromTrackedSources && !this.loggedTrackedSourcesFallback) {\n this.loggedTrackedSourcesFallback = true;\n console.info(\n '[iwsdk][gaze] gaze source found in session.trackedSources rather ' +\n 'than session.inputSources.',\n );\n }\n\n if (present !== this.sourcePresent) {\n this.sourcePresent = present;\n this.poseValid = null;\n if (present) {\n // A later disconnect is \"showed up then left\", never \"never appeared\".\n this.loggedMissingSource = true;\n console.info('[iwsdk][gaze] gaze XRInputSource appeared.', {\n profiles: Array.from(gazeSource!.profiles),\n handedness: gazeSource!.handedness,\n });\n } else {\n console.warn(\n '[iwsdk][gaze] the gaze XRInputSource disappeared; ' +\n 'ordinary hand/controller far targeting is now active.',\n );\n }\n return;\n }\n\n // Never showed up at all — distinct failure from \"showed up then left\".\n if (\n !present &&\n !this.loggedMissingSource &&\n time - this.sessionStart >= GAZE_VERDICT.minSeconds\n ) {\n this.loggedMissingSource = true;\n console.warn(\n '[iwsdk][gaze] no XRInputSource with targetRayMode === \"gaze\" ' +\n `appeared within ${GAZE_VERDICT.minSeconds}s of session start. ` +\n 'Ordinary hand/controller far targeting remains active. Common causes: the ' +\n 'feature was not granted, eye tracking is disabled in system ' +\n 'settings, the headset has not been calibrated for this user, or ' +\n 'the hardware has no eye tracking.',\n );\n }\n }\n\n private logPose(gazeSource: XRInputSource | undefined, posed: boolean): void {\n if (!gazeSource || posed === this.poseValid) {\n return;\n }\n this.poseValid = posed;\n if (posed) {\n console.info(\n isEmulatedGaze()\n ? '[iwsdk][gaze] emulated gaze pose is valid (synthetic, not eye tracking).'\n : '[iwsdk][gaze] eye pose is valid — real gaze data is flowing.',\n );\n } else {\n console.warn(\n '[iwsdk][gaze] the gaze input source is present but ' +\n 'frame.getPose(targetRaySpace) returned null, so tracked gaze is ' +\n 'temporarily unavailable. Common causes: OS eye-tracking permission ' +\n 'not granted, headset not calibrated, or hardware without eye tracking.',\n );\n }\n }\n\n /**\n * Compare the tracked gaze ray against the head ray. A runtime can hand back\n * a perfectly valid gaze pose that is just a copy of the viewer pose; that\n * is indistinguishable from the fallback unless the two are measured.\n */\n private compareWithHead(time: number, xrOrigin: XROrigin): void {\n if (this.loggedVerdict) {\n return;\n }\n const eye = xrOrigin.eyeSpace;\n const head = xrOrigin.head;\n diagForward.set(0, 0, -1).applyQuaternion(eye.quaternion);\n diagHeadForward.set(0, 0, -1).applyQuaternion(head.quaternion);\n const dot = Math.min(1, Math.max(-1, diagForward.dot(diagHeadForward)));\n const angleDeg = Math.acos(dot) * RAD_TO_DEG;\n const positionMm = eye.position.distanceTo(head.position) * 1000;\n\n if (this.firstValidPoseAt < 0) {\n this.firstValidPoseAt = time;\n }\n this.comparisonFrames++;\n this.maxAngleDeg = Math.max(this.maxAngleDeg, angleDeg);\n this.maxPositionMm = Math.max(this.maxPositionMm, positionMm);\n if (\n angleDeg < GAZE_VERDICT.identicalAngleDeg &&\n positionMm < GAZE_VERDICT.identicalPositionMm\n ) {\n this.identicalFrames++;\n }\n\n if (this.maxAngleDeg >= GAZE_VERDICT.passAngleDeg) {\n this.loggedVerdict = true;\n console.info(\n '[iwsdk][gaze] real eye movement observed — the gaze ray separates ' +\n `from the head ray by up to ${this.maxAngleDeg.toFixed(2)}°.`,\n );\n return;\n }\n\n if (\n time - this.firstValidPoseAt < GAZE_VERDICT.minSeconds ||\n this.comparisonFrames < GAZE_VERDICT.minFrames\n ) {\n return;\n }\n\n const identicalRatio = this.identicalFrames / this.comparisonFrames;\n if (\n identicalRatio >= GAZE_VERDICT.headLockedRatio &&\n this.maxAngleDeg < GAZE_VERDICT.headLockedAngleDeg &&\n this.maxPositionMm < GAZE_VERDICT.identicalPositionMm\n ) {\n this.loggedVerdict = true;\n if (isIntentionalHeadDirectedPreview()) {\n console.info(\n '[iwsdk][gaze] target-device preview is intentionally ' +\n 'providing head-directed synthetic gaze.',\n );\n return;\n }\n if (isEmulatedGaze()) {\n console.info(\n '[iwsdk][gaze] emulated gaze still points where the head does; ' +\n 'aim it (for example with xr look-at on \"gaze\") to test targeting.',\n );\n return;\n }\n console.warn(\n '[iwsdk][gaze] the gaze target-ray pose matched the head pose on ' +\n `${(identicalRatio * 100).toFixed(0)}% of ${this.comparisonFrames} ` +\n `frames (max separation ${this.maxAngleDeg.toFixed(3)}°). Eye ` +\n 'tracking is reporting poses, but the runtime is mapping ' +\n 'XRTargetRaySpace onto the head pose, so gaze behaves as ' +\n 'head-pointing. This is a runtime/build issue, not an app one.',\n );\n return;\n }\n\n if (!this.loggedInconclusive) {\n this.loggedInconclusive = true;\n console.info(\n `[iwsdk][gaze] inconclusive: only ${this.maxAngleDeg.toFixed(2)}° of ` +\n `gaze/head separation over ${this.comparisonFrames} frames. Hold ` +\n 'your head still and look far left and right to confirm real gaze.',\n );\n }\n }\n}\n\n/**\n * Singleton gaze pointer. Peer of {@link MultiPointer} in\n * {@link XRInputManager}.\n *\n * @remarks\n * - One global instance — gaze has no handedness.\n * - Samples the WebXR gaze target ray itself via\n * {@link GazePointer.sampleGazePose}, publishing the result to\n * {@link XROrigin.eyeSpace}. The hand/controller ray owns far targeting when\n * a gaze source is unavailable. {@link GazePointerOptions.diagnostics}\n * explains the silent failure modes.\n * - Candidate selection is delegated to a {@link GazeCandidateProvider};\n * the default {@link GazeConecaster} does OBB cone membership and\n * time-weighted dwell consensus while this pointer resolves surfaces with\n * the same pmndrs ray intersector used for event delivery.\n * - Selector composes either hand's pinch; once selecting, the other hand\n * is ignored until release (per-hand mutual exclusion, matching Meta\n * Interaction SDK's `HandGazeInteractor` semantics).\n * - Drives a real `@pmndrs/pointer-events` pointer so UIKit panels click\n * naturally on gaze-pinch.\n * - Keeps its optional debug reticle hidden by default. Production feedback\n * belongs on the hovered target, matching Meta Interaction SDK.\n *\n * @category Pointer\n */\nexport class GazePointer {\n public readonly reticle: Mesh<CircleGeometry, MeshBasicMaterial>;\n\n public provider: GazeCandidateProvider;\n public suppressWhenDirectPointerActive: boolean;\n public pointerTransformFollowsHand: boolean;\n public showDebugReticle: boolean;\n\n private _trackingLossGraceSeconds = 5;\n\n public get trackingLossGraceSeconds(): number {\n return this._trackingLossGraceSeconds;\n }\n\n public set trackingLossGraceSeconds(value: number) {\n this._trackingLossGraceSeconds = Number.isFinite(value)\n ? Math.max(0, value)\n : 0;\n }\n\n /** See {@link GazePointerOptions.diagnostics}. */\n public diagnosticsEnabled: boolean;\n\n /**\n * OneEuro smoother applied to the raw gaze pose. Public so hosts can retune\n * `minCutoff`/`beta` from config without rebuilding the pointer.\n */\n public readonly filter: FilteredEyeGaze;\n\n /**\n * Real `@pmndrs/pointer-events` Pointer driven by the filtered gaze ray.\n * Each frame: pose-update + `pointer.move(scene)` raycasts from the gaze\n * origin so UIKit and any other pointer-events listeners see enter/leave/\n * move events from the gaze just like they do from the hand ray. On pinch\n * we forward `down`/`up` with `button: 0` so `click` fires naturally.\n */\n public readonly pointer: Pointer;\n public readonly pointerState: GazePointerState = {\n source: 'gaze',\n handedness: null,\n };\n\n private readonly filteredOrigin = new Vector3();\n private readonly filteredQuaternion = new Quaternion();\n private readonly rawOrigin = new Vector3();\n private readonly rawQuaternion = new Quaternion();\n private readonly direction = new Vector3();\n private readonly aimDirection = new Vector3();\n private readonly reticleOffset = new Vector3();\n private readonly rayTarget = new Vector3();\n private readonly rayUp = new Vector3();\n private readonly handOrigin = new Vector3();\n private readonly handQuaternion = new Quaternion();\n private readonly worldRayQuaternion = new Quaternion();\n private readonly handRelativeRayQuaternion = new Quaternion();\n private readonly tmpQuat = new Quaternion();\n private readonly lookMatrix = new Matrix4();\n private readonly normalMatrix = new Matrix3();\n\n /** Reticle tint while gaze is genuinely tracked. */\n private readonly reticleTrackedColor: Color;\n\n /**\n * Synthetic `Object3D` whose world transform mirrors the *filtered* gaze\n * pose. Lives under `xrOrigin` so it inherits rig motion; the @pmndrs ray\n * intersector reads its position/quaternion to cast from.\n */\n private readonly gazeRaySpace: Object3D;\n\n private readonly conecasterCtx: GazeCandidateContext = {\n origin: this.filteredOrigin,\n direction: this.direction,\n candidates: [] as ReadonlyArray<Object3D>,\n intersectCandidate: (candidate, direction) =>\n this.intersectCandidate(candidate, direction),\n };\n\n private readonly nativeEvent = { timeStamp: 0 };\n private readonly buttonEvent = { timeStamp: 0, button: 0 };\n\n private currentHit: GazeHit | null = null;\n private heldHit: GazeHit | null = null;\n private heldByHand: GazeHand | null = null;\n private wasSelecting = false;\n private buttonDown = false;\n private heldFollowsHand = false;\n private hasAcquiredTrackedGaze = false;\n private gazeSource: XRInputSource | null = null;\n private gazeSourcePresent = false;\n private lastTrackedPoseTime = Number.NEGATIVE_INFINITY;\n\n private readonly diagnostics = new GazeDiagnostics();\n\n constructor(\n private readonly xrOrigin: XROrigin,\n private readonly scene: Scene,\n camera: PerspectiveCamera,\n options: GazePointerOptions = {},\n ) {\n this.provider = new GazeConecaster();\n this.suppressWhenDirectPointerActive =\n options.suppressWhenDirectPointerActive ?? true;\n this.pointerTransformFollowsHand =\n options.pointerTransformFollowsHand ?? true;\n this.showDebugReticle = options.showDebugReticle ?? false;\n this.trackingLossGraceSeconds = options.trackingLossGraceSeconds ?? 5;\n this.diagnosticsEnabled = options.diagnostics ?? true;\n this.filter = new FilteredEyeGaze(options.filter);\n\n this.reticleTrackedColor =\n options.reticleColor instanceof Color\n ? options.reticleColor.clone()\n : new Color(options.reticleColor ?? 0xffffff);\n const radius = options.reticleRadius ?? 0.012;\n this.reticle = new Mesh(\n new CircleGeometry(radius, 32),\n new MeshBasicMaterial({\n color: this.reticleTrackedColor.clone(),\n transparent: true,\n opacity: 0.85,\n depthWrite: false,\n depthTest: false,\n }),\n );\n this.reticle.renderOrder = Infinity;\n this.reticle.visible = false;\n this.reticle.name = 'gaze-reticle';\n\n // Synthetic ray source for the @pmndrs Pointer. We can't use eyeSpace\n // directly because we want the *filtered* pose, not the raw per-frame\n // gaze. Manual matrix updates: we drive position/quaternion explicitly\n // each frame from the filter output.\n this.gazeRaySpace = new Object3D();\n this.gazeRaySpace.name = 'gaze-ray-space';\n this.gazeRaySpace.matrixAutoUpdate = false;\n\n this.pointer = createRayPointer(\n () => camera,\n { current: this.gazeRaySpace },\n this.pointerState,\n // contextMenu lives on button 2; gaze never produces it. Disable to\n // avoid spurious contextmenu events.\n {\n contextMenuButton: -1,\n filter: isObjectTreeVisible,\n },\n );\n // BVH-accelerated firstHitOnly raycast (matches hand RayPointer).\n const raycaster = (\n this.pointer.intersector as unknown as {\n raycaster?: { firstHitOnly?: boolean };\n }\n ).raycaster;\n if (raycaster) {\n raycaster.firstHitOnly = true;\n }\n }\n\n /**\n * Add or remove the pointer's rig nodes (debug reticle and ray space).\n *\n * The pointer is constructed eagerly by {@link XRInputManager} so systems can\n * hold a stable reference, but an app that never uses gaze shouldn't pay for\n * gaze geometry in every rig matrix walk — so nothing is parented until gaze\n * is actually switched on.\n */\n setAttached(attached: boolean): void {\n if (attached) {\n this.xrOrigin.add(this.reticle, this.gazeRaySpace);\n } else {\n this.reticle.removeFromParent();\n this.gazeRaySpace.removeFromParent();\n }\n }\n\n /**\n * Read the gaze target ray off the live frame and write it into\n * {@link XROrigin.eyeSpace}.\n *\n * This mirrors the standalone WebXR eye-gaze diagnostic page's probe: find\n * the input source whose `targetRayMode` is `'gaze'`, then pose its\n * `targetRaySpace` against the frame's reference space, tolerating a throw.\n * The source can exist while `getPose` returns null (uncalibrated headset,\n * withheld permission), so source presence and pose validity are tracked\n * separately. A missing or invalid pose clears the current gaze pose so stale\n * tracking can never be used for targeting.\n *\n * Call once per frame before {@link GazePointer.update}.\n */\n sampleGazePose(time: number, context: GazeFrameContext): void {\n const { frame, referenceSpace, session } = context;\n const { source, fromTrackedSources } = findGazeSource(session);\n const nextGazeSource = source ?? null;\n if (nextGazeSource !== this.gazeSource) {\n // Grace belongs to one uninterrupted source lifetime. A source that is\n // removed or replaced must earn ownership again with a valid pose.\n this.hasAcquiredTrackedGaze = false;\n this.lastTrackedPoseTime = Number.NEGATIVE_INFINITY;\n this.gazeSource = nextGazeSource;\n }\n this.gazeSourcePresent = source != null;\n this.xrOrigin.clearGaze();\n let pose: XRPose | null = null;\n if (source) {\n try {\n pose = frame.getPose(source.targetRaySpace, referenceSpace) ?? null;\n } catch (error) {\n if (this.diagnosticsEnabled) {\n this.diagnostics.poseThrew(error);\n }\n }\n }\n\n if (pose) {\n this.xrOrigin.applyTrackedEyePose(pose.transform);\n this.hasAcquiredTrackedGaze = true;\n this.lastTrackedPoseTime = time;\n }\n\n if (this.diagnosticsEnabled) {\n this.diagnostics.frame(\n time,\n this.xrOrigin,\n session,\n source,\n fromTrackedSources,\n !!pose,\n );\n }\n }\n\n /**\n * Whether gaze mode should own far targeting this frame.\n *\n * This mirrors ISDK's mode/source distinction: a valid pose activates gaze;\n * then a short grace period keeps the mode active when a frame's pose is\n * invalid (for example, a blink), while targeting itself clears. WebXR does\n * not expose a separate pose-validity signal, so source enumeration defines\n * the lifetime of that grace period. Removing the source hands far targeting\n * back to hands/controllers immediately; the grace period applies only to\n * temporary pose invalidity (for example, a blink).\n */\n ownsFarTargeting(time: number): boolean {\n if (!this.gazeSourcePresent) {\n return false;\n }\n if (this.xrOrigin.gazeOrigin === 'tracked') {\n return true;\n }\n return (\n this.hasAcquiredTrackedGaze &&\n time - this.lastTrackedPoseTime <= this.trackingLossGraceSeconds\n );\n }\n\n /** Whether this frame has a pose that is safe to use for fresh targeting. */\n canTarget(): boolean {\n return this.xrOrigin.gazeOrigin === 'tracked';\n }\n\n /**\n * Swap the candidate provider at runtime (e.g. a multi-cone or dwell-only\n * provider). The previous provider is reset and detached.\n */\n setCandidateProvider(provider: GazeCandidateProvider): void {\n this.provider.reset();\n this.provider = provider;\n }\n\n update(\n targetingAvailable: boolean,\n dt: number,\n time: number,\n input: GazePointerInput,\n ): void {\n this.nativeEvent.timeStamp = time * 1000;\n\n // Source removal is a mode transition, not transient tracking loss. End a\n // gaze-started gesture before hand/controller far targeting resumes.\n if (!this.gazeSourcePresent && !targetingAvailable && this.heldByHand) {\n this.releaseSelect(true);\n }\n\n if (!targetingAvailable && !this.heldByHand) {\n this.provider.reset();\n this.filter.reset();\n this.currentHit = null;\n this.reticle.visible = false;\n this.releaseAndDisable();\n return;\n }\n\n let releasedSelect = false;\n if (this.heldByHand) {\n const hand = this.heldByHand;\n const pinchEnded = input.pinchEnd[hand];\n const targetAvailable = this.isHeldTargetAvailable(input.candidates);\n if (pinchEnded || !input.pinchActive[hand] || !targetAvailable) {\n // A real pinch-end is an up/click. Tracking loss, reset, removal, or\n // semantic invisibility interrupts the gesture and must cancel it.\n this.releaseSelect(!pinchEnded || !targetAvailable);\n releasedSelect = true;\n } else {\n this.driveHeldPointer();\n this.updateReticle();\n return;\n }\n }\n\n // A transient invalid eye pose clears hover immediately, matching ISDK,\n // but does not interrupt a selection that was already handed off to the\n // pinching hand. Once that gesture ends there is no stale pose from which\n // to start a new selection.\n if (!targetingAvailable) {\n this.provider.reset();\n this.filter.reset();\n this.currentHit = null;\n this.reticle.visible = false;\n this.releaseAndDisable();\n return;\n }\n\n if (this.diagnosticsEnabled) {\n this.diagnostics.targets(input.candidates.length);\n }\n\n // World-space pose of the (raw) gaze, then smoothed in-place. This runs\n // only with a current targeting pose, so a transient invalid frame cannot\n // contaminate the eye filter with the previous valid gaze pose.\n this.xrOrigin.eyeSpace.getWorldPosition(this.rawOrigin);\n this.xrOrigin.eyeSpace.getWorldQuaternion(this.rawQuaternion);\n this.filter.filter(\n this.rawOrigin,\n this.rawQuaternion,\n Math.max(dt, 1 / 240),\n this.filteredOrigin,\n this.filteredQuaternion,\n );\n this.direction.set(0, 0, -1).applyQuaternion(this.filteredQuaternion);\n\n const externallySuppressed =\n this.suppressWhenDirectPointerActive &&\n (input.directPointerActive.left || input.directPointerActive.right);\n\n if (externallySuppressed) {\n this.currentHit = null;\n this.reticle.visible = false;\n this.commitNoTarget();\n } else {\n this.conecasterCtx.candidates = input.candidates;\n this.currentHit = this.provider.update(time, dt, this.conecasterCtx);\n if (this.currentHit) {\n this.commitHit(this.currentHit);\n } else {\n this.commitNoTarget();\n }\n }\n\n if (!releasedSelect) {\n this.processSelector(input);\n }\n this.updateReticle();\n }\n\n /** Resolve one candidate through the same intersector used for dispatch. */\n private intersectCandidate(\n candidate: Object3D,\n direction: Vector3,\n ): Intersection | null {\n this.setRayFromDirection(\n this.filteredOrigin,\n direction,\n this.filteredQuaternion,\n );\n const intersection = this.computeScopedIntersection([candidate]);\n return intersection.object.isVoidObject ? null : intersection;\n }\n\n /** Install the provider's authoritative intersection and emit one move. */\n private commitHit(hit: GazeHit): void {\n this.ensurePointerEnabled();\n this.setRayWorldPose(\n hit.intersection.pointerPosition,\n hit.intersection.pointerQuaternion,\n );\n this.pointer.setIntersection(hit.intersection);\n this.pointer.commit(this.nativeEvent, true);\n }\n\n /** Commit a void hit so the previous target receives out/leave events. */\n private commitNoTarget(): void {\n this.currentHit = null;\n this.ensurePointerEnabled();\n this.setRayFromDirection(\n this.filteredOrigin,\n this.direction,\n this.filteredQuaternion,\n );\n const intersection = this.computeScopedIntersection([]);\n this.pointer.setIntersection(intersection);\n this.pointer.commit(this.nativeEvent, true);\n }\n\n private computeScopedIntersection(descendants: Object3D[]): Intersection {\n const scene = this.scene as Scene & {\n interactableDescendants?: Object3D[];\n };\n const previous = scene.interactableDescendants;\n scene.interactableDescendants = descendants;\n try {\n return this.pointer.computeIntersection(\n 'pointer',\n this.scene,\n this.nativeEvent,\n );\n } finally {\n scene.interactableDescendants = previous;\n }\n }\n\n private ensurePointerEnabled(): void {\n if (!this.pointer.getEnabled()) {\n this.pointer.setEnabled(true, this.nativeEvent, false);\n }\n }\n\n /** Pose the synthetic ray in world space while it remains parented to the rig. */\n private setRayWorldPose(origin: Vector3, quaternion: Quaternion): void {\n this.xrOrigin.updateWorldMatrix(true, false);\n this.gazeRaySpace.position.copy(origin);\n this.xrOrigin.worldToLocal(this.gazeRaySpace.position);\n this.xrOrigin.getWorldQuaternion(this.tmpQuat).invert();\n this.gazeRaySpace.quaternion.copy(this.tmpQuat).multiply(quaternion);\n this.gazeRaySpace.updateMatrix();\n this.gazeRaySpace.updateMatrixWorld(true);\n }\n\n /** Build a ray pose whose -Z axis follows `direction`. */\n private setRayFromDirection(\n origin: Vector3,\n direction: Vector3,\n upQuaternion: Quaternion,\n ): void {\n this.rayTarget.copy(origin).add(direction);\n this.rayUp.set(0, 1, 0).applyQuaternion(upQuaternion);\n this.lookMatrix.lookAt(origin, this.rayTarget, this.rayUp);\n this.worldRayQuaternion.setFromRotationMatrix(this.lookMatrix);\n this.setRayWorldPose(origin, this.worldRayQuaternion);\n }\n\n /** Release event state before disabling or detaching the pointer. */\n private releaseAndDisable(): void {\n this.releaseSelect(true);\n if (!this.pointer.getEnabled()) {\n return;\n }\n this.pointer.exit(this.nativeEvent);\n this.pointer.setEnabled(false, this.nativeEvent, false);\n }\n\n private updateReticle(): void {\n if (!this.showDebugReticle) {\n this.reticle.visible = false;\n return;\n }\n const intersection = this.pointer.getIntersection();\n if (!intersection || intersection.object.isVoidObject) {\n this.reticle.visible = false;\n return;\n }\n if (\n this.reticle.material.color.getHex() !== this.reticleTrackedColor.getHex()\n ) {\n this.reticle.material.color.copy(this.reticleTrackedColor);\n }\n this.reticleOffset.copy(intersection.point);\n this.xrOrigin.worldToLocal(this.reticleOffset);\n this.reticle.position.copy(this.reticleOffset);\n\n const normal = intersection.normal ?? intersection.face?.normal;\n if (normal) {\n this.normalMatrix.getNormalMatrix(intersection.object.matrixWorld);\n this.rayUp.copy(normal).applyNormalMatrix(this.normalMatrix).normalize();\n this.reticle.quaternion.setFromUnitVectors(RETICLE_FORWARD, this.rayUp);\n this.xrOrigin.getWorldQuaternion(this.tmpQuat).invert();\n this.reticle.quaternion.premultiply(this.tmpQuat);\n }\n // Scale reticle gently with distance for legibility.\n const s = Math.max(0.6, Math.min(2, intersection.distance));\n this.reticle.scale.setScalar(s);\n this.reticle.visible = true;\n }\n\n private processSelector(input: GazePointerInput): void {\n const hand: GazeHand | null = input.pinchStart.left\n ? 'left'\n : input.pinchStart.right\n ? 'right'\n : null;\n if (!hand || !this.currentHit) {\n return;\n }\n\n const gazeHit = this.currentHit;\n this.heldByHand = hand;\n this.pointerState.handedness = hand;\n this.heldFollowsHand = false;\n\n let selectIntersection = gazeHit.intersection;\n if (this.pointerTransformFollowsHand) {\n const handSpace = this.xrOrigin.raySpaces[hand];\n handSpace.updateWorldMatrix(true, false);\n handSpace.getWorldPosition(this.handOrigin);\n handSpace.getWorldQuaternion(this.handQuaternion);\n this.aimDirection.copy(gazeHit.intersection.point).sub(this.handOrigin);\n if (this.aimDirection.lengthSq() > 1e-12) {\n this.aimDirection.normalize();\n this.setRayFromDirection(\n this.handOrigin,\n this.aimDirection,\n this.handQuaternion,\n );\n const handIntersection = this.computeScopedIntersection([\n gazeHit.object,\n ]);\n if (\n !handIntersection.object.isVoidObject &&\n handIntersection.object === gazeHit.intersection.object\n ) {\n selectIntersection = handIntersection;\n this.handRelativeRayQuaternion\n .copy(this.handQuaternion)\n .invert()\n .multiply(handIntersection.pointerQuaternion);\n this.heldFollowsHand = true;\n } else {\n this.setRayWorldPose(\n gazeHit.intersection.pointerPosition,\n gazeHit.intersection.pointerQuaternion,\n );\n }\n }\n }\n\n this.heldHit = {\n object: gazeHit.object,\n intersection: selectIntersection,\n angularDistance: gazeHit.angularDistance,\n };\n this.wasSelecting = true;\n this.pointer.setIntersection(selectIntersection);\n // The hover path already emitted this frame's move. This commit only needs\n // to install the hand-origin intersection before a synchronous capture in\n // `down()`; enter/leave bookkeeping still runs if the leaf changed.\n this.pointer.commit(this.nativeEvent, false);\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = 0;\n this.buttonDown = true;\n try {\n this.pointer.down(this.buttonEvent);\n } catch {\n this.releaseSelect(true);\n }\n }\n\n private driveHeldPointer(): void {\n if (!this.heldHit || !this.heldByHand) {\n return;\n }\n\n if (this.pointer.getPointerCapture()) {\n if (this.heldFollowsHand) {\n const handSpace = this.xrOrigin.raySpaces[this.heldByHand];\n handSpace.updateWorldMatrix(true, false);\n handSpace.getWorldPosition(this.handOrigin);\n handSpace.getWorldQuaternion(this.handQuaternion);\n this.worldRayQuaternion\n .copy(this.handQuaternion)\n .multiply(this.handRelativeRayQuaternion);\n this.setRayWorldPose(this.handOrigin, this.worldRayQuaternion);\n } else {\n this.setRayWorldPose(\n this.heldHit.intersection.pointerPosition,\n this.heldHit.intersection.pointerQuaternion,\n );\n }\n this.pointer.move(this.scene, this.nativeEvent);\n return;\n }\n\n // Plain clickable targets generally do not capture. Keep their select-time\n // intersection stable so small hand motion during the pinch cannot turn a\n // valid down into an up on the void object.\n this.setRayWorldPose(\n this.heldHit.intersection.pointerPosition,\n this.heldHit.intersection.pointerQuaternion,\n );\n this.pointer.setIntersection(this.heldHit.intersection);\n this.pointer.commit(this.nativeEvent, true);\n }\n\n private isHeldTargetAvailable(candidates: ReadonlyArray<Object3D>): boolean {\n const object = this.heldHit?.object;\n return (\n !!object && isObjectTreeVisible(object) && candidates.includes(object)\n );\n }\n\n private releaseSelect(cancelled = false): void {\n if (this.buttonDown) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = 0;\n if (cancelled) {\n try {\n this.pointer.cancel(this.nativeEvent);\n } catch {}\n // Pointer.cancel emits the correct event but the upstream pointer\n // keeps its button/capture bookkeeping. Clear it while disabled so no\n // pointerup or click is dispatched for an interrupted gesture.\n const wasEnabled = this.pointer.getEnabled();\n if (wasEnabled) {\n this.pointer.setEnabled(false, this.nativeEvent, true);\n }\n try {\n this.pointer.up(this.buttonEvent);\n } catch {}\n if (wasEnabled) {\n this.pointer.setEnabled(true, this.nativeEvent, false);\n }\n } else {\n try {\n this.pointer.up(this.buttonEvent);\n } catch {}\n }\n this.buttonDown = false;\n }\n this.heldHit = null;\n this.heldByHand = null;\n this.pointerState.handedness = null;\n this.heldFollowsHand = false;\n this.wasSelecting = false;\n }\n\n /** Current dwell winner's root Object3D (null if none/suppressed). */\n getCurrentTarget(): Object3D | null {\n return this.currentHit?.object ?? null;\n }\n\n /** Which hand initiated the active gaze-pinch select. */\n getHeldByHand(): GazeHand | null {\n return this.heldByHand;\n }\n\n /** True while a gaze-pinch select is held. */\n isSelecting(): boolean {\n return this.wasSelecting;\n }\n\n /** World-space gaze origin (post-filter). */\n getOrigin(): Vector3 {\n return this.filteredOrigin;\n }\n\n /** World-space gaze direction (post-filter, unit length). */\n getDirection(): Vector3 {\n return this.direction;\n }\n\n /**\n * Whether a valid gaze pose is available this frame.\n */\n getGazeOrigin(): GazeOrigin {\n return this.xrOrigin.gazeOrigin;\n }\n\n /**\n * Reset filter, provider, selector and diagnostic state. Call when gaze\n * becomes invalid (session ended, eye tracking lost) so we don't carry stale\n * samples, and so the next session re-reports its gaze verdict.\n */\n reset(): void {\n this.diagnostics.reset();\n this.provider.reset();\n this.filter.reset();\n this.currentHit = null;\n this.hasAcquiredTrackedGaze = false;\n this.gazeSource = null;\n this.gazeSourcePresent = false;\n this.lastTrackedPoseTime = Number.NEGATIVE_INFINITY;\n this.reticle.visible = false;\n this.releaseAndDisable();\n }\n\n dispose(): void {\n this.releaseAndDisable();\n this.reticle.geometry.dispose();\n this.reticle.material.dispose();\n this.reticle.removeFromParent();\n this.gazeRaySpace.removeFromParent();\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;AAwGH;;;;;;;;AAQG;AACH,SAAS,cAAc,CAAC,OAAkB,EAAA;AAIxC,IAAA,KAAK,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E;AAC/B,QAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;AAC/B,QAAA,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE;IACtC;AACD;;;;"}
1
+ {"version":3,"file":"gaze-pointer.js","sources":["../../src/pointer/gaze-pointer.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n Pointer,\n createRayPointer,\n type Intersection,\n} from '@pmndrs/pointer-events';\nimport {\n CircleGeometry,\n Color,\n Matrix3,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Object3D,\n PerspectiveCamera,\n Quaternion,\n Scene,\n Vector3,\n} from 'three';\nimport type { GazeOrigin, XROrigin } from '../rig/xr-origin.js';\nimport {\n FilteredEyeGaze,\n FilteredEyeGazeOptions,\n} from './filtered-eye-gaze.js';\nimport type {\n GazeCandidateContext,\n GazeCandidateProvider,\n GazeHit,\n} from './gaze-candidate-provider.js';\nimport { GazeConecaster } from './gaze-conecaster.js';\nimport { isObjectTreeVisible } from './visibility.js';\n\nexport type GazeHand = 'left' | 'right';\n\n/** Metadata exposed as `PointerEvent.pointerState` for the gaze ray. */\nexport interface GazePointerState {\n source: 'gaze';\n handedness: GazeHand | null;\n}\n\n/**\n * Per-frame input context passed into {@link GazePointer.update}.\n */\nexport interface GazePointerInput {\n /** Candidate Object3D roots (gaze-eligible interactables). */\n candidates: ReadonlyArray<Object3D>;\n /** Whether each hand's pinch went down this frame. */\n pinchStart: { left: boolean; right: boolean };\n /** Whether each hand's pinch was released this frame. */\n pinchEnd: { left: boolean; right: boolean };\n /** Whether each hand is currently pinching. */\n pinchActive: { left: boolean; right: boolean };\n /** Whether either hand has an active near touch/grab pointer. */\n directPointerActive: { left: boolean; right: boolean };\n}\n\n/**\n * The live WebXR state {@link GazePointer.sampleGazePose} needs to read the\n * gaze target ray itself, rather than trusting another system to have\n * refreshed the rig first.\n */\nexport interface GazeFrameContext {\n /** The frame currently being rendered. */\n frame: XRFrame;\n /**\n * Reference space the pose is resolved against. Must be the same space\n * {@link XROrigin.updateHead} used, since the result is written into\n * {@link XROrigin.eyeSpace}, which lives in that space.\n */\n referenceSpace: XRReferenceSpace;\n /** Session to scan for the gaze input source. */\n session: XRSession;\n}\n\nexport interface GazePointerOptions {\n /** Suppress hover/select while a near touch/grab pointer is active. @default true */\n suppressWhenDirectPointerActive?: boolean;\n /**\n * On select commit, move the effective pointer origin to the pinching\n * hand's ray space so captured drags track the hand, not the eyes.\n * @default true\n */\n pointerTransformFollowsHand?: boolean;\n /** Reticle color while gaze is genuinely tracked. @default 0xffffff */\n reticleColor?: Color | number;\n /** Reticle radius in meters. @default 0.012 */\n reticleRadius?: number;\n /** Show the developer-only gaze hit reticle. @default false */\n showDebugReticle?: boolean;\n /** Keep gaze mode active briefly after tracking becomes invalid. @default 5 */\n trackingLossGraceSeconds?: number;\n /** OneEuro filter parameters applied to the gaze pose. */\n filter?: FilteredEyeGazeOptions;\n /**\n * Emit `[iwsdk][gaze]` console diagnostics explaining why gaze is (or isn't)\n * tracked, and whether the runtime's gaze ray actually separates from the\n * head ray. Eye tracking has several silent failure modes that are otherwise\n * indistinguishable from a missing source.\n * @default true\n */\n diagnostics?: boolean;\n}\n\n/**\n * Locate the eye-tracking input source.\n *\n * The primary scan is the one the standalone WebXR eye-gaze diagnostic page\n * uses verbatim — the gaze source is whichever entry of `session.inputSources`\n * reports `targetRayMode === 'gaze'`. `trackedSources` is checked afterwards\n * because some runtimes surface non-primary sources only there; the\n * diagnostics log says which list produced the hit.\n */\nfunction findGazeSource(session: XRSession): {\n source: XRInputSource | undefined;\n fromTrackedSources: boolean;\n} {\n for (const source of session.inputSources) {\n if (source.targetRayMode === 'gaze') {\n return { source, fromTrackedSources: false };\n }\n }\n if (session.trackedSources) {\n for (const source of session.trackedSources) {\n if (source.targetRayMode === 'gaze') {\n return { source, fromTrackedSources: true };\n }\n }\n }\n return { source: undefined, fromTrackedSources: false };\n}\n\n/**\n * Thresholds lifted from the standalone WebXR eye-gaze diagnostic page, so a\n * verdict logged here means the same thing as a verdict shown there.\n */\nconst GAZE_VERDICT = {\n /** Gaze/head separation that proves the eye ray is genuinely independent. */\n passAngleDeg: 1.5,\n /** Below this, one frame's gaze and head rays count as \"the same ray\". */\n identicalAngleDeg: 0.05,\n /** Below this (millimetres), one frame's gaze and head origins coincide. */\n identicalPositionMm: 0.5,\n /** Ratio of identical frames that indicates a head-pose mapping bug. */\n headLockedRatio: 0.95,\n /** Max separation still counted as head-locked. */\n headLockedAngleDeg: 0.1,\n /** Minimum evidence before any negative verdict is logged. */\n minSeconds: 3,\n minFrames: 90,\n} as const;\n\nconst RAD_TO_DEG = 180 / Math.PI;\nconst diagForward = new Vector3();\nconst diagHeadForward = new Vector3();\n\nconst RETICLE_FORWARD = new Vector3(0, 0, 1);\n\nfunction isIntentionalHeadDirectedPreview(): boolean {\n const preview = (\n globalThis as typeof globalThis & {\n __IWSDK_TARGET_DEVICE_PREVIEW__?: {\n active?: boolean;\n gazeSimulation?: 'head' | false;\n };\n }\n ).__IWSDK_TARGET_DEVICE_PREVIEW__;\n return preview?.active === true && preview.gazeSimulation === 'head';\n}\n\n/**\n * The development emulator (desktop IWER or a native override) supplies gaze\n * that only moves when aimed, so it starts out matching the head and must not\n * be reported as real eye data or as a head-locked runtime.\n */\nfunction isEmulatedGaze(): boolean {\n const profile = (\n globalThis as typeof globalThis & {\n __IWSDK_EMULATION_PROFILE?: { active?: boolean };\n }\n ).__IWSDK_EMULATION_PROFILE;\n return profile?.active === true;\n}\n\n/**\n * One-shot console diagnostics for the gaze pipeline.\n *\n * Eye tracking fails silently in several distinct ways — feature not granted,\n * no gaze input source, source present but posed null, or a runtime that maps\n * the gaze target ray onto the head pose. These can otherwise look like either\n * missing or head-locked gaze, so each gets its own message with the\n * remediation that actually applies. Every message fires at most once per\n * state transition, so this is safe to leave on in a per-frame path.\n */\nclass GazeDiagnostics {\n private sessionStart = -1;\n private loggedFeature = false;\n private loggedMissingSource = false;\n private loggedTrackedSourcesFallback = false;\n private loggedPoseThrow = false;\n private loggedNoTargets = false;\n private loggedVerdict = false;\n private loggedInconclusive = false;\n private sourcePresent = false;\n /** Tri-state so the very first sample always logs its pose validity. */\n private poseValid: boolean | null = null;\n\n // Head-versus-gaze separation stats, accumulated over valid poses only.\n private firstValidPoseAt = -1;\n private comparisonFrames = 0;\n private identicalFrames = 0;\n private maxAngleDeg = 0;\n private maxPositionMm = 0;\n\n reset(): void {\n this.sessionStart = -1;\n this.loggedFeature = false;\n this.loggedMissingSource = false;\n this.loggedTrackedSourcesFallback = false;\n this.loggedPoseThrow = false;\n this.loggedNoTargets = false;\n this.loggedVerdict = false;\n this.loggedInconclusive = false;\n this.sourcePresent = false;\n this.poseValid = null;\n this.firstValidPoseAt = -1;\n this.comparisonFrames = 0;\n this.identicalFrames = 0;\n this.maxAngleDeg = 0;\n this.maxPositionMm = 0;\n }\n\n /**\n * @param time Monotonic seconds, matching {@link GazePointer.update}.\n * @param xrOrigin Rig whose `eyeSpace`/`head` hold this frame's poses.\n */\n frame(\n time: number,\n xrOrigin: XROrigin,\n session: XRSession,\n gazeSource: XRInputSource | undefined,\n fromTrackedSources: boolean,\n posed: boolean,\n ): void {\n if (this.sessionStart < 0) {\n this.sessionStart = time;\n }\n this.logFeature(session);\n this.logSource(time, gazeSource, fromTrackedSources);\n this.logPose(gazeSource, posed);\n if (posed) {\n this.compareWithHead(time, xrOrigin);\n }\n }\n\n /** Nothing is gaze-eligible, so gaze can never hit anything. */\n targets(count: number): void {\n if (count > 0) {\n this.loggedNoTargets = false;\n return;\n }\n if (this.loggedNoTargets) {\n return;\n }\n this.loggedNoTargets = true;\n console.info(\n '[iwsdk][gaze] no ray-interactable targets are available, so the gaze ' +\n 'cone has nothing to hit.',\n );\n }\n\n poseThrew(error: unknown): void {\n if (this.loggedPoseThrow) {\n return;\n }\n this.loggedPoseThrow = true;\n console.warn(\n '[iwsdk][gaze] frame.getPose(gazeSource.targetRaySpace) threw; tracked ' +\n 'gaze is unavailable for this frame.',\n error,\n );\n }\n\n /** Report whether the runtime actually granted `gaze-tracking`. */\n private logFeature(session: XRSession): void {\n if (this.loggedFeature) {\n return;\n }\n this.loggedFeature = true;\n // `enabledFeatures` is not in every UA's lib.dom typing yet.\n const enabled = (session as XRSession & { enabledFeatures?: string[] })\n .enabledFeatures;\n if (!enabled) {\n console.info(\n \"[iwsdk][gaze] this browser doesn't expose session.enabledFeatures, \" +\n \"so whether 'gaze-tracking' was granted can't be confirmed here. \" +\n 'Watch for the gaze XRInputSource message below instead.',\n );\n return;\n }\n const enabledFeatures = Array.from(enabled);\n if (\n enabledFeatures.includes('gaze-tracking') ||\n enabledFeatures.includes('eye-tracking')\n ) {\n console.info(\"[iwsdk][gaze] 'gaze-tracking' granted for this session.\", {\n enabledFeatures,\n });\n return;\n }\n console.warn(\n \"[iwsdk][gaze] 'gaze-tracking' was NOT granted for this session, so \" +\n 'tracked gaze is unavailable. Check that the project requests ' +\n 'xr.features.gazeTracking, that this browser build exposes eye ' +\n \"tracking, and that the page's permissions policy allows \" +\n 'xr-spatial-tracking.',\n { enabledFeatures },\n );\n }\n\n private logSource(\n time: number,\n gazeSource: XRInputSource | undefined,\n fromTrackedSources: boolean,\n ): void {\n const present = !!gazeSource;\n\n if (present && fromTrackedSources && !this.loggedTrackedSourcesFallback) {\n this.loggedTrackedSourcesFallback = true;\n console.info(\n '[iwsdk][gaze] gaze source found in session.trackedSources rather ' +\n 'than session.inputSources.',\n );\n }\n\n if (present !== this.sourcePresent) {\n this.sourcePresent = present;\n this.poseValid = null;\n if (present) {\n // A later disconnect is \"showed up then left\", never \"never appeared\".\n this.loggedMissingSource = true;\n console.info('[iwsdk][gaze] gaze XRInputSource appeared.', {\n profiles: Array.from(gazeSource!.profiles),\n handedness: gazeSource!.handedness,\n });\n } else {\n console.warn(\n '[iwsdk][gaze] the gaze XRInputSource disappeared; ' +\n 'ordinary hand/controller far targeting is now active.',\n );\n }\n return;\n }\n\n // Never showed up at all — distinct failure from \"showed up then left\".\n if (\n !present &&\n !this.loggedMissingSource &&\n time - this.sessionStart >= GAZE_VERDICT.minSeconds\n ) {\n this.loggedMissingSource = true;\n console.warn(\n '[iwsdk][gaze] no XRInputSource with targetRayMode === \"gaze\" ' +\n `appeared within ${GAZE_VERDICT.minSeconds}s of session start. ` +\n 'Ordinary hand/controller far targeting remains active. Common causes: the ' +\n 'feature was not granted, eye tracking is disabled in system ' +\n 'settings, the headset has not been calibrated for this user, or ' +\n 'the hardware has no eye tracking.',\n );\n }\n }\n\n private logPose(gazeSource: XRInputSource | undefined, posed: boolean): void {\n if (!gazeSource || posed === this.poseValid) {\n return;\n }\n this.poseValid = posed;\n if (posed) {\n console.info(\n isEmulatedGaze()\n ? '[iwsdk][gaze] emulated gaze pose is valid (synthetic, not eye tracking).'\n : '[iwsdk][gaze] eye pose is valid — real gaze data is flowing.',\n );\n } else {\n console.warn(\n '[iwsdk][gaze] the gaze input source is present but ' +\n 'frame.getPose(targetRaySpace) returned null, so tracked gaze is ' +\n 'temporarily unavailable. Common causes: OS eye-tracking permission ' +\n 'not granted, headset not calibrated, or hardware without eye tracking.',\n );\n }\n }\n\n /**\n * Compare the tracked gaze ray against the head ray. A runtime can hand back\n * a perfectly valid gaze pose that is just a copy of the viewer pose; that\n * is indistinguishable from the fallback unless the two are measured.\n */\n private compareWithHead(time: number, xrOrigin: XROrigin): void {\n if (this.loggedVerdict) {\n return;\n }\n const eye = xrOrigin.eyeSpace;\n const head = xrOrigin.head;\n diagForward.set(0, 0, -1).applyQuaternion(eye.quaternion);\n diagHeadForward.set(0, 0, -1).applyQuaternion(head.quaternion);\n const dot = Math.min(1, Math.max(-1, diagForward.dot(diagHeadForward)));\n const angleDeg = Math.acos(dot) * RAD_TO_DEG;\n const positionMm = eye.position.distanceTo(head.position) * 1000;\n\n if (this.firstValidPoseAt < 0) {\n this.firstValidPoseAt = time;\n }\n this.comparisonFrames++;\n this.maxAngleDeg = Math.max(this.maxAngleDeg, angleDeg);\n this.maxPositionMm = Math.max(this.maxPositionMm, positionMm);\n if (\n angleDeg < GAZE_VERDICT.identicalAngleDeg &&\n positionMm < GAZE_VERDICT.identicalPositionMm\n ) {\n this.identicalFrames++;\n }\n\n if (this.maxAngleDeg >= GAZE_VERDICT.passAngleDeg) {\n this.loggedVerdict = true;\n console.info(\n '[iwsdk][gaze] real eye movement observed — the gaze ray separates ' +\n `from the head ray by up to ${this.maxAngleDeg.toFixed(2)}°.`,\n );\n return;\n }\n\n if (\n time - this.firstValidPoseAt < GAZE_VERDICT.minSeconds ||\n this.comparisonFrames < GAZE_VERDICT.minFrames\n ) {\n return;\n }\n\n const identicalRatio = this.identicalFrames / this.comparisonFrames;\n if (\n identicalRatio >= GAZE_VERDICT.headLockedRatio &&\n this.maxAngleDeg < GAZE_VERDICT.headLockedAngleDeg &&\n this.maxPositionMm < GAZE_VERDICT.identicalPositionMm\n ) {\n this.loggedVerdict = true;\n if (isIntentionalHeadDirectedPreview()) {\n console.info(\n '[iwsdk][gaze] target-device preview is intentionally ' +\n 'providing head-directed synthetic gaze.',\n );\n return;\n }\n if (isEmulatedGaze()) {\n console.info(\n '[iwsdk][gaze] emulated gaze still points where the head does; ' +\n 'aim it (for example with xr look-at on \"gaze\") to test targeting.',\n );\n return;\n }\n console.warn(\n '[iwsdk][gaze] the gaze target-ray pose matched the head pose on ' +\n `${(identicalRatio * 100).toFixed(0)}% of ${this.comparisonFrames} ` +\n `frames (max separation ${this.maxAngleDeg.toFixed(3)}°). Eye ` +\n 'tracking is reporting poses, but the runtime is mapping ' +\n 'XRTargetRaySpace onto the head pose, so gaze behaves as ' +\n 'head-pointing. This is a runtime/build issue, not an app one.',\n );\n return;\n }\n\n if (!this.loggedInconclusive) {\n this.loggedInconclusive = true;\n console.info(\n `[iwsdk][gaze] inconclusive: only ${this.maxAngleDeg.toFixed(2)}° of ` +\n `gaze/head separation over ${this.comparisonFrames} frames. Hold ` +\n 'your head still and look far left and right to confirm real gaze.',\n );\n }\n }\n}\n\n/**\n * Singleton gaze pointer. Peer of {@link MultiPointer} in\n * {@link XRInputManager}.\n *\n * @remarks\n * - One global instance — gaze has no handedness.\n * - Samples the WebXR gaze target ray itself via\n * {@link GazePointer.sampleGazePose}, publishing the result to\n * {@link XROrigin.eyeSpace}. The hand/controller ray owns far targeting when\n * a gaze source is unavailable. {@link GazePointerOptions.diagnostics}\n * explains the silent failure modes.\n * - Candidate selection is delegated to a {@link GazeCandidateProvider};\n * the default {@link GazeConecaster} does OBB cone membership and\n * time-weighted dwell consensus while this pointer resolves surfaces with\n * the same pmndrs ray intersector used for event delivery.\n * - Selector composes either hand's pinch; once selecting, the other hand\n * is ignored until release (per-hand mutual exclusion, matching Meta\n * Interaction SDK's `HandGazeInteractor` semantics).\n * - Drives a real `@pmndrs/pointer-events` pointer so UIKit panels click\n * naturally on gaze-pinch.\n * - Keeps its optional debug reticle hidden by default. Production feedback\n * belongs on the hovered target, matching Meta Interaction SDK.\n *\n * @category Pointer\n */\nexport class GazePointer {\n public readonly reticle: Mesh<CircleGeometry, MeshBasicMaterial>;\n\n public provider: GazeCandidateProvider;\n public suppressWhenDirectPointerActive: boolean;\n public pointerTransformFollowsHand: boolean;\n public showDebugReticle: boolean;\n\n private _trackingLossGraceSeconds = 5;\n\n public get trackingLossGraceSeconds(): number {\n return this._trackingLossGraceSeconds;\n }\n\n public set trackingLossGraceSeconds(value: number) {\n this._trackingLossGraceSeconds = Number.isFinite(value)\n ? Math.max(0, value)\n : 0;\n }\n\n /** See {@link GazePointerOptions.diagnostics}. */\n public diagnosticsEnabled: boolean;\n\n /**\n * OneEuro smoother applied to the raw gaze pose. Public so hosts can retune\n * `minCutoff`/`beta` from config without rebuilding the pointer.\n */\n public readonly filter: FilteredEyeGaze;\n\n /**\n * Real `@pmndrs/pointer-events` Pointer driven by the filtered gaze ray.\n * Each frame: pose-update + `pointer.move(scene)` raycasts from the gaze\n * origin so UIKit and any other pointer-events listeners see enter/leave/\n * move events from the gaze just like they do from the hand ray. On pinch\n * we forward `down`/`up` with `button: 0` so `click` fires naturally.\n */\n public readonly pointer: Pointer;\n public readonly pointerState: GazePointerState = {\n source: 'gaze',\n handedness: null,\n };\n\n private readonly filteredOrigin = new Vector3();\n private readonly filteredQuaternion = new Quaternion();\n private readonly rawOrigin = new Vector3();\n private readonly rawQuaternion = new Quaternion();\n private readonly direction = new Vector3();\n private readonly aimDirection = new Vector3();\n private readonly reticleOffset = new Vector3();\n private readonly rayTarget = new Vector3();\n private readonly rayUp = new Vector3();\n private readonly handOrigin = new Vector3();\n private readonly handQuaternion = new Quaternion();\n private readonly worldRayQuaternion = new Quaternion();\n private readonly handRelativeRayQuaternion = new Quaternion();\n private readonly tmpQuat = new Quaternion();\n private readonly lookMatrix = new Matrix4();\n private readonly normalMatrix = new Matrix3();\n\n /** Reticle tint while gaze is genuinely tracked. */\n private readonly reticleTrackedColor: Color;\n\n /**\n * Synthetic `Object3D` whose world transform mirrors the *filtered* gaze\n * pose. Lives under `xrOrigin` so it inherits rig motion; the @pmndrs ray\n * intersector reads its position/quaternion to cast from.\n */\n private readonly gazeRaySpace: Object3D;\n\n private readonly conecasterCtx: GazeCandidateContext = {\n origin: this.filteredOrigin,\n direction: this.direction,\n candidates: [] as ReadonlyArray<Object3D>,\n intersectCandidate: (candidate, direction) =>\n this.intersectCandidate(candidate, direction),\n };\n\n private readonly nativeEvent = { timeStamp: 0 };\n private readonly buttonEvent = { timeStamp: 0, button: 0 };\n\n private currentHit: GazeHit | null = null;\n private heldHit: GazeHit | null = null;\n private heldByHand: GazeHand | null = null;\n private wasSelecting = false;\n private buttonDown = false;\n private heldFollowsHand = false;\n private hasAcquiredTrackedGaze = false;\n private gazeSource: XRInputSource | null = null;\n private gazeSourcePresent = false;\n private lastTrackedPoseTime = Number.NEGATIVE_INFINITY;\n\n private readonly diagnostics = new GazeDiagnostics();\n\n constructor(\n private readonly xrOrigin: XROrigin,\n private readonly scene: Scene,\n camera: PerspectiveCamera,\n options: GazePointerOptions = {},\n ) {\n this.provider = new GazeConecaster();\n this.suppressWhenDirectPointerActive =\n options.suppressWhenDirectPointerActive ?? true;\n this.pointerTransformFollowsHand =\n options.pointerTransformFollowsHand ?? true;\n this.showDebugReticle = options.showDebugReticle ?? false;\n this.trackingLossGraceSeconds = options.trackingLossGraceSeconds ?? 5;\n this.diagnosticsEnabled = options.diagnostics ?? true;\n this.filter = new FilteredEyeGaze(options.filter);\n\n this.reticleTrackedColor =\n options.reticleColor instanceof Color\n ? options.reticleColor.clone()\n : new Color(options.reticleColor ?? 0xffffff);\n const radius = options.reticleRadius ?? 0.012;\n this.reticle = new Mesh(\n new CircleGeometry(radius, 32),\n new MeshBasicMaterial({\n color: this.reticleTrackedColor.clone(),\n transparent: true,\n opacity: 0.85,\n depthWrite: false,\n depthTest: false,\n }),\n );\n this.reticle.renderOrder = Infinity;\n this.reticle.visible = false;\n this.reticle.name = 'gaze-reticle';\n\n // Synthetic ray source for the @pmndrs Pointer. We can't use eyeSpace\n // directly because we want the *filtered* pose, not the raw per-frame\n // gaze. Manual matrix updates: we drive position/quaternion explicitly\n // each frame from the filter output.\n this.gazeRaySpace = new Object3D();\n this.gazeRaySpace.name = 'gaze-ray-space';\n this.gazeRaySpace.matrixAutoUpdate = false;\n\n this.pointer = createRayPointer(\n () => camera,\n { current: this.gazeRaySpace },\n this.pointerState,\n // contextMenu lives on button 2; gaze never produces it. Disable to\n // avoid spurious contextmenu events.\n {\n contextMenuButton: -1,\n filter: isObjectTreeVisible,\n },\n );\n // BVH-accelerated firstHitOnly raycast (matches hand RayPointer).\n const raycaster = (\n this.pointer.intersector as unknown as {\n raycaster?: { firstHitOnly?: boolean; camera?: PerspectiveCamera };\n }\n ).raycaster;\n if (raycaster) {\n raycaster.firstHitOnly = true;\n // Sprite.raycast needs the viewing camera (see RayPointer).\n raycaster.camera = camera;\n }\n }\n\n /**\n * Add or remove the pointer's rig nodes (debug reticle and ray space).\n *\n * The pointer is constructed eagerly by {@link XRInputManager} so systems can\n * hold a stable reference, but an app that never uses gaze shouldn't pay for\n * gaze geometry in every rig matrix walk — so nothing is parented until gaze\n * is actually switched on.\n */\n setAttached(attached: boolean): void {\n if (attached) {\n this.xrOrigin.add(this.reticle, this.gazeRaySpace);\n } else {\n this.reticle.removeFromParent();\n this.gazeRaySpace.removeFromParent();\n }\n }\n\n /**\n * Read the gaze target ray off the live frame and write it into\n * {@link XROrigin.eyeSpace}.\n *\n * This mirrors the standalone WebXR eye-gaze diagnostic page's probe: find\n * the input source whose `targetRayMode` is `'gaze'`, then pose its\n * `targetRaySpace` against the frame's reference space, tolerating a throw.\n * The source can exist while `getPose` returns null (uncalibrated headset,\n * withheld permission), so source presence and pose validity are tracked\n * separately. A missing or invalid pose clears the current gaze pose so stale\n * tracking can never be used for targeting.\n *\n * Call once per frame before {@link GazePointer.update}.\n */\n sampleGazePose(time: number, context: GazeFrameContext): void {\n const { frame, referenceSpace, session } = context;\n const { source, fromTrackedSources } = findGazeSource(session);\n const nextGazeSource = source ?? null;\n if (nextGazeSource !== this.gazeSource) {\n // Grace belongs to one uninterrupted source lifetime. A source that is\n // removed or replaced must earn ownership again with a valid pose.\n this.hasAcquiredTrackedGaze = false;\n this.lastTrackedPoseTime = Number.NEGATIVE_INFINITY;\n this.gazeSource = nextGazeSource;\n }\n this.gazeSourcePresent = source != null;\n this.xrOrigin.clearGaze();\n let pose: XRPose | null = null;\n if (source) {\n try {\n pose = frame.getPose(source.targetRaySpace, referenceSpace) ?? null;\n } catch (error) {\n if (this.diagnosticsEnabled) {\n this.diagnostics.poseThrew(error);\n }\n }\n }\n\n if (pose) {\n this.xrOrigin.applyTrackedEyePose(pose.transform);\n this.hasAcquiredTrackedGaze = true;\n this.lastTrackedPoseTime = time;\n }\n\n if (this.diagnosticsEnabled) {\n this.diagnostics.frame(\n time,\n this.xrOrigin,\n session,\n source,\n fromTrackedSources,\n !!pose,\n );\n }\n }\n\n /**\n * Whether gaze mode should own far targeting this frame.\n *\n * This mirrors ISDK's mode/source distinction: a valid pose activates gaze;\n * then a short grace period keeps the mode active when a frame's pose is\n * invalid (for example, a blink), while targeting itself clears. WebXR does\n * not expose a separate pose-validity signal, so source enumeration defines\n * the lifetime of that grace period. Removing the source hands far targeting\n * back to hands/controllers immediately; the grace period applies only to\n * temporary pose invalidity (for example, a blink).\n */\n ownsFarTargeting(time: number): boolean {\n if (!this.gazeSourcePresent) {\n return false;\n }\n if (this.xrOrigin.gazeOrigin === 'tracked') {\n return true;\n }\n return (\n this.hasAcquiredTrackedGaze &&\n time - this.lastTrackedPoseTime <= this.trackingLossGraceSeconds\n );\n }\n\n /** Whether this frame has a pose that is safe to use for fresh targeting. */\n canTarget(): boolean {\n return this.xrOrigin.gazeOrigin === 'tracked';\n }\n\n /**\n * Swap the candidate provider at runtime (e.g. a multi-cone or dwell-only\n * provider). The previous provider is reset and detached.\n */\n setCandidateProvider(provider: GazeCandidateProvider): void {\n this.provider.reset();\n this.provider = provider;\n }\n\n update(\n targetingAvailable: boolean,\n dt: number,\n time: number,\n input: GazePointerInput,\n ): void {\n this.nativeEvent.timeStamp = time * 1000;\n\n // Source removal is a mode transition, not transient tracking loss. End a\n // gaze-started gesture before hand/controller far targeting resumes.\n if (!this.gazeSourcePresent && !targetingAvailable && this.heldByHand) {\n this.releaseSelect(true);\n }\n\n if (!targetingAvailable && !this.heldByHand) {\n this.provider.reset();\n this.filter.reset();\n this.currentHit = null;\n this.reticle.visible = false;\n this.releaseAndDisable();\n return;\n }\n\n let releasedSelect = false;\n if (this.heldByHand) {\n const hand = this.heldByHand;\n const pinchEnded = input.pinchEnd[hand];\n const targetAvailable = this.isHeldTargetAvailable(input.candidates);\n if (pinchEnded || !input.pinchActive[hand] || !targetAvailable) {\n // A real pinch-end is an up/click. Tracking loss, reset, removal, or\n // semantic invisibility interrupts the gesture and must cancel it.\n this.releaseSelect(!pinchEnded || !targetAvailable);\n releasedSelect = true;\n } else {\n this.driveHeldPointer();\n this.updateReticle();\n return;\n }\n }\n\n // A transient invalid eye pose clears hover immediately, matching ISDK,\n // but does not interrupt a selection that was already handed off to the\n // pinching hand. Once that gesture ends there is no stale pose from which\n // to start a new selection.\n if (!targetingAvailable) {\n this.provider.reset();\n this.filter.reset();\n this.currentHit = null;\n this.reticle.visible = false;\n this.releaseAndDisable();\n return;\n }\n\n if (this.diagnosticsEnabled) {\n this.diagnostics.targets(input.candidates.length);\n }\n\n // World-space pose of the (raw) gaze, then smoothed in-place. This runs\n // only with a current targeting pose, so a transient invalid frame cannot\n // contaminate the eye filter with the previous valid gaze pose.\n this.xrOrigin.eyeSpace.getWorldPosition(this.rawOrigin);\n this.xrOrigin.eyeSpace.getWorldQuaternion(this.rawQuaternion);\n this.filter.filter(\n this.rawOrigin,\n this.rawQuaternion,\n Math.max(dt, 1 / 240),\n this.filteredOrigin,\n this.filteredQuaternion,\n );\n this.direction.set(0, 0, -1).applyQuaternion(this.filteredQuaternion);\n\n const externallySuppressed =\n this.suppressWhenDirectPointerActive &&\n (input.directPointerActive.left || input.directPointerActive.right);\n\n if (externallySuppressed) {\n this.currentHit = null;\n this.reticle.visible = false;\n this.commitNoTarget();\n } else {\n this.conecasterCtx.candidates = input.candidates;\n this.currentHit = this.provider.update(time, dt, this.conecasterCtx);\n if (this.currentHit) {\n this.commitHit(this.currentHit);\n } else {\n this.commitNoTarget();\n }\n }\n\n if (!releasedSelect) {\n this.processSelector(input);\n }\n this.updateReticle();\n }\n\n /** Resolve one candidate through the same intersector used for dispatch. */\n private intersectCandidate(\n candidate: Object3D,\n direction: Vector3,\n ): Intersection | null {\n this.setRayFromDirection(\n this.filteredOrigin,\n direction,\n this.filteredQuaternion,\n );\n const intersection = this.computeScopedIntersection([candidate]);\n return intersection.object.isVoidObject ? null : intersection;\n }\n\n /** Install the provider's authoritative intersection and emit one move. */\n private commitHit(hit: GazeHit): void {\n this.ensurePointerEnabled();\n this.setRayWorldPose(\n hit.intersection.pointerPosition,\n hit.intersection.pointerQuaternion,\n );\n this.pointer.setIntersection(hit.intersection);\n this.pointer.commit(this.nativeEvent, true);\n }\n\n /** Commit a void hit so the previous target receives out/leave events. */\n private commitNoTarget(): void {\n this.currentHit = null;\n this.ensurePointerEnabled();\n this.setRayFromDirection(\n this.filteredOrigin,\n this.direction,\n this.filteredQuaternion,\n );\n const intersection = this.computeScopedIntersection([]);\n this.pointer.setIntersection(intersection);\n this.pointer.commit(this.nativeEvent, true);\n }\n\n private computeScopedIntersection(descendants: Object3D[]): Intersection {\n const scene = this.scene as Scene & {\n interactableDescendants?: Object3D[];\n };\n const previous = scene.interactableDescendants;\n scene.interactableDescendants = descendants;\n try {\n return this.pointer.computeIntersection(\n 'pointer',\n this.scene,\n this.nativeEvent,\n );\n } finally {\n scene.interactableDescendants = previous;\n }\n }\n\n private ensurePointerEnabled(): void {\n if (!this.pointer.getEnabled()) {\n this.pointer.setEnabled(true, this.nativeEvent, false);\n }\n }\n\n /** Pose the synthetic ray in world space while it remains parented to the rig. */\n private setRayWorldPose(origin: Vector3, quaternion: Quaternion): void {\n this.xrOrigin.updateWorldMatrix(true, false);\n this.gazeRaySpace.position.copy(origin);\n this.xrOrigin.worldToLocal(this.gazeRaySpace.position);\n this.xrOrigin.getWorldQuaternion(this.tmpQuat).invert();\n this.gazeRaySpace.quaternion.copy(this.tmpQuat).multiply(quaternion);\n this.gazeRaySpace.updateMatrix();\n this.gazeRaySpace.updateMatrixWorld(true);\n }\n\n /** Build a ray pose whose -Z axis follows `direction`. */\n private setRayFromDirection(\n origin: Vector3,\n direction: Vector3,\n upQuaternion: Quaternion,\n ): void {\n this.rayTarget.copy(origin).add(direction);\n this.rayUp.set(0, 1, 0).applyQuaternion(upQuaternion);\n this.lookMatrix.lookAt(origin, this.rayTarget, this.rayUp);\n this.worldRayQuaternion.setFromRotationMatrix(this.lookMatrix);\n this.setRayWorldPose(origin, this.worldRayQuaternion);\n }\n\n /** Release event state before disabling or detaching the pointer. */\n private releaseAndDisable(): void {\n this.releaseSelect(true);\n if (!this.pointer.getEnabled()) {\n return;\n }\n this.pointer.exit(this.nativeEvent);\n this.pointer.setEnabled(false, this.nativeEvent, false);\n }\n\n private updateReticle(): void {\n if (!this.showDebugReticle) {\n this.reticle.visible = false;\n return;\n }\n const intersection = this.pointer.getIntersection();\n if (!intersection || intersection.object.isVoidObject) {\n this.reticle.visible = false;\n return;\n }\n if (\n this.reticle.material.color.getHex() !== this.reticleTrackedColor.getHex()\n ) {\n this.reticle.material.color.copy(this.reticleTrackedColor);\n }\n this.reticleOffset.copy(intersection.point);\n this.xrOrigin.worldToLocal(this.reticleOffset);\n this.reticle.position.copy(this.reticleOffset);\n\n const normal = intersection.normal ?? intersection.face?.normal;\n if (normal) {\n this.normalMatrix.getNormalMatrix(intersection.object.matrixWorld);\n this.rayUp.copy(normal).applyNormalMatrix(this.normalMatrix).normalize();\n this.reticle.quaternion.setFromUnitVectors(RETICLE_FORWARD, this.rayUp);\n this.xrOrigin.getWorldQuaternion(this.tmpQuat).invert();\n this.reticle.quaternion.premultiply(this.tmpQuat);\n }\n // Scale reticle gently with distance for legibility.\n const s = Math.max(0.6, Math.min(2, intersection.distance));\n this.reticle.scale.setScalar(s);\n this.reticle.visible = true;\n }\n\n private processSelector(input: GazePointerInput): void {\n const hand: GazeHand | null = input.pinchStart.left\n ? 'left'\n : input.pinchStart.right\n ? 'right'\n : null;\n if (!hand || !this.currentHit) {\n return;\n }\n\n const gazeHit = this.currentHit;\n this.heldByHand = hand;\n this.pointerState.handedness = hand;\n this.heldFollowsHand = false;\n\n let selectIntersection = gazeHit.intersection;\n if (this.pointerTransformFollowsHand) {\n const handSpace = this.xrOrigin.raySpaces[hand];\n handSpace.updateWorldMatrix(true, false);\n handSpace.getWorldPosition(this.handOrigin);\n handSpace.getWorldQuaternion(this.handQuaternion);\n this.aimDirection.copy(gazeHit.intersection.point).sub(this.handOrigin);\n if (this.aimDirection.lengthSq() > 1e-12) {\n this.aimDirection.normalize();\n this.setRayFromDirection(\n this.handOrigin,\n this.aimDirection,\n this.handQuaternion,\n );\n const handIntersection = this.computeScopedIntersection([\n gazeHit.object,\n ]);\n if (\n !handIntersection.object.isVoidObject &&\n handIntersection.object === gazeHit.intersection.object\n ) {\n selectIntersection = handIntersection;\n this.handRelativeRayQuaternion\n .copy(this.handQuaternion)\n .invert()\n .multiply(handIntersection.pointerQuaternion);\n this.heldFollowsHand = true;\n } else {\n this.setRayWorldPose(\n gazeHit.intersection.pointerPosition,\n gazeHit.intersection.pointerQuaternion,\n );\n }\n }\n }\n\n this.heldHit = {\n object: gazeHit.object,\n intersection: selectIntersection,\n angularDistance: gazeHit.angularDistance,\n };\n this.wasSelecting = true;\n this.pointer.setIntersection(selectIntersection);\n // The hover path already emitted this frame's move. This commit only needs\n // to install the hand-origin intersection before a synchronous capture in\n // `down()`; enter/leave bookkeeping still runs if the leaf changed.\n this.pointer.commit(this.nativeEvent, false);\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = 0;\n this.buttonDown = true;\n try {\n this.pointer.down(this.buttonEvent);\n } catch {\n this.releaseSelect(true);\n }\n }\n\n private driveHeldPointer(): void {\n if (!this.heldHit || !this.heldByHand) {\n return;\n }\n\n if (this.pointer.getPointerCapture()) {\n if (this.heldFollowsHand) {\n const handSpace = this.xrOrigin.raySpaces[this.heldByHand];\n handSpace.updateWorldMatrix(true, false);\n handSpace.getWorldPosition(this.handOrigin);\n handSpace.getWorldQuaternion(this.handQuaternion);\n this.worldRayQuaternion\n .copy(this.handQuaternion)\n .multiply(this.handRelativeRayQuaternion);\n this.setRayWorldPose(this.handOrigin, this.worldRayQuaternion);\n } else {\n this.setRayWorldPose(\n this.heldHit.intersection.pointerPosition,\n this.heldHit.intersection.pointerQuaternion,\n );\n }\n this.pointer.move(this.scene, this.nativeEvent);\n return;\n }\n\n // Plain clickable targets generally do not capture. Keep their select-time\n // intersection stable so small hand motion during the pinch cannot turn a\n // valid down into an up on the void object.\n this.setRayWorldPose(\n this.heldHit.intersection.pointerPosition,\n this.heldHit.intersection.pointerQuaternion,\n );\n this.pointer.setIntersection(this.heldHit.intersection);\n this.pointer.commit(this.nativeEvent, true);\n }\n\n private isHeldTargetAvailable(candidates: ReadonlyArray<Object3D>): boolean {\n const object = this.heldHit?.object;\n return (\n !!object && isObjectTreeVisible(object) && candidates.includes(object)\n );\n }\n\n private releaseSelect(cancelled = false): void {\n if (this.buttonDown) {\n this.buttonEvent.timeStamp = this.nativeEvent.timeStamp;\n this.buttonEvent.button = 0;\n if (cancelled) {\n try {\n this.pointer.cancel(this.nativeEvent);\n } catch {}\n // Pointer.cancel emits the correct event but the upstream pointer\n // keeps its button/capture bookkeeping. Clear it while disabled so no\n // pointerup or click is dispatched for an interrupted gesture.\n const wasEnabled = this.pointer.getEnabled();\n if (wasEnabled) {\n this.pointer.setEnabled(false, this.nativeEvent, true);\n }\n try {\n this.pointer.up(this.buttonEvent);\n } catch {}\n if (wasEnabled) {\n this.pointer.setEnabled(true, this.nativeEvent, false);\n }\n } else {\n try {\n this.pointer.up(this.buttonEvent);\n } catch {}\n }\n this.buttonDown = false;\n }\n this.heldHit = null;\n this.heldByHand = null;\n this.pointerState.handedness = null;\n this.heldFollowsHand = false;\n this.wasSelecting = false;\n }\n\n /** Current dwell winner's root Object3D (null if none/suppressed). */\n getCurrentTarget(): Object3D | null {\n return this.currentHit?.object ?? null;\n }\n\n /** Which hand initiated the active gaze-pinch select. */\n getHeldByHand(): GazeHand | null {\n return this.heldByHand;\n }\n\n /** True while a gaze-pinch select is held. */\n isSelecting(): boolean {\n return this.wasSelecting;\n }\n\n /** World-space gaze origin (post-filter). */\n getOrigin(): Vector3 {\n return this.filteredOrigin;\n }\n\n /** World-space gaze direction (post-filter, unit length). */\n getDirection(): Vector3 {\n return this.direction;\n }\n\n /**\n * Whether a valid gaze pose is available this frame.\n */\n getGazeOrigin(): GazeOrigin {\n return this.xrOrigin.gazeOrigin;\n }\n\n /**\n * Reset filter, provider, selector and diagnostic state. Call when gaze\n * becomes invalid (session ended, eye tracking lost) so we don't carry stale\n * samples, and so the next session re-reports its gaze verdict.\n */\n reset(): void {\n this.diagnostics.reset();\n this.provider.reset();\n this.filter.reset();\n this.currentHit = null;\n this.hasAcquiredTrackedGaze = false;\n this.gazeSource = null;\n this.gazeSourcePresent = false;\n this.lastTrackedPoseTime = Number.NEGATIVE_INFINITY;\n this.reticle.visible = false;\n this.releaseAndDisable();\n }\n\n dispose(): void {\n this.releaseAndDisable();\n this.reticle.geometry.dispose();\n this.reticle.material.dispose();\n this.reticle.removeFromParent();\n this.gazeRaySpace.removeFromParent();\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;AAwGH;;;;;;;;AAQG;AACH,SAAS,cAAc,CAAC,OAAkB,EAAA;AAIxC,IAAA,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,YAAY,EAAE;AACzC,QAAA,IAAI,MAAM,CAAC,aAAa,KAAK,MAAM,EAAE;AACnC,YAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE;QAC9C;IACF;AACA,IAAA,IAAI,OAAO,CAAC,cAAc,EAAE;AAC1B,QAAA,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,cAAc,EAAE;AAC3C,YAAA,IAAI,MAAM,CAAC,aAAa,KAAK,MAAM,EAAE;AACnC,gBAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE;YAC7C;QACF;IACF;IACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK,EAAE;AACzD;AAEA;;;AAGG;AACH,MAAM,YAAY,GAAG;;AAEnB,IAAA,YAAY,EAAE,GAAG;;AAEjB,IAAA,iBAAiB,EAAE,IAAI;;AAEvB,IAAA,mBAAmB,EAAE,GAAG;;AAExB,IAAA,eAAe,EAAE,IAAI;;AAErB,IAAA,kBAAkB,EAAE,GAAG;;AAEvB,IAAA,UAAU,EAAE,CAAC;AACb,IAA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;AACrB,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;AACnB,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI;AACtB,QAAA,IAAI,CAAC,sBAAsB,GAAG,KAAK;AACnC,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI;AACtB,QAAA,IAAI,CAAC,iBAAiB,GAAG,KAAK;AAC9B,QAAA,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,iBAAiB;AACnD,QAAA,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK;QAC5B,IAAI,CAAC,iBAAiB,EAAE;IAC1B;IAEA,OAAO,GAAA;QACL,IAAI,CAAC,iBAAiB,EAAE;AACxB,QAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC/B,QAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC/B,QAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;AAC/B,QAAA,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE;IACtC;AACD;;;;"}
@@ -13,6 +13,13 @@ export interface MultiPointerInput {
13
13
  selectEnd?: boolean;
14
14
  squeezeStart?: boolean;
15
15
  squeezeEnd?: boolean;
16
+ /**
17
+ * Whether the squeeze is held this frame. When `false`, a grab selection
18
+ * ends even without a `squeezeEnd` edge, for example after the input source
19
+ * switched from a controller to a hand mid-squeeze. Leave it undefined to
20
+ * rely on the edges alone.
21
+ */
22
+ squeezing?: boolean;
16
23
  /**
17
24
  * Temporarily disable the far ray without changing its registration.
18
25
  * Gaze mode uses this to make the hand/controller ray a fallback while
@@ -59,6 +66,16 @@ export declare class MultiPointer {
59
66
  private pointerStates;
60
67
  /** Hysteresis tracking: whether touch is currently in hover state */
61
68
  private touchHoverActive;
69
+ /**
70
+ * Set while a touch press cancelled by a grab (a squeeze, or a pinch routed
71
+ * to the grab pointer) waits for the tip to lift off. Until then the touch
72
+ * pointer isn't moved, so it neither hovers nor presses, as a browser makes
73
+ * a cancelled touch lift before it can press again. A tip still on the
74
+ * surface when the grab ends (always the case for a pokeable grabbable the
75
+ * tip pressed) would otherwise press it again at once, and pulling away
76
+ * would click it.
77
+ */
78
+ private touchLiftPending;
62
79
  /** Cached scene reference with type-specific descendants */
63
80
  private sceneWithDescendants;
64
81
  /** Reusable native event object to avoid per-frame allocations */
@@ -67,8 +84,9 @@ export declare class MultiPointer {
67
84
  private readonly rayPolicy;
68
85
  /**
69
86
  * Pointers that completed the upstream library's first ready move. Mirrors
70
- * its private `wasMoved` latch; neither latch is reset because MultiPointer
71
- * never calls `Pointer.exit()` on these long-lived instances.
87
+ * its private `wasMoved` latch. Only `Pointer.exit()` resets that latch,
88
+ * and MultiPointer calls it only in `releaseTouchForGrab()`, which removes
89
+ * the touch pointer from this set too.
72
90
  */
73
91
  private readonly movedPointers;
74
92
  /** Reusable event object for pointer down/up with button */
@@ -105,6 +123,55 @@ export declare class MultiPointer {
105
123
  * Check if a pointer has a valid candidate (intersection)
106
124
  */
107
125
  private hasValidCandidate;
126
+ /**
127
+ * Touch outranks grab so a fingertip or controller tip can press a pokeable,
128
+ * but only the active pointer's lifecycle runs and only the grab pointer
129
+ * takes the squeeze. Without this, any pokeable within touch range (or the
130
+ * grabbable itself, when it is also pokeable) swallows every squeeze. A
131
+ * squeeze is a grab intent, so the grab pointer takes over whenever its
132
+ * sphere has a target, even from a touch press, which it cancels. A ray
133
+ * selection keeps its lock: its trigger release only reaches it while it is
134
+ * the active pointer.
135
+ */
136
+ private preferGrabOnSqueeze;
137
+ /** Whether the grab sphere touches something a squeeze or pinch can grab. */
138
+ private grabHasTarget;
139
+ /**
140
+ * Ends what the touch pointer is doing when a grab takes the hand over.
141
+ *
142
+ * A press is cancelled. Left alone, it would hold the poked object pressed
143
+ * (`Pressed`, UIKit active) through the grab, and lifting the tip after a
144
+ * short grab would still click it. As when a browser cancels a touch, the
145
+ * object gets pointercancel, then pointerout and pointerleave from `exit()`,
146
+ * and no pointerup or click. The touch pointer then waits for the tip to
147
+ * lift off (`touchLiftPending`) before it hovers or presses again.
148
+ *
149
+ * With `endHover`, a touch pointer that only hovers something gets the
150
+ * leave events from `exit()` too, without the lift-off wait. A squeeze grab
151
+ * passes it because its lock freezes the touch pointer. A routed pinch
152
+ * doesn't: the touch pointer keeps moving through a pinch grab, so its
153
+ * hover stays current.
154
+ *
155
+ * A touch pointer that touches nothing is left alone. Its button is down
156
+ * then too: with no pokeable in reach, its hit is the scene's void object at
157
+ * distance 0, which is within `downRadius`. Cancelling that press would send
158
+ * pointercancel, pointerout and pointerleave to the void object, which
159
+ * bubble to the scene, and start a lift-off wait for nothing.
160
+ *
161
+ * In pointer-events 6.6.32, `cancel()` clears the pressed button, its click
162
+ * time and any capture. In 6.6.28 it only emits pointercancel and leaves
163
+ * the button down, and `exit()` doesn't clear it either: `exit()` drops the
164
+ * intersection and capture and commits. The touch pointer's move callback
165
+ * (from `createTouchPointer`), which that commit runs, then sees no contact
166
+ * and calls `up()`, which clears the button and emits nothing without an
167
+ * intersection.
168
+ */
169
+ private releaseTouchForGrab;
170
+ /**
171
+ * Whether the touch tip is within press distance of a pokeable. Probes
172
+ * without moving the touch pointer, so it emits no events.
173
+ */
174
+ private isTouchTipDown;
108
175
  /**
109
176
  * Switch active pointer to a new kind
110
177
  */
@@ -124,6 +191,8 @@ export declare class MultiPointer {
124
191
  /**
125
192
  * Get the policy for ray visual rendering
126
193
  */
194
+ /** Objects this hand may poke: its own list when the scene has one. */
195
+ private touchCandidates;
127
196
  getPolicyForRay(): {
128
197
  forceHideRay: boolean;
129
198
  };
@@ -1 +1 @@
1
- {"version":3,"file":"multi-pointer.d.ts","sourceRoot":"","sources":["../../src/pointer/multi-pointer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO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