"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// packages/block-editor/src/components/block-mover/mover-description.js
var mover_description_exports = {};
__export(mover_description_exports, {
  getBlockMoverDescription: () => getBlockMoverDescription,
  getMultiBlockMoverDescription: () => getMultiBlockMoverDescription
});
module.exports = __toCommonJS(mover_description_exports);
var import_i18n = require("@wordpress/i18n");
var getMovementDirection = (moveDirection, orientation) => {
  if (moveDirection === "up") {
    if (orientation === "horizontal") {
      return (0, import_i18n.isRTL)() ? "right" : "left";
    }
    return "up";
  } else if (moveDirection === "down") {
    if (orientation === "horizontal") {
      return (0, import_i18n.isRTL)() ? "left" : "right";
    }
    return "down";
  }
  return null;
};
function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) {
  const position = firstIndex + 1;
  if (selectedCount > 1) {
    return getMultiBlockMoverDescription(
      selectedCount,
      firstIndex,
      isFirst,
      isLast,
      dir,
      orientation
    );
  }
  if (isFirst && isLast) {
    return (0, import_i18n.sprintf)(
      // translators: %s: Type of block (i.e. Text, Image etc)
      (0, import_i18n.__)("Block %s is the only block, and cannot be moved"),
      type
    );
  }
  if (dir > 0 && !isLast) {
    const movementDirection = getMovementDirection("down", orientation);
    if (movementDirection === "down") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
        (0, import_i18n.__)(
          "Move %1$s block from position %2$d down to position %3$d"
        ),
        type,
        position,
        position + 1
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
        (0, import_i18n.__)(
          "Move %1$s block from position %2$d left to position %3$d"
        ),
        type,
        position,
        position + 1
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
        (0, import_i18n.__)(
          "Move %1$s block from position %2$d right to position %3$d"
        ),
        type,
        position,
        position + 1
      );
    }
  }
  if (dir > 0 && isLast) {
    const movementDirection = getMovementDirection("down", orientation);
    if (movementDirection === "down") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc)
        (0, import_i18n.__)(
          "Block %1$s is at the end of the content and can’t be moved down"
        ),
        type
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc)
        (0, import_i18n.__)(
          "Block %1$s is at the end of the content and can’t be moved left"
        ),
        type
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc)
        (0, import_i18n.__)(
          "Block %1$s is at the end of the content and can’t be moved right"
        ),
        type
      );
    }
  }
  if (dir < 0 && !isFirst) {
    const movementDirection = getMovementDirection("up", orientation);
    if (movementDirection === "up") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
        (0, import_i18n.__)("Move %1$s block from position %2$d up to position %3$d"),
        type,
        position,
        position - 1
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
        (0, import_i18n.__)(
          "Move %1$s block from position %2$d left to position %3$d"
        ),
        type,
        position,
        position - 1
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
        (0, import_i18n.__)(
          "Move %1$s block from position %2$d right to position %3$d"
        ),
        type,
        position,
        position - 1
      );
    }
  }
  if (dir < 0 && isFirst) {
    const movementDirection = getMovementDirection("up", orientation);
    if (movementDirection === "up") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc)
        (0, import_i18n.__)(
          "Block %1$s is at the beginning of the content and can’t be moved up"
        ),
        type
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc)
        (0, import_i18n.__)(
          "Block %1$s is at the beginning of the content and can’t be moved left"
        ),
        type
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Type of block (i.e. Text, Image etc)
        (0, import_i18n.__)(
          "Block %1$s is at the beginning of the content and can’t be moved right"
        ),
        type
      );
    }
  }
}
function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation) {
  const position = firstIndex + 1;
  if (isFirst && isLast) {
    return (0, import_i18n.__)("All blocks are selected, and cannot be moved");
  }
  if (dir > 0 && !isLast) {
    const movementDirection = getMovementDirection("down", orientation);
    if (movementDirection === "down") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Number of selected blocks, 2: Position of selected blocks
        (0, import_i18n.__)("Move %1$d blocks from position %2$d down by one place"),
        selectedCount,
        position
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Number of selected blocks, 2: Position of selected blocks
        (0, import_i18n.__)("Move %1$d blocks from position %2$d left by one place"),
        selectedCount,
        position
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Number of selected blocks, 2: Position of selected blocks
        (0, import_i18n.__)("Move %1$d blocks from position %2$d right by one place"),
        selectedCount,
        position
      );
    }
  }
  if (dir > 0 && isLast) {
    const movementDirection = getMovementDirection("down", orientation);
    if (movementDirection === "down") {
      return (0, import_i18n.__)(
        "Blocks cannot be moved down as they are already at the bottom"
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.__)(
        "Blocks cannot be moved left as they are already are at the leftmost position"
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.__)(
        "Blocks cannot be moved right as they are already are at the rightmost position"
      );
    }
  }
  if (dir < 0 && !isFirst) {
    const movementDirection = getMovementDirection("up", orientation);
    if (movementDirection === "up") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Number of selected blocks, 2: Position of selected blocks
        (0, import_i18n.__)("Move %1$d blocks from position %2$d up by one place"),
        selectedCount,
        position
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Number of selected blocks, 2: Position of selected blocks
        (0, import_i18n.__)("Move %1$d blocks from position %2$d left by one place"),
        selectedCount,
        position
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.sprintf)(
        // translators: 1: Number of selected blocks, 2: Position of selected blocks
        (0, import_i18n.__)("Move %1$d blocks from position %2$d right by one place"),
        selectedCount,
        position
      );
    }
  }
  if (dir < 0 && isFirst) {
    const movementDirection = getMovementDirection("up", orientation);
    if (movementDirection === "up") {
      return (0, import_i18n.__)(
        "Blocks cannot be moved up as they are already at the top"
      );
    }
    if (movementDirection === "left") {
      return (0, import_i18n.__)(
        "Blocks cannot be moved left as they are already are at the leftmost position"
      );
    }
    if (movementDirection === "right") {
      return (0, import_i18n.__)(
        "Blocks cannot be moved right as they are already are at the rightmost position"
      );
    }
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getBlockMoverDescription,
  getMultiBlockMoverDescription
});
//# sourceMappingURL=mover-description.cjs.map
