function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);
    if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);
        if (enumerableOnly) {
            symbols = symbols.filter(function(sym) {
                return Object.getOwnPropertyDescriptor(object, sym).enumerable;
            });
        }
        keys.push.apply(keys, symbols);
    }
    return keys;
}
function _object_spread_props(target, source) {
    source = source != null ? source : {};
    if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
        ownKeys(Object(source)).forEach(function(key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
    }
    return target;
}
import React, { useMemo } from "react";
import { useAsyncLottieData } from "../useAsyncLottieData";
import AbstractLottie from "./Abstract";
/**
 * 工厂：根据动态 import 生成一个基于 AbstractLottie 的 bubble-action 包装组件。
 *
 * 用于消除 bubble-actions/{Like,Copy,Dislike,More,Play,Quote,Refresh,Share} 等
 * 结构完全相同的轻量包装组件。
 */ export function createBubbleActionLottie(options) {
    var loadJson = options.loadJson, displayName = options.displayName;
    var Component = function Component(props) {
        var stableLoad = useMemo(function() {
            return loadJson;
        }, []);
        var animationData = useAsyncLottieData(stableLoad);
        if (animationData === null) {
            return null;
        }
        return /*#__PURE__*/ React.createElement(AbstractLottie, _object_spread_props(_object_spread({}, props), {
            animationData: animationData
        }));
    };
    if (displayName) {
        Component.displayName = displayName;
    }
    return Component;
}
