creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    constructor(address initialOwner) {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    /**\n     * @dev Muldiv operation overflow.\n     */\n    error MathOverflowedMulDiv();\n\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            return a / b;\n        }\n\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0 = x * y; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            if (denominator <= prod1) {\n                revert MathOverflowedMulDiv();\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/math/SignedMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n    uint8 private constant ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev The `value` string doesn't fit in the specified `length`.\n     */\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toStringSigned(int256 value) internal pure returns (string memory) {\n        return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        uint256 localValue = value;\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = HEX_DIGITS[localValue & 0xf];\n            localValue >>= 4;\n        }\n        if (localValue != 0) {\n            revert StringsInsufficientHexLength(value, length);\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n     * representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"
      },
      "contracts/CypherDudesRenderer.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {Base64} from \"./ethfs/solady/utils/Base64.sol\";\nimport {File, Content} from \"./ethfs/File.sol\";\nimport {IScriptyBuilderV2, HTMLRequest, HTMLTagType, HTMLTag} from \"./scripty.sol/interfaces/IScriptyBuilderV2.sol\";\n\ninterface ICypherDudes {\n    struct TokenData {\n        uint256 seed;\n        uint256 globalProgression;\n        string secretWord;\n    }\n\n    function tokenData(\n        uint256 tokenId\n    ) external view returns (uint256, uint256, string memory);\n\n    function ownerOf(uint256 tokenId) external view returns (address);\n}\n\ninterface ICypherdudesFileStore {\n    function readFile(\n        string memory filename\n    ) external view returns (string memory content);\n\n    function getFile(\n        string memory filename\n    ) external view returns (File memory file);\n}\n\n/// @title cypherdudesRenderer\n/// @author @felixfelixfelix\ncontract cypherdudesRenderer is Ownable {\n    ICypherDudes public cypherdudesContract;\n    ICypherdudesFileStore public fileStore;\n    address public immutable scriptyStorageAddress;\n    address public immutable scriptyBuilderAddress;\n    string public cypherdudeScript;\n\n    string public baseImageURI;\n    string public website;\n\n    struct Trait {\n        string typeName;\n        string valueName;\n    }\n\n    struct leastSignificantBit {\n        uint256 bit;\n    }\n\n    mapping(uint256 => leastSignificantBit) public lsb;\n\n    constructor(\n        address _scriptyBuilderAddress,\n        address _scriptyStorageAddress,\n        address filestore_,\n        string memory baseImageURI_,\n        string memory website_,\n        string memory cypherdudeScript_\n    ) Ownable(msg.sender) {\n        scriptyStorageAddress = _scriptyStorageAddress;\n        scriptyBuilderAddress = _scriptyBuilderAddress;\n        fileStore = ICypherdudesFileStore(filestore_);\n        baseImageURI = baseImageURI_;\n        website = website_;\n        cypherdudeScript = cypherdudeScript_;\n    }\n\n    function setcypherdudesContract(\n        address _cypherdudesContract\n    ) public onlyOwner {\n        cypherdudesContract = ICypherDudes(_cypherdudesContract);\n    }\n\n    function setFileStoreContract(address _fileStore) public onlyOwner {\n        fileStore = ICypherdudesFileStore(_fileStore);\n    }\n\n    function setBaseImageURI(string calldata uri) public onlyOwner {\n        baseImageURI = uri;\n    }\n\n    function setWebsite(string calldata url) public onlyOwner {\n        website = url;\n    }\n\n    function setCypherdudeScript(string calldata script) public onlyOwner {\n        cypherdudeScript = script;\n    }\n\n    function switchLSB(uint256 _bit, uint256 _tokenId) public {\n        require(\n            msg.sender == cypherdudesContract.ownerOf(_tokenId),\n            \"Not Authorized\"\n        );\n        lsb[_tokenId].bit = _bit;\n    }\n\n    function getMetadataObject(\n        bytes memory animationUrl,\n        uint256 tokenId,\n        uint256 dude,\n        uint256 layer2\n    ) internal view returns (bytes memory) {\n        string memory tid = toString(tokenId);\n        (,,string memory secretWord) = cypherdudesContract.tokenData(tokenId);\n        string memory st = \"\";\n        if (bytes(secretWord).length != 0) {\n            st = \" - \";\n        }\n        return\n            abi.encodePacked(\n                '{\"name\": \"',\n                secretWord,\n                st,\n                \"CYPHERDUDE #\",\n                tid,\n                '\", \"description\":\"Cypherdudes is a generative cryptoart series paying tribute to the Cypherpunk movement, which has been campaigning for the protection of privacy on the internet since the early 90s, and was behind the creation of bitcoin in 2008.'\n                \"This series takes up the graphic universe of a character that I invented and gained some popularity in the crypto art scene : the cryptodude.\"\n                \"A personification of crypto culture, the Cypherdude performs actions that visually translate the expressions and behaviors specific to this ecosystem.\"\n                \"Each work in the series is unique and generated from an algorithm hosted directly on the blockchain. The parameters composing each work are selected from a wide range of elements created individually by myself and combined in a seeded random way. Each seed is determined by the blockchain on mint.\"\n                \"The work and the Message.\"\n                \"Each owner of a work from the series has access to a hidden feature : the ability to inscribe an encrypted message in the work itself. The encryption key is decided by the owner on every inscription. This message can then only be decoded by a recipient knowing the key. This way, the work becomes a veritable tool at the service of its owner, who, by using it, makes it evolve visually using a simple steganographic technique.\"\n                'The Cypherdudes thus becomes the visual witness to the presence of a message, and its digital security vault.\",',\n                '\"external_url\": \"',\n                website,\n                '\", \"image\": \"',\n                baseImageURI,\n                tid,\n                '.svg\"',\n                ', \"animation_url\": \"',\n                animationUrl,\n                '\", \"attributes\": [',\n                getJSONAttributes(tokenId, dude, layer2),\n                \"]}\"\n            );\n    }\n\n    function getTokenConstantsScript(\n        uint256 tokenId,\n        uint256 dude\n    ) internal view returns (bytes memory) {\n        (uint256 seed,,string memory secretWord) = cypherdudesContract.tokenData(tokenId);\n        seed >>= 8;\n        uint256 layer1 = seed % 11;\n        seed >>= 8;\n        seed >>= 8;\n        uint256 layer3 = dude == 2 || dude == 3 || dude == 8 ? seed % 8 : 8;\n        seed >>= 8;\n        uint256 bitEnvironment = seed % 9;\n        seed >>= 8;\n        uint256 bitPalette = seed % 12;\n        return\n            abi.encodePacked(\n                \"let tokenId = \",\n                toString(tokenId),\n                \";\",\n                \"let layer1 = \",\n                toString(layer1),\n                \";\",\n                \"let layer3 = \",\n                toString(layer3),\n                \";\",\n                \"let secretWord = '\",\n                secretWord,\n                \"';\",\n                \"let bitEnvironment = \",\n                toString(bitEnvironment),\n                \";\",\n                \"let bitPalette = \",\n                toString(bitPalette),\n                \";\"\n            );\n    }\n\n    function getCardConstantsScript(\n        uint256 tokenId\n    ) internal view returns (bytes memory) {\n        (,uint256 globalProgression,) = cypherdudesContract.tokenData(tokenId);\n        \n        return\n            abi.encodePacked(\n                \"let gridSize = \",\n                toString(globalProgression < 97 ? 32 : globalProgression < 193 ? 64 : 128),\n                \";\",\n                \"let gridResolution = \",\n                toString(2-(((globalProgression - 1) / 32) % 3)),\n                \";\",\n                \"let levelProgression = \",\n                toString(globalProgression % 32 == 0 ? 1 : 32 - (globalProgression % 32)),\n                \";\",\n                \"let ownerAddy = '\",\n                Strings.toHexString(cypherdudesContract.ownerOf(tokenId)),\n                \"';\",\n                \"let message = '\",\n                fileStore.readFile(\n                    string.concat(\"cypherCard_\", toString(tokenId))\n                ),\n                \"';\",\n                \"let lsb = \",\n                toString(lsb[tokenId].bit),\n                \";\"\n            );\n    }\n\n    function tokenURI(uint256 tokenId) external view returns (string memory) {\n        HTMLTag[] memory bodyTags = new HTMLTag[](8);\n        (uint256 seed, , ) = cypherdudesContract.tokenData(tokenId);\n        uint256 dude = seed % 20;\n        seed >>= 8;\n        seed >>= 8;\n        uint256 layer2 = seed % 2 > 0 ? seed % 11 : 11;\n\n        HTMLTag[] memory headTags = new HTMLTag[](1);\n        headTags[0].tagOpen = \"<style>\";\n        headTags[0]\n            .tagContent = \"html{overflow:hidden}body{margin:0;padding:0}\";\n        headTags[0].tagClose = \"</style>\";\n\n        bodyTags[0].name = lsb[tokenId].bit > 0\n            ? dudeFiles[dude + 20]\n            : dudeFiles[dude];\n        bodyTags[0].tagType = HTMLTagType.scriptGZIPBase64DataURI;\n        bodyTags[0].contractAddress = scriptyStorageAddress;\n\n        bodyTags[1].name = \"CypherDudesLayer1\";\n        bodyTags[1].tagType = HTMLTagType.script;\n        bodyTags[1].contractAddress = scriptyStorageAddress;\n\n        bodyTags[2].name = \"CypherDudesFonts\";\n        bodyTags[2].tagType = HTMLTagType.script;\n        bodyTags[2].contractAddress = scriptyStorageAddress;\n\n        bodyTags[3].name = layers_2[layer2];\n        bodyTags[3].tagType = HTMLTagType.script;\n        bodyTags[3].contractAddress = scriptyStorageAddress;\n\n        bodyTags[4].name = cypherdudeScript;\n        bodyTags[4].tagType = HTMLTagType.scriptGZIPBase64DataURI;\n        bodyTags[4].contractAddress = scriptyStorageAddress;\n\n        bodyTags[5].tagContent = getTokenConstantsScript(tokenId, dude);\n        bodyTags[5].tagType = HTMLTagType.script;\n\n        bodyTags[6].tagContent = getCardConstantsScript(tokenId);\n        bodyTags[6].tagType = HTMLTagType.script;\n\n        bodyTags[7].name = \"gunzipScripts-0.0.1\";\n        bodyTags[7].tagType = HTMLTagType.script;\n        bodyTags[7].contractAddress = scriptyStorageAddress;\n\n        HTMLRequest memory htmlRequest;\n        htmlRequest.headTags = headTags;\n        htmlRequest.bodyTags = bodyTags;\n\n        bytes memory base64EncodedHTMLDataURI = IScriptyBuilderV2(\n            scriptyBuilderAddress\n        ).getEncodedHTML(htmlRequest);\n\n        return\n            string(\n                abi.encodePacked(\n                    \"data:application/json;base64,\",\n                    Base64.encode(\n                        getMetadataObject(\n                            base64EncodedHTMLDataURI,\n                            tokenId,\n                            dude,\n                            layer2\n                        )\n                    )\n                )\n            );\n    }\n\n    function getJSONAttributes(\n        uint256 tokenId,\n        uint256 dude,\n        uint256 layer2\n    ) internal view returns (string memory) {\n        (uint256 seed,uint256 globalProgression,string memory secretWord) = cypherdudesContract.tokenData(tokenId);\n        string memory _lsb = lsb[tokenId].bit > 0 ? \"01011000 01011000\":\"01011000 01011001\";\n        seed >>= 8;\n        uint256 layer1 = seed % 11;\n        seed >>= 8;\n        seed >>= 8;\n        uint256 layer3 = dude == 2 || dude == 3 || dude == 8 ? seed % 8 : 8;\n        seed >>= 8;\n        uint256 bitEnvironment = seed % 9;\n        seed >>= 8;\n        uint256 bitPalette = seed % 12;\n\n        return\n            string(\n                abi.encodePacked(\n                    '{\"trait_type\":\"Grid Size\",\"value\" :\"',\n                    toString(globalProgression < 97 ? 32 : globalProgression < 193 ? 64 : 128),\n                    '\"},',\n                    '{\"trait_type\":\"Grid Resolution\",\"value\" :\"',\n                    grid_Resolution[((globalProgression - 1) / 32) % 3],\n                    '\"},',\n                    '{\"trait_type\":\"Level Progression\",\"value\" :\"',\n                    toString(globalProgression % 32 == 0 ? 1 : 32 - (globalProgression % 32)),\n                    '\"},',\n                    '{\"trait_type\":\"Action\",\"value\" :\"',\n                    dudeActions[dude],\n                    '\"},',\n                    '{\"trait_type\":\"Layer 1\",\"value\" :\"',\n                    layers_1[layer1],\n                    '\"},',\n                    '{\"trait_type\":\"Layer 2\",\"value\" :\"',\n                    layers_2[layer2],\n                    '\"},',\n                    '{\"trait_type\":\"Layer 3\",\"value\" :\"',\n                    layers_3[layer3],\n                    '\"},',\n                    '{\"trait_type\":\"Secret Word\",\"value\" :\"',\n                    secretWord,\n                    '\"},',\n                    '{\"trait_type\":\"Bit Environment\",\"value\" :\"',\n                    bit_Environment[bitEnvironment],\n                    '\"},',\n                    '{\"trait_type\":\"Bit Palette\",\"value\" :\"',\n                    bit_Palette[bitPalette],\n                    '\"},',\n                    '{\"trait_type\":\"Least Significant Bit\",\"value\" :\"',\n                    _lsb,\n                    '\"}'\n                )\n            );\n    }\n\n    function toString(uint256 value) internal pure returns (string memory) {\n        // Inspired by OraclizeAPI's implementation - MIT licence\n        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n        if (value == 0) {\n            return \"0\";\n        }\n        uint256 temp = value;\n        uint256 digits;\n        while (temp != 0) {\n            digits++;\n            temp /= 10;\n        }\n        bytes memory buffer = new bytes(digits);\n        while (value != 0) {\n            digits -= 1;\n            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n            value /= 10;\n        }\n        return string(buffer);\n    }\n\n    string[] internal grid_Resolution = [\"High\", \"Medium\", \"Low\"];\n\n    string[] internal dudeActions = [\n        \"Backdoor Dude\",\n        \"Bitruvian Dude\",\n        \"Building Dude\",\n        \"Dude Scrolling\", //\n        \"Fake Dude\",\n        \"Going to Zero Dude\",\n        \"Hashing Dude\",\n        \"Longterm Dude\",\n        \"Over Minting Dude\", //\n        \"Mooning Dude\",\n        \"Pumping Dude\",\n        \"Rabbit Hole Dude\",\n        \"Dude Regulatoors\",\n        \"Eyes on the Charts\",\n        \"Rugged Dude\",\n        \"Scammed Dude\",\n        \"Dude Walking By\",\n        \"Transfer Dude\",\n        \"Follow the Dude\",\n        \"Secret Dude\"\n    ];\n    string[] internal dudeFiles = [\n        \"Backdoor_Dude\",\n        \"Bitruvian_Dude\",\n        \"Building_Dude\",\n        \"Dude_Scrolling\",\n        \"Fake_Dude\",\n        \"Going_To_Zero_Dude\",\n        \"Hashing_Dude\",\n        \"Longterm_Dude\",\n        \"Over_Minting_Dude\",\n        \"Mooning_Dude\",\n        \"Pumping_Dude\",\n        \"Rabbit_Hole_Dude\",\n        \"Dude_Regulatoors\",\n        \"Eyes_On_The_Chart\",\n        \"Rugged_Dude\",\n        \"Scammed_Dude\",\n        \"Dude_Walking_By\",\n        \"Transfer_Dude\",\n        \"Follow_The_Dude\",\n        \"Secret_Dude\",\n        \"Backdoor_Dude_w\",\n        \"Bitruvian_Dude_w\",\n        \"Building_Dude_w\",\n        \"Dude_Scrolling_w\",\n        \"Fake_Dude_w\",\n        \"Going_To_Zero_Dude_w\",\n        \"Hashing_Dude_w\",\n        \"Longterm_Dude_w\",\n        \"Over_Minting_Dude_w\",\n        \"Mooning_Dude_w\",\n        \"Pumping_Dude_w\",\n        \"Rabbit_Hole_Dude_w\",\n        \"Dude_Regulatoors_w\",\n        \"Eyes_On_The_Chart_w\",\n        \"Rugged_Dude_w\",\n        \"Scammed_Dude_w\",\n        \"Dude_Walking_By_w\",\n        \"Transfer_Dude_w\",\n        \"Follow_The_Dude_w\",\n        \"Secret_Dude_w\"\n    ];\n\n    string[] internal layers_1 = [\n        \"Rare_Pepes\",\n        \"CryptoPunks\",\n        \"Coins_Flow\",\n        \"Chart\",\n        \"Moma_Pixels\",\n        \"Pixelmon_Reveal\",\n        \"Crypto_Space\",\n        \"Crypto_Voxel\",\n        \"Circuit_Board\",\n        \"Uniswap\",\n        \"Mooncats\"\n    ];\n\n    string[] internal layers_2 = [\n        \"Gas_Wars\",\n        \"PacMan\",\n        \"Hardware_Wallet\",\n        \"Feels_Good_Man\",\n        \"Game_Over\",\n        \"M3t4m4Sk\",\n        \"Promising_Collab\",\n        \"MaxPain\",\n        \"Green_Chart\",\n        \"Press_That_Mint_Button\",\n        \"Trash_Art\",\n        \"none\"\n    ];\n\n    string[] internal layers_3 = [\n        \"Rare_Pepes\",\n        \"Chart\",\n        \"Moma_Pixels\",\n        \"Crypto_Space\",\n        \"Crypto_Voxel\",\n        \"Circuit_Board\",\n        \"Uniswap\",\n        \"MaxPain\",\n        \"none\"\n    ];\n\n    string[] internal bit_Environment = [\n        \"32 bits\",\n        \"32 bits animated\",\n        \"64 bits\",\n        \"64 bits animated\",\n        \"Who dis ?\",\n        \"Bitcoin genesis block\",\n        \"Data tunnel\",\n        \"Meta Script\",\n        \"The Cypherpunk\"\n    ];\n\n    string[] internal bit_Palette = [\n        \"green, white, black\",\n        \"green, black, white\",\n        \"black, green, white\",\n        \"black, green, green\",\n        \"black, white, white\",\n        \"black, white, green\",\n        \"black, fuschia, aqua\",\n        \"black, white, green\",\n        \"blue, red, black\",\n        \"black, red, yellow\",\n        \"blue, yellow, fuschia\",\n        \"black, white, white\"\n    ];\n}\n"
      },
      "contracts/ethfs/File.sol": {
        "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.20;\n\nstruct Content {\n    bytes32 checksum;\n    address pointer;\n}\n\nstruct File {\n    uint256 size; // content length in bytes, max 24k\n    Content[] contents;\n}\n\nfunction read(File memory file) view returns (string memory contents) {\n    Content[] memory chunks = file.contents;\n\n    // Adapted from https://gist.github.com/xtremetom/20411eb126aaf35f98c8a8ffa00123cd\n    assembly {\n        let len := mload(chunks)\n        let totalSize := 0x20\n        contents := mload(0x40)\n        let size\n        let chunk\n        let pointer\n\n        // loop through all pointer addresses\n        // - get content\n        // - get address\n        // - get data size\n        // - get code and add to contents\n        // - update total size\n\n        for { let i := 0 } lt(i, len) { i := add(i, 1) } {\n            chunk := mload(add(chunks, add(0x20, mul(i, 0x20))))\n            pointer := mload(add(chunk, 0x20))\n\n            size := sub(extcodesize(pointer), 1)\n            extcodecopy(pointer, add(contents, totalSize), 1, size)\n            totalSize := add(totalSize, size)\n        }\n\n        // update contents size\n        mstore(contents, sub(totalSize, 0x20))\n        // store contents\n        mstore(0x40, add(contents, and(add(totalSize, 0x1f), not(0x1f))))\n    }\n}\n\nusing {read} for File global;"
      },
      "contracts/ethfs/solady/utils/Base64.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Library to encode strings in Base64.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol)\n/// @author Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos - <brecht@loopring.org>.\nlibrary Base64 {\n    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.\n    /// See: https://datatracker.ietf.org/doc/html/rfc4648\n    /// @param fileSafe  Whether to replace '+' with '-' and '/' with '_'.\n    /// @param noPadding Whether to strip away the padding.\n    function encode(bytes memory data, bool fileSafe, bool noPadding)\n        internal\n        pure\n        returns (string memory result)\n    {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let dataLength := mload(data)\n\n            if dataLength {\n                // Multiply by 4/3 rounded up.\n                // The `shl(2, ...)` is equivalent to multiplying by 4.\n                let encodedLength := shl(2, div(add(dataLength, 2), 3))\n\n                // Set `result` to point to the start of the free memory.\n                result := mload(0x40)\n\n                // Store the table into the scratch space.\n                // Offsetted by -1 byte so that the `mload` will load the character.\n                // We will rewrite the free memory pointer at `0x40` later with\n                // the allocated size.\n                // The magic constant 0x0230 will translate \"-_\" + \"+/\".\n                mstore(0x1f, \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef\")\n                mstore(0x3f, sub(\"ghijklmnopqrstuvwxyz0123456789-_\", mul(iszero(fileSafe), 0x0230)))\n\n                // Skip the first slot, which stores the length.\n                let ptr := add(result, 0x20)\n                let end := add(ptr, encodedLength)\n\n                // Run over the input, 3 bytes at a time.\n                for {} 1 {} {\n                    data := add(data, 3) // Advance 3 bytes.\n                    let input := mload(data)\n\n                    // Write 4 bytes. Optimized for fewer stack operations.\n                    mstore8(0, mload(and(shr(18, input), 0x3F)))\n                    mstore8(1, mload(and(shr(12, input), 0x3F)))\n                    mstore8(2, mload(and(shr(6, input), 0x3F)))\n                    mstore8(3, mload(and(input, 0x3F)))\n                    mstore(ptr, mload(0x00))\n\n                    ptr := add(ptr, 4) // Advance 4 bytes.\n                    if iszero(lt(ptr, end)) { break }\n                }\n                mstore(0x40, add(end, 0x20)) // Allocate the memory.\n                // Equivalent to `o = [0, 2, 1][dataLength % 3]`.\n                let o := div(2, mod(dataLength, 3))\n                // Offset `ptr` and pad with '='. We can simply write over the end.\n                mstore(sub(ptr, o), shl(240, 0x3d3d))\n                // Set `o` to zero if there is padding.\n                o := mul(iszero(iszero(noPadding)), o)\n                mstore(sub(ptr, o), 0) // Zeroize the slot after the string.\n                mstore(result, sub(encodedLength, o)) // Store the length.\n            }\n        }\n    }\n\n    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.\n    /// Equivalent to `encode(data, false, false)`.\n    function encode(bytes memory data) internal pure returns (string memory result) {\n        result = encode(data, false, false);\n    }\n\n    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.\n    /// Equivalent to `encode(data, fileSafe, false)`.\n    function encode(bytes memory data, bool fileSafe)\n        internal\n        pure\n        returns (string memory result)\n    {\n        result = encode(data, fileSafe, false);\n    }\n\n    /// @dev Decodes base64 encoded `data`.\n    ///\n    /// Supports:\n    /// - RFC 4648 (both standard and file-safe mode).\n    /// - RFC 3501 (63: ',').\n    ///\n    /// Does not support:\n    /// - Line breaks.\n    ///\n    /// Note: For performance reasons,\n    /// this function will NOT revert on invalid `data` inputs.\n    /// Outputs for invalid inputs will simply be undefined behaviour.\n    /// It is the user's responsibility to ensure that the `data`\n    /// is a valid base64 encoded string.\n    function decode(string memory data) internal pure returns (bytes memory result) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let dataLength := mload(data)\n\n            if dataLength {\n                let decodedLength := mul(shr(2, dataLength), 3)\n\n                for {} 1 {} {\n                    // If padded.\n                    if iszero(and(dataLength, 3)) {\n                        let t := xor(mload(add(data, dataLength)), 0x3d3d)\n                        // forgefmt: disable-next-item\n                        decodedLength := sub(\n                            decodedLength,\n                            add(iszero(byte(30, t)), iszero(byte(31, t)))\n                        )\n                        break\n                    }\n                    // If non-padded.\n                    decodedLength := add(decodedLength, sub(and(dataLength, 3), 1))\n                    break\n                }\n                result := mload(0x40)\n\n                // Write the length of the bytes.\n                mstore(result, decodedLength)\n\n                // Skip the first slot, which stores the length.\n                let ptr := add(result, 0x20)\n                let end := add(ptr, decodedLength)\n\n                // Load the table into the scratch space.\n                // Constants are optimized for smaller bytecode with zero gas overhead.\n                // `m` also doubles as the mask of the upper 6 bits.\n                let m := 0xfc000000fc00686c7074787c8084888c9094989ca0a4a8acb0b4b8bcc0c4c8cc\n                mstore(0x5b, m)\n                mstore(0x3b, 0x04080c1014181c2024282c3034383c4044484c5054585c6064)\n                mstore(0x1a, 0xf8fcf800fcd0d4d8dce0e4e8ecf0f4)\n\n                for {} 1 {} {\n                    // Read 4 bytes.\n                    data := add(data, 4)\n                    let input := mload(data)\n\n                    // Write 3 bytes.\n                    // forgefmt: disable-next-item\n                    mstore(ptr, or(\n                        and(m, mload(byte(28, input))),\n                        shr(6, or(\n                            and(m, mload(byte(29, input))),\n                            shr(6, or(\n                                and(m, mload(byte(30, input))),\n                                shr(6, mload(byte(31, input)))\n                            ))\n                        ))\n                    ))\n                    ptr := add(ptr, 3)\n                    if iszero(lt(ptr, end)) { break }\n                }\n                mstore(0x40, add(end, 0x20)) // Allocate the memory.\n                mstore(end, 0) // Zeroize the slot after the bytes.\n                mstore(0x60, 0) // Restore the zero slot.\n            }\n        }\n    }\n}"
      },
      "contracts/scripty.sol/core/ScriptyCore.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n///////////////////////////////////////////////////////////\n// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //\n// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //\n// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //\n// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //\n// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //\n// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //\n///////////////////////////////////////////////////////////\n//░░░░░░░░░░░░░░░░░░░░░░    CORE    ░░░░░░░░░░░░░░░░░░░░░//\n///////////////////////////////////////////////////////////\n\nimport {HTMLRequest, HTMLTagType, HTMLTag} from \"./ScriptyStructs.sol\";\nimport {DynamicBuffer} from \"./../utils/DynamicBuffer.sol\";\nimport {IScriptyContractStorage} from \"./../interfaces/IScriptyContractStorage.sol\";\n\ncontract ScriptyCore {\n    using DynamicBuffer for bytes;\n\n    // =============================================================\n    //                        TAG CONSTANTS\n    // =============================================================\n\n    // data:text/html;base64,\n    // raw\n    // 22 bytes\n    bytes public constant DATA_HTML_BASE64_URI_RAW = \"data:text/html;base64,\";\n    // url encoded\n    // 21 bytes\n    bytes public constant DATA_HTML_URL_SAFE = \"data%3Atext%2Fhtml%2C\";\n\n    // <html>,\n    // raw\n    // 6 bytes\n    bytes public constant HTML_OPEN_RAW = \"<html>\";\n    // url encoded\n    // 10 bytes\n    bytes public constant HTML_OPEN_URL_SAFE = \"%3Chtml%3E\";\n\n    // <head>,\n    // raw\n    // 6 bytes\n    bytes public constant HEAD_OPEN_RAW = \"<head>\";\n    // url encoded\n    // 10 bytes\n    bytes public constant HEAD_OPEN_URL_SAFE = \"%3Chead%3E\";\n\n    // </head>,\n    // raw\n    // 7 bytes\n    bytes public constant HEAD_CLOSE_RAW = \"</head>\";\n    // url encoded\n    // 13 bytes\n    bytes public constant HEAD_CLOSE_URL_SAFE = \"%3C%2Fhead%3E\";\n\n    // <body>\n    // 6 bytes\n    bytes public constant BODY_OPEN_RAW = \"<body>\";\n    // url encoded\n    // 10 bytes\n    bytes public constant BODY_OPEN_URL_SAFE = \"%3Cbody%3E\";\n\n    // </body></html>\n    // 14 bytes\n    bytes public constant HTML_BODY_CLOSED_RAW = \"</body></html>\";\n    // 26 bytes\n    bytes public constant HTML_BODY_CLOSED_URL_SAFE =\n        \"%3C%2Fbody%3E%3C%2Fhtml%3E\";\n\n    // [RAW]\n    // HTML_OPEN + HEAD_OPEN + HEAD_CLOSE + BODY_OPEN + HTML_BODY_CLOSED\n    uint256 public constant URLS_RAW_BYTES = 39;\n\n    // [URL_SAFE]\n    // DATA_HTML_URL_SAFE + HTML_OPEN + HEAD_OPEN + HEAD_CLOSE + BODY_OPEN + HTML_BODY_CLOSED\n    uint256 public constant URLS_SAFE_BYTES = 90;\n\n    // [RAW]\n    // HTML_OPEN + HTML_CLOSE\n    uint256 public constant HTML_RAW_BYTES = 13;\n\n    // [RAW]\n    // HEAD_OPEN + HEAD_CLOSE\n    uint256 public constant HEAD_RAW_BYTES = 13;\n\n    // [RAW]\n    // BODY_OPEN + BODY_CLOSE\n    uint256 public constant BODY_RAW_BYTES = 13;\n\n    // All raw\n    // HTML_RAW_BYTES + HEAD_RAW_BYTES + BODY_RAW_BYTES\n    uint256 public constant RAW_BYTES = 39;\n\n    // [URL_SAFE]\n    // HTML_OPEN + HTML_CLOSE\n    uint256 public constant HTML_URL_SAFE_BYTES = 23;\n\n    // [URL_SAFE]\n    // HEAD_OPEN + HEAD_CLOSE\n    uint256 public constant HEAD_URL_SAFE_BYTES = 23;\n\n    // [URL_SAFE]\n    // BODY_OPEN + BODY_CLOSE\n    uint256 public constant BODY_SAFE_BYTES = 23;\n\n    // All url safe\n    // HTML_URL_SAFE_BYTES + HEAD_URL_SAFE_BYTES + BODY_URL_SAFE_BYTES\n    // %3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E\n    uint256 public constant URL_SAFE_BYTES = 69;\n\n    // data:text/html;base64,\n    uint256 public constant HTML_BASE64_DATA_URI_BYTES = 22;\n\n    // =============================================================\n    //                    TAG OPEN CLOSE TEMPLATES\n    // =============================================================\n\n    /**\n     * @notice Grab tag open and close depending on tag type\n     * @dev\n     *      tagType: 0/HTMLTagType.useTagOpenAndClose or any other:\n     *          [tagOpen][CONTENT][tagClose]\n     *\n     *      tagType: 1/HTMLTagType.script:\n     *          <script>[SCRIPT]</script>\n     *\n     *      tagType: 2/HTMLTagType.scriptBase64DataURI:\n     *          <script src=\"data:text/javascript;base64,[SCRIPT]\"></script>\n     *\n     *      tagType: 3/HTMLTagType.scriptGZIPBase64DataURI:\n     *          <script type=\"text/javascript+gzip\" src=\"data:text/javascript;base64,[SCRIPT]\"></script>\n     *\n     *      tagType: 4/HTMLTagType.scriptPNGBase64DataURI\n     *          <script type=\"text/javascript+png\" name=\"[NAME]\" src=\"data:text/javascript;base64,[SCRIPT]\"></script>\n     *\n     *      [IMPORTANT NOTE]: The tags `text/javascript+gzip` and `text/javascript+png` are used to identify scripts\n     *      during decompression\n     *\n     * @param htmlTag - HTMLTag data for code\n     * @return (tagOpen, tagClose) - Tag open and close as a tuple\n     */\n    function tagOpenCloseForHTMLTag(\n        HTMLTag memory htmlTag\n    ) public pure returns (bytes memory, bytes memory) {\n        if (htmlTag.tagType == HTMLTagType.script) {\n            return (\"<script>\", \"</script>\");\n        } else if (htmlTag.tagType == HTMLTagType.scriptBase64DataURI) {\n            return ('<script src=\"data:text/javascript;base64,', '\"></script>');\n        } else if (htmlTag.tagType == HTMLTagType.scriptGZIPBase64DataURI) {\n            return (\n                '<script type=\"text/javascript+gzip\" src=\"data:text/javascript;base64,',\n                '\"></script>'\n            );\n        } else if (htmlTag.tagType == HTMLTagType.scriptPNGBase64DataURI) {\n            return (\n                '<script type=\"text/javascript+png\" src=\"data:text/javascript;base64,',\n                '\"></script>'\n            );\n        }\n        return (htmlTag.tagOpen, htmlTag.tagClose);\n    }\n\n    /**\n     * @notice Grab URL safe tag open and close depending on tag type\n     * @dev\n     *      tagType: 0/HTMLTagType.useTagOpenAndClose or any other:\n     *          [tagOpen][scriptContent or scriptFromContract][tagClose]\n     *\n     *      tagType: 1/HTMLTagType.script:\n     *      tagType: 2/HTMLTagType.scriptBase64DataURI:\n     *          <script src=\"data:text/javascript;base64,[SCRIPT]\"></script>\n     *\n     *      tagType: 3/HTMLTagType.scriptGZIPBase64DataURI:\n     *          <script type=\"text/javascript+gzip\" src=\"data:text/javascript;base64,[SCRIPT]\"></script>\n     *\n     *      tagType: 4/HTMLTagType.scriptPNGBase64DataURI\n     *          <script type=\"text/javascript+png\" name=\"[NAME]\" src=\"data:text/javascript;base64,[SCRIPT]\"></script>\n     *\n     *      [IMPORTANT NOTE]: The tags `text/javascript+gzip` and `text/javascript+png` are used to identify scripts\n     *      during decompression\n     *\n     * @param htmlTag - HTMLTag data for code\n     * @return (tagOpen, tagClose) - Tag open and close as a tuple\n     */\n    function tagOpenCloseForHTMLTagURLSafe(\n        HTMLTag memory htmlTag\n    ) public pure returns (bytes memory, bytes memory) {\n        if (\n            htmlTag.tagType == HTMLTagType.script ||\n            htmlTag.tagType == HTMLTagType.scriptBase64DataURI\n        ) {\n            // <script src=\"data:text/javascript;base64,\n            // \"></script>\n            return (\n                \"%253Cscript%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C\",\n                \"%2522%253E%253C%252Fscript%253E\"\n            );\n        } else if (htmlTag.tagType == HTMLTagType.scriptGZIPBase64DataURI) {\n            // <script type=\"text/javascript+gzip\" src=\"data:text/javascript;base64,\n            // \"></script>\n            return (\n                \"%253Cscript%2520type%253D%2522text%252Fjavascript%252Bgzip%2522%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C\",\n                \"%2522%253E%253C%252Fscript%253E\"\n            );\n        } else if (htmlTag.tagType == HTMLTagType.scriptPNGBase64DataURI) {\n            // <script type=\"text/javascript+png\" src=\"data:text/javascript;base64,\n            // \"></script>\n            return (\n                \"%253Cscript%2520type%253D%2522text%252Fjavascript%252Bpng%2522%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C\",\n                \"%2522%253E%253C%252Fscript%253E\"\n            );\n        }\n        return (htmlTag.tagOpen, htmlTag.tagClose);\n    }\n\n    // =============================================================\n    //                      TAG CONTENT FETCHER\n    // =============================================================\n\n    /**\n     * @notice Grabs requested tag content from storage\n     * @dev\n     *      If given HTMLTag contains non empty contractAddress\n     *      this method will fetch the content from given storage\n     *      contract. Otherwise, it will return the tagContent\n     *      from the given htmlTag.\n     *\n     * @param htmlTag - HTMLTag\n     */\n    function fetchTagContent(\n        HTMLTag memory htmlTag\n    ) public view returns (bytes memory) {\n        if (htmlTag.contractAddress != address(0)) {\n            return\n                IScriptyContractStorage(htmlTag.contractAddress).getContent(\n                    htmlTag.name,\n                    htmlTag.contractData\n                );\n        }\n        return htmlTag.tagContent;\n    }\n\n    // =============================================================\n    //                        SIZE OPERATIONS\n    // =============================================================\n\n    /**\n     * @notice Calculate the buffer size post base64 encoding\n     * @param value - Starting buffer size\n     * @return Final buffer size as uint256\n     */\n    function sizeForBase64Encoding(\n        uint256 value\n    ) public pure returns (uint256) {\n        unchecked {\n            return 4 * ((value + 2) / 3);\n        }\n    }\n\n    /**\n     * @notice Adds the required tag open/close and calculates buffer size of tags\n     * @dev Effectively multiple functions bundled into one as this saves gas\n     * @param htmlTags - Array of HTMLTag\n     * @param isURLSafe - Bool to handle tag content/open/close encoding\n     * @return Total buffersize of updated HTMLTags\n     */\n    function _enrichHTMLTags(\n        HTMLTag[] memory htmlTags,\n        bool isURLSafe\n    ) internal view returns (uint256) {\n        if (htmlTags.length == 0) {\n            return 0;\n        }\n\n        bytes memory tagOpen;\n        bytes memory tagClose;\n        bytes memory tagContent;\n\n        uint256 totalSize;\n        uint256 length = htmlTags.length;\n        uint256 i;\n\n        unchecked {\n            do {\n                tagContent = fetchTagContent(htmlTags[i]);\n                htmlTags[i].tagContent = tagContent;\n\n                if (isURLSafe && htmlTags[i].tagType == HTMLTagType.script) {\n                    totalSize += sizeForBase64Encoding(tagContent.length);\n                } else {\n                    totalSize += tagContent.length;\n                }\n\n                if (isURLSafe) {\n                    (tagOpen, tagClose) = tagOpenCloseForHTMLTagURLSafe(\n                        htmlTags[i]\n                    );\n                } else {\n                    (tagOpen, tagClose) = tagOpenCloseForHTMLTag(htmlTags[i]);\n                }\n\n                htmlTags[i].tagOpen = tagOpen;\n                htmlTags[i].tagClose = tagClose;\n\n                totalSize += tagOpen.length;\n                totalSize += tagClose.length;\n            } while (++i < length);\n        }\n        return totalSize;\n    }\n\n    // =============================================================\n    //                     HTML CONCATENATION\n    // =============================================================\n\n    /**\n     * @notice Append tags to the html buffer for tags\n     * @param htmlFile - bytes buffer\n     * @param htmlTags - Tags being added to buffer\n     * @param base64EncodeTagContent - Bool to handle tag content encoding\n     */\n    function _appendHTMLTags(\n        bytes memory htmlFile,\n        HTMLTag[] memory htmlTags,\n        bool base64EncodeTagContent\n    ) internal pure {\n        uint256 i;\n        unchecked {\n            do {\n                _appendHTMLTag(htmlFile, htmlTags[i], base64EncodeTagContent);\n            } while (++i < htmlTags.length);\n        }\n    }\n\n    /**\n     * @notice Append tag to the html buffer\n     * @param htmlFile - bytes buffer\n     * @param htmlTag - Request being added to buffer\n     * @param base64EncodeTagContent - Bool to handle tag content encoding\n     */\n    function _appendHTMLTag(\n        bytes memory htmlFile,\n        HTMLTag memory htmlTag,\n        bool base64EncodeTagContent\n    ) internal pure {\n        htmlFile.appendSafe(htmlTag.tagOpen);\n        if (base64EncodeTagContent) {\n            htmlFile.appendSafeBase64(htmlTag.tagContent, false, false);\n        } else {\n            htmlFile.appendSafe(htmlTag.tagContent);\n        }\n        htmlFile.appendSafe(htmlTag.tagClose);\n    }\n}"
      },
      "contracts/scripty.sol/core/ScriptyStructs.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n///////////////////////////////////////////////////////////\n// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //\n// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //\n// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //\n// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //\n// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //\n// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //\n///////////////////////////////////////////////////////////\n//░░░░░░░░░░░░░░░░░░░    REQUESTS    ░░░░░░░░░░░░░░░░░░░░//\n///////////////////////////////////////////////////////////\n\nstruct HTMLRequest {\n    HTMLTag[] headTags;\n    HTMLTag[] bodyTags;\n}\n\nenum HTMLTagType {\n    useTagOpenAndClose,\n    script,\n    scriptBase64DataURI,\n    scriptGZIPBase64DataURI,\n    scriptPNGBase64DataURI\n}\n\nstruct HTMLTag {\n    string name;\n    address contractAddress;\n    bytes contractData;\n    HTMLTagType tagType;\n    bytes tagOpen;\n    bytes tagClose;\n    bytes tagContent;\n}"
      },
      "contracts/scripty.sol/interfaces/IScriptyBuilderV2.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n///////////////////////////////////////////////////////////\n// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //\n// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //\n// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //\n// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //\n// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //\n// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //\n///////////////////////////////////////////////////////////\n\n/**\n  @title A generic HTML builder that fetches and assembles given JS requests.\n  @author @0xthedude\n  @author @xtremetom\n\n  Special thanks to @cxkoda and @frolic\n*/\n\nimport \"./IScriptyHTML.sol\";\nimport \"./IScriptyHTMLURLSafe.sol\";\n\ninterface IScriptyBuilderV2 is IScriptyHTML, IScriptyHTMLURLSafe {}"
      },
      "contracts/scripty.sol/interfaces/IScriptyContractStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\n///////////////////////////////////////////////////////////\n// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //\n// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //\n// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //\n// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //\n// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //\n// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //\n///////////////////////////////////////////////////////////\n\ninterface IScriptyContractStorage {\n    // =============================================================\n    //                            GETTERS\n    // =============================================================\n\n    /**\n     * @notice Get the full content\n     * @param name - Name given to the script. Eg: threejs.min.js_r148\n     * @param data - Arbitrary data to be passed to storage\n     * @return script - Full script from merged chunks\n     */\n    function getContent(string calldata name, bytes memory data)\n        external\n        view\n        returns (bytes memory script);\n}"
      },
      "contracts/scripty.sol/interfaces/IScriptyHTML.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\n///////////////////////////////////////////////////////////\n// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //\n// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //\n// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //\n// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //\n// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //\n// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //\n///////////////////////////////////////////////////////////\n\nimport {HTMLRequest, HTMLTagType, HTMLTag} from \"./../core/ScriptyCore.sol\";\n\ninterface IScriptyHTML {\n    // =============================================================\n    //                      RAW HTML GETTERS\n    // =============================================================\n\n    /**\n     * @notice  Get HTML with requested head tags and body tags\n     * @dev Your HTML is returned in the following format:\n     *      <html>\n     *          <head>\n     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]\n     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]\n     *              ...\n     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]\n     *          </head>\n     *          <body>\n     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]\n     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]\n     *              ...\n     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]\n     *          </body>\n     *      </html>\n     * @param htmlRequest - HTMLRequest\n     * @return Full HTML with head and body tags\n     */\n    function getHTML(\n        HTMLRequest memory htmlRequest\n    ) external view returns (bytes memory);\n\n    // =============================================================\n    //                      ENCODED HTML GETTERS\n    // =============================================================\n\n    /**\n     * @notice Get {getHTML} and base64 encode it\n     * @param htmlRequest - HTMLRequest\n     * @return Full HTML with head and script tags, base64 encoded\n     */\n    function getEncodedHTML(\n        HTMLRequest memory htmlRequest\n    ) external view returns (bytes memory);\n\n    // =============================================================\n    //                      STRING UTILITIES\n    // =============================================================\n\n    /**\n     * @notice Convert {getHTML} output to a string\n     * @param htmlRequest - HTMLRequest\n     * @return {getHTMLWrapped} as a string\n     */\n    function getHTMLString(\n        HTMLRequest memory htmlRequest\n    ) external view returns (string memory);\n\n    /**\n     * @notice Convert {getEncodedHTML} output to a string\n     * @param htmlRequest - HTMLRequest\n     * @return {getEncodedHTML} as a string\n     */\n    function getEncodedHTMLString(\n        HTMLRequest memory htmlRequest\n    ) external view returns (string memory);\n}"
      },
      "contracts/scripty.sol/interfaces/IScriptyHTMLURLSafe.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.22;\n\n///////////////////////////////////////////////////////////\n// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //\n// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //\n// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //\n// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //\n// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //\n// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //\n///////////////////////////////////////////////////////////\n\nimport {HTMLRequest, HTMLTagType, HTMLTag} from \"./../core/ScriptyCore.sol\";\n\ninterface IScriptyHTMLURLSafe {\n    // =============================================================\n    //                      RAW HTML GETTERS\n    // =============================================================\n\n    /**\n     * @notice  Get URL safe HTML with requested head tags and body tags\n     * @dev Any tags with tagType = 1/script are converted to base64 and wrapped\n     *      with <script src=\"data:text/javascript;base64,[SCRIPT]\"></script>\n     *\n     *      [WARNING]: Large non-base64 libraries that need base64 encoding\n     *      carry a high risk of causing a gas out. Highly advised the use\n     *      of base64 encoded scripts where possible\n     *\n     *      Your HTML is returned in the following format:\n     *\n     *      <html>\n     *          <head>\n     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]\n     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]\n     *              ...\n     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]\n     *          </head>\n     *          <body>\n     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]\n     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]\n     *              ...\n     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]\n     *          </body>\n     *      </html>\n     * @param htmlRequest - HTMLRequest\n     * @return Full HTML with head and body tags\n     */\n    function getHTMLURLSafe(\n        HTMLRequest memory htmlRequest\n    ) external view returns (bytes memory);\n\n    // =============================================================\n    //                      STRING UTILITIES\n    // =============================================================\n\n    /**\n     * @notice Convert {getHTMLURLSafe} output to a string\n     * @param htmlRequest - HTMLRequest\n     * @return {getHTMLURLSafe} as a string\n     */\n    function getHTMLURLSafeString(\n        HTMLRequest memory htmlRequest\n    ) external view returns (string memory);\n}"
      },
      "contracts/scripty.sol/utils/DynamicBuffer.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)\n\npragma solidity ^0.8.22;\n\n/// @title DynamicBuffer\n/// @author David Huber (@cxkoda) and Simon Fremaux (@dievardump). See also\n///         https://raw.githubusercontent.com/dievardump/solidity-dynamic-buffer\n/// @notice This library is used to allocate a big amount of container memory\n//          which will be subsequently filled without needing to reallocate\n///         memory.\n/// @dev First, allocate memory.\n///      Then use `buffer.appendUnchecked(theBytes)` or `appendSafe()` if\n///      bounds checking is required.\nlibrary DynamicBuffer {\n    /// @notice Allocates container space for the DynamicBuffer\n    /// @param capacity_ The intended max amount of bytes in the buffer\n    /// @return buffer The memory location of the buffer\n    /// @dev Allocates `capacity_ + 0x60` bytes of space\n    ///      The buffer array starts at the first container data position,\n    ///      (i.e. `buffer = container + 0x20`)\n    function allocate(uint256 capacity_)\n        internal\n        pure\n        returns (bytes memory buffer)\n    {\n        assembly {\n            // Get next-free memory address\n            let container := mload(0x40)\n\n            // Allocate memory by setting a new next-free address\n            {\n                // Add 2 x 32 bytes in size for the two length fields\n                // Add 32 bytes safety space for 32B chunked copy\n                let size := add(capacity_, 0x60)\n                let newNextFree := add(container, size)\n                mstore(0x40, newNextFree)\n            }\n\n            // Set the correct container length\n            {\n                let length := add(capacity_, 0x40)\n                mstore(container, length)\n            }\n\n            // The buffer starts at idx 1 in the container (0 is length)\n            buffer := add(container, 0x20)\n\n            // Init content with length 0\n            mstore(buffer, 0)\n        }\n\n        return buffer;\n    }\n\n    /// @notice Appends data to buffer, and update buffer length\n    /// @param buffer the buffer to append the data to\n    /// @param data the data to append\n    /// @dev Does not perform out-of-bound checks (container capacity)\n    ///      for efficiency.\n    function appendUnchecked(bytes memory buffer, bytes memory data)\n        internal\n        pure\n    {\n        assembly {\n            let length := mload(data)\n            for {\n                data := add(data, 0x20)\n                let dataEnd := add(data, length)\n                let copyTo := add(buffer, add(mload(buffer), 0x20))\n            } lt(data, dataEnd) {\n                data := add(data, 0x20)\n                copyTo := add(copyTo, 0x20)\n            } {\n                // Copy 32B chunks from data to buffer.\n                // This may read over data array boundaries and copy invalid\n                // bytes, which doesn't matter in the end since we will\n                // later set the correct buffer length, and have allocated an\n                // additional word to avoid buffer overflow.\n                mstore(copyTo, mload(data))\n            }\n\n            // Update buffer length\n            mstore(buffer, add(mload(buffer), length))\n        }\n    }\n\n    /// @notice Appends data to buffer, and update buffer length\n    /// @param buffer the buffer to append the data to\n    /// @param data the data to append\n    /// @dev Performs out-of-bound checks and calls `appendUnchecked`.\n    function appendSafe(bytes memory buffer, bytes memory data) internal pure {\n        checkOverflow(buffer, data.length);\n        appendUnchecked(buffer, data);\n    }\n\n    /// @notice Appends data encoded as Base64 to buffer.\n    /// @param fileSafe  Whether to replace '+' with '-' and '/' with '_'.\n    /// @param noPadding Whether to strip away the padding.\n    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.\n    /// See: https://datatracker.ietf.org/doc/html/rfc4648\n    /// Author: Modified from Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol)\n    /// Author: Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol)\n    /// Author: Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos.\n    function appendSafeBase64(\n        bytes memory buffer,\n        bytes memory data,\n        bool fileSafe,\n        bool noPadding\n    ) internal pure {\n        uint256 dataLength = data.length;\n\n        if (data.length == 0) {\n            return;\n        }\n\n        uint256 encodedLength;\n        uint256 r;\n        assembly {\n            // For each 3 bytes block, we will have 4 bytes in the base64\n            // encoding: `encodedLength = 4 * divCeil(dataLength, 3)`.\n            // The `shl(2, ...)` is equivalent to multiplying by 4.\n            encodedLength := shl(2, div(add(dataLength, 2), 3))\n\n            r := mod(dataLength, 3)\n            if noPadding {\n                // if r == 0 => no modification\n                // if r == 1 => encodedLength -= 2\n                // if r == 2 => encodedLength -= 1\n                encodedLength := sub(\n                    encodedLength,\n                    add(iszero(iszero(r)), eq(r, 1))\n                )\n            }\n        }\n\n        checkOverflow(buffer, encodedLength);\n\n        assembly {\n            let nextFree := mload(0x40)\n\n            // Store the table into the scratch space.\n            // Offsetted by -1 byte so that the `mload` will load the character.\n            // We will rewrite the free memory pointer at `0x40` later with\n            // the allocated size.\n            mstore(0x1f, \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef\")\n            mstore(\n                0x3f,\n                sub(\n                    \"ghijklmnopqrstuvwxyz0123456789-_\",\n                    // The magic constant 0x0230 will translate \"-_\" + \"+/\".\n                    mul(iszero(fileSafe), 0x0230)\n                )\n            )\n\n            // Skip the first slot, which stores the length.\n            let ptr := add(add(buffer, 0x20), mload(buffer))\n            let end := add(data, dataLength)\n\n            // Run over the input, 3 bytes at a time.\n            // prettier-ignore\n            // solhint-disable-next-line no-empty-blocks\n            for {} 1 {} {\n                    data := add(data, 3) // Advance 3 bytes.\n                    let input := mload(data)\n\n                    // Write 4 bytes. Optimized for fewer stack operations.\n                    mstore8(    ptr    , mload(and(shr(18, input), 0x3F)))\n                    mstore8(add(ptr, 1), mload(and(shr(12, input), 0x3F)))\n                    mstore8(add(ptr, 2), mload(and(shr( 6, input), 0x3F)))\n                    mstore8(add(ptr, 3), mload(and(        input , 0x3F)))\n                    \n                    ptr := add(ptr, 4) // Advance 4 bytes.\n                    // prettier-ignore\n                    if iszero(lt(data, end)) { break }\n                }\n\n            if iszero(noPadding) {\n                // Offset `ptr` and pad with '='. We can simply write over the end.\n                mstore8(sub(ptr, iszero(iszero(r))), 0x3d) // Pad at `ptr - 1` if `r > 0`.\n                mstore8(sub(ptr, shl(1, eq(r, 1))), 0x3d) // Pad at `ptr - 2` if `r == 1`.\n            }\n\n            mstore(buffer, add(mload(buffer), encodedLength))\n            mstore(0x40, nextFree)\n        }\n    }\n\n    /// @notice Appends data encoded as Base64 to buffer.\n    /// @param fileSafe  Whether to replace '+' with '-' and '/' with '_'.\n    /// @param noPadding Whether to strip away the padding.\n    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.\n    /// See: https://datatracker.ietf.org/doc/html/rfc4648\n    /// Author: Modified from Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol)\n    /// Author: Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol)\n    /// Author: Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos.\n    function appendUncheckedBase64(\n        bytes memory buffer,\n        bytes memory data,\n        bool fileSafe,\n        bool noPadding\n    ) internal pure {\n        uint256 dataLength = data.length;\n\n        if (data.length == 0) {\n            return;\n        }\n\n        uint256 encodedLength;\n        uint256 r;\n        assembly {\n            // For each 3 bytes block, we will have 4 bytes in the base64\n            // encoding: `encodedLength = 4 * divCeil(dataLength, 3)`.\n            // The `shl(2, ...)` is equivalent to multiplying by 4.\n            encodedLength := shl(2, div(add(dataLength, 2), 3))\n\n            r := mod(dataLength, 3)\n            if noPadding {\n                // if r == 0 => no modification\n                // if r == 1 => encodedLength -= 2\n                // if r == 2 => encodedLength -= 1\n                encodedLength := sub(\n                    encodedLength,\n                    add(iszero(iszero(r)), eq(r, 1))\n                )\n            }\n        }\n\n        assembly {\n            let nextFree := mload(0x40)\n\n            // Store the table into the scratch space.\n            // Offsetted by -1 byte so that the `mload` will load the character.\n            // We will rewrite the free memory pointer at `0x40` later with\n            // the allocated size.\n            mstore(0x1f, \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef\")\n            mstore(\n                0x3f,\n                sub(\n                    \"ghijklmnopqrstuvwxyz0123456789-_\",\n                    // The magic constant 0x0230 will translate \"-_\" + \"+/\".\n                    mul(iszero(fileSafe), 0x0230)\n                )\n            )\n\n            // Skip the first slot, which stores the length.\n            let ptr := add(add(buffer, 0x20), mload(buffer))\n            let end := add(data, dataLength)\n\n            // Run over the input, 3 bytes at a time.\n            // prettier-ignore\n            // solhint-disable-next-line no-empty-blocks\n            for {} 1 {} {\n                    data := add(data, 3) // Advance 3 bytes.\n                    let input := mload(data)\n\n                    // Write 4 bytes. Optimized for fewer stack operations.\n                    mstore8(    ptr    , mload(and(shr(18, input), 0x3F)))\n                    mstore8(add(ptr, 1), mload(and(shr(12, input), 0x3F)))\n                    mstore8(add(ptr, 2), mload(and(shr( 6, input), 0x3F)))\n                    mstore8(add(ptr, 3), mload(and(        input , 0x3F)))\n                    \n                    ptr := add(ptr, 4) // Advance 4 bytes.\n                    // prettier-ignore\n                    if iszero(lt(data, end)) { break }\n                }\n\n            if iszero(noPadding) {\n                // Offset `ptr` and pad with '='. We can simply write over the end.\n                mstore8(sub(ptr, iszero(iszero(r))), 0x3d) // Pad at `ptr - 1` if `r > 0`.\n                mstore8(sub(ptr, shl(1, eq(r, 1))), 0x3d) // Pad at `ptr - 2` if `r == 1`.\n            }\n\n            mstore(buffer, add(mload(buffer), encodedLength))\n            mstore(0x40, nextFree)\n        }\n    }\n\n    /// @notice Returns the capacity of a given buffer.\n    function capacity(bytes memory buffer) internal pure returns (uint256) {\n        uint256 cap;\n        assembly {\n            cap := sub(mload(sub(buffer, 0x20)), 0x40)\n        }\n        return cap;\n    }\n\n    /// @notice Reverts if the buffer will overflow after appending a given\n    /// number of bytes.\n    function checkOverflow(bytes memory buffer, uint256 addedLength)\n        internal\n        pure\n    {\n        uint256 cap = capacity(buffer);\n        uint256 newLength = buffer.length + addedLength;\n        if (cap < newLength) {\n            revert(\"DynamicBuffer: Appending out of bounds.\");\n        }\n    }\n}"
      }
    },
    "settings": {
      "evmVersion": "paris",
      "optimizer": {
        "enabled": false,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}