module.exports=[129012,e=>{"use strict";var t=e.i(572381),a=e.i(737727),n=e.i(251187),r=e.i(816815);async function o(e,t){let a=await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/data-components?limit=100`);return{...a,data:a.data.map(e=>({...e,props:e.props||{}}))}}async function i(e,t,a){let r=await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/data-components/${a}`);return{...r.data,props:r.data.props||{}}}let s=(0,a.cache)(i);async function c(e,t,a){let r=await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/data-components`,{method:"POST",body:JSON.stringify(a)});return{...r.data,props:r.data.props||{}}}async function d(e,t,a){let r=await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/data-components/${a.id}`,{method:"PUT",body:JSON.stringify(a)});return{...r.data,props:r.data.props||{}}}async function p(e,t,a){await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/data-components/${a}`,{method:"DELETE"})}(0,r.ensureServerEntryExports)([o,c,d,p,s]),(0,t.registerServerReference)(o,"6081416c03a4a790690ff95297a37c5586141ec665",null),(0,t.registerServerReference)(c,"70e49be6704dc04778d2f3344476ab0772b23da6a0",null),(0,t.registerServerReference)(d,"70a753274b67948e1f801bab26e1ab3598b0048aa1",null),(0,t.registerServerReference)(p,"703772a479f9c06ba1629e5e75b1d5019dd160d0b1",null),(0,t.registerServerReference)(s,"7fe28485adb396e2d73e1cf3e716a363ec0c0dc604",null),e.s(["fetchDataComponent",0,s])},840623,e=>e.a(async(t,a)=>{try{var n=e.i(34941),r=e.i(919240),o=e.i(498779),i=e.i(181748),s=e.i(683786),c=e.i(314336),d=e.i(78091),p=e.i(129012),l=e.i(87690),u=e.i(761283),m=t([n]);async function g(e,t){try{var a,n,m;let g,h,f,{dataComponentId:b}=await t.params,{tenantId:R,projectId:x,instructions:y,existingCode:E}=await e.json();if(!R||!x)return new Response("Missing tenantId or projectId",{status:400});let S=await (0,u.requireApiRouteProjectPermission)(e,{tenantId:R,projectId:x,level:"edit"});if(!S.ok)return S.response;let v=await (0,p.fetchDataComponent)(R,x,b);if(!v)return new Response("Data component not found",{status:404});let w=await (0,l.fetchProject)(R,x);if(!w.data)return new Response("Project not found",{status:404});let O=w.data;if(!O.models?.base)return new Response("Project base model configuration is required",{status:400});let T=(a=v,n=y,m=E,g=a.props||{},h=JSON.stringify(g,null,2),f=a.name.split(/\s+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("").replace(/[^a-zA-Z0-9]/g,""),n&&m?`You are an expert React and Tailwind CSS developer. You need to modify an existing React component based on specific instructions.

COMPONENT DETAILS:
- Original Name: ${a.name}
- Component Function Name: ${f}
- Description: ${a.description||""}
- Props Schema (JSON Schema): ${h}

EXISTING COMPONENT CODE:
\`\`\`jsx
${m}
\`\`\`

MODIFICATION INSTRUCTIONS:
${n}

REQUIREMENTS:
1. Modify the existing component code according to the instructions
2. Keep using Tailwind CSS SEMANTIC COLOR CLASSES (bg-background, text-foreground, etc.)
3. Maintain the balanced spacing and design principles from the original
4. Keep using lucide-react icons where appropriate
5. DO NOT include export statements - just the imports and function
6. DO NOT include TypeScript type annotations
7. Component name should remain: ${f}
8. DO NOT regenerate sample data - keep the same data structure

OUTPUT FORMAT:
You need to generate only one thing:
1. "component": The modified React component code as a string

Return ONLY the component field, the mockData field will be reused from the existing render.

EXAMPLE OUTPUT:
{
  "component": "import { Mail, User } from 'lucide-react';\\n\\nfunction ${f}(props) {\\n  // Modified component code here\\n}"
}

Focus on making the requested changes while maintaining the component's quality and design principles.`:`You are an expert React and Tailwind CSS developer. Generate a beautiful, modern React component for displaying data and sample data to preview it.

COMPONENT DETAILS:
- Original Name: ${a.name}
- Component Function Name: ${f}
- Description: ${a.description||""}
- Props Schema (JSON Schema): ${h}

REQUIREMENTS:
1. Create a React functional component (JSX, not TypeScript)
2. Use Tailwind CSS SEMANTIC COLOR CLASSES (these automatically adapt to light/dark mode):
   - Background: bg-background, bg-card, bg-muted, bg-muted/40, bg-accent, bg-primary
   - Text: text-foreground, text-muted-foreground, text-card-foreground, text-primary-foreground
   - Borders: border-border, border-input, border-muted
   - DO NOT use direct colors like bg-white, bg-gray-800, text-gray-900, etc.
   - DO NOT use dark: prefix - semantic classes handle dark mode automatically
3. Make it balanced - comfortable but efficient:
   - Use moderate padding: p-4, px-4 py-3 (balanced, not cramped or excessive)
   - Use appropriate text sizes: text-sm for body, text-base for headings, text-xs for captions
   - Use balanced spacing: gap-2.5, gap-3, space-y-2, mt-2, mb-3
   - Aim for a clean, professional look with good readability
4. Design for embedding - this component blends into existing content:
   - DO NOT add redundant titles or headers unless they're part of the actual data schema
   - Focus on displaying the data directly and elegantly
   - Assume the component is part of a larger conversation or content flow
   - If the schema has a "title" or "name" property, display it as data, not as a wrapper heading
5. Use LUCIDE-REACT ICONS to enhance UI aesthetics:
   - Import icons from lucide-react: import { User, Mail, Clock } from 'lucide-react'
   - Use icons with size-4 or size-5 classes for balanced visibility
   - Place icons inline with text or as visual indicators
   - Example: <User className="size-4" /> or <Mail className="size-4 text-muted-foreground" />
   - Common useful icons: User, Mail, Calendar, Clock, Check, X, Star, Heart, Settings, Search, etc.
6. The component should accept props that match the JSON Schema properties
7. Make it visually appealing and professional - clean with good whitespace
8. Use semantic HTML elements
9. Make it responsive and accessible
10. You can import icons from 'lucide-react' at the top
11. DO NOT include export statements - just the imports and function
12. DO NOT include TypeScript type annotations
13. Component name should be exactly: ${f}

AVAILABLE SEMANTIC COLOR CLASSES:
- Backgrounds: bg-background, bg-foreground, bg-card, bg-popover, bg-primary, bg-secondary, bg-muted, bg-accent, bg-destructive
- Text: text-foreground, text-background, text-card-foreground, text-popover-foreground, text-primary-foreground, text-secondary-foreground, text-muted-foreground, text-accent-foreground, text-destructive
- Borders: border-border, border-input, border-ring
- You can use opacity modifiers: bg-muted/40, bg-accent/10, etc.

OUTPUT FORMAT:
You need to generate two things:
1. "component": The complete React component code as a string
2. "mockData": Realistic sample data that matches the props schema (as a JSON object)

EXAMPLE OUTPUT (for a user profile schema with name, email, role):
{
  "component": "import { Mail, User } from 'lucide-react';\\n\\nfunction ${f}(props) {\\n  return (\\n    <div className=\\"p-4 rounded-lg border border-border bg-card\\">\\n      <div className=\\"flex items-center gap-2.5 mb-2\\">\\n        <User className=\\"size-4 text-muted-foreground\\" />\\n        <span className=\\"text-base font-medium text-foreground\\">{props.name}</span>\\n      </div>\\n      <div className=\\"flex items-center gap-2 text-sm text-muted-foreground\\">\\n        <Mail className=\\"size-4\\" />\\n        <span>{props.email}</span>\\n      </div>\\n      <div className=\\"text-xs text-muted-foreground mt-2\\">Role: {props.role}</div>\\n    </div>\\n  );\\n}",
  "mockData": {
    "name": "Sarah Chen",
    "email": "sarah.chen@example.com",
    "role": "Product Manager"
  }
}

REMEMBER:
- ONLY use semantic color classes (bg-card, text-foreground, etc.)
- NO direct colors (bg-white, text-gray-900, etc.)
- NO dark: prefix needed - semantic classes adapt automatically
- Use balanced spacing (p-4, gap-2.5/gap-3, text-sm for body, text-base for headings)
- Use lucide-react icons where appropriate for better UI
- NO redundant titles - just display the actual data from props
- Design for embedding - this blends into existing content, not a standalone card
- Make the sample data realistic and useful for previewing the component`),C=o.ModelFactory.prepareGenerationConfig(O.models?.base),N=(0,i.normalizeDataComponentSchema)(v.props),A=d.z.fromJSONSchema(N),M=d.z.object({component:d.z.string().describe("The React component code"),mockData:A.describe("Sample data matching the props schema")}),k=Object.entries({"tenant.id":R,"project.id":x}).reduce((e,[t,a])=>e.setEntry(t,{value:a}),s.propagation.getBaggage(s.context.active())??s.propagation.createBaggage()),P=s.context.with(s.propagation.setBaggage(s.context.active(),k),()=>(0,c.streamText)({...C,prompt:T,output:c.Output.object({schema:M}),temperature:.7,experimental_telemetry:{isEnabled:!0,metadata:{tenantId:R,projectId:x,generationType:r.GENERATION_TYPES.COMPONENT_RENDER}}})),U=E&&v.render&&"object"==typeof v.render&&"mockData"in v.render?v.render.mockData:null,I=new ReadableStream({async start(e){try{for await(let t of P.partialOutputStream){let a=y&&U?{...t,mockData:U}:t,n=`${JSON.stringify(a)}
`;e.enqueue(new TextEncoder().encode(n))}e.close()}catch(a){console.error("Error streaming preview generation:",a);let t=`${JSON.stringify({component:"// Error generating component",mockData:{}})}
`;e.enqueue(new TextEncoder().encode(t)),e.close()}}});return new Response(I,{headers:{"Content-Type":"application/x-ndjson","Transfer-Encoding":"chunked","Cache-Control":"no-cache"}})}catch(e){return console.error("Error generating component render:",e),new Response(e instanceof Error?e.message:"Internal server error",{status:500})}}[n]=m.then?(await m)():m,e.s(["POST",0,g]),a()}catch(e){a(e)}},!1),491615,e=>e.a(async(t,a)=>{try{var n=e.i(394375),r=e.i(325273),o=e.i(570155),i=e.i(464389),s=e.i(649982),c=e.i(240384),d=e.i(996089),p=e.i(30162),l=e.i(134499),u=e.i(192521),m=e.i(380990),g=e.i(528515),h=e.i(794380),f=e.i(850173),b=e.i(544257),R=e.i(193695);e.i(370790);var x=e.i(64123),y=e.i(840623),E=t([y]);[y]=E.then?(await E)():E;let v=new n.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/data-components/[dataComponentId]/generate-render/route",pathname:"/api/data-components/[dataComponentId]/generate-render",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/agents-manage-ui/src/app/api/data-components/[dataComponentId]/generate-render/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:w,workUnitAsyncStorage:O,serverHooks:T}=v;async function S(e,t,a){a.requestMeta&&(0,i.setRequestMeta)(e,a.requestMeta),v.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let n="/api/data-components/[dataComponentId]/generate-render/route";n=n.replace(/\/index$/,"")||"/";let o=await v.prepare(e,t,{srcPage:n,multiZoneDraftMode:!1});if(!o)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,deploymentId:E,params:S,nextConfig:w,parsedUrl:O,isDraftMode:T,prerenderManifest:C,routerServerContext:N,isOnDemandRevalidate:A,revalidateOnlyGenerated:M,resolvedPathname:k,clientReferenceManifest:P,serverActionsManifest:U}=o,I=(0,d.normalizeAppPath)(n),D=!!(C.dynamicRoutes[I]||C.routes[k]),$=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,O,!1):t.end("This page could not be found"),null);if(D&&!T){let e=!!C.routes[k],t=C.dynamicRoutes[I];if(t&&!1===t.fallback&&!e){if(w.adapterPath)return await $();throw new R.NoFallbackError}}let j=null;!D||v.isDev||T||(j=k,j="/index"===j?"/":j);let q=!0===v.isDev||!D,_=D&&!q;U&&P&&(0,c.setManifestsSingleton)({page:n,clientReferenceManifest:P,serverActionsManifest:U});let L=e.method||"GET",H=(0,s.getTracer)(),F=H.getActiveScopeSpan(),B=!!(null==N?void 0:N.isWrappedByNextServer),z=!!(0,i.getRequestMeta)(e,"minimalMode"),J=(0,i.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,w,C,z);null==J||J.resetRequestCache(),globalThis.__incrementalCache=J;let K={params:S,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:q,incrementalCache:J,cacheLifeProfiles:w.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,n,r)=>v.onRequestError(e,t,n,r,N)},sharedContext:{buildId:y,deploymentId:E}},Y=new p.NodeNextRequest(e),X=new p.NodeNextResponse(t),G=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(t));try{let o,i=async e=>v.handle(G,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let a=H.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route");if(r){let t=`${L} ${r}`;e.setAttributes({"next.route":r,"http.route":r,"next.span_name":t}),e.updateName(t),o&&o!==e&&(o.setAttribute("http.route",r),o.updateName(t))}else e.updateName(`${L} ${n}`)}),c=async o=>{var s,c;let d=async({previousCacheEntry:r})=>{try{if(!z&&A&&M&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await i(o);e.fetchMetrics=K.renderOpts.fetchMetrics;let s=K.renderOpts.pendingWaitUntil;s&&a.waitUntil&&(a.waitUntil(s),s=void 0);let c=K.renderOpts.collectedTags;if(!D)return await (0,g.sendResponse)(Y,X,n,K.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);c&&(t[b.NEXT_CACHE_TAGS_HEADER]=c),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==K.renderOpts.collectedRevalidate&&!(K.renderOpts.collectedRevalidate>=b.INFINITE_CACHE)&&K.renderOpts.collectedRevalidate,r=void 0===K.renderOpts.collectedExpire||K.renderOpts.collectedExpire>=b.INFINITE_CACHE?void 0:K.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==r?void 0:r.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:n,routeType:"route",revalidateReason:(0,m.getRevalidateReason)({isStaticGeneration:_,isOnDemandRevalidate:A})},!1,N),t}},p=await v.handleResponse({req:e,nextConfig:w,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:M,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:z});if(!D)return null;if((null==p||null==(s=p.value)?void 0:s.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(c=p.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});z||t.setHeader("x-nextjs-cache",A?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),T&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,h.fromNodeOutgoingHttpHeaders)(p.value.headers);return z&&D||l.delete(b.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,f.getCacheControlHeader)(p.cacheControl)),await (0,g.sendResponse)(Y,X,new Response(p.value.body,{headers:l,status:p.value.status||200})),null};B&&F?await c(F):(o=H.getActiveScopeSpan(),await H.withPropagatedContext(e.headers,()=>H.trace(u.BaseServerSpan.handleRequest,{spanName:`${L} ${n}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},c),void 0,!B))}catch(t){if(t instanceof R.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,m.getRevalidateReason)({isStaticGeneration:_,isOnDemandRevalidate:A})},!1,N),D)throw t;return await (0,g.sendResponse)(Y,X,new Response(null,{status:500})),null}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,o.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:O})},"routeModule",0,v,"serverHooks",0,T,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,O]),a()}catch(e){a(e)}},!1)];

//# sourceMappingURL=_0acna0x._.js.map