"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    useCanvasNodeLayout: ()=>useCanvasNodeLayout,
    useNodeManifestResolver: ()=>useNodeManifestResolver
});
const external_react_namespaceObject = require("react");
const index_cjs_namespaceObject = require("../core/index.cjs");
const collapse_cjs_namespaceObject = require("../utils/collapse.cjs");
const container_cjs_namespaceObject = require("../utils/container.cjs");
function useNodeManifestResolver() {
    const registry = (0, index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
    return (0, external_react_namespaceObject.useCallback)((node)=>node.type ? registry?.getManifest(node.type) : void 0, [
        registry
    ]);
}
function useCanvasNodeLayout() {
    const getManifestForNode = useNodeManifestResolver();
    return (0, external_react_namespaceObject.useMemo)(()=>{
        const getNodeDimensions = (node)=>{
            const manifest = getManifestForNode(node);
            return (0, container_cjs_namespaceObject.getNodeDimensions)(node, (0, collapse_cjs_namespaceObject.getExpandedSize)(manifest?.display.shape));
        };
        const isContainerNode = (node)=>(0, container_cjs_namespaceObject.isContainerNodeManifest)(getManifestForNode(node));
        return {
            getManifestForNode,
            getNodeDimensions,
            isContainerNode,
            getContainerFitGeometry: (node)=>isContainerNode(node) ? (0, container_cjs_namespaceObject.getContainerFitGeometry)() : null
        };
    }, [
        getManifestForNode
    ]);
}
exports.useCanvasNodeLayout = __webpack_exports__.useCanvasNodeLayout;
exports.useNodeManifestResolver = __webpack_exports__.useNodeManifestResolver;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "useCanvasNodeLayout",
    "useNodeManifestResolver"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
