[
  {
    "path": ".dockerignore",
    "content": "Dockerfile\n.dockerignore\nnode_modules\nnpm-debug.log\nREADME.md\n.next\n.git\nknip.json\nsqlite.db\n.env\n.env.example\n"
  },
  {
    "path": ".eslintrc.json",
    "content": "{\n  \"$schema\": \"https://json.schemastore.org/eslintrc\",\n  \"root\": true,\n  \"extends\": [\n    \"next/core-web-vitals\",\n    \"prettier\",\n    \"plugin:tailwindcss/recommended\",\n    \"plugin:@typescript-eslint/recommended\",\n    \"plugin:react/recommended\"\n  ],\n  \"plugins\": [\n    \"tailwindcss\",\n    \"react\"\n  ],\n  \"rules\": {\n    \"@next/next/no-html-link-for-pages\": \"off\",\n    \"react/jsx-key\": \"off\",\n    \"react/no-array-index-key\": \"warn\",\n    \"tailwindcss/no-custom-classname\": \"off\",\n    \"tailwindcss/classnames-order\": \"error\",\n    \"react/prop-types\": \"off\",\n    \"react/no-unknown-property\": \"off\"\n  },\n  \"globals\": {\n    \"React\": \"writable\"\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"detect\"\n    },\n    \"tailwindcss\": {\n      \"callees\": [\n        \"cn\",\n        \"cva\"\n      ],\n      \"config\": \"tailwind.config.js\"\n    },\n    \"next\": {\n      \"rootDir\": true\n    }\n  },\n  \"overrides\": [\n    {\n      \"files\": [\n        \"*.ts\",\n        \"*.tsx\"\n      ],\n      \"parser\": \"@typescript-eslint/parser\"\n    }\n  ]\n}\n"
  },
  {
    "path": ".github/actions/build-setup/action.yml",
    "content": "name: 'Prepare'\ndescription: 'Sets up the build for NodeJS and cache'\n\nruns:\n  using: \"composite\"\n  steps:\n    - uses: pnpm/action-setup@v4\n      name: Install pnpm\n      with:\n        run_install: false\n\n    - name: Install Node.js\n      uses: actions/setup-node@v4\n      with:\n        node-version: 20\n        cache: 'pnpm'\n\n    - name: Install dependencies\n      run: pnpm install\n      shell: bash\n"
  },
  {
    "path": ".github/actions/format/action.yml",
    "content": "name: 'Format'\ndescription: 'Ensures the repo matches Prettier rules'\nruns:\n  using: \"composite\"\n  steps:\n    - name: Format\n      shell: bash\n      run: pnpm format\n"
  },
  {
    "path": ".github/actions/lint/action.yml",
    "content": "name: 'Lint'\ndescription: 'Lints the repository'\n\nruns:\n  using: \"composite\"\n  steps:\n    - name: Lint\n      shell: bash\n      run: pnpm lint\n\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\n\non:\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\njobs:\n  code-style:\n    uses: ./.github/workflows/code-style.yml\n\n  check:\n    runs-on: ubuntu-20.04\n    timeout-minutes: 10\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Setup\n        uses: ./.github/actions/build-setup\n\n      - name: Check\n        run: pnpm check\n\n  knip:\n    runs-on: ubuntu-20.04\n    timeout-minutes: 10\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Setup\n        uses: ./.github/actions/build-setup\n\n      - name: Check\n        run: pnpm knip\n"
  },
  {
    "path": ".github/workflows/code-style.yml",
    "content": "name: Code Style Check\non:\n  workflow_call:\n\njobs:\n  lint:\n    runs-on: ubuntu-20.04\n    timeout-minutes: 5\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: Setup\n        uses: ./.github/actions/build-setup\n\n      - name: Lint\n        uses: ./.github/actions/lint\n\n  format:\n    runs-on: ubuntu-20.04\n    timeout-minutes: 5\n    steps:\n      - uses: actions/checkout@v3\n\n      - name: Setup\n        uses: ./.github/actions/build-setup\n\n      - name: Format\n        uses: ./.github/actions/format\n"
  },
  {
    "path": ".github/workflows/release.yaml",
    "content": "name: Create and publish Docker image\n\non:\n  release:\n    types: [ published ]\n\nenv:\n  REGISTRY: ghcr.io\n\njobs:\n  build-and-push-image:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      packages: write\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - name: Docker meta\n        id: meta\n        uses: docker/metadata-action@v5\n        with:\n          # list of Docker images to use as base name for tags\n          images: ghcr.io/georgegebbett/recipe-buddy\n          # generate Docker tags based on the following events/attributes\n          tags: |\n            type=semver,pattern=${{ github.event.release.tag_name }}\n            type=sha            \n\n      - name: Set up QEMU\n        uses: docker/setup-qemu-action@v3\n\n      - name: Set up Docker Buildx\n        uses: docker/setup-buildx-action@v3\n\n      - name: Log in to the Container registry\n        uses: docker/login-action@v3\n        with:\n          registry: ${{ env.REGISTRY }}\n          username: ${{ github.actor }}\n          password: ${{ secrets.GITHUB_TOKEN }}\n\n      - name: Build and push Docker image\n        uses: docker/build-push-action@v5\n        with:\n          context: .\n          platforms: linux/amd64,linux/arm64\n          push: true\n          tags: ${{ steps.meta.outputs.tags }}\n          labels: ${{ steps.meta.outputs.labels }}\n          cache-from: type=gha\n          cache-to: type=gha,mode=max\n"
  },
  {
    "path": ".gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# database\n/prisma/db.sqlite\n/prisma/db.sqlite-journal\n\n# next.js\n/.next/\n/out/\nnext-env.d.ts\n\n# production\n/build\n\n# misc\n.DS_Store\n*.pem\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n.pnpm-debug.log*\n\n# local env files\n# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables\n.env\n.env*.local\n\n# vercel\n.vercel\n\n# typescript\n*.tsbuildinfo\n\nsqlite.db\n"
  },
  {
    "path": ".idea/.gitignore",
    "content": "# Default ignored files\n/shelf/\n/workspace.xml\n# Editor-based HTTP Client requests\n/httpRequests/\n# Datasource local storage ignored files\n/dataSources/\n/dataSources.local.xml\n# GitHub Copilot persisted chat sessions\n/copilot/chatSessions\n"
  },
  {
    "path": ".idea/aws.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"accountSettings\">\n    <option name=\"activeProfile\" value=\"profile:default\" />\n    <option name=\"activeRegion\" value=\"us-east-1\" />\n    <option name=\"recentlyUsedProfiles\">\n      <list>\n        <option value=\"profile:default\" />\n      </list>\n    </option>\n    <option name=\"recentlyUsedRegions\">\n      <list>\n        <option value=\"us-east-1\" />\n      </list>\n    </option>\n  </component>\n</project>"
  },
  {
    "path": ".idea/codeStyles/Project.xml",
    "content": "<component name=\"ProjectCodeStyleConfiguration\">\n  <code_scheme name=\"Project\" version=\"173\">\n    <HTMLCodeStyleSettings>\n      <option name=\"HTML_SPACE_INSIDE_EMPTY_TAG\" value=\"true\" />\n      <option name=\"HTML_QUOTE_STYLE\" value=\"Single\" />\n      <option name=\"HTML_ENFORCE_QUOTES\" value=\"true\" />\n    </HTMLCodeStyleSettings>\n    <JSCodeStyleSettings version=\"0\">\n      <option name=\"FORCE_SEMICOLON_STYLE\" value=\"true\" />\n      <option name=\"SPACE_BEFORE_FUNCTION_LEFT_PARENTH\" value=\"false\" />\n      <option name=\"USE_DOUBLE_QUOTES\" value=\"false\" />\n      <option name=\"FORCE_QUOTE_STYlE\" value=\"true\" />\n      <option name=\"ENFORCE_TRAILING_COMMA\" value=\"WhenMultiline\" />\n      <option name=\"SPACES_WITHIN_OBJECT_LITERAL_BRACES\" value=\"true\" />\n      <option name=\"SPACES_WITHIN_IMPORTS\" value=\"true\" />\n    </JSCodeStyleSettings>\n    <TypeScriptCodeStyleSettings version=\"0\">\n      <option name=\"FORCE_SEMICOLON_STYLE\" value=\"true\" />\n      <option name=\"SPACE_BEFORE_FUNCTION_LEFT_PARENTH\" value=\"false\" />\n      <option name=\"USE_DOUBLE_QUOTES\" value=\"false\" />\n      <option name=\"FORCE_QUOTE_STYlE\" value=\"true\" />\n      <option name=\"ENFORCE_TRAILING_COMMA\" value=\"WhenMultiline\" />\n      <option name=\"SPACES_WITHIN_OBJECT_LITERAL_BRACES\" value=\"true\" />\n      <option name=\"SPACES_WITHIN_IMPORTS\" value=\"true\" />\n    </TypeScriptCodeStyleSettings>\n    <VueCodeStyleSettings>\n      <option name=\"INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER\" value=\"false\" />\n      <option name=\"INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER\" value=\"false\" />\n    </VueCodeStyleSettings>\n    <codeStyleSettings language=\"HTML\">\n      <option name=\"SOFT_MARGINS\" value=\"80\" />\n      <indentOptions>\n        <option name=\"INDENT_SIZE\" value=\"2\" />\n        <option name=\"CONTINUATION_INDENT_SIZE\" value=\"2\" />\n        <option name=\"TAB_SIZE\" value=\"2\" />\n      </indentOptions>\n    </codeStyleSettings>\n    <codeStyleSettings language=\"JavaScript\">\n      <option name=\"SOFT_MARGINS\" value=\"80\" />\n      <indentOptions>\n        <option name=\"INDENT_SIZE\" value=\"2\" />\n        <option name=\"CONTINUATION_INDENT_SIZE\" value=\"2\" />\n        <option name=\"TAB_SIZE\" value=\"2\" />\n      </indentOptions>\n    </codeStyleSettings>\n    <codeStyleSettings language=\"TypeScript\">\n      <option name=\"SOFT_MARGINS\" value=\"80\" />\n      <indentOptions>\n        <option name=\"INDENT_SIZE\" value=\"2\" />\n        <option name=\"CONTINUATION_INDENT_SIZE\" value=\"2\" />\n        <option name=\"TAB_SIZE\" value=\"2\" />\n      </indentOptions>\n    </codeStyleSettings>\n    <codeStyleSettings language=\"Vue\">\n      <option name=\"SOFT_MARGINS\" value=\"80\" />\n      <indentOptions>\n        <option name=\"CONTINUATION_INDENT_SIZE\" value=\"2\" />\n      </indentOptions>\n    </codeStyleSettings>\n  </code_scheme>\n</component>"
  },
  {
    "path": ".idea/codeStyles/codeStyleConfig.xml",
    "content": "<component name=\"ProjectCodeStyleConfiguration\">\n  <state>\n    <option name=\"USE_PER_PROJECT_SETTINGS\" value=\"true\" />\n  </state>\n</component>"
  },
  {
    "path": ".idea/dataSources.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"DataSourceManagerImpl\" format=\"xml\" multifile-model=\"true\">\n    <data-source source=\"LOCAL\" name=\"@localhost\" uuid=\"dcc5ae3c-b275-40a9-8d48-bd6530d677e1\">\n      <driver-ref>mongo</driver-ref>\n      <synchronize>true</synchronize>\n      <jdbc-driver>com.dbschema.MongoJdbcDriver</jdbc-driver>\n      <jdbc-url>mongodb://localhost:27017</jdbc-url>\n      <working-dir>$ProjectFileDir$</working-dir>\n    </data-source>\n    <data-source source=\"LOCAL\" name=\"sqlite.db\" uuid=\"77c813d4-b24d-40f0-8fd9-765fc0b25509\">\n      <driver-ref>sqlite.xerial</driver-ref>\n      <synchronize>true</synchronize>\n      <jdbc-driver>org.sqlite.JDBC</jdbc-driver>\n      <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/sqlite.db</jdbc-url>\n      <working-dir>$ProjectFileDir$</working-dir>\n    </data-source>\n  </component>\n</project>"
  },
  {
    "path": ".idea/git_toolbox_blame.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"GitToolBoxBlameSettings\">\n    <option name=\"version\" value=\"2\" />\n  </component>\n</project>"
  },
  {
    "path": ".idea/git_toolbox_prj.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"GitToolBoxProjectSettings\">\n    <option name=\"commitMessageIssueKeyValidationOverride\">\n      <BoolValueOverride>\n        <option name=\"enabled\" value=\"true\" />\n      </BoolValueOverride>\n    </option>\n    <option name=\"commitMessageValidationEnabledOverride\">\n      <BoolValueOverride>\n        <option name=\"enabled\" value=\"true\" />\n      </BoolValueOverride>\n    </option>\n  </component>\n</project>"
  },
  {
    "path": ".idea/inspectionProfiles/Project_Default.xml",
    "content": "<component name=\"InspectionProjectProfileManager\">\n  <profile version=\"1.0\">\n    <option name=\"myName\" value=\"Project Default\" />\n    <inspection_tool class=\"Eslint\" enabled=\"true\" level=\"WARNING\" enabled_by_default=\"true\" />\n  </profile>\n</component>"
  },
  {
    "path": ".idea/jsLibraryMappings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"JavaScriptLibraryMappings\">\n    <includedPredefinedLibrary name=\"Node.js Core\" />\n  </component>\n</project>"
  },
  {
    "path": ".idea/misc.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"MarkdownSettingsMigration\">\n    <option name=\"stateVersion\" value=\"1\" />\n  </component>\n</project>"
  },
  {
    "path": ".idea/modules.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"ProjectModuleManager\">\n    <modules>\n      <module fileurl=\"file://$PROJECT_DIR$/.idea/recipe-buddy-v2.iml\" filepath=\"$PROJECT_DIR$/.idea/recipe-buddy-v2.iml\" />\n    </modules>\n  </component>\n</project>"
  },
  {
    "path": ".idea/prettier.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"PrettierConfiguration\">\n    <option name=\"myConfigurationMode\" value=\"AUTOMATIC\" />\n    <option name=\"myRunOnSave\" value=\"true\" />\n    <option name=\"myRunOnReformat\" value=\"true\" />\n  </component>\n</project>"
  },
  {
    "path": ".idea/recipe-buddy-v2.iml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"WEB_MODULE\" version=\"4\">\n  <component name=\"NewModuleRootManager\">\n    <content url=\"file://$MODULE_DIR$\">\n      <excludeFolder url=\"file://$MODULE_DIR$/.tmp\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/temp\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/tmp\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/.idea/copilot/chatSessions\" />\n    </content>\n    <orderEntry type=\"inheritedJdk\" />\n    <orderEntry type=\"sourceFolder\" forTests=\"false\" />\n  </component>\n</module>"
  },
  {
    "path": ".idea/recipe-buddy.iml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module type=\"WEB_MODULE\" version=\"4\">\n  <component name=\"NewModuleRootManager\">\n    <content url=\"file://$MODULE_DIR$\">\n      <excludeFolder url=\"file://$MODULE_DIR$/temp\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/.tmp\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/tmp\" />\n    </content>\n    <orderEntry type=\"inheritedJdk\" />\n    <orderEntry type=\"sourceFolder\" forTests=\"false\" />\n  </component>\n</module>"
  },
  {
    "path": ".idea/runConfigurations/Front_and_Back.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"Front and Back\" type=\"CompoundRunConfigurationType\">\n    <toRun name=\"Start Backend\" type=\"js.build_tools.npm\" />\n    <toRun name=\"Start Frontend\" type=\"js.build_tools.npm\" />\n    <method v=\"2\" />\n  </configuration>\n</component>"
  },
  {
    "path": ".idea/runConfigurations/Front_end_dev__back_end_docker.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"Front end dev, back end docker\" type=\"CompoundRunConfigurationType\">\n    <toRun name=\"docker-compose-dev.yml: Compose Deployment\" type=\"docker-deploy\" />\n    <toRun name=\"Start Frontend\" type=\"js.build_tools.npm\" />\n    <method v=\"2\" />\n  </configuration>\n</component>"
  },
  {
    "path": ".idea/runConfigurations/recipe_buddy__Compose_Deployment.xml",
    "content": "<component name=\"ProjectRunConfigurationManager\">\n  <configuration default=\"false\" name=\"recipe-buddy: Compose Deployment\" type=\"docker-deploy\" factoryName=\"docker-compose.yml\" server-name=\"Docker\">\n    <deployment type=\"docker-compose.yml\">\n      <settings>\n        <option name=\"envFilePath\" value=\"\" />\n        <option name=\"sourceFilePath\" value=\"../recipe-buddy/docker-compose.yml\" />\n      </settings>\n    </deployment>\n    <method v=\"2\" />\n  </configuration>\n</component>"
  },
  {
    "path": ".idea/sqldialects.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"SqlDialectMappings\">\n    <file url=\"PROJECT\" dialect=\"SQLite\" />\n  </component>\n</project>"
  },
  {
    "path": ".idea/vcs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"VcsDirectoryMappings\">\n    <mapping directory=\"\" vcs=\"Git\" />\n  </component>\n</project>"
  },
  {
    "path": ".prettierrc.cjs",
    "content": "/** @type {import('prettier').Config} */\nmodule.exports = {\n  endOfLine: 'lf',\n  semi: false,\n  singleQuote: false,\n  tabWidth: 2,\n  trailingComma: 'es5',\n  importOrder: [\n    '^(react/(.*)$)|^(react$)',\n    '^(next/(.*)$)|^(next$)',\n    '<THIRD_PARTY_MODULES>',\n    '',\n    '^types$',\n    '^~/env(.*)$',\n    '^~/types/(.*)$',\n    '^~/config/(.*)$',\n    '^~/lib/(.*)$',\n    '^~/hooks/(.*)$',\n    '^~/components/ui/(.*)$',\n    '^~/components/(.*)$',\n    '^~/styles/(.*)$',\n    '^~/app/(.*)$',\n    '',\n    '^[./]',\n  ],\n  importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],\n  plugins: ['@ianvs/prettier-plugin-sort-imports'],\n};\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM node:18-alpine AS base\n\n# mostly inspired from https://github.com/BretFisher/node-docker-good-defaults/blob/main/Dockerfile & https://github.com/remix-run/example-trellix/blob/main/Dockerfile\n\n# Check https://github.com/nodejs/docker-node/blob/7c659dfc7bd632725695aa2112eb0cf0e5357cfd/README.md#nodealpine to understand why gcompat might be needed.\nRUN apk add --no-cache gcompat\nRUN corepack enable && corepack prepare pnpm@8.15.5 --activate\n# set the store dir to a folder that is not in the project\nRUN pnpm config set store-dir ~/.pnpm-store\nRUN pnpm fetch\n\nFROM base AS deps\nUSER node\n# WORKDIR now sets correct permissions if you set USER first so `USER node` has permissions on `/app` directory\nWORKDIR /home/node/app\nCOPY --chown=node:node package.json pnpm-lock.yaml* ./\n\nUSER root\n\nRUN pnpm install\n\nFROM base AS production-deps\nWORKDIR /home/node/app\n\nCOPY --from=deps --chown=node:node /home/node/app/node_modules ./node_modules\nCOPY --chown=node:node package.json pnpm-lock.yaml* ./\nRUN pnpm prune --prod\n\nFROM base AS builder\n\nWORKDIR /home/node/app\nCOPY --from=deps --chown=node:node /home/node/app/node_modules ./node_modules\nCOPY --chown=node:node src/server/db/drizzle ./migrations\nCOPY --chown=node:node . .\n\n#RUN pnpm install --offline\n\nENV SKIP_ENV_VALIDATION=1\n\nRUN pnpm build\n\nFROM base AS runner\nWORKDIR /home/node/app\n\nRUN apk add --no-cache dumb-init\n\nENV NODE_ENV=production\nENV DATABASE_URL=\"/home/node/app/data/sqlite.db\"\n\nRUN mkdir data\n\nVOLUME \"/home/node/app/data\"\n\nCOPY --from=builder /home/node/app/next.config.js ./\nCOPY --from=builder /home/node/app/public ./public\nCOPY --from=builder /home/node/app/package.json ./package.json\nCOPY --from=production-deps --chown=node:node home/node/app/node_modules ./node_modules\n\n\n# Automatically leverage output traces to reduce image size\n# https://nextjs.org/docs/advanced-features/output-file-tracing\n# Some things are not allowed (see https://github.com/vercel/next.js/issues/38119#issuecomment-1172099259)\nCOPY --from=builder --chown=node:node /home/node/app/.next/standalone ./\nCOPY --from=builder --chown=node:node /home/node/app/.next/static ./.next/static\nCOPY --from=builder --chown=node:node /home/node/app/src/server/db ./db\n\nCOPY --from=builder --chown=node:node /home/node/app/migrations ./migrations\n\n# Move the run script and litestream config to the runtime image\nCOPY --chown=node:node src/server/db/ ./migrations\nCOPY --chown=node:node scripts/run.sh ./run.sh\n\nRUN npx tsc -b ./migrations\n\nEXPOSE 3000\n\nENV PORT=3000\nENV HOSTNAME=0.0.0.0\nENV NEXTAUTH_URL_INTERNAL=http://0.0.0.0:3000\n\nRUN chmod +x ./run.sh\n\nCMD [\"dumb-init\", \"--\", \"./run.sh\"]\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# Recipe Buddy\n\n[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua)\n[![wakatime](https://wakatime.com/badge/user/43ab5910-d51d-486b-9e03-376e766a43d3/project/c2af7adc-0f49-4c92-bcaa-63bb2f09e9e2.svg)](https://wakatime.com/badge/user/43ab5910-d51d-486b-9e03-376e766a43d3/project/c2af7adc-0f49-4c92-bcaa-63bb2f09e9e2)\n\n## Update - April 2024\n\nV2 of Recipe Buddy is here! V2 brings a host of improvements, including:\n\n* An all-new architecture - SQLIte replaces Mongo and Next.js replaces the massively overkill Nest.js and plain React\n* Can be run in one (1) Docker container - no messing about with compose files\n* A whole new UI\n\nThe only thing that hasn't really changed is the recipe scraping logic itself - that is coming (no promises on when\nthough)\n\n## The problem\n\nI am getting sick of manually importing recipes into Grocy.\n\n## The solution\n\nOvercomplication, naturally. Recipe Buddy is a web app which scrapes web pages for the\ndelicious [structured metadata](https://schema.org/Recipe) embedded therein.\n\nOnce the recipe has been extracted from the page, Recipe Buddy gives you a nice easy means to match each of its\ningredients up with a product from your Grocy stock, as well as a quantity unit. Once this is done, you simply hit the '\nAdd Recipe' button, and the TypeScript goblins painstakingly transcribe the recipe into your Grocy instance, ready for\nmeal planning!\n\n## How you can have a go\n\n\"Well gee, George, that sounds mighty swell\", I hear you say, \"but how does little old me go about harnessing the\nTypeScript goblins for my own recipe-scraping requirements?\"\n\nWell, dear reader, as I am a benevolent goblin-wrangler, I have imprisoned them in a poorly written Dockerfile for you!\nAll one needs to do to benefit from the gobliny goodness is as follows:\n\n1. Generate yourself an auth secret using `openssl rand -base64 32`\n2. Get the base url of your Grocy instance (everything up to the first `/`)\n3. Get an API key for your Grocy instance\n4. Run the following command:\n    ```\n   docker run \\\n     -p 3005:3000 \\\n     -v rb_data:/home/node/app/data \\\n     --env GROCY_API_KEY=YOUR_GROCY_API_KEY \\\n     --env GROCY_BASE_URL=YOUR_GROCY_BASE_URL \\\n     --env NEXTAUTH_SECRET=YOUR_AUTH_SECRET \\\n     --env NEXTAUTH_URL=http://localhost:3005 \\\n     ghcr.io/georgegebbett/recipe-buddy\n   ```\n\n## A disclaimer\n\nI am apparently a professional software engineer, however I certainly do not profess to be any good at this stuff. I\nhereby abdicate any responsibility for the misbehaviour of the TypeScript goblins. If you think you can do better, then\nopen a PR and I will almost certainly merge it without question.\n\nLots of love, George xoxoxoxo\n"
  },
  {
    "path": "SECURITY.md",
    "content": "# Security Policy\n\n## Supported Versions\n\nUse this section to tell people about which versions of your project are\ncurrently being supported with security updates.\n\n| Version | Supported          |\n| ------- | ------------------ |\n| all     | :white_check_mark: |\n\n\n## Reporting a Vulnerability\n\nemail me - github[at]georgegebbett[dot]co[dot]uk\n"
  },
  {
    "path": "components.json",
    "content": "{\n  \"$schema\": \"https://ui.shadcn.com/schema.json\",\n  \"style\": \"default\",\n  \"rsc\": true,\n  \"tsx\": true,\n  \"tailwind\": {\n    \"config\": \"tailwind.config.js\",\n    \"css\": \"src/styles/globals.css\",\n    \"baseColor\": \"slate\",\n    \"cssVariables\": true,\n    \"prefix\": \"\"\n  },\n  \"aliases\": {\n    \"components\": \"~/components\",\n    \"utils\": \"~/lib/utils\"\n  }\n}"
  },
  {
    "path": "drizzle.config.ts",
    "content": "import { type Config } from \"drizzle-kit\"\n\nimport { env } from \"./src/env\"\n\nexport default {\n  schema: \"./src/server/db/schema.ts\",\n  driver: \"better-sqlite\",\n  dbCredentials: {\n    url: env.DATABASE_URL,\n  },\n  tablesFilter: [\"recipe-buddy_*\"],\n  out: \"./src/server/db/drizzle\",\n} satisfies Config\n"
  },
  {
    "path": "knip.json",
    "content": "{\n  \"$schema\": \"https://unpkg.com/knip@5/schema.json\",\n  \"entry\": [\n    \"src/server/db/drizzle-migrate.mjs\"\n  ],\n  \"ignore\": [\n    \"src/components/ui/*.tsx\",\n    \"src/trpc/**.*\"\n  ],\n  \"ignoreDependencies\": [\n    \"@radix-ui/*\",\n    \"server-only\"\n  ]\n}\n"
  },
  {
    "path": "next.config.js",
    "content": "/**\n * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful\n * for Docker builds.\n */\nawait import(\"./src/env.js\")\n\n/** @type {import(\"next\").NextConfig} */\nconst config = {\n  output: \"standalone\",\n}\n\nexport default config\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"recipe-buddy\",\n  \"version\": \"2.0.8\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"next build\",\n    \"check\": \"tsc --noEmit\",\n    \"db:migrate\": \"node migrations/drizzle-migrate.mjs\",\n    \"db:migrate:dev\": \"dotenv tsx src/server/db/migrate.ts\",\n    \"db:push\": \"dotenv drizzle-kit push:sqlite\",\n    \"db:studio\": \"dotenv drizzle-kit studio\",\n    \"dev\": \"next dev | pino-pretty\",\n    \"format\": \"SKIP_ENV_VALIDATION=1 prettier -c src --ignore-path .gitignore\",\n    \"format:fix\": \"prettier -l -w src --ignore-path .gitignore\",\n    \"knip\": \"SKIP_ENV_VALIDATION=1 knip\",\n    \"lint\": \"SKIP_ENV_VALIDATION=1 next lint\",\n    \"lint:fix\": \"next lint --fix\",\n    \"start\": \"next start\"\n  },\n  \"dependencies\": {\n    \"@hookform/resolvers\": \"^3.3.3\",\n    \"@planetscale/database\": \"^1.11.0\",\n    \"@radix-ui/react-accordion\": \"^1.1.2\",\n    \"@radix-ui/react-avatar\": \"^1.0.4\",\n    \"@radix-ui/react-dialog\": \"^1.0.5\",\n    \"@radix-ui/react-dropdown-menu\": \"^2.0.6\",\n    \"@radix-ui/react-label\": \"^2.0.2\",\n    \"@radix-ui/react-popover\": \"^1.0.7\",\n    \"@radix-ui/react-scroll-area\": \"^1.0.5\",\n    \"@radix-ui/react-slot\": \"^1.0.2\",\n    \"@t3-oss/env-nextjs\": \"^0.7.1\",\n    \"@tanstack/react-query\": \"^4.36.1\",\n    \"@trpc/client\": \"^10.43.6\",\n    \"@trpc/react-query\": \"^10.43.6\",\n    \"@trpc/server\": \"^10.43.6\",\n    \"bcrypt\": \"^5.1.1\",\n    \"better-sqlite3\": \"^9.2.2\",\n    \"class-variance-authority\": \"^0.7.0\",\n    \"clsx\": \"^2.0.0\",\n    \"cmdk\": \"^1.0.0\",\n    \"drizzle-orm\": \"^0.30.9\",\n    \"jsdom\": \"^23.0.1\",\n    \"lucide-react\": \"^0.368.0\",\n    \"next\": \"^14.0.3\",\n    \"next-auth\": \"^4.24.5\",\n    \"next-themes\": \"^0.2.1\",\n    \"normalize-url\": \"^8.0.0\",\n    \"pino\": \"^8.17.2\",\n    \"react\": \"18.2.0\",\n    \"react-dom\": \"18.2.0\",\n    \"react-hook-form\": \"^7.49.2\",\n    \"server-only\": \"^0.0.1\",\n    \"slugify\": \"^1.6.6\",\n    \"sonner\": \"^1.3.1\",\n    \"superjson\": \"^2.2.1\",\n    \"tailwind-merge\": \"^2.2.0\",\n    \"tailwindcss-animate\": \"^1.0.7\",\n    \"tsx\": \"^4.7.1\",\n    \"typescript\": \"^5.1.6\",\n    \"uuid\": \"^9.0.1\",\n    \"zod\": \"^3.22.4\"\n  },\n  \"devDependencies\": {\n    \"@ianvs/prettier-plugin-sort-imports\": \"^4.1.1\",\n    \"@types/bcrypt\": \"^5.0.2\",\n    \"@types/better-sqlite3\": \"^7.6.8\",\n    \"@types/jsdom\": \"^21.1.6\",\n    \"@types/node\": \"^18.17.0\",\n    \"@types/react\": \"^18.2.37\",\n    \"@types/react-dom\": \"^18.2.15\",\n    \"@types/uuid\": \"^9.0.7\",\n    \"@typescript-eslint/eslint-plugin\": \"^7.4.0\",\n    \"@typescript-eslint/parser\": \"^7.4.0\",\n    \"autoprefixer\": \"^10.4.14\",\n    \"dotenv-cli\": \"^7.3.0\",\n    \"drizzle-kit\": \"^0.20.17\",\n    \"eslint\": \"^8.57.0\",\n    \"eslint-config-next\": \"13.0.0\",\n    \"eslint-config-prettier\": \"^8.8.0\",\n    \"eslint-plugin-react\": \"^7.34.1\",\n    \"eslint-plugin-tailwindcss\": \"^3.11.0\",\n    \"knip\": \"^5.46.0\",\n    \"pino-pretty\": \"^10.3.1\",\n    \"postcss\": \"^8.4.31\",\n    \"prettier\": \"^3.1.0\",\n    \"tailwindcss\": \"^3.3.5\"\n  },\n  \"packageManager\": \"pnpm@10.6.3+sha512.bb45e34d50a9a76e858a95837301bfb6bd6d35aea2c5d52094fa497a467c43f5c440103ce2511e9e0a2f89c3d6071baac3358fc68ac6fb75e2ceb3d2736065e6\",\n  \"pnpm\": {\n    \"onlyBuiltDependencies\": [\n      \"bcrypt\",\n      \"better-sqlite3\",\n      \"es5-ext\",\n      \"esbuild\"\n    ]\n  },\n  \"ct3aMetadata\": {\n    \"initVersion\": \"7.25.0\"\n  }\n}\n"
  },
  {
    "path": "postcss.config.cjs",
    "content": "const config = {\n  plugins: {\n    tailwindcss: {},\n    autoprefixer: {},\n  },\n};\n\nmodule.exports = config;\n"
  },
  {
    "path": "scripts/run.sh",
    "content": "#!/bin/sh\n\n## Check if DATABASE_URL is not set\n#if [ -z \"$DATABASE_URL\" ]; then\n#    # Check if all required variables are provided\n#    if [ -n \"$DATABASE_HOST\" ] && [ -n \"$DATABASE_USERNAME\" ] && [ -n \"$DATABASE_PASSWORD\" ]  && [ -n \"$DATABASE_NAME\" ]; then\n#        # Construct DATABASE_URL from the provided variables\n#        DATABASE_URL=\"postgresql://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}\"\n#        export DATABASE_URL\n#    else\n#        echo \"Error: Required database environment variables are not set. Provide a postgres url for DATABASE_URL.\"\n#        exit 1\n#    fi\n#fi\n#\n## Set DIRECT_URL to the value of DATABASE_URL if it is not set, required for migrations\n#if [ -z \"$DIRECT_URL\" ]; then\n#    export DIRECT_URL=$DATABASE_URL\n#fi\n\n\n\n\n# Apply migrations\nnpm run db:migrate\nstatus=$?\n\n# If migration fails (returns non-zero exit status), exit script with that status\nif [ $status -ne 0 ]; then\n    echo \"Applying database migrations failed. This is mostly caused by the database being unavailable.\"\n    echo \"Exiting...\"\n    exit $status\nfi\n\n# Start server\nnode server.js\n"
  },
  {
    "path": "src/app/(dashboard)/recipes/[id]/loading.tsx",
    "content": "import { Skeleton } from \"~/components/ui/skeleton\"\nimport { DashboardShell } from \"~/components/shell\"\n\nexport default function DashboardLoading() {\n  return (\n    <DashboardShell>\n      <Skeleton className=\"h-16\" />\n      <div className=\"flex flex-col gap-2\">\n        <Skeleton className=\"h-8\" />\n        <Skeleton className=\"h-8\" />\n        <Skeleton className=\"h-8\" />\n        <Skeleton className=\"h-8\" />\n        <Skeleton className=\"h-8\" />\n      </div>\n    </DashboardShell>\n  )\n}\n"
  },
  {
    "path": "src/app/(dashboard)/recipes/[id]/page.tsx",
    "content": "import { unstable_noStore as noStore } from \"next/dist/server/web/spec-extension/unstable-no-store\"\n\nimport { env } from \"~/env\"\nimport { DashboardShell } from \"~/components/shell\"\nimport { RecipeForm } from \"~/app/(dashboard)/recipes/[id]/recipeForm\"\n\nexport default async function RecipePage({\n  params,\n}: {\n  params: { id: string }\n}) {\n  noStore()\n\n  const baseUrl = env.GROCY_BASE_URL\n\n  return (\n    <DashboardShell>\n      <RecipeForm recipeId={parseInt(params.id)} grocyBaseUrl={baseUrl} />\n    </DashboardShell>\n  )\n}\n"
  },
  {
    "path": "src/app/(dashboard)/recipes/[id]/recipeForm.tsx",
    "content": "\"use client\"\n\nimport Link from \"next/link\"\nimport { useRouter } from \"next/navigation\"\nimport { zodResolver } from \"@hookform/resolvers/zod\"\nimport {\n  CreateRecipeInGrocyCommand,\n  CreateRecipeInGrocyCommandSchema,\n} from \"~/server/api/modules/grocy/procedures/createRecipeInGrocySchema\"\nimport { api } from \"~/trpc/react\"\nimport { RouterOutputs } from \"~/trpc/shared\"\nimport { Controller, FormProvider, useForm } from \"react-hook-form\"\nimport { toast } from \"sonner\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"~/components/ui/form\"\nimport { Input } from \"~/components/ui/input\"\nimport { IngredientTable } from \"~/components/ingredient-table\"\nimport { RecipeTitleInput } from \"~/components/recipe-title-input\"\n\ntype RecipeFormProps = {\n  recipeId: number\n  grocyBaseUrl: string\n}\n\nexport function RecipeForm({ recipeId, grocyBaseUrl }: RecipeFormProps) {\n  const { data: recipe } = api.recipe.get.useQuery({\n    id: recipeId,\n  })\n\n  return (\n    recipe && <RecipeFormInner recipe={recipe} grocyBaseUrl={grocyBaseUrl} />\n  )\n}\n\ntype RecipeWithIngredients = RouterOutputs[\"recipe\"][\"get\"]\n\nfunction RecipeFormInner({\n  recipe,\n  grocyBaseUrl,\n}: {\n  recipe: NonNullable<RecipeWithIngredients>\n  grocyBaseUrl?: string\n}) {\n  const form = useForm<CreateRecipeInGrocyCommand>({\n    resolver: zodResolver(CreateRecipeInGrocyCommandSchema),\n    defaultValues: {\n      ingredients: recipe.ingredients.map((a) => {\n        const amount = /\\d+/g.exec(a.scrapedName)\n        return {\n          scrapedName: a.scrapedName,\n          amount: amount ? parseInt(amount[0]) : undefined,\n          ignored: false as const,\n        }\n      }),\n      recipeName: recipe.name,\n      method: recipe.steps ?? undefined,\n      imageUrl: recipe.imageUrl ?? undefined,\n      recipeBuddyRecipeId: recipe.id,\n      servings: recipe.servings ?? undefined,\n    },\n  })\n\n  const { push } = useRouter()\n\n  const { mutate, isLoading: mutLoading } = api.grocy.createRecipe.useMutation({\n    onSuccess: () => {\n      toast(\"Recipe created\")\n      push(\"/recipes\")\n    },\n  })\n\n  const onSubmit = (a: CreateRecipeInGrocyCommand) => mutate(a)\n\n  return (\n    <FormProvider {...form}>\n      <form onSubmit={form.handleSubmit(onSubmit)}>\n        <input hidden {...form.register(\"recipeBuddyRecipeId\")} />\n        <div className=\"flex flex-col gap-2\">\n          <Controller\n            render={({ field }) => (\n              <RecipeTitleInput value={field.value} onChange={field.onChange} />\n            )}\n            name=\"recipeName\"\n            control={form.control}\n          />\n          <FormField\n            render={({ field }) => (\n              <FormItem className=\"flex items-center gap-2\">\n                <FormLabel>Servings</FormLabel>\n                <FormControl>\n                  <Input className=\"max-w-[70px]\" type=\"number\" {...field} />\n                </FormControl>\n                <FormMessage />\n              </FormItem>\n            )}\n            name=\"servings\"\n            control={form.control}\n          />\n          <Link\n            href={recipe.url}\n            className=\"pl-1 text-lg text-muted-foreground\"\n            target=\"_blank\"\n          >\n            View Original\n          </Link>\n        </div>\n        <div className=\"flex flex-col gap-2\">\n          <IngredientTable grocyBaseUrl={grocyBaseUrl ?? \"\"} />\n          <Button type=\"submit\" isLoading={mutLoading} className=\"self-end\">\n            Create Recipe\n          </Button>\n        </div>\n      </form>\n    </FormProvider>\n  )\n}\n"
  },
  {
    "path": "src/app/(dashboard)/recipes/layout.tsx",
    "content": "import { ReactNode } from \"react\"\n\nexport default function Layout({ children }: { children: ReactNode }) {\n  return (\n    <div className=\"container flex-1 gap-12 md:grid-cols-[200px_1fr]\">\n      <main className=\"flex w-full flex-1 flex-col overflow-hidden\">\n        {children}\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/app/(dashboard)/recipes/loading.tsx",
    "content": "import { CardSkeleton } from \"~/components/card-skeleton\"\nimport { DashboardHeader } from \"~/components/header\"\nimport { NewRecipeDialog } from \"~/components/new-recipe-dialog\"\nimport { DashboardShell } from \"~/components/shell\"\n\nexport default function DashboardLoading() {\n  return (\n    <DashboardShell>\n      <DashboardHeader heading=\"Recipes\" text=\"Add and manage recipes.\">\n        <NewRecipeDialog />\n      </DashboardHeader>\n      <div className=\"grid grid-cols-3 gap-4\">\n        <CardSkeleton />\n        <CardSkeleton />\n        <CardSkeleton />\n        <CardSkeleton />\n        <CardSkeleton />\n        <CardSkeleton />\n      </div>\n    </DashboardShell>\n  )\n}\n"
  },
  {
    "path": "src/app/(dashboard)/recipes/page.tsx",
    "content": "\"use client\"\n\nimport { api } from \"~/trpc/react\"\n\nimport { EmptyPlaceholder } from \"~/components/empty-placeholder\"\nimport { DashboardHeader } from \"~/components/header\"\nimport { NewRecipeDialog } from \"~/components/new-recipe-dialog\"\nimport { RecipeCard } from \"~/components/recipe-card\"\nimport { DashboardShell } from \"~/components/shell\"\n\nexport default function DashboardPage() {\n  const { data: recipes } = api.recipe.list.useQuery()\n\n  return (\n    <DashboardShell>\n      <DashboardHeader heading=\"Recipes\" text=\"Add and manage recipes.\">\n        <NewRecipeDialog />\n      </DashboardHeader>\n      {recipes && recipes.length > 0 ? (\n        <div className=\"grid grid-cols-3 gap-4\">\n          {recipes.map((a) => (\n            <RecipeCard key={a.id} recipe={a} />\n          ))}\n        </div>\n      ) : (\n        <NoRecipesPlaceholder />\n      )}\n    </DashboardShell>\n  )\n}\n\nconst NoRecipesPlaceholder = () => (\n  <EmptyPlaceholder>\n    <EmptyPlaceholder.Icon name=\"post\" />\n    <EmptyPlaceholder.Title>No recipes added</EmptyPlaceholder.Title>\n    <EmptyPlaceholder.Description>\n      You haven&apos;t added any recipes yet. Why not add one?\n    </EmptyPlaceholder.Description>\n    <NewRecipeDialog variant=\"outline\" />\n  </EmptyPlaceholder>\n)\n"
  },
  {
    "path": "src/app/(dashboard)/settings/layout.tsx",
    "content": "import { ReactNode } from \"react\"\n\nexport default function Layout({ children }: { children: ReactNode }) {\n  return (\n    <div className=\"container flex-1 gap-12 md:grid-cols-[200px_1fr]\">\n      <main className=\"flex w-full flex-1 flex-col overflow-hidden\">\n        {children}\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/app/(dashboard)/settings/loading.tsx",
    "content": "import { CardSkeleton } from \"~/components/card-skeleton\"\nimport { DashboardHeader } from \"~/components/header\"\nimport { DashboardShell } from \"~/components/shell\"\n\nexport default function DashboardSettingsLoading() {\n  return (\n    <DashboardShell>\n      <DashboardHeader\n        heading=\"Settings\"\n        text=\"Manage account and website settings.\"\n      />\n      <div className=\"grid gap-10\">\n        <CardSkeleton />\n      </div>\n    </DashboardShell>\n  )\n}\n"
  },
  {
    "path": "src/app/(dashboard)/settings/page.tsx",
    "content": "import { redirect } from \"next/navigation\"\nimport { authOptions } from \"~/server/auth\"\n\nimport { getCurrentUser } from \"~/lib/session\"\nimport { GrocyStatus } from \"~/components/grocy-status\"\nimport { DashboardHeader } from \"~/components/header\"\nimport { DashboardShell } from \"~/components/shell\"\nimport { UserTable } from \"~/components/user-table\"\n\nexport const metadata = {\n  title: \"Settings\",\n  description: \"Manage account and website settings.\",\n}\n\nexport default async function SettingsPage() {\n  const user = await getCurrentUser()\n\n  if (!user) {\n    redirect(authOptions?.pages?.signIn || \"/login\")\n  }\n\n  return (\n    <DashboardShell>\n      <DashboardHeader heading=\"Settings\" />\n      <div className=\"grid gap-10\">\n        <GrocyStatus />\n        <UserTable />\n      </div>\n    </DashboardShell>\n  )\n}\n"
  },
  {
    "path": "src/app/(setup)/setup/page.tsx",
    "content": "\"use client\"\n\nimport { useEffect } from \"react\"\nimport { useRouter } from \"next/navigation\"\nimport { zodResolver } from \"@hookform/resolvers/zod\"\nimport {\n  CreateUser,\n  CreateUserSchema,\n} from \"~/server/api/modules/users/procedures/createUserSchema\"\nimport { api } from \"~/trpc/react\"\nimport { useForm } from \"react-hook-form\"\n\nimport { ROUTES } from \"~/lib/routes\"\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Card,\n  CardContent,\n  CardFooter,\n  CardHeader,\n  CardTitle,\n} from \"~/components/ui/card\"\nimport {\n  Form,\n  FormControl,\n  FormDescription,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"~/components/ui/form\"\nimport { Input } from \"~/components/ui/input\"\n\nexport default function Page() {\n  const form = useForm<CreateUser>({\n    resolver: zodResolver(CreateUserSchema),\n  })\n\n  const utils = api.useContext()\n\n  const { mutate, isLoading } = api.users.setupUser.useMutation({\n    onSuccess: () => {\n      utils.users.checkIsSetup.invalidate()\n    },\n  })\n\n  const { data } = api.users.checkIsSetup.useQuery()\n\n  const { push } = useRouter()\n\n  useEffect(() => {\n    if (data) {\n      push(ROUTES.recipes.root)\n    }\n  }, [data])\n\n  return (\n    <div className=\"flex flex-row items-center justify-center\">\n      <Card>\n        <CardHeader>\n          <CardTitle>Setup User</CardTitle>\n        </CardHeader>\n        <CardContent>\n          <Form {...form}>\n            <form id=\"setupUser\" onSubmit={form.handleSubmit((a) => mutate(a))}>\n              <FormField\n                render={({ field }) => (\n                  <FormItem>\n                    <FormLabel>Name</FormLabel>\n                    <FormControl>\n                      <Input autoComplete=\"off\" {...field} />\n                    </FormControl>\n                    <FormDescription>The user&apos;s full name</FormDescription>\n                    <FormMessage />\n                  </FormItem>\n                )}\n                name=\"name\"\n                control={form.control}\n              />\n              <FormField\n                render={({ field }) => (\n                  <FormItem>\n                    <FormLabel>Username</FormLabel>\n                    <FormControl>\n                      <Input autoComplete=\"off\" {...field} />\n                    </FormControl>\n                    <FormDescription>\n                      The username that will be used to log in\n                    </FormDescription>\n                    <FormMessage />\n                  </FormItem>\n                )}\n                name=\"username\"\n                control={form.control}\n              />\n              <FormField\n                render={({ field }) => (\n                  <FormItem>\n                    <FormLabel>Password</FormLabel>\n                    <FormControl>\n                      <Input\n                        type=\"password\"\n                        autoComplete=\"new-password\"\n                        {...field}\n                      />\n                    </FormControl>\n                    <FormDescription>The user&apos;s password</FormDescription>\n                    <FormMessage />\n                  </FormItem>\n                )}\n                name=\"password\"\n                control={form.control}\n              />\n            </form>\n          </Form>\n        </CardContent>\n        <CardFooter>\n          <Button type=\"submit\" form=\"setupUser\" disabled={isLoading}>\n            Create User\n          </Button>\n        </CardFooter>\n      </Card>\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/app/api/auth/[...nextauth]/route.ts",
    "content": "import { authOptions } from \"~/server/auth\"\nimport NextAuth from \"next-auth\"\n\nconst handler = NextAuth(authOptions)\nexport { handler as GET, handler as POST }\n"
  },
  {
    "path": "src/app/api/trpc/[trpc]/route.ts",
    "content": "import { type NextRequest } from \"next/server\"\nimport { fetchRequestHandler } from \"@trpc/server/adapters/fetch\"\nimport { appRouter } from \"~/server/api/root\"\nimport { createTRPCContext } from \"~/server/api/trpc\"\n\nimport { env } from \"~/env\"\n\n/**\n * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when\n * handling a HTTP request (e.g. when you make requests from Client Components).\n */\nconst createContext = async (req: NextRequest) => {\n  return createTRPCContext({\n    headers: req.headers,\n  })\n}\n\nconst handler = (req: NextRequest) =>\n  fetchRequestHandler({\n    endpoint: \"/api/trpc\",\n    req,\n    router: appRouter,\n    createContext: () => createContext(req),\n    onError:\n      env.NODE_ENV === \"development\"\n        ? ({ path, error }) => {\n            console.error(\n              `❌ tRPC failed on ${path ?? \"<no-path>\"}: ${error.message}`\n            )\n          }\n        : undefined,\n  })\n\nexport { handler as GET, handler as POST }\n"
  },
  {
    "path": "src/app/layout.tsx",
    "content": "import \"~/styles/globals.css\"\n\nimport { Inter } from \"next/font/google\"\nimport { cookies } from \"next/headers\"\nimport { checkIsSetup } from \"~/server/api/modules/users/service/checkIsSetup\"\nimport { TRPCReactProvider } from \"~/trpc/react\"\n\nimport { dashboardConfig } from \"~/config/dashboard\"\nimport { getCurrentUser } from \"~/lib/session\"\nimport { cn } from \"~/lib/utils\"\nimport { Toaster } from \"~/components/ui/sonner\"\nimport { MainNav } from \"~/components/main-nav\"\nimport { SignInButton } from \"~/components/sign-in-button\"\nimport { SiteFooter } from \"~/components/site-footer\"\nimport { ThemeProvider } from \"~/components/theme-provider\"\nimport { UserAccountNav } from \"~/components/user-account-nav\"\n\nconst inter = Inter({\n  subsets: [\"latin\"],\n  variable: \"--font-sans\",\n})\n\nexport const metadata = {\n  title: \"Recipe Buddy\",\n  description: \"Recipe Buddy\",\n  icons: [{ rel: \"icon\", url: \"/favicon.ico\" }],\n}\n\nexport default async function RootLayout({\n  children,\n}: {\n  children: React.ReactNode\n}) {\n  const user = await getCurrentUser()\n\n  return (\n    <html lang=\"en\">\n      <body\n        className={cn(\n          \"min-h-screen bg-background font-sans antialiased\",\n          inter.variable\n        )}\n      >\n        <TRPCReactProvider cookies={cookies().toString()}>\n          <ThemeProvider attribute=\"class\" defaultTheme=\"system\" enableSystem>\n            <div className=\"flex min-h-screen flex-col space-y-6\">\n              <header className=\"sticky top-0 z-40 border-b bg-background\">\n                <div className=\"container flex h-16 items-center justify-between py-4\">\n                  <MainNav items={user ? dashboardConfig.mainNav : []} />\n                  {user && (\n                    <UserAccountNav\n                      user={{\n                        name: user?.name,\n                        username: user?.username,\n                      }}\n                    />\n                  )}\n                </div>\n              </header>\n              {user ? (\n                children\n              ) : (await checkIsSetup()) ? (\n                <div className=\"flex items-center justify-center\">\n                  <SignInButton />\n                </div>\n              ) : (\n                children\n              )}\n              <Toaster />\n            </div>\n            <SiteFooter />\n          </ThemeProvider>\n        </TRPCReactProvider>\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "src/app/page.tsx",
    "content": "import { redirect } from \"next/navigation\"\nimport { checkIsSetup } from \"~/server/api/modules/users/service/checkIsSetup\"\nimport { getServerAuthSession } from \"~/server/auth\"\n\nimport { ROUTES } from \"~/lib/routes\"\n\nexport default async function Home() {\n  const session = await getServerAuthSession()\n\n  const isSetup = await checkIsSetup()\n\n  if (session) {\n    redirect(ROUTES.recipes.root)\n  } else if (!isSetup) {\n    redirect(ROUTES.setup)\n  }\n}\n"
  },
  {
    "path": "src/components/card-skeleton.tsx",
    "content": "import { Card, CardContent, CardFooter, CardHeader } from \"~/components/ui/card\"\nimport { Skeleton } from \"~/components/ui/skeleton\"\n\nexport function CardSkeleton() {\n  return (\n    <Card>\n      <CardHeader className=\"gap-2\">\n        <Skeleton className=\"h-5 w-1/5\" />\n        <Skeleton className=\"h-4 w-4/5\" />\n      </CardHeader>\n      <CardContent className=\"h-10\" />\n      <CardFooter>\n        <Skeleton className=\"h-8 w-[120px]\" />\n      </CardFooter>\n    </Card>\n  )\n}\n"
  },
  {
    "path": "src/components/delete-recipe-button.tsx",
    "content": "\"use client\"\n\nimport { api } from \"~/trpc/react\"\n\nimport { Button } from \"~/components/ui/button\"\n\ntype DeleteRecipeButtonProps = {\n  recipeId: number\n}\n\nexport function DeleteRecipeButton({ recipeId }: DeleteRecipeButtonProps) {\n  const utils = api.useUtils()\n  const { mutate, isLoading } = api.recipe.delete.useMutation({\n    onSuccess: () => utils.recipe.list.invalidate(),\n  })\n\n  const handleDelete = () => {\n    mutate({ recipeId })\n  }\n\n  return (\n    <Button variant=\"destructive\" onClick={handleDelete} isLoading={isLoading}>\n      Delete\n    </Button>\n  )\n}\n"
  },
  {
    "path": "src/components/empty-placeholder.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"~/lib/utils\"\nimport { Icons } from \"~/components/icons\"\n\ninterface EmptyPlaceholderProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport function EmptyPlaceholder({\n  className,\n  children,\n  ...props\n}: EmptyPlaceholderProps) {\n  return (\n    <div\n      className={cn(\n        \"flex min-h-[400px] flex-col items-center justify-center rounded-md border border-dashed p-8 text-center animate-in fade-in-50\",\n        className\n      )}\n      {...props}\n    >\n      <div className=\"mx-auto flex max-w-[420px] flex-col items-center justify-center text-center\">\n        {children}\n      </div>\n    </div>\n  )\n}\n\ninterface EmptyPlaceholderIconProps\n  extends Partial<React.SVGProps<SVGSVGElement>> {\n  name: keyof typeof Icons\n}\n\nEmptyPlaceholder.Icon = function EmptyPlaceHolderIcon({\n  name,\n  className,\n  ...props\n}: EmptyPlaceholderIconProps) {\n  const Icon = Icons[name]\n\n  if (!Icon) {\n    return null\n  }\n\n  return (\n    <div className=\"flex size-20 items-center justify-center rounded-full bg-muted\">\n      <Icon className={cn(\"size-10\", className)} {...props} />\n    </div>\n  )\n}\n\ninterface EmptyPlacholderTitleProps\n  extends React.HTMLAttributes<HTMLHeadingElement> {}\n\nEmptyPlaceholder.Title = function EmptyPlaceholderTitle({\n  className,\n  ...props\n}: EmptyPlacholderTitleProps) {\n  return (\n    <h2 className={cn(\"mt-6 text-xl font-semibold\", className)} {...props} />\n  )\n}\n\ninterface EmptyPlacholderDescriptionProps\n  extends React.HTMLAttributes<HTMLParagraphElement> {}\n\nEmptyPlaceholder.Description = function EmptyPlaceholderDescription({\n  className,\n  ...props\n}: EmptyPlacholderDescriptionProps) {\n  return (\n    <p\n      className={cn(\n        \"mb-8 mt-2 text-center text-sm font-normal leading-6 text-muted-foreground\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n"
  },
  {
    "path": "src/components/grocy-product-combobox.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { api } from \"~/trpc/react\"\nimport { ChevronsUpDown, PlusCircleIcon } from \"lucide-react\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Command,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n  CommandSeparator,\n} from \"~/components/ui/command\"\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"~/components/ui/popover\"\n\ntype GrocyProductComboboxProps = {\n  productName: string\n  disabled?: boolean\n  value: string\n  setValue: (newValue: string) => void\n  baseUrl: string\n}\n\nexport function GrocyProductCombobox({\n  productName,\n  disabled,\n  value,\n  setValue,\n  baseUrl,\n}: GrocyProductComboboxProps) {\n  const [open, setOpen] = React.useState(false)\n\n  const utils = api.useContext()\n\n  const { data } = api.grocy.getProducts.useQuery()\n\n  const newProductSlug = `/product/new?closeAfterCreation&flow=InplaceNewProductWithName&name=${productName}`\n\n  const onCreateNewProduct = () => {\n    window.addEventListener(\"visibilitychange\", onRefocusAfterCreateProduct)\n    window.open(`${baseUrl}${newProductSlug}`)\n  }\n\n  const onRefocusAfterCreateProduct = async () => {\n    if (document.visibilityState === \"visible\") {\n      await utils.grocy.getProducts.invalidate()\n      await utils.grocy.getProducts.refetch()\n\n      const prods = await utils.grocy.getProducts.ensureData()\n\n      const [highestProd] = prods.sort(\n        (a, b) => parseInt(b.id) - parseInt(a.id)\n      )\n\n      console.log(\"gighest prod\")\n      console.log(highestProd)\n\n      if (highestProd) {\n        setValue(highestProd.id)\n      }\n\n      window.removeEventListener(\n        \"visibilitychange\",\n        onRefocusAfterCreateProduct\n      )\n    }\n  }\n\n  return (\n    data && (\n      <Popover open={open} onOpenChange={setOpen}>\n        <PopoverTrigger asChild>\n          <Button\n            variant=\"outline\"\n            role=\"combobox\"\n            aria-expanded={open}\n            className=\"w-[200px] justify-between\"\n            disabled={disabled}\n          >\n            <div className=\"overflow-x-clip text-ellipsis\">\n              {value\n                ? data.find((product) => product.id === value)?.name\n                : \"Select product...\"}\n            </div>\n            <ChevronsUpDown className=\"ml-2 size-4 shrink-0 opacity-50\" />\n          </Button>\n        </PopoverTrigger>\n        <PopoverContent className=\"w-[200px] p-0\">\n          <Command>\n            <CommandInput placeholder=\"Search products...\" />\n            <CommandList>\n              <CommandEmpty>No product found</CommandEmpty>\n              <CommandGroup>\n                <CommandItem value=\"add\" onSelect={onCreateNewProduct}>\n                  <div className=\"flex items-center gap-2\">\n                    <PlusCircleIcon className=\"size-4 fill-black text-white\" />\n                    <p>Add Product</p>\n                  </div>\n                </CommandItem>\n              </CommandGroup>\n              <CommandSeparator />\n              <CommandGroup className=\"max-h-52 overflow-y-scroll\">\n                {data.map((product) => (\n                  <CommandItem\n                    key={product.id}\n                    value={product.name}\n                    onSelect={(currentValue) => {\n                      setValue(currentValue === product.id ? \"\" : product.id)\n                      setOpen(false)\n                    }}\n                  >\n                    {product.name}\n                  </CommandItem>\n                ))}\n              </CommandGroup>\n            </CommandList>\n          </Command>\n        </PopoverContent>\n      </Popover>\n    )\n  )\n}\n"
  },
  {
    "path": "src/components/grocy-status.tsx",
    "content": "\"use client\"\n\nimport { api } from \"~/trpc/react\"\nimport { CheckCircle } from \"lucide-react\"\n\nimport { Alert, AlertDescription, AlertTitle } from \"~/components/ui/alert\"\nimport { Skeleton } from \"~/components/ui/skeleton\"\n\nexport const GrocyStatus = () => {\n  const { data, isLoading } = api.grocy.checkConnection.useQuery()\n\n  return (\n    <>\n      {data && data.success ? (\n        <Alert>\n          <CheckCircle className=\"size-4\" />\n          <AlertTitle>Connected to Grocy</AlertTitle>\n          <AlertDescription>\n            Connected to Grocy v{data.data.grocy_version.Version}\n          </AlertDescription>\n        </Alert>\n      ) : isLoading ? (\n        <Alert className=\"pl-10\">\n          <AlertTitle>\n            <Skeleton className=\"h-5 w-40\" />\n          </AlertTitle>\n          <AlertDescription>\n            <Skeleton className=\"h-4 w-80\" />\n          </AlertDescription>\n        </Alert>\n      ) : (\n        <Alert>\n          <CheckCircle className=\"size-4\" />\n          <AlertTitle>Not connected to Grocy</AlertTitle>\n          <AlertDescription>\n            Unable to connect to Grocy - check your URL and API key\n          </AlertDescription>\n        </Alert>\n      )}\n    </>\n  )\n}\n"
  },
  {
    "path": "src/components/grocy-unit-combobox.tsx",
    "content": "import * as React from \"react\"\nimport { api } from \"~/trpc/react\"\nimport { ChevronsUpDown } from \"lucide-react\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Command,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n} from \"~/components/ui/command\"\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"~/components/ui/popover\"\n\nexport function GrocyUnitCombobox({\n  disabled,\n  value,\n  setValue,\n}: {\n  disabled?: boolean\n  value: string\n  setValue: (newValue: string) => void\n}) {\n  const [open, setOpen] = React.useState(false)\n\n  const { data } = api.grocy.getQuantityUnits.useQuery()\n\n  return (\n    data && (\n      <Popover open={open} onOpenChange={setOpen}>\n        <PopoverTrigger asChild>\n          <Button\n            variant=\"outline\"\n            role=\"combobox\"\n            aria-expanded={open}\n            className=\"w-[200px] justify-between\"\n            disabled={disabled}\n          >\n            {value\n              ? data.find((product) => product.id === value)?.name\n              : \"Select unit...\"}\n            <ChevronsUpDown className=\"ml-2 size-4 shrink-0 opacity-50\" />\n          </Button>\n        </PopoverTrigger>\n        <PopoverContent className=\"w-[200px] p-0\">\n          <Command>\n            <CommandInput placeholder=\"Search units...\" />\n            <CommandList>\n              <CommandEmpty>No product found.</CommandEmpty>\n              <CommandGroup className=\"max-h-52 overflow-y-scroll\">\n                {data.map((product) => (\n                  <CommandItem\n                    key={product.id}\n                    value={product.name}\n                    onSelect={(currentValue) => {\n                      setValue(currentValue === product.id ? \"\" : product.id)\n                      setOpen(false)\n                    }}\n                  >\n                    {product.name}\n                  </CommandItem>\n                ))}\n              </CommandGroup>\n            </CommandList>\n          </Command>\n        </PopoverContent>\n      </Popover>\n    )\n  )\n}\n"
  },
  {
    "path": "src/components/header.tsx",
    "content": "import { cn } from \"~/lib/utils\"\n\ninterface DashboardHeaderProps {\n  heading: string\n  text?: string\n  children?: React.ReactNode\n  className?: string\n}\n\nexport function DashboardHeader({\n  heading,\n  text,\n  children,\n  className,\n}: DashboardHeaderProps) {\n  return (\n    <div className={cn(\"flex items-center justify-between px-2\", className)}>\n      <div className=\"grid gap-1\">\n        <h1 className=\"font-heading text-3xl md:text-4xl\">{heading}</h1>\n        {text && <p className=\"text-lg text-muted-foreground\">{text}</p>}\n      </div>\n      {children}\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/components/icons.tsx",
    "content": "import {\n  AlertTriangle,\n  ArrowRight,\n  Check,\n  ChevronLeft,\n  ChevronRight,\n  CookingPot,\n  CreditCard,\n  File,\n  FileText,\n  HelpCircle,\n  Image,\n  Laptop,\n  Loader2,\n  LucideProps,\n  Moon,\n  MoreVertical,\n  Pizza,\n  Plus,\n  Settings,\n  SunMedium,\n  Trash,\n  Twitter,\n  User,\n  X,\n} from \"lucide-react\"\n\nexport const Icons = {\n  logo: CookingPot,\n  close: X,\n  spinner: Loader2,\n  chevronLeft: ChevronLeft,\n  chevronRight: ChevronRight,\n  trash: Trash,\n  post: FileText,\n  page: File,\n  media: Image,\n  settings: Settings,\n  billing: CreditCard,\n  ellipsis: MoreVertical,\n  add: Plus,\n  warning: AlertTriangle,\n  user: User,\n  arrowRight: ArrowRight,\n  help: HelpCircle,\n  pizza: Pizza,\n  sun: SunMedium,\n  moon: Moon,\n  laptop: Laptop,\n  gitHub: ({ ...props }: LucideProps) => (\n    <svg\n      aria-hidden=\"true\"\n      focusable=\"false\"\n      data-prefix=\"fab\"\n      data-icon=\"github\"\n      role=\"img\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 496 512\"\n      {...props}\n    >\n      <path\n        fill=\"currentColor\"\n        d=\"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z\"\n      ></path>\n    </svg>\n  ),\n  twitter: Twitter,\n  check: Check,\n}\n"
  },
  {
    "path": "src/components/ingredient-group-combobox.tsx",
    "content": "import * as React from \"react\"\nimport { useState } from \"react\"\nimport { ChevronsUpDown, PlusCircleIcon } from \"lucide-react\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Command,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n  CommandSeparator,\n} from \"~/components/ui/command\"\nimport { InputProps } from \"~/components/ui/input\"\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"~/components/ui/popover\"\n\ninterface IngredientGroupComboboxProps extends InputProps {\n  setValue: (newValue: string) => void\n  groups: string[]\n  addGroup: (newGroup: string) => void\n}\n\nexport function IngredientGroupCombobox({\n  disabled,\n  value,\n  setValue,\n  groups,\n  addGroup,\n}: IngredientGroupComboboxProps) {\n  const [open, setOpen] = useState(false)\n\n  const onCreateNewGroup = (groupName: string) => {\n    if (groups.includes(groupName)) {\n      setValue(groupName)\n      setOpen(false)\n      return\n    }\n\n    addGroup(groupName)\n    setValue(groupName)\n    setOpen(false)\n  }\n\n  const [textVal, setTextVal] = useState(\"\")\n\n  return (\n    <Popover open={open} onOpenChange={setOpen}>\n      <PopoverTrigger asChild>\n        <Button\n          variant=\"outline\"\n          role=\"combobox\"\n          aria-expanded={open}\n          className=\"w-[200px] justify-between\"\n          disabled={disabled}\n        >\n          <div className=\"overflow-x-clip text-ellipsis\">\n            {value ?? \"Select group...\"}\n          </div>\n          <ChevronsUpDown className=\"ml-2 size-4 shrink-0 opacity-50\" />\n        </Button>\n      </PopoverTrigger>\n      <PopoverContent className=\"w-[200px] p-0\">\n        <Command>\n          <CommandInput\n            placeholder=\"Search groups...\"\n            value={textVal}\n            onValueChange={setTextVal}\n          />\n          <CommandList>\n            <CommandGroup forceMount>\n              <CommandItem\n                forceMount\n                value=\"e388b184-9b92-4969-a5e9-a7d25df8dc72\"\n                onSelect={() => onCreateNewGroup(textVal)}\n                disabled={textVal.length === 0 || groups.includes(textVal)}\n              >\n                <div className=\"flex items-center gap-2\">\n                  <PlusCircleIcon className=\"size-4 fill-black text-white\" />\n                  <p>Add {textVal}</p>\n                </div>\n              </CommandItem>\n            </CommandGroup>\n            <CommandSeparator />\n            <CommandGroup className=\"max-h-52 overflow-y-scroll\">\n              {groups.map((group) => (\n                <CommandItem\n                  key={group}\n                  value={group}\n                  onSelect={(val) => {\n                    setValue(val)\n                    setOpen(false)\n                  }}\n                >\n                  {group}\n                </CommandItem>\n              ))}\n            </CommandGroup>\n          </CommandList>\n        </Command>\n      </PopoverContent>\n    </Popover>\n  )\n}\n"
  },
  {
    "path": "src/components/ingredient-note-dialog.tsx",
    "content": "import { useState } from \"react\"\nimport { DialogBody } from \"next/dist/client/components/react-dev-overlay/internal/components/Dialog\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Dialog,\n  DialogContent,\n  DialogFooter,\n  DialogHeader,\n  DialogTrigger,\n} from \"~/components/ui/dialog\"\nimport { Textarea, TextareaProps } from \"~/components/ui/textarea\"\n\ninterface IngredientNoteDialogProps extends TextareaProps {}\n\nexport function IngredientNoteDialog({\n  children,\n  ...props\n}: IngredientNoteDialogProps) {\n  const [open, setOpen] = useState(false)\n\n  return (\n    <Dialog open={open} onOpenChange={setOpen}>\n      <DialogTrigger asChild>{children}</DialogTrigger>\n      <DialogContent>\n        <DialogHeader>Add note</DialogHeader>\n        <DialogBody>\n          <Textarea {...props} />\n        </DialogBody>\n        <DialogFooter>\n          <Button onClick={() => setOpen(false)}>Close</Button>\n        </DialogFooter>\n      </DialogContent>\n    </Dialog>\n  )\n}\n"
  },
  {
    "path": "src/components/ingredient-table.tsx",
    "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { CreateRecipeInGrocyCommand } from \"~/server/api/modules/grocy/procedures/createRecipeInGrocySchema\"\nimport { api } from \"~/trpc/react\"\nimport { SquarePen } from \"lucide-react\"\nimport {\n  Controller,\n  FormProvider,\n  useFieldArray,\n  useFormContext,\n} from \"react-hook-form\"\n\nimport { Button } from \"~/components/ui/button\"\nimport { FormField, FormMessage } from \"~/components/ui/form\"\nimport { Input } from \"~/components/ui/input\"\nimport {\n  Table,\n  TableBody,\n  TableCell,\n  TableHead,\n  TableHeader,\n  TableRow,\n} from \"~/components/ui/table\"\nimport { GrocyUnitCombobox } from \"~/components/grocy-unit-combobox\"\nimport { IngredientGroupCombobox } from \"~/components/ingredient-group-combobox\"\nimport { IngredientNoteDialog } from \"~/components/ingredient-note-dialog\"\n\nimport { GrocyProductCombobox } from \"./grocy-product-combobox\"\n\ntype IngredientTableProps = {\n  grocyBaseUrl: string\n}\n\nexport function IngredientTable({ grocyBaseUrl }: IngredientTableProps) {\n  const f = useFormContext<CreateRecipeInGrocyCommand>()\n\n  const [groups, setGroups] = useState<string[]>([])\n\n  const addGroup = (groupName: string) =>\n    setGroups((old) => [groupName, ...old])\n\n  const { fields } = useFieldArray<CreateRecipeInGrocyCommand>({\n    name: \"ingredients\",\n    control: f.control,\n  })\n\n  return (\n    <div className=\"flex flex-col\">\n      <Table>\n        <TableHeader>\n          <TableRow>\n            <TableHead>Name</TableHead>\n            <TableHead>Product</TableHead>\n            <TableHead>Amount</TableHead>\n            <TableHead>Unit</TableHead>\n            <TableHead>Group</TableHead>\n            <TableHead>Note</TableHead>\n            <TableHead>Ignore</TableHead>\n          </TableRow>\n        </TableHeader>\n        <TableBody>\n          <FormProvider {...f}>\n            {fields.map((a, i) => (\n              <IngredientTableRow\n                ingredientName={a.scrapedName}\n                key={a.id}\n                index={i}\n                grocyBaseUrl={grocyBaseUrl}\n                addGroup={addGroup}\n                groups={groups}\n                {...a}\n              />\n            ))}\n          </FormProvider>\n        </TableBody>\n      </Table>\n    </div>\n  )\n}\n\nconst IngredientTableRow = ({\n  ingredientName,\n  index,\n  grocyBaseUrl,\n  groups,\n  addGroup,\n}: {\n  ingredientName: string\n  index: number\n  grocyBaseUrl: string\n  groups: string[]\n  addGroup: (newGroup: string) => void\n}) => {\n  const f = useFormContext<CreateRecipeInGrocyCommand>()\n\n  const { data: products } = api.grocy.getProducts.useQuery()\n\n  const isRowIgnored = f.watch(`ingredients.${index}.ignored`)\n\n  return (\n    <TableRow>\n      <TableCell className={isRowIgnored ? \"line-through\" : \"\"}>\n        {ingredientName}\n      </TableCell>\n      <TableCell>\n        <FormField\n          render={({ field }) => (\n            <>\n              <GrocyProductCombobox\n                baseUrl={grocyBaseUrl}\n                productName={ingredientName}\n                disabled={isRowIgnored}\n                value={field.value}\n                setValue={(a) => {\n                  field.onChange(a)\n                  const prod = products\n                    ? products.find((b) => b.id === a)\n                    : undefined\n                  if (prod) {\n                    f.setValue(`ingredients.${index}.unitId`, prod.qu_id_stock)\n                  }\n                }}\n              />\n              <FormMessage />\n            </>\n          )}\n          name={`ingredients.${index}.productId`}\n          control={f.control}\n        />\n      </TableCell>\n      <TableCell>\n        <FormField\n          render={({ field }) => (\n            <>\n              <Input type=\"number\" disabled={isRowIgnored} {...field} />\n              <FormMessage />\n            </>\n          )}\n          name={`ingredients.${index}.amount`}\n          control={f.control}\n        />\n      </TableCell>\n      <TableCell>\n        <FormField\n          render={({ field }) => (\n            <>\n              <GrocyUnitCombobox\n                disabled={isRowIgnored}\n                value={field.value}\n                setValue={field.onChange}\n              />\n              <FormMessage />\n            </>\n          )}\n          name={`ingredients.${index}.unitId`}\n          control={f.control}\n        />\n      </TableCell>\n      <TableCell>\n        <FormField\n          render={({ field }) => (\n            <>\n              <IngredientGroupCombobox\n                disabled={isRowIgnored}\n                setValue={field.onChange}\n                groups={groups}\n                addGroup={addGroup}\n                value={field.value}\n              />\n              <FormMessage />\n            </>\n          )}\n          name={`ingredients.${index}.group`}\n          control={f.control}\n        />\n      </TableCell>\n      <TableCell>\n        <Controller\n          render={({ field }) => {\n            return (\n              <IngredientNoteDialog {...field}>\n                <Button\n                  size=\"icon\"\n                  variant=\"outline\"\n                  data-has-note={field.value && field.value.trim().length > 0}\n                  className=\"data-[has-note=true]:bg-green-200\"\n                >\n                  <SquarePen strokeWidth={1} className={\"size-4\"} />\n                </Button>\n              </IngredientNoteDialog>\n            )\n          }}\n          name={`ingredients.${index}.note`}\n          control={f.control}\n        />\n      </TableCell>\n      <TableCell>\n        <Controller\n          render={({ field }) => {\n            return (\n              <Button onClick={() => field.onChange(!field.value)}>\n                {field.value ? \"Unignore\" : \"Ignore\"}\n              </Button>\n            )\n          }}\n          name={`ingredients.${index}.ignored`}\n          control={f.control}\n        />\n      </TableCell>\n    </TableRow>\n  )\n}\n"
  },
  {
    "path": "src/components/main-nav.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport Link from \"next/link\"\nimport { useSelectedLayoutSegment } from \"next/navigation\"\nimport { MainNavItem } from \"~/types\"\n\nimport { siteConfig } from \"~/config/site\"\nimport { cn } from \"~/lib/utils\"\n\nimport { Icons } from \"./icons\"\nimport { MobileNav } from \"./mobile-nav\"\n\ninterface MainNavProps {\n  items?: MainNavItem[]\n  children?: React.ReactNode\n}\n\nexport function MainNav({ items, children }: MainNavProps) {\n  const segment = useSelectedLayoutSegment()\n  const [showMobileMenu, setShowMobileMenu] = React.useState<boolean>(false)\n\n  return (\n    <div className=\"flex gap-6 md:gap-10\">\n      <Link href=\"/\" className=\"hidden items-center space-x-2 md:flex\">\n        <Icons.logo />\n        <span className=\"hidden font-bold sm:inline-block\">\n          {siteConfig.name}\n        </span>\n      </Link>\n      {items?.length ? (\n        <nav className=\"hidden gap-6 md:flex\">\n          {items?.map((item) => (\n            <Link\n              key={item.href}\n              href={item.disabled ? \"#\" : item.href}\n              className={cn(\n                \"flex items-center text-lg font-medium transition-colors hover:text-foreground/80 sm:text-sm\",\n                item.href.startsWith(`/${segment}`)\n                  ? \"text-foreground\"\n                  : \"text-foreground/60\",\n                item.disabled && \"cursor-not-allowed opacity-80\"\n              )}\n            >\n              {item.title}\n            </Link>\n          ))}\n        </nav>\n      ) : null}\n      <button\n        className=\"flex items-center space-x-2 md:hidden\"\n        onClick={() => setShowMobileMenu(!showMobileMenu)}\n      >\n        {showMobileMenu ? <Icons.close /> : <Icons.logo />}\n        <span className=\"font-bold\">Menu</span>\n      </button>\n      {showMobileMenu && items && (\n        <MobileNav items={items}>{children}</MobileNav>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/components/mobile-nav.tsx",
    "content": "import * as React from \"react\"\nimport Link from \"next/link\"\nimport { MainNavItem } from \"~/types\"\n\nimport { siteConfig } from \"~/config/site\"\nimport { cn } from \"~/lib/utils\"\nimport { useLockBody } from \"~/hooks/use-lock-body\"\n\nimport { Icons } from \"./icons\"\n\ninterface MobileNavProps {\n  items: MainNavItem[]\n  children?: React.ReactNode\n}\n\nexport function MobileNav({ items, children }: MobileNavProps) {\n  useLockBody()\n\n  return (\n    <div\n      className={cn(\n        \"fixed inset-0 top-16 z-50 grid h-[calc(100vh-4rem)] grid-flow-row auto-rows-max overflow-auto p-6 pb-32 shadow-md animate-in slide-in-from-bottom-80 md:hidden\"\n      )}\n    >\n      <div className=\"relative z-20 grid gap-6 rounded-md bg-popover p-4 text-popover-foreground shadow-md\">\n        <Link href=\"/\" className=\"flex items-center space-x-2\">\n          <Icons.logo />\n          <span className=\"font-bold\">{siteConfig.name}</span>\n        </Link>\n        <nav className=\"grid grid-flow-row auto-rows-max text-sm\">\n          {items.map((item) => (\n            <Link\n              key={item.href}\n              href={item.disabled ? \"#\" : item.href}\n              className={cn(\n                \"flex w-full items-center rounded-md p-2 text-sm font-medium hover:underline\",\n                item.disabled && \"cursor-not-allowed opacity-60\"\n              )}\n            >\n              {item.title}\n            </Link>\n          ))}\n        </nav>\n        {children}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/components/mode-toggle.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { useTheme } from \"next-themes\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from \"~/components/ui/dropdown-menu\"\n\nimport { Icons } from \"./icons\"\n\nexport function ModeToggle() {\n  const { setTheme } = useTheme()\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger asChild>\n        <Button variant=\"ghost\" size=\"sm\" className=\"size-8 px-0\">\n          <Icons.sun className=\"rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0\" />\n          <Icons.moon className=\"absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100\" />\n          <span className=\"sr-only\">Toggle theme</span>\n        </Button>\n      </DropdownMenuTrigger>\n      <DropdownMenuContent align=\"end\">\n        <DropdownMenuItem onClick={() => setTheme(\"light\")}>\n          <Icons.sun className=\"mr-2 size-4\" />\n          <span>Light</span>\n        </DropdownMenuItem>\n        <DropdownMenuItem onClick={() => setTheme(\"dark\")}>\n          <Icons.moon className=\"mr-2 size-4\" />\n          <span>Dark</span>\n        </DropdownMenuItem>\n        <DropdownMenuItem onClick={() => setTheme(\"system\")}>\n          <Icons.laptop className=\"mr-2 size-4\" />\n          <span>System</span>\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  )\n}\n"
  },
  {
    "path": "src/components/new-recipe-dialog.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { useState } from \"react\"\nimport { DialogBody } from \"next/dist/client/components/react-dev-overlay/internal/components/Dialog\"\nimport { zodResolver } from \"@hookform/resolvers/zod\"\nimport {\n  ScrapeRecipe,\n  ScrapeRecipeSchema,\n} from \"~/server/api/modules/recipes/procedures/scrapeRecipeSchema\"\nimport { api } from \"~/trpc/react\"\nimport { useForm } from \"react-hook-form\"\n\nimport { cn } from \"~/lib/utils\"\nimport { Button, ButtonProps, buttonVariants } from \"~/components/ui/button\"\nimport {\n  Dialog,\n  DialogContent,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from \"~/components/ui/dialog\"\nimport {\n  Form,\n  FormControl,\n  FormDescription,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"~/components/ui/form\"\nimport { Input } from \"~/components/ui/input\"\nimport { Icons } from \"~/components/icons\"\n\ninterface NewRecipeDialogProps extends ButtonProps {}\nexport const NewRecipeDialog = ({\n  className,\n  variant,\n  ...props\n}: NewRecipeDialogProps) => {\n  const [open, setOpen] = useState(false)\n\n  const form = useForm<ScrapeRecipe>({\n    resolver: zodResolver(ScrapeRecipeSchema),\n  })\n\n  const utils = api.useContext()\n\n  const { mutate, isLoading } = api.recipe.scrape.useMutation({\n    onSuccess: () => {\n      utils.recipe.list.invalidate()\n      setOpen(false)\n    },\n  })\n\n  return (\n    <Dialog open={open} onOpenChange={setOpen}>\n      <DialogTrigger asChild>\n        <button\n          className={cn(\n            buttonVariants({ variant }),\n            {\n              \"cursor-not-allowed opacity-60\": isLoading,\n            },\n            className\n          )}\n          disabled={isLoading}\n          type=\"submit\"\n          {...props}\n        >\n          {isLoading ? (\n            <Icons.spinner className=\"mr-2 size-4 animate-spin\" />\n          ) : (\n            <Icons.add className=\"mr-2 size-4\" />\n          )}\n          Add recipe\n        </button>\n      </DialogTrigger>\n      <DialogContent>\n        <DialogHeader>\n          <DialogTitle>Add Recipe</DialogTitle>\n        </DialogHeader>\n        <DialogBody>\n          <Form {...form}>\n            <form id=\"addRecipe\" onSubmit={form.handleSubmit((a) => mutate(a))}>\n              <FormField\n                render={({ field }) => (\n                  <FormItem>\n                    <FormLabel>Name</FormLabel>\n                    <FormControl>\n                      <Input autoComplete=\"off\" {...field} />\n                    </FormControl>\n                    <FormDescription>\n                      The URL of the recipe to scrape\n                    </FormDescription>\n                    <FormMessage />\n                  </FormItem>\n                )}\n                name=\"url\"\n                control={form.control}\n              />\n            </form>\n          </Form>\n        </DialogBody>\n        <DialogFooter>\n          <Button disabled={isLoading} type=\"submit\" form=\"addRecipe\">\n            Add\n          </Button>\n        </DialogFooter>\n      </DialogContent>\n    </Dialog>\n  )\n}\n"
  },
  {
    "path": "src/components/new-user-dialog.tsx",
    "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { DialogBody } from \"next/dist/client/components/react-dev-overlay/internal/components/Dialog\"\nimport { zodResolver } from \"@hookform/resolvers/zod\"\nimport {\n  CreateUser,\n  CreateUserSchema,\n} from \"~/server/api/modules/users/procedures/createUserSchema\"\nimport { api } from \"~/trpc/react\"\nimport { useForm } from \"react-hook-form\"\nimport { toast } from \"sonner\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Dialog,\n  DialogContent,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from \"~/components/ui/dialog\"\nimport {\n  Form,\n  FormControl,\n  FormDescription,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from \"~/components/ui/form\"\nimport { Input } from \"~/components/ui/input\"\n\nexport const NewUserDialog = () => {\n  const [open, setOpen] = useState(false)\n\n  const form = useForm<CreateUser>({\n    resolver: zodResolver(CreateUserSchema),\n  })\n\n  const utils = api.useContext()\n\n  const { mutate, isLoading } = api.users.create.useMutation({\n    onMutate: (variables) => {\n      const prevData = utils.users.list.getData()\n      utils.users.list.setData(undefined, (old) =>\n        old\n          ? [\n              ...old,\n              {\n                name: variables.name,\n                username: variables.username,\n                id: 5000,\n              },\n            ]\n          : [{ name: variables.name, username: variables.username, id: 5000 }]\n      )\n\n      return { prevData }\n    },\n    onError(_err, _newPost, ctx) {\n      toast.error(\"Unable to create user\")\n      utils.users.list.setData(undefined, ctx?.prevData || [])\n    },\n    onSettled() {\n      setOpen(false)\n      utils.users.list.invalidate()\n    },\n  })\n\n  return (\n    <Dialog open={open} onOpenChange={setOpen}>\n      <DialogTrigger asChild>\n        <Button disabled={isLoading}>Add User</Button>\n      </DialogTrigger>\n      <DialogContent>\n        <DialogHeader>\n          <DialogTitle>Add User</DialogTitle>\n        </DialogHeader>\n        <DialogBody>\n          <Form {...form}>\n            <form id=\"addUser\" onSubmit={form.handleSubmit((a) => mutate(a))}>\n              <FormField\n                render={({ field }) => (\n                  <FormItem>\n                    <FormLabel>Name</FormLabel>\n                    <FormControl>\n                      <Input autoComplete=\"off\" {...field} />\n                    </FormControl>\n                    <FormDescription>The user&apos;s full name</FormDescription>\n                    <FormMessage />\n                  </FormItem>\n                )}\n                name=\"name\"\n                control={form.control}\n              />\n              <FormField\n                render={({ field }) => (\n                  <FormItem>\n                    <FormLabel>Username</FormLabel>\n                    <FormControl>\n                      <Input autoComplete=\"off\" {...field} />\n                    </FormControl>\n                    <FormDescription>\n                      The username that will be used to log in\n                    </FormDescription>\n                    <FormMessage />\n                  </FormItem>\n                )}\n                name=\"username\"\n                control={form.control}\n              />\n              <FormField\n                render={({ field }) => (\n                  <FormItem>\n                    <FormLabel>Password</FormLabel>\n                    <FormControl>\n                      <Input\n                        type=\"password\"\n                        autoComplete=\"new-password\"\n                        {...field}\n                      />\n                    </FormControl>\n                    <FormDescription>The user&apos;s password</FormDescription>\n                    <FormMessage />\n                  </FormItem>\n                )}\n                name=\"password\"\n                control={form.control}\n              />\n            </form>\n          </Form>\n        </DialogBody>\n        <DialogFooter>\n          <Button disabled={isLoading} type=\"submit\" form=\"addUser\">\n            Add\n          </Button>\n        </DialogFooter>\n      </DialogContent>\n    </Dialog>\n  )\n}\n"
  },
  {
    "path": "src/components/recipe-card.tsx",
    "content": "import Link from \"next/link\"\nimport { Recipe } from \"~/server/db/schema\"\n\nimport { ROUTES } from \"~/lib/routes\"\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Card,\n  CardFooter,\n  CardHeader,\n  CardImage,\n  CardTitle,\n} from \"~/components/ui/card\"\nimport { DeleteRecipeButton } from \"~/components/delete-recipe-button\"\n\ntype RecipeCardProps = {\n  recipe: Pick<Recipe, \"name\" | \"id\" | \"imageUrl\">\n}\n\nexport function RecipeCard({ recipe }: RecipeCardProps) {\n  return (\n    <Card>\n      {recipe.imageUrl && (\n        <CardImage\n          src={recipe.imageUrl}\n          alt={`An image of ${recipe.name}`}\n          className=\"h-24 object-cover\"\n        />\n      )}\n      <CardHeader className=\"gap-2\">\n        <CardTitle className=\"text-xl\">{recipe.name}</CardTitle>\n      </CardHeader>\n      <CardFooter className=\"justify-between\">\n        <DeleteRecipeButton recipeId={recipe.id} />\n        <Link href={ROUTES.recipes.details(recipe.id)}>\n          <Button>Add</Button>\n        </Link>\n      </CardFooter>\n    </Card>\n  )\n}\n"
  },
  {
    "path": "src/components/recipe-title-input.tsx",
    "content": "\"use client\"\n\nimport { cn } from \"~/lib/utils\"\nimport { Input, InputProps } from \"~/components/ui/input\"\n\ninterface RecipeTitleInputProps extends InputProps {}\n\nexport function RecipeTitleInput({\n  className,\n  ...props\n}: RecipeTitleInputProps) {\n  return (\n    <Input className={cn(\"py-6 text-3xl md:text-4xl\", className)} {...props} />\n  )\n}\n"
  },
  {
    "path": "src/components/shell.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"~/lib/utils\"\n\ninterface DashboardShellProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport function DashboardShell({\n  children,\n  className,\n  ...props\n}: DashboardShellProps) {\n  return (\n    <div className={cn(\"grid items-start gap-8\", className)} {...props}>\n      {children}\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/components/sign-in-button.tsx",
    "content": "\"use client\"\n\nimport { signIn } from \"next-auth/react\"\n\nimport { Button } from \"~/components/ui/button\"\n\nexport const SignInButton = () => (\n  <Button onClick={() => signIn()}>Sign in</Button>\n)\n"
  },
  {
    "path": "src/components/site-footer.tsx",
    "content": "import * as React from \"react\"\n\nimport { siteConfig } from \"~/config/site\"\nimport { cn } from \"~/lib/utils\"\nimport { ModeToggle } from \"~/components/mode-toggle\"\n\nimport { Icons } from \"./icons\"\n\nexport function SiteFooter({ className }: React.HTMLAttributes<HTMLElement>) {\n  return (\n    <footer className={cn(className)}>\n      <div className=\"container flex flex-col items-center justify-between gap-4 py-10 md:h-12 md:flex-row md:py-0\">\n        <div className=\"flex flex-col items-center gap-4 px-8 md:flex-row md:gap-2 md:px-0\">\n          <Icons.logo />\n          <p className=\"text-center text-sm leading-loose md:text-left\">\n            Built by{\" \"}\n            <a\n              href={siteConfig.links.twitter}\n              target=\"_blank\"\n              rel=\"noreferrer\"\n              className=\"font-medium underline underline-offset-4\"\n            >\n              @georgegebbett\n            </a>\n            . The source code is available on{\" \"}\n            <a\n              href={siteConfig.links.github}\n              target=\"_blank\"\n              rel=\"noreferrer\"\n              className=\"font-medium underline underline-offset-4\"\n            >\n              GitHub\n            </a>\n            .\n          </p>\n        </div>\n        <ModeToggle />\n      </div>\n    </footer>\n  )\n}\n"
  },
  {
    "path": "src/components/theme-provider.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider as NextThemesProvider } from \"next-themes\"\nimport { ThemeProviderProps } from \"next-themes/dist/types\"\n\nexport function ThemeProvider({ children, ...props }: ThemeProviderProps) {\n  return <NextThemesProvider {...props}>{children}</NextThemesProvider>\n}\n"
  },
  {
    "path": "src/components/ui/accordion.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\"\nimport { ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst Accordion = AccordionPrimitive.Root\n\nconst AccordionItem = React.forwardRef<\n  React.ElementRef<typeof AccordionPrimitive.Item>,\n  React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>\n>(({ className, ...props }, ref) => (\n  <AccordionPrimitive.Item\n    ref={ref}\n    className={cn(\"border-b\", className)}\n    {...props}\n  />\n))\nAccordionItem.displayName = \"AccordionItem\"\n\nconst AccordionTrigger = React.forwardRef<\n  React.ElementRef<typeof AccordionPrimitive.Trigger>,\n  React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n  <AccordionPrimitive.Header className=\"flex\">\n    <AccordionPrimitive.Trigger\n      ref={ref}\n      className={cn(\n        \"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <ChevronDown className=\"size-4 shrink-0 transition-transform duration-200\" />\n    </AccordionPrimitive.Trigger>\n  </AccordionPrimitive.Header>\n))\nAccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName\n\nconst AccordionContent = React.forwardRef<\n  React.ElementRef<typeof AccordionPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n  <AccordionPrimitive.Content\n    ref={ref}\n    className=\"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down\"\n    {...props}\n  >\n    <div className={cn(\"pb-4 pt-0\", className)}>{children}</div>\n  </AccordionPrimitive.Content>\n))\n\nAccordionContent.displayName = AccordionPrimitive.Content.displayName\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent }\n"
  },
  {
    "path": "src/components/ui/alert.tsx",
    "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst alertVariants = cva(\n  \"relative w-full rounded-lg border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-background text-foreground\",\n        destructive:\n          \"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nconst Alert = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n  <div\n    ref={ref}\n    role=\"alert\"\n    className={cn(alertVariants({ variant }), className)}\n    {...props}\n  />\n))\nAlert.displayName = \"Alert\"\n\nconst AlertTitle = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n  <h5\n    ref={ref}\n    className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n    {...props}\n  />\n))\nAlertTitle.displayName = \"AlertTitle\"\n\nconst AlertDescription = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n    {...props}\n  />\n))\nAlertDescription.displayName = \"AlertDescription\"\n\nexport { Alert, AlertTitle, AlertDescription }\n"
  },
  {
    "path": "src/components/ui/avatar.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst Avatar = React.forwardRef<\n  React.ElementRef<typeof AvatarPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ className, ...props }, ref) => (\n  <AvatarPrimitive.Root\n    ref={ref}\n    className={cn(\n      \"relative flex size-10 shrink-0 overflow-hidden rounded-full\",\n      className\n    )}\n    {...props}\n  />\n))\nAvatar.displayName = AvatarPrimitive.Root.displayName\n\nconst AvatarImage = React.forwardRef<\n  React.ElementRef<typeof AvatarPrimitive.Image>,\n  React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n  <AvatarPrimitive.Image\n    ref={ref}\n    className={cn(\"aspect-square size-full\", className)}\n    {...props}\n  />\n))\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nconst AvatarFallback = React.forwardRef<\n  React.ElementRef<typeof AvatarPrimitive.Fallback>,\n  React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n  <AvatarPrimitive.Fallback\n    ref={ref}\n    className={cn(\n      \"flex size-full items-center justify-center rounded-full bg-muted\",\n      className\n    )}\n    {...props}\n  />\n))\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarImage, AvatarFallback }\n"
  },
  {
    "path": "src/components/ui/button.tsx",
    "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { RefreshCw } from \"lucide-react\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst buttonVariants = cva(\n  \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n        destructive:\n          \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n        outline:\n          \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n        secondary:\n          \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n        ghost: \"hover:bg-accent hover:text-accent-foreground\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n      size: {\n        default: \"h-10 px-4 py-2\",\n        sm: \"h-9 rounded-md px-3\",\n        lg: \"h-11 rounded-md px-8\",\n        icon: \"size-10\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nexport interface ButtonProps\n  extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n    VariantProps<typeof buttonVariants> {\n  asChild?: boolean\n  isLoading?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n  (\n    {\n      className,\n      variant,\n      size,\n      asChild = false,\n      isLoading,\n      children,\n      disabled,\n      type = \"button\",\n      ...props\n    },\n    ref\n  ) => {\n    const Comp = asChild ? Slot : \"button\"\n    return (\n      <Comp\n        className={cn(buttonVariants({ variant, size, className }))}\n        ref={ref}\n        disabled={disabled || isLoading}\n        type={type}\n        {...props}\n      >\n        {isLoading ? (\n          <div className=\"flex items-center gap-2\">\n            <RefreshCw className=\"size-4 animate-spin\" />\n            {children}\n          </div>\n        ) : (\n          children\n        )}\n      </Comp>\n    )\n  }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n"
  },
  {
    "path": "src/components/ui/card.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst Card = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\n      \"rounded-lg border bg-card text-card-foreground shadow-sm\",\n      className\n    )}\n    {...props}\n  />\n))\nCard.displayName = \"Card\"\n\nconst CardHeader = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n    {...props}\n  />\n))\nCardHeader.displayName = \"CardHeader\"\n\nconst CardTitle = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n  <h3\n    ref={ref}\n    className={cn(\n      \"text-2xl font-semibold leading-none tracking-tight\",\n      className\n    )}\n    {...props}\n  />\n))\nCardTitle.displayName = \"CardTitle\"\n\nconst CardDescription = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n  <p\n    ref={ref}\n    className={cn(\"text-sm text-muted-foreground\", className)}\n    {...props}\n  />\n))\nCardDescription.displayName = \"CardDescription\"\n\nconst CardContent = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div ref={ref} className={cn(\"p-6 pt-0\", className)} {...props} />\n))\nCardContent.displayName = \"CardContent\"\n\nconst CardFooter = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"flex items-center p-6 pt-0\", className)}\n    {...props}\n  />\n))\nCardFooter.displayName = \"CardFooter\"\n\nconst CardImage = React.forwardRef<\n  HTMLImageElement,\n  React.ImgHTMLAttributes<HTMLImageElement>\n>(({ className, ...props }, ref) => (\n  <img ref={ref} className={cn(\"h-auto w-full\", className)} {...props} />\n))\nCardImage.displayName = \"CardImage\"\n\nexport {\n  Card,\n  CardHeader,\n  CardFooter,\n  CardTitle,\n  CardDescription,\n  CardContent,\n  CardImage,\n}\n"
  },
  {
    "path": "src/components/ui/command.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { type DialogProps } from \"@radix-ui/react-dialog\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { Search } from \"lucide-react\"\n\nimport { cn } from \"~/lib/utils\"\nimport { Dialog, DialogContent } from \"~/components/ui/dialog\"\n\nconst Command = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive\n    ref={ref}\n    className={cn(\n      \"flex size-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n      className\n    )}\n    {...props}\n  />\n))\nCommand.displayName = CommandPrimitive.displayName\n\ninterface CommandDialogProps extends DialogProps {}\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n  return (\n    <Dialog {...props}>\n      <DialogContent className=\"overflow-hidden p-0 shadow-lg\">\n        <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5\">\n          {children}\n        </Command>\n      </DialogContent>\n    </Dialog>\n  )\n}\n\nconst CommandInput = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Input>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n  <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n    <Search className=\"mr-2 size-4 shrink-0 opacity-50\" />\n    <CommandPrimitive.Input\n      ref={ref}\n      className={cn(\n        \"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n        className\n      )}\n      {...props}\n    />\n  </div>\n))\n\nCommandInput.displayName = CommandPrimitive.Input.displayName\n\nconst CommandList = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.List>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.List\n    ref={ref}\n    className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n    {...props}\n  />\n))\n\nCommandList.displayName = CommandPrimitive.List.displayName\n\nconst CommandEmpty = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Empty>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n  <CommandPrimitive.Empty\n    ref={ref}\n    className=\"py-6 text-center text-sm\"\n    {...props}\n  />\n))\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName\n\nconst CommandGroup = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Group>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Group\n    ref={ref}\n    className={cn(\n      \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n      className\n    )}\n    {...props}\n  />\n))\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName\n\nconst CommandSeparator = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Separator>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Separator\n    ref={ref}\n    className={cn(\"-mx-1 h-px bg-border\", className)}\n    {...props}\n  />\n))\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName\n\nconst CommandItem = React.forwardRef<\n  React.ElementRef<typeof CommandPrimitive.Item>,\n  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n  <CommandPrimitive.Item\n    ref={ref}\n    className={cn(\n      \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50\",\n      className\n    )}\n    {...props}\n  />\n))\n\nCommandItem.displayName = CommandPrimitive.Item.displayName\n\nconst CommandShortcut = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n  return (\n    <span\n      className={cn(\n        \"ml-auto text-xs tracking-widest text-muted-foreground\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\nCommandShortcut.displayName = \"CommandShortcut\"\n\nexport {\n  Command,\n  CommandDialog,\n  CommandInput,\n  CommandList,\n  CommandEmpty,\n  CommandGroup,\n  CommandItem,\n  CommandShortcut,\n  CommandSeparator,\n}\n"
  },
  {
    "path": "src/components/ui/dialog.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst Dialog = DialogPrimitive.Root\n\nconst DialogTrigger = DialogPrimitive.Trigger\n\nconst DialogPortal = DialogPrimitive.Portal\n\nconst DialogClose = DialogPrimitive.Close\n\nconst DialogOverlay = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Overlay>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Overlay\n    ref={ref}\n    className={cn(\n      \"fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n      className\n    )}\n    {...props}\n  />\n))\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName\n\nconst DialogContent = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n  <DialogPortal>\n    <DialogOverlay />\n    <DialogPrimitive.Content\n      ref={ref}\n      className={cn(\n        \"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n        <X className=\"size-4\" />\n        <span className=\"sr-only\">Close</span>\n      </DialogPrimitive.Close>\n    </DialogPrimitive.Content>\n  </DialogPortal>\n))\nDialogContent.displayName = DialogPrimitive.Content.displayName\n\nconst DialogHeader = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n  <div\n    className={cn(\n      \"flex flex-col space-y-1.5 text-center sm:text-left\",\n      className\n    )}\n    {...props}\n  />\n)\nDialogHeader.displayName = \"DialogHeader\"\n\nconst DialogFooter = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n  <div\n    className={cn(\n      \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n      className\n    )}\n    {...props}\n  />\n)\nDialogFooter.displayName = \"DialogFooter\"\n\nconst DialogTitle = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Title>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Title\n    ref={ref}\n    className={cn(\n      \"text-lg font-semibold leading-none tracking-tight\",\n      className\n    )}\n    {...props}\n  />\n))\nDialogTitle.displayName = DialogPrimitive.Title.displayName\n\nconst DialogDescription = React.forwardRef<\n  React.ElementRef<typeof DialogPrimitive.Description>,\n  React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n  <DialogPrimitive.Description\n    ref={ref}\n    className={cn(\"text-sm text-muted-foreground\", className)}\n    {...props}\n  />\n))\nDialogDescription.displayName = DialogPrimitive.Description.displayName\n\nexport {\n  Dialog,\n  DialogPortal,\n  DialogOverlay,\n  DialogClose,\n  DialogTrigger,\n  DialogContent,\n  DialogHeader,\n  DialogFooter,\n  DialogTitle,\n  DialogDescription,\n}\n"
  },
  {
    "path": "src/components/ui/dropdown-menu.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\"\nimport { Check, ChevronRight, Circle } from \"lucide-react\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst DropdownMenu = DropdownMenuPrimitive.Root\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n    inset?: boolean\n  }\n>(({ className, inset, children, ...props }, ref) => (\n  <DropdownMenuPrimitive.SubTrigger\n    ref={ref}\n    className={cn(\n      \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n      inset && \"pl-8\",\n      className\n    )}\n    {...props}\n  >\n    {children}\n    <ChevronRight className=\"ml-auto size-4\" />\n  </DropdownMenuPrimitive.SubTrigger>\n))\nDropdownMenuSubTrigger.displayName =\n  DropdownMenuPrimitive.SubTrigger.displayName\n\nconst DropdownMenuSubContent = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n  <DropdownMenuPrimitive.SubContent\n    ref={ref}\n    className={cn(\n      \"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n      className\n    )}\n    {...props}\n  />\n))\nDropdownMenuSubContent.displayName =\n  DropdownMenuPrimitive.SubContent.displayName\n\nconst DropdownMenuContent = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n  <DropdownMenuPrimitive.Portal>\n    <DropdownMenuPrimitive.Content\n      ref={ref}\n      sideOffset={sideOffset}\n      className={cn(\n        \"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n        className\n      )}\n      {...props}\n    />\n  </DropdownMenuPrimitive.Portal>\n))\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName\n\nconst DropdownMenuItem = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n    inset?: boolean\n  }\n>(({ className, inset, ...props }, ref) => (\n  <DropdownMenuPrimitive.Item\n    ref={ref}\n    className={cn(\n      \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n      inset && \"pl-8\",\n      className\n    )}\n    {...props}\n  />\n))\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n  <DropdownMenuPrimitive.CheckboxItem\n    ref={ref}\n    className={cn(\n      \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n      className\n    )}\n    checked={checked}\n    {...props}\n  >\n    <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n      <DropdownMenuPrimitive.ItemIndicator>\n        <Check className=\"size-4\" />\n      </DropdownMenuPrimitive.ItemIndicator>\n    </span>\n    {children}\n  </DropdownMenuPrimitive.CheckboxItem>\n))\nDropdownMenuCheckboxItem.displayName =\n  DropdownMenuPrimitive.CheckboxItem.displayName\n\nconst DropdownMenuRadioItem = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n  <DropdownMenuPrimitive.RadioItem\n    ref={ref}\n    className={cn(\n      \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n      className\n    )}\n    {...props}\n  >\n    <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n      <DropdownMenuPrimitive.ItemIndicator>\n        <Circle className=\"size-2 fill-current\" />\n      </DropdownMenuPrimitive.ItemIndicator>\n    </span>\n    {children}\n  </DropdownMenuPrimitive.RadioItem>\n))\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName\n\nconst DropdownMenuLabel = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n    inset?: boolean\n  }\n>(({ className, inset, ...props }, ref) => (\n  <DropdownMenuPrimitive.Label\n    ref={ref}\n    className={cn(\n      \"px-2 py-1.5 text-sm font-semibold\",\n      inset && \"pl-8\",\n      className\n    )}\n    {...props}\n  />\n))\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName\n\nconst DropdownMenuSeparator = React.forwardRef<\n  React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <DropdownMenuPrimitive.Separator\n    ref={ref}\n    className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n    {...props}\n  />\n))\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName\n\nconst DropdownMenuShortcut = ({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n  return (\n    <span\n      className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n      {...props}\n    />\n  )\n}\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\"\n\nexport {\n  DropdownMenu,\n  DropdownMenuTrigger,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuCheckboxItem,\n  DropdownMenuRadioItem,\n  DropdownMenuLabel,\n  DropdownMenuSeparator,\n  DropdownMenuShortcut,\n  DropdownMenuGroup,\n  DropdownMenuPortal,\n  DropdownMenuSub,\n  DropdownMenuSubContent,\n  DropdownMenuSubTrigger,\n  DropdownMenuRadioGroup,\n}\n"
  },
  {
    "path": "src/components/ui/form.tsx",
    "content": "import * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport {\n  Controller,\n  ControllerProps,\n  FieldPath,\n  FieldValues,\n  FormProvider,\n  useFormContext,\n} from \"react-hook-form\"\n\nimport { cn } from \"~/lib/utils\"\nimport { Label } from \"~/components/ui/label\"\n\nconst Form = FormProvider\n\ntype FormFieldContextValue<\n  TFieldValues extends FieldValues = FieldValues,\n  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n  name: TName\n}\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n  {} as FormFieldContextValue\n)\n\nconst FormField = <\n  TFieldValues extends FieldValues = FieldValues,\n  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n  ...props\n}: ControllerProps<TFieldValues, TName>) => {\n  return (\n    <FormFieldContext.Provider value={{ name: props.name }}>\n      <Controller {...props} />\n    </FormFieldContext.Provider>\n  )\n}\n\nconst useFormField = () => {\n  const fieldContext = React.useContext(FormFieldContext)\n  const itemContext = React.useContext(FormItemContext)\n  const { getFieldState, formState } = useFormContext()\n\n  const fieldState = getFieldState(fieldContext.name, formState)\n\n  if (!fieldContext) {\n    throw new Error(\"useFormField should be used within <FormField>\")\n  }\n\n  const { id } = itemContext\n\n  return {\n    id,\n    name: fieldContext.name,\n    formItemId: `${id}-form-item`,\n    formDescriptionId: `${id}-form-item-description`,\n    formMessageId: `${id}-form-item-message`,\n    ...fieldState,\n  }\n}\n\ntype FormItemContextValue = {\n  id: string\n}\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n  {} as FormItemContextValue\n)\n\nconst FormItem = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n  const id = React.useId()\n\n  return (\n    <FormItemContext.Provider value={{ id }}>\n      <div ref={ref} className={cn(\"space-y-2\", className)} {...props} />\n    </FormItemContext.Provider>\n  )\n})\nFormItem.displayName = \"FormItem\"\n\nconst FormLabel = React.forwardRef<\n  React.ElementRef<typeof LabelPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n  const { error, formItemId } = useFormField()\n\n  return (\n    <Label\n      ref={ref}\n      className={cn(error && \"text-destructive\", className)}\n      htmlFor={formItemId}\n      {...props}\n    />\n  )\n})\nFormLabel.displayName = \"FormLabel\"\n\nconst FormControl = React.forwardRef<\n  React.ElementRef<typeof Slot>,\n  React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n  const { error, formItemId, formDescriptionId, formMessageId } = useFormField()\n\n  return (\n    <Slot\n      ref={ref}\n      id={formItemId}\n      aria-describedby={\n        !error\n          ? `${formDescriptionId}`\n          : `${formDescriptionId} ${formMessageId}`\n      }\n      aria-invalid={!!error}\n      {...props}\n    />\n  )\n})\nFormControl.displayName = \"FormControl\"\n\nconst FormDescription = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n  const { formDescriptionId } = useFormField()\n\n  return (\n    <p\n      ref={ref}\n      id={formDescriptionId}\n      className={cn(\"text-sm text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n})\nFormDescription.displayName = \"FormDescription\"\n\nconst FormMessage = React.forwardRef<\n  HTMLParagraphElement,\n  React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n  const { error, formMessageId } = useFormField()\n  const body = error ? String(error?.message) : children\n\n  if (!body) {\n    return null\n  }\n\n  return (\n    <p\n      ref={ref}\n      id={formMessageId}\n      className={cn(\"text-sm font-medium text-destructive\", className)}\n      {...props}\n    >\n      {body}\n    </p>\n  )\n})\nFormMessage.displayName = \"FormMessage\"\n\nexport {\n  useFormField,\n  Form,\n  FormItem,\n  FormLabel,\n  FormControl,\n  FormDescription,\n  FormMessage,\n  FormField,\n}\n"
  },
  {
    "path": "src/components/ui/input.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"~/lib/utils\"\n\nexport interface InputProps\n  extends React.InputHTMLAttributes<HTMLInputElement> {}\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n  ({ className, type, ...props }, ref) => {\n    return (\n      <input\n        type={type}\n        className={cn(\n          \"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n          className\n        )}\n        ref={ref}\n        {...props}\n      />\n    )\n  }\n)\nInput.displayName = \"Input\"\n\nexport { Input }\n"
  },
  {
    "path": "src/components/ui/label.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as LabelPrimitive from \"@radix-ui/react-label\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst labelVariants = cva(\n  \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n)\n\nconst Label = React.forwardRef<\n  React.ElementRef<typeof LabelPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n    VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n  <LabelPrimitive.Root\n    ref={ref}\n    className={cn(labelVariants(), className)}\n    {...props}\n  />\n))\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"
  },
  {
    "path": "src/components/ui/popover.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\n\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n  React.ElementRef<typeof PopoverPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n  <PopoverPrimitive.Portal>\n    <PopoverPrimitive.Content\n      ref={ref}\n      align={align}\n      sideOffset={sideOffset}\n      className={cn(\n        \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n        className\n      )}\n      {...props}\n    />\n  </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n"
  },
  {
    "path": "src/components/ui/scroll-area.tsx",
    "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst ScrollArea = React.forwardRef<\n  React.ElementRef<typeof ScrollAreaPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n  <ScrollAreaPrimitive.Root\n    ref={ref}\n    className={cn(\"relative overflow-hidden\", className)}\n    {...props}\n  >\n    <ScrollAreaPrimitive.Viewport className=\"size-full rounded-[inherit]\">\n      {children}\n    </ScrollAreaPrimitive.Viewport>\n    <ScrollBar />\n    <ScrollAreaPrimitive.Corner />\n  </ScrollAreaPrimitive.Root>\n))\nScrollArea.displayName = ScrollAreaPrimitive.Root.displayName\n\nconst ScrollBar = React.forwardRef<\n  React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n  React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(({ className, orientation = \"vertical\", ...props }, ref) => (\n  <ScrollAreaPrimitive.ScrollAreaScrollbar\n    ref={ref}\n    orientation={orientation}\n    className={cn(\n      \"flex touch-none select-none transition-colors\",\n      orientation === \"vertical\" &&\n        \"h-full w-2.5 border-l border-l-transparent p-px\",\n      orientation === \"horizontal\" &&\n        \"h-2.5 flex-col border-t border-t-transparent p-px\",\n      className\n    )}\n    {...props}\n  >\n    <ScrollAreaPrimitive.ScrollAreaThumb className=\"relative flex-1 rounded-full bg-border\" />\n  </ScrollAreaPrimitive.ScrollAreaScrollbar>\n))\nScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName\n\nexport { ScrollArea, ScrollBar }\n"
  },
  {
    "path": "src/components/ui/skeleton.tsx",
    "content": "import { cn } from \"~/lib/utils\"\n\nfunction Skeleton({\n  className,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n  return (\n    <div\n      className={cn(\"animate-pulse rounded-md bg-muted\", className)}\n      {...props}\n    />\n  )\n}\n\nexport { Skeleton }\n"
  },
  {
    "path": "src/components/ui/sonner.tsx",
    "content": "\"use client\"\n\nimport { useTheme } from \"next-themes\"\nimport { Toaster as Sonner } from \"sonner\"\n\ntype ToasterProps = React.ComponentProps<typeof Sonner>\n\nconst Toaster = ({ ...props }: ToasterProps) => {\n  const { theme = \"system\" } = useTheme()\n\n  return (\n    <Sonner\n      theme={theme as ToasterProps[\"theme\"]}\n      className=\"toaster group\"\n      toastOptions={{\n        classNames: {\n          toast:\n            \"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg\",\n          description: \"group-[.toast]:text-muted-foreground\",\n          actionButton:\n            \"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground\",\n          cancelButton:\n            \"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground\",\n        },\n      }}\n      {...props}\n    />\n  )\n}\n\nexport { Toaster }\n"
  },
  {
    "path": "src/components/ui/table.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"~/lib/utils\"\n\nconst Table = React.forwardRef<\n  HTMLTableElement,\n  React.HTMLAttributes<HTMLTableElement>\n>(({ className, ...props }, ref) => (\n  <div className=\"relative w-full overflow-auto\">\n    <table\n      ref={ref}\n      className={cn(\"w-full caption-bottom text-sm\", className)}\n      {...props}\n    />\n  </div>\n))\nTable.displayName = \"Table\"\n\nconst TableHeader = React.forwardRef<\n  HTMLTableSectionElement,\n  React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n  <thead ref={ref} className={cn(\"[&_tr]:border-b\", className)} {...props} />\n))\nTableHeader.displayName = \"TableHeader\"\n\nconst TableBody = React.forwardRef<\n  HTMLTableSectionElement,\n  React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n  <tbody\n    ref={ref}\n    className={cn(\"[&_tr:last-child]:border-0\", className)}\n    {...props}\n  />\n))\nTableBody.displayName = \"TableBody\"\n\nconst TableFooter = React.forwardRef<\n  HTMLTableSectionElement,\n  React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n  <tfoot\n    ref={ref}\n    className={cn(\n      \"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\",\n      className\n    )}\n    {...props}\n  />\n))\nTableFooter.displayName = \"TableFooter\"\n\nconst TableRow = React.forwardRef<\n  HTMLTableRowElement,\n  React.HTMLAttributes<HTMLTableRowElement>\n>(({ className, ...props }, ref) => (\n  <tr\n    ref={ref}\n    className={cn(\n      \"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted\",\n      className\n    )}\n    {...props}\n  />\n))\nTableRow.displayName = \"TableRow\"\n\nconst TableHead = React.forwardRef<\n  HTMLTableCellElement,\n  React.ThHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n  <th\n    ref={ref}\n    className={cn(\n      \"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0\",\n      className\n    )}\n    {...props}\n  />\n))\nTableHead.displayName = \"TableHead\"\n\nconst TableCell = React.forwardRef<\n  HTMLTableCellElement,\n  React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n  <td\n    ref={ref}\n    className={cn(\"p-4 align-middle [&:has([role=checkbox])]:pr-0\", className)}\n    {...props}\n  />\n))\nTableCell.displayName = \"TableCell\"\n\nconst TableCaption = React.forwardRef<\n  HTMLTableCaptionElement,\n  React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n  <caption\n    ref={ref}\n    className={cn(\"mt-4 text-sm text-muted-foreground\", className)}\n    {...props}\n  />\n))\nTableCaption.displayName = \"TableCaption\"\n\nexport {\n  Table,\n  TableHeader,\n  TableBody,\n  TableFooter,\n  TableHead,\n  TableRow,\n  TableCell,\n  TableCaption,\n}\n"
  },
  {
    "path": "src/components/ui/textarea.tsx",
    "content": "import * as React from \"react\"\n\nimport { cn } from \"~/lib/utils\"\n\nexport interface TextareaProps\n  extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n  ({ className, ...props }, ref) => {\n    return (\n      <textarea\n        className={cn(\n          \"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\",\n          className\n        )}\n        ref={ref}\n        {...props}\n      />\n    )\n  }\n)\nTextarea.displayName = \"Textarea\"\n\nexport { Textarea }\n"
  },
  {
    "path": "src/components/user-account-nav.tsx",
    "content": "\"use client\"\n\nimport { User } from \"next-auth\"\nimport { signOut } from \"next-auth/react\"\n\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from \"~/components/ui/dropdown-menu\"\n\nimport { UserAvatar } from \"./user-avatar\"\n\ninterface UserAccountNavProps extends React.HTMLAttributes<HTMLDivElement> {\n  user: Pick<User, \"name\" | \"username\">\n}\n\nexport function UserAccountNav({ user }: UserAccountNavProps) {\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger>\n        <UserAvatar user={{ name: user.name }} className=\"size-8\" />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent align=\"end\">\n        <div className=\"flex items-center justify-start gap-2 p-2\">\n          <div className=\"flex flex-col space-y-1 leading-none\">\n            {user.name && <p className=\"font-medium\">{user.name}</p>}\n            {user.username && (\n              <p className=\"w-[200px] truncate text-sm text-muted-foreground\">\n                {user.username}\n              </p>\n            )}\n          </div>\n        </div>\n        <DropdownMenuSeparator />\n        <DropdownMenuItem\n          className=\"cursor-pointer\"\n          onSelect={(event: Event) => {\n            event.preventDefault()\n            signOut({\n              callbackUrl: `${window.location.origin}/login`,\n            })\n          }}\n        >\n          Sign out\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  )\n}\n"
  },
  {
    "path": "src/components/user-avatar.tsx",
    "content": "import { AvatarProps } from \"@radix-ui/react-avatar\"\nimport { User } from \"next-auth\"\n\nimport { Icons } from \"./icons\"\nimport { Avatar, AvatarFallback } from \"./ui/avatar\"\n\ninterface UserAvatarProps extends AvatarProps {\n  user: Pick<User, \"name\">\n}\n\nexport function UserAvatar({ user, ...props }: UserAvatarProps) {\n  return (\n    <Avatar {...props}>\n      <AvatarFallback>\n        <span className=\"sr-only\">{user.name}</span>\n        <Icons.user className=\"size-4\" />\n      </AvatarFallback>\n    </Avatar>\n  )\n}\n"
  },
  {
    "path": "src/components/user-table.tsx",
    "content": "\"use client\"\n\nimport { api } from \"~/trpc/react\"\n\nimport { Button } from \"~/components/ui/button\"\nimport {\n  Table,\n  TableBody,\n  TableCell,\n  TableHead,\n  TableHeader,\n  TableRow,\n} from \"~/components/ui/table\"\nimport { NewUserDialog } from \"~/components/new-user-dialog\"\n\nexport function UserTable() {\n  const { data } = api.users.list.useQuery()\n\n  return (\n    <div className=\"flex flex-col\">\n      <div className=\"flex items-center justify-between\">\n        <p className=\"text-xl\">Users</p>\n        <NewUserDialog />\n      </div>\n      <Table>\n        <TableHeader>\n          <TableRow>\n            <TableHead>ID</TableHead>\n            <TableHead>Name</TableHead>\n            <TableHead>Username</TableHead>\n            <TableHead>Actions</TableHead>\n          </TableRow>\n        </TableHeader>\n        <TableBody>\n          {data &&\n            data.map((a) => (\n              <TableRow key={a.id}>\n                <TableCell>{a.id}</TableCell>\n                <TableCell>{a.name}</TableCell>\n                <TableCell>{a.username}</TableCell>\n                <TableCell className=\"flex gap-2\">\n                  <Button>Edit</Button>\n                  <Button>Delete</Button>\n                </TableCell>\n              </TableRow>\n            ))}\n        </TableBody>\n      </Table>\n    </div>\n  )\n}\n"
  },
  {
    "path": "src/config/dashboard.ts",
    "content": "import { DashboardConfig } from \"~/types\"\n\nexport const dashboardConfig: DashboardConfig = {\n  mainNav: [\n    {\n      title: \"Recipes\",\n      href: \"/recipes\",\n    },\n    {\n      title: \"Settings\",\n      href: \"/settings\",\n    },\n  ],\n  sidebarNav: [\n    {\n      title: \"Recipes\",\n      href: \"/recipes\",\n      icon: \"post\",\n    },\n    {\n      title: \"Settings\",\n      href: \"/settings\",\n      icon: \"settings\",\n    },\n  ],\n}\n"
  },
  {
    "path": "src/config/site.ts",
    "content": "import { SiteConfig } from \"~/types\"\n\nexport const siteConfig: SiteConfig = {\n  name: \"Recipe Buddy\",\n  description: \"A better way to import recipes to Grocy.1\",\n  url: \"https://github.com/georgegebbett/recipe-buddy\",\n  ogImage: \"https://tx.shadcn.com/og.jpg\",\n  links: {\n    twitter: \"https://twitter.com/georgegebbett\",\n    github: \"https://github.com/georgegebbett/recipe-buddy\",\n  },\n}\n"
  },
  {
    "path": "src/env.js",
    "content": "import { createEnv } from \"@t3-oss/env-nextjs\"\nimport { z } from \"zod\"\n\nexport const env = createEnv({\n  /**\n   * Specify your server-side environment variables schema here. This way you can ensure the app\n   * isn't built with invalid env vars.\n   */\n  server: {\n    DATABASE_URL: z.string(),\n    NODE_ENV: z\n      .enum([\"development\", \"test\", \"production\"])\n      .default(\"development\"),\n    NEXTAUTH_SECRET:\n      process.env.NODE_ENV === \"production\"\n        ? z.string()\n        : z.string().optional(),\n    NEXTAUTH_URL: z.preprocess(\n      // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL\n      // Since NextAuth.js automatically uses the VERCEL_URL if present.\n      (str) => process.env.VERCEL_URL ?? str,\n      // VERCEL_URL doesn't include `https` so it cant be validated as a URL\n      process.env.VERCEL ? z.string() : z.string().url()\n    ),\n    GROCY_BASE_URL: z.string(),\n    GROCY_API_KEY: z.string(),\n  },\n\n  /**\n   * Specify your client-side environment variables schema here. This way you can ensure the app\n   * isn't built with invalid env vars. To expose them to the client, prefix them with\n   * `NEXT_PUBLIC_`.\n   */\n  client: {\n    // NEXT_PUBLIC_CLIENTVAR: z.string(),\n  },\n\n  /**\n   * You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.\n   * middlewares) or client-side so we need to destruct manually.\n   */\n  runtimeEnv: {\n    DATABASE_URL: process.env.DATABASE_URL,\n    NODE_ENV: process.env.NODE_ENV,\n    NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,\n    NEXTAUTH_URL: process.env.NEXTAUTH_URL,\n    GROCY_BASE_URL: process.env.GROCY_BASE_URL,\n    GROCY_API_KEY: process.env.GROCY_API_KEY,\n  },\n  /**\n   * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially\n   * useful for Docker builds.\n   */\n  skipValidation: !!process.env.SKIP_ENV_VALIDATION,\n  /**\n   * Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and\n   * `SOME_VAR=''` will throw an error.\n   */\n  emptyStringAsUndefined: true,\n})\n"
  },
  {
    "path": "src/hooks/use-lock-body.ts",
    "content": "import * as React from \"react\"\n\n// @see https://usehooks.com/useLockBodyScroll.\nexport function useLockBody() {\n  React.useLayoutEffect((): (() => void) => {\n    const originalStyle: string = window.getComputedStyle(\n      document.body\n    ).overflow\n    document.body.style.overflow = \"hidden\"\n    return () => (document.body.style.overflow = originalStyle)\n  }, [])\n}\n"
  },
  {
    "path": "src/lib/logger.ts",
    "content": "import pino from \"pino\"\n\nexport const logger = pino()\n"
  },
  {
    "path": "src/lib/routes.ts",
    "content": "export const ROUTES = {\n  recipes: {\n    root: \"/recipes\",\n    details: (id: number | string) => `/recipes/${id}`,\n  },\n  setup: \"/setup\",\n}\n"
  },
  {
    "path": "src/lib/session.ts",
    "content": "import { authOptions } from \"~/server/auth\"\nimport { getServerSession } from \"next-auth/next\"\n\nexport async function getCurrentUser() {\n  const session = await getServerSession(authOptions)\n\n  return session?.user\n}\n"
  },
  {
    "path": "src/lib/utils.ts",
    "content": "import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs))\n}\n"
  },
  {
    "path": "src/server/api/modules/grocy/procedures/checkGrocyConnection.ts",
    "content": "import { grocyFetch } from \"~/server/api/modules/grocy/service/client\"\nimport { protectedProcedure } from \"~/server/api/trpc\"\nimport z from \"zod\"\n\nconst GrocyStatusSchema = z.object({\n  grocy_version: z.object({\n    Version: z.string(),\n    ReleaseDate: z.string(),\n  }),\n})\n\nexport const checkGrocyConnectionProcedure = protectedProcedure.query(\n  async () => {\n    const res = await grocyFetch(`/system/info`)\n\n    const body = await res.json()\n\n    return GrocyStatusSchema.safeParse(body)\n  }\n)\n"
  },
  {
    "path": "src/server/api/modules/grocy/procedures/createRecipeInGrocy.ts",
    "content": "import {\n  CreateRecipeInGrocyCommandSchema,\n  UnignoredIngredient,\n} from \"~/server/api/modules/grocy/procedures/createRecipeInGrocySchema\"\nimport { grocyFetch } from \"~/server/api/modules/grocy/service/client\"\nimport { getGrocyProducts } from \"~/server/api/modules/grocy/service/getGrocyProducts\"\nimport { deleteRecipe } from \"~/server/api/modules/recipes/service/deleteRecipe\"\nimport { protectedProcedure } from \"~/server/api/trpc\"\nimport normalizeUrl from \"normalize-url\"\nimport slugify from \"slugify\"\nimport { v4 } from \"uuid\"\nimport z from \"zod\"\n\nimport { logger } from \"~/lib/logger\"\n\nexport const createRecipeInGrocyProcedure = protectedProcedure\n  .input(CreateRecipeInGrocyCommandSchema)\n  .mutation(async ({ input }) => {\n    let imageFilename: string | undefined = undefined\n\n    const grocyProducts = await getGrocyProducts()\n\n    if (input.imageUrl) {\n      const normalised = normalizeUrl(input.imageUrl, {\n        removeQueryParameters: true,\n      })\n\n      const split = normalised.split(\".\")\n      const extension = split[split.length - 1]\n\n      const image = await fetch(input.imageUrl)\n      const blob = await image.blob()\n\n      const slug = slugify(input.recipeName)\n\n      const uuid = v4()\n      const [beginningOfUuid] = uuid.split(\"-\")\n\n      imageFilename = slug + \"-\" + beginningOfUuid + \".\" + extension\n\n      logger.info(\n        { imageFilename, base64: btoa(imageFilename) },\n        \"Uploading image to Grocy\"\n      )\n\n      await grocyFetch(`/files/recipepictures/${btoa(imageFilename)}`, {\n        method: \"PUT\",\n        body: blob,\n        headers: { \"Content-Type\": \"application/octet-stream\" },\n      })\n\n      logger.info(\"Uploaded image to Grocy\")\n    }\n\n    logger.info(input, \"Creating recipe in Grocy\")\n\n    const recipeBody = {\n      name: input.recipeName,\n      description: input.method,\n      picture_file_name: imageFilename,\n      base_servings: input.servings,\n    }\n\n    const recipeResponse = await grocyFetch(\"/objects/recipes\", {\n      method: \"POST\",\n      body: JSON.stringify(recipeBody),\n      headers: { \"Content-Type\": \"application/json\" },\n    })\n\n    const recipeJson = await recipeResponse.json()\n\n    logger.info(recipeJson, \"Recipe created\")\n\n    const recipeId = z.coerce.string().parse(recipeJson.created_object_id)\n\n    const filteredIngredients = input.ingredients.filter(\n      (a): a is UnignoredIngredient => !a.ignored\n    )\n\n    for (const ingredient of filteredIngredients) {\n      logger.info(ingredient, `Creating ingredient [${ingredient.scrapedName}]`)\n\n      const grocyProduct = grocyProducts.find(\n        (a) => a.id === ingredient.productId\n      )\n\n      if (!grocyProduct) continue\n\n      const useAnyUnit: \"1\" | \"0\" =\n        ingredient.unitId === grocyProduct.qu_id_stock ? \"0\" : \"1\"\n\n      const body = {\n        recipe_id: recipeId,\n        product_id: ingredient.productId,\n        amount: ingredient.amount,\n        qu_id: ingredient.unitId,\n        only_check_single_unit_in_stock: useAnyUnit,\n        note: ingredient.note,\n        ingredient_group: ingredient.group,\n      }\n\n      const ingredientResponse = await grocyFetch(\"/objects/recipes_pos\", {\n        method: \"POST\",\n        body: JSON.stringify(body),\n        headers: { \"Content-Type\": \"application/json\" },\n      })\n\n      const ingredientJson = await ingredientResponse.json()\n\n      if (!ingredientResponse.ok) {\n        throw new Error(ingredientJson.error_message ?? \"An error occurred\")\n      }\n\n      logger.info(ingredientJson, \"Ingredient created\")\n    }\n\n    logger.info(\"Recipe creation success, deleting recipe from Recipe Buddy\")\n\n    await deleteRecipe(input.recipeBuddyRecipeId)\n  })\n"
  },
  {
    "path": "src/server/api/modules/grocy/procedures/createRecipeInGrocySchema.ts",
    "content": "import z from \"zod\"\n\nconst IgnoredIngredientSchema = z.object({\n  scrapedName: z.string(),\n  ignored: z.literal(true),\n})\n\nconst UnignoredIngredientSchema = z.object({\n  productId: z.string(),\n  amount: z.coerce.number(),\n  unitId: z.string(),\n  scrapedName: z.string(),\n  ignored: z.literal(false),\n  note: z.string().trim().optional(),\n  group: z.string().trim().optional(),\n})\n\nexport type UnignoredIngredient = z.infer<typeof UnignoredIngredientSchema>\n\nconst IngredientSchema = z.union([\n  UnignoredIngredientSchema,\n  IgnoredIngredientSchema,\n])\n\nconst numberLike = z.union([z.number(), z.string()])\nconst numberLikeToNumberAtLeastOne = numberLike\n  .pipe(\n    z.coerce\n      .number()\n      .int(\"Must be a whole number\")\n      .min(0, \"Must be a positive number\")\n  )\n  .transform((a) => {\n    if (a < 1) return 1\n    return a\n  })\n\nexport const CreateRecipeInGrocyCommandSchema = z.object({\n  recipeBuddyRecipeId: z.number(),\n  recipeName: z.string().trim().min(1),\n  ingredients: IngredientSchema.array(),\n  method: z.string().optional(),\n  imageUrl: z.string().url().optional(),\n  servings: numberLikeToNumberAtLeastOne.optional(),\n})\n\nexport type CreateRecipeInGrocyCommand = z.infer<\n  typeof CreateRecipeInGrocyCommandSchema\n>\n"
  },
  {
    "path": "src/server/api/modules/grocy/procedures/getGrocyProducts.ts",
    "content": "import { getGrocyProducts } from \"~/server/api/modules/grocy/service/getGrocyProducts\"\nimport { protectedProcedure } from \"~/server/api/trpc\"\n\nexport const getGrocyProductsProcedure =\n  protectedProcedure.query(getGrocyProducts)\n"
  },
  {
    "path": "src/server/api/modules/grocy/procedures/getGrocyQuantityUnits.ts",
    "content": "import { grocyFetch } from \"~/server/api/modules/grocy/service/client\"\nimport { protectedProcedure } from \"~/server/api/trpc\"\nimport z from \"zod\"\n\nconst grocyQuantityUnitSchema = z.object({\n  id: z.coerce.string(),\n  name: z.string(),\n})\n\nexport const getGrocyQuantityUnitsProcedure = protectedProcedure.query(\n  async () => {\n    const prods = await grocyFetch(\"/objects/quantity_units\")\n\n    const json = await prods.json()\n\n    return grocyQuantityUnitSchema.array().parse(json)\n  }\n)\n"
  },
  {
    "path": "src/server/api/modules/grocy/service/client.ts",
    "content": "import { env } from \"~/env\"\n\nconst headers = {\n  \"GROCY-API-KEY\": env.GROCY_API_KEY,\n}\n\nexport const grocyFetch = (suffix: string, init?: RequestInit) =>\n  fetch(`${env.GROCY_BASE_URL}/api${suffix}`, {\n    ...init,\n    headers: {\n      ...init?.headers,\n      ...headers,\n    },\n  })\n"
  },
  {
    "path": "src/server/api/modules/grocy/service/getGrocyProducts.ts",
    "content": "import { grocyFetch } from \"~/server/api/modules/grocy/service/client\"\nimport z from \"zod\"\n\nconst grocyProductSchema = z.object({\n  id: z.coerce.string(),\n  name: z.string(),\n  qu_id_stock: z.coerce.string(),\n})\n\ntype GrocyProduct = z.infer<typeof grocyProductSchema>\n\nexport const getGrocyProducts = async (): Promise<GrocyProduct[]> => {\n  const prods = await grocyFetch(\"/objects/products\", { cache: \"no-cache\" })\n\n  const json = await prods.json()\n\n  return grocyProductSchema.array().parse(json)\n}\n"
  },
  {
    "path": "src/server/api/modules/recipes/procedures/deleteRecipe.ts",
    "content": "import { deleteRecipe } from \"~/server/api/modules/recipes/service/deleteRecipe\"\nimport { protectedProcedure } from \"~/server/api/trpc\"\nimport { z } from \"zod\"\n\nexport const deleteRecipeProcedure = protectedProcedure\n  .input(\n    z.object({\n      recipeId: z.number(),\n    })\n  )\n  .mutation(({ input }) => deleteRecipe(input.recipeId))\n"
  },
  {
    "path": "src/server/api/modules/recipes/procedures/getById.ts",
    "content": "import { protectedProcedure } from \"~/server/api/trpc\"\nimport { db } from \"~/server/db\"\nimport { recipes as recipeTable } from \"~/server/db/schema\"\nimport { eq } from \"drizzle-orm\"\nimport z from \"zod\"\n\nexport const getRecipeByIdProcedure = protectedProcedure\n  .input(\n    z.object({\n      id: z.coerce.number().int(),\n    })\n  )\n  .query(async ({ input }) =>\n    db.query.recipes.findFirst({\n      where: eq(recipeTable.id, input.id),\n      with: { ingredients: true },\n    })\n  )\n"
  },
  {
    "path": "src/server/api/modules/recipes/procedures/listRecipes.ts",
    "content": "import { protectedProcedure } from \"~/server/api/trpc\"\nimport { db } from \"~/server/db\"\nimport { recipes as recipeTable } from \"~/server/db/schema\"\nimport z from \"zod\"\n\nexport const listRecipesProcedure = protectedProcedure\n  .output(\n    z\n      .object({\n        id: z.number(),\n        name: z.string(),\n        imageUrl: z.string().nullable(),\n      })\n      .array()\n  )\n  .query(async () => {\n    return db\n      .select({\n        id: recipeTable.id,\n        name: recipeTable.name,\n        imageUrl: recipeTable.imageUrl,\n      })\n      .from(recipeTable)\n  })\n"
  },
  {
    "path": "src/server/api/modules/recipes/procedures/scrapeRecipe.ts",
    "content": "import { hydrateRecipe } from \"~/server/api/modules/recipes/service/scraper\"\nimport { protectedProcedure } from \"~/server/api/trpc\"\nimport { db } from \"~/server/db\"\nimport { ingredients as ingredientsTable, recipes } from \"~/server/db/schema\"\nimport z from \"zod\"\n\nimport { logger } from \"~/lib/logger\"\n\nexport const scrapeRecipeProcedure = protectedProcedure\n  .input(\n    z.object({\n      url: z.string().url(),\n    })\n  )\n  .mutation(async ({ input }) => {\n    const { url } = input\n\n    const { recipe, ingredients } = await hydrateRecipe(url)\n\n    const dbRecipe = await db.insert(recipes).values({\n      ...recipe,\n    })\n\n    ingredients.map(\n      async (a) =>\n        await db.insert(ingredientsTable).values({\n          scrapedName: a.scrapedName,\n          recipeId: dbRecipe.lastInsertRowid.valueOf() as number,\n        })\n    )\n\n    logger.info({ recipe, ingredients }, \"Recipe added\")\n\n    return url\n  })\n"
  },
  {
    "path": "src/server/api/modules/recipes/procedures/scrapeRecipeSchema.ts",
    "content": "import z from \"zod\"\n\nexport const ScrapeRecipeSchema = z.object({\n  url: z.string().url({ message: \"Please enter a valid URL\" }),\n})\n\nexport type ScrapeRecipe = z.infer<typeof ScrapeRecipeSchema>\n"
  },
  {
    "path": "src/server/api/modules/recipes/service/deleteRecipe.ts",
    "content": "import { db } from \"~/server/db\"\nimport { recipes } from \"~/server/db/schema\"\nimport { eq } from \"drizzle-orm\"\n\nimport { logger } from \"~/lib/logger\"\n\nexport const deleteRecipe = (recipeId: number) => {\n  logger.info(`Deleting recipe with ID ${recipeId}`)\n\n  return db.delete(recipes).where(eq(recipes.id, recipeId))\n}\n"
  },
  {
    "path": "src/server/api/modules/recipes/service/schemas.ts",
    "content": "import z from \"zod\"\n\nconst StepSchema = z.object({\n  text: z.string(),\n})\n\nconst beautifyInstructions = (input: string): string => {\n  const sections = input.split(/\\n\\n+/)\n\n  const formattedSections = sections.map((section, index) => {\n    const numberedSection = section.replace(/\\n/g, \"<br>\")\n    return `${index + 1}. ${numberedSection}`\n  })\n\n  return formattedSections.map((section) => `<p>${section}</p>`).join(\"\")\n}\n\nexport const StepsToStringSchema = z\n  .union([z.array(StepSchema), z.string()])\n  .transform((steps) => {\n    if (typeof steps === \"string\") return beautifyInstructions(steps)\n    return beautifyInstructions(steps.map((step) => step.text).join(\"\\n\\n\"))\n  })\n\nconst baseUrlSchema = z.union([z.string(), z.object({ url: z.string() })])\nexport const RecipeImageUrlSchema = z\n  .union([baseUrlSchema, baseUrlSchema.array()])\n  .transform((input): string | undefined => {\n    const res = Array.isArray(input) ? input[0] : input\n\n    if (!res || typeof res === \"string\") return res\n    return res.url\n  })\n\nexport const JsonLdRecipeSchema = z.object({\n  \"@type\": z.union([z.string(), z.tuple([z.string()]).transform((a) => a[0])]),\n})\n\nexport const ExtractNumberSchema = z.coerce.string().transform((val, ctx) => {\n  const numberRegex = /\\d+/g\n\n  const regexResult = numberRegex.exec(val)\n\n  if (!regexResult) {\n    ctx.addIssue({\n      message: \"No numbers found in servings\",\n      code: \"custom\",\n    })\n    return z.NEVER\n  }\n\n  const [first] = regexResult\n\n  return parseInt(first)\n})\n"
  },
  {
    "path": "src/server/api/modules/recipes/service/scraper.ts",
    "content": "import { TRPCError } from \"@trpc/server\"\nimport {\n  ExtractNumberSchema,\n  JsonLdRecipeSchema,\n  RecipeImageUrlSchema,\n  StepsToStringSchema,\n} from \"~/server/api/modules/recipes/service/schemas\"\nimport { InsertIngredient, InsertRecipe } from \"~/server/db/schema\"\nimport { JSDOM } from \"jsdom\"\n\nimport { logger } from \"~/lib/logger\"\n\nasync function getNodeListOfMetadataNodesFromUrl(url: string) {\n  const dom = await JSDOM.fromURL(url)\n  const nodeList: NodeList = dom.window.document.querySelectorAll(\n    \"script[type='application/ld+json']\"\n  )\n\n  if (nodeList.length === 0) {\n    throw new TRPCError({\n      message: \"The linked page contains no metadata\",\n      code: \"INTERNAL_SERVER_ERROR\",\n    })\n  }\n\n  return nodeList\n}\n\nfunction jsonObjectIsRecipe(jsonObject: Record<string, unknown>): boolean {\n  const parsed = JsonLdRecipeSchema.safeParse(jsonObject)\n\n  if (parsed.success) {\n    if (parsed.data[\"@type\"].toLowerCase().includes(\"recipe\")) return true\n  }\n\n  return false\n}\n\nfunction jsonObjectHasGraph(jsonObject: Record<string, unknown>): boolean {\n  return Object.prototype.hasOwnProperty.call(jsonObject, \"@graph\")\n}\n\nfunction normalizeWhitespace(input: string): string {\n  return input.replace(\n    /[\\u00A0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]/g,\n    \" \"\n  )\n}\n\nfunction escapeRealLineBreaksInString(input: string): string {\n  return input.replace(/([\"'])([\\s\\S]*?)\\1/g, (match, quote, content) => {\n    const escapedContent = content.replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\")\n    return quote + escapedContent + quote\n  })\n}\n\nfunction getSchemaRecipeFromNodeList(nodeList: NodeList) {\n  for (const node of nodeList.values()) {\n    const { textContent } = node\n\n    if (!textContent) {\n      logger.debug(\"No text content in node, trying next node\")\n      continue\n    }\n\n    // Preprocess the text to ensure that it can be parsed as JSON\n    const textContentWithEscapedLinebreaks =\n      escapeRealLineBreaksInString(textContent)\n    const formattedTextContent = normalizeWhitespace(\n      textContentWithEscapedLinebreaks\n    )\n\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    let parsedNodeContent: any\n\n    try {\n      parsedNodeContent = JSON.parse(formattedTextContent)\n    } catch (e) {\n      logger.error(\n        { error: e, textContent },\n        \"Error in extracting JSON from node content\"\n      )\n      continue\n    }\n\n    if (Array.isArray(parsedNodeContent)) {\n      for (const metadataObject of parsedNodeContent) {\n        if (jsonObjectIsRecipe(metadataObject)) {\n          return metadataObject\n        }\n      }\n    } else {\n      if (jsonObjectIsRecipe(parsedNodeContent)) {\n        return parsedNodeContent\n      }\n      if (jsonObjectHasGraph(parsedNodeContent)) {\n        for (const graphNode of parsedNodeContent[\"@graph\"]) {\n          if (jsonObjectIsRecipe(graphNode)) {\n            return graphNode\n          }\n        }\n      }\n    }\n  }\n  throw new Error(\"Unable to extract Recipe metadata from provided url\")\n}\n\nexport async function hydrateRecipe(url: string) {\n  const nodeList: NodeList = await getNodeListOfMetadataNodesFromUrl(url)\n\n  const recipeData = getSchemaRecipeFromNodeList(nodeList)\n\n  const { error, data: steps } = StepsToStringSchema.safeParse(\n    recipeData.recipeInstructions\n  )\n\n  if (error) {\n    throw new Error(\"Unable to parse steps\")\n  }\n\n  const ingredients: string[] = recipeData.recipeIngredient\n    .flat()\n    .map((ingredient: string) => ingredient.trim())\n\n  const image = RecipeImageUrlSchema.safeParse(recipeData.image)\n\n  const ings: Pick<InsertIngredient, \"scrapedName\">[] = ingredients.map(\n    (a) => ({ scrapedName: a })\n  )\n\n  const servings = ExtractNumberSchema.safeParse(recipeData.recipeYield)\n\n  const recipe: InsertRecipe = {\n    name: recipeData.name,\n    url,\n    steps,\n    imageUrl: image.success ? image.data : undefined,\n    servings: servings.success ? servings.data : undefined,\n  }\n\n  return { recipe, ingredients: ings }\n}\n"
  },
  {
    "path": "src/server/api/modules/users/procedures/checkIsSetup.ts",
    "content": "import { checkIsSetup } from \"~/server/api/modules/users/service/checkIsSetup\"\nimport { publicProcedure } from \"~/server/api/trpc\"\n\nexport const checkIsSetupProcedure = publicProcedure.query(checkIsSetup)\n"
  },
  {
    "path": "src/server/api/modules/users/procedures/createUser.ts",
    "content": "import { CreateUserSchema } from \"~/server/api/modules/users/procedures/createUserSchema\"\nimport { createUser } from \"~/server/api/modules/users/service/createUser\"\nimport { protectedProcedure } from \"~/server/api/trpc\"\nimport z from \"zod\"\n\nexport const createUserProcedure = protectedProcedure\n  .input(CreateUserSchema)\n  .output(\n    z.object({\n      id: z.number(),\n      name: z.string(),\n      username: z.string(),\n    })\n  )\n  .mutation(async ({ input }) => {\n    return createUser(input)\n  })\n"
  },
  {
    "path": "src/server/api/modules/users/procedures/createUserSchema.ts",
    "content": "import z from \"zod\"\n\nexport const CreateUserSchema = z.object({\n  name: z.string(),\n  username: z.string(),\n  password: z.string(),\n})\n\nexport type CreateUser = z.infer<typeof CreateUserSchema>\n"
  },
  {
    "path": "src/server/api/modules/users/procedures/listUsers.ts",
    "content": "import { protectedProcedure } from \"~/server/api/trpc\"\nimport { db } from \"~/server/db\"\nimport { users as userTable } from \"~/server/db/schema\"\nimport z from \"zod\"\n\nexport const listUsersProcedure = protectedProcedure\n  .output(\n    z\n      .object({\n        id: z.number(),\n        name: z.string(),\n        username: z.string(),\n      })\n      .array()\n  )\n  .query(async () => {\n    return db\n      .select({\n        id: userTable.id,\n        name: userTable.name,\n        username: userTable.username,\n      })\n      .from(userTable)\n  })\n"
  },
  {
    "path": "src/server/api/modules/users/procedures/setupUser.ts",
    "content": "import { TRPCError } from \"@trpc/server\"\nimport { CreateUserSchema } from \"~/server/api/modules/users/procedures/createUserSchema\"\nimport { checkIsSetup } from \"~/server/api/modules/users/service/checkIsSetup\"\nimport { createUser } from \"~/server/api/modules/users/service/createUser\"\nimport { publicProcedure } from \"~/server/api/trpc\"\n\nexport const setupUserProcedure = publicProcedure\n  .input(CreateUserSchema)\n  .mutation(async ({ input }) => {\n    const isSetup = await checkIsSetup()\n\n    if (isSetup)\n      throw new TRPCError({\n        code: \"FORBIDDEN\",\n        message: \"Already set up\",\n      })\n\n    // Otherwise, create a user\n    return await createUser(input)\n  })\n"
  },
  {
    "path": "src/server/api/modules/users/service/checkIsSetup.ts",
    "content": "import { db } from \"~/server/db\"\nimport { users } from \"~/server/db/schema\"\nimport { count } from \"drizzle-orm\"\n\nimport { logger } from \"~/lib/logger\"\n\nexport const checkIsSetup = async () => {\n  logger.info(\"Checking if instance setup\")\n\n  const [numberOfUsers] = await db\n    .select({ value: count(users.id) })\n    .from(users)\n\n  const isSetup = !numberOfUsers || (numberOfUsers && numberOfUsers.value > 0)\n\n  logger.info({ isSetup })\n\n  return isSetup\n}\n"
  },
  {
    "path": "src/server/api/modules/users/service/createUser.ts",
    "content": "import { db } from \"~/server/db\"\nimport { users as userTable } from \"~/server/db/schema\"\nimport bcrypt from \"bcrypt\"\n\ntype CreateUserInput = {\n  username: string\n  name: string\n  password: string\n}\nexport const createUser = async (input: CreateUserInput) => {\n  const hashed = await bcrypt.hash(input.password, 10)\n\n  const insertedUser = await db.insert(userTable).values({\n    ...input,\n    passwordHash: hashed,\n  })\n\n  return {\n    id: insertedUser.lastInsertRowid as number,\n    ...input,\n  }\n}\n"
  },
  {
    "path": "src/server/api/root.ts",
    "content": "import { grocyRouter } from \"~/server/api/routers/grocy\"\nimport { recipeRouter } from \"~/server/api/routers/recipe\"\nimport { userRouter } from \"~/server/api/routers/user\"\nimport { createTRPCRouter } from \"~/server/api/trpc\"\n\n/**\n * This is the primary router for your server.\n *\n * All routers added in /api/routers should be manually added here.\n */\nexport const appRouter = createTRPCRouter({\n  recipe: recipeRouter,\n  grocy: grocyRouter,\n  users: userRouter,\n})\n\n// export type definition of API\nexport type AppRouter = typeof appRouter\n"
  },
  {
    "path": "src/server/api/routers/grocy.ts",
    "content": "import { checkGrocyConnectionProcedure } from \"~/server/api/modules/grocy/procedures/checkGrocyConnection\"\nimport { createRecipeInGrocyProcedure } from \"~/server/api/modules/grocy/procedures/createRecipeInGrocy\"\nimport { getGrocyProductsProcedure } from \"~/server/api/modules/grocy/procedures/getGrocyProducts\"\nimport { getGrocyQuantityUnitsProcedure } from \"~/server/api/modules/grocy/procedures/getGrocyQuantityUnits\"\nimport { createTRPCRouter } from \"~/server/api/trpc\"\n\nexport const grocyRouter = createTRPCRouter({\n  checkConnection: checkGrocyConnectionProcedure,\n  getProducts: getGrocyProductsProcedure,\n  getQuantityUnits: getGrocyQuantityUnitsProcedure,\n  createRecipe: createRecipeInGrocyProcedure,\n})\n"
  },
  {
    "path": "src/server/api/routers/recipe.ts",
    "content": "import { deleteRecipeProcedure } from \"~/server/api/modules/recipes/procedures/deleteRecipe\"\nimport { getRecipeByIdProcedure } from \"~/server/api/modules/recipes/procedures/getById\"\nimport { listRecipesProcedure } from \"~/server/api/modules/recipes/procedures/listRecipes\"\nimport { scrapeRecipeProcedure } from \"~/server/api/modules/recipes/procedures/scrapeRecipe\"\nimport {\n  createTRPCRouter,\n  protectedProcedure,\n  publicProcedure,\n} from \"~/server/api/trpc\"\nimport { z } from \"zod\"\n\nexport const recipeRouter = createTRPCRouter({\n  hello: publicProcedure\n    .input(z.object({ text: z.string() }))\n    .query(({ input }) => {\n      return {\n        greeting: `Hello ${input.text}`,\n      }\n    }),\n\n  getSecretMessage: protectedProcedure.query(() => {\n    return \"you can now see this secret message!\"\n  }),\n  scrape: scrapeRecipeProcedure,\n  list: listRecipesProcedure,\n  get: getRecipeByIdProcedure,\n  delete: deleteRecipeProcedure,\n})\n"
  },
  {
    "path": "src/server/api/routers/user.ts",
    "content": "import { checkIsSetupProcedure } from \"~/server/api/modules/users/procedures/checkIsSetup\"\nimport { createUserProcedure } from \"~/server/api/modules/users/procedures/createUser\"\nimport { listUsersProcedure } from \"~/server/api/modules/users/procedures/listUsers\"\nimport { setupUserProcedure } from \"~/server/api/modules/users/procedures/setupUser\"\nimport { createTRPCRouter } from \"~/server/api/trpc\"\n\nexport const userRouter = createTRPCRouter({\n  list: listUsersProcedure,\n  create: createUserProcedure,\n  checkIsSetup: checkIsSetupProcedure,\n  setupUser: setupUserProcedure,\n})\n"
  },
  {
    "path": "src/server/api/trpc.ts",
    "content": "/**\n * YOU PROBABLY DON'T NEED TO EDIT THIS FILE, UNLESS:\n * 1. You want to modify request context (see Part 1).\n * 2. You want to create a new middleware or type of procedure (see Part 3).\n *\n * TL;DR - This is where all the tRPC server stuff is created and plugged in. The pieces you will\n * need to use are documented accordingly near the end.\n */\n\nimport { initTRPC, TRPCError } from \"@trpc/server\"\nimport { getServerAuthSession } from \"~/server/auth\"\nimport { db } from \"~/server/db\"\nimport superjson from \"superjson\"\nimport { ZodError } from \"zod\"\n\n/**\n * 1. CONTEXT\n *\n * This section defines the \"contexts\" that are available in the backend API.\n *\n * These allow you to access things when processing a request, like the database, the session, etc.\n *\n * This helper generates the \"internals\" for a tRPC context. The API handler and RSC clients each\n * wrap this and provides the required context.\n *\n * @see https://trpc.io/docs/server/context\n */\nexport const createTRPCContext = async (opts: { headers: Headers }) => {\n  const session = await getServerAuthSession()\n\n  return {\n    db,\n    session,\n    ...opts,\n  }\n}\n\n/**\n * 2. INITIALIZATION\n *\n * This is where the tRPC API is initialized, connecting the context and transformer. We also parse\n * ZodErrors so that you get typesafety on the frontend if your procedure fails due to validation\n * errors on the backend.\n */\nconst t = initTRPC.context<typeof createTRPCContext>().create({\n  transformer: superjson,\n  errorFormatter({ shape, error }) {\n    return {\n      ...shape,\n      data: {\n        ...shape.data,\n        zodError:\n          error.cause instanceof ZodError ? error.cause.flatten() : null,\n      },\n    }\n  },\n})\n\n/**\n * 3. ROUTER & PROCEDURE (THE IMPORTANT BIT)\n *\n * These are the pieces you use to build your tRPC API. You should import these a lot in the\n * \"/src/server/api/routers\" directory.\n */\n\n/**\n * This is how you create new routers and sub-routers in your tRPC API.\n *\n * @see https://trpc.io/docs/router\n */\nexport const createTRPCRouter = t.router\n\n/**\n * Public (unauthenticated) procedure\n *\n * This is the base piece you use to build new queries and mutations on your tRPC API. It does not\n * guarantee that a user querying is authorized, but you can still access user session data if they\n * are logged in.\n */\nexport const publicProcedure = t.procedure\n\n/** Reusable middleware that enforces users are logged in before running the procedure. */\nconst enforceUserIsAuthed = t.middleware(({ ctx, next }) => {\n  if (!ctx.session || !ctx.session.user) {\n    throw new TRPCError({ code: \"UNAUTHORIZED\" })\n  }\n  return next({\n    ctx: {\n      // infers the `session` as non-nullable\n      session: { ...ctx.session, user: ctx.session.user },\n    },\n  })\n})\n\n/**\n * Protected (authenticated) procedure\n *\n * If you want a query or mutation to ONLY be accessible to logged in users, use this. It verifies\n * the session is valid and guarantees `ctx.session.user` is not null.\n *\n * @see https://trpc.io/docs/procedures\n */\nexport const protectedProcedure = t.procedure.use(enforceUserIsAuthed)\n"
  },
  {
    "path": "src/server/auth.ts",
    "content": "import { db } from \"~/server/db\"\nimport { users } from \"~/server/db/schema\"\nimport bcrpyt from \"bcrypt\"\nimport { eq } from \"drizzle-orm\"\nimport {\n  getServerSession,\n  type DefaultSession,\n  type NextAuthOptions,\n} from \"next-auth\"\nimport Credentials from \"next-auth/providers/credentials\"\n\n/**\n * Module augmentation for `next-auth` types. Allows us to add custom properties to the `session`\n * object and keep type safety.\n *\n * @see https://next-auth.js.org/getting-started/typescript#module-augmentation\n */\ndeclare module \"next-auth\" {\n  interface Session {\n    user: User & DefaultSession[\"user\"]\n  }\n\n  interface User {\n    id: string\n    name: string\n    username: string\n  }\n}\n\n/**\n * Options for NextAuth.js used to configure adapters, providers, callbacks, etc.\n *\n * @see https://next-auth.js.org/configuration/options\n */\nexport const authOptions: NextAuthOptions = {\n  providers: [\n    Credentials({\n      name: \"Password\",\n      credentials: {\n        username: { label: \"Username\", type: \"text\" },\n        password: { label: \"Password\", type: \"password\" },\n      },\n      async authorize(credentials) {\n        // Add logic here to look up the user from the credentials supplied\n\n        if (credentials) {\n          const dbUser = await db.query.users.findFirst({\n            where: eq(users.username, credentials.username),\n          })\n\n          if (!dbUser) return null\n\n          const passwordResult = await bcrpyt.compare(\n            credentials.password,\n            dbUser.passwordHash\n          )\n\n          if (!passwordResult) return null\n\n          return {\n            name: dbUser.name,\n            id: dbUser.id.toString(),\n            username: dbUser.username,\n          }\n        } else {\n          return null\n        }\n      },\n    }),\n  ],\n  callbacks: {\n    jwt({ token, user }) {\n      if (user) {\n        token.id = user.id\n      }\n      return token\n    },\n    session: ({ session, token }) => {\n      if (session?.user && token?.id) {\n        session.user.id = String(token.id)\n      }\n      return session\n    },\n  },\n}\n\n/**\n * Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file.\n *\n * @see https://next-auth.js.org/configuration/nextjs\n */\nexport const getServerAuthSession = () => getServerSession(authOptions)\n"
  },
  {
    "path": "src/server/db/drizzle/0000_rare_sauron.sql",
    "content": "CREATE TABLE `recipe-buddy_ingredient` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t`scrapedName` text NOT NULL,\n\t`recipeId` integer NOT NULL,\n\tFOREIGN KEY (`recipeId`) REFERENCES `recipe-buddy_recipe`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE TABLE `recipe-buddy_recipe` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t`name` text(256) NOT NULL,\n\t`url` text(512) NOT NULL,\n\t`steps` text,\n\t`imageUrl` text(256)\n);\n--> statement-breakpoint\nCREATE TABLE `recipe-buddy_user` (\n\t`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n\t`name` text(255) NOT NULL,\n\t`username` text(255) NOT NULL,\n\t`passwordHash` text NOT NULL\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `recipe-buddy_user_username_unique` ON `recipe-buddy_user` (`username`);--> statement-breakpoint\nCREATE INDEX `username_idx` ON `recipe-buddy_user` (`name`);"
  },
  {
    "path": "src/server/db/drizzle/0001_worthless_aqueduct.sql",
    "content": "ALTER TABLE `recipe-buddy_recipe` ADD `servings` integer;\n"
  },
  {
    "path": "src/server/db/drizzle/meta/0000_snapshot.json",
    "content": "{\n  \"version\": \"5\",\n  \"dialect\": \"sqlite\",\n  \"id\": \"6d9f7961-4666-469a-bc84-92afae7f2c60\",\n  \"prevId\": \"00000000-0000-0000-0000-000000000000\",\n  \"tables\": {\n    \"recipe-buddy_ingredient\": {\n      \"name\": \"recipe-buddy_ingredient\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"integer\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"autoincrement\": true\n        },\n        \"scrapedName\": {\n          \"name\": \"scrapedName\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"recipeId\": {\n          \"name\": \"recipeId\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"recipe-buddy_ingredient_recipeId_recipe-buddy_recipe_id_fk\": {\n          \"name\": \"recipe-buddy_ingredient_recipeId_recipe-buddy_recipe_id_fk\",\n          \"tableFrom\": \"recipe-buddy_ingredient\",\n          \"tableTo\": \"recipe-buddy_recipe\",\n          \"columnsFrom\": [\"recipeId\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {}\n    },\n    \"recipe-buddy_recipe\": {\n      \"name\": \"recipe-buddy_recipe\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"integer\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"autoincrement\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text(256)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"url\": {\n          \"name\": \"url\",\n          \"type\": \"text(512)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"steps\": {\n          \"name\": \"steps\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"autoincrement\": false\n        },\n        \"imageUrl\": {\n          \"name\": \"imageUrl\",\n          \"type\": \"text(256)\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"autoincrement\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {}\n    },\n    \"recipe-buddy_user\": {\n      \"name\": \"recipe-buddy_user\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"integer\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"autoincrement\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"username\": {\n          \"name\": \"username\",\n          \"type\": \"text(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"passwordHash\": {\n          \"name\": \"passwordHash\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        }\n      },\n      \"indexes\": {\n        \"recipe-buddy_user_username_unique\": {\n          \"name\": \"recipe-buddy_user_username_unique\",\n          \"columns\": [\"username\"],\n          \"isUnique\": true\n        },\n        \"username_idx\": {\n          \"name\": \"username_idx\",\n          \"columns\": [\"name\"],\n          \"isUnique\": false\n        }\n      },\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {}\n    }\n  },\n  \"enums\": {},\n  \"_meta\": {\n    \"schemas\": {},\n    \"tables\": {},\n    \"columns\": {}\n  }\n}\n"
  },
  {
    "path": "src/server/db/drizzle/meta/0001_snapshot.json",
    "content": "{\n  \"version\": \"5\",\n  \"dialect\": \"sqlite\",\n  \"id\": \"ce10c78c-b332-4765-b5d1-932f1db6cf33\",\n  \"prevId\": \"6d9f7961-4666-469a-bc84-92afae7f2c60\",\n  \"tables\": {\n    \"recipe-buddy_ingredient\": {\n      \"name\": \"recipe-buddy_ingredient\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"integer\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"autoincrement\": true\n        },\n        \"scrapedName\": {\n          \"name\": \"scrapedName\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"recipeId\": {\n          \"name\": \"recipeId\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {\n        \"recipe-buddy_ingredient_recipeId_recipe-buddy_recipe_id_fk\": {\n          \"name\": \"recipe-buddy_ingredient_recipeId_recipe-buddy_recipe_id_fk\",\n          \"tableFrom\": \"recipe-buddy_ingredient\",\n          \"tableTo\": \"recipe-buddy_recipe\",\n          \"columnsFrom\": [\"recipeId\"],\n          \"columnsTo\": [\"id\"],\n          \"onDelete\": \"cascade\",\n          \"onUpdate\": \"no action\"\n        }\n      },\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {}\n    },\n    \"recipe-buddy_recipe\": {\n      \"name\": \"recipe-buddy_recipe\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"integer\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"autoincrement\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text(256)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"url\": {\n          \"name\": \"url\",\n          \"type\": \"text(512)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"steps\": {\n          \"name\": \"steps\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"autoincrement\": false\n        },\n        \"imageUrl\": {\n          \"name\": \"imageUrl\",\n          \"type\": \"text(256)\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"autoincrement\": false\n        },\n        \"servings\": {\n          \"name\": \"servings\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"autoincrement\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {}\n    },\n    \"recipe-buddy_user\": {\n      \"name\": \"recipe-buddy_user\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"integer\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"autoincrement\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"username\": {\n          \"name\": \"username\",\n          \"type\": \"text(255)\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        },\n        \"passwordHash\": {\n          \"name\": \"passwordHash\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"autoincrement\": false\n        }\n      },\n      \"indexes\": {\n        \"recipe-buddy_user_username_unique\": {\n          \"name\": \"recipe-buddy_user_username_unique\",\n          \"columns\": [\"username\"],\n          \"isUnique\": true\n        },\n        \"username_idx\": {\n          \"name\": \"username_idx\",\n          \"columns\": [\"name\"],\n          \"isUnique\": false\n        }\n      },\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {}\n    }\n  },\n  \"enums\": {},\n  \"_meta\": {\n    \"schemas\": {},\n    \"tables\": {},\n    \"columns\": {}\n  }\n}\n"
  },
  {
    "path": "src/server/db/drizzle/meta/_journal.json",
    "content": "{\n  \"version\": \"5\",\n  \"dialect\": \"sqlite\",\n  \"entries\": [\n    {\n      \"idx\": 0,\n      \"version\": \"5\",\n      \"when\": 1711809186824,\n      \"tag\": \"0000_rare_sauron\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 1,\n      \"version\": \"5\",\n      \"when\": 1713943610110,\n      \"tag\": \"0001_worthless_aqueduct\",\n      \"breakpoints\": true\n    }\n  ]\n}\n"
  },
  {
    "path": "src/server/db/drizzle-migrate.mjs",
    "content": "import Database from \"better-sqlite3\"\nimport { drizzle } from \"drizzle-orm/better-sqlite3\"\nimport { migrate } from \"drizzle-orm/better-sqlite3/migrator\"\n\nimport * as schema from \"./schema.js\"\n\nexport const sqlite = new Database(process.env.DATABASE_URL ?? \"\")\nexport const db = drizzle(sqlite, { schema })\n\nawait migrate(db, { migrationsFolder: \"./migrations/drizzle\" })\n\nawait sqlite.close()\n"
  },
  {
    "path": "src/server/db/index.ts",
    "content": "import Database from \"better-sqlite3\"\nimport { drizzle } from \"drizzle-orm/better-sqlite3\"\n\nimport * as schema from \"./schema\"\n\nexport const sqlite = new Database(process.env.DATABASE_URL ?? \"\")\nexport const db = drizzle(sqlite, { schema })\n"
  },
  {
    "path": "src/server/db/migrate.ts",
    "content": "import { dirname, join } from \"path\"\nimport { fileURLToPath } from \"url\"\nimport { migrate } from \"drizzle-orm/better-sqlite3/migrator\"\n\nimport { db, sqlite } from \"./index\"\n\nconst __filename = fileURLToPath(import.meta.url) // get the resolved path to the file\nconst __dirname = dirname(__filename)\n\nconst migrationsPath = join(__dirname, \"drizzle\")\n\nawait migrate(db, { migrationsFolder: migrationsPath })\n\nawait sqlite.close()\n"
  },
  {
    "path": "src/server/db/schema.ts",
    "content": "import { InferInsertModel, InferSelectModel, relations } from \"drizzle-orm\"\nimport {\n  index,\n  integer,\n  sqliteTableCreator,\n  text,\n} from \"drizzle-orm/sqlite-core\"\n\nexport const sqLiteTable = sqliteTableCreator((name) => `recipe-buddy_${name}`)\n\nexport const recipes = sqLiteTable(\"recipe\", {\n  id: integer(\"id\", { mode: \"number\" }).primaryKey({ autoIncrement: true }),\n  name: text(\"name\", { length: 256 }).notNull(),\n  url: text(\"url\", { length: 512 }).notNull(),\n  steps: text(\"steps\"),\n  imageUrl: text(\"imageUrl\", { length: 256 }),\n  servings: integer(\"servings\", { mode: \"number\" }),\n})\n\nexport const recipeRelations = relations(recipes, ({ many }) => ({\n  ingredients: many(ingredients),\n}))\n\nexport type Recipe = InferSelectModel<typeof recipes>\nexport type InsertRecipe = InferInsertModel<typeof recipes>\n\nexport const ingredients = sqLiteTable(\"ingredient\", {\n  id: integer(\"id\", { mode: \"number\" }).primaryKey({ autoIncrement: true }),\n  scrapedName: text(\"scrapedName\").notNull(),\n  recipeId: integer(\"recipeId\")\n    .references(() => recipes.id, { onDelete: \"cascade\" })\n    .notNull(),\n})\n\nexport const ingredientRelations = relations(ingredients, ({ one }) => ({\n  recipe: one(recipes, {\n    fields: [ingredients.recipeId],\n    references: [recipes.id],\n  }),\n}))\n\nexport type Ingredient = InferSelectModel<typeof ingredients>\nexport type InsertIngredient = InferInsertModel<typeof ingredients>\n\nexport const users = sqLiteTable(\n  \"user\",\n  {\n    id: integer(\"id\", { mode: \"number\" })\n      .notNull()\n      .primaryKey({ autoIncrement: true }),\n    name: text(\"name\", { length: 255 }).notNull(),\n    username: text(\"username\", { length: 255 }).notNull().unique(),\n    passwordHash: text(\"passwordHash\").notNull(),\n  },\n  (table) => {\n    return {\n      usernameIdx: index(\"username_idx\").on(table.name),\n    }\n  }\n)\n"
  },
  {
    "path": "src/server/db/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es2022\",\n    \"module\": \"esnext\",\n    \"esModuleInterop\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"moduleResolution\": \"Bundler\"\n  }\n}\n"
  },
  {
    "path": "src/styles/globals.css",
    "content": "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer base {\n  :root {\n    --background: 0 0% 100%;\n    --foreground: 222.2 84% 4.9%;\n\n    --card: 0 0% 100%;\n    --card-foreground: 222.2 84% 4.9%;\n\n    --popover: 0 0% 100%;\n    --popover-foreground: 222.2 84% 4.9%;\n\n    --primary: 222.2 47.4% 11.2%;\n    --primary-foreground: 210 40% 98%;\n\n    --secondary: 210 40% 96.1%;\n    --secondary-foreground: 222.2 47.4% 11.2%;\n\n    --muted: 210 40% 96.1%;\n    --muted-foreground: 215.4 16.3% 46.9%;\n\n    --accent: 210 40% 96.1%;\n    --accent-foreground: 222.2 47.4% 11.2%;\n\n    --destructive: 0 84.2% 60.2%;\n    --destructive-foreground: 210 40% 98%;\n\n    --border: 214.3 31.8% 91.4%;\n    --input: 214.3 31.8% 91.4%;\n    --ring: 222.2 84% 4.9%;\n\n    --radius: 0.5rem;\n  }\n\n  .dark {\n    --background: 222.2 84% 4.9%;\n    --foreground: 210 40% 98%;\n\n    --card: 222.2 84% 4.9%;\n    --card-foreground: 210 40% 98%;\n\n    --popover: 222.2 84% 4.9%;\n    --popover-foreground: 210 40% 98%;\n\n    --primary: 210 40% 98%;\n    --primary-foreground: 222.2 47.4% 11.2%;\n\n    --secondary: 217.2 32.6% 17.5%;\n    --secondary-foreground: 210 40% 98%;\n\n    --muted: 217.2 32.6% 17.5%;\n    --muted-foreground: 215 20.2% 65.1%;\n\n    --accent: 217.2 32.6% 17.5%;\n    --accent-foreground: 210 40% 98%;\n\n    --destructive: 0 62.8% 30.6%;\n    --destructive-foreground: 210 40% 98%;\n\n    --border: 217.2 32.6% 17.5%;\n    --input: 217.2 32.6% 17.5%;\n    --ring: 212.7 26.8% 83.9%;\n  }\n}\n\n@layer base {\n  * {\n    @apply border-border;\n  }\n  body {\n    @apply bg-background text-foreground;\n  }\n}\n"
  },
  {
    "path": "src/trpc/react.tsx",
    "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport {\n  MutationCache,\n  QueryCache,\n  QueryClient,\n  QueryClientProvider,\n} from \"@tanstack/react-query\"\nimport { loggerLink, unstable_httpBatchStreamLink } from \"@trpc/client\"\nimport { createTRPCReact } from \"@trpc/react-query\"\nimport { type AppRouter } from \"~/server/api/root\"\nimport { toast } from \"sonner\"\n\nimport { getUrl, transformer } from \"./shared\"\n\nexport const api = createTRPCReact<AppRouter>()\n\nexport function TRPCReactProvider(props: {\n  children: React.ReactNode\n  cookies: string\n}) {\n  const [queryClient] = useState(\n    () =>\n      new QueryClient({\n        queryCache: new QueryCache({\n          onError: (error, query) => {\n            if (query.state.data !== undefined) {\n              const title =\n                (query.meta?.title as string) ?? \"Something went wrong\"\n              const description =\n                (query.meta?.description as string) ??\n                (error instanceof Error && `${error.message}`)\n\n              toast.error(title, { description })\n            }\n          },\n        }),\n        mutationCache: new MutationCache({\n          onError: (error, _, __, mutation) => {\n            const title =\n              (mutation.meta?.title as string) ?? \"Something went wrong\"\n            const description =\n              (mutation.meta?.description as string) ??\n              (error instanceof Error && `${error.message}`)\n\n            toast.error(title, { description })\n          },\n        }),\n      })\n  )\n\n  const [trpcClient] = useState(() =>\n    api.createClient({\n      transformer,\n      links: [\n        loggerLink({\n          enabled: (op) =>\n            process.env.NODE_ENV === \"development\" ||\n            (op.direction === \"down\" && op.result instanceof Error),\n        }),\n        unstable_httpBatchStreamLink({\n          url: getUrl(),\n          headers() {\n            return {\n              cookie: props.cookies,\n              \"x-trpc-source\": \"react\",\n            }\n          },\n        }),\n      ],\n    })\n  )\n\n  return (\n    <QueryClientProvider client={queryClient}>\n      <api.Provider client={trpcClient} queryClient={queryClient}>\n        {props.children}\n      </api.Provider>\n    </QueryClientProvider>\n  )\n}\n"
  },
  {
    "path": "src/trpc/server.ts",
    "content": "import \"server-only\"\n\nimport { cache } from \"react\"\nimport { cookies } from \"next/headers\"\nimport {\n  createTRPCProxyClient,\n  loggerLink,\n  TRPCClientError,\n} from \"@trpc/client\"\nimport { callProcedure } from \"@trpc/server\"\nimport { observable } from \"@trpc/server/observable\"\nimport { type TRPCErrorResponse } from \"@trpc/server/rpc\"\nimport { appRouter, type AppRouter } from \"~/server/api/root\"\nimport { createTRPCContext } from \"~/server/api/trpc\"\n\nimport { transformer } from \"./shared\"\n\n/**\n * This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when\n * handling a tRPC call from a React Server Component.\n */\nconst createContext = cache(() => {\n  return createTRPCContext({\n    headers: new Headers({\n      cookie: cookies().toString(),\n      \"x-trpc-source\": \"rsc\",\n    }),\n  })\n})\n\nexport const api = createTRPCProxyClient<AppRouter>({\n  transformer,\n  links: [\n    loggerLink({\n      enabled: (op) =>\n        process.env.NODE_ENV === \"development\" ||\n        (op.direction === \"down\" && op.result instanceof Error),\n    }),\n    /**\n     * Custom RSC link that lets us invoke procedures without using http requests. Since Server\n     * Components always run on the server, we can just call the procedure as a function.\n     */\n    () =>\n      ({ op }) =>\n        observable((observer) => {\n          createContext()\n            .then((ctx) => {\n              return callProcedure({\n                procedures: appRouter._def.procedures,\n                path: op.path,\n                rawInput: op.input,\n                ctx,\n                type: op.type,\n              })\n            })\n            .then((data) => {\n              observer.next({ result: { data } })\n              observer.complete()\n            })\n            .catch((cause: TRPCErrorResponse) => {\n              observer.error(TRPCClientError.from(cause))\n            })\n        }),\n  ],\n})\n"
  },
  {
    "path": "src/trpc/shared.ts",
    "content": "import { type inferRouterInputs, type inferRouterOutputs } from \"@trpc/server\"\nimport { type AppRouter } from \"~/server/api/root\"\nimport superjson from \"superjson\"\n\nexport const transformer = superjson\n\nfunction getBaseUrl() {\n  if (typeof window !== \"undefined\") return \"\"\n  if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`\n  return `http://localhost:${process.env.PORT ?? 3000}`\n}\n\nexport function getUrl() {\n  return getBaseUrl() + \"/api/trpc\"\n}\n\n/**\n * Inference helper for inputs.\n *\n * @example type HelloInput = RouterInputs['example']['hello']\n */\nexport type RouterInputs = inferRouterInputs<AppRouter>\n\n/**\n * Inference helper for outputs.\n *\n * @example type HelloOutput = RouterOutputs['example']['hello']\n */\nexport type RouterOutputs = inferRouterOutputs<AppRouter>\n"
  },
  {
    "path": "src/types/index.d.ts",
    "content": "import { Icons } from \"~/components/icons\"\n\nexport type NavItem = {\n  title: string\n  href: string\n  disabled?: boolean\n}\n\nexport type MainNavItem = NavItem\n\nexport type SidebarNavItem = {\n  title: string\n  disabled?: boolean\n  external?: boolean\n  icon?: keyof typeof Icons\n} & (\n  | {\n      href: string\n      items?: never\n    }\n  | {\n      href?: string\n      items: NavLink[]\n    }\n)\n\nexport type SiteConfig = {\n  name: string\n  description: string\n  url: string\n  ogImage: string\n  links: {\n    twitter: string\n    github: string\n  }\n}\n\nexport type DocsConfig = {\n  mainNav: MainNavItem[]\n  sidebarNav: SidebarNavItem[]\n}\n\nexport type MarketingConfig = {\n  mainNav: MainNavItem[]\n}\n\nexport type DashboardConfig = {\n  mainNav: MainNavItem[]\n  sidebarNav: SidebarNavItem[]\n}\n\nexport type SubscriptionPlan = {\n  name: string\n  description: string\n  stripePriceId: string\n}\n"
  },
  {
    "path": "tailwind.config.js",
    "content": "/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n  darkMode: [\"class\"],\n  content: [\n    './pages/**/*.{ts,tsx}',\n    './components/**/*.{ts,tsx}',\n    './app/**/*.{ts,tsx}',\n    './src/**/*.{ts,tsx}',\n  ],\n  prefix: \"\",\n  theme: {\n    container: {\n      center: true,\n      padding: \"2rem\",\n      screens: {\n        \"2xl\": \"1400px\",\n      },\n    },\n    extend: {\n      colors: {\n        border: \"hsl(var(--border))\",\n        input: \"hsl(var(--input))\",\n        ring: \"hsl(var(--ring))\",\n        background: \"hsl(var(--background))\",\n        foreground: \"hsl(var(--foreground))\",\n        primary: {\n          DEFAULT: \"hsl(var(--primary))\",\n          foreground: \"hsl(var(--primary-foreground))\",\n        },\n        secondary: {\n          DEFAULT: \"hsl(var(--secondary))\",\n          foreground: \"hsl(var(--secondary-foreground))\",\n        },\n        destructive: {\n          DEFAULT: \"hsl(var(--destructive))\",\n          foreground: \"hsl(var(--destructive-foreground))\",\n        },\n        muted: {\n          DEFAULT: \"hsl(var(--muted))\",\n          foreground: \"hsl(var(--muted-foreground))\",\n        },\n        accent: {\n          DEFAULT: \"hsl(var(--accent))\",\n          foreground: \"hsl(var(--accent-foreground))\",\n        },\n        popover: {\n          DEFAULT: \"hsl(var(--popover))\",\n          foreground: \"hsl(var(--popover-foreground))\",\n        },\n        card: {\n          DEFAULT: \"hsl(var(--card))\",\n          foreground: \"hsl(var(--card-foreground))\",\n        },\n      },\n      borderRadius: {\n        lg: \"var(--radius)\",\n        md: \"calc(var(--radius) - 2px)\",\n        sm: \"calc(var(--radius) - 4px)\",\n      },\n      keyframes: {\n        \"accordion-down\": {\n          from: { height: \"0\" },\n          to: { height: \"var(--radix-accordion-content-height)\" },\n        },\n        \"accordion-up\": {\n          from: { height: \"var(--radix-accordion-content-height)\" },\n          to: { height: \"0\" },\n        },\n      },\n      animation: {\n        \"accordion-down\": \"accordion-down 0.2s ease-out\",\n        \"accordion-up\": \"accordion-up 0.2s ease-out\",\n      },\n    },\n  },\n  plugins: [require(\"tailwindcss-animate\")],\n}"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    /* Base Options: */\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"es2022\",\n    \"allowJs\": true,\n    \"resolveJsonModule\": true,\n    \"moduleDetection\": \"force\",\n    \"isolatedModules\": true,\n\n    /* Strictness */\n    \"strict\": true,\n    \"noUncheckedIndexedAccess\": true,\n    \"checkJs\": true,\n\n    /* Bundled projects */\n    \"lib\": [\"dom\", \"dom.iterable\", \"ES2022\"],\n    \"noEmit\": true,\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"jsx\": \"preserve\",\n    \"plugins\": [{ \"name\": \"next\" }],\n    \"incremental\": true,\n\n    /* Path Aliases */\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    }\n  },\n  \"include\": [\n    \".eslintrc.cjs\",\n    \"next-env.d.ts\",\n    \"**/*.ts\",\n    \"**/*.tsx\",\n    \"**/*.cjs\",\n    \"**/*.js\",\n    \".next/types/**/*.ts\"\n  ],\n  \"exclude\": [\"node_modules\"]\n}\n"
  }
]