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A,EACjC,oBAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA;AAAA,IACI,OAAA,EAAS;AAAA;AAEjB,CAAA,CAAE,mBAAmB,CAAA;AAMrB,IAAO,qBAAA,GAAQ","file":"PlaneDebugger-ESX6FTFB.mjs","sourcesContent":["// #region imports\n    // #region libraries\n    import React from 'react';\n\n    import { connect } from 'react-redux';\n\n    import styled from 'styled-components';\n\n    import {\n        Theme,\n    } from '@plurid/plurid-themes';\n\n    import {\n        TreePlane,\n        CameraState,\n        ViewSize,\n        PLURID_ENTITY_PLANE_DEBUGGER,\n    } from '@plurid/plurid-data';\n    // #endregion libraries\n\n\n    // #region external\n    import { AppState } from '~services/state/store';\n    import StateContext from '~services/state/context';\n    import selectors from '~services/state/selectors';\n\n    import {\n        cameraDepthOf,\n        planeWorldCenter,\n    } from '~services/logic/selection';\n\n    import {\n        resolvePlaneFallbackSize,\n    } from '~services/logic/camera';\n    import {\n        getCulledSets,\n        planeCullingState,\n        PlaneCullingState,\n    } from '~services/state/modules/space/selectors';\n    // #endregion external\n// #endregion imports\n\n\n\n// #region module\n\nconst StyledPluridPlaneDebugger = styled.pre<{ theme: Theme }>`\n    position: absolute;\n    top: 100%;\n    left: 0;\n    margin: 2px 0 0;\n    padding: 4px 6px;\n    font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;\n    color: ${({ theme }) => 'var(--plurid-ink)'};\n    background-color: ${({ theme }) => 'var(--plurid-surface)'};\n    border: 1px solid ${({ theme }) => 'var(--plurid-surface-strong)'};\n    border-radius: 4px;\n    pointer-events: none;\n    user-select: none;\n    white-space: pre;\n`;\n\n\nexport interface PluridPlaneDebuggerOwnProperties {\n    treePlane: TreePlane;\n    /** Renders of the plane since mount (`development.inspector`). */\n    renders?: number;\n}\n\nexport interface PluridPlaneDebuggerStateProperties {\n    stateGeneralTheme: Theme;\n    stateCamera: CameraState;\n    stateViewSize: ViewSize;\n    stateFallback: { width: number; height: number };\n    stateCulled: PlaneCullingState;\n}\n\nexport type PluridPlaneDebuggerProperties =\n    & PluridPlaneDebuggerOwnProperties\n    & PluridPlaneDebuggerStateProperties;\n\n\n/** Per-plane readout (`development.planeDebugger`): id, route, placement, size, depth, link. */\nconst PluridPlaneDebugger: React.FC<PluridPlaneDebuggerProperties> = (\n    {\n        treePlane,\n        renders,\n        stateGeneralTheme,\n        stateCamera,\n        stateViewSize,\n        stateFallback,\n        stateCulled,\n    },\n) => {\n    const depth = cameraDepthOf(stateCamera, stateViewSize, planeWorldCenter(treePlane, stateFallback));\n    const location = treePlane.location;\n    const lines = [\n        `${treePlane.planeID}`,\n        `${treePlane.route}`,\n        `at ${Math.round(location.translateX)},${Math.round(location.translateY)},${Math.round(location.translateZ)}  rot ${Math.round(location.rotateX)},${Math.round(location.rotateY)}`,\n        `size ${Math.round(treePlane.width)}×${Math.round(treePlane.height)} ${treePlane.sizeMode || 'measured'}  depth ${Math.round(stateCamera.perspective - depth)}  ${stateCulled}`,\n        treePlane.spawnedByLinkID ? `link ${treePlane.spawnedByLinkID}` : 'root',\n        `parent ${treePlane.parentPlaneID || '-'}  renders ${renders ?? 0}${treePlane.manuallyPositioned ? '  pinned' : ''}`,\n    ];\n\n    return (\n        <StyledPluridPlaneDebugger\n            theme={stateGeneralTheme}\n            data-plurid-entity={PLURID_ENTITY_PLANE_DEBUGGER}\n            aria-hidden=\"true\"\n        >\n            {lines.join('\\n')}\n        </StyledPluridPlaneDebugger>\n    );\n};\n\n\nconst mapStateToProperties = (\n    state: AppState,\n    ownProperties: PluridPlaneDebuggerOwnProperties,\n): PluridPlaneDebuggerStateProperties => {\n    const id = ownProperties.treePlane.planeID;\n    return {\n        stateGeneralTheme: selectors.themes.getGeneralTheme(state),\n        stateCamera: state.space.camera,\n        stateViewSize: state.space.viewSize,\n        stateFallback: resolvePlaneFallbackSize(state.configuration, state.space.viewSize),\n        stateCulled: planeCullingState(getCulledSets(state), id),\n    };\n};\n\n\nconst ConnectedPluridPlaneDebugger = connect(\n    mapStateToProperties,\n    null,\n    null,\n    {\n        context: StateContext,\n    },\n)(PluridPlaneDebugger);\n// #endregion module\n\n\n\n// #region exports\nexport default ConnectedPluridPlaneDebugger;\n// #endregion exports\n"]}