Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

chore: remove unused shiki/code-block/tool ai-elements scaffold

Khuram Niazd9b985055b0a
diff --git a/package-lock.json b/package-lock.json
index 208995c..55db644 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -62,7 +62,6 @@
"react-day-picker": "^9.12.0",
"react-dom": "19.2.4",
"react-hook-form": "^7.54.2",
- "shiki": "^4.4.1",
"sonner": "^2.0.7",
"tailwind-merge": "^3.6.0",
"tw-animate-css": "^1.4.0",
@@ -4444,106 +4443,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@shikijs/core": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.4.1.tgz",
- "integrity": "sha512-VeR2CY6Nn9/WbisoYLOQZ7HZOnwTrpBuOw4wExjqLnBCi62BNWynBUO6K2uPIASPFJwAv7cX1fUu+LrPlSstcw==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/primitive": "4.4.1",
- "@shikijs/types": "4.4.1",
- "@shikijs/vscode-textmate": "^10.0.2",
- "@types/hast": "^3.0.5",
- "hast-util-to-html": "^9.0.5"
- },
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/@shikijs/engine-javascript": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.4.1.tgz",
- "integrity": "sha512-6U4lJBh8LTvIkEVqRHv/rr3ruwtO6IweFQt1ME1ntHJMGHS+6N86vfYGO1o8c/DtOCTia2lfhdQBtBrps1sDfQ==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/types": "4.4.1",
- "@shikijs/vscode-textmate": "^10.0.2",
- "oniguruma-to-es": "^4.3.6"
- },
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/@shikijs/engine-oniguruma": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.4.1.tgz",
- "integrity": "sha512-p23RugMKss0r5DAtRJW1yAXUDl60JvhQYV20yuxei//26JyDSJefV3umyWzzwep2weblMnJGDYahuti6XkcMgA==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/types": "4.4.1",
- "@shikijs/vscode-textmate": "^10.0.2"
- },
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/@shikijs/langs": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.4.1.tgz",
- "integrity": "sha512-xb2kCMloBCIraIy2fS5MW0t/BxVY3q2nDyQKBoeSeq6KNrQbShHetCFlw2n35fGIJ6t3+hXDLQogP5ir9O9bvA==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/types": "4.4.1"
- },
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/@shikijs/primitive": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.4.1.tgz",
- "integrity": "sha512-ko2OfDoG89YuQ7xL5LtcQiWKb7NIv1Ephb7g48TVU198OzAMLC8lXVEwaJGHK4sUMYrfAGJDqYmNLOLiW/Kz8w==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/types": "4.4.1",
- "@shikijs/vscode-textmate": "^10.0.2",
- "@types/hast": "^3.0.5"
- },
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/@shikijs/themes": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.4.1.tgz",
- "integrity": "sha512-wudOaoFro+/Zl9gQv2W1Ur5XlVduqvTuYLI483Xi0wgc1A+cy1hfB2r6ac6ufBgF+ID7KJEW7L41MHrzQ4wH+w==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/types": "4.4.1"
- },
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/@shikijs/types": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.4.1.tgz",
- "integrity": "sha512-GOwCLQDHM5EjGUWNPrhzJbr6JP8V/Dx/CDVkWvbZ1Avw5JFnNUckrgbLmE07qtg4WlW7Q7QFndhjIkeU9XMPvw==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/vscode-textmate": "^10.0.2",
- "@types/hast": "^3.0.5"
- },
- "engines": {
- "node": ">=20"
- }
- },
- "node_modules/@shikijs/vscode-textmate": {
- "version": "10.0.2",
- "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz",
- "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==",
- "license": "MIT"
- },
"node_modules/@standard-schema/spec": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
@@ -5549,15 +5448,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/hast": {
- "version": "3.0.5",
- "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.5.tgz",
- "integrity": "sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "*"
- }
- },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -5588,15 +5478,6 @@
"@types/mdurl": "^2"
}
},
- "node_modules/@types/mdast": {
- "version": "4.0.4",
- "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",
- "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "*"
- }
- },
"node_modules/@types/mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz",
@@ -5650,12 +5531,6 @@
"@types/react": "^19.2.0"
}
},
- "node_modules/@types/unist": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
- "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==",
- "license": "MIT"
- },
"node_modules/@types/use-sync-external-store": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
@@ -5934,12 +5809,6 @@
"url": "https://opencollective.com/eslint"
}
},
- "node_modules/@ungap/structured-clone": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.3.tgz",
- "integrity": "sha512-60YRaenCQcVjYEKOcG824+DRGGIQ3VKErcBoAEDJZz5bKIs2ZG+X/H9Nk+Q6EVkwJk5QNApxbrc5QtBSwtrXAg==",
- "license": "ISC"
- },
"node_modules/@unrs/resolver-binding-android-arm-eabi": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.11.1.tgz",
@@ -7153,16 +7022,6 @@
],
"license": "CC-BY-4.0"
},
- "node_modules/ccount": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz",
- "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/chai": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
@@ -7206,26 +7065,6 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
- "node_modules/character-entities-html4": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz",
- "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
- "node_modules/character-entities-legacy": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
- "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/chokidar": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
@@ -7345,16 +7184,6 @@
"node": ">=12.20"
}
},
- "node_modules/comma-separated-tokens": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
- "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -7842,19 +7671,6 @@
"integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==",
"license": "MIT"
},
- "node_modules/devlop": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz",
- "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==",
- "license": "MIT",
- "dependencies": {
- "dequal": "^2.0.0"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/dfa": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz",
@@ -9386,42 +9202,6 @@
"node": ">= 0.4"
}
},
- "node_modules/hast-util-to-html": {
- "version": "9.0.5",
- "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz",
- "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==",
- "license": "MIT",
- "dependencies": {
- "@types/hast": "^3.0.0",
- "@types/unist": "^3.0.0",
- "ccount": "^2.0.0",
- "comma-separated-tokens": "^2.0.0",
- "hast-util-whitespace": "^3.0.0",
- "html-void-elements": "^3.0.0",
- "mdast-util-to-hast": "^13.0.0",
- "property-information": "^7.0.0",
- "space-separated-tokens": "^2.0.0",
- "stringify-entities": "^4.0.0",
- "zwitch": "^2.0.4"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/hast-util-whitespace": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",
- "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==",
- "license": "MIT",
- "dependencies": {
- "@types/hast": "^3.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
"node_modules/hono": {
"version": "4.12.32",
"resolved": "https://registry.npmjs.org/hono/-/hono-4.12.32.tgz",
@@ -9468,16 +9248,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/html-void-elements": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz",
- "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
@@ -10904,27 +10674,6 @@
"node": ">= 0.4"
}
},
- "node_modules/mdast-util-to-hast": {
- "version": "13.2.1",
- "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",
- "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==",
- "license": "MIT",
- "dependencies": {
- "@types/hast": "^3.0.0",
- "@types/mdast": "^4.0.0",
- "@ungap/structured-clone": "^1.0.0",
- "devlop": "^1.0.0",
- "micromark-util-sanitize-uri": "^2.0.0",
- "trim-lines": "^3.0.0",
- "unist-util-position": "^5.0.0",
- "unist-util-visit": "^5.0.0",
- "vfile": "^6.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
"node_modules/mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",
@@ -10968,95 +10717,6 @@
"node": ">= 8"
}
},
- "node_modules/micromark-util-character": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz",
- "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==",
- "funding": [
- {
- "type": "GitHub Sponsors",
- "url": "https://github.com/sponsors/unifiedjs"
- },
- {
- "type": "OpenCollective",
- "url": "https://opencollective.com/unified"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "micromark-util-symbol": "^2.0.0",
- "micromark-util-types": "^2.0.0"
- }
- },
- "node_modules/micromark-util-encode": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz",
- "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==",
- "funding": [
- {
- "type": "GitHub Sponsors",
- "url": "https://github.com/sponsors/unifiedjs"
- },
- {
- "type": "OpenCollective",
- "url": "https://opencollective.com/unified"
- }
- ],
- "license": "MIT"
- },
- "node_modules/micromark-util-sanitize-uri": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz",
- "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==",
- "funding": [
- {
- "type": "GitHub Sponsors",
- "url": "https://github.com/sponsors/unifiedjs"
- },
- {
- "type": "OpenCollective",
- "url": "https://opencollective.com/unified"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "micromark-util-character": "^2.0.0",
- "micromark-util-encode": "^2.0.0",
- "micromark-util-symbol": "^2.0.0"
- }
- },
- "node_modules/micromark-util-symbol": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz",
- "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==",
- "funding": [
- {
- "type": "GitHub Sponsors",
- "url": "https://github.com/sponsors/unifiedjs"
- },
- {
- "type": "OpenCollective",
- "url": "https://opencollective.com/unified"
- }
- ],
- "license": "MIT"
- },
- "node_modules/micromark-util-types": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz",
- "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==",
- "funding": [
- {
- "type": "GitHub Sponsors",
- "url": "https://github.com/sponsors/unifiedjs"
- },
- {
- "type": "OpenCollective",
- "url": "https://opencollective.com/unified"
- }
- ],
- "license": "MIT"
- },
"node_modules/micromatch": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
@@ -11552,23 +11212,6 @@
"wrappy": "1"
}
},
- "node_modules/oniguruma-parser": {
- "version": "0.12.2",
- "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz",
- "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==",
- "license": "MIT"
- },
- "node_modules/oniguruma-to-es": {
- "version": "4.3.6",
- "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz",
- "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==",
- "license": "MIT",
- "dependencies": {
- "oniguruma-parser": "^0.12.2",
- "regex": "^6.1.0",
- "regex-recursion": "^6.0.2"
- }
- },
"node_modules/option": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/option/-/option-0.2.4.tgz",
@@ -12026,16 +11669,6 @@
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"license": "MIT"
},
- "node_modules/property-information": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz",
- "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/prosemirror-changeset": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/prosemirror-changeset/-/prosemirror-changeset-2.3.1.tgz",
@@ -12574,30 +12207,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/regex": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz",
- "integrity": "sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==",
- "license": "MIT",
- "dependencies": {
- "regex-utilities": "^2.3.0"
- }
- },
- "node_modules/regex-recursion": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz",
- "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==",
- "license": "MIT",
- "dependencies": {
- "regex-utilities": "^2.3.0"
- }
- },
- "node_modules/regex-utilities": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz",
- "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==",
- "license": "MIT"
- },
"node_modules/regexp.prototype.flags": {
"version": "1.5.4",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz",
@@ -13074,25 +12683,6 @@
"node": ">=8"
}
},
- "node_modules/shiki": {
- "version": "4.4.1",
- "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.4.1.tgz",
- "integrity": "sha512-rFP+iYKzjLEIqiMiKANhARqiAbk4deDhWnBtnUO/K0D0dPxMGDH4N0FVfBY/VeI+lPrV4wNGCHQZp7EOr7NNBw==",
- "license": "MIT",
- "dependencies": {
- "@shikijs/core": "4.4.1",
- "@shikijs/engine-javascript": "4.4.1",
- "@shikijs/engine-oniguruma": "4.4.1",
- "@shikijs/langs": "4.4.1",
- "@shikijs/themes": "4.4.1",
- "@shikijs/types": "4.4.1",
- "@shikijs/vscode-textmate": "^10.0.2",
- "@types/hast": "^3.0.5"
- },
- "engines": {
- "node": ">=20"
- }
- },
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
@@ -13191,16 +12781,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/space-separated-tokens": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
- "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -13373,20 +12953,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/stringify-entities": {
- "version": "4.0.4",
- "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
- "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==",
- "license": "MIT",
- "dependencies": {
- "character-entities-html4": "^2.0.0",
- "character-entities-legacy": "^3.0.0"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/strip-indent": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
@@ -13668,16 +13234,6 @@
"node": ">=18"
}
},
- "node_modules/trim-lines": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
- "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/ts-api-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
@@ -14026,74 +13582,6 @@
"integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==",
"license": "MIT"
},
- "node_modules/unist-util-is": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz",
- "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/unist-util-position": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz",
- "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/unist-util-stringify-position": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz",
- "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/unist-util-visit": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz",
- "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0",
- "unist-util-is": "^6.0.0",
- "unist-util-visit-parents": "^6.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/unist-util-visit-parents": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz",
- "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0",
- "unist-util-is": "^6.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
"node_modules/unpdf": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/unpdf/-/unpdf-1.6.2.tgz",
@@ -14263,34 +13751,6 @@
"node": ">= 0.8"
}
},
- "node_modules/vfile": {
- "version": "6.0.3",
- "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
- "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0",
- "vfile-message": "^4.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/vfile-message": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz",
- "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0",
- "unist-util-stringify-position": "^4.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
"node_modules/vite": {
"version": "8.1.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-8.1.3.tgz",
@@ -14804,16 +14264,6 @@
"peerDependencies": {
"zod": "^3.25.28 || ^4"
}
- },
- "node_modules/zwitch": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",
- "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
}
}
}
diff --git a/package.json b/package.json
index d703b83..b144399 100644
--- a/package.json
+++ b/package.json
@@ -75,7 +75,6 @@
"react-day-picker": "^9.12.0",
"react-dom": "19.2.4",
"react-hook-form": "^7.54.2",
- "shiki": "^4.4.1",
"sonner": "^2.0.7",
"tailwind-merge": "^3.6.0",
"tw-animate-css": "^1.4.0",
diff --git a/src/components/ai-elements/code-block.tsx b/src/components/ai-elements/code-block.tsx
deleted file mode 100644
index 11b45b0..0000000
--- a/src/components/ai-elements/code-block.tsx
+++ /dev/null
@@ -1,561 +0,0 @@
-"use client";
-
-import { Button } from "@/components/ui/button";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select";
-import { cn } from "@/lib/utils";
-import { CheckIcon, CopyIcon } from "lucide-react";
-import type { ComponentProps, CSSProperties, HTMLAttributes } from "react";
-import {
- createContext,
- memo,
- useCallback,
- useContext,
- useEffect,
- useMemo,
- useRef,
- useState,
-} from "react";
-import type {
- BundledLanguage,
- BundledTheme,
- HighlighterGeneric,
- ThemedToken,
-} from "shiki";
-import { createHighlighter } from "shiki";
-
-// Shiki uses bitflags for font styles: 1=italic, 2=bold, 4=underline
-// oxlint-disable-next-line eslint(no-bitwise)
-const isItalic = (fontStyle: number | undefined) => fontStyle && fontStyle & 1;
-// oxlint-disable-next-line eslint(no-bitwise)
-const isBold = (fontStyle: number | undefined) => fontStyle && fontStyle & 2;
-const isUnderline = (fontStyle: number | undefined) =>
- // oxlint-disable-next-line eslint(no-bitwise)
- fontStyle && fontStyle & 4;
-
-// Transform tokens to include pre-computed keys to avoid noArrayIndexKey lint
-interface KeyedToken {
- token: ThemedToken;
- key: string;
-}
-interface KeyedLine {
- tokens: KeyedToken[];
- key: string;
-}
-
-const addKeysToTokens = (lines: ThemedToken[][]): KeyedLine[] =>
- lines.map((line, lineIdx) => ({
- key: `line-${lineIdx}`,
- tokens: line.map((token, tokenIdx) => ({
- key: `line-${lineIdx}-${tokenIdx}`,
- token,
- })),
- }));
-
-// Token rendering component
-const TokenSpan = ({ token }: { token: ThemedToken }) => (
- <span
- className="dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)]"
- style={
- {
- backgroundColor: token.bgColor,
- color: token.color,
- fontStyle: isItalic(token.fontStyle) ? "italic" : undefined,
- fontWeight: isBold(token.fontStyle) ? "bold" : undefined,
- textDecoration: isUnderline(token.fontStyle) ? "underline" : undefined,
- ...token.htmlStyle,
- } as CSSProperties
- }
- >
- {token.content}
- </span>
-);
-
-// Line number styles using CSS counters
-const LINE_NUMBER_CLASSES = cn(
- "block",
- "before:content-[counter(line)]",
- "before:inline-block",
- "before:[counter-increment:line]",
- "before:w-8",
- "before:mr-4",
- "before:text-right",
- "before:text-muted-foreground/50",
- "before:font-mono",
- "before:select-none"
-);
-
-// Line rendering component
-const LineSpan = ({
- keyedLine,
- showLineNumbers,
-}: {
- keyedLine: KeyedLine;
- showLineNumbers: boolean;
-}) => (
- <span className={showLineNumbers ? LINE_NUMBER_CLASSES : "block"}>
- {keyedLine.tokens.length === 0
- ? "\n"
- : keyedLine.tokens.map(({ token, key }) => (
- <TokenSpan key={key} token={token} />
- ))}
- </span>
-);
-
-// Types
-type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
- code: string;
- language: BundledLanguage;
- showLineNumbers?: boolean;
-};
-
-interface TokenizedCode {
- tokens: ThemedToken[][];
- fg: string;
- bg: string;
-}
-
-interface CodeBlockContextType {
- code: string;
-}
-
-// Context
-const CodeBlockContext = createContext<CodeBlockContextType>({
- code: "",
-});
-
-// Highlighter cache (singleton per language)
-const highlighterCache = new Map<
- string,
- Promise<HighlighterGeneric<BundledLanguage, BundledTheme>>
->();
-
-// Token cache
-const tokensCache = new Map<string, TokenizedCode>();
-
-// Subscribers for async token updates
-const subscribers = new Map<string, Set<(result: TokenizedCode) => void>>();
-
-const getTokensCacheKey = (code: string, language: BundledLanguage) => {
- const start = code.slice(0, 100);
- const end = code.length > 100 ? code.slice(-100) : "";
- return `${language}:${code.length}:${start}:${end}`;
-};
-
-const getHighlighter = (
- language: BundledLanguage
-): Promise<HighlighterGeneric<BundledLanguage, BundledTheme>> => {
- const cached = highlighterCache.get(language);
- if (cached) {
- return cached;
- }
-
- const highlighterPromise = createHighlighter({
- langs: [language],
- themes: ["github-light", "github-dark"],
- });
-
- highlighterCache.set(language, highlighterPromise);
- return highlighterPromise;
-};
-
-// Create raw tokens for immediate display while highlighting loads
-const createRawTokens = (code: string): TokenizedCode => ({
- bg: "transparent",
- fg: "inherit",
- tokens: code.split("\n").map((line) =>
- line === ""
- ? []
- : [
- {
- color: "inherit",
- content: line,
- } as ThemedToken,
- ]
- ),
-});
-
-// Synchronous highlight with callback for async results
-export const highlightCode = (
- code: string,
- language: BundledLanguage,
- // oxlint-disable-next-line eslint-plugin-promise(prefer-await-to-callbacks)
- callback?: (result: TokenizedCode) => void
-): TokenizedCode | null => {
- const tokensCacheKey = getTokensCacheKey(code, language);
-
- // Return cached result if available
- const cached = tokensCache.get(tokensCacheKey);
- if (cached) {
- return cached;
- }
-
- // Subscribe callback if provided
- if (callback) {
- if (!subscribers.has(tokensCacheKey)) {
- subscribers.set(tokensCacheKey, new Set());
- }
- subscribers.get(tokensCacheKey)?.add(callback);
- }
-
- // Start highlighting in background - fire-and-forget async pattern
- getHighlighter(language)
- // oxlint-disable-next-line eslint-plugin-promise(prefer-await-to-then)
- .then((highlighter) => {
- const availableLangs = highlighter.getLoadedLanguages();
- const langToUse = availableLangs.includes(language) ? language : "text";
-
- const result = highlighter.codeToTokens(code, {
- lang: langToUse,
- themes: {
- dark: "github-dark",
- light: "github-light",
- },
- });
-
- const tokenized: TokenizedCode = {
- bg: result.bg ?? "transparent",
- fg: result.fg ?? "inherit",
- tokens: result.tokens,
- };
-
- // Cache the result
- tokensCache.set(tokensCacheKey, tokenized);
-
- // Notify all subscribers
- const subs = subscribers.get(tokensCacheKey);
- if (subs) {
- for (const sub of subs) {
- sub(tokenized);
- }
- subscribers.delete(tokensCacheKey);
- }
- })
- // oxlint-disable-next-line eslint-plugin-promise(prefer-await-to-then), eslint-plugin-promise(prefer-await-to-callbacks)
- .catch((error) => {
- console.error("Failed to highlight code:", error);
- subscribers.delete(tokensCacheKey);
- });
-
- return null;
-};
-
-const CodeBlockBody = memo(
- ({
- tokenized,
- showLineNumbers,
- className,
- }: {
- tokenized: TokenizedCode;
- showLineNumbers: boolean;
- className?: string;
- }) => {
- const preStyle = useMemo(
- () => ({
- backgroundColor: tokenized.bg,
- color: tokenized.fg,
- }),
- [tokenized.bg, tokenized.fg]
- );
-
- const keyedLines = useMemo(
- () => addKeysToTokens(tokenized.tokens),
- [tokenized.tokens]
- );
-
- return (
- <pre
- className={cn(
- "dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)] m-0 p-4 text-sm",
- className
- )}
- style={preStyle}
- >
- <code
- className={cn(
- "font-mono text-sm",
- showLineNumbers && "[counter-increment:line_0] [counter-reset:line]"
- )}
- >
- {keyedLines.map((keyedLine) => (
- <LineSpan
- key={keyedLine.key}
- keyedLine={keyedLine}
- showLineNumbers={showLineNumbers}
- />
- ))}
- </code>
- </pre>
- );
- },
- (prevProps, nextProps) =>
- prevProps.tokenized === nextProps.tokenized &&
- prevProps.showLineNumbers === nextProps.showLineNumbers &&
- prevProps.className === nextProps.className
-);
-
-CodeBlockBody.displayName = "CodeBlockBody";
-
-export const CodeBlockContainer = ({
- className,
- language,
- style,
- ...props
-}: HTMLAttributes<HTMLDivElement> & { language: string }) => (
- <div
- className={cn(
- "group relative w-full overflow-hidden rounded-md border bg-background text-foreground",
- className
- )}
- data-language={language}
- style={{
- containIntrinsicSize: "auto 200px",
- contentVisibility: "auto",
- ...style,
- }}
- {...props}
- />
-);
-
-export const CodeBlockHeader = ({
- children,
- className,
- ...props
-}: HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn(
- "flex items-center justify-between border-b bg-muted/80 px-3 py-2 text-muted-foreground text-xs",
- className
- )}
- {...props}
- >
- {children}
- </div>
-);
-
-export const CodeBlockTitle = ({
- children,
- className,
- ...props
-}: HTMLAttributes<HTMLDivElement>) => (
- <div className={cn("flex items-center gap-2", className)} {...props}>
- {children}
- </div>
-);
-
-export const CodeBlockFilename = ({
- children,
- className,
- ...props
-}: HTMLAttributes<HTMLSpanElement>) => (
- <span className={cn("font-mono", className)} {...props}>
- {children}
- </span>
-);
-
-export const CodeBlockActions = ({
- children,
- className,
- ...props
-}: HTMLAttributes<HTMLDivElement>) => (
- <div
- className={cn("-my-1 -mr-1 flex items-center gap-2", className)}
- {...props}
- >
- {children}
- </div>
-);
-
-export const CodeBlockContent = ({
- code,
- language,
- showLineNumbers = false,
-}: {
- code: string;
- language: BundledLanguage;
- showLineNumbers?: boolean;
-}) => {
- // Memoized raw tokens for immediate display
- const rawTokens = useMemo(() => createRawTokens(code), [code]);
-
- // Synchronous cache lookup — avoids setState in effect for cached results
- const syncTokens = useMemo(
- () => highlightCode(code, language) ?? rawTokens,
- [code, language, rawTokens]
- );
-
- // Async highlighting result (populated after shiki loads)
- const [asyncTokens, setAsyncTokens] = useState<TokenizedCode | null>(null);
- const asyncKeyRef = useRef({ code, language });
-
- // Invalidate stale async tokens synchronously during render
- if (
- asyncKeyRef.current.code !== code ||
- asyncKeyRef.current.language !== language
- ) {
- asyncKeyRef.current = { code, language };
- setAsyncTokens(null);
- }
-
- useEffect(() => {
- let cancelled = false;
-
- highlightCode(code, language, (result) => {
- if (!cancelled) {
- setAsyncTokens(result);
- }
- });
-
- return () => {
- cancelled = true;
- };
- }, [code, language]);
-
- const tokenized = asyncTokens ?? syncTokens;
-
- return (
- <div className="relative overflow-auto">
- <CodeBlockBody showLineNumbers={showLineNumbers} tokenized={tokenized} />
- </div>
- );
-};
-
-export const CodeBlock = ({
- code,
- language,
- showLineNumbers = false,
- className,
- children,
- ...props
-}: CodeBlockProps) => {
- const contextValue = useMemo(() => ({ code }), [code]);
-
- return (
- <CodeBlockContext.Provider value={contextValue}>
- <CodeBlockContainer className={className} language={language} {...props}>
- {children}
- <CodeBlockContent
- code={code}
- language={language}
- showLineNumbers={showLineNumbers}
- />
- </CodeBlockContainer>
- </CodeBlockContext.Provider>
- );
-};
-
-export type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
- onCopy?: () => void;
- onError?: (error: Error) => void;
- timeout?: number;
-};
-
-export const CodeBlockCopyButton = ({
- onCopy,
- onError,
- timeout = 2000,
- children,
- className,
- ...props
-}: CodeBlockCopyButtonProps) => {
- const [isCopied, setIsCopied] = useState(false);
- const timeoutRef = useRef<number>(0);
- const { code } = useContext(CodeBlockContext);
-
- const copyToClipboard = useCallback(async () => {
- if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
- onError?.(new Error("Clipboard API not available"));
- return;
- }
-
- try {
- if (!isCopied) {
- await navigator.clipboard.writeText(code);
- setIsCopied(true);
- onCopy?.();
- timeoutRef.current = window.setTimeout(
- () => setIsCopied(false),
- timeout
- );
- }
- } catch (error) {
- onError?.(error as Error);
- }
- }, [code, onCopy, onError, timeout, isCopied]);
-
- useEffect(
- () => () => {
- window.clearTimeout(timeoutRef.current);
- },
- []
- );
-
- const Icon = isCopied ? CheckIcon : CopyIcon;
-
- return (
- <Button
- className={cn("shrink-0", className)}
- onClick={copyToClipboard}
- size="icon"
- variant="ghost"
- {...props}
- >
- {children ?? <Icon size={14} />}
- </Button>
- );
-};
-
-export type CodeBlockLanguageSelectorProps = ComponentProps<typeof Select>;
-
-export const CodeBlockLanguageSelector = (
- props: CodeBlockLanguageSelectorProps
-) => <Select {...props} />;
-
-export type CodeBlockLanguageSelectorTriggerProps = ComponentProps<
- typeof SelectTrigger
->;
-
-export const CodeBlockLanguageSelectorTrigger = ({
- className,
- ...props
-}: CodeBlockLanguageSelectorTriggerProps) => (
- <SelectTrigger
- className={cn(
- "h-7 border-none bg-transparent px-2 text-xs shadow-none",
- className
- )}
- {...props}
- />
-);
-
-export type CodeBlockLanguageSelectorValueProps = ComponentProps<
- typeof SelectValue
->;
-
-export const CodeBlockLanguageSelectorValue = (
- props: CodeBlockLanguageSelectorValueProps
-) => <SelectValue {...props} />;
-
-export type CodeBlockLanguageSelectorContentProps = ComponentProps<
- typeof SelectContent
->;
-
-export const CodeBlockLanguageSelectorContent = ({
- align = "end",
- ...props
-}: CodeBlockLanguageSelectorContentProps) => (
- <SelectContent align={align} {...props} />
-);
-
-export type CodeBlockLanguageSelectorItemProps = ComponentProps<
- typeof SelectItem
->;
-
-export const CodeBlockLanguageSelectorItem = (
- props: CodeBlockLanguageSelectorItemProps
-) => <SelectItem {...props} />;
diff --git a/src/components/ai-elements/tool.tsx b/src/components/ai-elements/tool.tsx
deleted file mode 100644
index 18c4bb8..0000000
--- a/src/components/ai-elements/tool.tsx
+++ /dev/null
@@ -1,173 +0,0 @@
-"use client";
-
-import { Badge } from "@/components/ui/badge";
-import {
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
-} from "@/components/ui/collapsible";
-import { cn } from "@/lib/utils";
-import type { DynamicToolUIPart, ToolUIPart } from "ai";
-import {
- CheckCircleIcon,
- ChevronDownIcon,
- CircleIcon,
- ClockIcon,
- WrenchIcon,
- XCircleIcon,
-} from "lucide-react";
-import type { ComponentProps, ReactNode } from "react";
-import { isValidElement } from "react";
-
-import { CodeBlock } from "./code-block";
-
-export type ToolProps = ComponentProps<typeof Collapsible>;
-
-export const Tool = ({ className, ...props }: ToolProps) => (
- <Collapsible
- className={cn("group not-prose mb-4 w-full rounded-md border", className)}
- {...props}
- />
-);
-
-export type ToolPart = ToolUIPart | DynamicToolUIPart;
-
-export type ToolHeaderProps = {
- title?: string;
- className?: string;
-} & (
- | { type: ToolUIPart["type"]; state: ToolUIPart["state"]; toolName?: never }
- | {
- type: DynamicToolUIPart["type"];
- state: DynamicToolUIPart["state"];
- toolName: string;
- }
-);
-
-const statusLabels: Record<ToolPart["state"], string> = {
- "approval-requested": "Awaiting Approval",
- "approval-responded": "Responded",
- "input-available": "Running",
- "input-streaming": "Pending",
- "output-available": "Completed",
- "output-denied": "Denied",
- "output-error": "Error",
-};
-
-const statusIcons: Record<ToolPart["state"], ReactNode> = {
- "approval-requested": <ClockIcon className="size-4 text-yellow-600" />,
- "approval-responded": <CheckCircleIcon className="size-4 text-blue-600" />,
- "input-available": <ClockIcon className="size-4 animate-pulse" />,
- "input-streaming": <CircleIcon className="size-4" />,
- "output-available": <CheckCircleIcon className="size-4 text-green-600" />,
- "output-denied": <XCircleIcon className="size-4 text-orange-600" />,
- "output-error": <XCircleIcon className="size-4 text-red-600" />,
-};
-
-export const getStatusBadge = (status: ToolPart["state"]) => (
- <Badge className="gap-1.5 rounded-full text-xs" variant="secondary">
- {statusIcons[status]}
- {statusLabels[status]}
- </Badge>
-);
-
-export const ToolHeader = ({
- className,
- title,
- type,
- state,
- toolName,
- ...props
-}: ToolHeaderProps) => {
- const derivedName =
- type === "dynamic-tool" ? toolName : type.split("-").slice(1).join("-");
-
- return (
- <CollapsibleTrigger
- className={cn(
- "flex w-full items-center justify-between gap-4 p-3",
- className
- )}
- {...props}
- >
- <div className="flex items-center gap-2">
- <WrenchIcon className="size-4 text-muted-foreground" />
- <span className="font-medium text-sm">{title ?? derivedName}</span>
- {getStatusBadge(state)}
- </div>
- <ChevronDownIcon className="size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" />
- </CollapsibleTrigger>
- );
-};
-
-export type ToolContentProps = ComponentProps<typeof CollapsibleContent>;
-
-export const ToolContent = ({ className, ...props }: ToolContentProps) => (
- <CollapsibleContent
- className={cn(
- "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 space-y-4 p-4 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
- className
- )}
- {...props}
- />
-);
-
-export type ToolInputProps = ComponentProps<"div"> & {
- input: ToolPart["input"];
-};
-
-export const ToolInput = ({ className, input, ...props }: ToolInputProps) => (
- <div className={cn("space-y-2 overflow-hidden", className)} {...props}>
- <h4 className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
- Parameters
- </h4>
- <div className="rounded-md bg-muted/50">
- <CodeBlock code={JSON.stringify(input, null, 2)} language="json" />
- </div>
- </div>
-);
-
-export type ToolOutputProps = ComponentProps<"div"> & {
- output: ToolPart["output"];
- errorText: ToolPart["errorText"];
-};
-
-export const ToolOutput = ({
- className,
- output,
- errorText,
- ...props
-}: ToolOutputProps) => {
- if (!(output || errorText)) {
- return null;
- }
-
- let Output = <div>{output as ReactNode}</div>;
-
- if (typeof output === "object" && !isValidElement(output)) {
- Output = (
- <CodeBlock code={JSON.stringify(output, null, 2)} language="json" />
- );
- } else if (typeof output === "string") {
- Output = <CodeBlock code={output} language="json" />;
- }
-
- return (
- <div className={cn("space-y-2", className)} {...props}>
- <h4 className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
- {errorText ? "Error" : "Result"}
- </h4>
- <div
- className={cn(
- "overflow-x-auto rounded-md text-xs [&_table]:w-full",
- errorText
- ? "bg-destructive/10 text-destructive"
- : "bg-muted/50 text-foreground"
- )}
- >
- {errorText && <div>{errorText}</div>}
- {Output}
- </div>
- </div>
- );
-};