# Frontend execution path — publisher-provided source excerpts

Examined frontend revision: `3403a9e3ab3a5b22c90b81d57bdaed9626b1e5c4`. The application's GitHub repository is not publicly retrievable, so these excerpts are provided with source paths, one-based line references and complete-file fingerprints. They document the publisher's inspected integration; they do not independently attest the JavaScript served to every production visitor. The public npm engine, raw outcomes and replay can be verified independently.

## src/lib/optimizedDiceCore.ts:1

Complete-file SHA-256: `706f08053e3c861ad321d5151f2fe64f0ea8f969e1dddf687a0f94275f71c4a5`

```ts
import { type MixedRollResult, rollMixedDice } from "@erpg/dicecore/systems/mixed";

/**
 * Keeps generic segments complete for animation while avoiding duplicated
 * base-roll payloads for semantic system segments.
 */
export const rollCompactMixedDice = (input: string): MixedRollResult<"compact"> =>
  rollMixedDice(input, {
    detail: "compact",
    randomAlgorithm: "xoshiro128ss",
  });
```

## src/components/character-sheet/advancedRollRuntime.ts:509

Complete-file SHA-256: `018f789c69053f9ebeb25a2f5520e84f125accd13189481390d9d638a6d9469c`

```ts
  let roll: DiceRollResult;
  try {
    const mixedRoll = rollCompactMixedDice(resolveDiceFormulaComparisons(nextResolvedFormula));
    const onlyRoll = mixedRoll.rolls.length === 1 ? mixedRoll.rolls[0] : null;
    if (onlyRoll?.kind !== "generic") {
      return buildMixedRollExecution(trimmedFormula, nextResolvedFormula, mixedRoll);
    }
    roll = onlyRoll.result;
  } catch (error) {
    const numericFallback = evaluateSheetNumericFormula({
      expression: nextResolvedFormula,
      scope: variables,
      fallback: 0,
    });
```

## src/pages/tools/useDiceRoller.ts:120

Complete-file SHA-256: `567a3829066b1df0ad309d881221e0bd21c798156b72a1d2e44be9d6d75e52db`

```ts
        const resolution = resolveDiceRollerFormula(trimmedFormula, MAX_DICE_PER_ROLL);
        if (!resolution.ok) {
          if (resolution.reason === "too-many-dice") {
            throw new Error(
              t("tools.dice-roller.error_max_dice", {
                defaultValue: "Role no maximo {{max}} dados por vez.",
                max: MAX_DICE_PER_ROLL,
              }),
            );
          }
          if (resolution.reason === "no-dice-group") {
            throw new Error(
              t("tools.dice-roller.error_no_dice_group", {
                defaultValue: "A rolagem precisa ter ao menos um grupo de dados, como 2d20+5.",
              }),
            );
          }

          throw new Error(
            t("tools.dice-roller.error_invalid_formula", {
              defaultValue: "Nao foi possivel rolar essa formula.",
            }),
          );
        }
        const { execution } = resolution;
        const preparedRoll = settings.disable3DDice
          ? null
          : buildCompatibleDice3DRollRequest({
              id,
              dice: execution.details.dice,
              events: execution.details.events,
              mixedRoll: execution.mixedRoll,
            });

```

## src/components/dice/dice3dRollUtils.ts:299

Complete-file SHA-256: `678f09e5ae4fffc7bd0221ac3ce26d96e566696da26bb016873158a7cfe6830e`

```ts
  const physicalValues = resolveFinalPhysicalValues(compatibleDice, events);
  return compatibleDice.map((die) => {
    const stableId = `${id}-box-${die.id}`;
    if (die.sides === "F") {
      const physicalValue = getFatePhysicalFace(physicalValues.get(die.id) ?? die.rawValue);
      return {
        id: stableId,
        sides: 6,
        value: physicalValue,
        rawValue: physicalValue,
        physicalValue,
        profileId: FATE_DF_PROFILE,
        included: die.included,
        discarded: !die.included,
      };
    }

    const physicalValue = clampDieValue(physicalValues.get(die.id) ?? die.rawValue, die.sides);
    return {
      id: stableId,
      sides: die.sides,
      value: physicalValue,
      rawValue: physicalValue,
      physicalValue,
      included: die.included,
      discarded: !die.included,
    };
  });
};
```

