creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "packages/contracts/src/ART0x1.sol": {
        "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport \"sstore2/contracts/SSTORE2.sol\";\nimport {IERC721} from \"openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\nimport {IART0x1} from \"./interfaces/IART0x1.sol\";\nimport {ART0x1Types} from \"./ART0x1Types.sol\";\nimport {ERC721Base} from \"./ERC721Base.sol\";\n\n/// @author hashrunner.eth\n/// @title  ART0x1\ncontract ART0x1 is ERC721Base {\n    //\n    //   █████╗ ██████╗ ████████╗ ██████╗ ██╗  ██╗ ██╗\n    //  ██╔══██╗██╔══██╗╚══██╔══╝██╔═████╗╚██╗██╔╝███║\n    //  ███████║██████╔╝   ██║   ██║██╔██║ ╚███╔╝ ╚██║\n    //  ██╔══██║██╔══██╗   ██║   ████╔╝██║ ██╔██╗  ██║\n    //  ██║  ██║██║  ██║   ██║   ╚██████╔╝██╔╝ ██╗ ██║\n    //  ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝    ╚═════╝ ╚═╝  ╚═╝ ╚═╝\n    //\n    // ------------------------------------------------------------------------\n    // STORAGE\n    // ------------------------------------------------------------------------\n\n    // CONFIGURATION ----------------------------------------------------------\n\n    address[] public programAddresses;\n\n    mapping(uint => uint) public tokenToProgramAddress;\n\n    // MINTING ----------------------------------------------------------------\n\n    bool public earlyMintActive;\n\n    bool public publicMintActive;\n\n    // INSTRUCTIONS -----------------------------------------------------------\n\n    address public preRevealInstructions;\n\n    mapping(uint => address) public tokenInstructions;\n\n    // GALLERIES --------------------------------------------------------------\n\n    mapping(uint => ART0x1Types.Gallery) public galleries;\n\n    mapping(uint => address) public galleryToCurator;\n\n    mapping(uint => mapping(address => bool)) public isArtistInvitedToGallery;\n\n    mapping(uint => bool) public isGalleryRevealed;\n\n    mapping(uint => uint) public tokenToGalleryId;\n\n    mapping(uint => uint[]) public tokenToVisitedGalleries;\n\n    bool public isGalleryCurationPermissionless;\n\n    // GFX MODULES ------------------------------------------------------------\n\n    address[] public gfxModuleAddresses;\n\n    mapping(address => ART0x1Types.GfxModule) public gfxModules;\n\n    mapping(uint => address) public tokenToGfxModuleAddress;\n\n    mapping(uint => uint) public tokenToGfxModuleUint;\n\n    mapping(uint => string) public tokenToGfxModuleString;\n\n    mapping(uint => address[]) public tokenToExecutedGfxModules;\n\n    // ------------------------------------------------------------------------\n\n    // ------------------------------------------------------------------------\n    // CONSTRUCTOR\n    // ------------------------------------------------------------------------\n\n    constructor() ERC721Base(\"ART0x1\", \"ART0X1\", 0.068 ether, 1024) {}\n\n    // ------------------------------------------------------------------------\n    // CONFIGURATION\n    // ------------------------------------------------------------------------\n\n    function addProgramAddress(address _newAddress) public onlyOwner {\n        programAddresses.push(_newAddress);\n    }\n\n    function setTokenProgramAddress(\n        uint[] memory _tokenIds,\n        uint _index\n    ) public {\n        require(\n            _index < programAddresses.length,\n            \"ART0x1: no program at _index.\"\n        );\n\n        for (uint i; i < _tokenIds.length; i++) {\n            require(\n                msg.sender == ownerOf(_tokenIds[i]),\n                \"ART0x1: one or more tokens are not yours.\"\n            );\n            tokenToProgramAddress[_tokenIds[i]] = _index;\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // MINTING\n    // ------------------------------------------------------------------------\n\n    function toggleEarly() public onlyOwner {\n        require(\n            programAddresses.length > 0 && preRevealInstructions != address(0),\n            \"ART0x1: program not configured.\"\n        );\n        earlyMintActive = !earlyMintActive;\n    }\n\n    function togglePublic() public onlyOwner {\n        publicMintActive = !publicMintActive;\n    }\n\n    function mintAdmin(\n        uint _numToBeMinted\n    ) external onlyOwner withinMintLimit(6, _numToBeMinted) nonReentrant {\n        require(\n            programAddresses.length > 0 && preRevealInstructions != address(0),\n            \"ART0x1: program not configured.\"\n        );\n        _mintMany(_msgSender(), _numToBeMinted);\n    }\n\n    function mintEarly(\n        uint _numToBeMinted\n    )\n        external\n        payable\n        hasExactPayment(_numToBeMinted)\n        withinMintLimit(3, _numToBeMinted)\n        nonReentrant\n    {\n        require(earlyMintActive, \"ART0x1: cannot mint yet.\");\n        require(\n            IERC721(0x4E1f41613c9084FdB9E34E11fAE9412427480e56).balanceOf(\n                msg.sender\n            ) > 0,\n            \"ART0x1: need Terraforms to mint early.\"\n        );\n        _mintMany(_msgSender(), _numToBeMinted);\n    }\n\n    function mint(\n        uint _numToBeMinted\n    )\n        external\n        payable\n        hasExactPayment(_numToBeMinted)\n        withinMintLimit(3, _numToBeMinted)\n        nonReentrant\n    {\n        require(publicMintActive, \"ART0x1: public cannot mint yet.\");\n        _mintMany(_msgSender(), _numToBeMinted);\n    }\n\n    // ------------------------------------------------------------------------\n    // INSTRUCTIONS\n    // ------------------------------------------------------------------------\n\n    function setPreRevealInstructions(\n        string[12] memory _instructions\n    ) public onlyOwner {\n        preRevealInstructions = storeInstructions(_instructions);\n    }\n\n    function setTokenInstructions(\n        uint _tokenId,\n        string[12] memory _instructions\n    ) public {\n        require(_exists(_tokenId), \"ART0x1: token does not exist.\");\n        require(ownerOf(_tokenId) == msg.sender, \"ART0x1: not your token.\");\n        require(\n            isGalleryRevealed[0] == true,\n            \"ART0x1: cannot set instructions until after genesis reveal.\"\n        );\n\n        tokenInstructions[_tokenId] = storeInstructions(_instructions);\n    }\n\n    function getTokenInstructions(\n        uint _tokenId\n    ) public view returns (string[12] memory) {\n        require(_exists(_tokenId), \"ART0x1: token does not exist.\");\n        require(\n            tokenInstructions[_tokenId] != address(0),\n            \"ART0x1: token instructions not set.\"\n        );\n\n        bytes memory instr = SSTORE2.read(tokenInstructions[_tokenId]);\n        bytes[12] memory byteStrings = abi.decode(instr, (bytes[12]));\n        string[12] memory result;\n\n        for (uint i = 0; i < byteStrings.length; ) {\n            result[i] = string(byteStrings[i]);\n            unchecked {\n                ++i;\n            }\n        }\n        return result;\n    }\n\n    function clearTokenInstructions(uint[] memory _tokenIds) public {\n        for (uint i = 0; i < _tokenIds.length; ) {\n            uint tokenId = _tokenIds[i];\n\n            require(_exists(tokenId), \"ART0x1: token does not exist.\");\n            require(ownerOf(tokenId) == msg.sender, \"ART0x1: not your token.\");\n\n            tokenInstructions[tokenId] = address(0);\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // GALLERIES\n    // ------------------------------------------------------------------------\n\n    function assignGalleryCurator(\n        uint _galleryIndex,\n        address _curatorAddress\n    ) public {\n        if (!isGalleryCurationPermissionless) {\n            require(\n                owner() == msg.sender,\n                \"ART0x1: only owner can assign gallery curators.\"\n            );\n        }\n        require(\n            galleryToCurator[_galleryIndex] == address(0),\n            \"ART0x1: _galleryIndex is taken.\"\n        );\n\n        galleryToCurator[_galleryIndex] = _curatorAddress;\n    }\n\n    function inviteGalleryArtists(\n        uint _galleryIndex,\n        address[] memory _artistAddressList\n    ) public {\n        require(\n            galleryToCurator[_galleryIndex] == msg.sender,\n            \"ART0x1: only curator of _galleryIndex can invite artists.\"\n        );\n\n        uint len = _artistAddressList.length;\n        for (uint i = 0; i < len; ) {\n            isArtistInvitedToGallery[_galleryIndex][\n                _artistAddressList[i]\n            ] = true;\n\n            unchecked {\n                i++;\n            }\n        }\n    }\n\n    function addGalleryItem(\n        uint _galleryIndex,\n        string[12] memory _instructions\n    ) public {\n        require(\n            isArtistInvitedToGallery[_galleryIndex][msg.sender],\n            \"ART0x1: only invited artists can add to gallery\"\n        );\n\n        address data = storeInstructions(_instructions);\n        galleries[_galleryIndex].instructions.push(data);\n        galleries[_galleryIndex].artists.push(msg.sender);\n    }\n\n    function addGalleryItems(\n        uint _galleryIndex,\n        string[12][] memory _instructionsList\n    ) public {\n        require(\n            !isGalleryRevealed[_galleryIndex],\n            \"ART0x1: gallery already revealed, cannot add instructions.\"\n        );\n\n        for (uint i = 0; i < _instructionsList.length; i++) {\n            require(\n                isArtistInvitedToGallery[_galleryIndex][msg.sender],\n                \"ART0x1: only invited artists can add to gallery\"\n            );\n        }\n\n        uint len = _instructionsList.length;\n        for (uint i = 0; i < len; ) {\n            addGalleryItem(_galleryIndex, _instructionsList[i]);\n            unchecked {\n                i++;\n            }\n        }\n    }\n\n    function revealGallery(\n        uint _galleryIndex,\n        string memory _name,\n        uint _price\n    ) public {\n        require(\n            galleryToCurator[_galleryIndex] == msg.sender,\n            \"ART0x1: only gallery curator can reveal.\"\n        );\n\n        require(\n            (!isGalleryRevealed[_galleryIndex]),\n            \"ART0x1: gallery at _galleryIndex already revealed.\"\n        );\n\n        uint instructionsLength = galleries[_galleryIndex].instructions.length;\n\n        require(\n            instructionsLength != 0,\n            \"ART0x1: gallery at _galleryIndex is empty.\"\n        );\n\n        galleries[_galleryIndex].name = _name;\n        galleries[_galleryIndex].price = _price;\n        galleries[_galleryIndex].curator = msg.sender;\n\n        // Shuffle instructions and artists using Fisher-Yates algorithm\n        address[] storage instructions = galleries[_galleryIndex].instructions;\n        address[] storage artists = galleries[_galleryIndex].artists;\n\n        for (uint i = instructionsLength - 1; i > 0; i--) {\n            uint j = uint(\n                keccak256(\n                    abi.encodePacked(\n                        block.timestamp,\n                        blockhash(block.number - 1),\n                        i\n                    )\n                )\n            ) % (i + 1);\n\n            // Shuffle instructions\n            address tempInstruction = instructions[i];\n            instructions[i] = instructions[j];\n            instructions[j] = tempInstruction;\n\n            // Shuffle artists\n            address tempArtist = artists[i];\n            artists[i] = artists[j];\n            artists[j] = tempArtist;\n        }\n\n        // Set revealed\n        isGalleryRevealed[_galleryIndex] = true;\n    }\n\n    function setTokenGallery(\n        uint _tokenId,\n        uint _galleryIndex\n    ) public payable nonReentrant {\n        require(\n            isGalleryRevealed[0],\n            \"ART0x1: cannot set new gallery before genesis reveal.\"\n        );\n\n        require(\n            galleries[_galleryIndex].instructions.length > 0 &&\n                isGalleryRevealed[_galleryIndex],\n            \"ART0x1: gallery does not exist or is not yet revealed.\"\n        );\n\n        require(_exists(_tokenId), \"ART0x1: token does not exist.\");\n        require(ownerOf(_tokenId) == msg.sender, \"ART0x1: not your token.\");\n\n        bool previouslyVisited = false;\n        for (uint i = 0; i < tokenToVisitedGalleries[_tokenId].length; ) {\n            if (tokenToVisitedGalleries[_tokenId][i] == _galleryIndex) {\n                previouslyVisited = true;\n                break;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        // Check msg.value on first visit\n        uint galleryPrice = galleries[_galleryIndex].price;\n        if (!previouslyVisited) {\n            require(msg.value >= galleryPrice, \"ART0x1: insufficient payment.\");\n        }\n\n        tokenToGalleryId[_tokenId] = _galleryIndex;\n        tokenInstructions[_tokenId] = address(0);\n\n        // Add to the visited gallery if it hasn't been visited before\n        if (!previouslyVisited) {\n            tokenToVisitedGalleries[_tokenId].push(_galleryIndex);\n        }\n\n        // Refund excess payment if any\n        if (msg.value > galleryPrice) {\n            payable(msg.sender).transfer(msg.value - galleryPrice);\n        }\n\n        // Transfer payment to the curator of the gallery minus 2% fee\n        if (galleryPrice > 0 && !previouslyVisited) {\n            uint fee = (galleryPrice * 2) / 100;\n            uint amountToCurator = galleryPrice - fee;\n            address curatorAddress = galleries[_galleryIndex].curator;\n            payable(curatorAddress).transfer(amountToCurator);\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // GFX MODULES\n    // ------------------------------------------------------------------------\n\n    function listGfxModule(\n        string memory _name,\n        address _moduleAddress,\n        uint _price\n    ) public {\n        require(\n            gfxModules[_moduleAddress].moduleAddress == address(0),\n            \"Module already listed for this address\"\n        );\n\n        ART0x1Types.GfxModule memory newModule = ART0x1Types.GfxModule(\n            _name,\n            msg.sender,\n            _moduleAddress,\n            _price\n        );\n\n        gfxModuleAddresses.push(_moduleAddress);\n        gfxModules[_moduleAddress] = newModule;\n    }\n\n    function getGfxModuleByIndex(\n        uint _index\n    ) public view returns (ART0x1Types.GfxModule memory) {\n        require(\n            _index < gfxModuleAddresses.length,\n            \"ART0x1: gfx module does not exist.\"\n        );\n\n        address moduleAddress = gfxModuleAddresses[_index];\n        return gfxModules[moduleAddress];\n    }\n\n    function getGfxModules()\n        public\n        view\n        returns (ART0x1Types.GfxModule[] memory)\n    {\n        ART0x1Types.GfxModule[] memory modules = new ART0x1Types.GfxModule[](\n            gfxModuleAddresses.length\n        );\n        for (uint i = 0; i < gfxModuleAddresses.length; i++) {\n            modules[i] = gfxModules[gfxModuleAddresses[i]];\n        }\n        return modules;\n    }\n\n    function setTokenGfxModule(\n        uint _tokenId,\n        address _gfxModuleAddress,\n        uint _uint,\n        string memory _string\n    ) public payable nonReentrant {\n        require(_exists(_tokenId), \"ART0x1: token does not exist.\");\n        require(ownerOf(_tokenId) == msg.sender, \"ART0x1: not your token.\");\n        require(\n            gfxModules[_gfxModuleAddress].moduleAddress != address(0),\n            \"ART0x1: gfx module does not exist.\"\n        );\n        require(\n            isGalleryRevealed[0],\n            \"ART0x1: cannot set modules until after genesis gallery reveal.\"\n        );\n\n        // If module is HypercastleZones, require ownership of specified\n        // terraforms token\n        if (gfxModuleAddresses[0] == _gfxModuleAddress) {\n            require(\n                IERC721(0x4E1f41613c9084FdB9E34E11fAE9412427480e56).ownerOf(\n                    _uint\n                ) == msg.sender,\n                \"ART0x1: not your terraforms token.\"\n            );\n        }\n\n        // Determine if the module has been previously executed\n        bool previouslyExecuted = false;\n        for (uint i = 0; i < tokenToExecutedGfxModules[_tokenId].length; ) {\n            if (tokenToExecutedGfxModules[_tokenId][i] == _gfxModuleAddress) {\n                previouslyExecuted = true;\n                break;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        // Check msg.value on first execution\n        uint modulePrice = gfxModules[_gfxModuleAddress].price;\n        if (!previouslyExecuted) {\n            require(msg.value >= modulePrice, \"ART0x1: insufficient payment.\");\n        }\n\n        // Update token to gfx module mapping\n        tokenToGfxModuleAddress[_tokenId] = _gfxModuleAddress;\n        tokenToGfxModuleUint[_tokenId] = _uint;\n        tokenToGfxModuleString[_tokenId] = _string;\n\n        // Add to the executed gfx modules if it hasn't been added before\n        if (!previouslyExecuted) {\n            tokenToExecutedGfxModules[_tokenId].push(_gfxModuleAddress);\n        }\n\n        // Refund excess payment if any\n        if (msg.value > modulePrice) {\n            payable(msg.sender).transfer(msg.value - modulePrice);\n        }\n\n        // Transfer payment to the author of the gfx module minus 2% fee\n        if (modulePrice > 0 && !previouslyExecuted) {\n            uint fee = (modulePrice * 2) / 100;\n            uint amountToAuthor = modulePrice - fee;\n            address authorAddress = gfxModules[_gfxModuleAddress].authorAddress;\n            payable(authorAddress).transfer(amountToAuthor);\n        }\n    }\n\n    function resetTokenGfxModule(uint[] memory _tokenIds) public {\n        for (uint i = 0; i < _tokenIds.length; ) {\n            uint tokenId = _tokenIds[i];\n\n            require(_exists(tokenId), \"ART0x1: token does not exist.\");\n            require(ownerOf(tokenId) == msg.sender, \"ART0x1: not your token.\");\n\n            tokenToGfxModuleAddress[tokenId] = address(0);\n            tokenToGfxModuleUint[tokenId] = 0;\n            tokenToGfxModuleString[tokenId] = \"\";\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // TOKEN DATA\n    // ------------------------------------------------------------------------\n\n    function tokenHTML(uint _tokenId) public view returns (string memory) {\n        require(_exists(_tokenId), \"ART0x1: token does not exist.\");\n\n        return getTokenProgram(_tokenId).tokenHTML(getTokenContext(_tokenId));\n    }\n\n    function tokenSVG(uint _tokenId) public view returns (string memory) {\n        require(_exists(_tokenId), \"ART0x1: token does not exist.\");\n\n        return getTokenProgram(_tokenId).tokenSVG(getTokenContext(_tokenId));\n    }\n\n    function tokenURI(\n        uint _tokenId\n    ) public view override returns (string memory) {\n        require(_exists(_tokenId), \"ART0x1: token does not exist.\");\n\n        return getTokenProgram(_tokenId).tokenURI(getTokenContext(_tokenId));\n    }\n\n    // ------------------------------------------------------------------------\n    // UTILS\n    // ------------------------------------------------------------------------\n\n    function getTokenProgram(uint _tokenId) private view returns (IART0x1) {\n        return IART0x1(programAddresses[tokenToProgramAddress[_tokenId]]);\n    }\n\n    function getTokenContext(\n        uint _tokenId\n    ) internal view returns (ART0x1Types.TokenCtx memory tokenCtx) {\n        tokenCtx.id = _tokenId;\n        tokenCtx.prn = tokenToPRN[_tokenId];\n        tokenCtx.galleryId = tokenToGalleryId[_tokenId];\n\n        ART0x1Types.Gallery memory gallery = galleries[tokenCtx.galleryId];\n\n        // Artwork\n        if (!isGalleryRevealed[0]) {\n            // Pre-Reveal\n            tokenCtx.instructions = abi.decode(\n                SSTORE2.read(preRevealInstructions),\n                (bytes[12])\n            );\n            tokenCtx.mode = ART0x1Types.Mode.PRE_REVEAL;\n        } else {\n            address instructionsAddress = tokenInstructions[_tokenId];\n            uint galleryItemCount = gallery.instructions.length;\n\n            if (instructionsAddress != address(0)) {\n                // Original\n                tokenCtx.instructions = abi.decode(\n                    SSTORE2.read(instructionsAddress),\n                    (bytes[12])\n                );\n                tokenCtx.mode = ART0x1Types.Mode.ORIGINAL;\n                tokenCtx.artistAddress = ownerOf(_tokenId);\n            } else {\n                // Gallery\n                tokenCtx.instructions = abi.decode(\n                    SSTORE2.read(\n                        gallery.instructions[tokenCtx.prn % galleryItemCount]\n                    ),\n                    (bytes[12])\n                );\n                tokenCtx.mode = ART0x1Types.Mode.GALLERY;\n                tokenCtx.artistAddress = gallery.artists[\n                    tokenCtx.prn % galleryItemCount\n                ];\n                tokenCtx.galleryName = gallery.name;\n                tokenCtx.galleryCurator = galleryToCurator[tokenCtx.galleryId];\n            }\n        }\n\n        // Preset GFX\n        (\n            tokenCtx.gfx.colors,\n            tokenCtx.gfx.fontName,\n            tokenCtx.gfx.fontFilename,\n            tokenCtx.gfx.fontSize\n        ) = getTokenPresetGfx(tokenCtx.prn);\n\n        // GFX Module\n        address gfxModuleAddress = tokenToGfxModuleAddress[_tokenId];\n        ART0x1Types.GfxModule memory gfxModule = gfxModules[gfxModuleAddress];\n        tokenCtx.moduleName = gfxModule.name;\n        tokenCtx.moduleAuthor = gfxModule.authorAddress;\n        tokenCtx.moduleAddress = gfxModuleAddress;\n        tokenCtx.moduleUint = tokenToGfxModuleUint[_tokenId];\n        tokenCtx.moduleString = tokenToGfxModuleString[_tokenId];\n    }\n\n    function getTokenPresetGfx(\n        uint _prn\n    )\n        internal\n        pure\n        returns (\n            string[3] memory _colors,\n            string memory _fontName,\n            string memory _fontFilename,\n            string memory _fontSize\n        )\n    {\n        string[12] memory presetColorsOpts = [\n            // bg\n            \"#f4f4f4\",\n            \"#262626\",\n            \"#8d8d8d29\",\n            \"#161616\",\n            // c1\n            \"#161616\",\n            \"#c6c6c6\",\n            \"#6f6f6f\",\n            \"#8d8d8d\",\n            // c2\n            \"#161616\",\n            \"#c6c6c6\",\n            \"#6f6f6f\",\n            \"#8d8d8d\"\n        ];\n\n        uint colorId = _prn % 4;\n        _colors[0] = presetColorsOpts[colorId];\n        _colors[1] = presetColorsOpts[4 + colorId];\n        _colors[2] = presetColorsOpts[8 + colorId];\n        _fontName = \"IBM Plex Mono\";\n        _fontFilename = \"IBMPlexMono-Regular.woff2\";\n        _fontSize = \"12px\";\n    }\n\n    function storeInstructions(\n        string[12] memory _instructions\n    ) internal returns (address) {\n        bytes[12] memory bytesInstructions;\n        for (uint i = 0; i < _instructions.length; ) {\n            bytesInstructions[i] = bytes(_instructions[i]);\n            unchecked {\n                ++i;\n            }\n        }\n        return SSTORE2.write(abi.encode(bytesInstructions));\n    }\n}\n"
      },
      "packages/contracts/lib/sstore2/contracts/SSTORE2.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./utils/Bytecode.sol\";\n\n/**\n  @title A key-value storage with auto-generated keys for storing chunks of data with a lower write & read cost.\n  @author Agustin Aguilar <aa@horizon.io>\n\n  Readme: https://github.com/0xsequence/sstore2#readme\n*/\nlibrary SSTORE2 {\n  error WriteError();\n\n  /**\n    @notice Stores `_data` and returns `pointer` as key for later retrieval\n    @dev The pointer is a contract address with `_data` as code\n    @param _data to be written\n    @return pointer Pointer to the written `_data`\n  */\n  function write(bytes memory _data) internal returns (address pointer) {\n    // Append 00 to _data so contract can't be called\n    // Build init code\n    bytes memory code = Bytecode.creationCodeFor(\n      abi.encodePacked(\n        hex'00',\n        _data\n      )\n    );\n\n    // Deploy contract using create\n    assembly { pointer := create(0, add(code, 32), mload(code)) }\n\n    // Address MUST be non-zero\n    if (pointer == address(0)) revert WriteError();\n  }\n\n  /**\n    @notice Reads the contents of the `_pointer` code as data, skips the first byte \n    @dev The function is intended for reading pointers generated by `write`\n    @param _pointer to be read\n    @return data read from `_pointer` contract\n  */\n  function read(address _pointer) internal view returns (bytes memory) {\n    return Bytecode.codeAt(_pointer, 1, type(uint256).max);\n  }\n\n  /**\n    @notice Reads the contents of the `_pointer` code as data, skips the first byte \n    @dev The function is intended for reading pointers generated by `write`\n    @param _pointer to be read\n    @param _start number of bytes to skip\n    @return data read from `_pointer` contract\n  */\n  function read(address _pointer, uint256 _start) internal view returns (bytes memory) {\n    return Bytecode.codeAt(_pointer, _start + 1, type(uint256).max);\n  }\n\n  /**\n    @notice Reads the contents of the `_pointer` code as data, skips the first byte \n    @dev The function is intended for reading pointers generated by `write`\n    @param _pointer to be read\n    @param _start number of bytes to skip\n    @param _end index before which to end extraction\n    @return data read from `_pointer` contract\n  */\n  function read(address _pointer, uint256 _start, uint256 _end) internal view returns (bytes memory) {\n    return Bytecode.codeAt(_pointer, _start + 1, _end + 1);\n  }\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC-721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n     *   {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the address zero.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "packages/contracts/src/interfaces/IART0x1.sol": {
        "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport {ART0x1Types} from \"../ART0x1Types.sol\";\n\ninterface IART0x1 {\n    function tokenHTML(\n        ART0x1Types.TokenCtx memory _tokenCtx\n    ) external view returns (string memory);\n\n    function tokenSVG(\n        ART0x1Types.TokenCtx memory _tokenCtx\n    ) external view returns (string memory);\n\n    function tokenURI(\n        ART0x1Types.TokenCtx memory _tokenCtx\n    ) external view returns (string memory);\n}\n"
      },
      "packages/contracts/src/ART0x1Types.sol": {
        "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nlibrary ART0x1Types {\n    enum Mode {\n        PRE_REVEAL,\n        ORIGINAL,\n        GALLERY\n    }\n\n    struct InitInstructions {\n        bytes1 sym1;\n        bytes1 sym2;\n        uint nCol;\n        uint mCol;\n        string title;\n    }\n\n    struct ShapeInstructions {\n        bytes1 sym;\n        uint8 arr;\n        int16 row;\n        int16 col;\n        int16 nR;\n        int16 nC;\n        int16[] repeatRows;\n        int16[] repeatCols;\n    }\n\n    struct Gallery {\n        string name;\n        uint price;\n        address curator;\n        address[] instructions;\n        address[] artists;\n    }\n\n    struct GfxModule {\n        string name;\n        address authorAddress;\n        address moduleAddress;\n        uint price;\n    }\n\n    struct TokenGfx {\n        string[3] colors;\n        string fontName;\n        string fontFilename;\n        string fontSize;\n    }\n\n    struct TokenCtx {\n        uint id;\n        uint prn;\n        uint galleryId;\n        uint moduleUint;\n        address artistAddress;\n        address galleryCurator;\n        address moduleAuthor;\n        address moduleAddress;\n        bytes[12] instructions;\n        TokenGfx gfx;\n        Mode mode;\n        string galleryName;\n        string moduleName;\n        string moduleString;\n    }\n}\n"
      },
      "packages/contracts/src/ERC721Base.sol": {
        "content": "// SPDX-License-Identifier: Unlicense\npragma solidity ^0.8.22;\n\nimport {IERC721A, ERC721A} from \"erc721a/contracts/ERC721A.sol\";\nimport {IERC20} from \"openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC2981, ERC2981} from \"@openzeppelin/contracts/token/common/ERC2981.sol\";\nimport {Ownable} from \"openzeppelin/contracts/access/Ownable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\n/// @author frolic.eth (with modifications from hashrunner.eth)\n/// @title  ERC721 base contract\nabstract contract ERC721Base is ERC721A, ERC2981, Ownable, ReentrancyGuard {\n    uint public immutable price;\n    uint public immutable maxSupply;\n\n    mapping(uint => uint) public tokenToPRN;\n\n    bool public operatorFilteringEnabled;\n\n    event Initialized();\n\n    // ------------------------------------------------------------------------\n    // INITIALISE\n    // ------------------------------------------------------------------------\n\n    constructor(\n        string memory _name,\n        string memory _symbol,\n        uint _price,\n        uint _maxSupply\n    ) Ownable(msg.sender) ERC721A(_name, _symbol) {\n        price = _price;\n        maxSupply = _maxSupply;\n        _setDefaultRoyalty(msg.sender, 200);\n        emit Initialized();\n    }\n\n    function _startTokenId() internal pure override returns (uint) {\n        return 1;\n    }\n\n    function totalMinted() public view returns (uint) {\n        return _totalMinted();\n    }\n\n    // ------------------------------------------------------------------------\n    // CONDITIONS\n    // ------------------------------------------------------------------------\n\n    error MintLimitExceeded(uint limit);\n    error MintSupplyExceeded(uint supply);\n    error WrongPayment();\n\n    modifier withinMintLimit(uint limit, uint numToBeMinted) {\n        if (_numberMinted(_msgSender()) + numToBeMinted > limit) {\n            revert MintLimitExceeded(limit);\n        }\n        _;\n    }\n\n    modifier withinSupply(\n        uint supply,\n        uint numMinted,\n        uint numToBeMinted\n    ) {\n        if (numMinted + numToBeMinted > supply) {\n            revert MintSupplyExceeded(supply);\n        }\n        _;\n    }\n\n    modifier withinMaxSupply(uint numToBeMinted) {\n        if (_totalMinted() + numToBeMinted > maxSupply) {\n            revert MintSupplyExceeded(maxSupply);\n        }\n        _;\n    }\n\n    modifier hasExactPayment(uint numToBeMinted) {\n        if (msg.value != price * numToBeMinted) {\n            revert WrongPayment();\n        }\n        _;\n    }\n\n    // ------------------------------------------------------------------------\n    // MINTING\n    // ------------------------------------------------------------------------\n\n    function _mintMany(address to, uint numToBeMinted) internal {\n        _mintMany(to, numToBeMinted, \"\");\n    }\n\n    function _mintMany(\n        address to,\n        uint numToBeMinted,\n        bytes memory data\n    ) internal withinMaxSupply(numToBeMinted) {\n        uint batchSize = 10;\n        uint currentTotalMinted = totalMinted();\n\n        for (uint i = 0; i < numToBeMinted; i += batchSize) {\n            uint mintAmount = (i + batchSize > numToBeMinted)\n                ? numToBeMinted - i\n                : batchSize;\n            _safeMint(to, mintAmount, data);\n\n            for (uint j = 0; j < mintAmount; ++j) {\n                uint tokenId = currentTotalMinted + i + j;\n                tokenToPRN[tokenId] = uint(\n                    keccak256(\n                        abi.encodePacked(\n                            tokenId,\n                            to,\n                            block.timestamp,\n                            block.prevrandao,\n                            j\n                        )\n                    )\n                );\n            }\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // ROYALTIES\n    // ------------------------------------------------------------------------\n\n    function supportsInterface(\n        bytes4 interfaceId\n    ) public view virtual override(ERC721A, ERC2981) returns (bool) {\n        return\n            ERC721A.supportsInterface(interfaceId) ||\n            ERC2981.supportsInterface(interfaceId);\n    }\n\n    function setDefaultRoyalty(\n        address receiver,\n        uint96 feeNumerator\n    ) public onlyOwner {\n        _setDefaultRoyalty(receiver, feeNumerator);\n    }\n\n    function setOperatorFilteringEnabled(bool value) public onlyOwner {\n        operatorFilteringEnabled = value;\n    }\n\n    function _operatorFilteringEnabled() internal view returns (bool) {\n        return operatorFilteringEnabled;\n    }\n\n    function _isPriorityOperator(\n        address operator\n    ) internal pure returns (bool) {\n        return operator == address(0x1E0049783F008A0085193E00003D00cd54003c71);\n    }\n\n    // ------------------------------------------------------------------------\n    // ADMIN\n    // ------------------------------------------------------------------------\n\n    function withdrawAll() external nonReentrant {\n        require(address(this).balance > 0, \"ART0x1: zero balance.\");\n        (bool sent, ) = owner().call{value: address(this).balance}(\"\");\n        require(sent, \"ART0x1: failed to withdraw.\");\n    }\n\n    function withdrawAllERC20(IERC20 token) external nonReentrant {\n        token.transfer(owner(), token.balanceOf(address(this)));\n    }\n\n    // Can be run any time after mint to optimize gas for future transfers\n    function normalizeOwnership(uint startTokenId, uint quantity) external {\n        for (uint i = 0; i < quantity; i++) {\n            _initializeOwnershipAt(startTokenId + i);\n        }\n    }\n}\n"
      },
      "packages/contracts/lib/sstore2/contracts/utils/Bytecode.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n\nlibrary Bytecode {\n  error InvalidCodeAtRange(uint256 _size, uint256 _start, uint256 _end);\n\n  /**\n    @notice Generate a creation code that results on a contract with `_code` as bytecode\n    @param _code The returning value of the resulting `creationCode`\n    @return creationCode (constructor) for new contract\n  */\n  function creationCodeFor(bytes memory _code) internal pure returns (bytes memory) {\n    /*\n      0x00    0x63         0x63XXXXXX  PUSH4 _code.length  size\n      0x01    0x80         0x80        DUP1                size size\n      0x02    0x60         0x600e      PUSH1 14            14 size size\n      0x03    0x60         0x6000      PUSH1 00            0 14 size size\n      0x04    0x39         0x39        CODECOPY            size\n      0x05    0x60         0x6000      PUSH1 00            0 size\n      0x06    0xf3         0xf3        RETURN\n      <CODE>\n    */\n\n    return abi.encodePacked(\n      hex\"63\",\n      uint32(_code.length),\n      hex\"80_60_0E_60_00_39_60_00_F3\",\n      _code\n    );\n  }\n\n  /**\n    @notice Returns the size of the code on a given address\n    @param _addr Address that may or may not contain code\n    @return size of the code on the given `_addr`\n  */\n  function codeSize(address _addr) internal view returns (uint256 size) {\n    assembly { size := extcodesize(_addr) }\n  }\n\n  /**\n    @notice Returns the code of a given address\n    @dev It will fail if `_end < _start`\n    @param _addr Address that may or may not contain code\n    @param _start number of bytes of code to skip on read\n    @param _end index before which to end extraction\n    @return oCode read from `_addr` deployed bytecode\n\n    Forked from: https://gist.github.com/KardanovIR/fe98661df9338c842b4a30306d507fbd\n  */\n  function codeAt(address _addr, uint256 _start, uint256 _end) internal view returns (bytes memory oCode) {\n    uint256 csize = codeSize(_addr);\n    if (csize == 0) return bytes(\"\");\n\n    if (_start > csize) return bytes(\"\");\n    if (_end < _start) revert InvalidCodeAtRange(csize, _start, _end); \n\n    unchecked {\n      uint256 reqSize = _end - _start;\n      uint256 maxSize = csize - _start;\n\n      uint256 size = maxSize < reqSize ? maxSize : reqSize;\n\n      assembly {\n        // allocate output byte array - this could also be done without assembly\n        // by using o_code = new bytes(size)\n        oCode := mload(0x40)\n        // new \"memory end\" including padding\n        mstore(0x40, add(oCode, and(add(add(size, 0x20), 0x1f), not(0x1f))))\n        // store length in memory\n        mstore(oCode, size)\n        // actually retrieve the code, this needs assembly\n        extcodecopy(_addr, add(oCode, 0x20), _start, size)\n      }\n    }\n  }\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "packages/contracts/lib/ERC721A/contracts/ERC721A.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721A.sol';\n\n/**\n * @dev Interface of ERC721 token receiver.\n */\ninterface ERC721A__IERC721Receiver {\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n\n/**\n * @title ERC721A\n *\n * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)\n * Non-Fungible Token Standard, including the Metadata extension.\n * Optimized for lower gas during batch mints.\n *\n * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)\n * starting from `_startTokenId()`.\n *\n * Assumptions:\n *\n * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.\n * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).\n */\ncontract ERC721A is IERC721A {\n    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).\n    struct TokenApprovalRef {\n        address value;\n    }\n\n    // =============================================================\n    //                           CONSTANTS\n    // =============================================================\n\n    // Mask of an entry in packed address data.\n    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;\n\n    // The bit position of `numberMinted` in packed address data.\n    uint256 private constant _BITPOS_NUMBER_MINTED = 64;\n\n    // The bit position of `numberBurned` in packed address data.\n    uint256 private constant _BITPOS_NUMBER_BURNED = 128;\n\n    // The bit position of `aux` in packed address data.\n    uint256 private constant _BITPOS_AUX = 192;\n\n    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.\n    uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;\n\n    // The bit position of `startTimestamp` in packed ownership.\n    uint256 private constant _BITPOS_START_TIMESTAMP = 160;\n\n    // The bit mask of the `burned` bit in packed ownership.\n    uint256 private constant _BITMASK_BURNED = 1 << 224;\n\n    // The bit position of the `nextInitialized` bit in packed ownership.\n    uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;\n\n    // The bit mask of the `nextInitialized` bit in packed ownership.\n    uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;\n\n    // The bit position of `extraData` in packed ownership.\n    uint256 private constant _BITPOS_EXTRA_DATA = 232;\n\n    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.\n    uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n    // The mask of the lower 160 bits for addresses.\n    uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;\n\n    // The maximum `quantity` that can be minted with {_mintERC2309}.\n    // This limit is to prevent overflows on the address data entries.\n    // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}\n    // is required to cause an overflow, which is unrealistic.\n    uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n    // The `Transfer` event signature is given by:\n    // `keccak256(bytes(\"Transfer(address,address,uint256)\"))`.\n    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =\n        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n    // =============================================================\n    //                            STORAGE\n    // =============================================================\n\n    // The next token ID to be minted.\n    uint256 private _currentIndex;\n\n    // The number of tokens burned.\n    uint256 private _burnCounter;\n\n    // Token name\n    string private _name;\n\n    // Token symbol\n    string private _symbol;\n\n    // Mapping from token ID to ownership details\n    // An empty struct value does not necessarily mean the token is unowned.\n    // See {_packedOwnershipOf} implementation for details.\n    //\n    // Bits Layout:\n    // - [0..159]   `addr`\n    // - [160..223] `startTimestamp`\n    // - [224]      `burned`\n    // - [225]      `nextInitialized`\n    // - [232..255] `extraData`\n    mapping(uint256 => uint256) private _packedOwnerships;\n\n    // Mapping owner address to address data.\n    //\n    // Bits Layout:\n    // - [0..63]    `balance`\n    // - [64..127]  `numberMinted`\n    // - [128..191] `numberBurned`\n    // - [192..255] `aux`\n    mapping(address => uint256) private _packedAddressData;\n\n    // Mapping from token ID to approved address.\n    mapping(uint256 => TokenApprovalRef) private _tokenApprovals;\n\n    // Mapping from owner to operator approvals\n    mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n    // =============================================================\n    //                          CONSTRUCTOR\n    // =============================================================\n\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n        _currentIndex = _startTokenId();\n    }\n\n    // =============================================================\n    //                   TOKEN COUNTING OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Returns the starting token ID.\n     * To change the starting token ID, please override this function.\n     */\n    function _startTokenId() internal view virtual returns (uint256) {\n        return 0;\n    }\n\n    /**\n     * @dev Returns the next token ID to be minted.\n     */\n    function _nextTokenId() internal view virtual returns (uint256) {\n        return _currentIndex;\n    }\n\n    /**\n     * @dev Returns the total number of tokens in existence.\n     * Burned tokens will reduce the count.\n     * To get the total number of tokens minted, please see {_totalMinted}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        // Counter underflow is impossible as _burnCounter cannot be incremented\n        // more than `_currentIndex - _startTokenId()` times.\n        unchecked {\n            return _currentIndex - _burnCounter - _startTokenId();\n        }\n    }\n\n    /**\n     * @dev Returns the total amount of tokens minted in the contract.\n     */\n    function _totalMinted() internal view virtual returns (uint256) {\n        // Counter underflow is impossible as `_currentIndex` does not decrement,\n        // and it is initialized to `_startTokenId()`.\n        unchecked {\n            return _currentIndex - _startTokenId();\n        }\n    }\n\n    /**\n     * @dev Returns the total number of tokens burned.\n     */\n    function _totalBurned() internal view virtual returns (uint256) {\n        return _burnCounter;\n    }\n\n    // =============================================================\n    //                    ADDRESS DATA OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Returns the number of tokens in `owner`'s account.\n     */\n    function balanceOf(address owner) public view virtual override returns (uint256) {\n        if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector);\n        return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;\n    }\n\n    /**\n     * Returns the number of tokens minted by `owner`.\n     */\n    function _numberMinted(address owner) internal view returns (uint256) {\n        return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;\n    }\n\n    /**\n     * Returns the number of tokens burned by or on behalf of `owner`.\n     */\n    function _numberBurned(address owner) internal view returns (uint256) {\n        return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;\n    }\n\n    /**\n     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n     */\n    function _getAux(address owner) internal view returns (uint64) {\n        return uint64(_packedAddressData[owner] >> _BITPOS_AUX);\n    }\n\n    /**\n     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n     * If there are multiple variables, please pack them into a uint64.\n     */\n    function _setAux(address owner, uint64 aux) internal virtual {\n        uint256 packed = _packedAddressData[owner];\n        uint256 auxCasted;\n        // Cast `aux` with assembly to avoid redundant masking.\n        assembly {\n            auxCasted := aux\n        }\n        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);\n        _packedAddressData[owner] = packed;\n    }\n\n    // =============================================================\n    //                            IERC165\n    // =============================================================\n\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        // The interface IDs are constants representing the first 4 bytes\n        // of the XOR of all function selectors in the interface.\n        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)\n        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)\n        return\n            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.\n            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.\n            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.\n    }\n\n    // =============================================================\n    //                        IERC721Metadata\n    // =============================================================\n\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n        if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector);\n\n        string memory baseURI = _baseURI();\n        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';\n    }\n\n    /**\n     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n     * by default, it can be overridden in child contracts.\n     */\n    function _baseURI() internal view virtual returns (string memory) {\n        return '';\n    }\n\n    // =============================================================\n    //                     OWNERSHIPS OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n        return address(uint160(_packedOwnershipOf(tokenId)));\n    }\n\n    /**\n     * @dev Gas spent here starts off proportional to the maximum mint batch size.\n     * It gradually moves to O(1) as tokens get transferred around over time.\n     */\n    function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {\n        return _unpackedOwnership(_packedOwnershipOf(tokenId));\n    }\n\n    /**\n     * @dev Returns the unpacked `TokenOwnership` struct at `index`.\n     */\n    function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {\n        return _unpackedOwnership(_packedOwnerships[index]);\n    }\n\n    /**\n     * @dev Returns whether the ownership slot at `index` is initialized.\n     * An uninitialized slot does not necessarily mean that the slot has no owner.\n     */\n    function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {\n        return _packedOwnerships[index] != 0;\n    }\n\n    /**\n     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.\n     */\n    function _initializeOwnershipAt(uint256 index) internal virtual {\n        if (_packedOwnerships[index] == 0) {\n            _packedOwnerships[index] = _packedOwnershipOf(index);\n        }\n    }\n\n    /**\n     * Returns the packed ownership data of `tokenId`.\n     */\n    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {\n        if (_startTokenId() <= tokenId) {\n            packed = _packedOwnerships[tokenId];\n            // If the data at the starting slot does not exist, start the scan.\n            if (packed == 0) {\n                if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector);\n                // Invariant:\n                // There will always be an initialized ownership slot\n                // (i.e. `ownership.addr != address(0) && ownership.burned == false`)\n                // before an unintialized ownership slot\n                // (i.e. `ownership.addr == address(0) && ownership.burned == false`)\n                // Hence, `tokenId` will not underflow.\n                //\n                // We can directly compare the packed value.\n                // If the address is zero, packed will be zero.\n                for (;;) {\n                    unchecked {\n                        packed = _packedOwnerships[--tokenId];\n                    }\n                    if (packed == 0) continue;\n                    if (packed & _BITMASK_BURNED == 0) return packed;\n                    // Otherwise, the token is burned, and we must revert.\n                    // This handles the case of batch burned tokens, where only the burned bit\n                    // of the starting slot is set, and remaining slots are left uninitialized.\n                    _revert(OwnerQueryForNonexistentToken.selector);\n                }\n            }\n            // Otherwise, the data exists and we can skip the scan.\n            // This is possible because we have already achieved the target condition.\n            // This saves 2143 gas on transfers of initialized tokens.\n            // If the token is not burned, return `packed`. Otherwise, revert.\n            if (packed & _BITMASK_BURNED == 0) return packed;\n        }\n        _revert(OwnerQueryForNonexistentToken.selector);\n    }\n\n    /**\n     * @dev Returns the unpacked `TokenOwnership` struct from `packed`.\n     */\n    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {\n        ownership.addr = address(uint160(packed));\n        ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);\n        ownership.burned = packed & _BITMASK_BURNED != 0;\n        ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);\n    }\n\n    /**\n     * @dev Packs ownership data into a single uint256.\n     */\n    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {\n        assembly {\n            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n            owner := and(owner, _BITMASK_ADDRESS)\n            // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.\n            result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))\n        }\n    }\n\n    /**\n     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.\n     */\n    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {\n        // For branchless setting of the `nextInitialized` flag.\n        assembly {\n            // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.\n            result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n        }\n    }\n\n    // =============================================================\n    //                      APPROVAL OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     */\n    function approve(address to, uint256 tokenId) public payable virtual override {\n        _approve(to, tokenId, true);\n    }\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) public view virtual override returns (address) {\n        if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector);\n\n        return _tokenApprovals[tokenId].value;\n    }\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom}\n     * for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) public virtual override {\n        _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n    }\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}.\n     */\n    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n        return _operatorApprovals[owner][operator];\n    }\n\n    /**\n     * @dev Returns whether `tokenId` exists.\n     *\n     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n     *\n     * Tokens start existing when they are minted. See {_mint}.\n     */\n    function _exists(uint256 tokenId) internal view virtual returns (bool result) {\n        if (_startTokenId() <= tokenId) {\n            if (tokenId < _currentIndex) {\n                uint256 packed;\n                while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId;\n                result = packed & _BITMASK_BURNED == 0;\n            }\n        }\n    }\n\n    /**\n     * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.\n     */\n    function _isSenderApprovedOrOwner(\n        address approvedAddress,\n        address owner,\n        address msgSender\n    ) private pure returns (bool result) {\n        assembly {\n            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n            owner := and(owner, _BITMASK_ADDRESS)\n            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.\n            msgSender := and(msgSender, _BITMASK_ADDRESS)\n            // `msgSender == owner || msgSender == approvedAddress`.\n            result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))\n        }\n    }\n\n    /**\n     * @dev Returns the storage slot and value for the approved address of `tokenId`.\n     */\n    function _getApprovedSlotAndAddress(uint256 tokenId)\n        private\n        view\n        returns (uint256 approvedAddressSlot, address approvedAddress)\n    {\n        TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];\n        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.\n        assembly {\n            approvedAddressSlot := tokenApproval.slot\n            approvedAddress := sload(approvedAddressSlot)\n        }\n    }\n\n    // =============================================================\n    //                      TRANSFER OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Transfers `tokenId` from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token\n     * by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) public payable virtual override {\n        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n        // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.\n        from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));\n\n        if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);\n\n        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n        // The nested ifs save around 20+ gas over a compound boolean condition.\n        if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n            if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);\n\n        _beforeTokenTransfers(from, to, tokenId, 1);\n\n        // Clear approvals from the previous owner.\n        assembly {\n            if approvedAddress {\n                // This is equivalent to `delete _tokenApprovals[tokenId]`.\n                sstore(approvedAddressSlot, 0)\n            }\n        }\n\n        // Underflow of the sender's balance is impossible because we check for\n        // ownership above and the recipient's balance can't realistically overflow.\n        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n        unchecked {\n            // We can directly increment and decrement the balances.\n            --_packedAddressData[from]; // Updates: `balance -= 1`.\n            ++_packedAddressData[to]; // Updates: `balance += 1`.\n\n            // Updates:\n            // - `address` to the next owner.\n            // - `startTimestamp` to the timestamp of transfering.\n            // - `burned` to `false`.\n            // - `nextInitialized` to `true`.\n            _packedOwnerships[tokenId] = _packOwnershipData(\n                to,\n                _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)\n            );\n\n            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n                uint256 nextTokenId = tokenId + 1;\n                // If the next slot's address is zero and not burned (i.e. packed value is zero).\n                if (_packedOwnerships[nextTokenId] == 0) {\n                    // If the next slot is within bounds.\n                    if (nextTokenId != _currentIndex) {\n                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n                    }\n                }\n            }\n        }\n\n        // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n        uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;\n        assembly {\n            // Emit the `Transfer` event.\n            log4(\n                0, // Start of data (0, since no data).\n                0, // End of data (0, since no data).\n                _TRANSFER_EVENT_SIGNATURE, // Signature.\n                from, // `from`.\n                toMasked, // `to`.\n                tokenId // `tokenId`.\n            )\n        }\n        if (toMasked == 0) _revert(TransferToZeroAddress.selector);\n\n        _afterTokenTransfers(from, to, tokenId, 1);\n    }\n\n    /**\n     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) public payable virtual override {\n        safeTransferFrom(from, to, tokenId, '');\n    }\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token\n     * by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement\n     * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes memory _data\n    ) public payable virtual override {\n        transferFrom(from, to, tokenId);\n        if (to.code.length != 0)\n            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n                _revert(TransferToNonERC721ReceiverImplementer.selector);\n            }\n    }\n\n    /**\n     * @dev Hook that is called before a set of serially-ordered token IDs\n     * are about to be transferred. This includes minting.\n     * And also called before burning one token.\n     *\n     * `startTokenId` - the first token ID to be transferred.\n     * `quantity` - the amount to be transferred.\n     *\n     * Calling conditions:\n     *\n     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n     * transferred to `to`.\n     * - When `from` is zero, `tokenId` will be minted for `to`.\n     * - When `to` is zero, `tokenId` will be burned by `from`.\n     * - `from` and `to` are never both zero.\n     */\n    function _beforeTokenTransfers(\n        address from,\n        address to,\n        uint256 startTokenId,\n        uint256 quantity\n    ) internal virtual {}\n\n    /**\n     * @dev Hook that is called after a set of serially-ordered token IDs\n     * have been transferred. This includes minting.\n     * And also called after one token has been burned.\n     *\n     * `startTokenId` - the first token ID to be transferred.\n     * `quantity` - the amount to be transferred.\n     *\n     * Calling conditions:\n     *\n     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been\n     * transferred to `to`.\n     * - When `from` is zero, `tokenId` has been minted for `to`.\n     * - When `to` is zero, `tokenId` has been burned by `from`.\n     * - `from` and `to` are never both zero.\n     */\n    function _afterTokenTransfers(\n        address from,\n        address to,\n        uint256 startTokenId,\n        uint256 quantity\n    ) internal virtual {}\n\n    /**\n     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.\n     *\n     * `from` - Previous owner of the given token ID.\n     * `to` - Target address that will receive the token.\n     * `tokenId` - Token ID to be transferred.\n     * `_data` - Optional data to send along with the call.\n     *\n     * Returns whether the call correctly returned the expected magic value.\n     */\n    function _checkContractOnERC721Received(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes memory _data\n    ) private returns (bool) {\n        try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (\n            bytes4 retval\n        ) {\n            return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;\n        } catch (bytes memory reason) {\n            if (reason.length == 0) {\n                _revert(TransferToNonERC721ReceiverImplementer.selector);\n            }\n            assembly {\n                revert(add(32, reason), mload(reason))\n            }\n        }\n    }\n\n    // =============================================================\n    //                        MINT OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Mints `quantity` tokens and transfers them to `to`.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - `quantity` must be greater than 0.\n     *\n     * Emits a {Transfer} event for each mint.\n     */\n    function _mint(address to, uint256 quantity) internal virtual {\n        uint256 startTokenId = _currentIndex;\n        if (quantity == 0) _revert(MintZeroQuantity.selector);\n\n        _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n        // Overflows are incredibly unrealistic.\n        // `balance` and `numberMinted` have a maximum limit of 2**64.\n        // `tokenId` has a maximum limit of 2**256.\n        unchecked {\n            // Updates:\n            // - `address` to the owner.\n            // - `startTimestamp` to the timestamp of minting.\n            // - `burned` to `false`.\n            // - `nextInitialized` to `quantity == 1`.\n            _packedOwnerships[startTokenId] = _packOwnershipData(\n                to,\n                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n            );\n\n            // Updates:\n            // - `balance += quantity`.\n            // - `numberMinted += quantity`.\n            //\n            // We can directly add to the `balance` and `numberMinted`.\n            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n            // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n            uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;\n\n            if (toMasked == 0) _revert(MintToZeroAddress.selector);\n\n            uint256 end = startTokenId + quantity;\n            uint256 tokenId = startTokenId;\n\n            do {\n                assembly {\n                    // Emit the `Transfer` event.\n                    log4(\n                        0, // Start of data (0, since no data).\n                        0, // End of data (0, since no data).\n                        _TRANSFER_EVENT_SIGNATURE, // Signature.\n                        0, // `address(0)`.\n                        toMasked, // `to`.\n                        tokenId // `tokenId`.\n                    )\n                }\n                // The `!=` check ensures that large values of `quantity`\n                // that overflows uint256 will make the loop run out of gas.\n            } while (++tokenId != end);\n\n            _currentIndex = end;\n        }\n        _afterTokenTransfers(address(0), to, startTokenId, quantity);\n    }\n\n    /**\n     * @dev Mints `quantity` tokens and transfers them to `to`.\n     *\n     * This function is intended for efficient minting only during contract creation.\n     *\n     * It emits only one {ConsecutiveTransfer} as defined in\n     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),\n     * instead of a sequence of {Transfer} event(s).\n     *\n     * Calling this function outside of contract creation WILL make your contract\n     * non-compliant with the ERC721 standard.\n     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309\n     * {ConsecutiveTransfer} event is only permissible during contract creation.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - `quantity` must be greater than 0.\n     *\n     * Emits a {ConsecutiveTransfer} event.\n     */\n    function _mintERC2309(address to, uint256 quantity) internal virtual {\n        uint256 startTokenId = _currentIndex;\n        if (to == address(0)) _revert(MintToZeroAddress.selector);\n        if (quantity == 0) _revert(MintZeroQuantity.selector);\n        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);\n\n        _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.\n        unchecked {\n            // Updates:\n            // - `balance += quantity`.\n            // - `numberMinted += quantity`.\n            //\n            // We can directly add to the `balance` and `numberMinted`.\n            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n            // Updates:\n            // - `address` to the owner.\n            // - `startTimestamp` to the timestamp of minting.\n            // - `burned` to `false`.\n            // - `nextInitialized` to `quantity == 1`.\n            _packedOwnerships[startTokenId] = _packOwnershipData(\n                to,\n                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)\n            );\n\n            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);\n\n            _currentIndex = startTokenId + quantity;\n        }\n        _afterTokenTransfers(address(0), to, startTokenId, quantity);\n    }\n\n    /**\n     * @dev Safely mints `quantity` tokens and transfers them to `to`.\n     *\n     * Requirements:\n     *\n     * - If `to` refers to a smart contract, it must implement\n     * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.\n     * - `quantity` must be greater than 0.\n     *\n     * See {_mint}.\n     *\n     * Emits a {Transfer} event for each mint.\n     */\n    function _safeMint(\n        address to,\n        uint256 quantity,\n        bytes memory _data\n    ) internal virtual {\n        _mint(to, quantity);\n\n        unchecked {\n            if (to.code.length != 0) {\n                uint256 end = _currentIndex;\n                uint256 index = end - quantity;\n                do {\n                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {\n                        _revert(TransferToNonERC721ReceiverImplementer.selector);\n                    }\n                } while (index < end);\n                // Reentrancy protection.\n                if (_currentIndex != end) _revert(bytes4(0));\n            }\n        }\n    }\n\n    /**\n     * @dev Equivalent to `_safeMint(to, quantity, '')`.\n     */\n    function _safeMint(address to, uint256 quantity) internal virtual {\n        _safeMint(to, quantity, '');\n    }\n\n    // =============================================================\n    //                       APPROVAL OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Equivalent to `_approve(to, tokenId, false)`.\n     */\n    function _approve(address to, uint256 tokenId) internal virtual {\n        _approve(to, tokenId, false);\n    }\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the\n     * zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function _approve(\n        address to,\n        uint256 tokenId,\n        bool approvalCheck\n    ) internal virtual {\n        address owner = ownerOf(tokenId);\n\n        if (approvalCheck && _msgSenderERC721A() != owner)\n            if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n                _revert(ApprovalCallerNotOwnerNorApproved.selector);\n            }\n\n        _tokenApprovals[tokenId].value = to;\n        emit Approval(owner, to, tokenId);\n    }\n\n    // =============================================================\n    //                        BURN OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Equivalent to `_burn(tokenId, false)`.\n     */\n    function _burn(uint256 tokenId) internal virtual {\n        _burn(tokenId, false);\n    }\n\n    /**\n     * @dev Destroys `tokenId`.\n     * The approval is cleared when the token is burned.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _burn(uint256 tokenId, bool approvalCheck) internal virtual {\n        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n        address from = address(uint160(prevOwnershipPacked));\n\n        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);\n\n        if (approvalCheck) {\n            // The nested ifs save around 20+ gas over a compound boolean condition.\n            if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))\n                if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);\n        }\n\n        _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n        // Clear approvals from the previous owner.\n        assembly {\n            if approvedAddress {\n                // This is equivalent to `delete _tokenApprovals[tokenId]`.\n                sstore(approvedAddressSlot, 0)\n            }\n        }\n\n        // Underflow of the sender's balance is impossible because we check for\n        // ownership above and the recipient's balance can't realistically overflow.\n        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n        unchecked {\n            // Updates:\n            // - `balance -= 1`.\n            // - `numberBurned += 1`.\n            //\n            // We can directly decrement the balance, and increment the number burned.\n            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.\n            _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;\n\n            // Updates:\n            // - `address` to the last owner.\n            // - `startTimestamp` to the timestamp of burning.\n            // - `burned` to `true`.\n            // - `nextInitialized` to `true`.\n            _packedOwnerships[tokenId] = _packOwnershipData(\n                from,\n                (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)\n            );\n\n            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n                uint256 nextTokenId = tokenId + 1;\n                // If the next slot's address is zero and not burned (i.e. packed value is zero).\n                if (_packedOwnerships[nextTokenId] == 0) {\n                    // If the next slot is within bounds.\n                    if (nextTokenId != _currentIndex) {\n                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n                    }\n                }\n            }\n        }\n\n        emit Transfer(from, address(0), tokenId);\n        _afterTokenTransfers(from, address(0), tokenId, 1);\n\n        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.\n        unchecked {\n            _burnCounter++;\n        }\n    }\n\n    // =============================================================\n    //                     EXTRA DATA OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Directly sets the extra data for the ownership data `index`.\n     */\n    function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {\n        uint256 packed = _packedOwnerships[index];\n        if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);\n        uint256 extraDataCasted;\n        // Cast `extraData` with assembly to avoid redundant masking.\n        assembly {\n            extraDataCasted := extraData\n        }\n        packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);\n        _packedOwnerships[index] = packed;\n    }\n\n    /**\n     * @dev Called during each token transfer to set the 24bit `extraData` field.\n     * Intended to be overridden by the cosumer contract.\n     *\n     * `previousExtraData` - the value of `extraData` before transfer.\n     *\n     * Calling conditions:\n     *\n     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n     * transferred to `to`.\n     * - When `from` is zero, `tokenId` will be minted for `to`.\n     * - When `to` is zero, `tokenId` will be burned by `from`.\n     * - `from` and `to` are never both zero.\n     */\n    function _extraData(\n        address from,\n        address to,\n        uint24 previousExtraData\n    ) internal view virtual returns (uint24) {}\n\n    /**\n     * @dev Returns the next extra data for the packed ownership data.\n     * The returned result is shifted into position.\n     */\n    function _nextExtraData(\n        address from,\n        address to,\n        uint256 prevOwnershipPacked\n    ) private view returns (uint256) {\n        uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);\n        return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;\n    }\n\n    // =============================================================\n    //                       OTHER OPERATIONS\n    // =============================================================\n\n    /**\n     * @dev Returns the message sender (defaults to `msg.sender`).\n     *\n     * If you are writing GSN compatible contracts, you need to override this function.\n     */\n    function _msgSenderERC721A() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    /**\n     * @dev Converts a uint256 to its ASCII string decimal representation.\n     */\n    function _toString(uint256 value) internal pure virtual returns (string memory str) {\n        assembly {\n            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but\n            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.\n            // We will need 1 word for the trailing zeros padding, 1 word for the length,\n            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.\n            let m := add(mload(0x40), 0xa0)\n            // Update the free memory pointer to allocate.\n            mstore(0x40, m)\n            // Assign the `str` to the end.\n            str := sub(m, 0x20)\n            // Zeroize the slot after the string.\n            mstore(str, 0)\n\n            // Cache the end of the memory to calculate the length later.\n            let end := str\n\n            // We write the string from rightmost digit to leftmost digit.\n            // The following is essentially a do-while loop that also handles the zero case.\n            // prettier-ignore\n            for { let temp := value } 1 {} {\n                str := sub(str, 1)\n                // Write the character to the pointer.\n                // The ASCII index of the '0' character is 48.\n                mstore8(str, add(48, mod(temp, 10)))\n                // Keep dividing `temp` until zero.\n                temp := div(temp, 10)\n                // prettier-ignore\n                if iszero(temp) { break }\n            }\n\n            let length := sub(end, str)\n            // Move the pointer 32 bytes leftwards to make room for the length.\n            str := sub(str, 0x20)\n            // Store the length.\n            mstore(str, length)\n        }\n    }\n\n    /**\n     * @dev For more efficient reverts.\n     */\n    function _revert(bytes4 errorSelector) internal pure {\n        assembly {\n            mstore(0x00, errorSelector)\n            revert(0x00, 0x04)\n        }\n    }\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/contracts/token/common/ERC2981.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC2981} from \"../../interfaces/IERC2981.sol\";\nimport {IERC165, ERC165} from \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.\n *\n * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for\n * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.\n *\n * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the\n * fee is specified in basis points by default.\n *\n * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See\n * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to\n * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.\n */\nabstract contract ERC2981 is IERC2981, ERC165 {\n    struct RoyaltyInfo {\n        address receiver;\n        uint96 royaltyFraction;\n    }\n\n    RoyaltyInfo private _defaultRoyaltyInfo;\n    mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;\n\n    /**\n     * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).\n     */\n    error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);\n\n    /**\n     * @dev The default royalty receiver is invalid.\n     */\n    error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);\n\n    /**\n     * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).\n     */\n    error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);\n\n    /**\n     * @dev The royalty receiver for `tokenId` is invalid.\n     */\n    error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {\n        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @inheritdoc IERC2981\n     */\n    function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) {\n        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];\n\n        if (royalty.receiver == address(0)) {\n            royalty = _defaultRoyaltyInfo;\n        }\n\n        uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();\n\n        return (royalty.receiver, royaltyAmount);\n    }\n\n    /**\n     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a\n     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an\n     * override.\n     */\n    function _feeDenominator() internal pure virtual returns (uint96) {\n        return 10000;\n    }\n\n    /**\n     * @dev Sets the royalty information that all ids in this contract will default to.\n     *\n     * Requirements:\n     *\n     * - `receiver` cannot be the zero address.\n     * - `feeNumerator` cannot be greater than the fee denominator.\n     */\n    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n        uint256 denominator = _feeDenominator();\n        if (feeNumerator > denominator) {\n            // Royalty fee will exceed the sale price\n            revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);\n        }\n        if (receiver == address(0)) {\n            revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));\n        }\n\n        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);\n    }\n\n    /**\n     * @dev Removes default royalty information.\n     */\n    function _deleteDefaultRoyalty() internal virtual {\n        delete _defaultRoyaltyInfo;\n    }\n\n    /**\n     * @dev Sets the royalty information for a specific token id, overriding the global default.\n     *\n     * Requirements:\n     *\n     * - `receiver` cannot be the zero address.\n     * - `feeNumerator` cannot be greater than the fee denominator.\n     */\n    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {\n        uint256 denominator = _feeDenominator();\n        if (feeNumerator > denominator) {\n            // Royalty fee will exceed the sale price\n            revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);\n        }\n        if (receiver == address(0)) {\n            revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));\n        }\n\n        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);\n    }\n\n    /**\n     * @dev Resets royalty information for the token id back to the global default.\n     */\n    function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n        delete _tokenRoyaltyInfo[tokenId];\n    }\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/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"
      },
      "packages/contracts/lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"
      },
      "packages/contracts/lib/ERC721A/contracts/IERC721A.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\n/**\n * @dev Interface of ERC721A.\n */\ninterface IERC721A {\n    /**\n     * The caller must own the token or be an approved operator.\n     */\n    error ApprovalCallerNotOwnerNorApproved();\n\n    /**\n     * The token does not exist.\n     */\n    error ApprovalQueryForNonexistentToken();\n\n    /**\n     * Cannot query the balance for the zero address.\n     */\n    error BalanceQueryForZeroAddress();\n\n    /**\n     * Cannot mint to the zero address.\n     */\n    error MintToZeroAddress();\n\n    /**\n     * The quantity of tokens minted must be more than zero.\n     */\n    error MintZeroQuantity();\n\n    /**\n     * The token does not exist.\n     */\n    error OwnerQueryForNonexistentToken();\n\n    /**\n     * The caller must own the token or be an approved operator.\n     */\n    error TransferCallerNotOwnerNorApproved();\n\n    /**\n     * The token must be owned by `from`.\n     */\n    error TransferFromIncorrectOwner();\n\n    /**\n     * Cannot safely transfer to a contract that does not implement the\n     * ERC721Receiver interface.\n     */\n    error TransferToNonERC721ReceiverImplementer();\n\n    /**\n     * Cannot transfer to the zero address.\n     */\n    error TransferToZeroAddress();\n\n    /**\n     * The token does not exist.\n     */\n    error URIQueryForNonexistentToken();\n\n    /**\n     * The `quantity` minted with ERC2309 exceeds the safety limit.\n     */\n    error MintERC2309QuantityExceedsLimit();\n\n    /**\n     * The `extraData` cannot be set on an unintialized ownership slot.\n     */\n    error OwnershipNotInitializedForExtraData();\n\n    // =============================================================\n    //                            STRUCTS\n    // =============================================================\n\n    struct TokenOwnership {\n        // The address of the owner.\n        address addr;\n        // Stores the start time of ownership with minimal overhead for tokenomics.\n        uint64 startTimestamp;\n        // Whether the token has been burned.\n        bool burned;\n        // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.\n        uint24 extraData;\n    }\n\n    // =============================================================\n    //                         TOKEN COUNTERS\n    // =============================================================\n\n    /**\n     * @dev Returns the total number of tokens in existence.\n     * Burned tokens will reduce the count.\n     * To get the total number of tokens minted, please see {_totalMinted}.\n     */\n    function totalSupply() external view returns (uint256);\n\n    // =============================================================\n    //                            IERC165\n    // =============================================================\n\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n    // =============================================================\n    //                            IERC721\n    // =============================================================\n\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables\n     * (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in `owner`'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`,\n     * checking first that contract recipients are aware of the ERC721 protocol\n     * to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be have been allowed to move\n     * this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement\n     * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes calldata data\n    ) external payable;\n\n    /**\n     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external payable;\n\n    /**\n     * @dev Transfers `tokenId` from `from` to `to`.\n     *\n     * WARNING: Usage of this method is discouraged, use {safeTransferFrom}\n     * whenever possible.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token\n     * by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external payable;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the\n     * zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external payable;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom}\n     * for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool _approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}.\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n    // =============================================================\n    //                        IERC721Metadata\n    // =============================================================\n\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n\n    // =============================================================\n    //                           IERC2309\n    // =============================================================\n\n    /**\n     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`\n     * (inclusive) is transferred from `from` to `to`, as defined in the\n     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.\n     *\n     * See {_mintERC2309} for more details.\n     */\n    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n */\ninterface IERC2981 is IERC165 {\n    /**\n     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n     */\n    function royaltyInfo(\n        uint256 tokenId,\n        uint256 salePrice\n    ) external view returns (address receiver, uint256 royaltyAmount);\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "packages/contracts/lib/openzeppelin-contracts/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"
      }
    },
    "settings": {
      "remappings": [
        "erc721a/=packages/contracts/lib/ERC721A/",
        "base64/=packages/contracts/lib/base64/",
        "forge-std/=packages/contracts/lib/forge-std/src/",
        "openzeppelin/=packages/contracts/lib/openzeppelin-contracts/",
        "abdk-libraries-solidity/=packages/contracts/lib/abdk-libraries-solidity/",
        "sstore2/=packages/contracts/lib/sstore2/",
        "ds-test/=packages/contracts/lib/ds-test/src/",
        "solady/=packages/contracts/lib/ethfs/packages/contracts/lib/solady/src/",
        "@openzeppelin/contracts/=packages/contracts/lib/openzeppelin-contracts/contracts/",
        "ERC721A/=packages/contracts/lib/ERC721A/contracts/",
        "erc4626-tests/=packages/contracts/lib/openzeppelin-contracts/lib/erc4626-tests/",
        "ethfs/=packages/contracts/lib/ethfs/",
        "openzeppelin-contracts/=packages/contracts/lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "none",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}