"use strict";(()=>{var e={};e.id=167,e.ids=[167],e.modules={399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},4770:e=>{e.exports=require("crypto")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},6829:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>x,patchFetch:()=>v,requestAsyncStorage:()=>c,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>h});var s={};r.r(s),r.d(s,{POST:()=>u});var a=r(9303),i=r(8716),p=r(670),o=r(7070),n=r(9911),d=r(5735);async function u(e,{params:t}){let r=await e.json().catch(()=>({})),s=await (0,d.W9)(),a=s.pinDrafts.find(e=>e.id===t.id);if(!a)return o.NextResponse.json({error:"pin draft not found"},{status:404});let i=await (0,n.Qt)(s,"pin_publish");if(!i.ok)return await (0,d.lX)(s),o.NextResponse.json({ok:!1,error:i.error,snapshot:i.snapshot},{status:i.status});let p=new Date().toISOString();a.status=(r.scheduleOnly,"scheduled"),a.scheduledAt=r.scheduledAt?String(r.scheduledAt):a.scheduledAt||p,a.updatedAt=p;let u={id:(0,d.Mc)("task"),type:"publish_pin",executorMode:"api",status:"pending",payload:{pinDraftId:a.id},createdAt:p,updatedAt:p};return s.tasks.unshift(u),(0,d.Vt)(s,{type:"content",actor:"user",title:"批准 Pin 发布",detail:`${a.title} -> task ${u.id}`,status:"review"}),await (0,d.lX)(s),o.NextResponse.json({pinDraft:a,task:u})}let l=new a.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/pins/drafts/[id]/approve/route",pathname:"/api/pins/drafts/[id]/approve",filename:"route",bundlePath:"app/api/pins/drafts/[id]/approve/route"},resolvedPagePath:"/Users/momo/Project/pinterest-auto/app/api/pins/drafts/[id]/approve/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:c,staticGenerationAsyncStorage:h,serverHooks:f}=l,x="/api/pins/drafts/[id]/approve/route";function v(){return(0,p.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:h})}}};var t=require("../../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[276,972,145],()=>r(6829));module.exports=s})();