[
  {
    "path": ".changeset/config.json",
    "content": "{\n  \"$schema\": \"https://unpkg.com/@changesets/config@3.0.0/schema.json\",\n  \"changelog\": \"@changesets/cli/changelog\",\n  \"commit\": false,\n  \"fixed\": [],\n  \"linked\": [],\n  \"access\": \"restricted\",\n  \"baseBranch\": \"main\",\n  \"updateInternalDependencies\": \"patch\",\n  \"ignore\": []\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "# EditorConfig is awesome: https://EditorConfig.org\n\n# top-most EditorConfig file\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = false"
  },
  {
    "path": ".github/FUNDING.yaml",
    "content": "# These are supported funding model platforms\ngithub: [ixahmedxi]\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n---\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yaml",
    "content": "blank_issues_enabled: false\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE/pull_request_template.md",
    "content": "Fixes #\n\n## Proposed Changes\n\n-\n-\n-\n"
  },
  {
    "path": ".github/workflows/main-ci.yml",
    "content": "name: Main CI\n\non:\n  push:\n    branches:\n      - main\n      # TODO: remove this once next branch is merged into main\n      - next\n\njobs:\n  main-ci:\n    runs-on: ubuntu-latest\n\n    environment: CI\n    env:\n      # Database\n      DATABASE_URL: ${{ secrets.DATABASE_URL }}\n\n      # Clerk\n      NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ vars.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}\n      CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}\n\n      NEXT_PUBLIC_CLERK_SIGN_IN_URL: '/sign-in'\n      NEXT_PUBLIC_CLERK_SIGN_UP_URL: '/sign-up'\n      NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL: '/app'\n      NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL: '/app'\n\n      # Upstash\n      UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}\n      UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}\n\n      # Resend\n      RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 2\n\n      - name: Setup Bun\n        uses: oven-sh/setup-bun@v1\n\n      - name: Install Dependencies\n        run: bun install\n\n      - name: Run DB Migrations\n        run: bun db:migrate\n\n      - name: Check Format\n        run: bun format:check\n\n      - name: Lint\n        run: bun lint\n\n      - name: Typecheck\n        run: bun typecheck\n\n      - name: Build\n        run: bun run build\n"
  },
  {
    "path": ".github/workflows/pr-ci.yml",
    "content": "name: PR CI\n\non: [pull_request]\n\njobs:\n  main-ci:\n    runs-on: ubuntu-latest\n\n    environment: CI\n    env:\n      # Neon\n      NEON_DATABASE_USERNAME: ${{ secrets.NEON_DATABASE_USERNAME }}\n      NEON_API_KEY: ${{ secrets.NEON_API_KEY }}\n      NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }}\n\n      # Clerk\n      NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ vars.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}\n      CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}\n\n      NEXT_PUBLIC_CLERK_SIGN_IN_URL: '/sign-in'\n      NEXT_PUBLIC_CLERK_SIGN_UP_URL: '/sign-up'\n      NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL: '/app'\n      NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL: '/app'\n\n      # Upstash\n      UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}\n      UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}\n\n      # Resend\n      RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 2\n\n      - name: Get branch name\n        id: branch_name\n        uses: tj-actions/branch-names@v8\n\n      - name: Create Neon Branch\n        id: create-branch\n        uses: neondatabase/create-branch-action@v4\n        with:\n          project_id: ${{ env.NEON_PROJECT_ID }}\n          branch_name: pr-${{ github.event.number }}-${{ steps.branch_name.outputs.current_branch }}\n          username: ${{ env.NEON_DATABASE_USERNAME }}\n          api_key: ${{ env.NEON_API_KEY }}\n\n      - name: Set DATABASE_URL\n        shell: bash\n        run: |\n          echo \"DATABASE_URL=${{ steps.create-branch.outputs.db_url }}?sslmode=require\" >> $GITHUB_ENV\n\n      - name: Setup Bun\n        uses: oven-sh/setup-bun@v1\n\n      - name: Install Dependencies\n        run: bun install\n\n      - name: Run DB Migrations\n        run: bun db:migrate\n\n      - name: Check Format\n        run: bun format:check\n\n      - name: Lint\n        run: bun lint\n\n      - name: Typecheck\n        run: bun typecheck\n\n      - name: Build\n        run: bun run build\n"
  },
  {
    "path": ".github/workflows/pr-cleanup.yml",
    "content": "name: Clean up after after a PR is closed or merged\nrun-name: Clean up PR database\non:\n  pull_request:\n    types: [closed]\n\njobs:\n  delete-db-branch:\n    runs-on: ubuntu-latest\n\n    environment: CI\n\n    env:\n      NEON_API_KEY: ${{ secrets.NEON_API_KEY }}\n      NEON_PROJECT_ID: ${{ secrets.NEON_PROJECT_ID }}\n\n    steps:\n      - name: Get branch name\n        id: branch_name\n        uses: tj-actions/branch-names@v8\n\n      - name: Delete Neon Branch\n        uses: neondatabase/delete-branch-action@v3\n        with:\n          project_id: ${{ secrets.NEON_PROJECT_ID }}\n          branch: pr-${{ github.event.number }}-${{ steps.branch_name.outputs.current_branch }}\n          api_key: ${{ secrets.NEON_API_KEY }}\n"
  },
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n.pnpm-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# Snowpack dependency directory (https://snowpack.dev/)\nweb_modules/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional stylelint cache\n.stylelintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variable files\n.env\n.env.development.local\n.env.test.local\n.env.production.local\n.env.local\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n.parcel-cache\n\n# Next.js build output\n.next\nnext-env.d.ts\nout\n\n# Nuxt.js build / generate output\n.nuxt\ndist\n\n# Gatsby files\n.cache/\n# Comment in the public line in if your project uses Gatsby and not Next.js\n# https://nextjs.org/blog/next-9-1#public-directory-support\n# public\n\n# vuepress build output\n.vuepress/dist\n\n# vuepress v2.x temp and cache directory\n.temp\n.cache\n\n# Docusaurus cache and generated files\n.docusaurus\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\n\n# Stores VSCode versions used for testing VSCode extensions\n.vscode-test\n\n# yarn v2\n.yarn/cache\n.yarn/unplugged\n.yarn/build-state.yml\n.yarn/install-state.gz\n.pnp.*\n\n# DS Store files\n.DS_Store\n\n# task file\n.todo"
  },
  {
    "path": ".husky/commit-msg",
    "content": "bun commitlint --edit ${1}"
  },
  {
    "path": ".husky/pre-commit",
    "content": "bun lint-staged"
  },
  {
    "path": ".husky/prepare-commit-msg",
    "content": "# only run this if no git commit message has been provided\n[ -z \"$2\" ] && exec < /dev/tty && bun git-cz --hook || true"
  },
  {
    "path": ".markdownlint.json",
    "content": "{\n  \"extends\": \"markdownlint/style/prettier\",\n  \"first-line-h1\": false,\n  \"no-inline-html\": false,\n  \"no-space-in-emphasis\": false,\n  \"no-duplicate-heading\": false,\n  \"code-block-style\": false\n}\n"
  },
  {
    "path": ".prettierignore",
    "content": ".prettierignore\nnode_modules\n.next\nnext-env.d.ts\n.husky\nbun.lockb\n*.toml\ndrizzle"
  },
  {
    "path": ".vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"esbenp.prettier-vscode\",\n    \"dbaeumer.vscode-eslint\",\n    \"mikestead.dotenv\",\n    \"streetsidesoftware.code-spell-checker\",\n    \"aaron-bond.better-comments\",\n    \"EditorConfig.EditorConfig\",\n    \"dsznajder.es7-react-js-snippets\",\n    \"tamasfe.even-better-toml\",\n    \"DavidAnson.vscode-markdownlint\",\n    \"unifiedjs.vscode-mdx\",\n    \"christian-kohler.path-intellisense\",\n    \"YoavBls.pretty-ts-errors\",\n    \"bradlc.vscode-tailwindcss\"\n  ]\n}\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  // Editor\n  \"editor.tabSize\": 2,\n  \"editor.formatOnSave\": true,\n  \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n\n  // ESLint\n  \"editor.codeActionsOnSave\": {\n    \"source.fixAll.eslint\": \"explicit\"\n  },\n  \"eslint.rules.customizations\": [\n    {\n      \"rule\": \"*\",\n      \"severity\": \"warn\"\n    }\n  ],\n  \"eslint.useFlatConfig\": true,\n\n  // Tailwind\n  \"files.associations\": {\n    \"*.css\": \"tailwindcss\"\n  },\n  \"tailwindCSS.experimental.classRegex\": [\n    [\"cva\\\\(([^)]*)\\\\)\", \"[\\\"'`]([^\\\"'`]*).*?[\\\"'`]\"],\n    [\"cx\\\\(([^)]*)\\\\)\", \"(?:'|\\\"|`)([^']*)(?:'|\\\"|`)\"]\n  ],\n\n  // TypeScript\n  \"typescript.tsdk\": \"node_modules/typescript/lib\"\n}\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participation in our\ncommunity a harassment-free experience for everyone, regardless of age, body\nsize, visible or invisible disability, ethnicity, sex characteristics, gender\nidentity and expression, level of experience, education, socio-economic status,\nnationality, personal appearance, race, caste, color, religion, or sexual\nidentity and orientation.\n\nWe pledge to act and interact in ways that contribute to an open, welcoming,\ndiverse, inclusive, and healthy community.\n\n## Our Standards\n\nExamples of behavior that contributes to a positive environment for our\ncommunity include:\n\n- Demonstrating empathy and kindness toward other people\n- Being respectful of differing opinions, viewpoints, and experiences\n- Giving and gracefully accepting constructive feedback\n- Accepting responsibility and apologizing to those affected by our mistakes,\n  and learning from the experience\n- Focusing on what is best not just for us as individuals, but for the overall\n  community\n\nExamples of unacceptable behavior include:\n\n- The use of sexualized language or imagery, and sexual attention or advances of\n  any kind\n- Trolling, insulting or derogatory comments, and personal or political attacks\n- Public or private harassment\n- Publishing others' private information, such as a physical or email address,\n  without their explicit permission\n- Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Enforcement Responsibilities\n\nCommunity leaders are responsible for clarifying and enforcing our standards of\nacceptable behavior and will take appropriate and fair corrective action in\nresponse to any behavior that they deem inappropriate, threatening, offensive,\nor harmful.\n\nCommunity leaders have the right and responsibility to remove, edit, or reject\ncomments, commits, code, wiki edits, issues, and other contributions that are\nnot aligned to this Code of Conduct, and will communicate reasons for moderation\ndecisions when appropriate.\n\n## Scope\n\nThis Code of Conduct applies within all community spaces, and also applies when\nan individual is officially representing the community in public spaces.\nExamples of representing our community include using an official email address,\nposting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported to the community leaders responsible for enforcement at\n[ahmed@noodle.run](mailto:ahmed@noodle.run).\nAll complaints will be reviewed and investigated promptly and fairly.\n\nAll community leaders are obligated to respect the privacy and security of the\nreporter of any incident.\n\n## Enforcement Guidelines\n\nCommunity leaders will follow these Community Impact Guidelines in determining\nthe consequences for any action they deem in violation of this Code of Conduct:\n\n### 1. Correction\n\n**Community Impact**: Use of inappropriate language or other behavior deemed\nunprofessional or unwelcome in the community.\n\n**Consequence**: A private, written warning from community leaders, providing\nclarity around the nature of the violation and an explanation of why the\nbehavior was inappropriate. A public apology may be requested.\n\n### 2. Warning\n\n**Community Impact**: A violation through a single incident or series of\nactions.\n\n**Consequence**: A warning with consequences for continued behavior. No\ninteraction with the people involved, including unsolicited interaction with\nthose enforcing the Code of Conduct, for a specified period of time. This\nincludes avoiding interactions in community spaces as well as external channels\nlike social media. Violating these terms may lead to a temporary or permanent\nban.\n\n### 3. Temporary Ban\n\n**Community Impact**: A serious violation of community standards, including\nsustained inappropriate behavior.\n\n**Consequence**: A temporary ban from any sort of interaction or public\ncommunication with the community for a specified period of time. No public or\nprivate interaction with the people involved, including unsolicited interaction\nwith those enforcing the Code of Conduct, is allowed during this period.\nViolating these terms may lead to a permanent ban.\n\n### 4. Permanent Ban\n\n**Community Impact**: Demonstrating a pattern of violation of community\nstandards, including sustained inappropriate behavior, harassment of an\nindividual, or aggression toward or disparagement of classes of individuals.\n\n**Consequence**: A permanent ban from any sort of public interaction within the\ncommunity.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage],\nversion 2.1, available at\n[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].\n\nCommunity Impact Guidelines were inspired by\n[Mozilla's code of conduct enforcement ladder][Mozilla CoC].\n\nFor answers to common questions about this code of conduct, see the FAQ at\n[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at\n[https://www.contributor-covenant.org/translations][translations].\n\n[homepage]: https://www.contributor-covenant.org\n[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html\n[Mozilla CoC]: https://github.com/mozilla/diversity\n[FAQ]: https://www.contributor-covenant.org/faq\n[translations]: https://www.contributor-covenant.org/translations\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Noodle's contributing guidelines\n\nThank you for your interest in contributing to our project! Any contribution is highly appreciated and will be reflected on our project ✨\n\nFirst things first, make sure you read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectable.\n\nIn this guide, you will get an overview of the project structure and setup, as well as the workflow from opening an issue, creating a PR, reviewing, and merging the PR.\n\n## Table of contents\n\n- [Noodle's contributing guidelines](#noodles-contributing-guidelines)\n  - [Table of contents](#table-of-contents)\n  - [New contributor guide](#new-contributor-guide)\n  - [Getting your foot in](#getting-your-foot-in)\n    - [Some simple rules](#some-simple-rules)\n  - [The tech stack](#the-tech-stack)\n  - [Getting stuff running](#getting-stuff-running)\n    - [Cloning the repo](#cloning-the-repo)\n    - [Bun](#bun)\n    - [Installing dependencies](#installing-dependencies)\n    - [Environment Variables](#environment-variables)\n    - [Running stuff](#running-stuff)\n  - [Closing notes](#closing-notes)\n\n## New contributor guide\n\nHere are some resources to help you get started with open source contributions:\n\n- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)\n- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)\n- [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow)\n- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)\n\n## Getting your foot in\n\nOur preferred way of providing the opportunity for people to contribute to Noodle is through a process that starts with creating a new issue, the summary of the workflow that you can expect and should adhere to is the following:\n\n- You see an area of improvement in the code base, this could be a fix, feature, refactoring...etc\n- Create an [issue](https://github.com/noodle-run/noodle/issues) on our Github repository.\n- Wait until a team member discusses the issue with you, and if both parties are in agreement, you can start working on the issue.\n- Once work has started, you can create a draft pull request and remember to link your pull request with the issue.\n- Once the work is complete, change the status of the pull request to ready for review.\n- We will review the pull request and if all is good, congratulations! 🥳 you are now a Noodle contributor!\n- If not, we will explain the changes that need to be made for the pull request to be merged or why it can't be merged.\n\nIf you would like to be more involved in the development of Noodle, we would like to invite you to our [Discord Server](https://discord.gg/SERySfj8Eg) where we can have a chat together and get you involved in the project!\n\n### Some simple rules\n\n- Don't work on an issue that is already being worked on by someone else.\n- Don't work on something without getting a team member's approval, this is to not waste your time by making you work on something that won't be merged.\n- Don't demand for your pull request to be approved and merged.\n- Be nice to everyone involved, we are aiming to create a positive community around collaborating and contributing towards Noodle's development.\n\n## The tech stack\n\nThe Runtime:\n\n- [Bun](https://bun.sh/)\n\nThe Tech Stack:\n\n- [Next.js App Router](https://nextjs.org/)\n- [TailwindCSS](https://tailwindcss.com/)\n- [tRPC](https://trpc.io)\n- [Drizzle ORM](https://orm.drizzle.team/)\n- [ShadCN UI](https://ui.shadcn.com)\n- [NeonDB](https://neon.tech)\n- [Clerk Auth](https://clerk.dev/)\n- [Upstash](https://upstash.com)\n- [Resend](https://resend.com)\n\nDevelopment stuff:\n\n- [ESLint](https://eslint.org/)\n- [Prettier](https://prettier.io)\n\nThere are a lot of other technologies being used in this project, however these are the most important and influential bits of it.\n\n## Getting stuff running\n\n### Cloning the repo\n\nTo clone the repo, you firstly need to [fork](https://github.com/noodle-run/noodle/fork) it, and then clone your copy of noodle locally.\n\n```bash\ngit clone https://github.com/<your-gh-username>/noodle.git\n```\n\n### Bun\n\nBun is used as the package manager of Noodle, with Bun, you don't need to have NodeJS installed at all on your system to be able to run Noodle. The only tool you need to install dependencies & run Noodle is Bun!\n\nTo install bun, head over to [their website](https://bun.sh/) which will tell you how to get it installed on your system.\n\nTo check that you have Bun installed, simply run the following command:\n\n```bash\nbun --version\n```\n\nIf this commands outputs a version number, you're all good to go.\n\n### Installing dependencies\n\nWith bun installed on your machine, the next step would be to install the dependencies that Noodle relies upon to work, to do this, run the following command:\n\n```bash\nbun install\n```\n\n### Environment Variables\n\nNow that Bun & dependencies has been installed, it's time to configure your environment variables so that the project works as expected:\n\n1.  Duplicate the `.env.example` file as just `.env`\n2.  Populate the values with your own, you will need to sign up to some services in the process.\n\nYou can checkout which variables are needed and which are optional in the `src/env.ts` file.\n\n### Running stuff\n\n```bash\n# Run the project's dev server\nbun dev\n\n# Build the project\nbun run build\n\n# Run the built project in production mode\nbun start\n\n# Run the typecheck script\nbun typecheck\n\n# Lint using ESLint\nbun lint\n\n# Format using Prettier\nbun format\n```\n\n## Closing notes\n\nAgain, thank you so much for your interest in contributing to Noodle, we really appreciate it, and if there is anything we can do to help your journey, make sure to join our [Discord Server](https://discord.gg/SERySfj8Eg).\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\nCopyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\nEveryone is permitted to copy and distribute verbatim copies\nof this license document, but changing it is not allowed.\n\n                            Preamble\n\nThe GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\nThe licenses for most software and other practical works are designed\nto take away your freedom to share and change the works. By contrast,\nour General Public Licenses are 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.\n\nWhen 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\nDevelopers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\nA secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate. Many developers of free software are heartened and\nencouraged by the resulting cooperation. However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\nThe GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community. It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server. Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\nAn older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals. This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\nThe precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n0. Definitions.\n\n\"This License\" refers to version 3 of the GNU Affero 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\nTo \"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\nA \"covered work\" means either the unmodified Program or a work based\non the Program.\n\nTo \"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\nTo \"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\nAn 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\n1. Source Code.\n\nThe \"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\nA \"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\nThe \"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\nThe \"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\nThe Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\nThe Corresponding Source for a work in source code form is that\nsame work.\n\n2. Basic Permissions.\n\nAll 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\nYou 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\nConveying under any other circumstances is permitted solely under\nthe conditions stated below. Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\nNo 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\nWhen 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\n4. Conveying Verbatim Copies.\n\nYou 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\nYou 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\n5. Conveying Modified Source Versions.\n\nYou 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\nA 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\n6. Conveying Non-Source Forms.\n\nYou 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\nA 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\nA \"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\nIf 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\nThe 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\nCorresponding 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\n7. 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\nWhen 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\nNotwithstanding 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\nAll 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\nIf 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\nAdditional 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\n8. Termination.\n\nYou 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\nHowever, 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\nMoreover, 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\nTermination 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\n9. Acceptance Not Required for Having Copies.\n\nYou 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\n10. Automatic Licensing of Downstream Recipients.\n\nEach 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\nAn \"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\nYou 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\n11. Patents.\n\nA \"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\nA 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\nEach 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\nIn 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\nIf 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\nIf, 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\nA 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\nNothing 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\n12. No Surrender of Others' Freedom.\n\nIf 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\n13. Remote Network Interaction; Use with the GNU General Public License.\n\nNotwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software. This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\nNotwithstanding 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 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 work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n14. Revised Versions of this License.\n\nThe Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time. Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number. If the\nProgram specifies that a certain numbered version of the GNU Affero 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 Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\nIf the Program specifies that a proxy can decide which future\nversions of the GNU Affero 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\nLater 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\n15. Disclaimer of Warranty.\n\nTHERE 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\n16. Limitation of Liability.\n\nIN 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\n17. Interpretation of Sections 15 and 16.\n\nIf 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\nIf 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\nTo 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    Noodle - A productivity web application for students including many tools they need to be productive.\n    Copyright (C) 2024 NOODLE RUN LTD.\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero 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 Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero 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\nIf your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source. For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code. There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\nYou 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 AGPL, see\n<https://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "README.md",
    "content": "<div align=\"center\">\n  <img src=\"https://github.com/noodle-run/noodle/blob/main/public/logo.svg?raw=true\" alt=\"Noodle logo\" width=\"75\">\n  <h1>Noodle <br> Rethinking Student Productivity</h1>\n  <br>\n</div>\n\n> **Warning**\n> This is a work-in-progress and not the finished product.\n>\n> Noodle is still in active development towards a minimal viable product (MVP).\n>\n> Follow me on twitter [@ixahmedxii](https://twitter.com/ixahmedxii) for updates.\n\n![Noodle Preview](https://github.com/noodle-run/noodle/blob/main/public/_static/dark-dashboard-preview.jpg?raw=true)\n\n<p align=\"center\" style=\"color:dodgerblue;\"><strong>⚠️ This is a UI design mockup of what the platform will look like, it is not the current state of the project.</strong></p>\n\n## Purpose\n\nNoodle as an idea came from the struggles that I faced during my university years. I was using multiple apps to try and stay on track with my studies, and I thought to myself, why is there no singular app that can do everything a student needs to stay on track with their studies? Like a GitHub but for students.\n\n## Planned MVP Features\n\n- ✍️ Note Taking\n- 📚 Flashcards\n\nThe flashcards will be generated from the notes that you take, and you will be able to quiz yourself on them.\n\n## Future Features\n\n- 📅 Calendar\n- 📝 Task management\n- 📊 Grade tracking\n\nFeel free to suggest more features by opening an issue, or join our [Discord server](https://discord.gg/ewKmQd8kYm) to discuss it with the community.\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=noodle-run/noodle#gh-light-mode-only)](https://star-history.com/#noodle-run/noodle#gh-light-mode-only)\n[![Star History Chart](https://api.star-history.com/svg?repos=noodle-run/noodle&theme=dark#gh-dark-mode-only)](https://star-history.com/#noodle-run/noodle#gh-dark-mode-only)\n\n## Contributing\n\nIf you would like to contribute to Noodle, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) file to get started.\n\n## License\n\nNoodle is open source and available under the [AGPL-3.0-or-later](./LICENSE) license.\n"
  },
  {
    "path": "SECURITY.md",
    "content": "# Noodle Security\n\n## Reporting a Vulnerability\n\nTo report a security issue, please [open a security advisory](https://github.com/noodle-run/noodle/security/advisories/new) on GitHub with a detailed description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue.\n\nPlease remember to include everything required for us to reproduce the issue, including but not limited to a publicly accessible git repository and/or StackBlitz repository.\n"
  },
  {
    "path": "cspell.config.yaml",
    "content": "$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json\nversion: '0.2'\nignorePaths:\n  - node_modules\n  - bun.lockb\n  - .tsbuildinfo\n  - .gitignore\n  - .next\n  - drizzle\n  - '**/*.svg'\n  - .vscode/extensions.json\n  - public\n  - tsconfig.tsbuildinfo\n  - branch_out\nwords:\n  - activecampaign\n  - aeiou\n  - Arcjet\n  - asana\n  - autopilotmail\n  - autoresponder\n  - bcdfghj\n  - bigcommerce\n  - callees\n  - classname\n  - clsx\n  - commitlint\n  - compat\n  - constantcontact\n  - customerservice\n  - esbenp\n  - facebookmail\n  - freshdesk\n  - frontmatter\n  - healthcheck\n  - helpdesk\n  - helpscout\n  - hookform\n  - hubspot\n  - ianvs\n  - ixahmedxi\n  - ixahmedxii\n  - jiti\n  - lockb\n  - lucide\n  - mailchimp\n  - mailgun\n  - marketo\n  - mitigations\n  - neondatabase\n  - nextjs\n  - noreplys\n  - packagejson\n  - paralleldrive\n  - pinterest\n  - pipedrive\n  - Posthog\n  - postmarkapp\n  - ratelimit\n  - redditmail\n  - Registrator\n  - sendgrid\n  - sendinblue\n  - serviceworker\n  - Shadcn\n  - Signin\n  - Signup\n  - Sonner\n  - sslmode\n  - superjson\n  - tailwindcss\n  - tanstack\n  - tawk\n  - timeago\n  - Todos\n  - trpc\n  - tsbuildinfo\n  - tseslint\n  - typecheck\n  - Uploadthing\n  - Upstash\n  - usehooks\n"
  },
  {
    "path": "drizzle/0000_funny_johnny_blaze.sql",
    "content": "CREATE TABLE IF NOT EXISTS \"early_access\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"email\" text NOT NULL,\n\t\"reason\" text NOT NULL,\n\t\"approved\" boolean DEFAULT false,\n\t\"created_at\" timestamp (3) DEFAULT now(),\n\t\"invitation_sent_at\" timestamp (3),\n\tCONSTRAINT \"early_access_email_unique\" UNIQUE(\"email\")\n);\n"
  },
  {
    "path": "drizzle/0001_minor_warlock.sql",
    "content": "CREATE TABLE IF NOT EXISTS \"modules\" (\n\t\"id\" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,\n\t\"user_id\" text NOT NULL,\n\t\"name\" text NOT NULL,\n\t\"description\" text NOT NULL,\n\t\"code\" text NOT NULL,\n\t\"icon\" text DEFAULT 'default' NOT NULL,\n\t\"color\" text DEFAULT 'default' NOT NULL,\n\t\"archived\" boolean DEFAULT false NOT NULL,\n\t\"credits\" integer DEFAULT 0 NOT NULL,\n\t\"created_at\" timestamp DEFAULT now() NOT NULL,\n\t\"modified_at\" timestamp DEFAULT now() NOT NULL,\n\t\"last_visited\" timestamp DEFAULT now() NOT NULL,\n\tCONSTRAINT \"modules_id_unique\" UNIQUE(\"id\")\n);\n"
  },
  {
    "path": "drizzle/0002_complex_sally_floyd.sql",
    "content": "ALTER TABLE \"modules\" ALTER COLUMN \"description\" DROP NOT NULL;"
  },
  {
    "path": "drizzle/meta/0000_snapshot.json",
    "content": "{\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.early_access\": {\n      \"name\": \"early_access\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"reason\": {\n          \"name\": \"reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"approved\": {\n          \"name\": \"approved\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp (3)\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": \"now()\"\n        },\n        \"invitation_sent_at\": {\n          \"name\": \"invitation_sent_at\",\n          \"type\": \"timestamp (3)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"early_access_email_unique\": {\n          \"name\": \"early_access_email_unique\",\n          \"columns\": [\n            \"email\"\n          ],\n          \"nullsNotDistinct\": false\n        }\n      }\n    }\n  },\n  \"enums\": {},\n  \"schemas\": {},\n  \"_meta\": {\n    \"schemas\": {},\n    \"tables\": {},\n    \"columns\": {}\n  },\n  \"id\": \"b304d26a-1927-40c9-9067-57935d6d9ab3\",\n  \"prevId\": \"00000000-0000-0000-0000-000000000000\"\n}"
  },
  {
    "path": "drizzle/meta/0001_snapshot.json",
    "content": "{\n  \"id\": \"e2f7138b-3bc5-4e5c-8e9f-df04364cddcb\",\n  \"prevId\": \"b304d26a-1927-40c9-9067-57935d6d9ab3\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.early_access\": {\n      \"name\": \"early_access\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"reason\": {\n          \"name\": \"reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"approved\": {\n          \"name\": \"approved\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp (3)\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": \"now()\"\n        },\n        \"invitation_sent_at\": {\n          \"name\": \"invitation_sent_at\",\n          \"type\": \"timestamp (3)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"early_access_email_unique\": {\n          \"name\": \"early_access_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      }\n    },\n    \"public.modules\": {\n      \"name\": \"modules\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"code\": {\n          \"name\": \"code\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"icon\": {\n          \"name\": \"icon\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'default'\"\n        },\n        \"color\": {\n          \"name\": \"color\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'default'\"\n        },\n        \"archived\": {\n          \"name\": \"archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"credits\": {\n          \"name\": \"credits\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": 0\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"modified_at\": {\n          \"name\": \"modified_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"last_visited\": {\n          \"name\": \"last_visited\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"modules_id_unique\": {\n          \"name\": \"modules_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"id\"\n          ]\n        }\n      }\n    }\n  },\n  \"enums\": {},\n  \"schemas\": {},\n  \"sequences\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "drizzle/meta/0002_snapshot.json",
    "content": "{\n  \"id\": \"6f3e4fea-8b33-40d5-a9cd-1c4bbb28d564\",\n  \"prevId\": \"e2f7138b-3bc5-4e5c-8e9f-df04364cddcb\",\n  \"version\": \"7\",\n  \"dialect\": \"postgresql\",\n  \"tables\": {\n    \"public.early_access\": {\n      \"name\": \"early_access\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"email\": {\n          \"name\": \"email\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"reason\": {\n          \"name\": \"reason\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"approved\": {\n          \"name\": \"approved\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": false\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp (3)\",\n          \"primaryKey\": false,\n          \"notNull\": false,\n          \"default\": \"now()\"\n        },\n        \"invitation_sent_at\": {\n          \"name\": \"invitation_sent_at\",\n          \"type\": \"timestamp (3)\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"early_access_email_unique\": {\n          \"name\": \"early_access_email_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"email\"\n          ]\n        }\n      }\n    },\n    \"public.modules\": {\n      \"name\": \"modules\",\n      \"schema\": \"\",\n      \"columns\": {\n        \"id\": {\n          \"name\": \"id\",\n          \"type\": \"uuid\",\n          \"primaryKey\": true,\n          \"notNull\": true,\n          \"default\": \"gen_random_uuid()\"\n        },\n        \"user_id\": {\n          \"name\": \"user_id\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"name\": {\n          \"name\": \"name\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"description\": {\n          \"name\": \"description\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": false\n        },\n        \"code\": {\n          \"name\": \"code\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true\n        },\n        \"icon\": {\n          \"name\": \"icon\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'default'\"\n        },\n        \"color\": {\n          \"name\": \"color\",\n          \"type\": \"text\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"'default'\"\n        },\n        \"archived\": {\n          \"name\": \"archived\",\n          \"type\": \"boolean\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": false\n        },\n        \"credits\": {\n          \"name\": \"credits\",\n          \"type\": \"integer\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": 0\n        },\n        \"created_at\": {\n          \"name\": \"created_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"modified_at\": {\n          \"name\": \"modified_at\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        },\n        \"last_visited\": {\n          \"name\": \"last_visited\",\n          \"type\": \"timestamp\",\n          \"primaryKey\": false,\n          \"notNull\": true,\n          \"default\": \"now()\"\n        }\n      },\n      \"indexes\": {},\n      \"foreignKeys\": {},\n      \"compositePrimaryKeys\": {},\n      \"uniqueConstraints\": {\n        \"modules_id_unique\": {\n          \"name\": \"modules_id_unique\",\n          \"nullsNotDistinct\": false,\n          \"columns\": [\n            \"id\"\n          ]\n        }\n      }\n    }\n  },\n  \"enums\": {},\n  \"schemas\": {},\n  \"sequences\": {},\n  \"_meta\": {\n    \"columns\": {},\n    \"schemas\": {},\n    \"tables\": {}\n  }\n}"
  },
  {
    "path": "drizzle/meta/_journal.json",
    "content": "{\n  \"version\": \"6\",\n  \"dialect\": \"postgresql\",\n  \"entries\": [\n    {\n      \"idx\": 0,\n      \"version\": \"6\",\n      \"when\": 1716742272276,\n      \"tag\": \"0000_funny_johnny_blaze\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 1,\n      \"version\": \"7\",\n      \"when\": 1722099574439,\n      \"tag\": \"0001_minor_warlock\",\n      \"breakpoints\": true\n    },\n    {\n      \"idx\": 2,\n      \"version\": \"7\",\n      \"when\": 1724179669909,\n      \"tag\": \"0002_complex_sally_floyd\",\n      \"breakpoints\": true\n    }\n  ]\n}"
  },
  {
    "path": "drizzle.config.ts",
    "content": "import type { Config } from 'drizzle-kit';\n\nimport { env } from '@/env';\n\nexport default {\n  dialect: 'postgresql',\n  schema: './src/db/schema/index.ts',\n  out: './drizzle',\n  strict: true,\n  verbose: true,\n  dbCredentials: {\n    url: env.DATABASE_URL,\n  },\n} satisfies Config;\n"
  },
  {
    "path": "eslint.config.js",
    "content": "import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport comments from '@eslint-community/eslint-plugin-eslint-comments/configs';\nimport { fixupConfigRules } from '@eslint/compat';\nimport { FlatCompat } from '@eslint/eslintrc';\nimport js from '@eslint/js';\nimport eslintConfigPrettier from 'eslint-config-prettier';\nimport jsdoc from 'eslint-plugin-jsdoc';\nimport * as regexpPlugin from 'eslint-plugin-regexp';\nimport pluginSecurity from 'eslint-plugin-security';\nimport tseslint from 'typescript-eslint';\nimport globals from 'globals';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst compat = new FlatCompat({\n  baseDirectory: __dirname,\n  resolvePluginsRelativeTo: __dirname,\n});\n\nexport default tseslint.config(\n  {\n    ignores: ['.next'],\n  },\n\n  // Base configurations\n  js.configs.recommended,\n  ...tseslint.configs.strictTypeChecked,\n  ...tseslint.configs.stylisticTypeChecked,\n\n  // Next.js / React\n  ...fixupConfigRules(compat.extends('plugin:@next/next/recommended')),\n  ...fixupConfigRules(compat.extends('plugin:react/recommended')),\n  ...fixupConfigRules(compat.extends('plugin:react-hooks/recommended')),\n  ...fixupConfigRules(compat.extends('plugin:jsx-a11y/strict')),\n\n  // Tailwind CSS\n  ...fixupConfigRules(compat.extends('plugin:tailwindcss/recommended')),\n\n  // Other plugins\n  comments.recommended,\n  regexpPlugin.configs['flat/recommended'],\n  pluginSecurity.configs.recommended,\n  eslintConfigPrettier,\n\n  // JSDoc plugin only for TypeScript files\n  {\n    files: ['**/*.{ts,tsx}'],\n    extends: [jsdoc.configs['flat/recommended-typescript-error']],\n  },\n\n  // Settings and rule overrides\n  {\n    linterOptions: {\n      reportUnusedDisableDirectives: true,\n    },\n    languageOptions: {\n      parserOptions: {\n        projectService: true,\n        tsconfigRootDir: __dirname,\n      },\n      globals: {\n        ...globals.node,\n        ...globals.browser,\n        ...globals.es2024,\n      },\n    },\n    settings: {\n      react: {\n        version: 'detect',\n      },\n      tailwindcss: {\n        callees: ['classnames', 'clsx', 'ctl', 'cn', 'cva'],\n      },\n    },\n    rules: {\n      '@typescript-eslint/no-unused-vars': [\n        'error',\n        { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },\n      ],\n\n      '@typescript-eslint/consistent-type-imports': [\n        'warn',\n        { prefer: 'type-imports', fixStyle: 'separate-type-imports' },\n      ],\n\n      '@typescript-eslint/no-misused-promises': [\n        'error',\n        { checksVoidReturn: { attributes: false } },\n      ],\n\n      '@typescript-eslint/non-nullable-type-assertion-style': 'off',\n\n      '@typescript-eslint/dot-notation': 'off',\n\n      '@typescript-eslint/no-unnecessary-condition': [\n        'error',\n        {\n          allowConstantLoopConditions: true,\n        },\n      ],\n\n      'react/react-in-jsx-scope': 'off',\n      'react/prop-types': 'off',\n\n      // security\n      'security/detect-non-literal-fs-filename': 'off',\n\n      // we're not building a library here\n      'jsdoc/require-jsdoc': 'off',\n    },\n  },\n);\n"
  },
  {
    "path": "eslint.d.ts",
    "content": "/**\n * Since ESLint and many plugins are written in JavaScript, we need to provide\n * or change some types to make them work with TypeScript.\n */\n\n// From: https://github.com/t3-oss/create-t3-turbo/blob/main/tooling/eslint/types.d.ts\ndeclare module '@eslint/js' {\n  import type { Linter } from 'eslint';\n\n  export const configs: {\n    readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> };\n    readonly all: { readonly rules: Readonly<Linter.RulesRecord> };\n  };\n}\n\ndeclare module '@eslint-community/eslint-plugin-eslint-comments/configs' {\n  import type { Linter } from 'eslint';\n\n  export const recommended: {\n    rules: Linter.RulesRecord;\n  };\n}\n\ndeclare module '@eslint/eslintrc' {\n  import type { Linter } from 'eslint';\n\n  export class FlatCompat {\n    constructor({\n      baseDirectory,\n      resolvePluginsRelativeTo,\n    }: {\n      baseDirectory: string;\n      resolvePluginsRelativeTo: string;\n    });\n\n    extends(extendsValue: string): Linter.Config & {\n      [Symbol.iterator]: () => IterableIterator<Linter.Config>;\n    };\n  }\n}\n\ndeclare module '@eslint/compat' {\n  import type { Linter } from 'eslint';\n  import type { ConfigWithExtends } from 'typescript-eslint';\n\n  export const fixupConfigRules: (\n    config: string | Linter.Config,\n  ) => ConfigWithExtends[];\n}\n\ndeclare module 'eslint-plugin-regexp' {\n  import type { Linter } from 'eslint';\n  import type { ConfigWithExtends } from 'typescript-eslint';\n\n  export const configs: {\n    'flat/recommended': {\n      [Symbol.iterator]: () => IterableIterator<ConfigWithExtends>;\n      rules: Linter.RulesRecord;\n    };\n    'flat/all': {\n      [Symbol.iterator]: () => IterableIterator<ConfigWithExtends>;\n      rules: Linter.RulesRecord;\n    };\n  };\n}\n\ndeclare module 'eslint-plugin-security' {\n  import type { Linter } from 'eslint';\n  import type { ConfigWithExtends } from 'typescript-eslint';\n\n  export const configs: {\n    recommended: {\n      [Symbol.iterator]: () => IterableIterator<ConfigWithExtends>;\n      rules: Linter.RulesRecord;\n    };\n  };\n}\n"
  },
  {
    "path": "next.config.js",
    "content": "import { fileURLToPath } from 'node:url';\n\nimport { createJiti } from 'jiti';\n\nconst jiti = createJiti(fileURLToPath(import.meta.url));\n\nawait jiti.import('./src/env');\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  reactStrictMode: true,\n  transpilePackages: ['next-mdx-remote', 'lucide-react'],\n\n  // We run ESLint and TypeScript separately in the CI pipeline\n  eslint: {\n    ignoreDuringBuilds: true,\n  },\n  typescript: {\n    ignoreBuildErrors: true,\n  },\n  logging: {\n    fetches: {\n      fullUrl: true,\n    },\n  },\n};\n\nexport default nextConfig;\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"noodle\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"description\": \"Rethinking Student Productivity\",\n  \"license\": \"AGPL-3.0-or-later\",\n  \"author\": \"NOODLE RUN LTD.\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"next build\",\n    \"clean\": \"bun run rm -rf .next node_modules *.tsbuildinfo next-env.d.ts\",\n    \"commit\": \"git-cz\",\n    \"db:check\": \"drizzle-kit check\",\n    \"db:generate\": \"drizzle-kit generate\",\n    \"db:migrate\": \"drizzle-kit migrate\",\n    \"db:migrate:drop\": \"drizzle-kit migrate:drop\",\n    \"db:pull\": \"drizzle-kit introspect\",\n    \"db:push\": \"drizzle-kit push\",\n    \"db:studio\": \"drizzle-kit studio\",\n    \"db:up\": \"drizzle-kit up\",\n    \"dev\": \"next dev --turbo\",\n    \"email:dev\": \"SKIP_ENV_VALIDATION=true email dev --port 3001 --dir src/emails/templates\",\n    \"format\": \"pnpm format:write\",\n    \"format:check\": \"prettier \\\"**/*\\\" --ignore-unknown --list-different\",\n    \"format:write\": \"prettier \\\"**/*\\\" --ignore-unknown --list-different --write\",\n    \"lint\": \"bun lint:js && bun lint:md && bun lint:spell\",\n    \"lint:js\": \"eslint . --max-warnings 0\",\n    \"lint:md\": \"markdownlint \\\"**/*.md\\\" \\\".github/**/*.md\\\" --ignore node_modules\",\n    \"lint:spell\": \"cspell \\\"**/*\\\" --no-summary --no-progress\",\n    \"prepare\": \"husky\",\n    \"start\": \"next start\",\n    \"typecheck\": \"tsc\"\n  },\n  \"commitlint\": {\n    \"extends\": [\n      \"@commitlint/config-conventional\"\n    ]\n  },\n  \"lint-staged\": {\n    \"*\": [\n      \"cspell --no-must-find-files\",\n      \"prettier --list-different\"\n    ],\n    \"**/*.{ts,tsx,js,jsx,cjs,mjs}\": [\n      \"eslint\"\n    ],\n    \"**/*.{md,mdx}\": [\n      \"markdownlint\"\n    ]\n  },\n  \"config\": {\n    \"commitizen\": {\n      \"path\": \"@commitlint/cz-commitlint\"\n    }\n  },\n  \"dependencies\": {\n    \"@clerk/nextjs\": \"^5.7.3\",\n    \"@clerk/themes\": \"^2.1.36\",\n    \"@hookform/resolvers\": \"^3.9.0\",\n    \"@neondatabase/serverless\": \"^0.10.1\",\n    \"@paralleldrive/cuid2\": \"^2.2.2\",\n    \"@radix-ui/colors\": \"^3.0.0\",\n    \"@radix-ui/react-checkbox\": \"^1.1.2\",\n    \"@radix-ui/react-dropdown-menu\": \"^2.1.2\",\n    \"@radix-ui/react-label\": \"^2.1.0\",\n    \"@radix-ui/react-navigation-menu\": \"^1.2.1\",\n    \"@radix-ui/react-popover\": \"^1.1.2\",\n    \"@radix-ui/react-scroll-area\": \"^1.2.0\",\n    \"@radix-ui/react-select\": \"^2.1.2\",\n    \"@radix-ui/react-separator\": \"^1.1.0\",\n    \"@radix-ui/react-slot\": \"^1.1.0\",\n    \"@radix-ui/react-tabs\": \"^1.1.1\",\n    \"@react-email/components\": \"^0.0.25\",\n    \"@t3-oss/env-nextjs\": \"^0.11.1\",\n    \"@tanstack/react-query\": \"^5.59.15\",\n    \"@trpc/client\": \"next\",\n    \"@trpc/react-query\": \"next\",\n    \"@trpc/server\": \"next\",\n    \"@upstash/redis\": \"^1.34.3\",\n    \"@vercel/analytics\": \"^1.3.1\",\n    \"@vercel/speed-insights\": \"^1.0.12\",\n    \"class-variance-authority\": \"^0.7.0\",\n    \"clsx\": \"^2.1.1\",\n    \"color\": \"^4.2.3\",\n    \"drizzle-orm\": \"^0.35.1\",\n    \"drizzle-zod\": \"^0.5.1\",\n    \"framer-motion\": \"^11.11.9\",\n    \"geist\": \"^1.3.1\",\n    \"jiti\": \"^2.3.3\",\n    \"lucide-react\": \"^0.453.0\",\n    \"next\": \"14.2.15\",\n    \"next-mdx-remote\": \"^5.0.0\",\n    \"next-themes\": \"^0.3.0\",\n    \"react\": \"^18.3.1\",\n    \"react-animate-height\": \"^3.2.3\",\n    \"react-dom\": \"^18.3.1\",\n    \"react-email\": \"^3.0.1\",\n    \"react-hook-form\": \"^7.53.0\",\n    \"resend\": \"^4.0.0\",\n    \"server-only\": \"^0.0.1\",\n    \"slugify\": \"^1.6.6\",\n    \"sonner\": \"^1.5.0\",\n    \"superjson\": \"^2.2.1\",\n    \"tailwind-merge\": \"^2.5.4\",\n    \"timeago.js\": \"^4.0.2\",\n    \"use-resize-observer\": \"^9.1.0\",\n    \"usehooks-ts\": \"^3.1.0\",\n    \"zod\": \"^3.23.8\"\n  },\n  \"devDependencies\": {\n    \"@changesets/cli\": \"^2.27.9\",\n    \"@commitlint/cli\": \"^19.5.0\",\n    \"@commitlint/config-conventional\": \"^19.5.0\",\n    \"@commitlint/cz-commitlint\": \"^19.5.0\",\n    \"@eslint-community/eslint-plugin-eslint-comments\": \"^4.4.0\",\n    \"@eslint/compat\": \"^1.2.0\",\n    \"@eslint/eslintrc\": \"^3.1.0\",\n    \"@eslint/js\": \"^9.12.0\",\n    \"@happy-dom/global-registrator\": \"^15.7.4\",\n    \"@ianvs/prettier-plugin-sort-imports\": \"^4.3.1\",\n    \"@next/eslint-plugin-next\": \"^14.2.15\",\n    \"@tailwindcss/aspect-ratio\": \"^0.4.2\",\n    \"@tailwindcss/container-queries\": \"^0.1.1\",\n    \"@tailwindcss/typography\": \"^0.5.15\",\n    \"@total-typescript/ts-reset\": \"^0.6.1\",\n    \"@types/bun\": \"^1.1.11\",\n    \"@types/color\": \"^3.0.6\",\n    \"@types/eslint\": \"^9.6.1\",\n    \"@types/eslint-config-prettier\": \"^6.11.3\",\n    \"@types/node\": \"^22.7.6\",\n    \"@types/react\": \"^18.3.11\",\n    \"@types/react-dom\": \"^18.3.1\",\n    \"commitizen\": \"^4.3.1\",\n    \"cspell\": \"^8.15.3\",\n    \"drizzle-kit\": \"^0.26.2\",\n    \"eslint\": \"^9.12.0\",\n    \"eslint-config-prettier\": \"^9.1.0\",\n    \"eslint-plugin-jsdoc\": \"^50.4.1\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.0\",\n    \"eslint-plugin-react\": \"^7.37.1\",\n    \"eslint-plugin-react-hooks\": \"^5.0.0\",\n    \"eslint-plugin-regexp\": \"^2.6.0\",\n    \"eslint-plugin-security\": \"^3.0.1\",\n    \"eslint-plugin-tailwindcss\": \"^3.17.5\",\n    \"globals\": \"^15.11.0\",\n    \"husky\": \"^9.1.6\",\n    \"lint-staged\": \"^15.2.10\",\n    \"markdownlint\": \"^0.35.0\",\n    \"markdownlint-cli\": \"^0.42.0\",\n    \"postcss\": \"^8.4.47\",\n    \"prettier\": \"^3.3.3\",\n    \"prettier-plugin-curly\": \"^0.3.1\",\n    \"prettier-plugin-packagejson\": \"^2.5.3\",\n    \"tailwindcss\": \"^3.4.14\",\n    \"tailwindcss-animate\": \"^1.0.7\",\n    \"typescript\": \"^5.6.3\",\n    \"typescript-eslint\": \"^8.9.0\"\n  },\n  \"trustedDependencies\": [\n    \"@clerk/shared\",\n    \"@swc/core\",\n    \"es5-ext\",\n    \"esbuild\"\n  ]\n}\n"
  },
  {
    "path": "postcss.config.js",
    "content": "/** @type {import('postcss-load-config').Config} */\nconst config = {\n  plugins: {\n    tailwindcss: {},\n  },\n};\n\nexport default config;\n"
  },
  {
    "path": "prettier.config.js",
    "content": "/** @type {import('@ianvs/prettier-plugin-sort-imports').PrettierConfig} */\nconst config = {\n  semi: true,\n  singleQuote: true,\n  trailingComma: 'all',\n  printWidth: 80,\n  plugins: [\n    '@ianvs/prettier-plugin-sort-imports',\n    'prettier-plugin-packagejson',\n    'prettier-plugin-curly',\n  ],\n  importOrder: [\n    '',\n    '^react$',\n    '^next(-[^/]+)?(/.*)?$',\n    '',\n    '<TYPES>',\n    '<TYPES>^[.]',\n    '',\n    '<BUILTIN_MODULES>',\n    '',\n    '<THIRD_PARTY_MODULES>',\n    '',\n    '^@/(.*)$',\n    '',\n    '^[./]',\n    '',\n    '^(?!.*[.]css$)[./].*$',\n    '.css$',\n  ],\n  importOrderTypeScriptVersion: '5.4.5',\n};\n\nexport default config;\n"
  },
  {
    "path": "public/.well-known/security.txt",
    "content": "Contact: https://github.com/noodle-run/noodle/security/advisories/new\nExpires: 2025-12-31T23:00:00.000Z\nAcknowledgments: https://github.com/noodle-run/noodle/security\nPreferred-Languages: en\nCanonical: https://noodle.run/.well-known/security.txt\nPolicy: https://github.com/noodle-run/noodle/blob/main/SECURITY.md\n"
  },
  {
    "path": "public/browserconfig.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<browserconfig>\n    <msapplication>\n        <tile>\n            <square150x150logo src=\"/mstile-150x150.png\"/>\n            <TileColor>#111111</TileColor>\n        </tile>\n    </msapplication>\n</browserconfig>\n"
  },
  {
    "path": "reset.d.ts",
    "content": "import '@total-typescript/ts-reset';\n"
  },
  {
    "path": "src/app/(dashboard)/(auth)/sign-in/[[...sign-in]]/page.tsx",
    "content": "import { SignIn } from '@clerk/nextjs';\n\n/**\n * The Signin page component.\n * @returns The signin page.\n */\nexport default function Page() {\n  return (\n    <main className=\"container mx-auto flex min-h-screen items-center justify-center\">\n      <SignIn />\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/(auth)/sign-up/[[...sign-in]]/page.tsx",
    "content": "import { SignUp } from '@clerk/nextjs';\n\n/**\n * The Signup page component.\n * @returns The signup page.\n */\nexport default function Page() {\n  return (\n    <main className=\"container mx-auto flex min-h-screen items-center justify-center\">\n      <SignUp />\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/_components/active-button.tsx",
    "content": "'use client';\n\nimport { cn } from '@/utils/cn';\nimport { Button } from '@/primitives/button';\nimport Link from 'next/link';\nimport { usePathname } from 'next/navigation';\nimport type { ReactNode } from 'react';\n\ninterface Props {\n  href: string;\n  label: string;\n  icon: ReactNode;\n}\n\nexport function ActiveButton({ href, label, icon }: Props) {\n  const pathname = usePathname();\n\n  return (\n    <Button\n      variant=\"ghost\"\n      className={cn(\n        'justify-start gap-3 font-normal',\n        pathname === href && 'text-foreground',\n      )}\n      asChild\n    >\n      <Link href={href}>\n        {icon}\n        <span className=\"w-full truncate\">{label}</span>\n      </Link>\n    </Button>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/_components/create-module-popover.tsx",
    "content": "'use client';\n\nimport { Button } from '@/primitives/button';\nimport { Input } from '@/primitives/input';\nimport { Popover, PopoverContent, PopoverTrigger } from '@/primitives/popover';\nimport { ResizablePanel } from '@/primitives/resizable-panel';\nimport { Separator } from '@/primitives/separator';\nimport { ChevronRightIcon, PlusIcon } from 'lucide-react';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { useForm } from 'react-hook-form';\nimport { useState } from 'react';\nimport { z } from 'zod';\nimport {\n  Form,\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from '@/primitives/form';\nimport { Label } from '@/primitives/label';\nimport type { IconNames } from '@/primitives/icon';\nimport { Icon, iconNames } from '@/primitives/icon';\nimport { grayDark } from '@radix-ui/colors';\nimport { colorChoices } from '../lib/color-choices';\nimport { ScrollArea } from '@/primitives/scroll-area';\nimport { api } from '@/lib/trpc/react';\nimport { useRouter } from 'next/navigation';\nimport { toast } from 'sonner';\nimport { Textarea } from '@/primitives/textarea';\nimport { useDebounceValue } from 'usehooks-ts';\ninterface StepHeadingProps {\n  title: string;\n  description: string;\n}\n\nconst StepHeading = ({ title, description }: StepHeadingProps) => {\n  return (\n    <div className=\"flex flex-col gap-1.5\">\n      <div className=\"font-medium text-foreground\">{title}</div>\n      <div className=\"max-w-[40ch] text-sm text-gray-foreground-muted\">\n        {description}\n      </div>\n      <Separator className=\"my-3\" />\n    </div>\n  );\n};\n\ninterface IconPickerProps {\n  iconOnClickHandler: (icon: IconNames) => void;\n}\n\nexport function IconPicker({ iconOnClickHandler }: IconPickerProps) {\n  const [iconSearchTerm, setIconSearchTerm] = useDebounceValue('', 200);\n\n  return (\n    <>\n      <Input\n        type=\"text\"\n        placeholder=\"Search icons...\"\n        onChange={(e) => {\n          setIconSearchTerm(e.target.value);\n        }}\n      />\n      <ScrollArea className=\"mt-2 h-[300px]\">\n        <div className=\"mt-2 grid grid-cols-6 gap-2\">\n          {iconNames\n            .filter((icon) =>\n              iconSearchTerm === ''\n                ? true\n                : icon.toLowerCase().includes(iconSearchTerm.toLowerCase()),\n            )\n            .map((icon) => (\n              <button\n                type=\"button\"\n                key={icon}\n                className=\"grid place-items-center rounded-lg p-2 text-foreground transition-colors hover:bg-gray-element\"\n                onClick={() => {\n                  iconOnClickHandler(icon);\n                }}\n              >\n                <Icon name={icon} size={20} strokeWidth={1.5} />\n              </button>\n            ))}\n        </div>\n      </ScrollArea>\n    </>\n  );\n}\n\nconst formSchema = z.object({\n  moduleName: z.string().min(2),\n  description: z.string().optional(),\n  code: z.string().min(2),\n  credits: z.string(),\n  icon: z.string().min(1),\n  color: z.string().min(1),\n});\n\nexport function CreateModulePopover() {\n  const [popoverOpen, setPopoverOpen] = useState(false);\n  const [step, setStep] = useState<1 | 2 | 3>(1);\n\n  const router = useRouter();\n\n  const mutation = api.modules.create.useMutation({\n    onError(error) {\n      toast.error(error.message);\n    },\n    onSuccess() {\n      router.refresh();\n    },\n  });\n\n  const form = useForm<z.infer<typeof formSchema>>({\n    resolver: zodResolver(formSchema),\n    defaultValues: {\n      moduleName: '',\n      code: '',\n      credits: '0',\n      icon: 'default',\n      color: 'default',\n    },\n  });\n\n  async function onSubmit(values: z.infer<typeof formSchema>) {\n    await mutation.mutateAsync({\n      ...values,\n      credits: parseInt(values.credits),\n      name: values.moduleName,\n    });\n    form.reset({\n      moduleName: '',\n      code: '',\n      credits: '0',\n      icon: 'default',\n      color: 'default',\n    });\n  }\n\n  return (\n    <Popover\n      open={popoverOpen}\n      onOpenChange={() => {\n        setPopoverOpen((prev) => !prev);\n        setStep(1);\n      }}\n    >\n      <PopoverTrigger asChild>\n        <Button variant=\"ghost\" size=\"icon\" className=\"size-8\">\n          <PlusIcon size={15} strokeWidth={1.5} />\n        </Button>\n      </PopoverTrigger>\n\n      <PopoverContent align=\"start\" side=\"right\" className=\"w-[328px]\">\n        <ResizablePanel>\n          <Form {...form}>\n            <form onSubmit={form.handleSubmit(onSubmit)} className=\"p-4\">\n              {step === 1 && (\n                <div>\n                  <StepHeading\n                    title=\"Create a new module\"\n                    description=\"A module is like a hub for a subject's study material such as notes, flashcards...etc\"\n                  />\n                  <div className=\"space-y-2\">\n                    <FormField\n                      control={form.control}\n                      name=\"moduleName\"\n                      render={({ field }) => (\n                        <FormItem>\n                          <FormLabel className=\"text-xs text-foreground\">\n                            Module Name\n                          </FormLabel>\n                          <FormControl>\n                            <Input\n                              type=\"text\"\n                              placeholder=\"Artificial Intelligence\"\n                              {...field}\n                            />\n                          </FormControl>\n                          <FormMessage />\n                        </FormItem>\n                      )}\n                    />\n                    <FormField\n                      control={form.control}\n                      name=\"description\"\n                      render={({ field }) => (\n                        <FormItem>\n                          <FormLabel className=\"text-xs text-foreground\">\n                            Description (optional)\n                          </FormLabel>\n                          <FormControl>\n                            <Textarea\n                              className=\"resize-none\"\n                              placeholder=\"Type here...\"\n                              {...field}\n                            />\n                          </FormControl>\n                          <FormMessage />\n                        </FormItem>\n                      )}\n                    />\n                    <div className=\"flex items-start justify-between gap-3\">\n                      <FormField\n                        control={form.control}\n                        name=\"code\"\n                        render={({ field }) => (\n                          <FormItem>\n                            <FormLabel className=\"text-xs text-foreground\">\n                              Code\n                            </FormLabel>\n                            <FormControl>\n                              <Input\n                                type=\"text\"\n                                placeholder=\"AI001\"\n                                {...field}\n                              />\n                            </FormControl>\n                            <FormMessage />\n                          </FormItem>\n                        )}\n                      />\n                      <FormField\n                        control={form.control}\n                        name=\"credits\"\n                        render={({ field }) => (\n                          <FormItem>\n                            <FormLabel className=\"text-xs text-foreground\">\n                              Credits\n                            </FormLabel>\n                            <FormControl>\n                              <Input\n                                type=\"number\"\n                                placeholder=\"15\"\n                                {...field}\n                              />\n                            </FormControl>\n                            <FormMessage />\n                          </FormItem>\n                        )}\n                      />\n                    </div>\n                    <div className=\"flex items-start justify-between gap-3\">\n                      <div className=\"mt-1 flex flex-1 flex-col gap-2\">\n                        <Label className=\"text-xs text-foreground\">Icon</Label>\n                        <Button\n                          type=\"button\"\n                          variant=\"outline\"\n                          className=\"flex-1 justify-between bg-gray-subtle px-3 py-2 hover:bg-gray-element\"\n                          style={{\n                            color:\n                              form.watch('color') === 'default'\n                                ? grayDark.gray10\n                                : colorChoices.find(\n                                    (color) =>\n                                      color.name === form.watch('color'),\n                                  )?.value,\n                          }}\n                          onClick={() => {\n                            setStep(2);\n                          }}\n                        >\n                          <Icon\n                            name={\n                              form.watch('icon') !== 'default'\n                                ? (form.watch('icon') as IconNames)\n                                : 'Folder'\n                            }\n                            size={18}\n                            strokeWidth={1.5}\n                          />\n\n                          <ChevronRightIcon\n                            className=\"text-gray-solid\"\n                            size={18}\n                            strokeWidth={1.5}\n                          />\n                        </Button>\n                      </div>\n                      <div className=\"mt-1 flex flex-1 flex-col space-y-2\">\n                        <Label className=\"text-xs text-foreground\">Color</Label>\n                        <Button\n                          type=\"button\"\n                          variant=\"outline\"\n                          className=\"flex-1 justify-between bg-gray-subtle px-3 py-2 hover:bg-gray-element\"\n                          onClick={() => {\n                            setStep(3);\n                          }}\n                        >\n                          <div\n                            className=\"size-[18px] rounded-md\"\n                            style={{\n                              backgroundColor:\n                                form.watch('color') === 'default'\n                                  ? grayDark.gray10\n                                  : colorChoices.find(\n                                      (color) =>\n                                        color.name === form.watch('color'),\n                                    )?.value,\n                            }}\n                          />\n\n                          <ChevronRightIcon\n                            className=\"text-gray-solid\"\n                            size={18}\n                            strokeWidth={1.5}\n                          />\n                        </Button>\n                      </div>\n                    </div>\n                    <Button\n                      type=\"submit\"\n                      disabled={form.formState.isSubmitting}\n                      className=\"!mt-4 w-full\"\n                      size=\"sm\"\n                    >\n                      {form.formState.isSubmitting\n                        ? 'Creating...'\n                        : 'Create module'}\n                    </Button>\n                  </div>\n                </div>\n              )}\n\n              {step === 2 && (\n                <div>\n                  <StepHeading\n                    title=\"Select an icon\"\n                    description=\"You can select an icon for your module to make it easier to identify.\"\n                  />\n                  <IconPicker\n                    iconOnClickHandler={(icon) => {\n                      form.setValue('icon', icon);\n                      setStep(1);\n                    }}\n                  />\n                </div>\n              )}\n\n              {step === 3 && (\n                <div>\n                  <StepHeading\n                    title=\"Select a color\"\n                    description=\"You can select a color for your module to be able to identify it easily.\"\n                  />\n                  <div className=\"mt-2 flex flex-wrap justify-between gap-4\">\n                    {colorChoices.map((color) => (\n                      <button\n                        type=\"button\"\n                        key={color.name}\n                        className=\"size-8 rounded-lg transition-all hover:scale-110\"\n                        style={{ backgroundColor: color.value }}\n                        onClick={() => {\n                          form.setValue('color', color.name);\n                          setStep(1);\n                        }}\n                      />\n                    ))}\n                  </div>\n                </div>\n              )}\n            </form>\n          </Form>\n        </ResizablePanel>\n      </PopoverContent>\n    </Popover>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/_components/module-card.tsx",
    "content": "import Color from 'color';\nimport { Icon, type IconNames } from '@/primitives/icon';\nimport { Skeleton } from '@/primitives/skeleton';\nimport Link from 'next/link';\nimport colors, { zinc } from 'tailwindcss/colors';\n\ninterface ModuleCardProps {\n  color: string;\n  id: string;\n  name: string;\n  icon: IconNames;\n  credits: number;\n}\n\nexport function ModuleCard({\n  id,\n  color,\n  name,\n  icon,\n  credits,\n}: ModuleCardProps) {\n  const moduleColor =\n    color === 'default' ? zinc : colors[color as keyof typeof colors];\n\n  return (\n    <li className=\"shrink-0 basis-full lg:basis-[250px]\">\n      <Link\n        href={`/app/module/${id}`}\n        className=\"flex flex-col gap-2 rounded-xl p-6\"\n        style={{\n          background: `linear-gradient(135deg, ${Color(moduleColor['500'])\n            .alpha(0.08)\n            .toString()} 0%, ${Color(moduleColor['700'])\n            .alpha(0.05)\n            .toString()} 100%)`,\n          border: `1px solid ${Color(moduleColor['500'])\n            .alpha(0.1)\n            .toString()}`,\n        }}\n      >\n        <Icon name={icon} strokeWidth={2} size={20} />\n        <h3 className=\"mt-2 text-lg font-medium\">{name}</h3>\n        <p className=\"text-xs text-gray-foreground-muted\">{credits} Credits</p>\n      </Link>\n    </li>\n  );\n}\n\nModuleCard.Skeleton = function ModuleCardSkeleton({\n  animate = true,\n  opacity = 100,\n}: {\n  animate?: boolean;\n  opacity?: number;\n}) {\n  return (\n    <li\n      className=\"shrink-0 basis-full lg:basis-[250px]\"\n      style={{ opacity: `${opacity.toString()}%` }}\n    >\n      <div className=\"flex flex-col gap-2 rounded-xl border bg-gray-subtle p-6\">\n        <Skeleton noPulse={!animate} className=\"size-5\" />\n        <Skeleton noPulse={!animate} className=\"mt-2 h-6 w-full\" />\n        <Skeleton noPulse={!animate} className=\"mt-1 h-4 w-[50px]\" />\n      </div>\n    </li>\n  );\n};\n"
  },
  {
    "path": "src/app/(dashboard)/app/_components/recent-modules.tsx",
    "content": "'use client';\n\nimport { ScrollArea, ScrollBar } from '@/primitives/scroll-area';\nimport { ModuleCard } from './module-card';\nimport { Button } from '@/primitives/button';\nimport AnimateHeight from 'react-animate-height';\nimport { useState } from 'react';\nimport type { RouterOutputs } from '@/lib/trpc/types';\nimport { cn } from '@/utils/cn';\nimport type { IconNames } from '@/primitives/icon';\n\ninterface RecentModulesProps {\n  modules: RouterOutputs['modules']['getUserModules'];\n}\n\nexport function RecentModules({ modules }: RecentModulesProps) {\n  const [isExpanded, setIsExpanded] = useState(true);\n  return (\n    <div className=\"mt-6 overflow-hidden rounded-xl border px-4 py-3\">\n      <div className=\"flex justify-between\">\n        <h2 className=\"text-lg font-semibold\">Recent Modules</h2>\n        <Button\n          variant=\"outline\"\n          size=\"sm\"\n          className=\"text-xs\"\n          aria-expanded={isExpanded}\n          aria-controls=\"recent-modules-list\"\n          onClick={() => {\n            setIsExpanded((prev) => !prev);\n          }}\n        >\n          {isExpanded ? 'Hide' : 'Show'}\n        </Button>\n      </div>\n      <AnimateHeight id=\"recent-modules-list\" height={isExpanded ? 'auto' : 0}>\n        <ScrollArea>\n          <ul\n            className={cn(\n              'relative mt-4 flex gap-4',\n              modules.length === 0 && 'overflow-hidden',\n            )}\n          >\n            {modules.length === 0 && (\n              <>\n                <div className=\"absolute inset-0 z-10 flex flex-col items-center justify-center\">\n                  <p className=\"max-w-[40ch] text-center text-sm text-gray-foreground-muted\">\n                    When you decide to become a good student and create modules,\n                    your recent ones will show up here.\n                  </p>\n                </div>\n                {new Array(8).fill(0).map((_, i) => (\n                  <ModuleCard.Skeleton key={i} opacity={50} animate={false} />\n                ))}\n              </>\n            )}\n\n            {modules.length > 0 &&\n              modules.map((module) => (\n                <ModuleCard\n                  key={module.id}\n                  {...module}\n                  icon={\n                    module.icon === 'default'\n                      ? 'Folder'\n                      : (module.icon as IconNames)\n                  }\n                />\n              ))}\n          </ul>\n          <ScrollBar orientation=\"horizontal\" />\n        </ScrollArea>\n      </AnimateHeight>\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/_components/side-menu.tsx",
    "content": "import { api } from '@/lib/trpc/server';\nimport {\n  CircleHelpIcon,\n  DiamondIcon,\n  HomeIcon,\n  MessageSquareMore,\n  PenLineIcon,\n} from 'lucide-react';\nimport Image from 'next/image';\nimport { ActiveButton } from './active-button';\nimport { CreateModulePopover } from './create-module-popover';\nimport type { IconNames } from '@/primitives/icon';\nimport { Icon } from '@/primitives/icon';\nimport { Button } from '@/primitives/button';\nimport { constants } from '@/constants';\n\nconst iconSize = 15;\n\nconst sideMenuStaticLinks = [\n  {\n    icon: <HomeIcon size={iconSize} />,\n    label: 'Home',\n    href: '/app',\n  },\n  {\n    icon: <PenLineIcon size={iconSize} />,\n    label: 'Notebooks',\n    href: '/app/notes',\n  },\n  {\n    icon: <DiamondIcon size={iconSize} />,\n    label: 'Flashcards',\n    href: '/app/flashcards',\n  },\n];\n\nexport async function SideMenu() {\n  const modules = await api.modules.getUserModules();\n\n  return (\n    <aside className=\"flex w-[200px] flex-col justify-between gap-8\">\n      <div>\n        <div className=\"flex items-center gap-3 pl-3 pt-4\">\n          <Image src=\"/logo.svg\" width={35} height={35} alt=\"Noodle Logo\" />\n          <span>Noodle</span>\n        </div>\n\n        <ul className=\"mt-8 flex flex-col\">\n          {sideMenuStaticLinks.map(({ icon, label, href }) => (\n            <li key={label} className=\"flex flex-1 flex-col\">\n              <ActiveButton icon={icon} label={label} href={href} />\n            </li>\n          ))}\n        </ul>\n\n        <div className=\"mt-6 space-y-2\">\n          <div className=\"flex items-center justify-between pl-4\">\n            <h3 className=\"text-xs text-gray\">Modules</h3>\n            <CreateModulePopover />\n          </div>\n          <ul className=\"flex flex-col\">\n            {modules\n              .sort((a, b) => {\n                return (\n                  new Date(a.createdAt).getTime() -\n                  new Date(b.createdAt).getTime()\n                );\n              })\n              .map((module) => (\n                <li key={module.id} className=\"flex flex-1 flex-col\">\n                  <ActiveButton\n                    href={`/app/module/${module.id}`}\n                    icon={\n                      <Icon\n                        name={\n                          module.icon === 'default'\n                            ? 'Folder'\n                            : (module.icon as IconNames)\n                        }\n                        size={15}\n                        strokeWidth={1.5}\n                      />\n                    }\n                    label={module.name}\n                  />\n                </li>\n              ))}\n          </ul>\n        </div>\n      </div>\n\n      <div className=\"mb-6 flex flex-col\">\n        <Button\n          variant=\"ghost\"\n          className=\"justify-start gap-3 font-normal\"\n          asChild\n        >\n          <a\n            href={constants.feedback}\n            target=\"_blank\"\n            rel=\"noopener noreferrer\"\n          >\n            <MessageSquareMore size={15} strokeWidth={1.5} /> Feedback\n          </a>\n        </Button>\n        <Button\n          variant=\"ghost\"\n          className=\"justify-start gap-3 font-normal\"\n          asChild\n        >\n          <a href={constants.support} target=\"_blank\" rel=\"noopener noreferrer\">\n            <CircleHelpIcon size={15} strokeWidth={1.5} /> Help & Support\n          </a>\n        </Button>\n      </div>\n    </aside>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/_components/welcome-message.tsx",
    "content": "'use client';\n\nimport { Skeleton } from '@/primitives/skeleton';\nimport { useUser } from '@clerk/nextjs';\n\nexport function WelcomeMessage() {\n  const { isLoaded, user } = useUser();\n\n  if (!isLoaded || !user) {\n    return (\n      <div className=\"space-y-3\">\n        <Skeleton className=\"h-10 w-2/5\" />\n        <div className=\"flex flex-col gap-2\">\n          <Skeleton className=\"h-5 w-1/2\" />\n          <Skeleton className=\"h-5 w-1/2\" />\n        </div>\n      </div>\n    );\n  }\n\n  const currentHour = new Date().getHours();\n\n  let timeGreeting;\n  if (currentHour < 12) {\n    timeGreeting = 'Good morning';\n  } else if (currentHour < 18) {\n    timeGreeting = 'Good afternoon';\n  } else {\n    timeGreeting = 'Good evening';\n  }\n\n  const greeting = user.firstName\n    ? `${timeGreeting}, ${user.firstName}!`\n    : `${timeGreeting}!`;\n\n  return (\n    <div className=\"space-y-3\">\n      <h1 className=\"text-4xl font-semibold\">{greeting}</h1>\n      <p className=\"max-w-prose text-balance text-sm leading-6 text-foreground-muted\">\n        “The final wisdom of life requires not the annulment of incongruity but\n        the achievement of serenity within and above it.” - Reinhold Niebuhr\n      </p>\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/layout.tsx",
    "content": "import { PanelLeftCloseIcon } from 'lucide-react';\nimport type { PropsWithChildren } from 'react';\nimport { Button } from '@/primitives/button';\nimport { UserButton } from '@clerk/nextjs';\nimport { SideMenu } from './_components/side-menu';\n\nexport default function AppLayout({ children }: PropsWithChildren) {\n  return (\n    <main className=\"flex min-h-dvh gap-4 p-4\">\n      <SideMenu />\n\n      <div className=\"flex flex-1 flex-col rounded-xl border px-6 pb-6 pt-4\">\n        <nav className=\"mb-6 flex items-center justify-between\">\n          <Button variant=\"ghost\" size=\"icon\" className=\"-ml-2\">\n            <PanelLeftCloseIcon strokeWidth={1.5} size={18} />\n          </Button>\n          <UserButton />\n        </nav>\n\n        {children}\n      </div>\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/lib/color-choices.ts",
    "content": "import {\n  amber,\n  blue,\n  bronze,\n  brown,\n  crimson,\n  cyan,\n  gold,\n  grass,\n  gray,\n  green,\n  indigo,\n  iris,\n  jade,\n  lime,\n  mauve,\n  mint,\n  olive,\n  orange,\n  pink,\n  plum,\n  purple,\n  red,\n  ruby,\n  sage,\n  sky,\n  slate,\n  teal,\n  tomato,\n  violet,\n  yellow,\n} from '@radix-ui/colors';\n\nexport const colorChoices = [\n  {\n    name: 'default',\n    value: gray.gray9,\n  },\n  {\n    name: 'mauve',\n    value: mauve.mauve9,\n  },\n  {\n    name: 'slate',\n    value: slate.slate9,\n  },\n  {\n    name: 'sage',\n    value: sage.sage9,\n  },\n  {\n    name: 'olive',\n    value: olive.olive9,\n  },\n  {\n    name: 'tomato',\n    value: tomato.tomato9,\n  },\n  {\n    name: 'red',\n    value: red.red9,\n  },\n  {\n    name: 'ruby',\n    value: ruby.ruby9,\n  },\n  {\n    name: 'crimson',\n    value: crimson.crimson9,\n  },\n  {\n    name: 'pink',\n    value: pink.pink9,\n  },\n  {\n    name: 'plum',\n    value: plum.plum9,\n  },\n  {\n    name: 'purple',\n    value: purple.purple9,\n  },\n  {\n    name: 'violet',\n    value: violet.violet9,\n  },\n  {\n    name: 'iris',\n    value: iris.iris9,\n  },\n  {\n    name: 'indigo',\n    value: indigo.indigo9,\n  },\n  {\n    name: 'blue',\n    value: blue.blue9,\n  },\n  {\n    name: 'cyan',\n    value: cyan.cyan9,\n  },\n  {\n    name: 'teal',\n    value: teal.teal9,\n  },\n  {\n    name: 'jade',\n    value: jade.jade9,\n  },\n  {\n    name: 'green',\n    value: green.green9,\n  },\n  {\n    name: 'grass',\n    value: grass.grass9,\n  },\n  {\n    name: 'bronze',\n    value: bronze.bronze9,\n  },\n  {\n    name: 'gold',\n    value: gold.gold9,\n  },\n  {\n    name: 'brown',\n    value: brown.brown9,\n  },\n  {\n    name: 'orange',\n    value: orange.orange9,\n  },\n  {\n    name: 'amber',\n    value: amber.amber9,\n  },\n  {\n    name: 'yellow',\n    value: yellow.yellow9,\n  },\n  {\n    name: 'lime',\n    value: lime.lime9,\n  },\n  {\n    name: 'mint',\n    value: mint.mint9,\n  },\n  {\n    name: 'sky',\n    value: sky.sky9,\n  },\n];\n"
  },
  {
    "path": "src/app/(dashboard)/app/module/[id]/page.tsx",
    "content": "import { api } from '@/lib/trpc/server';\nimport type { RouterOutputs } from '@/lib/trpc/types';\nimport type { IconNames } from '@/primitives/icon';\nimport { Icon } from '@/primitives/icon';\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from '@/primitives/tabs';\nimport { Textarea } from '@/primitives/textarea';\nimport {\n  ClockIcon,\n  DiamondIcon,\n  PenLineIcon,\n  RadicalIcon,\n  WeightIcon,\n} from 'lucide-react';\nimport { redirect } from 'next/navigation';\nimport { format } from 'timeago.js';\n\ninterface Props {\n  params: {\n    id: string;\n  };\n}\n\ntype UserModule = RouterOutputs['modules']['getById'];\n\nexport default async function ModulePage({ params }: Props) {\n  let userModule: UserModule;\n\n  try {\n    userModule = await api.modules.getById({ id: params.id });\n  } catch {\n    redirect('/not-found');\n  }\n\n  return (\n    <div className=\"flex flex-1 gap-6\">\n      <div className=\"flex-1\">\n        <div className=\"flex items-start gap-4\">\n          <div className=\"mt-1\">\n            <Icon\n              name={\n                userModule.icon === 'default'\n                  ? 'Folder'\n                  : (userModule.icon as IconNames)\n              }\n              size={28}\n              strokeWidth={1.5}\n            />\n          </div>\n          <div className=\"flex flex-1 flex-col gap-3\">\n            <h1 className=\"text-3xl font-medium\">{userModule.name}</h1>\n            <div className=\"flex items-start gap-6\">\n              <p className=\"flex items-center gap-2 text-sm text-foreground-muted\">\n                <RadicalIcon size={15} /> {userModule.code}\n              </p>\n              <p className=\"flex items-center gap-2 text-sm text-foreground-muted\">\n                <WeightIcon size={15} /> {userModule.credits} credits\n              </p>\n              <p className=\"flex items-center gap-2 text-sm text-foreground-muted\">\n                <ClockIcon size={15} /> Created {format(userModule.createdAt)}\n              </p>\n              <p className=\"flex items-center gap-2 text-sm text-foreground-muted\">\n                <PenLineIcon size={15} /> 0 Notebooks\n              </p>\n              <p className=\"flex items-center gap-2 text-sm text-foreground-muted\">\n                <DiamondIcon size={15} /> 0 Flashcards\n              </p>\n            </div>\n          </div>\n        </div>\n        <Tabs defaultValue=\"notes\" className=\"mt-4 w-full\">\n          <TabsList className=\"w-full\">\n            <TabsTrigger value=\"notes\" className=\"flex items-center gap-2\">\n              <PenLineIcon size={15} />\n              Notebooks\n            </TabsTrigger>\n            <TabsTrigger value=\"flashcards\" className=\"flex items-center gap-2\">\n              <DiamondIcon size={15} />\n              Flashcards\n            </TabsTrigger>\n          </TabsList>\n          <TabsContent value=\"notes\">\n            <div>Notes</div>\n          </TabsContent>\n          <TabsContent value=\"flashcards\">\n            <div>Flashcards</div>\n          </TabsContent>\n        </Tabs>\n      </div>\n      <div className=\"min-w-[280px] rounded-lg border p-4\">\n        <div className=\"flex flex-col gap-3\">\n          <h2 className=\"font-medium\">Description</h2>\n          <Textarea\n            value={userModule.description ?? ''}\n            readOnly\n            className=\"resize-none\"\n          />\n        </div>\n      </div>\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/app/page.tsx",
    "content": "import { api } from '@/lib/trpc/server';\nimport { RecentModules } from './_components/recent-modules';\nimport { WelcomeMessage } from './_components/welcome-message';\n\nexport default async function DashboardHome() {\n  const modules = await api.modules.getUserModules();\n\n  return (\n    <div className=\"flex flex-1 gap-6\">\n      <div className=\"flex-1\">\n        <WelcomeMessage />\n        <RecentModules modules={modules.slice(0, 4)} />\n      </div>\n      <div className=\"min-w-[280px] rounded-lg border p-4\">Right side</div>\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/app/(dashboard)/layout.tsx",
    "content": "import { TRPCReactProvider } from '@/lib/trpc/react';\nimport { ClerkProvider } from '@clerk/nextjs';\nimport { dark } from '@clerk/themes';\nimport type { PropsWithChildren } from 'react';\n\n/**\n * The layout of the dashboard routes, this supplies the clerk & trpc providers mainly.\n * @param props The props of the layout.\n * @param props.children The children of the layout, which are all the routes under this route group.\n * @returns A react component.\n */\nexport default function DashboardLayout({ children }: PropsWithChildren) {\n  return (\n    <ClerkProvider\n      appearance={{\n        baseTheme: dark,\n        variables: { colorPrimary: '#F9617B' },\n        elements: {\n          userButtonPopoverMain: 'bg-gray-subtle',\n          navbar: 'bg-gradient-to-r from-gray-subtle to-gray-subtle',\n          pageScrollBox: 'bg-gray-subtle',\n        },\n      }}\n    >\n      <TRPCReactProvider>{children}</TRPCReactProvider>\n    </ClerkProvider>\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/(legal)/layout.tsx",
    "content": "import type { PropsWithChildren } from 'react';\n\nexport default function LegalLayout({ children }: PropsWithChildren) {\n  return <main className=\"mx-auto max-w-prose py-8 md:py-12\">{children}</main>;\n}\n"
  },
  {
    "path": "src/app/(site)/(legal)/privacy/page.tsx",
    "content": "import { getLegalDocs } from '@/lib/mdx';\nimport { notFound } from 'next/navigation';\nimport { CustomMDX, MDXComponents } from '../../_components/custom-mdx';\n\nexport default async function PrivacyPage() {\n  const docs = await getLegalDocs();\n  const post = docs.find((d) => d.slug === 'privacy');\n\n  if (!post) {\n    notFound();\n  }\n\n  return (\n    <>\n      <MDXComponents.h1>{post.metadata.title}</MDXComponents.h1>\n      <p className=\"my-3 text-sm md:my-4 md:text-base\">\n        {post.metadata.effectiveDate}\n      </p>\n      <CustomMDX source={post.content} />\n    </>\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/(legal)/tos/page.tsx",
    "content": "import { getLegalDocs } from '@/lib/mdx';\nimport { notFound } from 'next/navigation';\nimport { CustomMDX, MDXComponents } from '../../_components/custom-mdx';\n\nexport default async function TermsPage() {\n  const docs = await getLegalDocs();\n  const post = docs.find((d) => d.slug === 'tos');\n\n  if (!post) {\n    notFound();\n  }\n\n  return (\n    <>\n      <MDXComponents.h1>{post.metadata.title}</MDXComponents.h1>\n      <p className=\"my-3 text-sm md:my-4 md:text-base\">\n        Effective date: {post.metadata.effectiveDate}\n      </p>\n      <CustomMDX source={post.content} />\n    </>\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/_components/custom-mdx.tsx",
    "content": "import { cn } from '@/utils/cn';\nimport slugify from 'slugify';\nimport { buttonVariants } from '@/primitives/button';\nimport type { MDXRemoteProps } from 'next-mdx-remote/rsc';\nimport { MDXRemote } from 'next-mdx-remote/rsc';\nimport type { PropsWithChildren } from 'react';\nimport { createElement } from 'react';\n\nfunction createHeading(level: 1 | 2 | 3 | 4 | 5 | 6, className: string) {\n  const Element = ({ children }: PropsWithChildren) => {\n    const slug =\n      typeof children === 'string'\n        ? slugify(children, { lower: true, strict: true })\n        : '';\n\n    return createElement(\n      `h${String(level)}`,\n      { id: slug },\n      createElement(\n        'a',\n        {\n          href: `#${slug}`,\n          key: `link-${slug}`,\n          className: cn('font-medium', className),\n        },\n        children,\n      ),\n    );\n  };\n\n  Element.displayName = `h${String(level)}`;\n\n  return Element;\n}\n\nexport const MDXComponents = {\n  h1: createHeading(1, 'text-2xl md:text-3xl'),\n  h2: createHeading(\n    2,\n    'text-xl md:text-2xl mb-3 md:mb-4 mt-3 md:mt-4 inline-block',\n  ),\n  h3: createHeading(\n    3,\n    'text-lg md:text-xl mb-2 md:mb-3 mt-2 md:mt-3 inline-block font-normal',\n  ),\n  ul: ({ children, className, ...props }) => (\n    <ul\n      {...props}\n      className={cn(\n        className,\n        'mb-3 list-disc pl-6 text-sm md:mb-4 md:text-base',\n      )}\n    >\n      {children}\n    </ul>\n  ),\n  li: ({ children, className, ...props }) => (\n    <li\n      {...props}\n      className={cn(\n        className,\n        'mb-1.5 text-sm leading-relaxed text-foreground-muted md:mb-2 md:text-base',\n      )}\n    >\n      {children}\n    </li>\n  ),\n  strong: ({ children, className, ...props }) => (\n    <strong {...props} className={cn(className, 'font-medium text-foreground')}>\n      {children}\n    </strong>\n  ),\n  a: ({ children, className, ...props }) => (\n    <a\n      {...props}\n      className={cn(\n        buttonVariants({ variant: 'link' }),\n        className,\n        'p-0 pb-0.5 font-bold before:w-full',\n      )}\n      target=\"_blank\"\n      rel=\"noopener noreferrer\"\n    >\n      {children}\n    </a>\n  ),\n  p: ({ children, className, ...props }) => (\n    <p\n      {...props}\n      className={cn(\n        className,\n        'mb-3 text-sm !leading-6 text-foreground-muted md:mb-4 md:text-base md:!leading-7',\n      )}\n    >\n      {children}\n    </p>\n  ),\n} satisfies MDXRemoteProps['components'];\n\nexport function CustomMDX(props: MDXRemoteProps) {\n  return (\n    <MDXRemote\n      {...props}\n      components={{ ...MDXComponents, ...(props.components ?? {}) }}\n    />\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/_components/footer.tsx",
    "content": "import { constants } from '@/constants';\nimport Image from 'next/image';\nimport Link from 'next/link';\n\nconst footerLinkSections = [\n  {\n    section: 'GENERAL',\n    links: [\n      {\n        title: 'Blog',\n        url: '/blog',\n      },\n      {\n        title: 'Contribute',\n        url: constants.github_repo,\n      },\n    ],\n  },\n  {\n    section: 'SOCIAL',\n    links: [\n      {\n        title: 'Twitter',\n        url: constants.twitter,\n      },\n      {\n        title: 'Discord',\n        url: constants.discord,\n      },\n    ],\n  },\n  {\n    section: 'LEGAL',\n    links: [\n      {\n        title: 'Terms of Service',\n        url: '/tos',\n      },\n      {\n        title: 'Privacy Policy',\n        url: '/privacy',\n      },\n    ],\n  },\n];\n\nexport const Footer = () => {\n  return (\n    <footer className=\"border-t border-gray-element py-12 lg:py-16\">\n      <div className=\"container flex flex-col justify-between md:flex-row\">\n        <div className=\"order-2 space-y-4 md:order-1\">\n          <Link href=\"/\" className=\"flex items-center gap-3\">\n            <Image src=\"/logo.svg\" width={24} height={24} alt=\"Noodle Logo\" />\n            <span>Noodle</span>\n          </Link>\n          <p className=\"text-sm text-foreground-muted\">\n            &copy; {new Date().getFullYear()} NOODLE RUN LTD. All Rights\n            Reserved.\n          </p>\n        </div>\n        <div className=\"order-1 mb-10 grid grid-cols-3 gap-0 md:order-2 md:mb-0 md:gap-12\">\n          {footerLinkSections.map(({ section, links }) => (\n            <div className=\"text-sm\" key={section}>\n              <h3 className=\"pb-4 text-foreground-muted\">{section}</h3>\n              <ul className=\"flex flex-col gap-2\">\n                {links.map(({ title, url }) => (\n                  <li key={title}>\n                    {url.startsWith('/') ? (\n                      <Link href={url}>{title}</Link>\n                    ) : (\n                      <a href={url} target=\"_blank\" rel=\"noreferrer noopener\">\n                        {title}\n                      </a>\n                    )}\n                  </li>\n                ))}\n              </ul>\n            </div>\n          ))}\n        </div>\n      </div>\n    </footer>\n  );\n};\n"
  },
  {
    "path": "src/app/(site)/_components/navbar.tsx",
    "content": "'use client';\n\nimport { forwardRef, useState } from 'react';\nimport Image from 'next/image';\nimport Link from 'next/link';\n\nimport { ChevronRightIcon, MenuIcon } from 'lucide-react';\n\nimport { constants, features } from '@/constants';\nimport { cn } from '@/utils/cn';\nimport { Button } from '@/primitives/button';\nimport {\n  NavigationMenu,\n  NavigationMenuContent,\n  NavigationMenuItem,\n  NavigationMenuLink,\n  NavigationMenuList,\n  NavigationMenuTrigger,\n  navigationMenuTriggerStyle,\n} from '@/primitives/navigation-menu';\n\nconst ListItem = forwardRef<\n  React.ElementRef<'div'>,\n  React.ComponentPropsWithoutRef<'div'> & { icon: React.ReactNode }\n>(({ className, title, children, icon, ...props }, ref) => {\n  return (\n    <li>\n      <NavigationMenuLink asChild>\n        <div\n          ref={ref}\n          className={cn(\n            'z-50 flex select-none items-start gap-3 rounded-md border border-transparent px-4 py-3 leading-none no-underline outline-none transition-colors hover:border-gray-element-border hover:bg-gray-element hover:text-gray-foreground focus:border-gray-element-border focus:bg-gray-element focus:text-gray-foreground',\n            className,\n          )}\n          {...props}\n        >\n          <div className=\"size-[18px]\">{icon}</div>\n          <div className=\"space-y-2\">\n            <div className=\"text-sm font-medium leading-none text-foreground\">\n              {title}\n            </div>\n            <p className=\"line-clamp-2 text-xs leading-normal\">{children}</p>\n          </div>\n        </div>\n      </NavigationMenuLink>\n    </li>\n  );\n});\nListItem.displayName = 'ListItem';\n\nexport const Navbar = () => {\n  const [menuOpen, setMenuOpen] = useState(false);\n\n  return (\n    <nav className={cn('z-50 w-full pb-0 pt-4 md:py-4')}>\n      <div className=\"container flex items-center justify-between transition-all\">\n        <Link href=\"/\" className=\"flex items-center gap-3\">\n          <Image src=\"/logo.svg\" width={35} height={35} alt=\"Noodle Logo\" />\n          <span>Noodle</span>\n        </Link>\n\n        <NavigationMenu className=\"hidden md:block\">\n          <NavigationMenuList>\n            <NavigationMenuItem>\n              <NavigationMenuTrigger>Features</NavigationMenuTrigger>\n              <NavigationMenuContent>\n                <div className=\"absolute right-36 top-1/2 z-30 size-20 -translate-y-1/2 rounded-full bg-pink opacity-50 blur-3xl\" />\n                <ul className=\"grid gap-3 p-3 md:w-[450px] lg:w-[550px] lg:grid-cols-[1fr_0.85fr]\">\n                  <div className=\"flex flex-col gap-3\">\n                    {features(18).map((feature) => (\n                      <ListItem\n                        key={feature.title}\n                        title={feature.title}\n                        icon={feature.icon}\n                      >\n                        {feature.description}\n                      </ListItem>\n                    ))}\n                  </div>\n                  <li>\n                    <NavigationMenuLink asChild>\n                      <div className=\"flex size-full select-none flex-col justify-end rounded-md border border-gray-element-border bg-gray-element/50 px-6 py-3 pt-6 no-underline outline-none backdrop-blur-lg transition-colors hover:bg-gray-element/75 focus:shadow-md\">\n                        <Image\n                          src=\"/logo.svg\"\n                          width={35}\n                          height={35}\n                          alt=\"Noodle Logo\"\n                        />\n                        <div className=\"mb-2 mt-4 text-lg font-medium text-foreground\">\n                          {constants.shortName}\n                        </div>\n                        <p className=\"text-sm leading-snug text-foreground-muted\">\n                          Helping students stay productive and on top of their\n                          work.\n                        </p>\n\n                        <a\n                          href={constants.github_repo}\n                          target=\"_blank\"\n                          rel=\"noreferrer noopener\"\n                          className=\"mt-6 flex items-center gap-2 py-2 text-sm transition-colors hover:text-gray-foreground\"\n                        >\n                          Contribute <ChevronRightIcon size={13} />\n                        </a>\n                      </div>\n                    </NavigationMenuLink>\n                  </li>\n                </ul>\n              </NavigationMenuContent>\n            </NavigationMenuItem>\n            <NavigationMenuItem>\n              <Link href=\"/blog\" legacyBehavior passHref>\n                <NavigationMenuLink className={navigationMenuTriggerStyle()}>\n                  Blog\n                </NavigationMenuLink>\n              </Link>\n            </NavigationMenuItem>\n            <NavigationMenuItem>\n              <NavigationMenuLink\n                href={constants.github_repo}\n                target=\"_blank\"\n                rel=\"noreferrer noopener\"\n                className={navigationMenuTriggerStyle()}\n              >\n                Contribute\n              </NavigationMenuLink>\n            </NavigationMenuItem>\n            <NavigationMenuItem>\n              <NavigationMenuLink\n                href={constants.discord}\n                target=\"_blank\"\n                rel=\"noreferrer noopener\"\n                className={navigationMenuTriggerStyle()}\n              >\n                Discord\n              </NavigationMenuLink>\n            </NavigationMenuItem>\n          </NavigationMenuList>\n        </NavigationMenu>\n        <div className=\"hidden items-center gap-4 md:flex\">\n          <Button size=\"sm\" asChild>\n            <Link href=\"/sign-in\">\n              Dashboard <ChevronRightIcon size={16} />\n            </Link>\n          </Button>\n        </div>\n        <div className=\"block md:hidden\">\n          <button\n            type=\"button\"\n            onClick={() => {\n              setMenuOpen((prev) => !prev);\n            }}\n          >\n            <MenuIcon size={24} />\n          </button>\n        </div>\n      </div>\n      <div\n        className={cn(\n          'block h-0 overflow-hidden md:hidden',\n          menuOpen && 'h-full pt-6',\n        )}\n      >\n        <div className=\"container\">\n          <ul className=\"flex flex-col gap-3\">\n            <li>\n              <Link href=\"/early-access\">Early access</Link>\n            </li>\n            <li>\n              <Link href=\"/blog\">Blog</Link>\n            </li>\n            <li>\n              <a\n                href={constants.github_repo}\n                target=\"_blank\"\n                rel=\"noreferrer noopener\"\n              >\n                Contribute\n              </a>\n            </li>\n            <li>\n              <a\n                href={constants.discord}\n                target=\"_blank\"\n                rel=\"noreferrer noopener\"\n              >\n                Discord\n              </a>\n            </li>\n          </ul>\n        </div>\n      </div>\n    </nav>\n  );\n};\n"
  },
  {
    "path": "src/app/(site)/blog/[slug]/page.tsx",
    "content": "import { getBlogPosts } from '@/lib/mdx';\nimport { notFound } from 'next/navigation';\nimport { CustomMDX, MDXComponents } from '../../_components/custom-mdx';\nimport type { Metadata } from 'next';\nimport { constructMetadata } from '@/utils/construct-metadata';\nimport { constants } from '@/constants';\nimport { getBaseUrl } from '@/utils/base-url';\n\nexport const dynamic = 'force-static';\n\ninterface Props {\n  params: {\n    slug: string;\n  };\n}\n\nexport async function generateMetadata({\n  params,\n}: Props): Promise<Metadata | undefined> {\n  const posts = await getBlogPosts();\n  const post = posts.find((p) => p.slug === params.slug);\n\n  if (!post) {\n    return;\n  }\n\n  const {\n    title,\n    publishedAt: publishedTime,\n    summary: description,\n    image,\n  } = post.metadata;\n\n  return constructMetadata({\n    title: `${title} - ${constants.shortName}`,\n    description,\n    image: image ? `${getBaseUrl()}/${image}` : `${getBaseUrl()}/thumbnail.jpg`,\n    publishedTime,\n    type: 'article',\n    url: `${getBaseUrl()}/blog/${params.slug}`,\n  });\n}\n\nexport default async function Home({ params }: Props) {\n  const posts = await getBlogPosts();\n  const post = posts.find((p) => p.slug === params.slug);\n\n  if (!post) {\n    notFound();\n  }\n\n  return (\n    <main className=\"mx-auto max-w-prose py-8 md:py-12\">\n      <MDXComponents.h1>{post.metadata.title}</MDXComponents.h1>\n      <MDXComponents.p className=\"my-4 text-foreground-muted\">\n        {post.metadata.publishedAt}\n      </MDXComponents.p>\n      <MDXComponents.p className=\"my-4 text-foreground-muted\">\n        {post.metadata.summary}\n      </MDXComponents.p>\n      <CustomMDX source={post.content} />\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/blog/page.tsx",
    "content": "import { getBlogPosts } from '@/lib/mdx';\nimport { Button } from '@/primitives/button';\nimport { MoveRightIcon } from 'lucide-react';\nimport { notFound } from 'next/navigation';\n\nexport default async function BlogPage() {\n  const posts = await getBlogPosts();\n\n  // TODO: once we have more than one post, we can use this to show the latest post\n  const latestPost = posts[0];\n\n  if (!latestPost) {\n    notFound();\n  }\n\n  return (\n    <main className=\"py-12 md:py-16 lg:py-24\">\n      <h1 className=\"mb-8 text-3xl font-medium md:text-4xl lg:mb-12\">\n        Latest post\n      </h1>\n      <div key={latestPost.slug}>\n        <p className=\"mb-4 text-sm text-foreground-muted\">\n          {latestPost.metadata.publishedAt}\n        </p>\n        <h3 className=\"mb-4 inline-block text-xl font-medium md:text-2xl\">\n          {latestPost.metadata.title}\n        </h3>\n        <p className=\"max-w-prose text-balance text-sm leading-relaxed text-foreground-muted md:text-base\">\n          {latestPost.metadata.summary}\n        </p>\n        <Button variant=\"default\" size=\"sm\" className=\"mt-6\" asChild>\n          <a href={`/blog/${latestPost.slug}`}>\n            Read post <MoveRightIcon size={16} strokeWidth={3} />\n          </a>\n        </Button>\n      </div>\n      <h2 className=\"pt-12 text-2xl font-medium md:pt-16 md:text-3xl lg:pt-24\">\n        More posts\n      </h2>\n      <p className=\"mt-6 text-balance text-left text-foreground-muted md:mt-12 md:text-center lg:mt-16\">\n        🤪 Waiting on the Noodle team (Ahmed) to write more...\n      </p>\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/early-access/_forms/join.tsx",
    "content": "'use client';\n\nimport { api } from '@/lib/trpc/react';\nimport { cn } from '@/utils/cn';\nimport { Button, buttonVariants } from '@/primitives/button';\nimport { Checkbox } from '@/primitives/checkbox';\nimport { Input } from '@/primitives/input';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from '@/primitives/select';\nimport Link from 'next/link';\nimport { useForm } from 'react-hook-form';\nimport { z } from 'zod';\nimport {\n  Form,\n  FormControl,\n  FormField,\n  FormItem,\n  FormLabel,\n  FormMessage,\n} from '@/primitives/form';\nimport { toast } from 'sonner';\n\nconst formSchema = z.object({\n  name: z.string().min(2, { message: 'Name is too short' }),\n  email: z.string().email({ message: 'Invalid email address' }).min(5),\n  reason: z.enum(['student', 'project', 'both']).default('student'),\n  agreement: z.boolean().default(false),\n});\n\nexport const JoinEarlyAccessForm = () => {\n  const { mutate: joinEarlyAccess, isPending } =\n    api.earlyAccess.joinEarlyAccess.useMutation({\n      onError: (error) => {\n        toast.error(error.message);\n      },\n      onSuccess: () => {\n        toast.success('Thank you for joining the early access list!');\n      },\n    });\n\n  const form = useForm<z.infer<typeof formSchema>>({\n    resolver: zodResolver(formSchema),\n    defaultValues: {\n      name: '',\n      email: '',\n      reason: 'student',\n      agreement: false,\n    },\n  });\n\n  function onSubmit(values: z.infer<typeof formSchema>) {\n    if (values.agreement) {\n      joinEarlyAccess(values);\n    }\n  }\n\n  return (\n    <Form {...form}>\n      <form\n        onSubmit={form.handleSubmit(onSubmit)}\n        className=\"mt-6 flex max-w-[500px] flex-col gap-6\"\n      >\n        <div className=\"flex w-full flex-col gap-6 md:flex-row\">\n          <div className=\"w-full space-y-2\">\n            <FormField\n              control={form.control}\n              name=\"name\"\n              render={({ field }) => (\n                <FormItem>\n                  <FormLabel htmlFor=\"name\">Name</FormLabel>\n                  <FormControl>\n                    <Input\n                      {...field}\n                      id=\"name\"\n                      type=\"text\"\n                      placeholder=\"John Doe\"\n                    />\n                  </FormControl>\n                  <FormMessage />\n                </FormItem>\n              )}\n            />\n          </div>\n          <div className=\"w-full space-y-2\">\n            <FormField\n              control={form.control}\n              name=\"email\"\n              render={({ field }) => (\n                <FormItem>\n                  <FormLabel htmlFor=\"email\">Email address</FormLabel>\n                  <FormControl>\n                    <Input\n                      {...field}\n                      id=\"email\"\n                      placeholder=\"johndoe@example.com\"\n                    />\n                  </FormControl>\n                  <FormMessage />\n                </FormItem>\n              )}\n            />\n          </div>\n        </div>\n        <div className=\"space-y-2\">\n          <FormField\n            control={form.control}\n            name=\"reason\"\n            render={({ field }) => (\n              <FormItem>\n                <FormLabel>Reason of interest</FormLabel>\n                <FormControl>\n                  <Select\n                    onValueChange={field.onChange}\n                    defaultValue={field.value}\n                  >\n                    <SelectTrigger>\n                      <SelectValue placeholder=\"Reason\" />\n                    </SelectTrigger>\n                    <SelectContent>\n                      <SelectItem value=\"student\">I am a student</SelectItem>\n                      <SelectItem value=\"project\">\n                        Interested in the project\n                      </SelectItem>\n                      <SelectItem value=\"both\">Both</SelectItem>\n                    </SelectContent>\n                  </Select>\n                </FormControl>\n                <FormMessage />\n              </FormItem>\n            )}\n          />\n        </div>\n        <FormField\n          control={form.control}\n          name=\"agreement\"\n          render={({ field }) => (\n            <FormItem className=\"flex gap-3\">\n              <FormControl>\n                <Checkbox\n                  checked={field.value}\n                  onCheckedChange={field.onChange}\n                  className=\"mt-3\"\n                />\n              </FormControl>\n              <span className=\"text-balance text-sm leading-6 text-foreground-muted\">\n                By signing up, you agree to our{' '}\n                <Link\n                  href=\"/terms\"\n                  className={cn(\n                    buttonVariants({ variant: 'link' }),\n                    'p-0 before:w-full',\n                  )}\n                >\n                  terms of service\n                </Link>{' '}\n                and{' '}\n                <Link\n                  href=\"/privacy\"\n                  className={cn(\n                    buttonVariants({ variant: 'link' }),\n                    'p-0 before:w-full',\n                  )}\n                >\n                  privacy policy\n                </Link>\n                , also to be contacted by email about product updates and early\n                access.\n              </span>\n            </FormItem>\n          )}\n        />\n        <Button\n          type=\"submit\"\n          className=\"mt-3\"\n          disabled={\n            isPending ||\n            form.formState.isSubmitting ||\n            !form.formState.isValid ||\n            !form.getValues('agreement')\n          }\n        >\n          {isPending ? 'Joining...' : 'Join early access'}\n        </Button>\n      </form>\n    </Form>\n  );\n};\n"
  },
  {
    "path": "src/app/(site)/early-access/layout.tsx",
    "content": "import { TRPCReactProvider } from '@/lib/trpc/react';\nimport type { PropsWithChildren } from 'react';\n\nexport default function EarlyAccessLayout({ children }: PropsWithChildren) {\n  return <TRPCReactProvider>{children}</TRPCReactProvider>;\n}\n"
  },
  {
    "path": "src/app/(site)/early-access/page.tsx",
    "content": "import type { Metadata } from 'next';\nimport { JoinEarlyAccessForm } from './_forms/join';\nimport { constructMetadata } from '@/utils/construct-metadata';\n\nexport const metadata: Metadata = constructMetadata({\n  title: 'Early Access - Noodle',\n  description: 'Join us on our journey to improve student productivity.',\n});\n\nexport default function EarlyAccessPage() {\n  return (\n    <main className=\"flex flex-col items-center justify-center gap-6 py-12 md:py-16 lg:py-24\">\n      <h1 className=\"hidden max-w-[20ch] text-balance bg-gradient-to-b from-foreground to-gray-foreground-muted bg-clip-text text-center text-5xl font-extrabold leading-none text-transparent sm:block md:text-6xl lg:text-7xl\">\n        Join us on our journey to improve student productivity\n      </h1>\n      <h1 className=\"block max-w-[20ch] text-balance bg-gradient-to-b from-foreground to-gray-foreground-muted bg-clip-text text-center text-5xl font-extrabold leading-none text-transparent sm:hidden md:text-6xl lg:text-7xl\">\n        Join us on our journey\n      </h1>\n      <p className=\"max-w-prose text-balance text-center text-lg text-foreground-muted [&>strong]:font-medium [&>strong]:text-foreground\">\n        Sign up to our <strong>early access list</strong> and be the{' '}\n        <strong>first to get</strong> updates and access to the platform{' '}\n        <strong>before the wider public</strong>.\n      </p>\n      <JoinEarlyAccessForm />\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/layout.tsx",
    "content": "import type { PropsWithChildren } from 'react';\n\nimport { Navbar } from './_components/navbar';\nimport { Footer } from './_components/footer';\n\n/**\n * The root layout component of the marketing group of pages.\n * @param props The props of the layout.\n * @param props.children The children of the layout which is every page in the\n *   marketing layout group.\n * @returns A react component representing the layout.\n */\nexport default function RootLayout({ children }: PropsWithChildren) {\n  return (\n    <div className=\"flex min-h-dvh flex-col\">\n      <div className=\"absolute left-0 top-0 z-[-1] h-56 w-full bg-gradient-to-b from-indigo-subtle to-background\" />\n      <Navbar />\n      <div className=\"container flex-1\">{children}</div>\n      <Footer />\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/app/(site)/page.tsx",
    "content": "import Link from 'next/link';\nimport { ChevronRightIcon, StarIcon } from 'lucide-react';\n\nimport { constants } from '@/constants';\nimport { Button } from '@/primitives/button';\n\nimport Image from 'next/image';\n\n/**\n * The marketing home page.\n * @returns A react component representing the marketing home page.\n */\nexport default function Home() {\n  return (\n    <main className=\"flex flex-col items-center justify-center py-12 md:py-16 lg:py-24\">\n      <div className=\"flex flex-col items-center gap-6\">\n        <Button variant=\"outline\" asChild className=\"rounded-full font-normal\">\n          <a\n            href={constants.github_repo}\n            target=\"_blank\"\n            rel=\"noreferrer noopener\"\n          >\n            Star us on GitHub{' '}\n            <StarIcon className=\"fill-amber-500 stroke-amber-500\" size={16} />\n          </a>\n        </Button>\n        <h1 className=\"max-w-[20ch] text-balance bg-gradient-to-b from-foreground to-gray-foreground-muted bg-clip-text text-center text-5xl font-extrabold leading-none text-transparent md:text-6xl lg:text-8xl\">\n          {constants.tagline}\n        </h1>\n        <p className=\"max-w-[50ch] text-pretty text-center text-foreground-muted lg:text-lg [&>strong]:font-medium [&>strong]:text-foreground\">\n          <strong>open-source</strong> student productivity platform made to{' '}\n          <strong>streamline</strong> the process students conduct their studies\n          and organize it.\n        </p>\n        <Button className=\"rounded-full\" size=\"lg\" asChild>\n          <Link href=\"/early-access\">\n            Get early access <ChevronRightIcon size={20} strokeWidth={2.5} />\n          </Link>\n        </Button>\n      </div>\n      <Image\n        src=\"/_static/dark-dashboard-preview.jpg\"\n        width={1920}\n        height={1080}\n        alt=\"Dashboard Preview\"\n        className=\"mt-12 rounded-lg shadow-[0_50px_200px_75px] shadow-pink/10 md:mt-16 lg:mt-24\"\n      />\n    </main>\n  );\n}\n"
  },
  {
    "path": "src/app/api/trpc/[trpc]/route.ts",
    "content": "import type { NextRequest } from 'next/server';\n\nimport { fetchRequestHandler } from '@trpc/server/adapters/fetch';\n\nimport { env } from '@/env';\nimport { appRouter } from '@/server';\nimport { createTRPCContext } from '@/server/trpc';\n\nconst createContext = (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: ({ path, error }) => {\n      if (env.NODE_ENV === 'development') {\n        console.error(\n          `❌ tRPC failed on ${path ?? '<no-path>'}: ${error.message}`,\n        );\n      }\n    },\n  });\n\nexport { handler as GET, handler as POST };\n"
  },
  {
    "path": "src/app/globals.css",
    "content": ":root {\n  --gray-1: 0 0% 99%;\n  --gray-2: 0 0% 98%;\n  --gray-3: 0 0% 94%;\n  --gray-4: 0 0% 91%;\n  --gray-5: 0 0% 88%;\n  --gray-6: 0 0% 85%;\n  --gray-7: 0 0% 81%;\n  --gray-8: 0 0% 73%;\n  --gray-9: 0 0% 55%;\n  --gray-10: 0 0% 51%;\n  --gray-11: 0 0% 39%;\n  --gray-12: 0 0% 13%;\n\n  --pink-1: 340 100% 99%;\n  --pink-2: 351 78% 98%;\n  --pink-3: 346 100% 96%;\n  --pink-4: 346 100% 93%;\n  --pink-5: 347 85% 90%;\n  --pink-6: 345 71% 85%;\n  --pink-7: 345 61% 80%;\n  --pink-8: 345 57% 73%;\n  --pink-9: 339 99% 66%;\n  --pink-10: 338 85% 61%;\n  --pink-11: 335 71% 46%;\n  --pink-12: 338 62% 24%;\n\n  --salmon-1: 0 50% 99%;\n  --salmon-2: 7 100% 98%;\n  --salmon-3: 5 100% 96%;\n  --salmon-4: 6 100% 92%;\n  --salmon-5: 5 100% 88%;\n  --salmon-6: 4 100% 86%;\n  --salmon-7: 4 79% 80%;\n  --salmon-8: 3 70% 73%;\n  --salmon-9: 1 91% 69%;\n  --salmon-10: 0 79% 65%;\n  --salmon-11: 359 57% 53%;\n  --salmon-12: 3 36% 25%;\n\n  --indigo-1: 240 33% 99%;\n  --indigo-2: 225 100% 98%;\n  --indigo-3: 222 89% 96%;\n  --indigo-4: 224 100% 94%;\n  --indigo-5: 224 100% 91%;\n  --indigo-6: 225 100% 88%;\n  --indigo-7: 226 87% 82%;\n  --indigo-8: 226 75% 75%;\n  --indigo-9: 226 70% 55%;\n  --indigo-10: 226 65% 52%;\n  --indigo-11: 226 56% 50%;\n  --indigo-12: 226 50% 24%;\n\n  --red-1: 0 100% 99%;\n  --red-2: 7, 100%, 98%;\n  --red-3: 10, 92%, 95%;\n  --red-4: 12, 100%, 91%;\n  --red-5: 11, 100%, 88%;\n  --red-6: 11, 95%, 84%;\n  --red-7: 10, 82%, 78%;\n  --red-8: 10, 75%, 70%;\n  --red-9: 10, 78%, 54%;\n  --red-10: 10, 73%, 51%;\n  --red-11: 10, 82%, 45%;\n  --red-12: 8, 50%, 24%;\n}\n\n:root.dark {\n  --gray-1: 0 0% 7%;\n  --gray-2: 0 0% 10%;\n  --gray-3: 0 0% 13%;\n  --gray-4: 0 0% 16%;\n  --gray-5: 0 0% 19%;\n  --gray-6: 0 0% 23%;\n  --gray-7: 0 0% 28%;\n  --gray-8: 0 0% 38%;\n  --gray-9: 0 0% 43%;\n  --gray-10: 0 0% 48%;\n  --gray-11: 0 0% 71%;\n  --gray-12: 0 0% 93%;\n\n  --pink-1: 347 24% 7%;\n  --pink-2: 346 25% 10%;\n  --pink-3: 340 51% 15%;\n  --pink-4: 337 72% 18%;\n  --pink-5: 337 66% 23%;\n  --pink-6: 339 55% 29%;\n  --pink-7: 340 49% 37%;\n  --pink-8: 339 49% 48%;\n  --pink-9: 339 99% 66%;\n  --pink-10: 338 85% 61%;\n  --pink-11: 341 100% 77%;\n  --pink-12: 345 100% 91%;\n\n  --salmon-1: 8 22% 7%;\n  --salmon-2: 5 27% 10%;\n  --salmon-3: 0 51% 15%;\n  --salmon-4: 358 65% 19%;\n  --salmon-5: 358 60% 24%;\n  --salmon-6: 359 51% 30%;\n  --salmon-7: 0 45% 38%;\n  --salmon-8: 1 44% 49%;\n  --salmon-9: 1 91% 69%;\n  --salmon-10: 0 78% 65%;\n  --salmon-11: 3 100% 77%;\n  --salmon-12: 4 100% 91%;\n\n  --indigo-1: 231 29% 9%;\n  --indigo-2: 230 31% 11%;\n  --indigo-3: 225 51% 19%;\n  --indigo-4: 225 54% 25%;\n  --indigo-5: 225 52% 30%;\n  --indigo-6: 226 47% 35%;\n  --indigo-7: 226 44% 41%;\n  --indigo-8: 226 45% 48%;\n  --indigo-9: 226 70% 55%;\n  --indigo-10: 228 73% 61%;\n  --indigo-11: 228 100% 81%;\n  --indigo-12: 224 100% 92%;\n\n  --red-1: 0, 17%, 8%;\n  --red-2: 10, 24%, 10%;\n  --red-3: 5, 48%, 15%;\n  --red-4: 4, 64%, 19%;\n  --red-5: 5, 62%, 23%;\n  --red-6: 7, 55%, 28%;\n  --red-7: 9, 49%, 35%;\n  --red-8: 10, 50%, 45%;\n  --red-9: 10, 78%, 54%;\n  --red-10: 11, 82%, 59%;\n  --red-11: 12, 100%, 75%;\n  --red-12: 10, 86%, 89%;\n}\n\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer base {\n  * {\n    @apply border-border;\n  }\n  body {\n    @apply bg-background text-foreground;\n    font-feature-settings:\n      'rlig' 1,\n      'calt' 1;\n  }\n}\n"
  },
  {
    "path": "src/app/layout.tsx",
    "content": "import type { Metadata } from 'next';\n\nimport { GeistMono } from 'geist/font/mono';\nimport { GeistSans } from 'geist/font/sans';\n\nimport './globals.css';\n\nimport { ThemeProvider } from 'next-themes';\n\nimport type { PropsWithChildren } from 'react';\nimport { Analytics } from '@vercel/analytics/react';\nimport { SpeedInsights } from '@vercel/speed-insights/next';\n\nimport { constructMetadata } from '@/utils/construct-metadata';\nimport { Toaster } from '@/primitives/sonner';\n\nexport const metadata: Metadata = constructMetadata();\n\n/**\n * The root layout component of the application.\n * @param props The props of the root layout.\n * @param props.children The children of the root layout which is every page in\n *   the application.\n * @returns A react component representing the root layout.\n */\nexport default function RootLayout({ children }: PropsWithChildren) {\n  return (\n    <html\n      lang=\"en\"\n      suppressHydrationWarning\n      className={`${GeistSans.variable} ${GeistMono.variable}`}\n    >\n      <body>\n        <ThemeProvider attribute=\"class\" disableTransitionOnChange>\n          {children}\n          <Toaster />\n          <Analytics />\n          <SpeedInsights />\n        </ThemeProvider>\n      </body>\n    </html>\n  );\n}\n"
  },
  {
    "path": "src/app/manifest.ts",
    "content": "import type { MetadataRoute } from 'next';\n\nimport { constants } from '@/constants';\n\n/**\n * This function returns an object that represents the manifest.json file which\n * next.js uses to create the manifest.json file.\n * @returns The manifest.json file configuration.\n */\nexport default function manifest(): MetadataRoute.Manifest {\n  return {\n    name: constants.name,\n    short_name: constants.shortName,\n    description: constants.description,\n    start_url: '/',\n    display: 'standalone',\n    background_color: '#111111',\n    theme_color: '#F86C6A',\n    icons: [\n      {\n        src: '/android-chrome-192x192.png',\n        sizes: '192x192',\n        type: 'image/png',\n        purpose: 'maskable',\n      },\n      {\n        src: '/android-chrome-512x512.png',\n        sizes: '512x512',\n        type: 'image/png',\n        purpose: 'maskable',\n      },\n    ],\n  };\n}\n"
  },
  {
    "path": "src/app/not-found.tsx",
    "content": "import { Button } from '@/primitives/button';\nimport { Footer } from './(site)/_components/footer';\nimport { Navbar } from './(site)/_components/navbar';\nimport Link from 'next/link';\nimport { constants } from '@/constants';\n\nexport default function NotFoundPage() {\n  return (\n    <div className=\"flex min-h-dvh flex-col\">\n      <div className=\"absolute left-0 top-0 z-[-1] h-56 w-full bg-gradient-to-b from-indigo-subtle to-background\" />\n      <Navbar />\n      <div className=\"container flex flex-1\">\n        <main className=\"mb-4 flex flex-1 flex-col items-center justify-center gap-6\">\n          <div className=\"relative\">\n            <h1 className=\"text-9xl font-bold text-gray-foreground\">404</h1>\n          </div>\n          <h2 className=\"text-4xl font-medium text-gray-foreground\">\n            Oops! Page not found\n          </h2>\n          <p className=\"max-w-prose text-balance text-center text-lg text-foreground-muted\">\n            It looks like this page has gone on an adventure. Maybe it&apos;s\n            hanging out with all those missing socks from the laundry.\n          </p>\n          <div className=\"flex gap-4\">\n            <Button asChild size=\"lg\">\n              <Link href=\"/\">Return home</Link>\n            </Button>\n            <Button asChild size=\"lg\" variant=\"outline\">\n              <a\n                href={constants.support}\n                target=\"_blank\"\n                rel=\"noopener noreferrer\"\n              >\n                Contact support\n              </a>\n            </Button>\n          </div>\n        </main>\n      </div>\n      <Footer />\n    </div>\n  );\n}\n"
  },
  {
    "path": "src/app/robots.ts",
    "content": "import type { MetadataRoute } from 'next';\n\nimport { getBaseUrl } from '@/utils/base-url';\n\n/**\n * This function returns an object that represents the robots.txt file which\n * next.js uses to create the robots.txt file.\n * @returns The robots.txt file configuration.\n */\nexport default function robots(): MetadataRoute.Robots {\n  return {\n    rules: {\n      userAgent: '*',\n      allow: '/',\n    },\n    sitemap: `${getBaseUrl()}/sitemap.xml`,\n  };\n}\n"
  },
  {
    "path": "src/constants.tsx",
    "content": "import {\n  ClipboardCheckIcon,\n  DiamondIcon,\n  Edit3Icon,\n  ListChecksIcon,\n} from 'lucide-react';\n\nexport const constants = {\n  name: 'Noodle - Rethinking Student Productivity',\n  shortName: 'Noodle',\n  tagline: 'Rethinking Student Productivity',\n  description:\n    'Noodle is a productivity platform including many tools students need to be productive and stay on top of their work such as note taking, task management, and more.',\n  twitter_handle: '@noodle_run',\n  github_repo: 'https://github.com/noodle-run/noodle',\n  domain: 'noodle.run',\n  discord: 'https://discord.gg/ewKmQd8kYm',\n  twitter: 'https://x.com/noodle_run',\n  feedback: 'mailto:feedback@noodle.run',\n  support: 'mailto:support@noodle.run',\n};\n\nexport const features = (iconSize: number) => [\n  {\n    icon: <Edit3Icon size={iconSize} />,\n    title: 'Note Taking',\n    description: 'Write your study notes and let Noodle take care of the rest.',\n  },\n  {\n    icon: <DiamondIcon size={iconSize} />,\n    title: 'Flashcards',\n    description:\n      'Create flashcards with reminders or let AI auto-suggest them for you.',\n  },\n  {\n    icon: <ListChecksIcon size={iconSize} />,\n    title: 'Task Management',\n    description:\n      'Create module specific tasks to keep on track with what you need to do.',\n  },\n  {\n    icon: <ClipboardCheckIcon size={iconSize} />,\n    title: 'Grade Tracking',\n    description: 'Find out what you need to achieve to stay in progression.',\n  },\n];\n"
  },
  {
    "path": "src/content/blog/noodle-resurgence.md",
    "content": "---\ntitle: Noodle is back to life!\npublishedAt: Jun 8th, 2024\nsummary: After a brief period of absence, Noodle is back again in the works. Learn more about what we have been up to, the story until now and what's next in the future of Noodle!\nimage: /_static/blog/noodle-resurrection.jpg\n---\n\n## The Noodle Story\n\nNoodle is a project that has been in the works for a long time now. It has gone through many ups and downs, but it has always been a project that I have been passionate about. I have always believed in the idea behind Noodle and I have always wanted to see it come to life.\n\n### Early Beginnings\n\nNoodle as a concept was born during my university years. I had noticed myself using multiple apps just to try and stay on track with my studies. I was using [Fantastical](https://flexibits.com/fantastical) for my calendar, [Things 3](https://culturedcode.com/things/) for my todos, [Notion](https://notion.so) for note taking, sometimes as well handwritten on my iPad using [Notability](https://notability.com/), and many others like a grade calculator to know where I'm standing with my grades.\n\nIt was all just a bit much, there is no way I needed all of that to manage my studies, and why is there no singular app that can do everything a student needs to stay on track with their studies? Like a GitHub but for students.\n\n### The First Attempt\n\nStraight out of graduation, I knew I wanted to work on Noodle and try to make it happen. I teamed up with a friend of mine, [Sinclair](https://x.com/F1VEBORDIER) and we started working on it. I would handle the development of the app and he would handle the business side of things.\n\nThe initial launch of the idea of Noodle on GitHub gained massive amounts of traction. We had over 10,000 GitHub stars in no time, without ever being on Product Hunt, Hacker News, or any other platform. It was pure insanity, just from a few tweets.\n\n### The First Failure\n\nWith this amount of traction, we had all the eyes on us. The pressure was on, we had to deliver. Unfortunately, working a full time job and trying to build a startup on the side is not an easy task, added with the hype and pressure, it was a recipe for disaster.\n\nEventually, I had to make a tough decision to put Noodle on hold, I was burning out quickly and I didn't want to ruin the project by releasing something that wasn't up to the standards that I had set for myself.\n\n## The Resurrection\n\nAfter a brief period of absence, lasting for 6 months, I am happy to announce that Noodle is back in the works. I have taken the time to reflect on what went wrong the first time around and I have learned so much from that experience.\n\n### The Plan Going Forward\n\nFirst of all, I would like to thank Sinclair for his work towards Noodle. He has decided to step down from the project and I will be the only person working on Noodle for the time being.\n\nI have decided to take a different approach this time around, instead of obsessing over every detail and trying to make everything perfect, I will focus on getting a minimum viable product out there as quickly as possible, one that delivers an improvement to the student productivity life, but not one that has everything just yet.\n\nThe plan is to deliver an MVP with Note taking and Flashcards. Note taking is the core principle that revolves around every other feature in Noodle, and that will be the first thing I will be working on.\n\n### The Future of Noodle\n\nI am excited to see where this new journey with Noodle will take me. I have learned so much from the first attempt and I am confident that I will be able to deliver something that I can be proud of this time around.\n\nI will be documenting the progress of Noodle on this blog, so make sure to check back regularly for updates on the project. I am excited to have you all along for the ride and I can't wait to see where this new journey with Noodle will take me.\n\n### Thank You ❤️\n\nI would like to take this opportunity to thank everyone who has supported me and Noodle throughout this journey. Your support means the world to me and I am so grateful for all of the encouragement and kind words that I have received, it has truly been the driving force behind my decision to bring Noodle back to life.\n\nThank you to everyone on the early access list, which we have over 4000 people signed up for currently, I can't wait to show you what I have been working on very soon!\n\nMake sure you join our [Discord server](https://discord.gg/ewKmQd8kYm) if you want to get the latest updates on Noodle and be part of the community.\n"
  },
  {
    "path": "src/content/legal/privacy.md",
    "content": "---\ntitle: Privacy Policy\neffectiveDate: Jun 8th, 2024\n---\n\n## 1. Introduction\n\nNoodle Run LTD (\"Noodle\") is committed to protecting your privacy. This Privacy Policy explains how we collect, use, and share information about you when you use our website at [https://noodle.run](https://noodle.run)\n\n## 2. Information We Collect\n\n- **Personal Information**: We collect information you provide directly to us, such as your name, email address, and any other information you choose to provide.\n- **Usage Data**: We collect information about your interactions with our services, such as IP address, browser type, and access times.\n\n## 3. How We Use Information\n\nWe use the information we collect to:\n\n- Provide, maintain, and improve our services.\n- Communicate with you about updates, offers, and promotions.\n- Protect the rights and property of Noodle and our users.\n\n## 4. Sharing of Information\n\nWe do not share your personal information with third parties except as necessary to comply with legal obligations, protect our rights, or with your consent.\n\n## 5. Security\n\nWe implement reasonable security measures to protect your information from unauthorized access, use, or disclosure.\n\n## 6. Your Rights\n\nYou have the right to access, update, or delete your personal information. To exercise these rights, please contact us at [privacy@noodle.run](mailto:privacy@noodle.run).\n\n## 7. Changes to this Policy\n\nWe may update this Privacy Policy from time to time. We will notify you of any changes by posting the new policy on this website.\n\n## 8. Contact Us\n\nIf you have any questions about this Privacy Policy, please contact us at [privacy@noodle.run](mailto:privacy@noodle.run).\n"
  },
  {
    "path": "src/content/legal/tos.md",
    "content": "---\ntitle: Terms of Service\neffectiveDate: Jun 8th, 2024\n---\n\n## 1. Introduction\n\nWelcome to Noodle Run LTD (\"Noodle\"). By accessing our website at [https://noodle.run](https://noodle.run) and using our services, you agree to be bound by these Terms of Service (\"Terms\").\n\n## 2. Use of Services\n\nNoodle grants you a non-exclusive, non-transferable, limited right to access and use our services for personal, non-commercial purposes.\n\n## 3. User Responsibilities\n\nYou agree to use our services in compliance with all applicable laws and not to engage in any harmful activities that may disrupt or harm the services.\n\n## 4. Intellectual Property\n\nAll content, trademarks, and data on this website are owned by or licensed to Noodle and are protected by applicable intellectual property laws.\n\n## 5. Termination\n\nWe may terminate or suspend access to our services immediately, without prior notice or liability, for any reason whatsoever, including without limitation if you breach the Terms.\n\n## 6. Limitation of Liability\n\nIn no event shall Noodle, nor its directors, employees, partners, agents, suppliers, or affiliates, be liable for any indirect, incidental, special, consequential, or punitive damages arising out of your use of the services.\n\n## 7. Changes to Terms\n\nWe reserve the right to modify these Terms at any time. We will notify you of any changes by posting the new Terms on this website.\n\n## 8. Contact Us\n\nIf you have any questions about these Terms, please contact us at [contact@noodle.run](mailto:contact@noodle.run).\n"
  },
  {
    "path": "src/db/index.ts",
    "content": "import { neon } from '@neondatabase/serverless';\nimport { drizzle } from 'drizzle-orm/neon-http';\n\nimport { env } from '@/env';\n\nimport * as schema from './schema';\n\nconst sql = neon(env.DATABASE_URL);\n\nexport const db = drizzle(sql, {\n  schema,\n  logger: env.NODE_ENV === 'development',\n});\n"
  },
  {
    "path": "src/db/schema/early-access.ts",
    "content": "import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';\n\nexport const earlyAccessTable = pgTable('early_access', {\n  id: uuid('id').primaryKey().defaultRandom(),\n  name: text('name').notNull(),\n  email: text('email').notNull().unique(),\n  reason: text('reason', { enum: ['student', 'project', 'both'] }).notNull(),\n  approved: boolean('approved').default(false),\n  createdAt: timestamp('created_at', {\n    mode: 'date',\n    precision: 3,\n  }).defaultNow(),\n  invitationSentAt: timestamp('invitation_sent_at', {\n    mode: 'date',\n    precision: 3,\n  }),\n});\n"
  },
  {
    "path": "src/db/schema/index.ts",
    "content": "export * from './early-access';\nexport * from './modules';\n"
  },
  {
    "path": "src/db/schema/modules.ts",
    "content": "import {\n  boolean,\n  integer,\n  pgTable,\n  text,\n  timestamp,\n  uuid,\n} from 'drizzle-orm/pg-core';\nimport { createInsertSchema, createSelectSchema } from 'drizzle-zod';\nimport { z } from 'zod';\n\nexport const modulesTable = pgTable('modules', {\n  id: uuid('id').primaryKey().unique().defaultRandom().notNull(),\n  user_id: text('user_id').notNull(),\n  name: text('name').notNull(),\n  description: text('description'),\n  code: text('code').notNull(),\n  icon: text('icon').default('default').notNull(),\n  color: text('color').default('default').notNull(),\n  archived: boolean('archived').default(false).notNull(),\n  credits: integer('credits').default(0).notNull(),\n  createdAt: timestamp('created_at').notNull().defaultNow(),\n  modifiedAt: timestamp('modified_at').notNull().defaultNow(),\n  lastVisited: timestamp('last_visited').notNull().defaultNow(),\n});\n\nexport const insertModuleSchema = createInsertSchema(modulesTable).extend({\n  id: z.string().min(1),\n  description: z.string().optional(),\n  icon: z.string().default('default'),\n  color: z.string().default('default'),\n  archived: z.boolean().default(false),\n  credits: z.number().default(0),\n  createdAt: z.date().default(new Date()),\n  modifiedAt: z.date().default(new Date()),\n  lastVisited: z.date().default(new Date()),\n});\n\nexport type InsertModuleInput = z.infer<typeof insertModuleSchema>;\n\nexport const selectModuleSchema = createSelectSchema(modulesTable);\n"
  },
  {
    "path": "src/emails/layouts/Base.tsx",
    "content": "import {\n  Body,\n  Container,\n  Font,\n  Head,\n  Html,\n  Preview,\n  Tailwind,\n} from '@react-email/components';\nimport { emailTailwindConfig } from '../tailwind';\nimport type { PropsWithChildren } from 'react';\nimport { emailBaseUrl } from '../utils';\nimport { cn } from '@/utils/cn';\n\ntype Props = PropsWithChildren<{\n  title: string;\n  previewText: string;\n  className?: string;\n}>;\n\nexport const BaseEmailLayout = ({\n  children,\n  title,\n  previewText,\n  className,\n}: Props) => {\n  return (\n    <Tailwind config={emailTailwindConfig}>\n      <Html lang=\"en\" dir=\"ltr\">\n        <Head>\n          <title>{title}</title>\n          <Font\n            fontFamily=\"Geist Mono\"\n            fallbackFontFamily=\"monospace\"\n            webFont={{\n              url: `${emailBaseUrl()}/_static/fonts/GeistMono-Variable.ttf`,\n              format: 'truetype',\n            }}\n          />\n          <Font\n            fontFamily=\"Geist\"\n            fallbackFontFamily=\"sans-serif\"\n            webFont={{\n              url: `${emailBaseUrl()}/_static/fonts/Geist-Variable.ttf`,\n              format: 'truetype',\n            }}\n          />\n        </Head>\n        <Preview>{previewText}</Preview>\n        <Body>\n          <Container className={cn('px-3', className)}>{children}</Container>\n        </Body>\n      </Html>\n    </Tailwind>\n  );\n};\n"
  },
  {
    "path": "src/emails/tailwind.ts",
    "content": "import type { TailwindConfig } from '@react-email/components';\nimport { gray, indigo, tomato } from '@radix-ui/colors';\n\n/**\n * This config is used for the emails, hence why it's almost the same as the normal tailwind config, just more verbose.\n */\nexport const emailTailwindConfig = {\n  theme: {\n    container: {\n      center: true,\n      padding: '2rem',\n      screens: {\n        '2xl': '1400px',\n      },\n    },\n    colors: {\n      black: '#000',\n      white: '#fff',\n      transparent: 'transparent',\n      current: 'currentColor',\n\n      background: gray.gray1,\n      foreground: gray.gray12,\n      'foreground-muted': gray.gray11,\n      border: gray.gray4,\n\n      gray: {\n        DEFAULT: gray.gray9,\n        'foreground-muted': gray.gray11,\n        foreground: gray.gray12,\n\n        app: gray.gray1,\n        subtle: gray.gray2,\n        'subtle-border': gray.gray6,\n\n        element: gray.gray3,\n        'element-hover': gray.gray4,\n        'element-active': gray.gray5,\n        'element-border': gray.gray7,\n        'element-border-hover': gray.gray8,\n\n        solid: gray.gray9,\n        'solid-hover': gray.gray10,\n      },\n      pink: {\n        DEFAULT: 'hsl(339 99% 66%)',\n        'foreground-muted': 'hsl(335 71% 46%)',\n        foreground: 'hsl(338 62% 24%)',\n\n        app: 'hsl(340 100% 99%)',\n\n        subtle: 'hsl(351 78% 98%)',\n        'subtle-border': 'hsl(345 71% 85%)',\n\n        element: 'hsl(346 100% 96%)',\n        'element-hover': 'hsl(346 100% 93%)',\n        'element-active': 'hsl(347 85% 90%)',\n        'element-border': 'hsl(345 61% 80%)',\n        'element-border-hover': 'hsl(345 57% 73%)',\n\n        solid: 'hsl(339 99% 66%)',\n        'solid-hover': 'hsl(338 85% 61%)',\n      },\n      salmon: {\n        DEFAULT: 'hsl(1 91% 69%)',\n        'foreground-muted': 'hsl(359 57% 53%)',\n        foreground: 'hsl(3 36% 25%)',\n\n        app: 'hsl(0 50% 99%)',\n\n        subtle: 'hsl(7 100% 98%)',\n        'subtle-border': 'hsl(4 100% 86%)',\n\n        element: 'hsl(5 100 96%)',\n        'element-hover': 'hsl(6 100% 92%)',\n        'element-active': 'hsl(5 100% 88%)',\n        'element-border': 'hsl(4 79% 80%)',\n        'element-border-hover': 'hsl(3 70% 73%)',\n\n        solid: 'hsl(1 91% 69%)',\n        'solid-hover': 'hsl(0 79% 65%)',\n      },\n      indigo: {\n        DEFAULT: indigo.indigo9,\n        'foreground-muted': indigo.indigo11,\n        foreground: indigo.indigo12,\n\n        app: indigo.indigo1,\n        subtle: indigo.indigo2,\n        'subtle-border': indigo.indigo6,\n\n        element: indigo.indigo3,\n        'element-hover': indigo.indigo4,\n        'element-active': indigo.indigo5,\n        'element-border': indigo.indigo7,\n        'element-border-hover': indigo.indigo8,\n\n        solid: indigo.indigo9,\n        'solid-hover': indigo.indigo10,\n      },\n      red: {\n        DEFAULT: tomato.tomato9,\n        'foreground-muted': tomato.tomato11,\n        foreground: tomato.tomato12,\n\n        app: tomato.tomato1,\n        subtle: tomato.tomato2,\n        'subtle-border': tomato.tomato6,\n\n        element: tomato.tomato3,\n        'element-hover': tomato.tomato4,\n        'element-active': tomato.tomato5,\n        'element-border': tomato.tomato7,\n        'element-border-hover': tomato.tomato8,\n\n        solid: tomato.tomato9,\n        'solid-hover': tomato.tomato10,\n      },\n    },\n    fontFamily: {\n      sans: ['Geist'],\n      mono: ['Geist Mono'],\n    },\n    fontSize: {\n      xs: ['12px', { lineHeight: '16px' }],\n      sm: ['14px', { lineHeight: '20px' }],\n      base: ['16px', { lineHeight: '24px' }],\n      lg: ['18px', { lineHeight: '28px' }],\n      xl: ['20px', { lineHeight: '28px' }],\n      '2xl': ['24px', { lineHeight: '32px' }],\n      '3xl': ['30px', { lineHeight: '36px' }],\n      '4xl': ['36px', { lineHeight: '36px' }],\n      '5xl': ['48px', { lineHeight: '1' }],\n      '6xl': ['60px', { lineHeight: '1' }],\n      '7xl': ['72px', { lineHeight: '1' }],\n      '8xl': ['96px', { lineHeight: '1' }],\n      '9xl': ['144px', { lineHeight: '1' }],\n    },\n    spacing: {\n      px: '1px',\n      0: '0',\n      0.5: '2px',\n      1: '4px',\n      1.5: '6px',\n      2: '8px',\n      2.5: '10px',\n      3: '12px',\n      3.5: '14px',\n      4: '16px',\n      5: '20px',\n      6: '24px',\n      7: '28px',\n      8: '32px',\n      9: '36px',\n      10: '40px',\n      11: '44px',\n      12: '48px',\n      14: '56px',\n      16: '64px',\n      20: '80px',\n      24: '96px',\n      28: '112px',\n      32: '128px',\n      36: '144px',\n      40: '160px',\n      44: '176px',\n      48: '192px',\n      52: '208px',\n      56: '224px',\n      60: '240px',\n      64: '256px',\n      72: '288px',\n      80: '320px',\n      96: '384px',\n    },\n  },\n} satisfies TailwindConfig;\n"
  },
  {
    "path": "src/emails/templates/early-access-joined.tsx",
    "content": "import { Heading, Img, Link, Text } from '@react-email/components';\nimport { BaseEmailLayout } from '../layouts/Base';\nimport { emailBaseUrl } from '../utils';\nimport { constants } from '@/constants';\n\ninterface Props {\n  name: string;\n  email: string;\n}\n\nexport default function EarlyAccessJoinedEmail({ name, email }: Props) {\n  return (\n    <BaseEmailLayout\n      title={`${name}, you have joined Noodle's early access list!`}\n      previewText={`Hey ${name}, this is to just let you know that you have joined Noodle's early access waiting list.`}\n      className=\"py-8\"\n    >\n      <Img\n        src={`${emailBaseUrl()}/logo.svg`}\n        width={50}\n        height={50}\n        alt=\"Noodle logo\"\n      />\n      <Heading as=\"h1\" className=\"my-0 pb-0 pt-6 font-medium\">\n        You are on the list!\n      </Heading>\n      <Text className=\"my-0 pt-4\">\n        Hey {name}, Ahmed here, founder and creator of Noodle.\n      </Text>\n      <Text>\n        I wanted to thank you for joining Noodle&apos;s early access list. I am\n        super excited to have you on board and can&apos;t wait for you to start\n        using Noodle.\n      </Text>\n      <Text>\n        I am currently working hard to get Noodle ready for you and will be in\n        touch soon to let you know when you can access and start using it. Just\n        make sure to sign in using the same email you joined the early access\n        list with, which is{' '}\n        <Link className=\"text-pink underline underline-offset-4\">{email}</Link>.\n      </Text>\n      <Text>\n        You can join our{' '}\n        <Link\n          href={constants.discord}\n          className=\"text-pink underline underline-offset-4\"\n        >\n          Discord server\n        </Link>{' '}\n        in the meantime to stay up to date and to share your thoughts and\n        feedback, helping shape Noodle into the best product it can be.\n      </Text>\n    </BaseEmailLayout>\n  );\n}\n\nEarlyAccessJoinedEmail.PreviewProps = {\n  firstName: 'John',\n  email: 'johndoe@example.com',\n};\n"
  },
  {
    "path": "src/emails/utils.ts",
    "content": "import { constants } from '@/constants';\nimport { env } from '@/env';\n\n/**\n * This is used to get the base URL of the assets that the email templates can use.\n * @returns The correct URL.\n */\nexport const emailBaseUrl = () => {\n  if (env.NODE_ENV === 'development') {\n    return 'http://localhost:3000';\n  }\n\n  if (env.VERCEL_URL) {\n    return `https://${env.VERCEL_URL}`;\n  }\n\n  return `https://${constants.domain}`;\n};\n"
  },
  {
    "path": "src/env.ts",
    "content": "import { createEnv } from '@t3-oss/env-nextjs';\nimport { vercel } from '@t3-oss/env-nextjs/presets';\nimport { z } from 'zod';\n\nexport const env = createEnv({\n  extends: [vercel()],\n  shared: {\n    NODE_ENV: z\n      .enum(['development', 'production', 'test'])\n      .default('development'),\n  },\n  server: {\n    PORT: z.coerce.number().default(3000),\n\n    // Neon DB\n    DATABASE_URL: z.string().url(),\n\n    // Upstash\n    UPSTASH_REDIS_REST_URL: z.string(),\n    UPSTASH_REDIS_REST_TOKEN: z.string(),\n\n    // Resend\n    RESEND_API_KEY: z.string(),\n\n    // Clerk\n    CLERK_SECRET_KEY: z.string(),\n  },\n  client: {\n    // Clerk\n    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string(),\n  },\n\n  experimental__runtimeEnv: {\n    NODE_ENV: process.env.NODE_ENV,\n    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:\n      process.env['NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY'],\n  },\n\n  skipValidation: !!process.env['SKIP_ENV_VALIDATION'],\n  emptyStringAsUndefined: true,\n});\n"
  },
  {
    "path": "src/lib/mdx.ts",
    "content": "import fs from 'node:fs/promises';\nimport path from 'path';\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\nfunction parseFrontmatter<T extends Record<string, unknown>>(\n  fileContent: string,\n) {\n  const frontmatterRegex = /---\\n([\\s\\S]*?)\\n---/;\n  const match = frontmatterRegex.exec(fileContent);\n  if (!match) {\n    throw new Error('No frontmatter found');\n  }\n  const frontMatterBlock = match[1];\n  const content = fileContent.replace(frontmatterRegex, '').trim();\n  const frontMatterLines = frontMatterBlock?.trim().split('\\n');\n  const metadata: Partial<T> = {};\n\n  frontMatterLines?.forEach((line) => {\n    const [key, ...valueArr] = line.split(': ');\n    let value = valueArr.join(': ').trim();\n    value = value.replace(/^['\"](.*)['\"]$/, '$1');\n    if (!key) {\n      throw new Error('Invalid frontmatter');\n    }\n    (metadata as Record<string, unknown>)[key.trim()] = value;\n  });\n\n  return { metadata: metadata as T, content };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters\nasync function getMDXData<T extends Record<string, unknown>>(dir: string) {\n  const files = await fs.readdir(dir);\n  const mdxFiles = files.filter(\n    (file) => path.extname(file) === '.mdx' || path.extname(file) === '.md',\n  );\n\n  const mapped = await Promise.all(\n    mdxFiles.map(async (file) => {\n      const rawContent = await fs.readFile(path.join(dir, file), 'utf-8');\n      const { metadata, content } = parseFrontmatter<T>(rawContent);\n      const slug = path.basename(file, path.extname(file));\n      return {\n        metadata,\n        slug,\n        content,\n      };\n    }),\n  );\n\n  return mapped;\n}\n\ninterface BlogMetadata {\n  [key: string]: unknown;\n  title: string;\n  publishedAt: string;\n  summary: string;\n  image?: string;\n}\n\ninterface LegalMetadata {\n  [key: string]: unknown;\n  title: string;\n  effectiveDate: string;\n}\n\nexport function getBlogPosts() {\n  return getMDXData<BlogMetadata>(path.join(process.cwd(), 'src/content/blog'));\n}\n\nexport function getLegalDocs() {\n  return getMDXData<LegalMetadata>(\n    path.join(process.cwd(), 'src/content/legal'),\n  );\n}\n"
  },
  {
    "path": "src/lib/redis.ts",
    "content": "import { Redis } from '@upstash/redis';\n\nimport { env } from '@/env';\n\nexport const redis = new Redis({\n  url: env.UPSTASH_REDIS_REST_URL,\n  token: env.UPSTASH_REDIS_REST_TOKEN,\n});\n"
  },
  {
    "path": "src/lib/resend.ts",
    "content": "import { env } from '@/env';\nimport { Resend } from 'resend';\n\nexport const resend = new Resend(env.RESEND_API_KEY);\n"
  },
  {
    "path": "src/lib/trpc/react.tsx",
    "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { loggerLink, unstable_httpBatchStreamLink } from '@trpc/client';\nimport { createTRPCReact } from '@trpc/react-query';\nimport superjson from 'superjson';\n\nimport { getBaseUrl } from '@/utils/base-url';\nimport { type AppRouter } from '@/server';\n\nconst createQueryClient = () => new QueryClient();\n\nlet clientQueryClientSingleton: QueryClient | undefined = undefined;\nconst getQueryClient = () => {\n  if (typeof window === 'undefined') {\n    return createQueryClient();\n  }\n  return (clientQueryClientSingleton ??= createQueryClient());\n};\n\nexport const api = createTRPCReact<AppRouter>();\n\n/**\n * The TRPC React Provider is a component that initializes trpc and react query.\n * @param props Props for the TRPC React Provider.\n * @param props.children The children of the TRPC React Provider, which would be\n *   the entire page/layout in most cases.\n * @returns React Provider component that initializes trpc and react query\n *   integration for the client.\n */\nexport function TRPCReactProvider(props: { children: React.ReactNode }) {\n  const queryClient = getQueryClient();\n\n  const [trpcClient] = useState(() =>\n    api.createClient({\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          transformer: superjson,\n          url: getBaseUrl() + '/api/trpc',\n          headers: () => {\n            const headers = new Headers();\n            headers.set('x-trpc-source', 'nextjs-react');\n            return headers;\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/lib/trpc/server.ts",
    "content": "import 'server-only';\n\nimport { cache } from 'react';\nimport { headers } from 'next/headers';\n\nimport { createCaller } from '@/server';\nimport { createTRPCContext } from '@/server/trpc';\n\nconst createContext = cache(() => {\n  const heads = new Headers(headers());\n  heads.set('x-trpc-source', 'rsc');\n\n  return createTRPCContext({\n    headers: heads,\n  });\n});\n\nexport const api = createCaller(createContext);\n"
  },
  {
    "path": "src/lib/trpc/types.ts",
    "content": "import type { AppRouter } from '@/server';\nimport type { inferReactQueryProcedureOptions } from '@trpc/react-query';\nimport type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';\n\nexport type ReactQueryOptions = inferReactQueryProcedureOptions<AppRouter>;\nexport type RouterInputs = inferRouterInputs<AppRouter>;\nexport type RouterOutputs = inferRouterOutputs<AppRouter>;\n"
  },
  {
    "path": "src/mdx-components.tsx",
    "content": "import type { MDXComponents } from 'mdx/types';\nimport { buttonVariants } from './primitives/button';\nimport { cn } from '@/utils/cn';\n\nexport function useMDXComponents(components: MDXComponents): MDXComponents {\n  return {\n    h1: ({ children, ...props }) => (\n      <h1 className=\"text-2xl font-medium md:text-3xl\" {...props}>\n        {children}\n      </h1>\n    ),\n    h2: ({ children, ...props }) => (\n      <h2\n        className=\"mb-3 mt-4 text-xl font-medium md:mt-6 md:text-2xl\"\n        {...props}\n      >\n        {children}\n      </h2>\n    ),\n    p: ({ children, ...props }) => (\n      <p className=\"mb-3 text-sm text-foreground-muted md:text-base\" {...props}>\n        {children}\n      </p>\n    ),\n    ul: ({ children, ...props }) => (\n      <ul className=\"list-disc pl-8\" {...props}>\n        {children}\n      </ul>\n    ),\n    li: ({ children, ...props }) => (\n      <li\n        className=\"mb-1.5 text-sm text-foreground-muted md:text-base\"\n        {...props}\n      >\n        {children}\n      </li>\n    ),\n    strong: ({ children, ...props }) => (\n      <strong className=\"text-foreground\" {...props}>\n        {children}\n      </strong>\n    ),\n    a: ({ children, ...props }) => (\n      <a\n        className={cn(\n          buttonVariants({ variant: 'link' }),\n          'p-0 font-bold before:w-full',\n        )}\n        {...props}\n      >\n        {children}\n      </a>\n    ),\n    ...components,\n  };\n}\n"
  },
  {
    "path": "src/middleware.ts",
    "content": "import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';\n\nconst isProtectedRoute = createRouteMatcher(['/app(.*)']);\n\nexport default clerkMiddleware((auth, req) => {\n  if (isProtectedRoute(req)) {\n    auth().protect();\n  }\n});\n\nexport const config = {\n  matcher: [\n    '/((?!_next|[^?]*\\\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',\n    '/(api|trpc)(.*)',\n  ],\n};\n"
  },
  {
    "path": "src/primitives/button.tsx",
    "content": "import * as React from 'react';\n\nimport type { VariantProps } from 'class-variance-authority';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva } from 'class-variance-authority';\n\nimport { cn } from '@/utils/cn';\n\nconst buttonVariants = cva(\n  'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-subtle-border focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n  {\n    variants: {\n      variant: {\n        default:\n          'bg-gradient-to-br from-salmon to-pink text-white hover:opacity-90 dark:text-black',\n        destructive: 'bg-red text-white hover:bg-red-solid-hover',\n        outline:\n          'border border-gray-subtle-border bg-gray-element text-foreground-muted hover:bg-gray-element-hover hover:text-foreground',\n        ghost:\n          'text-foreground-muted hover:bg-gray-element hover:text-foreground',\n        link: 'relative bg-gradient-to-br from-salmon to-pink bg-clip-text text-transparent before:absolute before:bottom-0 before:h-px before:w-[calc(100%-24px)] before:rounded-full before:bg-gradient-to-br before:from-salmon before:to-pink hover:opacity-90',\n      },\n      size: {\n        default: 'px-4 py-2',\n        sm: 'px-3 py-1.5',\n        lg: 'px-3 py-1.5 lg:px-4 lg:py-2 lg:text-base',\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}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n  ({ className, variant, size, asChild = false, ...props }, ref) => {\n    const Comp = asChild ? Slot : 'button';\n    return (\n      <Comp\n        className={cn(buttonVariants({ variant, size, className }))}\n        ref={ref}\n        {...props}\n      />\n    );\n  },\n);\nButton.displayName = 'Button';\n\nexport { Button, buttonVariants };\n"
  },
  {
    "path": "src/primitives/checkbox.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\n\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\nimport { CheckIcon } from 'lucide-react';\n\nimport { cn } from '@/utils/cn';\n\nconst Checkbox = React.forwardRef<\n  React.ElementRef<typeof CheckboxPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>\n>(({ className, ...props }, ref) => (\n  <CheckboxPrimitive.Root\n    ref={ref}\n    className={cn(\n      'peer flex size-[18px] shrink-0 items-center justify-center rounded-md border border-gray-subtle-border text-transparent shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-pink-solid-hover disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-pink data-[state=checked]:bg-salmon data-[state=checked]:text-white dark:data-[state=checked]:text-black',\n      className,\n    )}\n    {...props}\n  >\n    <CheckboxPrimitive.Indicator\n      className={cn('flex items-center justify-center text-current')}\n    >\n      <CheckIcon className=\"size-4\" strokeWidth={3} />\n    </CheckboxPrimitive.Indicator>\n  </CheckboxPrimitive.Root>\n));\nCheckbox.displayName = CheckboxPrimitive.Root.displayName;\n\nexport { Checkbox };\n"
  },
  {
    "path": "src/primitives/dropdown-menu.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';\nimport { cn } from '@/utils/cn';\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\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-gray-element-active data-[state=open]:bg-gray-element-active',\n      inset && 'pl-8',\n      className,\n    )}\n    {...props}\n  >\n    {children}\n    <ChevronRightIcon 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-gray-element p-1 text-gray-foreground-muted 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-gray-subtle p-1.5 text-gray-foreground-muted shadow-md',\n        '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-md px-2 py-1.5 text-sm outline-none transition-colors focus:bg-gray-element-hover focus:text-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 = false, ...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-gray-element-active focus:text-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        <CheckIcon 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-gray-element-active focus:text-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        <CircleIcon className=\"size-4 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.5 h-px bg-gray-element-active', 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/primitives/form.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\n\nimport type * as LabelPrimitive from '@radix-ui/react-label';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { Controller, FormProvider, useFormContext } from 'react-hook-form';\n\nimport { Label } from '@/primitives/label';\nimport { cn } from '@/utils/cn';\nimport { CircleXIcon } from 'lucide-react';\n\nconst Form = FormProvider;\n\ninterface 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  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\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\ninterface 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-red-solid', 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 } =\n    useFormField();\n\n  return (\n    <Slot\n      ref={ref}\n      id={formItemId}\n      aria-describedby={\n        !error ? formDescriptionId : `${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-[0.8rem] text-foreground-muted', 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-[0.8rem] font-medium text-red-solid', className)}\n      {...props}\n    >\n      <CircleXIcon className=\"mr-1.5 inline-block size-4\" />\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/primitives/icon.tsx",
    "content": "import { icons } from 'lucide-react';\n\ninterface Props {\n  name: keyof typeof icons;\n  color?: string;\n  size?: number;\n  strokeWidth?: number;\n}\n\nexport const Icon: React.FC<Props> = ({ name, color, size, strokeWidth }) => {\n  // eslint-disable-next-line security/detect-object-injection\n  const LucideIcon = icons[name];\n\n  return (\n    <LucideIcon strokeWidth={strokeWidth} color={color} size={size ?? 24} />\n  );\n};\n\nexport type IconNames = keyof typeof icons;\nexport const iconNames = Object.keys(icons) as IconNames[];\n"
  },
  {
    "path": "src/primitives/input.tsx",
    "content": "import * as React from 'react';\n\nimport { cn } from '@/utils/cn';\n\nexport type InputProps = 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-9 w-full rounded-md border border-gray-subtle-border bg-gray-subtle px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-gray-solid focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-pink-solid-hover 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/primitives/label.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\n\nimport type { VariantProps } from 'class-variance-authority';\n\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { cva } from 'class-variance-authority';\n\nimport { cn } from '@/utils/cn';\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/primitives/navigation-menu.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\n\nimport * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';\nimport { cva } from 'class-variance-authority';\nimport { ChevronDown } from 'lucide-react';\n\nimport { cn } from '@/utils/cn';\n\nconst NavigationMenu = React.forwardRef<\n  React.ElementRef<typeof NavigationMenuPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>\n>(({ className, children, ...props }, ref) => (\n  <NavigationMenuPrimitive.Root\n    ref={ref}\n    className={cn(\n      'relative z-10 flex max-w-max flex-1 items-center justify-center',\n      className,\n    )}\n    {...props}\n  >\n    {children}\n    <NavigationMenuViewport />\n  </NavigationMenuPrimitive.Root>\n));\nNavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;\n\nconst NavigationMenuList = React.forwardRef<\n  React.ElementRef<typeof NavigationMenuPrimitive.List>,\n  React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>\n>(({ className, ...props }, ref) => (\n  <NavigationMenuPrimitive.List\n    ref={ref}\n    className={cn(\n      'group flex flex-1 list-none items-center justify-center space-x-1',\n      className,\n    )}\n    {...props}\n  />\n));\nNavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;\n\nconst NavigationMenuItem = NavigationMenuPrimitive.Item;\n\nconst navigationMenuTriggerStyle = cva(\n  'group inline-flex w-max items-center justify-center rounded-md px-3 py-2 text-sm text-foreground transition-colors hover:bg-white/5 focus:outline-none disabled:pointer-events-none disabled:opacity-50',\n);\n\nconst NavigationMenuTrigger = React.forwardRef<\n  React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,\n  React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n  <NavigationMenuPrimitive.Trigger\n    ref={ref}\n    className={cn(navigationMenuTriggerStyle(), 'group', className)}\n    {...props}\n  >\n    {children}{' '}\n    <ChevronDown\n      className=\"relative top-px ml-1 size-3 transition duration-200 group-data-[state=open]:rotate-180\"\n      aria-hidden=\"true\"\n    />\n  </NavigationMenuPrimitive.Trigger>\n));\nNavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;\n\nconst NavigationMenuContent = React.forwardRef<\n  React.ElementRef<typeof NavigationMenuPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n  <NavigationMenuPrimitive.Content\n    ref={ref}\n    className={cn(\n      'relative left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto',\n      className,\n    )}\n    {...props}\n  />\n));\nNavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;\n\nconst NavigationMenuLink = NavigationMenuPrimitive.Link;\n\nconst NavigationMenuViewport = React.forwardRef<\n  React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,\n  React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>\n>(({ className, ...props }, ref) => (\n  <div className={cn('absolute left-0 top-full flex justify-center')}>\n    <NavigationMenuPrimitive.Viewport\n      className={cn(\n        'relative mt-1 h-[var(--radix-navigation-menu-viewport-height)] w-full origin-top overflow-hidden rounded-lg border border-gray-element bg-background text-foreground-muted shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]',\n        className,\n      )}\n      ref={ref}\n      {...props}\n    />\n  </div>\n));\nNavigationMenuViewport.displayName =\n  NavigationMenuPrimitive.Viewport.displayName;\n\nconst NavigationMenuIndicator = React.forwardRef<\n  React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,\n  React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>\n>(({ className, ...props }, ref) => (\n  <NavigationMenuPrimitive.Indicator\n    ref={ref}\n    className={cn(\n      'top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in',\n      className,\n    )}\n    {...props}\n  >\n    <div className=\"relative top-[60%] size-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n  </NavigationMenuPrimitive.Indicator>\n));\nNavigationMenuIndicator.displayName =\n  NavigationMenuPrimitive.Indicator.displayName;\n\nexport {\n  navigationMenuTriggerStyle,\n  NavigationMenu,\n  NavigationMenuList,\n  NavigationMenuItem,\n  NavigationMenuContent,\n  NavigationMenuTrigger,\n  NavigationMenuLink,\n  NavigationMenuIndicator,\n  NavigationMenuViewport,\n};\n"
  },
  {
    "path": "src/primitives/popover.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { cn } from '@/utils/cn';\n\nconst Popover = PopoverPrimitive.Root;\n\nconst PopoverTrigger = PopoverPrimitive.Trigger;\n\nconst PopoverAnchor = PopoverPrimitive.Anchor;\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-gray-subtle text-foreground-muted 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, PopoverAnchor };\n"
  },
  {
    "path": "src/primitives/resizable-panel.tsx",
    "content": "import { AnimatePresence, motion } from 'framer-motion';\nimport { type PropsWithChildren } from 'react';\nimport useResizeObserver from 'use-resize-observer';\nconst ignoreCircularReferences = () => {\n  const seen = new WeakSet();\n  return (key: string, value: Record<string, unknown>) => {\n    if (key.startsWith('_')) {\n      return;\n    } // Don't compare React's internal props.\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    if (typeof value === 'object' && value !== null) {\n      if (seen.has(value)) {\n        return;\n      }\n      seen.add(value);\n    }\n    return value;\n  };\n};\n\nexport function ResizablePanel({ children }: PropsWithChildren) {\n  const { ref, height } = useResizeObserver<HTMLDivElement>();\n\n  return (\n    <motion.div\n      animate={{ height: height ?? 'auto' }}\n      initial={false}\n      className=\"relative w-full overflow-hidden\"\n    >\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        <motion.div\n          key={JSON.stringify(children, ignoreCircularReferences())}\n          initial={{\n            opacity: 0,\n          }}\n          animate={{\n            opacity: 1,\n          }}\n          exit={{\n            opacity: 0,\n          }}\n        >\n          <div ref={ref}>{children}</div>\n        </motion.div>\n      </AnimatePresence>\n    </motion.div>\n  );\n}\n"
  },
  {
    "path": "src/primitives/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 '@/utils/cn';\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/primitives/select.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\n\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\n\nimport { cn } from '@/utils/cn';\n\nconst Select = SelectPrimitive.Root;\n\nconst SelectGroup = SelectPrimitive.Group;\n\nconst SelectValue = SelectPrimitive.Value;\n\nconst SelectTrigger = React.forwardRef<\n  React.ElementRef<typeof SelectPrimitive.Trigger>,\n  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n  <SelectPrimitive.Trigger\n    ref={ref}\n    className={cn(\n      'flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-gray-subtle-border bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-gray-solid focus:outline-none focus:ring-1 focus:ring-pink-solid-hover disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',\n      className,\n    )}\n    {...props}\n  >\n    {children}\n    <SelectPrimitive.Icon asChild>\n      <ChevronDownIcon className=\"size-4 opacity-50\" />\n    </SelectPrimitive.Icon>\n  </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n\nconst SelectScrollUpButton = React.forwardRef<\n  React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n  React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n  <SelectPrimitive.ScrollUpButton\n    ref={ref}\n    className={cn(\n      'flex cursor-default items-center justify-center py-1',\n      className,\n    )}\n    {...props}\n  >\n    <ChevronUpIcon />\n  </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\n\nconst SelectScrollDownButton = React.forwardRef<\n  React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n  React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n  <SelectPrimitive.ScrollDownButton\n    ref={ref}\n    className={cn(\n      'flex cursor-default items-center justify-center py-1',\n      className,\n    )}\n    {...props}\n  >\n    <ChevronDownIcon />\n  </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName =\n  SelectPrimitive.ScrollDownButton.displayName;\n\nconst SelectContent = React.forwardRef<\n  React.ElementRef<typeof SelectPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = 'popper', ...props }, ref) => (\n  <SelectPrimitive.Portal>\n    <SelectPrimitive.Content\n      ref={ref}\n      className={cn(\n        'relative z-50 max-h-96 min-w-32 overflow-hidden rounded-lg border bg-gray-subtle text-foreground-muted 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        position === 'popper' &&\n          'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',\n        className,\n      )}\n      position={position}\n      {...props}\n    >\n      <SelectScrollUpButton />\n      <SelectPrimitive.Viewport\n        className={cn(\n          'p-1.5',\n          position === 'popper' &&\n            'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',\n        )}\n      >\n        {children}\n      </SelectPrimitive.Viewport>\n      <SelectScrollDownButton />\n    </SelectPrimitive.Content>\n  </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\n\nconst SelectLabel = React.forwardRef<\n  React.ElementRef<typeof SelectPrimitive.Label>,\n  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n  <SelectPrimitive.Label\n    ref={ref}\n    className={cn('px-2 py-1.5 text-sm font-semibold', className)}\n    {...props}\n  />\n));\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\n\nconst SelectItem = React.forwardRef<\n  React.ElementRef<typeof SelectPrimitive.Item>,\n  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n  <SelectPrimitive.Item\n    ref={ref}\n    className={cn(\n      'relative flex w-full cursor-default select-none items-center rounded-md border border-transparent py-1.5 pl-2 pr-8 text-sm outline-none focus:border-gray-element-border focus:bg-gray-element-hover focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n      className,\n    )}\n    {...props}\n  >\n    <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n      <SelectPrimitive.ItemIndicator>\n        <CheckIcon className=\"size-4\" />\n      </SelectPrimitive.ItemIndicator>\n    </span>\n    <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n  </SelectPrimitive.Item>\n));\nSelectItem.displayName = SelectPrimitive.Item.displayName;\n\nconst SelectSeparator = React.forwardRef<\n  React.ElementRef<typeof SelectPrimitive.Separator>,\n  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <SelectPrimitive.Separator\n    ref={ref}\n    className={cn('-mx-1 my-1 h-px bg-gray-subtle', className)}\n    {...props}\n  />\n));\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\n\nexport {\n  Select,\n  SelectGroup,\n  SelectValue,\n  SelectTrigger,\n  SelectContent,\n  SelectLabel,\n  SelectItem,\n  SelectSeparator,\n  SelectScrollUpButton,\n  SelectScrollDownButton,\n};\n"
  },
  {
    "path": "src/primitives/separator.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\n\nimport { cn } from '@/utils/cn';\n\nconst Separator = React.forwardRef<\n  React.ElementRef<typeof SeparatorPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(\n  (\n    { className, orientation = 'horizontal', decorative = true, ...props },\n    ref,\n  ) => (\n    <SeparatorPrimitive.Root\n      ref={ref}\n      decorative={decorative}\n      orientation={orientation}\n      className={cn(\n        'shrink-0 bg-border',\n        orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',\n        className,\n      )}\n      {...props}\n    />\n  ),\n);\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n"
  },
  {
    "path": "src/primitives/skeleton.tsx",
    "content": "import { cn } from '@/utils/cn';\n\nfunction Skeleton({\n  className,\n  noPulse = false,\n  ...props\n}: React.HTMLAttributes<HTMLDivElement> & { noPulse?: boolean }) {\n  return (\n    <div\n      className={cn(\n        'animate-pulse rounded-md bg-gray-element',\n        noPulse && 'animate-none',\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport { Skeleton };\n"
  },
  {
    "path": "src/primitives/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']) ?? 'light'}\n      // eslint-disable-next-line tailwindcss/no-custom-classname\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/primitives/tabs.tsx",
    "content": "'use client';\n\nimport * as React from 'react';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\n\nimport { cn } from '@/utils/cn';\n\nconst Tabs = TabsPrimitive.Root;\n\nconst TabsList = React.forwardRef<\n  React.ElementRef<typeof TabsPrimitive.List>,\n  React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n  <TabsPrimitive.List\n    ref={ref}\n    className={cn(\n      'inline-flex h-12 items-center gap-4 border-b text-gray-foreground-muted',\n      className,\n    )}\n    {...props}\n  />\n));\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nconst TabsTrigger = React.forwardRef<\n  React.ElementRef<typeof TabsPrimitive.Trigger>,\n  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n  <TabsPrimitive.Trigger\n    ref={ref}\n    className={cn(\n      'relative inline-flex items-center whitespace-nowrap rounded-sm px-2 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-pink-solid-hover focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-foreground data-[state=active]:after:absolute data-[state=active]:after:bottom-[-14px] data-[state=active]:after:left-0 data-[state=active]:after:h-[2px] data-[state=active]:after:w-full data-[state=active]:after:bg-pink-solid-hover',\n      className,\n    )}\n    {...props}\n  />\n));\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\nconst TabsContent = React.forwardRef<\n  React.ElementRef<typeof TabsPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n  <TabsPrimitive.Content\n    ref={ref}\n    className={cn(\n      'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-pink-solid-hover focus-visible:ring-offset-2',\n      className,\n    )}\n    {...props}\n  />\n));\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent };\n"
  },
  {
    "path": "src/primitives/textarea.tsx",
    "content": "import * as React from 'react';\n\nimport { cn } from '@/utils/cn';\n\nexport type TextareaProps = 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-gray-subtle-border bg-gray-subtle px-3 py-2 text-sm ring-offset-background placeholder:text-gray-solid focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-pink-solid-hover 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/server/index.ts",
    "content": "import { earlyAccessRouter } from './routers/early-access';\nimport { modulesRouter } from './routers/modules';\nimport { createCallerFactory, createRouter, publicProcedure } from './trpc';\n\nexport const appRouter = createRouter({\n  healthcheck: publicProcedure.query(() => 'ok'),\n  earlyAccess: earlyAccessRouter,\n  modules: modulesRouter,\n});\n\nexport type AppRouter = typeof appRouter;\n\nexport const createCaller = createCallerFactory(appRouter);\n"
  },
  {
    "path": "src/server/routers/early-access.ts",
    "content": "import { earlyAccessTable } from '@/db/schema';\nimport { createRouter, publicProcedure } from '../trpc';\nimport EarlyAccessJoinedEmail from '@/emails/templates/early-access-joined';\nimport { TRPCError } from '@trpc/server';\nimport { z } from 'zod';\n\nconst nonHumanEmailDomains = [\n  '@no-reply',\n  '@noreply',\n  '@notifications',\n  '@alerts',\n  '@mailer',\n  '@updates',\n  '@system',\n  '@bot',\n  '@mailchimp.com',\n  '@sendgrid.net',\n  '@postmarkapp.com',\n  '@amazonaws.com',\n  '@mailgun.org',\n  '@constantcontact.com',\n  '@sendinblue.com',\n  '@intercom.io',\n  '@intercom-mail.com',\n  '@zendesk.com',\n  '@freshdesk.com',\n  '@helpscout.net',\n  '@tawk.to',\n  '@hubspot.com',\n  '@salesforce.com',\n  '@marketo.com',\n  '@pipedrive.com',\n  '@drip.com',\n  '@activecampaign.com',\n  '@autopilotmail.com',\n  '@slack.com',\n  '@jira.com',\n  '@trello.com',\n  '@asana.com',\n  '@monday.com',\n  '@github.com',\n  '@gitlab.com',\n  '@bitbucket.org',\n  '@paypal.com',\n  '@stripe.com',\n  '@shopify.com',\n  '@bigcommerce.com',\n  '@facebookmail.com',\n  '@linkedin.com',\n  '@twitter.com',\n  '@pinterest.com',\n  '@redditmail.com',\n  '@medium.com',\n];\n\nconst automatedKeywordsInUsername = [\n  'noreply',\n  'no-reply',\n  'admin',\n  'support',\n  'system',\n  'notifications',\n  'bot',\n  'helpdesk',\n  'service',\n  'info',\n  'alerts',\n  'updates',\n  'newsletter',\n  'mailer',\n  'auto',\n  'daemon',\n  'bounce',\n  'team',\n  'noreplys',\n  'customerservice',\n  'contact',\n  'autoresponder',\n];\n\nfunction isEmailGibberish(username: string): boolean {\n  const vowelCount = username.replace(/[^aeiou]/gi, '').length;\n  const consonantCount = username.replace(/[^bcdfghj-np-tv-z]/gi, '').length;\n\n  return (\n    vowelCount === 0 ||\n    (consonantCount > 8 && vowelCount < 2) ||\n    (username.length > 10 && vowelCount < 3)\n  );\n}\n\nfunction hasAlternatingCharsAndNumbers(username: string): boolean {\n  // eslint-disable-next-line security/detect-unsafe-regex, regexp/no-super-linear-backtracking\n  const alternatingPattern = /^(?:[a-z]+\\d+|\\d+[a-z]+)+$/i;\n  return alternatingPattern.test(username);\n}\n\nfunction scoreEmail(email: string): number {\n  let score = 0;\n\n  const [username, domain] = email.split('@');\n\n  if (!username || !domain) {\n    return 100;\n  }\n\n  if (nonHumanEmailDomains.some((d) => email.endsWith(d))) {\n    score += 50;\n  }\n  if (\n    automatedKeywordsInUsername.some((keyword) =>\n      username.toLowerCase().includes(keyword),\n    )\n  ) {\n    score += 30;\n  }\n\n  if (username.length > 32) {\n    score += 10;\n  } else if (username.length > 24) {\n    score += 5;\n  }\n\n  const numberCount = username.replace(/\\D/g, '').length;\n  const numberDensity = numberCount / username.length;\n  if (numberDensity > 0.5) {\n    score += 15;\n  } else if (numberDensity > 0.3) {\n    score += 10;\n  } else if (numberDensity > 0.1) {\n    score += 5;\n  }\n\n  if (isEmailGibberish(username)) {\n    score += 20;\n  }\n\n  if (hasAlternatingCharsAndNumbers(username)) {\n    score += 15;\n  }\n\n  const specialCharCount = username.replace(/[a-z0-9]/gi, '').length;\n  const specialCharDensity = specialCharCount / username.length;\n  if (specialCharDensity > 0.3) {\n    score += 15;\n  } else if (specialCharDensity > 0.2) {\n    score += 10;\n  } else if (specialCharDensity > 0.1) {\n    score += 5;\n  }\n\n  return score;\n}\n\nfunction isLikelyHuman(email: string, threshold = 30): boolean {\n  const emailScore = scoreEmail(email);\n  return emailScore < threshold;\n}\n\nexport const earlyAccessRouter = createRouter({\n  joinEarlyAccess: publicProcedure\n    .input(\n      z.object({\n        name: z.string().min(2, { message: 'Name is too short' }),\n        email: z.string().email({ message: 'Invalid email address' }).min(5),\n        reason: z.enum(['student', 'project', 'both']).default('student'),\n      }),\n    )\n    .mutation(async ({ ctx, input }) => {\n      const { email, name, reason } = input;\n      const { db, resend } = ctx;\n\n      const emailHuman = isLikelyHuman(email);\n\n      if (!emailHuman) {\n        throw new TRPCError({\n          code: 'BAD_REQUEST',\n          message: 'Please use a valid email address.',\n        });\n      }\n\n      await db\n        .insert(earlyAccessTable)\n        .values({\n          email,\n          name,\n          reason,\n        })\n        .catch((err: unknown) => {\n          if (err instanceof Error) {\n            if (\n              err.message.includes(\n                'duplicate key value violates unique constraint',\n              )\n            ) {\n              throw new TRPCError({\n                code: 'BAD_REQUEST',\n                cause: err,\n                message: 'This email is already on the early access list.',\n              });\n            }\n\n            throw new TRPCError({\n              code: 'INTERNAL_SERVER_ERROR',\n              cause: err,\n              message:\n                'An error occurred while adding you to the early access list. Please try again later.',\n            });\n          }\n        });\n\n      await resend.emails\n        .send({\n          from: 'Noodle <contact@noodle.run>',\n          to: email,\n          subject: \"You are on Noodle's early access list!\",\n          react: EarlyAccessJoinedEmail({ name, email }),\n        })\n        .catch((err: unknown) => {\n          throw new TRPCError({\n            code: 'INTERNAL_SERVER_ERROR',\n            cause: err,\n            message:\n              'An error occurred while adding you to the early access list. Please try again later.',\n          });\n        });\n    }),\n});\n"
  },
  {
    "path": "src/server/routers/modules.ts",
    "content": "import { createRouter, protectedProcedure } from '../trpc';\nimport {\n  insertModuleSchema,\n  modulesTable,\n  selectModuleSchema,\n} from '@/db/schema';\nimport { TRPCError } from '@trpc/server';\nimport { DrizzleError, and, eq } from 'drizzle-orm';\n\nexport const modulesRouter = createRouter({\n  getById: protectedProcedure\n    .input(selectModuleSchema.pick({ id: true }))\n    .query(async ({ ctx, input }) => {\n      const userId = ctx.user.id;\n\n      try {\n        const userModule = await ctx.db.query.modulesTable.findFirst({\n          where: (t, { and, eq }) =>\n            and(eq(t.id, input.id), eq(t.user_id, userId)),\n        });\n\n        if (!userModule) {\n          throw new TRPCError({\n            code: 'BAD_REQUEST',\n            message: 'Module not found',\n          });\n        }\n\n        return userModule;\n      } catch (error) {\n        if (error instanceof DrizzleError) {\n          throw new TRPCError({\n            code: 'BAD_REQUEST',\n            message: error.message,\n          });\n        }\n\n        throw new TRPCError({\n          code: 'INTERNAL_SERVER_ERROR',\n          message: 'An error occurred while fetching the module',\n        });\n      }\n    }),\n\n  getUserModules: protectedProcedure.query(async ({ ctx }) => {\n    const userId = ctx.user.id;\n\n    return ctx.db.query.modulesTable.findMany({\n      where: (t, { eq }) => eq(t.user_id, userId),\n      orderBy: (t, { desc }) => desc(t.lastVisited),\n    });\n  }),\n\n  create: protectedProcedure\n    .input(\n      insertModuleSchema.pick({\n        name: true,\n        description: true,\n        code: true,\n        icon: true,\n        color: true,\n        credits: true,\n      }),\n    )\n    .mutation(async ({ ctx, input }) => {\n      const userId = ctx.user.id;\n\n      return ctx.db\n        .insert(modulesTable)\n        .values({\n          ...input,\n          description: input.description ?? '',\n          user_id: userId,\n        })\n        .returning();\n    }),\n\n  archive: protectedProcedure\n    .input(selectModuleSchema.pick({ id: true }))\n    .mutation(async ({ ctx, input }) => {\n      const userId = ctx.user.id;\n\n      return ctx.db\n        .update(modulesTable)\n        .set({ archived: true })\n        .where(\n          and(eq(modulesTable.id, input.id), eq(modulesTable.user_id, userId)),\n        );\n    }),\n\n  recover: protectedProcedure\n    .input(selectModuleSchema.pick({ id: true }))\n    .mutation(async ({ ctx, input }) => {\n      const userId = ctx.user.id;\n\n      return ctx.db\n        .update(modulesTable)\n        .set({ archived: false })\n        .where(\n          and(eq(modulesTable.id, input.id), eq(modulesTable.user_id, userId)),\n        );\n    }),\n\n  update: protectedProcedure\n    .input(\n      insertModuleSchema.pick({\n        color: true,\n        icon: true,\n        name: true,\n        description: true,\n        code: true,\n        credits: true,\n        id: true,\n      }),\n    )\n    .mutation(async ({ ctx, input }) => {\n      const userId = ctx.user.id;\n\n      const { id: moduleId, ...updateData } = input;\n\n      const existingModule = await ctx.db.query.modulesTable.findFirst({\n        where: (t, { and, eq }) =>\n          and(eq(t.id, moduleId), eq(t.user_id, userId)),\n      });\n\n      if (!existingModule) {\n        throw new Error('Module not found');\n      }\n\n      return ctx.db\n        .update(modulesTable)\n        .set({\n          ...updateData,\n          description: updateData.description ?? '',\n          modifiedAt: new Date(),\n        })\n        .where(\n          and(eq(modulesTable.id, moduleId), eq(modulesTable.user_id, userId)),\n        );\n    }),\n\n  updateLastVisited: protectedProcedure\n    .input(insertModuleSchema.pick({ id: true }))\n    .mutation(async ({ ctx, input }) => {\n      const userId = ctx.user.id;\n\n      return ctx.db\n        .update(modulesTable)\n        .set({ lastVisited: new Date() })\n        .where(\n          and(eq(modulesTable.id, input.id), eq(modulesTable.user_id, userId)),\n        );\n    }),\n});\n"
  },
  {
    "path": "src/server/trpc.ts",
    "content": "import { currentUser } from '@clerk/nextjs/server';\nimport { initTRPC, TRPCError } from '@trpc/server';\nimport superjson from 'superjson';\nimport { ZodError } from 'zod';\n\nimport { db } from '@/db';\nimport { resend } from '@/lib/resend';\nimport { redis } from '@/lib/redis';\n\nexport const createTRPCContext = (opts: { headers: Headers }) => {\n  return {\n    db,\n    resend,\n    redis,\n    ...opts,\n  };\n};\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\nexport const createCallerFactory = t.createCallerFactory;\nexport const createRouter = t.router;\nexport const publicProcedure = t.procedure;\n\nexport const protectedProcedure = t.procedure.use(async ({ next }) => {\n  const user = await currentUser();\n\n  if (!user) {\n    throw new TRPCError({ code: 'UNAUTHORIZED' });\n  }\n\n  return next({\n    ctx: {\n      user: { ...user },\n    },\n  });\n});\n"
  },
  {
    "path": "src/utils/base-url.ts",
    "content": "import { env } from '@/env';\n\n/**\n * A utility function to get the base URL of the current instance.\n * @returns The base URL.\n */\nexport function getBaseUrl() {\n  if (typeof window !== 'undefined') {\n    return window.location.origin;\n  }\n\n  if (env.VERCEL_URL) {\n    return `https://${env.VERCEL_URL}`;\n  }\n  return `http://localhost:${String(env.PORT)}`;\n}\n"
  },
  {
    "path": "src/utils/cn.ts",
    "content": "import type { ClassValue } from 'clsx';\nimport clsx from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to merge Tailwind CSS classes using a combination of clsx\n * and tailwind-merge.\n * @example\n *   import { cn } from '@lib/utils';\n *\n *   const classes = cn('text-black', 'bg-white', 'p-4');\n * @param inputs - The classes to merge.\n * @returns A string of the classes merged together.\n */\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n"
  },
  {
    "path": "src/utils/construct-metadata.ts",
    "content": "import { constants } from '@/constants';\nimport { getBaseUrl } from './base-url';\nimport type { Metadata } from 'next';\n\n/**\n * A utility function to construct metadata for the application which can be\n * used per page.\n * @param params - The parameters for the metadata.\n * @param params.title The title of the page.\n * @param params.description The description of the page.\n * @param params.image The image of the page.\n * @param params.icons The icons of the page.\n * @param params.noIndex Whether to no-index the page.\n * @param params.url The URL of the page.\n * @param params.type The type of the page, either 'website' or 'article'.\n * @param params.publishedTime The published time of the article.\n * @returns The metadata for the page.\n */\nexport function constructMetadata({\n  title = constants.name,\n  description = constants.description,\n  image = `${getBaseUrl()}/thumbnail.jpg`,\n  icons = [\n    {\n      rel: 'apple-touch-icon',\n      sizes: '32x32',\n      url: '/apple-touch-icon.png',\n    },\n    {\n      rel: 'icon',\n      type: 'image/png',\n      sizes: '32x32',\n      url: '/favicon-32x32.png',\n    },\n    {\n      rel: 'icon',\n      type: 'image/png',\n      sizes: '16x16',\n      url: '/favicon-16x16.png',\n    },\n  ],\n  noIndex = false,\n  url = getBaseUrl(),\n  type = 'website',\n  publishedTime,\n}: {\n  title?: string;\n  description?: string;\n  image?: string | null;\n  icons?: Metadata['icons'];\n  noIndex?: boolean;\n  url?: string;\n  type?: 'website' | 'article';\n  publishedTime?: string;\n} = {}): Metadata {\n  return {\n    title,\n    description,\n    openGraph: {\n      title,\n      description,\n      url,\n      type,\n      publishedTime,\n      ...(image && {\n        images: [\n          {\n            url: image,\n          },\n        ],\n      }),\n    },\n    twitter: {\n      title,\n      description,\n      ...(image && {\n        card: 'summary_large_image',\n        images: [image],\n      }),\n      creator: constants.twitter_handle,\n    },\n    icons,\n    metadataBase: new URL(getBaseUrl()),\n    ...(noIndex && {\n      robots: {\n        index: false,\n        follow: false,\n      },\n    }),\n  };\n}\n"
  },
  {
    "path": "tailwind.config.ts",
    "content": "import type { Config } from 'tailwindcss';\n\nimport aspectRatioPlugin from '@tailwindcss/aspect-ratio';\nimport containerQueriesPlugin from '@tailwindcss/container-queries';\nimport typographyPlugin from '@tailwindcss/typography';\nimport tailwindAnimate from 'tailwindcss-animate';\n\ntype Scale = 'gray' | 'pink' | 'salmon' | 'indigo' | 'red';\n\nconst generateColorScale = (scale: Scale) => ({\n  DEFAULT: `hsl(var(--${scale}-9))`,\n\n  'foreground-muted': `hsl(var(--${scale}-11))`,\n  foreground: `hsl(var(--${scale}-12))`,\n\n  app: `hsl(var(--${scale}-1))`,\n\n  subtle: `hsl(var(--${scale}-2))`,\n  'subtle-border': `hsl(var(--${scale}-6))`,\n\n  element: `hsl(var(--${scale}-3))`,\n  'element-hover': `hsl(var(--${scale}-4))`,\n  'element-active': `hsl(var(--${scale}-5))`,\n  'element-border': `hsl(var(--${scale}-7))`,\n  'element-border-hover': `hsl(var(--${scale}-8))`,\n\n  solid: `hsl(var(--${scale}-9))`,\n  'solid-hover': `hsl(var(--${scale}-10))`,\n});\n\nconst config: Config = {\n  content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],\n  darkMode: 'class',\n  theme: {\n    container: {\n      center: true,\n      padding: '1.5rem',\n      screens: {\n        '2xl': '1400px',\n      },\n    },\n    extend: {\n      colors: {\n        background: 'hsl(var(--gray-1))',\n        foreground: 'hsl(var(--gray-12))',\n        'foreground-muted': 'hsl(var(--gray-11))',\n        border: 'hsl(var(--gray-4))',\n\n        gray: generateColorScale('gray'),\n        pink: generateColorScale('pink'),\n        salmon: generateColorScale('salmon'),\n        indigo: generateColorScale('indigo'),\n        red: generateColorScale('red'),\n      },\n      fontFamily: {\n        sans: ['var(--font-geist-sans)'],\n        mono: ['var(--font-geist-mono)'],\n      },\n    },\n  },\n  plugins: [\n    typographyPlugin,\n    aspectRatioPlugin,\n    {\n      handler: containerQueriesPlugin.handler,\n      config: containerQueriesPlugin.config ?? {},\n    },\n    tailwindAnimate,\n  ],\n};\nexport default config;\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"allowUnusedLabels\": false,\n    \"allowUnreachableCode\": false,\n    \"exactOptionalPropertyTypes\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noImplicitOverride\": true,\n    \"noImplicitReturns\": true,\n    \"noPropertyAccessFromIndexSignature\": true,\n    \"noUncheckedIndexedAccess\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n\n    \"isolatedModules\": true,\n\n    \"allowJs\": true,\n    \"checkJs\": true,\n\n    \"esModuleInterop\": true,\n    \"skipLibCheck\": true,\n    \"forceConsistentCasingInFileNames\": true,\n\n    \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n    \"module\": \"esnext\",\n    \"target\": \"es2022\",\n    \"moduleResolution\": \"bundler\",\n    \"moduleDetection\": \"force\",\n    \"allowImportingTsExtensions\": true,\n    \"resolveJsonModule\": true,\n    \"noEmit\": true,\n    \"incremental\": true,\n\n    \"jsx\": \"preserve\",\n    \"plugins\": [\n      {\n        \"name\": \"next\"\n      }\n    ],\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  },\n  \"include\": [\n    \"next-env.d.ts\",\n    \"reset.d.ts\",\n    \"eslint.d.ts\",\n    \"**/*.ts\",\n    \"**/*.js\",\n    \"**/*.tsx\",\n    \".next/types/**/*.ts\"\n  ],\n  \"exclude\": [\"node_modules\"]\n}\n"
  }
]