"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const tslib_es6 = require("../../../../../../../tslib@2.6.2/node_modules/tslib/tslib.es6.js");
const React = require("react");
const isForcedMotionValue = require("../../motion/utils/is-forced-motion-value.js");
const isMotionValue = require("../../value/utils/is-motion-value.js");
const buildStyles = require("./utils/build-styles.js");
const createRenderState = require("./utils/create-render-state.js");
function copyRawValuesOnly(target, source, props) {
  for (var key in source) {
    if (!isMotionValue.isMotionValue(source[key]) && !isForcedMotionValue.isForcedMotionValue(key, props)) {
      target[key] = source[key];
    }
  }
}
function useInitialMotionValues(_a, visualState, isStatic) {
  var transformTemplate = _a.transformTemplate;
  return React.useMemo(function() {
    var state = createRenderState.createHtmlRenderState();
    buildStyles.buildHTMLStyles(state, visualState, { enableHardwareAcceleration: !isStatic }, transformTemplate);
    var vars = state.vars, style = state.style;
    return tslib_es6.__assign(tslib_es6.__assign({}, vars), style);
  }, [visualState]);
}
function useStyle(props, visualState, isStatic) {
  var styleProp = props.style || {};
  var style = {};
  copyRawValuesOnly(style, styleProp, props);
  Object.assign(style, useInitialMotionValues(props, visualState, isStatic));
  if (props.transformValues) {
    style = props.transformValues(style);
  }
  return style;
}
function useHTMLProps(props, visualState, isStatic) {
  var htmlProps = {};
  var style = useStyle(props, visualState, isStatic);
  if (Boolean(props.drag) && props.dragListener !== false) {
    htmlProps.draggable = false;
    style.userSelect = style.WebkitUserSelect = style.WebkitTouchCallout = "none";
    style.touchAction = props.drag === true ? "none" : "pan-".concat(props.drag === "x" ? "y" : "x");
  }
  htmlProps.style = style;
  return htmlProps;
}
exports.copyRawValuesOnly = copyRawValuesOnly;
exports.useHTMLProps = useHTMLProps;
exports.useStyle = useStyle;
//# sourceMappingURL=use-props.js.map
