module.exports=[993099,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){return await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/artifact-components?limit=100`)}let i=(0,a.cache)(o);async function s(e,t,a){return(await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/artifact-components/${a}`)).data}let c=(0,a.cache)(s);async function d(e,t,a){return(await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/artifact-components`,{method:"POST",body:JSON.stringify(a)})).data}async function p(e,t,a){return(await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/artifact-components/${a.id}`,{method:"PUT",body:JSON.stringify(a)})).data}async function l(e,t,a){await (0,n.makeManagementApiRequest)(`tenants/${e}/projects/${t}/artifact-components/${a}`,{method:"DELETE"})}(0,r.ensureServerEntryExports)([d,p,l,i,c]),(0,t.registerServerReference)(d,"70188ef59c59bee67531df9c7c9755412a4f4d2813",null),(0,t.registerServerReference)(p,"703b6e7ae98c0371615ec57c0482b7cc25bddec8a8",null),(0,t.registerServerReference)(l,"7015353a3551d528e8e220870dfac185e1da431faf",null),(0,t.registerServerReference)(i,"7f3afeff7be7c7ee981045324e877eb9fa24d127f6",null),(0,t.registerServerReference)(c,"7f585e5f10ce7328ac2af8ccde9561dc7dfc2c3bbf",null),e.s(["fetchArtifactComponent",0,c])},330642,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(993099),l=e.i(87690),u=e.i(761283),m=t([n]);async function g(e,t){try{var a,n,m;let g,f,h,{artifactComponentId: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 T=await (0,u.requireApiRouteProjectPermission)(e,{tenantId:R,projectId:x,level:"edit"});if(!T.ok)return T.response;let v=await (0,p.fetchArtifactComponent)(R,x,b);if(!v)return new Response("Artifact 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 S=w.data;if(!S.models?.base)return new Response("Project base model configuration is required",{status:400});let C=(a=v,n=y,m=E,g=a.props||{},f=JSON.stringify(g,null,2),h=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: ${h}
- Description: ${a.description}
- Props Schema (JSON Schema): ${f}

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: ${h}
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 ${h}(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 artifact data and sample data to preview it.

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

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 artifact display - focus on showcasing structured artifact information:
   - Display artifact properties clearly and attractively
   - Use appropriate icons to represent different types of artifacts
   - Consider the artifact might represent citations, documents, media, or other structured content
   - Make it suitable for embedding in conversations or content flows
5. Use LUCIDE-REACT ICONS to enhance UI aesthetics:
   - Import icons from lucide-react: import { FileText, Link, Calendar, User } 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: <FileText className="size-4" /> or <Link className="size-4 text-muted-foreground" />
   - Common useful icons: FileText, Link, Calendar, User, Tag, MapPin, Clock, Star, 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: ${h}

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 an artifact with title, url, type):
{
  "component": "import { FileText, Link } from 'lucide-react';\\n\\nfunction ${h}(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        <FileText className=\\"size-4 text-muted-foreground\\" />\\n        <span className=\\"text-base font-medium text-foreground\\">{props.title}</span>\\n      </div>\\n      <div className=\\"flex items-center gap-2 text-sm text-muted-foreground\\">\\n        <Link className=\\"size-4\\" />\\n        <span>{props.url}</span>\\n      </div>\\n      <div className=\\"text-xs text-muted-foreground mt-2\\">Type: {props.type}</div>\\n    </div>\\n  );\\n}",
  "mockData": {
    "title": "React Best Practices Guide",
    "url": "https://example.com/react-guide",
    "type": "documentation"
  }
}

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 artifact representation
- Focus on displaying structured artifact data clearly
- Design for embedding - this blends into existing content
- Make the sample data realistic and useful for previewing the component`),O=o.ModelFactory.prepareGenerationConfig(S.models?.base),N=v.props?d.z.fromJSONSchema((0,i.normalizeDataComponentSchema)(v.props)):d.z.string(),A=d.z.object({component:d.z.string().describe("The React component code"),mockData:N.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()),M=s.context.with(s.propagation.setBaggage(s.context.active(),k),()=>(0,c.streamText)({...O,prompt:C,output:c.Output.object({schema:A}),temperature:.7,experimental_telemetry:{isEnabled:!0,metadata:{tenantId:R,projectId:x,generationType:r.GENERATION_TYPES.COMPONENT_RENDER}}})),P=E&&v.render&&"object"==typeof v.render&&"mockData"in v.render?v.render.mockData:null,U=new ReadableStream({async start(e){try{for await(let t of M.partialOutputStream){let a=y&&P?{...t,mockData:P}: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(U,{headers:{"Content-Type":"application/x-ndjson","Transfer-Encoding":"chunked","Cache-Control":"no-cache"}})}catch(e){return console.error("Error generating artifact 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),723,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),f=e.i(794380),h=e.i(850173),b=e.i(544257),R=e.i(193695);e.i(370790);var x=e.i(64123),y=e.i(330642),E=t([y]);[y]=E.then?(await E)():E;let v=new n.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/artifact-components/[artifactComponentId]/generate-render/route",pathname:"/api/artifact-components/[artifactComponentId]/generate-render",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/agents-manage-ui/src/app/api/artifact-components/[artifactComponentId]/generate-render/route.ts",nextConfigOutput:"standalone",userland:y,...{}}),{workAsyncStorage:w,workUnitAsyncStorage:S,serverHooks:C}=v;async function T(e,t,a){a.requestMeta&&(0,i.setRequestMeta)(e,a.requestMeta),v.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let n="/api/artifact-components/[artifactComponentId]/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:T,nextConfig:w,parsedUrl:S,isDraftMode:C,prerenderManifest:O,routerServerContext:N,isOnDemandRevalidate:A,revalidateOnlyGenerated:k,resolvedPathname:M,clientReferenceManifest:P,serverActionsManifest:U}=o,I=(0,d.normalizeAppPath)(n),D=!!(O.dynamicRoutes[I]||O.routes[M]),$=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,S,!1):t.end("This page could not be found"),null);if(D&&!C){let e=!!O.routes[M],t=O.dynamicRoutes[I];if(t&&!1===t.fallback&&!e){if(w.adapterPath)return await $();throw new R.NoFallbackError}}let j=null;!D||v.isDev||C||(j=M,j="/index"===j?"/":j);let q=!0===v.isDev||!D,L=D&&!q;U&&P&&(0,c.setManifestsSingleton)({page:n,clientReferenceManifest:P,serverActionsManifest:U});let _=e.method||"GET",F=(0,s.getTracer)(),H=F.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,O,z);null==J||J.resetRequestCache(),globalThis.__incrementalCache=J;let K={params:T,previewProps:O.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),G=new p.NodeNextResponse(t),X=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(t));try{let o,i=async e=>v.handle(X,K).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let a=F.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=`${_} ${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(`${_} ${n}`)}),c=async o=>{var s,c;let d=async({previousCacheEntry:r})=>{try{if(!z&&A&&k&&!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,G,n,K.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,f.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:L,isOnDemandRevalidate:A})},!1,N),t}},p=await v.handleResponse({req:e,nextConfig:w,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:k,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"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,f.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,h.getCacheControlHeader)(p.cacheControl)),await (0,g.sendResponse)(Y,G,new Response(p.value.body,{headers:l,status:p.value.status||200})),null};B&&H?await c(H):(o=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(u.BaseServerSpan.handleRequest,{spanName:`${_} ${n}`,kind:s.SpanKind.SERVER,attributes:{"http.method":_,"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:L,isOnDemandRevalidate:A})},!1,N),D)throw t;return await (0,g.sendResponse)(Y,G,new Response(null,{status:500})),null}}e.s(["handler",0,T,"patchFetch",0,function(){return(0,o.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:S})},"routeModule",0,v,"serverHooks",0,C,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,S]),a()}catch(e){a(e)}},!1)];

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