"use strict";(()=>{var T={};T.id=3079,T.ids=[3079],T.modules={72934:T=>{T.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:T=>{T.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:T=>{T.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:T=>{T.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:T=>{T.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},27790:T=>{T.exports=require("assert")},78893:T=>{T.exports=require("buffer")},84770:T=>{T.exports=require("crypto")},17702:T=>{T.exports=require("events")},92048:T=>{T.exports=require("fs")},32615:T=>{T.exports=require("http")},35240:T=>{T.exports=require("https")},19801:T=>{T.exports=require("os")},55315:T=>{T.exports=require("path")},86624:T=>{T.exports=require("querystring")},17360:T=>{T.exports=require("url")},21764:T=>{T.exports=require("util")},71568:T=>{T.exports=require("zlib")},92761:T=>{T.exports=require("node:async_hooks")},17718:T=>{T.exports=require("node:child_process")},6005:T=>{T.exports=require("node:crypto")},15673:T=>{T.exports=require("node:events")},87561:T=>{T.exports=require("node:fs")},93977:T=>{T.exports=require("node:fs/promises")},70612:T=>{T.exports=require("node:os")},49411:T=>{T.exports=require("node:path")},97742:T=>{T.exports=require("node:process")},25997:T=>{T.exports=require("node:tty")},47261:T=>{T.exports=require("node:util")},51352:(T,e,E)=>{E.r(e),E.d(e,{originalPathname:()=>X,patchFetch:()=>u,requestAsyncStorage:()=>I,routeModule:()=>S,serverHooks:()=>p,staticGenerationAsyncStorage:()=>D});var r={};E.r(r),E.d(r,{GET:()=>O,POST:()=>l,dynamic:()=>n});var t=E(49790),L=E(60540),i=E(82273),N=E(19096),A=E(27489),a=E(64451),o=E(92795),s=E(71281);let n="force-dynamic";async function U(){let T=await (0,A.getServerSession)(a.L);return T?.user?.id}async function O(){let T=await U();if(!T)return N.NextResponse.json({error:"Unauthorized"},{status:401});let e=await (0,s.gJ)(T);return N.NextResponse.json({available:!!e})}async function l(){let T=await U();if(!T)return N.NextResponse.json({error:"Unauthorized"},{status:401});let e=await (0,s.gJ)(T);if(!e)return N.NextResponse.json({error:"No previous rewrite version is available."},{status:404});let E=await o._.profile.upsert({where:{userId:T},update:{fullName:e.fullName,email:e.email,phone:e.phone,location:e.location,linkedinUrl:e.linkedinUrl,websiteUrl:e.websiteUrl,summary:e.summary,skills:e.skills,experience:e.experience,education:e.education,certifications:e.certifications,projects:e.projects,languages:e.languages,atsScore:e.atsScore??null,lastAnalysis:e.lastAnalysis??null},create:{userId:T,fullName:e.fullName,email:e.email,phone:e.phone,location:e.location,linkedinUrl:e.linkedinUrl,websiteUrl:e.websiteUrl,summary:e.summary,skills:e.skills,experience:e.experience,education:e.education,certifications:e.certifications,projects:e.projects,languages:e.languages,atsScore:e.atsScore??null,lastAnalysis:e.lastAnalysis??null}});return await (0,s.FA)(T),N.NextResponse.json({ok:!0,profile:E})}let S=new t.AppRouteRouteModule({definition:{kind:L.x.APP_ROUTE,page:"/api/profile/rewrite/rollback/route",pathname:"/api/profile/rewrite/rollback",filename:"route",bundlePath:"app/api/profile/rewrite/rollback/route"},resolvedPagePath:"/Users/andrasgyenes/Desktop/MrQuery 2026/HyreMe/Archive/hyreme-app/app/api/profile/rewrite/rollback/route.ts",nextConfigOutput:"standalone",userland:r}),{requestAsyncStorage:I,staticGenerationAsyncStorage:D,serverHooks:p}=S,X="/api/profile/rewrite/rollback/route";function u(){return(0,i.patchFetch)({serverHooks:p,staticGenerationAsyncStorage:D})}},64451:(T,e,E)=>{E.d(e,{L:()=>A});var r=E(53236),t=E(23734),L=E.n(t),i=E(92795),N=E(93334);let A={session:{strategy:"jwt"},pages:{signIn:"/login"},providers:[(0,r.Z)({name:"credentials",credentials:{email:{label:"Email",type:"email"},password:{label:"Password",type:"password"}},async authorize(T){if(!T?.email||!T?.password)return null;await (0,N.X)(i._);let e=await i._.user.findUnique({where:{email:T.email.toLowerCase()}});if(!e||!await L().compare(T.password,e.password))return null;if(!e.emailVerified)throw Error("EMAIL_NOT_VERIFIED");return{id:e.id,email:e.email,name:e.name??void 0}}})],callbacks:{jwt:async({token:T,user:e})=>(e&&(T.id=e.id),T),session:async({session:T,token:e})=>(T.user&&e.id&&(T.user.id=e.id),T)}}},93334:(T,e,E)=>{E.d(e,{X:()=>i});let r=globalThis,t=[`
  CREATE TABLE IF NOT EXISTS "User" (
      "id" TEXT NOT NULL,
      "email" TEXT NOT NULL,
      "password" TEXT NOT NULL,
      "name" TEXT,
      "firstName" TEXT,
      "lastName" TEXT,
      "photoUrl" TEXT,
      "emailVerified" TIMESTAMP(3),
      "verificationToken" TEXT,
      "verificationTokenExpiry" TIMESTAMP(3),
      "aiProvider" TEXT NOT NULL DEFAULT 'gemini',
      "aiModel" TEXT,
      "aiOpenaiKey" TEXT,
      "aiAnthropicKey" TEXT,
      "aiGeminiKey" TEXT,
      "aiMistralKey" TEXT,
      "aiGroqKey" TEXT,
      "aiDeepseekKey" TEXT,
      "aiXaiKey" TEXT,
      "aiCohereKey" TEXT,
      "aiPerplexityKey" TEXT,
      "aiOllamaKey" TEXT,
      "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      CONSTRAINT "User_pkey" PRIMARY KEY ("id")
  )
  `,'ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "name" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "firstName" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "lastName" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "photoUrl" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "emailVerified" TIMESTAMP(3)','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "verificationToken" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "verificationTokenExpiry" TIMESTAMP(3)','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiProvider" TEXT DEFAULT \'gemini\'','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiModel" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiOpenaiKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiAnthropicKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiGeminiKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiMistralKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiGroqKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiDeepseekKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiXaiKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiCohereKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiPerplexityKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "aiOllamaKey" TEXT','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','CREATE UNIQUE INDEX IF NOT EXISTS "User_email_key" ON "User"("email")',`
  CREATE TABLE IF NOT EXISTS "Profile" (
      "id" TEXT NOT NULL,
      "userId" TEXT NOT NULL,
      "fullName" TEXT NOT NULL DEFAULT '',
      "email" TEXT NOT NULL DEFAULT '',
      "phone" TEXT NOT NULL DEFAULT '',
      "location" TEXT NOT NULL DEFAULT '',
      "linkedinUrl" TEXT NOT NULL DEFAULT '',
      "websiteUrl" TEXT NOT NULL DEFAULT '',
      "summary" TEXT NOT NULL DEFAULT '',
      "skills" JSONB NOT NULL DEFAULT '[]',
      "experience" JSONB NOT NULL DEFAULT '[]',
      "education" JSONB NOT NULL DEFAULT '[]',
      "certifications" JSONB NOT NULL DEFAULT '[]',
      "projects" JSONB NOT NULL DEFAULT '[]',
      "languages" JSONB NOT NULL DEFAULT '[]',
      "atsScore" INTEGER,
      "lastAnalysis" TEXT,
      "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      CONSTRAINT "Profile_pkey" PRIMARY KEY ("id")
  )
  `,'ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "fullName" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "email" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "phone" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "location" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "linkedinUrl" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "websiteUrl" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "summary" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "skills" JSONB NOT NULL DEFAULT \'[]\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "experience" JSONB NOT NULL DEFAULT \'[]\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "education" JSONB NOT NULL DEFAULT \'[]\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "certifications" JSONB NOT NULL DEFAULT \'[]\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "projects" JSONB NOT NULL DEFAULT \'[]\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "languages" JSONB NOT NULL DEFAULT \'[]\'','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "atsScore" INTEGER','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "lastAnalysis" TEXT','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','ALTER TABLE "Profile" ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','ALTER TABLE "Profile" DROP COLUMN IF EXISTS "targetTitle"','CREATE UNIQUE INDEX IF NOT EXISTS "Profile_userId_key" ON "Profile"("userId")',`
  CREATE TABLE IF NOT EXISTS "JobListing" (
      "id" TEXT NOT NULL,
      "userId" TEXT NOT NULL,
      "url" TEXT NOT NULL,
      "title" TEXT NOT NULL DEFAULT '',
      "company" TEXT NOT NULL DEFAULT '',
      "location" TEXT NOT NULL DEFAULT '',
      "rawContent" TEXT NOT NULL DEFAULT '',
      "description" TEXT NOT NULL DEFAULT '',
      "fitScore" INTEGER,
      "fitAnalysis" TEXT,
      "tailoredCvHtml" TEXT,
      "coverLetterHtml" TEXT,
      "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      CONSTRAINT "JobListing_pkey" PRIMARY KEY ("id")
  )
  `,'ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "title" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "company" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "location" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "rawContent" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "description" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "fitScore" INTEGER','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "fitAnalysis" TEXT','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "tailoredCvHtml" TEXT','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "coverLetterHtml" TEXT','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','ALTER TABLE "JobListing" ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP',`
  CREATE TABLE IF NOT EXISTS "PromptTemplate" (
      "id" TEXT NOT NULL,
      "key" TEXT NOT NULL,
      "label" TEXT NOT NULL,
      "description" TEXT NOT NULL DEFAULT '',
      "defaultContent" TEXT NOT NULL,
      "activeContent" TEXT NOT NULL,
      "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      CONSTRAINT "PromptTemplate_pkey" PRIMARY KEY ("id")
  )
  `,'ALTER TABLE "PromptTemplate" ADD COLUMN IF NOT EXISTS "key" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "PromptTemplate" ADD COLUMN IF NOT EXISTS "label" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "PromptTemplate" ADD COLUMN IF NOT EXISTS "description" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "PromptTemplate" ADD COLUMN IF NOT EXISTS "defaultContent" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "PromptTemplate" ADD COLUMN IF NOT EXISTS "activeContent" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "PromptTemplate" ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','ALTER TABLE "PromptTemplate" ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','CREATE UNIQUE INDEX IF NOT EXISTS "PromptTemplate_key_key" ON "PromptTemplate"("key")',`
  CREATE TABLE IF NOT EXISTS "PromptTemplateVersion" (
      "id" TEXT NOT NULL,
      "promptKey" TEXT NOT NULL,
      "version" INTEGER NOT NULL,
      "content" TEXT NOT NULL,
      "updatedBy" TEXT,
      "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
      CONSTRAINT "PromptTemplateVersion_pkey" PRIMARY KEY ("id")
  )
  `,'ALTER TABLE "PromptTemplateVersion" ADD COLUMN IF NOT EXISTS "promptKey" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "PromptTemplateVersion" ADD COLUMN IF NOT EXISTS "version" INTEGER NOT NULL DEFAULT 1','ALTER TABLE "PromptTemplateVersion" ADD COLUMN IF NOT EXISTS "content" TEXT NOT NULL DEFAULT \'\'','ALTER TABLE "PromptTemplateVersion" ADD COLUMN IF NOT EXISTS "updatedBy" TEXT','ALTER TABLE "PromptTemplateVersion" ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP','CREATE INDEX IF NOT EXISTS "PromptTemplateVersion_promptKey_version_idx" ON "PromptTemplateVersion"("promptKey", "version")',`
  DO $$
  BEGIN
      IF NOT EXISTS (
          SELECT 1 FROM pg_constraint WHERE conname = 'Profile_userId_fkey'
      ) THEN
          ALTER TABLE "Profile"
              ADD CONSTRAINT "Profile_userId_fkey"
              FOREIGN KEY ("userId") REFERENCES "User"("id")
              ON DELETE CASCADE ON UPDATE CASCADE;
      END IF;
  END $$;
  `,`
  DO $$
  BEGIN
      IF NOT EXISTS (
          SELECT 1 FROM pg_constraint WHERE conname = 'JobListing_userId_fkey'
      ) THEN
          ALTER TABLE "JobListing"
              ADD CONSTRAINT "JobListing_userId_fkey"
              FOREIGN KEY ("userId") REFERENCES "User"("id")
              ON DELETE CASCADE ON UPDATE CASCADE;
      END IF;
  END $$;
  `,`
  DO $$
  BEGIN
      IF NOT EXISTS (
          SELECT 1 FROM pg_constraint WHERE conname = 'PromptTemplateVersion_promptKey_fkey'
      ) THEN
          ALTER TABLE "PromptTemplateVersion"
              ADD CONSTRAINT "PromptTemplateVersion_promptKey_fkey"
              FOREIGN KEY ("promptKey") REFERENCES "PromptTemplate"("key")
              ON DELETE CASCADE ON UPDATE CASCADE;
      END IF;
  END $$;
  `];async function L(T){for(let e of t)await T.$executeRawUnsafe(e)}async function i(T){"true"!==String(process.env.LOCAL_DEV_MODE||"").toLowerCase()&&(r.hyremeSchemaReady||(r.hyremeSchemaReady=L(T).catch(T=>{throw r.hyremeSchemaReady=void 0,T})),await r.hyremeSchemaReady)}},71281:(T,e,E)=>{E.d(e,{FA:()=>D,Uj:()=>l,gJ:()=>I,R5:()=>O,gX:()=>S});let r=require("fs/promises");var t=E.n(r),L=E(55315),i=E.n(L);let N=(0,E(63095).t3)(),A=i().join(N,"resumes"),a=i().join(N,"rewrite-snapshots");async function o(T){await t().mkdir(T,{recursive:!0})}function s(T){return i().join(A,`${T}.pdf`)}function n(T){return i().join(A,`${T}.json`)}function U(T){return i().join(a,`${T}.json`)}async function O(T,e,E,r){await o(A),await t().writeFile(s(T),r),await t().writeFile(n(T),JSON.stringify({fileName:e,contentType:E},null,2),"utf8")}async function l(T){try{let[e,E]=await Promise.all([t().readFile(s(T)),t().readFile(n(T),"utf8")]);return{buffer:e,meta:JSON.parse(E)}}catch{return null}}async function S(T,e){await o(a),await t().writeFile(U(T),JSON.stringify(e,null,2),"utf8")}async function I(T){try{let e=await t().readFile(U(T),"utf8");return JSON.parse(e)}catch{return null}}async function D(T){try{await t().unlink(U(T))}catch{}}}};var e=require("../../../../../webpack-runtime.js");e.C(T);var E=T=>e(e.s=T),r=e.X(0,[9085,400,8664,7764,2795],()=>E(51352));module.exports=r})();