@number10/phaserjsx 0.3.1 → 0.4.0

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.
Files changed (137) hide show
  1. package/dist/{TransformOriginView-KcTgaYRi.cjs → TransformOriginView-Bx81YEUU.cjs} +1077 -1500
  2. package/dist/TransformOriginView-Bx81YEUU.cjs.map +1 -0
  3. package/dist/{TransformOriginView-CzVjS16F.js → TransformOriginView-DCvId72M.js} +1200 -1623
  4. package/dist/TransformOriginView-DCvId72M.js.map +1 -0
  5. package/dist/camera/camera-fx-registry.d.ts +47 -0
  6. package/dist/camera/camera-fx-registry.d.ts.map +1 -0
  7. package/dist/camera/index.d.ts +6 -0
  8. package/dist/camera/index.d.ts.map +1 -0
  9. package/dist/camera/use-camera-fx.d.ts +59 -0
  10. package/dist/camera/use-camera-fx.d.ts.map +1 -0
  11. package/dist/components/appliers/applyBackground.d.ts +4 -0
  12. package/dist/components/appliers/applyBackground.d.ts.map +1 -1
  13. package/dist/components/appliers/applyParticles.d.ts +7 -0
  14. package/dist/components/appliers/applyParticles.d.ts.map +1 -0
  15. package/dist/components/appliers/applyParticlesLayout.d.ts +11 -0
  16. package/dist/components/appliers/applyParticlesLayout.d.ts.map +1 -0
  17. package/dist/components/creators/createParticlesLayout.d.ts +14 -0
  18. package/dist/components/creators/createParticlesLayout.d.ts.map +1 -0
  19. package/dist/components/custom/Accordion.d.ts +3 -2
  20. package/dist/components/custom/Accordion.d.ts.map +1 -1
  21. package/dist/components/custom/AlertDialog.d.ts +2 -1
  22. package/dist/components/custom/AlertDialog.d.ts.map +1 -1
  23. package/dist/components/custom/Button.d.ts +2 -1
  24. package/dist/components/custom/Button.d.ts.map +1 -1
  25. package/dist/components/custom/CharText/CharText.d.ts +2 -1
  26. package/dist/components/custom/CharText/CharText.d.ts.map +1 -1
  27. package/dist/components/custom/CharTextInput.d.ts +2 -1
  28. package/dist/components/custom/CharTextInput.d.ts.map +1 -1
  29. package/dist/components/custom/Dialog.d.ts +2 -1
  30. package/dist/components/custom/Dialog.d.ts.map +1 -1
  31. package/dist/components/custom/Divider.d.ts +2 -1
  32. package/dist/components/custom/Divider.d.ts.map +1 -1
  33. package/dist/components/custom/Dropdown.d.ts +2 -1
  34. package/dist/components/custom/Dropdown.d.ts.map +1 -1
  35. package/dist/components/custom/Graphics.d.ts +45 -0
  36. package/dist/components/custom/Graphics.d.ts.map +1 -0
  37. package/dist/components/custom/Icon.d.ts +3 -2
  38. package/dist/components/custom/Icon.d.ts.map +1 -1
  39. package/dist/components/custom/Image.d.ts +2 -1
  40. package/dist/components/custom/Image.d.ts.map +1 -1
  41. package/dist/components/custom/Joystick.d.ts +42 -0
  42. package/dist/components/custom/Joystick.d.ts.map +1 -0
  43. package/dist/components/custom/Modal.d.ts +2 -1
  44. package/dist/components/custom/Modal.d.ts.map +1 -1
  45. package/dist/components/custom/NineSlice.d.ts +2 -1
  46. package/dist/components/custom/NineSlice.d.ts.map +1 -1
  47. package/dist/components/custom/NineSliceButton.d.ts +2 -1
  48. package/dist/components/custom/NineSliceButton.d.ts.map +1 -1
  49. package/dist/components/custom/Particles.d.ts +17 -0
  50. package/dist/components/custom/Particles.d.ts.map +1 -0
  51. package/dist/components/custom/Portal.d.ts +2 -1
  52. package/dist/components/custom/Portal.d.ts.map +1 -1
  53. package/dist/components/custom/RadioButton.d.ts +2 -1
  54. package/dist/components/custom/RadioButton.d.ts.map +1 -1
  55. package/dist/components/custom/RadioGroup.d.ts +2 -5
  56. package/dist/components/custom/RadioGroup.d.ts.map +1 -1
  57. package/dist/components/custom/RefOriginView.d.ts +2 -1
  58. package/dist/components/custom/RefOriginView.d.ts.map +1 -1
  59. package/dist/components/custom/ScrollSlider.d.ts +3 -2
  60. package/dist/components/custom/ScrollSlider.d.ts.map +1 -1
  61. package/dist/components/custom/ScrollView.d.ts +13 -4
  62. package/dist/components/custom/ScrollView.d.ts.map +1 -1
  63. package/dist/components/custom/Sidebar.d.ts +2 -1
  64. package/dist/components/custom/Sidebar.d.ts.map +1 -1
  65. package/dist/components/custom/Slider.d.ts +4 -3
  66. package/dist/components/custom/Slider.d.ts.map +1 -1
  67. package/dist/components/custom/Sprite.d.ts +74 -0
  68. package/dist/components/custom/Sprite.d.ts.map +1 -0
  69. package/dist/components/custom/Tabs.d.ts +50 -0
  70. package/dist/components/custom/Tabs.d.ts.map +1 -0
  71. package/dist/components/custom/Text.d.ts +2 -1
  72. package/dist/components/custom/Text.d.ts.map +1 -1
  73. package/dist/components/custom/TileSprite.d.ts +60 -0
  74. package/dist/components/custom/TileSprite.d.ts.map +1 -0
  75. package/dist/components/custom/Toggle.d.ts +2 -1
  76. package/dist/components/custom/Toggle.d.ts.map +1 -1
  77. package/dist/components/custom/TransformOriginView.d.ts +3 -2
  78. package/dist/components/custom/TransformOriginView.d.ts.map +1 -1
  79. package/dist/components/custom/View.d.ts +2 -1
  80. package/dist/components/custom/View.d.ts.map +1 -1
  81. package/dist/components/custom/WrapText.d.ts +2 -1
  82. package/dist/components/custom/WrapText.d.ts.map +1 -1
  83. package/dist/components/custom/index.cjs +6 -1
  84. package/dist/components/custom/index.cjs.map +1 -1
  85. package/dist/components/custom/index.d.ts +3 -0
  86. package/dist/components/custom/index.d.ts.map +1 -1
  87. package/dist/components/custom/index.js +16 -11
  88. package/dist/components/index.d.ts +10 -8
  89. package/dist/components/index.d.ts.map +1 -1
  90. package/dist/components/internal/SceneWrapper.d.ts +1 -1
  91. package/dist/components/internal/SceneWrapper.d.ts.map +1 -1
  92. package/dist/components/primitives/particles.d.ts +37 -0
  93. package/dist/components/primitives/particles.d.ts.map +1 -0
  94. package/dist/core-types.d.ts +5 -0
  95. package/dist/core-types.d.ts.map +1 -1
  96. package/dist/gestures/gesture-manager.d.ts.map +1 -1
  97. package/dist/hooks.d.ts +124 -3
  98. package/dist/hooks.d.ts.map +1 -1
  99. package/dist/index.cjs +2152 -20
  100. package/dist/index.cjs.map +1 -1
  101. package/dist/index.d.ts +4 -1
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +2265 -132
  104. package/dist/index.js.map +1 -1
  105. package/dist/jsx-runtime.cjs.map +1 -1
  106. package/dist/jsx-runtime.d.ts +2 -3
  107. package/dist/jsx-runtime.d.ts.map +1 -1
  108. package/dist/jsx-runtime.js.map +1 -1
  109. package/dist/jsx-types.d.ts +8 -0
  110. package/dist/jsx-types.d.ts.map +1 -1
  111. package/dist/layout/layout-engine.d.ts.map +1 -1
  112. package/dist/particles/emit-zone.d.ts +67 -0
  113. package/dist/particles/emit-zone.d.ts.map +1 -0
  114. package/dist/particles/index.d.ts +8 -0
  115. package/dist/particles/index.d.ts.map +1 -0
  116. package/dist/particles/particle-types.d.ts +20 -0
  117. package/dist/particles/particle-types.d.ts.map +1 -0
  118. package/dist/particles/preset-registry.d.ts +46 -0
  119. package/dist/particles/preset-registry.d.ts.map +1 -0
  120. package/dist/particles/use-particles.d.ts +15 -0
  121. package/dist/particles/use-particles.d.ts.map +1 -0
  122. package/dist/particles/utils.d.ts +10 -0
  123. package/dist/particles/utils.d.ts.map +1 -0
  124. package/dist/plugin.d.ts +157 -0
  125. package/dist/plugin.d.ts.map +1 -0
  126. package/dist/theme-base.d.ts +10 -1
  127. package/dist/theme-base.d.ts.map +1 -1
  128. package/dist/theme-custom.d.ts +7 -0
  129. package/dist/theme-custom.d.ts.map +1 -1
  130. package/dist/theme-defaults.d.ts.map +1 -1
  131. package/dist/types.d.ts +18 -1
  132. package/dist/types.d.ts.map +1 -1
  133. package/dist/vdom.d.ts +28 -3
  134. package/dist/vdom.d.ts.map +1 -1
  135. package/package.json +1 -1
  136. package/dist/TransformOriginView-CzVjS16F.js.map +0 -1
  137. package/dist/TransformOriginView-KcTgaYRi.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"TransformOriginView-CzVjS16F.js","sources":["../src/host.ts","../src/components/appliers/applyGraphics.ts","../src/components/appliers/applyGraphicsLayout.ts","../src/components/appliers/applyPhaser.ts","../src/components/appliers/applyTransform.ts","../src/components/creators/createGraphicsLayout.ts","../src/components/creators/createPhaser.ts","../src/components/creators/createTransform.ts","../src/components/primitives/graphics.ts","../src/components/appliers/applyImage.ts","../src/components/appliers/applyImageLayout.ts","../src/components/creators/createImageLayout.ts","../src/components/primitives/image.ts","../src/components/appliers/applyNineSlice.ts","../src/components/appliers/applyNineSliceLayout.ts","../src/components/creators/createNineSliceLayout.ts","../src/components/primitives/nineslice.ts","../src/components/appliers/applySprite.ts","../src/components/appliers/applySpriteLayout.ts","../src/components/creators/createSpriteLayout.ts","../src/components/primitives/sprite.ts","../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js","../src/dev-config.ts","../src/viewport-context.ts","../src/layout/utils/size-resolver.ts","../src/components/appliers/applyText.ts","../src/components/appliers/applyTextLayout.ts","../src/components/creators/createTextLayout.ts","../src/components/primitives/text.ts","../src/components/primitives/tilesprite.ts","../src/components/appliers/applyBackground.ts","../src/gestures/gesture-types.ts","../src/gestures/gesture-manager.ts","../src/components/appliers/applyGestures.ts","../src/core-props.ts","../src/layout/appliers/background-applier.ts","../src/layout/appliers/container-applier.ts","../src/layout/appliers/position-applier.ts","../src/layout/utils/spacing-calculator.ts","../src/layout/strategies/base-strategy.ts","../src/layout/strategies/column-layout.ts","../src/layout/strategies/row-layout.ts","../src/layout/strategies/stack-layout.ts","../src/layout/utils/child-utils.ts","../src/layout/utils/dimension-calculator.ts","../src/layout/utils/flex-distributor.ts","../src/layout/layout-engine.ts","../src/components/appliers/applyLayout.ts","../src/colors/color-types.ts","../src/colors/color-utils.ts","../src/colors/color-presets.ts","../src/design-tokens/design-token-presets.ts","../src/theme-defaults.ts","../src/theme.ts","../src/components/appliers/applyTooltip.ts","../src/components/creators/createBackground.ts","../src/components/creators/createGestures.ts","../src/components/creators/createLayout.ts","../src/components/primitives/view.ts","../src/render-context.ts","../src/components/custom/View.tsx","../src/components/internal/SceneWrapper.tsx","../src/portal/portal-registry.ts","../src/vdom.ts","../src/hooks.ts","../src/effects/use-effect.ts","../src/effects/effect-registry.ts","../src/components/custom/Button.tsx","../src/components/custom/RadioButton.tsx","../src/components/custom/RadioGroup.tsx","../src/components/custom/Text.tsx","../src/components/index.ts","../src/utils/svg-texture.ts","../src/utils/texture-registry.ts","../src/hooks-svg.ts","../src/utils/dom-input-manager.ts","../src/utils/KeyboardInputManager.ts","../src/animation/animated-signal.ts","../src/animation/spring-physics.ts","../src/animation/useSpring.ts","../src/components/custom/Accordion.tsx","../src/components/custom/Portal.tsx","../src/components/custom/Modal.tsx","../src/components/custom/Dialog.tsx","../src/components/custom/WrapText.tsx","../src/components/custom/AlertDialog.tsx","../src/components/custom/CharText/utils.ts","../src/components/custom/CharText/CharText.tsx","../src/components/custom/CharTextInput.tsx","../src/components/custom/Divider.tsx","../src/components/custom/ScrollSlider.tsx","../src/components/custom/ScrollView.tsx","../src/components/custom/Dropdown.tsx","../src/components/custom/Image.tsx","../src/components/custom/Icon.tsx","../src/components/custom/NineSlice.tsx","../src/components/custom/NineSliceButton.tsx","../src/components/custom/RefOriginView.tsx","../src/components/custom/Sidebar.tsx","../src/components/custom/Slider.tsx","../src/components/custom/Toggle.tsx","../src/components/custom/TransformOriginView.tsx"],"sourcesContent":["/**\n * Host layer - Generic bridge between VDOM and Phaser GameObjects\n * Provides type-safe creator/patcher pattern for extensible node types\n */\nimport Phaser from 'phaser'\nimport type { NodeInstance, NodeProps, NodeType } from './core-types'\n\n/**\n * Host creator function type - creates a node instance from props\n */\nexport type HostCreator<T extends NodeType> = (\n scene: Phaser.Scene,\n props: NodeProps<T>\n) => NodeInstance<T>\n\n/**\n * Host patcher function type - updates node properties\n */\nexport type HostPatcher<T extends NodeType> = (\n node: NodeInstance<T>,\n prev: NodeProps<T>,\n next: NodeProps<T>\n) => void\n\n/**\n * Node descriptor combining creator and patcher\n */\nexport interface NodeDescriptor<T extends NodeType> {\n create: HostCreator<T>\n patch: HostPatcher<T>\n}\n\n/**\n * Internal registry of node descriptors\n */\ntype NodeRegistry = {\n [K in NodeType]: NodeDescriptor<K>\n}\n\n/**\n * Node registry - maps node types to their descriptors\n * Exported for external registration of custom node types\n */\nexport const nodeRegistry: Partial<NodeRegistry> = {}\n\n/**\n * Registers a node descriptor (creator + patcher) for a custom node type\n * @param type - Node type name\n * @param descriptor - Node descriptor with create and patch functions\n */\nexport function register<T extends NodeType>(type: T, descriptor: NodeDescriptor<T>): void {\n nodeRegistry[type] = descriptor as NodeRegistry[T]\n}\n\n/**\n * Host API - Generic interface for VDOM to manage Phaser nodes\n */\nexport const host = {\n /**\n * Creates a node instance using the registered creator for the given type\n * @param type - Node type name\n * @param props - Node properties\n * @param scene - Phaser scene\n * @returns Created node instance\n * @throws Error if no creator registered for the type\n */\n create<T extends NodeType>(type: T, props: NodeProps<T>, scene: Phaser.Scene): NodeInstance<T> {\n const descriptor = nodeRegistry[type] as NodeDescriptor<T> | undefined\n if (!descriptor) {\n throw new Error(`No host descriptor registered for node type \"${String(type)}\"`)\n }\n return descriptor.create(scene, props)\n },\n\n /**\n * Patches node properties with updates using the registered patcher\n * @param type - Node type name\n * @param node - Node to patch\n * @param prev - Previous props\n * @param next - New props\n */\n patch<T extends NodeType>(\n type: T,\n node: NodeInstance<T>,\n prev: NodeProps<T>,\n next: NodeProps<T>\n ): void {\n const descriptor = nodeRegistry[type] as NodeDescriptor<T> | undefined\n if (!descriptor) {\n throw new Error(`No host descriptor registered for node type \"${String(type)}\"`)\n }\n descriptor.patch(node, prev, next)\n },\n\n /**\n * Appends child node to parent container\n * @param parent - Parent container or scene\n * @param child - Child node to append\n */\n append(parent: unknown, child: unknown) {\n // Parent is a Container\n if (parent instanceof Phaser.GameObjects.Container) {\n parent.add(child as Phaser.GameObjects.GameObject)\n }\n // Parent is a Scene\n else if (parent && typeof parent === 'object' && 'sys' in parent) {\n const scene = parent as Phaser.Scene\n scene.add.existing(child as Phaser.GameObjects.GameObject)\n }\n // Fallback: try to add to display list\n else if (parent && typeof parent === 'object' && 'scene' in parent) {\n const gameObject = parent as Phaser.GameObjects.GameObject\n if (gameObject.scene?.children) {\n gameObject.scene.children.add(child as Phaser.GameObjects.GameObject)\n }\n }\n },\n\n /**\n * Removes child node from parent and destroys it\n * @param parent - Parent container\n * @param child - Child node to remove\n */\n remove(parent: unknown, child: unknown) {\n const childObj = child as Phaser.GameObjects.GameObject & { scene?: Phaser.Scene | null }\n\n // Check if child still has a scene (not already destroyed)\n if (!childObj.scene) return\n\n // Remove from parent container first\n if (parent instanceof Phaser.GameObjects.Container) {\n parent.remove(childObj, false)\n }\n\n // Destroy the child WITHOUT destroying its children (VDOM handles that)\n if (childObj.destroy) {\n childObj.destroy(false)\n }\n },\n\n /**\n * Performs layout update on container (no-op for native Phaser)\n */\n layout() {\n // Native Phaser containers don't have automatic layout\n // This is a no-op but kept for API compatibility\n },\n}\n","/**\n * Graphics-specific property appliers\n */\nimport type Phaser from 'phaser'\nimport type { GameObjectWithLayout } from '../../layout/types'\nimport type { GraphicsBaseProps } from '../primitives/graphics'\n\n/**\n * Graphics node with draw dependencies tracking\n */\ntype GraphicsWithDrawDeps = Phaser.GameObjects.Graphics &\n GameObjectWithLayout & {\n __drawDependencies?: unknown[] | undefined\n }\n\n/**\n * Shallow comparison of dependency arrays\n * @param a - First array\n * @param b - Second array\n * @returns True if arrays are equal\n */\nfunction shallowEqual(a?: unknown[], b?: unknown[]): boolean {\n if (!a || !b) return a === b\n if (a.length !== b.length) return false\n return a.every((val, i) => val === b[i])\n}\n\n/**\n * Apply Graphics-specific props (onDraw, autoClear, dependencies)\n * @param node - Graphics node\n * @param _prev - Previous props (unused, dependencies stored on node)\n * @param next - New props\n */\nexport function applyGraphicsProps(\n node: Phaser.GameObjects.Graphics,\n _prev: Partial<GraphicsBaseProps>,\n next: Partial<GraphicsBaseProps>\n): void {\n // Check if dependencies changed (shallow compare)\n const prevDeps = (node as GraphicsWithDrawDeps).__drawDependencies\n const nextDeps = next.dependencies\n const depsChanged = !shallowEqual(prevDeps, nextDeps)\n\n // Redraw if dependencies changed and onDraw callback exists\n if (depsChanged && next.onDraw) {\n // Clear graphics if autoClear is enabled (default: true)\n if (next.autoClear !== false) {\n node.clear()\n }\n\n // Execute draw callback\n next.onDraw(node, next)\n\n // Update stored dependencies\n ;(node as GraphicsWithDrawDeps).__drawDependencies = nextDeps\n }\n}\n","/**\n * Graphics layout property appliers\n */\nimport type Phaser from 'phaser'\nimport type { GameObjectWithLayout } from '../../layout/types'\nimport type { GraphicsBaseProps } from '../primitives/graphics'\n\n/**\n * Apply layout updates for Graphics (width/height changes)\n * @param node - Graphics node\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyGraphicsLayout(\n node: Phaser.GameObjects.Graphics,\n prev: Partial<GraphicsBaseProps>,\n next: Partial<GraphicsBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation (like Text does)\n ;(node as GameObjectWithLayout).__layoutProps = next as GraphicsBaseProps\n\n // Update size provider if dimensions or headless changed\n if (prev.width !== next.width || prev.height !== next.height || prev.headless !== next.headless) {\n ;(node as GameObjectWithLayout).__getLayoutSize = () => {\n if (next.headless ?? true) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: typeof next.width === 'number' ? next.width : 0,\n height: typeof next.height === 'number' ? next.height : 0,\n }\n }\n }\n}\n","/**\n * Applier for Phaser GameObject display properties\n */\nimport type { Display, PhaserProps } from '../../core-props'\n\n/**\n * Generic node type with Phaser GameObject display capabilities\n */\ntype PhaserNode = {\n visible: boolean\n setAlpha: (alpha: number) => void\n setDepth: (depth: number) => void\n}\n\n/**\n * Normalize visible prop to boolean for Phaser GameObject\n * - true / 'visible' → true (rendered)\n * - false / 'invisible' → false (not rendered, but takes space)\n * - 'none' → false (not rendered, no space)\n * @param visible - Visible prop value\n * @returns Boolean for Phaser GameObject.visible\n */\nfunction normalizeVisible(visible: boolean | Display | undefined): boolean {\n if (visible === undefined) return true // default: visible\n if (typeof visible === 'boolean') return visible\n // String values\n if (visible === 'visible') return true\n if (visible === 'invisible' || visible === 'none') return false\n return true\n}\n\n/**\n * Applies Phaser display properties (alpha, depth, visibility)\n * @param node - Node with Phaser GameObject properties\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyPhaserProps<T extends Partial<PhaserNode>>(\n node: T,\n prev: Partial<PhaserProps & { visible?: boolean | Display }>,\n next: Partial<PhaserProps & { visible?: boolean | Display }>\n): void {\n // Alpha\n if (prev.alpha !== next.alpha && typeof next.alpha === 'number') {\n node.setAlpha?.(next.alpha)\n }\n\n // Depth\n if (prev.depth !== next.depth && typeof next.depth === 'number') {\n node.setDepth?.(next.depth)\n }\n\n // Visibility - supports boolean and Display type (from LayoutProps)\n if (prev.visible !== next.visible) {\n const visibleValue = normalizeVisible(next.visible)\n node.visible = visibleValue\n }\n}\n","/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport type { TransformProps } from '../../core-props'\n\n/**\n * Generic node type with transform capabilities\n */\ntype TransformNode = {\n x: number\n y: number\n rotation: number\n scaleX: number\n scaleY: number\n setScale: (x: number, y: number) => void\n}\n\n/**\n * Applies transform properties (position, rotation, scale)\n * @param node - Node with transform properties\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTransformProps<T extends Partial<TransformNode>>(\n node: T,\n prev: Partial<TransformProps>,\n next: Partial<TransformProps>\n): void {\n // Position\n if (prev.x !== next.x && typeof next.x === 'number') {\n node.x = next.x\n }\n if (prev.y !== next.y && typeof next.y === 'number') {\n node.y = next.y\n }\n\n // Rotation\n if (prev.rotation !== next.rotation && typeof next.rotation === 'number') {\n node.rotation = next.rotation\n }\n\n // Scale - handle both unified scale and separate scaleX/scaleY\n const nextScale = next.scale as number | undefined\n const nextScaleX = next.scaleX as number | undefined\n const nextScaleY = next.scaleY as number | undefined\n const prevScale = prev.scale as number | undefined\n const prevScaleX = prev.scaleX as number | undefined\n const prevScaleY = prev.scaleY as number | undefined\n\n if (nextScale !== undefined && nextScale !== prevScale) {\n node.setScale?.(nextScale, nextScale)\n } else if (nextScaleX !== prevScaleX || nextScaleY !== prevScaleY) {\n const currentScaleX = node.scaleX ?? 1\n const currentScaleY = node.scaleY ?? 1\n const sx = nextScaleX ?? currentScaleX\n const sy = nextScaleY ?? currentScaleY\n node.setScale?.(sx, sy)\n }\n}\n","/**\n * Layout system initialization for Graphics component\n */\nimport type Phaser from 'phaser'\nimport type { GraphicsBaseProps } from '../primitives/graphics'\n\n/**\n * Setup layout system for Graphics component\n * @param graphics - Phaser Graphics instance\n * @param props - Initial props\n */\nexport function createGraphicsLayout(\n graphics: Phaser.GameObjects.Graphics,\n props: Partial<GraphicsBaseProps>\n): void {\n // Validation: headless=false requires explicit width/height\n if (props.headless === false) {\n if (typeof props.width !== 'number' || typeof props.height !== 'number') {\n throw new Error(\n 'Graphics component requires explicit width and height props when headless=false'\n )\n }\n }\n\n // Setup layout props (for layout system) - store ALL props like Text does\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(graphics as any).__layoutProps = props as GraphicsBaseProps\n\n // Setup layout size provider (returns explicit dimensions)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(graphics as any).__getLayoutSize = () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((graphics as any).__layoutProps?.headless ?? true) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: props.width ?? 0,\n height: props.height ?? 0,\n }\n }\n\n // Store dependencies for comparison in patcher\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(graphics as any).__drawDependencies = props.dependencies\n}\n","/**\n * Creator for Phaser GameObject display properties\n */\nimport type { Display, PhaserProps } from '../../core-props'\n\n/**\n * Normalize visible prop to boolean for Phaser GameObject\n * - true / 'visible' → true (rendered)\n * - false / 'invisible' → false (not rendered, but takes space)\n * - 'none' → false (not rendered, no space)\n * @param visible - Visible prop value\n * @returns Boolean for Phaser GameObject.visible\n */\nfunction normalizeVisible(visible: boolean | Display | undefined): boolean {\n if (visible === undefined) return true // default: visible\n if (typeof visible === 'boolean') return visible\n // String values\n if (visible === 'visible') return true\n if (visible === 'invisible' || visible === 'none') return false\n return true\n}\n\n/**\n * Apply Phaser display properties during node creation\n * @param node - Node with Phaser GameObject capabilities\n * @param props - Initial props\n */\nexport function createPhaser<\n T extends {\n visible: boolean\n setDepth: (depth: number) => void\n setAlpha: (alpha: number) => void\n },\n>(node: T, props: Partial<PhaserProps & { visible?: boolean | Display }>): void {\n // Visibility - supports boolean and Display type (from LayoutProps)\n if (props.visible !== undefined) {\n node.visible = normalizeVisible(props.visible)\n }\n if (props.depth !== undefined) {\n node.setDepth(props.depth)\n }\n if (props.alpha !== undefined) {\n node.setAlpha(props.alpha)\n }\n}\n","/**\n * Shared property creators for component initialization\n * These functions avoid code duplication when creating nodes with initial properties\n */\nimport type { TransformProps } from '../../core-props'\n\n/**\n * Apply transform properties during node creation (geometric transformations only)\n * @param node - Node with transform capabilities\n * @param props - Initial props\n */\nexport function createTransform<\n T extends {\n setScale: (x: number, y: number) => void\n setRotation: (rotation: number) => void\n },\n>(node: T, props: Partial<TransformProps>): void {\n if (props.scaleX !== undefined || props.scaleY !== undefined) {\n node.setScale(\n (props.scaleX as number | undefined) ?? 1,\n (props.scaleY as number | undefined) ?? 1\n )\n }\n if (props.rotation !== undefined) {\n node.setRotation(props.rotation as number)\n }\n}\n","/**\n * Graphics component - Phaser Graphics GameObject (custom shapes)\n * Status: IMPLEMENTED ✅\n *\n * Design Decisions & Answers:\n * ===========================\n *\n * 1. Headless Default: TRUE ✅\n * Rationale: Graphics are typically decorative (custom shapes, effects).\n * They should NOT affect layout unless explicitly configured.\n * Use Cases:\n * - ✅ Headless (default): Debug visualizations, particle trails, decorative effects\n * - ❌ Layout-aware: Custom UI shapes (via headless=false + explicit width/height)\n *\n * 2. View Background vs. Graphics Component: CLEAR SEPARATION ✅\n * View Background (internal):\n * - Special role: Defines container dimensions\n * - Automatically managed by View component\n * - Marked with __isBackground flag\n * - Always excluded from layout calculations\n * Graphics Component (user-facing):\n * - Custom shapes for any purpose\n * - User controls drawing via onDraw callback\n * - Can be headless OR layout-aware (explicit)\n * - Independent GameObject, not tied to View\n *\n * 3. Layout Size Provider: EXPLICIT DIMENSIONS REQUIRED ✅\n * Decision: Option A - Require explicit width/height props for layout participation\n * Reasoning:\n * - Graphics have no inherent dimensions until drawn\n * - Calculating bounds dynamically is expensive (getBounds() forces geometry calc)\n * - Bounds change with every draw call (unstable for layout)\n * - Explicit dimensions = predictable layout behavior\n * Implementation:\n * - If headless=false: Require width/height props (throw error if missing)\n * - __getLayoutSize = () => ({ width: props.width!, height: props.height! })\n *\n * 4. Drawing API: IMPERATIVE CALLBACK ✅\n * Decision: Option A - onDraw callback (imperative)\n * Reasoning:\n * - Simplest API, full Phaser Graphics power\n * - No abstraction overhead\n * - Familiar to Phaser developers\n * - Flexible for complex shapes\n * Interface:\n * onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n * Example:\n * <Graphics onDraw={(g) => {\n * g.fillStyle(0xff0000, 1)\n * g.fillCircle(50, 50, 50)\n * }} />\n * Future: Consider declarative shape components if demand is high\n *\n * 5. Redraw Strategy: DEPENDENCY-BASED ✅\n * Decision: Redraw when dependencies array changes (React useEffect style)\n * Behavior:\n * - autoClear=true (default): Clear graphics before each onDraw call\n * - dependencies=[...]: Only redraw when dependencies change (shallow compare)\n * - No dependencies: Redraw on every patch (expensive!)\n * Implementation:\n * - Store previous dependencies on graphics object\n * - Compare with current dependencies in patcher\n * - Call onDraw only if changed\n *\n * 6. Performance Optimization: GENERATETEXTURE PATH 🆕\n * Strategy for static graphics:\n * - Static graphics (no redraw) → Consider generateTexture() optimization\n * - Converts geometry to texture (faster rendering, loses vector quality)\n * - Trade-off: Memory (texture) vs. CPU (redraw)\n * Props:\n * - static?: boolean (if true, generate texture after first draw)\n * - textureKey?: string (cache key for generated texture)\n * Recommendation: Advanced feature, implement later if needed\n *\n * 7. Common Use Cases & Alternatives: DOCUMENTED ✅\n * Use Graphics For:\n * - ✅ Custom complex shapes (polygons, stars, bezier curves)\n * - ✅ Dynamic visualizations (graphs, charts)\n * - ✅ Progress bars with custom shapes\n * - ✅ Debug overlays (hitboxes, grids)\n * Use Alternatives For:\n * - ❌ Simple rectangles → Use View with backgroundColor\n * - ❌ Borders → Use View with borderColor/borderWidth\n * - ❌ Static shapes → Consider Image with pre-rendered texture\n * - ❌ Repeated patterns → Use TileSprite\n *\n * 8. Clear Behavior: CONFIGURABLE ✅\n * Decision: autoClear=true by default\n * Reasoning:\n * - Most use cases: Single shape per Graphics object\n * - Prevents accumulation of draw calls\n * - Override with autoClear=false for additive drawing\n * Edge Case: Multiple draw calls in onDraw → All executed, then cleared on next redraw\n *\n * Implementation Status:\n * ======================\n * [✅] Create graphics with scene.add.graphics()\n * [✅] Apply transform props via applyTransformProps\n * [✅] Setup onDraw callback invocation\n * [✅] Implement dependency-based redraw logic\n * [✅] Handle autoClear flag\n * [✅] Setup layout size provider (explicit width/height)\n * [✅] Validate width/height if headless=false\n * [✅] Example component with interactive demos\n * [❌] generateTexture optimization (future enhancement)\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyGraphicsProps } from '../appliers/applyGraphics'\nimport { applyGraphicsLayout } from '../appliers/applyGraphicsLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createGraphicsLayout } from '../creators/createGraphicsLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Graphics component\n */\nexport interface GraphicsBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /**\n * Drawing callback - receives Graphics instance for custom drawing\n * Called on mount and when dependencies change\n * @param graphics - Phaser Graphics instance\n * @param props - Current props (for accessing dynamic values)\n */\n onDraw?: (graphics: Phaser.GameObjects.Graphics, props: GraphicsBaseProps) => void\n\n /**\n * If true, graphics is cleared before onDraw is called\n * Default: true (usually what you want)\n */\n autoClear?: boolean\n\n /**\n * Dependencies array - if any value changes, onDraw is re-executed\n * Similar to React useEffect dependencies\n */\n dependencies?: unknown[]\n}\n\n/**\n * Props for Graphics component\n */\nexport interface GraphicsProps\n extends GraphicsBaseProps,\n PropsDefaultExtension<Phaser.GameObjects.Graphics> {}\n\n/**\n * Graphics creator - creates a Phaser Graphics object\n */\nexport const graphicsCreator: HostCreator<'Graphics'> = (scene, props) => {\n // Create graphics (position set via setPosition below)\n const graphics = scene.add.graphics()\n\n // Set initial position explicitly (Graphics doesn't take x/y in constructor like Text does)\n graphics.setPosition(props.x ?? 0, props.y ?? 0)\n\n // Apply transform props (scale, rotation)\n createTransform(graphics, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(graphics, props)\n\n // Setup layout system (props and size provider)\n createGraphicsLayout(graphics, props)\n\n // Execute initial draw if onDraw callback provided\n if (props.onDraw) {\n props.onDraw(graphics, props)\n }\n return graphics\n}\n\n/**\n * Graphics patcher - updates Graphics properties\n */\nexport const graphicsPatcher: HostPatcher<'Graphics'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply Graphics-specific props (onDraw, autoClear, dependencies)\n applyGraphicsProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applyGraphicsLayout(node, prev, next)\n}\n","/**\n * Applier for Image-specific properties\n */\nimport type Phaser from 'phaser'\nimport type { ImageBaseProps } from '../primitives/image'\n\n/**\n * Calculates scale factors for fit modes\n * @param image - Phaser Image object\n * @param targetWidth - Desired width\n * @param targetHeight - Desired height\n * @param fit - Fit mode\n * @returns Scale factors for x and y\n */\nfunction calculateFitScale(\n image: Phaser.GameObjects.Image,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill'\n): { scaleX: number; scaleY: number } {\n const textureWidth = image.width\n const textureHeight = image.height\n\n if (textureWidth === 0 || textureHeight === 0) {\n return { scaleX: 1, scaleY: 1 }\n }\n\n if (fit === 'fill') {\n // Stretch to fill (may distort aspect ratio)\n return {\n scaleX: targetWidth / textureWidth,\n scaleY: targetHeight / textureHeight,\n }\n }\n\n const targetAspect = targetWidth / targetHeight\n const textureAspect = textureWidth / textureHeight\n\n if (fit === 'contain') {\n // Scale to fit within bounds, preserve aspect ratio\n const scale =\n targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n if (fit === 'cover') {\n // Scale to cover bounds, preserve aspect ratio (may crop)\n const scale =\n targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n return { scaleX: 1, scaleY: 1 }\n}\n\n/**\n * Applies Image-specific properties (texture, frame, tint, displaySize, fit)\n * @param image - Phaser Image object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyImageProps(\n image: Phaser.GameObjects.Image,\n prev: Partial<ImageBaseProps>,\n next: Partial<ImageBaseProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n image.setTexture(next.texture, next.frame)\n }\n\n // Apply tint\n if (prev.tint !== next.tint) {\n if (typeof next.tint === 'number') {\n image.setTint(next.tint)\n } else {\n image.clearTint()\n }\n }\n\n // Apply origin if specified\n if (prev.originX !== next.originX || prev.originY !== next.originY) {\n const originX = next.originX ?? image.originX\n const originY = next.originY ?? image.originY\n image.setOrigin(originX, originY)\n }\n\n // Apply displayWidth/displayHeight with fit mode\n const displayWidthChanged = prev.displayWidth !== next.displayWidth\n const displayHeightChanged = prev.displayHeight !== next.displayHeight\n const fitChanged = prev.fit !== next.fit\n\n if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n const { scaleX, scaleY } = calculateFitScale(\n image,\n next.displayWidth,\n next.displayHeight,\n next.fit\n )\n image.setScale(scaleX, scaleY)\n } else if (typeof next.displayWidth === 'number') {\n // Only width specified - preserve aspect ratio\n const scale = next.displayWidth / image.width\n image.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height specified - preserve aspect ratio\n const scale = next.displayHeight / image.height\n image.setScale(scale, scale)\n }\n }\n}\n","/**\n * Layout applier for Image components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { LayoutSize } from '../../layout/index'\nimport type { ImageBaseProps } from '../primitives/image'\n\n/**\n * Applies layout props and updates layout size provider\n * @param image - Phaser Image object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyImageLayout(\n image: Phaser.GameObjects.Image & {\n __layoutProps?: ImageBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n prev: Partial<ImageBaseProps & LayoutProps>,\n next: Partial<ImageBaseProps & LayoutProps>\n): void {\n // Update layout props reference\n image.__layoutProps = next as ImageBaseProps\n\n // Update size provider if headless flag changed\n if (prev.headless !== next.headless) {\n image.__getLayoutSize = () => {\n if (image.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: image.displayWidth,\n height: image.displayHeight,\n }\n }\n }\n}\n","/**\n * Layout creator for Image components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { ImageBaseProps } from '../primitives/image'\n\n/**\n * Creates layout infrastructure for an Image component\n * Attaches layout props and dynamic size provider\n * @param image - Phaser Image object\n * @param props - Image props including layout\n */\nexport function createImageLayout(\n image: Phaser.GameObjects.Image & {\n __layoutProps?: ImageBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<ImageBaseProps>\n): void {\n // Attach layout props for layout calculations\n image.__layoutProps = props as ImageBaseProps\n\n // Attach dynamic size provider\n // Headless images return minimal size 0.01x0.01 (participates in alignment, not spacing)\n // Layout-aware images return actual display dimensions\n image.__getLayoutSize = () => {\n if (image.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: image.displayWidth,\n height: image.displayHeight,\n }\n }\n}\n","/**\n * Image component - Phaser Image GameObject (static texture)\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: TEXTURE RENDERING\n * Purpose: Display static textures in UI layouts (icons, avatars, illustrations)\n * Phaser Type: Phaser.GameObjects.Image (texture-based rendering)\n * Characteristics:\n * - Layout-aware by default (participates in parent layout)\n * - Auto-sizing based on texture dimensions (like HTML <img>)\n * - Supports Phaser texture system (atlases, frames)\n *\n * 2. Headless Default: FALSE ✅\n * Decision: Image participates in layout by default\n * Reasoning:\n * - Images are UI elements (icons, avatars, illustrations)\n * - Should affect parent container dimensions\n * - Similar to Text component behavior\n * Use Cases:\n * - ✅ Layout-aware (default): Icons, avatars, logos, UI illustrations\n * - ❌ Headless (optional): Decorative backgrounds, overlays, parallax layers\n * Usage:\n * <Image texture=\"icon\" /> // Layout-aware\n * <Image texture=\"bg\" headless={true} /> // Decorative (no layout impact)\n *\n * 3. Layout Size Provider: DISPLAY DIMENSIONS ✅\n * Implementation: Uses image.displayWidth and image.displayHeight\n * Behavior:\n * - Returns scaled display dimensions\n * - Rotation is IGNORED for layout-aware images (headless=false)\n * - Rotation only works with headless=true (no layout impact)\n * Reasoning:\n * - Flow layout is incompatible with rotation (causes positioning issues)\n * - Rotated images would overlap siblings in flow layout\n * - Matches Text component behavior\n * Example:\n * <Image texture=\"icon\" /> // ✅ Layout size: 64x64\n * <Image texture=\"icon\" rotation={Math.PI/4} /> // ⚠️ Rotation IGNORED, size: 64x64\n * <Image texture=\"icon\" rotation={Math.PI/4} headless={true} /> // ✅ Rotated, no layout\n * Recommendation: Use rotation only with headless=true or absolute positioning\n *\n * 4. Sizing Strategy: HYBRID APPROACH ✅\n * Auto-Size (default):\n * - No displayWidth/displayHeight → Use texture dimensions\n * - Like HTML <img> natural size\n * Explicit Size:\n * - displayWidth + displayHeight → Scale to fit\n * - fit prop controls aspect ratio handling\n * Example:\n * <Image texture=\"icon\" /> // Auto-size\n * <Image texture=\"icon\" displayWidth={64} displayHeight={64} fit=\"contain\" />\n *\n * 5. Fit Modes: CSS-LIKE BEHAVIOR ✅\n * Decision: Implement CSS object-fit equivalent\n * Modes:\n * - 'fill' (default): Stretch to fill bounds (may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio (letterbox)\n * - 'cover': Scale to cover bounds, preserve aspect ratio (crop)\n * Implementation: Calculate scale in applier based on fit mode\n *\n * 6. Origin Behavior: HEADLESS-AWARE ✅\n * Current: Like Text component\n * - Layout-aware (headless=false): Origin (0, 0) - top-left, UI-friendly\n * - Headless (headless=true): Origin (0.5, 0.5) - centered, game object semantics\n * Reasoning:\n * - UI elements align naturally with top-left origin\n * - Game objects (headless) work better centered\n * - Consistent with Text component behavior\n *\n * 7. Rotation Behavior: LIKE TEXT ✅\n * Decision: Rotation only supported with headless=true\n * Reasoning:\n * - Flow layout is incompatible with rotation\n * - Matches Text component constraints\n * - Props normalized: rotation removed if headless=false\n *\n * 8. Common Patterns:\n * Icon:\n * <View direction=\"row\" gap={10}>\n * <Image texture=\"icon-user\" />\n * <Text text=\"Username\" />\n * </View>\n * Avatar:\n * <Image texture=\"avatar\" displayWidth={64} displayHeight={64} fit=\"cover\" />\n * Background (headless):\n * <Image texture=\"bg\" headless={true} alpha={0.5} />\n *\n * 9. Performance Considerations:\n * - Texture atlases recommended (reduce texture switches)\n * - Static images are efficient (single draw call)\n * - Texture changes trigger re-render\n * - Scaling via displayWidth/displayHeight is GPU-accelerated\n *\n * 10. Known Limitations:\n * - Rotation only supported with headless=true (ignored for layout-aware)\n * - Missing textures show Phaser default (white square)\n * - No built-in loading states\n * - Texture must be preloaded before use\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Image creation with texture/frame support\n * [✅] Transform props (position, scale, alpha)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Origin handling (headless-aware: 0,0 vs 0.5,0.5)\n * [✅] Display size with fit modes (contain/cover/fill)\n * [✅] Tint support\n * [✅] Texture and frame patching\n * [⚠️] Rotation - Only with headless=true (ignored for layout-aware)\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyImageProps } from '../appliers/applyImage'\nimport { applyImageLayout } from '../appliers/applyImageLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createImageLayout } from '../creators/createImageLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Image component\n */\nexport interface ImageBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Tint color applied to image (0xRRGGBB) */\n tint?: number | undefined\n\n /** Display width (scales image to fit) */\n displayWidth?: number | undefined\n\n /** Display height (scales image to fit) */\n displayHeight?: number | undefined\n\n /**\n * How image should fit within bounds (if displayWidth/displayHeight set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Origin X (0-1, default 0.5) */\n originX?: number\n\n /** Origin Y (0-1, default 0.5) */\n originY?: number\n}\n\n/**\n * Props for primitive image component (internal use only)\n * For public API, use ImageProps from custom/Image.tsx\n */\nexport interface ImagePrimitiveProps\n extends ImageBaseProps,\n PropsDefaultExtension<Phaser.GameObjects.Image> {}\n\n/**\n * Image creator - creates a Phaser Image object\n */\nexport const imageCreator: HostCreator<'Image'> = (scene, props) => {\n const image = scene.add.image(props.x ?? 0, props.y ?? 0, props.texture, props.frame)\n\n // Set origin based on headless flag\n // Headless: (0.5, 0.5) - centered, works naturally with rotation/scale\n // Layout-aware: (0, 0) - top-left, aligns with layout flow\n if (props.headless) {\n image.setOrigin(0.5, 0.5)\n } else {\n image.setOrigin(0, 0)\n }\n\n // Apply custom origin if specified\n if (props.originX !== undefined || props.originY !== undefined) {\n image.setOrigin(props.originX ?? image.originX, props.originY ?? image.originY)\n }\n\n // Normalize props for headless objects\n // Headless objects are positioned as points - no spacing or rotation constraints\n const normalizedProps = { ...props } as Record<string, unknown>\n if (props.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedProps.padding\n delete normalizedProps.margin\n delete normalizedProps.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedProps.rotation !== undefined) {\n delete normalizedProps.rotation\n }\n }\n\n // Apply transform props (scale, rotation if headless)\n createTransform(image, normalizedProps)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(image, normalizedProps)\n\n // Apply image-specific props (tint, displaySize, fit)\n if (props.tint !== undefined) {\n image.setTint(props.tint)\n }\n\n // Apply displayWidth/displayHeight if specified\n if (props.displayWidth !== undefined || props.displayHeight !== undefined) {\n if (props.displayWidth !== undefined && props.displayHeight !== undefined) {\n // Both specified - use fit mode\n const fit = props.fit ?? 'fill'\n const textureWidth = image.width\n const textureHeight = image.height\n\n if (textureWidth > 0 && textureHeight > 0) {\n if (fit === 'fill') {\n image.setDisplaySize(props.displayWidth, props.displayHeight)\n } else if (fit === 'contain') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect > textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n image.setScale(scale)\n } else if (fit === 'cover') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect < textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n image.setScale(scale)\n }\n }\n } else if (props.displayWidth !== undefined) {\n // Only width - preserve aspect ratio\n const scale = props.displayWidth / image.width\n image.setScale(scale)\n } else if (props.displayHeight !== undefined) {\n // Only height - preserve aspect ratio\n const scale = props.displayHeight / image.height\n image.setScale(scale)\n }\n }\n\n // Setup layout system (props and size provider)\n createImageLayout(image, normalizedProps)\n\n // Call onReady callback if provided\n if (props.onReady) {\n props.onReady(image)\n }\n\n return image\n}\n\n/**\n * Image patcher - updates Image properties\n */\nexport const imagePatcher: HostPatcher<'Image'> = (node, prev, next) => {\n // Update origin if headless flag changed\n if (prev.headless !== next.headless) {\n if (next.headless) {\n node.setOrigin(0.5, 0.5) // Headless: centered\n } else {\n node.setOrigin(0, 0) // Layout-aware: top-left\n }\n }\n\n // Normalize props for headless objects\n const normalizedPrev = { ...prev } as Record<string, unknown>\n const normalizedNext = { ...next } as Record<string, unknown>\n\n if (next.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedNext.padding\n delete normalizedNext.margin\n delete normalizedNext.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedNext.rotation !== undefined) {\n delete normalizedNext.rotation\n }\n }\n\n if (prev.headless) {\n delete normalizedPrev.padding\n delete normalizedPrev.margin\n delete normalizedPrev.gap\n } else {\n if (normalizedPrev.rotation !== undefined) {\n delete normalizedPrev.rotation\n }\n }\n\n // Apply transform props (position, rotation only if headless, scale)\n applyTransformProps(node, normalizedPrev, normalizedNext)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, normalizedPrev, normalizedNext)\n\n // Apply image-specific props (texture, frame, tint, displaySize, fit)\n applyImageProps(node, normalizedPrev, normalizedNext)\n\n // Apply layout props and update size provider if needed\n applyImageLayout(node, normalizedPrev, normalizedNext)\n}\n","/**\n * Applier for NineSlice-specific properties\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { NineSliceSpecificProps } from '../primitives/nineslice'\n\n/**\n * Applies NineSlice-specific properties (texture, frame, slice dimensions)\n * @param nineSlice - Phaser NineSlice object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyNineSliceProps(\n nineSlice: Phaser.GameObjects.NineSlice,\n prev: Partial<NineSliceSpecificProps & LayoutProps>,\n next: Partial<NineSliceSpecificProps & LayoutProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n nineSlice.setTexture(next.texture, next.frame)\n }\n\n // Check if slice dimensions changed\n const sliceChanged =\n prev.leftWidth !== next.leftWidth ||\n prev.rightWidth !== next.rightWidth ||\n prev.topHeight !== next.topHeight ||\n prev.bottomHeight !== next.bottomHeight\n\n if (sliceChanged) {\n const width = typeof next.width === 'number' ? next.width : nineSlice.width\n const height = typeof next.height === 'number' ? next.height : nineSlice.height\n\n nineSlice.setSlices(\n width,\n height,\n next.leftWidth ?? prev.leftWidth ?? 0,\n next.rightWidth ?? prev.rightWidth ?? 0,\n next.topHeight ?? prev.topHeight,\n next.bottomHeight ?? prev.bottomHeight\n )\n }\n\n // Check if size changed (independent of slice changes)\n const prevWidth = typeof prev.width === 'number' ? prev.width : nineSlice.width\n const nextWidth = typeof next.width === 'number' ? next.width : nineSlice.width\n const prevHeight = typeof prev.height === 'number' ? prev.height : nineSlice.height\n const nextHeight = typeof next.height === 'number' ? next.height : nineSlice.height\n\n if (prevWidth !== nextWidth || prevHeight !== nextHeight) {\n nineSlice.setSize(nextWidth, nextHeight)\n }\n\n // Check if tint changed\n if (prev.tint !== next.tint) {\n if (next.tint !== undefined) {\n nineSlice.setTint(next.tint)\n } else {\n nineSlice.clearTint()\n }\n }\n}\n","/**\n * Layout applier for NineSlice components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { NineSliceBaseProps } from '../primitives/nineslice'\n\n/**\n * Applies layout properties for NineSlice components\n * Updates layout props when properties change\n * @param nineSlice - Phaser NineSlice object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyNineSliceLayout(\n nineSlice: Phaser.GameObjects.NineSlice & {\n __layoutProps?: NineSliceBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n prev: Partial<NineSliceBaseProps>,\n next: Partial<NineSliceBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation\n nineSlice.__layoutProps = next as NineSliceBaseProps\n\n // Update size provider if dimensions changed\n if (prev.width !== next.width || prev.height !== next.height) {\n nineSlice.__getLayoutSize = () => {\n return {\n width: nineSlice.width,\n height: nineSlice.height,\n }\n }\n }\n}\n","/**\n * Layout creator for NineSlice components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { NineSliceBaseProps } from '../primitives/nineslice'\n\n/**\n * Creates layout infrastructure for a NineSlice component\n * Attaches layout props and dynamic size provider\n * @param nineSlice - Phaser NineSlice object\n * @param props - NineSlice props including layout\n */\nexport function createNineSliceLayout(\n nineSlice: Phaser.GameObjects.NineSlice & {\n __layoutProps?: NineSliceBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<NineSliceBaseProps>\n): void {\n // Attach layout props for layout calculations\n nineSlice.__layoutProps = props as NineSliceBaseProps\n\n // Attach dynamic size provider using NineSlice dimensions\n nineSlice.__getLayoutSize = () => {\n return {\n width: nineSlice.width,\n height: nineSlice.height,\n }\n }\n}\n","/**\n * NineSlice component - Phaser NineSlice GameObject for scalable UI panels\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: SCALABLE UI PANELS\n * Purpose: Create resizable UI elements that preserve border/corner integrity\n * Phaser Type: Phaser.GameObjects.NineSlice (9-slice scaling)\n * Use Cases:\n * - Buttons with fixed corner radius\n * - Dialog boxes with preserved borders\n * - Progress bars with capped ends\n * - Panels that scale without distorting decorative edges\n *\n * 2. Nine-Slice Scaling Concept:\n * Texture divided into 9 regions:\n * ┌─────┬─────────┬─────┐\n * │ TL │ Top │ TR │ (corners + edges)\n * ├─────┼─────────┼─────┤\n * │Left │ Center │Right│ (center scales, edges stretch)\n * ├─────┼─────────┼─────┤\n * │ BL │ Bottom │ BR │ (corners stay fixed)\n * └─────┴─────────┴─────┘\n * Behavior:\n * - Corners: Never scale (preserve pixel-perfect)\n * - Edges: Stretch along one axis (top/bottom: horizontal, left/right: vertical)\n * - Center: Scales in both directions\n * Benefit: UI elements scale to any size without visual distortion\n *\n * 3. Three-Slice Mode (Optional):\n * Feature: Omit topHeight/bottomHeight for horizontal-only slicing\n * Use Case: Horizontal buttons, progress bars\n * Layout:\n * ┌─────┬─────────────────┬─────┐\n * │Left │ Center │Right│\n * └─────┴─────────────────┴─────┘\n * Props: Only leftWidth + rightWidth required\n *\n * 4. Headless Default: FALSE ✅\n * Decision: NineSlice participates in layout by default\n * Reasoning:\n * - NineSlice is a UI element (buttons, panels, containers)\n * - Should affect parent container dimensions\n * - Similar to View component (container semantics)\n * Use Cases:\n * - ✅ Layout-aware (default): Buttons, panels, dialogs, cards\n * - ❌ Headless (optional): Background overlays, decorative frames\n * Usage:\n * <NineSlice texture=\"panel\" leftWidth={16} rightWidth={16} width={200} height={100} />\n * <NineSlice texture=\"frame\" headless={true} /> // Decorative\n *\n * 5. Layout Size Provider:\n * Implementation: Uses explicit width/height (required props)\n * Reasoning:\n * - NineSlice requires explicit dimensions (Phaser constructor param)\n * - No auto-sizing (unlike Text)\n * - Dimensions always known and stable\n * __getLayoutSize:\n * return { width: nineSlice.width, height: nineSlice.height }\n * Note: getBounds() not needed (no rotation typically applied)\n *\n * 6. Slice Configuration:\n * Required Props:\n * - texture: string (texture key)\n * - leftWidth: number (pixels)\n * - rightWidth: number (pixels)\n * - width: number (total width)\n * - height: number (total height)\n * Optional Props:\n * - topHeight: number (9-slice mode, default: 0 for 3-slice)\n * - bottomHeight: number (9-slice mode, default: 0 for 3-slice)\n * - frame: string | number (texture atlas frame)\n * Validation:\n * - Width must be >= leftWidth + rightWidth\n * - Height must be >= topHeight + bottomHeight\n * - Slice widths/heights define source texture regions\n *\n * 7. Inner Bounds Feature:\n * Purpose: Calculate content area excluding slices\n * Use Case: Position children inside panel borders\n * Calculation:\n * innerBounds = {\n * x: leftWidth,\n * y: topHeight,\n * width: totalWidth - leftWidth - rightWidth,\n * height: totalHeight - topHeight - bottomHeight\n * }\n * Access:\n * const ref = useRef<NineSliceRef>(null)\n * <NineSlice ref={ref} ... />\n * console.log(ref.current?.innerBounds) // { x, y, width, height }\n * Pattern: Useful for padding-aware content positioning\n *\n * 8. Ref Extension:\n * Feature: NineSliceRef provides slice metadata\n * Properties:\n * - node: Phaser.GameObjects.NineSlice (the GameObject)\n * - leftWidth, rightWidth, topHeight, bottomHeight: Slice dimensions\n * - innerBounds: Content area calculation\n * Usage:\n * const panelRef = useRef<NineSliceRef>(null)\n * // Access slice info for child positioning\n * const { innerBounds } = panelRef.current\n *\n * 9. Common Patterns:\n * Button:\n * <NineSlice\n * texture=\"button\"\n * leftWidth={16} rightWidth={16}\n * topHeight={16} bottomHeight={16}\n * width={200} height={60}\n * >\n * <Text text=\"Click Me\" />\n * </NineSlice>\n * Dialog Box:\n * <NineSlice\n * texture=\"panel\"\n * leftWidth={32} rightWidth={32}\n * topHeight={32} bottomHeight={32}\n * width={400} height={300}\n * >\n * <View padding={32}> {/* Padding matches slice sizes * }\n * <Text text=\"Dialog Content\" />\n * </View>\n * </NineSlice>\n * Progress Bar (3-slice):\n * <NineSlice\n * texture=\"progressbar\"\n * leftWidth={8} rightWidth={8}\n * width={progress * 200} height={20}\n * />\n *\n * 10. Performance Considerations:\n * - Efficient rendering (single draw call per NineSlice)\n * - Texture atlases recommended (reduce texture switches)\n * - Scaling performance: No geometry regeneration needed\n * - Slice configuration: Calculated once on creation\n * - Dynamic resizing: Efficiently handled by Phaser\n *\n * 11. Known Limitations:\n * - Requires pre-designed 9-slice texture\n * - Slice dimensions must match source texture layout exactly\n * - Rotation not recommended (distorts slice alignment)\n * - Can't animate slice dimensions (only width/height)\n * - No rounded corner support (must be in texture)\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser NineSlice creation with slice configuration\n * [✅] Transform props (position, scale, alpha, depth)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Width/height as layout props (explicit sizing)\n * [✅] Three-slice mode support (optional topHeight/bottomHeight)\n * [✅] NineSliceRef with innerBounds calculation\n * [✅] Slice dimension validation\n * [✅] Theme system integration\n * [✅] Dynamic resizing support (width/height patching)\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyNineSliceProps } from '../appliers/applyNineSlice'\nimport { applyNineSliceLayout } from '../appliers/applyNineSliceLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createNineSliceLayout } from '../creators/createNineSliceLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Inner bounds of a NineSlice - the content area excluding slices\n */\nexport interface NineSliceInnerBounds {\n /**\n * X offset from left edge (equals leftWidth)\n */\n x: number\n /**\n * Y offset from top edge (equals topHeight)\n */\n y: number\n /**\n * Width of inner content area (totalWidth - leftWidth - rightWidth)\n */\n width: number\n /**\n * Height of inner content area (totalHeight - topHeight - bottomHeight)\n */\n height: number\n}\n\n/**\n * Extended NineSlice reference with slice information and inner bounds\n */\nexport interface NineSliceRef {\n /**\n * The underlying Phaser NineSlice GameObject\n */\n node: Phaser.GameObjects.NineSlice | null\n /**\n * Width of the left slice in pixels\n */\n leftWidth: number\n /**\n * Width of the right slice in pixels\n */\n rightWidth: number\n /**\n * Height of the top slice in pixels (0 for 3-slice mode)\n */\n topHeight: number\n /**\n * Height of the bottom slice in pixels (0 for 3-slice mode)\n */\n bottomHeight: number\n /**\n * Inner content bounds excluding slices\n * Useful for positioning content within the NineSlice\n */\n innerBounds: NineSliceInnerBounds\n}\n\n/**\n * NineSlice-specific properties for texture and slice configuration\n */\nexport interface NineSliceSpecificProps {\n /**\n * Texture key to use for the NineSlice\n */\n texture: string\n\n /**\n * Optional tint to apply to the NineSlice\n */\n tint?: number | undefined\n\n /**\n * Optional frame within the texture atlas\n */\n frame?: string | number\n\n /**\n * Width of the left slice (in pixels of source texture)\n */\n leftWidth: number\n\n /**\n * Width of the right slice (in pixels of source texture)\n */\n rightWidth: number\n\n /**\n * Height of the top slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n topHeight?: number\n\n /**\n * Height of the bottom slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n bottomHeight?: number\n}\n\n/**\n * Base props for NineSlice - composing shared prop groups\n * Note: No InteractionProps - interaction should be handled by parent View container\n */\nexport interface NineSliceBaseProps\n extends TransformProps,\n PhaserProps,\n LayoutProps,\n NineSliceSpecificProps {}\n\n/**\n * Props for NineSlice primitive - extends base props with JSX-specific props\n * Renamed to avoid conflict with custom NineSlice wrapper\n */\nexport interface NineSlicePrimitiveProps\n extends NineSliceBaseProps,\n PropsDefaultExtension<Phaser.GameObjects.NineSlice> {}\n\n/**\n * NineSlice creator - creates a Phaser NineSlice object\n */\nexport const nineSliceCreator: HostCreator<'NineSlice'> = (scene, props) => {\n // For width/height, use a small default that will be overridden by layout system\n // This prevents the NineSlice from being created with huge dimensions\n const initialWidth = typeof props.width === 'number' ? props.width : 64\n const initialHeight = typeof props.height === 'number' ? props.height : 64\n\n const nineSlice = scene.add.nineslice(\n props.x ?? 0,\n props.y ?? 0,\n props.texture,\n props.frame,\n initialWidth,\n initialHeight,\n props.leftWidth,\n props.rightWidth,\n props.topHeight,\n props.bottomHeight\n )\n nineSlice.setOrigin(0, 0) // Top-left origin for easier layout handling as it is in UI\n\n // Apply tint if provided\n if (props.tint !== undefined) {\n nineSlice.setTint(props.tint)\n }\n\n // Apply transform props (scale, rotation)\n createTransform(nineSlice, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(nineSlice, props)\n\n // Setup layout system (props and size provider)\n createNineSliceLayout(nineSlice, props)\n\n return nineSlice\n}\n\n/**\n * NineSlice patcher - updates NineSlice properties\n */\nexport const nineSlicePatcher: HostPatcher<'NineSlice'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply NineSlice-specific props (texture, frame, slice dimensions)\n applyNineSliceProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applyNineSliceLayout(node, prev, next)\n}\n","/**\n * Applier for Sprite-specific properties\n */\nimport type Phaser from 'phaser'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Gets original texture dimensions (unscaled)\n * @param sprite - Phaser Sprite object\n * @returns Original width and height\n */\nfunction getOriginalTextureDimensions(sprite: Phaser.GameObjects.Sprite): {\n width: number\n height: number\n} {\n const frame = sprite.frame\n return {\n width: frame.width,\n height: frame.height,\n }\n}\n\n/**\n * Calculates scale factors for fit modes\n * @param sprite - Phaser Sprite object\n * @param targetWidth - Desired width\n * @param targetHeight - Desired height\n * @param fit - Fit mode\n * @returns Scale factors for x and y\n */\nfunction calculateFitScale(\n sprite: Phaser.GameObjects.Sprite,\n targetWidth: number,\n targetHeight: number,\n fit: 'fill' | 'contain' | 'cover' = 'fill'\n): { scaleX: number; scaleY: number } {\n const { width: textureWidth, height: textureHeight } = getOriginalTextureDimensions(sprite)\n\n if (textureWidth === 0 || textureHeight === 0) {\n return { scaleX: 1, scaleY: 1 }\n }\n\n if (fit === 'fill') {\n return {\n scaleX: targetWidth / textureWidth,\n scaleY: targetHeight / textureHeight,\n }\n }\n\n const targetAspect = targetWidth / targetHeight\n const textureAspect = textureWidth / textureHeight\n\n if (fit === 'contain') {\n const scale =\n targetAspect > textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n if (fit === 'cover') {\n const scale =\n targetAspect < textureAspect ? targetHeight / textureHeight : targetWidth / textureWidth\n return { scaleX: scale, scaleY: scale }\n }\n\n return { scaleX: 1, scaleY: 1 }\n}\n\n/**\n * Applies Sprite-specific properties (texture, frame, tint, displaySize, fit, animations)\n * @param sprite - Phaser Sprite object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applySpriteProps(\n sprite: Phaser.GameObjects.Sprite,\n prev: Partial<SpriteBaseProps>,\n next: Partial<SpriteBaseProps>\n): void {\n // Check if texture or frame changed\n const textureChanged = prev.texture !== next.texture || prev.frame !== next.frame\n if (textureChanged && next.texture) {\n sprite.setTexture(next.texture, next.frame)\n }\n\n // Apply tint\n if (prev.tint !== next.tint) {\n if (typeof next.tint === 'number') {\n sprite.setTint(next.tint)\n } else {\n sprite.clearTint()\n }\n }\n\n // Apply origin if specified\n if (prev.originX !== next.originX || prev.originY !== next.originY) {\n const originX = next.originX ?? sprite.originX\n const originY = next.originY ?? sprite.originY\n sprite.setOrigin(originX, originY)\n }\n\n // Apply displayWidth/displayHeight with fit mode\n const displayWidthChanged = prev.displayWidth !== next.displayWidth\n const displayHeightChanged = prev.displayHeight !== next.displayHeight\n const fitChanged = prev.fit !== next.fit\n\n if (displayWidthChanged || displayHeightChanged || fitChanged || textureChanged) {\n if (typeof next.displayWidth === 'number' && typeof next.displayHeight === 'number') {\n // Both specified - use fit mode\n const fit = next.fit ?? 'fill'\n\n if (fit === 'fill') {\n // Use setDisplaySize for fill mode (non-uniform scaling)\n sprite.setDisplaySize(next.displayWidth, next.displayHeight)\n } else {\n // Use setScale for contain/cover (uniform scaling)\n const { scaleX, scaleY } = calculateFitScale(\n sprite,\n next.displayWidth,\n next.displayHeight,\n fit\n )\n sprite.setScale(scaleX, scaleY)\n }\n } else if (typeof next.displayWidth === 'number') {\n // Only width - preserve aspect ratio (use original texture width)\n const { width: origWidth } = getOriginalTextureDimensions(sprite)\n const scale = next.displayWidth / origWidth\n sprite.setScale(scale)\n } else if (typeof next.displayHeight === 'number') {\n // Only height - preserve aspect ratio (use original texture height)\n const { height: origHeight } = getOriginalTextureDimensions(sprite)\n const scale = next.displayHeight / origHeight\n sprite.setScale(scale, scale)\n } else {\n // No display size specified - reset to default scale\n sprite.setScale(1)\n }\n }\n\n // Handle animation changes\n const animationChanged =\n prev.animationKey !== next.animationKey ||\n prev.loop !== next.loop ||\n prev.repeatDelay !== next.repeatDelay\n\n if (animationChanged) {\n // Stop previous animation if playing\n if (sprite.anims.isPlaying) {\n sprite.anims.stop()\n }\n\n // Play new animation if specified\n if (next.animationKey) {\n sprite.anims.play({\n key: next.animationKey,\n repeat: next.loop ? -1 : 0,\n repeatDelay: next.repeatDelay ?? 0,\n })\n }\n }\n\n // Update animation callbacks\n const callbacksChanged =\n prev.onAnimationStart !== next.onAnimationStart ||\n prev.onAnimationComplete !== next.onAnimationComplete ||\n prev.onAnimationRepeat !== next.onAnimationRepeat ||\n prev.onAnimationUpdate !== next.onAnimationUpdate\n\n if (callbacksChanged) {\n // Remove old listeners\n sprite.off('animationstart')\n sprite.off('animationcomplete')\n sprite.off('animationrepeat')\n sprite.off('animationupdate')\n\n // Add new listeners\n if (next.onAnimationStart) {\n sprite.on('animationstart', (anim: Phaser.Animations.Animation) => {\n next.onAnimationStart?.(anim.key)\n })\n }\n\n if (next.onAnimationComplete) {\n sprite.on('animationcomplete', (anim: Phaser.Animations.Animation) => {\n next.onAnimationComplete?.(anim.key)\n })\n }\n\n if (next.onAnimationRepeat) {\n sprite.on('animationrepeat', (anim: Phaser.Animations.Animation) => {\n next.onAnimationRepeat?.(anim.key)\n })\n }\n\n if (next.onAnimationUpdate) {\n sprite.on(\n 'animationupdate',\n (anim: Phaser.Animations.Animation, frame: Phaser.Animations.AnimationFrame) => {\n next.onAnimationUpdate?.(anim.key, frame)\n }\n )\n }\n }\n}\n","/**\n * Layout applier for Sprite components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps } from '../../core-props'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Applies layout props and updates layout size provider\n * Sprites are always headless (return minimal size)\n * @param sprite - Phaser Sprite object\n * @param _prev - Previous props (unused)\n * @param next - New props\n */\nexport function applySpriteLayout(\n sprite: Phaser.GameObjects.Sprite & {\n __layoutProps?: SpriteBaseProps\n },\n _prev: Partial<SpriteBaseProps & LayoutProps>,\n next: Partial<SpriteBaseProps & LayoutProps>\n): void {\n // Update layout props reference\n sprite.__layoutProps = next as SpriteBaseProps\n\n // Note: __getLayoutSize is set once in creator and never changes\n // Sprites are always headless (0.01x0.01)\n}\n","/**\n * Layout creator for Sprite components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { SpriteBaseProps } from '../primitives/sprite'\n\n/**\n * Creates layout infrastructure for a Sprite component\n * Attaches layout props and size provider\n * Sprites are always headless (minimal size)\n * @param sprite - Phaser Sprite object\n * @param props - Sprite props including layout\n */\nexport function createSpriteLayout(\n sprite: Phaser.GameObjects.Sprite & {\n __layoutProps?: SpriteBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<SpriteBaseProps>\n): void {\n // Attach layout props for layout calculations\n sprite.__layoutProps = props as SpriteBaseProps\n\n // Attach size provider\n // Sprites are always headless - return minimal size (0.01x0.01)\n // This allows them to participate in alignment but not affect layout dimensions\n sprite.__getLayoutSize = () => {\n return { width: 0.01, height: 0.01 }\n }\n}\n","/**\n * Sprite component - Phaser Sprite GameObject (animated texture)\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: ANIMATED GAME OBJECTS\n * Purpose: Display animated sprites in game scenes (characters, effects, particles)\n * Phaser Type: Phaser.GameObjects.Sprite (animation-capable texture rendering)\n * Characteristics:\n * - Always headless (does not affect parent layout)\n * - Supports Phaser Animation system\n * - Free positioning with rotation/scale\n *\n * 2. Headless Behavior: MANDATORY ✅\n * Decision: Sprites are ALWAYS headless (not configurable)\n * Reasoning:\n * - Sprites are game objects, not UI elements\n * - Should NOT affect parent layout dimensions\n * - Free positioning with full transform support (rotation, scale)\n * Layout Impact: Returns minimal size (0.01x0.01) - participates in alignment only\n * Use Cases:\n * - ✅ Game characters, particles, effects, free-floating objects\n * - ✅ Animated decorations, background elements\n * - ❌ NOT for layout-based UIs (use Image component instead)\n *\n * 3. Layout Size Provider: MINIMAL SIZE ✅\n * Implementation: Always returns { width: 0.01, height: 0.01 }\n * Reasoning:\n * - Sprites don't affect layout spacing\n * - Minimal size allows alignment but no spacing impact\n * - Simpler than getBounds() with same result\n *\n * 4. Animation System: PHASER ANIMATIONS ✅\n * Features:\n * - animationKey: Play pre-registered animation\n * - loop: Repeat animation indefinitely\n * - repeatDelay: Delay between animation repeats (ms)\n * Callbacks:\n * - onAnimationStart: Triggered when animation begins\n * - onAnimationComplete: Triggered when animation ends\n * - onAnimationRepeat: Triggered on each repeat\n * - onAnimationUpdate: Triggered on each frame update\n * Note: Animations must be pre-registered in Phaser AnimationManager\n *\n * 5. Texture & Sizing: LIKE IMAGE ✅\n * Props:\n * - texture: Texture key (required)\n * - frame: Frame from atlas/spritesheet\n * - tint: Color tint (0xRRGGBB)\n * - displayWidth/displayHeight: Scale sprite to fit\n * - fit: 'fill' | 'contain' | 'cover' (aspect ratio handling)\n * Error Handling: Missing texture → Phaser default (white square)\n *\n * 6. Origin Behavior: CENTERED (0.5, 0.5) ✅\n * Decision: Default origin (0.5, 0.5) - centered\n * Reasoning:\n * - Phaser sprite default\n * - Natural for rotation/scale pivot\n * - Game object semantics\n * Override: Use originX/originY props for custom origin\n *\n * 7. Performance: SPRITE BATCHING ✅\n * Strategy:\n * - Leverages Phaser's sprite batching (WebGL)\n * - Props that preserve batching: tint, alpha, scale, position\n * - Props that break batching: custom shaders, blend modes (use sparingly)\n * - Texture atlases strongly recommended for multiple sprites\n *\n * 8. Common Patterns:\n * Character:\n * <Sprite texture=\"player\" animationKey=\"walk\" loop={true} />\n * Particle Effect:\n * <Sprite texture=\"explosion\" animationKey=\"explode\" onAnimationComplete={destroy} />\n * Scaled Sprite:\n * <Sprite texture=\"coin\" displayWidth={32} displayHeight={32} fit=\"contain\" />\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Sprite creation with texture/frame support\n * [✅] Transform props (position, rotation, scale, alpha)\n * [✅] Layout system integration (always headless)\n * [✅] Origin handling (0.5, 0.5 default)\n * [✅] Display size with fit modes (contain/cover/fill)\n * [✅] Tint support\n * [✅] Animation system (play, loop, callbacks)\n * [✅] Texture and frame patching\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applySpriteProps } from '../appliers/applySprite'\nimport { applySpriteLayout } from '../appliers/applySpriteLayout'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createSpriteLayout } from '../creators/createSpriteLayout'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Sprite component\n */\nexport interface SpriteBaseProps extends TransformProps, PhaserProps, LayoutProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas or spritesheet */\n frame?: string | number\n\n /** Tint color applied to sprite (0xRRGGBB) */\n tint?: number\n\n /** Display width (scales sprite to fit) */\n displayWidth?: number\n\n /** Display height (scales sprite to fit) */\n displayHeight?: number\n\n /**\n * How sprite should fit within bounds (if displayWidth/displayHeight set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Animation key to play (pre-registered in Phaser AnimationManager) */\n animationKey?: string\n\n /** Loop animation (default: false) */\n loop?: boolean\n\n /** Delay between animation repeats in ms (default: 0) */\n repeatDelay?: number\n\n /** Callback when animation starts */\n onAnimationStart?: (key: string) => void\n\n /** Callback when animation completes */\n onAnimationComplete?: (key: string) => void\n\n /** Callback when animation repeats */\n onAnimationRepeat?: (key: string) => void\n\n /** Callback on each animation frame update */\n onAnimationUpdate?: (key: string, frame: Phaser.Animations.AnimationFrame) => void\n\n /** Origin X (0-1, default 0.5) */\n originX?: number\n\n /** Origin Y (0-1, default 0.5) */\n originY?: number\n}\n\n/**\n * Props for Sprite component\n */\nexport interface SpriteProps\n extends SpriteBaseProps,\n PropsDefaultExtension<Phaser.GameObjects.Sprite> {}\n\n/**\n * Sprite creator - creates a Phaser Sprite object with animations\n */\nexport const spriteCreator: HostCreator<'Sprite'> = (scene, props) => {\n const sprite = scene.add.sprite(props.x ?? 0, props.y ?? 0, props.texture, props.frame)\n\n // Set origin - always centered (0.5, 0.5) for sprites\n sprite.setOrigin(0.5, 0.5)\n\n // Apply custom origin if specified\n if (props.originX !== undefined || props.originY !== undefined) {\n sprite.setOrigin(props.originX ?? sprite.originX, props.originY ?? sprite.originY)\n }\n\n // Apply transform props (scale, rotation)\n createTransform(sprite, props)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(sprite, props)\n\n // Apply sprite-specific props (tint, displaySize, fit)\n if (props.tint !== undefined) {\n sprite.setTint(props.tint)\n }\n\n // Apply displayWidth/displayHeight if specified\n if (props.displayWidth !== undefined || props.displayHeight !== undefined) {\n if (props.displayWidth !== undefined && props.displayHeight !== undefined) {\n // Both specified - use fit mode\n const fit = props.fit ?? 'fill'\n const textureWidth = sprite.width\n const textureHeight = sprite.height\n\n if (textureWidth > 0 && textureHeight > 0) {\n if (fit === 'fill') {\n sprite.setDisplaySize(props.displayWidth, props.displayHeight)\n } else if (fit === 'contain') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect > textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n sprite.setScale(scale)\n } else if (fit === 'cover') {\n const targetAspect = props.displayWidth / props.displayHeight\n const textureAspect = textureWidth / textureHeight\n const scale =\n targetAspect < textureAspect\n ? props.displayHeight / textureHeight\n : props.displayWidth / textureWidth\n sprite.setScale(scale)\n }\n }\n } else if (props.displayWidth !== undefined) {\n const scale = props.displayWidth / sprite.width\n sprite.setScale(scale)\n } else if (props.displayHeight !== undefined) {\n const scale = props.displayHeight / sprite.height\n sprite.setScale(scale)\n }\n }\n\n // Setup animation system\n // Only play if the animation is already registered in the AnimationManager.\n // Calling `sprite.anims.play` with a missing key causes Phaser to log\n // \"Missing animation: <key>\". Many examples register animations in a\n // separate effect that may run after the Sprite is created, so avoid\n // attempting to play until the animation actually exists.\n if (props.animationKey) {\n if (sprite.scene && sprite.scene.anims.exists(props.animationKey)) {\n sprite.anims.play({\n key: props.animationKey,\n repeat: props.loop ? -1 : 0,\n repeatDelay: props.repeatDelay ?? 0,\n })\n }\n }\n\n // Setup animation callbacks\n if (props.onAnimationStart) {\n sprite.on('animationstart', (anim: Phaser.Animations.Animation) => {\n props.onAnimationStart?.(anim.key)\n })\n }\n\n if (props.onAnimationComplete) {\n sprite.on('animationcomplete', (anim: Phaser.Animations.Animation) => {\n props.onAnimationComplete?.(anim.key)\n })\n }\n\n if (props.onAnimationRepeat) {\n sprite.on('animationrepeat', (anim: Phaser.Animations.Animation) => {\n props.onAnimationRepeat?.(anim.key)\n })\n }\n\n if (props.onAnimationUpdate) {\n sprite.on(\n 'animationupdate',\n (anim: Phaser.Animations.Animation, frame: Phaser.Animations.AnimationFrame) => {\n props.onAnimationUpdate?.(anim.key, frame)\n }\n )\n }\n\n // Setup layout system (props and size provider)\n createSpriteLayout(sprite, props)\n\n // Call onReady callback if provided\n if (props.onReady) {\n props.onReady(sprite)\n }\n\n return sprite\n}\n\n/**\n * Sprite patcher - updates Sprite properties\n */\nexport const spritePatcher: HostPatcher<'Sprite'> = (node, prev, next) => {\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, prev, next)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, prev, next)\n\n // Apply sprite-specific props (texture, frame, tint, displaySize, fit, animations)\n applySpriteProps(node, prev, next)\n\n // Apply layout props and update size provider if needed\n applySpriteLayout(node, prev, next)\n}\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","/**\n * @license\n * Lodash <https://lodash.com/>\n * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n;(function() {\n\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n var undefined;\n\n /** Used as the semantic version number. */\n var VERSION = '4.17.21';\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200;\n\n /** Error message constants. */\n var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',\n FUNC_ERROR_TEXT = 'Expected a function',\n INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';\n\n /** Used to stand-in for `undefined` hash values. */\n var HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n /** Used as the maximum memoize cache size. */\n var MAX_MEMOIZE_SIZE = 500;\n\n /** Used as the internal argument placeholder. */\n var PLACEHOLDER = '__lodash_placeholder__';\n\n /** Used to compose bitmasks for cloning. */\n var CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n /** Used to compose bitmasks for value comparisons. */\n var COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n /** Used to compose bitmasks for function metadata. */\n var WRAP_BIND_FLAG = 1,\n WRAP_BIND_KEY_FLAG = 2,\n WRAP_CURRY_BOUND_FLAG = 4,\n WRAP_CURRY_FLAG = 8,\n WRAP_CURRY_RIGHT_FLAG = 16,\n WRAP_PARTIAL_FLAG = 32,\n WRAP_PARTIAL_RIGHT_FLAG = 64,\n WRAP_ARY_FLAG = 128,\n WRAP_REARG_FLAG = 256,\n WRAP_FLIP_FLAG = 512;\n\n /** Used as default options for `_.truncate`. */\n var DEFAULT_TRUNC_LENGTH = 30,\n DEFAULT_TRUNC_OMISSION = '...';\n\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\n var HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n /** Used to indicate the type of lazy iteratees. */\n var LAZY_FILTER_FLAG = 1,\n LAZY_MAP_FLAG = 2,\n LAZY_WHILE_FLAG = 3;\n\n /** Used as references for various `Number` constants. */\n var INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n /** Used as references for the maximum length and index of an array. */\n var MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n /** Used to associate wrap methods with their bit flags. */\n var wrapFlags = [\n ['ary', WRAP_ARY_FLAG],\n ['bind', WRAP_BIND_FLAG],\n ['bindKey', WRAP_BIND_KEY_FLAG],\n ['curry', WRAP_CURRY_FLAG],\n ['curryRight', WRAP_CURRY_RIGHT_FLAG],\n ['flip', WRAP_FLIP_FLAG],\n ['partial', WRAP_PARTIAL_FLAG],\n ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],\n ['rearg', WRAP_REARG_FLAG]\n ];\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n domExcTag = '[object DOMException]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]',\n weakSetTag = '[object WeakSet]';\n\n var arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n /** Used to match empty string literals in compiled template source. */\n var reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n /** Used to match HTML entities and HTML characters. */\n var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,\n reUnescapedHtml = /[&<>\"']/g,\n reHasEscapedHtml = RegExp(reEscapedHtml.source),\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n /** Used to match template delimiters. */\n var reEscape = /<%-([\\s\\S]+?)%>/g,\n reEvaluate = /<%([\\s\\S]+?)%>/g,\n reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n /**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\n var reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g,\n reHasRegExpChar = RegExp(reRegExpChar.source);\n\n /** Used to match leading whitespace. */\n var reTrimStart = /^\\s+/;\n\n /** Used to match a single whitespace character. */\n var reWhitespace = /\\s/;\n\n /** Used to match wrap detail comments. */\n var reWrapComment = /\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,\n reWrapDetails = /\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,\n reSplitDetails = /,? & /;\n\n /** Used to match words composed of alphanumeric characters. */\n var reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n /**\n * Used to validate the `validate` option in `_.template` variable.\n *\n * Forbids characters which could potentially change the meaning of the function argument definition:\n * - \"(),\" (modification of function parameters)\n * - \"=\" (default value)\n * - \"[]{}\" (destructuring of function parameters)\n * - \"/\" (beginning of a comment)\n * - whitespace\n */\n var reForbiddenIdentifierChars = /[()=,{}\\[\\]\\/\\s]/;\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g;\n\n /**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\n var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/;\n\n /** Used to detect bad signed hexadecimal string values. */\n var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n /** Used to detect binary string values. */\n var reIsBinary = /^0b[01]+$/i;\n\n /** Used to detect host constructors (Safari). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n /** Used to detect octal string values. */\n var reIsOctal = /^0o[0-7]+$/i;\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n /** Used to match Latin Unicode letters (excluding mathematical operators). */\n var reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n /** Used to ensure capturing order of template delimiters. */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals. */\n var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n /** Used to compose unicode character classes. */\n var rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n /** Used to compose unicode capture groups. */\n var rsApos = \"['\\u2019]\",\n rsAstral = '[' + rsAstralRange + ']',\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n /** Used to compose unicode regexes. */\n var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n /** Used to match apostrophes. */\n var reApos = RegExp(rsApos, 'g');\n\n /**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\n var reComboMark = RegExp(rsCombo, 'g');\n\n /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\n var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n /** Used to match complex or compound words. */\n var reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n ].join('|'), 'g');\n\n /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\n var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n /** Used to detect strings that need a more robust regexp to match words. */\n var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n /** Used to assign default `context` object properties. */\n var contextProps = [\n 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',\n 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',\n 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',\n 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',\n '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'\n ];\n\n /** Used to make template sourceURLs easier to identify. */\n var templateCounter = -1;\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {};\n typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n typedArrayTags[uint32Tag] = true;\n typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\n typedArrayTags[errorTag] = typedArrayTags[funcTag] =\n typedArrayTags[mapTag] = typedArrayTags[numberTag] =\n typedArrayTags[objectTag] = typedArrayTags[regexpTag] =\n typedArrayTags[setTag] = typedArrayTags[stringTag] =\n typedArrayTags[weakMapTag] = false;\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {};\n cloneableTags[argsTag] = cloneableTags[arrayTag] =\n cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\n cloneableTags[boolTag] = cloneableTags[dateTag] =\n cloneableTags[float32Tag] = cloneableTags[float64Tag] =\n cloneableTags[int8Tag] = cloneableTags[int16Tag] =\n cloneableTags[int32Tag] = cloneableTags[mapTag] =\n cloneableTags[numberTag] = cloneableTags[objectTag] =\n cloneableTags[regexpTag] = cloneableTags[setTag] =\n cloneableTags[stringTag] = cloneableTags[symbolTag] =\n cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n cloneableTags[errorTag] = cloneableTags[funcTag] =\n cloneableTags[weakMapTag] = false;\n\n /** Used to map Latin Unicode letters to basic Latin letters. */\n var deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n };\n\n /** Used to map characters to HTML entities. */\n var htmlEscapes = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;'\n };\n\n /** Used to map HTML entities to characters. */\n var htmlUnescapes = {\n '&amp;': '&',\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"',\n '&#39;': \"'\"\n };\n\n /** Used to escape characters for inclusion in compiled string literals. */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Built-in method references without a dependency on `root`. */\n var freeParseFloat = parseFloat,\n freeParseInt = parseInt;\n\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n /** Detect free variable `self`. */\n var freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n /** Used as a reference to the global object. */\n var root = freeGlobal || freeSelf || Function('return this')();\n\n /** Detect free variable `exports`. */\n var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n /** Detect free variable `module`. */\n var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports;\n\n /** Detect free variable `process` from Node.js. */\n var freeProcess = moduleExports && freeGlobal.process;\n\n /** Used to access faster Node.js helpers. */\n var nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n }());\n\n /* Node.js helper references. */\n var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,\n nodeIsDate = nodeUtil && nodeUtil.isDate,\n nodeIsMap = nodeUtil && nodeUtil.isMap,\n nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,\n nodeIsSet = nodeUtil && nodeUtil.isSet,\n nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\n function apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n }\n\n /**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEachRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEachRight(array, iteratee) {\n var length = array == null ? 0 : array.length;\n\n while (length--) {\n if (iteratee(array[length], length, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n }\n\n /**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\n function arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.reduceRight` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the last element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduceRight(array, iteratee, accumulator, initAccum) {\n var length = array == null ? 0 : array.length;\n if (initAccum && length) {\n accumulator = array[--length];\n }\n while (length--) {\n accumulator = iteratee(accumulator, array[length], length, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Gets the size of an ASCII `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n var asciiSize = baseProperty('length');\n\n /**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function asciiToArray(string) {\n return string.split('');\n }\n\n /**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function asciiWords(string) {\n return string.match(reAsciiWord) || [];\n }\n\n /**\n * The base implementation of methods like `_.findKey` and `_.findLastKey`,\n * without support for iteratee shorthands, which iterates over `collection`\n * using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\n function baseFindKey(collection, predicate, eachFunc) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = key;\n return false;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n }\n\n /**\n * This function is like `baseIndexOf` except that it accepts a comparator.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOfWith(array, value, fromIndex, comparator) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (comparator(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\n function baseIsNaN(value) {\n return value !== value;\n }\n\n /**\n * The base implementation of `_.mean` and `_.meanBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the mean.\n */\n function baseMean(array, iteratee) {\n var length = array == null ? 0 : array.length;\n return length ? (baseSum(array, iteratee) / length) : NAN;\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight`, without support\n * for iteratee shorthands, which iterates over `collection` using `eachFunc`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initAccum Specify using the first or last element of\n * `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initAccum\n ? (initAccum = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\n function baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.sum` and `_.sumBy` without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function baseSum(array, iteratee) {\n var result,\n index = -1,\n length = array.length;\n\n while (++index < length) {\n var current = iteratee(array[index]);\n if (current !== undefined) {\n result = result === undefined ? current : (result + current);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\n function baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array\n * of key-value pairs for `object` corresponding to the property names of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the key-value pairs.\n */\n function baseToPairs(object, props) {\n return arrayMap(props, function(key) {\n return [key, object[key]];\n });\n }\n\n /**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\n function baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n }\n\n /**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\n function baseUnary(func) {\n return function(value) {\n return func(value);\n };\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n }\n\n /**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function cacheHas(cache, key) {\n return cache.has(key);\n }\n\n /**\n * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the first unmatched string symbol.\n */\n function charsStartIndex(strSymbols, chrSymbols) {\n var index = -1,\n length = strSymbols.length;\n\n while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol\n * that is not found in the character symbols.\n *\n * @private\n * @param {Array} strSymbols The string symbols to inspect.\n * @param {Array} chrSymbols The character symbols to find.\n * @returns {number} Returns the index of the last unmatched string symbol.\n */\n function charsEndIndex(strSymbols, chrSymbols) {\n var index = strSymbols.length;\n\n while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}\n return index;\n }\n\n /**\n * Gets the number of `placeholder` occurrences in `array`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} placeholder The placeholder to search for.\n * @returns {number} Returns the placeholder count.\n */\n function countHolders(array, placeholder) {\n var length = array.length,\n result = 0;\n\n while (length--) {\n if (array[length] === placeholder) {\n ++result;\n }\n }\n return result;\n }\n\n /**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\n var deburrLetter = basePropertyOf(deburredLetters);\n\n /**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n var escapeHtmlChar = basePropertyOf(htmlEscapes);\n\n /**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n }\n\n /**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function getValue(object, key) {\n return object == null ? undefined : object[key];\n }\n\n /**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\n function hasUnicode(string) {\n return reHasUnicode.test(string);\n }\n\n /**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\n function hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n }\n\n /**\n * Converts `iterator` to an array.\n *\n * @private\n * @param {Object} iterator The iterator to convert.\n * @returns {Array} Returns the converted array.\n */\n function iteratorToArray(iterator) {\n var data,\n result = [];\n\n while (!(data = iterator.next()).done) {\n result.push(data.value);\n }\n return result;\n }\n\n /**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\n function mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n }\n\n /**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\n function overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n }\n\n /**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\n function replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value === placeholder || value === PLACEHOLDER) {\n array[index] = PLACEHOLDER;\n result[resIndex++] = index;\n }\n }\n return result;\n }\n\n /**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\n function setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n }\n\n /**\n * Converts `set` to its value-value pairs.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the value-value pairs.\n */\n function setToPairs(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = [value, value];\n });\n return result;\n }\n\n /**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * A specialized version of `_.lastIndexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function strictLastIndexOf(array, value, fromIndex) {\n var index = fromIndex + 1;\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return index;\n }\n\n /**\n * Gets the number of symbols in `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the string size.\n */\n function stringSize(string) {\n return hasUnicode(string)\n ? unicodeSize(string)\n : asciiSize(string);\n }\n\n /**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n }\n\n /**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\n function trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n }\n\n /**\n * Used by `_.unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} chr The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n var unescapeHtmlChar = basePropertyOf(htmlUnescapes);\n\n /**\n * Gets the size of a Unicode `string`.\n *\n * @private\n * @param {string} string The string inspect.\n * @returns {number} Returns the string size.\n */\n function unicodeSize(string) {\n var result = reUnicode.lastIndex = 0;\n while (reUnicode.test(string)) {\n ++result;\n }\n return result;\n }\n\n /**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\n function unicodeToArray(string) {\n return string.match(reUnicode) || [];\n }\n\n /**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\n function unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Create a new pristine `lodash` function using the `context` object.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Util\n * @param {Object} [context=root] The context object.\n * @returns {Function} Returns a new `lodash` function.\n * @example\n *\n * _.mixin({ 'foo': _.constant('foo') });\n *\n * var lodash = _.runInContext();\n * lodash.mixin({ 'bar': lodash.constant('bar') });\n *\n * _.isFunction(_.foo);\n * // => true\n * _.isFunction(_.bar);\n * // => false\n *\n * lodash.isFunction(lodash.foo);\n * // => false\n * lodash.isFunction(lodash.bar);\n * // => true\n *\n * // Create a suped-up `defer` in Node.js.\n * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n */\n var runInContext = (function runInContext(context) {\n context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));\n\n /** Built-in constructor references. */\n var Array = context.Array,\n Date = context.Date,\n Error = context.Error,\n Function = context.Function,\n Math = context.Math,\n Object = context.Object,\n RegExp = context.RegExp,\n String = context.String,\n TypeError = context.TypeError;\n\n /** Used for built-in method references. */\n var arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n /** Used to detect overreaching core-js shims. */\n var coreJsData = context['__core-js_shared__'];\n\n /** Used to resolve the decompiled source of functions. */\n var funcToString = funcProto.toString;\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty;\n\n /** Used to generate unique IDs. */\n var idCounter = 0;\n\n /** Used to detect methods masquerading as native. */\n var maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n }());\n\n /**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\n var nativeObjectToString = objectProto.toString;\n\n /** Used to infer the `Object` constructor. */\n var objectCtorString = funcToString.call(Object);\n\n /** Used to restore the original `_` reference in `_.noConflict`. */\n var oldDash = root._;\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n );\n\n /** Built-in value references. */\n var Buffer = moduleExports ? context.Buffer : undefined,\n Symbol = context.Symbol,\n Uint8Array = context.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,\n symIterator = Symbol ? Symbol.iterator : undefined,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n var defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n }());\n\n /** Mocked built-ins. */\n var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,\n ctxNow = Date && Date.now !== root.Date.now && Date.now,\n ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;\n\n /* Built-in method references for those with the same name as other `lodash` methods. */\n var nativeCeil = Math.ceil,\n nativeFloor = Math.floor,\n nativeGetSymbols = Object.getOwnPropertySymbols,\n nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeIsFinite = context.isFinite,\n nativeJoin = arrayProto.join,\n nativeKeys = overArg(Object.keys, Object),\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeNow = Date.now,\n nativeParseInt = context.parseInt,\n nativeRandom = Math.random,\n nativeReverse = arrayProto.reverse;\n\n /* Built-in method references that are verified to be native. */\n var DataView = getNative(context, 'DataView'),\n Map = getNative(context, 'Map'),\n Promise = getNative(context, 'Promise'),\n Set = getNative(context, 'Set'),\n WeakMap = getNative(context, 'WeakMap'),\n nativeCreate = getNative(Object, 'create');\n\n /** Used to store function metadata. */\n var metaMap = WeakMap && new WeakMap;\n\n /** Used to lookup unminified function names. */\n var realNames = {};\n\n /** Used to detect maps, sets, and weakmaps. */\n var dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n /** Used to convert symbols to primitives and strings. */\n var symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps `value` to enable implicit method\n * chain sequences. Methods that operate on and return arrays, collections,\n * and functions can be chained together. Methods that retrieve a single value\n * or may return a primitive value will automatically end the chain sequence\n * and return the unwrapped value. Otherwise, the value must be unwrapped\n * with `_#value`.\n *\n * Explicit chain sequences, which must be unwrapped with `_#value`, may be\n * enabled using `_.chain`.\n *\n * The execution of chained methods is lazy, that is, it's deferred until\n * `_#value` is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion.\n * Shortcut fusion is an optimization to merge iteratee calls; this avoids\n * the creation of intermediate arrays and can greatly reduce the number of\n * iteratee executions. Sections of a chain sequence qualify for shortcut\n * fusion if the section is applied to an array and iteratees accept only\n * one argument. The heuristic for whether a section qualifies for shortcut\n * fusion is subject to change.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,\n * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,\n * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,\n * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,\n * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,\n * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,\n * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,\n * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,\n * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,\n * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,\n * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,\n * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,\n * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,\n * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,\n * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,\n * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,\n * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,\n * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,\n * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,\n * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,\n * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,\n * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,\n * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,\n * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,\n * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,\n * `zipObject`, `zipObjectDeep`, and `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,\n * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,\n * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,\n * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,\n * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,\n * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,\n * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,\n * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,\n * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,\n * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,\n * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,\n * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,\n * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,\n * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,\n * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,\n * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,\n * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,\n * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,\n * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,\n * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,\n * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,\n * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,\n * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,\n * `upperFirst`, `value`, and `words`\n *\n * @name _\n * @constructor\n * @category Seq\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // Returns an unwrapped value.\n * wrapped.reduce(_.add);\n * // => 6\n *\n * // Returns a wrapped value.\n * var squares = wrapped.map(square);\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n }());\n\n /**\n * The function whose prototype chain sequence wrappers inherit from.\n *\n * @private\n */\n function baseLodash() {\n // No operation performed.\n }\n\n /**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable explicit method chain sequences.\n */\n function LodashWrapper(value, chainAll) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__chain__ = !!chainAll;\n this.__index__ = 0;\n this.__values__ = undefined;\n }\n\n /**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB) as well as ES2015 template strings. Change the\n * following template settings to use alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type {Object}\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type {string}\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type {Object}\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type {Function}\n */\n '_': lodash\n }\n };\n\n // Ensure wrappers are instances of `baseLodash`.\n lodash.prototype = baseLodash.prototype;\n lodash.prototype.constructor = lodash;\n\n LodashWrapper.prototype = baseCreate(baseLodash.prototype);\n LodashWrapper.prototype.constructor = LodashWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @constructor\n * @param {*} value The value to wrap.\n */\n function LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = MAX_ARRAY_LENGTH;\n this.__views__ = [];\n }\n\n /**\n * Creates a clone of the lazy wrapper object.\n *\n * @private\n * @name clone\n * @memberOf LazyWrapper\n * @returns {Object} Returns the cloned `LazyWrapper` object.\n */\n function lazyClone() {\n var result = new LazyWrapper(this.__wrapped__);\n result.__actions__ = copyArray(this.__actions__);\n result.__dir__ = this.__dir__;\n result.__filtered__ = this.__filtered__;\n result.__iteratees__ = copyArray(this.__iteratees__);\n result.__takeCount__ = this.__takeCount__;\n result.__views__ = copyArray(this.__views__);\n return result;\n }\n\n /**\n * Reverses the direction of lazy iteration.\n *\n * @private\n * @name reverse\n * @memberOf LazyWrapper\n * @returns {Object} Returns the new reversed `LazyWrapper` object.\n */\n function lazyReverse() {\n if (this.__filtered__) {\n var result = new LazyWrapper(this);\n result.__dir__ = -1;\n result.__filtered__ = true;\n } else {\n result = this.clone();\n result.__dir__ *= -1;\n }\n return result;\n }\n\n /**\n * Extracts the unwrapped value from its lazy wrapper.\n *\n * @private\n * @name value\n * @memberOf LazyWrapper\n * @returns {*} Returns the unwrapped value.\n */\n function lazyValue() {\n var array = this.__wrapped__.value(),\n dir = this.__dir__,\n isArr = isArray(array),\n isRight = dir < 0,\n arrLength = isArr ? array.length : 0,\n view = getView(0, arrLength, this.__views__),\n start = view.start,\n end = view.end,\n length = end - start,\n index = isRight ? end : (start - 1),\n iteratees = this.__iteratees__,\n iterLength = iteratees.length,\n resIndex = 0,\n takeCount = nativeMin(length, this.__takeCount__);\n\n if (!isArr || (!isRight && arrLength == length && takeCount == length)) {\n return baseWrapperValue(array, this.__actions__);\n }\n var result = [];\n\n outer:\n while (length-- && resIndex < takeCount) {\n index += dir;\n\n var iterIndex = -1,\n value = array[index];\n\n while (++iterIndex < iterLength) {\n var data = iteratees[iterIndex],\n iteratee = data.iteratee,\n type = data.type,\n computed = iteratee(value);\n\n if (type == LAZY_MAP_FLAG) {\n value = computed;\n } else if (!computed) {\n if (type == LAZY_FILTER_FLAG) {\n continue outer;\n } else {\n break outer;\n }\n }\n }\n result[resIndex++] = value;\n }\n return result;\n }\n\n // Ensure `LazyWrapper` is an instance of `baseLodash`.\n LazyWrapper.prototype = baseCreate(baseLodash.prototype);\n LazyWrapper.prototype.constructor = LazyWrapper;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\n function hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n }\n\n /**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n }\n\n /**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\n function hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n }\n\n // Add methods to `Hash`.\n Hash.prototype.clear = hashClear;\n Hash.prototype['delete'] = hashDelete;\n Hash.prototype.get = hashGet;\n Hash.prototype.has = hashHas;\n Hash.prototype.set = hashSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\n function listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n }\n\n /**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n }\n\n /**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n }\n\n /**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\n function listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n }\n\n // Add methods to `ListCache`.\n ListCache.prototype.clear = listCacheClear;\n ListCache.prototype['delete'] = listCacheDelete;\n ListCache.prototype.get = listCacheGet;\n ListCache.prototype.has = listCacheHas;\n ListCache.prototype.set = listCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n }\n\n /**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\n function mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n }\n\n /**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n }\n\n /**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function mapCacheGet(key) {\n return getMapData(this, key).get(key);\n }\n\n /**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapCacheHas(key) {\n return getMapData(this, key).has(key);\n }\n\n /**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\n function mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n }\n\n // Add methods to `MapCache`.\n MapCache.prototype.clear = mapCacheClear;\n MapCache.prototype['delete'] = mapCacheDelete;\n MapCache.prototype.get = mapCacheGet;\n MapCache.prototype.has = mapCacheHas;\n MapCache.prototype.set = mapCacheSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n }\n\n /**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\n function setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n }\n\n /**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\n function setCacheHas(value) {\n return this.__data__.has(value);\n }\n\n // Add methods to `SetCache`.\n SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\n SetCache.prototype.has = setCacheHas;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\n function Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n }\n\n /**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\n function stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n }\n\n /**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\n function stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n }\n\n /**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\n function stackGet(key) {\n return this.__data__.get(key);\n }\n\n /**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function stackHas(key) {\n return this.__data__.has(key);\n }\n\n /**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\n function stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n }\n\n // Add methods to `Stack`.\n Stack.prototype.clear = stackClear;\n Stack.prototype['delete'] = stackDelete;\n Stack.prototype.get = stackGet;\n Stack.prototype.has = stackHas;\n Stack.prototype.set = stackSet;\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\n function arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.sample` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @returns {*} Returns the random element.\n */\n function arraySample(array) {\n var length = array.length;\n return length ? array[baseRandom(0, length - 1)] : undefined;\n }\n\n /**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n }\n\n /**\n * A specialized version of `_.shuffle` for arrays.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function arrayShuffle(array) {\n return shuffleSelf(copyArray(array));\n }\n\n /**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n }\n\n /**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n }\n\n /**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n }\n\n /**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n }\n\n /**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\n function baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n }\n\n /**\n * The base implementation of `_.at` without support for individual paths.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {string[]} paths The property paths to pick.\n * @returns {Array} Returns the picked elements.\n */\n function baseAt(object, paths) {\n var index = -1,\n length = paths.length,\n result = Array(length),\n skip = object == null;\n\n while (++index < length) {\n result[index] = skip ? undefined : get(object, paths[index]);\n }\n return result;\n }\n\n /**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\n function baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n }\n\n /**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n }\n\n /**\n * The base implementation of `_.conforms` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property predicates to conform to.\n * @returns {Function} Returns the new spec function.\n */\n function baseConforms(source) {\n var props = keys(source);\n return function(object) {\n return baseConformsTo(object, source, props);\n };\n }\n\n /**\n * The base implementation of `_.conformsTo` which accepts `props` to check.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n */\n function baseConformsTo(object, source, props) {\n var length = props.length;\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (length--) {\n var key = props[length],\n predicate = source[key],\n value = object[key];\n\n if ((value === undefined && !(key in object)) || !predicate(value)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.delay` and `_.defer` which accepts `args`\n * to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Array} args The arguments to provide to `func`.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n function baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n }\n\n /**\n * The base implementation of methods like `_.difference` without support\n * for excluding multiple arrays or iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n isCommon = true,\n length = array.length,\n result = [],\n valuesLength = values.length;\n\n if (!length) {\n return result;\n }\n if (iteratee) {\n values = arrayMap(values, baseUnary(iteratee));\n }\n if (comparator) {\n includes = arrayIncludesWith;\n isCommon = false;\n }\n else if (values.length >= LARGE_ARRAY_SIZE) {\n includes = cacheHas;\n isCommon = false;\n values = new SetCache(values);\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee == null ? value : iteratee(value);\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === computed) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (!includes(values, computed, comparator)) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn);\n\n /**\n * The base implementation of `_.forEachRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\n var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n /**\n * The base implementation of `_.every` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n }\n\n /**\n * The base implementation of methods like `_.max` and `_.min` which accepts a\n * `comparator` to determine the extremum value.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The iteratee invoked per iteration.\n * @param {Function} comparator The comparator used to compare values.\n * @returns {*} Returns the extremum value.\n */\n function baseExtremum(array, iteratee, comparator) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index],\n current = iteratee(value);\n\n if (current != null && (computed === undefined\n ? (current === current && !isSymbol(current))\n : comparator(current, computed)\n )) {\n var computed = current,\n result = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\n function baseFill(array, value, start, end) {\n var length = array.length;\n\n start = toInteger(start);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : toInteger(end);\n if (end < 0) {\n end += length;\n }\n end = start > end ? 0 : toLength(end);\n while (start < end) {\n array[start++] = value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.filter` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor();\n\n /**\n * This function is like `baseFor` except that it iterates over properties\n * in the opposite order.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseForRight = createBaseFor(true);\n\n /**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.forOwnRight` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwnRight(object, iteratee) {\n return object && baseForRight(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.functions` which creates an array of\n * `object` function property names filtered from `props`.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} props The property names to filter.\n * @returns {Array} Returns the function names.\n */\n function baseFunctions(object, props) {\n return arrayFilter(props, function(key) {\n return isFunction(object[key]);\n });\n }\n\n /**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n }\n\n /**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n }\n\n /**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n function baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n }\n\n /**\n * The base implementation of `_.gt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n */\n function baseGt(value, other) {\n return value > other;\n }\n\n /**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n }\n\n /**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\n function baseHasIn(object, key) {\n return object != null && key in Object(object);\n }\n\n /**\n * The base implementation of `_.inRange` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to check.\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n */\n function baseInRange(number, start, end) {\n return number >= nativeMin(start, end) && number < nativeMax(start, end);\n }\n\n /**\n * The base implementation of methods like `_.intersection`, without support\n * for iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of shared values.\n */\n function baseIntersection(arrays, iteratee, comparator) {\n var includes = comparator ? arrayIncludesWith : arrayIncludes,\n length = arrays[0].length,\n othLength = arrays.length,\n othIndex = othLength,\n caches = Array(othLength),\n maxLength = Infinity,\n result = [];\n\n while (othIndex--) {\n var array = arrays[othIndex];\n if (othIndex && iteratee) {\n array = arrayMap(array, baseUnary(iteratee));\n }\n maxLength = nativeMin(array.length, maxLength);\n caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))\n ? new SetCache(othIndex && array)\n : undefined;\n }\n array = arrays[0];\n\n var index = -1,\n seen = caches[0];\n\n outer:\n while (++index < length && result.length < maxLength) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (!(seen\n ? cacheHas(seen, computed)\n : includes(result, computed, comparator)\n )) {\n othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if (!(cache\n ? cacheHas(cache, computed)\n : includes(arrays[othIndex], computed, comparator))\n ) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.invert` and `_.invertBy` which inverts\n * `object` with values transformed by `iteratee` and set by `setter`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform values.\n * @param {Object} accumulator The initial inverted object.\n * @returns {Function} Returns `accumulator`.\n */\n function baseInverter(object, setter, iteratee, accumulator) {\n baseForOwn(object, function(value, key, object) {\n setter(accumulator, iteratee(value), key, object);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `_.invoke` without support for individual\n * method arguments.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {Array} args The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n */\n function baseInvoke(object, path, args) {\n path = castPath(path, object);\n object = parent(object, path);\n var func = object == null ? object : object[toKey(last(path))];\n return func == null ? undefined : apply(func, object, args);\n }\n\n /**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\n function baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n }\n\n /**\n * The base implementation of `_.isArrayBuffer` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n */\n function baseIsArrayBuffer(value) {\n return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;\n }\n\n /**\n * The base implementation of `_.isDate` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n */\n function baseIsDate(value) {\n return isObjectLike(value) && baseGetTag(value) == dateTag;\n }\n\n /**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n }\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n }\n\n /**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\n function baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n }\n\n /**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\n function baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n }\n\n /**\n * The base implementation of `_.isRegExp` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n */\n function baseIsRegExp(value) {\n return isObjectLike(value) && baseGetTag(value) == regexpTag;\n }\n\n /**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\n function baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n }\n\n /**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\n function baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n }\n\n /**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\n function baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == 'object') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n }\n\n /**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.lt` which doesn't coerce arguments.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n */\n function baseLt(value, other) {\n return value < other;\n }\n\n /**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n }\n\n /**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n }\n\n /**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n }\n\n /**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\n function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n }\n\n /**\n * The base implementation of `_.nth` which doesn't coerce arguments.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {number} n The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n */\n function baseNth(array, n) {\n var length = array.length;\n if (!length) {\n return;\n }\n n += n < 0 ? length : 0;\n return isIndex(n, length) ? array[n] : undefined;\n }\n\n /**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\n function baseOrderBy(collection, iteratees, orders) {\n if (iteratees.length) {\n iteratees = arrayMap(iteratees, function(iteratee) {\n if (isArray(iteratee)) {\n return function(value) {\n return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);\n }\n }\n return iteratee;\n });\n } else {\n iteratees = [identity];\n }\n\n var index = -1;\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n }\n\n /**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\n function basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n }\n\n /**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\n function basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\n function basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n }\n\n /**\n * The base implementation of `_.pullAllBy` without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n */\n function basePullAll(array, values, iteratee, comparator) {\n var indexOf = comparator ? baseIndexOfWith : baseIndexOf,\n index = -1,\n length = values.length,\n seen = array;\n\n if (array === values) {\n values = copyArray(values);\n }\n if (iteratee) {\n seen = arrayMap(array, baseUnary(iteratee));\n }\n while (++index < length) {\n var fromIndex = 0,\n value = values[index],\n computed = iteratee ? iteratee(value) : value;\n\n while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {\n if (seen !== array) {\n splice.call(seen, fromIndex, 1);\n }\n splice.call(array, fromIndex, 1);\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.pullAt` without support for individual\n * indexes or capturing the removed elements.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {number[]} indexes The indexes of elements to remove.\n * @returns {Array} Returns `array`.\n */\n function basePullAt(array, indexes) {\n var length = array ? indexes.length : 0,\n lastIndex = length - 1;\n\n while (length--) {\n var index = indexes[length];\n if (length == lastIndex || index !== previous) {\n var previous = index;\n if (isIndex(index)) {\n splice.call(array, index, 1);\n } else {\n baseUnset(array, index);\n }\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\n function baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n }\n\n /**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\n function baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n }\n\n /**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\n function baseRepeat(string, n) {\n var result = '';\n if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n if (n) {\n string += string;\n }\n } while (n);\n\n return result;\n }\n\n /**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\n function baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n }\n\n /**\n * The base implementation of `_.sample`.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n */\n function baseSample(collection) {\n return arraySample(values(collection));\n }\n\n /**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\n function baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n }\n\n /**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n }\n\n /**\n * The base implementation of `setData` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n };\n\n /**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n };\n\n /**\n * The base implementation of `_.shuffle`.\n *\n * @private\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n */\n function baseShuffle(collection) {\n return shuffleSelf(values(collection));\n }\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.some` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n }\n\n /**\n * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which\n * performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndex(array, value, retHighest) {\n var low = 0,\n high = array == null ? low : array.length;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if (computed !== null && !isSymbol(computed) &&\n (retHighest ? (computed <= value) : (computed < value))) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return baseSortedIndexBy(array, value, identity, retHighest);\n }\n\n /**\n * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`\n * which invokes `iteratee` for `value` and each element of `array` to compute\n * their sort ranking. The iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The iteratee invoked per element.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function baseSortedIndexBy(array, value, iteratee, retHighest) {\n var low = 0,\n high = array == null ? 0 : array.length;\n if (high === 0) {\n return 0;\n }\n\n value = iteratee(value);\n var valIsNaN = value !== value,\n valIsNull = value === null,\n valIsSymbol = isSymbol(value),\n valIsUndefined = value === undefined;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n othIsDefined = computed !== undefined,\n othIsNull = computed === null,\n othIsReflexive = computed === computed,\n othIsSymbol = isSymbol(computed);\n\n if (valIsNaN) {\n var setLow = retHighest || othIsReflexive;\n } else if (valIsUndefined) {\n setLow = othIsReflexive && (retHighest || othIsDefined);\n } else if (valIsNull) {\n setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);\n } else if (valIsSymbol) {\n setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);\n } else if (othIsNull || othIsSymbol) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n }\n\n /**\n * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseSortedUniq(array, iteratee) {\n var index = -1,\n length = array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n if (!index || !eq(computed, seen)) {\n var seen = computed;\n result[resIndex++] = value === 0 ? 0 : value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.toNumber` which doesn't ensure correct\n * conversions of binary, hexadecimal, or octal string values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n */\n function baseToNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n return +value;\n }\n\n /**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\n function baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\n function baseUnset(object, path) {\n path = castPath(path, object);\n object = parent(object, path);\n return object == null || delete object[toKey(last(path))];\n }\n\n /**\n * The base implementation of `_.update`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to update.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\n function baseUpdate(object, path, updater, customizer) {\n return baseSet(object, path, updater(baseGet(object, path)), customizer);\n }\n\n /**\n * The base implementation of methods like `_.dropWhile` and `_.takeWhile`\n * without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseWhile(array, predicate, isDrop, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length) &&\n predicate(array[index], index, array)) {}\n\n return isDrop\n ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n }\n\n /**\n * The base implementation of `wrapperValue` which returns the result of\n * performing a sequence of actions on the unwrapped `value`, where each\n * successive action is supplied the return value of the previous.\n *\n * @private\n * @param {*} value The unwrapped value.\n * @param {Array} actions Actions to perform to resolve the unwrapped value.\n * @returns {*} Returns the resolved value.\n */\n function baseWrapperValue(value, actions) {\n var result = value;\n if (result instanceof LazyWrapper) {\n result = result.value();\n }\n return arrayReduce(actions, function(result, action) {\n return action.func.apply(action.thisArg, arrayPush([result], action.args));\n }, result);\n }\n\n /**\n * The base implementation of methods like `_.xor`, without support for\n * iteratee shorthands, that accepts an array of arrays to inspect.\n *\n * @private\n * @param {Array} arrays The arrays to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of values.\n */\n function baseXor(arrays, iteratee, comparator) {\n var length = arrays.length;\n if (length < 2) {\n return length ? baseUniq(arrays[0]) : [];\n }\n var index = -1,\n result = Array(length);\n\n while (++index < length) {\n var array = arrays[index],\n othIndex = -1;\n\n while (++othIndex < length) {\n if (othIndex != index) {\n result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);\n }\n }\n }\n return baseUniq(baseFlatten(result, 1), iteratee, comparator);\n }\n\n /**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\n function baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n }\n\n /**\n * Casts `value` to an empty array if it's not an array like object.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Array|Object} Returns the cast array-like object.\n */\n function castArrayLikeObject(value) {\n return isArrayLikeObject(value) ? value : [];\n }\n\n /**\n * Casts `value` to `identity` if it's not a function.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Function} Returns cast function.\n */\n function castFunction(value) {\n return typeof value == 'function' ? value : identity;\n }\n\n /**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\n function castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n }\n\n /**\n * A `baseRest` alias which can be replaced with `identity` by module\n * replacement plugins.\n *\n * @private\n * @type {Function}\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n var castRest = baseRest;\n\n /**\n * Casts `array` to a slice if it's needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\n function castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n }\n\n /**\n * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).\n *\n * @private\n * @param {number|Object} id The timer id or timeout object of the timer to clear.\n */\n var clearTimeout = ctxClearTimeout || function(id) {\n return root.clearTimeout(id);\n };\n\n /**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\n function cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n }\n\n /**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n }\n\n /**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\n function cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n }\n\n /**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\n function cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n }\n\n /**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\n function cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n }\n\n /**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\n function cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n }\n\n /**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\n function compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n }\n\n /**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of \"desc\" for descending or \"asc\" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == 'desc' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n }\n\n /**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgs(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersLength = holders.length,\n leftIndex = -1,\n leftLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(leftLength + rangeLength),\n isUncurried = !isCurried;\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n }\n while (rangeLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @params {boolean} [isCurried] Specify composing for a curried function.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgsRight(args, partials, holders, isCurried) {\n var argsIndex = -1,\n argsLength = args.length,\n holdersIndex = -1,\n holdersLength = holders.length,\n rightIndex = -1,\n rightLength = partials.length,\n rangeLength = nativeMax(argsLength - holdersLength, 0),\n result = Array(rangeLength + rightLength),\n isUncurried = !isCurried;\n\n while (++argsIndex < rangeLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n if (isUncurried || argsIndex < argsLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n }\n return result;\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\n function copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n }\n\n /**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n }\n\n /**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\n function copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n }\n\n /**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, getIteratee(iteratee, 2), accumulator);\n };\n }\n\n /**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n }\n\n /**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the optional `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createBind(func, bitmask, thisArg) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, arguments);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\n function createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join('')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n }\n\n /**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\n function createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');\n };\n }\n\n /**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCtor(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors. See\n // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n }\n\n /**\n * Creates a function that wraps `func` to enable currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {number} arity The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCurry(func, bitmask, arity) {\n var Ctor = createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length,\n placeholder = getHolder(wrapper);\n\n while (index--) {\n args[index] = arguments[index];\n }\n var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)\n ? []\n : replaceHolders(args, placeholder);\n\n length -= holders.length;\n if (length < arity) {\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, undefined,\n args, holders, undefined, undefined, arity - length);\n }\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return apply(fn, this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} findIndexFunc The function to find the collection index.\n * @returns {Function} Returns the new find function.\n */\n function createFind(findIndexFunc) {\n return function(collection, predicate, fromIndex) {\n var iterable = Object(collection);\n if (!isArrayLike(collection)) {\n var iteratee = getIteratee(predicate, 3);\n collection = keys(collection);\n predicate = function(key) { return iteratee(iterable[key], key, iterable); };\n }\n var index = findIndexFunc(collection, predicate, fromIndex);\n return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;\n };\n }\n\n /**\n * Creates a `_.flow` or `_.flowRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new flow function.\n */\n function createFlow(fromRight) {\n return flatRest(function(funcs) {\n var length = funcs.length,\n index = length,\n prereq = LodashWrapper.prototype.thru;\n\n if (fromRight) {\n funcs.reverse();\n }\n while (index--) {\n var func = funcs[index];\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (prereq && !wrapper && getFuncName(func) == 'wrapper') {\n var wrapper = new LodashWrapper([], true);\n }\n }\n index = wrapper ? index : length;\n while (++index < length) {\n func = funcs[index];\n\n var funcName = getFuncName(func),\n data = funcName == 'wrapper' ? getData(func) : undefined;\n\n if (data && isLaziable(data[0]) &&\n data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&\n !data[4].length && data[9] == 1\n ) {\n wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n } else {\n wrapper = (func.length == 1 && isLaziable(func))\n ? wrapper[funcName]()\n : wrapper.thru(func);\n }\n }\n return function() {\n var args = arguments,\n value = args[0];\n\n if (wrapper && args.length == 1 && isArray(value)) {\n return wrapper.plant(value).value();\n }\n var index = 0,\n result = length ? funcs[index].apply(this, args) : value;\n\n while (++index < length) {\n result = funcs[index].call(this, result);\n }\n return result;\n };\n });\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with optional `this`\n * binding of `thisArg`, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided\n * to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & WRAP_ARY_FLAG,\n isBind = bitmask & WRAP_BIND_FLAG,\n isBindKey = bitmask & WRAP_BIND_KEY_FLAG,\n isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),\n isFlip = bitmask & WRAP_FLIP_FLAG,\n Ctor = isBindKey ? undefined : createCtor(func);\n\n function wrapper() {\n var length = arguments.length,\n args = Array(length),\n index = length;\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (isCurried) {\n var placeholder = getHolder(wrapper),\n holdersCount = countHolders(args, placeholder);\n }\n if (partials) {\n args = composeArgs(args, partials, holders, isCurried);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight, isCurried);\n }\n length -= holdersCount;\n if (isCurried && length < arity) {\n var newHolders = replaceHolders(args, placeholder);\n return createRecurry(\n func, bitmask, createHybrid, wrapper.placeholder, thisArg,\n args, newHolders, argPos, ary, arity - length\n );\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n length = args.length;\n if (argPos) {\n args = reorder(args, argPos);\n } else if (isFlip && length > 1) {\n args.reverse();\n }\n if (isAry && ary < length) {\n args.length = ary;\n }\n if (this && this !== root && this instanceof wrapper) {\n fn = Ctor || createCtor(fn);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a function like `_.invertBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} toIteratee The function to resolve iteratees.\n * @returns {Function} Returns the new inverter function.\n */\n function createInverter(setter, toIteratee) {\n return function(object, iteratee) {\n return baseInverter(object, setter, toIteratee(iteratee), {});\n };\n }\n\n /**\n * Creates a function that performs a mathematical operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @param {number} [defaultValue] The value used for `undefined` arguments.\n * @returns {Function} Returns the new mathematical operation function.\n */\n function createMathOperation(operator, defaultValue) {\n return function(value, other) {\n var result;\n if (value === undefined && other === undefined) {\n return defaultValue;\n }\n if (value !== undefined) {\n result = value;\n }\n if (other !== undefined) {\n if (result === undefined) {\n return other;\n }\n if (typeof value == 'string' || typeof other == 'string') {\n value = baseToString(value);\n other = baseToString(other);\n } else {\n value = baseToNumber(value);\n other = baseToNumber(other);\n }\n result = operator(value, other);\n }\n return result;\n };\n }\n\n /**\n * Creates a function like `_.over`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over iteratees.\n * @returns {Function} Returns the new over function.\n */\n function createOver(arrayFunc) {\n return flatRest(function(iteratees) {\n iteratees = arrayMap(iteratees, baseUnary(getIteratee()));\n return baseRest(function(args) {\n var thisArg = this;\n return arrayFunc(iteratees, function(iteratee) {\n return apply(iteratee, thisArg, args);\n });\n });\n });\n }\n\n /**\n * Creates the padding for `string` based on `length`. The `chars` string\n * is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {number} length The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padding for `string`.\n */\n function createPadding(length, chars) {\n chars = chars === undefined ? ' ' : baseToString(chars);\n\n var charsLength = chars.length;\n if (charsLength < 2) {\n return charsLength ? baseRepeat(chars, length) : chars;\n }\n var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));\n return hasUnicode(chars)\n ? castSlice(stringToArray(result), 0, length).join('')\n : result.slice(0, length);\n }\n\n /**\n * Creates a function that wraps `func` to invoke it with the `this` binding\n * of `thisArg` and `partials` prepended to the arguments it receives.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to\n * the new function.\n * @returns {Function} Returns the new wrapped function.\n */\n function createPartial(func, bitmask, thisArg, partials) {\n var isBind = bitmask & WRAP_BIND_FLAG,\n Ctor = createCtor(func);\n\n function wrapper() {\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength),\n fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n return apply(fn, isBind ? thisArg : this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\n function createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n }\n\n /**\n * Creates a function that performs a relational operation on two values.\n *\n * @private\n * @param {Function} operator The function to perform the operation.\n * @returns {Function} Returns the new relational operation function.\n */\n function createRelationalOperation(operator) {\n return function(value, other) {\n if (!(typeof value == 'string' && typeof other == 'string')) {\n value = toNumber(value);\n other = toNumber(other);\n }\n return operator(value, other);\n };\n }\n\n /**\n * Creates a function that wraps `func` to continue currying.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @param {Function} wrapFunc The function to create the `func` wrapper.\n * @param {*} placeholder The placeholder value.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to\n * the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {\n var isCurry = bitmask & WRAP_CURRY_FLAG,\n newHolders = isCurry ? holders : undefined,\n newHoldersRight = isCurry ? undefined : holders,\n newPartials = isCurry ? partials : undefined,\n newPartialsRight = isCurry ? undefined : partials;\n\n bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);\n\n if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {\n bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);\n }\n var newData = [\n func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,\n newHoldersRight, argPos, ary, arity\n ];\n\n var result = wrapFunc.apply(undefined, newData);\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return setWrapToString(result, func, bitmask);\n }\n\n /**\n * Creates a function like `_.round`.\n *\n * @private\n * @param {string} methodName The name of the `Math` method to use when rounding.\n * @returns {Function} Returns the new round function.\n */\n function createRound(methodName) {\n var func = Math[methodName];\n return function(number, precision) {\n number = toNumber(number);\n precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);\n if (precision && nativeIsFinite(number)) {\n // Shift with exponential notation to avoid floating-point issues.\n // See [MDN](https://mdn.io/round#Examples) for more details.\n var pair = (toString(number) + 'e').split('e'),\n value = func(pair[0] + 'e' + (+pair[1] + precision));\n\n pair = (toString(value) + 'e').split('e');\n return +(pair[0] + 'e' + (+pair[1] - precision));\n }\n return func(number);\n };\n }\n\n /**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\n var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n };\n\n /**\n * Creates a `_.toPairs` or `_.toPairsIn` function.\n *\n * @private\n * @param {Function} keysFunc The function to get the keys of a given object.\n * @returns {Function} Returns the new pairs function.\n */\n function createToPairs(keysFunc) {\n return function(object) {\n var tag = getTag(object);\n if (tag == mapTag) {\n return mapToArray(object);\n }\n if (tag == setTag) {\n return setToPairs(object);\n }\n return baseToPairs(object, keysFunc(object));\n };\n }\n\n /**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to wrap.\n * @param {number} bitmask The bitmask flags.\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * 512 - `_.flip`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);\n partials = holders = undefined;\n }\n ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);\n arity = arity === undefined ? arity : toInteger(arity);\n length -= holders ? holders.length : 0;\n\n if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined;\n }\n var data = isBindKey ? undefined : getData(func);\n\n var newData = [\n func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,\n argPos, ary, arity\n ];\n\n if (data) {\n mergeData(newData, data);\n }\n func = newData[0];\n bitmask = newData[1];\n thisArg = newData[2];\n partials = newData[3];\n holders = newData[4];\n arity = newData[9] = newData[9] === undefined\n ? (isBindKey ? 0 : func.length)\n : nativeMax(newData[9] - length, 0);\n\n if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {\n bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);\n }\n if (!bitmask || bitmask == WRAP_BIND_FLAG) {\n var result = createBind(func, bitmask, thisArg);\n } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {\n result = createCurry(func, bitmask, arity);\n } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {\n result = createPartial(func, bitmask, thisArg, partials);\n } else {\n result = createHybrid.apply(undefined, newData);\n }\n var setter = data ? baseSetData : setData;\n return setWrapToString(setter(result, newData), func, bitmask);\n }\n\n /**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n }\n\n /**\n * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source\n * objects into destination objects that are passed thru.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to merge.\n * @param {Object} object The parent object of `objValue`.\n * @param {Object} source The parent object of `srcValue`.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n * @returns {*} Returns the value to assign.\n */\n function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {\n if (isObject(objValue) && isObject(srcValue)) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, objValue);\n baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);\n stack['delete'](srcValue);\n }\n return objValue;\n }\n\n /**\n * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain\n * objects.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {string} key The key of the property to inspect.\n * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.\n */\n function customOmitClone(value) {\n return isPlainObject(value) ? undefined : value;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n }\n\n /**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\n function flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n }\n\n /**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n }\n\n /**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\n function getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n }\n\n /**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\n var getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n };\n\n /**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\n function getFuncName(func) {\n var result = (func.name + ''),\n array = realNames[result],\n length = hasOwnProperty.call(realNames, result) ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n }\n\n /**\n * Gets the argument placeholder value for `func`.\n *\n * @private\n * @param {Function} func The function to inspect.\n * @returns {*} Returns the placeholder value.\n */\n function getHolder(func) {\n var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;\n return object.placeholder;\n }\n\n /**\n * Gets the appropriate \"iteratee\" function. If `_.iteratee` is customized,\n * this function returns the custom method, otherwise it returns `baseIteratee`.\n * If arguments are provided, the chosen function is invoked with them and\n * its result is returned.\n *\n * @private\n * @param {*} [value] The value to convert to an iteratee.\n * @param {number} [arity] The arity of the created iteratee.\n * @returns {Function} Returns the chosen function or its result.\n */\n function getIteratee() {\n var result = lodash.iteratee || iteratee;\n result = result === iteratee ? baseIteratee : result;\n return arguments.length ? result(arguments[0], arguments[1]) : result;\n }\n\n /**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\n function getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n }\n\n /**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n }\n\n /**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\n function getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n }\n\n /**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n };\n\n /**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\n var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n };\n\n /**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\n var getTag = baseGetTag;\n\n // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\n if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n }\n\n /**\n * Gets the view, applying any `transforms` to the `start` and `end` positions.\n *\n * @private\n * @param {number} start The start of the view.\n * @param {number} end The end of the view.\n * @param {Array} transforms The transformations to apply to the view.\n * @returns {Object} Returns an object containing the `start` and `end`\n * positions of the view.\n */\n function getView(start, end, transforms) {\n var index = -1,\n length = transforms.length;\n\n while (++index < length) {\n var data = transforms[index],\n size = data.size;\n\n switch (data.type) {\n case 'drop': start += size; break;\n case 'dropRight': end -= size; break;\n case 'take': end = nativeMin(end, start + size); break;\n case 'takeRight': start = nativeMax(start, end - size); break;\n }\n }\n return { 'start': start, 'end': end };\n }\n\n /**\n * Extracts wrapper details from the `source` body comment.\n *\n * @private\n * @param {string} source The source to inspect.\n * @returns {Array} Returns the wrapper details.\n */\n function getWrapDetails(source) {\n var match = source.match(reWrapDetails);\n return match ? match[1].split(reSplitDetails) : [];\n }\n\n /**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\n function hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n }\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n }\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n }\n\n /**\n * Inserts wrapper `details` in a comment at the top of the `source` body.\n *\n * @private\n * @param {string} source The source to modify.\n * @returns {Array} details The details to insert.\n * @returns {string} Returns the modified source.\n */\n function insertWrapDetails(source, details) {\n var length = details.length;\n if (!length) {\n return source;\n }\n var lastIndex = length - 1;\n details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];\n details = details.join(length > 2 ? ', ' : ' ');\n return source.replace(reWrapComment, '{\\n/* [wrapped with ' + details + '] */\\n');\n }\n\n /**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\n function isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n }\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n }\n\n /**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n }\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n }\n\n /**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\n function isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n }\n\n /**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart,\n * else `false`.\n */\n function isLaziable(func) {\n var funcName = getFuncName(func),\n other = lodash[funcName];\n\n if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {\n return false;\n }\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n }\n\n /**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\n function isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n }\n\n /**\n * Checks if `func` is capable of being masked.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `func` is maskable, else `false`.\n */\n var isMaskable = coreJsData ? isFunction : stubFalse;\n\n /**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\n function isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value);\n }\n\n /**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\n function matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n }\n\n /**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\n function memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n }\n\n /**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers used to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and\n * `_.rearg` modify function arguments, making the order in which they are\n * executed important, preventing the merging of metadata. However, we make\n * an exception for a safe combined case where curried functions have `_.ary`\n * and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\n function mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);\n\n var isCombo =\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||\n ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||\n ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & WRAP_BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : value;\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = value;\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & WRAP_ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n }\n\n /**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\n function objectToString(value) {\n return nativeObjectToString.call(value);\n }\n\n /**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\n function overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n }\n\n /**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\n function parent(object, path) {\n return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));\n }\n\n /**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\n function reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = copyArray(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n }\n return array;\n }\n\n /**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\n function safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n }\n\n /**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity\n * function to avoid garbage collection pauses in V8. See\n * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var setData = shortOut(baseSetData);\n\n /**\n * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @returns {number|Object} Returns the timer id or timeout object.\n */\n var setTimeout = ctxSetTimeout || function(func, wait) {\n return root.setTimeout(func, wait);\n };\n\n /**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\n var setToString = shortOut(baseSetToString);\n\n /**\n * Sets the `toString` method of `wrapper` to mimic the source of `reference`\n * with wrapper details in a comment at the top of the source body.\n *\n * @private\n * @param {Function} wrapper The function to modify.\n * @param {Function} reference The reference function.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Function} Returns `wrapper`.\n */\n function setWrapToString(wrapper, reference, bitmask) {\n var source = (reference + '');\n return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));\n }\n\n /**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\n function shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n }\n\n /**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\n function shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n }\n\n /**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\n var stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n });\n\n /**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\n function toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n }\n\n /**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\n function toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n }\n\n /**\n * Updates wrapper `details` based on `bitmask` flags.\n *\n * @private\n * @returns {Array} details The details to modify.\n * @param {number} bitmask The bitmask flags. See `createWrap` for more details.\n * @returns {Array} Returns `details`.\n */\n function updateWrapDetails(details, bitmask) {\n arrayEach(wrapFlags, function(pair) {\n var value = '_.' + pair[0];\n if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {\n details.push(value);\n }\n });\n return details.sort();\n }\n\n /**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\n function wrapperClone(wrapper) {\n if (wrapper instanceof LazyWrapper) {\n return wrapper.clone();\n }\n var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);\n result.__actions__ = copyArray(wrapper.__actions__);\n result.__index__ = wrapper.__index__;\n result.__values__ = wrapper.__values__;\n return result;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements split into groups the length of `size`.\n * If `array` can't be split evenly, the final chunk will be the remaining\n * elements.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to process.\n * @param {number} [size=1] The length of each chunk\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the new array of chunks.\n * @example\n *\n * _.chunk(['a', 'b', 'c', 'd'], 2);\n * // => [['a', 'b'], ['c', 'd']]\n *\n * _.chunk(['a', 'b', 'c', 'd'], 3);\n * // => [['a', 'b', 'c'], ['d']]\n */\n function chunk(array, size, guard) {\n if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {\n size = 1;\n } else {\n size = nativeMax(toInteger(size), 0);\n }\n var length = array == null ? 0 : array.length;\n if (!length || size < 1) {\n return [];\n }\n var index = 0,\n resIndex = 0,\n result = Array(nativeCeil(length / size));\n\n while (index < length) {\n result[resIndex++] = baseSlice(array, index, (index += size));\n }\n return result;\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n }\n\n /**\n * Creates a new array concatenating `array` with any additional arrays\n * and/or values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to concatenate.\n * @param {...*} [values] The values to concatenate.\n * @returns {Array} Returns the new concatenated array.\n * @example\n *\n * var array = [1];\n * var other = _.concat(array, 2, [3], [[4]]);\n *\n * console.log(other);\n * // => [1, 2, 3, [4]]\n *\n * console.log(array);\n * // => [1]\n */\n function concat() {\n var length = arguments.length;\n if (!length) {\n return [];\n }\n var args = Array(length - 1),\n array = arguments[0],\n index = length;\n\n while (index--) {\n args[index - 1] = arguments[index];\n }\n return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));\n }\n\n /**\n * Creates an array of `array` values not included in the other given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * **Note:** Unlike `_.pullAll`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.without, _.xor\n * @example\n *\n * _.difference([2, 1], [2, 3]);\n * // => [1]\n */\n var difference = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `iteratee` which\n * is invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * **Note:** Unlike `_.pullAllBy`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var differenceBy = baseRest(function(array, values) {\n var iteratee = last(values);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.difference` except that it accepts `comparator`\n * which is invoked to compare elements of `array` to `values`. The order and\n * references of result values are determined by the first array. The comparator\n * is invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.pullAllWith`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The values to exclude.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n *\n * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }]\n */\n var differenceWith = baseRest(function(array, values) {\n var comparator = last(values);\n if (isArrayLikeObject(comparator)) {\n comparator = undefined;\n }\n return isArrayLikeObject(array)\n ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)\n : [];\n });\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.dropRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropRightWhile(users, ['active', false]);\n * // => objects for ['barney']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropRightWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.dropWhile(users, function(o) { return !o.active; });\n * // => objects for ['pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.dropWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.dropWhile(users, ['active', false]);\n * // => objects for ['pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.dropWhile(users, 'active');\n * // => objects for ['barney', 'fred', 'pebbles']\n */\n function dropWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), true)\n : [];\n }\n\n /**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8, 10], '*', 1, 3);\n * // => [4, '*', '*', 10]\n */\n function fill(array, value, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n }\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(o) { return o.user == 'barney'; });\n * // => 0\n *\n * // The `_.matches` iteratee shorthand.\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findIndex(users, ['active', false]);\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.findIndex(users, 'active');\n * // => 2\n */\n function findIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index);\n }\n\n /**\n * This method is like `_.findIndex` except that it iterates over elements\n * of `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });\n * // => 2\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n * // => 0\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastIndex(users, ['active', false]);\n * // => 2\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastIndex(users, 'active');\n * // => 0\n */\n function findLastIndex(array, predicate, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length - 1;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = fromIndex < 0\n ? nativeMax(length + index, 0)\n : nativeMin(index, length - 1);\n }\n return baseFindIndex(array, getIteratee(predicate, 3), index, true);\n }\n\n /**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\n function flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n }\n\n /**\n * Recursively flattens `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, [3, [4]], 5]]);\n * // => [1, 2, 3, 4, 5]\n */\n function flattenDeep(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, INFINITY) : [];\n }\n\n /**\n * Recursively flatten `array` up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * var array = [1, [2, [3, [4]], 5]];\n *\n * _.flattenDepth(array, 1);\n * // => [1, 2, [3, [4]], 5]\n *\n * _.flattenDepth(array, 2);\n * // => [1, 2, 3, [4], 5]\n */\n function flattenDepth(array, depth) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(array, depth);\n }\n\n /**\n * The inverse of `_.toPairs`; this method returns an object composed\n * from key-value `pairs`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} pairs The key-value pairs.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.fromPairs([['a', 1], ['b', 2]]);\n * // => { 'a': 1, 'b': 2 }\n */\n function fromPairs(pairs) {\n var index = -1,\n length = pairs == null ? 0 : pairs.length,\n result = {};\n\n while (++index < length) {\n var pair = pairs[index];\n result[pair[0]] = pair[1];\n }\n return result;\n }\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias first\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.head([1, 2, 3]);\n * // => 1\n *\n * _.head([]);\n * // => undefined\n */\n function head(array) {\n return (array && array.length) ? array[0] : undefined;\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it's used as the\n * offset from the end of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // Search from the `fromIndex`.\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n */\n function indexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = fromIndex == null ? 0 : toInteger(fromIndex);\n if (index < 0) {\n index = nativeMax(length + index, 0);\n }\n return baseIndexOf(array, value, index);\n }\n\n /**\n * Gets all but the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n */\n function initial(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 0, -1) : [];\n }\n\n /**\n * Creates an array of unique values that are included in all given arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons. The order and references of result values are\n * determined by the first array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersection([2, 1], [2, 3]);\n * // => [2]\n */\n var intersection = baseRest(function(arrays) {\n var mapped = arrayMap(arrays, castArrayLikeObject);\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped)\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `iteratee`\n * which is invoked for each element of each `arrays` to generate the criterion\n * by which they're compared. The order and references of result values are\n * determined by the first array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [2.1]\n *\n * // The `_.property` iteratee shorthand.\n * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }]\n */\n var intersectionBy = baseRest(function(arrays) {\n var iteratee = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n if (iteratee === last(mapped)) {\n iteratee = undefined;\n } else {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, getIteratee(iteratee, 2))\n : [];\n });\n\n /**\n * This method is like `_.intersection` except that it accepts `comparator`\n * which is invoked to compare elements of `arrays`. The order and references\n * of result values are determined by the first array. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of intersecting values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.intersectionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }]\n */\n var intersectionWith = baseRest(function(arrays) {\n var comparator = last(arrays),\n mapped = arrayMap(arrays, castArrayLikeObject);\n\n comparator = typeof comparator == 'function' ? comparator : undefined;\n if (comparator) {\n mapped.pop();\n }\n return (mapped.length && mapped[0] === arrays[0])\n ? baseIntersection(mapped, undefined, comparator)\n : [];\n });\n\n /**\n * Converts all elements in `array` into a string separated by `separator`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to convert.\n * @param {string} [separator=','] The element separator.\n * @returns {string} Returns the joined string.\n * @example\n *\n * _.join(['a', 'b', 'c'], '~');\n * // => 'a~b~c'\n */\n function join(array, separator) {\n return array == null ? '' : nativeJoin.call(array, separator);\n }\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n }\n\n /**\n * This method is like `_.indexOf` except that it iterates over elements of\n * `array` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=array.length-1] The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 1, 2], 2);\n * // => 3\n *\n * // Search from the `fromIndex`.\n * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n * // => 1\n */\n function lastIndexOf(array, value, fromIndex) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return -1;\n }\n var index = length;\n if (fromIndex !== undefined) {\n index = toInteger(fromIndex);\n index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);\n }\n return value === value\n ? strictLastIndexOf(array, value, index)\n : baseFindIndex(array, baseIsNaN, index, true);\n }\n\n /**\n * Gets the element at index `n` of `array`. If `n` is negative, the nth\n * element from the end is returned.\n *\n * @static\n * @memberOf _\n * @since 4.11.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=0] The index of the element to return.\n * @returns {*} Returns the nth element of `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n *\n * _.nth(array, 1);\n * // => 'b'\n *\n * _.nth(array, -2);\n * // => 'c';\n */\n function nth(array, n) {\n return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;\n }\n\n /**\n * Removes all given values from `array` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`\n * to remove elements from an array by predicate.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...*} [values] The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pull(array, 'a', 'c');\n * console.log(array);\n * // => ['b', 'b']\n */\n var pull = baseRest(pullAll);\n\n /**\n * This method is like `_.pull` except that it accepts an array of values to remove.\n *\n * **Note:** Unlike `_.difference`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = ['a', 'b', 'c', 'a', 'b', 'c'];\n *\n * _.pullAll(array, ['a', 'c']);\n * console.log(array);\n * // => ['b', 'b']\n */\n function pullAll(array, values) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values)\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `iteratee` which is\n * invoked for each element of `array` and `values` to generate the criterion\n * by which they're compared. The iteratee is invoked with one argument: (value).\n *\n * **Note:** Unlike `_.differenceBy`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];\n *\n * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');\n * console.log(array);\n * // => [{ 'x': 2 }]\n */\n function pullAllBy(array, values, iteratee) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, getIteratee(iteratee, 2))\n : array;\n }\n\n /**\n * This method is like `_.pullAll` except that it accepts `comparator` which\n * is invoked to compare elements of `array` to `values`. The comparator is\n * invoked with two arguments: (arrVal, othVal).\n *\n * **Note:** Unlike `_.differenceWith`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Array} values The values to remove.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];\n *\n * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);\n * console.log(array);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]\n */\n function pullAllWith(array, values, comparator) {\n return (array && array.length && values && values.length)\n ? basePullAll(array, values, undefined, comparator)\n : array;\n }\n\n /**\n * Removes elements from `array` corresponding to `indexes` and returns an\n * array of removed elements.\n *\n * **Note:** Unlike `_.at`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...(number|number[])} [indexes] The indexes of elements to remove.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = ['a', 'b', 'c', 'd'];\n * var pulled = _.pullAt(array, [1, 3]);\n *\n * console.log(array);\n * // => ['a', 'c']\n *\n * console.log(pulled);\n * // => ['b', 'd']\n */\n var pullAt = flatRest(function(array, indexes) {\n var length = array == null ? 0 : array.length,\n result = baseAt(array, indexes);\n\n basePullAt(array, arrayMap(indexes, function(index) {\n return isIndex(index, length) ? +index : index;\n }).sort(compareAscending));\n\n return result;\n });\n\n /**\n * Removes all elements from `array` that `predicate` returns truthy for\n * and returns an array of the removed elements. The predicate is invoked\n * with three arguments: (value, index, array).\n *\n * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`\n * to pull elements from an array by value.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [1, 2, 3, 4];\n * var evens = _.remove(array, function(n) {\n * return n % 2 == 0;\n * });\n *\n * console.log(array);\n * // => [1, 3]\n *\n * console.log(evens);\n * // => [2, 4]\n */\n function remove(array, predicate) {\n var result = [];\n if (!(array && array.length)) {\n return result;\n }\n var index = -1,\n indexes = [],\n length = array.length;\n\n predicate = getIteratee(predicate, 3);\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result.push(value);\n indexes.push(index);\n }\n }\n basePullAt(array, indexes);\n return result;\n }\n\n /**\n * Reverses `array` so that the first element becomes the last, the second\n * element becomes the second to last, and so on.\n *\n * **Note:** This method mutates `array` and is based on\n * [`Array#reverse`](https://mdn.io/Array/reverse).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to modify.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.reverse(array);\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function reverse(array) {\n return array == null ? array : nativeReverse.call(array);\n }\n\n /**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of\n * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are\n * returned.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function slice(array, start, end) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n else {\n start = start == null ? 0 : toInteger(start);\n end = end === undefined ? length : toInteger(end);\n }\n return baseSlice(array, start, end);\n }\n\n /**\n * Uses a binary search to determine the lowest index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([30, 50], 40);\n * // => 1\n */\n function sortedIndex(array, value) {\n return baseSortedIndex(array, value);\n }\n\n /**\n * This method is like `_.sortedIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 0\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedIndexBy(objects, { 'x': 4 }, 'x');\n * // => 0\n */\n function sortedIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));\n }\n\n /**\n * This method is like `_.indexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedIndexOf([4, 5, 5, 5, 6], 5);\n * // => 1\n */\n function sortedIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value);\n if (index < length && eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.sortedIndex` except that it returns the highest\n * index at which `value` should be inserted into `array` in order to\n * maintain its sort order.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedLastIndex([4, 5, 5, 5, 6], 5);\n * // => 4\n */\n function sortedLastIndex(array, value) {\n return baseSortedIndex(array, value, true);\n }\n\n /**\n * This method is like `_.sortedLastIndex` except that it accepts `iteratee`\n * which is invoked for `value` and each element of `array` to compute their\n * sort ranking. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * var objects = [{ 'x': 4 }, { 'x': 5 }];\n *\n * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });\n * // => 1\n *\n * // The `_.property` iteratee shorthand.\n * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');\n * // => 1\n */\n function sortedLastIndexBy(array, value, iteratee) {\n return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);\n }\n\n /**\n * This method is like `_.lastIndexOf` except that it performs a binary\n * search on a sorted `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);\n * // => 3\n */\n function sortedLastIndexOf(array, value) {\n var length = array == null ? 0 : array.length;\n if (length) {\n var index = baseSortedIndex(array, value, true) - 1;\n if (eq(array[index], value)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * This method is like `_.uniq` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniq([1, 1, 2]);\n * // => [1, 2]\n */\n function sortedUniq(array) {\n return (array && array.length)\n ? baseSortedUniq(array)\n : [];\n }\n\n /**\n * This method is like `_.uniqBy` except that it's designed and optimized\n * for sorted arrays.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);\n * // => [1.1, 2.3]\n */\n function sortedUniqBy(array, iteratee) {\n return (array && array.length)\n ? baseSortedUniq(array, getIteratee(iteratee, 2))\n : [];\n }\n\n /**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.tail([1, 2, 3]);\n * // => [2, 3]\n */\n function tail(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseSlice(array, 1, length) : [];\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the beginning.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.take([1, 2, 3]);\n * // => [1]\n *\n * _.take([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.take([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.take([1, 2, 3], 0);\n * // => []\n */\n function take(array, n, guard) {\n if (!(array && array.length)) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the end.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRight([1, 2, 3]);\n * // => [3]\n *\n * _.takeRight([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.takeRight([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.takeRight([1, 2, 3], 0);\n * // => []\n */\n function takeRight(array, n, guard) {\n var length = array == null ? 0 : array.length;\n if (!length) {\n return [];\n }\n n = (guard || n === undefined) ? 1 : toInteger(n);\n n = length - n;\n return baseSlice(array, n < 0 ? 0 : n, length);\n }\n\n /**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.takeRightWhile(users, function(o) { return !o.active; });\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });\n * // => objects for ['pebbles']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeRightWhile(users, ['active', false]);\n * // => objects for ['fred', 'pebbles']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeRightWhile(users, 'active');\n * // => []\n */\n function takeRightWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3), false, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is invoked with\n * three arguments: (value, index, array).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.takeWhile(users, function(o) { return !o.active; });\n * // => objects for ['barney', 'fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.takeWhile(users, { 'user': 'barney', 'active': false });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.takeWhile(users, ['active', false]);\n * // => objects for ['barney', 'fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.takeWhile(users, 'active');\n * // => []\n */\n function takeWhile(array, predicate) {\n return (array && array.length)\n ? baseWhile(array, getIteratee(predicate, 3))\n : [];\n }\n\n /**\n * Creates an array of unique values, in order, from all given arrays using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([2], [1, 2]);\n * // => [2, 1]\n */\n var union = baseRest(function(arrays) {\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));\n });\n\n /**\n * This method is like `_.union` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which uniqueness is computed. Result values are chosen from the first\n * array in which the value occurs. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.unionBy([2.1], [1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n var unionBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.union` except that it accepts `comparator` which\n * is invoked to compare elements of `arrays`. Result values are chosen from\n * the first array in which the value occurs. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.unionWith(objects, others, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var unionWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);\n });\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\n function uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * uniqueness is computed. The order of result values is determined by the\n * order they occur in the array. The iteratee is invoked with one argument:\n * (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniqBy([2.1, 1.2, 2.3], Math.floor);\n * // => [2.1, 1.2]\n *\n * // The `_.property` iteratee shorthand.\n * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniqBy(array, iteratee) {\n return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];\n }\n\n /**\n * This method is like `_.uniq` except that it accepts `comparator` which\n * is invoked to compare elements of `array`. The order of result values is\n * determined by the order they occur in the array.The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.uniqWith(objects, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\n function uniqWith(array, comparator) {\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return (array && array.length) ? baseUniq(array, undefined, comparator) : [];\n }\n\n /**\n * This method is like `_.zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip\n * configuration.\n *\n * @static\n * @memberOf _\n * @since 1.2.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n *\n * _.unzip(zipped);\n * // => [['a', 'b'], [1, 2], [true, false]]\n */\n function unzip(array) {\n if (!(array && array.length)) {\n return [];\n }\n var length = 0;\n array = arrayFilter(array, function(group) {\n if (isArrayLikeObject(group)) {\n length = nativeMax(group.length, length);\n return true;\n }\n });\n return baseTimes(length, function(index) {\n return arrayMap(array, baseProperty(index));\n });\n }\n\n /**\n * This method is like `_.unzip` except that it accepts `iteratee` to specify\n * how regrouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * regrouped values.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * _.unzipWith(zipped, _.add);\n * // => [3, 30, 300]\n */\n function unzipWith(array, iteratee) {\n if (!(array && array.length)) {\n return [];\n }\n var result = unzip(array);\n if (iteratee == null) {\n return result;\n }\n return arrayMap(result, function(group) {\n return apply(iteratee, undefined, group);\n });\n }\n\n /**\n * Creates an array excluding all given values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.pull`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.xor\n * @example\n *\n * _.without([2, 1, 2, 3], 1, 2);\n * // => [3]\n */\n var without = baseRest(function(array, values) {\n return isArrayLikeObject(array)\n ? baseDifference(array, values)\n : [];\n });\n\n /**\n * Creates an array of unique values that is the\n * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n * of the given arrays. The order of result values is determined by the order\n * they occur in the arrays.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of filtered values.\n * @see _.difference, _.without\n * @example\n *\n * _.xor([2, 1], [2, 3]);\n * // => [1, 3]\n */\n var xor = baseRest(function(arrays) {\n return baseXor(arrayFilter(arrays, isArrayLikeObject));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `iteratee` which is\n * invoked for each element of each `arrays` to generate the criterion by\n * which by which they're compared. The order of result values is determined\n * by the order they occur in the arrays. The iteratee is invoked with one\n * argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);\n * // => [1.2, 3.4]\n *\n * // The `_.property` iteratee shorthand.\n * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 2 }]\n */\n var xorBy = baseRest(function(arrays) {\n var iteratee = last(arrays);\n if (isArrayLikeObject(iteratee)) {\n iteratee = undefined;\n }\n return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));\n });\n\n /**\n * This method is like `_.xor` except that it accepts `comparator` which is\n * invoked to compare elements of `arrays`. The order of result values is\n * determined by the order they occur in the arrays. The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];\n * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.xorWith(objects, others, _.isEqual);\n * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]\n */\n var xorWith = baseRest(function(arrays) {\n var comparator = last(arrays);\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);\n });\n\n /**\n * Creates an array of grouped elements, the first of which contains the\n * first elements of the given arrays, the second of which contains the\n * second elements of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zip(['a', 'b'], [1, 2], [true, false]);\n * // => [['a', 1, true], ['b', 2, false]]\n */\n var zip = baseRest(unzip);\n\n /**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\n function zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n }\n\n /**\n * This method is like `_.zipObject` except that it supports property paths.\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);\n * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\n function zipObjectDeep(props, values) {\n return baseZipObject(props || [], values || [], baseSet);\n }\n\n /**\n * This method is like `_.zip` except that it accepts `iteratee` to specify\n * how grouped values should be combined. The iteratee is invoked with the\n * elements of each group: (...group).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @param {Function} [iteratee=_.identity] The function to combine\n * grouped values.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {\n * return a + b + c;\n * });\n * // => [111, 222]\n */\n var zipWith = baseRest(function(arrays) {\n var length = arrays.length,\n iteratee = length > 1 ? arrays[length - 1] : undefined;\n\n iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;\n return unzipWith(arrays, iteratee);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` wrapper instance that wraps `value` with explicit method\n * chain sequences enabled. The result of such sequences must be unwrapped\n * with `_#value`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Seq\n * @param {*} value The value to wrap.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'pebbles', 'age': 1 }\n * ];\n *\n * var youngest = _\n * .chain(users)\n * .sortBy('age')\n * .map(function(o) {\n * return o.user + ' is ' + o.age;\n * })\n * .head()\n * .value();\n * // => 'pebbles is 1'\n */\n function chain(value) {\n var result = lodash(value);\n result.__chain__ = true;\n return result;\n }\n\n /**\n * This method invokes `interceptor` and returns `value`. The interceptor\n * is invoked with one argument; (value). The purpose of this method is to\n * \"tap into\" a method chain sequence in order to modify intermediate results.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns `value`.\n * @example\n *\n * _([1, 2, 3])\n * .tap(function(array) {\n * // Mutate input array.\n * array.pop();\n * })\n * .reverse()\n * .value();\n * // => [2, 1]\n */\n function tap(value, interceptor) {\n interceptor(value);\n return value;\n }\n\n /**\n * This method is like `_.tap` except that it returns the result of `interceptor`.\n * The purpose of this method is to \"pass thru\" values replacing intermediate\n * results in a method chain sequence.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Seq\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @returns {*} Returns the result of `interceptor`.\n * @example\n *\n * _(' abc ')\n * .chain()\n * .trim()\n * .thru(function(value) {\n * return [value];\n * })\n * .value();\n * // => ['abc']\n */\n function thru(value, interceptor) {\n return interceptor(value);\n }\n\n /**\n * This method is the wrapper version of `_.at`.\n *\n * @name at\n * @memberOf _\n * @since 1.0.0\n * @category Seq\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _(object).at(['a[0].b.c', 'a[1]']).value();\n * // => [3, 4]\n */\n var wrapperAt = flatRest(function(paths) {\n var length = paths.length,\n start = length ? paths[0] : 0,\n value = this.__wrapped__,\n interceptor = function(object) { return baseAt(object, paths); };\n\n if (length > 1 || this.__actions__.length ||\n !(value instanceof LazyWrapper) || !isIndex(start)) {\n return this.thru(interceptor);\n }\n value = value.slice(start, +start + (length ? 1 : 0));\n value.__actions__.push({\n 'func': thru,\n 'args': [interceptor],\n 'thisArg': undefined\n });\n return new LodashWrapper(value, this.__chain__).thru(function(array) {\n if (length && !array.length) {\n array.push(undefined);\n }\n return array;\n });\n });\n\n /**\n * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.\n *\n * @name chain\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * // A sequence without explicit chaining.\n * _(users).head();\n * // => { 'user': 'barney', 'age': 36 }\n *\n * // A sequence with explicit chaining.\n * _(users)\n * .chain()\n * .head()\n * .pick('user')\n * .value();\n * // => { 'user': 'barney' }\n */\n function wrapperChain() {\n return chain(this);\n }\n\n /**\n * Executes the chain sequence and returns the wrapped result.\n *\n * @name commit\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).push(3);\n *\n * console.log(array);\n * // => [1, 2]\n *\n * wrapped = wrapped.commit();\n * console.log(array);\n * // => [1, 2, 3]\n *\n * wrapped.last();\n * // => 3\n *\n * console.log(array);\n * // => [1, 2, 3]\n */\n function wrapperCommit() {\n return new LodashWrapper(this.value(), this.__chain__);\n }\n\n /**\n * Gets the next value on a wrapped object following the\n * [iterator protocol](https://mdn.io/iteration_protocols#iterator).\n *\n * @name next\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the next iterator value.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 1 }\n *\n * wrapped.next();\n * // => { 'done': false, 'value': 2 }\n *\n * wrapped.next();\n * // => { 'done': true, 'value': undefined }\n */\n function wrapperNext() {\n if (this.__values__ === undefined) {\n this.__values__ = toArray(this.value());\n }\n var done = this.__index__ >= this.__values__.length,\n value = done ? undefined : this.__values__[this.__index__++];\n\n return { 'done': done, 'value': value };\n }\n\n /**\n * Enables the wrapper to be iterable.\n *\n * @name Symbol.iterator\n * @memberOf _\n * @since 4.0.0\n * @category Seq\n * @returns {Object} Returns the wrapper object.\n * @example\n *\n * var wrapped = _([1, 2]);\n *\n * wrapped[Symbol.iterator]() === wrapped;\n * // => true\n *\n * Array.from(wrapped);\n * // => [1, 2]\n */\n function wrapperToIterator() {\n return this;\n }\n\n /**\n * Creates a clone of the chain sequence planting `value` as the wrapped value.\n *\n * @name plant\n * @memberOf _\n * @since 3.2.0\n * @category Seq\n * @param {*} value The value to plant.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var wrapped = _([1, 2]).map(square);\n * var other = wrapped.plant([3, 4]);\n *\n * other.value();\n * // => [9, 16]\n *\n * wrapped.value();\n * // => [1, 4]\n */\n function wrapperPlant(value) {\n var result,\n parent = this;\n\n while (parent instanceof baseLodash) {\n var clone = wrapperClone(parent);\n clone.__index__ = 0;\n clone.__values__ = undefined;\n if (result) {\n previous.__wrapped__ = clone;\n } else {\n result = clone;\n }\n var previous = clone;\n parent = parent.__wrapped__;\n }\n previous.__wrapped__ = value;\n return result;\n }\n\n /**\n * This method is the wrapper version of `_.reverse`.\n *\n * **Note:** This method mutates the wrapped array.\n *\n * @name reverse\n * @memberOf _\n * @since 0.1.0\n * @category Seq\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _(array).reverse().value()\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function wrapperReverse() {\n var value = this.__wrapped__;\n if (value instanceof LazyWrapper) {\n var wrapped = value;\n if (this.__actions__.length) {\n wrapped = new LazyWrapper(this);\n }\n wrapped = wrapped.reverse();\n wrapped.__actions__.push({\n 'func': thru,\n 'args': [reverse],\n 'thisArg': undefined\n });\n return new LodashWrapper(wrapped, this.__chain__);\n }\n return this.thru(reverse);\n }\n\n /**\n * Executes the chain sequence to resolve the unwrapped value.\n *\n * @name value\n * @memberOf _\n * @since 0.1.0\n * @alias toJSON, valueOf\n * @category Seq\n * @returns {*} Returns the resolved unwrapped value.\n * @example\n *\n * _([1, 2, 3]).value();\n * // => [1, 2, 3]\n */\n function wrapperValue() {\n return baseWrapperValue(this.__wrapped__, this.__actions__);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the number of times the key was returned by `iteratee`. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': 1, '6': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n ++result[key];\n } else {\n baseAssignValue(result, key, 1);\n }\n });\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * Iteration is stopped once `predicate` returns falsey. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * **Note:** This method returns `true` for\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\n * elements of empty collections.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.every(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, guard) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * **Note:** Unlike `_.remove`, this method returns a new array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.reject\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.filter(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, { 'age': 36, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.filter(users, 'active');\n * // => objects for ['barney']\n *\n * // Combining several predicates using `_.overEvery` or `_.overSome`.\n * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));\n * // => objects for ['fred', 'barney']\n */\n function filter(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is invoked with three\n * arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=0] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.find(users, function(o) { return o.age < 40; });\n * // => object for 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.find(users, { 'age': 1, 'active': true });\n * // => object for 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.find(users, ['active', false]);\n * // => object for 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.find(users, 'active');\n * // => object for 'barney'\n */\n var find = createFind(findIndex);\n\n /**\n * This method is like `_.find` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param {number} [fromIndex=collection.length-1] The index to search from.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * _.findLast([1, 2, 3, 4], function(n) {\n * return n % 2 == 1;\n * });\n * // => 3\n */\n var findLast = createFind(findLastIndex);\n\n /**\n * Creates a flattened array of values by running each element in `collection`\n * thru `iteratee` and flattening the mapped results. The iteratee is invoked\n * with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [n, n];\n * }\n *\n * _.flatMap([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMap(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), 1);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDeep([1, 2], duplicate);\n * // => [1, 1, 2, 2]\n */\n function flatMapDeep(collection, iteratee) {\n return baseFlatten(map(collection, iteratee), INFINITY);\n }\n\n /**\n * This method is like `_.flatMap` except that it recursively flattens the\n * mapped results up to `depth` times.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {number} [depth=1] The maximum recursion depth.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * function duplicate(n) {\n * return [[[n, n]]];\n * }\n *\n * _.flatMapDepth([1, 2], duplicate, 2);\n * // => [[1, 1], [2, 2]]\n */\n function flatMapDepth(collection, iteratee, depth) {\n depth = depth === undefined ? 1 : toInteger(depth);\n return baseFlatten(map(collection, iteratee), depth);\n }\n\n /**\n * Iterates over elements of `collection` and invokes `iteratee` for each element.\n * The iteratee is invoked with three arguments: (value, index|key, collection).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\"\n * property are iterated like arrays. To avoid this behavior use `_.forIn`\n * or `_.forOwn` for object iteration.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @alias each\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEachRight\n * @example\n *\n * _.forEach([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `1` then `2`.\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forEach(collection, iteratee) {\n var func = isArray(collection) ? arrayEach : baseEach;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forEach` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @alias eachRight\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n * @see _.forEach\n * @example\n *\n * _.forEachRight([1, 2], function(value) {\n * console.log(value);\n * });\n * // => Logs `2` then `1`.\n */\n function forEachRight(collection, iteratee) {\n var func = isArray(collection) ? arrayEachRight : baseEachRight;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n baseAssignValue(result, key, [value]);\n }\n });\n\n /**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\n function includes(collection, value, fromIndex, guard) {\n collection = isArrayLike(collection) ? collection : values(collection);\n fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n var length = collection.length;\n if (fromIndex < 0) {\n fromIndex = nativeMax(length + fromIndex, 0);\n }\n return isString(collection)\n ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n }\n\n /**\n * Invokes the method at `path` of each element in `collection`, returning\n * an array of the results of each invoked method. Any additional arguments\n * are provided to each invoked method. If `path` is a function, it's invoked\n * for, and `this` bound to, each element in `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array|Function|string} path The path of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [args] The arguments to invoke each method with.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invokeMap([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n var invokeMap = baseRest(function(collection, path, args) {\n var index = -1,\n isFunc = typeof path == 'function',\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value) {\n result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);\n });\n return result;\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the last element responsible for generating the key. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var array = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.keyBy(array, function(o) {\n * return String.fromCharCode(o.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.keyBy(array, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n */\n var keyBy = createAggregator(function(result, value, key) {\n baseAssignValue(result, key, value);\n });\n\n /**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee) {\n var func = isArray(collection) ? arrayMap : baseMap;\n return func(collection, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.sortBy` except that it allows specifying the sort\n * orders of the iteratees to sort by. If `orders` is unspecified, all values\n * are sorted in ascending order. Otherwise, specify an order of \"desc\" for\n * descending or \"asc\" for ascending sort order of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @param {string[]} [orders] The sort orders of `iteratees`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 34 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'barney', 'age': 36 }\n * ];\n *\n * // Sort by `user` in ascending order and by `age` in descending order.\n * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]\n */\n function orderBy(collection, iteratees, orders, guard) {\n if (collection == null) {\n return [];\n }\n if (!isArray(iteratees)) {\n iteratees = iteratees == null ? [] : [iteratees];\n }\n orders = guard ? undefined : orders;\n if (!isArray(orders)) {\n orders = orders == null ? [] : [orders];\n }\n return baseOrderBy(collection, iteratees, orders);\n }\n\n /**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\n var partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n }, function() { return [[], []]; });\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` thru `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not given, the first element of `collection` is used as the initial\n * value. The iteratee is invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,\n * and `sortBy`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduceRight\n * @example\n *\n * _.reduce([1, 2], function(sum, n) {\n * return sum + n;\n * }, 0);\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * return result;\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)\n */\n function reduce(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduce : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);\n }\n\n /**\n * This method is like `_.reduce` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @returns {*} Returns the accumulated value.\n * @see _.reduce\n * @example\n *\n * var array = [[0, 1], [2, 3], [4, 5]];\n *\n * _.reduceRight(array, function(flattened, other) {\n * return flattened.concat(other);\n * }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n function reduceRight(collection, iteratee, accumulator) {\n var func = isArray(collection) ? arrayReduceRight : baseReduce,\n initAccum = arguments.length < 3;\n\n return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);\n }\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n * @see _.filter\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * _.reject(users, function(o) { return !o.active; });\n * // => objects for ['fred']\n *\n * // The `_.matches` iteratee shorthand.\n * _.reject(users, { 'age': 40, 'active': true });\n * // => objects for ['barney']\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.reject(users, ['active', false]);\n * // => objects for ['fred']\n *\n * // The `_.property` iteratee shorthand.\n * _.reject(users, 'active');\n * // => objects for ['barney']\n */\n function reject(collection, predicate) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n return func(collection, negate(getIteratee(predicate, 3)));\n }\n\n /**\n * Gets a random element from `collection`.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @returns {*} Returns the random element.\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n */\n function sample(collection) {\n var func = isArray(collection) ? arraySample : baseSample;\n return func(collection);\n }\n\n /**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\n function sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n }\n\n /**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n *\n * _.shuffle([1, 2, 3, 4]);\n * // => [4, 1, 3, 2]\n */\n function shuffle(collection) {\n var func = isArray(collection) ? arrayShuffle : baseShuffle;\n return func(collection);\n }\n\n /**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable string keyed properties for objects.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the collection size.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n if (collection == null) {\n return 0;\n }\n if (isArrayLike(collection)) {\n return isString(collection) ? stringSize(collection) : collection.length;\n }\n var tag = getTag(collection);\n if (tag == mapTag || tag == setTag) {\n return collection.size;\n }\n return baseKeys(collection).length;\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * Iteration is stopped once `predicate` returns truthy. The predicate is\n * invoked with three arguments: (value, index|key, collection).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.some(users, ['active', false]);\n * // => true\n *\n * // The `_.property` iteratee shorthand.\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, guard) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (guard && isIterateeCall(collection, predicate, guard)) {\n predicate = undefined;\n }\n return func(collection, getIteratee(predicate, 3));\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 30 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]\n */\n var sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\n var now = ctxNow || function() {\n return root.Date.now();\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The opposite of `_.before`; this method creates a function that invokes\n * `func` once it's called `n` or more times.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {number} n The number of calls before `func` is invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => Logs 'done saving!' after the two async saves have completed.\n */\n function after(n, func) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that invokes `func`, with up to `n` arguments,\n * ignoring any additional arguments.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @param {number} [n=func.length] The arity cap.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n * // => [6, 8, 10]\n */\n function ary(func, n, guard) {\n n = guard ? undefined : n;\n n = (func && n == null) ? func.length : n;\n return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);\n }\n\n /**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it's called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {number} n The number of calls at which `func` is no longer invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * jQuery(element).on('click', _.before(5, addContactToList));\n * // => Allows adding up to 4 contacts to the list.\n */\n function before(n, func) {\n var result;\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n n = toInteger(n);\n return function() {\n if (--n > 0) {\n result = func.apply(this, arguments);\n }\n if (n <= 1) {\n func = undefined;\n }\n return result;\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and `partials` prepended to the arguments it receives.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind`, this method doesn't set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * function greet(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\n var bind = baseRest(function(func, thisArg, partials) {\n var bitmask = WRAP_BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bind));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(func, bitmask, thisArg, partials, holders);\n });\n\n /**\n * Creates a function that invokes the method at `object[key]` with `partials`\n * prepended to the arguments it receives.\n *\n * This method differs from `_.bind` by allowing bound functions to reference\n * methods that may be redefined or don't yet exist. See\n * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n * for more details.\n *\n * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Function\n * @param {Object} object The object to invoke the method on.\n * @param {string} key The key of the method.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var object = {\n * 'user': 'fred',\n * 'greet': function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n * };\n *\n * var bound = _.bindKey(object, 'greet', 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * object.greet = function(greeting, punctuation) {\n * return greeting + 'ya ' + this.user + punctuation;\n * };\n *\n * bound('!');\n * // => 'hiya fred!'\n *\n * // Bound with placeholders.\n * var bound = _.bindKey(object, 'greet', _, '!');\n * bound('hi');\n * // => 'hiya fred!'\n */\n var bindKey = baseRest(function(object, key, partials) {\n var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, getHolder(bindKey));\n bitmask |= WRAP_PARTIAL_FLAG;\n }\n return createWrap(key, bitmask, object, partials, holders);\n });\n\n /**\n * Creates a function that accepts arguments of `func` and either invokes\n * `func` returning its result, if at least `arity` number of arguments have\n * been provided, or returns a function that accepts the remaining `func`\n * arguments, and so on. The arity of `func` may be specified if `func.length`\n * is not sufficient.\n *\n * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curry(abc);\n *\n * curried(1)(2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(1)(_, 3)(2);\n * // => [1, 2, 3]\n */\n function curry(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curry.placeholder;\n return result;\n }\n\n /**\n * This method is like `_.curry` except that arguments are applied to `func`\n * in the manner of `_.partialRight` instead of `_.partial`.\n *\n * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for provided arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curryRight(abc);\n *\n * curried(3)(2)(1);\n * // => [1, 2, 3]\n *\n * curried(2, 3)(1);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // Curried with placeholders.\n * curried(3)(1, _)(2);\n * // => [1, 2, 3]\n */\n function curryRight(func, arity, guard) {\n arity = guard ? undefined : arity;\n var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curryRight.placeholder;\n return result;\n }\n\n /**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\n function debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n }\n\n /**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // => Logs 'deferred' after one millisecond.\n */\n var defer = baseRest(function(func, args) {\n return baseDelay(func, 1, args);\n });\n\n /**\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\n * provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) {\n * console.log(text);\n * }, 1000, 'later');\n * // => Logs 'later' after one second.\n */\n var delay = baseRest(function(func, wait, args) {\n return baseDelay(func, toNumber(wait) || 0, args);\n });\n\n /**\n * Creates a function that invokes `func` with arguments reversed.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to flip arguments for.\n * @returns {Function} Returns the new flipped function.\n * @example\n *\n * var flipped = _.flip(function() {\n * return _.toArray(arguments);\n * });\n *\n * flipped('a', 'b', 'c', 'd');\n * // => ['d', 'c', 'b', 'a']\n */\n function flip(func) {\n return createWrap(func, WRAP_FLIP_FLAG);\n }\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n }\n\n // Expose `MapCache`.\n memoize.Cache = MapCache;\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new negated function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n var args = arguments;\n switch (args.length) {\n case 0: return !predicate.call(this);\n case 1: return !predicate.call(this, args[0]);\n case 2: return !predicate.call(this, args[0], args[1]);\n case 3: return !predicate.call(this, args[0], args[1], args[2]);\n }\n return !predicate.apply(this, args);\n };\n }\n\n /**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first invocation. The `func` is\n * invoked with the `this` binding and arguments of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // => `createApplication` is invoked once\n */\n function once(func) {\n return before(2, func);\n }\n\n /**\n * Creates a function that invokes `func` with its arguments transformed.\n *\n * @static\n * @since 4.0.0\n * @memberOf _\n * @category Function\n * @param {Function} func The function to wrap.\n * @param {...(Function|Function[])} [transforms=[_.identity]]\n * The argument transforms.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function doubled(n) {\n * return n * 2;\n * }\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var func = _.overArgs(function(x, y) {\n * return [x, y];\n * }, [square, doubled]);\n *\n * func(9, 3);\n * // => [81, 6]\n *\n * func(10, 5);\n * // => [100, 10]\n */\n var overArgs = castRest(function(func, transforms) {\n transforms = (transforms.length == 1 && isArray(transforms[0]))\n ? arrayMap(transforms[0], baseUnary(getIteratee()))\n : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));\n\n var funcsLength = transforms.length;\n return baseRest(function(args) {\n var index = -1,\n length = nativeMin(args.length, funcsLength);\n\n while (++index < length) {\n args[index] = transforms[index].call(this, args[index]);\n }\n return apply(func, this, args);\n });\n });\n\n /**\n * Creates a function that invokes `func` with `partials` prepended to the\n * arguments it receives. This method is like `_.bind` except it does **not**\n * alter the `this` binding.\n *\n * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 0.2.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var sayHelloTo = _.partial(greet, 'hello');\n * sayHelloTo('fred');\n * // => 'hello fred'\n *\n * // Partially applied with placeholders.\n * var greetFred = _.partial(greet, _, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n */\n var partial = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partial));\n return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);\n });\n\n /**\n * This method is like `_.partial` except that partially applied arguments\n * are appended to the arguments it receives.\n *\n * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method doesn't set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * function greet(greeting, name) {\n * return greeting + ' ' + name;\n * }\n *\n * var greetFred = _.partialRight(greet, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n *\n * // Partially applied with placeholders.\n * var sayHelloTo = _.partialRight(greet, 'hello', _);\n * sayHelloTo('fred');\n * // => 'hello fred'\n */\n var partialRight = baseRest(function(func, partials) {\n var holders = replaceHolders(partials, getHolder(partialRight));\n return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);\n });\n\n /**\n * Creates a function that invokes `func` with arguments arranged according\n * to the specified `indexes` where the argument value at the first index is\n * provided as the first argument, the argument value at the second index is\n * provided as the second argument, and so on.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Function\n * @param {Function} func The function to rearrange arguments for.\n * @param {...(number|number[])} indexes The arranged argument indexes.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var rearged = _.rearg(function(a, b, c) {\n * return [a, b, c];\n * }, [2, 0, 1]);\n *\n * rearged('b', 'c', 'a')\n * // => ['a', 'b', 'c']\n */\n var rearg = flatRest(function(func, indexes) {\n return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);\n });\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as\n * an array.\n *\n * **Note:** This method is based on the\n * [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\n function rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start === undefined ? start : toInteger(start);\n return baseRest(func, start);\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * create function and an array of arguments much like\n * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).\n *\n * **Note:** This method is based on the\n * [spread operator](https://mdn.io/spread_operator).\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Function\n * @param {Function} func The function to spread arguments over.\n * @param {number} [start=0] The start position of the spread.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.spread(function(who, what) {\n * return who + ' says ' + what;\n * });\n *\n * say(['fred', 'hello']);\n * // => 'fred says hello'\n *\n * var numbers = Promise.all([\n * Promise.resolve(40),\n * Promise.resolve(36)\n * ]);\n *\n * numbers.then(_.spread(function(x, y) {\n * return x + y;\n * }));\n * // => a Promise of 76\n */\n function spread(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = start == null ? 0 : nativeMax(toInteger(start), 0);\n return baseRest(function(args) {\n var array = args[start],\n otherArgs = castSlice(args, 0, start);\n\n if (array) {\n arrayPush(otherArgs, array);\n }\n return apply(func, this, otherArgs);\n });\n }\n\n /**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\n function throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n }\n\n /**\n * Creates a function that accepts up to one argument, ignoring any\n * additional arguments.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n * @example\n *\n * _.map(['6', '8', '10'], _.unary(parseInt));\n * // => [6, 8, 10]\n */\n function unary(func) {\n return ary(func, 1);\n }\n\n /**\n * Creates a function that provides `value` to `wrapper` as its first\n * argument. Any additional arguments provided to the function are appended\n * to those provided to the `wrapper`. The wrapper is invoked with the `this`\n * binding of the created function.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {*} value The value to wrap.\n * @param {Function} [wrapper=identity] The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '<p>' + func(text) + '</p>';\n * });\n *\n * p('fred, barney, & pebbles');\n * // => '<p>fred, barney, &amp; pebbles</p>'\n */\n function wrap(value, wrapper) {\n return partial(castFunction(wrapper), value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Casts `value` as an array if it's not one.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Lang\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast array.\n * @example\n *\n * _.castArray(1);\n * // => [1]\n *\n * _.castArray({ 'a': 1 });\n * // => [{ 'a': 1 }]\n *\n * _.castArray('abc');\n * // => ['abc']\n *\n * _.castArray(null);\n * // => [null]\n *\n * _.castArray(undefined);\n * // => [undefined]\n *\n * _.castArray();\n * // => []\n *\n * var array = [1, 2, 3];\n * console.log(_.castArray(array) === array);\n * // => true\n */\n function castArray() {\n if (!arguments.length) {\n return [];\n }\n var value = arguments[0];\n return isArray(value) ? value : [value];\n }\n\n /**\n * Creates a shallow clone of `value`.\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)\n * and supports cloning arrays, array buffers, booleans, date objects, maps,\n * numbers, `Object` objects, regexes, sets, strings, symbols, and typed\n * arrays. The own enumerable properties of `arguments` objects are cloned\n * as plain objects. An empty object is returned for uncloneable values such\n * as error objects, functions, DOM nodes, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to clone.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeep\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var shallow = _.clone(objects);\n * console.log(shallow[0] === objects[0]);\n * // => true\n */\n function clone(value) {\n return baseClone(value, CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.clone` except that it accepts `customizer` which\n * is invoked to produce the cloned value. If `customizer` returns `undefined`,\n * cloning is handled by the method instead. The `customizer` is invoked with\n * up to four arguments; (value [, index|key, object, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the cloned value.\n * @see _.cloneDeepWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * }\n *\n * var el = _.cloneWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 0\n */\n function cloneWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\n function cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n }\n\n /**\n * This method is like `_.cloneWith` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @param {Function} [customizer] The function to customize cloning.\n * @returns {*} Returns the deep cloned value.\n * @see _.cloneWith\n * @example\n *\n * function customizer(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(true);\n * }\n * }\n *\n * var el = _.cloneDeepWith(document.body, customizer);\n *\n * console.log(el === document.body);\n * // => false\n * console.log(el.nodeName);\n * // => 'BODY'\n * console.log(el.childNodes.length);\n * // => 20\n */\n function cloneDeepWith(value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);\n }\n\n /**\n * Checks if `object` conforms to `source` by invoking the predicate\n * properties of `source` with the corresponding property values of `object`.\n *\n * **Note:** This method is equivalent to `_.conforms` when `source` is\n * partially applied.\n *\n * @static\n * @memberOf _\n * @since 4.14.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property predicates to conform to.\n * @returns {boolean} Returns `true` if `object` conforms, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 1; } });\n * // => true\n *\n * _.conformsTo(object, { 'b': function(n) { return n > 2; } });\n * // => false\n */\n function conformsTo(object, source) {\n return source == null || baseConformsTo(object, source, keys(source));\n }\n\n /**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\n function eq(value, other) {\n return value === other || (value !== value && other !== other);\n }\n\n /**\n * Checks if `value` is greater than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`,\n * else `false`.\n * @see _.lt\n * @example\n *\n * _.gt(3, 1);\n * // => true\n *\n * _.gt(3, 3);\n * // => false\n *\n * _.gt(1, 3);\n * // => false\n */\n var gt = createRelationalOperation(baseGt);\n\n /**\n * Checks if `value` is greater than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than or equal to\n * `other`, else `false`.\n * @see _.lte\n * @example\n *\n * _.gte(3, 1);\n * // => true\n *\n * _.gte(3, 3);\n * // => true\n *\n * _.gte(1, 3);\n * // => false\n */\n var gte = createRelationalOperation(function(value, other) {\n return value >= other;\n });\n\n /**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n };\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\n var isArray = Array.isArray;\n\n /**\n * Checks if `value` is classified as an `ArrayBuffer` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.\n * @example\n *\n * _.isArrayBuffer(new ArrayBuffer(2));\n * // => true\n *\n * _.isArrayBuffer(new Array(2));\n * // => false\n */\n var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;\n\n /**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\n function isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n }\n\n /**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\n function isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n }\n\n /**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false ||\n (isObjectLike(value) && baseGetTag(value) == boolTag);\n }\n\n /**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\n var isBuffer = nativeIsBuffer || stubFalse;\n\n /**\n * Checks if `value` is classified as a `Date` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a date object, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\n var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;\n\n /**\n * Checks if `value` is likely a DOM element.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n *\n * _.isElement('<body>');\n * // => false\n */\n function isElement(value) {\n return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);\n }\n\n /**\n * Checks if `value` is an empty object, collection, map, or set.\n *\n * Objects are considered empty if they have no own enumerable string keyed\n * properties.\n *\n * Array-like values such as `arguments` objects, arrays, buffers, strings, or\n * jQuery-like collections are considered empty if they have a `length` of `0`.\n * Similarly, maps and sets are considered empty if they have a `size` of `0`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) &&\n (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||\n isBuffer(value) || isTypedArray(value) || isArguments(value))) {\n return !value.length;\n }\n var tag = getTag(value);\n if (tag == mapTag || tag == setTag) {\n return !value.size;\n }\n if (isPrototype(value)) {\n return !baseKeys(value).length;\n }\n for (var key in value) {\n if (hasOwnProperty.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\n function isEqual(value, other) {\n return baseIsEqual(value, other);\n }\n\n /**\n * This method is like `_.isEqual` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with up to\n * six arguments: (objValue, othValue [, index|key, object, other, stack]).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, othValue) {\n * if (isGreeting(objValue) && isGreeting(othValue)) {\n * return true;\n * }\n * }\n *\n * var array = ['hello', 'goodbye'];\n * var other = ['hi', 'goodbye'];\n *\n * _.isEqualWith(array, other, customizer);\n * // => true\n */\n function isEqualWith(value, other, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n var result = customizer ? customizer(value, other) : undefined;\n return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;\n }\n\n /**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\n function isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n }\n\n /**\n * Checks if `value` is a finite primitive number.\n *\n * **Note:** This method is based on\n * [`Number.isFinite`](https://mdn.io/Number/isFinite).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.\n * @example\n *\n * _.isFinite(3);\n * // => true\n *\n * _.isFinite(Number.MIN_VALUE);\n * // => true\n *\n * _.isFinite(Infinity);\n * // => false\n *\n * _.isFinite('3');\n * // => false\n */\n function isFinite(value) {\n return typeof value == 'number' && nativeIsFinite(value);\n }\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n }\n\n /**\n * Checks if `value` is an integer.\n *\n * **Note:** This method is based on\n * [`Number.isInteger`](https://mdn.io/Number/isInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n * @example\n *\n * _.isInteger(3);\n * // => true\n *\n * _.isInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isInteger(Infinity);\n * // => false\n *\n * _.isInteger('3');\n * // => false\n */\n function isInteger(value) {\n return typeof value == 'number' && value == toInteger(value);\n }\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\n function isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\n function isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n }\n\n /**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\n function isObjectLike(value) {\n return value != null && typeof value == 'object';\n }\n\n /**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\n var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\n /**\n * Performs a partial deep comparison between `object` and `source` to\n * determine if `object` contains equivalent property values.\n *\n * **Note:** This method is equivalent to `_.matches` when `source` is\n * partially applied.\n *\n * Partial comparisons will match empty array and empty object `source`\n * values against any array or object value, respectively. See `_.isEqual`\n * for a list of supported value comparisons.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n *\n * _.isMatch(object, { 'b': 2 });\n * // => true\n *\n * _.isMatch(object, { 'b': 1 });\n * // => false\n */\n function isMatch(object, source) {\n return object === source || baseIsMatch(object, source, getMatchData(source));\n }\n\n /**\n * This method is like `_.isMatch` except that it accepts `customizer` which\n * is invoked to compare values. If `customizer` returns `undefined`, comparisons\n * are handled by the method instead. The `customizer` is invoked with five\n * arguments: (objValue, srcValue, index|key, object, source).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * function isGreeting(value) {\n * return /^h(?:i|ello)$/.test(value);\n * }\n *\n * function customizer(objValue, srcValue) {\n * if (isGreeting(objValue) && isGreeting(srcValue)) {\n * return true;\n * }\n * }\n *\n * var object = { 'greeting': 'hello' };\n * var source = { 'greeting': 'hi' };\n *\n * _.isMatchWith(object, source, customizer);\n * // => true\n */\n function isMatchWith(object, source, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return baseIsMatch(object, source, getMatchData(source), customizer);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is based on\n * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as\n * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for\n * `undefined` and other non-number values.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some\n // ActiveX objects in IE.\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is a pristine native function.\n *\n * **Note:** This method can't reliably detect native functions in the presence\n * of the core-js package because core-js circumvents this kind of detection.\n * Despite multiple requests, the core-js maintainer has made it clear: any\n * attempt to fix the detection will be obstructed. As a result, we're left\n * with little choice but to throw an error. Unfortunately, this also affects\n * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),\n * which rely on core-js.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\n function isNative(value) {\n if (isMaskable(value)) {\n throw new Error(CORE_ERROR_TEXT);\n }\n return baseIsNative(value);\n }\n\n /**\n * Checks if `value` is `null`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(void 0);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is `null` or `undefined`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is nullish, else `false`.\n * @example\n *\n * _.isNil(null);\n * // => true\n *\n * _.isNil(void 0);\n * // => true\n *\n * _.isNil(NaN);\n * // => false\n */\n function isNil(value) {\n return value == null;\n }\n\n /**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are\n * classified as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a number, else `false`.\n * @example\n *\n * _.isNumber(3);\n * // => true\n *\n * _.isNumber(Number.MIN_VALUE);\n * // => true\n *\n * _.isNumber(Infinity);\n * // => true\n *\n * _.isNumber('3');\n * // => false\n */\n function isNumber(value) {\n return typeof value == 'number' ||\n (isObjectLike(value) && baseGetTag(value) == numberTag);\n }\n\n /**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\n function isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n }\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;\n\n /**\n * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754\n * double precision number which isn't the result of a rounded unsafe integer.\n *\n * **Note:** This method is based on\n * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.\n * @example\n *\n * _.isSafeInteger(3);\n * // => true\n *\n * _.isSafeInteger(Number.MIN_VALUE);\n * // => false\n *\n * _.isSafeInteger(Infinity);\n * // => false\n *\n * _.isSafeInteger('3');\n * // => false\n */\n function isSafeInteger(value) {\n return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\n var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n }\n\n /**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\n function isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n }\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined;\n }\n\n /**\n * Checks if `value` is classified as a `WeakMap` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.\n * @example\n *\n * _.isWeakMap(new WeakMap);\n * // => true\n *\n * _.isWeakMap(new Map);\n * // => false\n */\n function isWeakMap(value) {\n return isObjectLike(value) && getTag(value) == weakMapTag;\n }\n\n /**\n * Checks if `value` is classified as a `WeakSet` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.\n * @example\n *\n * _.isWeakSet(new WeakSet);\n * // => true\n *\n * _.isWeakSet(new Set);\n * // => false\n */\n function isWeakSet(value) {\n return isObjectLike(value) && baseGetTag(value) == weakSetTag;\n }\n\n /**\n * Checks if `value` is less than `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`,\n * else `false`.\n * @see _.gt\n * @example\n *\n * _.lt(1, 3);\n * // => true\n *\n * _.lt(3, 3);\n * // => false\n *\n * _.lt(3, 1);\n * // => false\n */\n var lt = createRelationalOperation(baseLt);\n\n /**\n * Checks if `value` is less than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @since 3.9.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than or equal to\n * `other`, else `false`.\n * @see _.gte\n * @example\n *\n * _.lte(1, 3);\n * // => true\n *\n * _.lte(3, 3);\n * // => true\n *\n * _.lte(3, 1);\n * // => false\n */\n var lte = createRelationalOperation(function(value, other) {\n return value <= other;\n });\n\n /**\n * Converts `value` to an array.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Array} Returns the converted array.\n * @example\n *\n * _.toArray({ 'a': 1, 'b': 2 });\n * // => [1, 2]\n *\n * _.toArray('abc');\n * // => ['a', 'b', 'c']\n *\n * _.toArray(1);\n * // => []\n *\n * _.toArray(null);\n * // => []\n */\n function toArray(value) {\n if (!value) {\n return [];\n }\n if (isArrayLike(value)) {\n return isString(value) ? stringToArray(value) : copyArray(value);\n }\n if (symIterator && value[symIterator]) {\n return iteratorToArray(value[symIterator]());\n }\n var tag = getTag(value),\n func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);\n\n return func(value);\n }\n\n /**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\n function toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n }\n\n /**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\n function toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n }\n\n /**\n * Converts `value` to an integer suitable for use as the length of an\n * array-like object.\n *\n * **Note:** This method is based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toLength(3.2);\n * // => 3\n *\n * _.toLength(Number.MIN_VALUE);\n * // => 0\n *\n * _.toLength(Infinity);\n * // => 4294967295\n *\n * _.toLength('3.2');\n * // => 3\n */\n function toLength(value) {\n return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;\n }\n\n /**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\n function toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n }\n\n /**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\n function toPlainObject(value) {\n return copyObject(value, keysIn(value));\n }\n\n /**\n * Converts `value` to a safe integer. A safe integer can be compared and\n * represented correctly.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toSafeInteger(3.2);\n * // => 3\n *\n * _.toSafeInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toSafeInteger(Infinity);\n * // => 9007199254740991\n *\n * _.toSafeInteger('3.2');\n * // => 3\n */\n function toSafeInteger(value) {\n return value\n ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)\n : (value === 0 ? value : 0);\n }\n\n /**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\n function toString(value) {\n return value == null ? '' : baseToString(value);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Assigns own enumerable string keyed properties of source objects to the\n * destination object. Source objects are applied from left to right.\n * Subsequent sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @since 0.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assignIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assign({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3 }\n */\n var assign = createAssigner(function(object, source) {\n if (isPrototype(source) || isArrayLike(source)) {\n copyObject(source, keys(source), object);\n return;\n }\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n assignValue(object, key, source[key]);\n }\n }\n });\n\n /**\n * This method is like `_.assign` except that it iterates over own and\n * inherited source properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.assign\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * function Bar() {\n * this.c = 3;\n * }\n *\n * Foo.prototype.b = 2;\n * Bar.prototype.d = 4;\n *\n * _.assignIn({ 'a': 0 }, new Foo, new Bar);\n * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }\n */\n var assignIn = createAssigner(function(object, source) {\n copyObject(source, keysIn(source), object);\n });\n\n /**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n });\n\n /**\n * This method is like `_.assign` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignInWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var assignWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keys(source), object, customizer);\n });\n\n /**\n * Creates an array of values corresponding to `paths` of `object`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Array} Returns the picked values.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };\n *\n * _.at(object, ['a[0].b.c', 'a[1]']);\n * // => [3, 4]\n */\n var at = flatRest(baseAt);\n\n /**\n * Creates an object that inherits from the `prototype` object. If a\n * `properties` object is given, its own enumerable string keyed properties\n * are assigned to the created object.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Object\n * @param {Object} prototype The object to inherit from.\n * @param {Object} [properties] The properties to assign to the object.\n * @returns {Object} Returns the new object.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * function Circle() {\n * Shape.call(this);\n * }\n *\n * Circle.prototype = _.create(Shape.prototype, {\n * 'constructor': Circle\n * });\n *\n * var circle = new Circle;\n * circle instanceof Circle;\n * // => true\n *\n * circle instanceof Shape;\n * // => true\n */\n function create(prototype, properties) {\n var result = baseCreate(prototype);\n return properties == null ? result : baseAssign(result, properties);\n }\n\n /**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\n var defaults = baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n });\n\n /**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaults\n * @example\n *\n * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });\n * // => { 'a': { 'b': 2, 'c': 3 } }\n */\n var defaultsDeep = baseRest(function(args) {\n args.push(undefined, customDefaultsMerge);\n return apply(mergeWith, undefined, args);\n });\n\n /**\n * This method is like `_.find` except that it returns the key of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findKey(users, function(o) { return o.age < 40; });\n * // => 'barney' (iteration order is not guaranteed)\n *\n * // The `_.matches` iteratee shorthand.\n * _.findKey(users, { 'age': 1, 'active': true });\n * // => 'pebbles'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findKey(users, 'active');\n * // => 'barney'\n */\n function findKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);\n }\n\n /**\n * This method is like `_.findKey` except that it iterates over elements of\n * a collection in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {string|undefined} Returns the key of the matched element,\n * else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findLastKey(users, function(o) { return o.age < 40; });\n * // => returns 'pebbles' assuming `_.findKey` returns 'barney'\n *\n * // The `_.matches` iteratee shorthand.\n * _.findLastKey(users, { 'age': 36, 'active': true });\n * // => 'barney'\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.findLastKey(users, ['active', false]);\n * // => 'fred'\n *\n * // The `_.property` iteratee shorthand.\n * _.findLastKey(users, 'active');\n * // => 'pebbles'\n */\n function findLastKey(object, predicate) {\n return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);\n }\n\n /**\n * Iterates over own and inherited enumerable string keyed properties of an\n * object and invokes `iteratee` for each property. The iteratee is invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forInRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).\n */\n function forIn(object, iteratee) {\n return object == null\n ? object\n : baseFor(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * This method is like `_.forIn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forIn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forInRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.\n */\n function forInRight(object, iteratee) {\n return object == null\n ? object\n : baseForRight(object, getIteratee(iteratee, 3), keysIn);\n }\n\n /**\n * Iterates over own enumerable string keyed properties of an object and\n * invokes `iteratee` for each property. The iteratee is invoked with three\n * arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 0.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwnRight\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'a' then 'b' (iteration order is not guaranteed).\n */\n function forOwn(object, iteratee) {\n return object && baseForOwn(object, getIteratee(iteratee, 3));\n }\n\n /**\n * This method is like `_.forOwn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @since 2.0.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns `object`.\n * @see _.forOwn\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwnRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.\n */\n function forOwnRight(object, iteratee) {\n return object && baseForOwnRight(object, getIteratee(iteratee, 3));\n }\n\n /**\n * Creates an array of function property names from own enumerable properties\n * of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functionsIn\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functions(new Foo);\n * // => ['a', 'b']\n */\n function functions(object) {\n return object == null ? [] : baseFunctions(object, keys(object));\n }\n\n /**\n * Creates an array of function property names from own and inherited\n * enumerable properties of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the function names.\n * @see _.functions\n * @example\n *\n * function Foo() {\n * this.a = _.constant('a');\n * this.b = _.constant('b');\n * }\n *\n * Foo.prototype.c = _.constant('c');\n *\n * _.functionsIn(new Foo);\n * // => ['a', 'b', 'c']\n */\n function functionsIn(object) {\n return object == null ? [] : baseFunctions(object, keysIn(object));\n }\n\n /**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n }\n\n /**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\n function has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n }\n\n /**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\n function hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n }\n\n /**\n * Creates an object composed of the inverted keys and values of `object`.\n * If `object` contains duplicate values, subsequent values overwrite\n * property assignments of previous values.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Object\n * @param {Object} object The object to invert.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invert(object);\n * // => { '1': 'c', '2': 'b' }\n */\n var invert = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n result[value] = key;\n }, constant(identity));\n\n /**\n * This method is like `_.invert` except that the inverted object is generated\n * from the results of running each element of `object` thru `iteratee`. The\n * corresponding inverted value of each inverted key is an array of keys\n * responsible for generating the inverted value. The iteratee is invoked\n * with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.1.0\n * @category Object\n * @param {Object} object The object to invert.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invertBy(object);\n * // => { '1': ['a', 'c'], '2': ['b'] }\n *\n * _.invertBy(object, function(value) {\n * return 'group' + value;\n * });\n * // => { 'group1': ['a', 'c'], 'group2': ['b'] }\n */\n var invertBy = createInverter(function(result, value, key) {\n if (value != null &&\n typeof value.toString != 'function') {\n value = nativeObjectToString.call(value);\n }\n\n if (hasOwnProperty.call(result, value)) {\n result[value].push(key);\n } else {\n result[value] = [key];\n }\n }, getIteratee);\n\n /**\n * Invokes the method at `path` of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };\n *\n * _.invoke(object, 'a[0].b.c.slice', 1, 3);\n * // => [2, 3]\n */\n var invoke = baseRest(baseInvoke);\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n function keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n }\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n }\n\n /**\n * The opposite of `_.mapValues`; this method creates an object with the\n * same values as `object` and keys generated by running each own enumerable\n * string keyed property of `object` thru `iteratee`. The iteratee is invoked\n * with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 3.8.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapValues\n * @example\n *\n * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n * return key + value;\n * });\n * // => { 'a1': 1, 'b2': 2 }\n */\n function mapKeys(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, iteratee(value, key, object), value);\n });\n return result;\n }\n\n /**\n * Creates an object with the same keys as `object` and values generated\n * by running each own enumerable string keyed property of `object` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, key, object).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Object} Returns the new mapped object.\n * @see _.mapKeys\n * @example\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * _.mapValues(users, function(o) { return o.age; });\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n *\n * // The `_.property` iteratee shorthand.\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\n function mapValues(object, iteratee) {\n var result = {};\n iteratee = getIteratee(iteratee, 3);\n\n baseForOwn(object, function(value, key, object) {\n baseAssignValue(result, key, iteratee(value, key, object));\n });\n return result;\n }\n\n /**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\n var merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n });\n\n /**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\n var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n });\n\n /**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable property paths of `object` that are not omitted.\n *\n * **Note:** This method is considerably slower than `_.pick`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to omit.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omit(object, ['a', 'c']);\n * // => { 'b': '2' }\n */\n var omit = flatRest(function(object, paths) {\n var result = {};\n if (object == null) {\n return result;\n }\n var isDeep = false;\n paths = arrayMap(paths, function(path) {\n path = castPath(path, object);\n isDeep || (isDeep = path.length > 1);\n return path;\n });\n copyObject(object, getAllKeysIn(object), result);\n if (isDeep) {\n result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);\n }\n var length = paths.length;\n while (length--) {\n baseUnset(result, paths[length]);\n }\n return result;\n });\n\n /**\n * The opposite of `_.pickBy`; this method creates an object composed of\n * the own and inherited enumerable string keyed properties of `object` that\n * `predicate` doesn't return truthy for. The predicate is invoked with two\n * arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omitBy(object, _.isNumber);\n * // => { 'b': '2' }\n */\n function omitBy(object, predicate) {\n return pickBy(object, negate(getIteratee(predicate)));\n }\n\n /**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\n var pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n });\n\n /**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The source object.\n * @param {Function} [predicate=_.identity] The function invoked per property.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pickBy(object, _.isNumber);\n * // => { 'a': 1, 'c': 3 }\n */\n function pickBy(object, predicate) {\n if (object == null) {\n return {};\n }\n var props = arrayMap(getAllKeysIn(object), function(prop) {\n return [prop];\n });\n predicate = getIteratee(predicate);\n return basePickBy(object, props, function(value, path) {\n return predicate(value, path[0]);\n });\n }\n\n /**\n * This method is like `_.get` except that if the resolved value is a\n * function it's invoked with the `this` binding of its parent object and\n * its result is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to resolve.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n *\n * _.result(object, 'a[0].b.c1');\n * // => 3\n *\n * _.result(object, 'a[0].b.c2');\n * // => 4\n *\n * _.result(object, 'a[0].b.c3', 'default');\n * // => 'default'\n *\n * _.result(object, 'a[0].b.c3', _.constant('default'));\n * // => 'default'\n */\n function result(object, path, defaultValue) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length;\n\n // Ensure the loop is entered when path is empty.\n if (!length) {\n length = 1;\n object = undefined;\n }\n while (++index < length) {\n var value = object == null ? undefined : object[toKey(path[index])];\n if (value === undefined) {\n index = length;\n value = defaultValue;\n }\n object = isFunction(value) ? value.call(object) : value;\n }\n return object;\n }\n\n /**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\n function set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n }\n\n /**\n * This method is like `_.set` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.setWith(object, '[0][1]', 'a', Object);\n * // => { '0': { '1': 'a' } }\n */\n function setWith(object, path, value, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseSet(object, path, value, customizer);\n }\n\n /**\n * Creates an array of own enumerable string keyed-value pairs for `object`\n * which can be consumed by `_.fromPairs`. If `object` is a map or set, its\n * entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entries\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairs(new Foo);\n * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)\n */\n var toPairs = createToPairs(keys);\n\n /**\n * Creates an array of own and inherited enumerable string keyed-value pairs\n * for `object` which can be consumed by `_.fromPairs`. If `object` is a map\n * or set, its entries are returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias entriesIn\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the key-value pairs.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.toPairsIn(new Foo);\n * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)\n */\n var toPairsIn = createToPairs(keysIn);\n\n /**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own\n * enumerable string keyed properties thru `iteratee`, with each invocation\n * potentially mutating the `accumulator` object. If `accumulator` is not\n * provided, a new object with the same `[[Prototype]]` will be used. The\n * iteratee is invoked with four arguments: (accumulator, value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @since 1.3.0\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * }, []);\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {\n * (result[value] || (result[value] = [])).push(key);\n * }, {});\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\n function transform(object, iteratee, accumulator) {\n var isArr = isArray(object),\n isArrLike = isArr || isBuffer(object) || isTypedArray(object);\n\n iteratee = getIteratee(iteratee, 4);\n if (accumulator == null) {\n var Ctor = object && object.constructor;\n if (isArrLike) {\n accumulator = isArr ? new Ctor : [];\n }\n else if (isObject(object)) {\n accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};\n }\n else {\n accumulator = {};\n }\n }\n (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n }\n\n /**\n * Removes the property at `path` of `object`.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 7 } }] };\n * _.unset(object, 'a[0].b.c');\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n *\n * _.unset(object, ['a', '0', 'b', 'c']);\n * // => true\n *\n * console.log(object);\n * // => { 'a': [{ 'b': {} }] };\n */\n function unset(object, path) {\n return object == null ? true : baseUnset(object, path);\n }\n\n /**\n * This method is like `_.set` except that accepts `updater` to produce the\n * value to set. Use `_.updateWith` to customize `path` creation. The `updater`\n * is invoked with one argument: (value).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.update(object, 'a[0].b.c', function(n) { return n * n; });\n * console.log(object.a[0].b.c);\n * // => 9\n *\n * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });\n * console.log(object.x[0].y.z);\n * // => 0\n */\n function update(object, path, updater) {\n return object == null ? object : baseUpdate(object, path, castFunction(updater));\n }\n\n /**\n * This method is like `_.update` except that it accepts `customizer` which is\n * invoked to produce the objects of `path`. If `customizer` returns `undefined`\n * path creation is handled by the method instead. The `customizer` is invoked\n * with three arguments: (nsValue, key, nsObject).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.6.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {Function} updater The function to produce the updated value.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {};\n *\n * _.updateWith(object, '[0][1]', _.constant('a'), Object);\n * // => { '0': { '1': 'a' } }\n */\n function updateWith(object, path, updater, customizer) {\n customizer = typeof customizer == 'function' ? customizer : undefined;\n return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);\n }\n\n /**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n }\n\n /**\n * Creates an array of the own and inherited enumerable string keyed property\n * values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.valuesIn(new Foo);\n * // => [1, 2, 3] (iteration order is not guaranteed)\n */\n function valuesIn(object) {\n return object == null ? [] : baseValues(object, keysIn(object));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Clamps `number` within the inclusive `lower` and `upper` bounds.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Number\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n * @example\n *\n * _.clamp(-10, -5, 5);\n * // => -5\n *\n * _.clamp(10, -5, 5);\n * // => 5\n */\n function clamp(number, lower, upper) {\n if (upper === undefined) {\n upper = lower;\n lower = undefined;\n }\n if (upper !== undefined) {\n upper = toNumber(upper);\n upper = upper === upper ? upper : 0;\n }\n if (lower !== undefined) {\n lower = toNumber(lower);\n lower = lower === lower ? lower : 0;\n }\n return baseClamp(toNumber(number), lower, upper);\n }\n\n /**\n * Checks if `n` is between `start` and up to, but not including, `end`. If\n * `end` is not specified, it's set to `start` with `start` then set to `0`.\n * If `start` is greater than `end` the params are swapped to support\n * negative ranges.\n *\n * @static\n * @memberOf _\n * @since 3.3.0\n * @category Number\n * @param {number} number The number to check.\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `number` is in the range, else `false`.\n * @see _.range, _.rangeRight\n * @example\n *\n * _.inRange(3, 2, 4);\n * // => true\n *\n * _.inRange(4, 8);\n * // => true\n *\n * _.inRange(4, 2);\n * // => false\n *\n * _.inRange(2, 2);\n * // => false\n *\n * _.inRange(1.2, 2);\n * // => true\n *\n * _.inRange(5.2, 4);\n * // => false\n *\n * _.inRange(-3, -2, -6);\n * // => true\n */\n function inRange(number, start, end) {\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n number = toNumber(number);\n return baseInRange(number, start, end);\n }\n\n /**\n * Produces a random number between the inclusive `lower` and `upper` bounds.\n * If only one argument is provided a number between `0` and the given number\n * is returned. If `floating` is `true`, or either `lower` or `upper` are\n * floats, a floating-point number is returned instead of an integer.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @memberOf _\n * @since 0.7.0\n * @category Number\n * @param {number} [lower=0] The lower bound.\n * @param {number} [upper=1] The upper bound.\n * @param {boolean} [floating] Specify returning a floating-point number.\n * @returns {number} Returns the random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(lower, upper, floating) {\n if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {\n upper = floating = undefined;\n }\n if (floating === undefined) {\n if (typeof upper == 'boolean') {\n floating = upper;\n upper = undefined;\n }\n else if (typeof lower == 'boolean') {\n floating = lower;\n lower = undefined;\n }\n }\n if (lower === undefined && upper === undefined) {\n lower = 0;\n upper = 1;\n }\n else {\n lower = toFinite(lower);\n if (upper === undefined) {\n upper = lower;\n lower = 0;\n } else {\n upper = toFinite(upper);\n }\n }\n if (lower > upper) {\n var temp = lower;\n lower = upper;\n upper = temp;\n }\n if (floating || lower % 1 || upper % 1) {\n var rand = nativeRandom();\n return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);\n }\n return baseRandom(lower, upper);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar--');\n * // => 'fooBar'\n *\n * _.camelCase('__FOO_BAR__');\n * // => 'fooBar'\n */\n var camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? capitalize(word) : word);\n });\n\n /**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\n function capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n }\n\n /**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\n function deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n }\n\n /**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search up to.\n * @returns {boolean} Returns `true` if `string` ends with `target`,\n * else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\n function endsWith(string, target, position) {\n string = toString(string);\n target = baseToString(target);\n\n var length = string.length;\n position = position === undefined\n ? length\n : baseClamp(toInteger(position), 0, length);\n\n var end = position;\n position -= target.length;\n return position >= 0 && string.slice(position, end) == target;\n }\n\n /**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value. See\n * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * When working with HTML you should always\n * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n * XSS vectors.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, &amp; pebbles'\n */\n function escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n }\n\n /**\n * Escapes the `RegExp` special characters \"^\", \"$\", \"\\\", \".\", \"*\", \"+\",\n * \"?\", \"(\", \")\", \"[\", \"]\", \"{\", \"}\", and \"|\" in `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escapeRegExp('[lodash](https://lodash.com/)');\n * // => '\\[lodash\\]\\(https://lodash\\.com/\\)'\n */\n function escapeRegExp(string) {\n string = toString(string);\n return (string && reHasRegExpChar.test(string))\n ? string.replace(reRegExpChar, '\\\\$&')\n : string;\n }\n\n /**\n * Converts `string` to\n * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__FOO_BAR__');\n * // => 'foo-bar'\n */\n var kebabCase = createCompounder(function(result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase();\n });\n\n /**\n * Converts `string`, as space separated words, to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the lower cased string.\n * @example\n *\n * _.lowerCase('--Foo-Bar--');\n * // => 'foo bar'\n *\n * _.lowerCase('fooBar');\n * // => 'foo bar'\n *\n * _.lowerCase('__FOO_BAR__');\n * // => 'foo bar'\n */\n var lowerCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + word.toLowerCase();\n });\n\n /**\n * Converts the first character of `string` to lower case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.lowerFirst('Fred');\n * // => 'fred'\n *\n * _.lowerFirst('FRED');\n * // => 'fRED'\n */\n var lowerFirst = createCaseFirst('toLowerCase');\n\n /**\n * Pads `string` on the left and right sides if it's shorter than `length`.\n * Padding characters are truncated if they can't be evenly divided by `length`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.pad('abc', 8);\n * // => ' abc '\n *\n * _.pad('abc', 8, '_-');\n * // => '_-abc_-_'\n *\n * _.pad('abc', 3);\n * // => 'abc'\n */\n function pad(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n if (!length || strLength >= length) {\n return string;\n }\n var mid = (length - strLength) / 2;\n return (\n createPadding(nativeFloor(mid), chars) +\n string +\n createPadding(nativeCeil(mid), chars)\n );\n }\n\n /**\n * Pads `string` on the right side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padEnd('abc', 6);\n * // => 'abc '\n *\n * _.padEnd('abc', 6, '_-');\n * // => 'abc_-_'\n *\n * _.padEnd('abc', 3);\n * // => 'abc'\n */\n function padEnd(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (string + createPadding(length - strLength, chars))\n : string;\n }\n\n /**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padStart('abc', 6);\n * // => ' abc'\n *\n * _.padStart('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padStart('abc', 3);\n * // => 'abc'\n */\n function padStart(string, length, chars) {\n string = toString(string);\n length = toInteger(length);\n\n var strLength = length ? stringSize(string) : 0;\n return (length && strLength < length)\n ? (createPadding(length - strLength, chars) + string)\n : string;\n }\n\n /**\n * Converts `string` to an integer of the specified radix. If `radix` is\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a\n * hexadecimal, in which case a `radix` of `16` is used.\n *\n * **Note:** This method aligns with the\n * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.\n *\n * @static\n * @memberOf _\n * @since 1.1.0\n * @category String\n * @param {string} string The string to convert.\n * @param {number} [radix=10] The radix to interpret `value` by.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.parseInt('08');\n * // => 8\n *\n * _.map(['6', '08', '10'], _.parseInt);\n * // => [6, 8, 10]\n */\n function parseInt(string, radix, guard) {\n if (guard || radix == null) {\n radix = 0;\n } else if (radix) {\n radix = +radix;\n }\n return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);\n }\n\n /**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=1] The number of times to repeat the string.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\n function repeat(string, n, guard) {\n if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n return baseRepeat(toString(string), n);\n }\n\n /**\n * Replaces matches for `pattern` in `string` with `replacement`.\n *\n * **Note:** This method is based on\n * [`String#replace`](https://mdn.io/String/replace).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to modify.\n * @param {RegExp|string} pattern The pattern to replace.\n * @param {Function|string} replacement The match replacement.\n * @returns {string} Returns the modified string.\n * @example\n *\n * _.replace('Hi Fred', 'Fred', 'Barney');\n * // => 'Hi Barney'\n */\n function replace() {\n var args = arguments,\n string = toString(args[0]);\n\n return args.length < 3 ? string : string.replace(args[1], args[2]);\n }\n\n /**\n * Converts `string` to\n * [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--FOO-BAR--');\n * // => 'foo_bar'\n */\n var snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n });\n\n /**\n * Splits `string` by `separator`.\n *\n * **Note:** This method is based on\n * [`String#split`](https://mdn.io/String/split).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to split.\n * @param {RegExp|string} separator The separator pattern to split by.\n * @param {number} [limit] The length to truncate results to.\n * @returns {Array} Returns the string segments.\n * @example\n *\n * _.split('a-b-c', '-', 2);\n * // => ['a', 'b']\n */\n function split(string, separator, limit) {\n if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {\n separator = limit = undefined;\n }\n limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;\n if (!limit) {\n return [];\n }\n string = toString(string);\n if (string && (\n typeof separator == 'string' ||\n (separator != null && !isRegExp(separator))\n )) {\n separator = baseToString(separator);\n if (!separator && hasUnicode(string)) {\n return castSlice(stringToArray(string), 0, limit);\n }\n }\n return string.split(separator, limit);\n }\n\n /**\n * Converts `string` to\n * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n *\n * @static\n * @memberOf _\n * @since 3.1.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the start cased string.\n * @example\n *\n * _.startCase('--foo-bar--');\n * // => 'Foo Bar'\n *\n * _.startCase('fooBar');\n * // => 'Foo Bar'\n *\n * _.startCase('__FOO_BAR__');\n * // => 'FOO BAR'\n */\n var startCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + upperFirst(word);\n });\n\n /**\n * Checks if `string` starts with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=0] The position to search from.\n * @returns {boolean} Returns `true` if `string` starts with `target`,\n * else `false`.\n * @example\n *\n * _.startsWith('abc', 'a');\n * // => true\n *\n * _.startsWith('abc', 'b');\n * // => false\n *\n * _.startsWith('abc', 'b', 1);\n * // => true\n */\n function startsWith(string, target, position) {\n string = toString(string);\n position = position == null\n ? 0\n : baseClamp(toInteger(position), 0, string.length);\n\n target = baseToString(target);\n return string.slice(position, position + target.length) == target;\n }\n\n /**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='lodash.templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<b><%- value %></b>');\n * compiled({ 'value': '<script>' });\n * // => '<b>&lt;script&gt;</b>'\n *\n * // Use the \"evaluate\" delimiter to execute JavaScript and generate HTML.\n * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the internal `print` function in \"evaluate\" delimiters.\n * var compiled = _.template('<% print(\"hello \" + user); %>!');\n * compiled({ 'user': 'barney' });\n * // => 'hello barney!'\n *\n * // Use the ES template literal delimiter as an \"interpolate\" delimiter.\n * // Disable support by replacing the \"interpolate\" delimiter.\n * var compiled = _.template('hello ${ user }!');\n * compiled({ 'user': 'pebbles' });\n * // => 'hello pebbles!'\n *\n * // Use backslashes to treat delimiters as plain text.\n * var compiled = _.template('<%= \"\\\\<%- value %\\\\>\" %>');\n * compiled({ 'value': 'ignored' });\n * // => '<%- value %>'\n *\n * // Use the `imports` option to import `jQuery` as `jq`.\n * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\n * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the `sourceURL` option to specify a custom sourceURL for the template.\n * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\n * compiled(data);\n * // => Find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector.\n *\n * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.\n * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\n * compiled.source;\n * // => function(data) {\n * // var __t, __p = '';\n * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\n * // return __p;\n * // }\n *\n * // Use custom template delimiters.\n * _.templateSettings.interpolate = /{{([\\s\\S]+?)}}/g;\n * var compiled = _.template('hello {{ user }}!');\n * compiled({ 'user': 'mustache' });\n * // => 'hello mustache!'\n *\n * // Use the `source` property to inline compiled templates for meaningful\n * // line numbers in error messages and stack traces.\n * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\\\n * var JST = {\\\n * \"main\": ' + _.template(mainText).source + '\\\n * };\\\n * ');\n */\n function template(string, options, guard) {\n // Based on John Resig's `tmpl` implementation\n // (http://ejohn.org/blog/javascript-micro-templating/)\n // and Laura Doktorova's doT.js (https://github.com/olado/doT).\n var settings = lodash.templateSettings;\n\n if (guard && isIterateeCall(string, options, guard)) {\n options = undefined;\n }\n string = toString(string);\n options = assignInWith({}, options, settings, customDefaultsAssignIn);\n\n var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),\n importsKeys = keys(imports),\n importsValues = baseValues(imports, importsKeys);\n\n var isEscaping,\n isEvaluating,\n index = 0,\n interpolate = options.interpolate || reNoMatch,\n source = \"__p += '\";\n\n // Compile the regexp to match each delimiter.\n var reDelimiters = RegExp(\n (options.escape || reNoMatch).source + '|' +\n interpolate.source + '|' +\n (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +\n (options.evaluate || reNoMatch).source + '|$'\n , 'g');\n\n // Use a sourceURL for easier debugging.\n // The sourceURL gets injected into the source that's eval-ed, so be careful\n // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in\n // and escape the comment, thus injecting code that gets evaled.\n var sourceURL = '//# sourceURL=' +\n (hasOwnProperty.call(options, 'sourceURL')\n ? (options.sourceURL + '').replace(/\\s/g, ' ')\n : ('lodash.templateSources[' + (++templateCounter) + ']')\n ) + '\\n';\n\n string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {\n interpolateValue || (interpolateValue = esTemplateValue);\n\n // Escape characters that can't be included in string literals.\n source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);\n\n // Replace delimiters with snippets.\n if (escapeValue) {\n isEscaping = true;\n source += \"' +\\n__e(\" + escapeValue + \") +\\n'\";\n }\n if (evaluateValue) {\n isEvaluating = true;\n source += \"';\\n\" + evaluateValue + \";\\n__p += '\";\n }\n if (interpolateValue) {\n source += \"' +\\n((__t = (\" + interpolateValue + \")) == null ? '' : __t) +\\n'\";\n }\n index = offset + match.length;\n\n // The JS engine embedded in Adobe products needs `match` returned in\n // order to produce the correct `offset` value.\n return match;\n });\n\n source += \"';\\n\";\n\n // If `variable` is not specified wrap a with-statement around the generated\n // code to add the data object to the top of the scope chain.\n var variable = hasOwnProperty.call(options, 'variable') && options.variable;\n if (!variable) {\n source = 'with (obj) {\\n' + source + '\\n}\\n';\n }\n // Throw an error if a forbidden character was found in `variable`, to prevent\n // potential command injection attacks.\n else if (reForbiddenIdentifierChars.test(variable)) {\n throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);\n }\n\n // Cleanup code by stripping empty strings.\n source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)\n .replace(reEmptyStringMiddle, '$1')\n .replace(reEmptyStringTrailing, '$1;');\n\n // Frame code as the function body.\n source = 'function(' + (variable || 'obj') + ') {\\n' +\n (variable\n ? ''\n : 'obj || (obj = {});\\n'\n ) +\n \"var __t, __p = ''\" +\n (isEscaping\n ? ', __e = _.escape'\n : ''\n ) +\n (isEvaluating\n ? ', __j = Array.prototype.join;\\n' +\n \"function print() { __p += __j.call(arguments, '') }\\n\"\n : ';\\n'\n ) +\n source +\n 'return __p\\n}';\n\n var result = attempt(function() {\n return Function(importsKeys, sourceURL + 'return ' + source)\n .apply(undefined, importsValues);\n });\n\n // Provide the compiled function's source by its `toString` method or\n // the `source` property as a convenience for inlining compiled templates.\n result.source = source;\n if (isError(result)) {\n throw result;\n }\n return result;\n }\n\n /**\n * Converts `string`, as a whole, to lower case just like\n * [String#toLowerCase](https://mdn.io/toLowerCase).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the lower cased string.\n * @example\n *\n * _.toLower('--Foo-Bar--');\n * // => '--foo-bar--'\n *\n * _.toLower('fooBar');\n * // => 'foobar'\n *\n * _.toLower('__FOO_BAR__');\n * // => '__foo_bar__'\n */\n function toLower(value) {\n return toString(value).toLowerCase();\n }\n\n /**\n * Converts `string`, as a whole, to upper case just like\n * [String#toUpperCase](https://mdn.io/toUpperCase).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the upper cased string.\n * @example\n *\n * _.toUpper('--foo-bar--');\n * // => '--FOO-BAR--'\n *\n * _.toUpper('fooBar');\n * // => 'FOOBAR'\n *\n * _.toUpper('__foo_bar__');\n * // => '__FOO_BAR__'\n */\n function toUpper(value) {\n return toString(value).toUpperCase();\n }\n\n /**\n * Removes leading and trailing whitespace or specified characters from `string`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to trim.\n * @param {string} [chars=whitespace] The characters to trim.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the trimmed string.\n * @example\n *\n * _.trim(' abc ');\n * // => 'abc'\n *\n * _.trim('-_-abc-_-', '_-');\n * // => 'abc'\n *\n * _.map([' foo ', ' bar '], _.trim);\n * // => ['foo', 'bar']\n */\n function trim(string, chars, guard) {\n string = toString(string);\n if (string && (guard || chars === undefined)) {\n return baseTrim(string);\n }\n if (!string || !(chars = baseToString(chars))) {\n return string;\n }\n var strSymbols = stringToArray(string),\n chrSymbols = stringToArray(chars),\n start = charsStartIndex(strSymbols, chrSymbols),\n end = charsEndIndex(strSymbols, chrSymbols) + 1;\n\n return castSlice(strSymbols, start, end).join('');\n }\n\n /**\n * Removes trailing whitespace or specified characters from `string`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to trim.\n * @param {string} [chars=whitespace] The characters to trim.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the trimmed string.\n * @example\n *\n * _.trimEnd(' abc ');\n * // => ' abc'\n *\n * _.trimEnd('-_-abc-_-', '_-');\n * // => '-_-abc'\n */\n function trimEnd(string, chars, guard) {\n string = toString(string);\n if (string && (guard || chars === undefined)) {\n return string.slice(0, trimmedEndIndex(string) + 1);\n }\n if (!string || !(chars = baseToString(chars))) {\n return string;\n }\n var strSymbols = stringToArray(string),\n end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;\n\n return castSlice(strSymbols, 0, end).join('');\n }\n\n /**\n * Removes leading whitespace or specified characters from `string`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to trim.\n * @param {string} [chars=whitespace] The characters to trim.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the trimmed string.\n * @example\n *\n * _.trimStart(' abc ');\n * // => 'abc '\n *\n * _.trimStart('-_-abc-_-', '_-');\n * // => 'abc-_-'\n */\n function trimStart(string, chars, guard) {\n string = toString(string);\n if (string && (guard || chars === undefined)) {\n return string.replace(reTrimStart, '');\n }\n if (!string || !(chars = baseToString(chars))) {\n return string;\n }\n var strSymbols = stringToArray(string),\n start = charsStartIndex(strSymbols, stringToArray(chars));\n\n return castSlice(strSymbols, start).join('');\n }\n\n /**\n * Truncates `string` if it's longer than the given maximum string length.\n * The last characters of the truncated string are replaced with the omission\n * string which defaults to \"...\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to truncate.\n * @param {Object} [options={}] The options object.\n * @param {number} [options.length=30] The maximum string length.\n * @param {string} [options.omission='...'] The string to indicate text is omitted.\n * @param {RegExp|string} [options.separator] The separator pattern to truncate to.\n * @returns {string} Returns the truncated string.\n * @example\n *\n * _.truncate('hi-diddly-ho there, neighborino');\n * // => 'hi-diddly-ho there, neighbo...'\n *\n * _.truncate('hi-diddly-ho there, neighborino', {\n * 'length': 24,\n * 'separator': ' '\n * });\n * // => 'hi-diddly-ho there,...'\n *\n * _.truncate('hi-diddly-ho there, neighborino', {\n * 'length': 24,\n * 'separator': /,? +/\n * });\n * // => 'hi-diddly-ho there...'\n *\n * _.truncate('hi-diddly-ho there, neighborino', {\n * 'omission': ' [...]'\n * });\n * // => 'hi-diddly-ho there, neig [...]'\n */\n function truncate(string, options) {\n var length = DEFAULT_TRUNC_LENGTH,\n omission = DEFAULT_TRUNC_OMISSION;\n\n if (isObject(options)) {\n var separator = 'separator' in options ? options.separator : separator;\n length = 'length' in options ? toInteger(options.length) : length;\n omission = 'omission' in options ? baseToString(options.omission) : omission;\n }\n string = toString(string);\n\n var strLength = string.length;\n if (hasUnicode(string)) {\n var strSymbols = stringToArray(string);\n strLength = strSymbols.length;\n }\n if (length >= strLength) {\n return string;\n }\n var end = length - stringSize(omission);\n if (end < 1) {\n return omission;\n }\n var result = strSymbols\n ? castSlice(strSymbols, 0, end).join('')\n : string.slice(0, end);\n\n if (separator === undefined) {\n return result + omission;\n }\n if (strSymbols) {\n end += (result.length - end);\n }\n if (isRegExp(separator)) {\n if (string.slice(end).search(separator)) {\n var match,\n substring = result;\n\n if (!separator.global) {\n separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');\n }\n separator.lastIndex = 0;\n while ((match = separator.exec(substring))) {\n var newEnd = match.index;\n }\n result = result.slice(0, newEnd === undefined ? end : newEnd);\n }\n } else if (string.indexOf(baseToString(separator), end) != end) {\n var index = result.lastIndexOf(separator);\n if (index > -1) {\n result = result.slice(0, index);\n }\n }\n return result + omission;\n }\n\n /**\n * The inverse of `_.escape`; this method converts the HTML entities\n * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to\n * their corresponding characters.\n *\n * **Note:** No other HTML entities are unescaped. To unescape additional\n * HTML entities use a third-party library like [_he_](https://mths.be/he).\n *\n * @static\n * @memberOf _\n * @since 0.6.0\n * @category String\n * @param {string} [string=''] The string to unescape.\n * @returns {string} Returns the unescaped string.\n * @example\n *\n * _.unescape('fred, barney, &amp; pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function unescape(string) {\n string = toString(string);\n return (string && reHasEscapedHtml.test(string))\n ? string.replace(reEscapedHtml, unescapeHtmlChar)\n : string;\n }\n\n /**\n * Converts `string`, as space separated words, to upper case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the upper cased string.\n * @example\n *\n * _.upperCase('--foo-bar');\n * // => 'FOO BAR'\n *\n * _.upperCase('fooBar');\n * // => 'FOO BAR'\n *\n * _.upperCase('__foo_bar__');\n * // => 'FOO BAR'\n */\n var upperCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + word.toUpperCase();\n });\n\n /**\n * Converts the first character of `string` to upper case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.upperFirst('fred');\n * // => 'Fred'\n *\n * _.upperFirst('FRED');\n * // => 'FRED'\n */\n var upperFirst = createCaseFirst('toUpperCase');\n\n /**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\n function words(string, pattern, guard) {\n string = toString(string);\n pattern = guard ? undefined : pattern;\n\n if (pattern === undefined) {\n return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);\n }\n return string.match(pattern) || [];\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Attempts to invoke `func`, returning either the result or the caught error\n * object. Any additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Function} func The function to attempt.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {*} Returns the `func` result or error object.\n * @example\n *\n * // Avoid throwing errors for invalid selectors.\n * var elements = _.attempt(function(selector) {\n * return document.querySelectorAll(selector);\n * }, '>_>');\n *\n * if (_.isError(elements)) {\n * elements = [];\n * }\n */\n var attempt = baseRest(function(func, args) {\n try {\n return apply(func, undefined, args);\n } catch (e) {\n return isError(e) ? e : new Error(e);\n }\n });\n\n /**\n * Binds methods of an object to the object itself, overwriting the existing\n * method.\n *\n * **Note:** This method doesn't set the \"length\" property of bound functions.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {Object} object The object to bind and assign the bound methods to.\n * @param {...(string|string[])} methodNames The object method names to bind.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var view = {\n * 'label': 'docs',\n * 'click': function() {\n * console.log('clicked ' + this.label);\n * }\n * };\n *\n * _.bindAll(view, ['click']);\n * jQuery(element).on('click', view.click);\n * // => Logs 'clicked docs' when clicked.\n */\n var bindAll = flatRest(function(object, methodNames) {\n arrayEach(methodNames, function(key) {\n key = toKey(key);\n baseAssignValue(object, key, bind(object[key], object));\n });\n return object;\n });\n\n /**\n * Creates a function that iterates over `pairs` and invokes the corresponding\n * function of the first predicate to return truthy. The predicate-function\n * pairs are invoked with the `this` binding and arguments of the created\n * function.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {Array} pairs The predicate-function pairs.\n * @returns {Function} Returns the new composite function.\n * @example\n *\n * var func = _.cond([\n * [_.matches({ 'a': 1 }), _.constant('matches A')],\n * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],\n * [_.stubTrue, _.constant('no match')]\n * ]);\n *\n * func({ 'a': 1, 'b': 2 });\n * // => 'matches A'\n *\n * func({ 'a': 0, 'b': 1 });\n * // => 'matches B'\n *\n * func({ 'a': '1', 'b': '2' });\n * // => 'no match'\n */\n function cond(pairs) {\n var length = pairs == null ? 0 : pairs.length,\n toIteratee = getIteratee();\n\n pairs = !length ? [] : arrayMap(pairs, function(pair) {\n if (typeof pair[1] != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return [toIteratee(pair[0]), pair[1]];\n });\n\n return baseRest(function(args) {\n var index = -1;\n while (++index < length) {\n var pair = pairs[index];\n if (apply(pair[0], this, args)) {\n return apply(pair[1], this, args);\n }\n }\n });\n }\n\n /**\n * Creates a function that invokes the predicate properties of `source` with\n * the corresponding property values of a given object, returning `true` if\n * all predicates return truthy, else `false`.\n *\n * **Note:** The created function is equivalent to `_.conformsTo` with\n * `source` partially applied.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {Object} source The object of property predicates to conform to.\n * @returns {Function} Returns the new spec function.\n * @example\n *\n * var objects = [\n * { 'a': 2, 'b': 1 },\n * { 'a': 1, 'b': 2 }\n * ];\n *\n * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));\n * // => [{ 'a': 1, 'b': 2 }]\n */\n function conforms(source) {\n return baseConforms(baseClone(source, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\n function constant(value) {\n return function() {\n return value;\n };\n }\n\n /**\n * Checks `value` to determine whether a default value should be returned in\n * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,\n * or `undefined`.\n *\n * @static\n * @memberOf _\n * @since 4.14.0\n * @category Util\n * @param {*} value The value to check.\n * @param {*} defaultValue The default value.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * _.defaultTo(1, 10);\n * // => 1\n *\n * _.defaultTo(undefined, 10);\n * // => 10\n */\n function defaultTo(value, defaultValue) {\n return (value == null || value !== value) ? defaultValue : value;\n }\n\n /**\n * Creates a function that returns the result of invoking the given functions\n * with the `this` binding of the created function, where each successive\n * invocation is supplied the return value of the previous.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {...(Function|Function[])} [funcs] The functions to invoke.\n * @returns {Function} Returns the new composite function.\n * @see _.flowRight\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flow([_.add, square]);\n * addSquare(1, 2);\n * // => 9\n */\n var flow = createFlow();\n\n /**\n * This method is like `_.flow` except that it creates a function that\n * invokes the given functions from right to left.\n *\n * @static\n * @since 3.0.0\n * @memberOf _\n * @category Util\n * @param {...(Function|Function[])} [funcs] The functions to invoke.\n * @returns {Function} Returns the new composite function.\n * @see _.flow\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flowRight([square, _.add]);\n * addSquare(1, 2);\n * // => 9\n */\n var flowRight = createFlow(true);\n\n /**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\n function identity(value) {\n return value;\n }\n\n /**\n * Creates a function that invokes `func` with the arguments of the created\n * function. If `func` is a property name, the created function returns the\n * property value for a given element. If `func` is an array or object, the\n * created function returns `true` for elements that contain the equivalent\n * source properties, otherwise it returns `false`.\n *\n * @static\n * @since 4.0.0\n * @memberOf _\n * @category Util\n * @param {*} [func=_.identity] The value to convert to a callback.\n * @returns {Function} Returns the callback.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // The `_.matches` iteratee shorthand.\n * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));\n * // => [{ 'user': 'barney', 'age': 36, 'active': true }]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.filter(users, _.iteratee(['user', 'fred']));\n * // => [{ 'user': 'fred', 'age': 40 }]\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, _.iteratee('user'));\n * // => ['barney', 'fred']\n *\n * // Create custom iteratee shorthands.\n * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {\n * return !_.isRegExp(func) ? iteratee(func) : function(string) {\n * return func.test(string);\n * };\n * });\n *\n * _.filter(['abc', 'def'], /ef/);\n * // => ['def']\n */\n function iteratee(func) {\n return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that performs a partial deep comparison between a given\n * object and `source`, returning `true` if the given object has equivalent\n * property values, else `false`.\n *\n * **Note:** The created function is equivalent to `_.isMatch` with `source`\n * partially applied.\n *\n * Partial comparisons will match empty array and empty object `source`\n * values against any array or object value, respectively. See `_.isEqual`\n * for a list of supported value comparisons.\n *\n * **Note:** Multiple values can be checked by combining several matchers\n * using `_.overSome`\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n * @example\n *\n * var objects = [\n * { 'a': 1, 'b': 2, 'c': 3 },\n * { 'a': 4, 'b': 5, 'c': 6 }\n * ];\n *\n * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));\n * // => [{ 'a': 4, 'b': 5, 'c': 6 }]\n *\n * // Checking for several possible values\n * _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));\n * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]\n */\n function matches(source) {\n return baseMatches(baseClone(source, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that performs a partial deep comparison between the\n * value at `path` of a given object to `srcValue`, returning `true` if the\n * object value is equivalent, else `false`.\n *\n * **Note:** Partial comparisons will match empty array and empty object\n * `srcValue` values against any array or object value, respectively. See\n * `_.isEqual` for a list of supported value comparisons.\n *\n * **Note:** Multiple values can be checked by combining several matchers\n * using `_.overSome`\n *\n * @static\n * @memberOf _\n * @since 3.2.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n * @example\n *\n * var objects = [\n * { 'a': 1, 'b': 2, 'c': 3 },\n * { 'a': 4, 'b': 5, 'c': 6 }\n * ];\n *\n * _.find(objects, _.matchesProperty('a', 4));\n * // => { 'a': 4, 'b': 5, 'c': 6 }\n *\n * // Checking for several possible values\n * _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));\n * // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]\n */\n function matchesProperty(path, srcValue) {\n return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));\n }\n\n /**\n * Creates a function that invokes the method at `path` of a given object.\n * Any additional arguments are provided to the invoked method.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Util\n * @param {Array|string} path The path of the method to invoke.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {Function} Returns the new invoker function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': _.constant(2) } },\n * { 'a': { 'b': _.constant(1) } }\n * ];\n *\n * _.map(objects, _.method('a.b'));\n * // => [2, 1]\n *\n * _.map(objects, _.method(['a', 'b']));\n * // => [2, 1]\n */\n var method = baseRest(function(path, args) {\n return function(object) {\n return baseInvoke(object, path, args);\n };\n });\n\n /**\n * The opposite of `_.method`; this method creates a function that invokes\n * the method at a given path of `object`. Any additional arguments are\n * provided to the invoked method.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Util\n * @param {Object} object The object to query.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {Function} Returns the new invoker function.\n * @example\n *\n * var array = _.times(3, _.constant),\n * object = { 'a': array, 'b': array, 'c': array };\n *\n * _.map(['a[2]', 'c[0]'], _.methodOf(object));\n * // => [2, 0]\n *\n * _.map([['a', '2'], ['c', '0']], _.methodOf(object));\n * // => [2, 0]\n */\n var methodOf = baseRest(function(object, args) {\n return function(path) {\n return baseInvoke(object, path, args);\n };\n });\n\n /**\n * Adds all own enumerable string keyed function properties of a source\n * object to the destination object. If `object` is a function, then methods\n * are added to its prototype as well.\n *\n * **Note:** Use `_.runInContext` to create a pristine `lodash` function to\n * avoid conflicts caused by modifying the original.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {Function|Object} [object=lodash] The destination object.\n * @param {Object} source The object of functions to add.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.chain=true] Specify whether mixins are chainable.\n * @returns {Function|Object} Returns `object`.\n * @example\n *\n * function vowels(string) {\n * return _.filter(string, function(v) {\n * return /[aeiou]/i.test(v);\n * });\n * }\n *\n * _.mixin({ 'vowels': vowels });\n * _.vowels('fred');\n * // => ['e']\n *\n * _('fred').vowels().value();\n * // => ['e']\n *\n * _.mixin({ 'vowels': vowels }, { 'chain': false });\n * _('fred').vowels();\n * // => ['e']\n */\n function mixin(object, source, options) {\n var props = keys(source),\n methodNames = baseFunctions(source, props);\n\n if (options == null &&\n !(isObject(source) && (methodNames.length || !props.length))) {\n options = source;\n source = object;\n object = this;\n methodNames = baseFunctions(source, keys(source));\n }\n var chain = !(isObject(options) && 'chain' in options) || !!options.chain,\n isFunc = isFunction(object);\n\n arrayEach(methodNames, function(methodName) {\n var func = source[methodName];\n object[methodName] = func;\n if (isFunc) {\n object.prototype[methodName] = function() {\n var chainAll = this.__chain__;\n if (chain || chainAll) {\n var result = object(this.__wrapped__),\n actions = result.__actions__ = copyArray(this.__actions__);\n\n actions.push({ 'func': func, 'args': arguments, 'thisArg': object });\n result.__chain__ = chainAll;\n return result;\n }\n return func.apply(object, arrayPush([this.value()], arguments));\n };\n }\n });\n\n return object;\n }\n\n /**\n * Reverts the `_` variable to its previous value and returns a reference to\n * the `lodash` function.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @returns {Function} Returns the `lodash` function.\n * @example\n *\n * var lodash = _.noConflict();\n */\n function noConflict() {\n if (root._ === this) {\n root._ = oldDash;\n }\n return this;\n }\n\n /**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\n function noop() {\n // No operation performed.\n }\n\n /**\n * Creates a function that gets the argument at index `n`. If `n` is negative,\n * the nth argument from the end is returned.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {number} [n=0] The index of the argument to return.\n * @returns {Function} Returns the new pass-thru function.\n * @example\n *\n * var func = _.nthArg(1);\n * func('a', 'b', 'c', 'd');\n * // => 'b'\n *\n * var func = _.nthArg(-2);\n * func('a', 'b', 'c', 'd');\n * // => 'c'\n */\n function nthArg(n) {\n n = toInteger(n);\n return baseRest(function(args) {\n return baseNth(args, n);\n });\n }\n\n /**\n * Creates a function that invokes `iteratees` with the arguments it receives\n * and returns their results.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to invoke.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var func = _.over([Math.max, Math.min]);\n *\n * func(1, 2, 3, 4);\n * // => [4, 1]\n */\n var over = createOver(arrayMap);\n\n /**\n * Creates a function that checks if **all** of the `predicates` return\n * truthy when invoked with the arguments it receives.\n *\n * Following shorthands are possible for providing predicates.\n * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.\n * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {...(Function|Function[])} [predicates=[_.identity]]\n * The predicates to check.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var func = _.overEvery([Boolean, isFinite]);\n *\n * func('1');\n * // => true\n *\n * func(null);\n * // => false\n *\n * func(NaN);\n * // => false\n */\n var overEvery = createOver(arrayEvery);\n\n /**\n * Creates a function that checks if **any** of the `predicates` return\n * truthy when invoked with the arguments it receives.\n *\n * Following shorthands are possible for providing predicates.\n * Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.\n * Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {...(Function|Function[])} [predicates=[_.identity]]\n * The predicates to check.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var func = _.overSome([Boolean, isFinite]);\n *\n * func('1');\n * // => true\n *\n * func(null);\n * // => true\n *\n * func(NaN);\n * // => false\n *\n * var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])\n * var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])\n */\n var overSome = createOver(arraySome);\n\n /**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\n function property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n }\n\n /**\n * The opposite of `_.property`; this method creates a function that returns\n * the value at a given path of `object`.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var array = [0, 1, 2],\n * object = { 'a': array, 'b': array, 'c': array };\n *\n * _.map(['a[2]', 'c[0]'], _.propertyOf(object));\n * // => [2, 0]\n *\n * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));\n * // => [2, 0]\n */\n function propertyOf(object) {\n return function(path) {\n return object == null ? undefined : baseGet(object, path);\n };\n }\n\n /**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n * `start` is specified without an `end` or `step`. If `end` is not specified,\n * it's set to `start` with `start` then set to `0`.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.rangeRight\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(-4);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\n var range = createRange();\n\n /**\n * This method is like `_.range` except that it populates values in\n * descending order.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.range\n * @example\n *\n * _.rangeRight(4);\n * // => [3, 2, 1, 0]\n *\n * _.rangeRight(-4);\n * // => [-3, -2, -1, 0]\n *\n * _.rangeRight(1, 5);\n * // => [4, 3, 2, 1]\n *\n * _.rangeRight(0, 20, 5);\n * // => [15, 10, 5, 0]\n *\n * _.rangeRight(0, -4, -1);\n * // => [-3, -2, -1, 0]\n *\n * _.rangeRight(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.rangeRight(0);\n * // => []\n */\n var rangeRight = createRange(true);\n\n /**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\n function stubArray() {\n return [];\n }\n\n /**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\n function stubFalse() {\n return false;\n }\n\n /**\n * This method returns a new empty object.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Object} Returns the new empty object.\n * @example\n *\n * var objects = _.times(2, _.stubObject);\n *\n * console.log(objects);\n * // => [{}, {}]\n *\n * console.log(objects[0] === objects[1]);\n * // => false\n */\n function stubObject() {\n return {};\n }\n\n /**\n * This method returns an empty string.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {string} Returns the empty string.\n * @example\n *\n * _.times(2, _.stubString);\n * // => ['', '']\n */\n function stubString() {\n return '';\n }\n\n /**\n * This method returns `true`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `true`.\n * @example\n *\n * _.times(2, _.stubTrue);\n * // => [true, true]\n */\n function stubTrue() {\n return true;\n }\n\n /**\n * Invokes the iteratee `n` times, returning an array of the results of\n * each invocation. The iteratee is invoked with one argument; (index).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.times(3, String);\n * // => ['0', '1', '2']\n *\n * _.times(4, _.constant(0));\n * // => [0, 0, 0, 0]\n */\n function times(n, iteratee) {\n n = toInteger(n);\n if (n < 1 || n > MAX_SAFE_INTEGER) {\n return [];\n }\n var index = MAX_ARRAY_LENGTH,\n length = nativeMin(n, MAX_ARRAY_LENGTH);\n\n iteratee = getIteratee(iteratee);\n n -= MAX_ARRAY_LENGTH;\n\n var result = baseTimes(length, iteratee);\n while (++index < n) {\n iteratee(index);\n }\n return result;\n }\n\n /**\n * Converts `value` to a property path array.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Util\n * @param {*} value The value to convert.\n * @returns {Array} Returns the new property path array.\n * @example\n *\n * _.toPath('a.b.c');\n * // => ['a', 'b', 'c']\n *\n * _.toPath('a[0].b.c');\n * // => ['a', '0', 'b', 'c']\n */\n function toPath(value) {\n if (isArray(value)) {\n return arrayMap(value, toKey);\n }\n return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));\n }\n\n /**\n * Generates a unique ID. If `prefix` is given, the ID is appended to it.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {string} [prefix=''] The value to prefix the ID with.\n * @returns {string} Returns the unique ID.\n * @example\n *\n * _.uniqueId('contact_');\n * // => 'contact_104'\n *\n * _.uniqueId();\n * // => '105'\n */\n function uniqueId(prefix) {\n var id = ++idCounter;\n return toString(prefix) + id;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Adds two numbers.\n *\n * @static\n * @memberOf _\n * @since 3.4.0\n * @category Math\n * @param {number} augend The first number in an addition.\n * @param {number} addend The second number in an addition.\n * @returns {number} Returns the total.\n * @example\n *\n * _.add(6, 4);\n * // => 10\n */\n var add = createMathOperation(function(augend, addend) {\n return augend + addend;\n }, 0);\n\n /**\n * Computes `number` rounded up to `precision`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Math\n * @param {number} number The number to round up.\n * @param {number} [precision=0] The precision to round up to.\n * @returns {number} Returns the rounded up number.\n * @example\n *\n * _.ceil(4.006);\n * // => 5\n *\n * _.ceil(6.004, 2);\n * // => 6.01\n *\n * _.ceil(6040, -2);\n * // => 6100\n */\n var ceil = createRound('ceil');\n\n /**\n * Divide two numbers.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Math\n * @param {number} dividend The first number in a division.\n * @param {number} divisor The second number in a division.\n * @returns {number} Returns the quotient.\n * @example\n *\n * _.divide(6, 4);\n * // => 1.5\n */\n var divide = createMathOperation(function(dividend, divisor) {\n return dividend / divisor;\n }, 1);\n\n /**\n * Computes `number` rounded down to `precision`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Math\n * @param {number} number The number to round down.\n * @param {number} [precision=0] The precision to round down to.\n * @returns {number} Returns the rounded down number.\n * @example\n *\n * _.floor(4.006);\n * // => 4\n *\n * _.floor(0.046, 2);\n * // => 0.04\n *\n * _.floor(4060, -2);\n * // => 4000\n */\n var floor = createRound('floor');\n\n /**\n * Computes the maximum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * _.max([4, 2, 8, 6]);\n * // => 8\n *\n * _.max([]);\n * // => undefined\n */\n function max(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseGt)\n : undefined;\n }\n\n /**\n * This method is like `_.max` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the maximum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.maxBy(objects, function(o) { return o.n; });\n * // => { 'n': 2 }\n *\n * // The `_.property` iteratee shorthand.\n * _.maxBy(objects, 'n');\n * // => { 'n': 2 }\n */\n function maxBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)\n : undefined;\n }\n\n /**\n * Computes the mean of the values in `array`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {number} Returns the mean.\n * @example\n *\n * _.mean([4, 2, 8, 6]);\n * // => 5\n */\n function mean(array) {\n return baseMean(array, identity);\n }\n\n /**\n * This method is like `_.mean` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the value to be averaged.\n * The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the mean.\n * @example\n *\n * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n *\n * _.meanBy(objects, function(o) { return o.n; });\n * // => 5\n *\n * // The `_.property` iteratee shorthand.\n * _.meanBy(objects, 'n');\n * // => 5\n */\n function meanBy(array, iteratee) {\n return baseMean(array, getIteratee(iteratee, 2));\n }\n\n /**\n * Computes the minimum value of `array`. If `array` is empty or falsey,\n * `undefined` is returned.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * _.min([4, 2, 8, 6]);\n * // => 2\n *\n * _.min([]);\n * // => undefined\n */\n function min(array) {\n return (array && array.length)\n ? baseExtremum(array, identity, baseLt)\n : undefined;\n }\n\n /**\n * This method is like `_.min` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the criterion by which\n * the value is ranked. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {*} Returns the minimum value.\n * @example\n *\n * var objects = [{ 'n': 1 }, { 'n': 2 }];\n *\n * _.minBy(objects, function(o) { return o.n; });\n * // => { 'n': 1 }\n *\n * // The `_.property` iteratee shorthand.\n * _.minBy(objects, 'n');\n * // => { 'n': 1 }\n */\n function minBy(array, iteratee) {\n return (array && array.length)\n ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)\n : undefined;\n }\n\n /**\n * Multiply two numbers.\n *\n * @static\n * @memberOf _\n * @since 4.7.0\n * @category Math\n * @param {number} multiplier The first number in a multiplication.\n * @param {number} multiplicand The second number in a multiplication.\n * @returns {number} Returns the product.\n * @example\n *\n * _.multiply(6, 4);\n * // => 24\n */\n var multiply = createMathOperation(function(multiplier, multiplicand) {\n return multiplier * multiplicand;\n }, 1);\n\n /**\n * Computes `number` rounded to `precision`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Math\n * @param {number} number The number to round.\n * @param {number} [precision=0] The precision to round to.\n * @returns {number} Returns the rounded number.\n * @example\n *\n * _.round(4.006);\n * // => 4\n *\n * _.round(4.006, 2);\n * // => 4.01\n *\n * _.round(4060, -2);\n * // => 4100\n */\n var round = createRound('round');\n\n /**\n * Subtract two numbers.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {number} minuend The first number in a subtraction.\n * @param {number} subtrahend The second number in a subtraction.\n * @returns {number} Returns the difference.\n * @example\n *\n * _.subtract(6, 4);\n * // => 2\n */\n var subtract = createMathOperation(function(minuend, subtrahend) {\n return minuend - subtrahend;\n }, 0);\n\n /**\n * Computes the sum of the values in `array`.\n *\n * @static\n * @memberOf _\n * @since 3.4.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @returns {number} Returns the sum.\n * @example\n *\n * _.sum([4, 2, 8, 6]);\n * // => 20\n */\n function sum(array) {\n return (array && array.length)\n ? baseSum(array, identity)\n : 0;\n }\n\n /**\n * This method is like `_.sum` except that it accepts `iteratee` which is\n * invoked for each element in `array` to generate the value to be summed.\n * The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Math\n * @param {Array} array The array to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee invoked per element.\n * @returns {number} Returns the sum.\n * @example\n *\n * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];\n *\n * _.sumBy(objects, function(o) { return o.n; });\n * // => 20\n *\n * // The `_.property` iteratee shorthand.\n * _.sumBy(objects, 'n');\n * // => 20\n */\n function sumBy(array, iteratee) {\n return (array && array.length)\n ? baseSum(array, getIteratee(iteratee, 2))\n : 0;\n }\n\n /*------------------------------------------------------------------------*/\n\n // Add methods that return wrapped values in chain sequences.\n lodash.after = after;\n lodash.ary = ary;\n lodash.assign = assign;\n lodash.assignIn = assignIn;\n lodash.assignInWith = assignInWith;\n lodash.assignWith = assignWith;\n lodash.at = at;\n lodash.before = before;\n lodash.bind = bind;\n lodash.bindAll = bindAll;\n lodash.bindKey = bindKey;\n lodash.castArray = castArray;\n lodash.chain = chain;\n lodash.chunk = chunk;\n lodash.compact = compact;\n lodash.concat = concat;\n lodash.cond = cond;\n lodash.conforms = conforms;\n lodash.constant = constant;\n lodash.countBy = countBy;\n lodash.create = create;\n lodash.curry = curry;\n lodash.curryRight = curryRight;\n lodash.debounce = debounce;\n lodash.defaults = defaults;\n lodash.defaultsDeep = defaultsDeep;\n lodash.defer = defer;\n lodash.delay = delay;\n lodash.difference = difference;\n lodash.differenceBy = differenceBy;\n lodash.differenceWith = differenceWith;\n lodash.drop = drop;\n lodash.dropRight = dropRight;\n lodash.dropRightWhile = dropRightWhile;\n lodash.dropWhile = dropWhile;\n lodash.fill = fill;\n lodash.filter = filter;\n lodash.flatMap = flatMap;\n lodash.flatMapDeep = flatMapDeep;\n lodash.flatMapDepth = flatMapDepth;\n lodash.flatten = flatten;\n lodash.flattenDeep = flattenDeep;\n lodash.flattenDepth = flattenDepth;\n lodash.flip = flip;\n lodash.flow = flow;\n lodash.flowRight = flowRight;\n lodash.fromPairs = fromPairs;\n lodash.functions = functions;\n lodash.functionsIn = functionsIn;\n lodash.groupBy = groupBy;\n lodash.initial = initial;\n lodash.intersection = intersection;\n lodash.intersectionBy = intersectionBy;\n lodash.intersectionWith = intersectionWith;\n lodash.invert = invert;\n lodash.invertBy = invertBy;\n lodash.invokeMap = invokeMap;\n lodash.iteratee = iteratee;\n lodash.keyBy = keyBy;\n lodash.keys = keys;\n lodash.keysIn = keysIn;\n lodash.map = map;\n lodash.mapKeys = mapKeys;\n lodash.mapValues = mapValues;\n lodash.matches = matches;\n lodash.matchesProperty = matchesProperty;\n lodash.memoize = memoize;\n lodash.merge = merge;\n lodash.mergeWith = mergeWith;\n lodash.method = method;\n lodash.methodOf = methodOf;\n lodash.mixin = mixin;\n lodash.negate = negate;\n lodash.nthArg = nthArg;\n lodash.omit = omit;\n lodash.omitBy = omitBy;\n lodash.once = once;\n lodash.orderBy = orderBy;\n lodash.over = over;\n lodash.overArgs = overArgs;\n lodash.overEvery = overEvery;\n lodash.overSome = overSome;\n lodash.partial = partial;\n lodash.partialRight = partialRight;\n lodash.partition = partition;\n lodash.pick = pick;\n lodash.pickBy = pickBy;\n lodash.property = property;\n lodash.propertyOf = propertyOf;\n lodash.pull = pull;\n lodash.pullAll = pullAll;\n lodash.pullAllBy = pullAllBy;\n lodash.pullAllWith = pullAllWith;\n lodash.pullAt = pullAt;\n lodash.range = range;\n lodash.rangeRight = rangeRight;\n lodash.rearg = rearg;\n lodash.reject = reject;\n lodash.remove = remove;\n lodash.rest = rest;\n lodash.reverse = reverse;\n lodash.sampleSize = sampleSize;\n lodash.set = set;\n lodash.setWith = setWith;\n lodash.shuffle = shuffle;\n lodash.slice = slice;\n lodash.sortBy = sortBy;\n lodash.sortedUniq = sortedUniq;\n lodash.sortedUniqBy = sortedUniqBy;\n lodash.split = split;\n lodash.spread = spread;\n lodash.tail = tail;\n lodash.take = take;\n lodash.takeRight = takeRight;\n lodash.takeRightWhile = takeRightWhile;\n lodash.takeWhile = takeWhile;\n lodash.tap = tap;\n lodash.throttle = throttle;\n lodash.thru = thru;\n lodash.toArray = toArray;\n lodash.toPairs = toPairs;\n lodash.toPairsIn = toPairsIn;\n lodash.toPath = toPath;\n lodash.toPlainObject = toPlainObject;\n lodash.transform = transform;\n lodash.unary = unary;\n lodash.union = union;\n lodash.unionBy = unionBy;\n lodash.unionWith = unionWith;\n lodash.uniq = uniq;\n lodash.uniqBy = uniqBy;\n lodash.uniqWith = uniqWith;\n lodash.unset = unset;\n lodash.unzip = unzip;\n lodash.unzipWith = unzipWith;\n lodash.update = update;\n lodash.updateWith = updateWith;\n lodash.values = values;\n lodash.valuesIn = valuesIn;\n lodash.without = without;\n lodash.words = words;\n lodash.wrap = wrap;\n lodash.xor = xor;\n lodash.xorBy = xorBy;\n lodash.xorWith = xorWith;\n lodash.zip = zip;\n lodash.zipObject = zipObject;\n lodash.zipObjectDeep = zipObjectDeep;\n lodash.zipWith = zipWith;\n\n // Add aliases.\n lodash.entries = toPairs;\n lodash.entriesIn = toPairsIn;\n lodash.extend = assignIn;\n lodash.extendWith = assignInWith;\n\n // Add methods to `lodash.prototype`.\n mixin(lodash, lodash);\n\n /*------------------------------------------------------------------------*/\n\n // Add methods that return unwrapped values in chain sequences.\n lodash.add = add;\n lodash.attempt = attempt;\n lodash.camelCase = camelCase;\n lodash.capitalize = capitalize;\n lodash.ceil = ceil;\n lodash.clamp = clamp;\n lodash.clone = clone;\n lodash.cloneDeep = cloneDeep;\n lodash.cloneDeepWith = cloneDeepWith;\n lodash.cloneWith = cloneWith;\n lodash.conformsTo = conformsTo;\n lodash.deburr = deburr;\n lodash.defaultTo = defaultTo;\n lodash.divide = divide;\n lodash.endsWith = endsWith;\n lodash.eq = eq;\n lodash.escape = escape;\n lodash.escapeRegExp = escapeRegExp;\n lodash.every = every;\n lodash.find = find;\n lodash.findIndex = findIndex;\n lodash.findKey = findKey;\n lodash.findLast = findLast;\n lodash.findLastIndex = findLastIndex;\n lodash.findLastKey = findLastKey;\n lodash.floor = floor;\n lodash.forEach = forEach;\n lodash.forEachRight = forEachRight;\n lodash.forIn = forIn;\n lodash.forInRight = forInRight;\n lodash.forOwn = forOwn;\n lodash.forOwnRight = forOwnRight;\n lodash.get = get;\n lodash.gt = gt;\n lodash.gte = gte;\n lodash.has = has;\n lodash.hasIn = hasIn;\n lodash.head = head;\n lodash.identity = identity;\n lodash.includes = includes;\n lodash.indexOf = indexOf;\n lodash.inRange = inRange;\n lodash.invoke = invoke;\n lodash.isArguments = isArguments;\n lodash.isArray = isArray;\n lodash.isArrayBuffer = isArrayBuffer;\n lodash.isArrayLike = isArrayLike;\n lodash.isArrayLikeObject = isArrayLikeObject;\n lodash.isBoolean = isBoolean;\n lodash.isBuffer = isBuffer;\n lodash.isDate = isDate;\n lodash.isElement = isElement;\n lodash.isEmpty = isEmpty;\n lodash.isEqual = isEqual;\n lodash.isEqualWith = isEqualWith;\n lodash.isError = isError;\n lodash.isFinite = isFinite;\n lodash.isFunction = isFunction;\n lodash.isInteger = isInteger;\n lodash.isLength = isLength;\n lodash.isMap = isMap;\n lodash.isMatch = isMatch;\n lodash.isMatchWith = isMatchWith;\n lodash.isNaN = isNaN;\n lodash.isNative = isNative;\n lodash.isNil = isNil;\n lodash.isNull = isNull;\n lodash.isNumber = isNumber;\n lodash.isObject = isObject;\n lodash.isObjectLike = isObjectLike;\n lodash.isPlainObject = isPlainObject;\n lodash.isRegExp = isRegExp;\n lodash.isSafeInteger = isSafeInteger;\n lodash.isSet = isSet;\n lodash.isString = isString;\n lodash.isSymbol = isSymbol;\n lodash.isTypedArray = isTypedArray;\n lodash.isUndefined = isUndefined;\n lodash.isWeakMap = isWeakMap;\n lodash.isWeakSet = isWeakSet;\n lodash.join = join;\n lodash.kebabCase = kebabCase;\n lodash.last = last;\n lodash.lastIndexOf = lastIndexOf;\n lodash.lowerCase = lowerCase;\n lodash.lowerFirst = lowerFirst;\n lodash.lt = lt;\n lodash.lte = lte;\n lodash.max = max;\n lodash.maxBy = maxBy;\n lodash.mean = mean;\n lodash.meanBy = meanBy;\n lodash.min = min;\n lodash.minBy = minBy;\n lodash.stubArray = stubArray;\n lodash.stubFalse = stubFalse;\n lodash.stubObject = stubObject;\n lodash.stubString = stubString;\n lodash.stubTrue = stubTrue;\n lodash.multiply = multiply;\n lodash.nth = nth;\n lodash.noConflict = noConflict;\n lodash.noop = noop;\n lodash.now = now;\n lodash.pad = pad;\n lodash.padEnd = padEnd;\n lodash.padStart = padStart;\n lodash.parseInt = parseInt;\n lodash.random = random;\n lodash.reduce = reduce;\n lodash.reduceRight = reduceRight;\n lodash.repeat = repeat;\n lodash.replace = replace;\n lodash.result = result;\n lodash.round = round;\n lodash.runInContext = runInContext;\n lodash.sample = sample;\n lodash.size = size;\n lodash.snakeCase = snakeCase;\n lodash.some = some;\n lodash.sortedIndex = sortedIndex;\n lodash.sortedIndexBy = sortedIndexBy;\n lodash.sortedIndexOf = sortedIndexOf;\n lodash.sortedLastIndex = sortedLastIndex;\n lodash.sortedLastIndexBy = sortedLastIndexBy;\n lodash.sortedLastIndexOf = sortedLastIndexOf;\n lodash.startCase = startCase;\n lodash.startsWith = startsWith;\n lodash.subtract = subtract;\n lodash.sum = sum;\n lodash.sumBy = sumBy;\n lodash.template = template;\n lodash.times = times;\n lodash.toFinite = toFinite;\n lodash.toInteger = toInteger;\n lodash.toLength = toLength;\n lodash.toLower = toLower;\n lodash.toNumber = toNumber;\n lodash.toSafeInteger = toSafeInteger;\n lodash.toString = toString;\n lodash.toUpper = toUpper;\n lodash.trim = trim;\n lodash.trimEnd = trimEnd;\n lodash.trimStart = trimStart;\n lodash.truncate = truncate;\n lodash.unescape = unescape;\n lodash.uniqueId = uniqueId;\n lodash.upperCase = upperCase;\n lodash.upperFirst = upperFirst;\n\n // Add aliases.\n lodash.each = forEach;\n lodash.eachRight = forEachRight;\n lodash.first = head;\n\n mixin(lodash, (function() {\n var source = {};\n baseForOwn(lodash, function(func, methodName) {\n if (!hasOwnProperty.call(lodash.prototype, methodName)) {\n source[methodName] = func;\n }\n });\n return source;\n }()), { 'chain': false });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The semantic version number.\n *\n * @static\n * @memberOf _\n * @type {string}\n */\n lodash.VERSION = VERSION;\n\n // Assign default placeholders.\n arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {\n lodash[methodName].placeholder = lodash;\n });\n\n // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.\n arrayEach(['drop', 'take'], function(methodName, index) {\n LazyWrapper.prototype[methodName] = function(n) {\n n = n === undefined ? 1 : nativeMax(toInteger(n), 0);\n\n var result = (this.__filtered__ && !index)\n ? new LazyWrapper(this)\n : this.clone();\n\n if (result.__filtered__) {\n result.__takeCount__ = nativeMin(n, result.__takeCount__);\n } else {\n result.__views__.push({\n 'size': nativeMin(n, MAX_ARRAY_LENGTH),\n 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')\n });\n }\n return result;\n };\n\n LazyWrapper.prototype[methodName + 'Right'] = function(n) {\n return this.reverse()[methodName](n).reverse();\n };\n });\n\n // Add `LazyWrapper` methods that accept an `iteratee` value.\n arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {\n var type = index + 1,\n isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;\n\n LazyWrapper.prototype[methodName] = function(iteratee) {\n var result = this.clone();\n result.__iteratees__.push({\n 'iteratee': getIteratee(iteratee, 3),\n 'type': type\n });\n result.__filtered__ = result.__filtered__ || isFilter;\n return result;\n };\n });\n\n // Add `LazyWrapper` methods for `_.head` and `_.last`.\n arrayEach(['head', 'last'], function(methodName, index) {\n var takeName = 'take' + (index ? 'Right' : '');\n\n LazyWrapper.prototype[methodName] = function() {\n return this[takeName](1).value()[0];\n };\n });\n\n // Add `LazyWrapper` methods for `_.initial` and `_.tail`.\n arrayEach(['initial', 'tail'], function(methodName, index) {\n var dropName = 'drop' + (index ? '' : 'Right');\n\n LazyWrapper.prototype[methodName] = function() {\n return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);\n };\n });\n\n LazyWrapper.prototype.compact = function() {\n return this.filter(identity);\n };\n\n LazyWrapper.prototype.find = function(predicate) {\n return this.filter(predicate).head();\n };\n\n LazyWrapper.prototype.findLast = function(predicate) {\n return this.reverse().find(predicate);\n };\n\n LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {\n if (typeof path == 'function') {\n return new LazyWrapper(this);\n }\n return this.map(function(value) {\n return baseInvoke(value, path, args);\n });\n });\n\n LazyWrapper.prototype.reject = function(predicate) {\n return this.filter(negate(getIteratee(predicate)));\n };\n\n LazyWrapper.prototype.slice = function(start, end) {\n start = toInteger(start);\n\n var result = this;\n if (result.__filtered__ && (start > 0 || end < 0)) {\n return new LazyWrapper(result);\n }\n if (start < 0) {\n result = result.takeRight(-start);\n } else if (start) {\n result = result.drop(start);\n }\n if (end !== undefined) {\n end = toInteger(end);\n result = end < 0 ? result.dropRight(-end) : result.take(end - start);\n }\n return result;\n };\n\n LazyWrapper.prototype.takeRightWhile = function(predicate) {\n return this.reverse().takeWhile(predicate).reverse();\n };\n\n LazyWrapper.prototype.toArray = function() {\n return this.take(MAX_ARRAY_LENGTH);\n };\n\n // Add `LazyWrapper` methods to `lodash.prototype`.\n baseForOwn(LazyWrapper.prototype, function(func, methodName) {\n var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),\n isTaker = /^(?:head|last)$/.test(methodName),\n lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],\n retUnwrapped = isTaker || /^find/.test(methodName);\n\n if (!lodashFunc) {\n return;\n }\n lodash.prototype[methodName] = function() {\n var value = this.__wrapped__,\n args = isTaker ? [1] : arguments,\n isLazy = value instanceof LazyWrapper,\n iteratee = args[0],\n useLazy = isLazy || isArray(value);\n\n var interceptor = function(value) {\n var result = lodashFunc.apply(lodash, arrayPush([value], args));\n return (isTaker && chainAll) ? result[0] : result;\n };\n\n if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {\n // Avoid lazy use if the iteratee has a \"length\" value other than `1`.\n isLazy = useLazy = false;\n }\n var chainAll = this.__chain__,\n isHybrid = !!this.__actions__.length,\n isUnwrapped = retUnwrapped && !chainAll,\n onlyLazy = isLazy && !isHybrid;\n\n if (!retUnwrapped && useLazy) {\n value = onlyLazy ? value : new LazyWrapper(this);\n var result = func.apply(value, args);\n result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });\n return new LodashWrapper(result, chainAll);\n }\n if (isUnwrapped && onlyLazy) {\n return func.apply(this, args);\n }\n result = this.thru(interceptor);\n return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;\n };\n });\n\n // Add `Array` methods to `lodash.prototype`.\n arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {\n var func = arrayProto[methodName],\n chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',\n retUnwrapped = /^(?:pop|shift)$/.test(methodName);\n\n lodash.prototype[methodName] = function() {\n var args = arguments;\n if (retUnwrapped && !this.__chain__) {\n var value = this.value();\n return func.apply(isArray(value) ? value : [], args);\n }\n return this[chainName](function(value) {\n return func.apply(isArray(value) ? value : [], args);\n });\n };\n });\n\n // Map minified method names to their real names.\n baseForOwn(LazyWrapper.prototype, function(func, methodName) {\n var lodashFunc = lodash[methodName];\n if (lodashFunc) {\n var key = lodashFunc.name + '';\n if (!hasOwnProperty.call(realNames, key)) {\n realNames[key] = [];\n }\n realNames[key].push({ 'name': methodName, 'func': lodashFunc });\n }\n });\n\n realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{\n 'name': 'wrapper',\n 'func': undefined\n }];\n\n // Add methods to `LazyWrapper`.\n LazyWrapper.prototype.clone = lazyClone;\n LazyWrapper.prototype.reverse = lazyReverse;\n LazyWrapper.prototype.value = lazyValue;\n\n // Add chain sequence methods to the `lodash` wrapper.\n lodash.prototype.at = wrapperAt;\n lodash.prototype.chain = wrapperChain;\n lodash.prototype.commit = wrapperCommit;\n lodash.prototype.next = wrapperNext;\n lodash.prototype.plant = wrapperPlant;\n lodash.prototype.reverse = wrapperReverse;\n lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;\n\n // Add lazy aliases.\n lodash.prototype.first = lodash.prototype.head;\n\n if (symIterator) {\n lodash.prototype[symIterator] = wrapperToIterator;\n }\n return lodash;\n });\n\n /*--------------------------------------------------------------------------*/\n\n // Export lodash.\n var _ = runInContext();\n\n // Some AMD build optimizers, like r.js, check for condition patterns like:\n if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {\n // Expose Lodash on the global object to prevent errors when Lodash is\n // loaded by a script tag in the presence of an AMD loader.\n // See http://requirejs.org/docs/errors.html#mismatch for more details.\n // Use `_.noConflict` to remove Lodash from the global object.\n root._ = _;\n\n // Define as an anonymous module so, through path mapping, it can be\n // referenced as the \"underscore\" module.\n define(function() {\n return _;\n });\n }\n // Check for `exports` after `define` in case a build optimizer adds it.\n else if (freeModule) {\n // Export for Node.js.\n (freeModule.exports = _)._ = _;\n // Export for CommonJS support.\n freeExports._ = _;\n }\n else {\n // Export to the global object.\n root._ = _;\n }\n}.call(this));\n","/**\n * Development and debugging configuration\n * Runtime-configurable settings for debugging and development\n */\n\nimport { debounce } from 'lodash'\n\n/**\n * Development configuration object\n * Can be modified at runtime from user code for debugging\n *\n * @example\n * ```typescript\n * import { DevConfig } from '@number10/phaserjsx'\n *\n * // Enable specific debug categories\n * DevConfig.debug.enabled = true\n * DevConfig.debug.layout = true\n *\n * // Customize visual debugging\n * DevConfig.visual.maskFillColor = 0xff00ff // Pink\n * DevConfig.visual.maskAlpha = 0.3 // Semi-transparent\n * ```\n */\nexport const DevConfig = {\n /**\n * Debug logging configuration\n * Controls console output for different subsystems\n */\n debug: {\n /**\n * Master switch - disables all debug output when false\n * @default false\n */\n enabled: false,\n\n /**\n * Detailed layout calculation logs\n * Shows container sizing, positioning, and flex distribution\n * @default false\n */\n layout: false,\n\n /**\n * Overflow mask positioning logs\n * Shows world coordinate calculations and mask updates\n * @default false\n */\n overflowMask: false,\n\n /**\n * Flex distribution calculations\n * Shows flex space allocation across children\n * @default false\n */\n flex: false,\n\n /**\n * Child sizing and positioning\n * Shows individual child dimension calculations\n * @default false\n */\n positioning: false,\n\n /**\n * VDOM mount/patch/unmount operations\n * Shows virtual DOM updates and reconciliation\n * @default false\n */\n vdom: false,\n\n /**\n * Performance timing measurements\n * Shows execution time for layout operations\n * @default false\n */\n performance: false,\n\n /**\n * Theme system logs\n * Shows theme registry updates and prop merging\n * @default false\n */\n theme: false,\n },\n\n /**\n * VDOM warnings and development checks\n * These help catch common mistakes that lead to performance issues\n */\n warnings: {\n /**\n * Warn when list items (siblings) don't have key props\n * Similar to React's \"Each child in a list should have a unique key prop\" warning\n * @default true (in development)\n */\n missingKeys: false, // temp disable because of detection issues, will re-enable later\n\n /**\n * Warn when props change causes full remount instead of update\n * Detects JSX/callback recreation that prevents VDOM optimization\n * @default true (in development)\n */\n unnecessaryRemounts: false,\n\n /**\n * Warn when VNodes are frozen/sealed and need copying\n * Happens in production builds or with certain bundler optimizations\n * @default false (usually only relevant in production)\n */\n frozenVNodes: false,\n },\n\n /**\n * Visual debugging aids\n * Runtime-configurable visual settings\n */\n visual: {\n /**\n * Show overflow mask areas\n * When true, masks are visible (alpha > 0) for debugging\n * @default false\n */\n showOverflowMasks: false,\n\n /**\n * Mask fill color\n * @default 0xffffff (white, invisible with alpha=0)\n * @example 0xff00ff (pink for debugging)\n */\n maskFillColor: 0xffffff,\n\n /**\n * Mask alpha transparency\n * @default 0.0 (invisible)\n * @example 0.3 (semi-transparent for debugging)\n */\n maskAlpha: 0.0,\n },\n\n /**\n * Performance tuning\n */\n performance: {\n /**\n * Enable deferred layout queue batching\n * When false, deferred updates execute immediately (not batched)\n * @default true\n */\n useDeferredQueue: true,\n\n /**\n * Log deferred queue statistics\n * Shows number of batched callbacks per frame\n * @default false\n */\n logQueueStats: false,\n },\n}\n\n/**\n * Debug logger with category support\n * Only logs when global debug is enabled AND category is enabled\n *\n * @example\n * ```typescript\n * DebugLogger.log('layout', 'Container size:', { width: 100, height: 200 })\n * // Only logs if DevConfig.debug.enabled && DevConfig.debug.layout\n * ```\n */\nexport class DebugLogger {\n /**\n * Debounced console.log instances per category-message combination\n */\n private static debouncedLoggers = new Map<string, (...args: unknown[]) => void>()\n\n /**\n * Log a message with category filtering and debouncing\n * @param category - Debug category to check\n * @param message - Message to log\n * @param args - Additional arguments to log (only first element is used)\n */\n static log(category: keyof typeof DevConfig.debug, message: string, ...args: unknown[]): void {\n if (!DevConfig.debug.enabled) return\n if (category !== 'enabled' && !DevConfig.debug[category]) return\n\n const key = `${String(category)}:${message}`\n let debouncedLog = this.debouncedLoggers.get(key)\n\n // console.log(`[${category}] ${message}`, args[0])\n\n if (!debouncedLog) {\n debouncedLog = debounce(() => {\n console.log(`[${category}] ${message}`, args[0])\n }, 300)\n this.debouncedLoggers.set(key, debouncedLog)\n }\n\n debouncedLog()\n }\n\n /**\n * Log a warning message (always shown, even if debug disabled)\n * @param category - Category for context\n * @param message - Warning message\n * @param args - Additional arguments\n */\n static warn(category: string, message: string, ...args: unknown[]): void {\n console.warn(`[${category}] ${message}`, ...args)\n }\n\n /**\n * Log an error message (always shown, even if debug disabled)\n * @param category - Category for context\n * @param message - Error message\n * @param args - Additional arguments\n */\n static error(category: string, message: string, ...args: unknown[]): void {\n console.error(`[${category}] ${message}`, ...args)\n }\n\n /**\n * Start a performance timer\n * @param category - Debug category to check\n * @param label - Timer label\n */\n static time(category: keyof typeof DevConfig.debug, label: string): void {\n if (!DevConfig.debug.enabled) return\n if (category !== 'enabled' && !DevConfig.debug[category]) return\n\n console.time(`[${category}] ${label}`)\n }\n\n /**\n * End a performance timer\n * @param category - Debug category to check\n * @param label - Timer label\n */\n static timeEnd(category: keyof typeof DevConfig.debug, label: string): void {\n if (!DevConfig.debug.enabled) return\n if (category !== 'enabled' && !DevConfig.debug[category]) return\n\n console.timeEnd(`[${category}] ${label}`)\n }\n}\n\n/**\n * Predefined configuration presets for common debugging scenarios\n *\n * @example\n * ```typescript\n * import { DevPresets } from '@number10/phaserjsx'\n *\n * // Quick activation of overflow debugging\n * DevPresets.debugOverflow()\n *\n * // Revert to production settings\n * DevPresets.production()\n * ```\n */\nexport const DevPresets = {\n /**\n * Production configuration\n * All debugging disabled, optimal performance\n */\n production: (): void => {\n DevConfig.debug.enabled = false\n DevConfig.visual.showOverflowMasks = false\n DevConfig.visual.maskAlpha = 0.0\n DevConfig.visual.maskFillColor = 0xffffff\n DevConfig.performance.logQueueStats = false\n },\n\n /**\n * Debug layout issues\n * Enables layout, positioning, and flex logs\n */\n debugLayout: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.layout = true\n DevConfig.debug.positioning = true\n DevConfig.debug.flex = true\n // Keep other categories off\n DevConfig.debug.overflowMask = false\n DevConfig.debug.vdom = false\n DevConfig.debug.performance = false\n },\n\n /**\n * Debug overflow masking\n * Enables overflow logs and makes masks visible\n */\n debugOverflow: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.overflowMask = true\n DevConfig.visual.showOverflowMasks = true\n DevConfig.visual.maskFillColor = 0xff00ff // Pink\n DevConfig.visual.maskAlpha = 0.3 // Semi-transparent\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.vdom = false\n DevConfig.debug.performance = false\n },\n\n /**\n * Performance profiling\n * Enables performance timing and queue statistics\n */\n profilePerformance: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.performance = true\n DevConfig.performance.logQueueStats = true\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.overflowMask = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.vdom = false\n },\n\n /**\n * Debug VDOM operations\n * Enables virtual DOM mount/patch/unmount logs\n */\n debugVDOM: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.vdom = true\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.overflowMask = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.performance = false\n },\n\n debugTheme: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.theme = true\n // Keep other categories off\n DevConfig.debug.layout = false\n DevConfig.debug.overflowMask = false\n DevConfig.debug.positioning = false\n DevConfig.debug.flex = false\n DevConfig.debug.performance = false\n DevConfig.debug.vdom = false\n },\n\n /**\n * Enable all debug categories (verbose!)\n * Use with caution - produces lots of console output\n */\n debugAll: (): void => {\n DevConfig.debug.enabled = true\n DevConfig.debug.layout = true\n DevConfig.debug.overflowMask = true\n DevConfig.debug.flex = true\n DevConfig.debug.positioning = true\n DevConfig.debug.vdom = true\n DevConfig.debug.performance = true\n DevConfig.visual.showOverflowMasks = true\n DevConfig.visual.maskFillColor = 0xff00ff\n DevConfig.visual.maskAlpha = 0.3\n DevConfig.performance.logQueueStats = true\n },\n}\n","/**\n * Viewport context - provides screen/canvas dimensions to all components\n * Enables viewport-relative units (vw, vh) in layout calculations\n */\nimport type { ParentType } from './types'\n\n/**\n * Viewport dimensions\n */\nexport interface ViewportSize {\n width: number\n height: number\n}\n\n/**\n * Viewport registry - stores current viewport dimensions\n * Similar to themeRegistry pattern\n */\nclass ViewportRegistry {\n private viewport: ViewportSize = { width: 800, height: 600 }\n private parent: ParentType | undefined\n\n /**\n * Update viewport dimensions\n * @param width - Viewport width in pixels\n * @param height - Viewport height in pixels\n * @param parent - Optional Phaser scene reference\n */\n setViewport(width: number, height: number, parent?: ParentType): void {\n this.viewport = { width, height }\n this.parent = parent\n }\n\n /**\n * Get current viewport dimensions\n * @returns Current viewport size\n */\n getViewport(): ViewportSize {\n return this.viewport\n }\n\n /**\n * Get Phaser scene reference\n * @returns Scene or undefined\n */\n getParent(): ParentType | undefined {\n return this.parent\n }\n}\n\n/**\n * Global viewport registry instance\n */\nexport const viewportRegistry = new ViewportRegistry()\n","/**\n * Size resolution utilities for handling different size value types\n * Supports fixed pixels, percentages, viewport units (vw/vh), auto sizing, and calc() expressions\n */\nimport { DebugLogger } from '../../dev-config'\nimport { viewportRegistry } from '../../viewport-context'\nimport type { CalcExpression, CalcOperand, ParsedSize } from '../types'\n\n// Re-export for convenience\nexport type { ParsedSize } from '../types'\n\n/**\n * Cache for parseSize results to avoid repeated string parsing\n * Key: original size value, Value: parsed size object\n */\nconst parseSizeCache = new Map<unknown, ParsedSize>()\n\n/**\n * Set of size values that already triggered a warning\n * Prevents console spam from repeated warnings for the same invalid value\n */\nconst warnedSizes = new Set<string>()\n\n/**\n * Parse a calc operand (e.g., \"50%\" or \"20px\" or \"100vw\")\n * @param operand - String operand from calc expression\n * @returns Parsed operand\n */\nfunction parseCalcOperand(operand: string): CalcOperand {\n const trimmed = operand.trim()\n\n // Percentage: \"50%\"\n const percentMatch = trimmed.match(/^(\\d+(?:\\.\\d+)?)%$/)\n if (percentMatch && percentMatch[1]) {\n return { type: 'percent', value: parseFloat(percentMatch[1]) }\n }\n\n // Viewport width: \"100vw\"\n const vwMatch = trimmed.match(/^(\\d+(?:\\.\\d+)?)vw$/)\n if (vwMatch && vwMatch[1]) {\n return { type: 'vw', value: parseFloat(vwMatch[1]) }\n }\n\n // Viewport height: \"100vh\"\n const vhMatch = trimmed.match(/^(\\d+(?:\\.\\d+)?)vh$/)\n if (vhMatch && vhMatch[1]) {\n return { type: 'vh', value: parseFloat(vhMatch[1]) }\n }\n\n // Fixed pixels: \"20px\" or \"20\"\n const pixelMatch = trimmed.match(/^(-?\\d+(?:\\.\\d+)?)(?:px)?$/)\n if (pixelMatch && pixelMatch[1]) {\n return { type: 'fixed', value: parseFloat(pixelMatch[1]) }\n }\n\n throw new Error(`[Size] Invalid calc operand: \"${operand}\"`)\n}\n\n/**\n * Parse a calc() expression\n * @param expr - Calc expression string without \"calc(\" prefix\n * @returns Parsed calc expression\n */\nfunction parseCalcExpression(expr: string): CalcExpression {\n // Remove spaces\n expr = expr.replace(/\\s+/g, '')\n\n // Simple recursive parser for calc expressions\n function parseExpression(str: string): CalcExpression | CalcOperand {\n str = str.trim()\n\n // Handle parentheses\n if (str.startsWith('(') && str.endsWith(')')) {\n return parseExpression(str.slice(1, -1))\n }\n\n // Check if it's just an operand\n try {\n return parseCalcOperand(str)\n } catch {\n // Not an operand, continue parsing\n }\n\n // Find operators, respecting precedence: * / before + -\n const operators = ['+', '-', '*', '/']\n let parenDepth = 0\n let lastOpIndex = -1\n let lastOp = ''\n\n for (let i = str.length - 1; i >= 0; i--) {\n const char = str.charAt(i)\n if (char === ')') parenDepth++\n else if (char === '(') parenDepth--\n else if (parenDepth === 0 && operators.includes(char)) {\n // Check precedence: prefer * / over + -\n if (char === '*' || char === '/' || (lastOp !== '*' && lastOp !== '/')) {\n lastOpIndex = i\n lastOp = char\n if (char === '+' || char === '-') break // Lowest precedence, stop here\n }\n }\n }\n\n if (lastOpIndex === -1) {\n throw new Error(`[Size] No valid operator found in calc expression: \"${str}\"`)\n }\n\n const leftStr = str.slice(0, lastOpIndex)\n const rightStr = str.slice(lastOpIndex + 1)\n\n if (!leftStr || !rightStr) {\n throw new Error(`[Size] Invalid calc expression: \"${str}\"`)\n }\n\n return {\n left: parseExpression(leftStr),\n operator: lastOp as '+' | '-' | '*' | '/',\n right: parseExpression(rightStr),\n }\n }\n\n return parseExpression(expr) as CalcExpression\n}\n\n/**\n * Parse a size value into its components\n * Results are cached to avoid repeated string parsing during layout calculations\n * @param size - Size value (number, string, or undefined)\n * @returns Parsed size information\n * @throws Error if string format is invalid\n *\n * @example\n * parseSize(100) // { type: 'fixed', value: 100 }\n * parseSize('50%') // { type: 'percent', value: 50 }\n * parseSize('calc(100% - 40px)') // { type: 'calc', calc: {...} }\n * parseSize(undefined) // { type: 'auto' }\n * parseSize('auto') // { type: 'auto' }\n */\nexport function parseSize(size: number | string | undefined): ParsedSize {\n // Debug: Track parseSize call frequency\n // console.log('parseSize called:', size)\n\n // Check cache first (huge performance win for repeated calls)\n const cached = parseSizeCache.get(size)\n if (cached !== undefined) {\n return cached\n }\n\n // Parse the size value\n const result = parseSizeInternal(size)\n\n // Cache the result for future calls\n parseSizeCache.set(size, result)\n\n return result\n}\n\n/**\n * Internal parsing logic for size values\n * Separated to allow caching in parseSize()\n * @param size - Size value to parse\n * @returns Parsed size information\n */\nfunction parseSizeInternal(size: number | string | undefined): ParsedSize {\n // undefined -> auto (dynamic based on content)\n if (size === undefined) {\n return { type: 'auto' }\n }\n\n // number -> fixed pixel value\n if (typeof size === 'number') {\n return { type: 'fixed', value: size }\n }\n\n // string -> parse format\n if (size === 'auto') {\n return { type: 'auto' }\n }\n\n if (size === 'fill') {\n return { type: 'fill' }\n }\n\n // Calc expression: \"calc(100% - 40px)\"\n const calcMatch = size.match(/^calc\\((.+)\\)$/)\n if (calcMatch && calcMatch[1]) {\n return { type: 'calc', calc: parseCalcExpression(calcMatch[1]) }\n }\n\n // Percentage format: \"50%\", \"75.5%\", \"100%\"\n const percentMatch = size.match(/^(\\d+(?:\\.\\d+)?)%$/)\n if (percentMatch && percentMatch[1]) {\n const value = parseFloat(percentMatch[1])\n if (value < 0 || value > 100) {\n // Only warn once per unique invalid value to prevent console spam\n const warnKey = `percent:${value}`\n if (!warnedSizes.has(warnKey)) {\n warnedSizes.add(warnKey)\n DebugLogger.warn('Size', `Percentage value ${value}% is outside valid range (0-100%)`)\n }\n }\n return { type: 'percent', value }\n }\n\n // Viewport width: \"100vw\", \"50vw\"\n const vwMatch = size.match(/^(\\d+(?:\\.\\d+)?)vw$/)\n if (vwMatch && vwMatch[1]) {\n return { type: 'vw', value: parseFloat(vwMatch[1]) }\n }\n\n // Viewport height: \"100vh\", \"50vh\"\n const vhMatch = size.match(/^(\\d+(?:\\.\\d+)?)vh$/)\n if (vhMatch && vhMatch[1]) {\n return { type: 'vh', value: parseFloat(vhMatch[1]) }\n }\n\n // Unknown format\n throw new Error(\n `[Size] Invalid size format: \"${size}\". Supported formats: number, \"X%\", \"XvW\", \"Xvh\", \"calc(...)\", \"auto\", \"fill\", undefined`\n )\n}\n\n/**\n * Resolve a calc operand to pixel value\n * @param operand - Calc operand or sub-expression\n * @param parentSize - Parent dimension for percentage resolution\n * @param viewportSize - Viewport dimensions for vw/vh resolution\n * @returns Resolved pixel value\n */\nfunction resolveCalcOperand(\n operand: CalcOperand | CalcExpression,\n parentSize?: number,\n viewportSize?: { width: number; height: number }\n): number {\n if ('type' in operand) {\n // It's a CalcOperand\n if (operand.type === 'fixed') {\n return operand.value\n }\n\n // Percentage\n if (operand.type === 'percent') {\n if (parentSize === undefined) {\n return 0\n }\n return (parentSize * operand.value) / 100\n }\n\n // Viewport width\n if (operand.type === 'vw') {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vw without viewport size. Using 0.')\n return 0\n }\n return (viewport.width * operand.value) / 100\n }\n\n // Viewport height\n if (operand.type === 'vh') {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vh without viewport size. Using 0.')\n return 0\n }\n return (viewport.height * operand.value) / 100\n }\n\n return 0\n } else {\n // It's a CalcExpression\n return resolveCalcExpression(operand, parentSize, viewportSize)\n }\n}\n\n/**\n * Resolve a calc expression to pixel value\n * @param calc - Calc expression\n * @param parentSize - Parent dimension for percentage resolution\n * @param viewportSize - Viewport dimensions for vw/vh resolution\n * @returns Resolved pixel value\n */\nfunction resolveCalcExpression(\n calc: CalcExpression,\n parentSize?: number,\n viewportSize?: { width: number; height: number }\n): number {\n const left = resolveCalcOperand(calc.left, parentSize, viewportSize)\n const right = resolveCalcOperand(calc.right, parentSize, viewportSize)\n\n switch (calc.operator) {\n case '+':\n return left + right\n case '-':\n return left - right\n case '*':\n return left * right\n case '/':\n if (right === 0) {\n DebugLogger.error('Size', 'Division by zero in calc expression')\n return 0\n }\n return left / right\n default:\n DebugLogger.error('Size', `Unknown calc operator: ${calc.operator}`)\n return 0\n }\n}\n\n/**\n * Resolve a parsed size to actual pixel value\n * @param parsed - Parsed size information\n * @param parentSize - Parent dimension in pixels (required for percentage and calc)\n * @param contentSize - Content dimension in pixels (fallback for auto)\n * @param parentPadding - Parent padding in the relevant direction (for fill)\n * @param viewportSize - Viewport dimensions for vw/vh resolution\n * @returns Resolved size in pixels\n *\n * @example\n * resolveSize({ type: 'fixed', value: 100 }, 200) // 100\n * resolveSize({ type: 'percent', value: 50 }, 200) // 100 (50% of 200)\n * resolveSize({ type: 'vw', value: 100 }, undefined, undefined, undefined, viewport) // viewport.width\n * resolveSize({ type: 'vh', value: 50 }, undefined, undefined, undefined, viewport) // viewport.height * 0.5\n * resolveSize({ type: 'calc', calc: {...} }, 200) // calc result\n * resolveSize({ type: 'auto' }, 200, 150) // 150 (content size)\n * resolveSize({ type: 'fill' }, 200, undefined, 40) // 160 (200 - 40)\n */\nexport function resolveSize(\n parsed: ParsedSize,\n parentSize?: number,\n contentSize?: number,\n parentPadding?: number,\n viewportSize?: { width: number; height: number }\n): number {\n switch (parsed.type) {\n case 'fixed':\n return parsed.value ?? 100\n\n case 'percent':\n if (parentSize === undefined) {\n // Only warn if we also don't have a fallback content size\n if (contentSize === undefined) {\n DebugLogger.warn(\n 'Size',\n 'Cannot resolve percentage without parent size and no content fallback.'\n )\n return 100\n }\n // Parent size will be available in next layout pass - use content size for now\n return contentSize\n }\n return (parentSize * (parsed.value ?? 0)) / 100\n\n case 'vw': {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vw without viewport size. Using fallback 100px')\n return 100\n }\n return (viewport.width * (parsed.value ?? 0)) / 100\n }\n\n case 'vh': {\n const viewport = viewportSize || viewportRegistry.getViewport()\n if (!viewport) {\n DebugLogger.warn('Size', 'Cannot resolve vh without viewport size. Using fallback 100px')\n return 100\n }\n return (viewport.height * (parsed.value ?? 0)) / 100\n }\n\n case 'calc':\n if (!parsed.calc) {\n DebugLogger.error('Size', 'Calc type without calc expression')\n return 100\n }\n return resolveCalcExpression(parsed.calc, parentSize, viewportSize)\n\n case 'auto':\n if (contentSize === undefined) {\n DebugLogger.warn('Size', 'Auto size without content size, using fallback 100px')\n return 100\n }\n return contentSize\n\n case 'fill': {\n if (parentSize === undefined) {\n // this would be possible at startup before parent sizes are known, therefore just return 0\n // DebugLogger.warn('Size', 'Fill size without parent size, using fallback 0px')\n return 0\n }\n // Fill = parent size minus padding (content-area)\n if (parentPadding !== undefined && parentPadding > 0) {\n return Math.max(0, parentSize - parentPadding)\n }\n // No padding or already content-area\n return parentSize\n }\n\n default:\n // Should never happen with proper typing\n DebugLogger.error('Size', `Unknown size type: ${(parsed as ParsedSize).type}`)\n return 100\n }\n}\n\n/**\n * Clear the parseSize cache and warning deduplication set\n * Useful for testing or memory management in long-running applications\n *\n * @example\n * ```typescript\n * // Clear caches after major UI rebuild\n * clearSizeCaches()\n * ```\n */\nexport function clearSizeCaches(): void {\n parseSizeCache.clear()\n warnedSizes.clear()\n}\n\n/**\n * Check if a calc expression requires parent context\n * @param calc - Calc expression\n * @returns True if expression contains percentages\n */\nfunction calcRequiresParent(calc: CalcExpression): boolean {\n const checkOperand = (op: CalcOperand | CalcExpression): boolean => {\n if ('type' in op) {\n return op.type === 'percent'\n } else {\n return calcRequiresParent(op)\n }\n }\n return checkOperand(calc.left) || checkOperand(calc.right)\n}\n\n/**\n * Check if a size needs parent context to resolve\n * @param parsed - Parsed size information\n * @returns True if size requires parent dimension\n */\nexport function requiresParent(parsed: ParsedSize): boolean {\n if (parsed.type === 'percent' || parsed.type === 'fill') {\n return true\n }\n\n // Calc expressions might contain percentages\n if (parsed.type === 'calc' && parsed.calc) {\n return calcRequiresParent(parsed.calc)\n }\n\n return false\n}\n\n/**\n * Check if a size can be determined without content measurement\n * @param parsed - Parsed size information\n * @returns True if size is explicitly defined (not auto)\n */\nexport function isExplicit(parsed: ParsedSize): boolean {\n return (\n parsed.type === 'fixed' ||\n parsed.type === 'percent' ||\n parsed.type === 'vw' ||\n parsed.type === 'vh' ||\n parsed.type === 'calc' ||\n parsed.type === 'fill'\n )\n}\n\n/**\n * Clamp a size value to min/max constraints\n * Min/max constraints can be SizeValue (pixels, percentage, viewport units, calc)\n * They are resolved relative to the same parent/viewport context as the size itself\n *\n * @param size - Resolved size in pixels\n * @param minSize - Minimum size constraint (SizeValue or undefined = no constraint)\n * @param maxSize - Maximum size constraint (SizeValue or undefined = no constraint)\n * @param parentSize - Parent dimension for percentage resolution in constraints\n * @param fallbackSize - Fallback size for auto constraints (not typically used for min/max)\n * @param parentPadding - Parent padding for fill constraints (not typically used for min/max)\n * @returns Clamped size in pixels\n *\n * @example\n * clampSize(150, 100, 200) // 150 (within bounds)\n * clampSize(50, 100, 200) // 100 (clamped to min)\n * clampSize(300, 100, 200) // 200 (clamped to max)\n * clampSize(150, undefined, \"80%\", 1000) // 150 (max = 800px)\n * clampSize(1000, undefined, \"80%\", 1000) // 800 (clamped to 80% of parent)\n */\nexport function clampSize(\n size: number,\n minSize?: number | string,\n maxSize?: number | string,\n parentSize?: number,\n fallbackSize?: number,\n parentPadding?: number\n): number {\n let clamped = size\n\n // Resolve and apply minimum constraint\n if (minSize !== undefined) {\n const parsedMin = parseSize(minSize)\n const resolvedMin = resolveSize(parsedMin, parentSize, fallbackSize, parentPadding)\n if (clamped < resolvedMin) {\n clamped = resolvedMin\n }\n }\n\n // Resolve and apply maximum constraint\n if (maxSize !== undefined) {\n const parsedMax = parseSize(maxSize)\n const resolvedMax = resolveSize(parsedMax, parentSize, fallbackSize, parentPadding)\n if (clamped > resolvedMax) {\n clamped = resolvedMax\n }\n }\n\n return clamped\n}\n","/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport equal from 'fast-deep-equal'\nimport type { TextSpecificProps } from '../../core-props'\nimport { parseSize, resolveSize } from '../../layout/utils/size-resolver'\nimport { viewportRegistry } from '../../viewport-context'\n\n/**\n * Generic node type with text capabilities\n */\ntype TextNode = {\n setText: (text: string) => void\n setStyle: (style: object) => void\n setWordWrapWidth: (width: number, useAdvancedWrap: boolean) => void\n updateText?: () => void // Force Phaser to recalculate text metrics immediately\n active?: boolean // Check if GameObject is still active\n scene?: Phaser.Scene // Access to scene for texture checks\n}\n\n/**\n * Applies text-specific properties (text content, color, font, alignment)\n * @param node - Phaser Text GameObject\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextProps<T extends TextNode>(\n node: T,\n prev: Partial<\n TextSpecificProps & { style?: Phaser.Types.GameObjects.Text.TextStyle | undefined }\n >,\n next: Partial<TextSpecificProps & { style?: Phaser.Types.GameObjects.Text.TextStyle | undefined }>\n): void {\n // Safety check: Ensure node is still active and scene is available\n if (node.active === false || (node.scene && !node.scene.sys.game)) {\n return\n }\n\n let needsUpdate = false\n\n // Text content\n if (prev.text !== next.text && typeof next.text === 'string') {\n node.setText(next.text)\n needsUpdate = true\n }\n\n // Apply style changes if the style object changed\n if (next.style !== undefined && !equal(next.style, prev.style || {})) {\n // Guard against Phaser canvas context errors during theme updates\n try {\n node.setStyle(next.style)\n needsUpdate = true\n } catch (error) {\n console.warn('Failed to apply text style (scene may be transitioning):', error)\n }\n }\n\n // Word wrap width - resolve SizeValue to pixels\n if (next.maxWidth !== prev.maxWidth && next.maxWidth !== undefined) {\n const viewport = viewportRegistry.getViewport()\n const parsedMaxWidth = parseSize(next.maxWidth)\n const resolvedMaxWidth = resolveSize(parsedMaxWidth, viewport?.width, undefined, undefined)\n node.setWordWrapWidth(resolvedMaxWidth, true)\n needsUpdate = true\n }\n\n // Legacy: Support direct Phaser style object\n if (prev.style !== next.style && next.style !== undefined) {\n try {\n node.setStyle(next.style)\n needsUpdate = true\n } catch (error) {\n console.warn('Failed to apply text style (scene may be transitioning):', error)\n }\n }\n\n // Force Phaser to recalculate text metrics immediately\n // This ensures getBounds() returns updated dimensions for layout calculations\n if (needsUpdate && node.updateText) {\n node.updateText()\n }\n}\n","/**\n * Layout applier for text components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { TextBaseProps } from '../primitives/text'\n\n/**\n * Applies layout properties for text components\n * Updates layout props and size provider when text or style changes\n * @param text - Phaser text object\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyTextLayout(\n text: Phaser.GameObjects.Text & {\n __layoutProps?: TextBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n _prev: Partial<TextBaseProps>,\n next: Partial<TextBaseProps>\n): void {\n // Update layout props to trigger parent layout recalculation\n text.__layoutProps = next as TextBaseProps\n\n // ALWAYS recreate size provider to ensure VDOM detects size changes\n // Even if function reference changes, VDOM needs to know dimensions might have changed\n // Previously: Only updated if text/style changed - this caused layout not to recalculate\n // when text dimensions changed (e.g., \"9 times\" -> \"10 times\")\n text.__getLayoutSize = () => {\n if (text.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: text.width,\n height: text.height,\n }\n }\n}\n","/**\n * Layout creator for text components\n */\nimport type Phaser from 'phaser'\nimport type { LayoutSize } from '../../layout/index'\nimport type { TextBaseProps } from '../primitives/text'\n\n/**\n * Creates layout infrastructure for a text component\n * Attaches layout props and dynamic size provider\n * @param text - Phaser text object\n * @param props - Text props including layout\n */\nexport function createTextLayout(\n text: Phaser.GameObjects.Text & {\n __layoutProps?: TextBaseProps\n __getLayoutSize?: () => LayoutSize\n },\n props: Partial<TextBaseProps>\n): void {\n // Attach layout props for layout calculations\n text.__layoutProps = props as TextBaseProps\n\n // Attach dynamic size provider\n // Headless text returns minimal size 1x1 (participates in alignment, not spacing)\n // Note: 0x0 causes issues with Phaser internals or layout optimizations\n // Layout-aware text returns actual dimensions (rotation ignored for layout)\n text.__getLayoutSize = () => {\n if (text.__layoutProps?.headless) {\n return { width: 0.01, height: 0.01 }\n }\n return {\n width: text.width,\n height: text.height,\n }\n }\n}\n","/**\n * Text component - Phaser Text GameObject for rendering text\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: TEXT RENDERING\n * Purpose: Display styled text in UI layouts\n * Phaser Type: Phaser.GameObjects.Text (bitmap-based text rendering)\n * Characteristics:\n * - Layout-aware by default (participates in parent layout)\n * - Auto-sizing based on text content + font metrics\n * - Supports Phaser text styling (color, font, alignment, etc.)\n *\n * 2. Headless Default: FALSE ✅\n * Decision: Text participates in layout by default\n * Reasoning:\n * - Text is a UI element (labels, paragraphs, buttons)\n * - Should affect parent container dimensions\n * - Similar to HTML text nodes\n * Use Cases:\n * - ✅ Layout-aware (default): Labels, buttons, paragraphs, UI text\n * - ❌ Headless (optional): Floating damage numbers, debug text, tooltips\n * Usage:\n * <Text text=\"Label\" /> // Layout-aware\n * <Text text=\"+100\" headless={true} /> // Floating (no layout impact)\n *\n * 3. Layout Size Provider: UN-ROTATED DIMENSIONS ✅\n * Implementation: Uses text.width and text.height (un-rotated)\n * Behavior:\n * - Returns un-rotated text dimensions\n * - Rotation is IGNORED for layout-aware text (headless=false)\n * - Rotation only works with headless=true (no layout impact)\n * Reasoning:\n * - Flow layout is incompatible with rotation (causes positioning issues)\n * - Rotated text would overlap siblings in flow layout\n * - getBounds() position compensation is complex and error-prone\n * Example:\n * <Text text=\"Hello\" /> // ✅ Layout size: 100x20\n * <Text text=\"World\" rotation={Math.PI/4} /> // ⚠️ Rotation IGNORED, size: 100x20\n * <Text text=\"World\" rotation={Math.PI/4} headless={true} /> // ✅ Rotated, no layout\n * Recommendation: Use rotation only with headless=true or absolute positioning\n *\n * 4. Text Content & Styling:\n * Props:\n * - text: string (required, the text to display)\n * - style: Phaser.Types.GameObjects.Text.TextStyle (font, color, etc.)\n * - fontStyle, align, maxWidth: Convenience props (legacy)\n * Styling Priority:\n * 1. Inline style prop (highest)\n * 2. Individual props (fontStyle, align)\n * 3. Theme defaults (lowest)\n * Example:\n * <Text\n * text=\"Hello\"\n * style={{ fontSize: '24px', color: '#ffffff', fontFamily: 'Arial' }}\n * />\n *\n * 5. Margin Support:\n * Feature: Text supports margin prop (unique among primitives)\n * Reasoning:\n * - Text often needs spacing from siblings (inline elements)\n * - Margin affects layout calculations (added to text dimensions)\n * - Similar to CSS inline element margin\n * Usage:\n * <Text text=\"Label\" margin={{ left: 10, right: 10 }} />\n * <Text text=\"Spaced\" margin={8} /> // All sides\n *\n * 6. Layout Behavior:\n * Sizing:\n * - Auto-size: Text dimensions = rendered text bounds (default)\n * - No explicit width/height props (text size determined by content)\n * - maxWidth prop wraps text (Phaser feature)\n * Positioning:\n * - Positioned by parent layout engine (flexbox-style)\n * - x/y props override layout position (absolute positioning)\n *\n * 7. Origin Behavior:\n * Current: Phaser default origin (0, 0) - top-left\n * Reasoning:\n * - Text aligns naturally with layout flow\n * - Top-left origin simplifies position calculations\n * - Consistent with HTML text rendering\n * Note: Origin affects rotation pivot (if rotation applied)\n *\n * 8. Common Patterns:\n * Label:\n * <View direction=\"row\" gap={10}>\n * <Text text=\"Name:\" />\n * <Text text={userName} />\n * </View>\n * Styled Text:\n * <Text\n * text=\"Title\"\n * style={{ fontSize: '32px', fontWeight: 'bold', color: '#ff0000' }}\n * />\n * Wrapped Text:\n * <Text text={longParagraph} maxWidth={300} />\n * Floating Damage:\n * <Text text=\"-50 HP\" headless={true} alpha={0.8} />\n *\n * 9. Performance Considerations:\n * - Text rendering is relatively expensive (canvas-based)\n * - Frequent text changes trigger re-render\n * - Long text with maxWidth: word-wrap calculation cost\n * - Consider BitmapText for better performance (future component)\n * - Text batching: Multiple Text objects don't batch (separate draw calls)\n *\n * 10. Known Limitations:\n * - Rotation only supported with headless=true (ignored for layout-aware text)\n * → Flow layout is incompatible with rotation\n * - No rich text support (HTML tags, colors within text)\n * - Limited text effects (no shadows, outlines in base component)\n * - WordWrap with maxWidth: Can't specify ellipsis truncation\n * - Changing text frequently: Performance impact\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Text creation with style support\n * [✅] Transform props (position, scale, alpha)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Margin support (unique feature)\n * [✅] Text content and style patching\n * [✅] Theme system integration\n * [⚠️] Rotation - Only with headless=true (ignored for layout-aware text)\n * [❌] Rich text support - Future feature\n * [❌] Text effects (shadow, outline) - Future feature\n */\nimport type Phaser from 'phaser'\nimport type {\n EdgeInsets,\n LayoutProps,\n PhaserProps,\n TextSpecificProps,\n TransformProps,\n} from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTextProps } from '../appliers/applyText'\nimport { applyTextLayout } from '../appliers/applyTextLayout'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTextLayout } from '../creators/createTextLayout'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Base props for Text - composing shared prop groups\n * Includes optional margin for layout engine use\n */\nexport interface TextBaseProps\n extends TransformProps,\n PhaserProps,\n Pick<LayoutProps, 'headless'>,\n TextSpecificProps {\n margin?: EdgeInsets\n // Legacy: support Phaser's style object directly\n style?: Phaser.Types.GameObjects.Text.TextStyle | undefined\n}\n\n/**\n * Props for Text component - extends base props with JSX-specific props\n */\nexport interface TextProps extends TextBaseProps, PropsDefaultExtension<Phaser.GameObjects.Text> {}\n\n/**\n * Text creator - creates a Phaser Text object\n */\nexport const textCreator: HostCreator<'Text'> = (scene, props) => {\n const text = scene.add.text(props.x ?? 0, props.y ?? 0, props.text ?? '', props.style)\n\n // Set origin based on headless flag\n // Headless: (0.5, 0.5) - centered, works naturally with rotation/scale\n // Layout-aware: (0, 0) - top-left, aligns with layout flow\n if (props.headless) {\n text.setOrigin(0.5, 0.5)\n } else {\n text.setOrigin(0, 0)\n }\n\n // Normalize props for headless objects\n // Headless objects are positioned as points - no spacing or rotation constraints\n const normalizedProps = { ...props } as Record<string, unknown>\n if (props.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedProps.padding\n delete normalizedProps.margin\n delete normalizedProps.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedProps.rotation !== undefined) {\n delete normalizedProps.rotation\n }\n }\n\n // Apply transform props (scale, rotation if headless)\n createTransform(text, normalizedProps)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(text, normalizedProps)\n\n // Setup layout system (props and size provider)\n createTextLayout(text, normalizedProps)\n\n return text\n}\n\n/**\n * Text patcher - updates Text properties\n */\nexport const textPatcher: HostPatcher<'Text'> = (node, prev, next) => {\n // Update origin if headless flag changed\n if (prev.headless !== next.headless) {\n if (next.headless) {\n node.setOrigin(0.5, 0.5) // Headless: centered\n } else {\n node.setOrigin(0, 0) // Layout-aware: top-left\n }\n }\n\n // Normalize props for headless objects\n const normalizedPrev = { ...prev } as Record<string, unknown>\n const normalizedNext = { ...next } as Record<string, unknown>\n\n if (next.headless) {\n // Remove spacing props (headless = positioned as point)\n delete normalizedNext.padding\n delete normalizedNext.margin\n delete normalizedNext.gap\n } else {\n // Remove rotation (only supported with headless=true)\n if (normalizedNext.rotation !== undefined) {\n delete normalizedNext.rotation\n }\n }\n\n if (prev.headless) {\n delete normalizedPrev.padding\n delete normalizedPrev.margin\n delete normalizedPrev.gap\n } else {\n if (normalizedPrev.rotation !== undefined) {\n delete normalizedPrev.rotation\n }\n }\n\n // Apply transform props (position, rotation only if headless, scale)\n applyTransformProps(node, normalizedPrev, normalizedNext)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, normalizedPrev, normalizedNext)\n\n // Apply text-specific props (text content, color, font, etc.)\n applyTextProps(node, normalizedPrev, normalizedNext)\n\n // Apply layout props and update size provider if needed\n applyTextLayout(node, normalizedPrev, normalizedNext)\n}\n","/**\n * TileSprite component - Phaser TileSprite GameObject (repeating texture pattern)\n * Status: DUMMY - Not implemented yet\n *\n * Design Decisions & Answers:\n * ===========================\n *\n * 1. Headless Default: TRUE ✅\n * Rationale: TileSprites are typically backgrounds/patterns (decorative).\n * They fill available space and shouldn't affect parent dimensions.\n * Use Cases:\n * - ✅ Headless (default): Scrolling backgrounds, parallax layers, repeating patterns\n * - ❌ Layout-aware: Rare - textured progress bars, pattern-filled UI blocks\n *\n * 2. Layout Size Provider: SIMPLE DIMENSIONS ✅\n * Decision: Use width/height directly (not getBounds)\n * Reasoning:\n * - TileSprite requires explicit width/height (Phaser constructor param)\n * - Dimensions are always known and stable\n * - getBounds() adds unnecessary overhead\n * - Rotation affects visual but not logical dimensions (pattern stays in rect)\n * Implementation: __getLayoutSize = () => ({ width, height })\n *\n * 3. Tiling Props: DIRECT PHASER MAPPING ✅\n * Decision: Expose Phaser's tilePosition/tileScale props directly\n * Props:\n * - tilePositionX/Y: Offset for scrolling effect (default: 0)\n * - tileScaleX/Y: Tile size multiplier (default: 1)\n * Example:\n * <TileSprite\n * texture=\"clouds\"\n * width={800} height={200}\n * tilePositionX={scrollOffset}\n * tileScaleX={2} // Tiles 2x larger\n * />\n * Note: tilePosition updates are cheap (WebGL texture wrapping, no redraw)\n *\n * 4. Sizing Strategy: HYBRID LAYOUT SUPPORT ✅\n * Decision: Support both explicit and layout-aware sizing\n * Behavior:\n * - Explicit pixels: width={800} height={200} → Fixed size\n * - Layout string: width=\"100%\" height=\"50%\" → Resolved from parent\n * - Layout fill: width={undefined} → Auto-fill parent (if parent sized)\n * Implementation:\n * - Resolve layout size in creator using existing size-resolver\n * - Create TileSprite with resolved pixel dimensions\n * - Update dimensions in patcher if layout props change\n * Phaser Limitation: TileSprite dimensions can't change after creation\n * → Workaround: Recreate TileSprite if dimensions change (expensive!)\n *\n * 5. Performance Characteristics: OPTIMAL FOR PATTERNS ✅\n * Advantages:\n * - WebGL texture wrapping (hardware-accelerated, no CPU cost)\n * - tilePosition updates are free (just shader uniform)\n * - Good for large repeating areas (better than multiple sprites)\n * - No geometry regeneration on scroll\n * Limitations:\n * - Texture must support wrapping (power-of-2 dimensions recommended)\n * - Rotation/scale affects entire area (not individual tiles)\n * - Can't change dimensions dynamically (requires recreation)\n *\n * 6. Animation Support: USER CODE ✅\n * Decision: No built-in animation helpers\n * Reasoning:\n * - Scrolling patterns vary widely (linear, sine wave, parallax)\n * - Simple to implement in user code:\n * const [scroll, setScroll] = useState(0)\n * useEffect(() => {\n * const timer = setInterval(() => setScroll(s => s + 1), 16)\n * return () => clearInterval(timer)\n * }, [])\n * <TileSprite tilePositionX={scroll} />\n * - No need for framework abstraction\n * Future: Consider useScrollingPattern hook if demand is high\n *\n * 7. Common Use Cases & Patterns: DOCUMENTED ✅\n * Best For:\n * - ✅ Scrolling backgrounds (clouds, stars, terrain)\n * - ✅ Infinite repeating patterns (tiles, grids)\n * - ✅ Parallax layers (different scroll speeds)\n * - ✅ Textured fills (progress bars, health bars)\n * Avoid For:\n * - ❌ Static backgrounds → Use Image (simpler)\n * - ❌ Complex patterns → Use Graphics or multiple Sprites\n * - ❌ Animated tiles → Use Sprite with animation\n *\n * 8. Origin Behavior: UI-FRIENDLY DEFAULT 🆕\n * Decision: Default origin (0, 0) like Image (differs from Sprite!)\n * Reasoning:\n * - TileSprites typically used as backgrounds/fills (top-left alignment)\n * - Matches Image component behavior (UI semantics)\n * - Easier layout calculations\n * - Allow override via originX/originY for special cases\n *\n * 9. Rotation & Tiling: DOCUMENTED BEHAVIOR 🆕\n * Behavior:\n * - Rotation rotates entire TileSprite area (not individual tiles)\n * - Tile pattern remains axis-aligned in texture space\n * - Useful for rotated pattern fills, but limited flexibility\n * - For rotated individual tiles, use multiple Sprite instances\n *\n * Implementation Checklist:\n * ========================\n * [ ] Create TileSprite with scene.add.tileSprite(x, y, width, height, texture, frame)\n * [ ] Set origin to (0, 0) by default (UI-friendly)\n * [ ] Apply transform props via applyTransformProps\n * [ ] Setup tilePosition/tileScale props\n * [ ] Implement layout size resolver (support %, fill)\n * [ ] Setup layout size provider (width/height)\n * [ ] Handle dimension changes (recreate if needed)\n * [ ] Support tint, origin props\n * [ ] Test with scrolling, scaling, rotation\n * [ ] Document power-of-2 texture recommendation\n */\nimport type Phaser from 'phaser'\nimport type { TransformProps } from '../../core-props'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsDefaultExtension } from '../../types'\n\n/**\n * Base props for TileSprite component\n */\nexport interface TileSpriteBaseProps extends TransformProps {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Width of the tile sprite area */\n width: number\n\n /** Height of the tile sprite area */\n height: number\n\n /** Horizontal tile position offset (for scrolling effect) */\n tilePositionX?: number\n\n /** Vertical tile position offset (for scrolling effect) */\n tilePositionY?: number\n\n /** Horizontal tile scale factor */\n tileScaleX?: number\n\n /** Vertical tile scale factor */\n tileScaleY?: number\n\n /** Tint color applied to tiles (0xRRGGBB) */\n tint?: number\n\n /** Origin X (0-1, default 0.5) */\n originX?: number\n\n /** Origin Y (0-1, default 0.5) */\n originY?: number\n}\n\n/**\n * Props for TileSprite component\n */\nexport interface TileSpriteProps\n extends TileSpriteBaseProps,\n PropsDefaultExtension<Phaser.GameObjects.TileSprite> {}\n\n/**\n * TileSprite creator - NOT IMPLEMENTED YET\n * @throws Error indicating component is not implemented\n */\nexport const tileSpriteCreator: HostCreator<'TileSprite'> = (_scene, _props) => {\n throw new Error(\n 'TileSprite component not implemented yet. This is a placeholder for architecture planning.'\n )\n}\n\n/**\n * TileSprite patcher - NOT IMPLEMENTED YET\n * @throws Error indicating component is not implemented\n */\nexport const tileSpritePatcher: HostPatcher<'TileSprite'> = (_node, _prev, _next) => {\n throw new Error(\n 'TileSprite component not implemented yet. This is a placeholder for architecture planning.'\n )\n}\n","/**\n * Shared property appliers for component patching\n * These functions avoid code duplication when updating node properties\n */\nimport Phaser from 'phaser'\nimport type { BackgroundProps, LayoutProps } from '../../core-props'\n\n/**\n * Applies background properties (color, alpha, corner radius, border)\n * Handles adding, removing, and updating background graphics on containers\n * @param container - Phaser Container with potential background\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyBackgroundProps(\n container: Phaser.GameObjects.Container & { __background?: Phaser.GameObjects.Graphics },\n prev: Partial<BackgroundProps & LayoutProps>,\n next: Partial<BackgroundProps & LayoutProps>\n): void {\n const prevBgColor = prev.backgroundColor\n const nextBgColor = next.backgroundColor\n const prevBgAlpha = prev.backgroundAlpha ?? 1\n const nextBgAlpha = next.backgroundAlpha ?? 1\n const prevWidth = typeof prev.width === 'number' ? prev.width : 100\n const nextWidth = typeof next.width === 'number' ? next.width : 100\n const prevHeight = typeof prev.height === 'number' ? prev.height : 100\n const nextHeight = typeof next.height === 'number' ? next.height : 100\n const prevCornerRadius = prev.cornerRadius ?? 0\n const nextCornerRadius = next.cornerRadius ?? 0\n const prevBorderColor = prev.borderColor\n const nextBorderColor = next.borderColor\n const prevBorderWidth = prev.borderWidth ?? 0\n const nextBorderWidth = next.borderWidth ?? 0\n const prevBorderAlpha = prev.borderAlpha ?? 1\n const nextBorderAlpha = next.borderAlpha ?? 1\n\n const prevHasBorder = prevBorderWidth > 0 && prevBorderColor !== undefined\n const nextHasBorder = nextBorderWidth > 0 && nextBorderColor !== undefined\n const prevHasGraphics = prevBgColor !== undefined || prevHasBorder\n const nextHasGraphics = nextBgColor !== undefined || nextHasBorder\n\n if (prevHasGraphics && !nextHasGraphics) {\n // Remove background/border graphics entirely\n if (container.__background) {\n container.__background.destroy()\n delete container.__background\n }\n } else if (!prevHasGraphics && nextHasGraphics) {\n // Add background/border graphics\n if (container.scene) {\n const background = container.scene.add.graphics()\n\n if (nextBgColor !== undefined) {\n background.fillStyle(nextBgColor, nextBgAlpha)\n }\n\n if (nextHasBorder) {\n background.lineStyle(nextBorderWidth, nextBorderColor, nextBorderAlpha)\n }\n\n if (nextCornerRadius !== 0) {\n if (nextBgColor !== undefined) {\n background.fillRoundedRect(0, 0, nextWidth, nextHeight, nextCornerRadius)\n }\n if (nextHasBorder) {\n background.strokeRoundedRect(0, 0, nextWidth, nextHeight, nextCornerRadius)\n }\n } else {\n if (nextBgColor !== undefined) {\n background.fillRect(0, 0, nextWidth, nextHeight)\n }\n if (nextHasBorder) {\n background.strokeRect(0, 0, nextWidth, nextHeight)\n }\n }\n\n container.addAt(background, 0)\n container.__background = background\n ;(background as Phaser.GameObjects.Graphics & { __isBackground?: boolean }).__isBackground =\n true\n }\n } else if (container.__background && nextHasGraphics) {\n // Update existing background - Graphics requires clear and redraw\n const needsRedraw =\n prevBgColor !== nextBgColor ||\n prevBgAlpha !== nextBgAlpha ||\n prevWidth !== nextWidth ||\n prevHeight !== nextHeight ||\n prevCornerRadius !== nextCornerRadius ||\n prevBorderWidth !== nextBorderWidth ||\n prevBorderColor !== nextBorderColor ||\n prevBorderAlpha !== nextBorderAlpha\n\n if (needsRedraw) {\n container.__background.clear()\n\n if (nextBgColor !== undefined) {\n container.__background.fillStyle(nextBgColor, nextBgAlpha)\n }\n\n if (nextHasBorder) {\n container.__background.lineStyle(nextBorderWidth, nextBorderColor, nextBorderAlpha)\n }\n\n if (nextCornerRadius !== 0) {\n if (nextBgColor !== undefined) {\n container.__background.fillRoundedRect(0, 0, nextWidth, nextHeight, nextCornerRadius)\n }\n if (nextHasBorder) {\n container.__background.strokeRoundedRect(0, 0, nextWidth, nextHeight, nextCornerRadius)\n }\n } else {\n if (nextBgColor !== undefined) {\n container.__background.fillRect(0, 0, nextWidth, nextHeight)\n }\n if (nextHasBorder) {\n container.__background.strokeRect(0, 0, nextWidth, nextHeight)\n }\n }\n }\n }\n}\n","/**\n * Type definitions for the gesture system\n */\nimport type Phaser from 'phaser'\n\n/**\n * Touch move gesture state\n */\nexport type TouchMoveState = 'start' | 'move' | 'end'\n\n/**\n * Data passed to keyboard event handlers\n */\nexport interface KeyboardEventData {\n /** The original DOM keyboard event */\n event: KeyboardEvent\n /** The key value of the key represented by the event */\n key: string\n /** The code value of the physical key */\n code: string\n /** Whether the Alt key was pressed */\n altKey: boolean\n /** Whether the Ctrl key was pressed */\n ctrlKey: boolean\n /** Whether the Shift key was pressed */\n shiftKey: boolean\n /** Whether the Meta key (Cmd/Win) was pressed */\n metaKey: boolean\n /** Whether this is a repeat event (key held down) */\n repeat: boolean\n\n /**\n * Prevent default browser behavior\n */\n preventDefault(): void\n\n /**\n * Stop event propagation\n */\n stopPropagation(): void\n}\n\n/**\n * Data passed to input event handlers\n */\nexport interface InputEventData {\n /** The current value of the input */\n value: string\n /** The original DOM input event */\n event: Event\n\n /**\n * Prevent default browser behavior\n */\n preventDefault(): void\n\n /**\n * Stop event propagation\n */\n stopPropagation(): void\n}\n\n/**\n * Data passed to focus/blur event handlers\n */\nexport interface FocusEventData {\n /** The original DOM focus event */\n event: FocusEvent\n\n /**\n * Prevent default browser behavior\n */\n preventDefault(): void\n\n /**\n * Stop event propagation\n */\n stopPropagation(): void\n}\n\n/**\n * Data passed to hover event handlers (desktop/mouse only)\n */\nexport interface HoverEventData {\n /** The Phaser pointer that triggered the event */\n pointer: Phaser.Input.Pointer\n /** Local X coordinate relative to container origin (0,0) */\n localX: number\n /** Local Y coordinate relative to container origin (0,0) */\n localY: number\n /** Width of the container's hit area */\n width: number\n /** Height of the container's hit area */\n height: number\n\n /**\n * Stop event propagation to parent containers\n */\n stopPropagation(): void\n\n /**\n * Check if propagation has been stopped\n * @returns true if stopPropagation() was called\n */\n isPropagationStopped(): boolean\n}\n\n/**\n * Data passed to wheel event handlers (desktop/mouse only)\n */\nexport interface WheelEventData {\n /** The Phaser pointer at the time of the wheel event */\n pointer: Phaser.Input.Pointer\n /** Local X coordinate relative to container origin (0,0) */\n localX: number\n /** Local Y coordinate relative to container origin (0,0) */\n localY: number\n /** Wheel scroll delta X (horizontal scrolling) */\n deltaX: number\n /** Wheel scroll delta Y (vertical scrolling) */\n deltaY: number\n /** Wheel scroll delta Z (some mice) */\n deltaZ: number\n /** Delta mode: 0 = pixels, 1 = lines, 2 = pages */\n deltaMode: number\n /** Width of the container's hit area */\n width: number\n /** Height of the container's hit area */\n height: number\n /** Original DOM wheel event */\n originalEvent: WheelEvent\n\n /**\n * Stop event propagation to parent containers\n */\n stopPropagation(): void\n\n /**\n * Check if propagation has been stopped\n * @returns true if stopPropagation() was called\n */\n isPropagationStopped(): boolean\n\n /**\n * Prevent default browser behavior (e.g., page scroll)\n */\n preventDefault(): void\n}\n\n/**\n * Data passed to gesture event handlers\n * Supports DOM-style event propagation control\n */\nexport interface GestureEventData {\n /** The Phaser pointer that triggered the event */\n pointer: Phaser.Input.Pointer\n /** Local X coordinate relative to container origin (0,0) */\n localX: number\n /** Local Y coordinate relative to container origin (0,0) */\n localY: number\n /** Delta X since last move event (only for onTouchMove) */\n dx?: number\n /** Delta Y since last move event (only for onTouchMove) */\n dy?: number\n /** Width of the container's hit area */\n width: number\n /** Height of the container's hit area */\n height: number\n /** Whether pointer is currently inside the container hit area */\n isInside?: boolean\n /** Current state of touch move gesture: 'start' (first move), 'move' (during), 'end' (pointer up) (only for onTouchMove) */\n state?: TouchMoveState\n\n /**\n * Stop event propagation to parent containers\n * Similar to DOM's event.stopPropagation()\n * Default behavior: events bubble up to parent containers\n */\n stopPropagation(): void\n\n /**\n * Check if propagation has been stopped\n * @returns true if stopPropagation() was called\n */\n isPropagationStopped(): boolean\n}\n\n/**\n * Callback functions for gesture events\n */\nexport interface GestureCallbacks {\n /** Called on pointer down + up on the same target (click/tap) */\n onTouch?: (data: GestureEventData) => void\n /** Called when pointer up occurs outside the container (for click-outside detection) */\n onTouchOutside?: (data: GestureEventData) => void\n /** Called during pointer movement - continues even when outside bounds */\n onTouchMove?: (data: GestureEventData) => void\n /** Called when double tap/click is detected */\n onDoubleTap?: (data: GestureEventData) => void\n /** Called when pointer is held down for configured duration */\n onLongPress?: (data: GestureEventData) => void\n /** Called when a key is pressed down */\n onKeyDown?: (data: KeyboardEventData) => void\n /** Called when a key is released */\n onKeyUp?: (data: KeyboardEventData) => void\n /** Called when input value changes */\n onInput?: (data: InputEventData) => void\n /** Called when element receives focus */\n onFocus?: (data: FocusEventData) => void\n /** Called when element loses focus */\n onBlur?: (data: FocusEventData) => void\n /** Called when pointer enters the container (desktop/mouse only) */\n onHoverStart?: (data: HoverEventData) => void\n /** Called when pointer exits the container (desktop/mouse only) */\n onHoverEnd?: (data: HoverEventData) => void\n /** Called when mouse wheel is scrolled over container (desktop/mouse only) */\n onWheel?: (data: WheelEventData) => void\n}\n\n/**\n * Configuration for gesture detection\n */\nexport interface GestureConfig {\n /** Duration in ms to trigger long press (default: 500) */\n longPressDuration?: number\n /** Max time in ms between taps for double tap (default: 300) */\n doubleTapDelay?: number\n /** Max time in ms for a valid touch/click (prevents delayed touch after long hold) (default: 500) */\n maxTouchDuration?: number\n}\n\n/**\n * Default gesture configuration values\n */\nexport const DEFAULT_GESTURE_CONFIG: Required<GestureConfig> = {\n longPressDuration: 500,\n doubleTapDelay: 300,\n maxTouchDuration: 500,\n}\n\n/**\n * Internal state for tracking a registered container\n */\nexport interface GestureContainerState {\n container: Phaser.GameObjects.Container\n callbacks: GestureCallbacks\n config: Required<GestureConfig>\n hitArea: Phaser.Geom.Rectangle\n mountRootId?: number | undefined // Root ID from mountJSX to isolate different mount trees\n\n // State for gesture detection\n lastTapTime?: number | undefined\n longPressTimer?: NodeJS.Timeout | undefined\n pointerDownPosition?: { x: number; y: number } | undefined\n pointerDownTime?: number | undefined\n longPressTriggered?: boolean | undefined\n isFirstMove?: boolean | undefined\n}\n","/**\n * Global gesture manager for high-level touch and mouse interactions\n * Uses global Phaser input events to track gestures even when pointer moves outside bounds\n */\nimport Phaser from 'phaser'\nimport type {\n GestureCallbacks,\n GestureConfig,\n GestureContainerState,\n GestureEventData,\n HoverEventData,\n WheelEventData,\n} from './gesture-types'\nimport { DEFAULT_GESTURE_CONFIG } from './gesture-types'\n\n// Global counter for unique mount root IDs\nlet nextMountRootId = 1\n\n/**\n * Generate unique mount root ID for mountJSX isolation\n * @returns Unique root ID\n */\nexport function generateMountRootId(): number {\n return nextMountRootId++\n}\n\n/**\n * Manager for gesture detection across all containers in a scene\n * Singleton per scene, stored in scene.data\n */\nexport class GestureManager {\n private scene: Phaser.Scene\n private containers = new Map<Phaser.GameObjects.Container, GestureContainerState>()\n\n // Track pointer positions for delta calculation\n private lastPointerPositions = new Map<number, { x: number; y: number }>()\n\n // Track active pointer down for touch detection\n private activePointerDown: {\n pointerId: number\n container: Phaser.GameObjects.Container\n startX: number\n startY: number\n } | null = null\n\n // Track which containers were hit during pointer down (for move event filtering)\n private activeContainersForMove = new Map<number, Set<Phaser.GameObjects.Container>>()\n\n // Track hover state for each container (desktop/mouse only)\n private hoveredContainers = new Map<Phaser.GameObjects.Container, boolean>()\n\n // Track pending setTimeout timers for cleanup\n private pendingTimeouts = new Set<number>()\n\n private isInitialized = false\n private isDestroyed = false\n\n constructor(scene: Phaser.Scene) {\n this.scene = scene\n }\n\n /**\n * Initialize global event listeners (called once per scene)\n */\n private initialize(): void {\n if (this.isInitialized) return\n this.isInitialized = true\n\n // Global pointer down - detect which container was hit\n this.scene.input.on('pointerdown', this.handlePointerDown, this)\n\n // Global pointer up - check for touch/tap completion\n this.scene.input.on('pointerup', this.handlePointerUp, this)\n\n // Global pointer move - track deltas and notify all relevant containers\n this.scene.input.on('pointermove', this.handlePointerMove, this)\n\n // Handle pointer up outside canvas (window-level events)\n // This ensures we catch pointer release even when it happens outside the game canvas\n this.handleGlobalPointerUp = this.handleGlobalPointerUp.bind(this)\n window.addEventListener('mouseup', this.handleGlobalPointerUp)\n window.addEventListener('touchend', this.handleGlobalPointerUp)\n\n // Handle mouse wheel events (desktop only)\n // Use window instead of canvas to ensure we catch all wheel events\n this.handleWheel = this.handleWheel.bind(this)\n window.addEventListener('wheel', this.handleWheel, { passive: false })\n\n // Cleanup on scene shutdown\n this.scene.events.once('shutdown', this.destroy, this)\n }\n\n /**\n * Register a container for gesture tracking\n * @param container - Container to track\n * @param callbacks - Gesture event callbacks\n * @param hitArea - Interactive hit area\n * @param config - Gesture configuration\n */\n registerContainer(\n container: Phaser.GameObjects.Container,\n callbacks: GestureCallbacks,\n hitArea: Phaser.Geom.Rectangle,\n config: GestureConfig = {}\n ): void {\n this.initialize()\n\n const state: GestureContainerState = {\n container,\n callbacks,\n config: { ...DEFAULT_GESTURE_CONFIG, ...config },\n hitArea,\n }\n\n this.containers.set(container, state)\n\n // Cleanup when container is destroyed\n container.once('destroy', () => {\n this.unregisterContainer(container)\n })\n }\n\n /**\n * Unregister a container\n * @param container - Container to remove\n */\n unregisterContainer(container: Phaser.GameObjects.Container): void {\n const state = this.containers.get(container)\n if (!state) return\n\n // Clear any pending timers\n if (state.longPressTimer) {\n clearTimeout(state.longPressTimer)\n }\n\n this.containers.delete(container)\n\n // If this was the active pointer down target, clear it\n if (this.activePointerDown?.container === container) {\n this.activePointerDown = null\n }\n\n // Clear hover state\n this.hoveredContainers.delete(container)\n\n // Remove from active move tracking\n for (const hitContainers of this.activeContainersForMove.values()) {\n hitContainers.delete(container)\n }\n }\n\n /**\n * Check if a container is registered\n * @param container - Container to check\n * @returns True if container is registered\n */\n hasContainer(container: Phaser.GameObjects.Container): boolean {\n return this.containers.has(container)\n }\n\n /**\n * Create a gesture event data object with propagation control\n * @param pointer - Phaser pointer\n * @param localX - Local X coordinate\n * @param localY - Local Y coordinate\n * @param width - Hit area width\n * @param height - Hit area height\n * @param options - Optional additional data (dx, dy, isInside, state)\n * @returns Event data with stopPropagation support\n */\n private createEventData(\n pointer: Phaser.Input.Pointer,\n localX: number,\n localY: number,\n width: number,\n height: number,\n options: {\n dx?: number\n dy?: number\n isInside?: boolean\n state?: 'start' | 'move' | 'end'\n } = {}\n ): GestureEventData {\n let propagationStopped = false\n\n return {\n pointer,\n localX,\n localY,\n width,\n height,\n ...options,\n stopPropagation() {\n propagationStopped = true\n },\n isPropagationStopped() {\n return propagationStopped\n },\n }\n }\n\n /**\n * Get effective depth considering entire parent hierarchy\n * @param container - Container to calculate depth for\n * @returns Accumulated depth from container and all parents\n */\n private getEffectiveDepth(container: Phaser.GameObjects.Container): number {\n let depth = container.depth\n let parent = container.parentContainer\n\n // Walk up parent chain and accumulate depths\n while (parent) {\n depth += parent.depth\n parent = parent.parentContainer\n }\n\n return depth\n }\n\n /**\n * Get mount root ID from container hierarchy\n * Walks up to find the topmost container with __mountRootId\n * @param container - Container to check\n * @returns Mount root ID or 0 if none found\n */\n private getRootId(container: Phaser.GameObjects.Container): number {\n let current: Phaser.GameObjects.Container | null = container\n let rootId = 0\n\n while (current) {\n const id = (current as unknown as { __mountRootId?: number }).__mountRootId\n if (id !== undefined) {\n rootId = id\n }\n current = current.parentContainer\n }\n\n return rootId\n }\n\n /**\n * Bubble an event through overlapping containers\n * Iterates all containers at pointer position and calls handler until stopPropagation\n * Sorts containers by their actual display list order (z-index) to respect visual stacking\n * @param pointer - The pointer that triggered the event\n * @param eventType - Type of event for filtering callbacks\n * @param handler - Function to call for each container, returns true if propagation stopped\n * @param filterSet - Optional set of containers to limit bubbling to (for move events)\n * @param skipContainerCheck - Skip the isPointerInContainer check (for final move events)\n */\n private bubbleEvent(\n pointer: Phaser.Input.Pointer,\n eventType: keyof GestureCallbacks,\n handler: (state: GestureContainerState, localPos: { x: number; y: number }) => boolean | void,\n filterSet?: Set<Phaser.GameObjects.Container>,\n skipContainerCheck = false\n ): void {\n // Get all containers at pointer position with their original indices\n const containersArray = Array.from(this.containers.values()).map((state, originalIndex) => ({\n state,\n originalIndex,\n }))\n\n // Sort by: 1) mountRootId (higher = on top), 2) effective depth, 3) display list order\n // This ensures different mountJSX trees are properly isolated\n containersArray.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs (higher = mounted later = on top)\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA // Higher root ID first\n }\n\n // Second: Compare effective depths (accumulated from parent hierarchy)\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA // Higher depth first\n }\n\n // Third: If they share the same parent, compare their indices in the parent's display list\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA // Higher index first (topmost)\n\n // If display list indices are equal, preserve original registration order\n if (diff !== 0) return diff\n }\n\n // Fall back to original registration order (reverse for topmost first)\n return b.originalIndex - a.originalIndex\n })\n\n for (const { state } of containersArray) {\n // Only process containers that have the callback for this event type\n if (!state.callbacks[eventType]) continue\n\n // If filterSet provided, only process containers in the set\n if (filterSet && !filterSet.has(state.container)) continue\n\n // Check if pointer is within this container (unless skipContainerCheck is true)\n if (!skipContainerCheck && !this.isPointerInContainer(pointer, state)) continue\n\n // Calculate local position\n const localPos = this.getLocalPosition(pointer, state.container)\n\n // Call handler and check if propagation was stopped\n const stopped = handler(state, localPos)\n if (stopped) break\n }\n }\n\n /**\n * Update hit area for a container\n * @param container - Container to update\n * @param hitArea - New hit area\n */\n updateHitArea(container: Phaser.GameObjects.Container, hitArea: Phaser.Geom.Rectangle): void {\n const state = this.containers.get(container)\n if (state) {\n state.hitArea = hitArea\n }\n }\n\n /**\n * Update callbacks for a container\n * @param container - Container to update\n * @param callbacks - New callbacks\n */\n updateCallbacks(container: Phaser.GameObjects.Container, callbacks: GestureCallbacks): void {\n const state = this.containers.get(container)\n if (state) {\n state.callbacks = callbacks\n }\n }\n\n /**\n * Handle global pointer down event\n * Registers all containers that were hit for move event tracking\n * Only the topmost gets touch/longpress callbacks\n */\n private handlePointerDown(pointer: Phaser.Input.Pointer): void {\n // Create set to track all hit containers for this pointer\n const hitContainers = new Set<Phaser.GameObjects.Container>()\n\n // Find which containers were hit\n // Sort by: 1) mountRootId, 2) effective depth, 3) display list order\n const containersArray = Array.from(this.containers.values()).map((state, originalIndex) => ({\n state,\n originalIndex,\n }))\n containersArray.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA\n }\n\n // Second: Compare effective depths\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA\n }\n\n // Third: Compare display list indices if same parent\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA // Higher index first (topmost)\n\n // If display list indices are equal, preserve original registration order\n if (diff !== 0) return diff\n }\n\n // Fall back to original registration order (reverse for topmost first)\n return b.originalIndex - a.originalIndex\n })\n\n let isFirstHit = true\n\n for (const { state } of containersArray) {\n const isHit = this.isPointerInContainer(pointer, state)\n if (isHit) {\n // Add to hit set (for move event filtering)\n hitContainers.add(state.container)\n\n // Only the first (topmost) hit gets touch/longpress handling\n if (isFirstHit) {\n isFirstHit = false\n const localPos = this.getLocalPosition(pointer, state.container)\n\n // Store active pointer down for touch detection\n this.activePointerDown = {\n pointerId: pointer.id,\n container: state.container,\n startX: pointer.x,\n startY: pointer.y,\n }\n\n // Reset long press triggered flag\n state.longPressTriggered = false\n\n // Store down time for touch duration check\n state.pointerDownTime = Date.now()\n\n // Start long press timer if callback exists\n if (state.callbacks.onLongPress) {\n state.longPressTimer = setTimeout(() => {\n if (this.activePointerDown?.container === state.container) {\n const isInside = this.isPointerInContainer(pointer, state)\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n state.hitArea.width,\n state.hitArea.height,\n { isInside }\n )\n state.callbacks.onLongPress?.(data)\n\n // Mark that long press was triggered to prevent onTouch\n state.longPressTriggered = true\n this.activePointerDown = null\n }\n }, state.config.longPressDuration)\n }\n\n // Store down position for tracking\n state.pointerDownPosition = { x: pointer.x, y: pointer.y }\n }\n }\n }\n\n // Store hit containers for move event filtering\n if (hitContainers.size > 0) {\n this.activeContainersForMove.set(pointer.id, hitContainers)\n }\n }\n\n /**\n * Handle global pointer up event\n */\n private handlePointerUp(pointer: Phaser.Input.Pointer): void {\n if (!this.activePointerDown || this.activePointerDown.pointerId !== pointer.id) {\n return\n }\n\n const state = this.containers.get(this.activePointerDown.container)\n if (!state) {\n this.activePointerDown = null\n return\n }\n\n // Clear long press timer if still pending\n if (state.longPressTimer) {\n clearTimeout(state.longPressTimer)\n state.longPressTimer = undefined\n }\n\n // Calculate touch duration\n const touchDuration = state.pointerDownTime ? Date.now() - state.pointerDownTime : 0\n const isTouchTooLong = touchDuration > state.config.maxTouchDuration\n\n // Send final move event to containers that were hit during pointer down\n const last = this.lastPointerPositions.get(pointer.id)\n const dx = last ? pointer.x - last.x : 0\n const dy = last ? pointer.y - last.y : 0\n const hitContainers = this.activeContainersForMove.get(pointer.id)\n\n this.bubbleEvent(\n pointer,\n 'onTouchMove',\n (targetState, targetLocalPos) => {\n const isInside = this.isPointerInContainer(pointer, targetState)\n const finalMoveData = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { dx, dy, isInside, state: 'end' }\n )\n targetState.callbacks.onTouchMove?.(finalMoveData)\n\n // Reset first move flag for this container\n targetState.isFirstMove = undefined\n\n return finalMoveData.isPropagationStopped()\n },\n hitContainers,\n true // Skip container check for final move event\n )\n\n // Check if pointer is still within the container (basic tap/click detection)\n const isInside = this.isPointerInContainer(pointer, state)\n\n if (isInside) {\n // Fire onTouch only if:\n // - Long press wasn't triggered\n // - Touch duration is within acceptable range (not held too long)\n const shouldFireTouch = !state.longPressTriggered && !isTouchTooLong\n\n // Bubble onTouch event to parent containers\n if (state.callbacks.onTouch && shouldFireTouch) {\n this.bubbleEvent(pointer, 'onTouch', (targetState, targetLocalPos) => {\n const isInside = this.isPointerInContainer(pointer, targetState)\n const data = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { isInside }\n )\n targetState.callbacks.onTouch?.(data)\n return data.isPropagationStopped()\n })\n }\n\n // Check for double tap (also skip if touch was too long)\n if (state.callbacks.onDoubleTap && shouldFireTouch) {\n const now = Date.now()\n const timeSinceLastTap = state.lastTapTime ? now - state.lastTapTime : Infinity\n\n if (timeSinceLastTap <= state.config.doubleTapDelay) {\n this.bubbleEvent(pointer, 'onDoubleTap', (targetState, targetLocalPos) => {\n const isInside = this.isPointerInContainer(pointer, targetState)\n const data = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { isInside }\n )\n targetState.callbacks.onDoubleTap?.(data)\n return data.isPropagationStopped()\n })\n state.lastTapTime = undefined // Reset to prevent triple-tap\n } else {\n state.lastTapTime = now\n }\n }\n }\n\n // Fire onTouchOutside for ALL containers where pointer is outside\n for (const [container, containerState] of this.containers) {\n if (!containerState.callbacks.onTouchOutside) continue\n\n const isInsideContainer = this.isPointerInContainer(pointer, containerState)\n if (isInsideContainer) continue // Skip if pointer is inside\n\n // Fire onTouchOutside - no touch duration check needed for outside clicks\n const localPos = this.getLocalPosition(pointer, container)\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n containerState.hitArea.width,\n containerState.hitArea.height,\n { isInside: false }\n )\n containerState.callbacks.onTouchOutside(data)\n }\n\n // Reset state\n state.longPressTriggered = false\n state.pointerDownTime = undefined\n\n this.activePointerDown = null\n state.pointerDownPosition = undefined\n\n // Clear active containers for move tracking\n this.activeContainersForMove.delete(pointer.id)\n }\n\n /**\n * Handle pointer up outside canvas (global window events)\n * Ensures touch move 'end' state is sent even when pointer released outside\n * Also handles onTouchOutside for ALL containers\n */\n private handleGlobalPointerUp(_event: MouseEvent | TouchEvent): void {\n // Use setTimeout to let Phaser's handlePointerUp run first (if inside canvas)\n const timerId = window.setTimeout(() => {\n // Remove timer from tracking\n this.pendingTimeouts.delete(timerId)\n\n // Guard: Check if manager is destroyed or scene is invalid\n if (this.isDestroyed || !this.scene || !this.scene.input) {\n return\n }\n\n // CRITICAL: activePointer is a getter that can throw if scene is being destroyed\n // Wrap in try-catch to handle race condition during scene destruction\n let pointer: Phaser.Input.Pointer | null = null\n try {\n pointer = this.scene.input.activePointer\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // Scene is being destroyed, silently ignore\n return\n }\n\n if (!pointer) {\n return\n }\n\n // Fire onTouchOutside for ALL containers that have the callback\n // and where the pointer is NOT inside\n for (const state of this.containers.values()) {\n if (!state.callbacks.onTouchOutside) continue\n\n const isInside = this.isPointerInContainer(pointer, state)\n if (isInside) continue // Skip if pointer is inside\n\n // Check if touch duration is valid\n const touchDuration = state.pointerDownTime ? Date.now() - state.pointerDownTime : 0\n const isTouchTooLong = touchDuration > state.config.maxTouchDuration\n const shouldFire = !state.longPressTriggered && !isTouchTooLong\n\n if (shouldFire) {\n const localPos = this.getLocalPosition(pointer, state.container)\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n state.hitArea.width,\n state.hitArea.height,\n { isInside: false }\n )\n state.callbacks.onTouchOutside?.(data)\n }\n }\n\n // If no activePointerDown, we're done\n if (!this.activePointerDown) return\n\n const state = this.containers.get(this.activePointerDown.container)\n if (!state) {\n this.activePointerDown = null\n return\n }\n\n // Clear long press timer if still pending\n if (state.longPressTimer) {\n clearTimeout(state.longPressTimer)\n state.longPressTimer = undefined\n }\n\n // Send final move event with 'end' state to all active containers\n const last = this.lastPointerPositions.get(pointer.id)\n const dx = last ? pointer.x - last.x : 0\n const dy = last ? pointer.y - last.y : 0\n const hitContainers = this.activeContainersForMove.get(pointer.id)\n\n this.bubbleEvent(\n pointer,\n 'onTouchMove',\n (targetState, targetLocalPos) => {\n const finalMoveData = this.createEventData(\n pointer,\n targetLocalPos.x,\n targetLocalPos.y,\n targetState.hitArea.width,\n targetState.hitArea.height,\n { dx, dy, isInside: false, state: 'end' }\n )\n targetState.callbacks.onTouchMove?.(finalMoveData)\n\n // Reset first move flag for this container\n targetState.isFirstMove = undefined\n\n return finalMoveData.isPropagationStopped()\n },\n hitContainers,\n true // Skip container check for final move event\n )\n\n // Reset state\n state.longPressTriggered = false\n state.pointerDownTime = undefined\n this.activePointerDown = null\n state.pointerDownPosition = undefined\n\n // Clear active containers for this pointer\n this.activeContainersForMove.delete(pointer.id)\n }, 0)\n\n // Track this timer for cleanup\n this.pendingTimeouts.add(timerId)\n }\n\n /**\n * Handle global pointer move event\n * Detects hover state changes and notifies containers with onHoverStart/onHoverEnd\n * Only notifies containers that were hit during pointer down for onTouchMove\n * Bubbles through them until stopPropagation() is called\n */\n private handlePointerMove(pointer: Phaser.Input.Pointer): void {\n // Calculate delta\n const last = this.lastPointerPositions.get(pointer.id)\n const dx = last ? pointer.x - last.x : 0\n const dy = last ? pointer.y - last.y : 0\n this.lastPointerPositions.set(pointer.id, { x: pointer.x, y: pointer.y })\n\n // Hover detection for all containers (desktop/mouse only)\n this.detectHoverChanges(pointer)\n\n // Only process touch move if there's an active pointer down\n if (!this.activePointerDown || pointer.id !== this.activePointerDown.pointerId) {\n return\n }\n\n // Get containers that were hit during pointer down\n const hitContainers = this.activeContainersForMove.get(pointer.id)\n if (!hitContainers) return\n\n // Bubble onTouchMove only to containers that were hit at pointer down\n // Sort by: 1) mountRootId, 2) effective depth, 3) display list order\n const containersArray = Array.from(this.containers.values()).map((state, originalIndex) => ({\n state,\n originalIndex,\n }))\n containersArray.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA\n }\n\n // Second: Compare effective depths\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA\n }\n\n // Third: Compare display list indices if same parent\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA // Higher index first (topmost)\n\n // If display list indices are equal, preserve original registration order\n if (diff !== 0) return diff\n }\n\n // Fall back to original registration order (reverse for topmost first)\n return b.originalIndex - a.originalIndex\n })\n\n for (const { state } of containersArray) {\n // Only process if:\n // 1. Container has onTouchMove callback\n // 2. Container was hit during pointer down\n if (!state.callbacks.onTouchMove) continue\n if (!hitContainers.has(state.container)) continue\n\n const localPos = this.getLocalPosition(pointer, state.container)\n const isInside = this.isPointerInContainer(pointer, state)\n\n // Determine state: 'start' for first move, 'move' for subsequent\n const moveState = state.isFirstMove === undefined ? 'start' : 'move'\n if (state.isFirstMove === undefined) {\n state.isFirstMove = false\n }\n\n const data = this.createEventData(\n pointer,\n localPos.x,\n localPos.y,\n state.hitArea.width,\n state.hitArea.height,\n { dx, dy, isInside, state: moveState }\n )\n\n state.callbacks.onTouchMove(data)\n\n // Stop bubbling if propagation was stopped\n if (data.isPropagationStopped()) break\n }\n }\n\n /**\n * Check if pointer is within a container's hit area\n * Also checks parent visibility chain to handle collapsed accordions\n */\n private isPointerInContainer(\n pointer: Phaser.Input.Pointer,\n state: GestureContainerState\n ): boolean {\n const container = state.container\n if (!container.visible || container.alpha === 0) return false\n\n // Check parent container visibility chain\n // This prevents interaction with children in collapsed accordions\n let parent = container.parentContainer\n while (parent) {\n if (!parent.visible || parent.alpha === 0) return false\n parent = parent.parentContainer\n }\n\n const localPos = this.getLocalPosition(pointer, container)\n return state.hitArea.contains(localPos.x, localPos.y)\n }\n\n /**\n * Convert global pointer position to container local coordinates\n */\n private getLocalPosition(\n pointer: Phaser.Input.Pointer,\n container: Phaser.GameObjects.Container\n ): { x: number; y: number } {\n // Transform global coordinates to container's local space\n const matrix = container.getWorldTransformMatrix()\n const inverseMatrix = matrix.invert()\n\n const localPos = inverseMatrix.transformPoint(pointer.x, pointer.y)\n return { x: localPos.x, y: localPos.y }\n }\n\n /**\n * Detect hover state changes for all containers (desktop/mouse only)\n * Called on every pointer move to update hover state\n */\n private detectHoverChanges(pointer: Phaser.Input.Pointer): void {\n for (const [container, state] of this.containers) {\n // Skip if container has no hover callbacks\n if (!state.callbacks.onHoverStart && !state.callbacks.onHoverEnd) {\n continue\n }\n\n // Check if container is active and visible\n if (!container.active) continue\n\n const isInside = this.isPointerInContainer(pointer, state)\n const wasInside = this.hoveredContainers.get(container) ?? false\n\n // Hover start\n if (isInside && !wasInside) {\n this.hoveredContainers.set(container, true)\n if (state.callbacks.onHoverStart) {\n const eventData = this.createHoverEventData(pointer, container, state.hitArea)\n state.callbacks.onHoverStart(eventData)\n }\n }\n\n // Hover end\n if (!isInside && wasInside) {\n this.hoveredContainers.set(container, false)\n if (state.callbacks.onHoverEnd) {\n const eventData = this.createHoverEventData(pointer, container, state.hitArea)\n state.callbacks.onHoverEnd(eventData)\n }\n }\n }\n }\n\n /**\n * Create hover event data\n */\n private createHoverEventData(\n pointer: Phaser.Input.Pointer,\n container: Phaser.GameObjects.Container,\n hitArea: Phaser.Geom.Rectangle\n ): HoverEventData {\n const localPos = this.getLocalPosition(pointer, container)\n\n let propagationStopped = false\n\n return {\n pointer,\n localX: localPos.x,\n localY: localPos.y,\n width: hitArea.width,\n height: hitArea.height,\n stopPropagation: () => {\n propagationStopped = true\n },\n isPropagationStopped: () => propagationStopped,\n }\n }\n\n /**\n * Handle mouse wheel event\n * Bubbles to all containers under the pointer\n */\n private handleWheel(event: WheelEvent): void {\n // Guard: Check if manager is destroyed or scene is invalid\n if (this.isDestroyed || !this.scene || !this.scene.input) {\n return\n }\n\n // Get active pointer and update its position from the wheel event\n // Wrap in try-catch as activePointer getter can throw during scene destruction\n let pointer: Phaser.Input.Pointer | null = null\n try {\n pointer = this.scene.input.activePointer\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // Scene is being destroyed, silently ignore\n return\n }\n\n if (!pointer) return\n\n // Update pointer position from wheel event (it might not be at correct position)\n const canvas = this.scene.game.canvas\n const rect = canvas.getBoundingClientRect()\n const scaleX = canvas.width / rect.width\n const scaleY = canvas.height / rect.height\n pointer.x = (event.clientX - rect.left) * scaleX\n pointer.y = (event.clientY - rect.top) * scaleY\n\n // Find all containers under the pointer\n const containersUnderPointer: Array<{\n state: GestureContainerState\n originalIndex: number\n }> = []\n\n Array.from(this.containers.values()).forEach((state, originalIndex) => {\n if (!state.callbacks.onWheel) return\n\n const isInside = this.isPointerInContainer(pointer, state)\n if (isInside) {\n containersUnderPointer.push({ state, originalIndex })\n }\n })\n\n // Sort by z-order (same logic as other events)\n containersUnderPointer.sort((a, b) => {\n const containerA = a.state.container\n const containerB = b.state.container\n\n // First: Compare mount root IDs\n const rootIdA = this.getRootId(containerA)\n const rootIdB = this.getRootId(containerB)\n if (rootIdA !== rootIdB) {\n return rootIdB - rootIdA\n }\n\n // Second: Compare effective depths\n const depthA = this.getEffectiveDepth(containerA)\n const depthB = this.getEffectiveDepth(containerB)\n if (depthA !== depthB) {\n return depthB - depthA\n }\n\n // Third: Compare display list indices if same parent\n if (containerA.parentContainer === containerB.parentContainer && containerA.parentContainer) {\n const indexA = containerA.parentContainer.getIndex(containerA)\n const indexB = containerB.parentContainer.getIndex(containerB)\n const diff = indexB - indexA\n if (diff !== 0) return diff\n }\n\n return b.originalIndex - a.originalIndex\n })\n\n // Bubble wheel event through containers\n for (const { state } of containersUnderPointer) {\n const localPos = this.getLocalPosition(pointer, state.container)\n\n let propagationStopped = false\n\n const wheelData: WheelEventData = {\n pointer,\n localX: localPos.x,\n localY: localPos.y,\n deltaX: event.deltaX,\n deltaY: event.deltaY,\n deltaZ: event.deltaZ,\n deltaMode: event.deltaMode,\n width: state.hitArea.width,\n height: state.hitArea.height,\n originalEvent: event,\n stopPropagation: () => {\n propagationStopped = true\n },\n isPropagationStopped: () => propagationStopped,\n preventDefault: () => {\n event.preventDefault()\n },\n }\n\n state.callbacks.onWheel?.(wheelData)\n\n // Stop bubbling if propagation was stopped\n if (propagationStopped) break\n }\n }\n\n /**\n * Cleanup all resources\n */\n private destroy(): void {\n console.log('[GestureManager] destroy() called', {\n pendingTimeouts: this.pendingTimeouts.size,\n containers: this.containers.size,\n })\n\n // Mark as destroyed to prevent any pending callbacks from executing\n this.isDestroyed = true\n\n // Clear all pending setTimeout timers\n for (const timerId of this.pendingTimeouts) {\n clearTimeout(timerId)\n }\n this.pendingTimeouts.clear()\n\n // Clear all container timers\n for (const state of this.containers.values()) {\n if (state.longPressTimer) {\n clearTimeout(state.longPressTimer)\n }\n }\n\n this.containers.clear()\n this.lastPointerPositions.clear()\n this.activePointerDown = null\n this.hoveredContainers.clear()\n\n // Remove event listeners\n if (this.isInitialized) {\n this.scene.input.off('pointerdown', this.handlePointerDown, this)\n this.scene.input.off('pointerup', this.handlePointerUp, this)\n this.scene.input.off('pointermove', this.handlePointerMove, this)\n\n // Remove global window event listeners\n window.removeEventListener('mouseup', this.handleGlobalPointerUp)\n window.removeEventListener('touchend', this.handleGlobalPointerUp)\n\n // Remove wheel event listener\n window.removeEventListener('wheel', this.handleWheel)\n }\n\n this.isInitialized = false\n }\n}\n\n/**\n * Get or create GestureManager for a scene\n * Stored in scene.data to ensure singleton per scene\n */\nexport function getGestureManager(scene: Phaser.Scene): GestureManager {\n // Safety check: ensure scene.data exists\n if (!scene || !scene.data) {\n throw new Error('getGestureManager: Invalid scene or scene.data is undefined')\n }\n\n const key = '__gestureManager__'\n let manager = scene.data.get(key) as GestureManager | undefined\n\n if (!manager) {\n manager = new GestureManager(scene)\n scene.data.set(key, manager)\n }\n\n return manager\n}\n","/**\n * Gesture property appliers for component patching\n * Updates gesture registration when props change\n */\nimport type { LayoutSize } from '@number10/phaserjsx/layout'\nimport Phaser from 'phaser'\nimport type { GestureProps, LayoutProps } from '../../core-props'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport type { GestureCallbacks } from '../../gestures/gesture-types'\n\n/**\n * Applies gesture properties when props change\n * Handles enabling/disabling gestures, updating callbacks, and hit area changes\n * @param scene - Scene containing the gesture manager\n * @param container - Phaser Container to update gestures on\n * @param prev - Previous props\n * @param next - New props\n */\nexport function applyGesturesProps(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n prev: Partial<GestureProps & LayoutProps>,\n next: Partial<GestureProps & LayoutProps>\n): void {\n // Safety check: ensure scene is valid and booted\n if (!scene || !scene.sys || !scene.data) {\n console.warn('applyGesturesProps: Invalid scene or scene not initialized')\n return\n }\n\n // Check if scene is still active (not shutting down/destroyed)\n if (!scene.sys.isActive() || scene.sys.game === null) {\n console.warn('applyGesturesProps: Scene is not active or game is null')\n return\n }\n\n const hasAnyGesture = !!(\n next.onTouch ||\n next.onTouchOutside ||\n next.onTouchMove ||\n next.onDoubleTap ||\n next.onLongPress ||\n next.onHoverStart ||\n next.onHoverEnd ||\n next.onWheel\n )\n const hadAnyGesture = !!(\n prev.onTouch ||\n prev.onTouchOutside ||\n prev.onTouchMove ||\n prev.onDoubleTap ||\n prev.onLongPress ||\n prev.onHoverStart ||\n prev.onHoverEnd ||\n prev.onWheel\n )\n\n // Auto-enable if callbacks present, unless explicitly disabled\n const prevEnabled = hadAnyGesture && prev.enableGestures !== false\n const nextEnabled = hasAnyGesture && next.enableGestures !== false\n\n const manager = getGestureManager(scene)\n\n // Case 1: Gestures newly enabled\n if (!prevEnabled && nextEnabled && hasAnyGesture) {\n // Register for the first time\n // Use __getLayoutSize for actual calculated dimensions\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n let width = 100\n let height = 100\n\n if (containerWithLayout.__getLayoutSize) {\n const size = containerWithLayout.__getLayoutSize()\n width = size.width\n height = size.height\n } else {\n const bounds = container.getBounds()\n width = bounds.width || 100\n height = bounds.height || 100\n }\n\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n const callbacks: GestureCallbacks = {}\n if (next.onTouch) callbacks.onTouch = next.onTouch\n if (next.onTouchOutside) callbacks.onTouchOutside = next.onTouchOutside\n if (next.onTouchMove) callbacks.onTouchMove = next.onTouchMove\n if (next.onDoubleTap) callbacks.onDoubleTap = next.onDoubleTap\n if (next.onLongPress) callbacks.onLongPress = next.onLongPress\n if (next.onHoverStart) callbacks.onHoverStart = next.onHoverStart\n if (next.onHoverEnd) callbacks.onHoverEnd = next.onHoverEnd\n if (next.onWheel) callbacks.onWheel = next.onWheel\n\n const config: { longPressDuration?: number; doubleTapDelay?: number } = {}\n if (next.longPressDuration !== undefined) config.longPressDuration = next.longPressDuration\n if (next.doubleTapDelay !== undefined) config.doubleTapDelay = next.doubleTapDelay\n\n manager.registerContainer(container, callbacks, hitArea, config)\n return\n }\n\n // Case 2: Gestures disabled or no callbacks\n if (prevEnabled && (!nextEnabled || !hasAnyGesture)) {\n manager.unregisterContainer(container)\n return\n }\n\n // Case 3: Gestures still enabled, update callbacks/hit area\n if (nextEnabled && hasAnyGesture) {\n // Update callbacks if any changed\n const callbacksChanged =\n prev.onTouch !== next.onTouch ||\n prev.onTouchOutside !== next.onTouchOutside ||\n prev.onTouchMove !== next.onTouchMove ||\n prev.onDoubleTap !== next.onDoubleTap ||\n prev.onLongPress !== next.onLongPress ||\n prev.onHoverStart !== next.onHoverStart ||\n prev.onHoverEnd !== next.onHoverEnd ||\n prev.onWheel !== next.onWheel\n\n if (callbacksChanged) {\n const callbacks: GestureCallbacks = {}\n if (next.onTouch) callbacks.onTouch = next.onTouch\n if (next.onTouchOutside) callbacks.onTouchOutside = next.onTouchOutside\n if (next.onTouchMove) callbacks.onTouchMove = next.onTouchMove\n if (next.onDoubleTap) callbacks.onDoubleTap = next.onDoubleTap\n if (next.onLongPress) callbacks.onLongPress = next.onLongPress\n if (next.onHoverStart) callbacks.onHoverStart = next.onHoverStart\n if (next.onHoverEnd) callbacks.onHoverEnd = next.onHoverEnd\n if (next.onWheel) callbacks.onWheel = next.onWheel\n\n manager.updateCallbacks(container, callbacks)\n }\n\n // Always update hit area when gestures are enabled\n // This ensures animated size changes (overlayHeight.value) are reflected\n // Use __getLayoutSize for actual calculated dimensions\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n let width = 100\n let height = 100\n\n if (containerWithLayout.__getLayoutSize) {\n const size = containerWithLayout.__getLayoutSize()\n width = size.width\n height = size.height\n } else {\n const bounds = container.getBounds()\n width = bounds.width || 100\n height = bounds.height || 100\n }\n\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n manager.updateHitArea(container, hitArea)\n }\n}\n","/**\n * Core prop type definitions for shared component properties\n * These prop groups can be composed to build component-specific props\n */\n\n// Import gesture types first so they can be used in GestureProps\nimport type {\n FocusEventData,\n GestureEventData,\n InputEventData,\n KeyboardEventData,\n TouchMoveState,\n WheelEventData,\n} from './gestures/gesture-types'\n\n// Re-export for public API\nexport type {\n FocusEventData,\n GestureEventData,\n InputEventData,\n KeyboardEventData,\n TouchMoveState,\n WheelEventData,\n}\n\n/**\n * Valid CSS-like size values with type safety\n * - Fixed pixels: number or \"20px\"\n * - Percentage: \"50%\", \"100%\"\n * - Viewport units: \"100vw\", \"50vh\"\n * - Keywords: \"auto\", \"fill\"\n * - Calc expressions: \"calc(100% - 20px)\"\n */\nexport type SizeValue =\n | number\n | 'auto'\n | 'fill'\n | `${number}%`\n | `${number}px`\n | `${number}vw`\n | `${number}vh`\n | `calc(${string})`\n\n/**\n * Flex basis size values (subset of SizeValue, no \"fill\" keyword)\n * - Fixed pixels: number or \"20px\"\n * - Percentage: \"50%\", \"100%\"\n * - Viewport units: \"100vw\", \"50vh\"\n * - Keyword: \"auto\"\n * - Calc expressions: \"calc(50% + 10px)\"\n */\nexport type FlexBasisValue =\n | number\n | 'auto'\n | `${number}%`\n | `${number}px`\n | `${number}vw`\n | `${number}vh`\n | `calc(${string})`\n\n/**\n * Display mode for visibility control\n * - 'visible': Rendered and takes up layout space (default)\n * - 'invisible': Not rendered but takes up layout space (like CSS visibility: hidden)\n * - 'none': Not rendered and does not take up layout space (like CSS display: none)\n */\nexport type Display = 'visible' | 'invisible' | 'none'\n\n/**\n * Transform properties - geometric transformations (position, rotation, scale)\n */\nexport interface TransformProps {\n x?: number\n y?: number\n rotation?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n}\n\n/**\n * Phaser GameObject display properties - rendering and display list API\n */\nexport interface PhaserProps {\n /**\n * Alpha transparency of the game object\n * - 0: Fully transparent\n * - 1: Fully opaque\n */\n alpha?: number\n\n /**\n * Depth (Z-index) of the game object in the display list\n * Higher values are rendered on top of lower values\n * Allows manual control over rendering order independent of child array order\n *\n * @example\n * // Layer system in stack layout\n * <View direction=\"stack\">\n * <View depth={1}>Background</View>\n * <View depth={2}>Content</View>\n * <View depth={3}>Overlay</View>\n * </View>\n */\n depth?: number\n\n /**\n * Callback invoked when GameObject is created and fully initialized\n * Useful for accessing GameObject properties (dimensions, bounds, etc.)\n * without needing useRef\n *\n * @param node - The created Phaser GameObject\n *\n * @example\n * // Display image dimensions\n * <Image\n * texture=\"icon\"\n * onReady={(img) => console.log(`${img.width}x${img.height}`)}\n * />\n *\n * // Access View bounds\n * <View\n * width={200}\n * height={100}\n * onReady={(view) => console.log(view.getBounds())}\n * />\n */\n onReady?: (node: Phaser.GameObjects.GameObject) => void\n\n /**\n * Tooltip configuration callback (desktop/mouse only)\n * Called when hover starts to determine tooltip configuration\n * Return null/undefined to disable tooltip\n * Return string as shortcut for { content: string }\n *\n * Note: Tooltips only work on desktop/mouse devices, not on touch devices (iPhone, iPad)\n *\n * @returns Tooltip configuration, string, or null to disable\n *\n * @example\n * // Simple text tooltip\n * <Button onTooltip={() => \"Click to delete\"} />\n *\n * // With i18n/translation\n * <Button onTooltip={() => t('buttons.delete')} />\n *\n * // Conditional tooltip\n * <Button onTooltip={() => isAdmin ? \"Admin action\" : null} />\n *\n * // Full configuration\n * <Button onTooltip={() => ({\n * content: \"Delete item\",\n * position: \"top\",\n * showDelay: 100\n * })} />\n *\n * // From repository/API\n * <Button onTooltip={() => tooltipRepo.get('delete-btn')} />\n */\n onTooltip?: import('./tooltip/tooltip-types').TooltipCallback\n}\n\n/**\n * Edge insets for margins and padding\n */\nexport interface EdgeInsets {\n top?: number\n right?: number\n bottom?: number\n left?: number\n}\n\n/**\n * Gap insets for horizontal and vertical gaps\n */\nexport interface GapInsets {\n horizontal?: number\n vertical?: number\n}\n\n/**\n * Corner radius specification\n */\nexport interface CornerRadiusInsets {\n tl?: number\n tr?: number\n bl?: number\n br?: number\n}\n\n/**\n * Normalize edge insets - converts number to all-sides object\n * @param value - Number (all sides) or edge insets object\n * @returns Normalized EdgeInsets object\n */\nexport function normalizeEdgeInsets(value: number | EdgeInsets | undefined): EdgeInsets {\n if (value === undefined) {\n return {}\n }\n if (typeof value === 'number') {\n return { top: value, right: value, bottom: value, left: value }\n }\n return value\n}\n\n/**\n * Normalize corner radius - converts number to all-corners object\n * @param value - Number (all corners) or corner radius object\n * @returns Normalized CornerRadiusInsets object or number\n */\nexport function normalizeCornerRadius(\n value: number | CornerRadiusInsets | undefined\n): number | CornerRadiusInsets {\n if (value === undefined) {\n return 0\n }\n if (typeof value === 'number') {\n return value\n }\n return value\n}\n\n/**\n * Normalize gap values - converts number to GapInsets object\n * @param value - Number (uniform gap) or gap insets object\n * @returns Normalized GapInsets object with horizontal and vertical values\n */\nexport function normalizeGap(value: number | GapInsets | undefined): {\n horizontal: number\n vertical: number\n} {\n if (value === undefined) {\n return { horizontal: 0, vertical: 0 }\n }\n if (typeof value === 'number') {\n return { horizontal: value, vertical: value }\n }\n return {\n horizontal: value.horizontal ?? 0,\n vertical: value.vertical ?? 0,\n }\n}\n\n/**\n * Layout properties - sizing, spacing, and layout participation\n */\nexport interface LayoutProps {\n /**\n * Visibility and layout participation\n * - true / 'visible': Rendered and takes layout space (default)\n * - false / 'invisible': Not rendered but takes layout space (like CSS visibility: hidden)\n * - 'none': Not rendered and no layout space (like CSS display: none)\n *\n * @example\n * <View visible={true}>Always visible</View>\n * <View visible={false}>Hidden but occupies space</View>\n * <View visible=\"none\">Hidden and no space</View>\n */\n visible?: boolean | Display\n\n /**\n * If true, object is rendered but excluded from layout calculations\n * Use for decorative elements, sprites, particles, or absolute-positioned objects\n * - true: Object is visual-only, doesn't affect parent/sibling layout\n * - false/undefined: Object participates in layout (default for UI elements)\n *\n * @example\n * // Decorative sprite that doesn't affect layout\n * <Sprite texture=\"particle\" headless={true} />\n *\n * // Text that participates in layout\n * <Text text=\"Label\" headless={false} />\n */\n headless?: boolean\n\n /**\n * Width of the container\n * - number: Fixed width in pixels (e.g., 200)\n * - Percentage: \"50%\", \"100%\"\n * - Viewport: \"100vw\"\n * - Keywords: \"auto\", \"fill\"\n * - Calc: \"calc(100% - 20px)\"\n * - undefined: Auto - size to content\n *\n * @example\n * width={200} // 200px fixed width\n * width=\"75%\" // 75% of parent width\n * width=\"100vw\" // 100% of viewport width\n * width=\"fill\" // Fill available space\n * width=\"calc(50% + 10px)\" // Calculated width\n * width={undefined} // Auto-size to content\n */\n width?: SizeValue | undefined\n\n /**\n * Height of the container\n * - number: Fixed height in pixels (e.g., 100)\n * - Percentage: \"50%\", \"100%\"\n * - Viewport: \"100vh\"\n * - Keywords: \"auto\", \"fill\"\n * - Calc: \"calc(100vh - 50px)\"\n * - undefined: Auto - size to content\n *\n * @example\n * height={100} // 100px fixed height\n * height=\"50%\" // 50% of parent height\n * height=\"100vh\" // 100% of viewport height\n * height=\"fill\" // Fill available space\n * height=\"calc(100% - 20px)\" // Calculated height\n * height={undefined} // Auto-size to content\n */\n height?: SizeValue | undefined\n\n /**\n * Minimum width constraint\n * Prevents element from shrinking below this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed minimum\n * <View flex={1} minWidth={200}>Sidebar</View>\n *\n * // Percentage of parent\n * <View width=\"100%\" minWidth=\"20%\" maxWidth=\"80%\">Flexible</View>\n *\n * // Viewport-based\n * <View flex={1} minWidth=\"200px\">Responsive sidebar</View>\n *\n * // Calc expression\n * <View width=\"100%\" minWidth=\"calc(50% - 20px)\">Dynamic</View>\n */\n minWidth?: SizeValue | undefined\n\n /**\n * Minimum height constraint\n * Prevents element from shrinking below this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed minimum\n * <View height=\"auto\" minHeight={100}>\n * <Text text={dynamicContent} />\n * </View>\n *\n * // Percentage of parent\n * <View height=\"100%\" minHeight=\"30%\">Flexible height</View>\n *\n * // Viewport-based\n * <View flex={1} minHeight=\"50vh\">Half viewport min</View>\n */\n minHeight?: SizeValue | undefined\n\n /**\n * Maximum width constraint\n * Prevents element from growing beyond this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed maximum\n * <View flex={1} maxWidth={800}>\n * <Text text=\"Long content...\" />\n * </View>\n *\n * // Percentage of parent\n * <View width=\"100%\" maxWidth=\"80%\">Responsive</View>\n *\n * // Viewport-based\n * <View flex={1} maxWidth=\"90vw\">Full width modal</View>\n */\n maxWidth?: SizeValue | undefined\n\n /**\n * Maximum height constraint\n * Prevents element from growing beyond this size\n * Works with flex, percentages, and auto sizing\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n *\n * @example\n * // Fixed maximum\n * <Image texture=\"photo\" width=\"100%\" maxHeight={400} />\n *\n * // Percentage of parent\n * <View height=\"100%\" maxHeight=\"80%\">Constrained</View>\n *\n * // Viewport-based\n * <View flex={1} maxHeight=\"80vh\">Scrollable content</View>\n */\n maxHeight?: SizeValue | undefined\n\n /**\n * * Margin outside the container\n * - number: Uniform margin on all sides\n * - EdgeInsets: Individual margin per side\n * - undefined: No margin\n */\n margin?: number | EdgeInsets | undefined\n\n /**\n * Padding inside the container\n * - number: Uniform padding on all sides\n * - EdgeInsets: Individual padding per side\n * - undefined: No padding\n */\n padding?: number | EdgeInsets | undefined\n\n /**\n * Layout direction for children\n * - 'column': Stack children vertically (default, like SwiftUI's VStack)\n * - 'row': Stack children horizontally (like SwiftUI's HStack)\n * - 'stack': Overlay children at the same position (like SwiftUI's ZStack)\n */\n direction?: 'row' | 'column' | 'stack'\n\n /**\n * Gap between children\n * - number: Uniform gap between all children\n * - GapInsets: Separate horizontal and vertical gaps\n * Applied between each child along the main axis (or both axes for GapInsets)\n */\n gap?: number | GapInsets | undefined\n\n /**\n * Main axis alignment (along direction)\n * - 'start': Align children to start (top for column, left for row)\n * - 'center': Center children along main axis\n * - 'end': Align children to end (bottom for column, right for row)\n * - 'space-between': Distribute children evenly, first at start, last at end\n * - 'space-around': Distribute children evenly with space around each\n * - 'space-evenly': Distribute children with equal space between and around\n */\n justifyContent?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly'\n\n /**\n * Cross axis alignment (perpendicular to direction)\n * - 'start': Align to start (left for column, top for row)\n * - 'center': Center along cross axis\n * - 'end': Align to end (right for column, bottom for row)\n * - 'stretch': Stretch children to fill cross axis (requires fixed container size)\n */\n alignItems?: 'start' | 'center' | 'end' | 'stretch'\n\n /**\n * Flex grow factor - how much of the remaining space this element should take\n * Similar to CSS flexbox flex-grow\n * - 0: Don't grow, use explicit width/height\n * - 1: Take equal share of remaining space\n * - 2+: Take proportionally more space\n *\n * @example\n * // Sidebar fixed, main content fills rest\n * <View direction=\"row\">\n * <View width={200}>Sidebar</View>\n * <View flex={1}>Main</View>\n * </View>\n *\n * // Two columns, second twice as wide\n * <View direction=\"row\">\n * <View flex={1}>Col 1</View>\n * <View flex={2}>Col 2</View>\n * </View>\n */\n flex?: number\n\n /**\n * Flex shrink factor - how much this element should shrink when space is limited\n * Similar to CSS flexbox flex-shrink\n * - 0: Don't shrink, maintain size even if container overflows\n * - 1: Shrink proportionally with other flex items (default)\n * - 2+: Shrink more than other items proportionally\n *\n * @example\n * // Text that can shrink, icon that stays fixed\n * <View direction=\"row\" width={150}>\n * <View width={50} flexShrink={0}>Icon</View>\n * <View flex={1} flexShrink={1}>Long Text...</View>\n * </View>\n *\n * // Two items, second shrinks twice as fast\n * <View direction=\"row\" width={100}>\n * <View width={80} flexShrink={1}>Item 1</View>\n * <View width={80} flexShrink={2}>Item 2</View>\n * </View>\n */\n flexShrink?: number\n\n /**\n * Flex basis - initial size before flex distribution\n * Similar to CSS flexbox flex-basis\n * - number: Fixed initial size in pixels\n * - Percentage: \"50%\", \"100%\"\n * - Viewport: \"100vw\", \"50vh\"\n * - Keyword: \"auto\"\n * - Calc: \"calc(50% + 10px)\"\n * - undefined: Use width/height as basis\n *\n * Defines the starting size before flexGrow/flexShrink is applied\n * Overrides width/height when flex is used\n *\n * @example\n * // Item starts at 200px, then grows with flex\n * <View flex={1} flexBasis={200}>Content</View>\n *\n * // Item starts at 50% of parent, then shrinks if needed\n * <View flexBasis=\"50%\" flexShrink={1}>Content</View>\n *\n * // Auto basis - uses content size\n * <View flex={1} flexBasis=\"auto\">Content</View>\n *\n * // Calc basis\n * <View flex={1} flexBasis=\"calc(100% / 3)\">Content</View>\n */\n flexBasis?: FlexBasisValue | undefined\n\n /**\n * Controls how content that overflows the container bounds is displayed\n * - 'visible': Content can overflow container bounds (default)\n * - 'hidden': Content is clipped to container bounds using Phaser mask\n *\n * @example\n * <View width={100} height={50} overflow=\"hidden\">\n * <Text text=\"This long text will be clipped\" />\n * </View>\n */\n overflow?: 'visible' | 'hidden'\n\n /**\n * Controls wrapping behavior for flex layouts\n * - 'nowrap': All items in single line (default, current behavior)\n * - 'wrap': Items wrap to new line/column when space exhausted\n * - 'wrap-reverse': Items wrap in reverse order\n *\n * Only applies to 'row' and 'column' directions, ignored for 'stack'\n * When wrapping, flex distribution is calculated per line\n *\n * @example\n * // Auto-wrap grid with 100px items\n * <View direction=\"row\" flexWrap=\"wrap\" gap={10} width={400}>\n * {items.map(item => <Card width={100} />)}\n * </View>\n *\n * // Responsive card grid\n * <View direction=\"row\" flexWrap=\"wrap\" gap={15}>\n * {cards.map(card => <View minWidth={180} flex={1}>{card}</View>)}\n * </View>\n */\n flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse'\n\n /**\n * Alignment of wrapped lines in multi-line flex container\n * Only applies when flexWrap !== 'nowrap' and there are multiple lines\n * Controls distribution of lines along cross axis (perpendicular to direction)\n *\n * - 'start': Pack lines to start (top for row, left for column)\n * - 'center': Center lines in container\n * - 'end': Pack lines to end (bottom for row, right for column)\n * - 'space-between': First line at start, last at end, equal space between\n * - 'space-around': Equal space around each line\n * - 'stretch': Lines stretch to fill cross axis (default)\n *\n * Difference from alignItems:\n * - alignItems: Aligns items within each line\n * - alignContent: Aligns the lines themselves within container\n *\n * @example\n * ```tsx\n * // Grid with lines distributed vertically\n * <View\n * direction=\"row\"\n * flexWrap=\"wrap\"\n * alignContent=\"space-between\"\n * height={400}\n * >\n * {items}\n * </View>\n * ```\n */\n alignContent?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'stretch'\n}\n\n/**\n * Background styling properties\n */\nexport interface BackgroundProps {\n backgroundColor?: number | undefined\n backgroundAlpha?: number | undefined\n cornerRadius?: number | CornerRadiusInsets | undefined\n borderWidth?: number | undefined\n borderColor?: number | undefined\n borderAlpha?: number\n}\n\n/**\n * Text-specific styling properties\n */\nexport interface TextSpecificProps {\n text: string | undefined\n /**\n * Maximum width for text wrapping\n * Supports all SizeValue formats (pixels, percentage, viewport units, calc)\n */\n maxWidth?: SizeValue\n}\n\n/**\n * High-level gesture props - unified touch and mouse interaction\n * These provide cross-platform gesture detection with transparent mouse/touch support\n */\nexport interface GestureProps {\n /**\n * Enable gesture system for this container\n * Must be true to receive any gesture events\n * Default: false (no overhead for non-interactive containers)\n */\n enableGestures?: boolean\n\n /**\n * Called on pointer down + up on the same target (click/tap)\n * Works for both mouse click and touch tap\n * Only fires if touch duration is within maxTouchDuration\n */\n onTouch?: (data: GestureEventData) => void\n\n /**\n * Called when pointer up occurs outside the container\n * Useful for click-outside detection (dropdowns, modals, tooltips)\n * Only fires if touch duration is within maxTouchDuration\n * Requires enableGestures: true\n */\n onTouchOutside?: (data: GestureEventData) => void\n\n /**\n * Called during pointer movement - continues even when outside bounds\n * Provides dx/dy deltas for tracking drag operations\n * Includes isInside flag and state ('start' | 'move' | 'end')\n * Requires enableGestures: true\n */\n onTouchMove?: (data: GestureEventData) => void\n\n /**\n * Called when double tap/click is detected within configured delay\n * Optional - only enable if needed to reduce overhead\n */\n onDoubleTap?: (data: GestureEventData) => void\n\n /**\n * Called when pointer is held down for configured duration\n * Optional - only enable if needed to reduce overhead\n */\n onLongPress?: (data: GestureEventData) => void\n\n /**\n * Duration in ms to trigger long press\n * Default: 500ms\n */\n longPressDuration?: number\n\n /**\n * Max time in ms between taps for double tap detection\n * Default: 300ms\n */\n doubleTapDelay?: number\n\n /**\n * Max time in ms for a valid touch/click (prevents delayed touch after long hold)\n * Default: 500ms\n */\n maxTouchDuration?: number\n\n /**\n * Called when a key is pressed down\n * Requires enableGestures: true\n */\n onKeyDown?: (data: KeyboardEventData) => void\n\n /**\n * Called when a key is released\n * Requires enableGestures: true\n */\n onKeyUp?: (data: KeyboardEventData) => void\n\n /**\n * Called when input value changes\n * Requires enableGestures: true\n */\n onInput?: (data: InputEventData) => void\n\n /**\n * Called when element receives focus\n * Requires enableGestures: true\n */\n onFocus?: (data: FocusEventData) => void\n\n /**\n * Called when element loses focus\n * Requires enableGestures: true\n */\n onBlur?: (data: FocusEventData) => void\n\n /**\n * Called when pointer enters the container (desktop/mouse only)\n * Does not work on touch devices (iPhone, iPad)\n * Requires enableGestures: true\n */\n onHoverStart?: (data: import('./gestures/gesture-types').HoverEventData) => void\n\n /**\n * Called when pointer exits the container (desktop/mouse only)\n * Does not work on touch devices (iPhone, iPad)\n * Requires enableGestures: true\n */\n onHoverEnd?: (data: import('./gestures/gesture-types').HoverEventData) => void\n\n /**\n * Called when mouse wheel is scrolled over container (desktop/mouse only)\n * Does not work on touch devices (iPhone, iPad)\n * Provides deltaX/deltaY for scroll amounts\n * Requires enableGestures: true\n */\n onWheel?: (data: WheelEventData) => void\n}\n","/**\n * Background applier - updates background and hit area\n */\nimport type Phaser from 'phaser'\nimport { DebugLogger } from '../../dev-config'\nimport type { GameObjectWithLayout } from '../types'\n\n/**\n * Update background graphics size if present\n * @param container - Phaser container\n * @param width - Background width\n * @param height - Background height\n */\nexport function updateBackground(\n container: Phaser.GameObjects.Container,\n width: number,\n height: number\n): void {\n const background = (container as GameObjectWithLayout).__background\n if (background) {\n // Graphics don't have setSize - need to redraw\n // Get current fill/stroke styles from __layoutProps\n const layoutProps = (container as GameObjectWithLayout).__layoutProps\n if (layoutProps) {\n const bgColor = layoutProps.backgroundColor\n const bgAlpha = layoutProps.backgroundAlpha ?? 1\n const cornerRadius = layoutProps.cornerRadius ?? 0\n const borderWidth = layoutProps.borderWidth ?? 0\n const borderColor = layoutProps.borderColor\n const borderAlpha = layoutProps.borderAlpha ?? 1\n const hasBorder = borderWidth > 0 && borderColor !== undefined\n\n background.clear()\n\n if (bgColor !== undefined) {\n background.fillStyle(bgColor, bgAlpha)\n }\n\n if (hasBorder) {\n background.lineStyle(borderWidth, borderColor, borderAlpha)\n }\n\n if (cornerRadius !== 0) {\n if (bgColor !== undefined) {\n background.fillRoundedRect(0, 0, width, height, cornerRadius)\n }\n if (hasBorder) {\n background.strokeRoundedRect(0, 0, width, height, cornerRadius)\n }\n } else {\n if (bgColor !== undefined) {\n background.fillRect(0, 0, width, height)\n }\n if (hasBorder) {\n background.strokeRect(0, 0, width, height)\n }\n }\n\n DebugLogger.log('layout', 'Background redrawn to:', { width, height })\n }\n }\n}\n\n/**\n * Update interactive hit area if present\n * @param container - Phaser container\n * @param width - Hit area width\n * @param height - Hit area height\n */\nexport function updateHitArea(\n container: Phaser.GameObjects.Container,\n width: number,\n height: number\n): void {\n if (container.input?.hitArea && 'setSize' in container.input.hitArea) {\n const hitArea = container.input.hitArea as Phaser.Geom.Rectangle\n const oldWidth = hitArea.width\n const oldHeight = hitArea.height\n\n // Only update if dimensions actually changed\n if (oldWidth !== width || oldHeight !== height) {\n // Position hit area centered around origin (container's local 0,0)\n // This is needed because Phaser containers treat hit areas relative to their center\n hitArea.setPosition(0, 0)\n hitArea.setSize(width, height)\n\n DebugLogger.log('layout', 'Hit area resized:', {\n from: { x: hitArea.x, y: hitArea.y, width: oldWidth, height: oldHeight },\n to: { x: 0, y: 0, width, height },\n })\n }\n }\n}\n","/**\n * Container applier - applies dimensions to container\n */\nimport type Phaser from 'phaser'\nimport { DebugLogger } from '../../dev-config'\nimport type { GameObjectWithLayout, LayoutSize } from '../types'\n\n/**\n * Apply dimensions to container and cache them for child percentage resolution\n * @param container - Phaser container\n * @param width - Container width\n * @param height - Container height\n */\nexport function applyContainerDimensions(\n container: Phaser.GameObjects.Container,\n width: number,\n height: number\n): void {\n const gameObject = container as GameObjectWithLayout & {\n __cachedLayoutSize?: LayoutSize\n __originalGetLayoutSize?: () => LayoutSize\n }\n gameObject.width = width\n gameObject.height = height\n\n // Cache the final layout size - this allows children to query parent size\n // for percentage-based constraints even when layout is recalculated\n gameObject.__cachedLayoutSize = { width, height }\n\n // Override __getLayoutSize to return cached value if available\n // Store original implementation on first call, then always use cache\n if (gameObject.__getLayoutSize && !gameObject.__originalGetLayoutSize) {\n gameObject.__originalGetLayoutSize = gameObject.__getLayoutSize\n gameObject.__getLayoutSize = () =>\n gameObject.__cachedLayoutSize ??\n (gameObject.__originalGetLayoutSize?.() || { width: 0, height: 0 })\n }\n\n DebugLogger.log('layout', 'Container dimensions set to:', { width, height })\n}\n","/**\n * Position applier - applies calculated positions to game objects\n */\nimport { DebugLogger } from '../../dev-config'\nimport type { LayoutChild, Position } from '../types'\n\n/**\n * Apply positions to children\n * @param children - Array of layout children\n * @param positions - Calculated positions for each child\n */\nexport function applyChildPositions(children: LayoutChild[], positions: Position[]): void {\n for (let i = 0; i < children.length; i++) {\n const childData = children[i]\n const position = positions[i]\n\n if (!childData || !position) continue\n\n const { child, size } = childData\n const { x, y } = position\n\n // Apply size (resolved from layout props, including percentages)\n if ('setSize' in child && typeof child.setSize === 'function') {\n if (size.width !== child.width || size.height !== child.height) {\n DebugLogger.log('positioning', 'Setting child', `${i} size: ${size.width}x${size.height}`)\n ;(child as { setSize: (w: number, h: number) => unknown }).setSize(size.width, size.height)\n }\n } else {\n // Fallback: directly set width/height\n child.width = size.width\n child.height = size.height\n if ('displayWidth' in child) (child as { displayWidth: number }).displayWidth = size.width\n if ('displayHeight' in child) (child as { displayHeight: number }).displayHeight = size.height\n }\n\n // Apply position\n if (child.setPosition) {\n DebugLogger.log('positioning', 'Setting child', ` ${i} position: (${x}, ${y})`)\n child.setPosition(x, y)\n }\n }\n}\n","/**\n * Spacing and alignment calculation utilities\n * Handles justifyContent and alignItems positioning logic\n */\nimport type { LayoutProps } from '../../core-props'\n\n/**\n * Justify content calculation result\n */\nexport interface JustifyResult {\n mainStart: number\n spaceBetween: number\n}\n\n/**\n * Calculate main axis starting position and spacing between children\n * @param justifyContent - Justify content value\n * @param remainingSpace - Space remaining after children are placed\n * @param childCount - Number of children\n * @returns Main axis starting offset and spacing between children\n */\nexport function calculateJustifyContent(\n justifyContent: LayoutProps['justifyContent'],\n remainingSpace: number,\n childCount: number\n): JustifyResult {\n let mainStart = 0\n let spaceBetween = 0\n\n switch (justifyContent) {\n case 'start':\n mainStart = 0\n break\n case 'center':\n mainStart = Math.max(0, remainingSpace / 2)\n break\n case 'end':\n mainStart = Math.max(0, remainingSpace)\n break\n case 'space-between':\n mainStart = 0\n spaceBetween = childCount > 1 ? remainingSpace / (childCount - 1) : 0\n break\n case 'space-around':\n spaceBetween = childCount > 0 ? remainingSpace / childCount : 0\n mainStart = spaceBetween / 2\n break\n case 'space-evenly':\n spaceBetween = childCount > 0 ? remainingSpace / (childCount + 1) : 0\n mainStart = spaceBetween\n break\n default:\n // 'start' is default\n mainStart = 0\n break\n }\n\n return { mainStart, spaceBetween }\n}\n\n/**\n * Calculate cross axis position for a child\n * @param alignItems - Align items value\n * @param contentArea - Available space on cross axis\n * @param childSize - Size of child on cross axis\n * @param marginStart - Margin at start of cross axis (top for row, left for column)\n * @param marginEnd - Margin at end of cross axis (bottom for row, right for column)\n * @returns Cross axis position\n */\nexport function calculateAlignItems(\n alignItems: LayoutProps['alignItems'],\n contentArea: number,\n childSize: number,\n marginStart: number,\n marginEnd: number\n): number {\n switch (alignItems) {\n case 'start':\n return marginStart\n case 'center':\n return (contentArea - childSize) / 2\n case 'end':\n return contentArea - childSize - marginEnd\n case 'stretch':\n // Stretch: position at start (size is stretched in layout engine)\n return marginStart\n default:\n return marginStart\n }\n}\n","/**\n * Base strategy interface for layout algorithms\n * Defines the contract for all layout strategies\n */\nimport type { LayoutChild, LayoutContext, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\n\n/**\n * Layout strategy interface\n * Each direction (row, column, stack) implements this interface\n */\nexport interface LayoutStrategy {\n /**\n * Calculate content dimensions for this layout strategy\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics (maxWidth, maxHeight, totalMainSize)\n */\n calculateMetrics(children: LayoutChild[], context: LayoutContext): ContentMetrics\n\n /**\n * Calculate position for a child at given index\n * @param child - Layout child\n * @param index - Child index\n * @param context - Layout context\n * @param currentMain - Current position on main axis\n * @returns Position (x, y) and updated currentMain value\n */\n positionChild(\n child: LayoutChild,\n index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number }\n}\n\n/**\n * Abstract base class for layout strategies\n * Provides common functionality for all strategies\n */\nexport abstract class BaseLayoutStrategy implements LayoutStrategy {\n abstract calculateMetrics(children: LayoutChild[], context: LayoutContext): ContentMetrics\n\n abstract positionChild(\n child: LayoutChild,\n index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number }\n\n /**\n * Helper: Normalize margin values\n * @param child - Layout child\n * @returns Normalized margin values\n */\n protected getMarginValues(child: LayoutChild) {\n return {\n top: child.margin.top ?? 0,\n right: child.margin.right ?? 0,\n bottom: child.margin.bottom ?? 0,\n left: child.margin.left ?? 0,\n }\n }\n\n /**\n * Helper: Calculate total child size including margins\n * @param child - Layout child\n * @returns Total width and height including margins\n */\n protected getTotalChildSize(child: LayoutChild) {\n const margin = this.getMarginValues(child)\n return {\n width: margin.left + child.size.width + margin.right,\n height: margin.top + child.size.height + margin.bottom,\n }\n }\n}\n","/**\n * Column layout strategy (vertical stacking)\n * Like SwiftUI's VStack\n */\nimport type { LayoutChild, LayoutContext, LayoutLine, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\nimport { parseSize, resolveSize } from '../utils/size-resolver'\nimport { calculateAlignItems } from '../utils/spacing-calculator'\nimport { BaseLayoutStrategy } from './base-strategy'\n\n/**\n * Column layout strategy - stacks children vertically\n */\nexport class ColumnLayoutStrategy extends BaseLayoutStrategy {\n /**\n * Calculate content dimensions for column layout\n * For flex children, uses a minimum default size to avoid chicken-egg sizing issues\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics\n */\n calculateMetrics(children: LayoutChild[], _context: LayoutContext): ContentMetrics {\n const FLEX_CHILD_MIN_SIZE = 100 // Minimum size for flex children in content calculation\n let maxWidth = 0\n let totalMainSize = 0\n\n for (const child of children) {\n const total = this.getTotalChildSize(child)\n maxWidth = Math.max(maxWidth, total.width)\n\n // Check if this child participates in flexbox (flex, flexShrink, or flexBasis)\n const props = child.child.__layoutProps\n const isFlexItem =\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n // If flex child already has a resolved size (> 10), use it; otherwise use minimum\n const childHeight = isFlexItem && child.size.height <= 10 ? FLEX_CHILD_MIN_SIZE : total.height\n\n totalMainSize += childHeight\n }\n\n return {\n maxWidth,\n maxHeight: 0, // Not used for column\n totalMainSize,\n }\n }\n\n /**\n * Position a child in column layout\n * @param child - Layout child\n * @param _index - Child index (unused for column layout)\n * @param context - Layout context\n * @param currentMain - Current Y position\n * @returns Position and next main axis value\n */\n positionChild(\n child: LayoutChild,\n _index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number } {\n const margin = this.getMarginValues(child)\n const isHeadless = child.child.__layoutProps?.headless\n\n let x: number\n let y: number\n let nextMain: number\n\n if (isHeadless) {\n // Headless: calculate position directly using alignItems/justifyContent on full parent size\n const parentWidth = context.parentSize?.width ?? context.contentArea.width\n const parentHeight = context.parentSize?.height ?? context.contentArea.height\n\n // justifyContent on main axis (vertical) - manual calculation\n const justify = context.containerProps.justifyContent ?? 'start'\n let mainAxisOffset = 0\n if (justify === 'center') {\n mainAxisOffset = (parentHeight - child.size.height) / 2\n } else if (justify === 'end') {\n mainAxisOffset = parentHeight - child.size.height\n }\n // start and space-* variants use 0 for single item\n y = mainAxisOffset\n\n // alignItems on cross axis (horizontal)\n const crossAxisOffset = calculateAlignItems(\n context.containerProps.alignItems,\n parentWidth,\n child.size.width,\n 0,\n 0\n )\n x = crossAxisOffset\n\n // Don't advance currentMain for headless (they don't participate in flow)\n nextMain = currentMain\n } else {\n // Normal: use container padding and contentArea\n currentMain += margin.top\n y = context.padding.top + currentMain\n\n const alignOffset = calculateAlignItems(\n context.containerProps.alignItems,\n context.contentArea.width,\n child.size.width,\n margin.left,\n margin.right\n )\n x = context.padding.left + alignOffset\n\n nextMain = currentMain + child.size.height + margin.bottom\n }\n\n return {\n position: { x, y },\n nextMain,\n }\n }\n\n /**\n * Wrap children into lines based on available height\n * Used when flexWrap is 'wrap' or 'wrap-reverse'\n * @param children - Layout children to wrap\n * @param availableHeight - Available height for each line\n * @param gap - Gap between children\n * @returns Array of layout lines\n */\n wrapChildren(children: LayoutChild[], availableHeight: number, gap: number): LayoutLine[] {\n const lines: LayoutLine[] = []\n let currentLine: LayoutChild[] = []\n let currentLineHeight = 0\n let currentLineWidth = 0\n\n for (const child of children) {\n // Skip headless children in wrapping calculation\n if (child.child.__layoutProps?.headless) {\n continue\n }\n\n const margin = this.getMarginValues(child)\n const props = child.child.__layoutProps\n\n // For flex items with no size, use flexBasis or minHeight as hint for wrapping\n let effectiveHeight = child.size.height\n if (effectiveHeight <= 0 && props) {\n if (props.flexBasis !== undefined && typeof props.flexBasis === 'number') {\n effectiveHeight = props.flexBasis\n } else if (props.minHeight !== undefined) {\n // Resolve minHeight SizeValue to number\n const parsed = parseSize(props.minHeight)\n effectiveHeight = resolveSize(parsed, availableHeight, 100, undefined)\n } else if (props.flex && props.flex > 0) {\n // Use a reasonable default for flex items with no size hint\n effectiveHeight = 100\n }\n }\n\n const childHeight = effectiveHeight + margin.top + margin.bottom\n const childWidth = child.size.width + margin.left + margin.right\n\n const gapSpace = currentLine.length > 0 ? gap : 0\n const requiredSpace = currentLineHeight + childHeight + gapSpace\n\n // Check if we need to wrap to a new line (column)\n if (requiredSpace > availableHeight && currentLine.length > 0) {\n // Save current line\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineHeight,\n crossAxisSize: currentLineWidth,\n })\n\n // Start new line\n currentLine = [child]\n currentLineHeight = childHeight\n currentLineWidth = childWidth\n } else {\n // Add to current line\n currentLine.push(child)\n currentLineHeight = requiredSpace\n currentLineWidth = Math.max(currentLineWidth, childWidth)\n }\n }\n\n // Add remaining line\n if (currentLine.length > 0) {\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineHeight,\n crossAxisSize: currentLineWidth,\n })\n }\n\n return lines\n }\n}\n","/**\n * Row layout strategy (horizontal stacking)\n * Like SwiftUI's HStack\n */\nimport type { LayoutChild, LayoutContext, LayoutLine, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\nimport { parseSize, resolveSize } from '../utils/size-resolver'\nimport { calculateAlignItems } from '../utils/spacing-calculator'\nimport { BaseLayoutStrategy } from './base-strategy'\n\n/**\n * Row layout strategy - stacks children horizontally\n */\nexport class RowLayoutStrategy extends BaseLayoutStrategy {\n /**\n * Calculate content dimensions for row layout\n * For flex children, uses a minimum default size to avoid chicken-egg sizing issues\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics\n */\n calculateMetrics(children: LayoutChild[], _context: LayoutContext): ContentMetrics {\n const FLEX_CHILD_MIN_SIZE = 100 // Minimum size for flex children in content calculation\n let maxHeight = 0\n let totalMainSize = 0\n\n for (const child of children) {\n const total = this.getTotalChildSize(child)\n maxHeight = Math.max(maxHeight, total.height)\n\n // Check if this child participates in flexbox (flex, flexShrink, or flexBasis)\n const props = child.child.__layoutProps\n const isFlexItem =\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n // If flex child already has a resolved size (> 10), use it; otherwise use minimum\n const childWidth = isFlexItem && child.size.width <= 10 ? FLEX_CHILD_MIN_SIZE : total.width\n\n totalMainSize += childWidth\n }\n\n return {\n maxWidth: 0, // Not used for row\n maxHeight,\n totalMainSize,\n }\n }\n\n /**\n * Position a child in row layout\n * @param child - Layout child\n * @param _index - Child index (unused for row layout)\n * @param context - Layout context\n * @param currentMain - Current X position\n * @returns Position and next main axis value\n */\n positionChild(\n child: LayoutChild,\n _index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number } {\n const margin = this.getMarginValues(child)\n const isHeadless = child.child.__layoutProps?.headless\n\n let x: number\n let y: number\n let nextMain: number\n\n if (isHeadless) {\n // Headless: calculate position directly using alignItems/justifyContent on full parent size\n const parentWidth = context.parentSize?.width ?? context.contentArea.width\n const parentHeight = context.parentSize?.height ?? context.contentArea.height\n\n // justifyContent on main axis (horizontal)\n const justify = context.containerProps.justifyContent ?? 'start'\n let mainAxisOffset = 0\n if (justify === 'center') {\n mainAxisOffset = (parentWidth - child.size.width) / 2\n } else if (justify === 'end') {\n mainAxisOffset = parentWidth - child.size.width\n }\n x = mainAxisOffset\n\n // alignItems on cross axis (vertical)\n const crossAxisOffset = calculateAlignItems(\n context.containerProps.alignItems,\n parentHeight,\n child.size.height,\n 0,\n 0\n )\n y = crossAxisOffset\n\n // Don't advance currentMain for headless\n nextMain = currentMain\n } else {\n // Normal: use container padding and contentArea\n currentMain += margin.left\n x = context.padding.left + currentMain\n\n const alignOffset = calculateAlignItems(\n context.containerProps.alignItems,\n context.contentArea.height,\n child.size.height,\n margin.top,\n margin.bottom\n )\n y = context.padding.top + alignOffset\n\n nextMain = currentMain + child.size.width + margin.right\n }\n\n return {\n position: { x, y },\n nextMain,\n }\n }\n\n /**\n * Wrap children into lines based on available width\n * Used when flexWrap is 'wrap' or 'wrap-reverse'\n * @param children - Layout children to wrap\n * @param availableWidth - Available width for each line\n * @param gap - Gap between children\n * @returns Array of layout lines\n */\n wrapChildren(children: LayoutChild[], availableWidth: number, gap: number): LayoutLine[] {\n const lines: LayoutLine[] = []\n let currentLine: LayoutChild[] = []\n let currentLineWidth = 0\n let currentLineHeight = 0\n\n for (const child of children) {\n // Skip headless children in wrapping calculation\n if (child.child.__layoutProps?.headless) {\n continue\n }\n\n const margin = this.getMarginValues(child)\n const props = child.child.__layoutProps\n\n // For flex items with no size, use flexBasis or minWidth as hint for wrapping\n let effectiveWidth = child.size.width\n if (effectiveWidth <= 0 && props) {\n if (props.flexBasis !== undefined && typeof props.flexBasis === 'number') {\n effectiveWidth = props.flexBasis\n } else if (props.minWidth !== undefined) {\n // Resolve minWidth SizeValue to number\n const parsed = parseSize(props.minWidth)\n effectiveWidth = resolveSize(parsed, availableWidth, 100, undefined)\n } else if (props.flex && props.flex > 0) {\n // Use a reasonable default for flex items with no size hint\n effectiveWidth = 100\n }\n }\n\n const childWidth = effectiveWidth + margin.left + margin.right\n const childHeight = child.size.height + margin.top + margin.bottom\n\n const gapSpace = currentLine.length > 0 ? gap : 0\n const requiredSpace = currentLineWidth + childWidth + gapSpace\n\n // Check if we need to wrap to a new line\n if (requiredSpace > availableWidth && currentLine.length > 0) {\n // Save current line\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineWidth,\n crossAxisSize: currentLineHeight,\n })\n\n // Start new line\n currentLine = [child]\n currentLineWidth = childWidth\n currentLineHeight = childHeight\n } else {\n // Add to current line\n currentLine.push(child)\n currentLineWidth = requiredSpace\n currentLineHeight = Math.max(currentLineHeight, childHeight)\n }\n }\n\n // Add remaining line\n if (currentLine.length > 0) {\n lines.push({\n children: currentLine,\n mainAxisSize: currentLineWidth,\n crossAxisSize: currentLineHeight,\n })\n }\n\n return lines\n }\n}\n","/**\n * Stack layout strategy (overlay positioning)\n * Like SwiftUI's ZStack - all children positioned at same location\n */\nimport type { LayoutChild, LayoutContext, Position } from '../types'\nimport type { ContentMetrics } from '../utils/dimension-calculator'\nimport { BaseLayoutStrategy } from './base-strategy'\n\n/**\n * Stack layout strategy - overlays all children at the same position\n */\nexport class StackLayoutStrategy extends BaseLayoutStrategy {\n /**\n * Calculate content dimensions for stack layout\n * For stack, we track max dimensions as children overlay\n * @param children - Array of layout children\n * @param context - Layout context\n * @returns Content metrics\n */\n calculateMetrics(children: LayoutChild[], _context: LayoutContext): ContentMetrics {\n let maxWidth = 0\n let maxHeight = 0\n\n for (const child of children) {\n const total = this.getTotalChildSize(child)\n maxWidth = Math.max(maxWidth, total.width)\n maxHeight = Math.max(maxHeight, total.height)\n }\n\n return {\n maxWidth,\n maxHeight,\n totalMainSize: 0, // Not applicable for stack\n }\n }\n\n /**\n * Position a child in stack layout\n * All children positioned at same location, aligned via alignItems\n * @param child - Layout child\n * @param _index - Child index (unused for stack layout)\n * @param context - Layout context\n * @param currentMain - Current position (unused for stack)\n * @returns Position and unchanged currentMain\n */\n positionChild(\n child: LayoutChild,\n _index: number,\n context: LayoutContext,\n currentMain: number\n ): { position: Position; nextMain: number } {\n const margin = this.getMarginValues(child)\n const { alignItems } = context.containerProps\n\n let x = 0\n let y = 0\n\n // Position based on alignItems (applies to both axes for stack)\n switch (alignItems) {\n case 'start':\n x = context.padding.left + margin.left\n y = context.padding.top + margin.top\n break\n case 'center':\n x = context.padding.left + (context.contentArea.width - child.size.width) / 2\n y = context.padding.top + (context.contentArea.height - child.size.height) / 2\n break\n case 'end':\n x = context.padding.left + context.contentArea.width - child.size.width - margin.right\n y = context.padding.top + context.contentArea.height - child.size.height - margin.bottom\n break\n case 'stretch':\n // TODO: Implement stretch - for now behave like start\n x = context.padding.left + margin.left\n y = context.padding.top + margin.top\n break\n default:\n x = context.padding.left + margin.left\n y = context.padding.top + margin.top\n break\n }\n\n // Apply explicit x/y offsets if provided\n const childX = child.child.__layoutProps?.x\n const childY = child.child.__layoutProps?.y\n\n if (childX !== undefined) {\n x += childX\n }\n if (childY !== undefined) {\n y += childY\n }\n\n return {\n position: { x, y },\n nextMain: currentMain, // Stack doesn't advance main axis\n }\n }\n}\n","/**\n * Utility functions for working with layout children\n */\nimport type Phaser from 'phaser'\nimport type { EdgeInsets, LayoutProps } from '../../core-props'\nimport { DebugLogger } from '../../dev-config'\nimport type { GameObjectWithLayout, LayoutChild, LayoutSize } from '../types'\nimport { clampSize, parseSize, resolveSize } from './size-resolver'\n\n/**\n * Check if a child should participate in layout calculations\n * Headless objects participate in layout (for alignment) but report size 0\n * @param child - Child game object\n * @returns True if child should be included in layout\n */\nexport function isLayoutChild(child: GameObjectWithLayout): boolean {\n // Skip background graphics (special role - defines container dimensions)\n if (child.__isBackground) return false\n\n // Check display mode from __layoutProps (visible prop)\n const displayMode = child.__layoutProps?.visible\n\n // Skip children with visible=\"none\" - they don't take up space (like CSS display: none)\n // Note: visible=false / \"invisible\" still occupies space (like CSS visibility: hidden)\n // Note: alpha=0 is different - it renders transparent but still occupies space\n if (displayMode === 'none') return false\n\n // Require __getLayoutSize for layout participation\n // Note: Headless objects still participate, they just report size 0\n return typeof child.__getLayoutSize === 'function'\n}\n\n/**\n * Get effective margin for a child\n * Normalizes margin to EdgeInsets (supports number for all sides)\n * Headless objects have no margin (positioned as point)\n * @param child - Child game object\n * @returns Edge insets\n */\nexport function getMargin(child: GameObjectWithLayout): EdgeInsets {\n const margin = child.__layoutProps?.margin\n if (typeof margin === 'number') {\n return { top: margin, right: margin, bottom: margin, left: margin }\n }\n return margin ?? {}\n}\n\n/**\n * Get effective size of a child\n * Calls __getLayoutSize if available, otherwise falls back to layoutProps or default\n * Note: String sizes (percentages) are resolved later with parent context\n * @param child - Child game object\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n * @returns Width and height in pixels\n */\nexport function getChildSize(\n child: GameObjectWithLayout,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): LayoutSize {\n // For flex children, we still need to calculate their actual size\n // (especially for cross-axis dimension in row/column layouts)\n // The main-axis size will be overridden by flex distribution anyway\n\n // If __layoutProps exists, use it (has priority for explicit layout configuration)\n if (\n child.__layoutProps &&\n (child.__layoutProps.width !== undefined || child.__layoutProps.height !== undefined)\n ) {\n const layoutWidth = child.__layoutProps.width\n const layoutHeight = child.__layoutProps.height\n\n // Resolve width\n const parsedWidth = parseSize(layoutWidth)\n let width = resolveSize(\n parsedWidth,\n parentSize?.width,\n child.width ?? 100,\n parentPadding?.horizontal\n )\n\n // Resolve height\n const parsedHeight = parseSize(layoutHeight)\n let height = resolveSize(\n parsedHeight,\n parentSize?.height,\n child.height ?? 20,\n parentPadding?.vertical\n )\n\n // Apply min/max constraints\n const { minWidth, maxWidth, minHeight, maxHeight } = child.__layoutProps\n width = clampSize(\n width,\n minWidth,\n maxWidth,\n parentSize?.width,\n child.width,\n parentPadding?.horizontal\n )\n height = clampSize(\n height,\n minHeight,\n maxHeight,\n parentSize?.height,\n child.height,\n parentPadding?.vertical\n )\n\n return { width, height }\n }\n\n // Use dynamic size provider if available\n if (child.__getLayoutSize) {\n let size = child.__getLayoutSize()\n\n // Apply constraints if layoutProps exist (even without explicit width/height)\n if (child.__layoutProps) {\n const { minWidth, maxWidth, minHeight, maxHeight } = child.__layoutProps\n size = {\n width: clampSize(\n size.width,\n minWidth,\n maxWidth,\n parentSize?.width,\n child.width,\n parentPadding?.horizontal\n ),\n height: clampSize(\n size.height,\n minHeight,\n maxHeight,\n parentSize?.height,\n child.height,\n parentPadding?.vertical\n ),\n }\n }\n\n return size\n }\n\n // Fallback to current dimensions or default\n let width = child.width ?? 100\n let height = child.height ?? 20\n\n // Apply constraints if layoutProps exist\n if (child.__layoutProps) {\n const { minWidth, maxWidth, minHeight, maxHeight } = child.__layoutProps\n width = clampSize(\n width,\n minWidth,\n maxWidth,\n parentSize?.width,\n child.width,\n parentPadding?.horizontal\n )\n height = clampSize(\n height,\n minHeight,\n maxHeight,\n parentSize?.height,\n child.height,\n parentPadding?.vertical\n )\n }\n\n return { width, height }\n}\n\n/**\n * Process a child container by recursively calculating its layout\n * @param child - Child game object to process\n * @param calculateLayoutFn - Layout calculation function (passed to avoid circular dependency)\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n */\nexport function processNestedContainer(\n child: GameObjectWithLayout,\n calculateLayoutFn: (\n container: Phaser.GameObjects.Container,\n props: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n ) => void,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): void {\n if (!('list' in child) || !Array.isArray((child as Phaser.GameObjects.Container).list)) {\n return\n }\n\n const childContainer = child as Phaser.GameObjects.Container\n const childLayoutProps = child.__layoutProps ?? {}\n\n DebugLogger.log('layout', 'Child is a container, calculating nested layout first')\n\n calculateLayoutFn(childContainer, childLayoutProps, parentSize, parentPadding)\n}\n\n/**\n * Filter and prepare children for layout calculations\n * Skips background elements and processes nested containers\n * @param children - Raw children from container\n * @param calculateLayoutFn - Layout calculation function for nested containers\n * @returns Prepared layout children with size and margin data\n */\nexport function prepareLayoutChildren(\n children: GameObjectWithLayout[],\n calculateLayoutFn: (container: Phaser.GameObjects.Container, props: LayoutProps) => void\n): LayoutChild[] {\n const layoutChildren: LayoutChild[] = []\n\n for (const child of children) {\n // Skip background rectangles\n if (child.__isBackground) {\n DebugLogger.log('layout', 'Skipping background')\n continue\n }\n\n // Process nested containers first\n processNestedContainer(child, calculateLayoutFn)\n\n const size = getChildSize(child)\n const margin = getMargin(child)\n\n layoutChildren.push({ child, size, margin })\n }\n\n return layoutChildren\n}\n\n/**\n * Extract margin values with defaults\n * @param margin - Edge insets\n * @returns Individual margin values\n */\nexport function extractMarginValues(margin: EdgeInsets) {\n return {\n top: margin.top ?? 0,\n right: margin.right ?? 0,\n bottom: margin.bottom ?? 0,\n left: margin.left ?? 0,\n }\n}\n","/**\n * Dimension calculation utilities for layout system\n * Handles content size tracking and container dimension computation\n */\nimport type { EdgeInsets, LayoutProps } from '../../core-props'\nimport type { LayoutChild } from '../types'\nimport { clampSize, parseSize, resolveSize } from './size-resolver'\n\n/**\n * Content dimension metrics\n */\nexport interface ContentMetrics {\n maxWidth: number\n maxHeight: number\n totalMainSize: number\n}\n\n/**\n * Padding values (normalized)\n */\nexport interface PaddingValues {\n left: number\n top: number\n right: number\n bottom: number\n}\n\n/**\n * Calculate content dimensions based on children and layout direction\n * For flex children, uses a minimum default size to avoid chicken-egg sizing issues\n * @param children - Array of layout children with size and margin info\n * @param direction - Layout direction ('row', 'column', or 'stack')\n * @returns Content metrics including max dimensions and total main axis size\n */\nexport function calculateContentDimensions(\n children: LayoutChild[],\n direction: 'row' | 'column' | 'stack'\n): ContentMetrics {\n const FLEX_CHILD_MIN_SIZE = 100 // Minimum size for flex children in content calculation\n let maxWidth = 0\n let maxHeight = 0\n let totalMainSize = 0\n\n for (const { size, margin, child } of children) {\n const marginTop = margin.top ?? 0\n const marginBottom = margin.bottom ?? 0\n const marginLeft = margin.left ?? 0\n const marginRight = margin.right ?? 0\n\n // Check if this child has flex property\n const hasFlex = (child.__layoutProps?.flex ?? 0) > 0\n\n if (direction === 'row') {\n const childWidth = hasFlex ? FLEX_CHILD_MIN_SIZE : size.width\n totalMainSize += marginLeft + childWidth + marginRight\n const childTotalHeight = marginTop + size.height + marginBottom\n maxHeight = Math.max(maxHeight, childTotalHeight)\n } else if (direction === 'column') {\n const childTotalWidth = marginLeft + size.width + marginRight\n maxWidth = Math.max(maxWidth, childTotalWidth)\n const childHeight = hasFlex ? FLEX_CHILD_MIN_SIZE : size.height\n totalMainSize += marginTop + childHeight + marginBottom\n } else if (direction === 'stack') {\n // For stack, track max dimensions (children overlay)\n const childTotalWidth = marginLeft + size.width + marginRight\n const childTotalHeight = marginTop + size.height + marginBottom\n maxWidth = Math.max(maxWidth, childTotalWidth)\n maxHeight = Math.max(maxHeight, childTotalHeight)\n }\n }\n\n return { maxWidth, maxHeight, totalMainSize }\n}\n\n/**\n * Calculate final container dimensions\n * @param props - Layout properties\n * @param metrics - Content metrics from calculateContentDimensions\n * @param padding - Normalized padding values\n * @param direction - Layout direction\n * @param gap - Gap between children (horizontal and vertical)\n * @param childCount - Number of children\n * @param parentSize - Parent dimensions for percentage resolution\n * @param parentPadding - Parent padding for 'fill' resolution\n * @returns Container width and height in pixels\n */\nexport function calculateContainerSize(\n props: LayoutProps,\n metrics: ContentMetrics,\n padding: PaddingValues,\n direction: 'row' | 'column' | 'stack',\n gap: { horizontal: number; vertical: number },\n childCount: number,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): { width: number; height: number } {\n // Add gaps to total main size (not applicable for stack)\n let totalMainSizeWithGaps = metrics.totalMainSize\n if (direction !== 'stack' && childCount > 1) {\n const gapValue = direction === 'row' ? gap.horizontal : gap.vertical\n totalMainSizeWithGaps += gapValue * (childCount - 1)\n }\n\n // Calculate content-based default sizes\n const contentWidth =\n direction === 'row'\n ? totalMainSizeWithGaps + padding.left + padding.right\n : metrics.maxWidth + padding.left + padding.right\n\n const contentHeight =\n direction === 'row'\n ? metrics.maxHeight + padding.top + padding.bottom\n : totalMainSizeWithGaps + padding.top + padding.bottom\n\n // Resolve width\n const parsedWidth = parseSize(props.width)\n let width = resolveSize(parsedWidth, parentSize?.width, contentWidth, parentPadding?.horizontal)\n\n // Resolve height\n const parsedHeight = parseSize(props.height)\n let height = resolveSize(parsedHeight, parentSize?.height, contentHeight, parentPadding?.vertical)\n\n // Apply min/max constraints to container size\n // Note: parentSize is already the content-area of the parent container (after padding),\n // so we should NOT apply parentPadding again for percentage-based constraints\n width = clampSize(\n width,\n props.minWidth,\n props.maxWidth,\n parentSize?.width,\n contentWidth,\n undefined // Don't use parentPadding - parentSize is already content-area\n )\n height = clampSize(\n height,\n props.minHeight,\n props.maxHeight,\n parentSize?.height,\n contentHeight,\n undefined // Don't use parentPadding - parentSize is already content-area\n )\n\n return { width, height }\n}\n\n/**\n * Normalize padding from EdgeInsets or number to PaddingValues\n * @param padding - Edge insets (may be undefined, partial, or a single number for all sides)\n * @returns Normalized padding with all values defined\n */\nexport function normalizePadding(padding?: number | EdgeInsets): PaddingValues {\n if (typeof padding === 'number') {\n return {\n left: padding,\n top: padding,\n right: padding,\n bottom: padding,\n }\n }\n return {\n left: padding?.left ?? 0,\n top: padding?.top ?? 0,\n right: padding?.right ?? 0,\n bottom: padding?.bottom ?? 0,\n }\n}\n","/**\n * Flex distribution utilities - handles flexbox logic (grow, shrink, basis) for layout children\n */\nimport type { LayoutChild } from '../types'\nimport { parseSize, resolveSize } from './size-resolver'\n\n/**\n * Flex item data structure\n */\ninterface FlexItem {\n child: LayoutChild\n index: number\n flexGrow: number\n flexShrink: number\n flexBasis: number\n minSize: number | undefined\n maxSize: number | undefined\n isFrozen: boolean\n targetSize: number\n}\n\n/**\n * Calculate flex distribution for children\n * Implements flexbox algorithm with grow, shrink, and basis support\n * Respects min/max constraints during distribution\n * @param children - Layout children\n * @param availableSpace - Total available space on main axis\n * @param direction - Layout direction ('row' or 'column')\n * @returns Updated children with flex sizes resolved\n */\nexport function distributeFlexSpace(\n children: LayoutChild[],\n availableSpace: number,\n direction: 'row' | 'column' | 'stack'\n): LayoutChild[] {\n if (direction === 'stack') {\n return children // Stack doesn't use flex\n }\n\n // Phase 1: Identify flex items and non-flex items\n const flexItems: FlexItem[] = []\n let nonFlexSpace = 0\n\n children.forEach((layoutChild, index) => {\n const props = layoutChild.child.__layoutProps\n const hasExplicitFlex = props?.flex !== undefined\n const hasExplicitShrink = props?.flexShrink !== undefined\n const hasExplicitBasis = props?.flexBasis !== undefined\n\n const flexGrow = props?.flex ?? 0\n // Only default flexShrink to 1 if element explicitly participates in flex\n const flexShrink =\n props?.flexShrink !== undefined\n ? props.flexShrink\n : hasExplicitFlex || hasExplicitBasis\n ? 1\n : 0\n const flexBasis = props?.flexBasis\n\n const margin = layoutChild.margin\n const marginSize =\n direction === 'row'\n ? (margin.left ?? 0) + (margin.right ?? 0)\n : (margin.top ?? 0) + (margin.bottom ?? 0)\n\n // Resolve min/max constraints from SizeValue to pixels\n const minSizeValue = direction === 'row' ? props?.minWidth : props?.minHeight\n const maxSizeValue = direction === 'row' ? props?.maxWidth : props?.maxHeight\n const currentSize = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n\n const minSize =\n minSizeValue !== undefined\n ? resolveSize(parseSize(minSizeValue), availableSpace, currentSize, undefined)\n : undefined\n const maxSize =\n maxSizeValue !== undefined\n ? resolveSize(parseSize(maxSizeValue), availableSpace, currentSize, undefined)\n : undefined\n\n // Calculate flex-basis\n let basisSize: number\n if (flexBasis !== undefined) {\n // Use explicit flex-basis\n const parsedBasis = parseSize(flexBasis)\n const currentSize = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n basisSize = resolveSize(parsedBasis, availableSpace, currentSize, undefined)\n } else {\n // Use width/height as flex-basis\n basisSize = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n }\n\n // Determine if this is a flex item\n // An item is a flex item if it explicitly sets flex, flexShrink, or flexBasis\n const isFlexItem = hasExplicitFlex || hasExplicitShrink || hasExplicitBasis\n\n if (isFlexItem) {\n flexItems.push({\n child: layoutChild,\n index,\n flexGrow,\n flexShrink,\n flexBasis: basisSize,\n minSize,\n maxSize,\n isFrozen: false,\n targetSize: basisSize,\n })\n\n nonFlexSpace += marginSize\n } else {\n // Non-flex item - uses its current size\n const size = direction === 'row' ? layoutChild.size.width : layoutChild.size.height\n nonFlexSpace += size + marginSize\n }\n })\n\n // No flex items - return as is\n if (flexItems.length === 0) {\n return children\n }\n\n // Phase 2: Calculate total flex-basis\n let totalFlexBasis = flexItems.reduce((sum, item) => sum + item.flexBasis, 0)\n let freeSpace = availableSpace - nonFlexSpace - totalFlexBasis\n\n // Phase 3: Flex distribution (grow or shrink)\n const updatedChildren = [...children]\n\n if (freeSpace > 0) {\n // GROW: Distribute positive free space\n distributeGrow(flexItems, freeSpace)\n } else if (freeSpace < 0) {\n // SHRINK: Distribute negative free space\n distributeShrink(flexItems, freeSpace)\n } else {\n // Exact fit - use flex-basis\n flexItems.forEach((item) => {\n item.targetSize = item.flexBasis\n })\n }\n\n // Phase 4: Apply calculated sizes\n flexItems.forEach((item) => {\n if (direction === 'row') {\n updatedChildren[item.index] = {\n ...item.child,\n size: {\n ...item.child.size,\n width: item.targetSize,\n },\n }\n } else {\n updatedChildren[item.index] = {\n ...item.child,\n size: {\n ...item.child.size,\n height: item.targetSize,\n },\n }\n }\n })\n\n return updatedChildren\n}\n\n/**\n * Distribute positive free space using flex-grow\n * @param flexItems - Flex items to distribute space among\n * @param freeSpace - Positive free space to distribute\n */\nfunction distributeGrow(flexItems: FlexItem[], freeSpace: number): void {\n let remainingSpace = freeSpace\n const MAX_ITERATIONS = 10\n\n for (let iteration = 0; iteration < MAX_ITERATIONS; iteration++) {\n // Calculate total flex-grow of unfrozen items\n const totalFlexGrow = flexItems\n .filter((item) => !item.isFrozen)\n .reduce((sum, item) => sum + item.flexGrow, 0)\n\n if (totalFlexGrow === 0 || remainingSpace <= 0) {\n break\n }\n\n let hasViolations = false\n\n // Distribute space proportionally\n for (const item of flexItems) {\n if (item.isFrozen) continue\n\n const growShare = (remainingSpace * item.flexGrow) / totalFlexGrow\n let targetSize = item.flexBasis + growShare\n\n // Apply min/max constraints\n if (item.minSize !== undefined && targetSize < item.minSize) {\n targetSize = item.minSize\n item.isFrozen = true\n hasViolations = true\n } else if (item.maxSize !== undefined && targetSize > item.maxSize) {\n targetSize = item.maxSize\n item.isFrozen = true\n hasViolations = true\n }\n\n item.targetSize = targetSize\n }\n\n if (!hasViolations) {\n break // All items distributed without violations\n }\n\n // Recalculate remaining space for next iteration\n remainingSpace = freeSpace\n for (const item of flexItems) {\n if (item.isFrozen) {\n remainingSpace -= item.targetSize - item.flexBasis\n }\n }\n }\n\n // Set targetSize for any remaining unfrozen items\n for (const item of flexItems) {\n if (!item.isFrozen) {\n // Already set in loop\n }\n }\n}\n\n/**\n * Distribute negative free space using flex-shrink\n * @param flexItems - Flex items to shrink\n * @param freeSpace - Negative free space (deficit)\n */\nfunction distributeShrink(flexItems: FlexItem[], freeSpace: number): void {\n let remainingSpace = Math.abs(freeSpace)\n const MAX_ITERATIONS = 10\n\n for (let iteration = 0; iteration < MAX_ITERATIONS; iteration++) {\n // Calculate scaled flex-shrink (shrink * basis)\n const totalScaledShrink = flexItems\n .filter((item) => !item.isFrozen)\n .reduce((sum, item) => sum + item.flexShrink * item.flexBasis, 0)\n\n if (totalScaledShrink === 0 || remainingSpace <= 0) {\n break\n }\n\n let hasViolations = false\n\n // Distribute shrinkage proportionally\n for (const item of flexItems) {\n if (item.isFrozen) continue\n\n const scaledShrink = item.flexShrink * item.flexBasis\n const shrinkShare = (remainingSpace * scaledShrink) / totalScaledShrink\n let targetSize = item.flexBasis - shrinkShare\n\n // Apply min/max constraints\n if (item.minSize !== undefined && targetSize < item.minSize) {\n targetSize = item.minSize\n item.isFrozen = true\n hasViolations = true\n } else if (item.maxSize !== undefined && targetSize > item.maxSize) {\n targetSize = item.maxSize\n item.isFrozen = true\n hasViolations = true\n }\n\n item.targetSize = targetSize\n }\n\n if (!hasViolations) {\n break // All items shrunk without violations\n }\n\n // Recalculate remaining space for next iteration\n remainingSpace = Math.abs(freeSpace)\n for (const item of flexItems) {\n if (item.isFrozen) {\n remainingSpace -= item.flexBasis - item.targetSize\n }\n }\n }\n\n // Set targetSize for any remaining unfrozen items\n for (const item of flexItems) {\n if (!item.isFrozen) {\n // Already set in loop\n }\n }\n}\n\n/**\n * Check if any children have flex properties (flex, flexShrink, or flexBasis)\n * @param children - Layout children\n * @returns True if at least one child participates in flexbox\n */\nexport function hasFlexChildren(children: LayoutChild[]): boolean {\n return children.some((child) => {\n const props = child.child.__layoutProps\n return (\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n )\n })\n}\n","/**\n * Layout engine - main orchestrator for layout calculations\n * Uses strategy pattern to handle different layout directions\n */\nimport Phaser from 'phaser'\nimport type { LayoutProps } from '../core-props'\nimport { normalizeGap } from '../core-props'\nimport { DebugLogger, DevConfig } from '../dev-config'\nimport { updateBackground, updateHitArea } from './appliers/background-applier'\nimport { applyContainerDimensions } from './appliers/container-applier'\nimport { applyChildPositions } from './appliers/position-applier'\nimport type { LayoutStrategy } from './strategies/base-strategy'\nimport { ColumnLayoutStrategy } from './strategies/column-layout'\nimport { RowLayoutStrategy } from './strategies/row-layout'\nimport { StackLayoutStrategy } from './strategies/stack-layout'\nimport type {\n GameObjectWithLayout,\n LayoutChild,\n LayoutContext,\n LayoutLine,\n Position,\n} from './types'\nimport { getChildSize, getMargin, isLayoutChild, processNestedContainer } from './utils/child-utils'\nimport { calculateContainerSize, normalizePadding } from './utils/dimension-calculator'\nimport { distributeFlexSpace, hasFlexChildren } from './utils/flex-distributor'\nimport { clampSize, parseSize, resolveSize } from './utils/size-resolver'\nimport { calculateAlignItems, calculateJustifyContent } from './utils/spacing-calculator'\n\n/**\n * Callback function for deferred layout updates\n * Executed after all layouts are complete in next frame\n */\ntype DeferredUpdateCallback = () => void\n\n/**\n * Central processor for deferred layout updates\n * Collects all updates that require final world coordinates or completed parent layouts\n * Executes them in batch via single requestAnimationFrame for optimal performance\n *\n * Use cases:\n * - Overflow mask positioning (needs world coordinates)\n * - Scroll position updates (needs final content size)\n * - Animation initialization (needs final positions)\n * - Custom effects requiring complete layout\n * - Gesture hit area updates (needs final layout size)\n */\nexport class DeferredLayoutQueue {\n private static callbacks: DeferredUpdateCallback[] = []\n private static scheduled = false\n\n /**\n * Schedule a callback to execute after current layout pass completes\n * All callbacks are batched and executed in single requestAnimationFrame\n * @param callback - Function to execute in next frame\n */\n static defer(callback: DeferredUpdateCallback): void {\n this.callbacks.push(callback)\n\n // Schedule flush if not already scheduled (only 1 requestAnimationFrame per frame)\n if (!this.scheduled) {\n this.scheduled = true\n requestAnimationFrame(() => this.flush())\n }\n }\n\n /**\n * Execute all pending callbacks in batch\n * Called once per frame via requestAnimationFrame\n */\n private static flush(): void {\n this.scheduled = false\n\n // Copy and clear callbacks before execution to prevent infinite loops\n const callbacks = [...this.callbacks]\n this.callbacks = []\n\n // Execute all callbacks with error isolation\n for (const callback of callbacks) {\n try {\n callback()\n } catch (error) {\n DebugLogger.error('DeferredLayoutQueue', 'Error in deferred callback:', error)\n }\n }\n }\n}\n\n/**\n * Entry for batched layout calculation\n */\ninterface LayoutBatchEntry {\n container: Phaser.GameObjects.Container\n containerProps: LayoutProps\n parentSize: { width: number; height: number } | undefined\n parentPadding: { horizontal: number; vertical: number } | undefined\n}\n\n/**\n * Batches layout calculations to reduce redundant recalculations\n * Prevents multiple calculations of same container within single synchronous call stack\n * Does NOT defer to next frame - executes immediately after current stack completes\n *\n * Benefits:\n * - Prevents multiple calculations of same container in one update\n * - Bottom-up execution order prevents redundant parent recalculations\n * - No visual flickering (executes in same frame)\n *\n * Usage:\n * - VDOM patches: LayoutBatchQueue.schedule() instead of direct calculateLayout()\n * - Appliers: LayoutBatchQueue.schedule() instead of direct calculateLayout()\n * - Tests: Set LayoutBatchQueue.synchronous = true for immediate execution\n */\nexport class LayoutBatchQueue {\n private static pending = new Map<Phaser.GameObjects.Container, LayoutBatchEntry>()\n private static scheduled = false\n\n /**\n * Enable synchronous mode for testing\n * When true, layouts execute immediately instead of batching\n */\n static synchronous = false\n\n /**\n * Schedule a layout calculation to execute after current call stack\n * Uses microtask (Promise) instead of requestAnimationFrame to avoid flickering\n * If container is already scheduled, updates entry with latest props\n * @param container - Container to calculate layout for\n * @param containerProps - Layout props\n * @param parentSize - Optional parent size for percentage resolution\n * @param parentPadding - Optional parent padding for fill resolution\n */\n static schedule(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n ): void {\n // Synchronous mode for tests - execute immediately\n if (this.synchronous) {\n calculateLayoutImmediate(container, containerProps, parentSize, parentPadding)\n return\n }\n\n // Update or add entry (latest props win if scheduled multiple times)\n this.pending.set(container, { container, containerProps, parentSize, parentPadding })\n\n // Schedule flush if not already scheduled\n // Use microtask (Promise.resolve) instead of requestAnimationFrame\n // This executes in SAME FRAME after current call stack, preventing flickering\n if (!this.scheduled) {\n this.scheduled = true\n Promise.resolve().then(() => this.flush())\n }\n }\n\n /**\n * Execute all pending layout calculations immediately\n * Processes in bottom-up order (deepest children first)\n * This prevents redundant parent recalculations\n */\n static flush(): void {\n this.scheduled = false\n\n if (this.pending.size === 0) return\n\n DebugLogger.time('performance', 'LayoutBatchQueue.flush')\n\n // Copy and clear pending entries\n const entries = Array.from(this.pending.values())\n this.pending.clear()\n\n // Sort bottom-up (deepest containers first)\n // This ensures children are laid out before parents\n entries.sort((a, b) => {\n const depthA = getContainerDepth(a.container)\n const depthB = getContainerDepth(b.container)\n return depthB - depthA // Higher depth = deeper = execute first\n })\n\n // Execute layout calculations in optimal order\n for (const entry of entries) {\n try {\n // Only calculate if container still exists and is active\n if (entry.container.active) {\n calculateLayoutImmediate(\n entry.container,\n entry.containerProps,\n entry.parentSize,\n entry.parentPadding\n )\n }\n } catch (error) {\n DebugLogger.error('LayoutBatchQueue', 'Error calculating layout:', error)\n }\n }\n\n DebugLogger.timeEnd('performance', 'LayoutBatchQueue.flush')\n }\n}\n\n/**\n * Get depth of container in scene hierarchy\n * Root containers have depth 0, children have depth 1, etc.\n * @param container - Container to get depth for\n * @returns Depth level (0 = root)\n */\nfunction getContainerDepth(container: Phaser.GameObjects.Container): number {\n let depth = 0\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let current: Phaser.GameObjects.Container | null = (container as any).parentContainer || null\n\n while (current) {\n depth++\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n current = (current as any).parentContainer || null\n }\n\n return depth\n}\n\n/**\n * Updates mask position using world coordinates\n * Called during batch processing or immediate updates\n * @param container - Container with mask\n * @param width - Container width\n * @param height - Container height\n */\nfunction updateMaskWorldPosition(\n container: Phaser.GameObjects.Container,\n width: number,\n height: number\n): void {\n const extendedContainer = container as typeof container & {\n __overflowMask?: Phaser.GameObjects.Graphics | undefined\n __overflowMaskUpdateListener?: (() => void) | undefined\n }\n\n if (!extendedContainer.__overflowMask) return\n\n // Remove existing listener to avoid duplicates\n if (extendedContainer.__overflowMaskUpdateListener) {\n container.scene.events.off('postupdate', extendedContainer.__overflowMaskUpdateListener)\n }\n\n // Create update function that recalculates mask position when container moves\n const updateMask = () => {\n // Build parent chain from container to root (bottom-up)\n const parentChain: Phaser.GameObjects.Container[] = []\n let current: Phaser.GameObjects.Container | null = container\n while (current) {\n parentChain.push(current)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n current = (current as any).parentContainer || null\n }\n\n // Reverse to get root-to-container order (top-down)\n parentChain.reverse()\n\n // Apply transforms cumulatively from root to container\n let worldX = 0\n let worldY = 0\n let worldRotation = 0\n let worldScaleX = 1\n let worldScaleY = 1\n\n for (const parent of parentChain) {\n // Apply parent's rotation to current position (rotate around origin)\n if (worldRotation !== 0) {\n const cos = Math.cos(worldRotation)\n const sin = Math.sin(worldRotation)\n const rotatedX = parent.x * cos - parent.y * sin\n const rotatedY = parent.x * sin + parent.y * cos\n worldX += rotatedX * worldScaleX\n worldY += rotatedY * worldScaleY\n } else {\n // No rotation yet, simple addition\n worldX += parent.x * worldScaleX\n worldY += parent.y * worldScaleY\n }\n\n // Accumulate rotation and scale\n worldRotation += parent.rotation\n worldScaleX *= parent.scaleX\n worldScaleY *= parent.scaleY\n }\n\n // Update mask geometry with accumulated world transform\n const maskGraphics = extendedContainer.__overflowMask\n if (!maskGraphics) return\n\n maskGraphics.clear()\n\n // Apply world transform to mask graphics\n maskGraphics.setPosition(worldX, worldY)\n maskGraphics.setRotation(worldRotation)\n maskGraphics.setScale(worldScaleX, worldScaleY)\n\n // Use configurable color and alpha for debugging\n maskGraphics.fillStyle(DevConfig.visual.maskFillColor)\n maskGraphics.setAlpha(\n DevConfig.visual.showOverflowMasks ? Math.max(DevConfig.visual.maskAlpha, 0.01) : 0.0\n )\n\n // Draw rectangle in local space (will be transformed by graphics properties)\n // Expand by 1px on each side to prevent edge artifacts\n const expandedWidth = width + 2\n const expandedHeight = height + 2\n\n // Check if mask has cornerRadius metadata\n const maskWithRadius = maskGraphics as Phaser.GameObjects.Graphics & {\n __cornerRadius?: number | { tl?: number; tr?: number; bl?: number; br?: number }\n }\n const cornerRadius = maskWithRadius.__cornerRadius\n\n if (cornerRadius !== undefined && cornerRadius !== 0) {\n // Use rounded rectangle for mask\n if (typeof cornerRadius === 'number') {\n maskGraphics.fillRoundedRect(-1, -1, expandedWidth, expandedHeight, cornerRadius)\n } else {\n // Handle individual corner radii\n maskGraphics.fillRoundedRect(-1, -1, expandedWidth, expandedHeight, cornerRadius)\n }\n } else {\n // Standard rectangular mask\n maskGraphics.fillRect(-1, -1, expandedWidth, expandedHeight)\n }\n\n //console.log('Updated overflow mask position:')\n }\n\n // Store reference to update function\n extendedContainer.__overflowMaskUpdateListener = updateMask\n\n // Listen for postupdate event (fires every frame after all updates)\n container.scene.events.on('postupdate', updateMask)\n\n // Initial update\n updateMask()\n\n DebugLogger.log('overflowMask', 'Set up dynamic mask updates for container and parents')\n}\n\n/**\n * Applies overflow mask to container if overflow='hidden' is set\n * Creates a geometry mask that clips children to container bounds\n *\n * IMPLEMENTATION NOTES:\n * - Mask Graphics is NOT added as child (must be independent for Phaser masks)\n * - Uses absolute world coordinates calculated from parent chain\n * - Defers position update to next frame for nested containers via DeferredLayoutQueue\n * - All deferred updates are batched in single requestAnimationFrame for optimal performance\n *\n * // Frame N - Initial Mount:\n * mount(scene, <View>...</View>)\n * ├─ calculateLayout(container)\n * │ ├─ Position children\n * │ ├─ Apply overflow mask\n * │ │ └─ DeferredLayoutQueue.defer(() => updateMask1())\n * │ └─ Nested calculateLayout(child)\n * │ └─ DeferredLayoutQueue.defer(() => updateMask2())\n * │\n * ├─ User code:\n * │ └─ DeferredLayoutQueue.defer(() => animateIn())\n * │\n * └─ requestAnimationFrame scheduled (only once!)\n *\n * // Frame N+1 - Deferred Execution:\n * requestAnimationFrame fires\n * └─ DeferredLayoutQueue.flush()\n * ├─ updateMask1() ✓\n * ├─ updateMask2() ✓\n * └─ animateIn() ✓\n *\n * All done in one batch! 🚀\n *\n * @param container - Phaser container to apply mask to\n * @param containerProps - Layout props containing overflow setting\n * @param width - Container width\n * @param height - Container height\n */\nfunction applyOverflowMask(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps & {\n cornerRadius?: number | { tl?: number; tr?: number; bl?: number; br?: number }\n },\n width: number,\n height: number\n): void {\n const extendedContainer = container as typeof container & {\n __overflowMask?:\n | (Phaser.GameObjects.Graphics & {\n __cornerRadius?: number | { tl?: number; tr?: number; bl?: number; br?: number }\n })\n | undefined\n }\n\n if (containerProps.overflow === 'hidden') {\n // Create or update mask\n if (!extendedContainer.__overflowMask) {\n const maskGraphics = container.scene.add.graphics() as Phaser.GameObjects.Graphics & {\n __cornerRadius?: number | { tl?: number; tr?: number; bl?: number; br?: number }\n }\n extendedContainer.__overflowMask = maskGraphics\n\n // Store cornerRadius for use in updateMaskWorldPosition\n if (containerProps.cornerRadius !== undefined) {\n maskGraphics.__cornerRadius = containerProps.cornerRadius\n }\n\n // DO NOT add as child - mask needs to be independent for Phaser's mask system\n // Phaser containers with masks cannot have masked children (Phaser limitation)\n\n // Create geometry mask\n const mask = maskGraphics.createGeometryMask()\n container.setMask(mask)\n\n // Destroy mask when container is destroyed\n container.once('destroy', () => {\n const extendedContainer = container as typeof container & {\n __overflowMask?: Phaser.GameObjects.Graphics | undefined\n __overflowMaskUpdateListener?: (() => void) | undefined\n }\n\n // Remove postupdate listener from scene\n if (extendedContainer.__overflowMaskUpdateListener) {\n container.scene.events.off('postupdate', extendedContainer.__overflowMaskUpdateListener)\n }\n\n if (extendedContainer.__overflowMask) {\n extendedContainer.__overflowMask.destroy()\n extendedContainer.__overflowMask = undefined\n }\n extendedContainer.__overflowMaskUpdateListener = undefined\n })\n\n DebugLogger.log('overflowMask', 'Created overflow mask')\n }\n\n // Check if this is a nested container (has parent container)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const hasParentContainer = (container as any).parentContainer != null\n\n if (hasParentContainer) {\n // Nested container: Defer mask position update to next frame\n // This ensures parent containers are fully positioned before calculating world coords\n // Uses deferred queue for optimal performance with many containers\n DeferredLayoutQueue.defer(() => {\n // Verify container still exists and has overflow=hidden\n if (container.active && containerProps.overflow === 'hidden') {\n updateMaskWorldPosition(container, width, height)\n }\n })\n\n DebugLogger.log('overflowMask', 'Scheduled deferred mask update for nested container')\n } else {\n // Root container: Update mask immediately (parent positions are already final)\n updateMaskWorldPosition(container, width, height)\n }\n } else if (extendedContainer.__overflowMask) {\n // Remove mask if overflow is not hidden\n container.clearMask()\n extendedContainer.__overflowMask.destroy()\n extendedContainer.__overflowMask = undefined\n\n DebugLogger.log('overflowMask', 'Removed overflow mask')\n }\n}\n\n/**\n * Strategy map - reusable strategy instances\n */\nconst strategies: Record<string, LayoutStrategy> = {\n column: new ColumnLayoutStrategy(),\n row: new RowLayoutStrategy(),\n stack: new StackLayoutStrategy(),\n}\n\n/**\n * Invalidates parent layout if container size changed after recalculation\n * Propagates layout changes up the hierarchy to ensure parent containers adapt\n * @param container - Container that was just laid out\n * @param oldSize - Size before layout calculation\n * @param newWidth - New width after layout\n * @param newHeight - New height after layout\n */\nfunction invalidateParentLayoutIfNeeded(\n container: Phaser.GameObjects.Container,\n oldSize: { width: number; height: number } | undefined,\n newWidth: number,\n newHeight: number\n): void {\n // Skip if no old size (first layout) or size unchanged\n if (!oldSize || (oldSize.width === newWidth && oldSize.height === newHeight)) {\n return\n }\n\n // Size changed - need to recalculate parent layout\n const parent = container.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n __getLayoutSize?: () => { width: number; height: number }\n })\n | undefined\n\n if (!parent || !parent.__layoutProps) {\n return // No layout parent to invalidate\n }\n\n DebugLogger.log(\n 'layout',\n 'Container size changed, invalidating parent:',\n `${oldSize.width}x${oldSize.height} -> ${newWidth}x${newHeight}`\n )\n\n // Get parent's parent for context\n const grandParent = parent.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n __getLayoutSize?: () => { width: number; height: number }\n })\n | undefined\n\n let grandParentSize: { width: number; height: number } | undefined\n if (grandParent && grandParent.__getLayoutSize) {\n const totalSize = grandParent.__getLayoutSize()\n const padding = (grandParent.__layoutProps?.padding ?? 0) as\n | number\n | { left?: number; right?: number; top?: number; bottom?: number }\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n grandParentSize = {\n width: totalSize.width - normPadding.left - normPadding.right,\n height: totalSize.height - normPadding.top - normPadding.bottom,\n }\n }\n\n // Recalculate parent layout (will recursively invalidate grandparent if needed)\n calculateLayout(parent, parent.__layoutProps, grandParentSize)\n}\n\n/**\n * Calculate layout for a container and its children immediately (internal)\n * DO NOT CALL DIRECTLY - Use calculateLayout() which batches for performance\n * @param container - Phaser container with children\n * @param containerProps - Layout props of the container\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n */\nfunction calculateLayoutImmediate(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): void {\n const children = container.list as GameObjectWithLayout[]\n\n // Store old size before layout calculation for parent invalidation\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => { width: number; height: number }\n }\n const oldContainerSize = containerWithLayout.__getLayoutSize?.()\n\n // Debug: Track excessive layout calls\n // console.log('[LAYOUT] calculateLayout called for container with', children?.length ?? 0, 'children')\n\n if (!children || !Array.isArray(children)) {\n return\n }\n\n // Performance timing\n DebugLogger.time('performance', 'calculateLayout')\n\n // 1. Extract layout parameters\n const direction = containerProps.direction ?? 'column'\n const padding = normalizePadding(containerProps.padding)\n const gap = normalizeGap(containerProps.gap)\n const justifyContent = containerProps.justifyContent ?? 'start'\n\n DebugLogger.log('layout', `Direction: ${direction}, Padding:`, padding)\n\n // 2a. Pre-calculate container size if possible (needed for percentage children and nested containers)\n // This allows percentage-based child sizes to resolve correctly and nested containers\n // to receive the correct content-area as their parent size\n let currentContainerSize: { width: number; height: number } | undefined\n\n // Try to calculate width early if we have explicit width or can resolve from parent\n const parsedWidth = parseSize(containerProps.width)\n const canCalculateWidth =\n parsedWidth.type === 'fixed' ||\n (parentSize?.width !== undefined &&\n (parsedWidth.type === 'percent' ||\n parsedWidth.type === 'fill' ||\n parsedWidth.type === 'calc'))\n\n const width = canCalculateWidth\n ? resolveSize(parsedWidth, parentSize?.width, container.width, parentPadding?.horizontal)\n : undefined\n\n // Try to calculate height early if we have explicit height or can resolve from parent\n const parsedHeight = parseSize(containerProps.height)\n const canCalculateHeight =\n parsedHeight.type === 'fixed' ||\n (parentSize?.height !== undefined &&\n (parsedHeight.type === 'percent' ||\n parsedHeight.type === 'fill' ||\n parsedHeight.type === 'calc'))\n\n const height = canCalculateHeight\n ? resolveSize(parsedHeight, parentSize?.height, container.height, parentPadding?.vertical)\n : undefined\n\n // Set currentContainerSize if we could calculate at least one dimension\n if (width !== undefined || height !== undefined) {\n // Apply constraints\n const clampedWidth =\n width !== undefined\n ? clampSize(\n width,\n containerProps.minWidth,\n containerProps.maxWidth,\n parentSize?.width,\n container.width,\n parentPadding?.horizontal\n )\n : container.width\n const clampedHeight =\n height !== undefined\n ? clampSize(\n height,\n containerProps.minHeight,\n containerProps.maxHeight,\n parentSize?.height,\n container.height,\n parentPadding?.vertical\n )\n : container.height\n\n currentContainerSize = {\n width: clampedWidth,\n height: clampedHeight,\n }\n }\n\n // Calculate available content size (container minus padding) for child size resolution\n // This allows 'fill' and percentage sizes to resolve correctly relative to content area\n const availableContentSize = currentContainerSize\n ? {\n width: currentContainerSize.width - padding.left - padding.right,\n height: currentContainerSize.height - padding.top - padding.bottom,\n }\n : undefined\n\n DebugLogger.log('layout', 'Pre-calculated container size:', currentContainerSize)\n DebugLogger.log('layout', 'Available content size (for fill):', availableContentSize)\n\n // 2. Prepare layout children (filter backgrounds, headless objects, process nested containers)\n const layoutChildren: LayoutChild[] = []\n\n for (const child of children) {\n // Skip non-layout children (backgrounds, headless objects, missing __getLayoutSize)\n if (!isLayoutChild(child)) {\n DebugLogger.log('layout', 'Skipping non-layout child:', {\n isBackground: child.__isBackground,\n headless: child.__layoutProps?.headless,\n hasLayoutSize: typeof child.__getLayoutSize === 'function',\n })\n continue\n } // Skip processing nested containers with flex (they need parent size first)\n const hasFlex = (child.__layoutProps?.flex ?? 0) > 0\n if (!hasFlex) {\n // Process nested containers - pass content-area (size minus padding) as parent size\n // This ensures nested children see the correct available space\n const parentSizeForNested = currentContainerSize\n ? {\n width: currentContainerSize.width - padding.left - padding.right,\n height: currentContainerSize.height - padding.top - padding.bottom,\n }\n : parentSize\n ? {\n width: parentSize.width - (parentPadding?.horizontal ?? 0),\n height: parentSize.height - (parentPadding?.vertical ?? 0),\n }\n : undefined\n\n processNestedContainer(\n child,\n calculateLayout,\n parentSizeForNested,\n undefined // No padding offset needed since we pass content-area\n )\n }\n\n // Get child size - pass content-area (container size minus padding) for % and fill\n // This way percentages and fill are relative to available content space\n const contentAreaForChild = currentContainerSize\n ? {\n width: currentContainerSize.width - padding.left - padding.right,\n height: currentContainerSize.height - padding.top - padding.bottom,\n }\n : parentSize\n ? {\n width: parentSize.width - (parentPadding?.horizontal ?? 0),\n height: parentSize.height - (parentPadding?.vertical ?? 0),\n }\n : undefined\n\n const size = getChildSize(child, contentAreaForChild, undefined)\n const margin = getMargin(child)\n\n layoutChildren.push({ child, size, margin })\n }\n\n // 3. Select strategy based on direction\n const strategy = strategies[direction]\n if (!strategy) {\n DebugLogger.error('Layout', `Unknown direction: ${direction}`)\n return\n }\n\n // 4. Build layout context (will be used after we know container dimensions)\n const contextPartial = {\n containerProps,\n padding,\n gap,\n children: layoutChildren,\n }\n\n // 5. Calculate metrics using strategy\n const metrics = strategy.calculateMetrics(layoutChildren, contextPartial as LayoutContext)\n\n // 5a. Check if wrapping is enabled\n const flexWrap = containerProps.flexWrap ?? 'nowrap'\n const shouldWrap = flexWrap !== 'nowrap' && direction !== 'stack'\n\n // 6. Calculate container dimensions (with parent size and padding for resolution)\n const { width: containerWidth, height: containerHeight } = calculateContainerSize(\n containerProps,\n metrics,\n padding,\n direction,\n gap,\n layoutChildren.length,\n parentSize,\n parentPadding\n )\n\n // 6a. Distribute flex space if there are flex children (skip if wrapping - will be done per line)\n let finalLayoutChildren = layoutChildren\n if (hasFlexChildren(layoutChildren) && !shouldWrap) {\n const contentSize =\n direction === 'row'\n ? containerWidth - padding.left - padding.right\n : containerHeight - padding.top - padding.bottom\n\n // Subtract gap space (gap appears between children, so n-1 gaps for n children)\n const gapValue = direction === 'row' ? gap.horizontal : gap.vertical\n const totalGapSpace = layoutChildren.length > 1 ? gapValue * (layoutChildren.length - 1) : 0\n const availableMainSpace = contentSize - totalGapSpace\n\n finalLayoutChildren = distributeFlexSpace(layoutChildren, availableMainSpace, direction)\n\n // Process nested flex containers now that they have their size\n for (const layoutChild of finalLayoutChildren) {\n const props = layoutChild.child.__layoutProps\n const isFlexItem =\n (props?.flex !== undefined && props.flex > 0) ||\n props?.flexShrink !== undefined ||\n props?.flexBasis !== undefined\n if (isFlexItem) {\n // Temporarily set explicit size based on flex calculation\n const originalProps = { ...layoutChild.child.__layoutProps }\n if (direction === 'row') {\n layoutChild.child.__layoutProps = {\n ...layoutChild.child.__layoutProps,\n width: layoutChild.size.width,\n }\n } else {\n layoutChild.child.__layoutProps = {\n ...layoutChild.child.__layoutProps,\n height: layoutChild.size.height,\n }\n }\n\n processNestedContainer(\n layoutChild.child,\n calculateLayout,\n {\n width: containerWidth,\n height: containerHeight,\n },\n {\n horizontal: padding.left + padding.right,\n vertical: padding.top + padding.bottom,\n }\n )\n\n // Restore original props\n layoutChild.child.__layoutProps = originalProps\n }\n }\n\n // Recalculate metrics with updated sizes\n const updatedMetrics = strategy.calculateMetrics(\n finalLayoutChildren,\n contextPartial as LayoutContext\n )\n metrics.totalMainSize = updatedMetrics.totalMainSize\n if (direction === 'column') {\n metrics.maxWidth = updatedMetrics.maxWidth\n } else if (direction === 'row') {\n metrics.maxHeight = updatedMetrics.maxHeight\n }\n }\n\n // 7. Calculate content area\n const contentArea = {\n width: containerWidth - padding.left - padding.right,\n height: containerHeight - padding.top - padding.bottom,\n }\n\n // 8. Complete layout context\n const context: LayoutContext = {\n ...contextPartial,\n children: finalLayoutChildren,\n contentArea,\n parentSize: {\n width: containerWidth,\n height: containerHeight,\n },\n }\n\n // 9. Calculate spacing for justifyContent\n const availableMainSpace = direction === 'row' ? contentArea.width : contentArea.height\n // Calculate total gap space (gaps between children, not before first or after last)\n const gapValue = direction === 'row' ? gap.horizontal : gap.vertical\n const totalGapSpace =\n finalLayoutChildren.length > 1 ? gapValue * (finalLayoutChildren.length - 1) : 0\n const remainingSpace = availableMainSpace - metrics.totalMainSize - totalGapSpace\n\n let mainStart = 0\n let spaceBetween = 0\n\n // For stack direction, justifyContent is not applicable\n if (direction !== 'stack') {\n const justifyResult = calculateJustifyContent(\n justifyContent,\n remainingSpace,\n finalLayoutChildren.length\n )\n mainStart = justifyResult.mainStart\n spaceBetween = justifyResult.spaceBetween\n }\n\n // 9a. Apply stretch if alignItems is 'stretch'\n const alignItems = containerProps.alignItems ?? 'start'\n if (alignItems === 'stretch' && direction !== 'stack') {\n for (const layoutChild of finalLayoutChildren) {\n const margin = getMargin(layoutChild.child)\n const child = layoutChild.child\n\n if (direction === 'row') {\n // Stretch height to full cross-axis (minus margins)\n const stretchHeight = contentArea.height - (margin.top ?? 0) - (margin.bottom ?? 0)\n layoutChild.size.height = Math.max(0, stretchHeight)\n\n // If child is a container with layout props, update its height prop and recalculate nested layout\n if (child.__layoutProps) {\n const originalHeight = child.__layoutProps.height\n child.__layoutProps = { ...child.__layoutProps, height: stretchHeight }\n\n // Recalculate nested container layout with new height\n processNestedContainer(child, calculateLayout, {\n width: containerWidth,\n height: containerHeight,\n })\n\n // Restore original height prop (in case it was percentage or undefined)\n child.__layoutProps = { ...child.__layoutProps, height: originalHeight }\n }\n } else if (direction === 'column') {\n // Stretch width to full cross-axis (minus margins)\n const stretchWidth = contentArea.width - (margin.left ?? 0) - (margin.right ?? 0)\n layoutChild.size.width = Math.max(0, stretchWidth)\n\n // If child is a container with layout props, update its width prop and recalculate nested layout\n if (child.__layoutProps) {\n const originalWidth = child.__layoutProps.width\n child.__layoutProps = { ...child.__layoutProps, width: stretchWidth }\n\n // Recalculate nested container layout with new width\n processNestedContainer(child, calculateLayout, {\n width: containerWidth,\n height: containerHeight,\n })\n\n // Restore original width prop (in case it was percentage or undefined)\n child.__layoutProps = { ...child.__layoutProps, width: originalWidth }\n }\n }\n }\n }\n\n // 10. Handle wrapping if enabled\n const positions: Position[] = []\n let adjustedContainerWidth = containerWidth\n let adjustedContainerHeight = containerHeight\n\n if (shouldWrap && 'wrapChildren' in strategy) {\n // Wrap children into multiple lines\n const availableMainSize = direction === 'row' ? contentArea.width : contentArea.height\n const mainGapValue = direction === 'row' ? gap.horizontal : gap.vertical\n const lines = (strategy as RowLayoutStrategy | ColumnLayoutStrategy).wrapChildren(\n finalLayoutChildren,\n availableMainSize,\n mainGapValue\n )\n\n if (flexWrap === 'wrap-reverse') {\n lines.reverse()\n }\n\n // Calculate total cross size needed for all lines\n const totalCrossSize = lines.reduce(\n (sum: number, line: LayoutLine) => sum + line.crossAxisSize,\n 0\n )\n const crossGapValue = direction === 'row' ? gap.vertical : gap.horizontal\n const totalLineGaps = (lines.length - 1) * crossGapValue\n\n // Adjust container dimensions if auto-sizing and wrapping occurred\n if (\n direction === 'row' &&\n (containerProps.height === undefined || containerProps.height === 'auto')\n ) {\n // For row direction with auto-height, calculate height based on wrapped lines\n adjustedContainerHeight = totalCrossSize + totalLineGaps + padding.top + padding.bottom\n } else if (\n direction === 'column' &&\n (containerProps.width === undefined || containerProps.width === 'auto')\n ) {\n // For column direction with auto-width, calculate width based on wrapped lines\n adjustedContainerWidth = totalCrossSize + totalLineGaps + padding.left + padding.right\n }\n\n const availableCrossSize = direction === 'row' ? contentArea.height : contentArea.width\n const freeCrossSpace = availableCrossSize - totalCrossSize - totalLineGaps\n\n // Apply alignContent to distribute lines\n const alignContent = containerProps.alignContent ?? 'stretch'\n let crossOffset = 0\n let lineCrossSpacing = 0\n\n if (alignContent === 'center') {\n crossOffset = freeCrossSpace / 2\n } else if (alignContent === 'end') {\n crossOffset = freeCrossSpace\n } else if (alignContent === 'space-between' && lines.length > 1) {\n lineCrossSpacing = freeCrossSpace / (lines.length - 1)\n } else if (alignContent === 'space-around') {\n lineCrossSpacing = freeCrossSpace / lines.length\n crossOffset = lineCrossSpacing / 2\n }\n\n // Position children line by line\n for (const line of lines) {\n // Apply flex distribution per line if line has flex children\n let lineChildren = line.children\n if (hasFlexChildren(line.children)) {\n const lineGapSpace = (line.children.length - 1) * mainGapValue\n const lineAvailableSpace = availableMainSize - lineGapSpace\n lineChildren = distributeFlexSpace(line.children, lineAvailableSpace, direction)\n\n // Update line main size after flex distribution\n line.mainAxisSize = lineChildren.reduce((sum: number, child: LayoutChild) => {\n const size = direction === 'row' ? child.size.width : child.size.height\n const margin = getMargin(child.child)\n const marginSize =\n direction === 'row'\n ? (margin.left ?? 0) + (margin.right ?? 0)\n : (margin.top ?? 0) + (margin.bottom ?? 0)\n return sum + size + marginSize\n }, 0)\n }\n\n // Calculate line-specific justifyContent\n const lineMainSize = line.mainAxisSize\n const lineAvailableMain = availableMainSize\n const lineRemainingSpace = lineAvailableMain - lineMainSize\n const lineGapSpace = (line.children.length - 1) * mainGapValue\n const lineFreeSpace = lineRemainingSpace - lineGapSpace\n\n const lineJustifyResult = calculateJustifyContent(\n justifyContent,\n lineFreeSpace,\n line.children.length\n )\n\n let lineMainOffset = lineJustifyResult.mainStart\n const lineSpaceBetween = lineJustifyResult.spaceBetween\n\n // Position each child in the line\n for (let i = 0; i < lineChildren.length; i++) {\n const child = lineChildren[i]\n if (!child) continue\n\n const margin = getMargin(child.child)\n\n let x: number\n let y: number\n\n if (direction === 'row') {\n // Main axis: horizontal\n lineMainOffset += margin.left ?? 0\n x = padding.left + lineMainOffset\n\n // Cross axis: vertical\n const childCrossOffset = calculateAlignItems(\n alignItems,\n line.crossAxisSize,\n child.size.height,\n margin.top ?? 0,\n margin.bottom ?? 0\n )\n y = padding.top + crossOffset + childCrossOffset\n\n lineMainOffset += child.size.width + (margin.right ?? 0)\n if (i < lineChildren.length - 1) {\n lineMainOffset += mainGapValue + lineSpaceBetween\n }\n } else {\n // Main axis: vertical\n lineMainOffset += margin.top ?? 0\n y = padding.top + lineMainOffset\n\n // Cross axis: horizontal\n const childCrossOffset = calculateAlignItems(\n alignItems,\n line.crossAxisSize,\n child.size.width,\n margin.left ?? 0,\n margin.right ?? 0\n )\n x = padding.left + crossOffset + childCrossOffset\n\n lineMainOffset += child.size.height + (margin.bottom ?? 0)\n if (i < lineChildren.length - 1) {\n lineMainOffset += mainGapValue + lineSpaceBetween\n }\n }\n\n // Find child index in original array for correct position assignment\n const childIndex = finalLayoutChildren.indexOf(child)\n if (childIndex !== -1) {\n positions[childIndex] = { x, y }\n }\n }\n\n // Move to next line\n crossOffset += line.crossAxisSize + crossGapValue + lineCrossSpacing\n }\n } else {\n // No wrapping - use original single-line positioning\n let currentMain = mainStart\n\n for (let i = 0; i < finalLayoutChildren.length; i++) {\n const child = finalLayoutChildren[i]\n if (!child) continue\n\n const result = strategy.positionChild(child, i, context, currentMain)\n\n positions.push(result.position)\n currentMain = result.nextMain\n\n // Add gap and space-between spacing (not for stack)\n if (direction !== 'stack' && i < finalLayoutChildren.length - 1) {\n currentMain += gapValue + spaceBetween\n }\n }\n }\n\n // 11. Apply positions to children\n applyChildPositions(finalLayoutChildren, positions)\n\n // 12. Apply container dimensions (use adjusted dimensions if wrapping changed them)\n applyContainerDimensions(container, adjustedContainerWidth, adjustedContainerHeight)\n\n // 13. Update background and hit area\n updateBackground(container, adjustedContainerWidth, adjustedContainerHeight)\n updateHitArea(container, adjustedContainerWidth, adjustedContainerHeight)\n\n // 14. Apply overflow mask if needed\n applyOverflowMask(container, containerProps, adjustedContainerWidth, adjustedContainerHeight)\n\n // End performance timing\n DebugLogger.timeEnd('performance', 'calculateLayout')\n\n // 15. Propagate layout changes to parent if size changed\n // This ensures parent containers resize when child content changes\n invalidateParentLayoutIfNeeded(\n container,\n oldContainerSize,\n adjustedContainerWidth,\n adjustedContainerHeight\n )\n}\n\n/**\n * Calculate layout for a container and its children\n * Batches layout calculations for optimal performance\n * Multiple calls within same frame are deduplicated and executed bottom-up\n * @param container - Phaser container with children\n * @param containerProps - Layout props of the container\n * @param parentSize - Optional parent dimensions for percentage resolution\n * @param parentPadding - Optional parent padding for 'fill' resolution\n */\nexport function calculateLayout(\n container: Phaser.GameObjects.Container,\n containerProps: LayoutProps,\n parentSize?: { width: number; height: number },\n parentPadding?: { horizontal: number; vertical: number }\n): void {\n LayoutBatchQueue.schedule(container, containerProps, parentSize, parentPadding)\n}\n","/**\n * Layout property applier for updating container layout configuration\n */\nimport equal from 'fast-deep-equal'\nimport type { BackgroundProps, LayoutProps } from '../../core-props'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport { calculateLayout, type LayoutSize } from '../../layout/index'\n\n/**\n * Updates gesture hit area based on current layout size\n * Called after layout recalculation to sync hit area with actual container size\n * @param node - Container with potential gesture registration\n */\nfunction updateGestureHitAreaIfNeeded(node: Phaser.GameObjects.Container): void {\n const containerWithLayout = node as typeof node & {\n __getLayoutSize?: () => LayoutSize\n scene: Phaser.Scene\n }\n\n // Only update if container has gesture system enabled and layout size available\n if (!containerWithLayout.__getLayoutSize) return\n\n try {\n const manager = getGestureManager(containerWithLayout.scene)\n const size = containerWithLayout.__getLayoutSize()\n const hitArea = new Phaser.Geom.Rectangle(0, 0, size.width, size.height)\n manager.updateHitArea(node, hitArea)\n } catch {\n // Gesture manager or container not registered, ignore\n }\n}\n\n/**\n * Layout-relevant props that trigger layout recalculation when changed\n */\nconst LAYOUT_RELEVANT_PROPS: (keyof LayoutProps)[] = [\n 'width',\n 'height',\n 'minWidth',\n 'maxWidth',\n 'minHeight',\n 'maxHeight',\n 'flex',\n 'margin',\n 'padding',\n 'gap',\n 'direction',\n 'justifyContent',\n 'alignItems',\n 'overflow',\n]\n\n/**\n * Object props that need deep comparison\n */\nconst DEEP_COMPARE_PROPS = new Set(['margin', 'padding'])\n\n/**\n * Check if any layout-relevant prop changed\n * Uses shallow equality for primitives and deep equality for objects\n * @param prev - Previous props\n * @param next - New props\n * @returns True if any layout prop changed\n */\nfunction hasLayoutPropsChanged(\n prev: Partial<LayoutProps & BackgroundProps>,\n next: Partial<LayoutProps & BackgroundProps>\n): boolean {\n for (const prop of LAYOUT_RELEVANT_PROPS) {\n const oldVal = prev[prop]\n const newVal = next[prop]\n\n // Use deep comparison for object props (margin, padding)\n if (DEEP_COMPARE_PROPS.has(prop as string)) {\n if (!equal(oldVal, newVal)) {\n return true\n }\n } else {\n // Shallow comparison for primitives\n if (oldVal !== newVal) {\n return true\n }\n }\n }\n return false\n}\n\n/**\n * Calculates parent size and padding from parent container's layout\n * Falls back to viewport size for root containers without a parent\n * @param node - Container node to get parent info for\n * @returns Parent size and padding if parent is a layout container\n */\nfunction getParentLayoutContext(node: Phaser.GameObjects.Container): {\n parentSize?: { width: number; height: number }\n parentPadding?: { horizontal: number; vertical: number }\n} {\n const parent = node.parentContainer as\n | (Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps\n __getLayoutSize?: () => LayoutSize\n })\n | undefined\n\n // If has layout parent, use its content-area\n if (parent && parent.__layoutProps && parent.__getLayoutSize) {\n const parentSize = parent.__getLayoutSize()\n const padding = parent.__layoutProps.padding ?? 0\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n\n return {\n parentSize: {\n width: parentSize.width - normPadding.left - normPadding.right,\n height: parentSize.height - normPadding.top - normPadding.bottom,\n },\n // Parent already provides content-area, no padding offset needed\n }\n }\n\n // Fallback: Root container without layout parent - use viewport as parent size\n // This allows percentage-based sizing/constraints to work on root containers\n if (node.scene) {\n return {\n parentSize: {\n width: node.scene.scale.width,\n height: node.scene.scale.height,\n },\n }\n }\n\n return {}\n}\n\n/**\n * Applies layout property changes to a container\n * Handles width, height, direction, padding, margin updates\n * Triggers layout recalculation when:\n * 1. Layout-relevant props changed, OR\n * 2. This is being called from host.patch (which means VDOM will handle child changes)\n * @param node - Phaser container node\n * @param prev - Previous layout props\n * @param next - New layout props\n */\nexport function applyLayoutProps(\n node: Phaser.GameObjects.Container & { __layoutProps?: LayoutProps & BackgroundProps },\n prev: Partial<LayoutProps & BackgroundProps>,\n next: Partial<LayoutProps & BackgroundProps>\n): void {\n // Update stored layout props (includes visible for display control)\n node.__layoutProps = next as LayoutProps & BackgroundProps\n\n // IMPORTANT: We only recalculate if container's own props changed\n // Children changes are handled by VDOM patchVNode() which has smarter detection\n // This prevents double-calculation while still catching container prop changes\n if (hasLayoutPropsChanged(prev, next)) {\n // Get parent layout context for percentage/fill resolution\n const { parentSize, parentPadding } = getParentLayoutContext(node)\n calculateLayout(node, next, parentSize, parentPadding)\n // Update gesture hit area after layout recalculation\n // This ensures hit area matches actual container size (important for auto-sized containers)\n updateGestureHitAreaIfNeeded(node)\n }\n // Note: If children changed (text content, child added/removed, etc.),\n // the VDOM layer will detect that and call calculateLayout separately\n}\n","/**\n * Color system types for PhaserJSX UI\n * Provides semantic color tokens with named shade levels\n */\n\n/**\n * Named shade levels for color scales\n * Uses semantic names instead of numeric values\n */\nexport type ShadeLevel = 'lightest' | 'light' | 'medium' | 'dark' | 'darkest'\n\n/**\n * Hex color string with conversion method\n * Extends string but adds toNumber() for Phaser compatibility\n */\nexport class HexColor extends String {\n /**\n * Convert to Phaser number format\n * @returns Color as number (0xffffff)\n */\n toNumber(): number {\n const hex = this.valueOf().replace('#', '')\n return parseInt(hex, 16)\n }\n\n /**\n * Create a HexColor from a hex string\n * @param hex - Hex color string\n */\n static from(hex: string): HexColor {\n return new HexColor(hex) as HexColor\n }\n}\n\n/**\n * Color shade scale with semantic naming\n * Each color token has multiple shades for different use cases\n * Uses HexColor type for VS Code color picker support and .toNumber() method\n * DEFAULT is computed property pointing to medium (not in interface)\n * @example\n * ```typescript\n * const primaryShade: ColorShade = {\n * lightest: HexColor.from('#e3f2fd'),\n * light: HexColor.from('#90caf9'),\n * medium: HexColor.from('#42a5f5'),\n * dark: HexColor.from('#1976d2'),\n * darkest: HexColor.from('#0d47a1'),\n * }\n * // DEFAULT is available via getter:\n * backgroundColor: colors.primary.DEFAULT.toNumber() // returns medium\n * // Direct usage:\n * backgroundColor: colors.primary.medium.toNumber()\n * ```\n */\nexport interface ColorShade {\n /** Lightest shade - backgrounds, hover states */\n lightest: HexColor\n /** Light shade - secondary elements */\n light: HexColor\n /** Medium shade - interactive elements (also available as DEFAULT) */\n medium: HexColor\n /** Dark shade - borders, dividers */\n dark: HexColor\n /** Darkest shade - text, emphasis */\n darkest: HexColor\n /** DEFAULT shade - computed property that points to medium */\n readonly DEFAULT: HexColor\n}\n\n/**\n * Complete color token system with semantic color categories\n * Designed for global theme usage with nested theme support\n */\nexport interface ColorTokens {\n /** Primary brand color - main actions and emphasis */\n primary: ColorShade\n /** Secondary brand color - supporting actions */\n secondary: ColorShade\n /** Accent color - highlights and special elements */\n accent: ColorShade\n\n /** Success state color - confirmations, positive feedback */\n success: ColorShade\n /** Warning state color - cautions, alerts */\n warning: ColorShade\n /** Error state color - errors, destructive actions */\n error: ColorShade\n /** Info state color - informational messages */\n info: ColorShade\n\n /** Background colors - main app backgrounds */\n background: ColorShade\n /** Surface colors - cards, panels, elevated elements */\n surface: ColorShade\n /** Text colors - typography hierarchy */\n text: ColorShade\n /** Border colors - dividers, outlines */\n border: ColorShade\n}\n\n/**\n * Color mode enum for light/dark theme switching\n */\nexport type ColorMode = 'light' | 'dark'\n\n/**\n * RGB color representation\n */\nexport interface RGBColor {\n r: number\n g: number\n b: number\n}\n","/**\n * Color utility functions for PhaserJSX UI\n * Provides conversion between formats and color manipulation\n */\n\nimport type { TextStyleToken } from '../design-tokens'\nimport { HexColor, type RGBColor } from './color-types'\n\n/**\n * Convert hex string to Phaser number format\n * @param hex - Hex color string (e.g., '#ffffff' or 'ffffff')\n * @returns Phaser color number (e.g., 0xffffff)\n * @example\n * ```typescript\n * hexToNumber('#ff0000') // returns 0xff0000\n * hexToNumber('00ff00') // returns 0x00ff00\n * ```\n */\nexport function hexToNumber(hex: string): number {\n const cleaned = hex.replace('#', '')\n return parseInt(cleaned, 16)\n}\n\n/**\n * Convert Phaser number format to hex string\n * @param num - Phaser color number (e.g., 0xffffff)\n * @param withHash - Include '#' prefix (default: true)\n * @returns Hex color string (e.g., '#ffffff')\n * @example\n * ```typescript\n * numberToHex(0xff0000) // returns '#ff0000'\n * numberToHex(0x00ff00, false) // returns '00ff00'\n * ```\n */\nexport function numberToHex(num: number, withHash = true): string {\n const hex = num.toString(16).padStart(6, '0')\n return withHash ? `#${hex}` : hex\n}\n\n/**\n * Convert RGB values to Phaser number format\n * @param r - Red component (0-255)\n * @param g - Green component (0-255)\n * @param b - Blue component (0-255)\n * @returns Phaser color number\n * @example\n * ```typescript\n * rgbToNumber(255, 0, 0) // returns 0xff0000 (red)\n * rgbToNumber(0, 255, 0) // returns 0x00ff00 (green)\n * rgbToNumber(255, 255, 255) // returns 0xffffff (white)\n * ```\n */\nexport function rgbToNumber(r: number, g: number, b: number): number {\n return ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)\n}\n\n/**\n * Convert Phaser number to RGB components\n * @param num - Phaser color number\n * @returns RGB color object\n * @example\n * ```typescript\n * numberToRgb(0xff0000) // returns { r: 255, g: 0, b: 0 }\n * numberToRgb(0x00ff00) // returns { r: 0, g: 255, b: 0 }\n * ```\n */\nexport function numberToRgb(num: number): RGBColor {\n return {\n r: (num >> 16) & 0xff,\n g: (num >> 8) & 0xff,\n b: num & 0xff,\n }\n}\n\n/**\n * Lighten a color by a given amount\n * @param color - Phaser color number\n * @param amount - Amount to lighten (0.0 to 1.0, where 1.0 is white)\n * @returns Lightened color number\n * @example\n * ```typescript\n * lighten(0x0000ff, 0.3) // returns lighter blue\n * lighten(0xff0000, 0.5) // returns light red/pink\n * ```\n */\nexport function lighten(color: number, amount: number): number {\n const rgb = numberToRgb(color)\n const factor = Math.max(0, Math.min(1, amount))\n\n const r = Math.round(rgb.r + (255 - rgb.r) * factor)\n const g = Math.round(rgb.g + (255 - rgb.g) * factor)\n const b = Math.round(rgb.b + (255 - rgb.b) * factor)\n\n return rgbToNumber(r, g, b)\n}\n\n/**\n * Darken a color by a given amount\n * @param color - Phaser color number\n * @param amount - Amount to darken (0.0 to 1.0, where 1.0 is black)\n * @returns Darkened color number\n * @example\n * ```typescript\n * darken(0x0000ff, 0.3) // returns darker blue\n * darken(0xff0000, 0.5) // returns dark red\n * ```\n */\nexport function darken(color: number, amount: number): number {\n const rgb = numberToRgb(color)\n const factor = 1 - Math.max(0, Math.min(1, amount))\n\n const r = Math.round(rgb.r * factor)\n const g = Math.round(rgb.g * factor)\n const b = Math.round(rgb.b * factor)\n\n return rgbToNumber(r, g, b)\n}\n\n/**\n * Lighten a hex color by a given amount\n * @param hex - Hex color (e.g., '#ffffff' or 'ffffff')\n * @param amount - Amount to lighten (0.0 to 1.0, where 1.0 is white)\n * @returns Lightened hex color string with '#' prefix\n * @example\n * ```typescript\n * lightenHex('#0000ff', 0.3) // returns lighter blue\n * lightenHex('#ff0000', 0.5) // returns light red/pink\n * ```\n */\nexport function lightenHex(hex: string, amount: number): HexColor {\n const num = hexToNumber(hex)\n const lightened = lighten(num, amount)\n return HexColor.from(numberToHex(lightened))\n}\n\n/**\n * Darken a hex color by a given amount\n * @param hex - Hex color (e.g., '#ffffff' or 'ffffff')\n * @param amount - Amount to darken (0.0 to 1.0, where 1.0 is black)\n * @returns Darkened hex color string with '#' prefix\n * @example\n * ```typescript\n * darkenHex('#0000ff', 0.3) // returns darker blue\n * darkenHex('#ff0000', 0.5) // returns dark red\n * ```\n */\nexport function darkenHex(hex: string, amount: number): HexColor {\n const num = hexToNumber(hex)\n const darkened = darken(num, amount)\n return HexColor.from(numberToHex(darkened))\n}\n\n/**\n * Hex color wrapper with chainable conversion methods\n * Provides fluent API for color conversions\n */\nexport interface HexColorWrapper {\n /** Original hex string value */\n value: string\n /** Convert to Phaser number format */\n toNumber: () => number\n /** Convert to string (returns hex) */\n toString: () => string\n}\n\n/**\n * Create a hex color wrapper with chainable methods\n * @param hex - Hex color string\n * @returns Wrapper object with conversion methods\n * @example\n * ```typescript\n * const color = hex('#ff0000')\n * color.toNumber() // 0xff0000\n * color.toString() // '#ff0000'\n *\n * // Direct usage:\n * backgroundColor: hex(colors.primary.DEFAULT).toNumber()\n * ```\n */\nexport function hex(hexColor: string): HexColorWrapper {\n return {\n value: hexColor,\n toNumber: () => hexToNumber(hexColor),\n toString: () => hexColor,\n }\n}\n\n/**\n * Convert color to rgba string for Phaser Text style\n * @param color - Phaser color number\n * @param alphaValue - Alpha value (0.0 to 1.0, default: 1.0)\n * @returns RGBA string usable in Text style (e.g., 'rgba(255, 0, 0, 0.5)')\n * @example\n * ```typescript\n * alpha(0xff0000, 1.0) // returns 'rgba(255, 0, 0, 1)'\n * alpha(0x00ff00, 0.5) // returns 'rgba(0, 255, 0, 0.5)'\n * alpha(0x0000ff) // returns 'rgba(0, 0, 255, 1)'\n * ```\n */\nexport function alpha(color: number, alphaValue = 1.0): string {\n const rgb = numberToRgb(color)\n const a = Math.max(0, Math.min(1, alphaValue))\n return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${a})`\n}\n\n/**\n * Calculate relative luminance of a color (WCAG formula)\n * @param color - Phaser color number\n * @returns Relative luminance (0.0 to 1.0)\n */\nfunction getLuminance(color: number): number {\n const rgb = numberToRgb(color)\n\n // Convert to sRGB\n const rsRGB = rgb.r / 255\n const gsRGB = rgb.g / 255\n const bsRGB = rgb.b / 255\n\n // Apply gamma correction\n const r = rsRGB <= 0.03928 ? rsRGB / 12.92 : Math.pow((rsRGB + 0.055) / 1.055, 2.4)\n const g = gsRGB <= 0.03928 ? gsRGB / 12.92 : Math.pow((gsRGB + 0.055) / 1.055, 2.4)\n const b = bsRGB <= 0.03928 ? bsRGB / 12.92 : Math.pow((bsRGB + 0.055) / 1.055, 2.4)\n\n // Calculate luminance\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n\n/**\n * Calculate contrast ratio between two colors (WCAG 2.0)\n * @param foreground - Foreground color (e.g., text)\n * @param background - Background color\n * @returns Contrast ratio (1 to 21)\n * @example\n * ```typescript\n * getContrastRatio(0x000000, 0xffffff) // returns 21 (black on white)\n * getContrastRatio(0xffffff, 0xffffff) // returns 1 (white on white)\n * ```\n */\nexport function getContrastRatio(foreground: number, background: number): number {\n const l1 = getLuminance(foreground)\n const l2 = getLuminance(background)\n\n const lighter = Math.max(l1, l2)\n const darker = Math.min(l1, l2)\n\n return (lighter + 0.05) / (darker + 0.05)\n}\n\n/**\n * Ensure minimum contrast ratio by adjusting foreground color\n * @param foreground - Foreground color to adjust\n * @param background - Background color (fixed)\n * @param minRatio - Minimum contrast ratio (default: 4.5 for WCAG AA)\n * @returns Adjusted foreground color meeting contrast requirements\n * @example\n * ```typescript\n * // Ensure text is readable on background\n * const textColor = ensureContrast(0x888888, 0xffffff, 4.5)\n * ```\n */\nexport function ensureContrast(foreground: number, background: number, minRatio = 4.5): number {\n let adjusted = foreground\n let ratio = getContrastRatio(adjusted, background)\n\n // If contrast is already sufficient, return original\n if (ratio >= minRatio) {\n return foreground\n }\n\n // Determine if we should lighten or darken\n const bgLuminance = getLuminance(background)\n const shouldLighten = bgLuminance < 0.5\n\n // Adjust in steps until we meet minimum ratio\n let step = 0.1\n while (ratio < minRatio && step <= 1.0) {\n adjusted = shouldLighten ? lighten(foreground, step) : darken(foreground, step)\n ratio = getContrastRatio(adjusted, background)\n step += 0.1\n }\n\n return adjusted\n}\n\n/**\n * Create a TextStyleToken by merging base style with overrides to ensure required properties are set\n * @param baseStyle\n * @param overrides\n * @returns\n */\nexport function createTextStyle(\n baseStyle: Partial<TextStyleToken> | undefined,\n overrides: Partial<TextStyleToken>\n): TextStyleToken {\n const base = baseStyle ?? {}\n return {\n fontSize: overrides.fontSize ?? base.fontSize ?? '14px',\n color: overrides.color ?? base.color ?? '#ffffff',\n ...(base.fontFamily && { fontFamily: base.fontFamily }),\n ...(base.align && { align: base.align }),\n ...overrides,\n }\n}\n","/**\n * Color preset definitions for PhaserJSX UI\n * Provides pre-configured color palettes with light/dark mode support\n */\n\nimport { HexColor, type ColorShade, type ColorTokens } from './color-types'\nimport { darkenHex, lightenHex } from './color-utils'\n\n/**\n * Base ColorShade without DEFAULT property\n */\ntype ColorShadeBase = Omit<ColorShade, 'DEFAULT'>\n\n/**\n * Add DEFAULT getter to ColorShade object\n * Makes DEFAULT a computed property pointing to medium\n * @param shade - ColorShade object without DEFAULT\n * @returns ColorShade with DEFAULT getter\n */\nfunction addDefaultGetter(shade: ColorShadeBase): ColorShade {\n Object.defineProperty(shade, 'DEFAULT', {\n get() {\n return this.medium\n },\n enumerable: false, // Don't show in Object.keys()\n configurable: true,\n })\n return shade as ColorShade\n}\n\n/**\n * Generate a complete color scale from a base color\n * Creates shades from lightest to darkest with DEFAULT pointing to medium\n * @param baseColor - The base color in hex format (e.g., '#2196f3')\n * @returns Complete ColorShade with all semantic levels as HexColor objects\n * @example\n * ```typescript\n * const primaryScale = generateColorScale('#2196f3')\n * // Usage: colors.primary.medium.toNumber()\n * // DEFAULT also works: colors.primary.DEFAULT.toNumber()\n * ```\n */\nexport function generateColorScale(baseColor: string): ColorShade {\n return addDefaultGetter({\n lightest: lightenHex(baseColor, 0.7),\n light: lightenHex(baseColor, 0.4),\n medium: lightenHex(baseColor, 0.15),\n dark: darkenHex(baseColor, 0.15),\n darkest: darkenHex(baseColor, 0.4),\n })\n}\n\n/**\n * Color preset configuration\n * Defines a complete set of semantic colors for a theme\n */\nexport interface ColorPreset {\n /** Preset name for identification */\n name: string\n /** Complete color token set */\n colors: ColorTokens\n}\n\n/**\n * Ocean Blue Preset\n * Clean, professional blue-based palette\n */\nexport const oceanBluePreset: ColorPreset = {\n name: 'oceanBlue',\n colors: {\n // Brand colors\n primary: generateColorScale('#2196f3'), // Material Blue\n secondary: generateColorScale('#607d8b'), // Blue Grey\n accent: generateColorScale('#00bcd4'), // Cyan\n\n // Feedback colors\n success: generateColorScale('#4caf50'), // Green\n warning: generateColorScale('#ff9800'), // Orange\n error: generateColorScale('#f44336'), // Red\n info: generateColorScale('#2196f3'), // Blue (same as primary)\n\n // Neutral colors - designed for light mode\n background: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#f5f5f5'),\n medium: HexColor.from('#e0e0e0'),\n dark: HexColor.from('#bdbdbd'),\n darkest: HexColor.from('#9e9e9e'),\n }),\n surface: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#f5f5f5'),\n medium: HexColor.from('#eeeeee'),\n dark: HexColor.from('#e0e0e0'),\n darkest: HexColor.from('#bdbdbd'),\n }),\n text: addDefaultGetter({\n lightest: HexColor.from('#9e9e9e'),\n light: HexColor.from('#757575'),\n medium: HexColor.from('#616161'),\n dark: HexColor.from('#424242'),\n darkest: HexColor.from('#212121'),\n }),\n border: addDefaultGetter({\n lightest: HexColor.from('#e0e0e0'),\n light: HexColor.from('#bdbdbd'),\n medium: HexColor.from('#9e9e9e'),\n dark: HexColor.from('#757575'),\n darkest: HexColor.from('#424242'),\n }),\n },\n}\n\n/**\n * Forest Green Preset\n * Nature-inspired green-based palette\n */\nexport const forestGreenPreset: ColorPreset = {\n name: 'forestGreen',\n colors: {\n // Brand colors\n primary: generateColorScale('#4caf50'), // Green\n secondary: generateColorScale('#8bc34a'), // Light Green\n accent: generateColorScale('#ffeb3b'), // Yellow\n\n // Feedback colors\n success: generateColorScale('#66bb6a'), // Light Green\n warning: generateColorScale('#ffa726'), // Orange\n error: generateColorScale('#ef5350'), // Red\n info: generateColorScale('#29b6f6'), // Light Blue\n\n // Neutral colors - designed for light mode\n background: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#f1f8e9'),\n medium: HexColor.from('#dcedc8'),\n dark: HexColor.from('#c5e1a5'),\n darkest: HexColor.from('#aed581'),\n }),\n surface: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#f9fbe7'),\n medium: HexColor.from('#f0f4c3'),\n dark: HexColor.from('#e6ee9c'),\n darkest: HexColor.from('#dce775'),\n }),\n text: addDefaultGetter({\n lightest: HexColor.from('#9e9e9e'),\n light: HexColor.from('#757575'),\n medium: HexColor.from('#616161'),\n dark: HexColor.from('#424242'),\n darkest: HexColor.from('#1b5e20'),\n }),\n border: addDefaultGetter({\n lightest: HexColor.from('#dcedc8'),\n light: HexColor.from('#c5e1a5'),\n medium: HexColor.from('#aed581'),\n dark: HexColor.from('#9ccc65'),\n darkest: HexColor.from('#7cb342'),\n }),\n },\n}\n\n/**\n * Midnight Preset\n * Dark, elegant purple-based palette\n */\nexport const midnightPreset: ColorPreset = {\n name: 'midnight',\n colors: {\n // Brand colors\n primary: generateColorScale('#9c27b0'), // Purple\n secondary: generateColorScale('#673ab7'), // Deep Purple\n accent: generateColorScale('#e91e63'), // Pink\n\n // Feedback colors\n success: generateColorScale('#66bb6a'), // Green\n warning: generateColorScale('#ffa726'), // Orange\n error: generateColorScale('#ef5350'), // Red\n info: generateColorScale('#42a5f5'), // Blue\n\n // Neutral colors - designed for dark mode\n background: addDefaultGetter({\n lightest: HexColor.from('#424242'),\n light: HexColor.from('#303030'),\n medium: HexColor.from('#212121'),\n dark: HexColor.from('#1a1a1a'),\n darkest: HexColor.from('#0a0a0a'),\n }),\n surface: addDefaultGetter({\n lightest: HexColor.from('#424242'),\n light: HexColor.from('#303030'),\n medium: HexColor.from('#262626'),\n dark: HexColor.from('#1e1e1e'),\n darkest: HexColor.from('#121212'),\n }),\n text: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#e0e0e0'),\n medium: HexColor.from('#bdbdbd'),\n dark: HexColor.from('#9e9e9e'),\n darkest: HexColor.from('#757575'),\n }),\n border: addDefaultGetter({\n lightest: HexColor.from('#616161'),\n light: HexColor.from('#424242'),\n medium: HexColor.from('#303030'),\n dark: HexColor.from('#212121'),\n darkest: HexColor.from('#1a1a1a'),\n }),\n },\n}\n\n/**\n * Apply light mode overrides to a preset\n * Adjusts neutral colors for optimal light mode appearance\n * @param preset - Base preset to modify\n * @returns New preset with light mode neutral colors\n */\nexport function applyLightMode(preset: ColorPreset): ColorPreset {\n return {\n ...preset,\n colors: {\n ...preset.colors,\n background: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#f5f5f5'),\n medium: HexColor.from('#e0e0e0'),\n dark: HexColor.from('#bdbdbd'),\n darkest: HexColor.from('#9e9e9e'),\n }),\n surface: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#f5f5f5'),\n medium: HexColor.from('#eeeeee'),\n dark: HexColor.from('#e0e0e0'),\n darkest: HexColor.from('#bdbdbd'),\n }),\n text: addDefaultGetter({\n lightest: HexColor.from('#9e9e9e'),\n light: HexColor.from('#757575'),\n medium: HexColor.from('#616161'),\n dark: HexColor.from('#424242'),\n darkest: HexColor.from('#212121'),\n }),\n border: addDefaultGetter({\n lightest: HexColor.from('#e0e0e0'),\n light: HexColor.from('#bdbdbd'),\n medium: HexColor.from('#9e9e9e'),\n dark: HexColor.from('#757575'),\n darkest: HexColor.from('#424242'),\n }),\n },\n }\n}\n\n/**\n * Apply dark mode overrides to a preset\n * Adjusts neutral colors for optimal dark mode appearance\n * @param preset - Base preset to modify\n * @returns New preset with dark mode neutral colors\n */\nexport function applyDarkMode(preset: ColorPreset): ColorPreset {\n return {\n ...preset,\n colors: {\n ...preset.colors,\n background: addDefaultGetter({\n lightest: HexColor.from('#424242'),\n light: HexColor.from('#303030'),\n medium: HexColor.from('#212121'),\n dark: HexColor.from('#1a1a1a'),\n darkest: HexColor.from('#0a0a0a'),\n }),\n surface: addDefaultGetter({\n lightest: HexColor.from('#424242'),\n light: HexColor.from('#303030'),\n medium: HexColor.from('#262626'),\n dark: HexColor.from('#1e1e1e'),\n darkest: HexColor.from('#121212'),\n }),\n text: addDefaultGetter({\n lightest: HexColor.from('#ffffff'),\n light: HexColor.from('#e0e0e0'),\n medium: HexColor.from('#bdbdbd'),\n dark: HexColor.from('#9e9e9e'),\n darkest: HexColor.from('#757575'),\n }),\n border: addDefaultGetter({\n lightest: HexColor.from('#616161'),\n light: HexColor.from('#424242'),\n medium: HexColor.from('#303030'),\n dark: HexColor.from('#212121'),\n darkest: HexColor.from('#1a1a1a'),\n }),\n },\n }\n}\n\n/**\n * All available presets\n */\nexport const presets = {\n oceanBlue: oceanBluePreset,\n forestGreen: forestGreenPreset,\n midnight: midnightPreset,\n} as const\n\n/**\n * Preset names for type safety\n */\nexport type PresetName = keyof typeof presets\n\n/**\n * Get a preset by name\n * @param name - Preset name\n * @returns Color preset\n * @example\n * ```typescript\n * const preset = getPreset('oceanBlue')\n * const primaryColor = preset.colors.primary.DEFAULT\n * ```\n */\nexport function getPreset(name: PresetName): ColorPreset {\n return presets[name]\n}\n\n/**\n * Get a preset with color mode applied\n * @param name - Preset name\n * @param mode - Color mode ('light' or 'dark')\n * @returns Color preset with mode-specific neutral colors\n * @example\n * ```typescript\n * const darkPreset = getPresetWithMode('oceanBlue', 'dark')\n * const bgColor = darkPreset.colors.background.DEFAULT\n * ```\n */\nexport function getPresetWithMode(name: PresetName, mode: 'light' | 'dark'): ColorPreset {\n const preset = getPreset(name)\n return mode === 'light' ? applyLightMode(preset) : applyDarkMode(preset)\n}\n","/**\n * Default design token presets\n * Provides sensible defaults for text styles, spacing, sizes, and radius\n */\nimport type { RadiusTokens, SizeTokens, SpacingTokens, TextStyleTokens } from './design-token-types'\n\n/**\n * Default spacing scale\n * Based on 4px base unit\n */\nexport const defaultSpacingTokens: SpacingTokens = {\n xs: 4,\n sm: 8,\n md: 16,\n lg: 24,\n xl: 32,\n xxl: 48,\n}\n\n/**\n * Default size scale\n * For width, height, icon sizes, etc.\n */\nexport const defaultSizeTokens: SizeTokens = {\n xs: 16,\n sm: 24,\n md: 32,\n lg: 48,\n xl: 64,\n xxl: 96,\n}\n\n/**\n * Default border radius scale\n */\nexport const defaultRadiusTokens: RadiusTokens = {\n none: 0,\n sm: 4,\n md: 8,\n lg: 16,\n xl: 24,\n xxl: 48,\n}\n\n/**\n * Create text style tokens with the given base text color\n * @param textColor - Base text color (hex string)\n * @returns TextStyleTokens with color applied\n */\nexport function createTextStyleTokens(textColor: string): TextStyleTokens {\n return {\n DEFAULT: {\n fontSize: '16px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n small: {\n fontSize: '12px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n medium: {\n fontSize: '16px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n large: {\n fontSize: '20px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n title: {\n fontSize: '28px',\n color: textColor,\n fontFamily: 'Arial',\n fontStyle: 'bold',\n align: 'left',\n },\n heading: {\n fontSize: '36px',\n color: textColor,\n fontFamily: 'Arial',\n fontStyle: 'bold',\n align: 'left',\n },\n caption: {\n fontSize: '10px',\n color: textColor,\n fontFamily: 'Arial',\n align: 'left',\n },\n }\n}\n\n/**\n * Default text style tokens (white text)\n */\nexport const defaultTextStyleTokens: TextStyleTokens = createTextStyleTokens('#ffffff')\n","/**\n * Default theme values for all components\n * This file contains the default theme configuration\n * Uses oceanBlue preset with light mode for consistent, semantic colors\n */\nimport { getPresetWithMode, type PresetName } from './colors/color-presets'\nimport type { ColorTokens } from './colors/color-types'\nimport { createTextStyleTokens } from './design-tokens/design-token-presets'\nimport type { Theme } from './theme-base'\nimport './theme-custom' // Import to activate declaration merging\n\nfunction buildDefaultTheme(colors: ColorTokens): Theme {\n const textStyles = createTextStyleTokens(colors.text.DEFAULT.toString())\n\n /**\n * Default theme values for all built-in and custom components\n */\n return {\n // Primitives (lowercase) - share same defaults as uppercase\n view: {\n alpha: 1,\n visible: true,\n },\n Icon: {\n size: 24,\n tint: colors.border.dark.toNumber(),\n },\n text: {\n text: '',\n alpha: 1,\n visible: true,\n style: textStyles.DEFAULT,\n },\n nineslice: {\n alpha: 1,\n visible: true,\n },\n sprite: {\n alpha: 1,\n visible: true,\n },\n image: {\n alpha: 1,\n visible: true,\n },\n graphics: {\n alpha: 1,\n visible: true,\n },\n tilesprite: {\n alpha: 1,\n visible: true,\n },\n // Public API (uppercase)\n View: {\n alpha: 1,\n visible: true,\n },\n Text: {\n text: '',\n alpha: 1,\n visible: true,\n style: textStyles.DEFAULT,\n },\n NineSlice: {\n alpha: 1,\n visible: true,\n },\n Sprite: {\n alpha: 1,\n visible: true,\n },\n Image: {\n alpha: 1,\n visible: true,\n },\n Graphics: {\n alpha: 1,\n visible: true,\n },\n TileSprite: {\n alpha: 1,\n visible: true,\n },\n RadioButton: {\n selectedColor: colors.primary.DEFAULT.toNumber(),\n color: colors.border.medium.toNumber(),\n gap: 10,\n size: 16,\n innerSize: 16,\n labelStyle: {\n color: colors.text.DEFAULT.toString(),\n fontSize: '14px',\n },\n },\n ScrollSlider: {\n borderColor: colors.border.dark.toNumber(),\n trackColor: colors.surface.dark.toNumber(),\n thumbColor: colors.primary.dark.toNumber(),\n borderWidth: 2,\n minThumbSize: 30,\n size: 24,\n },\n Button: {\n disabledColor: colors.background.DEFAULT.toNumber(),\n iconSize: 24,\n backgroundColor: colors.primary.DEFAULT.toNumber(),\n backgroundAlpha: 1.0,\n borderColor: colors.primary.dark.toNumber(),\n borderWidth: 1,\n cornerRadius: 6,\n padding: 8,\n gap: 8,\n justifyContent: 'center',\n alignItems: 'center',\n primary: {\n backgroundColor: colors.primary.medium.toNumber(),\n borderColor: colors.primary.dark.toNumber(),\n },\n secondary: {\n backgroundColor: colors.secondary.DEFAULT.toNumber(),\n borderColor: colors.secondary.dark.toNumber(),\n effect: 'press',\n effectConfig: { intensity: 0.9, time: 200 },\n },\n outline: {\n backgroundColor: 0x000000,\n backgroundAlpha: 0.0,\n borderColor: colors.accent.DEFAULT.toNumber(),\n borderWidth: 2,\n effect: 'flash',\n effectConfig: { intensity: 1.15, time: 200 },\n },\n small: {\n padding: 6,\n cornerRadius: 4,\n },\n medium: {\n padding: 8,\n cornerRadius: 6,\n },\n large: {\n padding: { top: 12, bottom: 12, left: 8, right: 8 },\n cornerRadius: 8,\n },\n },\n Sidebar: {\n variant: 'solid',\n size: 'md',\n backgroundColor: colors.surface.light.toNumber(),\n backgroundAlpha: 1,\n padding: 16,\n gap: 8,\n dividerColor: colors.border.light.toNumber(),\n itemGap: 8,\n sectionGap: 10,\n headerStyle: {\n gap: 10,\n padding: { bottom: 6 },\n width: 'fill',\n },\n footerStyle: {\n gap: 8,\n padding: { top: 6 },\n width: 'fill',\n },\n sectionStyle: {\n gap: 8,\n padding: { top: 4, bottom: 8 },\n width: 'fill',\n titleStyle: {\n ...textStyles.medium,\n color: colors.text.dark.toString(),\n fontStyle: 'bold',\n },\n },\n itemStyle: {\n gap: 8,\n padding: { top: 8, bottom: 8, left: 10, right: 10 },\n width: 'fill',\n cornerRadius: 8,\n backgroundColor: colors.surface.lightest.toNumber(),\n textStyle: {\n ...textStyles.medium,\n color: colors.text.dark.toString(),\n },\n active: {\n backgroundColor: colors.primary.lightest.toNumber(),\n borderColor: colors.primary.light.toNumber(),\n borderWidth: 1,\n backgroundAlpha: 0.9,\n },\n disabledAlpha: 0.5,\n },\n badgeStyle: {\n backgroundColor: colors.primary.light.toNumber(),\n backgroundAlpha: 0.15,\n cornerRadius: 6,\n padding: { top: 4, bottom: 4, left: 8, right: 8 },\n textStyle: {\n ...textStyles.small,\n color: colors.primary.dark.toString(),\n fontStyle: 'bold',\n },\n },\n variants: {\n solid: {\n backgroundColor: colors.surface.light.toNumber(),\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n },\n muted: {\n backgroundColor: colors.surface.medium.toNumber(),\n backgroundAlpha: 0.85,\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n },\n ghost: {\n backgroundColor: colors.background.lightest.toNumber(),\n backgroundAlpha: 0.6,\n borderWidth: 0,\n },\n inset: {\n backgroundColor: colors.surface.dark.toNumber(),\n backgroundAlpha: 1,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n },\n },\n sizes: {\n sm: {\n padding: 10,\n gap: 6,\n },\n md: {\n padding: 16,\n gap: 8,\n },\n lg: {\n padding: { top: 20, bottom: 20, left: 16, right: 16 },\n gap: 12,\n },\n },\n },\n Accordion: {\n effect: 'none',\n effectConfig: { magnitude: 0.02, time: 150 },\n headerStyle: {\n backgroundColor: colors.surface.dark.toNumber(),\n padding: 10,\n gap: 10,\n cornerRadius: 5,\n width: 'fill',\n },\n contentStyle: {\n backgroundColor: colors.surface.light.toNumber(),\n padding: 10,\n cornerRadius: 5,\n width: 'fill',\n },\n Icon: {\n size: 24,\n },\n textStyle: {\n color: colors.text.DEFAULT.toString(),\n fontSize: '18px',\n },\n },\n NineSliceButton: {},\n CharText: {\n charSpacing: 0,\n cursorColor: colors.secondary.DEFAULT.toNumber(),\n cursorWidth: 3,\n cursorBlinkSpeed: 200,\n selectionAlpha: 0.3,\n lineHeight: 1.2,\n wordWrap: true,\n textStyle: textStyles.DEFAULT,\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 2,\n cornerRadius: 6,\n padding: 10,\n },\n CharTextInput: {\n charSpacing: 2,\n cursorColor: colors.secondary.DEFAULT.toNumber(),\n cursorWidth: 3,\n cursorBlinkSpeed: 200,\n selectionColor: colors.accent.light.toNumber(),\n selectionAlpha: 0.5,\n lineHeight: 1.2,\n wordWrap: false,\n disabledColor: colors.border.dark.toNumber(),\n focusedBorderColor: colors.accent.lightest.toNumber(),\n backgroundColor: colors.surface.medium.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n padding: 8,\n textStyle: textStyles.DEFAULT,\n },\n Dropdown: {\n trigger: {\n backgroundColor: colors.surface.medium.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 4,\n padding: { left: 12, right: 12, top: 8, bottom: 8 },\n width: 'fill',\n },\n triggerHover: {\n borderColor: colors.primary.DEFAULT.toNumber(),\n },\n triggerOpen: {\n borderColor: colors.primary.DEFAULT.toNumber(),\n backgroundColor: colors.surface.dark.toNumber(),\n },\n triggerDisabled: {\n backgroundColor: colors.surface.light.toNumber(),\n alpha: 0.5,\n },\n arrow: {\n color: colors.text.DEFAULT.toNumber(),\n size: 12,\n },\n overlay: {\n backgroundColor: colors.surface.medium.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n borderWidth: 1,\n cornerRadius: 4,\n maxHeight: 300,\n padding: 4,\n },\n option: {\n padding: { left: 12, right: 12, top: 8, bottom: 8 },\n },\n optionSelected: {\n backgroundColor: colors.primary.light.toNumber(),\n Text: {\n style: textStyles.DEFAULT,\n },\n },\n optionDisabled: {\n alpha: 0.3,\n },\n textStyle: textStyles.DEFAULT,\n placeholderStyle: textStyles.DEFAULT,\n filterInput: {\n backgroundColor: colors.surface.lightest.toNumber(),\n borderColor: colors.border.medium.toNumber(),\n //height: 32,\n },\n animationConfig: 'stiff',\n optionGap: 2,\n },\n Slider: {\n // Track styling\n trackColor: colors.surface.dark.toNumber(),\n trackFilledColor: colors.primary.dark.toNumber(),\n trackHeight: 6,\n trackBorderRadius: 3,\n trackLength: 200,\n trackHoverColor: colors.surface.dark.toNumber(),\n\n // Thumb styling\n thumbColor: colors.primary.light.toNumber(),\n thumbSize: 20,\n thumbBorderColor: colors.border.light.toNumber(),\n thumbBorderWidth: 2,\n thumbHoverColor: colors.primary.light.toNumber(),\n thumbActiveColor: colors.primary.dark.toNumber(),\n thumbDragScale: 1.1,\n\n // Marks/Ticks\n markColor: colors.border.medium.toNumber(),\n markHeight: 8,\n markWidth: 2,\n\n // Value label\n labelStyle: textStyles.small,\n labelOffset: 10,\n valueLabel: {\n backgroundColor: colors.background.dark.toNumber(),\n textStyle: { ...textStyles.small, color: colors.text.light.toString() },\n padding: { left: 6, right: 6, top: 4, bottom: 4 },\n cornerRadius: 4,\n offset: 8,\n },\n\n // RangeSlider specific\n minDistance: 0,\n\n // States\n disabledAlpha: 0.4,\n\n // Animation & Effects\n animationConfig: { tension: 300, friction: 30 } as const,\n },\n Toggle: {\n width: 50,\n height: 28,\n thumbSize: 24,\n trackColorOff: colors.surface.dark.toNumber(),\n trackColorOn: colors.success.DEFAULT.toNumber(),\n thumbColor: colors.surface.lightest.toNumber(),\n disabledColor: colors.border.medium.toNumber(),\n padding: 2,\n duration: 200,\n gap: 8,\n labelStyle: textStyles.DEFAULT,\n labelPosition: 'right',\n },\n Modal: {\n backdropColor: 0x000000,\n backdropOpacity: 0.5,\n },\n Dialog: {\n backgroundColor: colors.surface.DEFAULT.toNumber(),\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n cornerRadius: 8,\n padding: 0,\n maxWidth: 600,\n showClose: true,\n Header: {\n padding: { left: 24, right: 24, top: 20, bottom: 16 },\n gap: 12,\n textStyle: textStyles.heading,\n closeButton: {\n size: 32,\n cornerRadius: 4,\n backgroundColor: colors.surface.dark.toNumber(),\n borderColor: colors.border.light.toNumber(),\n borderWidth: 1,\n },\n },\n Content: {\n padding: { left: 24, right: 24, top: 16, bottom: 16 },\n gap: 12,\n },\n Actions: {\n padding: { left: 24, right: 24, top: 16, bottom: 20 },\n gap: 12,\n justifyContent: 'end',\n },\n },\n AlertDialog: {\n maxWidth: 500,\n },\n WrapText: {\n wrap: true,\n paddingOffset: 0,\n textStyle: textStyles.DEFAULT,\n },\n Tooltip: {\n position: 'top',\n showDelay: 1000,\n hideDelay: 500,\n offset: 8,\n textStyle: {\n fontSize: '12px',\n fontFamily: 'Arial',\n color: colors.text.dark.toString(),\n backgroundColor: colors.warning.medium.toString(),\n padding: { x: 2, y: 2 },\n },\n cornerRadius: 8,\n animation: {\n fadeIn: 200,\n fadeOut: 200,\n move: { dx: 0, dy: -20 },\n pulse: false,\n },\n },\n }\n}\n\n// Get oceanBlue preset with light mode\nconst preset = getPresetWithMode('oceanBlue', 'light')\n\n/**\n * Default theme values for all built-in and custom components (oceanBlue / light)\n */\nexport const defaultTheme: Theme = buildDefaultTheme(preset.colors)\n\n/**\n * Create a default theme for any preset + mode combination\n * Useful when apps want the library defaults but re-colored by their own palette\n */\nexport function createDefaultTheme(\n presetName: PresetName = 'oceanBlue',\n mode: 'light' | 'dark' = 'light'\n): Theme {\n const presetForMode = getPresetWithMode(presetName, mode)\n return buildDefaultTheme(presetForMode.colors)\n}\n","/**\n * Global theme system for PhaserJSX\n * Provides type-safe theming with inheritance and component-specific styles\n */\nimport type { ColorTokens } from './colors'\nimport type { NodeType } from './core-types'\nimport { DebugLogger } from './dev-config'\nimport type { ComponentThemes, PartialTheme, Theme } from './theme-base'\nimport './theme-custom' // Import to activate declaration merging\nimport { createDefaultTheme, defaultTheme } from './theme-defaults'\n\n// Re-export all types and interfaces\nexport type {\n BuiltInComponentThemes,\n ComponentThemes,\n CustomComponentThemes,\n GraphicsTheme,\n ImageTheme,\n NestedComponentThemes,\n NineSliceTheme,\n PartialTheme,\n SpriteTheme,\n TextTheme,\n Theme,\n TileSpriteTheme,\n ViewTheme,\n} from './theme-base'\nexport { createDefaultTheme, defaultTheme }\n\n/**\n * Global theme registry\n * Stores the current global theme and custom component themes\n */\nclass ThemeRegistry {\n private globalTheme: Theme = { ...defaultTheme }\n private customThemes: Map<string, Record<string, unknown>> = new Map()\n private colorTokens: ColorTokens | undefined = undefined\n private colorMode: 'light' | 'dark' = 'light'\n private currentPresetName: string | undefined = undefined\n private listeners: Set<() => void> = new Set()\n\n /**\n * Get the complete global theme\n */\n getGlobalTheme(): Readonly<Theme> {\n return { ...this.globalTheme, ...Object.fromEntries(this.customThemes) } as Theme\n }\n\n /**\n * Update global theme (deep merge)\n * @param theme - Partial theme to merge with current global theme\n */\n updateGlobalTheme(theme: PartialTheme): void {\n for (const [component, styles] of Object.entries(theme)) {\n if (component in this.globalTheme) {\n this.globalTheme[component as NodeType] = {\n ...this.globalTheme[component as NodeType],\n ...styles,\n } as never\n DebugLogger.log(\n 'theme',\n `Updated ${component} theme:`,\n this.globalTheme[component as NodeType]\n )\n } else {\n // Custom component\n const existing = this.customThemes.get(component) ?? {}\n this.customThemes.set(component, { ...existing, ...styles })\n }\n }\n }\n\n /**\n * Set the entire global theme (replaces current theme)\n * @param theme - Complete theme to set\n */\n setGlobalTheme(theme: Theme): void {\n this.globalTheme = { ...theme }\n }\n\n /**\n * Reset global theme to default values\n */\n resetGlobalTheme(): void {\n this.globalTheme = { ...defaultTheme }\n this.customThemes.clear()\n }\n\n /**\n * Register a custom component theme\n * @param componentName - Name of the custom component\n * @param defaultStyles - Default styles for the component\n */\n registerCustomComponent<T extends Record<string, unknown>>(\n componentName: string,\n defaultStyles: T\n ): void {\n this.customThemes.set(componentName, defaultStyles)\n }\n\n /**\n * Get theme for a specific component\n * @param componentName - Component name\n * @returns Theme for the component\n */\n getComponentTheme<K extends keyof ComponentThemes>(componentName: K): ComponentThemes[K] {\n if (componentName in this.globalTheme) {\n const theme = this.globalTheme[componentName as NodeType] as ComponentThemes[K]\n return theme\n }\n return (this.customThemes.get(componentName as string) ?? {}) as ComponentThemes[K]\n }\n\n /**\n * Get all registered custom component names\n * @returns Set of custom component names\n */\n getCustomComponentNames(): Set<string> {\n return new Set(this.customThemes.keys())\n }\n\n /**\n * Set color tokens for the global theme\n * @param colors - ColorTokens to use globally\n */\n setColorTokens(colors: ColorTokens | undefined): void {\n this.colorTokens = colors\n }\n\n /**\n * Get current color tokens\n * @returns Current ColorTokens or undefined\n */\n getColorTokens(): ColorTokens | undefined {\n return this.colorTokens\n }\n\n /**\n * Get current color mode\n * @returns Current color mode\n */\n getColorMode(): 'light' | 'dark' {\n return this.colorMode\n }\n\n /**\n * Set color mode and trigger complete remount\n * Updates color tokens if a preset is active\n * Triggers complete remount of all active mountJSX instances\n * @param mode - Color mode to set\n */\n setColorMode(mode: 'light' | 'dark'): void {\n if (this.colorMode !== mode) {\n this.colorMode = mode\n\n // If a preset is active, reload color tokens with the new mode\n if (this.currentPresetName) {\n // Import and update color tokens immediately\n import('./colors/color-presets').then(({ getPresetWithMode }) => {\n const preset = getPresetWithMode(\n this.currentPresetName as 'oceanBlue' | 'forestGreen' | 'midnight',\n mode\n )\n this.colorTokens = preset.colors\n })\n }\n\n // Skip notifyListeners() - we're doing a complete remount instead\n // This prevents unnecessary re-renders and flickering\n\n // Trigger complete remount of all VDOM trees to apply new theme\n // Using setTimeout(0) to ensure all synchronous state updates complete first\n setTimeout(() => {\n // Import remountAll lazily to avoid circular dependency\n import('./vdom').then(({ remountAll }) => {\n remountAll()\n })\n }, 0)\n }\n }\n\n /**\n * Get current preset name\n * @returns Current preset name or undefined\n */\n getCurrentPresetName(): string | undefined {\n return this.currentPresetName\n }\n\n /**\n * Set current preset name\n * @param name - Preset name\n * @param skipNotify - If true, skip notifying listeners (used during remount)\n */\n setCurrentPresetName(name: string | undefined, skipNotify = false): void {\n if (this.currentPresetName !== name) {\n this.currentPresetName = name\n if (!skipNotify) {\n this.notifyListeners()\n }\n }\n }\n\n /**\n * Subscribe to theme changes\n * @param listener - Callback to invoke on theme change\n * @returns Unsubscribe function\n */\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener)\n return () => {\n this.listeners.delete(listener)\n }\n }\n\n /**\n * Notify all listeners of theme change\n */\n private notifyListeners(): void {\n this.listeners.forEach((listener) => listener())\n }\n}\n\n/**\n * Global theme registry instance\n */\nexport const themeRegistry = new ThemeRegistry()\n\n/**\n * Deep merge two theme objects\n * @param base - Base theme\n * @param override - Override theme\n * @returns Merged theme\n */\nexport function mergeThemes(base: PartialTheme, override: PartialTheme): PartialTheme {\n const result: PartialTheme = { ...base }\n\n for (const [component, styles] of Object.entries(override)) {\n if (component in result) {\n result[component as keyof ComponentThemes] = {\n ...result[component as keyof ComponentThemes],\n ...styles,\n } as never\n } else {\n result[component as keyof ComponentThemes] = styles as never\n }\n }\n\n return result\n}\n\n/**\n * Helper to create a partial theme with type safety\n * Optionally accepts a color preset to automatically populate color tokens\n * @param theme - Partial theme definition\n * @param colorPreset - Optional color preset to apply\n * @returns The same theme (for type checking)\n * @example\n * ```typescript\n * import { getPreset } from './colors'\n *\n * const preset = getPreset('oceanBlue')\n * const theme = createTheme({\n * Button: {\n * backgroundColor: preset.colors.primary.DEFAULT\n * }\n * }, preset)\n * ```\n */\nexport function createTheme(\n theme: PartialTheme,\n colorPreset?: { name: string; colors: ColorTokens; mode?: 'light' | 'dark' }\n): PartialTheme {\n if (colorPreset) {\n // Store color tokens in registry for useColors hook\n themeRegistry.setColorTokens(colorPreset.colors)\n\n // Add preset metadata to theme\n return {\n ...theme,\n __colorPreset: {\n name: colorPreset.name,\n mode: colorPreset.mode ?? 'light',\n },\n }\n }\n\n return theme\n}\n\n/**\n * Get themed props for a component, merging global theme, local theme override, and explicit props\n * Explicit props take highest priority, then local theme, then global theme\n * Also extracts nested component themes to pass down to children\n * @param componentName - Component name\n * @param localTheme - Local theme override (from theme prop in VDOM tree)\n * @param explicitProps - Explicit props passed to component\n * @returns Object with merged props and nested themes for child components\n */\nfunction deepMergeDefined<T extends object>(base: T, override: Partial<T>): T {\n const result = { ...base }\n for (const key in override) {\n const value = override[key]\n if (value !== undefined) {\n if (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n typeof base[key] === 'object' &&\n base[key] !== null\n ) {\n // Deep merge for nested objects (e.g. style)\n ;(result as unknown as Record<string, unknown>)[key] = deepMergeDefined(\n base[key] as object,\n value as object\n )\n } else {\n ;(result as unknown as Record<string, unknown>)[key] = value\n }\n }\n }\n return result as T\n}\n\n/**\n * Helper to extract nested component themes from a theme object\n * Separates own props from nested component themes\n * Detects nested themes by checking if the property value is an object\n * and the key starts with uppercase (convention for component names)\n * @param theme - Theme object that might contain nested themes\n * @returns Object with ownProps and nestedThemes\n */\nfunction extractNestedThemes<T extends object>(\n theme: T\n): { ownProps: T; nestedThemes: PartialTheme } {\n const ownProps = { ...theme }\n const nestedThemes: PartialTheme = {}\n\n // Get all registered component names (built-in + custom)\n const allComponentNames = new Set([\n 'View',\n 'Text',\n 'NineSlice',\n ...Array.from(themeRegistry.getCustomComponentNames()),\n ])\n\n for (const key in ownProps) {\n // Check if this key is a component name (starts with uppercase or is in our registry)\n if (allComponentNames.has(key)) {\n nestedThemes[key as keyof ComponentThemes] = (ownProps as never)[key]\n delete (ownProps as never)[key]\n }\n }\n\n return { ownProps, nestedThemes }\n}\n\nexport function getThemedProps<\n K extends keyof ComponentThemes,\n P extends Partial<ComponentThemes[K]>,\n>(\n componentName: K,\n localTheme: PartialTheme | undefined,\n explicitProps: P\n): { props: ComponentThemes[K] & P; nestedTheme: PartialTheme } {\n // Start with global theme for this component\n const globalComponentTheme = themeRegistry.getComponentTheme(componentName)\n\n // Extract nested themes from global theme\n const { ownProps: globalOwnProps, nestedThemes: globalNestedThemes } =\n extractNestedThemes(globalComponentTheme)\n\n // Apply local theme override if provided\n // IMPORTANT: localTheme can be either:\n // 1. Parent's nested theme (propagated down)\n // 2. Component's own theme (from theme prop via __theme)\n // We need to check if localTheme contains this component's theme OR nested themes\n const localComponentTheme = localTheme?.[componentName] ?? {}\n\n const { ownProps: localOwnProps, nestedThemes: localNestedThemes } =\n extractNestedThemes(localComponentTheme)\n\n // Also extract nested themes directly from localTheme (for theme prop case)\n const { nestedThemes: localThemeNested } = extractNestedThemes(localTheme ?? {})\n\n // Extract nested themes from explicit props\n const { ownProps: explicitOwnProps, nestedThemes: explicitNestedThemes } =\n extractNestedThemes(explicitProps)\n\n // Merge: global < local < explicit, but only defined values\n const mergedProps = {\n ...deepMergeDefined(globalOwnProps as object, localOwnProps),\n ...deepMergeDefined({}, explicitOwnProps),\n } as ComponentThemes[K] & P\n\n // Merge nested themes: global < localComponent < localTheme < explicit\n const mergedNestedThemes = mergeThemes(\n mergeThemes(mergeThemes(globalNestedThemes, localNestedThemes), localThemeNested),\n explicitNestedThemes\n )\n\n DebugLogger.log(\n 'theme',\n `getThemedProps(${String(componentName)}): FINAL mergedProps:`,\n mergedProps\n )\n\n return {\n props: mergedProps,\n nestedTheme: mergedNestedThemes,\n }\n}\n","/**\n * Tooltip applier for component patching\n * Manages native Phaser text tooltip rendering with animations\n */\nimport Phaser from 'phaser'\nimport type { HoverEventData } from '../../gestures/gesture-types'\nimport { themeRegistry } from '../../theme'\nimport type { TooltipCallback, TooltipConfig } from '../../tooltip/tooltip-types'\n\n/**\n * Internal state for tooltip management per container\n */\ninterface TooltipState {\n isVisible: boolean\n tooltip: Phaser.GameObjects.Container | null\n activeTweens: Phaser.Tweens.Tween[]\n showTimer: NodeJS.Timeout | null\n hideTimer: NodeJS.Timeout | null\n autoDismissTimer: NodeJS.Timeout | null\n currentConfig: TooltipConfig | null\n}\n\n// Map to store tooltip state for each container\nconst tooltipStates = new Map<Phaser.GameObjects.Container, TooltipState>()\n\n/**\n * Calculate tooltip position based on target bounds and preferred position\n * Auto-adjusts if tooltip would go out of viewport bounds\n */\nfunction calculateTooltipPosition(\n targetBounds: Phaser.Geom.Rectangle,\n position: 'top' | 'bottom' | 'left' | 'right',\n offset: number,\n tooltipWidth: number,\n tooltipHeight: number\n): { x: number; y: number } {\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n let x = 0\n let y = 0\n\n switch (position) {\n case 'top':\n x = targetBounds.centerX - tooltipWidth / 2\n y = targetBounds.top - tooltipHeight - offset\n break\n case 'bottom':\n x = targetBounds.centerX - tooltipWidth / 2\n y = targetBounds.bottom + offset\n break\n case 'left':\n x = targetBounds.left - tooltipWidth - offset\n y = targetBounds.centerY - tooltipHeight / 2\n break\n case 'right':\n x = targetBounds.right + offset\n y = targetBounds.centerY - tooltipHeight / 2\n break\n }\n\n // Clamp to viewport bounds (with small padding)\n x = Math.max(8, Math.min(x, viewport.width - tooltipWidth - 8))\n y = Math.max(8, Math.min(y, viewport.height - tooltipHeight - 8))\n\n return { x, y }\n}\n\n/**\n * Show native Phaser text tooltip with animations\n */\nfunction showTooltip(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n config: TooltipConfig\n): void {\n const state = tooltipStates.get(container)\n if (!state || state.isVisible) return\n\n state.isVisible = true\n state.currentConfig = config\n\n const theme = themeRegistry.getGlobalTheme()\n const tooltipTheme = theme.Tooltip || {}\n\n const position = config.position ?? tooltipTheme.position ?? 'top'\n const offset = config.offset ?? tooltipTheme.offset ?? 8\n\n const content = config.content\n\n // Get target bounds\n const targetBounds = container.getBounds()\n\n // Create text without background first to measure\n const textStyle: Phaser.Types.GameObjects.Text.TextStyle = tooltipTheme.textStyle ?? {\n fontSize: '14px',\n fontFamily: 'Arial',\n color: '#ffffff',\n padding: { x: 8, y: 4 },\n }\n\n // Remove backgroundColor from textStyle, we'll draw it manually\n const { backgroundColor: bgColor, ...styleWithoutBg } = textStyle\n\n const text = scene.add.text(0, 0, content, styleWithoutBg)\n text.setOrigin(0.5)\n\n // Measure text with padding\n const padding = textStyle.padding ?? { x: 8, y: 4 }\n const paddingX = typeof padding === 'number' ? padding : (padding.x ?? 8)\n const paddingY = typeof padding === 'number' ? padding : (padding.y ?? 4)\n const textWidth = text.width\n const textHeight = text.height\n const bgWidth = textWidth + paddingX * 2\n const bgHeight = textHeight + paddingY * 2\n\n // Create rounded background\n const cornerRadius = tooltipTheme.cornerRadius ?? 6\n const graphics = scene.add.graphics()\n\n // Parse background color\n const bg = bgColor ?? '#000000dd'\n let fillColor = 0x000000\n let fillAlpha = 0.87\n\n if (typeof bg === 'string') {\n if (bg.startsWith('#')) {\n // Handle hex with optional alpha\n const hex = bg.slice(1)\n if (hex.length === 8) {\n fillColor = parseInt(hex.slice(0, 6), 16)\n fillAlpha = parseInt(hex.slice(6, 8), 16) / 255\n } else if (hex.length === 6) {\n fillColor = parseInt(hex, 16)\n fillAlpha = 1\n }\n }\n }\n\n graphics.fillStyle(fillColor, fillAlpha)\n graphics.fillRoundedRect(-bgWidth / 2, -bgHeight / 2, bgWidth, bgHeight, cornerRadius)\n\n // Create container for background + text\n const tooltipContainer = scene.add.container(0, 0, [graphics, text])\n tooltipContainer.setDepth(10000)\n\n // Measure container bounds\n const textBounds = tooltipContainer.getBounds()\n\n // Calculate position\n const pos = calculateTooltipPosition(\n targetBounds,\n position,\n offset,\n textBounds.width,\n textBounds.height\n )\n\n // Animation config - merge config with theme defaults\n const themeAnim = tooltipTheme.animation || {}\n const anim = config.animation || {}\n const fadeInDuration = anim.fadeIn ?? themeAnim.fadeIn ?? 200\n const moveOffset = {\n dx: anim.move?.dx ?? themeAnim.move?.dx ?? 0,\n dy: anim.move?.dy ?? themeAnim.move?.dy ?? 0,\n }\n const pulse = anim.pulse ?? themeAnim.pulse ?? false\n const pulseScale = anim.pulseScale ?? [0.75, 1.25]\n\n // Set initial position (with move offset if enabled)\n tooltipContainer.setPosition(\n pos.x + textBounds.width / 2 - moveOffset.dx,\n pos.y + textBounds.height / 2 - moveOffset.dy\n )\n tooltipContainer.setAlpha(0)\n\n state.tooltip = tooltipContainer\n\n // Fade in animation\n const fadeTween = scene.tweens.add({\n targets: tooltipContainer,\n alpha: 1,\n x: pos.x + textBounds.width / 2,\n y: pos.y + textBounds.height / 2,\n duration: fadeInDuration,\n ease: 'Cubic.Out',\n })\n state.activeTweens.push(fadeTween)\n\n // Pulse animation\n if (pulse) {\n const pulseTween = scene.tweens.add({\n targets: tooltipContainer,\n scale: { from: pulseScale[0], to: pulseScale[1] },\n duration: 600,\n yoyo: true,\n repeat: -1,\n ease: 'Sine.InOut',\n })\n state.activeTweens.push(pulseTween)\n }\n\n // Auto-dismiss timer if configured\n if (config.autoDismiss && config.autoDismiss > 0) {\n state.autoDismissTimer = setTimeout(() => {\n hideTooltip(container)\n }, config.autoDismiss)\n }\n}\n\n/**\n * Hide tooltip for a container\n */\nfunction hideTooltip(container: Phaser.GameObjects.Container): void {\n const state = tooltipStates.get(container)\n if (!state || !state.isVisible) return\n\n state.isVisible = false\n const config = state.currentConfig\n state.currentConfig = null\n\n // Clear auto-dismiss timer\n if (state.autoDismissTimer) {\n clearTimeout(state.autoDismissTimer)\n state.autoDismissTimer = null\n }\n\n if (!state.tooltip) return\n\n const tooltip = state.tooltip\n const scene = tooltip.scene\n\n // Get theme defaults for fade out\n const theme = themeRegistry.getGlobalTheme()\n const tooltipTheme = theme.Tooltip || {}\n const themeAnim = tooltipTheme.animation || {}\n const anim = config?.animation || {}\n const fadeOutDuration = anim.fadeOut ?? themeAnim.fadeOut ?? 200\n\n // Stop all existing tweens\n state.activeTweens.forEach((tween) => tween.stop())\n state.activeTweens = []\n\n // Fade out animation\n scene.tweens.add({\n targets: tooltip,\n alpha: 0,\n duration: fadeOutDuration,\n ease: 'Cubic.In',\n onComplete: () => {\n tooltip.destroy()\n },\n })\n\n state.tooltip = null\n}\n\n/**\n * Apply tooltip functionality to a container\n * Sets up hover handlers and manages tooltip lifecycle\n */\nexport function applyTooltip(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n nextCallback: TooltipCallback | undefined,\n existingOnHoverStart?: (data: HoverEventData) => void,\n existingOnHoverEnd?: (data: HoverEventData) => void\n): {\n onHoverStart: (data: HoverEventData) => void\n onHoverEnd: (data: HoverEventData) => void\n} {\n // Initialize state if needed\n if (!tooltipStates.has(container)) {\n tooltipStates.set(container, {\n isVisible: false,\n tooltip: null,\n activeTweens: [],\n showTimer: null,\n hideTimer: null,\n autoDismissTimer: null,\n currentConfig: null,\n })\n\n // Cleanup on container destroy\n container.once('destroy', () => {\n const state = tooltipStates.get(container)\n if (state) {\n if (state.showTimer) clearTimeout(state.showTimer)\n if (state.hideTimer) clearTimeout(state.hideTimer)\n if (state.autoDismissTimer) clearTimeout(state.autoDismissTimer)\n state.activeTweens.forEach((tween) => tween.stop())\n hideTooltip(container)\n tooltipStates.delete(container)\n }\n })\n }\n\n const state = tooltipStates.get(container)\n if (!state) {\n throw new Error('applyTooltip: state not initialized')\n }\n\n const theme = themeRegistry.getGlobalTheme()\n const tooltipTheme = theme.Tooltip || {}\n\n // Create hover handlers\n const onHoverStart = (data: HoverEventData) => {\n // Call existing handler if present\n if (existingOnHoverStart) existingOnHoverStart(data)\n\n // Get tooltip config\n if (!nextCallback) return\n\n const result = nextCallback()\n if (!result) return // null/undefined = no tooltip\n\n const config: TooltipConfig = typeof result === 'string' ? { content: result } : result\n\n if (config.disabled) return\n\n // Clear any pending hide/auto-dismiss timers\n if (state.hideTimer) {\n clearTimeout(state.hideTimer)\n state.hideTimer = null\n }\n if (state.autoDismissTimer) {\n clearTimeout(state.autoDismissTimer)\n state.autoDismissTimer = null\n }\n\n // Start show timer\n const showDelay = config.showDelay ?? tooltipTheme.showDelay ?? 500\n state.showTimer = setTimeout(() => {\n showTooltip(scene, container, config)\n }, showDelay)\n }\n\n const onHoverEnd = (data: HoverEventData) => {\n // Call existing handler if present\n if (existingOnHoverEnd) existingOnHoverEnd(data)\n\n // Clear any pending show timer\n if (state.showTimer) {\n clearTimeout(state.showTimer)\n state.showTimer = null\n }\n\n // Start hide timer\n const hideDelay = state.currentConfig?.hideDelay ?? tooltipTheme.hideDelay ?? 0\n if (hideDelay > 0) {\n state.hideTimer = setTimeout(() => {\n hideTooltip(container)\n }, hideDelay)\n } else {\n hideTooltip(container)\n }\n }\n\n return { onHoverStart, onHoverEnd }\n}\n","/**\n * Shared property creators for component initialization\n * These functions avoid code duplication when creating nodes with initial properties\n */\nimport type Phaser from 'phaser'\nimport type { BackgroundProps } from '../../core-props'\n\n/**\n * Create background graphics for container-based components\n * @param scene - Phaser scene\n * @param container - Container to add background to\n * @param props - Props with background settings\n */\nexport function createBackground(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container & { __background?: Phaser.GameObjects.Graphics },\n props: Partial<\n BackgroundProps & { width?: number | string | undefined; height?: number | string | undefined }\n >\n): void {\n const hasBackground = props.backgroundColor !== undefined\n const hasBorder = props.borderColor !== undefined\n\n // Create graphics if either background or border is specified\n if (hasBackground || hasBorder) {\n const width = typeof props.width === 'number' ? props.width : 100\n const height = typeof props.height === 'number' ? props.height : 100\n const bgColor = props.backgroundColor as number | undefined\n const bgAlpha = props.backgroundAlpha ?? 1\n const cornerRadius = props.cornerRadius ?? 0\n const borderColor = props.borderColor\n const borderWidth = props.borderWidth ?? 0\n const borderAlpha = props.borderAlpha ?? 1\n\n const background = scene.add.graphics()\n\n // Fill style (only if background color is specified)\n if (bgColor !== undefined) {\n background.fillStyle(bgColor, bgAlpha)\n }\n\n // Border style (if specified)\n if (borderWidth > 0 && borderColor !== undefined) {\n background.lineStyle(borderWidth, borderColor, borderAlpha)\n }\n\n // Draw shape\n if (cornerRadius !== 0) {\n if (bgColor !== undefined) {\n background.fillRoundedRect(0, 0, width, height, cornerRadius)\n }\n if (borderWidth > 0 && borderColor !== undefined) {\n background.strokeRoundedRect(0, 0, width, height, cornerRadius)\n }\n } else {\n if (bgColor !== undefined) {\n background.fillRect(0, 0, width, height)\n }\n if (borderWidth > 0 && borderColor !== undefined) {\n background.strokeRect(0, 0, width, height)\n }\n }\n\n container.addAt(background, 0)\n container.__background = background\n // Mark as background so layout system can skip it\n ;(background as Phaser.GameObjects.Graphics & { __isBackground?: boolean }).__isBackground =\n true\n }\n}\n","/**\n * Gesture setup for component initialization\n * Registers containers with the GestureManager for high-level gesture detection\n */\nimport type { LayoutSize } from '@number10/phaserjsx/layout/types'\nimport Phaser from 'phaser'\nimport type { GestureProps, LayoutProps } from '../../core-props'\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport type { GestureCallbacks } from '../../gestures/gesture-types'\n\n/**\n * Setup gesture tracking for container-based components\n * Only registers if enableGestures is true and at least one gesture callback exists\n * @param scene - Scene containing the gesture manager\n * @param container - Container to make gesture-aware\n * @param props - Props with gesture settings\n */\nexport function createGestures(\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n props: Partial<GestureProps & LayoutProps>\n): void {\n // Check if any gesture callback is defined\n const hasAnyGesture = !!(\n props.onTouch ||\n props.onTouchOutside ||\n props.onTouchMove ||\n props.onDoubleTap ||\n props.onLongPress ||\n props.onHoverStart ||\n props.onHoverEnd ||\n props.onWheel\n )\n\n // Auto-enable gestures if callbacks are provided, unless explicitly disabled\n const shouldEnable = hasAnyGesture && props.enableGestures !== false\n\n if (!shouldEnable) {\n return\n }\n\n // Get scene's gesture manager\n const manager = getGestureManager(scene)\n\n // Get actual calculated container size from layout system\n // Use __getLayoutSize if available (set by createLayout), otherwise fallback to getBounds\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n let width = 100\n let height = 100\n\n if (containerWithLayout.__getLayoutSize) {\n const size = containerWithLayout.__getLayoutSize()\n width = size.width\n height = size.height\n } else {\n // Fallback to getBounds if __getLayoutSize not available yet\n const bounds = container.getBounds()\n width = bounds.width || 100\n height = bounds.height || 100\n }\n\n // Create hit area with origin at (0,0) - matches our component system\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n // Build callbacks object\n const callbacks: GestureCallbacks = {}\n if (props.onTouch) callbacks.onTouch = props.onTouch\n if (props.onTouchOutside) callbacks.onTouchOutside = props.onTouchOutside\n if (props.onTouchMove) callbacks.onTouchMove = props.onTouchMove\n if (props.onDoubleTap) callbacks.onDoubleTap = props.onDoubleTap\n if (props.onLongPress) callbacks.onLongPress = props.onLongPress\n if (props.onHoverStart) callbacks.onHoverStart = props.onHoverStart\n if (props.onHoverEnd) callbacks.onHoverEnd = props.onHoverEnd\n if (props.onWheel) callbacks.onWheel = props.onWheel\n\n // Build config (only include defined values)\n const config: { longPressDuration?: number; doubleTapDelay?: number; maxTouchDuration?: number } =\n {}\n if (props.longPressDuration !== undefined) config.longPressDuration = props.longPressDuration\n if (props.doubleTapDelay !== undefined) config.doubleTapDelay = props.doubleTapDelay\n if (props.maxTouchDuration !== undefined) config.maxTouchDuration = props.maxTouchDuration\n\n // Register with manager\n manager.registerContainer(container, callbacks, hitArea, config)\n}\n","/**\n * Layout creator for initializing container layout system\n */\nimport type { BackgroundProps, LayoutProps, TransformProps } from '../../core-props'\nimport { normalizeGap } from '../../core-props'\nimport {\n getChildSize,\n parseSize,\n resolveSize,\n type GameObjectWithLayout,\n type LayoutSize,\n} from '../../layout/index'\n\n/**\n * Creates layout infrastructure for a container\n * Attaches layout props and dynamic size provider\n * @param container - Phaser container\n * @param props - Layout props\n */\nexport function createLayout(\n container: Phaser.GameObjects.Container & {\n __layoutProps?: LayoutProps & BackgroundProps & TransformProps\n __getLayoutSize?: () => LayoutSize\n width?: number | string\n height?: number | string\n },\n props: Partial<LayoutProps & BackgroundProps & TransformProps>\n): void {\n // Attach layout props for layout calculations (includes visible for display control)\n container.__layoutProps = props as LayoutProps & BackgroundProps & TransformProps\n\n // Attach dynamic size provider\n // This returns the calculated dimensions after layout\n container.__getLayoutSize = () => {\n const children = container.list as GameObjectWithLayout[]\n\n const direction = props.direction ?? 'column'\n const paddingRaw = props.padding ?? {}\n const padding =\n typeof paddingRaw === 'number'\n ? { left: paddingRaw, top: paddingRaw, right: paddingRaw, bottom: paddingRaw }\n : paddingRaw\n const paddingLeft = padding.left ?? 0\n const paddingTop = padding.top ?? 0\n const paddingRight = padding.right ?? 0\n const paddingBottom = padding.bottom ?? 0\n const gapNormalized = normalizeGap(props.gap)\n\n let maxWidth = 0\n let maxHeight = 0\n let totalMainSize = 0\n\n // Count non-background children\n let childCount = 0\n\n for (const child of children) {\n if (child.__isBackground) {\n continue\n }\n\n childCount++\n\n const marginRaw = child.__layoutProps?.margin ?? {}\n const margin =\n typeof marginRaw === 'number'\n ? { top: marginRaw, right: marginRaw, bottom: marginRaw, left: marginRaw }\n : marginRaw\n const marginTop = margin.top ?? 0\n const marginBottom = margin.bottom ?? 0\n const marginLeft = margin.left ?? 0\n const marginRight = margin.right ?? 0\n\n const childSize = getChildSize(child)\n\n if (direction === 'row') {\n // Horizontal layout\n totalMainSize += marginLeft + childSize.width + marginRight\n const childTotalHeight = marginTop + childSize.height + marginBottom\n maxHeight = Math.max(maxHeight, childTotalHeight)\n } else {\n // Vertical layout (column)\n const childTotalWidth = marginLeft + childSize.width + marginRight\n maxWidth = Math.max(maxWidth, childTotalWidth)\n totalMainSize += marginTop + childSize.height + marginBottom\n }\n }\n\n // Add gaps to total main size\n if (childCount > 1) {\n const gapValue = direction === 'row' ? gapNormalized.horizontal : gapNormalized.vertical\n totalMainSize += gapValue * (childCount - 1)\n }\n\n const defaultWidth =\n direction === 'row'\n ? totalMainSize + paddingLeft + paddingRight\n : maxWidth + paddingLeft + paddingRight\n const defaultHeight =\n direction === 'row'\n ? maxHeight + paddingTop + paddingBottom\n : totalMainSize + paddingTop + paddingBottom\n\n // Resolve width (handle percentage and auto)\n const parsedWidth = parseSize(props.width)\n const finalWidth = resolveSize(parsedWidth, undefined, defaultWidth)\n\n // Resolve height (handle percentage and auto)\n const parsedHeight = parseSize(props.height)\n const finalHeight = resolveSize(parsedHeight, undefined, defaultHeight)\n\n return {\n width: finalWidth,\n height: finalHeight,\n }\n }\n}\n","/**\n * View component - Phaser Container with background Graphics and layout system\n * Status: IMPLEMENTED ✅\n *\n * Design Overview:\n * ================\n *\n * 1. Component Role: LAYOUT CONTAINER\n * Purpose: Primary layout primitive for UI composition\n * Composition: Phaser.Container + Background Graphics (optional)\n * Responsibilities:\n * - Layout orchestration (flexbox-style positioning of children)\n * - Visual styling (background color, borders, corner radius)\n * - Gesture handling (touch/mouse interaction)\n * - Dimension management (defines its own size + provides context for children)\n *\n * 2. Headless Behavior: NEVER HEADLESS ⚠️\n * Decision: View cannot be headless (always participates in layout)\n * Reasoning:\n * - View IS the layout system - it defines layout context for children\n * - Background Graphics has special role (__isBackground flag)\n * - Graphics is internal to View, excluded from child layout calculations\n * - If you need non-layout container, use raw Phaser.Container directly\n *\n * 3. Layout System Architecture:\n * Two-part system:\n * A) Background Graphics (special role):\n * - Defines View dimensions (not a layout child!)\n * - Marked with __isBackground = true\n * - Filtered out in layout calculations (see isLayoutChild helper)\n * - Automatically resized to match container dimensions\n * B) Layout Engine:\n * - Processes children (Views, Text, Images, etc.)\n * - Applies flexbox-style layout (row/column/stack)\n * - Respects headless flag on children\n * - Updates child positions/sizes based on layout props\n *\n * 4. Background Graphics vs. Graphics Component:\n * Distinction:\n * - View Background: Internal, auto-managed, defines dimensions, __isBackground=true\n * - Graphics Component: User-facing, custom shapes, typically headless=true\n * - Both use Phaser.Graphics but completely different purposes\n *\n * 5. Layout Size Provider:\n * Implementation: __getLayoutSize returns explicit or calculated dimensions\n * Behavior:\n * - Explicit width/height: Use those values\n * - Auto-size (undefined): Calculate from children + padding\n * - Percentage/fill: Resolve from parent context\n * - Critical: Background Graphics updates to match final size\n *\n * 6. Gesture System Integration:\n * Features:\n * - enableGestures: true enables touch/mouse interaction\n * - Hit area automatically sized to container dimensions\n * - Updated after layout recalculation (deferred queue)\n * - Supports: onTouch, onTouchMove, onDoubleTap, onLongPress\n * - Cross-platform (transparent mouse/touch support)\n *\n * 7. Styling Props:\n * Background:\n * - backgroundColor/backgroundAlpha: Fill color\n * - cornerRadius: Rounded corners (number or per-corner object)\n * - borderColor/borderWidth/borderAlpha: Stroke\n * Auto-defaults:\n * - backgroundAlpha defaults to 1 if backgroundColor set\n * - borderWidth defaults to 1 if borderColor set\n *\n * 8. Common Patterns:\n * Layout Container:\n * <View direction=\"row\" gap={10} padding={20}>\n * <View flex={1}>Left</View>\n * <View flex={2}>Right</View>\n * </View>\n * Styled Box:\n * <View backgroundColor={0x3498db} cornerRadius={8} padding={16}>\n * <Text text=\"Card Content\" />\n * </View>\n * Interactive Area:\n * <View enableGestures={true} onTouch={() => console.log('clicked')}>\n * <Text text=\"Button\" />\n * </View>\n *\n * 9. Performance Considerations:\n * - Background Graphics redrawn only when visual props change\n * - Layout calculations batched (LayoutBatchQueue)\n * - Gesture hit areas updated in deferred queue (post-layout)\n * - Overflow masking (overflow=\"hidden\") adds Phaser mask overhead\n *\n * 10. Known Limitations:\n * - Background Graphics cannot be independently positioned/rotated\n * - Nested View layout recalculations can be expensive (use sparingly)\n * - Gesture system requires scene pointer plugin (auto-enabled)\n *\n * Implementation Status:\n * ======================\n * [✅] Phaser Container creation\n * [✅] Background Graphics with styling (color, border, radius)\n * [✅] Layout system integration (__layoutProps, __getLayoutSize)\n * [✅] Transform props (position, rotation, scale, alpha)\n * [✅] Gesture system (enableGestures, interaction callbacks)\n * [✅] Auto-defaults for background/border alpha\n * [✅] Overflow masking support\n * [✅] Theme system integration\n * [✅] Deferred layout queue for gesture updates\n */\nimport Phaser from 'phaser'\nimport type {\n BackgroundProps,\n GestureProps,\n LayoutProps,\n PhaserProps,\n TransformProps,\n} from '../../core-props'\nimport { DebugLogger } from '../../dev-config'\nimport type { HostCreator, HostPatcher } from '../../host'\nimport type { PropsContainerExtension, PropsDefaultExtension } from '../../types'\nimport { applyBackgroundProps } from '../appliers/applyBackground'\nimport { applyGesturesProps } from '../appliers/applyGestures'\nimport { applyLayoutProps } from '../appliers/applyLayout'\nimport { applyPhaserProps } from '../appliers/applyPhaser'\nimport { applyTooltip } from '../appliers/applyTooltip'\nimport { applyTransformProps } from '../appliers/applyTransform'\nimport { createBackground } from '../creators/createBackground'\nimport { createGestures } from '../creators/createGestures'\nimport { createLayout } from '../creators/createLayout'\nimport { createPhaser } from '../creators/createPhaser'\nimport { createTransform } from '../creators/createTransform'\n\n/**\n * Normalize background props - apply auto-defaults for alpha and border width\n * @param props - Original props\n * @returns Normalized props with auto-defaults applied\n */\nfunction normalizeBackgroundProps<T>(props: T): T {\n // Only process if props contain background/border properties\n const bgProps = props as unknown as Partial<BackgroundProps>\n const hasBackground = bgProps.backgroundColor !== undefined\n const hasBorder = bgProps.borderColor !== undefined\n\n // If no background/border props, return as-is\n if (!hasBackground && !hasBorder) {\n return props\n }\n\n // Only apply defaults if the prop is explicitly undefined or 0 (theme default)\n // This allows users to override with explicit values\n const normalized = { ...props } as T & Partial<BackgroundProps>\n\n if (hasBackground && (bgProps.backgroundAlpha === undefined || bgProps.backgroundAlpha === 0)) {\n normalized.backgroundAlpha = 1\n }\n\n if (hasBorder) {\n if (bgProps.borderWidth === undefined || bgProps.borderWidth === 0) {\n normalized.borderWidth = 1\n }\n if (bgProps.borderAlpha === undefined || bgProps.borderAlpha === 0) {\n normalized.borderAlpha = 1\n }\n }\n\n return normalized as T\n}\n\n/**\n * Base props for View - composing shared prop groups\n */\nexport interface ViewBaseProps\n extends TransformProps,\n PhaserProps,\n LayoutProps,\n BackgroundProps,\n GestureProps {}\n\n/**\n * Props for View (Container) component - extends base props with JSX-specific props\n */\nexport interface ViewProps\n extends ViewBaseProps,\n PropsDefaultExtension<Phaser.GameObjects.Container>,\n PropsContainerExtension {}\n\n/**\n * View creator - creates a Phaser Container with optional background and interaction\n */\nexport const viewCreator: HostCreator<'View'> = (scene, props) => {\n // Debug: Log props to verify theme values\n if (props.backgroundColor !== undefined || props.cornerRadius !== undefined) {\n DebugLogger.log('theme', 'View Creator - Props received:', {\n backgroundColor: props.backgroundColor,\n cornerRadius: props.cornerRadius,\n width: props.width,\n height: props.height,\n })\n }\n\n // Normalize props early - apply auto-defaults for background/border\n const normalizedProps = normalizeBackgroundProps(props)\n\n const container = scene.add.container(normalizedProps.x ?? 0, normalizedProps.y ?? 0)\n\n // Apply transform props (scale, rotation)\n createTransform(container, normalizedProps)\n\n // Apply Phaser display props (alpha, depth, visible)\n createPhaser(container, normalizedProps)\n\n // Add background if backgroundColor is provided\n createBackground(\n scene,\n container as typeof container & { __background?: Phaser.GameObjects.Graphics },\n normalizedProps\n )\n\n // Setup layout system (props and size provider)\n // Must be before createGestures so __getLayoutSize is available\n createLayout(container, normalizedProps)\n\n // Tooltip support - inject hover handlers if onTooltip is present\n if (normalizedProps.onTooltip) {\n const handlers = applyTooltip(\n scene,\n container,\n normalizedProps.onTooltip,\n normalizedProps.onHoverStart,\n normalizedProps.onHoverEnd\n )\n normalizedProps.onHoverStart = handlers.onHoverStart\n normalizedProps.onHoverEnd = handlers.onHoverEnd\n }\n\n // Setup gesture system (high-level touch/mouse gestures)\n createGestures(scene, container, normalizedProps)\n\n // Debug: Log layout props storage\n DebugLogger.log(\n 'layout',\n 'View creator storing __layoutProps with padding:',\n normalizedProps.padding\n )\n\n return container\n}\n\n/**\n * View patcher - updates View properties\n */\nexport const viewPatcher: HostPatcher<'View'> = (node, prev, next) => {\n // Normalize props early - apply auto-defaults for background/border\n const normalizedPrev = normalizeBackgroundProps(prev)\n const normalizedNext = normalizeBackgroundProps(next)\n\n // Apply transform props (position, rotation, scale)\n applyTransformProps(node, normalizedPrev, normalizedNext)\n\n // Apply Phaser display props (alpha, depth, visible)\n applyPhaserProps(node, normalizedPrev, normalizedNext)\n\n // Background updates\n const container = node as Phaser.GameObjects.Container & {\n __background?: Phaser.GameObjects.Graphics\n }\n\n applyBackgroundProps(container, normalizedPrev, normalizedNext)\n\n // Tooltip support (integrates with gesture system)\n // Apply before gestures so hover handlers can be injected\n if (container.scene && container.scene.data) {\n if (normalizedNext.onTooltip) {\n const handlers = applyTooltip(\n container.scene,\n container,\n normalizedNext.onTooltip,\n normalizedNext.onHoverStart,\n normalizedNext.onHoverEnd\n )\n // Inject hover handlers for tooltip\n normalizedNext.onHoverStart = handlers.onHoverStart\n normalizedNext.onHoverEnd = handlers.onHoverEnd\n }\n }\n\n // Gesture event handlers (high-level touch/mouse gestures)\n // Safety check: ensure container has valid scene before applying gestures\n if (container.scene && container.scene.data) {\n applyGesturesProps(container.scene, container, normalizedPrev, normalizedNext)\n }\n\n // Apply layout props and recalculate if needed\n applyLayoutProps(container, normalizedPrev, normalizedNext)\n}\n","/**\n * Render context - isolates global state per mount point\n * Stored in scene.data to ensure proper isolation between multiple mounts\n */\nimport Phaser from 'phaser'\nimport { DebugLogger } from './dev-config'\nimport type { Ctx } from './hooks'\nimport type { ParentType } from './types'\n\n/**\n * Layout batch entry for deferred recalculation\n */\ninterface LayoutBatchEntry {\n container: Phaser.GameObjects.Container\n containerProps: unknown\n parentSize: { width: number; height: number } | undefined\n parentPadding: { horizontal: number; vertical: number } | undefined\n}\n\n/**\n * Render context - encapsulates all previously global state\n * Each mount point gets its own isolated context\n */\nexport class RenderContext {\n // Hook context stack (replaces global CURRENT)\n private currentCtx: Ctx | null = null\n\n // Texture management per mount\n private textureScene: Phaser.Scene | null = null\n private textures = new Map<\n string,\n { refCount: number; promise: Promise<void> | null; loaded: boolean }\n >()\n\n // Viewport dimensions per mount\n private viewport: { width: number; height: number } = { width: 800, height: 600 }\n private viewportParent: ParentType | undefined\n\n // Deferred layout callbacks per mount\n private deferredCallbacks: (() => void)[] = []\n private deferredScheduled = false\n\n // Layout batch queue per mount\n private layoutBatchMap = new Map<Phaser.GameObjects.Container, LayoutBatchEntry>()\n private batchScheduled = false\n\n // Track if context is shutting down\n private isShuttingDown = false\n\n constructor(public scene: Phaser.Scene) {\n this.textureScene = scene\n }\n\n /**\n * Check if context is shutting down\n */\n isShutdown(): boolean {\n return this.isShuttingDown\n }\n\n /**\n * Mark context as shutting down\n */\n shutdown(): void {\n this.isShuttingDown = true\n this.deferredCallbacks = []\n this.layoutBatchMap.clear()\n }\n\n /**\n * Get current hook context\n */\n getCurrent(): Ctx | null {\n return this.currentCtx\n }\n\n /**\n * Set current hook context\n */\n setCurrent(ctx: Ctx | null): void {\n this.currentCtx = ctx\n }\n\n /**\n * Get texture scene\n */\n getTextureScene(): Phaser.Scene | null {\n return this.textureScene\n }\n\n /**\n * Get textures map\n */\n getTextures(): Map<string, { refCount: number; promise: Promise<void> | null; loaded: boolean }> {\n return this.textures\n }\n\n /**\n * Set viewport dimensions\n */\n setViewport(width: number, height: number, parent?: ParentType): void {\n this.viewport = { width, height }\n this.viewportParent = parent\n }\n\n /**\n * Get viewport dimensions\n */\n getViewport(): { width: number; height: number } {\n return this.viewport\n }\n\n /**\n * Get viewport parent\n */\n getViewportParent(): ParentType | undefined {\n return this.viewportParent\n }\n\n /**\n * Defer a layout callback to next frame\n */\n deferLayout(callback: () => void): void {\n if (this.isShuttingDown) return\n this.deferredCallbacks.push(callback)\n if (!this.deferredScheduled) {\n this.deferredScheduled = true\n requestAnimationFrame(() => this.flushDeferred())\n }\n }\n\n /**\n * Flush all deferred layout callbacks\n */\n private flushDeferred(): void {\n if (this.isShuttingDown) return\n this.deferredScheduled = false\n const callbacks = [...this.deferredCallbacks]\n this.deferredCallbacks = []\n for (const callback of callbacks) {\n try {\n callback()\n } catch (error) {\n DebugLogger.error('RenderContext', 'Error in deferred callback:', error)\n }\n }\n }\n\n /**\n * Get layout batch map\n */\n getLayoutBatch(): Map<Phaser.GameObjects.Container, LayoutBatchEntry> {\n return this.layoutBatchMap\n }\n\n /**\n * Clear layout batch\n */\n clearLayoutBatch(): void {\n this.layoutBatchMap.clear()\n }\n\n /**\n * Check if batch is scheduled\n */\n isBatchScheduled(): boolean {\n return this.batchScheduled\n }\n\n /**\n * Set batch scheduled flag\n */\n setBatchScheduled(scheduled: boolean): void {\n this.batchScheduled = scheduled\n }\n}\n\n/**\n * Get or create RenderContext for a scene or container\n * Uses scene.data to store contexts, ensuring proper isolation\n * @param parentOrScene - Scene or Container to get context for\n * @returns RenderContext instance\n */\nexport function getRenderContext(\n parentOrScene: Phaser.Scene | Phaser.GameObjects.Container\n): RenderContext {\n const scene = parentOrScene instanceof Phaser.Scene ? parentOrScene : parentOrScene.scene\n\n if (!scene || !scene.data || !scene.sys || !scene.sys.settings.active) {\n throw new Error('getRenderContext: Invalid scene or scene.data is undefined')\n }\n\n // Use unique key per container to support multiple mounts in same scene\n // For scene-level mounts, use a default key\n const containerKey =\n parentOrScene instanceof Phaser.GameObjects.Container\n ? `__renderContext_${parentOrScene.name || (parentOrScene as unknown as { id?: number }).id || 'container'}__`\n : '__renderContext_scene__'\n\n let context = scene.data.get(containerKey) as RenderContext | undefined\n\n if (!context) {\n context = new RenderContext(scene)\n scene.data.set(containerKey, context)\n\n // Cleanup on scene shutdown\n scene.events.once('shutdown', () => {\n if (context) {\n context.shutdown()\n }\n scene.data.remove(containerKey)\n })\n }\n\n return context\n}\n\n/**\n * Get RenderContext from a parent (used internally by hooks)\n * @param parent - Parent scene or container\n * @returns RenderContext instance\n */\nexport function getContextFromParent(parent: ParentType): RenderContext {\n if (!parent) {\n throw new Error('getContextFromParent: Parent is null or undefined')\n }\n return getRenderContext(parent as Phaser.Scene | Phaser.GameObjects.Container)\n}\n","/** @jsxImportSource ../.. */\n/**\n * View component wrapper - strict type-safe wrapper around primitive view\n * This component is the public API for View, with controlled prop interface\n */\nimport type Phaser from 'phaser'\nimport type {\n BackgroundProps,\n GestureProps,\n LayoutProps,\n PhaserProps,\n TransformProps,\n} from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\n\n/**\n * Props for View component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface ViewProps\n extends TransformProps,\n PhaserProps,\n LayoutProps,\n BackgroundProps,\n GestureProps,\n PropsDefaultExtension<Phaser.GameObjects.Container> {\n /** Child components */\n children?: ChildrenType\n}\n\n/**\n * View component\n * Primary layout container with background styling and gesture support\n *\n * @example\n * ```tsx\n * <View direction=\"row\" gap={10} padding={20}>\n * <Text text=\"Hello\" />\n * <Text text=\"World\" />\n * </View>\n *\n * <View backgroundColor={0x3498db} cornerRadius={8}>\n * <Text text=\"Card\" />\n * </View>\n *\n * <View enableGestures={true} onTouch={() => console.log('clicked')}>\n * <Text text=\"Button\" />\n * </View>\n * ```\n */\nexport function View(props: ViewProps) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('View', localTheme, props)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <view {...themed} theme={nestedTheme} />\n}\n","/**\n * SceneWrapper - Internal component that provides scene dimensions\n * Enables percentage-based sizing for mounted components\n * Used automatically by mountJSX unless disableAutoSize is true\n */\n/** @jsxImportSource ../.. */\nimport type { VNode } from '../../hooks'\nimport { View } from '../custom/View'\n\n/**\n * Props for SceneWrapper\n */\nexport interface SceneWrapperProps {\n /** Scene/container width in pixels */\n width: number\n /** Scene/container height in pixels */\n height: number\n /** Child component to render */\n children: VNode\n}\n\n/**\n * Internal wrapper that provides scene dimensions to child components\n * This allows child components to use percentage-based widths/heights\n * @param props - SceneWrapper properties\n * @returns View with absolute dimensions\n */\nexport function SceneWrapper(props: SceneWrapperProps) {\n const { width, height, children } = props\n\n return (\n <View width={width} height={height}>\n {children}\n </View>\n )\n}\n","/**\n * Portal registry - manages portal trees and depth ordering\n */\nimport type Phaser from 'phaser'\nimport type { VNode } from '../hooks'\nimport type { PortalTree } from './portal-types'\n\n/**\n * Global portal registry\n * Manages all portal trees across scenes with depth-based ordering\n */\nclass PortalRegistry {\n private portals: Map<string, PortalTree> = new Map()\n private idCounter = 0\n private portalRoots: Map<Phaser.Scene, Phaser.GameObjects.Container> = new Map()\n private viewportSizes: Map<Phaser.Scene, { width: number; height: number }> = new Map()\n\n /**\n * Generate unique portal ID\n * @returns Unique portal ID\n */\n generateId(): string {\n return `portal-${++this.idCounter}`\n }\n\n /**\n * Get or create portal root container for scene\n * This container sits at very high depth to ensure portals are above regular content\n * @param scene - Phaser scene\n * @returns Portal root container\n */\n private getOrCreatePortalRoot(scene: Phaser.Scene): Phaser.GameObjects.Container {\n let root = this.portalRoots.get(scene)\n if (!root) {\n root = scene.add.container(0, 0)\n root.setDepth(999999) // Very high depth to be above normal content\n\n // Set very high mountRootId so GestureManager prioritizes portals over normal UI\n // This ensures portal events are processed first in event bubbling\n ;(root as unknown as { __mountRootId?: number }).__mountRootId = 999999\n\n this.portalRoots.set(scene, root)\n }\n return root\n }\n\n /**\n * Register a new portal tree\n * @param id - Portal ID\n * @param depth - Z-depth (higher = foreground)\n * @param scene - Phaser scene\n * @param vnode - Root VNode\n * @param mountedNode - Mounted GameObject\n * @returns Portal container\n */\n register(\n id: string,\n depth: number,\n scene: Phaser.Scene,\n vnode: VNode,\n mountedNode: Phaser.GameObjects.GameObject\n ): Phaser.GameObjects.Container {\n // Get portal root container for this scene\n const portalRoot = this.getOrCreatePortalRoot(scene)\n\n // Create container for this portal as child of portal root\n const container = scene.add.container(0, 0)\n container.setDepth(depth)\n portalRoot.add(container)\n\n // Store portal tree\n const portal: PortalTree = {\n id,\n depth,\n container,\n vnode,\n scene,\n mountedNode,\n }\n\n this.portals.set(id, portal)\n\n // Re-sort all portals in scene by depth to maintain input priority\n this.sortPortalsByDepth(scene)\n\n return container\n }\n\n /**\n * Sort portals in scene by depth (highest to lowest)\n * Ensures correct input event order within portal root\n * Phaser processes input from LAST to FIRST child in DisplayList\n * So highest depth should be LAST in the list to receive events first\n * @param scene - Phaser scene\n */\n private sortPortalsByDepth(scene: Phaser.Scene): void {\n const portalRoot = this.portalRoots.get(scene)\n if (!portalRoot) return\n\n const scenePortals = this.getByScene(scene)\n // Sort by depth DESCENDING - highest depth should be last in DisplayList\n scenePortals.sort((a, b) => b.depth - a.depth)\n\n // Remove all from portal root\n portalRoot.removeAll(false)\n\n // Add back in reverse order: lowest depth first, highest depth last\n for (let i = scenePortals.length - 1; i >= 0; i--) {\n const portal = scenePortals[i]\n if (portal) {\n portalRoot.add(portal.container)\n }\n }\n }\n\n /**\n * Unregister and cleanup portal\n * @param id - Portal ID\n */\n unregister(id: string): void {\n const portal = this.portals.get(id)\n if (!portal) return\n\n // Cleanup container and mounted node\n portal.container.destroy()\n\n this.portals.delete(id)\n\n // Cleanup portal root if no more portals in scene\n const scenePortals = this.getByScene(portal.scene)\n if (scenePortals.length === 0) {\n const root = this.portalRoots.get(portal.scene)\n if (root) {\n root.destroy()\n this.portalRoots.delete(portal.scene)\n }\n }\n }\n\n /**\n * Get portal by ID\n * @param id - Portal ID\n * @returns Portal tree or undefined\n */\n get(id: string): PortalTree | undefined {\n return this.portals.get(id)\n }\n\n /**\n * Get all portals sorted by depth (ascending)\n * @returns Sorted portal trees\n */\n getByDepth(): PortalTree[] {\n return Array.from(this.portals.values()).sort((a, b) => a.depth - b.depth)\n }\n\n /**\n * Get all portals for a specific scene\n * @param scene - Phaser scene\n * @returns Portal trees in scene\n */\n getByScene(scene: Phaser.Scene): PortalTree[] {\n return Array.from(this.portals.values()).filter((p) => p.scene === scene)\n }\n\n /**\n * Clear all portals\n */\n clear(): void {\n for (const portal of this.portals.values()) {\n portal.container.destroy()\n }\n this.portals.clear()\n }\n\n /**\n * Set viewport size for a scene\n * Used by Portal system to know screen dimensions for centering\n * @param scene - Phaser scene\n * @param width - Viewport width\n * @param height - Viewport height\n */\n setViewportSize(scene: Phaser.Scene, width: number, height: number): void {\n this.viewportSizes.set(scene, { width, height })\n }\n\n /**\n * Get viewport size for a scene\n * @param scene - Phaser scene\n * @returns Viewport size or default 800x600\n */\n getViewportSize(scene: Phaser.Scene): { width: number; height: number } {\n return this.viewportSizes.get(scene) ?? { width: 800, height: 600 }\n }\n\n /**\n * Get portal count\n * @returns Number of registered portals\n */\n get size(): number {\n return this.portals.size\n }\n}\n\n/**\n * Global portal registry instance\n */\nexport const portalRegistry = new PortalRegistry()\n","/**\n * VDOM + mount/patch/unmount and host integration.\n * This file glues JSX VNodes to Phaser GameObjects using the host bridge.\n */\nimport equal from 'fast-deep-equal'\nimport Phaser from 'phaser'\nimport { SceneWrapper } from './components/internal/SceneWrapper'\nimport type { NodeProps, NodeType } from './core-types'\nimport { DebugLogger, DevConfig } from './dev-config'\nimport { generateMountRootId, getGestureManager } from './gestures/gesture-manager'\nimport { disposeCtx, shouldComponentUpdate, withHooks, type Ctx, type VNode } from './hooks'\nimport { host } from './host'\nimport { Fragment } from './jsx-runtime'\nimport { calculateLayout, type LayoutSize } from './layout/index'\nimport { portalRegistry } from './portal'\nimport { getRenderContext } from './render-context'\nimport { getThemedProps } from './theme'\nimport type { ParentType, Ref } from './types'\n\nexport type VNodeLike = VNode | VNode[] | null\n\n/**\n * Registry for active mountJSX instances to enable complete remounting\n * Stores parent, type, and props for each mount to enable theme-triggered remounts\n */\ninterface MountRegistryEntry {\n id: number\n parent: ParentType\n type: NodeType | ((props: unknown) => VNode)\n props: MountProps & Record<string, unknown>\n rootNode: Phaser.GameObjects.GameObject\n vnode: VNode\n}\n\nclass MountRegistry {\n private entries: Map<number, MountRegistryEntry> = new Map()\n private nextId = 1\n\n /**\n * Register a new mountJSX instance\n * @param parent - Parent container or scene\n * @param type - Component type or node type\n * @param props - Mount props\n * @param rootNode - Root game object\n * @returns Registry ID for this mount\n */\n register(\n parent: ParentType,\n type: NodeType | ((props: unknown) => VNode),\n props: MountProps & Record<string, unknown>,\n rootNode: Phaser.GameObjects.GameObject,\n vnode: VNode\n ): number {\n const id = this.nextId++\n this.entries.set(id, { id, parent, type, props, rootNode, vnode })\n DebugLogger.log('vdom', `Registered mount ${id}`)\n return id\n }\n\n /**\n * Unregister a mountJSX instance\n * @param id - Registry ID\n */\n unregister(id: number): void {\n const entry = this.entries.get(id)\n if (entry) {\n DebugLogger.log('vdom', `Unregistered mount ${id}`)\n this.entries.delete(id)\n }\n }\n\n /**\n * Get a specific mount entry by registry ID\n * @param id - Registry ID\n * @returns Mount entry or undefined if not found\n */\n getEntry(id: number): MountRegistryEntry | undefined {\n return this.entries.get(id)\n }\n\n /**\n * Get all active mount entries\n * @returns Array of mount entries\n */\n getAllEntries(): MountRegistryEntry[] {\n return Array.from(this.entries.values())\n }\n\n /**\n * Clear all entries (for testing)\n */\n clear(): void {\n this.entries.clear()\n this.nextId = 1\n }\n}\n\n/**\n * Global mount registry instance\n */\nconst mountRegistry = new MountRegistry()\n\n/**\n * Remount all active mountJSX instances\n * Completely unmounts and remounts every registered root\n * Used when theme changes require full VDOM rebuild\n */\nexport function remountAll(): void {\n const entries = mountRegistry.getAllEntries()\n\n if (entries.length === 0) {\n DebugLogger.log('vdom', 'No mounts to remount')\n return\n }\n\n console.log(`[REMOUNT] Starting remount of ${entries.length} root(s)`)\n\n entries.forEach((entry) => {\n try {\n // Find the current VNode stored in the scene\n const scene =\n entry.parent instanceof Phaser.Scene\n ? entry.parent\n : (entry.parent as Phaser.GameObjects.GameObject).scene\n\n if (!scene || !scene.sys) {\n console.warn('[REMOUNT] Scene is invalid, skipping remount')\n return\n }\n\n const currentVNode = (scene as unknown as { __rootVNode?: VNode }).__rootVNode\n\n // Clear all children from the root container first\n if (entry.rootNode instanceof Phaser.GameObjects.Container) {\n // Remove all children from container\n const children = entry.rootNode.getAll()\n children.forEach((child) => {\n ;(entry.rootNode as Phaser.GameObjects.Container).remove(child, true) // true = destroy child\n })\n }\n\n // Unmount the VDOM tree (this cleans up hooks, contexts, etc.)\n if (currentVNode) {\n // Recursively unmount children but skip the final host.remove\n // since we already cleared the container above\n const flatChildren = flattenChildren(currentVNode.children)\n flatChildren.forEach(unmount)\n\n // Clean up component context if it exists\n if (currentVNode.__ctx) {\n disposeCtx(currentVNode.__ctx)\n delete currentVNode.__ctx\n }\n }\n\n // Create and mount a fresh VDOM tree\n const { width, height, disableAutoSize = false, ...componentProps } = entry.props\n\n // Update viewport dimensions\n const renderContext = getRenderContext(entry.parent)\n renderContext.setViewport(width, height, scene)\n portalRegistry.setViewportSize(scene, width, height)\n\n // Create VNode with or without SceneWrapper\n let vnode: VNode\n\n if (disableAutoSize) {\n vnode = { type: entry.type, props: { ...componentProps, width, height }, children: [] }\n } else {\n const componentVNode: VNode = {\n type: entry.type,\n props: componentProps,\n children: [],\n }\n\n vnode = {\n type: SceneWrapper,\n props: {\n width,\n height,\n children: componentVNode,\n },\n children: [],\n }\n }\n\n // Store new root VNode on the scene\n ;(scene as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n\n // Mount the new VDOM tree into the EXISTING parent container\n const rootNode = mount(entry.parent, vnode)\n\n if (rootNode instanceof Phaser.GameObjects.Container) {\n ;(rootNode as unknown as { __mountRootId?: number }).__mountRootId = generateMountRootId()\n }\n\n // Update registry with new root node and restore registry ID\n entry.rootNode = rootNode\n entry.vnode = vnode\n ;(rootNode as unknown as { __registryId?: number }).__registryId = entry.id\n ;(rootNode as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n\n console.log('[REMOUNT] Successfully remounted entry', entry.id)\n } catch (error) {\n console.error('[REMOUNT] Failed to remount entry', entry.id, error)\n }\n })\n\n console.log('[REMOUNT] Remount complete')\n}\n\n/**\n * Base props that mountJSX requires for scene dimensions\n * Provides viewport size for percentage-based sizing\n */\nexport interface MountProps {\n /** Scene/container width in pixels */\n width: number\n /** Scene/container height in pixels */\n height: number\n /** Disable automatic SceneWrapper (default: false) */\n disableAutoSize?: boolean\n}\n\n/**\n * Combined props type: MountProps + Component-specific props\n * Use this for type-safe mountJSX calls\n */\nexport type MountComponentProps<P = Record<string, never>> = MountProps & P\n\n/**\n * Returned handle from mountJSX\n * Extends the root GameObject with a typed unmount helper\n */\nexport interface MountHandle extends Phaser.GameObjects.GameObject {\n unmount: () => void\n}\n\n/**\n * Flattens nested arrays iteratively (performance optimized)\n * Handles arrays that weren't flattened by jsx-runtime (e.g., from Fragment)\n * @param children - Array that may contain nested arrays\n * @returns Flattened array\n */\nfunction flattenChildren(\n children: (VNode | null | false | undefined)[] | undefined\n): (VNode | null | false | undefined)[] {\n if (!children) return []\n return children.flat(Infinity) as (VNode | null | false | undefined)[]\n}\n\n/**\n * Checks if a child should be skipped during mounting\n * Filters out falsy values, empty strings, and whitespace-only strings\n * @param child - Child to check\n * @returns true if child should be skipped\n */\nfunction shouldSkipChild(child: unknown): boolean {\n if (child == null || child === false) return true\n if (typeof child === 'string') {\n const trimmed = child.trim()\n if (trimmed === '') {\n if (child !== '') {\n console.warn('JSX: Ignoring whitespace-only string in component children')\n }\n return true\n }\n }\n return false\n}\n\n/**\n * Checks if a set of VNode siblings are likely list items that need keys\n * Heuristics: multiple siblings of same type, or array index patterns\n * Static children (from jsxs()) are already excluded before this check\n * @param children - Array of child VNodes\n * @returns true if children look like a list that should have keys\n */\nfunction looksLikeList(children: (VNode | null | false | undefined)[]): boolean {\n const validChildren = children.filter((c) => c != null && c !== false) as VNode[]\n\n // Require at least 5+ children of same type to reduce false positives\n // 2-4 items are often static JSX siblings, not dynamic lists\n if (validChildren.length < 5) return false\n\n // Check if all children have the same type (strong indicator of list)\n const types = new Set(validChildren.map((c) => c.type))\n if (types.size === 1) return true\n\n // Check if many children are missing keys (50%+ threshold)\n const missingKeys = validChildren.filter((c) => !c.__key).length\n return missingKeys / validChildren.length >= 0.5\n}\n\n/**\n * Warns about missing key props in list-like children\n * Helps detect performance issues from VDOM reconciliation problems\n * @param parent - Parent VNode\n * @param children - Child VNodes to check\n */\nfunction warnMissingKeys(parent: VNode, children: (VNode | null | false | undefined)[]): void {\n if (!DevConfig.warnings.missingKeys) return\n\n // Skip warning if children are marked as static (from jsxs())\n if (parent.__staticChildren) return\n\n if (!looksLikeList(children)) return\n\n const validChildren = children.filter((c) => c != null && c !== false) as VNode[]\n const withoutKeys = validChildren.filter((c) => !c.__key)\n\n if (withoutKeys.length === 0) return\n\n const parentPath = buildComponentPath(parent)\n const firstChild = withoutKeys[0]\n if (!firstChild) return\n\n const childType =\n typeof firstChild.type === 'string'\n ? firstChild.type\n : (firstChild.type as { name?: string })?.name || 'Component'\n\n console.warn(\n `[PhaserJSX] Missing key props: ${withoutKeys.length}/${validChildren.length} <${childType}> children in <${parentPath}> don't have keys.`\n /*\n + `\\nThis can cause:\n` +\n ` • Unnecessary component recreation instead of updates\n` +\n ` • State loss in conditional rendering\n` +\n ` • Performance degradation with lists\n` +\n `\\nAdd unique key props to each child, e.g.:\\n` +\n ` <${childType} key=\"unique-id\" />\\n` +\n `\\nTo disable this warning: DevConfig.warnings.missingKeys = false`\n*/\n )\n}\n\n/**\n * Warns when a component remounts unnecessarily due to key/type mismatch\n * Helps detect inline JSX creation or callback recreation issues\n * @param oldV - Previous VNode\n * @param newV - New VNode\n */\nfunction warnUnnecessaryRemount(oldV: VNode, newV: VNode): void {\n if (!DevConfig.warnings.unnecessaryRemounts) return\n\n // Only warn for components (not primitives)\n if (typeof oldV.type !== 'function' && typeof newV.type !== 'function') return\n\n const oldPath = buildComponentPath(oldV)\n const reason = oldV.__key !== newV.__key ? 'key changed' : 'type changed'\n\n console.warn(\n `[PhaserJSX] Unnecessary remount: <${oldPath}> remounted because ${reason}.\\n` +\n `This often happens when:\n` +\n ` • JSX elements are created inline: prefix={<Icon />} (create new object every render)\n` +\n ` • Callbacks are not memoized: onClick={() => handler()} (new function every render)\n` +\n `\\nSolutions:\n` +\n ` • Memoize JSX: const icon = useMemo(() => <Icon />, [])\n` +\n ` • Memoize callbacks: const handleClick = useCallback(() => handler(), [])\n` +\n ` • Add stable key props: key=\"my-component\"\n` +\n `\\nTo disable this warning: DevConfig.warnings.unnecessaryRemounts = false`\n )\n}\n\n/**\n * Builds a component path string by walking up the VNode tree\n * Stops at the first parent with a key prop for easier debugging\n * @param vnode - VNode to start from\n * @returns Path string like \"ParentWithKey[myKey] > Child > Grandchild\"\n */\nfunction buildComponentPath(vnode: VNode): string {\n const path: string[] = []\n let current: VNode | undefined = vnode\n\n while (current) {\n const typeName =\n typeof current.type === 'string'\n ? current.type\n : (current.type as { name?: string })?.name || 'Component'\n const key = current.props?.key\n\n if (key) {\n // Found a keyed parent - add it with key and stop\n path.unshift(`${typeName}[key=\"${key}\"]`)\n break\n } else {\n path.unshift(typeName)\n }\n\n // Walk up to parent VNode (if stored)\n current = (current as VNode & { __parentVNode?: VNode }).__parentVNode\n }\n\n return path.join(' > ')\n}\n\n/**\n * Safely sets __theme on a VNode, handling frozen/sealed objects\n * Creates a shallow copy if the object is not extensible\n * @param vnode - VNode to set theme on\n * @param theme - Theme object to set\n * @returns Original VNode if extensible, or shallow copy with theme\n */\nfunction setThemeSafe<T extends VNode>(vnode: T, theme: Record<string, unknown>): T {\n // Check if object can be modified\n if (Object.isExtensible(vnode)) {\n vnode.__theme = theme\n return vnode\n }\n\n // Object is frozen/sealed - create shallow copy with theme\n if (DevConfig.warnings.frozenVNodes) {\n const componentPath = buildComponentPath(vnode)\n console.warn(\n `[PhaserJSX] Frozen VNode detected at <${componentPath}>. ` +\n `Creating shallow copy to apply theme. ` +\n `This may happen in production builds or with certain bundler optimizations.`\n )\n }\n\n // Create shallow copy with theme\n return { ...vnode, __theme: theme }\n}\n\n/**\n * Safely sets a property on a VNode, handling frozen/sealed objects\n * Creates a shallow copy if the object is not extensible\n * @param vnode - VNode to set property on\n * @param key - Property key to set\n * @param value - Value to set\n * @returns Original VNode if extensible, or shallow copy with property\n */\nfunction setVNodePropSafe<T extends VNode, K extends string>(vnode: T, key: K, value: unknown): T {\n // Check if object can be modified\n if (Object.isExtensible(vnode)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(vnode as any)[key] = value\n return vnode\n }\n\n // Object is frozen/sealed - create shallow copy with property\n if (DevConfig.warnings.frozenVNodes) {\n const componentPath = buildComponentPath(vnode)\n console.warn(\n `[PhaserJSX] Frozen VNode detected at <${componentPath}>. ` +\n `Creating shallow copy to set property '${key}'. ` +\n `This may happen in production builds or with certain bundler optimizations.`\n )\n }\n\n // Create shallow copy with property\n return { ...vnode, [key]: value } as T\n}\n\n/**\n * Updates gesture hit area based on current layout size\n * Called after layout recalculation to sync hit area with actual container size\n * @param container - Container with potential gesture registration\n */\nfunction updateGestureHitAreaAfterLayout(container: Phaser.GameObjects.Container): void {\n const containerWithLayout = container as typeof container & {\n __getLayoutSize?: () => LayoutSize\n }\n\n // Only update if container has gesture system enabled and layout size available\n if (!containerWithLayout.__getLayoutSize) return\n\n try {\n const manager = getGestureManager(container.scene)\n\n // Check if container is actually registered with gesture manager\n // If not, skip the update - this prevents overwriting hit areas of other containers\n if (!manager.hasContainer(container)) return\n\n // Use actual container dimensions after layout, not __getLayoutSize\n // __getLayoutSize may return 0x0 for containers with fill sizing before parent is laid out\n const width = container.width\n const height = container.height\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n manager.updateHitArea(container, hitArea)\n } catch {\n // Gesture manager or container not registered, ignore\n }\n}\n\n/**\n * Layout-relevant props that trigger layout recalculation when changed\n * These are the props that affect container/child sizing and positioning\n */\nconst LAYOUT_PROPS = [\n 'width',\n 'height',\n 'minWidth',\n 'maxWidth',\n 'minHeight',\n 'maxHeight',\n 'flex',\n 'margin',\n 'padding',\n 'gap',\n 'direction',\n 'justifyContent',\n 'alignItems',\n 'overflow',\n 'visible', // visible=\"none\" removes element from layout (like CSS display: none)\n] as const\n\n/**\n * Object props that need deep comparison\n * These props are objects and should be compared by value, not by reference\n */\nconst DEEP_COMPARE_PROPS = new Set(['margin', 'padding'])\n\n/**\n * Check if layout-relevant props changed between two VNodes\n * Uses shallow equality for primitives and deep equality for objects\n * @param oldV - Previous VNode\n * @param newV - New VNode\n * @returns True if any layout prop changed\n */\nfunction hasLayoutPropsChanged(oldV: VNode, newV: VNode): boolean {\n const oldProps = oldV.props ?? {}\n const newProps = newV.props ?? {}\n\n // Check each layout-relevant prop\n for (const prop of LAYOUT_PROPS) {\n const oldVal = oldProps[prop]\n const newVal = newProps[prop]\n\n // Use deep comparison for object props (margin, padding)\n if (DEEP_COMPARE_PROPS.has(prop)) {\n if (!equal(oldVal, newVal)) {\n return true\n }\n } else {\n // Shallow comparison for primitives\n if (oldVal !== newVal) {\n return true\n }\n }\n }\n\n return false\n}\n\n/**\n * Attaches or detaches a ref to a node\n * @param ref - Ref callback or object\n * @param value - Value to set (null for detach)\n */\nfunction attachRef<T>(ref: Ref<T> | undefined, value: T | null): void {\n if (!ref) return\n if (typeof ref === 'function') {\n ref(value)\n } else {\n ref.current = value\n }\n}\n\n/**\n * Creates a VNode element (alternative to JSX)\n * @param type - Element type (string or component)\n * @param props - Element props\n * @param children - Child elements\n * @returns VNode object\n */\nexport function createElement(\n type: string | ((props: Record<string, unknown>) => VNode),\n props: Record<string, unknown> | null,\n ...children: VNode[]\n): VNode {\n const flat = ([] as unknown[]).concat(...children).filter((c) => c != null)\n return { type, props: props ?? {}, children: flat as VNode[] }\n}\n\n/**\n * Mounts a VNode to the scene or parent container\n * @param parentOrScene - Scene or parent container\n * @param vnode - Virtual node to mount\n * @returns Created Phaser GameObject\n */\nexport function mount(parentOrScene: ParentType, vnode: VNode): Phaser.GameObjects.GameObject {\n // Guard against invalid vnodes\n if (!vnode || typeof vnode !== 'object') {\n // Create a dummy invisible container to prevent crashes\n console.error(\n '❌ Invalid VNode (not an object):',\n vnode,\n '\\n📍 This typically happens with raw text nodes in JSX.',\n '\\n💡 Solution: Wrap in <Text> component or use {expression} syntax'\n )\n // Return a dummy container to prevent cascade failures\n const dummy = (parentOrScene as Phaser.Scene).add.container(0, 0)\n dummy.setVisible(false)\n return dummy as Phaser.GameObjects.GameObject\n }\n if (vnode.type === undefined || vnode.type === null) {\n const componentPath = buildComponentPath(vnode)\n console.error(\n '❌ VNode with undefined/null type',\n `\\n📍 Component path: ${componentPath}`,\n '\\n💡 Invalid value:',\n vnode,\n '\\nℹ️ Check for empty JSX expressions {} or conditional renders returning undefined.',\n '\\n💡 Solution: Use {condition && <Component />} or provide fallback'\n )\n // Return a dummy container to prevent cascade failures\n const dummy = (parentOrScene as Phaser.Scene).add.container(0, 0)\n dummy.setVisible(false)\n return dummy as Phaser.GameObjects.GameObject\n }\n\n // Fragment - mount children directly without creating a container\n if (vnode.type === Fragment) {\n // Mount all children directly to parent\n let firstNode: Phaser.GameObjects.GameObject | undefined\n const flatChildren = flattenChildren(vnode.children)\n flatChildren.forEach((c) => {\n if (!shouldSkipChild(c)) {\n // Type guard: c is VNode at this point\n let child = c as VNode\n // Track parent VNode for error messages\n child = setVNodePropSafe(child, '__parentVNode', vnode)\n // Propagate theme to children\n if (!child.__theme && vnode.__theme) {\n const themed = setThemeSafe(child, vnode.__theme)\n if (themed !== child) {\n // VNode was frozen, replace it in parent's children array\n flatChildren[flatChildren.indexOf(child)] = themed\n }\n }\n const childNode = mount(parentOrScene, child)\n if (!firstNode) firstNode = childNode\n }\n })\n // Store a marker so we know this is a fragment during unmount/patch\n vnode = setVNodePropSafe(vnode, '__node', firstNode)\n vnode = setVNodePropSafe(vnode, '__parent', parentOrScene)\n // Fragment must have at least one child to work properly\n if (!firstNode) {\n throw new Error('Fragment must have at least one child element')\n }\n return firstNode\n }\n\n // Function component\n if (typeof vnode.type === 'function') {\n // Debug log for theme\n if (vnode.__theme) {\n DebugLogger.log(\n 'vdom',\n `Function component ${vnode.type.name} mounting with __theme:`,\n vnode.__theme\n )\n }\n\n // Extract scene early for potential null-return handling\n const scene =\n parentOrScene instanceof Phaser.Scene\n ? parentOrScene\n : (parentOrScene as Phaser.GameObjects.GameObject).scene\n\n const ctx: Ctx = {\n index: 0,\n slots: [],\n effects: [],\n cleanups: [],\n vnode, // Will be updated to rendered VNode below\n componentVNode: vnode, // Keep reference to component VNode\n parent: parentOrScene,\n function: vnode.type as (props: unknown) => VNode,\n isFactory: false,\n theme: vnode.__theme, // Inherit theme from parent or use vnode's theme\n }\n // Store context on the component vnode for patching\n vnode = setVNodePropSafe(vnode, '__ctx', ctx)\n // Pass children to the component via props\n const propsWithChildren = vnode.children?.length\n ? { ...(vnode.props ?? {}), children: vnode.children }\n : vnode.props\n let rendered = withHooks(ctx, () =>\n (vnode.type as (props: unknown) => VNode)(propsWithChildren)\n )\n\n // Handle null/undefined returns (e.g., from Portal component)\n if (!rendered) {\n // Component returned null - this is valid (e.g., Portal)\n ctx.vnode = rendered\n // IMPORTANT: Run effects even if component returns null (e.g., Portal needs useEffect)\n for (const run of ctx.effects) run()\n // Return a dummy container that won't be used\n const dummyContainer = scene.add.container(0, 0)\n dummyContainer.visible = false\n return dummyContainer\n }\n\n // Propagate theme to rendered VNode\n if (ctx.theme && !rendered.__theme) {\n const themed = setThemeSafe(rendered, ctx.theme)\n if (themed !== rendered) {\n // VNode was frozen, use the copy\n return mount(parentOrScene, themed)\n }\n }\n\n // Check if this is a VNode factory (renders immediately without using hooks)\n if (ctx.slots.length === 0 && ctx.effects.length === 0) {\n // This is a simple factory function, not a real component\n ctx.isFactory = true\n // Keep reference to the rendered output so unmounting works without recursion\n ctx.vnode = rendered\n // Copy __addConfig from component VNode to rendered VNode\n if (vnode.__addConfig) {\n rendered = setVNodePropSafe(rendered, '__addConfig', vnode.__addConfig)\n }\n // Mount the rendered VNode directly without creating a component context\n return mount(parentOrScene, rendered)\n }\n\n // Copy __addConfig from component VNode to rendered VNode\n if (vnode.__addConfig) {\n rendered = setVNodePropSafe(rendered, '__addConfig', vnode.__addConfig)\n }\n const node = mount(parentOrScene, rendered)\n ctx.cleanups.push(() => unmount(rendered))\n ctx.vnode = rendered\n for (const run of ctx.effects) run()\n return node\n }\n // Host node\n // Check if parentOrScene is already a Phaser.Scene\n const scene = (parentOrScene as { sys?: unknown }).sys\n ? (parentOrScene as Phaser.Scene) // It's a Scene\n : ((parentOrScene as { scene?: unknown }).scene as Phaser.Scene) // It's a game object with .scene\n\n // Apply theme to props and extract nested themes for children\n const nodeType = vnode.type as NodeType\n const { props: themedProps, nestedTheme } = getThemedProps(\n nodeType,\n vnode.__theme,\n vnode.props ?? {}\n )\n\n // Debug: Log themed props for View\n if (\n nodeType === 'View' &&\n (themedProps.backgroundColor !== undefined || themedProps.cornerRadius !== undefined)\n ) {\n DebugLogger.log('theme', 'VDOM Mount - Themed props for View:', {\n backgroundColor: themedProps.backgroundColor,\n cornerRadius: themedProps.cornerRadius,\n hasTheme: !!vnode.__theme,\n originalProps: vnode.props,\n })\n }\n\n const node = host.create(nodeType, themedProps as NodeProps, scene)\n vnode = setVNodePropSafe(vnode, '__node', node)\n vnode = setVNodePropSafe(vnode, '__parent', parentOrScene) // Store parent for unmounting\n\n // Attach ref after node creation\n const ref = vnode.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n attachRef(ref, node)\n\n host.append(parentOrScene, node)\n\n // Flatten children to support nested arrays\n const flatChildren = flattenChildren(vnode.children)\n\n // Warn about missing keys during initial mount\n if (flatChildren.length > 0) {\n warnMissingKeys(vnode, flatChildren)\n }\n\n flatChildren.forEach((c, index) => {\n if (!shouldSkipChild(c)) {\n // Type guard: c is VNode at this point\n let child = c as VNode\n\n // Additional validation: check if child is actually a VNode object\n if (!child || typeof child !== 'object' || !child.type) {\n const componentPath = buildComponentPath(vnode)\n console.warn(\n `❌ Invalid child at index ${index}`,\n `\\n📍 Component path: ${componentPath}`,\n `\\n💡 Invalid value:`,\n child,\n '\\nℹ️ This child will be skipped. Use {expression} or <Text> for text content.'\n )\n return // Skip this child instead of throwing\n }\n\n // Track parent VNode for error messages\n child = setVNodePropSafe(child, '__parentVNode', vnode)\n\n // Skip theme propagation for primitives (strings, numbers, booleans)\n if (typeof child === 'object') {\n // Merge parent's nested theme with child's existing theme\n if (Object.keys(nestedTheme).length > 0) {\n const mergedTheme = child.__theme ? { ...nestedTheme, ...child.__theme } : nestedTheme\n const themed = setThemeSafe(child, mergedTheme)\n if (themed !== child) {\n flatChildren[flatChildren.indexOf(child)] = themed\n }\n } else if (!child.__theme && vnode.__theme) {\n // Fallback: Propagate theme to children (inherit parent's theme if child doesn't have one)\n const themed = setThemeSafe(child, vnode.__theme)\n if (themed !== child) {\n flatChildren[flatChildren.indexOf(child)] = themed\n }\n }\n }\n mount(node as ParentType, child)\n }\n })\n\n // Calculate layout after all children are mounted\n // Check if this is a Container (has list property)\n if (node && 'list' in node && Array.isArray((node as Phaser.GameObjects.Container).list)) {\n const container = node as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n }\n\n // Get parent size for percentage/fill resolution\n let parentSize: { width: number; height: number } | undefined\n if (parentOrScene instanceof Phaser.GameObjects.Container) {\n const parentContainer = parentOrScene as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n __getLayoutSize?: () => { width: number; height: number }\n }\n // Get parent's content-area (size minus padding) for percentage resolution\n if (parentContainer.__getLayoutSize) {\n const parentTotalSize = parentContainer.__getLayoutSize()\n const padding = (parentContainer.__layoutProps?.padding ?? 0) as\n | number\n | { left?: number; right?: number; top?: number; bottom?: number }\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n parentSize = {\n width: parentTotalSize.width - normPadding.left - normPadding.right,\n height: parentTotalSize.height - normPadding.top - normPadding.bottom,\n }\n }\n }\n\n calculateLayout(container, container.__layoutProps ?? {}, parentSize)\n\n // Defer gesture hit area update to next frame after layout completes\n // This ensures __getLayoutSize() returns correct dimensions (not 0x0)\n const renderContext = getRenderContext(parentOrScene)\n renderContext.deferLayout(() => updateGestureHitAreaAfterLayout(container))\n }\n\n return node\n}\n\n/**\n * Unmounts a VNode and cleans up resources\n * @param vnode - VNode to unmount\n */\nexport function unmount(vnode: VNode | null | undefined | false): void {\n if (!vnode || (vnode as unknown) === false) return\n\n // Fragment - just unmount children\n if (vnode.type === Fragment) {\n const flatChildren = flattenChildren(vnode.children)\n flatChildren.forEach(unmount)\n return\n }\n\n if (typeof vnode.type === 'function') {\n const ctx = (vnode as VNode & { __ctx?: Ctx }).__ctx\n if (ctx) {\n disposeCtx(ctx)\n // Clear context reference to prevent memory leak\n delete (vnode as VNode & { __ctx?: Ctx }).__ctx\n }\n if (ctx?.vnode) unmount(ctx.vnode)\n return\n }\n\n // Detach ref before cleanup\n const ref = vnode.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n attachRef(ref, null)\n\n // Clean up children FIRST (before removing from parent)\n const flatChildren = flattenChildren(vnode.children)\n flatChildren.forEach(unmount)\n\n // Unregister from mount registry if this is a root node\n const node = vnode.__node as Phaser.GameObjects.GameObject & { __registryId?: number }\n if (node?.__registryId !== undefined) {\n mountRegistry.unregister(node.__registryId)\n delete node.__registryId\n }\n\n // Then remove from parent/scene\n const parent = vnode.__parent\n if (parent) host.remove(parent as ParentType, vnode.__node as Phaser.GameObjects.GameObject)\n\n // NOTE: We intentionally do NOT delete __node, __parent, __theme here\n // because these VNodes might still be referenced elsewhere (e.g., in closures)\n // The Phaser GameObject is destroyed by host.remove(), so the memory will be freed\n // The VNode references will be garbage collected when all references are gone\n}\n\n/**\n * Patches VNode tree with updates\n * @param parent - Parent container or scene\n * @param oldV - Previous VNode (can be null if previous render returned null)\n * @param newV - New VNode (can be null if new render returns null)\n */\nexport function patchVNode(parent: ParentType, oldV: VNode | null, newV: VNode | null) {\n // Handle null cases (e.g., Modal closing/opening)\n if (!oldV && !newV) return\n if (!oldV && newV) {\n mount(parent, newV)\n return\n }\n if (oldV && !newV) {\n unmount(oldV)\n return\n }\n\n // Both non-null from here on (TypeScript guard)\n if (!oldV || !newV) return\n\n // Check if keys differ - if so, unmount old and mount new\n if (oldV.__key !== newV.__key) {\n warnUnnecessaryRemount(oldV, newV)\n unmount(oldV)\n mount(parent, newV)\n return\n }\n\n // Fragment - patch children directly\n if (oldV.type === Fragment && newV.type === Fragment) {\n // Transfer theme from newV to oldV\n if (newV.__theme !== undefined) {\n const themed = setThemeSafe(oldV, newV.__theme)\n if (themed !== oldV) {\n // oldV was frozen - this shouldn't happen in normal operation\n console.error('[PhaserJSX] Cannot patch frozen Fragment VNode')\n }\n }\n\n const a = flattenChildren(oldV.children)\n const b = flattenChildren(newV.children)\n const len = Math.max(a.length, b.length)\n for (let i = 0; i < len; i++) {\n const c1 = a[i]\n const c2 = b[i]\n const isValidC1 = c1 != null && c1 !== false\n const isValidC2 = c2 != null && c2 !== false\n if (!isValidC1 && isValidC2) {\n // Propagate theme to new child (only for objects)\n if (typeof c2 === 'object' && newV.__theme && !c2.__theme) {\n const themed = setThemeSafe(c2, newV.__theme)\n if (themed !== c2) {\n b[i] = themed\n }\n }\n mount(parent, c2)\n } else if (isValidC1 && !isValidC2) {\n unmount(c1)\n } else if (isValidC1 && isValidC2) {\n // Propagate theme to both children (only for objects)\n if (typeof c1 === 'object' && typeof c2 === 'object' && newV.__theme) {\n let themed1 = setThemeSafe(c1, newV.__theme)\n let themed2 = setThemeSafe(c2, newV.__theme)\n if (themed1 !== c1) a[i] = themed1\n if (themed2 !== c2) b[i] = themed2\n }\n patchVNode(parent, c1, c2)\n }\n }\n return\n }\n\n // Function components\n if (typeof oldV.type === 'function' || typeof newV.type === 'function') {\n if (oldV.type === newV.type) {\n const ctx = (oldV as VNode & { __ctx?: Ctx }).__ctx\n if (!ctx) {\n // No context means this is a VNode factory (like RexSizer), not a real component\n // Render both and patch the results\n // Type guard: both oldV and newV are non-null and have same type\n if (!newV || !oldV) return\n const propsWithChildren = newV.children?.length\n ? { ...(newV.props ?? {}), children: newV.children }\n : newV.props\n const oldRendered = (oldV.type as (props: unknown) => VNode)(\n oldV.children?.length ? { ...(oldV.props ?? {}), children: oldV.children } : oldV.props\n )\n const newRendered = (newV.type as (props: unknown) => VNode)(propsWithChildren)\n patchVNode(parent, oldRendered, newRendered)\n return\n }\n // Real component with context - update component VNode props if changed\n if (newV.props !== undefined) {\n ctx.componentVNode.props = newV.props\n }\n if (newV.children !== undefined) {\n ctx.componentVNode.children = newV.children\n }\n // Update theme in context if it changed\n if (newV.__theme !== undefined) {\n ctx.theme = newV.__theme\n }\n // Transfer context to newV so future patches work\n const newVWithCtx = setVNodePropSafe(newV, '__ctx', ctx)\n\n // Build props for comparison (merge props + children)\n const propsWithChildren = ctx.componentVNode.children?.length\n ? { ...(ctx.componentVNode.props ?? {}), children: ctx.componentVNode.children }\n : ctx.componentVNode.props\n\n // Check if component should update (memoization)\n if (!shouldComponentUpdate(ctx, propsWithChildren)) {\n // Props haven't changed - skip re-render\n return\n }\n\n // Re-render with updated props (use newVWithCtx for type safety)\n const renderedNext = withHooks(ctx, () =>\n (newVWithCtx.type as (props: unknown) => VNode)(propsWithChildren)\n )\n\n // Handle null returns (e.g., from Portal component)\n if (!renderedNext) {\n ctx.vnode = renderedNext\n for (const run of ctx.effects) run()\n return\n }\n\n // Propagate theme to rendered VNode if not already set\n if (ctx.theme && !renderedNext.__theme) {\n const themed = setThemeSafe(renderedNext, ctx.theme)\n if (themed !== renderedNext) {\n // Update context to use themed copy\n patchVNode(parent, ctx.vnode, themed)\n ctx.vnode = themed\n for (const run of ctx.effects) run()\n return\n }\n }\n\n patchVNode(parent, ctx.vnode, renderedNext)\n ctx.vnode = renderedNext\n for (const run of ctx.effects) run()\n\n return\n }\n unmount(oldV)\n mount(parent, newV)\n return\n }\n // Host nodes\n if (oldV.type !== newV.type) {\n unmount(oldV)\n mount(parent, newV)\n return\n }\n const nodeType = oldV.type as NodeType\n newV = setVNodePropSafe(newV, '__node', oldV.__node)\n\n // Transfer theme from newV to oldV (theme may have changed)\n // Transfer theme from newV to oldV, or inherit from oldV if newV has no theme\n // This ensures theme updates are properly applied during patching\n if (newV.__theme !== undefined) {\n const themed = setThemeSafe(oldV, newV.__theme)\n if (themed !== oldV) {\n // oldV was frozen - this shouldn't happen during patch\n console.error('[PhaserJSX] Cannot patch frozen VNode in host node')\n }\n } else if (oldV.__theme !== undefined) {\n // IMPORTANT: If newV doesn't have a theme, inherit from oldV\n // This happens when a function component re-renders and creates new VNodes\n // without explicitly propagating the theme\n const themed = setThemeSafe(newV, oldV.__theme)\n if (themed !== newV) {\n // newV was frozen - we need to use the copy\n // This is a problem because we can't replace newV in the parent\n console.error('[PhaserJSX] Cannot inherit theme to frozen VNode')\n }\n }\n\n // Update ref if it changed\n const oldRef = oldV.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n const newRef = newV.props?.ref as Ref<Phaser.GameObjects.GameObject> | undefined\n if (oldRef !== newRef) {\n attachRef(oldRef, null)\n attachRef(newRef, oldV.__node as Phaser.GameObjects.GameObject)\n }\n\n // Apply theme to props before patching (merge explicit props with theme)\n DebugLogger.log(\n 'vdom',\n `Patching ${nodeType}: oldV.__theme:`,\n oldV.__theme,\n 'newV.__theme:',\n newV.__theme\n )\n const { props: oldThemedProps } = getThemedProps(nodeType, oldV.__theme, oldV.props ?? {})\n const { props: newThemedProps, nestedTheme: newNestedTheme } = getThemedProps(\n nodeType,\n newV.__theme,\n newV.props ?? {}\n )\n DebugLogger.log(\n 'vdom',\n `Patching ${nodeType}: oldThemedProps.gap:`,\n (oldThemedProps as { gap?: number }).gap\n )\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n host.patch(nodeType, oldV.__node as any, oldThemedProps, newThemedProps)\n\n const a = flattenChildren(oldV.children)\n const b = flattenChildren(newV.children)\n const len = Math.max(a.length, b.length)\n let childrenChanged = false\n\n // Warn about missing keys in list-like children\n if (b.length > 0) {\n warnMissingKeys(newV, b)\n }\n\n // Check if the container's own layout props changed\n const containerLayoutChanged = hasLayoutPropsChanged(oldV, newV)\n\n for (let i = 0; i < len; i++) {\n const c1 = a[i],\n c2 = b[i]\n // Filter out false/null/undefined children\n const isValidC1 = c1 != null && c1 !== false\n const isValidC2 = c2 != null && c2 !== false\n if (!isValidC1 && isValidC2) {\n // Merge parent's nested theme for new child (only for objects)\n if (typeof c2 === 'object') {\n if (Object.keys(newNestedTheme).length > 0) {\n const mergedTheme = c2.__theme ? { ...newNestedTheme, ...c2.__theme } : newNestedTheme\n const themed = setThemeSafe(c2, mergedTheme)\n if (themed !== c2) {\n b[i] = themed\n }\n } else if (!c2.__theme && newV.__theme) {\n const themed = setThemeSafe(c2, newV.__theme)\n if (themed !== c2) {\n b[i] = themed\n }\n }\n }\n mount(oldV.__node as ParentType, c2)\n childrenChanged = true\n } else if (isValidC1 && !isValidC2) {\n unmount(c1)\n childrenChanged = true\n } else if (isValidC1 && isValidC2) {\n // Merge parent's nested theme with child's theme (only for objects)\n // IMPORTANT: Update both c1 (for patch comparison) and c2 (for future renders)\n if (typeof c1 === 'object' && typeof c2 === 'object') {\n if (Object.keys(newNestedTheme).length > 0) {\n const mergedTheme = c2.__theme ? { ...newNestedTheme, ...c2.__theme } : newNestedTheme\n let themed1 = setThemeSafe(c1, mergedTheme)\n let themed2 = setThemeSafe(c2, mergedTheme)\n if (themed1 !== c1) a[i] = themed1\n if (themed2 !== c2) b[i] = themed2\n } else if (newV.__theme) {\n // Fallback: Propagate theme to child (inherit parent's theme)\n // IMPORTANT: Always propagate, even if child has theme, because parent theme might have changed\n let themed1 = setThemeSafe(c1, newV.__theme)\n let themed2 = setThemeSafe(c2, newV.__theme)\n if (themed1 !== c1) a[i] = themed1\n if (themed2 !== c2) b[i] = themed2\n }\n }\n\n // Check if this child has layout-relevant changes\n const childLayoutChanged = hasLayoutPropsChanged(c1, c2)\n\n // Check if text content changed (text nodes have dynamic sizing)\n const textContentChanged =\n c1.props?.text !== c2.props?.text || !equal(c1.props?.style, c2.props?.style)\n\n // Recursively patch the child\n patchVNode(oldV.__node as ParentType, c1, c2)\n\n // Mark as changed if:\n // 1. Layout props changed, OR\n // 2. Text content changed (affects text dimensions), OR\n // 3. Child has dynamic sizing (__getLayoutSize) and might have changed\n if (childLayoutChanged) {\n childrenChanged = true\n } else if (textContentChanged) {\n // Text content changed - dimensions likely changed\n childrenChanged = true\n } else if (c1.__node && typeof c1.__node === 'object' && '__getLayoutSize' in c1.__node) {\n // Child has dynamic sizing (e.g., text), assume size might have changed\n // Note: This is a fallback - should be caught by textContentChanged\n childrenChanged = true\n }\n }\n }\n\n // Recalculate layout if:\n // 1. Container's own layout props changed, OR\n // 2. Children structurally changed or have layout-relevant changes\n const shouldRecalculateLayout = containerLayoutChanged || childrenChanged\n\n if (\n shouldRecalculateLayout &&\n oldV.__node &&\n typeof oldV.__node === 'object' &&\n 'list' in oldV.__node\n ) {\n const container = oldV.__node as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n }\n if (container.__layoutProps) {\n // Get parent content-area (size minus padding) for percentage/fill resolution\n let parentSize: { width: number; height: number } | undefined\n if (parent instanceof Phaser.GameObjects.Container) {\n const parentContainer = parent as Phaser.GameObjects.Container & {\n __layoutProps?: Record<string, unknown>\n __getLayoutSize?: () => { width: number; height: number }\n }\n // Use parent's layout size minus padding (content-area)\n if (parentContainer.__getLayoutSize) {\n const parentTotalSize = parentContainer.__getLayoutSize()\n const padding = (parentContainer.__layoutProps?.padding ?? 0) as\n | number\n | { left?: number; right?: number; top?: number; bottom?: number }\n const normPadding =\n typeof padding === 'number'\n ? { left: padding, right: padding, top: padding, bottom: padding }\n : {\n left: padding.left ?? 0,\n right: padding.right ?? 0,\n top: padding.top ?? 0,\n bottom: padding.bottom ?? 0,\n }\n parentSize = {\n width: parentTotalSize.width - normPadding.left - normPadding.right,\n height: parentTotalSize.height - normPadding.top - normPadding.bottom,\n }\n }\n }\n\n calculateLayout(container, container.__layoutProps, parentSize)\n\n // Defer gesture hit area update to next frame after layout completes\n const renderContext = getRenderContext(parent)\n renderContext.deferLayout(() => updateGestureHitAreaAfterLayout(container))\n }\n }\n}\n\n/**\n * Mounts a component by type and props\n * Automatically wraps component in SceneWrapper unless disableAutoSize is true\n * @param parentOrScene - Phaser scene or parent container\n * @param type - Component type (function or string)\n * @param props - Component props including width and height\n * @returns Created Phaser GameObject\n */\n\nexport function mountJSX<T extends NodeType>(\n parentOrScene: ParentType,\n type: T,\n props: MountComponentProps<NodeProps<T>>\n): MountHandle\n\nexport function mountJSX<P = Record<string, never>>(\n parentOrScene: ParentType,\n type: (props: P & MountProps) => VNode,\n props: MountComponentProps<P>\n): MountHandle\n\nexport function mountJSX(\n parentOrScene: ParentType,\n type: NodeType | ((props: unknown) => VNode),\n props: MountProps & Record<string, unknown> = { width: 0, height: 0 }\n): MountHandle {\n // Extract MountProps and component props\n const { width, height, disableAutoSize = false, ...componentProps } = props\n\n // Extract scene and set viewport dimensions\n const scene =\n parentOrScene instanceof Phaser.Scene\n ? parentOrScene\n : (parentOrScene as Phaser.GameObjects.GameObject).scene\n\n if (scene) {\n const renderContext = getRenderContext(parentOrScene)\n renderContext.setViewport(width, height, scene)\n\n // Also set viewport for portal system (for Modal centering, etc.)\n portalRegistry.setViewportSize(scene, width, height)\n }\n\n // Create VNode with or without SceneWrapper\n let vnode: VNode\n\n if (disableAutoSize) {\n // Without wrapper: mount component directly (legacy behavior)\n vnode = { type, props: { ...componentProps, width, height }, children: [] }\n } else {\n // With wrapper (DEFAULT): use SceneWrapper for percentage-based sizing\n const componentVNode: VNode = {\n type,\n props: componentProps,\n children: [],\n }\n\n vnode = {\n type: SceneWrapper,\n props: {\n width,\n height,\n children: componentVNode,\n },\n children: [],\n }\n }\n\n // Store root VNode on the scene for debug access (non-intrusive)\n if (scene) {\n ;(scene as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n }\n\n // Mark root container with unique mount ID for gesture isolation\n // This ensures different mountJSX calls create separate gesture trees\n const rootNode = mount(parentOrScene, vnode)\n if (rootNode instanceof Phaser.GameObjects.Container) {\n ;(rootNode as unknown as { __mountRootId?: number }).__mountRootId = generateMountRootId()\n }\n\n // Store root VNode on the mounted node to allow typed unmounting later\n ;(rootNode as unknown as { __rootVNode?: VNode }).__rootVNode = vnode\n\n // Register this mount in the registry for theme-triggered remounts\n const registryId = mountRegistry.register(parentOrScene, type, props, rootNode, vnode)\n\n // Store registry ID on root node for cleanup\n ;(rootNode as unknown as { __registryId?: number }).__registryId = registryId\n\n const handle = rootNode as MountHandle\n handle.unmount = () => unmountJSX(handle)\n\n return handle\n}\n\n/**\n * Convenience helper to unmount a tree created via mountJSX without manual casting\n * Accepts either the root GameObject returned from mountJSX or the owning scene\n * @param target - Root GameObject or Phaser scene that holds the mounted JSX tree\n */\nexport function unmountJSX(target: Phaser.Scene | Phaser.GameObjects.GameObject): void {\n const scene = target instanceof Phaser.Scene ? target : target.scene\n const targetWithVNode = target as unknown as { __rootVNode?: VNode; __registryId?: number }\n const sceneWithVNode = scene as unknown as { __rootVNode?: VNode }\n\n // Prefer VNode stored directly on the root node (supports multiple mounts per scene)\n const rootVNode = targetWithVNode.__rootVNode ?? sceneWithVNode?.__rootVNode\n\n if (rootVNode) {\n unmount(rootVNode)\n\n // Clear stored references to avoid reusing a stale VNode after unmount\n if (targetWithVNode.__rootVNode === rootVNode) {\n delete targetWithVNode.__rootVNode\n }\n if (sceneWithVNode?.__rootVNode === rootVNode) {\n delete sceneWithVNode.__rootVNode\n }\n return\n }\n\n // Fallback: use registry entry if available (in case __rootVNode was cleared)\n if (targetWithVNode.__registryId !== undefined) {\n const entry = mountRegistry.getEntry(targetWithVNode.__registryId)\n if (entry?.vnode) {\n unmount(entry.vnode)\n return\n }\n }\n\n DebugLogger.log('vdom', 'unmountJSX called but no root VNode found on target')\n}\n","/**\n * Tiny hook runtime to enable function components with local subtree re-render.\n * It is independent from React/Preact renderers.\n */\nimport type { Signal } from '@preact/signals-core'\nimport { getContextFromParent } from './render-context'\nimport type { PartialTheme } from './theme'\nimport type { ParentType } from './types'\nimport { patchVNode } from './vdom'\n\ntype Cleanup = void | (() => void)\n\n/**\n * Get current hook context from active render\n * Must be called during component render\n * @returns Current context or null if not in render\n */\nexport function getCurrent(): Ctx | null {\n // This is a bit tricky: we need to get the context from somewhere\n // Since we removed the global CURRENT, we need a way to access it\n // The solution: store it in a module-level variable that's managed by withHooks\n // This is a temporary bridge solution\n return _currentCtx\n}\n\n// Module-level current context (managed by withHooks only)\nlet _currentCtx: Ctx | null = null\n\nexport type Ctx = {\n index: number\n slots: unknown[]\n effects: (() => Cleanup)[]\n cleanups: Cleanup[]\n vnode: VNode // The rendered VNode (output of component function)\n componentVNode: VNode // The component VNode itself (with type = function)\n parent: ParentType\n function: (props: unknown) => VNode\n updater?: (() => void) | undefined\n isFactory: boolean\n lastProps?: unknown // Store last props for memoization\n memoized?: boolean // Whether component uses memoization (default: true)\n theme?: PartialTheme | undefined // Theme context for this component\n disposed?: boolean // Flag to prevent updates after disposal\n}\n\nexport type VNode = {\n type: unknown\n props?: Record<string, unknown> | undefined\n children?: (VNode | null | undefined | false)[]\n __node?: unknown\n __ctx?: Ctx\n __parent?: unknown\n __key?: string | number | null\n __addConfig?: {\n expand?: boolean\n proportion?: number\n align?: string\n padding?: number | { left?: number; right?: number; top?: number; bottom?: number }\n }\n __memo?: boolean // Opt-out of memoization (false = always re-render)\n __theme?: PartialTheme // Theme override for this VNode and its children\n __staticChildren?: boolean // True when children are static JSX (not from .map())\n}\n\n/**\n * Executes a render function with hooks context\n * @param ctx - The context to use for hooks\n * @param render - The render function to execute\n * @returns The result of the render function\n */\nexport function withHooks<T>(ctx: Ctx, render: () => T): T {\n // Check scene validity before accessing render context\n const scene = ctx.parent instanceof Phaser.Scene ? ctx.parent : ctx.parent.scene\n if (!scene || !scene.sys || !scene.sys.settings.active) {\n // Scene is shutting down, return a safe default\n return null as T\n }\n\n const renderContext = getContextFromParent(ctx.parent)\n\n // Check if render context is shutting down\n if (renderContext.isShutdown()) {\n return null as T\n }\n\n const prev = renderContext.getCurrent()\n const prevModule = _currentCtx\n renderContext.setCurrent(ctx)\n _currentCtx = ctx\n ctx.index = 0\n ctx.effects = []\n const out = render()\n renderContext.setCurrent(prev)\n _currentCtx = prevModule\n return out\n}\n\n/**\n * State hook for managing component state\n * @param initial - Initial state value or initializer function\n * @returns Tuple of current state and setter function\n */\nexport function useState<T>(initial: T): [T, (v: T | ((p: T) => T)) => void] {\n // Get current context from the active render context\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n if (i >= c.slots.length)\n c.slots[i] = typeof initial === 'function' ? (initial as () => T)() : initial\n const value = c.slots[i] as T\n const set = (v: T | ((p: T) => T)) => {\n const next = typeof v === 'function' ? (v as (p: T) => T)(c.slots[i] as T) : v\n if (Object.is(next, c.slots[i])) return\n c.slots[i] = next\n scheduleUpdate(c)\n }\n return [value, set]\n}\n\n/**\n * Ref hook for storing mutable values\n * @param val - Initial ref value\n * @returns Ref object with current property\n */\nexport function useRef<T>(val: T): { current: T } {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n if (i >= c.slots.length) c.slots[i] = { current: val }\n return c.slots[i] as { current: T }\n}\n\n/**\n * Hook to force component re-render when signals change\n * @param signals - Array of signals to watch for changes\n * @param throttleMs - Optional throttle time in milliseconds\n *\n * ⚠️ IMPORTANT: Obey performance, massive redraw could have an effect!\n */\nexport function useForceRedraw(throttleMs: number, ...signals: Signal<unknown>[]): void\nexport function useForceRedraw(...signals: Signal<unknown>[]): void\nexport function useForceRedraw(first: number | Signal<unknown>, ...rest: Signal<unknown>[]): void {\n const [, setForceRedraw] = useState<unknown>(0)\n\n // Check if first parameter is throttle time\n const throttleMs = typeof first === 'number' ? first : undefined\n const signals = typeof first === 'number' ? rest : [first, ...rest]\n\n useEffect(() => {\n const unsubscribes: (() => void)[] = []\n let lastUpdate = 0\n\n const triggerUpdate = () => {\n const now = Date.now()\n if (throttleMs && now - lastUpdate < throttleMs) return\n lastUpdate = now\n setForceRedraw({})\n }\n\n for (const signal of signals) {\n if (signal && typeof signal === 'object' && 'subscribe' in signal) {\n const subscriptions = signal.subscribe(triggerUpdate)\n unsubscribes.push(subscriptions)\n }\n }\n\n return () => {\n unsubscribes.forEach((unsubscribe) => unsubscribe())\n }\n }, [throttleMs, ...signals])\n}\n\n/**\n * Memoization hook for expensive computations\n * @param fn - Function to memoize\n * @param deps - Dependency array\n * @returns Memoized value\n */\nexport function useMemo<T>(fn: () => T, deps: readonly unknown[]): T {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n const slot = (c.slots[i] ?? (c.slots[i] = { deps: undefined, value: undefined as T })) as {\n deps?: readonly unknown[]\n value: T\n }\n if (!depsChanged(slot.deps, deps)) return slot.value\n slot.value = fn()\n slot.deps = deps\n return slot.value\n}\n\n/**\n * Callback memoization hook\n * @param fn - Callback function to memoize\n * @param deps - Dependency array\n * @returns Memoized callback\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCallback<T extends (...args: any[]) => any>(fn: T, deps: readonly unknown[]): T {\n return useMemo(() => fn, deps)\n}\n\n/**\n * Hook to access current theme context\n * Returns the theme that was passed down through the VDOM tree\n * @returns Current theme context or undefined if no theme is set\n */\nexport function useTheme(): PartialTheme | undefined {\n return getCurrent()?.theme\n}\n\n/**\n * Hook to access current Phaser scene\n * Returns the scene from the render context\n * @returns Current Phaser scene\n */\nexport function useScene(): Phaser.Scene {\n const ctx = getCurrent()\n if (!ctx) throw new Error('useScene must be called within a component')\n\n const renderContext = getContextFromParent(ctx.parent)\n return renderContext.scene\n}\n\n/**\n * Effect hook for side effects with cleanup\n * @param fn - Effect function that optionally returns cleanup\n * @param deps - Optional dependency array\n */\nexport function useEffect(fn: () => Cleanup, deps?: readonly unknown[] | undefined) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const c = getCurrent()!\n const i = c.index++\n const slot = (c.slots[i] ??\n (c.slots[i] = { deps: undefined, cleanup: undefined as Cleanup })) as {\n deps?: readonly unknown[] | undefined\n cleanup: Cleanup\n }\n c.effects.push(() => {\n if (!depsChanged(slot.deps, deps)) return\n if (typeof slot.cleanup === 'function') slot.cleanup()\n slot.cleanup = fn()\n if (deps !== undefined) {\n slot.deps = deps\n }\n })\n}\n\n/**\n * Checks if dependency arrays have changed\n * @param a - Previous dependencies\n * @param b - Current dependencies\n * @returns true if changed, false otherwise\n */\nfunction depsChanged(a?: readonly unknown[], b?: readonly unknown[]) {\n if (!a || !b) return true\n if (a.length !== b.length) return true\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) return true\n }\n return false\n}\n\n/**\n * Shallow comparison for props objects\n * Used for component memoization (React.memo equivalent)\n * @param a - Previous props\n * @param b - Current props\n * @returns true if props are shallowly equal\n */\nexport function shallowEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true\n\n // Handle null/undefined\n if (a == null || b == null) return false\n\n // Must both be objects\n if (typeof a !== 'object' || typeof b !== 'object') return false\n\n const keysA = Object.keys(a)\n const keysB = Object.keys(b)\n\n // Different number of keys\n if (keysA.length !== keysB.length) return false\n\n // Check each key\n for (const key of keysA) {\n if (\n !Object.prototype.hasOwnProperty.call(b, key) ||\n !Object.is((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])\n ) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Check if component should update based on props comparison\n * Similar to React.memo() - skips re-render if props haven't changed\n * @param ctx - Component context\n * @param newProps - New props to compare\n * @returns true if component should re-render\n */\nexport function shouldComponentUpdate(ctx: Ctx, newProps: unknown): boolean {\n // Always update if memoization disabled (ctx.memoized = false or __memo = false)\n if (ctx.memoized === false) return true\n\n // Check VNode-level opt-out\n if (ctx.componentVNode.__memo === false) return true\n\n // First render or no previous props\n if (ctx.lastProps === undefined) {\n ctx.lastProps = newProps\n return true\n }\n\n // Compare props (shallow)\n const hasChanged = !shallowEqual(ctx.lastProps, newProps)\n\n // Update stored props\n ctx.lastProps = newProps\n\n return hasChanged\n}\n\n/**\n * Hook to manually trigger a component redraw\n * @returns Function to trigger redraw\n */\nexport function useRedraw(): () => void {\n const c = getCurrent()\n return () => {\n if (c != null) scheduleUpdate(c)\n }\n}\n\n/**\n * Schedules a component update on next microtask\n * @param c - Component context to update\n */\nfunction scheduleUpdate(c: Ctx) {\n if (c.updater) return\n c.updater = () => {\n c.updater = undefined\n\n // Skip update if context has been disposed\n if (c.disposed) {\n return\n }\n\n // Get scene and check if it's still valid\n const scene = c.parent instanceof Phaser.Scene ? c.parent : c.parent.scene\n if (!scene || !scene.sys || !scene.sys.settings.active) {\n // Scene is being shut down or destroyed, skip update\n return\n }\n\n // Use component VNode props, merging with children\n const componentProps = c.componentVNode.props ?? {}\n const propsWithChildren = c.componentVNode.children?.length\n ? { ...componentProps, children: c.componentVNode.children }\n : componentProps\n\n // Render the component to get the new VNode\n const nextVNode = withHooks(c, () => c.function(propsWithChildren))\n\n // Patch the existing rendered tree\n patchVNode(c.parent, c.vnode, nextVNode)\n\n c.vnode = nextVNode\n\n // Run effects after patching\n for (const run of c.effects) run()\n }\n queueMicrotask(c.updater)\n} /**\n * Disposes component context and runs cleanups\n * @param c - Context to dispose\n */\nexport function disposeCtx(c: Ctx) {\n // Mark as disposed to prevent pending updates\n c.disposed = true\n\n // Run all cleanup functions from cleanups array\n for (const cl of c.cleanups) {\n if (typeof cl === 'function') cl()\n }\n\n // Run all cleanup functions from slots (effects)\n for (const slot of c.slots) {\n if (\n slot &&\n typeof slot === 'object' &&\n 'cleanup' in slot &&\n typeof slot.cleanup === 'function'\n ) {\n slot.cleanup()\n }\n }\n\n // Clear cleanups array to prevent duplicate cleanup calls\n c.cleanups.length = 0\n\n // NOTE: We intentionally do NOT clear slots, effects, or updater\n // because the context might still be referenced by pending updates\n // The disposed flag will prevent any queued updates from executing\n}\n\n// SVG texture hooks have been moved to hooks-svg.ts for global texture management\n// Import them from there: import { useSVGTexture, useSVGTextures, type SVGTextureConfig } from './hooks-svg'\n","/**\n * Custom hook for Phaser game object effects (shake, pulse, etc.)\n * Manages multiple concurrent effects with proper cleanup\n */\nimport { useEffect, useRef } from '../hooks'\n\n/**\n * Ref object type\n */\ntype RefObject<T> = { current: T }\n\n/**\n * Effect configuration\n */\nexport interface EffectConfig {\n magnitude?: number\n time?: number\n intensity?: number\n duration?: number\n direction?: 'left' | 'right' | 'up' | 'down'\n angle?: number\n onComplete?: () => void\n}\n\n/**\n * Position state manager for effects that need to track original position\n * Allows multiple position-based effects to run synchronously\n */\ninterface PositionState {\n originalX: number\n originalY: number\n originalAlpha: number\n originalScaleX: number\n originalScaleY: number\n originalRotation: number\n originX: number\n originY: number\n effectCount: number\n scaleOffsetX: number\n scaleOffsetY: number\n rotationOffset: number\n initialized: boolean\n}\n\n/**\n * WeakMap to store position state for game objects\n * This allows multiple effects to share the same position data\n */\nconst positionStates = new WeakMap<Phaser.GameObjects.Container, PositionState>()\n\n/**\n * Get or create position state for a game object\n * @param obj - Game object\n * @returns Position state\n */\nfunction getPositionState(obj: Phaser.GameObjects.Container): PositionState {\n if (!positionStates.has(obj)) {\n positionStates.set(obj, {\n originalX: obj.x,\n originalY: obj.y,\n originalAlpha: obj.alpha,\n originalScaleX: obj.scaleX,\n originalScaleY: obj.scaleY,\n originalRotation: obj.rotation,\n originX: obj.originX ?? 0,\n originY: obj.originY ?? 0,\n effectCount: 0,\n scaleOffsetX: 0,\n scaleOffsetY: 0,\n rotationOffset: 0,\n initialized: false,\n })\n }\n const state = positionStates.get(obj)\n if (!state) {\n throw new Error('Position state not found')\n }\n return state\n}\n\n/**\n * Increment effect count (called when effect starts)\n * Stores original values only on first effect to prevent race conditions\n * @param obj - Game object\n */\nfunction incrementEffectCount(obj: Phaser.GameObjects.Container): void {\n const state = getPositionState(obj)\n\n // Store original values only when first effect starts\n if (state.effectCount === 0 && !state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n state.effectCount++\n}\n\n/**\n * Decrement effect count (called when effect completes)\n * Resets to original position when count reaches 0\n * @param obj - Game object\n */\nfunction decrementEffectCount(obj: Phaser.GameObjects.Container): void {\n const state = getPositionState(obj)\n state.effectCount--\n\n // Reset to original position, scale, alpha and rotation when all effects are done\n if (state.effectCount <= 0) {\n obj.setPosition(state.originalX, state.originalY)\n obj.setScale(state.originalScaleX, state.originalScaleY)\n obj.setAlpha(state.originalAlpha)\n obj.setRotation(state.originalRotation)\n state.effectCount = 0\n state.scaleOffsetX = 0\n state.scaleOffsetY = 0\n state.rotationOffset = 0\n state.initialized = false\n }\n}\n\n/**\n * Calculate position offset for origin-aware scaling\n * @param obj - Game object\n * @param state - Position state\n * @param currentScaleX - Current X scale\n * @param currentScaleY - Current Y scale\n * @returns Position offsets {x, y}\n */\nfunction calculateScaleOffset(\n obj: Phaser.GameObjects.Container,\n state: PositionState,\n currentScaleX: number,\n currentScaleY: number\n): { x: number; y: number } {\n const width = obj.width\n const height = obj.height\n\n // Calculate offset based on origin (default 0,0 = top-left)\n const offsetX = width * (currentScaleX - state.originalScaleX) * state.originX\n const offsetY = height * (currentScaleY - state.originalScaleY) * state.originY\n\n return { x: offsetX, y: offsetY }\n}\n\n/**\n * Apply origin-aware scale to object\n * @param obj - Game object\n * @param state - Position state\n * @param scaleX - Target X scale\n * @param scaleY - Target Y scale\n */\nfunction applyScaleWithOrigin(\n obj: Phaser.GameObjects.Container,\n state: PositionState,\n scaleX: number,\n scaleY: number\n): void {\n const newOffset = calculateScaleOffset(obj, state, scaleX, scaleY)\n\n // Calculate the delta from previous offset to preserve other tween effects\n const deltaX = newOffset.x - state.scaleOffsetX\n const deltaY = newOffset.y - state.scaleOffsetY\n\n state.scaleOffsetX = newOffset.x\n state.scaleOffsetY = newOffset.y\n\n obj.setScale(scaleX, scaleY)\n // Adjust position by delta to preserve other effects (like Float changing Y)\n obj.setPosition(obj.x - deltaX, obj.y - deltaY)\n}\n\n/**\n * Effect callback function\n * @param obj - The Phaser game object to apply effect to\n * @param config - Effect configuration\n */\nexport type EffectFn = (obj: Phaser.GameObjects.Container, config: EffectConfig) => void\n\n/**\n * This is a no-op effect function\n */\nexport const createNoneEffect: EffectFn = () => {\n // nothing to do\n}\n\n/**\n * Create a shake effect\n * @param obj - Game object to shake\n * @param config - Effect config (magnitude, time)\n */\nexport const createShakeEffect: EffectFn = (obj, config) => {\n const { magnitude = 5, time = 200, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseX = state.originalX\n const baseY = state.originalY\n\n scene.tweens.add({\n targets: obj,\n duration: time,\n x: 0, // required for tween to start\n onUpdate: (tween) => {\n // Use tween progress (0 to 1) for decay calculation\n const progress = tween.progress\n const decayFactor = Math.pow(1 - progress, 2)\n const mag = magnitude * decayFactor\n\n // Apply shake relative to original position, considering scale offset\n const newX = baseX + Phaser.Math.Between(-mag, mag) - state.scaleOffsetX\n const newY = baseY + Phaser.Math.Between(-mag, mag) - state.scaleOffsetY\n obj.setPosition(newX, newY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a pulse effect (scale animation)\n * @param obj - Game object to pulse\n * @param config - Effect config (intensity, time)\n */\nexport const createPulseEffect: EffectFn = (obj, config) => {\n const { intensity = 1.2, time = 300, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time / 2,\n ease: 'Quad.easeOut',\n yoyo: true,\n repeat: 0,\n onUpdate: () => {\n // Use helper function for origin-aware scaling\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a fade effect\n * @param obj - Game object to fade\n * @param config - Effect config (time, duration)\n */\nexport const createFadeEffect: EffectFn = (obj, config) => {\n const { time = 300, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const originalAlpha = state.originalAlpha\n\n scene.tweens.add({\n targets: obj,\n alpha: originalAlpha * 0.5,\n duration: time / 2,\n ease: 'Quad.easeInOut',\n yoyo: true,\n repeat: 0,\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a fade-in effect (alpha from 0 to original)\n * @param obj - Game object to fade in\n * @param config - Effect config (time)\n */\nexport const createFadeInEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetAlpha = state.originalAlpha\n\n obj.setAlpha(0)\n\n scene.tweens.add({\n targets: obj,\n alpha: targetAlpha,\n duration: time,\n ease: 'Quad.easeOut',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a fade-out effect (alpha from original to 0)\n * @param obj - Game object to fade out\n * @param config - Effect config (time)\n */\nexport const createFadeOutEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n incrementEffectCount(obj)\n\n const scene = obj.scene\n\n scene.tweens.add({\n targets: obj,\n alpha: 0,\n duration: time,\n ease: 'Quad.easeIn',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a bounce effect (elastic bounce feedback)\n * @param obj - Game object to bounce\n * @param config - Effect config (intensity, time)\n */\nexport const createBounceEffect: EffectFn = (obj, config) => {\n const { intensity = 1.3, time = 600, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time,\n ease: 'Elastic.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a flash effect (quick scale pulse for visibility)\n * @param obj - Game object to flash\n * @param config - Effect config (time, intensity)\n */\nexport const createFlashEffect: EffectFn = (obj, config) => {\n const { time = 200, intensity = 1.15, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time / 2,\n ease: 'Quad.easeOut',\n yoyo: true,\n repeat: 0,\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a wobble effect (rotation-based shake)\n * @param obj - Game object to wobble\n * @param config - Effect config (magnitude, time)\n */\nexport const createWobbleEffect: EffectFn = (obj, config) => {\n const { magnitude = 0.1, time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + magnitude,\n duration: time / 4,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 1,\n onComplete: () => {\n obj.setRotation(baseRotation)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a jello effect (squash & stretch)\n * @param obj - Game object for jello effect\n * @param config - Effect config (intensity, time)\n */\nexport const createJelloEffect: EffectFn = (obj, config) => {\n const { intensity = 0.15, time = 600, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseScaleX = state.originalScaleX\n const baseScaleY = state.originalScaleY\n\n let step = 0\n const steps = [\n { scaleX: baseScaleX * (1 + intensity), scaleY: baseScaleY * (1 - intensity * 0.5) },\n { scaleX: baseScaleX * (1 - intensity * 0.5), scaleY: baseScaleY * (1 + intensity) },\n { scaleX: baseScaleX * (1 + intensity * 0.3), scaleY: baseScaleY * (1 - intensity * 0.3) },\n { scaleX: baseScaleX, scaleY: baseScaleY },\n ]\n\n const runStep = () => {\n if (step >= steps.length) {\n decrementEffectCount(obj)\n userOnComplete?.()\n return\n }\n\n const currentStep = steps[step]\n if (!currentStep) return\n\n scene.tweens.add({\n targets: obj,\n scaleX: currentStep.scaleX,\n scaleY: currentStep.scaleY,\n duration: time / steps.length,\n ease: 'Sine.easeInOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n step++\n runStep()\n },\n })\n }\n\n runStep()\n}\n\n/**\n * Create a press effect (scale down + bounce back, like button press)\n * @param obj - Game object to press\n * @param config - Effect config (intensity, time)\n */\nexport const createPressEffect: EffectFn = (obj, config) => {\n const { intensity = 0.9, time = 200, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time / 2,\n ease: 'Quad.easeIn',\n yoyo: true,\n repeat: 0,\n easeReturn: 'Back.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a tada effect (attention grabber with scale + rotation)\n * @param obj - Game object for tada effect\n * @param config - Effect config (intensity, time)\n */\nexport const createTadaEffect: EffectFn = (obj, config) => {\n const { intensity = 1.1, time = 600, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n const baseScaleX = state.originalScaleX\n const baseScaleY = state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + 0.05,\n scaleX: intensity * baseScaleX,\n scaleY: intensity * baseScaleY,\n duration: time / 6,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 2,\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n obj.setRotation(baseRotation)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a swing effect (pendulum animation)\n * @param obj - Game object to swing\n * @param config - Effect config (magnitude, time)\n */\nexport const createSwingEffect: EffectFn = (obj, config) => {\n const { magnitude = 0.15, time = 800, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + magnitude,\n duration: time / 4,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 1,\n onComplete: () => {\n obj.setRotation(baseRotation)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a wiggle effect (gentle horizontal shake)\n * @param obj - Game object to wiggle\n * @param config - Effect config (magnitude, time)\n */\nexport const createWiggleEffect: EffectFn = (obj, config) => {\n const { magnitude = 3, time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const baseX = state.originalX\n\n scene.tweens.add({\n targets: obj,\n x: baseX + magnitude,\n duration: time / 6,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: 2,\n onComplete: () => {\n obj.setPosition(baseX, state.originalY)\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a slide-in effect\n * @param obj - Game object to slide in\n * @param config - Effect config (direction, time)\n */\nexport const createSlideInEffect: EffectFn = (obj, config) => {\n const { direction = 'left', time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetX = state.originalX\n const targetY = state.originalY\n\n // Calculate start position based on direction\n let startX = targetX\n let startY = targetY\n const distance = 200\n\n switch (direction) {\n case 'left':\n startX = targetX - distance\n break\n case 'right':\n startX = targetX + distance\n break\n case 'up':\n startY = targetY - distance\n break\n case 'down':\n startY = targetY + distance\n break\n }\n\n obj.setPosition(startX, startY)\n\n scene.tweens.add({\n targets: obj,\n x: targetX,\n y: targetY,\n duration: time,\n ease: 'Quad.easeOut',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a slide-out effect\n * @param obj - Game object to slide out\n * @param config - Effect config (direction, time)\n */\nexport const createSlideOutEffect: EffectFn = (obj, config) => {\n const { direction = 'right', time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const startX = state.originalX\n const startY = state.originalY\n const distance = 200\n\n // Calculate target position based on direction\n let targetX = startX\n let targetY = startY\n\n switch (direction) {\n case 'left':\n targetX = startX - distance\n break\n case 'right':\n targetX = startX + distance\n break\n case 'up':\n targetY = startY - distance\n break\n case 'down':\n targetY = startY + distance\n break\n }\n\n scene.tweens.add({\n targets: obj,\n x: targetX,\n y: targetY,\n duration: time,\n ease: 'Quad.easeIn',\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a zoom-in effect (scale from 0 to 1)\n * @param obj - Game object to zoom in\n * @param config - Effect config (time)\n */\nexport const createZoomInEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = state.originalScaleX\n const targetScaleY = state.originalScaleY\n\n obj.setScale(0, 0)\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time,\n ease: 'Back.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a zoom-out effect (scale from 1 to 0)\n * @param obj - Game object to zoom out\n * @param config - Effect config (time)\n */\nexport const createZoomOutEffect: EffectFn = (obj, config) => {\n const { time = 400, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n\n scene.tweens.add({\n targets: obj,\n scaleX: 0,\n scaleY: 0,\n duration: time,\n ease: 'Back.easeIn',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a flip-in effect (3D flip from edge)\n * @param obj - Game object to flip in\n * @param config - Effect config (time)\n */\nexport const createFlipInEffect: EffectFn = (obj, config) => {\n const { time = 500, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n const targetScaleX = state.originalScaleX\n\n obj.setScale(0, state.originalScaleY)\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n duration: time,\n ease: 'Back.easeOut',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a flip-out effect (3D flip to edge)\n * @param obj - Game object to flip out\n * @param config - Effect config (time)\n */\nexport const createFlipOutEffect: EffectFn = (obj, config) => {\n const { time = 500, onComplete: userOnComplete } = config\n\n const state = getPositionState(obj)\n incrementEffectCount(obj)\n\n const scene = obj.scene\n\n scene.tweens.add({\n targets: obj,\n scaleX: 0,\n duration: time,\n ease: 'Back.easeIn',\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n onComplete: () => {\n decrementEffectCount(obj)\n userOnComplete?.()\n },\n })\n}\n\n/**\n * Create a float effect (gentle up/down motion, for idle items)\n * @param obj - Game object to float\n * @param config - Effect config (magnitude, time)\n */\nexport const createFloatEffect: EffectFn = (obj, config) => {\n const { magnitude = 10, time = 2000 } = config\n\n const state = getPositionState(obj)\n // Initialize original values if not done yet (without incrementing count)\n if (!state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n const scene = obj.scene\n const baseY = state.originalY\n\n scene.tweens.add({\n targets: obj,\n y: baseY - magnitude,\n duration: time,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: -1, // infinite loop\n onUpdate: () => {\n // Keep x position stable, considering scale offset\n obj.setX(state.originalX - state.scaleOffsetX)\n },\n })\n\n // Note: For infinite effects, user must manually stop tween or unmount component\n}\n\n/**\n * Create a breathe effect (slow pulsing for idle/important objects)\n * @param obj - Game object to breathe\n * @param config - Effect config (intensity, time)\n */\nexport const createBreatheEffect: EffectFn = (obj, config) => {\n const { intensity = 1.05, time = 2000 } = config\n\n const state = getPositionState(obj)\n // Initialize original values if not done yet (without incrementing count)\n if (!state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n const scene = obj.scene\n const targetScaleX = intensity * state.originalScaleX\n const targetScaleY = intensity * state.originalScaleY\n\n scene.tweens.add({\n targets: obj,\n scaleX: targetScaleX,\n scaleY: targetScaleY,\n duration: time,\n ease: 'Sine.easeInOut',\n yoyo: true,\n repeat: -1, // infinite loop\n onUpdate: () => {\n applyScaleWithOrigin(obj, state, obj.scaleX, obj.scaleY)\n },\n })\n\n // Note: For infinite effects, user must manually stop tween or unmount component\n}\n\n/**\n * Create a spin effect (continuous rotation)\n * @param obj - Game object to spin\n * @param config - Effect config (time for one full rotation)\n */\nexport const createSpinEffect: EffectFn = (obj, config) => {\n const { time = 2000 } = config\n\n const state = getPositionState(obj)\n // Initialize original values if not done yet (without incrementing count)\n if (!state.initialized) {\n state.originalX = obj.x\n state.originalY = obj.y\n state.originalAlpha = obj.alpha\n state.originalScaleX = obj.scaleX\n state.originalScaleY = obj.scaleY\n state.originalRotation = obj.rotation\n state.originX = obj.originX ?? 0\n state.originY = obj.originY ?? 0\n state.initialized = true\n }\n\n const scene = obj.scene\n const baseRotation = state.originalRotation\n\n scene.tweens.add({\n targets: obj,\n rotation: baseRotation + Math.PI * 2,\n duration: time,\n ease: 'Linear',\n repeat: -1, // infinite loop\n })\n\n // Note: For infinite effects, user must manually stop tween or unmount component\n}\n\n/**\n * Hook for applying effects to game objects\n * Handles cleanup of tweens on unmount\n * @param ref - RefObject pointing to a Phaser game object\n * @returns Function to trigger effects\n */\nexport function useGameObjectEffect(ref: RefObject<Phaser.GameObjects.Container | null>) {\n const tweenIdsRef = useRef<Phaser.Tweens.Tween[]>([])\n\n /**\n * Apply an effect to the game object\n * @param effect - Effect function to apply\n * @param config - Effect configuration\n */\n const applyEffect = (effect: EffectFn, config: EffectConfig = {}) => {\n if (!ref.current) return\n\n // Store tween reference for cleanup\n const scene = ref.current.scene\n const tweenCountBefore = scene.tweens.getTweensOf(ref.current).length\n\n effect(ref.current, config)\n\n const tweenCountAfter = scene.tweens.getTweensOf(ref.current).length\n if (tweenCountAfter > tweenCountBefore) {\n const newTweens = scene.tweens.getTweensOf(ref.current).slice(tweenCountBefore)\n tweenIdsRef.current.push(...newTweens)\n }\n }\n\n /**\n * Stop all active effects/tweens\n */\n const stopEffects = () => {\n if (!ref.current) return\n\n const scene = ref.current.scene\n const tweens = scene.tweens.getTweensOf(ref.current)\n\n tweens.forEach((tween: Phaser.Tweens.Tween) => {\n if (!tween.isDestroyed()) {\n tween.stop()\n tween.remove()\n }\n })\n\n tweenIdsRef.current = []\n\n // Reset to original state if there's a state\n const obj = ref.current\n if (positionStates.has(obj)) {\n const state = positionStates.get(obj)\n if (state) {\n obj.setPosition(state.originalX, state.originalY)\n obj.setScale(state.originalScaleX, state.originalScaleY)\n obj.setAlpha(state.originalAlpha)\n obj.setRotation(state.originalRotation)\n state.effectCount = 0\n state.scaleOffsetX = 0\n state.scaleOffsetY = 0\n state.rotationOffset = 0\n state.initialized = false\n }\n }\n }\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n tweenIdsRef.current.forEach((tween) => {\n if (!tween.isDestroyed()) {\n tween.stop()\n }\n })\n tweenIdsRef.current = []\n }\n }, [])\n\n return { applyEffect, stopEffects }\n}\n","/**\n * Effect Repository - Centralized effect configuration and application\n * Provides reusable effect system for any component\n *\n * @example\n * ```typescript\n * // In component props/theme\n * interface MyComponentProps extends EffectDefinition {\n * // ... other props\n * }\n *\n * // In component implementation\n * const { applyEffect } = useGameObjectEffect(ref)\n * const resolved = resolveEffect(props, theme)\n * applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n * ```\n */\nimport {\n createBounceEffect,\n createBreatheEffect,\n createFadeEffect,\n createFadeInEffect,\n createFadeOutEffect,\n createFlashEffect,\n createFlipInEffect,\n createFlipOutEffect,\n createFloatEffect,\n createJelloEffect,\n createNoneEffect,\n createPressEffect,\n createPulseEffect,\n createShakeEffect,\n createSlideInEffect,\n createSlideOutEffect,\n createSpinEffect,\n createSwingEffect,\n createTadaEffect,\n createWiggleEffect,\n createWobbleEffect,\n createZoomInEffect,\n createZoomOutEffect,\n type EffectConfig,\n type EffectFn,\n} from './use-effect'\n\n/**\n * Built-in effect names\n */\nexport type BuiltInEffectName =\n | 'none'\n | 'pulse'\n | 'shake'\n | 'bounce'\n | 'press'\n | 'flash'\n | 'jello'\n | 'fade'\n | 'fadeIn'\n | 'fadeOut'\n | 'wobble'\n | 'tada'\n | 'swing'\n | 'wiggle'\n | 'slideIn'\n | 'slideOut'\n | 'zoomIn'\n | 'zoomOut'\n | 'flipIn'\n | 'flipOut'\n | 'float'\n | 'breathe'\n | 'spin'\n\n/**\n * Extension point for custom effect names\n * Use declaration merging to add custom effects:\n * @example\n * ```typescript\n * declare module '@number10/phaserjsx' {\n * interface EffectNameExtensions {\n * myCustom: 'myCustom'\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface EffectNameExtensions {}\n\n/**\n * Available effect names (built-in + extensions)\n */\nexport type EffectName =\n | BuiltInEffectName\n | (keyof EffectNameExtensions extends never ? never : keyof EffectNameExtensions)\n\n/**\n * Effect configuration with name and config\n */\nexport interface EffectDefinition {\n effect?: EffectName\n effectConfig?: EffectConfig\n}\n\n/**\n * Map of effect names to effect functions\n */\nexport const EFFECT_REGISTRY: Record<BuiltInEffectName, EffectFn | null> = {\n none: createNoneEffect,\n pulse: createPulseEffect,\n shake: createShakeEffect,\n bounce: createBounceEffect,\n press: createPressEffect,\n flash: createFlashEffect,\n jello: createJelloEffect,\n fade: createFadeEffect,\n fadeIn: createFadeInEffect,\n fadeOut: createFadeOutEffect,\n wobble: createWobbleEffect,\n tada: createTadaEffect,\n swing: createSwingEffect,\n wiggle: createWiggleEffect,\n slideIn: createSlideInEffect,\n slideOut: createSlideOutEffect,\n zoomIn: createZoomInEffect,\n zoomOut: createZoomOutEffect,\n flipIn: createFlipInEffect,\n flipOut: createFlipOutEffect,\n float: createFloatEffect,\n breathe: createBreatheEffect,\n spin: createSpinEffect,\n}\n\n/**\n * Default effect configuration\n */\nexport const DEFAULT_EFFECT: Required<EffectDefinition> = {\n effect: 'pulse',\n effectConfig: { intensity: 1.1, time: 100 },\n}\n\n/**\n * Apply an effect by name with configuration\n * @param applyEffect - The applyEffect function from useGameObjectEffect hook\n * @param effectName - Name of the effect to apply\n * @param effectConfig - Optional configuration for the effect\n * @returns true if effect was applied, false otherwise\n */\nexport function applyEffectByName(\n applyEffect: (effect: EffectFn, config?: EffectConfig) => void,\n effectName?: EffectName,\n effectConfig?: EffectConfig\n): boolean {\n const name = effectName ?? DEFAULT_EFFECT.effect\n const config = effectConfig ?? DEFAULT_EFFECT.effectConfig\n const effectFn = EFFECT_REGISTRY[name]\n\n if (effectFn) {\n applyEffect(effectFn, config)\n return true\n }\n\n return false\n}\n\n/**\n * Resolve effect definition with priority: props > theme > default\n * @param props - Props-level effect definition\n * @param theme - Theme-level effect definition\n * @returns Resolved effect definition\n */\nexport function resolveEffect(\n props?: EffectDefinition,\n theme?: EffectDefinition\n): Required<EffectDefinition> {\n return {\n effect: props?.effect ?? theme?.effect ?? DEFAULT_EFFECT.effect,\n effectConfig: props?.effectConfig ?? theme?.effectConfig ?? DEFAULT_EFFECT.effectConfig,\n }\n}\n","/** @jsxImportSource ../.. */\n/**\n * Generic Button component with variant and size support\n * Icon-agnostic - accepts children or content slots\n */\nimport type { ViewProps } from '..'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useRef } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport { View } from '../index'\n\n/**\n * Button variant theme\n */\nexport type ButtonVariantTheme = ViewTheme & EffectDefinition\nexport type ButtonVariant = 'primary' | 'secondary' | 'outline'\nexport type ButtonSize = 'small' | 'medium' | 'large'\n/**\n * Props for Button component\n */\nexport interface ButtonProps extends ViewProps, EffectDefinition {\n /** Button content - can be text, icons, or any JSX */\n children?: ChildrenType | undefined\n /** Click handler */\n onClick?: (() => void) | undefined\n /** Disabled state */\n disabled?: boolean | undefined\n /** Visual variant */\n variant?: ButtonVariant | undefined\n /** Size variant */\n size?: ButtonSize | undefined\n}\n\n/**\n * Generic Button component\n * Provides variant, size, and disabled state support\n * Content is fully customizable via children prop\n *\n * @example\n * ```tsx\n * <Button variant=\"primary\" onClick={() => console.log('clicked')}>\n * Click me\n * </Button>\n *\n * <Button variant=\"outline\" size=\"small\">\n * <Icon type=\"check\" />\n * <Text text=\"Confirm\" />\n * </Button>\n * ```\n */\nexport function Button(props: ButtonProps) {\n const { children, onClick, disabled, variant, size, width, height, ...restProps } = props\n const { props: themed } = getThemedProps('Button', undefined, {})\n const ref = useRef<Phaser.GameObjects.Container | null>(null)\n\n // Setup effect system\n const { applyEffect } = useGameObjectEffect(ref)\n\n // Cast to ButtonVariantTheme for proper access to nested themes\n const themedButton = themed as unknown as ButtonVariantTheme & {\n primary?: ButtonVariantTheme\n secondary?: ButtonVariantTheme\n outline?: ButtonVariantTheme\n small?: ButtonVariantTheme\n medium?: ButtonVariantTheme\n large?: ButtonVariantTheme\n disabledColor?: number\n }\n\n // Merge base theme with variant and size overrides\n let variantTheme = { ...themedButton }\n if (variant && themedButton[variant as keyof typeof themedButton]) {\n const variantOverrides = themedButton[\n variant as keyof typeof themedButton\n ] as ButtonVariantTheme\n variantTheme = { ...variantTheme, ...variantOverrides }\n }\n\n let sizeTheme = { ...variantTheme }\n if (size && themedButton[size as keyof typeof themedButton]) {\n const sizeOverrides = themedButton[size as keyof typeof themedButton] as ButtonVariantTheme\n sizeTheme = { ...sizeTheme, ...sizeOverrides }\n }\n\n // Apply disabled state styling\n const effectiveTheme = disabled\n ? {\n ...sizeTheme,\n backgroundColor: themedButton.disabledColor ?? sizeTheme?.backgroundColor,\n alpha: 0.5,\n }\n : sizeTheme\n\n const handleTouch = !disabled\n ? () => {\n // Apply effect: props override theme, theme overrides default\n const resolved = resolveEffect(props, themed as ButtonVariantTheme)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n onClick?.()\n }\n : undefined\n\n // Filter out non-View props from theme\n const {\n disabledColor: _disabledColor,\n effect: _effect,\n effectConfig: _effectConfig,\n primary: _primary,\n secondary: _secondary,\n outline: _outline,\n small: _small,\n medium: _medium,\n large: _large,\n ...viewThemeProps\n } = effectiveTheme as ButtonVariantTheme & {\n disabledColor?: number\n primary?: unknown\n secondary?: unknown\n outline?: unknown\n small?: unknown\n medium?: unknown\n large?: unknown\n }\n\n return (\n <View\n ref={ref}\n width={width}\n height={height}\n enableGestures={!disabled}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n {...(handleTouch && { onTouch: handleTouch })}\n {...viewThemeProps}\n {...restProps}\n >\n {children}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * RadioButton component - Selectable option with circle indicator and label\n */\nimport { getThemedProps } from '../../theme'\nimport { Text, View } from '../index'\n\n/**\n * Props for RadioButton component\n */\nexport interface RadioButtonProps {\n /** Unique key for VDOM identification */\n key?: string | number | undefined\n /** Label text for the radio button */\n label: string\n /** Whether this radio button is selected */\n selected?: boolean\n /** Callback when radio button is clicked */\n onClick?: () => void\n}\n\n/**\n * RadioButton component - displays a selectable circle with label\n * @param props - RadioButton properties\n * @returns RadioButton JSX element\n */\nexport function RadioButton(props: RadioButtonProps) {\n const { props: themed, nestedTheme } = getThemedProps('RadioButton', undefined, {})\n const size = themed.size ?? 16\n const innerSize = themed.innerSize ?? size * 0.75\n const innerRadius = innerSize * 0.5\n const outerRadius = size * 0.5\n\n return (\n <View\n key={props.key}\n direction=\"row\"\n alignItems=\"center\"\n enableGestures={true}\n onTouch={() => props.onClick?.()}\n theme={nestedTheme}\n gap={themed.gap}\n >\n <View\n width={size}\n height={size}\n backgroundColor={themed.color}\n alignItems=\"center\"\n justifyContent=\"center\"\n backgroundAlpha={1.0}\n padding={0}\n cornerRadius={outerRadius}\n >\n <View\n width={innerSize}\n height={innerSize}\n backgroundColor={themed.selectedColor}\n visible={props.selected ?? false}\n cornerRadius={innerRadius}\n />\n </View>\n\n <Text text={props.label} style={themed.labelStyle} />\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * RadioGroup component - Manages a group of radio buttons with single-selection logic\n */\n\nimport { useState } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport { Text, View } from '../index'\n\n// import { getThemedProps, Text, useState, View } from '@number10/phaserjsx'\n\n/**\n * Option item for RadioGroup\n */\nexport interface RadioGroupOption {\n /** Unique value for this option */\n value: string\n /** Display label for this option */\n label: string\n}\n\n/**\n * Props for RadioGroup component\n */\nexport interface RadioGroupProps {\n /** Array of options to display */\n options: RadioGroupOption[]\n /** Currently selected value */\n value?: string\n /** Callback when selection changes */\n onChange?: (value: string) => void\n /** Layout direction (default: 'column') */\n direction?: 'row' | 'column'\n}\n\n/**\n * RadioGroup component - displays a group of radio buttons with single-selection\n * @param props - RadioGroup properties\n * @returns RadioGroup JSX element\n */\nexport function RadioGroup(props: RadioGroupProps) {\n const { props: themed, nestedTheme } = getThemedProps('RadioButton', undefined, {})\n\n const [selected, setSelected] = useState<string>(props.value ?? '')\n\n const handleSelect = (value: string) => {\n setSelected(value)\n props.onChange?.(value)\n }\n\n return (\n <View direction={props.direction ?? 'column'} theme={nestedTheme} gap={themed.gap}>\n {props.options.map((option) => {\n const isSelected = selected === option.value\n\n const size = themed.size ?? 16\n const innerSize = themed.innerSize ?? size * 0.75\n const innerRadius = innerSize * 0.5\n const outerRadius = size * 0.5\n\n return (\n <View\n key={option.value}\n direction=\"row\"\n gap={themed.gap}\n alignItems=\"center\"\n enableGestures={true}\n onTouch={() => handleSelect(option.value)}\n >\n <View\n width={size}\n height={size}\n backgroundColor={themed.color}\n alignItems=\"center\"\n justifyContent=\"center\"\n backgroundAlpha={1.0}\n padding={0}\n cornerRadius={outerRadius}\n >\n <View\n width={innerSize}\n height={innerSize}\n backgroundColor={themed.selectedColor}\n visible={isSelected}\n cornerRadius={innerRadius}\n />\n </View>\n <Text text={option.label} style={themed.labelStyle} />\n </View>\n )\n })}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Text component wrapper - strict type-safe wrapper around primitive text\n * This component is the public API for Text, with controlled prop interface\n */\nimport type Phaser from 'phaser'\nimport type { EdgeInsets, PhaserProps, TextSpecificProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\n\n/**\n * Props for Text component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface TextProps\n extends Omit<TransformProps, 'scaleX' | 'scaleY' | 'scale' | 'rotation'>,\n PhaserProps,\n TextSpecificProps,\n PropsDefaultExtension<Phaser.GameObjects.Text> {\n /** Children are not supported for Text component */\n children?: ChildrenType\n /** Margin for layout system */\n margin?: EdgeInsets\n /** Legacy Phaser style object */\n style?: Phaser.Types.GameObjects.Text.TextStyle | undefined\n}\n\n/**\n * Text component\n * Renders text with full styling support\n *\n * @example\n * ```tsx\n * <Text text=\"Hello World\" />\n * ```\n */\nexport function Text(props: TextProps) {\n const localTheme = useTheme()\n // Cast props to any for getThemedProps to handle optional style prop\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('Text', localTheme, props as any)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <text {...themed} theme={nestedTheme} />\n}\n","/**\n * Built-in component implementations\n * Exports creators, patchers, props and registration function for all components\n */\nimport { register } from '../host'\nimport { graphicsCreator, graphicsPatcher } from './primitives/graphics'\nimport { imageCreator, imagePatcher } from './primitives/image'\nimport { nineSliceCreator, nineSlicePatcher } from './primitives/nineslice'\nimport { spriteCreator, spritePatcher } from './primitives/sprite'\nimport { textCreator, textPatcher } from './primitives/text'\nimport { tileSpriteCreator, tileSpritePatcher } from './primitives/tilesprite'\nimport { viewCreator, viewPatcher } from './primitives/view'\n\n/**\n * Component type constants for JSX usage (legacy primitives)\n * Note: Image and NineSlice constants removed to avoid conflicts with custom components\n * Use lowercase primitives or import wrappers from custom\n */\nexport const Sprite = 'Sprite' as const\nexport const Graphics = 'Graphics' as const\nexport const TileSprite = 'TileSprite' as const\n\n/**\n * Registers all built-in components with the host\n * This should be called during library initialization\n * Note: TileSprite is currently dummy (throws on use)\n */\nexport function registerBuiltins() {\n // Register primitives (lowercase) - internal use\n register('view' as 'View', { create: viewCreator, patch: viewPatcher })\n register('text' as 'Text', { create: textCreator, patch: textPatcher })\n register('nineslice' as 'NineSlice', { create: nineSliceCreator, patch: nineSlicePatcher })\n register('sprite' as 'Sprite', { create: spriteCreator, patch: spritePatcher })\n register('image' as 'Image', { create: imageCreator, patch: imagePatcher })\n register('graphics' as 'Graphics', { create: graphicsCreator, patch: graphicsPatcher })\n register('tilesprite' as 'TileSprite', { create: tileSpriteCreator, patch: tileSpritePatcher })\n\n // Register uppercase variants for backward compatibility\n register('View', { create: viewCreator, patch: viewPatcher })\n register('Text', { create: textCreator, patch: textPatcher })\n register('NineSlice', { create: nineSliceCreator, patch: nineSlicePatcher })\n register('Sprite', { create: spriteCreator, patch: spritePatcher })\n register('Image', { create: imageCreator, patch: imagePatcher })\n register('Graphics', { create: graphicsCreator, patch: graphicsPatcher })\n register('TileSprite', { create: tileSpriteCreator, patch: tileSpritePatcher })\n\n // Register internal SceneWrapper component (for mountJSX auto-sizing)\n // SceneWrapper is a function component, not a primitive, so it doesn't need creators\n // It will be handled by the function component path in mount()\n}\n\n// Re-export layout types\nexport { type LayoutSize } from './../layout/types'\n\n// Re-export custom components (public API)\nexport { Button, type ButtonProps } from './custom/Button'\nexport { RadioButton, type RadioButtonProps } from './custom/RadioButton'\nexport { RadioGroup, type RadioGroupOption, type RadioGroupProps } from './custom/RadioGroup'\nexport { Text, type TextProps } from './custom/Text'\nexport { View, type ViewProps } from './custom/View'\n\n// Re-export primitive creators/patchers for advanced use cases\nexport { textCreator, textPatcher, type TextBaseProps } from './primitives/text'\nexport { viewCreator, viewPatcher, type ViewBaseProps } from './primitives/view'\n\n// Re-export NineSlice primitive (internal use only - prefer custom wrapper)\nexport {\n nineSliceCreator,\n nineSlicePatcher,\n type NineSliceBaseProps,\n type NineSliceInnerBounds,\n type NineSlicePrimitiveProps,\n type NineSliceRef,\n} from './primitives/nineslice'\n\n// Re-export Sprite component (dummy, no wrapper yet)\nexport {\n spriteCreator,\n spritePatcher,\n type SpriteBaseProps,\n type SpriteProps,\n} from './primitives/sprite'\n\n// Re-export Image component (dummy, no wrapper yet)\nexport {\n imageCreator,\n imagePatcher,\n type ImageBaseProps,\n type ImagePrimitiveProps,\n} from './primitives/image'\n\n// Re-export Graphics component (no wrapper yet)\nexport {\n graphicsCreator,\n graphicsPatcher,\n type GraphicsBaseProps,\n type GraphicsProps,\n} from './primitives/graphics'\n\n// Re-export TileSprite component (dummy, no wrapper yet)\nexport {\n tileSpriteCreator,\n tileSpritePatcher,\n type TileSpriteBaseProps,\n type TileSpriteProps,\n} from './primitives/tilesprite'\n","/**\n * SVG to Phaser Texture Utilities\n * Provides conversion from SVG strings/URLs to Phaser texture resources\n */\nimport type Phaser from 'phaser'\n\n/**\n * Preprocesses SVG string to ensure tinting works correctly\n * Replaces fill=\"currentColor\" and other color fills with white (#FFFFFF)\n * This allows Phaser's tint to work multiplicatively (white × tint = tint color)\n * @param svg - Raw SVG string\n * @returns Preprocessed SVG string with white fills\n */\nfunction preprocessSvgForTinting(svg: string): string {\n return (\n svg\n // Replace fill=\"currentColor\" with fill=\"#FFFFFF\"\n .replace(/fill=\"currentColor\"/gi, 'fill=\"#FFFFFF\"')\n // Replace fill='currentColor' with fill='#FFFFFF'\n .replace(/fill='currentColor'/gi, \"fill='#FFFFFF'\")\n // Replace fill:currentColor in style attributes\n .replace(/fill:\\s*currentColor/gi, 'fill: #FFFFFF')\n // Replace black fills (common fallback)\n .replace(/fill=\"#000000\"/gi, 'fill=\"#FFFFFF\"')\n .replace(/fill=\"#000\"/gi, 'fill=\"#FFFFFF\"')\n .replace(/fill='#000000'/gi, \"fill='#FFFFFF'\")\n .replace(/fill='#000'/gi, \"fill='#FFFFFF'\")\n )\n}\n\n/**\n * Converts an SVG (string or URL) into a Phaser texture\n *\n * Supports multiple input formats:\n * - Raw SVG string (must start with '<svg')\n * - data:image/svg+xml URL\n * - External URL (http/https)\n *\n * The function creates a canvas element, renders the SVG at the specified dimensions,\n * and registers it as a Phaser texture. If a texture with the same key already exists,\n * it will be replaced.\n *\n * @param scene - Phaser scene instance\n * @param key - Unique texture key for registration\n * @param svgOrUrl - SVG string or URL\n * @param width - Desired texture width in pixels (default: 32)\n * @param height - Desired texture height in pixels (default: 32)\n * @throws {Error} If SVG loading or canvas rendering fails\n * @example\n * ```typescript\n * // Raw SVG string\n * await svgToTexture(scene, 'my-icon', '<svg>...</svg>', 64, 64)\n *\n * // URL\n * await svgToTexture(scene, 'external-icon', 'https://example.com/icon.svg')\n * ```\n */\nexport async function svgToTexture(\n scene: Phaser.Scene,\n key: string,\n svgOrUrl: string,\n width: number = 32,\n height: number = 32\n): Promise<void> {\n const trimmed = svgOrUrl.trim()\n let finalUrl: string\n let shouldRevokeUrl = false\n\n // Detect input type: raw SVG string or URL\n if (trimmed.startsWith('<svg')) {\n // Raw SVG string - preprocess for tinting, then create blob URL\n const processedSvg = preprocessSvgForTinting(trimmed)\n const blob = new Blob([processedSvg], { type: 'image/svg+xml' })\n finalUrl = URL.createObjectURL(blob)\n shouldRevokeUrl = true\n } else {\n // Already a URL (data: or http/https)\n finalUrl = svgOrUrl\n }\n\n // Load SVG as HTMLImageElement\n const img = await new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image()\n image.crossOrigin = 'anonymous'\n image.onload = () => resolve(image)\n image.onerror = () => reject(new Error(`Failed to load SVG: ${key}`))\n image.src = finalUrl\n })\n\n // Create canvas and render scaled SVG\n const canvas = document.createElement('canvas')\n canvas.width = width\n canvas.height = height\n\n const ctx = canvas.getContext('2d')\n if (!ctx) {\n throw new Error('Failed to get canvas 2D context')\n }\n\n ctx.clearRect(0, 0, width, height)\n ctx.drawImage(img, 0, 0, width, height)\n\n // Remove existing texture if present\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n\n // Register canvas as Phaser texture\n scene.textures.addCanvas(key, canvas)\n\n // Cleanup blob URL after canvas is added\n if (shouldRevokeUrl) {\n URL.revokeObjectURL(finalUrl)\n }\n\n // Force texture refresh to ensure GL texture is created\n const texture = scene.textures.get(key)\n if (texture && texture.source[0]) {\n texture.source[0].update()\n }\n}\n","/**\n * Texture Registry for managing SVG texture loading and reference counting\n * Prevents race conditions when multiple components request the same texture\n */\nimport type Phaser from 'phaser'\nimport { svgToTexture } from './svg-texture'\n\ninterface TextureRequest {\n key: string\n svg: string\n width: number\n height: number\n}\n\ninterface TextureEntry {\n refCount: number\n promise: Promise<void> | null\n loaded: boolean\n}\n\n/**\n * Global texture registry to manage texture loading and cleanup\n * Uses reference counting per scene to ensure textures are only removed when no longer needed\n */\nclass TextureRegistry {\n // Map of scene -> textures in that scene\n private sceneTextures = new Map<Phaser.Scene, Map<string, TextureEntry>>()\n\n /**\n * Get or create texture map for a scene\n */\n private getTextureMap(scene: Phaser.Scene): Map<string, TextureEntry> {\n let textures = this.sceneTextures.get(scene)\n if (!textures) {\n textures = new Map()\n this.sceneTextures.set(scene, textures)\n }\n return textures\n }\n\n /**\n * Request a texture in a specific scene, incrementing reference count\n * Loads the texture if it's the first request in this scene\n */\n async requestTexture(scene: Phaser.Scene, request: TextureRequest): Promise<void> {\n const { key } = request\n const textures = this.getTextureMap(scene)\n let entry = textures.get(key)\n\n if (!entry) {\n // First request for this texture in this scene\n entry = {\n refCount: 0,\n promise: null,\n loaded: false,\n }\n textures.set(key, entry)\n }\n\n entry.refCount++\n\n if (!entry.loaded && !entry.promise) {\n // Start loading\n entry.promise = svgToTexture(scene, request.key, request.svg, request.width, request.height)\n .then(() => {\n if (entry) {\n entry.loaded = true\n entry.promise = null\n }\n })\n .catch((err) => {\n if (entry) {\n entry.promise = null\n }\n throw err\n })\n }\n\n // Wait for loading if in progress\n if (entry.promise) {\n await entry.promise\n }\n }\n\n /**\n * Release a texture in a specific scene, decrementing reference count\n * Removes the texture if reference count reaches zero\n */\n releaseTexture(scene: Phaser.Scene, key: string) {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return\n\n const entry = textures.get(key)\n if (!entry) return\n\n entry.refCount--\n if (entry.refCount <= 0) {\n // No more references, remove texture\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n textures.delete(key)\n }\n }\n\n /**\n * Check if a texture is loaded in a specific scene\n */\n isTextureLoaded(scene: Phaser.Scene, key: string): boolean {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return false\n const entry = textures.get(key)\n return entry?.loaded ?? false\n }\n\n /**\n * Get all loaded textures in a specific scene\n */\n getLoadedTextures(scene: Phaser.Scene): string[] {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return []\n return Array.from(textures.entries())\n .filter(([, entry]) => entry.loaded)\n .map(([key]) => key)\n }\n\n /**\n * Release all textures in a specific scene\n * Called automatically when scene shuts down\n */\n releaseScene(scene: Phaser.Scene) {\n const textures = this.sceneTextures.get(scene)\n if (!textures) return\n\n for (const key of textures.keys()) {\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n }\n this.sceneTextures.delete(scene)\n }\n\n /**\n * Release all textures from all scenes\n * Use with caution - removes all textures from all Phaser scenes\n */\n releaseAll() {\n for (const [scene, textures] of this.sceneTextures.entries()) {\n for (const key of textures.keys()) {\n if (scene.textures.exists(key)) {\n scene.textures.remove(key)\n }\n }\n }\n this.sceneTextures.clear()\n }\n}\n\n// Global instance\nexport const textureRegistry = new TextureRegistry()\n","/**\n * SVG Texture Hooks - Per-scene texture management for SVG-based images\n * Each Phaser Scene maintains its own texture registry for isolation\n */\nimport Phaser from 'phaser'\nimport { getCurrent, useEffect, useMemo, useState } from './hooks'\nimport type { ParentType } from './types'\nimport { textureRegistry } from './utils/texture-registry'\n\n/**\n * SVG texture configuration for loading\n */\nexport interface SVGTextureConfig {\n key: string\n svg: string\n width?: number\n height?: number\n}\n\n/**\n * Manually release a global SVG texture from memory\n * Only call this if you're sure no component needs the texture anymore\n *\n * @param key - The texture key to release\n * @example\n * ```ts\n * // In a Phaser scene\n * import { releaseSVGTexture } from '@number10/phaserjsx'\n *\n * // When changing levels or cleaning up\n * releaseSVGTexture('icon-bell')\n * ```\n */\nexport function releaseSVGTexture(scene: Phaser.Scene, key: string): void {\n textureRegistry.releaseTexture(scene, key)\n}\n\n/**\n * Manually release multiple global SVG textures from memory\n * Only call this if you're sure no component needs these textures anymore\n *\n * @param keys - Array of texture keys to release\n * @example\n * ```ts\n * // In a Phaser scene\n * import { releaseSVGTextures } from '@number10/phaserjsx'\n *\n * // Clean up all icon textures when changing scenes\n * releaseSVGTextures(['icon-bell', 'icon-settings', 'icon-user'])\n * ```\n */\nexport function releaseSVGTextures(scene: Phaser.Scene, keys: string[]): void {\n for (const key of keys) {\n textureRegistry.releaseTexture(scene, key)\n }\n}\n\n/**\n * Manually release ALL global SVG textures from memory\n * Use with caution - this clears all textures managed by the texture registry\n *\n * @example\n * ```ts\n * // In a Phaser scene shutdown or cleanup\n * import { releaseAllSVGTextures } from '@number10/phaserjsx'\n *\n * // When changing to a different scene or restarting\n * releaseAllSVGTextures()\n * ```\n */\nexport function releaseAllSVGTextures(): void {\n textureRegistry.releaseAll()\n}\n\n/**\n * Hook to load a single SVG as a Phaser texture\n *\n * Automatically handles:\n * - Scene detection from component context\n * - Texture loading and registration\n * - Cleanup on unmount (removes texture from Phaser)\n *\n * @param key - Unique texture key\n * @param svg - SVG string or URL\n * @param width - Texture width in pixels (default: 32)\n * @param height - Texture height in pixels (default: 32)\n * @returns true when texture is loaded and ready to use\n * @example\n * ```tsx\n * function MyIcon() {\n * const ready = useSVGTexture('icon-bell', bellIconSvg, 32, 32)\n * return ready ? <Image texture=\"icon-bell\" /> : null\n * }\n * ```\n */\nexport function useSVGTexture(\n key: string,\n svg: string,\n width: number = 32,\n height: number = 32\n): boolean {\n const [ready, setReady] = useState(false)\n\n // Get scene from render context (isolated per mount point)\n const ctx = (getCurrent() as unknown as { parent: ParentType }) || {}\n const scene =\n ctx.parent instanceof Phaser.Scene\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject | undefined)?.scene\n\n useEffect(() => {\n if (!scene) return\n\n let cancelled = false\n setReady(false)\n\n // Request texture (with reference counting per scene)\n textureRegistry\n .requestTexture(scene, { key, svg, width, height })\n .then(() => {\n if (!cancelled) {\n setReady(true)\n }\n })\n .catch((err) => {\n if (!cancelled) console.error(`Failed to load SVG texture '${key}':`, err)\n })\n\n // Cleanup: release texture reference\n return () => {\n cancelled = true\n // textureRegistry.releaseTexture(scene, key)\n }\n }, [scene, key, svg, width, height])\n\n return ready\n}\n\n/**\n * Hook to load multiple SVG textures\n *\n * Automatically handles:\n * - Scene detection from component context\n * - Parallel texture loading\n * - Cleanup on unmount (removes all textures from Phaser)\n *\n * @param configs - Array of SVG texture configurations\n * @returns true when all textures are loaded and ready to use\n * @example\n * ```tsx\n * function MyIcons() {\n * const ready = useSVGTextures([\n * { key: 'icon-bell', svg: bellSvg, width: 32, height: 32 },\n * { key: 'icon-settings', svg: settingsSvg, width: 24 },\n * ])\n * return ready ? (\n * <>\n * <Image texture=\"icon-bell\" />\n * <Image texture=\"icon-settings\" />\n * </>\n * ) : null\n * }\n * ```\n */\nexport function useSVGTextures(configs: SVGTextureConfig[]): boolean {\n const [ready, setReady] = useState(false)\n\n // Get scene from render context (isolated per mount point)\n const ctx = (getCurrent() as unknown as { parent: ParentType }) || {}\n const scene =\n ctx.parent instanceof Phaser.Scene\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject | undefined)?.scene\n\n // Create stable key from configs to detect changes\n const configKey = useMemo(\n () => configs.map((c) => `${c.key}:${c.width ?? 32}:${c.height ?? 32}`).join('|'),\n [configs]\n )\n\n useEffect(() => {\n if (!scene || configs.length === 0) return\n\n let cancelled = false\n setReady(false)\n\n // Request all textures (with reference counting per scene)\n const loadSequentially = async () => {\n for (const config of configs) {\n if (cancelled) break\n await textureRegistry.requestTexture(scene, {\n key: config.key,\n svg: config.svg,\n width: config.width ?? 32,\n height: config.height ?? 32,\n })\n }\n }\n\n loadSequentially()\n .then(() => {\n if (!cancelled) {\n setReady(true)\n }\n })\n .catch((err) => {\n if (!cancelled) console.error('Failed to load SVG textures:', err)\n })\n\n // Cleanup: release all texture references\n return () => {\n cancelled = true\n // Textures are global and shared across mounts - don't release them\n // for (const config of configs) {\n // textureRegistry.releaseTexture(config.key)\n // }\n }\n }, [scene, configKey])\n\n return ready\n}\n","/**\n * DOM input element manager for text input overlay\n * Handles creation, positioning, and lifecycle of DOM input elements\n */\nimport type Phaser from 'phaser'\n\n/**\n * Configuration for DOM input element\n */\nexport interface DOMInputConfig {\n /** Input type (text, password, email, etc.) */\n type?: string\n /** Placeholder text */\n placeholder?: string\n /** Initial value */\n value?: string\n /** Whether input is disabled */\n disabled?: boolean\n /** Maximum length of input */\n maxLength?: number\n /** Autocomplete behavior */\n autocomplete?: string\n /** Autocorrect behavior (Safari) */\n autocorrect?: string\n /** Autocapitalize behavior (mobile) */\n autocapitalize?: string\n /** Spellcheck behavior */\n spellcheck?: boolean\n /** CSS styles to apply */\n styles?: Partial<CSSStyleDeclaration>\n /** Input event callback */\n onInput?: (value: string, event: Event) => void\n /** Keyboard event callbacks */\n onKeyDown?: (event: KeyboardEvent) => void\n onKeyUp?: (event: KeyboardEvent) => void\n /** Focus event callbacks */\n onFocus?: (event: FocusEvent) => void\n onBlur?: (event: FocusEvent) => void\n}\n\n/**\n * DOM input element wrapper with automatic positioning\n */\nexport class DOMInputElement {\n private input: HTMLInputElement\n private container: Phaser.GameObjects.Container\n private scene: Phaser.Scene\n private scrollHandler: () => void\n private resizeHandler: () => void\n private throttledScrollHandler: () => void\n private throttledResizeHandler: () => void\n private intersectionObserver: IntersectionObserver | null = null\n private isDestroyed = false\n private lastValues = { left: 0, top: 0, width: 0, height: 0 }\n private counter = 0\n private scrollThrottleTimeout: number | null = null\n private resizeThrottleTimeout: number | null = null\n\n constructor(container: Phaser.GameObjects.Container, config: DOMInputConfig = {}) {\n this.container = container\n this.scene = container.scene\n\n // Create input element\n this.input = document.createElement('input')\n this.input.type = config.type ?? 'text'\n if (config.placeholder) this.input.placeholder = config.placeholder\n if (config.value) this.input.value = config.value\n if (config.disabled) this.input.disabled = config.disabled\n if (config.maxLength) this.input.maxLength = config.maxLength\n if (config.autocomplete) this.input.setAttribute('autocomplete', config.autocomplete)\n if (config.autocorrect) this.input.setAttribute('autocorrect', config.autocorrect)\n if (config.autocapitalize) this.input.setAttribute('autocapitalize', config.autocapitalize)\n if (config.spellcheck !== undefined)\n this.input.setAttribute('spellcheck', config.spellcheck.toString())\n\n // Apply default styles\n this.applyDefaultStyles()\n\n // Apply custom styles\n if (config.styles) {\n Object.assign(this.input.style, config.styles)\n }\n\n // Add to DOM - use document.body for absolute positioning\n document.body.appendChild(this.input)\n\n // Setup event listeners\n if (config.onInput) {\n this.input.addEventListener('input', (e) => {\n config.onInput?.(this.input.value, e)\n })\n }\n\n if (config.onKeyDown) {\n this.input.addEventListener('keydown', config.onKeyDown)\n }\n\n if (config.onKeyUp) {\n this.input.addEventListener('keyup', config.onKeyUp)\n }\n\n if (config.onFocus) {\n this.input.addEventListener('focus', (e) => {\n config.onFocus?.(e)\n })\n }\n\n if (config.onBlur) {\n this.input.addEventListener('blur', (e) => {\n config.onBlur?.(e)\n })\n }\n\n // Initial position update\n this.updatePosition()\n\n // Bind handlers for page scrolling and resizing\n this.scrollHandler = this.updatePosition.bind(this)\n this.resizeHandler = this.updatePosition.bind(this)\n\n // Throttled handlers to limit update frequency\n this.throttledScrollHandler = this.throttle(this.scrollHandler, 20) // ~50fps max\n this.throttledResizeHandler = this.throttle(this.resizeHandler, 20) // ~50fps max\n\n // Setup event listeners immediately (always active)\n // Use capture phase to catch scroll events from any scrollable ancestor\n document.addEventListener('scroll', this.throttledScrollHandler, {\n passive: true,\n capture: true,\n })\n window.addEventListener('resize', this.throttledResizeHandler, { passive: true })\n\n // Setup IntersectionObserver to detect when canvas moves in viewport\n this.setupIntersectionObserver()\n\n // Cleanup on container destroy\n this.container.once('destroy', () => {\n this.destroy()\n })\n\n // Cleanup on scene shutdown\n this.scene.events.once('shutdown', () => {\n this.destroy()\n })\n }\n\n /**\n * Setup IntersectionObserver to detect canvas position changes\n */\n private setupIntersectionObserver(): void {\n const canvas = this.scene.game.canvas\n\n this.intersectionObserver = new IntersectionObserver(\n () => {\n // Canvas moved in viewport, update position\n this.updatePosition()\n },\n {\n threshold: [0, 0.1, 0.5, 0.9, 1.0], // Trigger on various visibility changes\n }\n )\n\n this.intersectionObserver.observe(canvas)\n }\n\n /**\n * Throttle function to limit call frequency\n * @param func - Function to throttle\n * @param delay - Minimum delay between calls in ms\n * @returns Throttled function\n */\n private throttle(func: () => void, delay: number): () => void {\n let timeoutId: number | null = null\n return () => {\n if (timeoutId !== null) return\n timeoutId = window.setTimeout(() => {\n func()\n timeoutId = null\n }, delay)\n }\n }\n\n /**\n * Apply default styles to input element\n */\n private applyDefaultStyles(): void {\n Object.assign(this.input.style, {\n position: 'absolute',\n pointerEvents: 'auto',\n boxSizing: 'border-box',\n fontFamily: 'Arial, sans-serif',\n fontSize: '16px',\n padding: '0px',\n margin: '0px',\n border: 'none',\n borderRadius: '0px',\n backgroundColor: 'transparent',\n color: 'transparent',\n outline: 'none',\n caretColor: 'transparent',\n } as Partial<CSSStyleDeclaration>)\n\n // Inject CSS to disable selection highlighting\n const styleId = 'phaserjsx-input-no-selection'\n if (!document.getElementById(styleId)) {\n const style = document.createElement('style')\n style.id = styleId\n style.textContent = `\n input[type=\"text\"]::selection,\n input[type=\"password\"]::selection,\n input[type=\"email\"]::selection {\n background: transparent !important;\n color: transparent !important;\n }\n `\n document.head.appendChild(style)\n }\n }\n\n /**\n * Update input element position to match Phaser container\n */\n private updatePosition(): void {\n if (this.isDestroyed || !this.container.scene) return\n\n const canvas = this.scene.game.canvas\n const canvasRect = canvas.getBoundingClientRect()\n\n // Get container world position\n const worldTransform = this.container.getWorldTransformMatrix()\n const worldX = worldTransform.tx\n const worldY = worldTransform.ty\n\n // Get container dimensions - prefer actual computed size over layoutProps\n // This ensures minHeight, maxHeight, and other constraints are respected\n const containerWidth = this.container.width ?? 200\n const containerHeight = this.container.height ?? 40\n\n // Calculate position relative to canvas\n const scale = this.scene.game.scale\n const zoom = this.scene.cameras.main.zoom\n\n // Calculate position and size with proper scaling\n const left = Math.round(canvasRect.left + worldX * zoom * scale.displayScale.x)\n const top = Math.round(canvasRect.top + worldY * zoom * scale.displayScale.y)\n const width = Math.round(containerWidth * zoom * scale.displayScale.x)\n const height = Math.round(containerHeight * zoom * scale.displayScale.y)\n this.counter++\n\n // apply only if changed to minimize layout thrashing\n if (\n this.lastValues.left === left &&\n this.lastValues.top === top &&\n this.lastValues.width === width &&\n this.lastValues.height === height\n ) {\n return\n }\n this.lastValues = { left, top, width, height }\n\n /* // Debug output for testing purposes\n console.log('[DOMInputElement] Updating position', {\n counter: this.counter,\n left,\n top,\n width,\n height,\n })\n */\n\n // Apply position and size\n this.input.style.left = `${left}px`\n this.input.style.top = `${top}px`\n this.input.style.width = `${width}px`\n this.input.style.height = `${height}px`\n }\n\n /**\n * Get the DOM input element\n */\n getElement(): HTMLInputElement {\n return this.input\n }\n\n /**\n * Set input value\n */\n setValue(value: string): void {\n if (!this.isDestroyed) {\n this.input.value = value\n }\n }\n\n /**\n * Get input value\n */\n getValue(): string {\n return this.isDestroyed ? '' : this.input.value\n }\n\n /**\n * Focus the input\n */\n focus(): void {\n if (!this.isDestroyed) {\n this.input.focus()\n }\n }\n\n /**\n * Blur the input\n */\n blur(): void {\n if (!this.isDestroyed) {\n this.input.blur()\n }\n }\n\n /**\n * Set disabled state\n */\n setDisabled(disabled: boolean): void {\n if (!this.isDestroyed) {\n this.input.disabled = disabled\n }\n }\n\n /**\n * Set placeholder\n */\n setPlaceholder(placeholder: string): void {\n if (!this.isDestroyed) {\n this.input.placeholder = placeholder\n }\n }\n\n /**\n * Update styles\n */\n setStyles(styles: Partial<CSSStyleDeclaration>): void {\n if (!this.isDestroyed) {\n Object.assign(this.input.style, styles)\n }\n }\n\n /**\n * Destroy the input element and cleanup\n */\n destroy(): void {\n if (this.isDestroyed) return\n this.isDestroyed = true\n\n // Clear any pending throttle timeouts\n if (this.scrollThrottleTimeout !== null) {\n clearTimeout(this.scrollThrottleTimeout)\n }\n if (this.resizeThrottleTimeout !== null) {\n clearTimeout(this.resizeThrottleTimeout)\n }\n\n // Disconnect IntersectionObserver\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect()\n this.intersectionObserver = null\n }\n\n // Remove event listeners\n document.removeEventListener('scroll', this.throttledScrollHandler, { capture: true })\n window.removeEventListener('resize', this.throttledResizeHandler)\n\n // Remove from DOM\n if (this.input.parentElement) {\n this.input.parentElement.removeChild(this.input)\n }\n }\n}\n","import { DOMInputElement, type DOMInputConfig } from './dom-input-manager'\n\nexport type KeyboardInputManagerConfig = {\n onInput?: (value: string, event: Event) => void\n onKeyDown?: (event: KeyboardEvent) => void\n onKeyUp?: (event: KeyboardEvent) => void\n onFocus?: () => void\n onBlur?: () => void\n maxLength?: number\n disabled?: boolean\n debug?: boolean | undefined\n}\n\n/**\n * Manages hidden DOM input for keyboard events\n */\nexport class KeyboardInputManager {\n private domInput: DOMInputElement | null = null\n private container: Phaser.GameObjects.Container\n private config: KeyboardInputManagerConfig\n\n constructor(container: Phaser.GameObjects.Container, config: KeyboardInputManagerConfig) {\n this.container = container\n this.config = config\n this.create()\n }\n\n /**\n * Create hidden DOM input element\n */\n private create(): void {\n const debugStyle: Partial<CSSStyleDeclaration> = this.config.debug\n ? {\n opacity: '0.3',\n backgroundColor: 'rgba(0,0,0,0.3)',\n border: '4px dashed red',\n color: 'white',\n }\n : {}\n\n const domConfig: DOMInputConfig = {\n type: 'text',\n value: '',\n ...(this.config.disabled !== undefined && { disabled: this.config.disabled }),\n ...(this.config.maxLength !== undefined && { maxLength: this.config.maxLength }),\n onInput: (value, event) => {\n this.config.onInput?.(value, event)\n },\n onKeyDown: (event) => {\n this.config.onKeyDown?.(event)\n },\n onKeyUp: (event) => {\n this.config.onKeyUp?.(event)\n },\n onFocus: () => {\n this.config.onFocus?.()\n },\n onBlur: () => {\n this.config.onBlur?.()\n },\n styles: {\n // need to debug until successful at all\n opacity: '0.0',\n // pointerEvents: 'none',\n position: 'absolute',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n ...debugStyle,\n } as Partial<CSSStyleDeclaration>,\n autocomplete: 'off',\n autocorrect: 'off',\n autocapitalize: 'off',\n spellcheck: false,\n }\n\n this.domInput = new DOMInputElement(this.container, domConfig)\n }\n\n /**\n * Update DOM input value programmatically\n */\n setValue(value: string): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.value = value\n }\n }\n\n /**\n * Focus the DOM input\n */\n focus(): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.focus()\n }\n }\n\n /**\n * Blur the DOM input\n */\n blur(): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.blur()\n }\n }\n\n /**\n * Check if DOM input is focused\n */\n isFocused(): boolean {\n const element = this.domInput?.getElement()\n return element === document.activeElement\n }\n\n /**\n * Set pointer events (auto when not focused, none when focused)\n */\n setPointerEvents(enabled: boolean): void {\n const element = this.domInput?.getElement()\n if (element) {\n element.style.pointerEvents = enabled ? 'auto' : 'none'\n }\n }\n\n /**\n * Destroy the DOM input\n */\n destroy(): void {\n this.domInput?.destroy()\n this.domInput = null\n }\n}\n","/**\n * Signal-based animation utilities\n * Provides reactive signals that trigger direct DOM updates without VDOM traversal\n */\nimport { signal, type Signal } from '@preact/signals-core'\n\n/**\n * Animated signal that holds a numeric value\n * Can be used in JSX props for direct updates without VDOM\n */\nexport interface AnimatedSignal extends Signal<number> {\n /** Mark as animated signal for VDOM detection */\n __isAnimated: true\n}\n\n/**\n * Creates an animated signal\n * @param initialValue - Initial numeric value\n * @returns Animated signal\n */\nexport function animatedSignal(initialValue: number): AnimatedSignal {\n const sig = signal(initialValue) as AnimatedSignal\n sig.__isAnimated = true\n return sig\n}\n\n/**\n * Type guard to check if value is an animated signal\n * @param value - Value to check\n * @returns True if value is an animated signal\n */\nexport function isAnimatedSignal(value: unknown): value is AnimatedSignal {\n return (\n typeof value === 'object' &&\n value !== null &&\n '__isAnimated' in value &&\n (value as AnimatedSignal).__isAnimated === true\n )\n}\n\n/**\n * Unwraps signal value or returns raw value\n * Type-safe overloads ensure correct return types\n * @param value - Signal or raw value\n * @returns Unwrapped value\n */\nfunction unwrapSignal(value: AnimatedSignal): number\nfunction unwrapSignal(value: number): number\nfunction unwrapSignal(value: string): string\nfunction unwrapSignal(value: number | AnimatedSignal): number\nfunction unwrapSignal(value: string | AnimatedSignal): string | number\nfunction unwrapSignal(value: number | string | AnimatedSignal): number | string\nfunction unwrapSignal(\n value: number | string | AnimatedSignal | undefined\n): number | string | undefined {\n if (value === undefined) return undefined\n return isAnimatedSignal(value) ? value.value : value\n}\n\nexport { unwrapSignal }\n","/**\n * Spring physics engine for smooth, natural animations\n * Based on spring-damper system with configurable tension, friction, and mass\n */\n\n/**\n * Configuration for spring physics behavior\n */\nexport interface SpringConfig {\n /** Spring stiffness (higher = faster, snappier). Default: 170 */\n tension?: number\n /** Damping force (higher = less oscillation). Default: 26 */\n friction?: number\n /** Mass of the animated object (higher = slower). Default: 1 */\n mass?: number\n /** Velocity threshold below which animation stops. Default: 0.01 */\n restVelocity?: number\n /** Distance threshold below which animation stops. Default: 0.01 */\n restDelta?: number\n /** Clamp values to prevent overshoot. Default: false */\n clamp?: boolean\n}\n\n/**\n * Spring physics state\n */\nexport interface SpringState {\n /** Current value */\n value: number\n /** Current velocity */\n velocity: number\n}\n\n/**\n * Default spring configuration (similar to react-spring)\n */\nexport const DEFAULT_SPRING_CONFIG: Required<SpringConfig> = {\n tension: 170,\n friction: 26,\n mass: 1,\n restVelocity: 0.01,\n restDelta: 0.01,\n clamp: false,\n}\n\n/**\n * Preset spring configurations for common use cases\n * Note: clamp prevents overshoot but can make animations feel less natural\n * For UI animations, consider enabling clamp to prevent visual artifacts\n */\nexport const SPRING_PRESETS = {\n /** Gentle, slow animation */\n gentle: { tension: 120, friction: 14 },\n /** Moderate, balanced animation (default) */\n default: { tension: 170, friction: 26 },\n /** Fast, snappy animation */\n wobbly: { tension: 180, friction: 12 },\n /** Very fast, bouncy animation */\n stiff: { tension: 210, friction: 20 },\n /** Slow, smooth animation */\n slow: { tension: 280, friction: 60 },\n /** Instant, no animation */\n instant: { tension: 1000, friction: 100 },\n} as const\n\n/**\n * Type for animation preset keys\n */\nexport type AnimationPreset = keyof typeof SPRING_PRESETS\n/**\n * Type for animation configuration (preset name or custom config)\n */\nexport type AnimationConfig = AnimationPreset | SpringConfig\n\n/**\n * Spring physics engine\n * Implements spring-damper physics for smooth, natural animations\n */\nexport class SpringPhysics {\n private config: Required<SpringConfig>\n\n /**\n * Creates a new spring physics engine\n * @param config - Spring configuration\n */\n constructor(config: SpringConfig = {}) {\n this.config = { ...DEFAULT_SPRING_CONFIG, ...config }\n }\n\n /**\n * Updates spring configuration\n * @param config - Partial config to merge with current\n */\n updateConfig(config: Partial<SpringConfig>): void {\n this.config = { ...this.config, ...config }\n }\n\n /**\n * Performs one physics step\n * Uses semi-implicit Euler integration for stability\n * @param state - Current spring state\n * @param target - Target value\n * @param deltaTime - Time delta in seconds\n * @returns New spring state\n */\n step(state: SpringState, target: number, deltaTime: number): SpringState {\n const { tension, friction, mass, clamp } = this.config\n\n // Calculate spring force (Hooke's law)\n const springForce = -tension * (state.value - target)\n\n // Calculate damping force\n const dampingForce = -friction * state.velocity\n\n // Calculate acceleration (F = ma → a = F/m)\n const acceleration = (springForce + dampingForce) / mass\n\n // Update velocity (semi-implicit Euler)\n const newVelocity = state.velocity + acceleration * deltaTime\n\n // Update position\n let newValue = state.value + newVelocity * deltaTime\n\n // Clamp if enabled\n if (clamp) {\n const min = Math.min(state.value, target)\n const max = Math.max(state.value, target)\n newValue = Math.max(min, Math.min(max, newValue))\n }\n\n return {\n value: newValue,\n velocity: newVelocity,\n }\n }\n\n /**\n * Checks if spring has reached rest state\n * @param state - Current spring state\n * @param target - Target value\n * @returns True if spring is at rest\n */\n isAtRest(state: SpringState, target: number): boolean {\n const { restVelocity, restDelta } = this.config\n const isVelocitySmall = Math.abs(state.velocity) <= restVelocity\n const isDisplacementSmall = Math.abs(state.value - target) <= restDelta\n return isVelocitySmall && isDisplacementSmall\n }\n\n /**\n * Snaps spring to target if at rest\n * @param state - Current spring state\n * @param target - Target value\n * @returns Adjusted state (snapped if at rest)\n */\n snapIfAtRest(state: SpringState, target: number): SpringState {\n if (this.isAtRest(state, target)) {\n return { value: target, velocity: 0 }\n }\n return state\n }\n}\n","/**\n * Spring animation hook\n * Provides physics-based animations using signals for direct updates\n */\nimport { computed, type Signal } from '@preact/signals-core'\nimport Phaser from 'phaser'\nimport { getCurrent, useEffect, useRef } from '../hooks'\nimport type { ParentType } from '../types'\nimport { animatedSignal, type AnimatedSignal } from './animated-signal'\nimport {\n SPRING_PRESETS,\n SpringPhysics,\n type SpringConfig,\n type SpringState,\n} from './spring-physics'\n\n/**\n * Spring animation hook\n * Creates an animated signal that smoothly transitions to target values\n *\n * @param initialValue - Initial value\n * @param config - Spring configuration or preset name\n * @returns Tuple of [animated signal, setter function]\n *\n * @example\n * ```tsx\n * // ✓ SAFE - leaf node\n * const [x, setX] = useSpring(0, 'wobbly')\n * <View x={x} width={50} height={50} backgroundColor={0xff0000} />\n *\n * // ✓ SAFE - transform properties\n * const [scale, setScale] = useSpring(1, 'default')\n * <View scale={scale}><Text text=\"Hello\" /></View>\n *\n * // ✗ UNSAFE - container with percentage children\n * const [width, setWidth] = useSpring(200, 'wobbly')\n * <View width={width}><NineSlice width=\"100%\" /></View> // BREAKS!\n * ```\n */\nexport function useSpring(\n initialValue: number,\n config?: SpringConfig | keyof typeof SPRING_PRESETS,\n onComplete?: () => void\n): [AnimatedSignal, (target: number | ((prev: number) => number)) => void] {\n // Resolve config\n const resolvedConfig =\n typeof config === 'string' ? SPRING_PRESETS[config] : (config ?? SPRING_PRESETS.default)\n\n // Create animated signal\n const valueSignal = useRef<AnimatedSignal | null>(null)\n if (valueSignal.current === null) {\n valueSignal.current = animatedSignal(initialValue)\n }\n\n // Get scene from render context (DURING RENDER, while getCurrent() is available)\n const ctx = getCurrent() as { parent: ParentType } | null\n const scene = ctx\n ? ctx.parent instanceof Phaser.Scene\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject).scene\n : null\n\n // Physics state\n const state = useRef<SpringState>({ value: initialValue, velocity: 0 })\n const target = useRef<Signal<number>>({ value: initialValue } as Signal<number>)\n const physics = useRef(new SpringPhysics(resolvedConfig))\n const updateListenerRef = useRef<((time: number, delta: number) => void) | null>(null)\n const sceneRef = useRef<Phaser.Scene | null>(scene)\n const wasAtRest = useRef<boolean>(true) // Track if previously at rest\n\n // Update scene ref if it changes (shouldn't happen, but defensive)\n if (scene && sceneRef.current !== scene) {\n sceneRef.current = scene\n }\n\n // Setter function - stable reference across renders\n const setValue = (newTarget: number | ((prev: number) => number)) => {\n const nextTarget = typeof newTarget === 'function' ? newTarget(target.current.value) : newTarget\n target.current.value = nextTarget\n }\n\n useEffect(() => {\n const scene = sceneRef.current\n if (!scene) {\n console.warn('useSpring: Phaser scene not found in context')\n return\n }\n\n // Physics update loop\n const updateListener = (_time: number, delta: number) => {\n const currentTarget = target.current.value\n const currentState = state.current\n\n // Check if at rest\n const atRest = physics.current.isAtRest(currentState, currentTarget)\n\n // Call onComplete if just reached rest\n if (atRest && !wasAtRest.current && onComplete) {\n onComplete()\n }\n wasAtRest.current = atRest\n\n // Skip if already at rest\n if (atRest) {\n // Snap to target\n const snapped = physics.current.snapIfAtRest(currentState, currentTarget)\n if (snapped.value !== currentState.value && valueSignal.current) {\n state.current = snapped\n valueSignal.current.value = snapped.value\n }\n return\n }\n\n // Perform physics step\n const deltaSeconds = delta / 1000\n const newState = physics.current.step(currentState, currentTarget, deltaSeconds)\n\n // Update state and signal\n if (valueSignal.current) {\n state.current = newState\n valueSignal.current.value = newState.value\n }\n }\n\n updateListenerRef.current = updateListener\n scene.events.on('update', updateListener)\n\n // Cleanup\n return () => {\n if (sceneRef.current && updateListenerRef.current) {\n sceneRef.current.events.off('update', updateListenerRef.current)\n }\n }\n }, [])\n\n if (!valueSignal.current) {\n throw new Error('useSpring: Failed to initialize animated signal')\n }\n\n return [valueSignal.current, setValue]\n}\n\n/**\n * Multi-spring animation hook\n * Creates multiple animated signals that share the same configuration\n * @param initialValues - Object with initial values\n * @param config - Spring configuration or preset name\n * @returns Tuple of [animated signals object, setter function]\n *\n * @example\n * ```tsx\n * const [pos, setPos] = useSprings({ x: 0, y: 0 }, 'wobbly')\n * <View x={pos.x} y={pos.y} />\n * setPos({ x: 100, y: 200 })\n * ```\n */\nexport function useSprings<T extends Record<string, number>>(\n initialValues: T,\n config?: SpringConfig | keyof typeof SPRING_PRESETS\n): [\n { [K in keyof T]: AnimatedSignal },\n (values: Partial<{ [K in keyof T]: number | ((prev: number) => number) }>) => void,\n] {\n const keys = Object.keys(initialValues) as (keyof T)[]\n const springsMap = useRef<\n Map<\n keyof T,\n {\n signal: AnimatedSignal\n target: { value: number }\n state: SpringState\n physics: SpringPhysics\n }\n >\n >(new Map())\n const updateListenerRef = useRef<((time: number, delta: number) => void) | null>(null)\n const sceneRef = useRef<Phaser.Scene | null>(null)\n\n // Resolve config\n const resolvedConfig =\n typeof config === 'string' ? SPRING_PRESETS[config] : (config ?? SPRING_PRESETS.default)\n\n // Initialize springs manually (can't use hooks in loops!)\n keys.forEach((key) => {\n if (!springsMap.current.has(key)) {\n const initialValue = initialValues[key] as number\n const signal = animatedSignal(initialValue)\n const target = { value: initialValue }\n const state = { value: initialValue, velocity: 0 }\n const physics = new SpringPhysics(resolvedConfig)\n springsMap.current.set(key, { signal, target, state, physics })\n }\n })\n\n // Get scene from render context (DURING RENDER, while getCurrent() is available)\n const ctx = getCurrent() as { parent: ParentType } | null\n const scene = ctx\n ? ctx.parent instanceof Phaser.Scene\n ? ctx.parent\n : (ctx.parent as Phaser.GameObjects.GameObject).scene\n : null\n\n // Update scene ref if it changes (shouldn't happen, but defensive)\n if (scene && sceneRef.current !== scene) {\n sceneRef.current = scene\n }\n\n // Setup physics update loop\n useEffect(() => {\n const scene = sceneRef.current\n if (!scene) {\n console.warn('useSprings: Phaser scene not found in context')\n return\n }\n\n const updateListener = (_time: number, delta: number) => {\n const deltaSeconds = delta / 1000\n\n springsMap.current.forEach((spring) => {\n const currentTarget = spring.target.value\n const currentState = spring.state\n\n // Skip if already at rest\n if (spring.physics.isAtRest(currentState, currentTarget)) {\n const snapped = spring.physics.snapIfAtRest(currentState, currentTarget)\n if (snapped.value !== currentState.value) {\n spring.state = snapped\n spring.signal.value = snapped.value\n }\n return\n }\n\n // Perform physics step\n const newState = spring.physics.step(currentState, currentTarget, deltaSeconds)\n spring.state = newState\n spring.signal.value = newState.value\n })\n }\n\n updateListenerRef.current = updateListener\n scene.events.on('update', updateListener)\n\n return () => {\n if (sceneRef.current && updateListenerRef.current) {\n sceneRef.current.events.off('update', updateListenerRef.current)\n }\n }\n }, [])\n\n // Build result object\n const signals = {} as { [K in keyof T]: AnimatedSignal }\n keys.forEach((key) => {\n const spring = springsMap.current.get(key)\n if (spring) {\n signals[key] = spring.signal\n }\n })\n\n // Setter function\n const setValues = (values: Partial<{ [K in keyof T]: number | ((prev: number) => number) }>) => {\n Object.entries(values).forEach(([key, value]) => {\n const spring = springsMap.current.get(key as keyof T)\n if (spring) {\n const nextTarget = typeof value === 'function' ? value(spring.target.value) : value\n spring.target.value = nextTarget as number\n }\n })\n }\n\n return [signals, setValues]\n}\n\n/**\n * Export presets for convenience\n */\nexport { computed, SPRING_PRESETS }\n","/** @jsxImportSource ../.. */\nimport { useSpring, type AnimationConfig } from '../../animation'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useEffect, useForceRedraw, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport { Text, View } from '../index'\nimport type { ViewProps } from '..'\n\n/**\n * Props for Accordion component\n */\nexport interface AccordionProps extends ViewProps, EffectDefinition {\n /** Title as string or custom JSX element */\n title?: string | ChildrenType\n /** Initial open state (default: false) */\n defaultOpen?: boolean\n /** Controlled open state */\n isOpen?: boolean\n /** Callback when accordion is toggled */\n onToggle?: (isOpen: boolean) => void\n /** Enable smooth height animation (default: false) */\n animated?: boolean\n /** Maximum height for animation (default: 200) */\n maxHeight?: number\n /** Automatically measure content height for animation. Note: Creates a duplicate invisible container for measurement. */\n autoHeight?: boolean\n /** Spring animation config (preset name or custom config, default: 'gentle') */\n animationConfig?: AnimationConfig\n /** Callback when accordion animation ends */\n onAnimationEnd?: () => void\n}\n\n/**\n * Accordion component - collapsible header with content\n * @param props - Accordion properties\n * @returns Accordion JSX element\n */\nexport function Accordion(props: AccordionProps) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Accordion', localTheme, {})\n\n const [internalOpen, setInternalOpen] = useState<boolean>(props.defaultOpen ?? false)\n const isOpen = props.isOpen !== undefined ? props.isOpen : internalOpen\n\n const ref = useRef<Phaser.GameObjects.Container | null>(null)\n const measurementRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect } = useGameObjectEffect(ref)\n\n const autoHeight = props.autoHeight ?? themed.animated ?? false\n const maxHeight = props.maxHeight ?? 200\n const animated = props.animated ?? themed.animated ?? false\n const animationConfig = props.animationConfig ?? themed.animationConfig ?? 'gentle'\n\n const [measuredHeight, setMeasuredHeight] = useState<number>(maxHeight)\n\n // Measure content height when opened\n useEffect(() => {\n if (autoHeight && isOpen && measurementRef.current) {\n // Wait for next frame to ensure rendering\n setTimeout(() => {\n if (measurementRef.current) {\n const height = measurementRef.current.height\n setMeasuredHeight(height)\n setContentHeight(height)\n }\n }, 0)\n }\n }, [isOpen, autoHeight])\n\n // Animate content height if enabled\n const [contentHeight, setContentHeight] = useSpring(\n animated\n ? isOpen\n ? autoHeight\n ? measuredHeight\n : maxHeight\n : 0\n : isOpen\n ? autoHeight\n ? measuredHeight\n : maxHeight\n : 0,\n animationConfig,\n props.onAnimationEnd\n )\n if (animated) {\n useForceRedraw(20, contentHeight)\n }\n\n const handleToggle = () => {\n const newState = !isOpen\n setInternalOpen(newState)\n if (animated) {\n const targetHeight = autoHeight ? measuredHeight : maxHeight\n setContentHeight(newState ? targetHeight : 0)\n }\n props.onToggle?.(newState)\n\n // Apply effect: props override theme, theme overrides default\n const resolved = resolveEffect(props, themed as EffectDefinition)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n }\n\n const headerTheme = themed.headerStyle ?? {}\n const contentTheme = themed.contentStyle ?? {}\n const textStyle = themed.textStyle\n\n return (\n <View\n key={props.key}\n width={props.width}\n height={props.height}\n direction=\"column\"\n {...themed}\n theme={nestedTheme}\n >\n {/* Header */}\n <View\n ref={ref}\n direction=\"row\"\n alignItems=\"center\"\n enableGestures={true}\n onTouch={handleToggle}\n {...headerTheme}\n >\n {typeof props.title === 'string' ? (\n <Text text={props.title} {...(textStyle && { style: textStyle })} />\n ) : (\n props.title\n )}\n </View>\n\n {/* Invisible measurement container */}\n {autoHeight && (\n <View visible={false} direction=\"stack\">\n <View ref={measurementRef} {...contentTheme}>\n {props.children}\n </View>\n </View>\n )}\n\n {/* Content */}\n <View\n direction=\"column\"\n height={animated ? contentHeight.value : isOpen ? undefined : 0}\n overflow=\"hidden\"\n visible={animated ? contentHeight.value > 0.5 : isOpen}\n {...contentTheme}\n >\n {props.children}\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Portal component - renders children into a separate tree at specified depth\n * Enables overlays, modals, tooltips without affecting parent tree layout\n */\nimport { getGestureManager } from '../../gestures/gesture-manager'\nimport type { VNode } from '../../hooks'\nimport { useEffect, useMemo, useRef, useScene } from '../../hooks'\nimport { DeferredLayoutQueue } from '../../layout/layout-engine'\nimport type { LayoutSize } from '../../layout/types'\nimport { portalRegistry } from '../../portal'\nimport type { ChildrenType } from '../../types'\nimport { mount, patchVNode, unmount } from '../../vdom'\n\n/**\n * Props for Portal component\n */\nexport interface PortalProps {\n /** Unique key for VDOM identification */\n key?: string | number | undefined\n /** Content to render in portal */\n children: ChildrenType\n /** Z-depth for portal (higher = foreground) */\n depth?: number\n /** Optional custom portal ID */\n id?: string\n /** Block events (click-through and scrolling) - default: true */\n blockEvents?: boolean\n}\n\n/**\n * Portal component\n * Renders child VNode into a separate container tree at specified depth.\n * Automatically injects event blockers to prevent click-through and scrolling.\n *\n * @example\n * ```tsx\n * // Basic portal (automatically blocks events in content area)\n * <Portal depth={1000}>\n * <View>Overlay content</View>\n * </Portal>\n *\n * // Non-blocking portal (allows click-through)\n * <Portal depth={500} blockEvents={false}>\n * <View>Info overlay - clickable background</View>\n * </Portal>\n *\n * // Portal with custom event handling (original handlers are preserved)\n * <Portal depth={1000}>\n * <View onTouch={(e) => console.log('clicked')}>\n * Content\n * </View>\n * </Portal>\n * ```\n */\nexport function Portal(props: PortalProps) {\n const portalId = useMemo(() => props.id ?? portalRegistry.generateId(), [props.id])\n const depth = props.depth ?? 1000\n const scene = useScene()\n const blockEvents = props.blockEvents ?? true\n const mountedNodesRef = useRef<Phaser.GameObjects.GameObject[]>([])\n const previousChildrenRef = useRef<VNode[]>([])\n\n // Initial mount effect - runs once\n useEffect(() => {\n // Register portal with depth-based container first\n const portalContainer = portalRegistry.register(\n portalId,\n depth,\n scene,\n { type: 'View', props: {}, children: [] },\n scene.add.container(0, 0)\n )\n\n // Create invisible blocker container if blockEvents enabled\n let blockerContainer: Phaser.GameObjects.Container | null = null\n if (blockEvents) {\n blockerContainer = scene.add.container(0, 0)\n portalContainer.add(blockerContainer)\n // Set depth to be behind content (will be adjusted after mount)\n blockerContainer.setDepth(-1)\n }\n\n // Mount children directly (preserves absolute positioning)\n const children = Array.isArray(props.children) ? props.children : [props.children]\n const mountedNodes: Phaser.GameObjects.GameObject[] = []\n\n for (const child of children) {\n if (child) {\n const mountedNode = mount(portalContainer, child)\n if (mountedNode) {\n portalContainer.add(mountedNode)\n mountedNodes.push(mountedNode)\n }\n }\n }\n\n mountedNodesRef.current = mountedNodes\n previousChildrenRef.current = children as VNode[]\n\n // Register event blocker on invisible container AFTER layout completes\n const gestureManager = getGestureManager(scene)\n if (blockEvents && blockerContainer) {\n const blocker = blockerContainer\n DeferredLayoutQueue.defer(() => {\n // Get layout dimensions from first mounted child (content)\n const firstChild = portalContainer.getAt(1) as Phaser.GameObjects.Container & {\n __cachedLayoutSize?: LayoutSize\n __getLayoutSize?: () => LayoutSize\n }\n\n if (!firstChild) return\n\n // Get dimensions from layout system\n let width = 0\n let height = 0\n let x = 0\n let y = 0\n\n if (firstChild.__cachedLayoutSize) {\n width = firstChild.__cachedLayoutSize.width\n height = firstChild.__cachedLayoutSize.height\n } else if (firstChild.__getLayoutSize) {\n const size = firstChild.__getLayoutSize()\n width = size.width\n height = size.height\n } else {\n const bounds = firstChild.getBounds()\n width = bounds.width\n height = bounds.height\n }\n\n // Position blocker at same location as content\n x = firstChild.x\n y = firstChild.y\n blocker.setPosition(x, y)\n\n // Register blocker container (not content!) with event blockers\n const hitArea = new Phaser.Geom.Rectangle(0, 0, width, height)\n\n gestureManager.registerContainer(\n blocker,\n {\n onTouch: (e) => {\n e.stopPropagation()\n },\n onTouchMove: (e) => {\n e.stopPropagation()\n },\n },\n hitArea\n )\n })\n }\n\n // Cleanup on unmount\n return () => {\n if (blockEvents && blockerContainer) {\n gestureManager.unregisterContainer(blockerContainer)\n }\n portalRegistry.unregister(portalId)\n }\n }, [portalId, depth, scene, blockEvents])\n\n // Update effect - patches children when they change\n useEffect(() => {\n const portal = portalRegistry.get(portalId)\n if (!portal) return\n\n const portalContainer = portal.container\n\n const newChildren = Array.isArray(props.children) ? props.children : [props.children]\n const oldChildren = previousChildrenRef.current\n\n // Patch each child\n const maxLen = Math.max(oldChildren.length, newChildren.length)\n for (let i = 0; i < maxLen; i++) {\n const oldChild = oldChildren[i] as VNode | null | undefined\n const newChild = newChildren[i] as VNode | null | undefined\n\n if (oldChild && newChild) {\n // Patch existing child\n patchVNode(portalContainer, oldChild, newChild)\n } else if (!oldChild && newChild) {\n // Mount new child\n const mountedNode = mount(portalContainer, newChild)\n if (mountedNode) {\n portalContainer.add(mountedNode)\n mountedNodesRef.current.push(mountedNode)\n }\n } else if (oldChild && !newChild) {\n // Unmount removed child\n unmount(oldChild)\n }\n }\n\n previousChildrenRef.current = newChildren as VNode[]\n }, [props.children, portalId])\n\n // Portal renders nothing in parent tree\n return null\n}\n","/** @jsxImportSource ../.. */\n/**\n * Modal component for overlay dialogs\n * Renders content in a Portal with backdrop and animations\n * @module components/custom/Modal\n */\nimport {\n createFadeInEffect,\n createFadeOutEffect,\n useGameObjectEffect,\n type EffectFn,\n} from '../../effects/use-effect'\nimport type { GestureEventData } from '../../gestures/gesture-types'\nimport { useCallback, useEffect, useRef, useScene, useState, useTheme } from '../../hooks'\nimport { portalRegistry } from '../../portal'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport { View } from '../index'\nimport { Portal } from './Portal'\n\n/**\n * ModalPortal component props\n */\nexport interface ModalProps {\n /** Unique key for VDOM identification */\n key?: string\n /** request if modal should change its open/close state */\n show: boolean\n /** Callback when modal should start closing (backdrop/Escape) */\n onRequestClose?: (() => void) | undefined\n /** Callback when modal has been opened (at start of animation) */\n onOpen?: (() => void) | undefined\n /** Callback when modal has been closed (at end of animation) */\n onClosed?: (() => void) | undefined\n /** Close on backdrop click (default: true) */\n closeOnBackdrop?: boolean | undefined\n /** Close on Escape key (default: true) */\n closeOnEscape?: boolean | undefined\n /** Portal depth (default: 1000) */\n depth?: number | undefined\n /** Custom effect for showing modal content (default: fade in) */\n viewOpenEffect?: EffectFn | undefined\n /** Custom effect for hiding modal content (default: fade out) */\n viewCloseEffect?: EffectFn | undefined\n /** Modal content */\n children?: ChildrenType\n}\n\n/**\n * Modal component with backdrop and animations\n * Uses Portal for rendering above main UI\n * @param props - Modal props\n * @returns Modal component\n */\nexport function Modal(props: ModalProps) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Modal', localTheme, {})\n const scene = useScene()\n\n const closeOnBackdrop = props.closeOnBackdrop ?? true\n const closeOnEscape = props.closeOnEscape ?? true\n\n const viewOpenEffect = props.viewOpenEffect ?? createFadeInEffect\n const viewCloseEffect = props.viewCloseEffect ?? createFadeOutEffect\n\n const openDurationMs = (themed as { openDuration?: number }).openDuration ?? 320\n const closeDurationMs = (themed as { closeDuration?: number }).closeDuration ?? 260\n\n // Get viewport size from portal registry\n const viewport = scene ? portalRegistry.getViewportSize(scene) : { width: 800, height: 600 }\n\n const backdropRef = useRef<Phaser.GameObjects.Container | null>(null)\n const viewRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect: viewAnimation, stopEffects: stopViewEffects } = useGameObjectEffect(viewRef)\n const { applyEffect: backdropAnimation, stopEffects: stopBackdropEffects } =\n useGameObjectEffect(backdropRef)\n\n const [isVisible, setIsVisible] = useState(false)\n const hasMountedRef = useRef(false)\n const closeRequestedRef = useRef(false)\n const animationPhaseRef = useRef<'opening' | 'closing' | null>(null)\n\n const requestClose = useCallback(() => {\n closeRequestedRef.current = true\n if (props.onRequestClose) {\n props.onRequestClose()\n } else {\n props.onClosed?.()\n }\n }, [props.onClosed, props.onRequestClose])\n\n useEffect(() => {\n if (!viewRef.current || !backdropRef.current) {\n return\n }\n viewRef.current.setVisible(false)\n backdropRef.current.setVisible(false)\n hasMountedRef.current = true\n }, [])\n\n useEffect(() => {\n const view = viewRef.current\n const backdrop = backdropRef.current\n\n if (!view || !backdrop || !hasMountedRef.current) {\n return\n }\n\n stopViewEffects()\n stopBackdropEffects()\n\n if (props.show) {\n animationPhaseRef.current = 'opening'\n closeRequestedRef.current = false\n\n view.setVisible(true)\n backdrop.setVisible(true)\n setIsVisible(true)\n\n props.onOpen?.()\n\n viewAnimation(viewOpenEffect, {\n time: openDurationMs,\n onComplete: () => {\n animationPhaseRef.current = null\n },\n })\n\n backdropAnimation(createFadeInEffect, {\n time: openDurationMs,\n })\n } else if (isVisible || animationPhaseRef.current === 'opening') {\n animationPhaseRef.current = 'closing'\n\n viewAnimation(viewCloseEffect, {\n time: closeDurationMs,\n onComplete: () => {\n view.setVisible(false)\n setIsVisible(false)\n animationPhaseRef.current = null\n\n const shouldNotifyCloseComplete =\n props.onRequestClose !== undefined || !closeRequestedRef.current\n\n if (shouldNotifyCloseComplete) {\n props.onClosed?.()\n }\n\n closeRequestedRef.current = false\n },\n })\n\n backdropAnimation(createFadeOutEffect, {\n time: closeDurationMs,\n onComplete: () => {\n backdrop.setVisible(false)\n },\n })\n } else {\n view.setVisible(false)\n backdrop.setVisible(false)\n }\n }, [props.show])\n\n // Handle Escape key\n useEffect(() => {\n if (!closeOnEscape || !props.show) return\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n requestClose()\n }\n }\n\n window.addEventListener('keydown', handleKeyDown)\n return () => window.removeEventListener('keydown', handleKeyDown)\n }, [closeOnEscape, props.show, requestClose])\n\n const handleBackdropClick = (e: GestureEventData) => {\n // Stop propagation to prevent click-through\n e.stopPropagation()\n if (closeOnBackdrop) {\n requestClose()\n }\n }\n\n const handleBackdropMove = (e: GestureEventData) => {\n // Stop propagation to prevent scrolling through modal\n e.stopPropagation()\n }\n\n return (\n <Portal {...(props.key && { key: props.key })} depth={props.depth ?? 1000} blockEvents={false}>\n {/* Backdrop - blocks all events below */}\n <View\n ref={backdropRef}\n width={viewport.width}\n height={viewport.height}\n backgroundColor={themed.backdropColor ?? 0x000000}\n alpha={themed.backdropOpacity ?? 0.5}\n onTouch={handleBackdropClick}\n onTouchMove={handleBackdropMove}\n visible={isVisible}\n />\n\n {/* Content Container (centered) */}\n <View\n ref={viewRef}\n width={viewport.width}\n height={viewport.height}\n direction=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n visible={isVisible}\n >\n {/* Content Wrapper (prevents backdrop click) */}\n <View onTouch={(e: GestureEventData) => e.stopPropagation()} theme={nestedTheme}>\n {props.children}\n </View>\n </View>\n </Portal>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Dialog component - structured modal with header, content, and actions\n * Provides consistent layout and styling for dialog patterns\n * @module components/custom/Dialog\n */\nimport type { SizeValue } from '@number10/phaserjsx/core-props'\nimport type { GestureEventData } from '../../gestures/gesture-types'\nimport { useRef, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport { Text, View } from '../index'\nimport { Modal } from './Modal'\n\n/**\n * Dialog component props\n */\nexport interface DialogProps {\n /** Unique key for VDOM identification */\n key?: string\n /** Ref to the container */\n forwardRef?: (ref: Phaser.GameObjects.Container | null) => void\n /** Whether dialog is visible */\n isOpen: boolean\n /** Callback when dialog should close */\n onClose?: (() => void) | undefined\n /** Close on backdrop click (default: true) */\n closeOnBackdrop?: boolean | undefined\n /** Close on Escape key (default: true) */\n closeOnEscape?: boolean | undefined\n /** Portal depth (default: 1000) */\n depth?: number | undefined\n\n /** Dialog title */\n title: string\n /** Optional prefix content (e.g., Icon) */\n prefix?: ChildrenType\n /** Show close button in header (default: true) */\n showClose?: boolean\n /** Maximum width of dialog (default: 600) */\n maxWidth?: SizeValue\n\n /** Dialog content */\n children: ChildrenType\n /** Optional action buttons in footer */\n actions?: ChildrenType\n}\n\n/**\n * Dialog component with structured layout\n * Provides header with title/icon, content area, and action footer\n *\n * @param props - Dialog props\n * @returns Dialog component\n *\n * @example\n * ```tsx\n * <Dialog\n * isOpen={isOpen}\n * onClose={onClose}\n * title=\"Settings\"\n * prefix={<Icon type=\"gear\" />}\n * actions={\n * <>\n * <Button onClick={onCancel}>Cancel</Button>\n * <Button onClick={onSave}>Save</Button>\n * </>\n * }\n * >\n * <Text>Dialog content...</Text>\n * </Dialog>\n * ```\n */\nexport function Dialog(props: DialogProps) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Dialog', localTheme, {})\n const internalRef = useRef<Phaser.GameObjects.Container | null>(null)\n\n const showClose = props.showClose ?? themed.showClose ?? true\n const maxWidth = props.maxWidth ?? themed.maxWidth ?? 600\n const prefix = props.prefix ?? themed.prefix\n\n const refCallback = (ref: Phaser.GameObjects.Container | null) => {\n internalRef.current = ref\n props.forwardRef?.(ref)\n }\n\n return (\n <Modal\n {...(props.key && { key: props.key })}\n show={props.isOpen}\n onClosed={props.onClose}\n closeOnBackdrop={props.closeOnBackdrop}\n closeOnEscape={props.closeOnEscape}\n depth={props.depth}\n >\n <View\n ref={refCallback}\n width={maxWidth}\n maxWidth={maxWidth}\n backgroundColor={themed.backgroundColor ?? 0xffffff}\n cornerRadius={themed.cornerRadius ?? 8}\n padding={0}\n direction=\"column\"\n theme={nestedTheme}\n >\n {/* Header */}\n <View direction=\"column\" gap={0} width={'fill'}>\n <View\n direction=\"row\"\n width={'fill'}\n alignItems=\"center\"\n gap={themed.Header?.gap ?? 12}\n padding={themed.Header?.padding ?? 16}\n >\n {/* Prefix (Icon) */}\n {prefix && prefix}\n\n {/* Title */}\n <View flex={1}>\n <Text text={props.title} style={themed.Header?.textStyle} />\n </View>\n\n {/* Close Button */}\n {showClose && props.onClose && (\n <View\n width={themed.Header?.closeButton?.size ?? 32}\n height={themed.Header?.closeButton?.size ?? 32}\n justifyContent=\"center\"\n alignItems=\"center\"\n cornerRadius={themed.Header?.closeButton?.cornerRadius ?? 4}\n backgroundColor={themed.Header?.closeButton?.backgroundColor}\n borderColor={themed.Header?.closeButton?.borderColor}\n borderWidth={themed.Header?.closeButton?.borderWidth}\n onTouch={(e: GestureEventData) => {\n e.stopPropagation()\n props.onClose?.()\n }}\n >\n {themed.closeIcon ?? <Text text=\"X\" />}\n </View>\n )}\n </View>\n {/* Header Divider */}\n <View height={1} width=\"fill\" backgroundColor={themed.Header?.borderColor ?? 0xe0e0e0} />\n </View>\n\n {/* Content */}\n <View\n width={'fill'}\n padding={themed.Content?.padding ?? 16}\n direction=\"column\"\n gap={themed.Content?.gap ?? 12}\n >\n {props.children}\n </View>\n\n {/* Actions Footer */}\n {props.actions && (\n <View direction=\"column\" gap={0} width={'fill'}>\n {/* Actions Divider */}\n <View\n height={1}\n width=\"fill\"\n backgroundColor={themed.Actions?.borderColor ?? 0xe0e0e0}\n />\n <View\n direction=\"row\"\n justifyContent={themed.Actions?.justifyContent ?? 'end'}\n gap={themed.Actions?.gap ?? 8}\n padding={themed.Actions?.padding ?? 16}\n >\n {props.actions}\n </View>\n </View>\n )}\n </View>\n </Modal>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * WrapText component - Text that automatically wraps to parent container width\n * Eliminates boilerplate for text wrapping by detecting parent dimensions\n * @module components/custom/WrapText\n */\nimport { useCallback, useEffect, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport { Text, View, type TextProps } from '../index'\n\n/**\n * WrapText component props\n */\nexport interface WrapTextProps extends TextProps {\n /** Enable/disable automatic wrapping (default: true) */\n wrap?: boolean\n /** Optional cache key to persist measured width across remounts */\n cacheKey?: string\n}\n\nconst widthCache = new Map<string, number>()\n\n/**\n * WrapText component\n * Automatically wraps text based on parent container width\n *\n * **IMPORTANT:** Parent container MUST have explicit width!\n * - Use `width={300}` or `width=\"fill\"` on parent\n * - `maxWidth` alone does NOT work (layout system limitation)\n *\n * @param props - WrapText props\n * @returns WrapText component\n *\n * @example\n * ```tsx\n * // ✅ CORRECT: Parent with explicit width\n * <View width={400}>\n * <WrapText text=\"This text will wrap at 400px\" />\n * </View>\n *\n * // ✅ CORRECT: Parent with fill (if its parent has size)\n * <View width=\"fill\">\n * <WrapText text=\"This text wraps to parent width\" />\n * </View>\n *\n * // ❌ WRONG: Only maxWidth (text won't wrap correctly)\n * <View maxWidth={400}>\n * <WrapText text=\"This won't work as expected\" />\n * </View>\n *\n * // With styling\n * <View width={300}>\n * <WrapText\n * text=\"Styled text\"\n * style={{ fontSize: '16px', color: '#333' }}\n * align=\"center\"\n * />\n * </View>\n *\n * // Disable wrapping\n * <View width={300}>\n * <WrapText text=\"Single line\" wrap={false} />\n * </View>\n *\n * // With padding offset\n * <View width={400} padding={24}>\n * <WrapText text=\"Text\" paddingOffset={48} />\n * </View>\n * ```\n */\nexport function WrapText(props: WrapTextProps) {\n const localTheme = useTheme()\n const { props: themed } = getThemedProps('WrapText', localTheme, {})\n\n const wrap = props.wrap ?? themed.wrap ?? true\n const paddingOffset = themed.paddingOffset ?? 0\n\n // Get parent container width for text wrapping\n type ContainerWithLayout = Phaser.GameObjects.Container & {\n __getLayoutSize?: () => { width: number; height: number }\n }\n const textKey = typeof props.text === 'string' ? props.text : null\n let cacheKey: string | null = null\n if (typeof props.cacheKey === 'string') {\n cacheKey = props.cacheKey\n } else if (typeof props.key === 'string') {\n cacheKey = textKey ? `${props.key}::${textKey}` : props.key\n } else if (textKey) {\n cacheKey = textKey\n }\n\n const cachedWidth = cacheKey ? (widthCache.get(cacheKey) ?? 0) : 0\n\n // Start with cached width (if any) to prevent layout flash across remounts\n const [containerWidth, setContainerWidth] = useState(cachedWidth)\n const lastWidthRef = useRef(cachedWidth)\n const containerRef = useRef<ContainerWithLayout | null>(null)\n const measureRafRef = useRef<number | null>(null)\n\n const measureWidth = useCallback(\n (container: ContainerWithLayout) => {\n if (!wrap) return\n\n const performMeasure = () => {\n if (!container.__getLayoutSize) return\n\n const size = container.__getLayoutSize()\n const nextWidth = size.width\n\n if (nextWidth > 0 && nextWidth !== lastWidthRef.current && nextWidth !== containerWidth) {\n lastWidthRef.current = nextWidth\n if (cacheKey) {\n widthCache.set(cacheKey, nextWidth)\n }\n setContainerWidth(nextWidth)\n }\n }\n\n // Schedule measure on next frame to allow layout to settle\n if (measureRafRef.current !== null) {\n return\n }\n\n measureRafRef.current = requestAnimationFrame(() => {\n measureRafRef.current = null\n performMeasure()\n })\n },\n [containerWidth, wrap]\n )\n\n // Use ref callback to detect container mount/changes\n const containerRefCallback = useCallback(\n (container: ContainerWithLayout | null) => {\n if (containerRef.current === container) return\n\n containerRef.current = container\n\n if (!container || !wrap) {\n return\n }\n\n if (containerWidth > 0) {\n return\n }\n\n measureWidth(container)\n },\n [containerWidth, measureWidth, wrap]\n )\n\n // Re-measure if wrap toggles on while mounted and width not yet captured\n useEffect(() => {\n if (!wrap || containerWidth > 0) return\n\n const container = containerRef.current\n if (container) {\n measureWidth(container)\n }\n }, [containerWidth, measureWidth, wrap])\n\n useEffect(() => {\n return () => {\n if (measureRafRef.current !== null) {\n cancelAnimationFrame(measureRafRef.current)\n measureRafRef.current = null\n }\n }\n }, [])\n\n // Calculate effective text width; fall back to last known width when container is temporarily hidden\n const measuredWidth = containerWidth > 0 ? containerWidth : lastWidthRef.current\n const textWidth = measuredWidth > paddingOffset ? measuredWidth - paddingOffset : 0\n\n // Merge themed style with prop style\n const textStyle = {\n ...themed.textStyle,\n ...props.style,\n }\n\n // Add wordWrap if enabled and width available\n const finalStyle =\n wrap && textWidth > 0\n ? {\n ...textStyle,\n wordWrap: { useAdvancedWrap: true, width: textWidth },\n }\n : textStyle\n\n // Build Text props conditionally to satisfy exactOptionalPropertyTypes\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const textProps: any = { text: props.text, style: finalStyle }\n //if (props.align !== undefined) textProps.align = props.align\n if (props.alpha !== undefined) textProps.alpha = props.alpha\n //if (props.visible !== undefined) textProps.visible = props.visible\n if (props.x !== undefined) textProps.x = props.x\n if (props.y !== undefined) textProps.y = props.y\n //if (props.rotation !== undefined) textProps.rotation = props.rotation\n //if (props.scale !== undefined) textProps.scale = props.scale\n\n return (\n <View ref={containerRefCallback} width={'fill'}>\n <Text {...textProps} />\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * AlertDialog component - simple confirm/alert dialog with predefined actions\n * Provides variants with automatic styling and button configuration\n * @module components/custom/AlertDialog\n */\nimport { useCallback, useEffect, useMemo, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport { Text } from '../index'\nimport { Button, type ButtonVariant } from './Button'\nimport { Dialog } from './Dialog'\nimport { WrapText } from './WrapText'\n\n/**\n * AlertDialog component props\n */\nexport interface AlertDialogProps {\n /** Unique key for VDOM identification */\n key?: string\n\n /** Whether dialog is visible */\n isOpen: boolean\n /** Callback when dialog should close */\n onClose?: () => void\n\n /** Dialog title */\n title: string\n /** Optional description text */\n description?: string\n\n /** Optional custom prefix (overrides variant icon from theme) */\n prefix?: ChildrenType\n\n /** Visual variant - determines styling and default icons */\n variant?: 'info' | 'warning' | 'destructive' | 'success'\n\n /** Cancel button text (default: \"Cancel\") */\n cancelText?: string\n /** Confirm button text (default: \"OK\") */\n confirmText?: string\n /** Show cancel button (default: true) */\n showCancel?: boolean\n\n /** Callback when confirm button is clicked */\n onConfirm?: () => void | Promise<void>\n /** Close dialog after confirm (default: true) */\n closeOnConfirm?: boolean\n\n /** Override loading state (for async onConfirm) */\n loading?: boolean\n}\n\n/**\n * AlertDialog component\n * Simple confirm/alert dialogs with variants and predefined actions\n *\n * @param props - AlertDialog props\n * @returns AlertDialog component\n *\n * @example\n * ```tsx\n * // With theme icon (variant)\n * <AlertDialog\n * isOpen={isOpen}\n * variant=\"destructive\"\n * title=\"Delete Item?\"\n * description=\"This cannot be undone.\"\n * onConfirm={handleDelete}\n * onClose={onClose}\n * />\n *\n * // With custom icon\n * <AlertDialog\n * isOpen={isOpen}\n * prefix={<Icon type=\"warning\" />}\n * title=\"Warning\"\n * onConfirm={handleAction}\n * onClose={onClose}\n * />\n * ```\n */\nexport function AlertDialog(props: AlertDialogProps) {\n const localTheme = useTheme()\n const { props: themed } = getThemedProps('AlertDialog', localTheme, {})\n\n const [isLoading, setIsLoading] = useState(false)\n const showCancel = props.showCancel ?? true\n const closeOnConfirm = props.closeOnConfirm ?? true\n const loading = props.loading ?? isLoading\n\n // Get variant-specific theme configuration\n const variantTheme = props.variant && themed.variants?.[props.variant]\n\n // Props override theme, theme overrides nothing\n const prefix = props.prefix ?? variantTheme?.prefix\n const buttonVariant: ButtonVariant | undefined = variantTheme?.buttonVariant\n\n // Handle confirm with async support (memoized to prevent re-creating on every render)\n const handleConfirm = useCallback(async () => {\n if (!props.onConfirm) return\n\n try {\n setIsLoading(true)\n const result = props.onConfirm()\n\n // Check if it's a promise\n if (result instanceof Promise) {\n await result\n }\n\n // Close dialog after successful confirm (if enabled)\n if (closeOnConfirm) {\n props.onClose?.()\n }\n } catch (error) {\n console.error('AlertDialog confirm error:', error)\n } finally {\n setIsLoading(false)\n }\n }, [props.onConfirm, closeOnConfirm, props.onClose])\n\n // Cleanup loading state when dialog closes\n useEffect(() => {\n if (!props.isOpen) {\n setIsLoading(false)\n }\n }, [props.isOpen])\n\n // Memoize actions to prevent unnecessary re-renders\n const actions = useMemo(\n () => (\n <>\n {showCancel && (\n <Button\n // TODO: find out why immediate close bother the button click animation\n onClick={() => setTimeout(() => props.onClose?.(), 200)}\n disabled={loading}\n >\n <Text text={props.cancelText ?? 'Cancel'} />\n </Button>\n )}\n {props.onConfirm && (\n <Button\n variant={buttonVariant}\n onClick={() => setTimeout(() => handleConfirm(), 200)}\n disabled={loading}\n >\n <Text text={props.confirmText ?? 'OK'} />\n </Button>\n )}\n </>\n ),\n [\n showCancel,\n props.onClose,\n props.cancelText,\n loading,\n props.onConfirm,\n buttonVariant,\n handleConfirm,\n props.confirmText,\n ]\n )\n\n // Memoize content to prevent unnecessary re-renders\n const content = useMemo(\n () => (props.description ? <WrapText text={props.description} /> : null),\n [props.description]\n )\n\n return (\n <Dialog\n {...(props.key && { key: props.key })}\n isOpen={props.isOpen}\n onClose={props.onClose}\n title={props.title}\n prefix={prefix}\n maxWidth={themed.maxWidth ?? 400}\n showClose={true}\n actions={actions}\n closeOnBackdrop={false}\n closeOnEscape={false}\n >\n {content}\n </Dialog>\n )\n}\n","import type { CharInfo, LineInfo } from './types'\n\ntype MutableRefObject<T> = { current: T }\n\n/**\n * Break text into lines based on width constraints\n */\nexport const breakIntoLines = (\n text: string,\n scene: Phaser.Scene,\n effectiveMaxWidth: number,\n textStyle: Phaser.Types.GameObjects.Text.TextStyle | undefined,\n charSpacing: number,\n multiline: boolean,\n wordWrap: boolean\n): LineInfo[] => {\n const lines: LineInfo[] = []\n let currentLine: CharInfo[] = []\n let currentX = 0\n let currentLineIndex = 0\n let charIndex = 0\n\n for (let i = 0; i < text.length; i++) {\n const char = text.charAt(i)\n\n // Create temporary text object to measure\n const tempText = scene.add.text(0, 0, char, textStyle ?? {})\n const charWidth = tempText.width\n const charHeight = tempText.height\n tempText.destroy()\n\n // Check for explicit line break\n if (char === '\\n') {\n // Finish current line without adding the newline character itself\n // The newline serves as a line terminator, not a visible character\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = []\n currentLineIndex++\n currentX = 0\n charIndex++\n continue\n }\n\n // Check if we need to wrap (check with spacing included for existing chars)\n const nextX = currentX + charWidth\n const wouldExceedWidth = currentLine.length > 0 ? nextX > effectiveMaxWidth : false\n\n if (multiline && wouldExceedWidth) {\n // Try word wrap\n if (wordWrap && char !== ' ') {\n // Find last space in current line\n let lastSpaceIdx = -1\n for (let j = currentLine.length - 1; j >= 0; j--) {\n if (currentLine[j]?.char === ' ') {\n lastSpaceIdx = j\n break\n }\n }\n\n if (lastSpaceIdx >= 0) {\n // Break at space - remove space and everything after it\n const charsToMove = currentLine.splice(lastSpaceIdx + 1)\n // Remove the space itself from current line\n currentLine.splice(lastSpaceIdx, 1)\n\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = charsToMove\n currentLineIndex++\n\n // Recalculate X for moved chars\n currentX = 0\n for (const movedChar of currentLine) {\n movedChar.x = currentX\n movedChar.lineIndex = currentLineIndex\n movedChar.lineCharIndex = currentLine.indexOf(movedChar)\n currentX += movedChar.width + charSpacing\n }\n } else {\n // No space found, hard break - current char goes to next line\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = []\n currentLineIndex++\n currentX = 0\n }\n } else {\n // Hard break (or at space) - current char goes to next line\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n currentLine = []\n currentLineIndex++\n currentX = 0\n }\n }\n\n // Add char to current line\n const charInfo: CharInfo = {\n char,\n textObject: null,\n x: currentX,\n y: 0,\n width: charWidth,\n height: charHeight,\n lineIndex: currentLineIndex,\n charIndex,\n lineCharIndex: currentLine.length,\n }\n\n currentLine.push(charInfo)\n currentX += charWidth + charSpacing\n charIndex++\n }\n\n // Add last line\n if (currentLine.length > 0) {\n lines.push(createLineInfo(currentLine, currentLineIndex, charSpacing))\n }\n\n return lines\n}\n\n/**\n * Create LineInfo from array of CharInfo\n */\nexport const createLineInfo = (\n chars: CharInfo[],\n lineIndex: number,\n charSpacing: number\n): LineInfo => {\n if (chars.length === 0) {\n return {\n chars: [],\n startCharIndex: 0,\n endCharIndex: 0,\n y: 0,\n width: 0,\n height: 0,\n lineIndex,\n }\n }\n\n const width = chars.reduce((sum, char, idx) => {\n return sum + char.width + (idx < chars.length - 1 ? charSpacing : 0)\n }, 0)\n\n const height = Math.max(...chars.map((c) => c.height))\n\n return {\n chars,\n startCharIndex: chars[0]?.charIndex ?? 0,\n endCharIndex: chars[chars.length - 1]?.charIndex ?? 0,\n y: 0,\n width,\n height,\n lineIndex,\n }\n}\n\n/**\n * Position lines vertically with lineHeight spacing\n */\nexport const positionLinesVertically = (lines: LineInfo[], lineHeight: number): void => {\n let currentY = 0\n\n for (const line of lines) {\n line.y = currentY\n\n // Update Y position for all chars in line\n for (const char of line.chars) {\n char.y = currentY\n }\n\n // Calculate spacing to next line\n const lineHeightPx = line.height * lineHeight\n currentY += lineHeightPx\n }\n}\n\n/**\n * Handle text overflow with maxLines limit\n */\nexport const handleOverflow = (\n lines: LineInfo[],\n maxLines?: number,\n textOverflow?: 'clip' | 'ellipsis'\n): LineInfo[] => {\n if (!maxLines || lines.length <= maxLines) {\n return lines\n }\n\n const visibleLines = lines.slice(0, maxLines)\n\n if (textOverflow === 'ellipsis' && visibleLines.length > 0) {\n const lastLine = visibleLines[maxLines - 1]\n if (lastLine) {\n // Add ellipsis indicator by modifying last chars\n const ellipsis = '...'\n if (lastLine.chars.length > ellipsis.length) {\n // Replace last chars with ellipsis\n for (let i = 0; i < ellipsis.length; i++) {\n const charIdx = lastLine.chars.length - ellipsis.length + i\n const char = lastLine.chars[charIdx]\n if (char) {\n char.char = ellipsis[i] ?? '.'\n }\n }\n }\n }\n }\n\n return visibleLines\n}\n\n/**\n * Get cursor position from pointer world coordinates\n */\nexport const getPositionFromPointer = (\n worldX: number,\n worldY: number,\n chars: CharInfo[],\n cursorPosition: number\n): number => {\n for (let i = 0; i < chars.length; i++) {\n const charInfo = chars[i]\n if (charInfo?.textObject) {\n const bounds = charInfo.textObject.getBounds()\n if (\n worldX >= bounds.left &&\n worldX <= bounds.right &&\n worldY >= bounds.top &&\n worldY <= bounds.bottom\n ) {\n return charInfo.charIndex + 1\n }\n }\n }\n\n if (chars.length === 0) {\n return 0\n }\n\n const firstChar = chars[0]\n const lastChar = chars[chars.length - 1]\n\n if (firstChar?.textObject && lastChar?.textObject) {\n const firstBounds = firstChar.textObject.getBounds()\n const lastBounds = lastChar.textObject.getBounds()\n\n if (worldX < firstBounds.left) {\n return 0\n } else if (worldX > lastBounds.right) {\n // Return position after last character in original text\n return lastChar.charIndex + 1\n }\n }\n\n return cursorPosition\n}\n\n/**\n * Get a text object from pool or create new one\n */\nexport const getTextObject = (\n scene: Phaser.Scene,\n container: Phaser.GameObjects.Container,\n textStyle: Phaser.Types.GameObjects.Text.TextStyle | undefined,\n textObjectPool: MutableRefObject<Phaser.GameObjects.Text[]>,\n activeTextObjects: MutableRefObject<Phaser.GameObjects.Text[]>\n): Phaser.GameObjects.Text => {\n let textObj = textObjectPool.current.pop()\n if (textObj != null) {\n textObj.setVisible(true)\n } else {\n textObj = scene.add.text(0, 0, '', textStyle ?? {})\n textObj.setOrigin(0, 0)\n container.add(textObj)\n }\n activeTextObjects.current.push(textObj)\n return textObj\n}\n\n/**\n * Return a text object to pool (make invisible)\n */\nexport const returnToPool = (\n textObj: Phaser.GameObjects.Text,\n textObjectPool: MutableRefObject<Phaser.GameObjects.Text[]>,\n activeTextObjects: MutableRefObject<Phaser.GameObjects.Text[]>\n): void => {\n textObj.setVisible(false)\n const index = activeTextObjects.current.indexOf(textObj)\n if (index > -1) {\n activeTextObjects.current.splice(index, 1)\n }\n textObjectPool.current.push(textObj)\n}\n","/** @jsxImportSource ../../.. */\nimport type { GestureEventData } from '../../../core-props'\nimport { useGameObjectEffect } from '../../../effects'\nimport { useEffect, useRef, useState } from '../../../hooks'\nimport { getThemedProps } from '../../../theme'\nimport { View } from '../../index'\nimport type { CharInfo, CharTextAPI, CharTextProps } from './types'\nimport {\n breakIntoLines,\n createLineInfo,\n getPositionFromPointer,\n getTextObject,\n handleOverflow,\n positionLinesVertically,\n returnToPool,\n} from './utils'\n\n/**\n * CharText component - renders text using individual Phaser Text GameObjects per character\n * @param props - CharText properties\n * @returns CharText JSX element\n */\nexport function CharText(props: CharTextProps) {\n const { props: themed } = getThemedProps('CharText', undefined, {})\n const internalRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect: _applyEffect } = useGameObjectEffect(internalRef)\n\n // Character state management\n const [chars, setChars] = useState<CharInfo[]>([])\n const charsRef = useRef<CharInfo[]>([])\n const [internalText, setInternalText] = useState('')\n const [width, setWidth] = useState(0)\n const [height, setHeight] = useState(0)\n const [containerReady, setContainerReady] = useState(false)\n\n // Object pool for text objects to avoid creating/destroying on every text change\n const textObjectPool = useRef<Phaser.GameObjects.Text[]>([])\n const activeTextObjects = useRef<Phaser.GameObjects.Text[]>([])\n\n // Track when container is ready\n useEffect(() => {\n if (internalRef.current && !containerReady) {\n setContainerReady(true)\n }\n })\n\n // Sync external ref with internal ref when container becomes available\n useEffect(() => {\n if (!containerReady || !internalRef.current) return\n\n const currentRef = props.forwardRef\n currentRef?.(internalRef.current)\n\n // Cleanup: reset external ref on unmount or ref change\n return () => {\n currentRef?.(null)\n }\n }, [containerReady, props.forwardRef])\n\n // Cursor management\n const cursorRef = useRef<Phaser.GameObjects.Rectangle | null>(null)\n const cursorTweenRef = useRef<Phaser.Tweens.Tween | null>(null)\n\n // Selection management\n const selectionRefs = useRef<Phaser.GameObjects.Rectangle[]>([])\n const dragStartPosRef = useRef<number>(-1)\n\n // Track if we're in controlled mode\n const isControlled = props.text !== undefined\n const displayedText = isControlled ? (props.text ?? '') : internalText\n\n // Keep charsRef in sync with chars state\n useEffect(() => {\n charsRef.current = chars\n }, [chars])\n\n // Cleanup all text objects on unmount\n useEffect(() => {\n return () => {\n // Destroy all pooled text objects\n textObjectPool.current.forEach((textObj) => {\n if (textObj && textObj.scene) {\n textObj.destroy()\n }\n })\n textObjectPool.current = []\n\n // Destroy all active text objects\n activeTextObjects.current.forEach((textObj) => {\n if (textObj && textObj.scene) {\n textObj.destroy()\n }\n })\n activeTextObjects.current = []\n\n // Also destroy any remaining in chars\n charsRef.current.forEach((charInfo) => {\n if (charInfo.textObject && charInfo.textObject.scene) {\n charInfo.textObject.destroy()\n }\n })\n }\n }, [])\n\n // Extract style and spacing from props/theme\n const textStyle = props.textStyle ?? themed.textStyle\n const charSpacing = props.charSpacing ?? themed.charSpacing ?? 0\n const padding = props.padding ?? themed.padding ?? 0\n const padLeft = typeof padding === 'number' ? padding : (padding.left ?? 0)\n const padRight = typeof padding === 'number' ? padding : (padding.right ?? 0)\n const horizontalPadding = padLeft + padRight\n const padTop = typeof padding === 'number' ? padding : (padding.top ?? 0)\n const padBottom = typeof padding === 'number' ? padding : (padding.bottom ?? 0)\n const verticalPadding = padTop + padBottom\n\n const showCursor = props.showCursor ?? false\n const cursorPosition = props.cursorPosition ?? displayedText.length\n const cursorColor = props.cursorColor ?? themed.cursorColor ?? 0xffffff\n const cursorWidth = props.cursorWidth ?? themed.cursorWidth ?? 2\n const cursorBlinkSpeed = props.cursorBlinkSpeed ?? themed.cursorBlinkSpeed ?? 530\n\n const selectionStart = props.selectionStart ?? -1\n const selectionEnd = props.selectionEnd ?? -1\n const selectionColor = props.selectionColor ?? themed.selectionColor ?? 0x4a90e2\n const selectionAlpha = props.selectionAlpha ?? themed.selectionAlpha ?? 0.3\n\n const multiline = props.multiline ?? false\n const lineHeight = props.lineHeight ?? themed.lineHeight ?? 1.2\n const maxLines = props.maxLines\n const textOverflow = props.textOverflow ?? 'clip'\n const wordWrap = props.wordWrap ?? themed.wordWrap ?? true\n\n /**\n * Text manipulation API\n */\n const api: CharTextAPI = {\n insertChar: (char: string, index: number) => {\n const newText = displayedText.slice(0, index) + char + displayedText.slice(index)\n if (isControlled) {\n props.onChange?.(newText)\n } else {\n setInternalText(newText)\n props.onChange?.(newText)\n }\n },\n deleteChar: (index: number) => {\n if (index < 0 || index >= displayedText.length) return\n const newText = displayedText.slice(0, index) + displayedText.slice(index + 1)\n if (isControlled) {\n props.onChange?.(newText)\n } else {\n setInternalText(newText)\n props.onChange?.(newText)\n }\n },\n replaceChar: (index: number, char: string) => {\n if (index < 0 || index >= displayedText.length) return\n const newText = displayedText.slice(0, index) + char + displayedText.slice(index + 1)\n if (isControlled) {\n props.onChange?.(newText)\n } else {\n setInternalText(newText)\n props.onChange?.(newText)\n }\n },\n setText: (text: string) => {\n if (isControlled) {\n props.onChange?.(text)\n } else {\n setInternalText(text)\n props.onChange?.(text)\n }\n },\n getText: () => displayedText,\n clear: () => {\n if (isControlled) {\n props.onChange?.('')\n } else {\n setInternalText('')\n props.onChange?.('')\n }\n },\n getCharAtPosition: (worldX: number, worldY: number) => {\n for (let i = 0; i < chars.length; i++) {\n const charInfo = chars[i]\n if (charInfo?.textObject) {\n const bounds = charInfo.textObject.getBounds()\n if (\n worldX >= bounds.left &&\n worldX <= bounds.right &&\n worldY >= bounds.top &&\n worldY <= bounds.bottom\n ) {\n return charInfo.charIndex\n }\n }\n }\n return null\n },\n canFitChar: (char: string, position: number) => {\n // Only applies to single-line mode\n if (multiline) return true\n\n // If no maxWidth set, always fits\n const effectiveMaxWidth =\n props.maxWidth !== undefined && typeof props.maxWidth === 'number'\n ? props.maxWidth\n : props.width !== undefined && typeof props.width === 'number'\n ? props.width\n : Infinity\n\n if (effectiveMaxWidth === Infinity) return true\n\n // Calculate available content width (excluding padding)\n const availableWidth = effectiveMaxWidth - horizontalPadding\n\n if (!internalRef.current) return false\n\n const scene = internalRef.current.scene\n\n // Build the text that would result from inserting the character\n const textWithChar = displayedText.slice(0, position) + char + displayedText.slice(position)\n\n // Calculate total width of the new text\n let totalWidth = 0\n for (let i = 0; i < textWithChar.length; i++) {\n const c = textWithChar.charAt(i)\n const tempText = scene.add.text(0, 0, c, textStyle ?? {})\n const charWidth = tempText.width\n tempText.destroy()\n\n totalWidth += charWidth\n if (i < textWithChar.length - 1) {\n totalWidth += charSpacing\n }\n }\n\n return totalWidth <= availableWidth\n },\n }\n\n // Store API in ref for external access (future use)\n const apiRef = useRef<CharTextAPI>(api)\n apiRef.current = api\n\n // Expose API to parent via callback\n useEffect(() => {\n if (containerReady && props.onApiReady) {\n props.onApiReady(api)\n }\n }, [containerReady, props.onApiReady])\n\n /**\n * Create or update character GameObjects based on text prop\n */\n useEffect(() => {\n if (!internalRef.current) return\n\n const container = internalRef.current\n const scene = container.scene\n\n // Get the previous displayed text from chars state\n const prevText = chars.map((c) => c.char).join('')\n\n // Check if text has changed\n if (displayedText === prevText) return\n\n // Wait for container bounds to be available\n const timeoutId = setTimeout(() => {\n const startX = padLeft\n const startY = padTop\n\n // Get effective max width (use container width if multiline and no explicit maxWidth)\n // Important: maxWidth is the content area width, not including padding\n const effectiveMaxWidth =\n multiline && props.maxWidth !== undefined && typeof props.maxWidth === 'number'\n ? props.maxWidth - horizontalPadding\n : multiline && props.width !== undefined && typeof props.width === 'number'\n ? props.width - horizontalPadding\n : Infinity\n\n let lines: import('./types').LineInfo[]\n let allChars: CharInfo[]\n\n if (multiline) {\n // Multi-line layout\n // TODO: Consider wrapping in ScrollView for better overflow handling\n // when content exceeds available height. This would allow scrolling\n // through long text instead of clipping at maxLines.\n lines = breakIntoLines(\n displayedText,\n scene,\n effectiveMaxWidth,\n textStyle,\n charSpacing,\n multiline,\n wordWrap\n )\n positionLinesVertically(lines, lineHeight)\n lines = handleOverflow(lines, maxLines, textOverflow)\n\n // Flatten lines to chars array\n allChars = []\n for (const line of lines) {\n for (const charInfo of line.chars) {\n allChars.push(charInfo)\n }\n }\n } else {\n // Single-line layout (original logic)\n allChars = []\n let currentX = 0\n\n for (let i = 0; i < displayedText.length; i++) {\n const char = displayedText.charAt(i)\n const tempText = scene.add.text(0, 0, char, textStyle ?? {})\n const charWidth = tempText.width\n const charHeight = tempText.height\n tempText.destroy()\n\n allChars.push({\n char,\n textObject: null,\n x: currentX,\n y: 0,\n width: charWidth,\n height: charHeight,\n lineIndex: 0,\n charIndex: i,\n lineCharIndex: i,\n })\n\n currentX += charWidth + charSpacing\n }\n\n lines = allChars.length > 0 ? [createLineInfo(allChars, 0, charSpacing)] : []\n }\n\n // Assign text objects to characters, reusing from pool\n const usedTextObjects: Phaser.GameObjects.Text[] = []\n for (const charInfo of allChars) {\n const textObj = getTextObject(\n scene,\n container,\n textStyle,\n textObjectPool,\n activeTextObjects\n )\n textObj.setText(charInfo.char)\n textObj.setPosition(startX + charInfo.x, startY + charInfo.y)\n charInfo.textObject = textObj\n usedTextObjects.push(textObj)\n }\n\n // Return unused active text objects to pool\n const currentActive = [...activeTextObjects.current]\n for (const textObj of currentActive) {\n if (!usedTextObjects.includes(textObj)) {\n returnToPool(textObj, textObjectPool, activeTextObjects)\n }\n }\n\n // Calculate total dimensions\n const calculatedWidth = lines.length > 0 ? Math.max(...lines.map((l) => l.width)) : 0\n\n // Calculate height: last line Y position + actual character height (not lineHeight multiplied)\n // This ensures the container height exactly fits the content without extra spacing after last line\n let calculatedHeight = 0\n if (lines.length > 0) {\n const lastLine = lines[lines.length - 1]\n if (lastLine) {\n // Height is Y position of last line + its character height\n calculatedHeight = lastLine.y + lastLine.height\n }\n }\n\n // Update state\n setChars(allChars)\n setWidth(calculatedWidth + horizontalPadding)\n setHeight(calculatedHeight + verticalPadding)\n }, 0)\n\n // Cleanup function - clear timeout\n return () => {\n clearTimeout(timeoutId)\n }\n }, [\n displayedText,\n textStyle,\n charSpacing,\n padLeft,\n padTop,\n horizontalPadding,\n verticalPadding,\n multiline,\n lineHeight,\n maxLines,\n textOverflow,\n wordWrap,\n props.maxWidth,\n props.width,\n ])\n\n /**\n * Update cursor position and visibility\n */\n useEffect(() => {\n if (!internalRef.current || !showCursor) {\n // Hide cursor if not needed\n if (cursorRef.current) {\n cursorRef.current.setVisible(false)\n if (cursorTweenRef.current) {\n cursorTweenRef.current.stop()\n cursorTweenRef.current = null\n }\n }\n return\n }\n\n const container = internalRef.current\n const scene = container.scene\n\n // Wait for chars to be ready\n if (chars.length === 0 && displayedText.length > 0) return\n\n setTimeout(() => {\n const startX = padLeft\n const startY = padTop\n\n // Find the character at cursor position to get correct line Y\n let cursorX = startX\n let cursorY = startY\n const clampedPosition = Math.max(0, Math.min(cursorPosition, displayedText.length))\n\n // Find the character right before the cursor position (charIndex < clampedPosition)\n // The cursor is positioned AFTER this character\n let charBeforeCursor: CharInfo | null = null\n\n for (const char of chars) {\n if (char.charIndex < clampedPosition) {\n if (!charBeforeCursor || char.charIndex > charBeforeCursor.charIndex) {\n charBeforeCursor = char\n }\n }\n }\n\n // Check if cursor is after a newline character in the text\n const charBeforeCursorInText =\n clampedPosition > 0 ? displayedText.charAt(clampedPosition - 1) : null\n const isAfterNewline = charBeforeCursorInText === '\\n'\n\n // Position cursor based on the character before it\n if (charBeforeCursor) {\n if (isAfterNewline) {\n // Cursor should be at start of next line\n const nextLineIndex = charBeforeCursor.lineIndex + 1\n\n // Find first char of next line\n const firstCharOfNextLine = chars.find((c) => c.lineIndex === nextLineIndex)\n\n if (firstCharOfNextLine) {\n // Next line has content\n cursorX = startX + firstCharOfNextLine.x\n cursorY = startY + firstCharOfNextLine.y\n } else {\n // Empty line after newline - cursor at start of virtual next line\n cursorX = startX\n const lineHeightPx = charBeforeCursor.height * lineHeight\n cursorY = startY + charBeforeCursor.y + lineHeightPx\n }\n } else {\n // Normal character - cursor goes after it\n cursorX = startX + charBeforeCursor.x + charBeforeCursor.width + charSpacing\n cursorY = startY + charBeforeCursor.y\n }\n } else if (chars.length > 0 && chars[0]) {\n // Cursor at position 0 (before first char)\n const firstChar = chars[0]\n cursorX = startX + firstChar.x\n cursorY = startY + firstChar.y\n } else {\n // No chars at all\n cursorX = startX\n cursorY = startY\n }\n\n // Get cursor height\n let cursorHeight = 20\n if (isAfterNewline) {\n // For newline, use height of next line if it exists\n const nextLineIndex = charBeforeCursor ? charBeforeCursor.lineIndex + 1 : 0\n const firstCharOfNextLine = chars.find((c) => c.lineIndex === nextLineIndex)\n if (firstCharOfNextLine) {\n cursorHeight = firstCharOfNextLine.height\n } else if (charBeforeCursor) {\n // Use height from current line, not doubled\n cursorHeight = charBeforeCursor.height\n } else if (chars.length > 0 && chars[0]) {\n cursorHeight = chars[0].height\n }\n } else if (charBeforeCursor) {\n cursorHeight = charBeforeCursor.height\n } else if (chars.length > 0 && chars[0]) {\n cursorHeight = chars[0].height\n }\n\n // console.log('cursorPosition', cursorPosition, 'cursorX', cursorX, 'cursorY', cursorY)\n\n // Create or update cursor rectangle\n if (!cursorRef.current) {\n cursorRef.current = scene.add.rectangle(\n cursorX,\n cursorY,\n cursorWidth,\n cursorHeight,\n cursorColor\n )\n cursorRef.current.setOrigin(0, 0)\n container.add(cursorRef.current)\n\n // Create blinking tween\n cursorTweenRef.current = scene.tweens.add({\n targets: cursorRef.current,\n alpha: { from: 1, to: 0 },\n duration: cursorBlinkSpeed,\n yoyo: true,\n repeat: -1,\n })\n } else {\n // Update existing cursor\n cursorRef.current.setPosition(cursorX, cursorY)\n cursorRef.current.setSize(cursorWidth, cursorHeight)\n cursorRef.current.setFillStyle(cursorColor)\n cursorRef.current.setVisible(true)\n\n // Restart blink animation\n if (cursorTweenRef.current) {\n cursorTweenRef.current.stop()\n }\n cursorRef.current.setAlpha(1)\n cursorTweenRef.current = scene.tweens.add({\n targets: cursorRef.current,\n alpha: { from: 1, to: 0 },\n duration: cursorBlinkSpeed,\n yoyo: true,\n repeat: -1,\n })\n }\n }, 10)\n\n // Cleanup\n return () => {\n if (cursorTweenRef.current) {\n cursorTweenRef.current.stop()\n }\n }\n }, [\n showCursor,\n cursorPosition,\n chars,\n displayedText.length,\n cursorColor,\n cursorWidth,\n cursorBlinkSpeed,\n padLeft,\n padTop,\n charSpacing,\n ])\n\n /**\n * Render selection background\n */\n useEffect(() => {\n if (!internalRef.current) return\n\n const container = internalRef.current\n const scene = container.scene\n\n // Clear old selection rectangles\n selectionRefs.current.forEach((rect) => rect.destroy())\n selectionRefs.current = []\n\n // Check if we have a valid selection\n if (selectionStart < 0 || selectionEnd < 0 || selectionStart >= selectionEnd) {\n return\n }\n\n // Wait for chars to be ready\n if (chars.length === 0) return\n\n setTimeout(() => {\n const startX = padLeft\n const startY = padTop\n\n // Group selected characters by line\n const lineGroups = new Map<number, CharInfo[]>()\n\n // Filter chars by their charIndex (text position), not array index\n for (const char of chars) {\n if (char && char.charIndex >= selectionStart && char.charIndex < selectionEnd) {\n const lineIndex = char.lineIndex\n if (!lineGroups.has(lineIndex)) {\n lineGroups.set(lineIndex, [])\n }\n lineGroups.get(lineIndex)?.push(char)\n }\n }\n\n // Create one selection rectangle per line\n for (const [_lineIndex, lineChars] of lineGroups) {\n if (lineChars.length === 0) continue\n\n const firstChar = lineChars[0]\n const lastChar = lineChars[lineChars.length - 1]\n\n if (firstChar && lastChar) {\n const selectionX = startX + firstChar.x\n const selectionY = startY + firstChar.y\n const selectionWidth =\n lastChar.x + lastChar.width - firstChar.x + (lineChars.length > 1 ? charSpacing : 0)\n const selectionHeight = firstChar.height\n\n // Create selection rectangle for this line\n const selectionRect = scene.add.rectangle(\n selectionX,\n selectionY,\n selectionWidth,\n selectionHeight,\n selectionColor,\n selectionAlpha\n )\n selectionRect.setOrigin(0, 0)\n container.add(selectionRect)\n\n // Move selection behind text\n container.moveDown(selectionRect)\n\n selectionRefs.current.push(selectionRect)\n }\n }\n }, 15)\n\n // Cleanup\n return () => {\n selectionRefs.current.forEach((rect) => rect.destroy())\n selectionRefs.current = []\n }\n }, [\n selectionStart,\n selectionEnd,\n chars,\n selectionColor,\n selectionAlpha,\n padLeft,\n padTop,\n charSpacing,\n ])\n\n return (\n <View\n ref={internalRef}\n width={width}\n height={height}\n enableGestures={!props.disabled && showCursor}\n onTouch={(data: GestureEventData) => {\n if (!showCursor) return\n const pos = getPositionFromPointer(\n data.pointer.worldX,\n data.pointer.worldY,\n chars,\n cursorPosition\n )\n dragStartPosRef.current = pos\n props.onCursorPositionChange?.(pos)\n props.onSelectionChange?.(-1, -1)\n data.stopPropagation()\n }}\n onTouchMove={(data: GestureEventData) => {\n if (!showCursor) return\n if (data.state === 'start') {\n dragStartPosRef.current = getPositionFromPointer(\n data.pointer.worldX,\n data.pointer.worldY,\n chars,\n cursorPosition\n )\n } else if (data.state === 'move' && dragStartPosRef.current >= 0) {\n const currentPos = getPositionFromPointer(\n data.pointer.worldX,\n data.pointer.worldY,\n chars,\n cursorPosition\n )\n if (currentPos !== dragStartPosRef.current) {\n const start = Math.min(dragStartPosRef.current, currentPos)\n const end = Math.max(dragStartPosRef.current, currentPos)\n props.onSelectionChange?.(start, end)\n }\n } else if (data.state === 'end') {\n dragStartPosRef.current = -1\n }\n data.stopPropagation()\n }}\n {...props}\n {...themed}\n />\n )\n}\n","/** @jsxImportSource ../.. */\nimport type { ViewProps } from '..'\nimport { useEffect, useRedraw, useRef, useState } from '../../hooks'\nimport { KeyboardInputManager } from '../../utils/KeyboardInputManager'\nimport { CharText, type CharTextAPI } from './CharText'\n\n/**\n * Props for CharTextInput component\n */\nexport interface CharTextInputProps extends Omit<ViewProps, 'children'> {\n /** Input value (controlled) */\n value?: string\n\n /** Placeholder text when empty */\n placeholder?: string\n\n /** Whether input is disabled */\n disabled?: boolean\n\n /** Maximum length of input */\n maxLength?: number\n\n /** Enable multi-line text input */\n multiline?: boolean\n\n /** Text style for characters */\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n\n /** Spacing between characters */\n charSpacing?: number\n\n /** Line height multiplier for multi-line */\n lineHeight?: number\n\n /** Maximum number of lines (multi-line only) */\n maxLines?: number\n\n /** How to handle text overflow when maxLines is reached */\n textOverflow?: 'clip' | 'ellipsis'\n\n /** Word wrap behavior (default: true) */\n wordWrap?: boolean\n\n /** Cursor color */\n cursorColor?: number\n\n /** Cursor width in pixels */\n cursorWidth?: number\n\n /** Cursor blink speed in milliseconds */\n cursorBlinkSpeed?: number\n\n /** Selection background color */\n selectionColor?: number\n\n /** Selection background alpha */\n selectionAlpha?: number\n\n /** show html input area */\n debugHtmlInput?: boolean\n\n /** Called when input value changes */\n onChange?: (value: string) => void\n\n /** Called when input receives focus */\n onFocus?: () => void\n\n /** Called when input loses focus */\n onBlur?: () => void\n\n /** Called when Enter key is pressed */\n onSubmit?: (value: string) => void\n}\n\n/**\n * CharTextInput component - text input using CharText for rendering\n * @param props - CharTextInput properties\n * @returns CharTextInput JSX element\n *\n * TODO: For multiline mode with height constraints, consider wrapping CharText\n * in a ScrollView component. This would provide:\n * - Automatic scrolling when content exceeds available height\n * - Better UX for long text input\n * - No need for maxLines clipping\n * - Scroll-to-cursor behavior on input\n */\nexport function CharTextInput(props: CharTextInputProps) {\n const containerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const inputManagerRef = useRef<KeyboardInputManager | null>(null)\n const charTextApiRef = useRef<CharTextAPI | null>(null)\n\n // Internal state for uncontrolled mode\n const [internalValue, setInternalValue] = useState(props.value ?? '')\n const [cursorPosition, setCursorPosition] = useState(0)\n const [selectionAnchor, setSelectionAnchor] = useState(-1) // -1 = no selection, else anchor position\n const [isFocused, setIsFocused] = useState(false)\n\n // Refs for current values (used in event handlers to avoid stale closures)\n const refCurrentValue = useRef(props.value ?? '')\n const refCursorPosition = useRef(0)\n const refSelectionAnchor = useRef(-1)\n\n // Use controlled value if provided\n const currentValue = props.value !== undefined ? props.value : internalValue\n const isControlled = props.value !== undefined\n\n // Sync refs with state\n refCurrentValue.current = currentValue\n refCursorPosition.current = cursorPosition\n refSelectionAnchor.current = selectionAnchor\n\n // Calculate selection start/end from anchor and cursor\n const selectionStart = selectionAnchor >= 0 ? Math.min(selectionAnchor, cursorPosition) : -1\n const selectionEnd = selectionAnchor >= 0 ? Math.max(selectionAnchor, cursorPosition) : -1\n\n const redraw = useRedraw()\n\n useEffect(() => {\n // Force multiple redraws to ensure container dimensions are properly calculated\n // First redraw after initial mount to have containerRef set and html input created\n const timer = setTimeout(() => redraw(), 0)\n return () => {\n clearTimeout(timer)\n }\n }, [containerRef.current])\n\n /**\n * Setup keyboard input manager\n */\n useEffect(() => {\n if (!containerRef.current) return\n\n const container = containerRef.current\n\n inputManagerRef.current = new KeyboardInputManager(container, {\n ...(props.maxLength !== undefined && { maxLength: props.maxLength }),\n ...(props.disabled !== undefined && { disabled: props.disabled }),\n debug: props.debugHtmlInput ?? false,\n onInput: (_value, _event) => {\n // Ignored - we handle all input via onKeyDown\n },\n onKeyDown: (event) => {\n // Handle special keys\n if (event.key === 'Enter') {\n if (!props.multiline) {\n event.preventDefault()\n props.onSubmit?.(refCurrentValue.current)\n } else {\n // Insert newline\n event.preventDefault()\n handleCharacterInput('\\n')\n // Force immediate redraw to show cursor on new line\n redraw()\n }\n } else if (event.key === 'Backspace') {\n handleBackspace(event)\n } else if (event.key === 'Delete') {\n handleDelete(event)\n } else if (event.key === 'ArrowLeft') {\n handleArrowLeft(event)\n } else if (event.key === 'ArrowRight') {\n handleArrowRight(event)\n } else if (event.key === 'ArrowUp') {\n handleArrowUp(event)\n } else if (event.key === 'ArrowDown') {\n handleArrowDown(event)\n } else if (event.key === 'Home') {\n handleHome(event)\n } else if (event.key === 'End') {\n handleEnd(event)\n } else if (event.key === 'a' && (event.ctrlKey || event.metaKey)) {\n handleSelectAll(event)\n } else if (isPrintableKey(event)) {\n // Handle printable characters\n event.preventDefault()\n handleCharacterInput(event.key)\n }\n // TODO: Copy/Paste with Ctrl+C/V or Cmd+C/V\n },\n onFocus: () => {\n setIsFocused(true)\n inputManagerRef.current?.setPointerEvents(false)\n setCursorPosition(currentValue.length)\n props.onFocus?.()\n },\n onBlur: () => {\n setIsFocused(false)\n setSelectionAnchor(-1)\n inputManagerRef.current?.setPointerEvents(true)\n props.onBlur?.()\n },\n })\n\n return () => {\n inputManagerRef.current?.destroy()\n inputManagerRef.current = null\n }\n }, [containerRef.current, props.maxLength, props.disabled, props.multiline, isControlled])\n\n /**\n * Check if key event represents a printable character\n */\n const isPrintableKey = (event: KeyboardEvent): boolean => {\n // Ignore if modifier keys are pressed (except Shift)\n if (event.ctrlKey || event.metaKey || event.altKey) {\n return false\n }\n\n // Single printable character\n if (event.key.length === 1) {\n return true\n }\n\n return false\n }\n\n /**\n * Handle printable character input\n */\n const handleCharacterInput = (char: string) => {\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n let newValue: string\n let newCursorPos: number\n\n if (anchor >= 0) {\n // Replace selection with new character\n const selStart = Math.min(anchor, cursorPosition)\n const selEnd = Math.max(anchor, cursorPosition)\n newValue = currentValue.slice(0, selStart) + char + currentValue.slice(selEnd)\n newCursorPos = selStart + char.length\n } else {\n // Insert at cursor position\n newValue = currentValue.slice(0, cursorPosition) + char + currentValue.slice(cursorPosition)\n newCursorPos = cursorPosition + char.length\n }\n\n // Enforce maxLength\n if (props.maxLength !== undefined && newValue.length > props.maxLength) {\n return\n }\n\n // Check if newline would exceed maxLines (multiline mode)\n if (props.multiline && char === '\\n' && props.maxLines !== undefined) {\n const lineCount = newValue.split('\\n').length\n if (lineCount > props.maxLines) {\n return\n }\n }\n\n // Check if character fits (single-line only)\n if (!props.multiline && charTextApiRef.current) {\n // For selection replacement, we need to check if the char fits at the selection start\n const insertPosition = anchor >= 0 ? Math.min(anchor, cursorPosition) : cursorPosition\n if (!charTextApiRef.current.canFitChar(char, insertPosition)) {\n return\n }\n }\n\n updateValue(newValue)\n\n // Update cursor position in both state and ref for immediate effect\n setCursorPosition(newCursorPos)\n refCursorPosition.current = newCursorPos\n\n setSelectionAnchor(-1)\n refSelectionAnchor.current = -1\n }\n\n /**\n * Handle backspace key\n */\n const handleBackspace = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (anchor >= 0) {\n // Delete selection\n const selStart = Math.min(anchor, cursorPosition)\n const selEnd = Math.max(anchor, cursorPosition)\n const newValue = currentValue.slice(0, selStart) + currentValue.slice(selEnd)\n updateValue(newValue)\n setCursorPosition(selStart)\n setSelectionAnchor(-1)\n } else if (cursorPosition > 0) {\n // Delete character before cursor\n const newValue =\n currentValue.slice(0, cursorPosition - 1) + currentValue.slice(cursorPosition)\n updateValue(newValue)\n const newPos = cursorPosition - 1\n setCursorPosition(newPos)\n }\n }\n\n /**\n * Handle delete key\n */\n const handleDelete = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (anchor >= 0) {\n // Delete selection\n const selStart = Math.min(anchor, cursorPosition)\n const selEnd = Math.max(anchor, cursorPosition)\n const newValue = currentValue.slice(0, selStart) + currentValue.slice(selEnd)\n updateValue(newValue)\n setCursorPosition(selStart)\n setSelectionAnchor(-1)\n } else if (cursorPosition < currentValue.length) {\n // Delete character after cursor\n const newValue =\n currentValue.slice(0, cursorPosition) + currentValue.slice(cursorPosition + 1)\n updateValue(newValue)\n }\n }\n\n /**\n * Handle arrow left key\n */\n const handleArrowLeft = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (event.shiftKey) {\n // Extend/start selection to the left\n if (anchor < 0) {\n // Start new selection - anchor at current position\n setSelectionAnchor(cursorPosition)\n }\n if (cursorPosition > 0) {\n setCursorPosition(cursorPosition - 1)\n }\n } else {\n // Move cursor (clear selection)\n\n setSelectionAnchor(-1)\n if (cursorPosition > 0) {\n setCursorPosition(cursorPosition - 1)\n }\n }\n }\n\n /**\n * Handle arrow right key\n */\n const handleArrowRight = (event: KeyboardEvent) => {\n event.preventDefault()\n\n const currentValue = refCurrentValue.current\n const cursorPosition = refCursorPosition.current\n const anchor = refSelectionAnchor.current\n\n if (event.shiftKey) {\n // Extend/start selection to the right\n if (anchor < 0) {\n // Start new selection - anchor at current position\n setSelectionAnchor(cursorPosition)\n }\n if (cursorPosition < currentValue.length) {\n setCursorPosition(cursorPosition + 1)\n }\n } else {\n setSelectionAnchor(-1)\n if (cursorPosition < currentValue.length) {\n setCursorPosition(cursorPosition + 1)\n }\n }\n }\n\n /**\n * Handle arrow up key (multiline)\n */\n const handleArrowUp = (event: KeyboardEvent) => {\n event.preventDefault()\n }\n\n /**\n * Handle arrow down key (multiline)\n */\n const handleArrowDown = (event: KeyboardEvent) => {\n event.preventDefault()\n }\n\n /**\n * Handle home key\n */\n const handleHome = (event: KeyboardEvent) => {\n event.preventDefault()\n setSelectionAnchor(-1)\n setCursorPosition(0)\n }\n\n /**\n * Handle end key\n */\n const handleEnd = (event: KeyboardEvent) => {\n event.preventDefault()\n const currentValue = refCurrentValue.current\n setSelectionAnchor(-1)\n setCursorPosition(currentValue.length)\n }\n\n /**\n * Handle select all (Ctrl+A / Cmd+A)\n */\n const handleSelectAll = (event: KeyboardEvent) => {\n event.preventDefault()\n const currentValue = refCurrentValue.current\n setSelectionAnchor(0)\n setCursorPosition(currentValue.length)\n }\n\n /**\n * Update value (controlled or uncontrolled)\n */\n const updateValue = (newValue: string) => {\n if (isControlled) {\n props.onChange?.(newValue)\n } else {\n setInternalValue(newValue)\n props.onChange?.(newValue)\n }\n }\n\n /**\n * Handle cursor position change from CharText click\n */\n const handleCursorPositionChange = (position: number) => {\n setCursorPosition(position)\n setSelectionAnchor(-1)\n\n // Focus DOM input\n // inputManagerRef.current?.focus()\n }\n\n /**\n * Handle selection change from CharText drag\n */\n const handleSelectionChange = (start: number, end: number) => {\n if (start >= 0 && end > start) {\n setSelectionAnchor(start)\n setCursorPosition(end)\n } else {\n setSelectionAnchor(-1)\n }\n\n // Focus DOM input\n // inputManagerRef.current?.focus()\n }\n\n // Build CharText props - extract CharTextInput-specific props and pass rest to CharText\n const {\n value: _value,\n placeholder: _placeholder,\n onChange: _onChange,\n onFocus: _onFocus,\n onBlur: _onBlur,\n onSubmit: _onSubmit,\n ...viewProps\n } = props\n\n // Determine displayed text: actual value, or placeholder if empty and not focused\n const displayText = currentValue || (props.placeholder && !isFocused ? props.placeholder : '')\n\n return (\n <CharText\n forwardRef={(r) => (containerRef.current = r)}\n {...viewProps}\n text={displayText}\n showCursor={isFocused}\n cursorPosition={cursorPosition}\n selectionStart={selectionStart}\n selectionEnd={selectionEnd}\n onCursorPositionChange={handleCursorPositionChange}\n onSelectionChange={handleSelectionChange}\n onApiReady={(api) => (charTextApiRef.current = api)}\n />\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Divider component - Simple visual separator\n * Test component to validate TSX support in packages/ui\n */\nimport type { SizeValue } from '@number10/phaserjsx/core-props'\nimport { View } from '../index'\n\n/**\n * Props for Divider component\n */\nexport interface DividerProps {\n /** Orientation of the divider */\n orientation?: 'horizontal' | 'vertical'\n /** Thickness of the divider line */\n thickness?: SizeValue | undefined\n /** Color of the divider */\n color?: number\n /** Length of the divider (defaults to 100%) */\n length?: SizeValue | undefined\n}\n\n/**\n * Divider component - renders a simple line separator\n * @param props - Divider properties\n * @returns Divider JSX element\n */\nexport function Divider(props: DividerProps) {\n const { orientation = 'horizontal', thickness = 1, color = 0xcccccc, length } = props\n\n const isHorizontal = orientation === 'horizontal'\n\n return (\n <View\n width={isHorizontal ? (length ?? '100%') : thickness}\n height={isHorizontal ? thickness : (length ?? '100%')}\n backgroundColor={color}\n />\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * ScrollSlider component for scrollable content areas\n */\nimport Phaser from 'phaser'\nimport type { GestureEventData } from '../../core-props'\nimport { useRef } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { LayoutSize } from '../index'\nimport { View } from '../index'\n\n/** Size variants for the scroll slider */\nexport type SliderSize = 'large' | 'medium' | 'small' | 'tiny' | undefined\n\n/**\n * Calculate slider dimensions based on size variant and theme\n * @param size - Size variant\n * @returns Calculated dimensions\n */\nexport function calculateSliderSize(size: SliderSize) {\n const { props: themed } = getThemedProps('ScrollSlider', undefined, {})\n const sizeFactor = size === 'large' ? 1.25 : size === 'small' ? 0.75 : size === 'tiny' ? 0.5 : 1 // medium or undefined\n const border = (themed.borderWidth ?? 1) * sizeFactor\n const outer = (themed.size ?? 24) * sizeFactor\n const dimension = outer - border * 2\n\n return { border, outer, dimension }\n}\n\n/**\n * Props for ScrollSlider component\n */\nexport interface ScrollSliderProps {\n /** Direction of the slider */\n direction: 'vertical' | 'horizontal'\n /** Whether to a size variant, default is medium */\n size?: SliderSize\n /** Current scroll position in pixels */\n scrollPosition: number\n /** Viewport size in pixels */\n viewportSize: number\n /** Content size in pixels */\n contentSize: number\n /** Callback when slider is scrolled, returns new scroll position in pixels */\n onScroll: (scrollPosition: number) => void\n /** Enable momentum scrolling for thumb dragging */\n momentum?: boolean\n /** Callback when momentum (or drag end without momentum) finishes */\n onMomentumEnd?: () => void\n}\n\n/**\n * ScrollSlider component providing slider functionality for ScrollView\n * @param props - ScrollSlider properties\n * @returns JSX element\n */\nexport function ScrollSlider(props: ScrollSliderProps) {\n const {\n direction,\n scrollPosition,\n viewportSize,\n contentSize,\n onScroll,\n momentum = true,\n onMomentumEnd,\n } = props\n const { props: themed } = getThemedProps('ScrollSlider', undefined, {})\n const sliderRef = useRef<Phaser.GameObjects.Container | null>(null)\n const isDraggingRef = useRef(false)\n const trackContainerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const velocityRef = useRef(0)\n const lastTimeRef = useRef(0)\n const tweenRef = useRef<Phaser.Tweens.Tween | null>(null)\n\n const isVertical = direction === 'vertical'\n const { border, outer, dimension } = calculateSliderSize(props.size)\n\n // Get actual resolved track size from the container after layout\n const containerWithLayout = trackContainerRef.current as\n | (Phaser.GameObjects.Container & {\n __getLayoutSize?: () => LayoutSize\n })\n | null\n\n const resolvedTrackSize = containerWithLayout?.__getLayoutSize\n ? isVertical\n ? containerWithLayout.__getLayoutSize().height\n : containerWithLayout.__getLayoutSize().width\n : containerWithLayout && containerWithLayout.width > 0 && containerWithLayout.height > 0\n ? isVertical\n ? containerWithLayout.height\n : containerWithLayout.width\n : 800 // fallback\n\n const trackSizeInner = resolvedTrackSize - border * 2\n const minThumbSize = themed.minThumbSize ?? 20\n\n // Calculate thumb size based on viewport to content ratio\n const maxScroll = Math.max(0, contentSize - viewportSize)\n const visibleRatio = contentSize > 0 ? viewportSize / contentSize : 1\n const thumbSize = Math.max(minThumbSize, trackSizeInner * visibleRatio)\n const thumbRange = trackSizeInner - thumbSize\n\n // Calculate thumb position from scroll position\n const thumbPosition = maxScroll > 0 ? (scrollPosition / maxScroll) * thumbRange : 0\n\n const handleThumbTouchMove = (data: GestureEventData) => {\n // Stop event propagation to prevent ScrollView from receiving the event\n data.stopPropagation()\n\n if (data.state === 'start') {\n isDraggingRef.current = true\n velocityRef.current = 0\n lastTimeRef.current = Date.now()\n // Stop any ongoing momentum tween\n if (tweenRef.current) {\n tweenRef.current.stop()\n tweenRef.current = null\n }\n return\n }\n\n if (data.state === 'end') {\n isDraggingRef.current = false\n if (momentum && Math.abs(velocityRef.current) > 0.1) {\n startMomentum(scrollPosition)\n } else if (onMomentumEnd) {\n onMomentumEnd()\n }\n return\n }\n\n if (!isDraggingRef.current) return\n\n const delta = isVertical ? (data.dy ?? 0) : (data.dx ?? 0)\n const now = Date.now()\n const deltaTime = now - lastTimeRef.current\n if (deltaTime > 0) {\n velocityRef.current = (delta / deltaTime) * 1000 // pixels per second\n lastTimeRef.current = now\n }\n\n const newThumbPos = Math.max(0, Math.min(thumbRange, thumbPosition + delta))\n const newScrollPos = thumbRange > 0 ? (newThumbPos / thumbRange) * maxScroll : 0\n\n onScroll(newScrollPos)\n }\n\n const startMomentum = (startPos: number) => {\n if (!sliderRef.current?.scene) return\n\n const scene = sliderRef.current.scene\n const duration = Math.min(1000, Math.max(200, Math.abs(velocityRef.current))) // 200-1000ms\n const targetScrollPos = Math.max(\n 0,\n Math.min(maxScroll, startPos + velocityRef.current * (duration / 1000))\n )\n\n tweenRef.current = scene.tweens.add({\n targets: { pos: startPos },\n pos: targetScrollPos,\n duration,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { pos: number }\n onScroll(target.pos)\n },\n onComplete: () => {\n tweenRef.current = null\n if (onMomentumEnd) {\n onMomentumEnd()\n }\n },\n })\n }\n\n const handleBackgroundTouch = (data: GestureEventData) => {\n // Stop event propagation to prevent ScrollView from receiving the event\n data.stopPropagation()\n\n // localY/localX is relative to the background view which has the full trackSizeInner dimensions\n const localPos = isVertical ? (data.localY ?? 0) : (data.localX ?? 0)\n\n // Calculate the center position of where the thumb should be\n const targetThumbCenter = Math.max(\n thumbSize / 2,\n Math.min(trackSizeInner - thumbSize / 2, localPos)\n )\n\n // Convert to thumb position (top-left corner)\n const targetThumbPos = targetThumbCenter - thumbSize / 2\n\n // Calculate scroll position in pixels from thumb position\n const targetScrollPos = thumbRange > 0 ? (targetThumbPos / thumbRange) * maxScroll : 0\n\n onScroll(Math.max(0, Math.min(maxScroll, targetScrollPos)))\n }\n\n return (\n <View\n ref={trackContainerRef}\n width={isVertical ? outer : '100%'}\n height={isVertical ? '100%' : outer}\n backgroundColor={themed.borderColor ?? 0x000000}\n padding={border}\n >\n <View\n ref={sliderRef}\n width={isVertical ? dimension : '100%'}\n height={isVertical ? '100%' : dimension}\n backgroundColor={themed.trackColor ?? 0xdddddd}\n direction=\"stack\"\n padding={0}\n >\n <View\n width={isVertical ? dimension : '100%'}\n height={isVertical ? '100%' : dimension}\n x={0}\n y={0}\n backgroundColor={themed.trackColor ?? 0xaaaaaa}\n enableGestures={true}\n onTouch={handleBackgroundTouch}\n />\n <View\n width={isVertical ? dimension : thumbSize}\n height={isVertical ? thumbSize : dimension}\n x={isVertical ? 0 : thumbPosition}\n y={isVertical ? thumbPosition : 0}\n backgroundColor={themed.thumbColor ?? 0xeeeebb}\n enableGestures={true}\n onTouchMove={handleThumbTouchMove}\n />\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * ScrollView component providing a scrollable area with optional sliders\n */\nimport Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport type { GestureEventData, WheelEventData } from '../../core-props'\nimport { useEffect, useRedraw, useRef, useState } from '../../hooks'\nimport { getRenderContext } from '../../render-context'\nimport { View } from '../index'\nimport { calculateSliderSize, ScrollSlider, type SliderSize } from './ScrollSlider'\n\n/**\n * Scroll information data\n */\nexport interface ScrollInfo {\n /** Current horizontal scroll position */\n dx: number\n /** Current vertical scroll position */\n dy: number\n /** Viewport width */\n viewportWidth: number\n /** Viewport height */\n viewportHeight: number\n /** Content width */\n contentWidth: number\n /** Content height */\n contentHeight: number\n /** Maximum horizontal scroll */\n maxScrollX: number\n /** Maximum vertical scroll */\n maxScrollY: number\n}\n\n/**\n * Snap configuration types\n */\nexport type SnapMode = { positions: number[]; threshold?: number }\nexport type SnapAlignment = 'start' | 'center' | 'end'\n\n/**\n * Props for ScrollView component\n */\nexport interface ScrollViewProps extends ViewProps {\n /** Whether to show the vertical scroll slider (default: auto) */\n showVerticalSlider?: boolean | 'auto' | undefined\n /** Whether to show the vertical scroll slider (default: auto) */\n showHorizontalSlider?: boolean | 'auto' | undefined\n /** Size variant for the scroll sliders */\n sliderSize?: SliderSize\n /** Initial scroll position */\n scroll?: { dx: number; dy: number }\n /** Callback when scroll information changes */\n onScrollInfoChange?: (info: ScrollInfo) => void\n /** Snap behavior: false (disabled), 'auto' (to items), or manual positions */\n snap?: SnapMode | undefined\n /** Alignment for snapping */\n snapAlignment?: SnapAlignment\n /** Threshold for snap (pixels) */\n snapThreshold?: number\n /** Enable momentum scrolling */\n momentum?: boolean\n}\n\n/**\n * ScrollView component providing a scrollable area with an optional vertical slider\n * @param props - ScrollView properties\n * @returns JSX element\n */\nexport function ScrollView(props: ScrollViewProps) {\n const {\n children,\n showVerticalSlider = 'auto',\n showHorizontalSlider = 'auto',\n scroll: initialScroll,\n onScrollInfoChange,\n snap = false,\n snapAlignment = 'start',\n snapThreshold = 20,\n momentum = true,\n } = props\n\n const [scroll, setScroll] = useState(initialScroll ?? { dx: 0, dy: 0 })\n const scrollRef = useRef(scroll)\n\n const contentRef = useRef<Phaser.GameObjects.Container | null>(null)\n const viewportRef = useRef<Phaser.GameObjects.Container | null>(null)\n\n const [contentHeight, setContentHeight] = useState(0)\n const [contentWidth, setContentWidth] = useState(0)\n\n // State for momentum scrolling\n const [velocity, setVelocity] = useState({ vx: 0, vy: 0 })\n const [lastTime, setLastTime] = useState(0)\n const tweenRef = useRef<Phaser.Tweens.Tween | null>(null)\n const wheelSnapTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const WHEEL_SNAP_DELAY = 200\n\n // Get slider size, considering size variant and theme\n const { outer: sliderSize } = calculateSliderSize(props.sliderSize)\n\n // Calculate if scrolling is needed\n const viewportHeight = viewportRef.current?.height ?? 0\n const viewportWidth = viewportRef.current?.width ?? 0\n const effectiveContentHeight = Math.max(contentHeight, viewportHeight)\n const effectiveContentWidth = Math.max(contentWidth, viewportWidth)\n\n // Use epsilon threshold to avoid floating-point precision issues\n const epsilon = 0.5\n const needsVerticalScroll = effectiveContentHeight > viewportHeight + epsilon\n const needsHorizontalScroll = effectiveContentWidth > viewportWidth + epsilon\n\n const showVerticalSliderActual =\n showVerticalSlider === true || (needsVerticalScroll && showVerticalSlider === 'auto')\n const showHorizontalSliderActual =\n showHorizontalSlider === true || (needsHorizontalScroll && showHorizontalSlider === 'auto')\n\n const maxScrollY = Math.max(0, effectiveContentHeight - viewportHeight)\n const maxScrollX = Math.max(0, effectiveContentWidth - viewportWidth)\n\n const updateScroll = (\n value:\n | { dx: number; dy: number }\n | ((prev: { dx: number; dy: number }) => { dx: number; dy: number })\n ) => {\n setScroll((prev) => {\n const next = typeof value === 'function' ? value(prev) : value\n scrollRef.current = next\n return next\n })\n }\n\n const stopActiveTween = () => {\n if (tweenRef.current) {\n tweenRef.current.stop()\n tweenRef.current = null\n }\n }\n\n const resolvedSnapThreshold =\n typeof snap === 'object' && 'positions' in snap\n ? (snap.threshold ?? snapThreshold)\n : snapThreshold\n const effectiveSnapThreshold =\n resolvedSnapThreshold === undefined || resolvedSnapThreshold < 0\n ? Infinity\n : resolvedSnapThreshold\n\n // Update scroll when props.scroll changes\n useEffect(() => {\n if (initialScroll) {\n updateScroll(initialScroll)\n }\n }, [initialScroll])\n\n // Notify parent of scroll info changes\n useEffect(() => {\n if (onScrollInfoChange && viewportWidth > 0 && viewportHeight > 0) {\n onScrollInfoChange({\n dx: scroll.dx,\n dy: scroll.dy,\n viewportWidth,\n viewportHeight,\n contentWidth: effectiveContentWidth,\n contentHeight: effectiveContentHeight,\n maxScrollX,\n maxScrollY,\n })\n }\n }, [\n scroll,\n viewportWidth,\n viewportHeight,\n effectiveContentWidth,\n effectiveContentHeight,\n maxScrollX,\n maxScrollY,\n ])\n\n // Update content dimensions after layout\n useEffect(() => {\n const update = () => {\n if (contentRef.current) {\n const newHeight = contentRef.current.height\n const newWidth = contentRef.current.width\n if (newHeight !== contentHeight) {\n setContentHeight(newHeight)\n }\n if (newWidth !== contentWidth) {\n setContentWidth(newWidth)\n }\n }\n // Defer again for next layout\n if (contentRef.current?.scene) {\n getRenderContext(contentRef.current.scene).deferLayout(update)\n }\n }\n if (contentRef.current?.scene) {\n getRenderContext(contentRef.current.scene).deferLayout(update)\n }\n }, [])\n\n const calc = (deltaX: number, deltaY: number) => {\n if (!contentRef.current || !viewportRef.current) return\n\n // Get viewport and content dimensions\n const viewportHeight = viewportRef.current.height\n const viewportWidth = viewportRef.current.width\n const contentHeight = contentRef.current.height\n const contentWidth = contentRef.current.width\n // Calculate new scroll position\n const maxScrollY = Math.max(0, contentHeight - viewportHeight)\n const maxScrollX = Math.max(0, contentWidth - viewportWidth)\n const newScrollY = Math.max(0, Math.min(maxScrollY, scroll.dy - deltaY))\n const newScrollX = Math.max(0, Math.min(maxScrollX, scroll.dx - deltaX))\n\n updateScroll({ dx: newScrollX, dy: newScrollY })\n }\n\n const startMomentum = () => {\n if (!contentRef.current?.scene) return\n\n const scene = contentRef.current.scene\n const duration = Math.min(1000, Math.max(200, Math.abs(velocity.vx) + Math.abs(velocity.vy))) // 200-1000ms\n const currentScroll = scrollRef.current\n const baseTargetDx = Math.max(\n 0,\n Math.min(maxScrollX, currentScroll.dx - velocity.vx * (duration / 1000))\n )\n const baseTargetDy = Math.max(\n 0,\n Math.min(maxScrollY, currentScroll.dy - velocity.vy * (duration / 1000))\n )\n const snappedTarget = snap ? calculateSnapDestination(baseTargetDx, baseTargetDy) : null\n\n stopActiveTween()\n\n tweenRef.current = scene.tweens.add({\n targets: { dx: currentScroll.dx, dy: currentScroll.dy },\n dx: snappedTarget?.dx ?? baseTargetDx,\n dy: snappedTarget?.dy ?? baseTargetDy,\n duration,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { dx: number; dy: number }\n updateScroll({ dx: target.dx, dy: target.dy })\n },\n onComplete: () => {\n tweenRef.current = null\n },\n })\n }\n\n type SnapTarget = { position: number; size: number }\n\n const getSnapTargets = (): { x: SnapTarget[]; y: SnapTarget[] } => {\n const viewportHeightCurrent = viewportRef.current?.height ?? viewportHeight\n const viewportWidthCurrent = viewportRef.current?.width ?? viewportWidth\n\n if (typeof snap === 'object' && 'positions' in snap) {\n const sorted = [...snap.positions].sort((a, b) => a - b)\n const inferredSizeY =\n sorted.length > 1\n ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0))\n : viewportHeightCurrent || 0\n const inferredSizeX =\n sorted.length > 1\n ? Math.max(0, (sorted[1] ?? 0) - (sorted[0] ?? 0))\n : viewportWidthCurrent || 0\n const targetsX = sorted.map((position, index) => {\n const next = sorted[index + 1]\n const size =\n next !== undefined\n ? Math.max(0, next - position)\n : inferredSizeX > 0\n ? inferredSizeX\n : viewportWidthCurrent || 0\n return { position, size }\n })\n const targetsY = sorted.map((position, index) => {\n const next = sorted[index + 1]\n const size =\n next !== undefined\n ? Math.max(0, next - position)\n : inferredSizeY > 0\n ? inferredSizeY\n : viewportHeightCurrent || 0\n return { position, size }\n })\n return { x: targetsX, y: targetsY }\n }\n\n return { x: [], y: [] }\n }\n\n const findNearestSnap = (\n current: number,\n targets: SnapTarget[],\n viewportSize: number,\n maxScroll: number\n ): number => {\n if (targets.length === 0) return current\n\n let nearest = current\n let minDistance = Infinity\n\n for (const { position, size } of targets) {\n let adjustedPos = position\n\n if (snapAlignment === 'center') {\n adjustedPos = position + size / 2 - viewportSize / 2\n } else if (snapAlignment === 'end') {\n adjustedPos = position + size - viewportSize\n }\n\n adjustedPos = Math.max(0, Math.min(maxScroll, adjustedPos))\n const distance = Math.abs(current - adjustedPos)\n\n if (distance < minDistance && distance <= effectiveSnapThreshold) {\n minDistance = distance\n nearest = adjustedPos\n } else if (distance < minDistance && effectiveSnapThreshold === Infinity) {\n minDistance = distance\n nearest = adjustedPos\n }\n }\n\n return nearest\n }\n\n const calculateSnapDestination = (baseDx: number, baseDy: number) => {\n const { x: xTargets, y: yTargets } = getSnapTargets()\n const viewportHeightLocal = viewportRef.current?.height ?? 0\n const viewportWidthLocal = viewportRef.current?.width ?? 0\n\n const targetDx = findNearestSnap(baseDx, xTargets, viewportWidthLocal, maxScrollX)\n const targetDy = findNearestSnap(baseDy, yTargets, viewportHeightLocal, maxScrollY)\n\n return { dx: targetDx, dy: targetDy }\n }\n\n const applySnap = () => {\n if (!contentRef.current?.scene || !snap) return\n\n const currentScroll = scrollRef.current\n const { dx: targetDx, dy: targetDy } = calculateSnapDestination(\n currentScroll.dx,\n currentScroll.dy\n )\n\n if (targetDx === currentScroll.dx && targetDy === currentScroll.dy) return\n\n const scene = contentRef.current.scene\n stopActiveTween()\n\n tweenRef.current = scene.tweens.add({\n targets: { dx: currentScroll.dx, dy: currentScroll.dy },\n dx: targetDx,\n dy: targetDy,\n duration: 250,\n ease: 'Quad.easeOut',\n onUpdate: (tween) => {\n const target = tween.targets[0] as { dx: number; dy: number }\n updateScroll({ dx: target.dx, dy: target.dy })\n },\n onComplete: () => {\n tweenRef.current = null\n },\n })\n }\n\n const handleVerticalScroll = (scrollPos: number) => {\n const clampedScrollPos = Math.max(0, Math.min(maxScrollY, scrollPos))\n updateScroll((prev) => ({ ...prev, dy: clampedScrollPos }))\n }\n\n const handleHorizontalScroll = (scrollPos: number) => {\n const clampedScrollPos = Math.max(0, Math.min(maxScrollX, scrollPos))\n updateScroll((prev) => ({ ...prev, dx: clampedScrollPos }))\n }\n\n const handleSliderMomentumEnd = () => {\n if (snap) {\n applySnap()\n }\n }\n\n const handleTouchMove = (data: GestureEventData) => {\n // Process start and move events, ignore end\n if (data.state === 'end') {\n if (momentum && (Math.abs(velocity.vx) > 0.1 || Math.abs(velocity.vy) > 0.1)) {\n startMomentum()\n } else if (snap) {\n applySnap()\n }\n return\n }\n if (data.state === 'start') {\n stopActiveTween()\n setVelocity({ vx: 0, vy: 0 })\n setLastTime(Date.now())\n data.stopPropagation()\n return\n }\n data.stopPropagation()\n\n const deltaX = data.dx ?? 0\n const deltaY = data.dy ?? 0\n\n // Calculate velocity for momentum\n const now = Date.now()\n const deltaTime = now - lastTime\n if (deltaTime > 0) {\n const newVx = (deltaX / deltaTime) * 1000 // pixels per second\n const newVy = (deltaY / deltaTime) * 1000\n setVelocity({ vx: newVx, vy: newVy })\n setLastTime(now)\n }\n\n calc(deltaX, deltaY)\n }\n\n const handleWheel = (data: WheelEventData) => {\n data.stopPropagation()\n data.preventDefault()\n\n stopActiveTween()\n calc(-data.deltaX, -data.deltaY)\n\n if (snap) {\n if (wheelSnapTimeoutRef.current) {\n clearTimeout(wheelSnapTimeoutRef.current)\n }\n wheelSnapTimeoutRef.current = setTimeout(() => applySnap(), WHEEL_SNAP_DELAY)\n }\n }\n\n // Force redraw after mount to ensure dimensions are calculated\n // and show content after that to avoid visual glitches\n const redraw = useRedraw()\n const [visible, setVisible] = useState(false)\n\n useEffect(() => {\n // Force multiple redraws to ensure container dimensions are properly calculated\n // First redraw after initial mount\n const timer1 = setTimeout(() => redraw(), 0)\n // Second redraw to catch any layout adjustments and slider dimensions\n const timer2 = setTimeout(() => setVisible(true), 2)\n return () => {\n clearTimeout(timer1)\n clearTimeout(timer2)\n if (wheelSnapTimeoutRef.current) {\n clearTimeout(wheelSnapTimeoutRef.current)\n }\n stopActiveTween()\n }\n }, [showVerticalSliderActual, showHorizontalSliderActual])\n\n return (\n <View visible={visible}>\n <View direction=\"row\" width=\"100%\" height=\"100%\" gap={0} padding={0}>\n {/* ScrollView takes remaining space */}\n <View flex={1} height={'100%'} direction=\"column\">\n <View\n ref={viewportRef}\n flex={1}\n width=\"100%\"\n //backgroundColor={0x0000ff}\n //backgroundAlpha={0.3}\n onTouchMove={handleTouchMove}\n onWheel={handleWheel}\n overflow=\"hidden\"\n direction=\"stack\"\n >\n {/* main scroll view area, can be greater than parent */}\n <View ref={contentRef} x={-scroll.dx} y={-scroll.dy}>\n {children}\n </View>\n\n {/* Invisible blocker overlay - same size as content, scrolls with content\n Blocks touches to masked content outside visible viewport area */}\n <View\n width={effectiveContentWidth}\n height={effectiveContentHeight}\n x={-scroll.dx}\n y={-scroll.dy}\n enableGestures={true}\n backgroundAlpha={0}\n onTouch={(data) => {\n const viewport = viewportRef.current\n if (!viewport) return\n\n // Get viewport world position using transform matrix\n const worldMatrix = viewport.getWorldTransformMatrix()\n const vpWorldX = worldMatrix.tx\n const vpWorldY = worldMatrix.ty\n\n // Get viewport size from layout\n const vpSize = (\n viewport as unknown as {\n __getLayoutSize?: () => { width: number; height: number }\n }\n ).__getLayoutSize?.() ?? {\n width: viewportWidth,\n height: viewportHeight,\n }\n\n // Get touch position in world coordinates\n const touchX = data.pointer?.worldX ?? 0\n const touchY = data.pointer?.worldY ?? 0\n\n // Check if touch is within viewport bounds\n // Use small epsilon for floating point comparison\n const epsilon = 0.1\n const inBounds =\n touchX >= vpWorldX - epsilon &&\n touchX <= vpWorldX + vpSize.width + epsilon &&\n touchY >= vpWorldY - epsilon &&\n touchY <= vpWorldY + vpSize.height + epsilon\n\n if (!inBounds) {\n // Touch outside viewport - block it\n data.stopPropagation()\n }\n // If in bounds, let it pass through to children below\n }}\n />\n </View>\n {/* Horizontal slider at the bottom */}\n <View visible={showHorizontalSliderActual ? true : 'none'}>\n <ScrollSlider\n direction=\"horizontal\"\n size={props.sliderSize}\n scrollPosition={scroll.dx}\n viewportSize={viewportWidth}\n contentSize={contentWidth}\n onScroll={handleHorizontalScroll}\n momentum={momentum}\n onMomentumEnd={handleSliderMomentumEnd}\n />\n </View>\n </View>\n\n {/* Vertical slider on the right */}\n <View height={'100%'} direction=\"column\" visible={showVerticalSliderActual ? true : 'none'}>\n <View flex={1}>\n <ScrollSlider\n direction=\"vertical\"\n size={props.sliderSize}\n scrollPosition={scroll.dy}\n viewportSize={viewportHeight}\n contentSize={effectiveContentHeight}\n onScroll={handleVerticalScroll}\n momentum={momentum}\n onMomentumEnd={handleSliderMomentumEnd}\n />\n </View>\n {showHorizontalSliderActual && (\n // Placeholder corner for potential icon - matches slider dimensions\n <View\n width={sliderSize}\n height={sliderSize}\n //backgroundAlpha={0.3}\n //backgroundColor={0xff0000}\n />\n )}\n </View>\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Dropdown/Select component\n * Provides single and multi-select functionality with filtering\n */\nimport type Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport { useSpring, type AnimationConfig } from '../../animation'\nimport type { GestureEventData } from '../../core-props'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useForceRedraw, useRef, useState, useTheme } from '../../hooks'\nimport type { GameObjectWithLayout } from '../../layout/types'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport { Graphics, Text, View } from '../index'\nimport { CharTextInput } from './CharTextInput'\nimport { ScrollView } from './ScrollView'\n\n/**\n * Option type for Dropdown\n */\nexport interface DropdownOption<T = string> {\n /** Unique value */\n value: T\n /** Display label */\n label: string\n /** Disabled state */\n disabled?: boolean\n /** Custom prefix content (e.g., Icon) */\n prefix?: ChildrenType\n /** Custom suffix content */\n suffix?: ChildrenType\n}\n\n/**\n * Props for Dropdown component\n */\nexport interface DropdownProps<T = string> extends Omit<ViewProps, 'children'>, EffectDefinition {\n /** Available options */\n options: DropdownOption<T>[]\n\n /** optional use stack layout, then only the trigger is part of automatic layout, rest as overlay */\n stackLayout?: boolean\n\n /** Selected value (controlled) */\n value?: T | T[]\n\n /** Default selected value (uncontrolled) */\n defaultValue?: T | T[]\n\n /** Placeholder text when nothing selected */\n placeholder?: string\n\n /** Multi-select mode */\n multiple?: boolean\n\n /** Enable filter */\n isFilterable?: boolean\n\n /** Filtering placeholder */\n filterInputPlaceholder?: string\n\n /** Disabled state */\n disabled?: boolean\n\n /** Maximum height of dropdown list */\n maxHeight?: number\n\n /** Position of dropdown (default: 'bottom') */\n placement?: 'top' | 'bottom'\n\n /** Custom render function for selected value */\n renderValue?: (selected: DropdownOption<T> | DropdownOption<T>[] | null) => ChildrenType\n\n /** Custom render function for option */\n renderOption?: (option: DropdownOption<T>, isSelected: boolean) => ChildrenType\n\n /** Custom arrow/indicator (default: simple Graphics triangle) */\n arrow?: ChildrenType\n\n /** Callback when selection changes */\n onChange?: (value: T | T[]) => void\n\n /** Callback when dropdown opens */\n onOpen?: () => void\n\n /** Callback when dropdown closes */\n onClose?: () => void\n\n /** Animation config for expand/collapse */\n animationConfig?: AnimationConfig\n\n /** Close on select (default: true for single, false for multi) */\n closeOnSelect?: boolean\n}\n\n/**\n * Default arrow component - simple Graphics triangle\n */\nfunction DefaultArrow(props: { color?: number; size?: number }) {\n const color = props.color ?? 0xffffff\n const size = props.size ?? 8\n\n return (\n <Graphics\n width={size}\n height={size}\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n g.fillStyle(color, 1)\n g.beginPath()\n g.moveTo(0, 0)\n g.lineTo(size, 0)\n g.lineTo(size / 2, size)\n g.closePath()\n g.fillPath()\n }}\n />\n )\n}\n\n/**\n * Dropdown/Select component\n * Themeable dropdown with single/multi-select, Filtering, and custom rendering\n *\n * @example\n * ```tsx\n * // Single select\n * <Dropdown\n * options={[\n * { value: '1', label: 'Option 1' },\n * { value: '2', label: 'Option 2' },\n * ]}\n * value={selected}\n * onChange={setSelected}\n * placeholder=\"Select an option\"\n * />\n *\n * // Multi-select with filtering\n * <Dropdown\n * options={options}\n * multiple={true}\n * isFiltering={true}\n * value={selectedValues}\n * onChange={setSelectedValues}\n * />\n * ```\n */\nexport function Dropdown<T = string>(props: DropdownProps<T>) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Dropdown', localTheme, {})\n\n // State management\n const [isOpen, setIsOpen] = useState(false)\n const [internalValue, setInternalValue] = useState<T | T[]>(\n props.defaultValue ?? (props.multiple ? [] : ('' as T))\n )\n const [filterQuery, setFilterQuery] = useState('')\n const [isAnimating, setIsAnimating] = useState(false)\n\n // Flag to prevent closing on option/overlay clicks\n const shouldIgnoreNextClick = useRef(false)\n\n // Refs\n const triggerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const overlayRef = useRef<Phaser.GameObjects.Container | null>(null)\n const containerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const scrollViewRef = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect } = useGameObjectEffect(triggerRef)\n\n // Controlled vs uncontrolled\n const isControlled = props.value !== undefined\n const currentValue = isControlled ? props.value : internalValue\n\n // Merge theme props\n const triggerTheme = themed.trigger ?? {}\n const overlayTheme = themed.overlay ?? {}\n const optionTheme = themed.option ?? {}\n const textStyle = themed.textStyle\n const placeholderStyle = themed.placeholderStyle\n const animationConfig = props.animationConfig ?? themed.animationConfig ?? 'gentle'\n const maxHeight = props.maxHeight ?? overlayTheme.maxHeight ?? 300\n const arrowConfig = themed.arrow ?? {}\n\n // Get selected options\n const getSelectedOptions = (): DropdownOption<T>[] => {\n if (props.multiple) {\n const values = currentValue as T[]\n return props.options.filter((opt) => values.includes(opt.value))\n } else {\n const option = props.options.find((opt) => opt.value === currentValue)\n return option ? [option] : []\n }\n }\n\n const selectedOptions = getSelectedOptions()\n\n // Animation for overlay height\n const targetHeight = isOpen ? maxHeight : 0\n const [overlayHeight, setOverlayHeight] = useSpring(targetHeight, animationConfig, () =>\n setIsAnimating(false)\n )\n useForceRedraw(20, overlayHeight)\n\n // Arrow rotation animation\n const targetRotation = isOpen ? Math.PI : 0\n const [arrowRotation, setArrowRotation] = useSpring(targetRotation, animationConfig)\n useForceRedraw(20, arrowRotation)\n\n // Toggle dropdown\n const handleToggle = (event?: GestureEventData) => {\n if (props.disabled) return\n\n event?.stopPropagation()\n\n if (isOpen) {\n // If open, close it (like clicking outside)\n handleClose()\n } else {\n // If closed, open it\n setIsOpen(true)\n setIsAnimating(true)\n setOverlayHeight(maxHeight)\n setArrowRotation(Math.PI)\n setFilterQuery('')\n props.onOpen?.()\n\n // Prevent immediate close from outside click detection\n // Especially important for placement=\"top\" where overlay overlaps trigger\n shouldIgnoreNextClick.current = true\n\n // Apply effect\n const resolved = resolveEffect(props, themed as EffectDefinition)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n }\n }\n\n // Close dropdown (for click outside)\n const handleClose = () => {\n setIsAnimating(true)\n setIsOpen(false)\n setOverlayHeight(0)\n setArrowRotation(0)\n setFilterQuery('')\n props.onClose?.()\n }\n\n // Select option\n const handleSelect = (value: T, event?: GestureEventData) => {\n // Stop propagation to prevent closing dropdown when clicking options\n event?.stopPropagation()\n shouldIgnoreNextClick.current = true\n\n if (props.multiple) {\n const values = currentValue as T[]\n const newValues = values.includes(value)\n ? values.filter((v) => v !== value)\n : [...values, value]\n\n if (!isControlled) {\n setInternalValue(newValues)\n }\n props.onChange?.(newValues)\n\n const shouldClose = props.closeOnSelect ?? false\n if (shouldClose) {\n handleClose()\n }\n } else {\n if (!isControlled) {\n setInternalValue(value)\n }\n props.onChange?.(value)\n\n const shouldClose = props.closeOnSelect ?? true\n if (shouldClose) {\n handleClose()\n }\n }\n }\n\n // Click outside detection\n const handleOutsideClick = () => {\n // Check and reset flag\n if (shouldIgnoreNextClick.current) {\n shouldIgnoreNextClick.current = false\n return\n }\n\n // Close dropdown when clicked outside\n if (isOpen) {\n handleClose()\n }\n }\n\n // Calculate overlay position and width\n const calculateOverlayPosition = (): { x: number; y: number; width: number } => {\n const triggerContainer = triggerRef.current as GameObjectWithLayout\n if (!triggerContainer) return { x: 0, y: 0, width: 0 }\n\n const triggerSize = triggerContainer.__getLayoutSize?.() ?? { width: 0, height: 0 }\n const triggerX = triggerContainer.x ?? 0\n const triggerY = triggerContainer.y ?? 0\n\n const gap = 4\n\n // Auto-placement logic\n let placement = props.placement ?? 'bottom'\n\n const overlayX = triggerX\n const overlayY =\n placement === 'bottom' ? triggerY + triggerSize.height + gap : triggerY - maxHeight - gap\n\n return { x: overlayX, y: overlayY, width: triggerSize.width }\n }\n\n // Render selected value\n const renderSelectedValue = () => {\n if (props.renderValue) {\n return props.renderValue(selectedOptions.length > 0 ? selectedOptions : null)\n }\n\n if (selectedOptions.length === 0) {\n return <Text text={props.placeholder ?? 'Select...'} style={placeholderStyle} />\n }\n\n if (props.multiple) {\n const label = `${selectedOptions.length} selected`\n return <Text text={label} style={textStyle} />\n }\n\n return <Text text={selectedOptions[0]?.label ?? ''} style={textStyle} />\n }\n\n // Calculate trigger state styles\n const getTriggerStyle = () => {\n if (props.disabled) {\n return { ...triggerTheme, ...(themed.triggerDisabled ?? {}) }\n }\n if (isOpen) {\n return { ...triggerTheme, ...(themed.triggerOpen ?? {}) }\n }\n return triggerTheme\n }\n\n const triggerStyle = getTriggerStyle()\n const overlayPosition = calculateOverlayPosition()\n\n // Render ALL options, use visible prop to show/hide based on filter\n // No useMemo - re-render on every filter change to ensure proper updates\n const renderedOptions = (() => {\n return props.options.map((option, _index) => {\n const isSelected = props.multiple\n ? (currentValue as T[]).includes(option.value)\n : currentValue === option.value\n const isDisabled =\n (option.disabled ?? false) || (isAnimating && (props.placement ?? 'bottom') === 'top')\n\n // Check if option matches current filter\n const matchesFilter = props.isFilterable\n ? option.label.toLowerCase().includes(filterQuery.toLowerCase())\n : true\n\n const optionStyle = {\n ...optionTheme,\n ...(isSelected ? (themed.optionSelected ?? {}) : {}),\n ...(isDisabled ? (themed.optionDisabled ?? {}) : {}),\n }\n\n // Extract nested theme for selected option (for Text component)\n const optionNestedTheme = isSelected ? themed.optionSelected : undefined\n\n return (\n <View\n key={String(option.value)}\n width={'fill'}\n direction=\"row\"\n alignItems=\"center\"\n enableGestures={!isDisabled}\n visible={matchesFilter ? true : 'none'}\n onTouch={(data) => {\n data.stopPropagation()\n if (!isDisabled) handleSelect(option.value, data)\n }}\n theme={optionNestedTheme}\n {...optionStyle}\n >\n {/* Custom render or default */}\n {props.renderOption ? (\n props.renderOption(option, isSelected)\n ) : (\n <>\n {option.prefix}\n <Text text={option.label} />\n {option.suffix}\n </>\n )}\n </View>\n )\n })\n })()\n\n const placement = props.placement ?? 'bottom'\n\n // Render trigger\n const trigger = (\n <View\n ref={triggerRef}\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n enableGestures={!props.disabled}\n onTouch={(data) => handleToggle(data)}\n {...triggerStyle}\n >\n <View flex={1}>{renderSelectedValue()}</View>\n\n {/* Arrow */}\n {props.arrow ? (\n props.arrow\n ) : (\n <DefaultArrow color={arrowConfig.color ?? 0xffffff} size={arrowConfig.size ?? 8} />\n )}\n </View>\n )\n\n // Render filter input\n const filterInput = props.isFilterable && (\n <CharTextInput\n value={filterQuery}\n onChange={(newValue) => {\n setFilterQuery(newValue)\n }}\n placeholder={props.filterInputPlaceholder ?? 'Filter...'}\n height={themed.filterInput?.height ?? 32}\n margin={placement === 'top' ? { top: 8 } : { bottom: 8 }}\n {...(themed.filterInput ?? {})}\n />\n )\n\n // Render options list\n const optionsList = (\n <View flex={1} width={'fill'}>\n <ScrollView\n ref={scrollViewRef}\n showVerticalSlider={isAnimating ? false : 'auto'}\n height=\"fill\"\n width=\"100%\"\n onTouch={() => {\n // Blur active element (CharTextInput) to allow scrolling\n if (document.activeElement instanceof HTMLElement) {\n document.activeElement.blur()\n }\n }}\n >\n <View\n direction=\"column\"\n gap={themed.optionGap ?? 2}\n width=\"100%\"\n theme={\n textStyle\n ? {\n Text: { style: textStyle },\n }\n : undefined\n }\n >\n {renderedOptions}\n </View>\n </ScrollView>\n </View>\n )\n\n // Render overlay\n const overlay = (\n <View height={overlayHeight.value} width={overlayPosition.width} overflow=\"hidden\">\n <View\n ref={overlayRef}\n direction=\"column\"\n width={'fill'}\n height={'fill'}\n visible={isOpen || Math.abs(overlayHeight.value) > 0.1}\n {...overlayTheme}\n >\n {placement === 'top' ? (\n <>\n {optionsList}\n {filterInput}\n </>\n ) : (\n <>\n {filterInput}\n {optionsList}\n </>\n )}\n </View>\n </View>\n )\n\n return (\n <View\n direction={props.stackLayout ? 'stack' : 'column'}\n width={props.width || 'fill'}\n height={props.stackLayout ? triggerRef.current?.height : 'auto'}\n ref={props.ref}\n //borderColor={0x00ff00}\n //borderWidth={14}\n >\n <View\n key={`dropdown-${placement}`}\n ref={containerRef}\n direction=\"column\"\n width={props.width}\n theme={nestedTheme}\n enableGestures={true}\n onTouchOutside={handleOutsideClick}\n //borderColor={0x0000ff}\n //borderWidth={2}\n >\n {placement === 'top' ? (\n <>\n {overlay}\n {trigger}\n </>\n ) : (\n <>\n {trigger}\n {overlay}\n </>\n )}\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Image component wrapper - strict type-safe wrapper around primitive image\n * This component is the public API for Image, with controlled prop interface\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\n\n/**\n * Props for Image component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface ImageProps\n extends Omit<TransformProps, 'scaleX' | 'scaleY' | 'scale'>,\n PhaserProps,\n Omit<LayoutProps, 'direction' | 'justifyContent' | 'alignItems' | 'gap' | 'flexWrap'>,\n PropsDefaultExtension<Phaser.GameObjects.Image> {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Tint color applied to image (0xRRGGBB) */\n tint?: number | undefined\n\n /**\n * How image should fit within bounds (if width/height set)\n * - 'fill': Stretch to fill (default, may distort aspect ratio)\n * - 'contain': Scale to fit within bounds, preserve aspect ratio\n * - 'cover': Scale to cover bounds, preserve aspect ratio (may crop)\n */\n fit?: 'fill' | 'contain' | 'cover'\n\n /** Origin X (0-1, default based on headless: 0 for layout, 0.5 for headless) */\n originX?: number\n\n /** Origin Y (0-1, default based on headless: 0 for layout, 0.5 for headless) */\n originY?: number\n\n /** Children are not supported for Image component */\n children?: ChildrenType\n}\n\n/**\n * Image component\n * Displays Phaser textures as visual elements\n *\n * @example\n * ```tsx\n * // Basic image with layout size\n * <Image texture=\"avatar\" width={64} height={64} />\n *\n * // Atlas frame\n * <Image texture=\"sprites\" frame=\"player\" width={32} height={32} />\n *\n * // Tinted image\n * <Image texture=\"icon\" width={48} height={48} tint={0xff0000} />\n *\n * // Fit modes\n * <Image texture=\"photo\" width={200} height={200} fit=\"cover\" />\n * <Image texture=\"logo\" width={100} height={100} fit=\"contain\" />\n * ```\n */\nexport function Image(props: ImageProps) {\n const localTheme = useTheme()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('Image', localTheme, props as any)\n\n // Map width/height to displayWidth/displayHeight for Phaser Image\n // LayoutProps uses width/height (can be number, percentage, etc.)\n // Phaser Image uses displayWidth/displayHeight (number only)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const mappedProps: any = { ...themed }\n\n // Extract numeric width/height values for display sizing\n if (typeof props.width === 'number') {\n mappedProps.displayWidth = props.width\n }\n if (typeof props.height === 'number') {\n mappedProps.displayHeight = props.height\n }\n\n // Cast to any to bypass type checking - the props are correct at runtime\n return <image {...mappedProps} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * Generic Icon component with pluggable loader system\n * Supports any icon library through a loader function\n */\nimport { useEffect, useState } from '../../hooks'\nimport { useSVGTexture } from '../../hooks-svg'\nimport { Image, type ImageProps } from './Image'\n\n/**\n * Icon loader function type\n * Takes an icon type string and returns a promise resolving to SVG string\n */\nexport interface IconLoaderFn<T extends string = string> {\n (type: T): Promise<string>\n}\n\n/**\n * Props for the generic Icon component\n */\nexport interface IconProps<T extends string = string>\n extends Omit<ImageProps, 'texture' | 'displayWidth' | 'displayHeight'> {\n /** The icon type/name to load */\n type: T | undefined\n /** Loader function that fetches the icon SVG */\n loader: IconLoaderFn<T>\n /** Icon size in pixels (default: 32) */\n size?: number\n}\n\n/**\n * Generic Icon component\n * Loads and displays an icon using the provided loader function\n *\n * @example\n * ```tsx\n * <Icon\n * type=\"check\"\n * loader={myIconLoader}\n * size={24}\n * />\n * ```\n */\nexport function Icon<T extends string = string>(props: IconProps<T>) {\n const { type, loader, size = 32, ...imageProps } = props\n const [svg, setSvg] = useState<string | null>(null)\n\n useEffect(() => {\n if (type != null)\n loader(type)\n .then(setSvg)\n .catch((err) => console.error(`Failed to load icon ${type}:`, err))\n }, [type, loader])\n\n // Include size in texture key to prevent conflicts with different sizes\n const textureKey = `icon-${type}-${size}`\n const ready = svg ? useSVGTexture(textureKey, svg, size, size) : false\n\n return <Image texture={ready ? textureKey : ''} width={size} height={size} {...imageProps} />\n}\n\n/**\n * Factory function to create a typed Icon component with a specific loader\n * This allows creating strongly-typed icon components for specific icon libraries\n *\n * @param loader - The icon loader function\n * @returns A typed Icon component that doesn't require the loader prop\n *\n * @example\n * ```tsx\n * // Define your loader\n * async function myIconLoader(type: MyIconType): Promise<string> {\n * const module = await import(`./icons/${type}.svg`)\n * return module.default\n * }\n *\n * // Create typed component\n * export const MyIcon = createIconComponent<MyIconType>(myIconLoader)\n *\n * // Use without loader prop\n * <MyIcon type=\"check\" size={24} />\n * ```\n */\nexport function createIconComponent<T extends string>(loader: IconLoaderFn<T>) {\n return function TypedIcon(props: Omit<IconProps<T>, 'loader'>) {\n return <Icon {...props} loader={loader} />\n }\n}\n\n/**\n * Hook to preload an icon and check if it's ready\n * Useful for loading icons before they're displayed\n *\n * @param type - The icon type to load\n * @param loader - The icon loader function\n * @returns true when the icon is loaded and ready to use\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const iconReady = useIconPreload('check', myIconLoader)\n *\n * return iconReady ? <Icon type=\"check\" loader={myIconLoader} /> : <Text text=\"Loading...\" />\n * }\n * ```\n */\nexport function useIconPreload<T extends string>(type: T, loader: IconLoaderFn<T>): boolean {\n const [svg, setSvg] = useState<string | null>(null)\n\n useEffect(() => {\n loader(type)\n .then(setSvg)\n .catch((err) => console.error(`Failed to load icon ${type}:`, err))\n }, [type, loader])\n\n return svg !== null\n}\n","/** @jsxImportSource ../.. */\n/**\n * NineSlice component wrapper - strict type-safe wrapper around primitive nineslice\n * This component is the public API for NineSlice, with controlled prop interface\n */\nimport type Phaser from 'phaser'\nimport type { LayoutProps, PhaserProps, TransformProps } from '../../core-props'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType, PropsDefaultExtension } from '../../types'\n\n/**\n * Props for NineSlice component\n * Explicitly defined to ensure type safety in JSX usage\n */\nexport interface NineSliceProps\n extends Omit<TransformProps, 'scaleX' | 'scaleY' | 'scale'>,\n PhaserProps,\n Omit<LayoutProps, 'direction' | 'justifyContent' | 'alignItems' | 'gap' | 'flexWrap'>,\n PropsDefaultExtension<Phaser.GameObjects.NineSlice> {\n /** Texture key (loaded via Phaser's texture manager) */\n texture: string\n\n /** Optional frame from texture atlas */\n frame?: string | number\n\n /** Tint color applied to NineSlice (0xRRGGBB) */\n tint?: number | undefined\n\n /**\n * Width of the left slice (in pixels of source texture)\n * Defines the non-stretching left border/corner area\n */\n leftWidth: number\n\n /**\n * Width of the right slice (in pixels of source texture)\n * Defines the non-stretching right border/corner area\n */\n rightWidth: number\n\n /**\n * Height of the top slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n topHeight?: number\n\n /**\n * Height of the bottom slice (in pixels of source texture)\n * Optional - omit for 3-slice mode (horizontal only)\n */\n bottomHeight?: number\n\n /** Children are not supported for NineSlice component */\n children?: ChildrenType\n}\n\n/**\n * NineSlice component\n * Displays scalable 9-slice textures with preserved corners\n *\n * @example\n * ```tsx\n * // Basic 9-slice panel\n * <NineSlice\n * texture=\"ui\"\n * frame=\"panel\"\n * width={300}\n * height={200}\n * leftWidth={20}\n * rightWidth={20}\n * topHeight={20}\n * bottomHeight={20}\n * />\n *\n * // 3-slice horizontal bar (no vertical slicing)\n * <NineSlice\n * texture=\"ui\"\n * frame=\"bar\"\n * width={400}\n * height={60}\n * leftWidth={15}\n * rightWidth={15}\n * />\n *\n * // Tinted panel\n * <NineSlice\n * texture=\"ui\"\n * frame=\"button\"\n * width={250}\n * height={100}\n * leftWidth={14}\n * rightWidth={14}\n * topHeight={14}\n * bottomHeight={14}\n * tint={0xff6600}\n * />\n * ```\n */\nexport function NineSlice(props: NineSliceProps) {\n const localTheme = useTheme()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { props: themed, nestedTheme } = getThemedProps('NineSlice', localTheme, props as any)\n\n // Cast to any to bypass type checking - the props are correct at runtime\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return <nineslice {...(themed as any)} theme={nestedTheme} />\n}\n","/** @jsxImportSource ../.. */\n/**\n * NineSliceButton - Convenience component for creating buttons with NineSlice backgrounds\n *\n * This component simplifies the creation of scalable buttons by automatically handling\n * the stack layout pattern and inner content positioning.\n */\nimport type { ViewProps } from '..'\nimport {\n applyEffectByName,\n resolveEffect,\n useGameObjectEffect,\n type EffectDefinition,\n} from '../../effects'\nimport { useEffect, useRef, useState } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport { NineSlice } from './NineSlice'\nimport { View } from './View'\n\n/**\n * Props for NineSliceButton component\n *\n * @remarks\n * This component creates a button with a NineSlice background and a content area.\n * The content area is automatically sized to exclude the slice borders.\n *\n * **IMPORTANT - Atlas/Texture Configuration:**\n *\n * The slice dimensions (leftWidth, rightWidth, topHeight, bottomHeight) must match\n * the actual design of your texture asset in the texture atlas. These values define\n * which parts of the source image are the \"corners\" and \"edges\" vs the \"center\".\n *\n * **Things to consider:**\n * - Inspect your texture atlas to determine the correct slice values\n * - The slice values are in pixels of the SOURCE texture, not the scaled button\n * - Sum of leftWidth + rightWidth should be less than the source texture width\n * - Sum of topHeight + bottomHeight should be less than the source texture height\n * - Width and height props define the FINAL size of the button after scaling\n * - The center area will stretch, but corners and edges maintain their size\n *\n * @example\n * ```tsx\n * // For a button texture that is 64x32 in the atlas with 8px corners:\n * <NineSliceButton\n * texture=\"ui\"\n * frame=\"button-green\"\n * width={200} // Final button width\n * height={80} // Final button height\n * leftWidth={8} // Left edge is 8px in source texture\n * rightWidth={8} // Right edge is 8px in source texture\n * topHeight={8} // Top edge is 8px in source texture\n * bottomHeight={8} // Bottom edge is 8px in source texture\n * onClick={() => console.log('clicked')}\n * >\n * <Text text=\"Click Me\" />\n * </NineSliceButton>\n * ```\n *\n * @example\n * ```tsx\n * // Horizontal-only (3-slice) button - omit topHeight/bottomHeight:\n * <NineSliceButton\n * texture=\"ui\"\n * frame=\"progress-bar\"\n * width={300}\n * height={40}\n * leftWidth={10}\n * rightWidth={10}\n * >\n * <Text text=\"Progress: 75%\" />\n * </NineSliceButton>\n * ```\n */\nexport interface NineSliceButtonProps extends ViewProps, EffectDefinition {\n /**\n * Texture key from the loaded texture atlas\n * Must be loaded before use (e.g., in a preload scene)\n */\n texture: string\n\n /**\n * Frame name or index within the texture atlas\n * Optional if the texture is not an atlas\n */\n frame?: string | number\n\n /**\n * Width of the left slice in pixels of the SOURCE texture\n * This defines the non-stretching left border/corner area\n */\n leftWidth: number\n\n /**\n * Width of the right slice in pixels of the SOURCE texture\n * This defines the non-stretching right border/corner area\n */\n rightWidth: number\n\n /**\n * Height of the top slice in pixels of the SOURCE texture\n * This defines the non-stretching top border/corner area\n * Optional - omit for 3-slice (horizontal only) mode\n */\n topHeight?: number\n\n /**\n * Height of the bottom slice in pixels of the SOURCE texture\n * This defines the non-stretching bottom border/corner area\n * Optional - omit for 3-slice (horizontal only) mode\n */\n bottomHeight?: number\n\n /**\n * Click handler for button interaction\n */\n onClick?: () => void\n\n //* Optional disabled state - if true, button will not respond to clicks */\n disabled?: boolean\n}\n\n/**\n * NineSliceButton component - creates a scalable button with NineSlice background\n *\n * This is a convenience wrapper around NineSlice + View that handles:\n * - Stack layout for background and content\n * - Automatic inner content area calculation\n * - Click interaction handling\n * - Proper content alignment\n *\n * @param props - NineSliceButton properties\n * @returns JSX element representing a button with NineSlice background\n *\n * @example\n * ```tsx\n * <NineSliceButton\n * texture=\"ui\"\n * frame=\"button-blue\"\n * width={250}\n * height={100}\n * leftWidth={20}\n * rightWidth={20}\n * topHeight={15}\n * bottomHeight={15}\n * onClick={() => console.log('Button clicked!')}\n * alignItems=\"center\"\n * justifyContent=\"center\"\n * >\n * <Text text=\"Click Me!\" style={{ fontSize: 24 }} />\n * </NineSliceButton>\n * ```\n */\n\nexport function NineSliceButton(props: NineSliceButtonProps) {\n const {\n texture,\n frame,\n leftWidth,\n rightWidth,\n topHeight,\n bottomHeight,\n onClick,\n disabled,\n visible,\n // Inner view layout props - used for content area, get here and not passed to outer View\n children: innerChildren,\n direction: innerDirection,\n gap: innerGap,\n padding: innerPadding,\n borderWidth: innerBorderWidth,\n borderColor: innerBorderColor,\n alignItems: innerAlignItems,\n justifyContent: innerJustifyContent,\n // Rest goes to outer view\n ...viewProps\n } = props\n\n const { props: themed } = getThemedProps('NineSliceButton', undefined, {})\n const ref = useRef<Phaser.GameObjects.Container | null>(null)\n const { applyEffect, stopEffects } = useGameObjectEffect(ref)\n\n // Force redraw after mount to ensure dimensions are calculated\n // and show content after that to avoid visual glitches\n const [show, setShow] = useState(false)\n\n useEffect(() => {\n // redraw to catch any layout adjustments and slider dimensions\n const timer = setTimeout(() => setShow(true), 0)\n return () => {\n clearTimeout(timer)\n }\n }, [])\n\n const innerWidth = (ref.current?.width ?? 0) - leftWidth - rightWidth\n const innerHeight = (ref.current?.height ?? 0) - (topHeight ?? 0) - (bottomHeight ?? 0)\n\n const handleTouch =\n !disabled && onClick\n ? () => {\n onClick?.()\n\n // Stop any running effects to prevent position drift\n stopEffects()\n\n // Apply effect: props override theme, theme overrides default\n const resolved = resolveEffect(props, themed as EffectDefinition)\n applyEffectByName(applyEffect, resolved.effect, resolved.effectConfig)\n }\n : undefined\n\n return (\n <View\n ref={ref}\n direction=\"stack\"\n backgroundAlpha={0.0}\n enableGestures={!disabled}\n visible={show && (visible ?? true)}\n {...themed}\n {...viewProps}\n {...(handleTouch && { onTouch: handleTouch })}\n >\n <NineSlice\n texture={texture}\n {...(frame !== undefined && { frame })}\n width=\"100%\"\n height=\"100%\"\n leftWidth={leftWidth}\n rightWidth={rightWidth}\n {...(topHeight !== undefined && { topHeight })}\n {...(bottomHeight !== undefined && { bottomHeight })}\n />\n <View\n backgroundAlpha={0.0}\n direction={innerDirection ?? 'column'}\n x={leftWidth}\n y={topHeight ?? 0}\n width={innerWidth}\n height={innerHeight}\n alignItems={innerAlignItems ?? 'center'}\n justifyContent={innerJustifyContent ?? 'center'}\n {...(innerGap !== undefined && { gap: innerGap })}\n {...(innerPadding !== undefined && { padding: innerPadding })}\n {...(innerBorderWidth !== undefined && { borderWidth: innerBorderWidth })}\n {...(innerBorderColor !== undefined && { borderColor: innerBorderColor })}\n >\n {innerChildren}\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * RefOriginView - ref-based component for imperative transforms with custom origin point\n *\n * Returns a ref to the pivot container, enabling imperative manipulation\n * (e.g., Phaser tweens) with correct origin point. Uses nested Views to\n * calculate and maintain the pivot point based on actual rendered dimensions.\n *\n * Use TransformOriginView instead for declarative/reactive transforms via props.\n *\n * @example\n * const ref = useRef<Phaser.GameObjects.Container>(null)\n * useEffect(() => {\n * ref.current?.scene.tweens.add({ targets: ref.current, rotation: Math.PI * 2 })\n * }, [])\n * <RefOriginView ref={ref} originX={0.5} originY={0.5} width={200} height={100}>\n * <Text>Rotates around center</Text>\n * </RefOriginView>\n */\nimport type { ChildrenType } from '@number10/phaserjsx/types'\nimport type Phaser from 'phaser'\nimport type { ViewProps } from '..'\nimport { useRef, useState } from '../../hooks'\nimport { View } from '../index'\n\n/**\n * Extended ViewProps with origin support\n */\nexport interface RefOriginViewProps extends Omit<ViewProps, 'x' | 'y' | 'children'> {\n /**\n * Origin X for rotation and scale (0 = left, 0.5 = center, 1 = right)\n * @default 0.5\n */\n originX?: number\n /**\n * Origin Y for rotation and scale (0 = top, 0.5 = center, 1 = bottom)\n * @default 0.5\n */\n originY?: number\n /**\n * X position of the view\n */\n x?: number\n /**\n * Y position of the view\n */\n y?: number\n /**\n * Children nodes.\n */\n children?: ChildrenType\n}\n\n/**\n * RefOriginView component - ref-based transforms around custom origin point\n *\n * Returns ref to middle View positioned at the origin point, enabling\n * imperative transformations. Calculates actual dimensions after layout.\n *\n * Uses nested View structure internally:\n * - Outer View: Defines bounding box and position\n * - Middle View: Positioned at origin point, receives ref (transform target)\n * - Inner View: Contains actual content, offset by negative padding\n *\n * @param props - RefOriginView props\n * @returns JSX element\n */\nexport function RefOriginView({\n originX = 0.5,\n originY = 0.5,\n x = 0,\n y = 0,\n width,\n height,\n ref,\n padding,\n children,\n ...viewProps\n}: RefOriginViewProps) {\n // Ref to outer View to get computed dimensions after layout\n const outerRef = useRef<Phaser.GameObjects.Container | null>(null)\n const [numericDimension, setNumericWidth] = useState<{ x: number; y: number }>({ x: 0, y: 0 })\n\n /**\n * Handler for outer View - calculates and updates pivot position based on actual size\n */\n const handleOuterRef = (container: Phaser.GameObjects.Container | null) => {\n if (!container) return\n outerRef.current = container\n\n setTimeout(() => {\n // Use layout dimensions or fallback to getBounds\n const width = container.width\n const height = container.height\n const actualWidth = Number.isNaN(width) ? 0 : width\n const actualHeight = Number.isNaN(height) ? 0 : height\n if (actualHeight !== numericDimension.y || actualWidth !== numericDimension.x)\n setNumericWidth({ x: actualWidth, y: actualHeight })\n }, 0)\n }\n\n // Calculate pivot point position (relative to outer View)\n const pivotX = numericDimension.x * originX\n const pivotY = numericDimension.y * originY\n\n // Calculate offset for inner content (to center it around pivot)\n const offsetX = -numericDimension.x * originX\n const offsetY = -numericDimension.y * originY\n\n return (\n <View\n ref={handleOuterRef}\n direction=\"stack\"\n width={width}\n height={height}\n x={x}\n y={y}\n padding={padding}\n >\n {/* Middle View: Positioned at origin point, receives ref for rotation */}\n <View\n ref={ref as ((instance: Phaser.GameObjects.Container | null) => void) | undefined}\n x={pivotX}\n y={pivotY}\n width={0}\n height={0}\n padding={{ left: offsetX, top: offsetY }}\n margin={0}\n direction=\"stack\"\n backgroundColor={0xff88ff}\n >\n {/* Inner View: Contains actual content with all original props */}\n <View width={width} height={height} {...viewProps} direction=\"stack\" padding={0} margin={0}>\n {children}\n </View>\n </View>\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\nimport type Phaser from 'phaser'\n/**\n * Sidebar component - High-level container with typical sidebar styling\n */\nimport type { ViewProps } from '..'\nimport type { VNode } from '../../hooks'\nimport { useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ViewTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport { Divider } from './Divider'\nimport { ScrollView } from './ScrollView'\nimport { Text } from './Text'\nimport { View } from './View'\n\nexport type SidebarVariant = 'solid' | 'muted' | 'ghost' | 'inset'\nexport type SidebarSize = 'sm' | 'md' | 'lg'\n\nexport interface SidebarNavItem {\n key?: string\n label?: string\n icon?: ChildrenType\n badge?: ChildrenType | number\n active?: boolean\n disabled?: boolean\n onSelect?: (key: string | undefined) => void\n content?: ChildrenType\n}\n\nexport interface SidebarSection {\n key?: string\n title?: string | ChildrenType\n items?: SidebarNavItem[]\n footer?: ChildrenType\n content?: ChildrenType\n}\n\n/**\n * Props for Sidebar component - extends ViewProps for full flexibility\n */\nexport interface SidebarProps extends ViewProps {\n /** Visual variant */\n variant?: SidebarVariant\n /** Size preset for padding/gaps */\n size?: SidebarSize\n /** Pinned header content */\n header?: ChildrenType\n /** Pinned footer content */\n footer?: ChildrenType\n /** Structured navigation sections */\n sections?: SidebarSection[]\n /** Enable internal scroll area for long content */\n scrollable?: boolean\n /** Render dividers between sections */\n showDividers?: boolean\n /** Override item spacing */\n itemGap?: number\n /** Override section spacing */\n sectionGap?: number\n}\n\ninterface SidebarTheme extends ViewTheme {\n variant?: SidebarVariant\n size?: SidebarSize\n variants?: Partial<Record<SidebarVariant, ViewTheme>>\n sizes?: Partial<Record<SidebarSize, ViewTheme>>\n dividerColor?: number\n dividerAlpha?: number\n headerStyle?: ViewTheme\n footerStyle?: ViewTheme\n sectionStyle?: ViewTheme & {\n titleStyle?: Phaser.Types.GameObjects.Text.TextStyle\n }\n itemStyle?: ViewTheme & {\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n active?: ViewTheme\n disabledAlpha?: number\n }\n badgeStyle?: ViewTheme & {\n textStyle?: Phaser.Types.GameObjects.Text.TextStyle\n }\n scrollable?: boolean\n itemGap?: number\n sectionGap?: number\n}\n\n/**\n * Sidebar component - pre-configured container for navigation/options\n * Adds variants, size presets, and optional header/sections/footer slots.\n */\nexport function Sidebar(props: SidebarProps) {\n const localTheme = useTheme()\n const { props: themedProps, nestedTheme } = getThemedProps('Sidebar', localTheme, {})\n const themed = themedProps as SidebarTheme\n\n const resolvedVariant = props.variant ?? themed.variant ?? 'solid'\n const resolvedSize = props.size ?? themed.size ?? 'md'\n\n const variantTheme = themed.variants?.[resolvedVariant] ?? {}\n const sizeTheme = themed.sizes?.[resolvedSize] ?? {}\n\n const {\n variants: _variants,\n sizes: _sizes,\n headerStyle,\n footerStyle,\n sectionStyle,\n itemStyle,\n badgeStyle,\n dividerColor,\n dividerAlpha: _dividerAlpha,\n scrollable: themedScrollable,\n itemGap: themedItemGap,\n sectionGap: themedSectionGap,\n variant: _variant,\n size: _size,\n ...baseTheme\n } = themed\n\n const effectiveGap = props.gap ?? (sizeTheme.gap as number | undefined) ?? themed.gap\n const sectionGap = props.sectionGap ?? themedSectionGap ?? effectiveGap ?? 8\n const itemGap = props.itemGap ?? themedItemGap ?? 8\n const scrollable = props.scrollable ?? themedScrollable ?? false\n const showDividers = props.showDividers ?? false\n const dividerColorValue = dividerColor ?? 0xcccccc\n\n const combinedProps: ViewProps = {\n ...baseTheme,\n ...variantTheme,\n ...sizeTheme,\n ...props,\n direction: props.direction ?? 'column',\n alignItems: props.alignItems ?? 'start',\n gap: effectiveGap,\n }\n\n const { titleStyle, ...sectionContainer } = sectionStyle ?? {}\n const {\n textStyle: itemTextStyle,\n active: activeItemStyle,\n disabledAlpha,\n ...itemContainer\n } = itemStyle ?? {}\n const { textStyle: badgeTextStyle, ...badgeContainer } = badgeStyle ?? {}\n\n const normalizeChildren = (child: ChildrenType | null): VNode[] =>\n child ? (Array.isArray(child) ? child : [child]) : []\n\n const renderTitle = (title?: string | ChildrenType) => {\n if (!title) return null\n return typeof title === 'string' ? <Text text={title} style={titleStyle} /> : title\n }\n\n const renderBadge = (badge?: ChildrenType | number) => {\n if (badge === undefined || badge === null) return null\n const badgeContent =\n typeof badge === 'number' ? <Text text={`${badge}`} style={badgeTextStyle} /> : badge\n return (\n <View\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n {...badgeContainer}\n padding={badgeContainer.padding ?? 6}\n >\n {badgeContent}\n </View>\n )\n }\n\n const renderItems = (items?: SidebarNavItem[], sectionKey?: string) => {\n if (!items?.length) return null\n return items.map((item, itemIndex) => {\n const key = item.key ?? `${sectionKey ?? 'section'}-item-${itemIndex}`\n const activeProps = item.active ? (activeItemStyle ?? {}) : {}\n const disabledProps =\n item.disabled && disabledAlpha !== undefined ? { alpha: disabledAlpha } : {}\n\n const content: VNode | VNode[] | null =\n item.content ?? (item.label ? <Text text={item.label} style={itemTextStyle} /> : null)\n const iconNodes = normalizeChildren(item.icon ?? null)\n const contentNodes = normalizeChildren(content)\n const badgeNodes = normalizeChildren(renderBadge(item.badge))\n const handleTouch = item.disabled ? undefined : () => item.onSelect?.(item.key ?? key)\n\n return (\n <View\n key={key}\n direction=\"row\"\n alignItems=\"center\"\n gap={itemContainer.gap ?? itemGap}\n enableGestures={!item.disabled}\n {...(handleTouch && { onTouch: handleTouch })}\n {...itemContainer}\n {...activeProps}\n {...disabledProps}\n >\n {[...iconNodes, ...contentNodes, ...badgeNodes]}\n </View>\n )\n })\n }\n\n const renderSections = () => {\n if (!props.sections?.length) return null\n const lastSectionIndex = props.sections.length - 1\n return props.sections.map((section, index) => {\n const sectionKey = section.key ?? `section-${index}`\n return (\n <View key={sectionKey} direction=\"column\" gap={sectionGap} {...sectionContainer}>\n {renderTitle(section.title)}\n {section.content ?? null}\n {renderItems(section.items, sectionKey)}\n {section.footer ?? null}\n {showDividers && index < lastSectionIndex ? (\n <Divider\n color={dividerColorValue}\n thickness={1}\n length={'100%'}\n orientation=\"horizontal\"\n />\n ) : null}\n </View>\n )\n })\n }\n\n const sectionsContent = renderSections()\n const hasSections = !!props.sections?.length\n const primaryContent = sectionsContent ?? (!hasSections ? props.children : null) ?? null\n const extraContent = hasSections ? (props.children ?? null) : null\n const contentNodes = [...normalizeChildren(primaryContent), ...normalizeChildren(extraContent)]\n\n return (\n <View\n {...combinedProps}\n theme={nestedTheme}\n backgroundColor={themed.backgroundColor}\n backgroundAlpha={themed.backgroundAlpha}\n padding={themed.padding}\n gap={themed.gap}\n >\n {props.header ? <View {...headerStyle}>{props.header}</View> : null}\n\n {scrollable ? (\n <ScrollView\n flex={1}\n width={'fill'}\n height={'fill'}\n showVerticalSlider={'auto'}\n showHorizontalSlider={false}\n sliderSize={'tiny'}\n theme={nestedTheme}\n >\n <View direction=\"column\" gap={effectiveGap} width={'fill'}>\n {contentNodes}\n </View>\n </ScrollView>\n ) : (\n contentNodes\n )}\n\n {props.footer ? <View {...footerStyle}>{props.footer}</View> : null}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * Slider/Range component\n * Provides interactive value selection with horizontal/vertical orientation\n */\nimport type Phaser from 'phaser'\nimport type { GestureEventData } from '../../core-props'\nimport { applyEffectByName, useGameObjectEffect, type EffectDefinition } from '../../effects'\nimport { useEffect, useMemo, useRef, useState, useTheme, type VNode } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { ChildrenType } from '../../types'\nimport { Graphics, Text, View } from '../index'\nimport type { ViewProps } from '..'\nimport { RefOriginView } from './RefOriginView'\n\n/**\n * Slider mark/tick definition\n */\nexport interface SliderMark {\n /** Value at this mark */\n value: number\n /** Optional label to display */\n label?: VNode\n /** Custom style for this mark */\n style?: {\n color?: number\n height?: number\n width?: number\n }\n}\n\n/**\n * Props for Slider component\n */\nexport interface SliderProps extends Omit<ViewProps, 'children'>, EffectDefinition {\n /** Current value (controlled) */\n value?: number\n\n /** Default value (uncontrolled) */\n defaultValue?: number\n\n /** Minimum value */\n min?: number\n\n /** Maximum value */\n max?: number\n\n /** Step increment (default: 1) */\n step?: number\n\n /** Orientation */\n orientation?: 'horizontal' | 'vertical'\n\n /** Reverse direction (right-to-left or bottom-to-top) */\n reverse?: boolean\n\n /** Disabled state */\n disabled?: boolean\n\n /** Show value label on thumb */\n showValue?: boolean\n\n /** Value label offset (x, y) relative to thumb - overrides theme */\n valueLabelOffset?: { x?: number; y?: number }\n\n /** Custom value formatter for label */\n formatValue?: (value: number) => string\n\n /** Marks/ticks to display */\n marks?: SliderMark[] | boolean\n\n /** Snap to marks/steps */\n snap?: boolean\n\n /** Track length (overrides theme default) */\n trackLength?: number\n\n /** Custom thumb renderer */\n renderThumb?: (value: number, isDragging: boolean) => ChildrenType\n\n /** Custom track renderer */\n renderTrack?: (fillPercentage: number) => ChildrenType\n\n /** Callback when value changes */\n onChange?: (value: number) => void\n\n /** Callback when dragging starts */\n onChangeStart?: (value: number) => void\n\n /** Callback when dragging ends */\n onChangeEnd?: (value: number) => void\n}\n\n/**\n * Props for RangeSlider component\n */\nexport interface RangeSliderProps extends Omit<ViewProps, 'children'>, EffectDefinition {\n /** Current value range (controlled) */\n value?: [number, number]\n\n /** Default value range (uncontrolled) */\n defaultValue?: [number, number]\n\n /** Minimum value */\n min?: number\n\n /** Maximum value */\n max?: number\n\n /** Step increment (default: 1) */\n step?: number\n\n /** Orientation */\n orientation?: 'horizontal' | 'vertical'\n\n /** Reverse direction (right-to-left or bottom-to-top) */\n reverse?: boolean\n\n /** Disabled state */\n disabled?: boolean\n\n /** Show value labels on thumbs */\n showValue?: boolean\n\n /** Value label offset for first thumb (x, y) - overrides theme */\n valueLabelOffset1?: { x?: number; y?: number }\n\n /** Value label offset for second thumb (x, y) - overrides theme */\n valueLabelOffset2?: { x?: number; y?: number }\n\n /** Custom value formatter for labels */\n formatValue?: (value: number) => string\n\n /** Marks/ticks to display */\n marks?: SliderMark[] | boolean\n\n /** Snap to marks/steps */\n snap?: boolean\n\n /** Track length (overrides theme default) */\n trackLength?: number\n\n /** Minimum distance between thumbs */\n minDistance?: number\n\n /** Custom thumb renderer */\n renderThumb?: (value: number, isDragging: boolean, thumbIndex?: number) => ChildrenType\n\n /** Custom track renderer */\n renderTrack?: (startPercentage: number, endPercentage?: number) => ChildrenType\n\n /** Callback when value changes */\n onChange?: (value: [number, number]) => void\n\n /** Callback when dragging starts */\n onChangeStart?: (value: [number, number]) => void\n\n /** Callback when dragging ends */\n onChangeEnd?: (value: [number, number]) => void\n}\n\n/**\n * Internal props for BaseSlider\n */\ninterface BaseSliderProps extends Omit<ViewProps, 'children'>, EffectDefinition {\n mode: 'single' | 'range'\n value?: number | [number, number]\n defaultValue?: number | [number, number]\n min?: number\n max?: number\n step?: number\n orientation?: 'horizontal' | 'vertical'\n reverse?: boolean\n disabled?: boolean\n showValue?: boolean\n valueLabelOffset?: { x?: number; y?: number }\n valueLabelOffset1?: { x?: number; y?: number }\n valueLabelOffset2?: { x?: number; y?: number }\n formatValue?: (value: number) => string\n marks?: SliderMark[] | boolean\n snap?: boolean\n trackLength?: number\n minDistance?: number\n renderThumb?: (value: number, isDragging: boolean, thumbIndex?: number) => ChildrenType\n renderTrack?: (startOrFillPercentage: number, endPercentage?: number) => ChildrenType\n onChange?: ((value: number) => void) | ((value: [number, number]) => void)\n onChangeStart?: ((value: number) => void) | ((value: [number, number]) => void)\n onChangeEnd?: ((value: number) => void) | ((value: [number, number]) => void)\n}\n\n/**\n * Default thumb component - circular shape with border\n * @param props - Thumb properties\n * @returns JSX element\n */\nfunction DefaultThumb(props: {\n size: number\n color: number\n borderColor?: number\n borderWidth?: number\n isDragging: boolean\n dragScale?: number\n}) {\n const { size, color, borderColor, borderWidth = 0, isDragging, dragScale = 1.1 } = props\n const scale = isDragging ? dragScale : 1.0\n\n return (\n <Graphics\n onDraw={(g: Phaser.GameObjects.Graphics) => {\n g.clear()\n\n // Border\n if (borderWidth > 0 && borderColor !== undefined) {\n g.fillStyle(borderColor, 1)\n g.fillCircle(0, 0, size / 2)\n }\n\n // Fill\n g.fillStyle(color, 1)\n g.fillCircle(0, 0, (size - borderWidth * 2) / 2)\n }}\n scale={scale}\n />\n )\n}\n\n/**\n * Base slider implementation - shared between Slider and RangeSlider\n * @param props - Base slider properties\n * @returns Slider JSX element\n */\nfunction BaseSlider(props: BaseSliderProps) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Slider', localTheme, {})\n\n const mode = props.mode\n const isRange = mode === 'range'\n\n // State management - controlled vs uncontrolled\n const defaultSingleValue = (props.defaultValue as number | undefined) ?? props.min ?? 0\n const defaultRangeValue: [number, number] = (props.defaultValue as\n | [number, number]\n | undefined) ?? [props.min ?? 0, props.max ?? 100]\n\n const [internalValue, setInternalValue] = useState<number | [number, number]>(\n isRange ? defaultRangeValue : defaultSingleValue\n )\n\n const isControlled = props.value !== undefined\n const value = isControlled ? props.value : internalValue\n\n const min = props.min ?? 0\n const max = props.max ?? 100\n\n // Extract values for single/range mode\n const singleValue = !isRange ? (value as number) : 0\n const rangeValue: [number, number] = isRange ? (value as [number, number]) : [min, max]\n const step = props.step ?? 1\n const orientation = props.orientation ?? 'horizontal'\n const reverse = props.reverse ?? false\n const disabled = props.disabled ?? false\n const snap = props.snap ?? true\n const minDistance = props.minDistance ?? step\n\n const trackLength = props.trackLength ?? themed.trackLength ?? 200\n const trackHeight = themed.trackHeight ?? 6\n const thumbSize = themed.thumbSize ?? 20\n\n const trackRef = useRef<Phaser.GameObjects.Container | null>(null)\n const thumb1Ref = useRef<Phaser.GameObjects.Container | null>(null)\n const thumb2Ref = useRef<Phaser.GameObjects.Container | null>(null)\n const [isDragging1, setIsDragging1] = useState(false)\n const [isDragging2, setIsDragging2] = useState(false)\n const virtualPos1Ref = useRef(0)\n const virtualPos2Ref = useRef(0)\n\n const { applyEffect: applyEffect1 } = useGameObjectEffect(thumb1Ref)\n const { applyEffect: applyEffect2 } = useGameObjectEffect(thumb2Ref)\n\n // Clamp value to valid range\n const clampValue = (val: number): number => {\n return Math.max(min, Math.min(max, val))\n }\n\n // Snap value to step\n const snapToStep = (val: number): number => {\n const steps = Math.round((val - min) / step)\n return min + steps * step\n }\n\n // Value to percentage (0-1)\n const valueToPercentage = (val: number): number => {\n if (max === min) return 0\n return (val - min) / (max - min)\n }\n\n // Position (pixels) to value - respects reverse\n const positionToValue = (pos: number, length: number): number => {\n const actualPos = reverse ? length - pos : pos\n const percentage = Math.max(0, Math.min(1, actualPos / length))\n return min + percentage * (max - min)\n }\n\n // Value to position (pixels) - respects reverse\n const valueToPosition = (val: number): number => {\n const percentage = valueToPercentage(val)\n const pos = percentage * trackLength\n return reverse ? trackLength - pos : pos\n }\n\n // Calculate thumb positions from values\n const thumb1Value = (isRange ? rangeValue[0] : singleValue) ?? 0\n const thumb2Value = (isRange ? rangeValue[1] : 0) ?? 0\n\n const thumb1PositionFromValue = valueToPosition(thumb1Value)\n const thumb2PositionFromValue = isRange ? valueToPosition(thumb2Value) : 0\n\n // During drag, calculate position directly from delta\n const [currentDragPos1, setCurrentDragPos1] = useState(thumb1PositionFromValue)\n const [currentDragPos2, setCurrentDragPos2] = useState(thumb2PositionFromValue)\n\n // Sync drag positions with values when not dragging (controlled component support)\n useEffect(() => {\n if (!isDragging1) {\n setCurrentDragPos1(thumb1PositionFromValue)\n }\n }, [thumb1PositionFromValue, isDragging1])\n\n useEffect(() => {\n if (!isDragging2 && isRange) {\n setCurrentDragPos2(thumb2PositionFromValue)\n }\n }, [thumb2PositionFromValue, isRange, isDragging2])\n\n // Generate marks if marks={true}\n const marksArray = useMemo<SliderMark[]>(() => {\n if (!props.marks) return []\n if (Array.isArray(props.marks)) return props.marks\n\n // Auto-generate marks\n const marks: SliderMark[] = []\n for (let val = min; val <= max; val += step) {\n marks.push({ value: val })\n }\n return marks\n }, [props.marks, min, max, step])\n\n // Handle track touch/click - jump to position\n const handleTrackTouch = (data: GestureEventData) => {\n if (disabled) return\n data.stopPropagation()\n\n const localPos = orientation === 'horizontal' ? (data.localX ?? 0) : (data.localY ?? 0)\n const newValue = positionToValue(localPos, trackLength)\n const snappedValue = snap ? snapToStep(newValue) : newValue\n const clampedValue = clampValue(snappedValue)\n\n if (isRange) {\n // Find closest thumb\n const dist1 = Math.abs(clampedValue - rangeValue[0])\n const dist2 = Math.abs(clampedValue - rangeValue[1])\n const useThumb1 = dist1 <= dist2\n\n const newRangeValue: [number, number] = useThumb1\n ? [clampedValue, rangeValue[1]]\n : [rangeValue[0], clampedValue]\n\n // Enforce min distance\n if (newRangeValue[1] - newRangeValue[0] < minDistance) {\n return\n }\n\n if (!isControlled) {\n setInternalValue(newRangeValue)\n }\n ;(props.onChange as ((v: [number, number]) => void) | undefined)?.(newRangeValue)\n } else {\n if (!isControlled) {\n setInternalValue(clampedValue)\n }\n ;(props.onChange as ((v: number) => void) | undefined)?.(clampedValue)\n }\n }\n\n // Handle thumb drag\n const handleThumbDrag = (thumbIndex: number) => (data: GestureEventData) => {\n if (disabled) return\n data.stopPropagation()\n\n const isThumb1 = thumbIndex === 0\n const isDragging = isThumb1 ? isDragging1 : isDragging2\n const setIsDragging = isThumb1 ? setIsDragging1 : setIsDragging2\n const virtualPosRef = isThumb1 ? virtualPos1Ref : virtualPos2Ref\n const setCurrentDragPos = isThumb1 ? setCurrentDragPos1 : setCurrentDragPos2\n const currentThumbPos = isThumb1 ? currentDragPos1 : currentDragPos2\n const applyEffect = isThumb1 ? applyEffect1 : applyEffect2\n\n if (data.state === 'start') {\n setIsDragging(true)\n virtualPosRef.current = currentThumbPos\n\n if (isRange) {\n ;(props.onChangeStart as ((v: [number, number]) => void) | undefined)?.(rangeValue)\n } else {\n ;(props.onChangeStart as ((v: number) => void) | undefined)?.(singleValue)\n }\n return\n }\n\n if (data.state === 'end') {\n setIsDragging(false)\n\n if (isRange) {\n ;(props.onChangeEnd as ((v: [number, number]) => void) | undefined)?.(rangeValue)\n } else {\n ;(props.onChangeEnd as ((v: number) => void) | undefined)?.(singleValue)\n }\n\n applyEffectByName(applyEffect, 'none')\n return\n }\n\n if (!isDragging) return\n\n // Use frame-to-frame delta\n const delta = orientation === 'horizontal' ? (data.dx ?? 0) : (data.dy ?? 0)\n\n // Update virtual position (can exceed bounds)\n virtualPosRef.current += delta\n\n // Clamp visual position to track bounds\n const newPos = Math.max(0, Math.min(trackLength, virtualPosRef.current))\n\n // Calculate and update value\n let newValue = positionToValue(newPos, trackLength)\n newValue = snap ? snapToStep(newValue) : newValue\n\n if (isRange) {\n let newRangeValue: [number, number] = isThumb1\n ? [newValue, rangeValue[1]]\n : [rangeValue[0], newValue]\n\n // Enforce bounds and min distance\n if (isThumb1) {\n newRangeValue[0] = clampValue(newRangeValue[0])\n if (newRangeValue[1] - newRangeValue[0] < minDistance) {\n newRangeValue[0] = newRangeValue[1] - minDistance\n }\n newRangeValue[0] = clampValue(newRangeValue[0])\n } else {\n newRangeValue[1] = clampValue(newRangeValue[1])\n if (newRangeValue[1] - newRangeValue[0] < minDistance) {\n newRangeValue[1] = newRangeValue[0] + minDistance\n }\n newRangeValue[1] = clampValue(newRangeValue[1])\n }\n\n // Update position to reflect clamped value\n const clampedPos = valueToPosition(isThumb1 ? newRangeValue[0] : newRangeValue[1])\n setCurrentDragPos(snap ? clampedPos : newPos)\n\n if (!isControlled) {\n setInternalValue(newRangeValue)\n }\n ;(props.onChange as ((v: [number, number]) => void) | undefined)?.(newRangeValue)\n } else {\n const clampedValue = clampValue(newValue)\n const snappedPos = valueToPosition(clampedValue)\n setCurrentDragPos(snap ? snappedPos : newPos)\n\n if (!isControlled) {\n setInternalValue(clampedValue)\n }\n ;(props.onChange as ((v: number) => void) | undefined)?.(clampedValue)\n }\n }\n\n const formatValue = props.formatValue ?? ((v: number) => v.toString())\n\n const isHorizontal = orientation === 'horizontal'\n\n const finalAlpha = disabled ? (themed.disabledAlpha ?? 0.4) : (props.alpha ?? 1)\n\n // Calculate value label offsets with smart defaults for RangeSlider\n // Labels are centered (origin 0.5, 0.5), so offset is from thumb center\n const defaultThemeOffset = themed.valueLabel?.offset ?? 8\n const labelGap = thumbSize + 8 // Gap from thumb edge + small padding\n\n // For single slider: label follows reverse direction (left if reversed, right if normal)\n // For range slider: labels on opposite sides (flipped if reversed)\n const labelOffset1 = {\n x:\n props.valueLabelOffset1?.x ??\n props.valueLabelOffset?.x ??\n (isRange\n ? isHorizontal\n ? reverse\n ? labelGap\n : -labelGap\n : labelGap\n : isHorizontal\n ? reverse\n ? -labelGap\n : labelGap\n : labelGap),\n y:\n props.valueLabelOffset1?.y ??\n props.valueLabelOffset?.y ??\n (isRange\n ? !isHorizontal\n ? reverse\n ? labelGap\n : -labelGap\n : -defaultThemeOffset\n : !isHorizontal\n ? reverse\n ? labelGap\n : -defaultThemeOffset\n : -defaultThemeOffset),\n }\n const labelOffset2 = {\n x:\n props.valueLabelOffset2?.x ??\n (isRange ? (isHorizontal ? (reverse ? -labelGap : labelGap) : labelGap) : labelGap),\n y:\n props.valueLabelOffset2?.y ??\n (isRange\n ? !isHorizontal\n ? reverse\n ? -labelGap\n : labelGap\n : -defaultThemeOffset\n : -defaultThemeOffset),\n }\n\n // Calculate fill track dimensions\n const fillStartPercentage = isRange ? valueToPercentage(rangeValue[0]) : 0\n const fillEndPercentage = isRange\n ? valueToPercentage(rangeValue[1])\n : valueToPercentage(singleValue)\n\n const fillStartPos = reverse\n ? trackLength - fillEndPercentage * trackLength\n : fillStartPercentage * trackLength\n const fillEndPos = reverse\n ? trackLength - fillStartPercentage * trackLength\n : fillEndPercentage * trackLength\n const fillLength = fillEndPos - fillStartPos\n\n return (\n <View\n {...props}\n direction={isHorizontal ? 'column' : 'row'}\n alignItems=\"center\"\n justifyContent=\"center\"\n gap={8}\n alpha={finalAlpha}\n theme={nestedTheme}\n >\n {/* Track Container */}\n <View\n ref={trackRef}\n width={isHorizontal ? trackLength : trackHeight}\n height={isHorizontal ? trackHeight : trackLength}\n backgroundColor={themed.trackColor ?? 0x444444}\n cornerRadius={themed.trackBorderRadius ?? trackHeight / 2}\n direction=\"stack\"\n onTouch={handleTrackTouch}\n theme={nestedTheme}\n >\n {/* Filled Track */}\n {props.renderTrack ? (\n <View key={Math.random()}>\n {props.renderTrack(fillStartPercentage, isRange ? fillEndPercentage : undefined)}\n </View>\n ) : (\n <View\n x={isHorizontal ? fillStartPos : 0}\n y={isHorizontal ? 0 : fillStartPos}\n width={isHorizontal ? fillLength : trackHeight}\n height={isHorizontal ? trackHeight : fillLength}\n backgroundColor={themed.trackFilledColor ?? 0x4dabf7}\n cornerRadius={themed.trackBorderRadius ?? trackHeight / 2}\n theme={nestedTheme}\n />\n )}\n\n {/* Marks/Ticks */}\n <View direction=\"stack\" theme={nestedTheme}>\n {marksArray.map((mark) => {\n const markPercentage = valueToPercentage(mark.value)\n const markPos = reverse\n ? trackLength - markPercentage * trackLength\n : markPercentage * trackLength\n\n const markHeight = mark.style?.height ?? themed.markHeight ?? 8\n const markWidth = mark.style?.width ?? themed.markWidth ?? 2\n const markColor = mark.style?.color ?? themed.markColor ?? 0x888888\n\n return (\n <View\n key={mark.value}\n x={isHorizontal ? markPos - markWidth / 2 : trackHeight / 2 - markWidth / 2}\n y={isHorizontal ? trackHeight / 2 - markHeight / 2 : markPos - markWidth / 2}\n width={isHorizontal ? markWidth : markHeight}\n height={isHorizontal ? markHeight : markWidth}\n backgroundColor={markColor}\n theme={nestedTheme}\n direction=\"stack\"\n >\n {mark.label}\n </View>\n )\n })}\n </View>\n\n {/* Thumb 1 (or single thumb) */}\n <View\n ref={thumb1Ref}\n x={isHorizontal ? currentDragPos1 : 0}\n y={isHorizontal ? 0 : currentDragPos1}\n direction=\"stack\"\n theme={nestedTheme}\n >\n <View\n x={-thumbSize}\n y={-thumbSize}\n width={thumbSize * 2}\n height={thumbSize * 2}\n onTouchMove={handleThumbDrag(0)}\n />\n <View\n x={isHorizontal ? 0 : trackHeight / 2}\n y={isHorizontal ? trackHeight / 2 : 0}\n width={thumbSize}\n height={thumbSize}\n direction=\"stack\"\n theme={nestedTheme}\n >\n {props.renderThumb ? (\n props.renderThumb(thumb1Value, isDragging1, 0)\n ) : (\n <DefaultThumb\n size={thumbSize}\n color={themed.thumbColor ?? 0x4dabf7}\n borderColor={themed.thumbBorderColor ?? 0xffffff}\n borderWidth={themed.thumbBorderWidth ?? 2}\n isDragging={isDragging1}\n dragScale={themed.thumbDragScale ?? 1.1}\n />\n )}\n </View>\n\n {props.showValue ? (\n <RefOriginView\n x={labelOffset1.x}\n y={labelOffset1.y}\n width={0}\n height={0}\n originX={0.5}\n originY={0.5}\n >\n <View\n width={100}\n height={50}\n x={-50}\n y={-25}\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <View\n backgroundColor={themed.valueLabel?.backgroundColor ?? 0x000000}\n padding={themed.valueLabel?.padding ?? { left: 6, right: 6, top: 4, bottom: 4 }}\n cornerRadius={themed.valueLabel?.cornerRadius ?? 4}\n theme={nestedTheme}\n >\n <Text\n text={formatValue(thumb1Value)}\n style={themed.valueLabel?.textStyle ?? { color: '#ffffff', fontSize: '12px' }}\n theme={nestedTheme}\n />\n </View>\n </View>\n </RefOriginView>\n ) : null}\n </View>\n\n {/* Thumb 2 (range mode only) */}\n {isRange ? (\n <View\n ref={thumb2Ref}\n x={isHorizontal ? currentDragPos2 : 0}\n y={isHorizontal ? 0 : currentDragPos2}\n direction=\"stack\"\n theme={nestedTheme}\n >\n <View\n x={-thumbSize}\n y={-thumbSize}\n width={thumbSize * 2}\n height={thumbSize * 2}\n onTouchMove={handleThumbDrag(1)}\n />\n <View\n x={isHorizontal ? 0 : trackHeight / 2}\n y={isHorizontal ? trackHeight / 2 : 0}\n width={thumbSize}\n height={thumbSize}\n direction=\"stack\"\n theme={nestedTheme}\n >\n {props.renderThumb ? (\n props.renderThumb(thumb2Value, isDragging2, 1)\n ) : (\n <DefaultThumb\n size={thumbSize}\n color={themed.thumbColor ?? 0x4dabf7}\n borderColor={themed.thumbBorderColor ?? 0xffffff}\n borderWidth={themed.thumbBorderWidth ?? 2}\n isDragging={isDragging2}\n dragScale={themed.thumbDragScale ?? 1.1}\n />\n )}\n </View>\n\n {props.showValue ? (\n <RefOriginView\n x={labelOffset2.x}\n y={labelOffset2.y}\n width={0}\n height={0}\n originX={0.5}\n originY={0.5}\n >\n <View\n width={100}\n height={50}\n x={-50}\n y={-25}\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <View\n backgroundColor={themed.valueLabel?.backgroundColor ?? 0x000000}\n padding={themed.valueLabel?.padding ?? { left: 6, right: 6, top: 4, bottom: 4 }}\n cornerRadius={themed.valueLabel?.cornerRadius ?? 4}\n theme={nestedTheme}\n >\n <Text\n text={formatValue(thumb2Value)}\n style={themed.valueLabel?.textStyle ?? { color: '#ffffff', fontSize: '12px' }}\n theme={nestedTheme}\n />\n </View>\n </View>\n </RefOriginView>\n ) : null}\n </View>\n ) : null}\n </View>\n </View>\n )\n}\n\n/**\n * Slider component - interactive single value selection\n * @param props - Slider properties\n * @returns Slider JSX element\n */\nexport function Slider(props: SliderProps) {\n return <BaseSlider {...props} mode=\"single\" />\n}\n\n/**\n * RangeSlider component - interactive range selection with two thumbs\n * @param props - RangeSlider properties\n * @returns RangeSlider JSX element\n */\nexport function RangeSlider(props: RangeSliderProps) {\n return <BaseSlider {...props} mode=\"range\" />\n}\n","/** @jsxImportSource ../.. */\n/**\n * Toggle/Switch component - Binary on/off control with animated thumb\n * Provides smooth animations and flexible theming\n */\nimport type Phaser from 'phaser'\nimport { numberToRgb, rgbToNumber } from '../../colors/color-utils'\nimport { useEffect, useRef, useState, useTheme } from '../../hooks'\nimport { getThemedProps } from '../../theme'\nimport type { PartialTheme } from '../../theme-base'\nimport type { ChildrenType } from '../../types'\nimport { Graphics, Text, View } from '../index'\n\n/**\n * Interpolate between two colors\n * @param color1 - Start color\n * @param color2 - End color\n * @param progress - Interpolation progress (0.0 to 1.0)\n * @returns Interpolated color\n */\nfunction interpolateColor(color1: number, color2: number, progress: number): number {\n const rgb1 = numberToRgb(color1)\n const rgb2 = numberToRgb(color2)\n\n const r = Math.round(rgb1.r + (rgb2.r - rgb1.r) * progress)\n const g = Math.round(rgb1.g + (rgb2.g - rgb1.g) * progress)\n const b = Math.round(rgb1.b + (rgb2.b - rgb1.b) * progress)\n\n return rgbToNumber(r, g, b)\n}\n\n/**\n * Props for Toggle component\n */\nexport interface ToggleProps {\n /** Whether the toggle is checked/on */\n checked?: boolean\n /** Callback when toggle state changes */\n onChange?: (checked: boolean) => void\n /** Optional label text */\n label?: string\n /** Label position relative to toggle */\n labelPosition?: 'left' | 'right' | 'none'\n /** Disabled state */\n disabled?: boolean\n /** Optional prefix content (e.g., Icon) */\n prefix?: ChildrenType\n /** Optional suffix content */\n suffix?: ChildrenType\n /** Theme overrides */\n theme?: PartialTheme\n}\n\n/**\n * Toggle/Switch component\n * Animated on/off switch with customizable appearance\n *\n * @example\n * ```tsx\n * // Basic toggle\n * <Toggle checked={isEnabled} onChange={setIsEnabled} label=\"Enable feature\" />\n *\n * // With custom positioning\n * <Toggle\n * checked={value}\n * onChange={setValue}\n * label=\"Dark Mode\"\n * labelPosition=\"left\"\n * />\n *\n * // With icons\n * <Toggle\n * checked={value}\n * onChange={setValue}\n * prefix={<Icon type=\"sun\" />}\n * suffix={<Icon type=\"moon\" />}\n * />\n * ```\n */\nexport function Toggle(props: ToggleProps) {\n const localTheme = useTheme()\n const { props: themed, nestedTheme } = getThemedProps('Toggle', localTheme, props.theme ?? {})\n\n // Theme values with defaults - use refs for values used in closures\n const width = useRef(themed.width ?? 50)\n const height = useRef(themed.height ?? 28)\n const thumbSize = useRef(themed.thumbSize ?? 24)\n const trackColorOff = useRef(themed.trackColorOff ?? 0x999999)\n const trackColorOn = useRef(themed.trackColorOn ?? 0x4caf50)\n const thumbColor = useRef(themed.thumbColor ?? 0xffffff)\n const disabledColor = useRef(themed.disabledColor ?? 0x666666)\n const padding = useRef(themed.padding ?? 2)\n const duration = useRef(themed.duration ?? 200)\n const gap = themed.gap ?? 8\n const labelPosition = props.labelPosition ?? themed.labelPosition ?? 'right'\n\n // Update refs when theme changes\n width.current = themed.width ?? 50\n height.current = themed.height ?? 28\n thumbSize.current = themed.thumbSize ?? 24\n trackColorOff.current = themed.trackColorOff ?? 0x999999\n trackColorOn.current = themed.trackColorOn ?? 0x4caf50\n thumbColor.current = themed.thumbColor ?? 0xffffff\n disabledColor.current = themed.disabledColor ?? 0x666666\n padding.current = themed.padding ?? 2\n duration.current = themed.duration ?? 200\n\n // Calculate positions\n const thumbRadius = thumbSize.current / 2\n const trackRadius = height.current / 2\n const thumbOffsetOff = padding.current + thumbRadius\n const thumbOffsetOn = width.current - padding.current - thumbRadius\n\n // State\n const initialChecked = props.checked !== undefined ? props.checked : false\n const [checked, setChecked] = useState<boolean>(initialChecked)\n const [isAnimating, setIsAnimating] = useState(false)\n const [thumbX, setThumbX] = useState<number>(initialChecked ? thumbOffsetOn : thumbOffsetOff)\n\n // Refs\n const trackRef = useRef<Phaser.GameObjects.Graphics | null>(null)\n const thumbRef = useRef<Phaser.GameObjects.Graphics | null>(null)\n const containerRef = useRef<Phaser.GameObjects.Container | null>(null)\n\n // Sync with controlled prop\n useEffect(() => {\n if (props.checked !== undefined && props.checked !== checked) {\n animateToggle(props.checked)\n }\n }, [props.checked, checked])\n\n /**\n * Animate toggle transition\n */\n const animateToggle = (newChecked: boolean) => {\n const track = trackRef.current\n const container = containerRef.current\n\n if (!track || !container) return\n\n const scene = container.scene\n if (!scene) return\n\n setIsAnimating(true)\n\n const endX = newChecked ? thumbOffsetOn : thumbOffsetOff\n\n // Animate thumb position via state\n const startX = thumbX\n\n console.log('Duration:', duration.current)\n\n scene.tweens.addCounter({\n from: 0,\n to: 1,\n duration: duration.current,\n ease: 'Cubic.easeOut',\n onUpdate: (tween: Phaser.Tweens.Tween) => {\n const progress = tween.getValue() as number\n const currentX = startX + (endX - startX) * progress\n setThumbX(currentX)\n },\n onComplete: () => {\n setThumbX(endX)\n setIsAnimating(false)\n },\n })\n\n // Animate track color\n const startColor = checked ? trackColorOn.current : trackColorOff.current\n const endColor = newChecked ? trackColorOn.current : trackColorOff.current\n\n scene.tweens.add({\n targets: { value: 0 },\n value: 1,\n duration: duration.current,\n ease: 'Cubic.easeOut',\n onUpdate: (tween: Phaser.Tweens.Tween) => {\n const progress = (tween.getValue() as number) ?? 0\n const currentColor = interpolateColor(startColor, endColor, progress)\n\n track.clear()\n track.fillStyle(props.disabled ? disabledColor.current : currentColor, 1)\n track.fillRoundedRect(0, 0, width.current, height.current, trackRadius)\n },\n })\n\n setChecked(newChecked)\n }\n\n /**\n * Handle toggle click\n */\n const handleClick = () => {\n if (props.disabled || isAnimating) return\n\n const newChecked = !checked\n animateToggle(newChecked)\n props.onChange?.(newChecked)\n }\n\n /**\n * Draw track graphics\n */\n const drawTrack = (g: Phaser.GameObjects.Graphics) => {\n g.clear()\n const color = props.disabled\n ? disabledColor.current\n : checked\n ? trackColorOn.current\n : trackColorOff.current\n g.fillStyle(color, 1)\n g.fillRoundedRect(0, 0, width.current, height.current, trackRadius)\n }\n\n /**\n * Draw thumb graphics\n */\n const drawThumb = (g: Phaser.GameObjects.Graphics) => {\n g.clear()\n g.fillStyle(thumbColor.current, 1)\n g.fillCircle(0, 0, thumbRadius)\n }\n\n // Build toggle element\n const toggleElement = (\n <View\n direction=\"stack\"\n width={width.current}\n height={height.current}\n enableGestures={!props.disabled}\n onTouch={handleClick}\n alpha={props.disabled ? 0.5 : 1}\n >\n {/* Track */}\n <Graphics ref={trackRef} width={width.current} height={height.current} onDraw={drawTrack} />\n\n {/* Thumb - position controlled by state */}\n <Graphics\n ref={thumbRef}\n width={thumbSize.current}\n height={thumbSize.current}\n x={thumbX}\n y={height.current / 2}\n onDraw={drawThumb}\n />\n </View>\n )\n\n // Build label if provided\n const labelElement = props.label && labelPosition !== 'none' && (\n <Text text={props.label} style={themed.labelStyle} />\n )\n\n // Render with label positioning\n if (!props.label || labelPosition === 'none') {\n return (\n <View ref={containerRef} direction=\"row\" alignItems=\"center\" gap={gap} theme={nestedTheme}>\n {props.prefix}\n {toggleElement}\n {props.suffix}\n </View>\n )\n }\n\n return (\n <View ref={containerRef} direction=\"row\" alignItems=\"center\" gap={gap} theme={nestedTheme}>\n {labelPosition === 'left' && labelElement}\n {props.prefix}\n {toggleElement}\n {props.suffix}\n {labelPosition === 'right' && labelElement}\n </View>\n )\n}\n","/** @jsxImportSource ../.. */\n/**\n * TransformOriginView - declarative transform component with custom origin point\n *\n * Applies transformations (rotation, scale) around a configurable origin point.\n * Unlike OriginView which returns a ref for imperative manipulation,\n * TransformOriginView applies transforms declaratively via props.\n *\n * Perfect for:\n * - Spring animations with useSpring\n * - Reactive transforms based on state/signals\n * - Declarative rotation/scale around center or custom origin\n *\n * @example\n * const [rotation, setRotation] = useSpring(0, 'gentle')\n * <TransformOriginView width={100} height={100} rotation={rotation.value}>\n * <View backgroundColor={0xff0000} />\n * </TransformOriginView>\n */\nimport type { VNode } from '../../hooks'\nimport { View } from '../index'\nimport type { ViewProps } from '..'\n\n/**\n * Extended ViewProps with origin support for declarative transforms\n */\nexport interface TransformOriginViewProps extends Omit<ViewProps, 'children'> {\n /**\n * Origin X for rotation and scale (0 = left, 0.5 = center, 1 = right)\n * @default 0.5\n */\n originX?: number\n /**\n * Origin Y for rotation and scale (0 = top, 0.5 = center, 1 = bottom)\n * @default 0.5\n */\n originY?: number\n /**\n * Child elements to render with centered origin\n */\n children?: VNode\n}\n\n/**\n * TransformOriginView component - declarative transforms around custom origin point\n *\n * Uses three nested Views to apply rotation/scale around configurable origin:\n * - Outer View: Defines bounding box, receives layout/position props\n * - Middle View: Positioned at origin point, receives transform/visual props\n * - Inner View: Contains content, offset to align with origin\n *\n * @param props - TransformOriginView props\n * @returns JSX element\n */\nexport function TransformOriginView({\n originX = 0.5,\n originY = 0.5,\n width,\n height,\n x = 0,\n y = 0,\n children,\n // Transform props go to middle View\n rotation,\n scale,\n scaleX,\n scaleY,\n // Visual props go to middle View\n backgroundColor,\n backgroundAlpha,\n cornerRadius,\n borderWidth,\n borderColor,\n borderAlpha,\n // All other ViewProps go to outer View\n ...outerViewProps\n}: TransformOriginViewProps) {\n if (typeof width !== 'number' || typeof height !== 'number') {\n throw new Error('TransformOriginView requires numeric width and height')\n }\n\n const offsetX = width * originX\n const offsetY = height * originY\n\n // Only pass defined transform/visual props to middle View\n const middleViewProps: Partial<ViewProps> = {}\n if (rotation !== undefined) middleViewProps.rotation = rotation\n if (scale !== undefined) middleViewProps.scale = scale\n if (scaleX !== undefined) middleViewProps.scaleX = scaleX\n if (scaleY !== undefined) middleViewProps.scaleY = scaleY\n if (backgroundColor !== undefined) middleViewProps.backgroundColor = backgroundColor\n if (backgroundAlpha !== undefined) middleViewProps.backgroundAlpha = backgroundAlpha\n if (cornerRadius !== undefined) middleViewProps.cornerRadius = cornerRadius\n if (borderWidth !== undefined) middleViewProps.borderWidth = borderWidth\n if (borderColor !== undefined) middleViewProps.borderColor = borderColor\n if (borderAlpha !== undefined) middleViewProps.borderAlpha = borderAlpha\n\n return (\n <View\n x={x}\n y={y}\n width={width}\n height={height}\n padding={0}\n direction=\"stack\"\n {...outerViewProps}\n >\n <View\n x={offsetX}\n y={offsetY}\n width={width}\n height={height}\n padding={0}\n direction=\"stack\"\n {...middleViewProps}\n >\n <View\n x={-offsetX}\n y={-offsetY}\n width={width}\n height={height}\n padding={0}\n direction=\"stack\"\n backgroundAlpha={0}\n >\n {children}\n </View>\n </View>\n </View>\n )\n}\n"],"names":["Phaser","shallowEqual","depsChanged","normalizeVisible","calculateFitScale","equal","undefined","global","exports","collection","runInContext","Array","Date","Error","Function","Math","Object","RegExp","String","Symbol","Map","Promise","Set","WeakMap","lodash","result","iteratee","size","values","key","setTimeout","includes","object","indexOf","set","clearTimeout","index","ary","othValue","map","transform","parent","clone","parseInt","chain","value","this","debounce","isInside","state","width","height","currentSize","extendedContainer","gapValue","totalGapSpace","availableMainSpace","lineGapSpace","DEEP_COMPARE_PROPS","hasLayoutPropsChanged","hex","preset","getPresetWithMode","remountAll","flatChildren","scene","node","a","b","len","propsWithChildren","signal","_value","currentValue","cursorPosition","viewportHeight","viewportWidth","contentHeight","contentWidth","maxScrollY","maxScrollX","epsilon","placement","Image","contentNodes"],"mappings":";;;AA2CO,MAAM,eAAsC,CAA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